5940 lines
209 KiB
JavaScript
5940 lines
209 KiB
JavaScript
// ==UserScript==
|
||
// @name 3CX TAPI
|
||
// @namespace http://cp-solutions.at
|
||
// @version 7.0.3
|
||
// @author Daniel Triendl <d.triendl@cp-solutions.at>
|
||
// @copyright Copyright 2020 CP Solutions GmbH
|
||
// @source http://scootaloo.cp-austria.at/gitlist/3cx_tapi.git
|
||
// @downloadURL http://scootaloo.cp-austria.at/gitlist/3cx_tapi.git/raw/master/3CX_TAPI.user.js
|
||
// @match https://192.168.0.154:5001/webclient*
|
||
// @match https://cpsolution.my3cx.at:5001/webclient*
|
||
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.2/waitForKeyElements.js
|
||
// @require https://cdn.jsdelivr.net/npm/axios@0.20.0/dist/axios.min.js
|
||
// @require https://cdn.jsdelivr.net/npm/axios-userscript-adapter@0.0.7/dist/axiosGmxhrAdapter.min.js
|
||
// @grant GM_xmlhttpRequest
|
||
// @grant GM.notification
|
||
// @connect cpatapi.cpsrvweb2016.cp-austria.at
|
||
// @run-at document-end
|
||
// ==/UserScript==
|
||
|
||
/******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId]) {
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ i: moduleId,
|
||
/******/ l: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.l = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // define getter function for harmony exports
|
||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = function(exports) {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/
|
||
/******/ // create a fake namespace object
|
||
/******/ // mode & 1: value is a module id, require it
|
||
/******/ // mode & 2: merge all properties of value into the ns
|
||
/******/ // mode & 4: return value when already ns object
|
||
/******/ // mode & 8|1: behave like require
|
||
/******/ __webpack_require__.t = function(value, mode) {
|
||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||
/******/ if(mode & 8) return value;
|
||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||
/******/ var ns = Object.create(null);
|
||
/******/ __webpack_require__.r(ns);
|
||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||
/******/ return ns;
|
||
/******/ };
|
||
/******/
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = function(module) {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ function getDefault() { return module['default']; } :
|
||
/******/ function getModuleExports() { return module; };
|
||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/
|
||
/******/ // Object.prototype.hasOwnProperty.call
|
||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = "e6Wu");
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ({
|
||
|
||
/***/ "+7KC":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
class ENTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return new RegExp(`(?:binnen|in)\\s*` + "(" + constants_1.TIME_UNITS_PATTERN + ")" + `(?=\\W|$)`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_1.parseTimeUnits(match[1]);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
}
|
||
exports.default = ENTimeUnitWithinFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "/+Lf":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractTimeExpressionParser_1 = __webpack_require__("MXb4");
|
||
const index_1 = __webpack_require__("6EsV");
|
||
class DETimeExpressionParser extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
|
||
primaryPrefix() {
|
||
return "(?:(?:um|von)\\s*)?";
|
||
}
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|bis)\\s*";
|
||
}
|
||
primarySuffix() {
|
||
return "(?:\\s*uhr)?(?:\\s*(?:morgens|vormittags|nachmittags|abends|nachts))?(?=\\W|$)";
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
const components = super.extractPrimaryTimeComponents(context, match);
|
||
if (components) {
|
||
if (match[0].endsWith("morgens") || match[0].endsWith("vormittags")) {
|
||
components.assign("meridiem", index_1.Meridiem.AM);
|
||
const hour = components.get("hour");
|
||
if (hour < 12) {
|
||
components.assign("hour", components.get("hour"));
|
||
}
|
||
}
|
||
if (match[0].endsWith("nachmittags") || match[0].endsWith("abends") || match[0].endsWith("nachts")) {
|
||
components.assign("meridiem", index_1.Meridiem.PM);
|
||
const hour = components.get("hour");
|
||
if (hour < 12) {
|
||
components.assign("hour", components.get("hour") + 12);
|
||
}
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = DETimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "2Ry0":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class NLMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(tot|-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = NLMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "2wHU":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const abstractRefiners_1 = __webpack_require__("LMHj");
|
||
class UnlikelyFormatFilter extends abstractRefiners_1.Filter {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
isValid(context, result) {
|
||
if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) {
|
||
context.debug(() => {
|
||
console.log(`Removing unlikely result '${result.text}'`);
|
||
});
|
||
return false;
|
||
}
|
||
if (!result.start.isValidDate()) {
|
||
context.debug(() => {
|
||
console.log(`Removing invalid result: ${result} (${result.start})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (result.end && !result.end.isValidDate()) {
|
||
context.debug(() => {
|
||
console.log(`Removing invalid result: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (this.strictMode) {
|
||
return this.isStrictModeValid(context, result);
|
||
}
|
||
return true;
|
||
}
|
||
isStrictModeValid(context, result) {
|
||
if (result.start.isOnlyWeekdayComponent()) {
|
||
context.debug(() => {
|
||
console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) {
|
||
context.debug(() => {
|
||
console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
exports.default = UnlikelyFormatFilter;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "3Niq":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class JPMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(から|ー|-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = JPMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "4LgJ":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
class OverlapRemovalRefiner {
|
||
refine(context, results) {
|
||
if (results.length < 2) {
|
||
return results;
|
||
}
|
||
const filteredResults = [];
|
||
let prevResult = results[0];
|
||
for (let i = 1; i < results.length; i++) {
|
||
const result = results[i];
|
||
if (result.index < prevResult.index + prevResult.text.length) {
|
||
if (result.text.length > prevResult.text.length) {
|
||
prevResult = result;
|
||
}
|
||
}
|
||
else {
|
||
filteredResults.push(prevResult);
|
||
prevResult = result;
|
||
}
|
||
}
|
||
if (prevResult != null) {
|
||
filteredResults.push(prevResult);
|
||
}
|
||
return filteredResults;
|
||
}
|
||
}
|
||
exports.default = OverlapRemovalRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "4UVn":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("" + "(" + constants_1.TIME_UNITS_PATTERN + ")" + "(later|after|from now|henceforth|forward|out)" + "(?=(?:\\W|$))", "i");
|
||
const STRICT_PATTERN = new RegExp("" + "(" + constants_1.TIME_UNITS_PATTERN + ")" + "(later|from now)" + "(?=(?:\\W|$))", "i");
|
||
const GROUP_NUM_TIMEUNITS = 1;
|
||
class ENTimeUnitLaterFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
innerPattern() {
|
||
return this.strictMode ? STRICT_PATTERN : PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const fragments = constants_1.parseTimeUnits(match[GROUP_NUM_TIMEUNITS]);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, fragments);
|
||
}
|
||
}
|
||
exports.default = ENTimeUnitLaterFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "4W4v":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
class FRCasualTimeParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const suffixLower = match[2].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (suffixLower) {
|
||
case "après-midi":
|
||
case "aprem":
|
||
component.imply("hour", 14);
|
||
component.imply("minute", 0);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
break;
|
||
case "soir":
|
||
component.imply("hour", 18);
|
||
component.imply("minute", 0);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
break;
|
||
case "matin":
|
||
component.imply("hour", 8);
|
||
component.imply("minute", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
case "a midi":
|
||
component.imply("hour", 12);
|
||
component.imply("minute", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
case "à minuit":
|
||
component.imply("hour", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = FRCasualTimeParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "4caT":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const FIRST_REG_PATTERN = new RegExp("(^|\\s|T)" +
|
||
"(?:(?:[àa])\\s*)?" +
|
||
"(\\d{1,2})(?:h|:)?" +
|
||
"(?:(\\d{1,2})(?:m|:)?)?" +
|
||
"(?:(\\d{1,2})(?:s|:)?)?" +
|
||
"(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?" +
|
||
"(?=\\W|$)", "i");
|
||
const SECOND_REG_PATTERN = new RegExp("^\\s*(\\-|\\–|\\~|\\〜|[àa]|\\?)\\s*" +
|
||
"(\\d{1,2})(?:h|:)?" +
|
||
"(?:(\\d{1,2})(?:m|:)?)?" +
|
||
"(?:(\\d{1,2})(?:s|:)?)?" +
|
||
"(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?" +
|
||
"(?=\\W|$)", "i");
|
||
const HOUR_GROUP = 2;
|
||
const MINUTE_GROUP = 3;
|
||
const SECOND_GROUP = 4;
|
||
const AM_PM_HOUR_GROUP = 5;
|
||
class FRSpecificTimeExpressionParser {
|
||
pattern(context) {
|
||
return FIRST_REG_PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
let result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length));
|
||
if (result.text.match(/^\d{4}$/)) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
result.start = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match);
|
||
if (!result.start) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
const remainingText = context.text.substring(match.index + match[0].length);
|
||
const secondMatch = SECOND_REG_PATTERN.exec(remainingText);
|
||
if (secondMatch) {
|
||
result.end = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch);
|
||
if (result.end) {
|
||
result.text += secondMatch[0];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
static extractTimeComponent(extractingComponents, match) {
|
||
let hour = 0;
|
||
let minute = 0;
|
||
let meridiem = null;
|
||
hour = parseInt(match[HOUR_GROUP]);
|
||
if (match[MINUTE_GROUP] != null) {
|
||
minute = parseInt(match[MINUTE_GROUP]);
|
||
}
|
||
if (minute >= 60 || hour > 24) {
|
||
return null;
|
||
}
|
||
if (hour >= 12) {
|
||
meridiem = index_1.Meridiem.PM;
|
||
}
|
||
if (match[AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12)
|
||
return null;
|
||
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
||
if (ampm == "a") {
|
||
meridiem = index_1.Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
}
|
||
}
|
||
if (ampm == "p") {
|
||
meridiem = index_1.Meridiem.PM;
|
||
if (hour != 12) {
|
||
hour += 12;
|
||
}
|
||
}
|
||
}
|
||
extractingComponents.assign("hour", hour);
|
||
extractingComponents.assign("minute", minute);
|
||
if (meridiem !== null) {
|
||
extractingComponents.assign("meridiem", meridiem);
|
||
}
|
||
else {
|
||
if (hour < 12) {
|
||
extractingComponents.imply("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
else {
|
||
extractingComponents.imply("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
}
|
||
if (match[SECOND_GROUP] != null) {
|
||
const second = parseInt(match[SECOND_GROUP]);
|
||
if (second >= 60)
|
||
return null;
|
||
extractingComponents.assign("second", second);
|
||
}
|
||
return extractingComponents;
|
||
}
|
||
}
|
||
exports.default = FRSpecificTimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "4po4":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("Gqx+"));
|
||
class ENMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$");
|
||
}
|
||
}
|
||
exports.default = ENMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "5Jgo":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const PATTERN = new RegExp("([^\\d]|^)" +
|
||
"([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})" +
|
||
"(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?" +
|
||
"(\\W|$)", "i");
|
||
const OPENING_GROUP = 1;
|
||
const ENDING_GROUP = 5;
|
||
const FIRST_NUMBERS_GROUP = 2;
|
||
const SECOND_NUMBERS_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class SlashDateFormatParser {
|
||
constructor(littleEndian) {
|
||
this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP;
|
||
this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP;
|
||
}
|
||
pattern() {
|
||
return PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
if (match[OPENING_GROUP] == "/" || match[ENDING_GROUP] == "/") {
|
||
match.index += match[0].length;
|
||
return;
|
||
}
|
||
const index = match.index + match[OPENING_GROUP].length;
|
||
const text = match[0].substr(match[OPENING_GROUP].length, match[0].length - match[OPENING_GROUP].length - match[ENDING_GROUP].length);
|
||
if (text.match(/^\d\.\d$/) || text.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) {
|
||
return;
|
||
}
|
||
if (!match[YEAR_GROUP] && match[0].indexOf("/") < 0) {
|
||
return;
|
||
}
|
||
const result = context.createParsingResult(index, text);
|
||
let month = parseInt(match[this.groupNumberMonth]);
|
||
let day = parseInt(match[this.groupNumberDay]);
|
||
if (month < 1 || month > 12) {
|
||
if (month > 12) {
|
||
if (day >= 1 && day <= 12 && month <= 31) {
|
||
[day, month] = [month, day];
|
||
}
|
||
else {
|
||
return null;
|
||
}
|
||
}
|
||
}
|
||
if (day < 1 || day > 31) {
|
||
return null;
|
||
}
|
||
result.start.assign("day", day);
|
||
result.start.assign("month", month);
|
||
if (match[YEAR_GROUP]) {
|
||
const rawYearNumber = parseInt(match[YEAR_GROUP]);
|
||
const year = years_1.findMostLikelyADYear(rawYearNumber);
|
||
result.start.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = SlashDateFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "6EsV":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.nl = exports.pt = exports.ja = exports.fr = exports.de = exports.Meridiem = exports.parseDate = exports.parse = exports.casual = exports.strict = exports.Chrono = exports.en = void 0;
|
||
const en = __importStar(__webpack_require__("Kxbc"));
|
||
exports.en = en;
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
Object.defineProperty(exports, "Chrono", { enumerable: true, get: function () { return chrono_1.Chrono; } });
|
||
exports.strict = en.strict;
|
||
exports.casual = en.casual;
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
var Meridiem;
|
||
(function (Meridiem) {
|
||
Meridiem[Meridiem["AM"] = 0] = "AM";
|
||
Meridiem[Meridiem["PM"] = 1] = "PM";
|
||
})(Meridiem = exports.Meridiem || (exports.Meridiem = {}));
|
||
const de = __importStar(__webpack_require__("Dtl+"));
|
||
exports.de = de;
|
||
const fr = __importStar(__webpack_require__("yRC8"));
|
||
exports.fr = fr;
|
||
const ja = __importStar(__webpack_require__("G4RC"));
|
||
exports.ja = ja;
|
||
const pt = __importStar(__webpack_require__("UK2x"));
|
||
exports.pt = pt;
|
||
const nl = __importStar(__webpack_require__("a+SU"));
|
||
exports.nl = nl;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "6IGW":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
exports.WEEKDAY_DICTIONARY = {
|
||
"sonntag": 0,
|
||
"so": 0,
|
||
"montag": 1,
|
||
"mo": 1,
|
||
"dienstag": 2,
|
||
"di": 2,
|
||
"mittwoch": 3,
|
||
"mi": 3,
|
||
"donnerstag": 4,
|
||
"do": 4,
|
||
"freitag": 5,
|
||
"fr": 5,
|
||
"samstag": 6,
|
||
"sa": 6,
|
||
};
|
||
exports.MONTH_DICTIONARY = {
|
||
"januar": 1,
|
||
"jan": 1,
|
||
"jan.": 1,
|
||
"februar": 2,
|
||
"feb": 2,
|
||
"feb.": 2,
|
||
"märz": 3,
|
||
"maerz": 3,
|
||
"mär": 3,
|
||
"mär.": 3,
|
||
"mrz": 3,
|
||
"mrz.": 3,
|
||
"april": 4,
|
||
"apr": 4,
|
||
"apr.": 4,
|
||
"mai": 5,
|
||
"juni": 6,
|
||
"jun": 6,
|
||
"jun.": 6,
|
||
"juli": 7,
|
||
"jul": 7,
|
||
"jul.": 7,
|
||
"august": 8,
|
||
"aug": 8,
|
||
"aug.": 8,
|
||
"september": 9,
|
||
"sep": 9,
|
||
"sep.": 9,
|
||
"sept": 9,
|
||
"sept.": 9,
|
||
"oktober": 10,
|
||
"okt": 10,
|
||
"okt.": 10,
|
||
"november": 11,
|
||
"nov": 11,
|
||
"nov.": 11,
|
||
"dezember": 12,
|
||
"dez": 12,
|
||
"dez.": 12,
|
||
};
|
||
exports.INTEGER_WORD_DICTIONARY = {
|
||
"eins": 1,
|
||
"zwei": 2,
|
||
"drei": 3,
|
||
"vier": 4,
|
||
"fünf": 5,
|
||
"fuenf": 5,
|
||
"sechs": 6,
|
||
"sieben": 7,
|
||
"acht": 8,
|
||
"neun": 9,
|
||
"zehn": 10,
|
||
"elf": 11,
|
||
"zwölf": 12,
|
||
"zwoelf": 12,
|
||
};
|
||
exports.TIME_UNIT_DICTIONARY = {
|
||
sec: "second",
|
||
second: "second",
|
||
seconds: "second",
|
||
min: "minute",
|
||
mins: "minute",
|
||
minute: "minute",
|
||
minutes: "minute",
|
||
h: "hour",
|
||
hr: "hour",
|
||
hrs: "hour",
|
||
hour: "hour",
|
||
hours: "hour",
|
||
day: "d",
|
||
days: "d",
|
||
week: "week",
|
||
weeks: "week",
|
||
month: "month",
|
||
months: "month",
|
||
y: "year",
|
||
yr: "year",
|
||
year: "year",
|
||
years: "year",
|
||
};
|
||
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
|
||
function parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.INTEGER_WORD_DICTIONARY[num];
|
||
}
|
||
else if (num === "a" || num === "an") {
|
||
return 1;
|
||
}
|
||
else if (num.match(/few/)) {
|
||
return 3;
|
||
}
|
||
else if (num.match(/half/)) {
|
||
return 0.5;
|
||
}
|
||
else if (num.match(/couple/)) {
|
||
return 2;
|
||
}
|
||
else if (num.match(/several/)) {
|
||
return 7;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
exports.parseNumberPattern = parseNumberPattern;
|
||
exports.YEAR_PATTERN = `(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*C(?:hr)?\\.?)?)`;
|
||
function parseYear(match) {
|
||
if (/v/i.test(match)) {
|
||
return -parseInt(match.replace(/[^0-9]+/gi, ""));
|
||
}
|
||
if (/n/i.test(match)) {
|
||
return parseInt(match.replace(/[^0-9]+/gi, ""));
|
||
}
|
||
const rawYearNumber = parseInt(match);
|
||
return years_1.findMostLikelyADYear(rawYearNumber);
|
||
}
|
||
exports.parseYear = parseYear;
|
||
const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s*(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s*`;
|
||
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE = SINGLE_TIME_UNIT_PATTERN.replace(/\((?!\?)/g, "(?:");
|
||
exports.TIME_UNITS_PATTERN = `(?:(?:about|around)\\s*)?` +
|
||
`${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE}\\s*(?:,?\\s*${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE})*`;
|
||
function parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length);
|
||
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
exports.parseTimeUnits = parseTimeUnits;
|
||
function collectDateTimeFragment(fragments, match) {
|
||
const num = parseNumberPattern(match[1]);
|
||
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "7zy1":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})" + "", "i");
|
||
const MONTH_GROUP = 1;
|
||
const YEAR_GROUP = 2;
|
||
class ENSlashMonthFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const year = parseInt(match[YEAR_GROUP]);
|
||
const month = parseInt(match[MONTH_GROUP]);
|
||
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
|
||
}
|
||
}
|
||
exports.default = ENSlashMonthFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "ARTj":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
exports.WEEKDAY_DICTIONARY = {
|
||
"dimanche": 0,
|
||
"dim": 0,
|
||
"lundi": 1,
|
||
"lun": 1,
|
||
"mardi": 2,
|
||
"mar": 2,
|
||
"mercredi": 3,
|
||
"mer": 3,
|
||
"jeudi": 4,
|
||
"jeu": 4,
|
||
"vendredi": 5,
|
||
"ven": 5,
|
||
"samedi": 6,
|
||
"sam": 6,
|
||
};
|
||
exports.MONTH_DICTIONARY = {
|
||
"janvier": 1,
|
||
"jan": 1,
|
||
"jan.": 1,
|
||
"février": 2,
|
||
"fév": 2,
|
||
"fév.": 2,
|
||
"fevrier": 2,
|
||
"fev": 2,
|
||
"fev.": 2,
|
||
"mars": 3,
|
||
"mar": 3,
|
||
"mar.": 3,
|
||
"avril": 4,
|
||
"avr": 4,
|
||
"avr.": 4,
|
||
"mai": 5,
|
||
"juin": 6,
|
||
"jun": 6,
|
||
"juillet": 7,
|
||
"juil": 7,
|
||
"jul": 7,
|
||
"jul.": 7,
|
||
"août": 8,
|
||
"aout": 8,
|
||
"septembre": 9,
|
||
"sep": 9,
|
||
"sep.": 9,
|
||
"sept": 9,
|
||
"sept.": 9,
|
||
"octobre": 10,
|
||
"oct": 10,
|
||
"oct.": 10,
|
||
"novembre": 11,
|
||
"nov": 11,
|
||
"nov.": 11,
|
||
"décembre": 12,
|
||
"decembre": 12,
|
||
"dec": 12,
|
||
"dec.": 12,
|
||
};
|
||
exports.INTEGER_WORD_DICTIONARY = {
|
||
"un": 1,
|
||
"deux": 2,
|
||
"trois": 3,
|
||
"quatre": 4,
|
||
"cinq": 5,
|
||
"six": 6,
|
||
"sept": 7,
|
||
"huit": 8,
|
||
"neuf": 9,
|
||
"dix": 10,
|
||
"onze": 11,
|
||
"douze": 12,
|
||
"treize": 13,
|
||
};
|
||
exports.TIME_UNIT_DICTIONARY = {
|
||
"sec": "second",
|
||
"seconde": "second",
|
||
"secondes": "second",
|
||
"min": "minute",
|
||
"mins": "minute",
|
||
"minute": "minute",
|
||
"minutes": "minute",
|
||
"h": "hour",
|
||
"hr": "hour",
|
||
"hrs": "hour",
|
||
"heure": "hour",
|
||
"heures": "hour",
|
||
"jour": "d",
|
||
"jours": "d",
|
||
"semaine": "week",
|
||
"semaines": "week",
|
||
"mois": "month",
|
||
"trimestre": "quarter",
|
||
"trimestres": "quarter",
|
||
"ans": "year",
|
||
"année": "year",
|
||
"années": "year",
|
||
};
|
||
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|une?|quelques?|demi-?)`;
|
||
function parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.INTEGER_WORD_DICTIONARY[num];
|
||
}
|
||
else if (num === "une" || num === "un") {
|
||
return 1;
|
||
}
|
||
else if (num.match(/quelques?/)) {
|
||
return 3;
|
||
}
|
||
else if (num.match(/demi-?/)) {
|
||
return 0.5;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
exports.parseNumberPattern = parseNumberPattern;
|
||
exports.ORDINAL_NUMBER_PATTERN = `(?:[0-9]{1,2}(?:er)?)`;
|
||
function parseOrdinalNumberPattern(match) {
|
||
let num = match.toLowerCase();
|
||
num = num.replace(/(?:er)$/i, "");
|
||
return parseInt(num);
|
||
}
|
||
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
|
||
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])`;
|
||
function parseYear(match) {
|
||
if (/AC/i.test(match)) {
|
||
match = match.replace(/BC/i, "");
|
||
return -parseInt(match);
|
||
}
|
||
if (/AD/i.test(match) || /C/i.test(match)) {
|
||
match = match.replace(/[^\d]+/i, "");
|
||
return parseInt(match);
|
||
}
|
||
let yearNumber = parseInt(match);
|
||
if (yearNumber < 100) {
|
||
if (yearNumber > 50) {
|
||
yearNumber = yearNumber + 1900;
|
||
}
|
||
else {
|
||
yearNumber = yearNumber + 2000;
|
||
}
|
||
}
|
||
return yearNumber;
|
||
}
|
||
exports.parseYear = parseYear;
|
||
const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s*(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s*`;
|
||
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE = SINGLE_TIME_UNIT_PATTERN.replace(/\((?!\?)/g, "(?:");
|
||
exports.TIME_UNITS_PATTERN = `(?:${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE})+`;
|
||
function parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length);
|
||
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
exports.parseTimeUnits = parseTimeUnits;
|
||
function collectDateTimeFragment(fragments, match) {
|
||
const num = parseNumberPattern(match[1]);
|
||
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "CFBl":
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = axiosGmxhrAdapter;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Dtl+":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
|
||
const configurations_1 = __webpack_require__("HskP");
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
const SlashDateFormatParser_1 = __importDefault(__webpack_require__("5Jgo"));
|
||
const ISOFormatParser_1 = __importDefault(__webpack_require__("JRQV"));
|
||
const DETimeExpressionParser_1 = __importDefault(__webpack_require__("/+Lf"));
|
||
const DEWeekdayParser_1 = __importDefault(__webpack_require__("M7Pc"));
|
||
const DEMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("Mrws"));
|
||
const DEMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("XDfb"));
|
||
const DECasualDateParser_1 = __importDefault(__webpack_require__("zUpm"));
|
||
const DECasualTimeParser_1 = __importDefault(__webpack_require__("r8Bu"));
|
||
const DEMonthNameLittleEndianParser_1 = __importDefault(__webpack_require__("V0tS"));
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
|
||
exports.strict = new chrono_1.Chrono(createConfiguration(true));
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration(littleEndian = true) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new DECasualTimeParser_1.default());
|
||
option.parsers.unshift(new DECasualDateParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration(strictMode = true, littleEndian = true) {
|
||
return configurations_1.includeCommonConfiguration({
|
||
parsers: [
|
||
new ISOFormatParser_1.default(),
|
||
new SlashDateFormatParser_1.default(littleEndian),
|
||
new DETimeExpressionParser_1.default(),
|
||
new DEMonthNameLittleEndianParser_1.default(),
|
||
new DEWeekdayParser_1.default(),
|
||
],
|
||
refiners: [new DEMergeDateRangeRefiner_1.default(), new DEMergeDateTimeRefiner_1.default()],
|
||
}, strictMode);
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "EHvs":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const constants_2 = __webpack_require__("ksW2");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
"\\s*" +
|
||
"(?:" +
|
||
`[,-]?\\s*(${constants_2.YEAR_PATTERN})?` +
|
||
")?" +
|
||
"(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)", "i");
|
||
const MONTH_NAME_GROUP = 1;
|
||
const YEAR_GROUP = 2;
|
||
class ENMonthNameParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
if (match[0].length <= 3) {
|
||
return null;
|
||
}
|
||
const components = context.createParsingComponents();
|
||
components.imply("day", 1);
|
||
const monthName = match[MONTH_NAME_GROUP];
|
||
const month = constants_1.MONTH_DICTIONARY[monthName.toLowerCase()];
|
||
components.assign("month", month);
|
||
if (match[YEAR_GROUP]) {
|
||
const year = constants_2.parseYear(match[YEAR_GROUP]);
|
||
components.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, 1, month);
|
||
components.imply("year", year);
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = ENMonthNameParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "EJGC":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class ENMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(to|-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = ENMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "EiDA":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
class ENCasualTimeParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return /(?:this)?\s*(morning|afternoon|evening|night|midnight|noon)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const targetDate = dayjs_1.default(context.refDate);
|
||
const component = context.createParsingComponents();
|
||
switch (match[1].toLowerCase()) {
|
||
case "afternoon":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 15);
|
||
break;
|
||
case "evening":
|
||
case "night":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 20);
|
||
break;
|
||
case "midnight":
|
||
dayjs_2.assignTheNextDay(component, targetDate);
|
||
component.imply("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
break;
|
||
case "morning":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 6);
|
||
break;
|
||
case "noon":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 12);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = ENCasualTimeParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "FDV4":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const constants_2 = __webpack_require__("ksW2");
|
||
const constants_3 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
"(?:-|/|\\s*,?\\s*)" +
|
||
`(${constants_2.ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*` +
|
||
"(?:" +
|
||
"(?:to|\\-)\\s*" +
|
||
`(${constants_2.ORDINAL_NUMBER_PATTERN})\\s*` +
|
||
")?" +
|
||
"(?:" +
|
||
"(?:-|/|\\s*,?\\s*)" +
|
||
`(${constants_3.YEAR_PATTERN})` +
|
||
")?" +
|
||
"(?=\\W|$)(?!\\:\\d)", "i");
|
||
const MONTH_NAME_GROUP = 1;
|
||
const DATE_GROUP = 2;
|
||
const DATE_TO_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class ENMonthNameMiddleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
return null;
|
||
}
|
||
const components = context.createParsingComponents({
|
||
day: day,
|
||
month: month,
|
||
});
|
||
if (match[YEAR_GROUP]) {
|
||
const year = constants_3.parseYear(match[YEAR_GROUP]);
|
||
components.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
components.imply("year", year);
|
||
}
|
||
if (!match[DATE_TO_GROUP]) {
|
||
return components;
|
||
}
|
||
const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
result.start = components;
|
||
result.end = components.clone();
|
||
result.end.assign("day", endDate);
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = ENMonthNameMiddleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "G4RC":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
|
||
const JPStandardParser_1 = __importDefault(__webpack_require__("LvKx"));
|
||
const JPMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("3Niq"));
|
||
const JPCasualDateParser_1 = __importDefault(__webpack_require__("OOKS"));
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
|
||
exports.strict = new chrono_1.Chrono(createConfiguration());
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration() {
|
||
const option = createConfiguration();
|
||
option.parsers.unshift(new JPCasualDateParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration() {
|
||
return {
|
||
parsers: [new JPStandardParser_1.default()],
|
||
refiners: [new JPMergeDateRangeRefiner_1.default()],
|
||
};
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "G6Ui":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
exports.WEEKDAY_DICTIONARY = {
|
||
zondag: 0,
|
||
zon: 0,
|
||
"zon.": 0,
|
||
zo: 0,
|
||
"zo.": 0,
|
||
maandag: 1,
|
||
ma: 1,
|
||
"ma.": 1,
|
||
dinsdag: 2,
|
||
din: 2,
|
||
"din.": 2,
|
||
di: 2,
|
||
"di.": 2,
|
||
woensdag: 3,
|
||
woe: 3,
|
||
"woe.": 3,
|
||
wo: 3,
|
||
"wo.": 3,
|
||
donderdag: 4,
|
||
dond: 4,
|
||
"dond.": 4,
|
||
do: 4,
|
||
"do.": 4,
|
||
vrijdag: 5,
|
||
vrij: 5,
|
||
"vrij.": 5,
|
||
vr: 5,
|
||
"vr.": 5,
|
||
zaterdag: 6,
|
||
zat: 6,
|
||
"zat.": 6,
|
||
"za": 6,
|
||
"za.": 6,
|
||
};
|
||
exports.MONTH_DICTIONARY = {
|
||
januari: 1,
|
||
jan: 1,
|
||
"jan.": 1,
|
||
februari: 2,
|
||
feb: 2,
|
||
"feb.": 2,
|
||
maart: 3,
|
||
mar: 3,
|
||
"mar.": 3,
|
||
april: 4,
|
||
apr: 4,
|
||
"apr.": 4,
|
||
mei: 5,
|
||
juni: 6,
|
||
jun: 6,
|
||
"jun.": 6,
|
||
juli: 7,
|
||
jul: 7,
|
||
"jul.": 7,
|
||
augustus: 8,
|
||
aug: 8,
|
||
"aug.": 8,
|
||
september: 9,
|
||
sep: 9,
|
||
"sep.": 9,
|
||
sept: 9,
|
||
"sept.": 9,
|
||
oktober: 10,
|
||
okt: 10,
|
||
"okt.": 10,
|
||
november: 11,
|
||
nov: 11,
|
||
"nov.": 11,
|
||
december: 12,
|
||
dec: 12,
|
||
"dec.": 12,
|
||
};
|
||
exports.INTEGER_WORD_DICTIONARY = {
|
||
een: 1,
|
||
twee: 2,
|
||
drie: 3,
|
||
vier: 4,
|
||
vijf: 5,
|
||
zes: 6,
|
||
zeven: 7,
|
||
acht: 8,
|
||
negen: 9,
|
||
tien: 10,
|
||
elf: 11,
|
||
twaalf: 12,
|
||
};
|
||
exports.ORDINAL_WORD_DICTIONARY = {
|
||
eerste: 1,
|
||
tweede: 2,
|
||
derde: 3,
|
||
vierde: 4,
|
||
vijfde: 5,
|
||
zesde: 6,
|
||
zevende: 7,
|
||
achtste: 8,
|
||
negende: 9,
|
||
tiende: 10,
|
||
elfde: 11,
|
||
twaalfde: 12,
|
||
dertiende: 13,
|
||
veertiende: 14,
|
||
vijftiende: 15,
|
||
zestiende: 16,
|
||
zeventiende: 17,
|
||
achttiende: 18,
|
||
negentiende: 19,
|
||
twintigste: 20,
|
||
"eenentwintigste": 21,
|
||
"tweeëntwintigste": 22,
|
||
"drieentwintigste": 23,
|
||
"vierentwintigste": 24,
|
||
"vijfentwintigste": 25,
|
||
"zesentwintigste": 26,
|
||
"zevenentwintigste": 27,
|
||
"achtentwintig": 28,
|
||
"negenentwintig": 29,
|
||
"dertigste": 30,
|
||
"eenendertigste": 31,
|
||
};
|
||
exports.TIME_UNIT_DICTIONARY = {
|
||
sec: "second",
|
||
second: "second",
|
||
seconden: "second",
|
||
min: "minute",
|
||
mins: "minute",
|
||
minute: "minute",
|
||
minuten: "minute",
|
||
h: "hour",
|
||
hr: "hour",
|
||
hrs: "hour",
|
||
uur: "hour",
|
||
uren: "hour",
|
||
dag: "d",
|
||
dagen: "d",
|
||
week: "week",
|
||
weken: "week",
|
||
maand: "month",
|
||
maanden: "month",
|
||
jaar: "year",
|
||
jr: "year",
|
||
jaren: "year",
|
||
};
|
||
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|een?|halve?)`;
|
||
function parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.INTEGER_WORD_DICTIONARY[num];
|
||
}
|
||
else if (num === "een") {
|
||
return 1;
|
||
}
|
||
else if (num.match(/halve?/)) {
|
||
return 0.5;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
exports.parseNumberPattern = parseNumberPattern;
|
||
exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:ste|de)?)`;
|
||
function parseOrdinalNumberPattern(match) {
|
||
let num = match.toLowerCase();
|
||
if (exports.ORDINAL_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.ORDINAL_WORD_DICTIONARY[num];
|
||
}
|
||
num = num.replace(/(?:ste|de)$/i, "");
|
||
return parseInt(num);
|
||
}
|
||
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
|
||
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])`;
|
||
function parseYear(match) {
|
||
if (/voor Christus/i.test(match)) {
|
||
match = match.replace(/voor Christus/i, "");
|
||
return -parseInt(match);
|
||
}
|
||
if (/na Christus/i.test(match)) {
|
||
match = match.replace(/na Christus/i, "");
|
||
return parseInt(match);
|
||
}
|
||
const rawYearNumber = parseInt(match);
|
||
return years_1.findMostLikelyADYear(rawYearNumber);
|
||
}
|
||
exports.parseYear = parseYear;
|
||
const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s*(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s*`;
|
||
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE = SINGLE_TIME_UNIT_PATTERN.replace(/\((?!\?)/g, "(?:");
|
||
exports.TIME_UNITS_PATTERN = `(?:(?:about|around)\\s*)?` +
|
||
`${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE}\\s*(?:,?\\s*${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE})*`;
|
||
function parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length);
|
||
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
exports.parseTimeUnits = parseTimeUnits;
|
||
function collectDateTimeFragment(fragments, match) {
|
||
const num = parseNumberPattern(match[1]);
|
||
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "GPup":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("i3am");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const weeks_1 = __webpack_require__("mZHA");
|
||
const PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" +
|
||
"(?:(este|esta|passado|pr[oó]ximo)\\s*)?" +
|
||
`(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})` +
|
||
"(?:\\s*(?:\\,|\\)|\\)))?" +
|
||
"(?:\\s*(este|esta|passado|pr[óo]ximo)\\s*semana)?" +
|
||
"(?=\\W|\\d|$)", "i");
|
||
var PREFIX_GROUP = 1;
|
||
var WEEKDAY_GROUP = 2;
|
||
var POSTFIX_GROUP = 3;
|
||
class PTWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
|
||
if (offset === undefined) {
|
||
return null;
|
||
}
|
||
let suffix = match[POSTFIX_GROUP];
|
||
suffix = suffix || "";
|
||
suffix = suffix.toLowerCase();
|
||
const prefix = match[PREFIX_GROUP];
|
||
const postfix = match[POSTFIX_GROUP];
|
||
let norm = prefix || postfix || "";
|
||
norm = norm.toLowerCase();
|
||
let modifier = null;
|
||
if (norm == "passado") {
|
||
modifier = "this";
|
||
}
|
||
else if (norm == "próximo" || norm == "proximo") {
|
||
modifier = "next";
|
||
}
|
||
else if (norm == "este") {
|
||
modifier = "this";
|
||
}
|
||
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
|
||
return context
|
||
.createParsingComponents()
|
||
.assign("weekday", offset)
|
||
.imply("day", date.date())
|
||
.imply("month", date.month() + 1)
|
||
.imply("year", date.year());
|
||
}
|
||
}
|
||
exports.default = PTWeekdayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Gqx+":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const abstractRefiners_1 = __webpack_require__("LMHj");
|
||
const mergingCalculation_1 = __webpack_require__("apo/");
|
||
class ENMergeDateTimeRefiner extends abstractRefiners_1.MergingRefiner {
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
return (((currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime()) ||
|
||
(nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime())) &&
|
||
textBetween.match(this.patternBetween()) != null);
|
||
}
|
||
mergeResults(textBetween, currentResult, nextResult) {
|
||
const result = currentResult.start.isOnlyDate()
|
||
? mergingCalculation_1.mergeDateTimeResult(currentResult, nextResult)
|
||
: mergingCalculation_1.mergeDateTimeResult(nextResult, currentResult);
|
||
result.index = currentResult.index;
|
||
result.text = currentResult.text + textBetween + nextResult.text;
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = ENMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "HLVV":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const timeunits_1 = __webpack_require__("aWHD");
|
||
class ENTimeUnitCasualRelativeFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return new RegExp(`(this|last|past|next|\\+|-)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const prefix = match[1].toLowerCase();
|
||
let timeUnits = constants_1.parseTimeUnits(match[2]);
|
||
switch (prefix) {
|
||
case "last":
|
||
case "past":
|
||
case "-":
|
||
timeUnits = timeunits_1.reverseTimeUnits(timeUnits);
|
||
break;
|
||
}
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
}
|
||
exports.default = ENTimeUnitCasualRelativeFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "HskP":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.includeCommonConfiguration = void 0;
|
||
const ExtractTimezoneAbbrRefiner_1 = __importDefault(__webpack_require__("ylIs"));
|
||
const ExtractTimezoneOffsetRefiner_1 = __importDefault(__webpack_require__("WlKo"));
|
||
const OverlapRemovalRefiner_1 = __importDefault(__webpack_require__("4LgJ"));
|
||
const ForwardDateRefiner_1 = __importDefault(__webpack_require__("jTCZ"));
|
||
const UnlikelyFormatFilter_1 = __importDefault(__webpack_require__("2wHU"));
|
||
const ISOFormatParser_1 = __importDefault(__webpack_require__("JRQV"));
|
||
const MergeWeekdayComponentRefiner_1 = __importDefault(__webpack_require__("pC9g"));
|
||
function includeCommonConfiguration(configuration, strictMode = false) {
|
||
configuration.parsers.unshift(new ISOFormatParser_1.default());
|
||
configuration.refiners.unshift(new MergeWeekdayComponentRefiner_1.default());
|
||
configuration.refiners.unshift(new ExtractTimezoneAbbrRefiner_1.default());
|
||
configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner_1.default());
|
||
configuration.refiners.unshift(new OverlapRemovalRefiner_1.default());
|
||
configuration.refiners.push(new ForwardDateRefiner_1.default());
|
||
configuration.refiners.push(new UnlikelyFormatFilter_1.default(strictMode));
|
||
return configuration;
|
||
}
|
||
exports.includeCommonConfiguration = includeCommonConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "IT3k":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("Gqx+"));
|
||
class FRMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(T|à|a|vers|de|,|-)?\\s*$");
|
||
}
|
||
}
|
||
exports.default = FRMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "JRQV":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})" +
|
||
"(?:T" +
|
||
"([0-9]{1,2}):([0-9]{1,2})" +
|
||
"(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?" +
|
||
"(?:Z|([+-]\\d{2}):?(\\d{2})?)?" +
|
||
")?" +
|
||
"(?=\\W|$)", "i");
|
||
const YEAR_NUMBER_GROUP = 1;
|
||
const MONTH_NUMBER_GROUP = 2;
|
||
const DATE_NUMBER_GROUP = 3;
|
||
const HOUR_NUMBER_GROUP = 4;
|
||
const MINUTE_NUMBER_GROUP = 5;
|
||
const SECOND_NUMBER_GROUP = 6;
|
||
const MILLISECOND_NUMBER_GROUP = 7;
|
||
const TZD_HOUR_OFFSET_GROUP = 8;
|
||
const TZD_MINUTE_OFFSET_GROUP = 9;
|
||
class ISOFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const components = {};
|
||
components["year"] = parseInt(match[YEAR_NUMBER_GROUP]);
|
||
components["month"] = parseInt(match[MONTH_NUMBER_GROUP]);
|
||
components["day"] = parseInt(match[DATE_NUMBER_GROUP]);
|
||
if (match[HOUR_NUMBER_GROUP] != null) {
|
||
components["hour"] = parseInt(match[HOUR_NUMBER_GROUP]);
|
||
components["minute"] = parseInt(match[MINUTE_NUMBER_GROUP]);
|
||
if (match[SECOND_NUMBER_GROUP] != null) {
|
||
components["second"] = parseInt(match[SECOND_NUMBER_GROUP]);
|
||
}
|
||
if (match[MILLISECOND_NUMBER_GROUP] != null) {
|
||
components["millisecond"] = parseInt(match[MILLISECOND_NUMBER_GROUP]);
|
||
}
|
||
if (match[TZD_HOUR_OFFSET_GROUP] == null) {
|
||
components["timezoneOffset"] = 0;
|
||
}
|
||
else {
|
||
const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]);
|
||
let minuteOffset = 0;
|
||
if (match[TZD_MINUTE_OFFSET_GROUP] != null) {
|
||
minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]);
|
||
}
|
||
let offset = hourOffset * 60;
|
||
if (offset < 0) {
|
||
offset -= minuteOffset;
|
||
}
|
||
else {
|
||
offset += minuteOffset;
|
||
}
|
||
components["timezoneOffset"] = offset;
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = ISOFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "K1Nu":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
class ENCasualDateParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(nu|vandaag|vanacht|morgen|morgend|gisteren)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const lowerText = match[0].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (lowerText) {
|
||
case "nu":
|
||
return references.now(context.refDate);
|
||
case "vandaag":
|
||
return references.today(context.refDate);
|
||
case "morgen":
|
||
case "morgend":
|
||
return references.tomorrow(context.refDate);
|
||
case "gisteren":
|
||
return references.yesterday(context.refDate);
|
||
case "vanacht":
|
||
return references.tonight(context.refDate);
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = ENCasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Kxbc":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.GB = exports.strict = exports.casual = void 0;
|
||
const ENTimeUnitWithinFormatParser_1 = __importDefault(__webpack_require__("esAq"));
|
||
const ENMonthNameLittleEndianParser_1 = __importDefault(__webpack_require__("rN2S"));
|
||
const ENMonthNameMiddleEndianParser_1 = __importDefault(__webpack_require__("FDV4"));
|
||
const ENMonthNameParser_1 = __importDefault(__webpack_require__("EHvs"));
|
||
const ENCasualYearMonthDayParser_1 = __importDefault(__webpack_require__("sQQt"));
|
||
const ENSlashMonthFormatParser_1 = __importDefault(__webpack_require__("Yui3"));
|
||
const ENTimeExpressionParser_1 = __importDefault(__webpack_require__("Mecv"));
|
||
const ENTimeUnitAgoFormatParser_1 = __importDefault(__webpack_require__("uZbV"));
|
||
const ENTimeUnitLaterFormatParser_1 = __importDefault(__webpack_require__("4UVn"));
|
||
const ENMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("EJGC"));
|
||
const ENMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("4po4"));
|
||
const configurations_1 = __webpack_require__("HskP");
|
||
const ENCasualDateParser_1 = __importDefault(__webpack_require__("L9FS"));
|
||
const ENCasualTimeParser_1 = __importDefault(__webpack_require__("EiDA"));
|
||
const ENWeekdayParser_1 = __importDefault(__webpack_require__("qcEV"));
|
||
const ENRelativeDateFormatParser_1 = __importDefault(__webpack_require__("xXdI"));
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
const SlashDateFormatParser_1 = __importDefault(__webpack_require__("5Jgo"));
|
||
const ENTimeUnitCasualRelativeFormatParser_1 = __importDefault(__webpack_require__("HLVV"));
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration(false));
|
||
exports.strict = new chrono_1.Chrono(createConfiguration(true, false));
|
||
exports.GB = new chrono_1.Chrono(createConfiguration(false, true));
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration(littleEndian = false) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new ENCasualDateParser_1.default());
|
||
option.parsers.unshift(new ENCasualTimeParser_1.default());
|
||
option.parsers.unshift(new ENMonthNameParser_1.default());
|
||
option.parsers.unshift(new ENRelativeDateFormatParser_1.default());
|
||
option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration(strictMode = true, littleEndian = false) {
|
||
return configurations_1.includeCommonConfiguration({
|
||
parsers: [
|
||
new SlashDateFormatParser_1.default(littleEndian),
|
||
new ENTimeUnitWithinFormatParser_1.default(),
|
||
new ENMonthNameLittleEndianParser_1.default(),
|
||
new ENMonthNameMiddleEndianParser_1.default(),
|
||
new ENWeekdayParser_1.default(),
|
||
new ENCasualYearMonthDayParser_1.default(),
|
||
new ENSlashMonthFormatParser_1.default(),
|
||
new ENTimeExpressionParser_1.default(),
|
||
new ENTimeUnitAgoFormatParser_1.default(strictMode),
|
||
new ENTimeUnitLaterFormatParser_1.default(strictMode),
|
||
],
|
||
refiners: [new ENMergeDateTimeRefiner_1.default(), new ENMergeDateRangeRefiner_1.default()],
|
||
}, strictMode);
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "L9FS":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
class ENCasualDateParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(now|today|tonight|tomorrow|tmr|yesterday|last\s*night)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_1.default(context.refDate);
|
||
const lowerText = match[0].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (lowerText) {
|
||
case "now":
|
||
return references.now(context.refDate);
|
||
case "today":
|
||
return references.today(context.refDate);
|
||
case "yesterday":
|
||
return references.yesterday(context.refDate);
|
||
case "tomorrow":
|
||
case "tmr":
|
||
return references.tomorrow(context.refDate);
|
||
case "tonight":
|
||
return references.tonight(context.refDate);
|
||
default:
|
||
if (lowerText.match(/last\s*night/)) {
|
||
if (targetDate.hour() > 6) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
}
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 0);
|
||
}
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = ENCasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "LMHj":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.MergingRefiner = exports.Filter = void 0;
|
||
class Filter {
|
||
refine(context, results) {
|
||
return results.filter((r) => this.isValid(context, r));
|
||
}
|
||
}
|
||
exports.Filter = Filter;
|
||
class MergingRefiner {
|
||
refine(context, results) {
|
||
if (results.length < 2) {
|
||
return results;
|
||
}
|
||
const mergedResults = [];
|
||
let curResult = results[0];
|
||
let nextResult = null;
|
||
for (let i = 1; i < results.length; i++) {
|
||
nextResult = results[i];
|
||
const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index);
|
||
if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) {
|
||
mergedResults.push(curResult);
|
||
curResult = nextResult;
|
||
}
|
||
else {
|
||
const left = curResult;
|
||
const right = nextResult;
|
||
const mergedResult = this.mergeResults(textBetween, left, right, context);
|
||
context.debug(() => {
|
||
console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`);
|
||
});
|
||
curResult = mergedResult;
|
||
}
|
||
}
|
||
if (curResult != null) {
|
||
mergedResults.push(curResult);
|
||
}
|
||
return mergedResults;
|
||
}
|
||
}
|
||
exports.MergingRefiner = MergingRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "LqQ3":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
class PTCasualDateParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_1.default(context.refDate);
|
||
const lowerText = match[0].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (lowerText) {
|
||
case "agora":
|
||
return references.now(context.refDate);
|
||
case "hoje":
|
||
return references.today(context.refDate);
|
||
case "amanha":
|
||
case "amanhã":
|
||
return references.tomorrow(context.refDate);
|
||
case "ontem":
|
||
return references.yesterday(context.refDate);
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = PTCasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "LvKx":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("X82P");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const PATTERN = /(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i;
|
||
const SPECIAL_YEAR_GROUP = 1;
|
||
const TYPICAL_YEAR_GROUP = 2;
|
||
const ERA_GROUP = 3;
|
||
const YEAR_NUMBER_GROUP = 4;
|
||
const MONTH_GROUP = 5;
|
||
const DAY_GROUP = 6;
|
||
class JPStandardParser {
|
||
pattern() {
|
||
return PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
const month = parseInt(constants_1.toHankaku(match[MONTH_GROUP]));
|
||
const day = parseInt(constants_1.toHankaku(match[DAY_GROUP]));
|
||
const components = context.createParsingComponents({
|
||
day: day,
|
||
month: month,
|
||
});
|
||
if (match[SPECIAL_YEAR_GROUP] && match[SPECIAL_YEAR_GROUP].match("同|今|本")) {
|
||
const moment = dayjs_1.default(context.refDate);
|
||
components.assign("year", moment.year());
|
||
}
|
||
if (match[TYPICAL_YEAR_GROUP]) {
|
||
const yearNumText = match[YEAR_NUMBER_GROUP];
|
||
let year = yearNumText == "元" ? 1 : parseInt(constants_1.toHankaku(yearNumText));
|
||
if (match[ERA_GROUP] == "令和") {
|
||
year += 2018;
|
||
}
|
||
else if (match[ERA_GROUP] == "平成") {
|
||
year += 1988;
|
||
}
|
||
else if (match[ERA_GROUP] == "昭和") {
|
||
year += 1925;
|
||
}
|
||
components.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
components.imply("year", year);
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = JPStandardParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "M7Pc":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("6IGW");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const weeks_1 = __webpack_require__("mZHA");
|
||
const PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" +
|
||
"(?:a[mn]\\s*?)?" +
|
||
"(?:(diese[mn]|letzte[mn]|n(?:ä|ae)chste[mn])\\s*)?" +
|
||
`(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})` +
|
||
"(?:\\s*(?:\\,|\\)|\\)))?" +
|
||
"(?:\\s*(diese|letzte|n(?:ä|ae)chste)\\s*woche)?" +
|
||
"(?=\\W|$)", "i");
|
||
const PREFIX_GROUP = 1;
|
||
const SUFFIX_GROUP = 3;
|
||
const WEEKDAY_GROUP = 2;
|
||
class DEWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
|
||
const prefix = match[PREFIX_GROUP];
|
||
const postfix = match[SUFFIX_GROUP];
|
||
let modifierWord = prefix || postfix;
|
||
modifierWord = modifierWord || "";
|
||
modifierWord = modifierWord.toLowerCase();
|
||
let modifier = null;
|
||
if (modifierWord.match(/letzte/)) {
|
||
modifier = "last";
|
||
}
|
||
else if (modifierWord.match(/chste/)) {
|
||
modifier = "next";
|
||
}
|
||
else if (modifierWord.match(/diese/)) {
|
||
modifier = "this";
|
||
}
|
||
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
|
||
return context
|
||
.createParsingComponents()
|
||
.assign("weekday", offset)
|
||
.imply("day", date.date())
|
||
.imply("month", date.month() + 1)
|
||
.imply("year", date.year());
|
||
}
|
||
}
|
||
exports.default = DEWeekdayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "MVmo":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.implySimilarTime = exports.assignSimilarTime = exports.assignSimilarDate = exports.assignTheNextDay = void 0;
|
||
function assignTheNextDay(component, targetDayJs) {
|
||
if (targetDayJs.hour() > 1) {
|
||
targetDayJs = targetDayJs.add(1, "day");
|
||
assignSimilarDate(component, targetDayJs);
|
||
implySimilarTime(component, targetDayJs);
|
||
}
|
||
else {
|
||
assignSimilarDate(component, targetDayJs);
|
||
component.imply("hour", 12);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
}
|
||
}
|
||
exports.assignTheNextDay = assignTheNextDay;
|
||
function assignSimilarDate(component, targetDayJs) {
|
||
component.assign("day", targetDayJs.date());
|
||
component.assign("month", targetDayJs.month() + 1);
|
||
component.assign("year", targetDayJs.year());
|
||
}
|
||
exports.assignSimilarDate = assignSimilarDate;
|
||
function assignSimilarTime(component, targetDayJs) {
|
||
component.assign("hour", targetDayJs.hour());
|
||
component.assign("minute", targetDayJs.minute());
|
||
component.assign("second", targetDayJs.second());
|
||
component.assign("millisecond", targetDayJs.millisecond());
|
||
}
|
||
exports.assignSimilarTime = assignSimilarTime;
|
||
function implySimilarTime(component, targetDayJs) {
|
||
component.imply("hour", targetDayJs.hour());
|
||
component.imply("minute", targetDayJs.minute());
|
||
component.imply("second", targetDayJs.second());
|
||
}
|
||
exports.implySimilarTime = implySimilarTime;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "MXb4":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.AbstractTimeExpressionParser = void 0;
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
function primaryTimePattern(primaryPrefix, primarySuffix) {
|
||
return new RegExp("(^|\\s|T)" +
|
||
`${primaryPrefix}` +
|
||
"(\\d{1,4})" +
|
||
"(?:" +
|
||
"(?:\\.|\\:|\\:)(\\d{1,2})" +
|
||
"(?:" +
|
||
"(?:\\:|\\:)(\\d{2})(?:\\.(\\d{1,6}))?" +
|
||
")?" +
|
||
")?" +
|
||
"(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?" +
|
||
`${primarySuffix}`, "i");
|
||
}
|
||
function followingTimeExpression(followingPhase, followingSuffix) {
|
||
return new RegExp(`^(${followingPhase})` +
|
||
"(\\d{1,4})" +
|
||
"(?:" +
|
||
"(?:\\.|\\:|\\:)(\\d{1,2})" +
|
||
"(?:" +
|
||
"(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?" +
|
||
")?" +
|
||
")?" +
|
||
"(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?" +
|
||
`${followingSuffix}`, "i");
|
||
}
|
||
const HOUR_GROUP = 2;
|
||
const MINUTE_GROUP = 3;
|
||
const SECOND_GROUP = 4;
|
||
const MILLI_SECOND_GROUP = 5;
|
||
const AM_PM_HOUR_GROUP = 6;
|
||
class AbstractTimeExpressionParser {
|
||
primarySuffix() {
|
||
return "(?=\\W|$)";
|
||
}
|
||
followingSuffix() {
|
||
return "(?=\\W|$)";
|
||
}
|
||
pattern(context) {
|
||
return primaryTimePattern(this.primaryPrefix(), this.primarySuffix());
|
||
}
|
||
extract(context, match) {
|
||
const refDate = dayjs_1.default(context.refDate);
|
||
let result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length));
|
||
result.start.imply("day", refDate.date());
|
||
result.start.imply("month", refDate.month() + 1);
|
||
result.start.imply("year", refDate.year());
|
||
result.start = this.extractPrimaryTimeComponents(context, match);
|
||
if (!result.start) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
const remainingText = context.text.substring(match.index + match[0].length);
|
||
const followingPattern = followingTimeExpression(this.followingPhase(), this.followingSuffix());
|
||
match = followingPattern.exec(remainingText);
|
||
if (!match) {
|
||
return result;
|
||
}
|
||
if (match[0].match(/^\s*([+-])\s*\d{3,4}$/)) {
|
||
return result;
|
||
}
|
||
result.end = this.extractFollowingTimeComponents(context, match, result);
|
||
if (result.end) {
|
||
if (result.end) {
|
||
result.text += match[0];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
const components = context.createParsingComponents();
|
||
let hour = 0;
|
||
let minute = 0;
|
||
let meridiem = null;
|
||
hour = parseInt(match[HOUR_GROUP]);
|
||
if (match[MINUTE_GROUP] != null) {
|
||
minute = parseInt(match[MINUTE_GROUP]);
|
||
}
|
||
else if (hour > 100) {
|
||
minute = hour % 100;
|
||
hour = Math.floor(hour / 100);
|
||
}
|
||
if (minute >= 60 || hour > 24) {
|
||
return null;
|
||
}
|
||
if (hour > 12) {
|
||
meridiem = index_1.Meridiem.PM;
|
||
}
|
||
if (match[AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12)
|
||
return null;
|
||
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
||
if (ampm == "a") {
|
||
meridiem = index_1.Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
}
|
||
}
|
||
if (ampm == "p") {
|
||
meridiem = index_1.Meridiem.PM;
|
||
if (hour != 12) {
|
||
hour += 12;
|
||
}
|
||
}
|
||
}
|
||
components.assign("hour", hour);
|
||
components.assign("minute", minute);
|
||
if (meridiem !== null) {
|
||
components.assign("meridiem", meridiem);
|
||
}
|
||
else {
|
||
if (hour < 12) {
|
||
components.imply("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
else {
|
||
components.imply("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
}
|
||
if (match[MILLI_SECOND_GROUP] != null) {
|
||
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
||
if (millisecond >= 1000)
|
||
return null;
|
||
components.assign("millisecond", millisecond);
|
||
}
|
||
if (match[SECOND_GROUP] != null) {
|
||
const second = parseInt(match[SECOND_GROUP]);
|
||
if (second >= 60)
|
||
return null;
|
||
components.assign("second", second);
|
||
}
|
||
return components;
|
||
}
|
||
extractFollowingTimeComponents(context, match, result) {
|
||
const components = context.createParsingComponents();
|
||
if (match[MILLI_SECOND_GROUP] != null) {
|
||
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
||
if (millisecond >= 1000)
|
||
return null;
|
||
components.assign("millisecond", millisecond);
|
||
}
|
||
if (match[SECOND_GROUP] != null) {
|
||
const second = parseInt(match[SECOND_GROUP]);
|
||
if (second >= 60)
|
||
return null;
|
||
components.assign("second", second);
|
||
}
|
||
let hour = parseInt(match[HOUR_GROUP]);
|
||
let minute = 0;
|
||
let meridiem = -1;
|
||
if (match[MINUTE_GROUP] != null) {
|
||
minute = parseInt(match[MINUTE_GROUP]);
|
||
}
|
||
else if (hour > 100) {
|
||
minute = hour % 100;
|
||
hour = Math.floor(hour / 100);
|
||
}
|
||
if (minute >= 60 || hour > 24) {
|
||
return null;
|
||
}
|
||
if (hour >= 12) {
|
||
meridiem = index_1.Meridiem.PM;
|
||
}
|
||
if (match[AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12) {
|
||
return null;
|
||
}
|
||
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
||
if (ampm == "a") {
|
||
meridiem = index_1.Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
if (!components.isCertain("day")) {
|
||
components.imply("day", components.get("day") + 1);
|
||
}
|
||
}
|
||
}
|
||
if (ampm == "p") {
|
||
meridiem = index_1.Meridiem.PM;
|
||
if (hour != 12)
|
||
hour += 12;
|
||
}
|
||
if (!result.start.isCertain("meridiem")) {
|
||
if (meridiem == index_1.Meridiem.AM) {
|
||
result.start.imply("meridiem", index_1.Meridiem.AM);
|
||
if (result.start.get("hour") == 12) {
|
||
result.start.assign("hour", 0);
|
||
}
|
||
}
|
||
else {
|
||
result.start.imply("meridiem", index_1.Meridiem.PM);
|
||
if (result.start.get("hour") != 12) {
|
||
result.start.assign("hour", result.start.get("hour") + 12);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
components.assign("hour", hour);
|
||
components.assign("minute", minute);
|
||
if (meridiem >= 0) {
|
||
components.assign("meridiem", meridiem);
|
||
}
|
||
else {
|
||
const startAtPM = result.start.isCertain("meridiem") && result.start.get("hour") > 12;
|
||
if (startAtPM) {
|
||
if (result.start.get("hour") - 12 > hour) {
|
||
components.imply("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
else if (hour <= 12) {
|
||
components.assign("hour", hour + 12);
|
||
components.assign("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
}
|
||
else if (hour > 12) {
|
||
components.imply("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
else if (hour <= 12) {
|
||
components.imply("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
}
|
||
if (components.date().getTime() < result.start.date().getTime()) {
|
||
components.imply("day", components.get("day") + 1);
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.AbstractTimeExpressionParser = AbstractTimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Mecv":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractTimeExpressionParser_1 = __webpack_require__("MXb4");
|
||
class ENTimeExpressionParser extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|to|\\?)\\s*";
|
||
}
|
||
primaryPrefix() {
|
||
return "(?:(?:at|from)\\s*)??";
|
||
}
|
||
primarySuffix() {
|
||
return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?=\\W|$)";
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
const components = super.extractPrimaryTimeComponents(context, match);
|
||
if (components) {
|
||
if (match[0].endsWith("night")) {
|
||
const hour = components.get("hour");
|
||
if (hour >= 6 && hour < 12) {
|
||
components.assign("hour", components.get("hour") + 12);
|
||
components.assign("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
else if (hour < 6) {
|
||
components.assign("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
}
|
||
if (match[0].endsWith("afternoon")) {
|
||
components.assign("meridiem", index_1.Meridiem.PM);
|
||
const hour = components.get("hour");
|
||
if (hour >= 0 && hour <= 6) {
|
||
components.assign("hour", components.get("hour") + 12);
|
||
}
|
||
}
|
||
if (match[0].endsWith("morning")) {
|
||
components.assign("meridiem", index_1.Meridiem.AM);
|
||
const hour = components.get("hour");
|
||
if (hour < 12) {
|
||
components.assign("hour", components.get("hour"));
|
||
}
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = ENTimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "MpCh":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.ParsingResult = exports.ParsingComponents = void 0;
|
||
const quarterOfYear_1 = __importDefault(__webpack_require__("mx/2"));
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
dayjs_1.default.extend(quarterOfYear_1.default);
|
||
class ParsingComponents {
|
||
constructor(refDate, knownComponents) {
|
||
this.knownValues = {};
|
||
this.impliedValues = {};
|
||
if (knownComponents) {
|
||
for (const key in knownComponents) {
|
||
this.knownValues[key] = knownComponents[key];
|
||
}
|
||
}
|
||
const refDayJs = dayjs_1.default(refDate);
|
||
this.imply("day", refDayJs.date());
|
||
this.imply("month", refDayJs.month() + 1);
|
||
this.imply("year", refDayJs.year());
|
||
this.imply("hour", 12);
|
||
this.imply("minute", 0);
|
||
this.imply("second", 0);
|
||
this.imply("millisecond", 0);
|
||
}
|
||
get(component) {
|
||
if (component in this.knownValues) {
|
||
return this.knownValues[component];
|
||
}
|
||
if (component in this.impliedValues) {
|
||
return this.impliedValues[component];
|
||
}
|
||
return null;
|
||
}
|
||
date() {
|
||
return this.dayjs().toDate();
|
||
}
|
||
isCertain(component) {
|
||
return component in this.knownValues;
|
||
}
|
||
getCertainComponents() {
|
||
return Object.keys(this.knownValues);
|
||
}
|
||
imply(component, value) {
|
||
if (component in this.knownValues) {
|
||
return this;
|
||
}
|
||
this.impliedValues[component] = value;
|
||
return this;
|
||
}
|
||
assign(component, value) {
|
||
this.knownValues[component] = value;
|
||
delete this.impliedValues[component];
|
||
return this;
|
||
}
|
||
delete(component) {
|
||
delete this.knownValues[component];
|
||
delete this.impliedValues[component];
|
||
}
|
||
clone() {
|
||
const component = new ParsingComponents(new Date());
|
||
component.knownValues = {};
|
||
component.impliedValues = {};
|
||
for (const key in this.knownValues) {
|
||
component.knownValues[key] = this.knownValues[key];
|
||
}
|
||
for (const key in this.impliedValues) {
|
||
component.impliedValues[key] = this.impliedValues[key];
|
||
}
|
||
return component;
|
||
}
|
||
isOnlyDate() {
|
||
return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
|
||
}
|
||
isOnlyTime() {
|
||
return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
||
}
|
||
isOnlyWeekdayComponent() {
|
||
return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
||
}
|
||
isOnlyDayMonthComponent() {
|
||
return this.isCertain("day") && this.isCertain("month") && !this.isCertain("year");
|
||
}
|
||
isValidDate() {
|
||
let dateMoment = this.dayjs();
|
||
if (this.isCertain("timezoneOffset")) {
|
||
const adjustTimezoneOffset = this.get("timezoneOffset") - dateMoment.utcOffset();
|
||
dateMoment = dateMoment.add(adjustTimezoneOffset, "minute");
|
||
}
|
||
if (dateMoment.get("year") != this.get("year"))
|
||
return false;
|
||
if (dateMoment.get("month") != this.get("month") - 1)
|
||
return false;
|
||
if (dateMoment.get("date") != this.get("day"))
|
||
return false;
|
||
if (this.get("hour") != null && dateMoment.get("hour") != this.get("hour"))
|
||
return false;
|
||
if (this.get("minute") != null && dateMoment.get("minute") != this.get("minute"))
|
||
return false;
|
||
return true;
|
||
}
|
||
dayjs() {
|
||
let result = dayjs_1.default();
|
||
result = result.year(this.get("year"));
|
||
result = result.month(this.get("month") - 1);
|
||
result = result.date(this.get("day"));
|
||
result = result.hour(this.get("hour"));
|
||
result = result.minute(this.get("minute"));
|
||
result = result.second(this.get("second"));
|
||
result = result.millisecond(this.get("millisecond"));
|
||
const currentTimezoneOffset = result.utcOffset();
|
||
const targetTimezoneOffset = this.get("timezoneOffset") !== null ? this.get("timezoneOffset") : currentTimezoneOffset;
|
||
const adjustTimezoneOffset = targetTimezoneOffset - currentTimezoneOffset;
|
||
result = result.add(-adjustTimezoneOffset, "minute");
|
||
return result;
|
||
}
|
||
toString() {
|
||
return `[ParsingComponents {knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}]`;
|
||
}
|
||
static createRelativeFromRefDate(refDate, fragments) {
|
||
let date = dayjs_1.default(refDate);
|
||
for (const key in fragments) {
|
||
date = date.add(fragments[key], key);
|
||
}
|
||
const components = new ParsingComponents(refDate);
|
||
if (fragments["hour"] || fragments["minute"] || fragments["second"]) {
|
||
components.assign("hour", date.hour());
|
||
components.assign("minute", date.minute());
|
||
components.assign("second", date.second());
|
||
components.assign("day", date.date());
|
||
components.assign("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
}
|
||
else {
|
||
components.imply("hour", date.hour());
|
||
components.imply("minute", date.minute());
|
||
components.imply("second", date.second());
|
||
if (fragments["d"]) {
|
||
components.assign("day", date.date());
|
||
components.assign("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
}
|
||
else {
|
||
if (fragments["week"]) {
|
||
components.imply("weekday", date.day());
|
||
}
|
||
components.imply("day", date.date());
|
||
components.imply("month", date.month() + 1);
|
||
components.imply("year", date.year());
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.ParsingComponents = ParsingComponents;
|
||
class ParsingResult {
|
||
constructor(refDate, index, text, start, end) {
|
||
this.refDate = refDate;
|
||
this.index = index;
|
||
this.text = text;
|
||
this.start = start || new ParsingComponents(this.refDate);
|
||
this.end = end;
|
||
}
|
||
clone() {
|
||
const result = new ParsingResult(this.refDate, this.index, this.text);
|
||
result.start = this.start ? this.start.clone() : null;
|
||
result.end = this.end ? this.end.clone() : null;
|
||
return result;
|
||
}
|
||
date() {
|
||
return this.start.date();
|
||
}
|
||
toString() {
|
||
return `[ParsingResult {index: ${this.index}, text: '${this.text}', ...}]`;
|
||
}
|
||
}
|
||
exports.ParsingResult = ParsingResult;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Mrws":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class DEMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = DEMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "OOKS":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
const PATTERN = /今日|当日|昨日|明日|今夜|今夕|今晩|今朝/i;
|
||
class JPCasualDateParser {
|
||
pattern() {
|
||
return PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
const text = match[0];
|
||
let date = dayjs_1.default(context.refDate);
|
||
const components = context.createParsingComponents();
|
||
switch (text) {
|
||
case "昨日":
|
||
return references.yesterday(context.refDate);
|
||
case "明日":
|
||
return references.tomorrow(context.refDate);
|
||
case "今日":
|
||
case "当日":
|
||
return references.today(context.refDate);
|
||
}
|
||
if (text == "今夜" || text == "今夕" || text == "今晩") {
|
||
components.imply("hour", 22);
|
||
components.assign("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
else if (text.match("今朝")) {
|
||
components.imply("hour", 6);
|
||
components.assign("meridiem", index_1.Meridiem.AM);
|
||
}
|
||
components.assign("day", date.date());
|
||
components.assign("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = JPCasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "SH9J":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ARTj");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const timeunits_1 = __webpack_require__("aWHD");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
class FRTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
constructor() {
|
||
super();
|
||
}
|
||
innerPattern() {
|
||
return new RegExp(`(?:les?|la|l\'|du|des?)\\s*` +
|
||
`(${constants_1.NUMBER_PATTERN})?` +
|
||
`(?:\\s*(prochaine?s?|derni[eè]re?s?|pass[ée]e?s?|pr[ée]c[ée]dents?|suivante?s?))?` +
|
||
`\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})` +
|
||
`(?:\\s*(prochaine?s?|derni[eè]re?s?|pass[ée]e?s?|pr[ée]c[ée]dents?|suivante?s?))?`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const num = match[1] ? constants_1.parseNumberPattern(match[1]) : 1;
|
||
const unit = constants_1.TIME_UNIT_DICTIONARY[match[3].toLowerCase()];
|
||
let timeUnits = {};
|
||
timeUnits[unit] = num;
|
||
let modifier = match[2] || match[4] || "";
|
||
modifier = modifier.toLowerCase();
|
||
if (!modifier) {
|
||
return;
|
||
}
|
||
if (/derni[eè]re?s?/.test(modifier) || /pass[ée]e?s?/.test(modifier) || /pr[ée]c[ée]dents?/.test(modifier)) {
|
||
timeUnits = timeunits_1.reverseTimeUnits(timeUnits);
|
||
}
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
}
|
||
exports.default = FRTimeUnitAgoFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "TXM6":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ARTj");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const timeunits_1 = __webpack_require__("aWHD");
|
||
class FRTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
constructor() {
|
||
super();
|
||
}
|
||
innerPattern() {
|
||
return new RegExp(`il y a\\s*(${constants_1.TIME_UNITS_PATTERN})(?=(?:\\W|$))`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_1.parseTimeUnits(match[1]);
|
||
const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, outputTimeUnits);
|
||
}
|
||
}
|
||
exports.default = FRTimeUnitAgoFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "UK2x":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
|
||
const configurations_1 = __webpack_require__("HskP");
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
const SlashDateFormatParser_1 = __importDefault(__webpack_require__("5Jgo"));
|
||
const PTWeekdayParser_1 = __importDefault(__webpack_require__("GPup"));
|
||
const PTTimeExpressionParser_1 = __importDefault(__webpack_require__("sFAh"));
|
||
const PTMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("loBo"));
|
||
const PTMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("pgTb"));
|
||
const PTMonthNameLittleEndianParser_1 = __importDefault(__webpack_require__("yJtp"));
|
||
const PTCasualDateParser_1 = __importDefault(__webpack_require__("LqQ3"));
|
||
const PTCasualTimeParser_1 = __importDefault(__webpack_require__("wI+u"));
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
|
||
exports.strict = new chrono_1.Chrono(createConfiguration(true));
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration(littleEndian = true) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.push(new PTCasualDateParser_1.default());
|
||
option.parsers.push(new PTCasualTimeParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration(strictMode = true, littleEndian = true) {
|
||
return configurations_1.includeCommonConfiguration({
|
||
parsers: [
|
||
new SlashDateFormatParser_1.default(littleEndian),
|
||
new PTWeekdayParser_1.default(),
|
||
new PTTimeExpressionParser_1.default(),
|
||
new PTMonthNameLittleEndianParser_1.default(),
|
||
],
|
||
refiners: [new PTMergeDateTimeRefiner_1.default(), new PTMergeDateRangeRefiner_1.default()],
|
||
}, strictMode);
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "V0tS":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("6IGW");
|
||
const constants_2 = __webpack_require__("6IGW");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("(?:am\\s*?)?" +
|
||
"(?:den\\s*?)?" +
|
||
`([0-9]{1,2})\\.` +
|
||
`(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\–|\\s)\\s*([0-9]{1,2})\\.?)?\\s*` +
|
||
`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
`(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?` +
|
||
`(?=\\W|$)`, "i");
|
||
const DATE_GROUP = 1;
|
||
const DATE_TO_GROUP = 2;
|
||
const MONTH_NAME_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class DEMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = parseInt(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[YEAR_GROUP]) {
|
||
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DATE_TO_GROUP]) {
|
||
const endDate = parseInt(match[DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = DEMonthNameLittleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Wgwc":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
!function(t,e){ true?module.exports=e():undefined}(this,function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",i="day",s="week",u="month",a="quarter",o="year",f="date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d+)?$/,c=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},$=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},l={s:$,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+$(r,2,"0")+":"+$(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,u),s=n-i<0,a=e.clone().add(r+(s?-1:1),u);return+(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return{M:u,y:o,w:s,d:i,D:f,h:r,m:n,s:e,ms:t,Q:a}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},y="en",M={};M[y]=d;var m=function(t){return t instanceof S},D=function(t,e,n){var r;if(!t)return y;if("string"==typeof t)M[t]&&(r=t),e&&(M[t]=e,r=t);else{var i=t.name;M[i]=t,r=i}return!n&&r&&(y=r),r||!n&&y},v=function(t,e){if(m(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new S(n)},g=l;g.l=D,g.i=m,g.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function d(t){this.$L=this.$L||D(t.locale,null,!0),this.parse(t)}var $=d.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},$.$utils=function(){return g},$.isValid=function(){return!("Invalid Date"===this.$d.toString())},$.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return v(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<v(t)},$.$g=function(t,e,n){return g.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,a){var h=this,c=!!g.u(a)||a,d=g.p(t),$=function(t,e){var n=g.w(h.$u?Date.UTC(h.$y,e,t):new Date(h.$y,e,t),h);return c?n:n.endOf(i)},l=function(t,e){return g.w(h.toDate()[t].apply(h.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(e)),h)},y=this.$W,M=this.$M,m=this.$D,D="set"+(this.$u?"UTC":"");switch(d){case o:return c?$(1,0):$(31,11);case u:return c?$(1,M):$(0,M+1);case s:var v=this.$locale().weekStart||0,S=(y<v?y+7:y)-v;return $(c?m-S:m+(6-S),M);case i:case f:return l(D+"Hours",0);case r:return l(D+"Minutes",1);case n:return l(D+"Seconds",2);case e:return l(D+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(s,a){var h,c=g.p(s),d="set"+(this.$u?"UTC":""),$=(h={},h[i]=d+"Date",h[f]=d+"Date",h[u]=d+"Month",h[o]=d+"FullYear",h[r]=d+"Hours",h[n]=d+"Minutes",h[e]=d+"Seconds",h[t]=d+"Milliseconds",h)[c],l=c===i?this.$D+(a-this.$W):a;if(c===u||c===o){var y=this.clone().set(f,1);y.$d[$](l),y.init(),this.$d=y.set(f,Math.min(this.$D,y.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[g.p(t)]()},$.add=function(t,a){var f,h=this;t=Number(t);var c=g.p(a),d=function(e){var n=v(h);return g.w(n.date(n.date()+Math.round(e*t)),h)};if(c===u)return this.set(u,this.$M+t);if(c===o)return this.set(o,this.$y+t);if(c===i)return d(1);if(c===s)return d(7);var $=(f={},f[n]=6e4,f[r]=36e5,f[e]=1e3,f)[c]||1,l=this.$d.getTime()+t*$;return g.w(l,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=g.z(this),i=this.$locale(),s=this.$H,u=this.$m,a=this.$M,o=i.weekdays,f=i.months,h=function(t,r,i,s){return t&&(t[r]||t(e,n))||i[r].substr(0,s)},d=function(t){return g.s(s%12||12,t,"0")},$=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:g.s(a+1,2,"0"),MMM:h(i.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:h(i.weekdaysMin,this.$W,o,2),ddd:h(i.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:g.s(s,2,"0"),h:d(1),hh:d(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:g.s(u,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:r};return n.replace(c,function(t,e){return e||l[t]||r.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(t,f,h){var c,d=g.p(f),$=v(t),l=6e4*($.utcOffset()-this.utcOffset()),y=this-$,M=g.m(this,$);return M=(c={},c[o]=M/12,c[u]=M,c[a]=M/3,c[s]=(y-l)/6048e5,c[i]=(y-l)/864e5,c[r]=y/36e5,c[n]=y/6e4,c[e]=y/1e3,c)[d]||y,h?M:g.a(M)},$.daysInMonth=function(){return this.endOf(u).$D},$.$locale=function(){return M[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=D(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return g.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},d}(),p=S.prototype;return v.prototype=p,[["$ms",t],["$s",e],["$m",n],["$H",r],["$W",i],["$M",u],["$y",o],["$D",f]].forEach(function(t){p[t[1]]=function(e){return this.$g(e,t[0],t[1])}}),v.extend=function(t,e){return t(e,S,v),v},v.locale=D,v.isDayjs=m,v.unix=function(t){return v(1e3*t)},v.en=M[y],v.Ls=M,v.p={},v});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "WlKo":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?", "i");
|
||
const TIMEZONE_OFFSET_SIGN_GROUP = 1;
|
||
const TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2;
|
||
const TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3;
|
||
class ExtractTimezoneOffsetRefiner {
|
||
refine(context, results) {
|
||
results.forEach(function (result) {
|
||
if (result.start.isCertain("timezoneOffset")) {
|
||
return;
|
||
}
|
||
const suffix = context.text.substring(result.index + result.text.length);
|
||
const match = TIMEZONE_OFFSET_PATTERN.exec(suffix);
|
||
if (!match) {
|
||
return;
|
||
}
|
||
context.debug(() => {
|
||
console.log(`Extracting timezone: '${match[0]}' into : ${result}`);
|
||
});
|
||
const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]);
|
||
const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0");
|
||
let timezoneOffset = hourOffset * 60 + minuteOffset;
|
||
if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") {
|
||
timezoneOffset = -timezoneOffset;
|
||
}
|
||
if (result.end != null) {
|
||
result.end.assign("timezoneOffset", timezoneOffset);
|
||
}
|
||
result.start.assign("timezoneOffset", timezoneOffset);
|
||
result.text += match[0];
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
exports.default = ExtractTimezoneOffsetRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "WlRN":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
class FRCasualDateParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_1.default(context.refDate);
|
||
const lowerText = match[0].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (lowerText) {
|
||
case "maintenant":
|
||
return references.now(context.refDate);
|
||
case "aujourd'hui":
|
||
return references.today(context.refDate);
|
||
case "hier":
|
||
return references.yesterday(context.refDate);
|
||
case "demain":
|
||
return references.tomorrow(context.refDate);
|
||
default:
|
||
if (lowerText.match(/cette\s*nuit/)) {
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 22);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
}
|
||
else if (lowerText.match(/la\s*veille/)) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 0);
|
||
}
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = FRCasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "X82P":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.toHankaku = void 0;
|
||
function toHankaku(text) {
|
||
return String(text)
|
||
.replace(/\u2019/g, "\u0027")
|
||
.replace(/\u201D/g, "\u0022")
|
||
.replace(/\u3000/g, "\u0020")
|
||
.replace(/\uFFE5/g, "\u00A5")
|
||
.replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g, alphaNum);
|
||
}
|
||
exports.toHankaku = toHankaku;
|
||
function alphaNum(token) {
|
||
return String.fromCharCode(token.charCodeAt(0) - 65248);
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "XDfb":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("Gqx+"));
|
||
class DEMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(T|um|am|,|-)?\\s*$");
|
||
}
|
||
}
|
||
exports.default = DEMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "Yui3":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})" + "", "i");
|
||
const MONTH_GROUP = 1;
|
||
const YEAR_GROUP = 2;
|
||
class ENSlashMonthFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const year = parseInt(match[YEAR_GROUP]);
|
||
const month = parseInt(match[MONTH_GROUP]);
|
||
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
|
||
}
|
||
}
|
||
exports.default = ENSlashMonthFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "ZJuD":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("Gqx+"));
|
||
class NLMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(om|na|voor|,|-)?\\s*$");
|
||
}
|
||
}
|
||
exports.default = NLMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "a+SU":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
|
||
const configurations_1 = __webpack_require__("HskP");
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
const NLMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("2Ry0"));
|
||
const NLMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("ZJuD"));
|
||
const NLCasualDateParser_1 = __importDefault(__webpack_require__("K1Nu"));
|
||
const NLCasualTimeParser_1 = __importDefault(__webpack_require__("p76M"));
|
||
const SlashDateFormatParser_1 = __importDefault(__webpack_require__("5Jgo"));
|
||
const NLTimeUnitWithinFormatParser_1 = __importDefault(__webpack_require__("+7KC"));
|
||
const NLWeekdayParser_1 = __importDefault(__webpack_require__("xkid"));
|
||
const NLMonthNameMiddleEndianParser_1 = __importDefault(__webpack_require__("ur7Q"));
|
||
const NLMonthNameParser_1 = __importDefault(__webpack_require__("uGZ/"));
|
||
const NLSlashMonthFormatParser_1 = __importDefault(__webpack_require__("7zy1"));
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
|
||
exports.strict = new chrono_1.Chrono(createConfiguration(true));
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration(littleEndian = true) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new NLCasualDateParser_1.default());
|
||
option.parsers.unshift(new NLCasualTimeParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration(strictMode = true, littleEndian = true) {
|
||
return configurations_1.includeCommonConfiguration({
|
||
parsers: [
|
||
new SlashDateFormatParser_1.default(littleEndian),
|
||
new NLTimeUnitWithinFormatParser_1.default(),
|
||
new NLWeekdayParser_1.default(),
|
||
new NLMonthNameMiddleEndianParser_1.default(),
|
||
new NLMonthNameParser_1.default(),
|
||
new NLSlashMonthFormatParser_1.default(),
|
||
],
|
||
refiners: [new NLMergeDateTimeRefiner_1.default(), new NLMergeDateRangeRefiner_1.default()],
|
||
}, strictMode);
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "aLSU":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.ParsingContext = exports.Chrono = void 0;
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const en_1 = __webpack_require__("Kxbc");
|
||
class Chrono {
|
||
constructor(configuration) {
|
||
configuration = configuration || en_1.createCasualConfiguration();
|
||
this.parsers = [...configuration.parsers];
|
||
this.refiners = [...configuration.refiners];
|
||
}
|
||
parseDate(text, refDate, opt) {
|
||
const results = this.parse(text, refDate, opt);
|
||
return results.length > 0 ? results[0].start.date() : null;
|
||
}
|
||
parse(text, refDate, opt) {
|
||
const context = new ParsingContext(text, refDate || new Date(), opt || {});
|
||
let results = [];
|
||
this.parsers.forEach((parser) => {
|
||
const parsedResults = Chrono.executeParser(context, parser);
|
||
results = results.concat(parsedResults);
|
||
});
|
||
results.sort((a, b) => {
|
||
return a.index - b.index;
|
||
});
|
||
this.refiners.forEach(function (refiner) {
|
||
results = refiner.refine(context, results);
|
||
});
|
||
return results;
|
||
}
|
||
clone() {
|
||
return new Chrono({
|
||
parsers: [...this.parsers],
|
||
refiners: [...this.refiners],
|
||
});
|
||
}
|
||
static executeParser(context, parser) {
|
||
const results = [];
|
||
const pattern = parser.pattern(context);
|
||
const originalText = context.text;
|
||
let remainingText = context.text;
|
||
let match = pattern.exec(remainingText);
|
||
while (match) {
|
||
const index = match.index + originalText.length - remainingText.length;
|
||
match.index = index;
|
||
const result = parser.extract(context, match);
|
||
if (!result) {
|
||
remainingText = originalText.substring(match.index + 1);
|
||
match = pattern.exec(remainingText);
|
||
continue;
|
||
}
|
||
let parsedResult = null;
|
||
if (result instanceof results_1.ParsingResult) {
|
||
parsedResult = result;
|
||
}
|
||
else if (result instanceof results_1.ParsingComponents) {
|
||
parsedResult = context.createParsingResult(match.index, match[0]);
|
||
parsedResult.start = result;
|
||
}
|
||
else {
|
||
parsedResult = context.createParsingResult(match.index, match[0], result);
|
||
}
|
||
context.debug(() => console.log(`${parser.constructor.name} extracted result ${parsedResult}`));
|
||
results.push(parsedResult);
|
||
remainingText = originalText.substring(index + parsedResult.text.length);
|
||
match = pattern.exec(remainingText);
|
||
}
|
||
return results;
|
||
}
|
||
}
|
||
exports.Chrono = Chrono;
|
||
class ParsingContext {
|
||
constructor(text, refDate, option) {
|
||
this.text = text;
|
||
this.refDate = refDate;
|
||
this.option = option;
|
||
}
|
||
createParsingComponents(components) {
|
||
return new results_1.ParsingComponents(this.refDate, components);
|
||
}
|
||
createParsingResult(index, textOrEndIndex, startComponents, endComponents) {
|
||
const text = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex);
|
||
const start = startComponents ? this.createParsingComponents(startComponents) : null;
|
||
const end = endComponents ? this.createParsingComponents(endComponents) : null;
|
||
return new results_1.ParsingResult(this.refDate, index, text, start, end);
|
||
}
|
||
debug(block) {
|
||
if (this.option.debug) {
|
||
if (this.option.debug instanceof Function) {
|
||
this.option.debug(block);
|
||
}
|
||
else {
|
||
const handler = this.option.debug;
|
||
handler.debug(block);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
exports.ParsingContext = ParsingContext;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "aWHD":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.addImpliedTimeUnits = exports.reverseTimeUnits = void 0;
|
||
function reverseTimeUnits(timeUnits) {
|
||
const reversed = {};
|
||
for (const key in timeUnits) {
|
||
reversed[key] = -timeUnits[key];
|
||
}
|
||
return reversed;
|
||
}
|
||
exports.reverseTimeUnits = reverseTimeUnits;
|
||
function addImpliedTimeUnits(components, timeUnits) {
|
||
const output = components.clone();
|
||
let date = components.dayjs();
|
||
for (const key in timeUnits) {
|
||
date = date.add(timeUnits[key], key);
|
||
}
|
||
if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) {
|
||
output.imply("day", date.date());
|
||
output.imply("month", date.month() + 1);
|
||
output.imply("year", date.year());
|
||
}
|
||
if ("second" in timeUnits || "minute" in timeUnits || "hour" in timeUnits) {
|
||
output.imply("second", date.second());
|
||
output.imply("minute", date.minute());
|
||
output.imply("hour", date.hour());
|
||
}
|
||
return output;
|
||
}
|
||
exports.addImpliedTimeUnits = addImpliedTimeUnits;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "apo/":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.mergeDateTimeComponent = exports.mergeDateTimeResult = void 0;
|
||
const index_1 = __webpack_require__("6EsV");
|
||
function mergeDateTimeResult(dateResult, timeResult) {
|
||
const result = dateResult.clone();
|
||
const beginDate = dateResult.start;
|
||
const beginTime = timeResult.start;
|
||
result.start = mergeDateTimeComponent(beginDate, beginTime);
|
||
if (dateResult.end != null || timeResult.end != null) {
|
||
const endDate = dateResult.end == null ? dateResult.start : dateResult.end;
|
||
const endTime = timeResult.end == null ? timeResult.start : timeResult.end;
|
||
const endDateTime = mergeDateTimeComponent(endDate, endTime);
|
||
if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) {
|
||
if (endDateTime.isCertain("day")) {
|
||
endDateTime.assign("day", endDateTime.get("day") + 1);
|
||
}
|
||
else {
|
||
endDateTime.imply("day", endDateTime.get("day") + 1);
|
||
}
|
||
}
|
||
result.end = endDateTime;
|
||
}
|
||
return result;
|
||
}
|
||
exports.mergeDateTimeResult = mergeDateTimeResult;
|
||
function mergeDateTimeComponent(dateComponent, timeComponent) {
|
||
const dateTimeComponent = dateComponent.clone();
|
||
if (timeComponent.isCertain("hour")) {
|
||
dateTimeComponent.assign("hour", timeComponent.get("hour"));
|
||
dateTimeComponent.assign("minute", timeComponent.get("minute"));
|
||
if (timeComponent.isCertain("second")) {
|
||
dateTimeComponent.assign("second", timeComponent.get("second"));
|
||
if (timeComponent.isCertain("millisecond")) {
|
||
dateTimeComponent.assign("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
else {
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
}
|
||
else {
|
||
dateTimeComponent.imply("second", timeComponent.get("second"));
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
}
|
||
else {
|
||
dateTimeComponent.imply("hour", timeComponent.get("hour"));
|
||
dateTimeComponent.imply("minute", timeComponent.get("minute"));
|
||
dateTimeComponent.imply("second", timeComponent.get("second"));
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
if (timeComponent.isCertain("timezoneOffset")) {
|
||
dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset"));
|
||
}
|
||
if (timeComponent.isCertain("meridiem")) {
|
||
dateTimeComponent.assign("meridiem", timeComponent.get("meridiem"));
|
||
}
|
||
else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) {
|
||
dateTimeComponent.imply("meridiem", timeComponent.get("meridiem"));
|
||
}
|
||
if (dateTimeComponent.get("meridiem") == index_1.Meridiem.PM && dateTimeComponent.get("hour") < 12) {
|
||
if (timeComponent.isCertain("hour")) {
|
||
dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12);
|
||
}
|
||
else {
|
||
dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12);
|
||
}
|
||
}
|
||
return dateTimeComponent;
|
||
}
|
||
exports.mergeDateTimeComponent = mergeDateTimeComponent;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "e6Wu":
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
// ESM COMPAT FLAG
|
||
__webpack_require__.r(__webpack_exports__);
|
||
|
||
// EXTERNAL MODULE: ./node_modules/chrono-node/dist/index.js
|
||
var dist = __webpack_require__("6EsV");
|
||
|
||
// EXTERNAL MODULE: external "axios"
|
||
var external_axios_ = __webpack_require__("zr5I");
|
||
var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_);
|
||
|
||
// EXTERNAL MODULE: external "axiosGmxhrAdapter"
|
||
var external_axiosGmxhrAdapter_ = __webpack_require__("CFBl");
|
||
var external_axiosGmxhrAdapter_default = /*#__PURE__*/__webpack_require__.n(external_axiosGmxhrAdapter_);
|
||
|
||
// CONCATENATED MODULE: ./src/js/utils.ts
|
||
/**
|
||
* @typedef {Object} AxiosResponse
|
||
* @property {Object} data
|
||
* @property {Object} headers
|
||
* @property {Object} config
|
||
* @property {Object} request
|
||
* @property {number} code
|
||
* @property {string} statusText
|
||
*/
|
||
/**
|
||
* @typedef {Object} AxiosError
|
||
* @property {AxiosResponse} response
|
||
*/
|
||
|
||
|
||
external_axios_default.a.defaults.adapter = external_axiosGmxhrAdapter_default.a;
|
||
|
||
function extractNumber(s) {
|
||
var match = /(\+?[0-9]{4,})/.exec(s);
|
||
if (!match) {
|
||
return undefined;
|
||
}
|
||
var number = match[1];
|
||
if (number.startsWith('+')) {
|
||
number = number.replace('+', '00');
|
||
}
|
||
return number;
|
||
}
|
||
|
||
// CONCATENATED MODULE: ./src/js/call-history.ts
|
||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
|
||
class call_history_CallHistory {
|
||
constructor() {
|
||
this.callerIds = {};
|
||
}
|
||
updateCallHistoryEntry(call, callerId) {
|
||
var span = call.querySelector('span');
|
||
this.showTimeManager(call, span.nextSibling.textContent.trim(), callerId);
|
||
if (callerId && callerId.tD_NAME !== '') {
|
||
var text = span.textContent;
|
||
span.textContent = callerId.tD_NAME;
|
||
var br = document.createElement('br');
|
||
var span2 = document.createElement('span');
|
||
span2.style.fontSize = 'small';
|
||
span2.textContent = text;
|
||
span.parentNode.insertBefore(br, span.nextSibling);
|
||
span.parentNode.insertBefore(span2, span.nextSibling);
|
||
}
|
||
}
|
||
showTimeManager(call, date, callerId) {
|
||
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/);
|
||
var duration = '00:00:00';
|
||
if (dateParts) {
|
||
date = dateParts.groups.date;
|
||
duration = dateParts.groups.duration;
|
||
}
|
||
var parsedDate = dist["de"].parseDate(date);
|
||
if (!parsedDate) {
|
||
parsedDate = dist["parseDate"](date);
|
||
}
|
||
if (!parsedDate) {
|
||
return;
|
||
}
|
||
// Date parsing is awful, just assume the first number is the day of month
|
||
var day = date.match(/[0-9]+/)[0];
|
||
var parsedDuration = dist["parseDate"](duration);
|
||
console.log('TAPI call history time:', date, 'parsedDate:', parsedDate, 'duration:', duration, 'parsedDuration:', parsedDuration);
|
||
var connect = parsedDate.getFullYear().toString() +
|
||
(parsedDate.getMonth() + 1).toString().padStart(2, '0') + // (January gives 0)
|
||
day.toString().padStart(2, '0') +
|
||
parsedDate.getHours().toString().padStart(2, '0') +
|
||
parsedDate.getMinutes().toString().padStart(2, '0');
|
||
var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString();
|
||
var toolbar = call.querySelector('.wcToolbarTiles');
|
||
var href = 'domizil://PM/Zeitbuchung?';
|
||
if (callerId && callerId.tD_ID) {
|
||
href += 'KontaktId=' + callerId.tD_ID + '&';
|
||
}
|
||
href += 'connect=' + connect + '&length=' + length;
|
||
var a = document.createElement('a');
|
||
a.title = 'PM Zeitbuchung';
|
||
a.dataset.domizilLink = href;
|
||
a.onclick = () => {
|
||
window.open(href);
|
||
};
|
||
a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98" width="20" height="20">' +
|
||
'<g>' +
|
||
' <g>' +
|
||
' <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' +
|
||
' C559.98,125.601,434.38,0,279.99,0z M279.99,498.78c-120.644,0-218.79-98.146-218.79-218.79' +
|
||
' c0-120.638,98.146-218.79,218.79-218.79s218.79,98.152,218.79,218.79C498.78,400.634,400.634,498.78,279.99,498.78z"/>' +
|
||
' <path d="M304.226,280.326V162.976c0-13.103-10.618-23.721-23.716-23.721c-13.102,0-23.721,10.618-23.721,23.721v124.928' +
|
||
' c0,0.373,0.092,0.723,0.11,1.096c-0.312,6.45,1.91,12.999,6.836,17.926l88.343,88.336c9.266,9.266,24.284,9.266,33.543,0' +
|
||
' c9.26-9.266,9.266-24.284,0-33.544L304.226,280.326z"/>' +
|
||
' </g>' +
|
||
'</g>' +
|
||
'</svg>';
|
||
toolbar.insertBefore(a, toolbar.firstChild);
|
||
}
|
||
showCallHistory(element) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
var span = element.querySelector('span');
|
||
var number = extractNumber(span.textContent);
|
||
if (!number) {
|
||
this.updateCallHistoryEntry(element, undefined);
|
||
return;
|
||
}
|
||
if (this.callerIds[number] !== undefined) {
|
||
this.updateCallHistoryEntry(element, this.callerIds[number]);
|
||
}
|
||
else {
|
||
var response = yield external_axios_default.a.get('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number));
|
||
var callerId = { tD_NAME: '' };
|
||
if (response.status === 200) {
|
||
callerId = response.data;
|
||
}
|
||
console.log('TAPI call histroy callerid response', number, response, callerId);
|
||
this.callerIds[number] = callerId;
|
||
this.updateCallHistoryEntry(element, callerId);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
// CONCATENATED MODULE: ./src/js/call-notification.ts
|
||
var call_notification_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
class call_notification_CallNotification {
|
||
showCallNotification(element) {
|
||
return call_notification_awaiter(this, void 0, void 0, function* () {
|
||
var number = element.dataset.id;
|
||
console.log('TAPI call notification', number);
|
||
number = extractNumber(number);
|
||
if (!number) {
|
||
console.log('TAPI callerid no number found');
|
||
return;
|
||
}
|
||
console.log('TAPI searching callerid for', number);
|
||
var response = yield external_axios_default.a.get('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number));
|
||
console.log('TAPI callerid response', response);
|
||
var notification = {
|
||
text: number
|
||
};
|
||
if (response.status === 200) {
|
||
var callerId = response.data;
|
||
if (callerId) {
|
||
notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')';
|
||
}
|
||
}
|
||
// eslint-disable-next-line no-undef
|
||
GM.notification(notification);
|
||
});
|
||
}
|
||
}
|
||
|
||
// CONCATENATED MODULE: ./src/js/debounce.js
|
||
function debounce (func, wait) {
|
||
let timeout
|
||
|
||
return function executedFunction (...args) {
|
||
const later = () => {
|
||
clearTimeout(timeout)
|
||
func(...args)
|
||
}
|
||
|
||
clearTimeout(timeout)
|
||
timeout = setTimeout(later, wait)
|
||
}
|
||
}
|
||
|
||
// CONCATENATED MODULE: ./src/js/search.ts
|
||
var search_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
|
||
class search_Search {
|
||
constructor() {
|
||
this.currentSearchText = '';
|
||
this.doSearch = debounce(() => search_awaiter(this, void 0, void 0, function* () {
|
||
var search = document.getElementById('tapiSearchInput');
|
||
var searchText = search.value.trim();
|
||
if (searchText === '') {
|
||
this.removeSearchResults();
|
||
return;
|
||
}
|
||
else if (searchText === this.currentSearchText) {
|
||
return;
|
||
}
|
||
console.log('Searching TAPI');
|
||
var response = yield external_axios_default.a.get('http://cpatapi.cpsrvweb2016.cp-austria.at/search?query=' + encodeURIComponent(searchText));
|
||
console.log('TAPI Search response', response);
|
||
var contacts = response.data;
|
||
console.log('TAPI Contacts', contacts);
|
||
this.removeSearchResults();
|
||
this.currentSearchText = searchText;
|
||
var resultList = document.createElement('ul');
|
||
resultList.id = 'tapiResults';
|
||
resultList.classList.add('search-nav-absolute');
|
||
resultList.classList.add('search-nav-ul');
|
||
document.getElementById('tapiSearchBox').appendChild(resultList);
|
||
resultList.innerHTML = '';
|
||
contacts.forEach(contact => {
|
||
var li = document.createElement('li');
|
||
li.classList.add('tapi-search-result');
|
||
li.classList.add('search-result');
|
||
li.classList.add('pointer');
|
||
li.onmouseover = () => { this.selectResult(li); };
|
||
li.dataset.tapiNumber = contact.tD_NUMBER_TAPI;
|
||
li.onclick = () => { this.dial(contact.tD_NUMBER_TAPI); };
|
||
li.style.listStyle = 'outside none none'; // display: flex; align-items: center;
|
||
var resultText = document.createElement('div');
|
||
resultText.classList.add('search-result-txt');
|
||
li.appendChild(resultText);
|
||
var line1 = document.createElement('div');
|
||
line1.appendChild(document.createTextNode(contact.tD_NAME));
|
||
resultText.appendChild(line1);
|
||
var line2 = document.createElement('div');
|
||
line2.appendChild(document.createTextNode(contact.tD_MEDIUM + ': ' + contact.tD_NUMBER_TAPI));
|
||
resultText.appendChild(line2);
|
||
resultList.appendChild(li);
|
||
});
|
||
}), 200);
|
||
}
|
||
createSearchWindow(element) {
|
||
console.log('Create TAPI Search');
|
||
var form = document.createElement('form');
|
||
form.style.width = '200px';
|
||
form.style.float = 'right';
|
||
form.style.marginRight = '20px';
|
||
form.onsubmit = () => {
|
||
var items = document.getElementsByClassName('tapi-search-result-selected');
|
||
if (items.length === 0) {
|
||
items = document.getElementsByClassName('tapi-search-result');
|
||
}
|
||
if (items.length > 0) {
|
||
this.dial(items[0].dataset.tapiNumber);
|
||
}
|
||
return false;
|
||
};
|
||
var searchBox = document.createElement('div');
|
||
searchBox.classList.add('contact-search-box');
|
||
searchBox.id = 'tapiSearchBox';
|
||
form.appendChild(searchBox);
|
||
var searchWrapper = document.createElement('div');
|
||
searchWrapper.classList.add('search-input-wrapper');
|
||
searchWrapper.style.position = 'relative';
|
||
searchBox.appendChild(searchWrapper);
|
||
var search = document.createElement('input');
|
||
search.id = 'tapiSearchInput';
|
||
search.autocomplete = 'off';
|
||
search.classList.add('padder');
|
||
search.classList.add('rounded');
|
||
search.classList.add('bg-light');
|
||
search.classList.add('no-border');
|
||
search.classList.add('contact-search-box');
|
||
search.placeholder = 'TAPI Suche';
|
||
search.onfocus = () => { this.doSearch(); };
|
||
search.onkeydown = (ev) => { this.doSearchKeyDown(ev); };
|
||
search.onblur = () => {
|
||
console.log('TAPI Search exit', this);
|
||
setTimeout(() => {
|
||
console.log('TAPI clear search results');
|
||
this.removeSearchResults();
|
||
}, 500);
|
||
};
|
||
searchWrapper.appendChild(search);
|
||
var icon = document.createElement('span');
|
||
icon.classList.add('fa');
|
||
icon.classList.add('fa-search');
|
||
icon.classList.add('form-control-feedback');
|
||
icon.style.color = 'grey';
|
||
searchWrapper.appendChild(icon);
|
||
element.appendChild(form);
|
||
}
|
||
removeSearchResults() {
|
||
var resultList = document.getElementById('tapiResults');
|
||
if (resultList) {
|
||
resultList.parentNode.removeChild(resultList);
|
||
}
|
||
this.currentSearchText = '';
|
||
}
|
||
doSearchKeyDown(ev) {
|
||
if (ev.key === 'ArrowUp') {
|
||
let items = document.getElementsByClassName('tapi-search-result-selected');
|
||
if (items.length > 0) {
|
||
var prev = items[0].previousSibling;
|
||
}
|
||
if (!prev) {
|
||
items = document.getElementsByClassName('tapi-search-result');
|
||
if (items.length > 0) {
|
||
prev = items[items.length - 1];
|
||
}
|
||
}
|
||
if (prev) {
|
||
this.selectResult(prev);
|
||
prev.scrollIntoView(true);
|
||
}
|
||
}
|
||
else if (ev.key === 'ArrowDown') {
|
||
let items = document.getElementsByClassName('tapi-search-result-selected');
|
||
if (items.length > 0) {
|
||
var next = items[0].nextSibling;
|
||
}
|
||
if (!next) {
|
||
items = document.getElementsByClassName('tapi-search-result');
|
||
if (items.length > 0) {
|
||
next = items[0];
|
||
}
|
||
}
|
||
if (next) {
|
||
this.selectResult(next);
|
||
next.scrollIntoView(false);
|
||
}
|
||
}
|
||
else {
|
||
this.doSearch();
|
||
}
|
||
}
|
||
selectResult(resultLi) {
|
||
var items = document.getElementsByClassName('tapi-search-result');
|
||
for (var item of items) {
|
||
item.classList.remove('bg-light');
|
||
item.classList.remove('tapi-search-result-selected');
|
||
}
|
||
resultLi.classList.add('bg-light');
|
||
resultLi.classList.add('tapi-search-result-selected');
|
||
}
|
||
dial(number) {
|
||
var searchInput = document.getElementsByName('searchByNumberInput');
|
||
if (searchInput.length > 0) {
|
||
searchInput[0].value = number;
|
||
searchInput[0].focus();
|
||
this.fireChangeEvents(searchInput[0]);
|
||
}
|
||
}
|
||
fireChangeEvents(element) {
|
||
var changeEvent = null;
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('input', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('input event dispatched for element: ' + element.id);
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('keyup', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('keyup event dispatched for element: ' + element.id);
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('change', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('change event dispatched for element: ' + element.id);
|
||
}
|
||
}
|
||
|
||
// CONCATENATED MODULE: ./src/js/index.js
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||
|
||
|
||
|
||
|
||
|
||
console.log('script start')
|
||
|
||
const js_search = new search_Search()
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('div.nav-search', (element) => { js_search.createSearchWindow(element) }, true)
|
||
|
||
const callNotification = new call_notification_CallNotification()
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('call-view', (element) => { callNotification.showCallNotification(element) }, false)
|
||
|
||
const callHistory = new call_history_CallHistory()
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('.call-history-list call', (element) => { callHistory.showCallHistory(element) }, false)
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "esAq":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
class ENTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return new RegExp(`(?:within|in)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?` +
|
||
"(" +
|
||
constants_1.TIME_UNITS_PATTERN +
|
||
")" +
|
||
`(?=\\W|$)`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_1.parseTimeUnits(match[1]);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
}
|
||
exports.default = ENTimeUnitWithinFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "fx0C":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const abstractRefiners_1 = __webpack_require__("LMHj");
|
||
class AbstractMergeDateRangeRefiner extends abstractRefiners_1.MergingRefiner {
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null;
|
||
}
|
||
mergeResults(textBetween, fromResult, toResult) {
|
||
if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) {
|
||
toResult.start.getCertainComponents().forEach((key) => {
|
||
if (!fromResult.start.isCertain(key)) {
|
||
fromResult.start.assign(key, toResult.start.get(key));
|
||
}
|
||
});
|
||
fromResult.start.getCertainComponents().forEach((key) => {
|
||
if (!toResult.start.isCertain(key)) {
|
||
toResult.start.assign(key, fromResult.start.get(key));
|
||
}
|
||
});
|
||
}
|
||
if (fromResult.start.date().getTime() > toResult.start.date().getTime()) {
|
||
let fromMoment = fromResult.start.dayjs();
|
||
let toMoment = toResult.start.dayjs();
|
||
if (fromResult.start.isOnlyWeekdayComponent() && fromMoment.add(-7, "days").isBefore(toMoment)) {
|
||
fromMoment = fromMoment.add(-7, "days");
|
||
fromResult.start.imply("day", fromMoment.date());
|
||
fromResult.start.imply("month", fromMoment.month() + 1);
|
||
fromResult.start.imply("year", fromMoment.year());
|
||
}
|
||
else if (toResult.start.isOnlyWeekdayComponent() && toMoment.add(7, "days").isAfter(fromMoment)) {
|
||
toMoment = toMoment.add(7, "days");
|
||
toResult.start.imply("day", toMoment.date());
|
||
toResult.start.imply("month", toMoment.month() + 1);
|
||
toResult.start.imply("year", toMoment.year());
|
||
}
|
||
else {
|
||
[toResult, fromResult] = [fromResult, toResult];
|
||
}
|
||
}
|
||
const result = fromResult.clone();
|
||
result.start = fromResult.start;
|
||
result.end = toResult.start;
|
||
result.index = Math.min(fromResult.index, toResult.index);
|
||
if (fromResult.index < toResult.index) {
|
||
result.text = fromResult.text + textBetween + toResult.text;
|
||
}
|
||
else {
|
||
result.text = toResult.text + textBetween + fromResult.text;
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = AbstractMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "g0k+":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.AbstractParserWithWordBoundaryChecking = void 0;
|
||
class AbstractParserWithWordBoundaryChecking {
|
||
pattern(context) {
|
||
const innerPattern = this.innerPattern(context);
|
||
return new RegExp(`(\\W|^)${innerPattern.source}`, innerPattern.flags);
|
||
}
|
||
extract(context, match) {
|
||
const header = match[1];
|
||
match.index = match.index + header.length;
|
||
match[0] = match[0].substring(header.length);
|
||
for (let i = 2; i < match.length; i++) {
|
||
match[i - 1] = match[i];
|
||
}
|
||
return this.innerExtract(context, match);
|
||
}
|
||
}
|
||
exports.AbstractParserWithWordBoundaryChecking = AbstractParserWithWordBoundaryChecking;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "h94c":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ARTj");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
class FRTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return new RegExp(`(?:dans|en)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_1.parseTimeUnits(match[1]);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
}
|
||
exports.default = FRTimeUnitWithinFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "hphd":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("ARTj");
|
||
const constants_2 = __webpack_require__("ARTj");
|
||
const constants_3 = __webpack_require__("ARTj");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("(?:on\\s*?)?" +
|
||
`(${constants_3.ORDINAL_NUMBER_PATTERN})` +
|
||
`(?:\\s*(?:au|\\-|\\–|jusqu\'au?|\\s)\\s*(${constants_3.ORDINAL_NUMBER_PATTERN}))?` +
|
||
`(?:-|/|\\s*(?:de)?\\s*)` +
|
||
`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
`(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?` +
|
||
`(?=\\W|$)`, "i");
|
||
const DATE_GROUP = 1;
|
||
const DATE_TO_GROUP = 2;
|
||
const MONTH_NAME_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class FRMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[YEAR_GROUP]) {
|
||
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DATE_TO_GROUP]) {
|
||
const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = FRMonthNameLittleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "i3am":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.parseYear = exports.YEAR_PATTERN = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
|
||
exports.WEEKDAY_DICTIONARY = {
|
||
"domingo": 0,
|
||
"dom": 0,
|
||
"segunda": 1,
|
||
"segunda-feira": 1,
|
||
"seg": 1,
|
||
"terça": 2,
|
||
"terça-feira": 2,
|
||
"ter": 2,
|
||
"quarta": 3,
|
||
"quarta-feira": 3,
|
||
"qua": 3,
|
||
"quinta": 4,
|
||
"quinta-feira": 4,
|
||
"qui": 4,
|
||
"sexta": 5,
|
||
"sexta-feira": 5,
|
||
"sex": 5,
|
||
"sábado": 6,
|
||
"sabado": 6,
|
||
"sab": 6,
|
||
};
|
||
exports.MONTH_DICTIONARY = {
|
||
"janeiro": 1,
|
||
"jan": 1,
|
||
"jan.": 1,
|
||
"fevereiro": 2,
|
||
"fev": 2,
|
||
"fev.": 2,
|
||
"março": 3,
|
||
"mar": 3,
|
||
"mar.": 3,
|
||
"abril": 4,
|
||
"abr": 4,
|
||
"abr.": 4,
|
||
"maio": 5,
|
||
"mai": 5,
|
||
"mai.": 5,
|
||
"junho": 6,
|
||
"jun": 6,
|
||
"jun.": 6,
|
||
"julho": 7,
|
||
"jul": 7,
|
||
"jul.": 7,
|
||
"agosto": 8,
|
||
"ago": 8,
|
||
"ago.": 8,
|
||
"setembro": 9,
|
||
"set": 9,
|
||
"set.": 9,
|
||
"outubro": 10,
|
||
"out": 10,
|
||
"out.": 10,
|
||
"novembro": 11,
|
||
"nov": 11,
|
||
"nov.": 11,
|
||
"dezembro": 12,
|
||
"dez": 12,
|
||
"dez.": 12,
|
||
};
|
||
exports.YEAR_PATTERN = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";
|
||
function parseYear(match) {
|
||
if (match.match(/^[0-9]{1,4}$/)) {
|
||
let yearNumber = parseInt(match);
|
||
if (yearNumber < 100) {
|
||
if (yearNumber > 50) {
|
||
yearNumber = yearNumber + 1900;
|
||
}
|
||
else {
|
||
yearNumber = yearNumber + 2000;
|
||
}
|
||
}
|
||
return yearNumber;
|
||
}
|
||
if (match.match(/a\.?\s*c\.?/i)) {
|
||
match = match.replace(/a\.?\s*c\.?/i, "");
|
||
return -parseInt(match);
|
||
}
|
||
return parseInt(match);
|
||
}
|
||
exports.parseYear = parseYear;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "jTCZ":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
class ForwardDateRefiner {
|
||
refine(context, results) {
|
||
if (!context.option.forwardDate) {
|
||
return results;
|
||
}
|
||
results.forEach(function (result) {
|
||
let refMoment = dayjs_1.default(context.refDate);
|
||
if (result.start.isOnlyDayMonthComponent() && refMoment.isAfter(result.start.dayjs())) {
|
||
for (let i = 0; i < 3 && refMoment.isAfter(result.start.dayjs()); i++) {
|
||
result.start.imply("year", result.start.get("year") + 1);
|
||
context.debug(() => {
|
||
console.log(`Forward yearly adjusted for ${result} (${result.start})`);
|
||
});
|
||
if (result.end && !result.end.isCertain("year")) {
|
||
result.end.imply("year", result.end.get("year") + 1);
|
||
context.debug(() => {
|
||
console.log(`Forward yearly adjusted for ${result} (${result.end})`);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
if (result.start.isOnlyWeekdayComponent() && refMoment.isAfter(result.start.dayjs())) {
|
||
if (refMoment.day() > result.start.get("weekday")) {
|
||
refMoment = refMoment.day(result.start.get("weekday") + 7);
|
||
}
|
||
else {
|
||
refMoment = refMoment.day(result.start.get("weekday"));
|
||
}
|
||
result.start.imply("day", refMoment.date());
|
||
result.start.imply("month", refMoment.month() + 1);
|
||
result.start.imply("year", refMoment.year());
|
||
context.debug(() => {
|
||
console.log(`Forward weekly adjusted for ${result} (${result.start})`);
|
||
});
|
||
if (result.end && result.end.isOnlyWeekdayComponent()) {
|
||
if (refMoment.day() > result.end.get("weekday")) {
|
||
refMoment = refMoment.day(result.end.get("weekday") + 7);
|
||
}
|
||
else {
|
||
refMoment = refMoment.day(result.end.get("weekday"));
|
||
}
|
||
result.end.imply("day", refMoment.date());
|
||
result.end.imply("month", refMoment.month() + 1);
|
||
result.end.imply("year", refMoment.year());
|
||
context.debug(() => {
|
||
console.log(`Forward weekly adjusted for ${result} (${result.end})`);
|
||
});
|
||
}
|
||
}
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
exports.default = ForwardDateRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "ksW2":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
exports.WEEKDAY_DICTIONARY = {
|
||
sunday: 0,
|
||
sun: 0,
|
||
"sun.": 0,
|
||
monday: 1,
|
||
mon: 1,
|
||
"mon.": 1,
|
||
tuesday: 2,
|
||
tue: 2,
|
||
"tue.": 2,
|
||
wednesday: 3,
|
||
wed: 3,
|
||
"wed.": 3,
|
||
thursday: 4,
|
||
thurs: 4,
|
||
"thurs.": 4,
|
||
thur: 4,
|
||
"thur.": 4,
|
||
thu: 4,
|
||
"thu.": 4,
|
||
friday: 5,
|
||
fri: 5,
|
||
"fri.": 5,
|
||
saturday: 6,
|
||
sat: 6,
|
||
"sat.": 6,
|
||
};
|
||
exports.MONTH_DICTIONARY = {
|
||
january: 1,
|
||
jan: 1,
|
||
"jan.": 1,
|
||
february: 2,
|
||
feb: 2,
|
||
"feb.": 2,
|
||
march: 3,
|
||
mar: 3,
|
||
"mar.": 3,
|
||
april: 4,
|
||
apr: 4,
|
||
"apr.": 4,
|
||
may: 5,
|
||
june: 6,
|
||
jun: 6,
|
||
"jun.": 6,
|
||
july: 7,
|
||
jul: 7,
|
||
"jul.": 7,
|
||
august: 8,
|
||
aug: 8,
|
||
"aug.": 8,
|
||
september: 9,
|
||
sep: 9,
|
||
"sep.": 9,
|
||
sept: 9,
|
||
"sept.": 9,
|
||
october: 10,
|
||
oct: 10,
|
||
"oct.": 10,
|
||
november: 11,
|
||
nov: 11,
|
||
"nov.": 11,
|
||
december: 12,
|
||
dec: 12,
|
||
"dec.": 12,
|
||
};
|
||
exports.INTEGER_WORD_DICTIONARY = {
|
||
one: 1,
|
||
two: 2,
|
||
three: 3,
|
||
four: 4,
|
||
five: 5,
|
||
six: 6,
|
||
seven: 7,
|
||
eight: 8,
|
||
nine: 9,
|
||
ten: 10,
|
||
eleven: 11,
|
||
twelve: 12,
|
||
};
|
||
exports.ORDINAL_WORD_DICTIONARY = {
|
||
first: 1,
|
||
second: 2,
|
||
third: 3,
|
||
fourth: 4,
|
||
fifth: 5,
|
||
sixth: 6,
|
||
seventh: 7,
|
||
eighth: 8,
|
||
ninth: 9,
|
||
tenth: 10,
|
||
eleventh: 11,
|
||
twelfth: 12,
|
||
thirteenth: 13,
|
||
fourteenth: 14,
|
||
fifteenth: 15,
|
||
sixteenth: 16,
|
||
seventeenth: 17,
|
||
eighteenth: 18,
|
||
nineteenth: 19,
|
||
twentieth: 20,
|
||
"twenty first": 21,
|
||
"twenty-first": 21,
|
||
"twenty second": 22,
|
||
"twenty-second": 22,
|
||
"twenty third": 23,
|
||
"twenty-third": 23,
|
||
"twenty fourth": 24,
|
||
"twenty-fourth": 24,
|
||
"twenty fifth": 25,
|
||
"twenty-fifth": 25,
|
||
"twenty sixth": 26,
|
||
"twenty-sixth": 26,
|
||
"twenty seventh": 27,
|
||
"twenty-seventh": 27,
|
||
"twenty eighth": 28,
|
||
"twenty-eighth": 28,
|
||
"twenty ninth": 29,
|
||
"twenty-ninth": 29,
|
||
"thirtieth": 30,
|
||
"thirty first": 31,
|
||
"thirty-first": 31,
|
||
};
|
||
exports.TIME_UNIT_DICTIONARY = {
|
||
sec: "second",
|
||
second: "second",
|
||
seconds: "second",
|
||
min: "minute",
|
||
mins: "minute",
|
||
minute: "minute",
|
||
minutes: "minute",
|
||
h: "hour",
|
||
hr: "hour",
|
||
hrs: "hour",
|
||
hour: "hour",
|
||
hours: "hour",
|
||
day: "d",
|
||
days: "d",
|
||
week: "week",
|
||
weeks: "week",
|
||
month: "month",
|
||
months: "month",
|
||
y: "year",
|
||
yr: "year",
|
||
year: "year",
|
||
years: "year",
|
||
};
|
||
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
|
||
function parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.INTEGER_WORD_DICTIONARY[num];
|
||
}
|
||
else if (num === "a" || num === "an") {
|
||
return 1;
|
||
}
|
||
else if (num.match(/few/)) {
|
||
return 3;
|
||
}
|
||
else if (num.match(/half/)) {
|
||
return 0.5;
|
||
}
|
||
else if (num.match(/couple/)) {
|
||
return 2;
|
||
}
|
||
else if (num.match(/several/)) {
|
||
return 7;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
exports.parseNumberPattern = parseNumberPattern;
|
||
exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
|
||
function parseOrdinalNumberPattern(match) {
|
||
let num = match.toLowerCase();
|
||
if (exports.ORDINAL_WORD_DICTIONARY[num] !== undefined) {
|
||
return exports.ORDINAL_WORD_DICTIONARY[num];
|
||
}
|
||
num = num.replace(/(?:st|nd|rd|th)$/i, "");
|
||
return parseInt(num);
|
||
}
|
||
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
|
||
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:BE|AD|BC)|[1-2][0-9]{3}|[5-9][0-9])`;
|
||
function parseYear(match) {
|
||
if (/BE/i.test(match)) {
|
||
match = match.replace(/BE/i, "");
|
||
return parseInt(match) - 543;
|
||
}
|
||
if (/BC/i.test(match)) {
|
||
match = match.replace(/BC/i, "");
|
||
return -parseInt(match);
|
||
}
|
||
if (/AD/i.test(match)) {
|
||
match = match.replace(/AD/i, "");
|
||
return parseInt(match);
|
||
}
|
||
const rawYearNumber = parseInt(match);
|
||
return years_1.findMostLikelyADYear(rawYearNumber);
|
||
}
|
||
exports.parseYear = parseYear;
|
||
const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s*(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s*`;
|
||
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE = SINGLE_TIME_UNIT_PATTERN.replace(/\((?!\?)/g, "(?:");
|
||
exports.TIME_UNITS_PATTERN = `(?:(?:about|around)\\s*)?` +
|
||
`${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE}\\s*(?:,?\\s*${SINGLE_TIME_UNIT_PATTERN_NO_CAPTURE})*`;
|
||
function parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length);
|
||
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
exports.parseTimeUnits = parseTimeUnits;
|
||
function collectDateTimeFragment(fragments, match) {
|
||
const num = parseNumberPattern(match[1]);
|
||
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "loBo":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("Gqx+"));
|
||
class PTMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(?:,|à)?\\s*$");
|
||
}
|
||
}
|
||
exports.default = PTMergeDateTimeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "mZHA":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.toDayJSClosestWeekday = exports.toDayJSWeekday = void 0;
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
var Modifier;
|
||
(function (Modifier) {
|
||
Modifier[Modifier["THIS"] = 0] = "THIS";
|
||
Modifier[Modifier["NEXT"] = 1] = "NEXT";
|
||
Modifier[Modifier["LAST"] = 2] = "LAST";
|
||
})(Modifier || (Modifier = {}));
|
||
function toDayJSWeekday(refDate, offset, modifier) {
|
||
if (!modifier) {
|
||
return toDayJSClosestWeekday(refDate, offset);
|
||
}
|
||
let date = dayjs_1.default(refDate);
|
||
switch (modifier) {
|
||
case "this":
|
||
date = date.day(offset);
|
||
break;
|
||
case "next":
|
||
date = date.day(offset + 7);
|
||
break;
|
||
case "last":
|
||
date = date.day(offset - 7);
|
||
break;
|
||
}
|
||
return date;
|
||
}
|
||
exports.toDayJSWeekday = toDayJSWeekday;
|
||
function toDayJSClosestWeekday(refDate, offset) {
|
||
let date = dayjs_1.default(refDate);
|
||
const refOffset = date.day();
|
||
if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) {
|
||
date = date.day(offset - 7);
|
||
}
|
||
else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) {
|
||
date = date.day(offset + 7);
|
||
}
|
||
else {
|
||
date = date.day(offset);
|
||
}
|
||
return date;
|
||
}
|
||
exports.toDayJSClosestWeekday = toDayJSClosestWeekday;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "mx/2":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
!function(t,n){ true?module.exports=n():undefined}(this,function(){"use strict";var t="month",n="quarter";return function(r,i){var e=i.prototype;e.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var u=e.add;e.add=function(r,i){return r=Number(r),this.$utils().p(i)===n?this.add(3*r,t):u.bind(this)(r,i)};var s=e.startOf;e.startOf=function(r,i){var e=this.$utils(),u=!!e.u(i)||i;if(e.p(r)===n){var a=this.quarter()-1;return u?this.month(3*a).startOf(t).startOf("day"):this.month(3*a+2).endOf(t).endOf("day")}return s.bind(this)(r,i)}}});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "omFw":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.matchAnyPattern = exports.extractTerms = exports.patternWithWordBreak = void 0;
|
||
function patternWithWordBreak(regExp) {
|
||
return RegExp("" + regExp.source);
|
||
}
|
||
exports.patternWithWordBreak = patternWithWordBreak;
|
||
function extractTerms(dictionary) {
|
||
let keys;
|
||
if (dictionary instanceof Array) {
|
||
keys = [...dictionary];
|
||
}
|
||
else if (dictionary instanceof Map) {
|
||
keys = Array.from(dictionary.keys());
|
||
}
|
||
else {
|
||
keys = Object.keys(dictionary);
|
||
}
|
||
return keys;
|
||
}
|
||
exports.extractTerms = extractTerms;
|
||
function matchAnyPattern(dictionary) {
|
||
const joinedTerms = extractTerms(dictionary)
|
||
.sort((a, b) => b.length - a.length)
|
||
.join("|")
|
||
.replace(/\./g, "\\.");
|
||
return `(?:${joinedTerms})`;
|
||
}
|
||
exports.matchAnyPattern = matchAnyPattern;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "p76M":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
class ENCasualTimeParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return /(?:this)?\s*(namiddag|avond|middernacht|ochtend|middag|\'s middags|\'s avonds|\'s ochtends)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const targetDate = dayjs_1.default(context.refDate);
|
||
const component = context.createParsingComponents();
|
||
switch (match[1].toLowerCase()) {
|
||
case "namiddag":
|
||
case "'s namiddags":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 15);
|
||
break;
|
||
case "avond":
|
||
case "'s avonds'":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 20);
|
||
break;
|
||
case "middernacht":
|
||
dayjs_2.assignTheNextDay(component, targetDate);
|
||
component.imply("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
break;
|
||
case "ochtend":
|
||
case "'s ochtends":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 6);
|
||
break;
|
||
case "middag":
|
||
case "'s middags":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 12);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = ENCasualTimeParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "pC9g":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const abstractRefiners_1 = __webpack_require__("LMHj");
|
||
class MergeWeekdayComponentRefiner extends abstractRefiners_1.MergingRefiner {
|
||
mergeResults(textBetween, currentResult, nextResult) {
|
||
const newResult = nextResult.clone();
|
||
newResult.index = currentResult.index;
|
||
newResult.text = currentResult.text + textBetween + newResult.text;
|
||
newResult.start.assign("weekday", currentResult.start.get("weekday"));
|
||
if (newResult.end) {
|
||
newResult.end.assign("weekday", currentResult.start.get("weekday"));
|
||
}
|
||
return newResult;
|
||
}
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
const weekdayThenNormalDate = currentResult.start.isOnlyWeekdayComponent() &&
|
||
!currentResult.start.isCertain("hour") &&
|
||
nextResult.start.isCertain("day");
|
||
return weekdayThenNormalDate && textBetween.match(/^,?\s*$/) != null;
|
||
}
|
||
}
|
||
exports.default = MergeWeekdayComponentRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "pKWP":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.findYearClosestToRef = exports.findMostLikelyADYear = void 0;
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
function findMostLikelyADYear(yearNumber) {
|
||
if (yearNumber < 100) {
|
||
if (yearNumber > 50) {
|
||
yearNumber = yearNumber + 1900;
|
||
}
|
||
else {
|
||
yearNumber = yearNumber + 2000;
|
||
}
|
||
}
|
||
return yearNumber;
|
||
}
|
||
exports.findMostLikelyADYear = findMostLikelyADYear;
|
||
function findYearClosestToRef(refDate, day, month) {
|
||
const refMoment = dayjs_1.default(refDate);
|
||
let dateMoment = refMoment;
|
||
dateMoment = dateMoment.month(month - 1);
|
||
dateMoment = dateMoment.date(day);
|
||
dateMoment = dateMoment.year(refMoment.year());
|
||
const nextYear = dateMoment.add(1, "y");
|
||
const lastYear = dateMoment.add(-1, "y");
|
||
if (Math.abs(nextYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
|
||
dateMoment = nextYear;
|
||
}
|
||
else if (Math.abs(lastYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
|
||
dateMoment = lastYear;
|
||
}
|
||
return dateMoment.year();
|
||
}
|
||
exports.findYearClosestToRef = findYearClosestToRef;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "pgTb":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class PTMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(?:-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = PTMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "q2Un":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.tonight = exports.tomorrow = exports.yesterday = exports.today = exports.now = void 0;
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
const index_1 = __webpack_require__("6EsV");
|
||
function now(refDate) {
|
||
const targetDate = dayjs_1.default(refDate);
|
||
const component = new results_1.ParsingComponents(refDate, {});
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
dayjs_2.assignSimilarTime(component, targetDate);
|
||
return component;
|
||
}
|
||
exports.now = now;
|
||
function today(refDate) {
|
||
const targetDate = dayjs_1.default(refDate);
|
||
const component = new results_1.ParsingComponents(refDate, {});
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
dayjs_2.implySimilarTime(component, targetDate);
|
||
return component;
|
||
}
|
||
exports.today = today;
|
||
function yesterday(refDate) {
|
||
let targetDate = dayjs_1.default(refDate);
|
||
const component = new results_1.ParsingComponents(refDate, {});
|
||
targetDate = targetDate.add(-1, "day");
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
dayjs_2.implySimilarTime(component, targetDate);
|
||
return component;
|
||
}
|
||
exports.yesterday = yesterday;
|
||
function tomorrow(refDate) {
|
||
const targetDate = dayjs_1.default(refDate);
|
||
const component = new results_1.ParsingComponents(refDate, {});
|
||
dayjs_2.assignTheNextDay(component, targetDate);
|
||
return component;
|
||
}
|
||
exports.tomorrow = tomorrow;
|
||
function tonight(refDate, implyHour = 22) {
|
||
const targetDate = dayjs_1.default(refDate);
|
||
const component = new results_1.ParsingComponents(refDate, {});
|
||
component.imply("hour", implyHour);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
return component;
|
||
}
|
||
exports.tonight = tonight;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "qcEV":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const weeks_1 = __webpack_require__("mZHA");
|
||
const PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" +
|
||
"(?:on\\s*?)?" +
|
||
"(?:(this|last|past|next)\\s*)?" +
|
||
`(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})` +
|
||
"(?:\\s*(?:\\,|\\)|\\)))?" +
|
||
"(?:\\s*(this|last|past|next)\\s*week)?" +
|
||
"(?=\\W|$)", "i");
|
||
const PREFIX_GROUP = 1;
|
||
const WEEKDAY_GROUP = 2;
|
||
const POSTFIX_GROUP = 3;
|
||
class ENWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
|
||
const prefix = match[PREFIX_GROUP];
|
||
const postfix = match[POSTFIX_GROUP];
|
||
let modifierWord = prefix || postfix;
|
||
modifierWord = modifierWord || "";
|
||
modifierWord = modifierWord.toLowerCase();
|
||
let modifier = null;
|
||
if (modifierWord == "last" || modifierWord == "past") {
|
||
modifier = "last";
|
||
}
|
||
else if (modifierWord == "next") {
|
||
modifier = "next";
|
||
}
|
||
else if (modifierWord == "this") {
|
||
modifier = "this";
|
||
}
|
||
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
|
||
return context
|
||
.createParsingComponents()
|
||
.assign("weekday", offset)
|
||
.imply("day", date.date())
|
||
.imply("month", date.month() + 1)
|
||
.imply("year", date.year());
|
||
}
|
||
}
|
||
exports.default = ENWeekdayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "r8Bu":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
const timeunits_1 = __webpack_require__("aWHD");
|
||
class DECasualTimeParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_1.default(context.refDate);
|
||
const timeKeywordPattern = match[2].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
dayjs_2.implySimilarTime(component, targetDate);
|
||
return DECasualTimeParser.extractTimeComponents(component, timeKeywordPattern);
|
||
}
|
||
static extractTimeComponents(component, timeKeywordPattern) {
|
||
switch (timeKeywordPattern) {
|
||
case "morgen":
|
||
component.imply("hour", 6);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
case "vormittag":
|
||
component.imply("hour", 9);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
case "mittag":
|
||
case "mittags":
|
||
component.imply("hour", 12);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
case "nachmittag":
|
||
component.imply("hour", 15);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
break;
|
||
case "abend":
|
||
component.imply("hour", 18);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
break;
|
||
case "nacht":
|
||
component.imply("hour", 22);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
break;
|
||
case "mitternacht":
|
||
if (component.get("hour") > 1) {
|
||
component = timeunits_1.addImpliedTimeUnits(component, { "day": 1 });
|
||
}
|
||
component.imply("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = DECasualTimeParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "rFfs":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("fx0C"));
|
||
class FRMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default {
|
||
patternBetween() {
|
||
return /^\s*(à|a|-)\s*$/i;
|
||
}
|
||
}
|
||
exports.default = FRMergeDateRangeRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "rN2S":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const constants_2 = __webpack_require__("ksW2");
|
||
const constants_3 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp("(?:on\\s*?)?" +
|
||
`(${constants_3.ORDINAL_NUMBER_PATTERN})` +
|
||
"(?:\\s*" +
|
||
"(?:to|\\-|\\–|until|through|till|\\s)\\s*" +
|
||
`(${constants_3.ORDINAL_NUMBER_PATTERN})` +
|
||
")?" +
|
||
"(?:-|/|\\s*(?:of)?\\s*)" +
|
||
"(" +
|
||
pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY) +
|
||
")" +
|
||
"(?:" +
|
||
"(?:-|/|,?\\s*)" +
|
||
`(${constants_2.YEAR_PATTERN}(?![^\\s]\\d))` +
|
||
")?" +
|
||
"(?=\\W|$)", "i");
|
||
const DATE_GROUP = 1;
|
||
const DATE_TO_GROUP = 2;
|
||
const MONTH_NAME_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class ENMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[YEAR_GROUP]) {
|
||
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DATE_TO_GROUP]) {
|
||
const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = ENMonthNameLittleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "rk+4":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ARTj");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const weeks_1 = __webpack_require__("mZHA");
|
||
const PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" +
|
||
"(?:(?:ce)\\s*)?" +
|
||
`(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})` +
|
||
"(?:\\s*(?:\\,|\\)|\\)))?" +
|
||
"(?:\\s*(dernier|prochain)\\s*)?" +
|
||
"(?=\\W|\\d|$)", "i");
|
||
const WEEKDAY_GROUP = 1;
|
||
const POSTFIX_GROUP = 2;
|
||
class FRWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
|
||
if (offset === undefined) {
|
||
return null;
|
||
}
|
||
let suffix = match[POSTFIX_GROUP];
|
||
suffix = suffix || "";
|
||
suffix = suffix.toLowerCase();
|
||
let modifier = null;
|
||
if (suffix == "dernier") {
|
||
modifier = "last";
|
||
}
|
||
else if (suffix == "prochain") {
|
||
modifier = "next";
|
||
}
|
||
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
|
||
return context
|
||
.createParsingComponents()
|
||
.assign("weekday", offset)
|
||
.imply("day", date.date())
|
||
.imply("month", date.month() + 1)
|
||
.imply("year", date.year());
|
||
}
|
||
}
|
||
exports.default = FRWeekdayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "sFAh":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractTimeExpressionParser_1 = __webpack_require__("MXb4");
|
||
class PTTimeExpressionParser extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
|
||
primaryPrefix() {
|
||
return "(?:(?:ao?|às?|das|da|de|do)\\s*)?";
|
||
}
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|a(?:o)?|\\?)\\s*";
|
||
}
|
||
}
|
||
exports.default = PTTimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "sQQt":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s]` +
|
||
`(?:(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]` +
|
||
`([0-9]{1,2})` +
|
||
"(?=\\W|$)", "i");
|
||
const YEAR_NUMBER_GROUP = 1;
|
||
const MONTH_NAME_GROUP = 2;
|
||
const MONTH_NUMBER_GROUP = 3;
|
||
const DATE_NUMBER_GROUP = 4;
|
||
class ENCasualYearMonthDayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const month = match[MONTH_NUMBER_GROUP]
|
||
? parseInt(match[MONTH_NUMBER_GROUP])
|
||
: constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
if (month < 1 || month > 12) {
|
||
return null;
|
||
}
|
||
const year = parseInt(match[YEAR_NUMBER_GROUP]);
|
||
const day = parseInt(match[DATE_NUMBER_GROUP]);
|
||
return {
|
||
day: day,
|
||
month: month,
|
||
year: year,
|
||
};
|
||
}
|
||
}
|
||
exports.default = ENCasualYearMonthDayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "uGZ/":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("G6Ui");
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const constants_2 = __webpack_require__("G6Ui");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
"\\s*" +
|
||
"(?:" +
|
||
`[,-]?\\s*(${constants_2.YEAR_PATTERN})?` +
|
||
")?" +
|
||
"(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)", "i");
|
||
const MONTH_NAME_GROUP = 1;
|
||
const YEAR_GROUP = 2;
|
||
class ENMonthNameParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
if (match[0].length <= 3) {
|
||
return null;
|
||
}
|
||
const components = context.createParsingComponents();
|
||
components.imply("day", 1);
|
||
const monthName = match[MONTH_NAME_GROUP];
|
||
const month = constants_1.MONTH_DICTIONARY[monthName.toLowerCase()];
|
||
components.assign("month", month);
|
||
if (match[YEAR_GROUP]) {
|
||
const year = constants_2.parseYear(match[YEAR_GROUP]);
|
||
components.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, 1, month);
|
||
components.imply("year", year);
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = ENMonthNameParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "uZbV":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const timeunits_1 = __webpack_require__("aWHD");
|
||
const PATTERN = new RegExp("" + "(" + constants_1.TIME_UNITS_PATTERN + ")" + "(?:ago|before|earlier)(?=(?:\\W|$))", "i");
|
||
const STRICT_PATTERN = new RegExp("" + "(" + constants_1.TIME_UNITS_PATTERN + ")" + "ago(?=(?:\\W|$))", "i");
|
||
class ENTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
innerPattern() {
|
||
return this.strictMode ? STRICT_PATTERN : PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_1.parseTimeUnits(match[1]);
|
||
const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits);
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, outputTimeUnits);
|
||
}
|
||
}
|
||
exports.default = ENTimeUnitAgoFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "ur7Q":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const constants_2 = __webpack_require__("ksW2");
|
||
const constants_3 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
"(?:-|/|\\s*,?\\s*)" +
|
||
`(${constants_2.ORDINAL_NUMBER_PATTERN})(?!\\s*)\\s*` +
|
||
"(?:" +
|
||
"(?:to|\\-)\\s*" +
|
||
`(${constants_2.ORDINAL_NUMBER_PATTERN})\\s*` +
|
||
")?" +
|
||
"(?:" +
|
||
"(?:-|/|\\s*,?\\s*)" +
|
||
`(${constants_3.YEAR_PATTERN})` +
|
||
")?" +
|
||
"(?=\\W|$)(?!\\:\\d)", "i");
|
||
const MONTH_NAME_GROUP = 1;
|
||
const DATE_GROUP = 2;
|
||
const DATE_TO_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class ENMonthNameMiddleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
return null;
|
||
}
|
||
const components = context.createParsingComponents({
|
||
day: day,
|
||
month: month,
|
||
});
|
||
if (match[YEAR_GROUP]) {
|
||
const year = constants_3.parseYear(match[YEAR_GROUP]);
|
||
components.assign("year", year);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
components.imply("year", year);
|
||
}
|
||
if (!match[DATE_TO_GROUP]) {
|
||
return components;
|
||
}
|
||
const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
result.start = components;
|
||
result.end = components.clone();
|
||
result.end.assign("day", endDate);
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = ENMonthNameMiddleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "wI+u":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const index_1 = __webpack_require__("6EsV");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_1 = __webpack_require__("MVmo");
|
||
const dayjs_2 = __importDefault(__webpack_require__("Wgwc"));
|
||
class PTCasualTimeParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return /(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const targetDate = dayjs_2.default(context.refDate);
|
||
const component = context.createParsingComponents();
|
||
switch (match[1].toLowerCase()) {
|
||
case "tarde":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 15);
|
||
break;
|
||
case "noite":
|
||
component.imply("meridiem", index_1.Meridiem.PM);
|
||
component.imply("hour", 22);
|
||
break;
|
||
case "manha":
|
||
case "manhã":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 6);
|
||
break;
|
||
case "meia-noite":
|
||
dayjs_1.assignTheNextDay(component, targetDate);
|
||
component.imply("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
break;
|
||
case "meio-dia":
|
||
component.imply("meridiem", index_1.Meridiem.AM);
|
||
component.imply("hour", 12);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = PTCasualTimeParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "xXdI":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const results_1 = __webpack_require__("MpCh");
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const PATTERN = new RegExp(`(this|next|last|past)\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?=\\s*)` + "(?=\\W|$)", "i");
|
||
const MODIFIER_WORD_GROUP = 1;
|
||
const RELATIVE_WORD_GROUP = 2;
|
||
class ENRelativeDateFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const modifier = match[MODIFIER_WORD_GROUP].toLowerCase();
|
||
const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase();
|
||
const timeunit = constants_1.TIME_UNIT_DICTIONARY[unitWord];
|
||
if (modifier == "next") {
|
||
const timeUnits = {};
|
||
timeUnits[timeunit] = 1;
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
if (modifier == "last" || modifier == "past") {
|
||
const timeUnits = {};
|
||
timeUnits[timeunit] = -1;
|
||
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
|
||
}
|
||
const components = context.createParsingComponents();
|
||
let date = dayjs_1.default(context.refDate);
|
||
if (unitWord.match(/week/i)) {
|
||
date = date.add(-date.get("d"), "d");
|
||
components.imply("day", date.date());
|
||
components.imply("month", date.month() + 1);
|
||
components.imply("year", date.year());
|
||
}
|
||
else if (unitWord.match(/month/i)) {
|
||
date = date.add(-date.date() + 1, "d");
|
||
components.imply("day", date.date());
|
||
components.assign("year", date.year());
|
||
components.assign("month", date.month() + 1);
|
||
}
|
||
else if (unitWord.match(/year/i)) {
|
||
date = date.add(-date.date() + 1, "d");
|
||
date = date.add(-date.month(), "month");
|
||
components.imply("day", date.date());
|
||
components.imply("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
exports.default = ENRelativeDateFormatParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "xkid":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const constants_1 = __webpack_require__("ksW2");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const weeks_1 = __webpack_require__("mZHA");
|
||
const PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" +
|
||
"(?:on\\s*?)?" +
|
||
"(?:(this|last|past|next)\\s*)?" +
|
||
`(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})` +
|
||
"(?:\\s*(?:\\,|\\)|\\)))?" +
|
||
"(?:\\s*(this|last|past|next)\\s*week)?" +
|
||
"(?=\\W|$)", "i");
|
||
const PREFIX_GROUP = 1;
|
||
const WEEKDAY_GROUP = 2;
|
||
const POSTFIX_GROUP = 3;
|
||
class ENWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
|
||
const prefix = match[PREFIX_GROUP];
|
||
const postfix = match[POSTFIX_GROUP];
|
||
let modifierWord = prefix || postfix;
|
||
modifierWord = modifierWord || "";
|
||
modifierWord = modifierWord.toLowerCase();
|
||
let modifier = null;
|
||
if (modifierWord == "last" || modifierWord == "past") {
|
||
modifier = "last";
|
||
}
|
||
else if (modifierWord == "next") {
|
||
modifier = "next";
|
||
}
|
||
else if (modifierWord == "this") {
|
||
modifier = "this";
|
||
}
|
||
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
|
||
return context
|
||
.createParsingComponents()
|
||
.assign("weekday", offset)
|
||
.imply("day", date.date())
|
||
.imply("month", date.month() + 1)
|
||
.imply("year", date.year());
|
||
}
|
||
}
|
||
exports.default = ENWeekdayParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "yJtp":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const years_1 = __webpack_require__("pKWP");
|
||
const constants_1 = __webpack_require__("i3am");
|
||
const constants_2 = __webpack_require__("i3am");
|
||
const pattern_1 = __webpack_require__("omFw");
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const PATTERN = new RegExp(`([0-9]{1,2})(?:º|ª|°)?` +
|
||
"(?:\\s*(?:desde|de|\\-|\\–|ao?|\\s)\\s*([0-9]{1,2})(?:º|ª|°)?)?\\s*(?:de)?\\s*" +
|
||
`(?:-|/|\\s*(?:de|,)?\\s*)` +
|
||
`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})` +
|
||
`(?:\\s*(?:de|,)?\\s*(${constants_2.YEAR_PATTERN}))?` +
|
||
`(?=\\W|$)`, "i");
|
||
const DATE_GROUP = 1;
|
||
const DATE_TO_GROUP = 2;
|
||
const MONTH_NAME_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class PTMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = parseInt(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[YEAR_GROUP]) {
|
||
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
}
|
||
else {
|
||
const year = years_1.findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DATE_TO_GROUP]) {
|
||
const endDate = parseInt(match[DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
exports.default = PTMonthNameLittleEndianParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "yRC8":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
|
||
const configurations_1 = __webpack_require__("HskP");
|
||
const chrono_1 = __webpack_require__("aLSU");
|
||
const FRCasualDateParser_1 = __importDefault(__webpack_require__("WlRN"));
|
||
const FRCasualTimeParser_1 = __importDefault(__webpack_require__("4W4v"));
|
||
const SlashDateFormatParser_1 = __importDefault(__webpack_require__("5Jgo"));
|
||
const FRTimeExpressionParser_1 = __importDefault(__webpack_require__("zVke"));
|
||
const FRMergeDateTimeRefiner_1 = __importDefault(__webpack_require__("IT3k"));
|
||
const FRMergeDateRangeRefiner_1 = __importDefault(__webpack_require__("rFfs"));
|
||
const FRWeekdayParser_1 = __importDefault(__webpack_require__("rk+4"));
|
||
const FRSpecificTimeExpressionParser_1 = __importDefault(__webpack_require__("4caT"));
|
||
const FRMonthNameLittleEndianParser_1 = __importDefault(__webpack_require__("hphd"));
|
||
const FRTimeUnitAgoFormatParser_1 = __importDefault(__webpack_require__("TXM6"));
|
||
const FRTimeUnitWithinFormatParser_1 = __importDefault(__webpack_require__("h94c"));
|
||
const FRTimeUnitRelativeFormatParser_1 = __importDefault(__webpack_require__("SH9J"));
|
||
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
|
||
exports.strict = new chrono_1.Chrono(createConfiguration(true));
|
||
function parse(text, ref, option) {
|
||
return exports.casual.parse(text, ref, option);
|
||
}
|
||
exports.parse = parse;
|
||
function parseDate(text, ref, option) {
|
||
return exports.casual.parseDate(text, ref, option);
|
||
}
|
||
exports.parseDate = parseDate;
|
||
function createCasualConfiguration(littleEndian = true) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new FRCasualDateParser_1.default());
|
||
option.parsers.unshift(new FRCasualTimeParser_1.default());
|
||
option.parsers.unshift(new FRTimeUnitRelativeFormatParser_1.default());
|
||
return option;
|
||
}
|
||
exports.createCasualConfiguration = createCasualConfiguration;
|
||
function createConfiguration(strictMode = true, littleEndian = true) {
|
||
return configurations_1.includeCommonConfiguration({
|
||
parsers: [
|
||
new SlashDateFormatParser_1.default(littleEndian),
|
||
new FRMonthNameLittleEndianParser_1.default(),
|
||
new FRTimeExpressionParser_1.default(),
|
||
new FRSpecificTimeExpressionParser_1.default(),
|
||
new FRTimeUnitAgoFormatParser_1.default(),
|
||
new FRTimeUnitWithinFormatParser_1.default(),
|
||
new FRWeekdayParser_1.default(),
|
||
],
|
||
refiners: [new FRMergeDateTimeRefiner_1.default(), new FRMergeDateRangeRefiner_1.default()],
|
||
}, strictMode);
|
||
}
|
||
exports.createConfiguration = createConfiguration;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "ylIs":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const TIMEZONE_NAME_PATTERN = new RegExp("^\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
|
||
const DEFAULT_TIMEZONE_ABBR_MAP = {
|
||
ACDT: 630,
|
||
ACST: 570,
|
||
ADT: -180,
|
||
AEDT: 660,
|
||
AEST: 600,
|
||
AFT: 270,
|
||
AKDT: -480,
|
||
AKST: -540,
|
||
ALMT: 360,
|
||
AMST: -180,
|
||
AMT: -240,
|
||
ANAST: 720,
|
||
ANAT: 720,
|
||
AQTT: 300,
|
||
ART: -180,
|
||
AST: -240,
|
||
AWDT: 540,
|
||
AWST: 480,
|
||
AZOST: 0,
|
||
AZOT: -60,
|
||
AZST: 300,
|
||
AZT: 240,
|
||
BNT: 480,
|
||
BOT: -240,
|
||
BRST: -120,
|
||
BRT: -180,
|
||
BST: 60,
|
||
BTT: 360,
|
||
CAST: 480,
|
||
CAT: 120,
|
||
CCT: 390,
|
||
CDT: -300,
|
||
CEST: 120,
|
||
CET: 60,
|
||
CHADT: 825,
|
||
CHAST: 765,
|
||
CKT: -600,
|
||
CLST: -180,
|
||
CLT: -240,
|
||
COT: -300,
|
||
CST: -360,
|
||
CVT: -60,
|
||
CXT: 420,
|
||
ChST: 600,
|
||
DAVT: 420,
|
||
EASST: -300,
|
||
EAST: -360,
|
||
EAT: 180,
|
||
ECT: -300,
|
||
EDT: -240,
|
||
EEST: 180,
|
||
EET: 120,
|
||
EGST: 0,
|
||
EGT: -60,
|
||
EST: -300,
|
||
ET: -300,
|
||
FJST: 780,
|
||
FJT: 720,
|
||
FKST: -180,
|
||
FKT: -240,
|
||
FNT: -120,
|
||
GALT: -360,
|
||
GAMT: -540,
|
||
GET: 240,
|
||
GFT: -180,
|
||
GILT: 720,
|
||
GMT: 0,
|
||
GST: 240,
|
||
GYT: -240,
|
||
HAA: -180,
|
||
HAC: -300,
|
||
HADT: -540,
|
||
HAE: -240,
|
||
HAP: -420,
|
||
HAR: -360,
|
||
HAST: -600,
|
||
HAT: -90,
|
||
HAY: -480,
|
||
HKT: 480,
|
||
HLV: -210,
|
||
HNA: -240,
|
||
HNC: -360,
|
||
HNE: -300,
|
||
HNP: -480,
|
||
HNR: -420,
|
||
HNT: -150,
|
||
HNY: -540,
|
||
HOVT: 420,
|
||
ICT: 420,
|
||
IDT: 180,
|
||
IOT: 360,
|
||
IRDT: 270,
|
||
IRKST: 540,
|
||
IRKT: 540,
|
||
IRST: 210,
|
||
IST: 330,
|
||
JST: 540,
|
||
KGT: 360,
|
||
KRAST: 480,
|
||
KRAT: 480,
|
||
KST: 540,
|
||
KUYT: 240,
|
||
LHDT: 660,
|
||
LHST: 630,
|
||
LINT: 840,
|
||
MAGST: 720,
|
||
MAGT: 720,
|
||
MART: -510,
|
||
MAWT: 300,
|
||
MDT: -360,
|
||
MESZ: 120,
|
||
MEZ: 60,
|
||
MHT: 720,
|
||
MMT: 390,
|
||
MSD: 240,
|
||
MSK: 240,
|
||
MST: -420,
|
||
MUT: 240,
|
||
MVT: 300,
|
||
MYT: 480,
|
||
NCT: 660,
|
||
NDT: -90,
|
||
NFT: 690,
|
||
NOVST: 420,
|
||
NOVT: 360,
|
||
NPT: 345,
|
||
NST: -150,
|
||
NUT: -660,
|
||
NZDT: 780,
|
||
NZST: 720,
|
||
OMSST: 420,
|
||
OMST: 420,
|
||
PDT: -420,
|
||
PET: -300,
|
||
PETST: 720,
|
||
PETT: 720,
|
||
PGT: 600,
|
||
PHOT: 780,
|
||
PHT: 480,
|
||
PKT: 300,
|
||
PMDT: -120,
|
||
PMST: -180,
|
||
PONT: 660,
|
||
PST: -480,
|
||
PT: -480,
|
||
PWT: 540,
|
||
PYST: -180,
|
||
PYT: -240,
|
||
RET: 240,
|
||
SAMT: 240,
|
||
SAST: 120,
|
||
SBT: 660,
|
||
SCT: 240,
|
||
SGT: 480,
|
||
SRT: -180,
|
||
SST: -660,
|
||
TAHT: -600,
|
||
TFT: 300,
|
||
TJT: 300,
|
||
TKT: 780,
|
||
TLT: 540,
|
||
TMT: 300,
|
||
TVT: 720,
|
||
ULAT: 480,
|
||
UTC: 0,
|
||
UYST: -120,
|
||
UYT: -180,
|
||
UZT: 300,
|
||
VET: -210,
|
||
VLAST: 660,
|
||
VLAT: 660,
|
||
VUT: 660,
|
||
WAST: 120,
|
||
WAT: 60,
|
||
WEST: 60,
|
||
WESZ: 60,
|
||
WET: 0,
|
||
WEZ: 0,
|
||
WFT: 720,
|
||
WGST: -120,
|
||
WGT: -180,
|
||
WIB: 420,
|
||
WIT: 540,
|
||
WITA: 480,
|
||
WST: 780,
|
||
WT: 0,
|
||
YAKST: 600,
|
||
YAKT: 600,
|
||
YAPT: 600,
|
||
YEKST: 360,
|
||
YEKT: 360,
|
||
};
|
||
class ExtractTimezoneAbbrRefiner {
|
||
constructor(timezoneOverrides) {
|
||
this.timezone = Object.assign(Object.assign({}, DEFAULT_TIMEZONE_ABBR_MAP), timezoneOverrides);
|
||
}
|
||
refine(context, results) {
|
||
const timezones = Object.assign(Object.assign({}, this.timezone), context.option.timezones);
|
||
results.forEach((result) => {
|
||
const suffix = context.text.substring(result.index + result.text.length);
|
||
const match = TIMEZONE_NAME_PATTERN.exec(suffix);
|
||
if (match) {
|
||
const timezoneAbbr = match[1].toUpperCase();
|
||
if (timezones[timezoneAbbr] === undefined) {
|
||
return;
|
||
}
|
||
const timezoneOffset = timezones[timezoneAbbr];
|
||
context.debug(() => {
|
||
console.log(`Extracting timezone: '${timezoneAbbr}' into : ${timezoneOffset}`);
|
||
});
|
||
if (!result.start.isCertain("timezoneOffset")) {
|
||
result.start.assign("timezoneOffset", timezoneOffset);
|
||
}
|
||
if (result.end != null && !result.end.isCertain("timezoneOffset")) {
|
||
result.end.assign("timezoneOffset", timezoneOffset);
|
||
}
|
||
result.text += match[0];
|
||
}
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
exports.default = ExtractTimezoneAbbrRefiner;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "zUpm":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const dayjs_1 = __importDefault(__webpack_require__("Wgwc"));
|
||
const AbstractParserWithWordBoundary_1 = __webpack_require__("g0k+");
|
||
const dayjs_2 = __webpack_require__("MVmo");
|
||
const DECasualTimeParser_1 = __importDefault(__webpack_require__("r8Bu"));
|
||
const references = __importStar(__webpack_require__("q2Un"));
|
||
const PATTERN = new RegExp(`(jetzt|heute|morgen|übermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)` +
|
||
`(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?` +
|
||
`(?=\\W|$)`, "i");
|
||
const DATE_GROUP = 1;
|
||
const TIME_GROUP = 2;
|
||
class DECasualDateParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_1.default(context.refDate);
|
||
const dateKeyword = (match[DATE_GROUP] || "").toLowerCase();
|
||
const timeKeyword = (match[TIME_GROUP] || "").toLowerCase();
|
||
let component = context.createParsingComponents();
|
||
switch (dateKeyword) {
|
||
case "jetzt":
|
||
component = references.now(context.refDate);
|
||
break;
|
||
case "heute":
|
||
component = references.today(context.refDate);
|
||
break;
|
||
case "morgen":
|
||
dayjs_2.assignTheNextDay(component, targetDate);
|
||
break;
|
||
case "übermorgen":
|
||
case "uebermorgen":
|
||
targetDate = targetDate.add(1, "day");
|
||
dayjs_2.assignTheNextDay(component, targetDate);
|
||
break;
|
||
case "gestern":
|
||
targetDate = targetDate.add(-1, "day");
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
dayjs_2.implySimilarTime(component, targetDate);
|
||
break;
|
||
case "vorgestern":
|
||
targetDate = targetDate.add(-2, "day");
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
dayjs_2.implySimilarTime(component, targetDate);
|
||
break;
|
||
default:
|
||
if (dateKeyword.match(/letzte\s*nacht/)) {
|
||
if (targetDate.hour() > 6) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
}
|
||
dayjs_2.assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 0);
|
||
}
|
||
break;
|
||
}
|
||
if (timeKeyword) {
|
||
component = DECasualTimeParser_1.default.extractTimeComponents(component, timeKeyword);
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
exports.default = DECasualDateParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "zVke":
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const AbstractTimeExpressionParser_1 = __webpack_require__("MXb4");
|
||
class FRTimeExpressionParser extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
|
||
primaryPrefix() {
|
||
return "(?:(?:[àa])\\s*)?";
|
||
}
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|[àa]|\\?)\\s*";
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
if (match[0].match(/^\s*\d{4}\s*$/)) {
|
||
return null;
|
||
}
|
||
return super.extractPrimaryTimeComponents(context, match);
|
||
}
|
||
}
|
||
exports.default = FRTimeExpressionParser;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "zr5I":
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = axios;
|
||
|
||
/***/ })
|
||
|
||
/******/ }); |