@dev-blinq/bvt-playwright-js 1.0.0-dev.3 → 1.0.0-dev.4.latest.103.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{en-Bp7eyprf.mjs → en-KbNSnMPf.mjs} +4 -4
- package/en-KbNSnMPf.mjs.map +1 -0
- package/index.d.mts +186 -11
- package/index.mjs +3126 -209
- package/index.mjs.map +1 -1
- package/{otpauth.node-k0uQ9qOV.mjs → otpauth.node-flL8gowF.mjs} +2 -2
- package/otpauth.node-flL8gowF.mjs.map +1 -0
- package/package.json +1 -1
- package/en-Bp7eyprf.mjs.map +0 -1
- package/otpauth.node-k0uQ9qOV.mjs.map +0 -1
package/index.mjs
CHANGED
|
@@ -343,7 +343,7 @@ var TestDataApi = class {
|
|
|
343
343
|
};
|
|
344
344
|
|
|
345
345
|
//#endregion
|
|
346
|
-
//#region ../../node_modules/zod/v4/core/core.js
|
|
346
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
347
347
|
/** A special constant with type `never` */
|
|
348
348
|
const NEVER = Object.freeze({ status: "aborted" });
|
|
349
349
|
function $constructor(name, initializer, params) {
|
|
@@ -403,7 +403,7 @@ function config(newConfig) {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
//#endregion
|
|
406
|
-
//#region ../../node_modules/zod/v4/core/util.js
|
|
406
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
407
407
|
function getEnumValues(entries) {
|
|
408
408
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
409
409
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -717,7 +717,7 @@ function issue(...args) {
|
|
|
717
717
|
}
|
|
718
718
|
|
|
719
719
|
//#endregion
|
|
720
|
-
//#region ../../node_modules/zod/v4/core/errors.js
|
|
720
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
721
721
|
const initializer$1 = (inst, def) => {
|
|
722
722
|
inst.name = "$ZodError";
|
|
723
723
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -775,7 +775,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
775
775
|
}
|
|
776
776
|
|
|
777
777
|
//#endregion
|
|
778
|
-
//#region ../../node_modules/zod/v4/core/parse.js
|
|
778
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
779
779
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
780
780
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
781
781
|
const result = schema._zod.run({
|
|
@@ -879,7 +879,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
879
879
|
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
880
880
|
|
|
881
881
|
//#endregion
|
|
882
|
-
//#region ../../node_modules/zod/v4/core/regexes.js
|
|
882
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
883
883
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
884
884
|
const cuid2 = /^[0-9a-z]+$/;
|
|
885
885
|
const ulid$1 = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -939,7 +939,7 @@ const lowercase = /^[^A-Z]*$/;
|
|
|
939
939
|
const uppercase = /^[^a-z]*$/;
|
|
940
940
|
|
|
941
941
|
//#endregion
|
|
942
|
-
//#region ../../node_modules/zod/v4/core/checks.js
|
|
942
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
943
943
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
944
944
|
var _a;
|
|
945
945
|
inst._zod ?? (inst._zod = {});
|
|
@@ -1298,7 +1298,7 @@ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (i
|
|
|
1298
1298
|
});
|
|
1299
1299
|
|
|
1300
1300
|
//#endregion
|
|
1301
|
-
//#region ../../node_modules/zod/v4/core/doc.js
|
|
1301
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
1302
1302
|
var Doc = class {
|
|
1303
1303
|
constructor(args = []) {
|
|
1304
1304
|
this.content = [];
|
|
@@ -1330,7 +1330,7 @@ var Doc = class {
|
|
|
1330
1330
|
};
|
|
1331
1331
|
|
|
1332
1332
|
//#endregion
|
|
1333
|
-
//#region ../../node_modules/zod/v4/core/versions.js
|
|
1333
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
1334
1334
|
const version$1 = {
|
|
1335
1335
|
major: 4,
|
|
1336
1336
|
minor: 3,
|
|
@@ -1338,7 +1338,7 @@ const version$1 = {
|
|
|
1338
1338
|
};
|
|
1339
1339
|
|
|
1340
1340
|
//#endregion
|
|
1341
|
-
//#region ../../node_modules/zod/v4/core/schemas.js
|
|
1341
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
1342
1342
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
1343
1343
|
var _a;
|
|
1344
1344
|
inst ?? (inst = {});
|
|
@@ -2586,7 +2586,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2586
2586
|
}
|
|
2587
2587
|
|
|
2588
2588
|
//#endregion
|
|
2589
|
-
//#region ../../node_modules/zod/v4/core/registries.js
|
|
2589
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
2590
2590
|
var _a;
|
|
2591
2591
|
var $ZodRegistry = class {
|
|
2592
2592
|
constructor() {
|
|
@@ -2634,7 +2634,7 @@ function registry() {
|
|
|
2634
2634
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2635
2635
|
|
|
2636
2636
|
//#endregion
|
|
2637
|
-
//#region ../../node_modules/zod/v4/core/api.js
|
|
2637
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2638
2638
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2639
2639
|
function _string(Class, params) {
|
|
2640
2640
|
return new Class({
|
|
@@ -3175,7 +3175,7 @@ function meta$1(metadata) {
|
|
|
3175
3175
|
}
|
|
3176
3176
|
|
|
3177
3177
|
//#endregion
|
|
3178
|
-
//#region ../../node_modules/zod/v4/core/to-json-schema.js
|
|
3178
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
3179
3179
|
function initializeContext(params) {
|
|
3180
3180
|
let target = params?.target ?? "draft-2020-12";
|
|
3181
3181
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -3461,7 +3461,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3461
3461
|
};
|
|
3462
3462
|
|
|
3463
3463
|
//#endregion
|
|
3464
|
-
//#region ../../node_modules/zod/v4/core/json-schema-processors.js
|
|
3464
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
3465
3465
|
const formatMap = {
|
|
3466
3466
|
guid: "uuid",
|
|
3467
3467
|
url: "uri",
|
|
@@ -3745,7 +3745,7 @@ const lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
3745
3745
|
};
|
|
3746
3746
|
|
|
3747
3747
|
//#endregion
|
|
3748
|
-
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
3748
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
3749
3749
|
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3750
3750
|
$ZodISODateTime.init(inst, def);
|
|
3751
3751
|
ZodStringFormat.init(inst, def);
|
|
@@ -3776,7 +3776,7 @@ function duration(params) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
|
|
3778
3778
|
//#endregion
|
|
3779
|
-
//#region ../../node_modules/zod/v4/classic/errors.js
|
|
3779
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
3780
3780
|
const initializer = (inst, issues) => {
|
|
3781
3781
|
$ZodError.init(inst, issues);
|
|
3782
3782
|
inst.name = "ZodError";
|
|
@@ -3800,7 +3800,7 @@ const ZodError = $constructor("ZodError", initializer);
|
|
|
3800
3800
|
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
3801
3801
|
|
|
3802
3802
|
//#endregion
|
|
3803
|
-
//#region ../../node_modules/zod/v4/classic/parse.js
|
|
3803
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
3804
3804
|
const parse$1 = /* @__PURE__ */ _parse(ZodRealError);
|
|
3805
3805
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3806
3806
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -3815,7 +3815,7 @@ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
|
3815
3815
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3816
3816
|
|
|
3817
3817
|
//#endregion
|
|
3818
|
-
//#region ../../node_modules/zod/v4/classic/schemas.js
|
|
3818
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
3819
3819
|
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
3820
3820
|
$ZodType.init(inst, def);
|
|
3821
3821
|
Object.assign(inst["~standard"], { jsonSchema: {
|
|
@@ -4467,7 +4467,7 @@ function preprocess(fn, schema) {
|
|
|
4467
4467
|
}
|
|
4468
4468
|
|
|
4469
4469
|
//#endregion
|
|
4470
|
-
//#region ../../node_modules/zod/v4/classic/compat.js
|
|
4470
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
|
|
4471
4471
|
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
|
|
4472
4472
|
const ZodIssueCode = {
|
|
4473
4473
|
invalid_type: "invalid_type",
|
|
@@ -6202,6 +6202,15 @@ const AiRecoveredScenarioVersionSchema = object({
|
|
|
6202
6202
|
supersededAt: date().optional()
|
|
6203
6203
|
}).strict();
|
|
6204
6204
|
|
|
6205
|
+
//#endregion
|
|
6206
|
+
//#region ../../core/schemas/src/custom-code-step-template/custom-code-step-template.schema.ts
|
|
6207
|
+
const CustomCodeStepTemplateSchema = object({
|
|
6208
|
+
_id: EntityIdSchema,
|
|
6209
|
+
projectId: EntityIdSchema,
|
|
6210
|
+
name: string().min(1).max(500),
|
|
6211
|
+
code: string().min(1).max(1e5)
|
|
6212
|
+
}).strict();
|
|
6213
|
+
|
|
6205
6214
|
//#endregion
|
|
6206
6215
|
//#region ../../core/schemas/src/workspace/workspace.schema.ts
|
|
6207
6216
|
const EnvironmentSchema = object({
|
|
@@ -6265,9 +6274,12 @@ const ProjectBrowserLaunchConfigurationSchema = object({
|
|
|
6265
6274
|
height: 900
|
|
6266
6275
|
} })
|
|
6267
6276
|
}).strict();
|
|
6277
|
+
const ProjectGitCodegenFormats = ["playwright", "gherkin"];
|
|
6278
|
+
const ProjectGitCodegenFormatSchema = _enum(ProjectGitCodegenFormats).default("playwright");
|
|
6268
6279
|
const ProjectSettingsSchema = object({
|
|
6269
6280
|
_id: EntityIdSchema,
|
|
6270
6281
|
projectId: EntityIdSchema,
|
|
6282
|
+
gitCodegenFormat: ProjectGitCodegenFormatSchema,
|
|
6271
6283
|
browerLaunchConfiguration: ProjectBrowserLaunchConfigurationSchema.default({
|
|
6272
6284
|
browser: {},
|
|
6273
6285
|
browserContext: { viewport: {
|
|
@@ -6458,7 +6470,7 @@ const BrowserObserverStateKSchema = union([_enum([
|
|
|
6458
6470
|
]), _null()]);
|
|
6459
6471
|
|
|
6460
6472
|
//#endregion
|
|
6461
|
-
//#region ../../node_modules/xstate/dev/dist/xstate-dev.esm.js
|
|
6473
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
|
|
6462
6474
|
function getGlobal$1() {
|
|
6463
6475
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
6464
6476
|
if (typeof self !== "undefined") return self;
|
|
@@ -6476,7 +6488,7 @@ const devToolsAdapter = (service) => {
|
|
|
6476
6488
|
};
|
|
6477
6489
|
|
|
6478
6490
|
//#endregion
|
|
6479
|
-
//#region ../../node_modules/xstate/dist/raise-34c45204.esm.js
|
|
6491
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dist/raise-34c45204.esm.js
|
|
6480
6492
|
var Mailbox = class {
|
|
6481
6493
|
constructor(_process) {
|
|
6482
6494
|
this._process = _process;
|
|
@@ -8380,7 +8392,7 @@ function raise(eventOrExpr, options) {
|
|
|
8380
8392
|
}
|
|
8381
8393
|
|
|
8382
8394
|
//#endregion
|
|
8383
|
-
//#region ../../node_modules/xstate/actors/dist/xstate-actors.esm.js
|
|
8395
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/actors/dist/xstate-actors.esm.js
|
|
8384
8396
|
/**
|
|
8385
8397
|
* Represents an actor created by `fromTransition`.
|
|
8386
8398
|
*
|
|
@@ -8691,7 +8703,7 @@ function fromCallback(callback) {
|
|
|
8691
8703
|
const emptyLogic = fromTransition((_) => void 0, void 0);
|
|
8692
8704
|
|
|
8693
8705
|
//#endregion
|
|
8694
|
-
//#region ../../node_modules/xstate/dist/assign-5f7ff891.esm.js
|
|
8706
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dist/assign-5f7ff891.esm.js
|
|
8695
8707
|
function createSpawner(actorScope, { machine, context }, event, spawnedChildren) {
|
|
8696
8708
|
const spawn = (src, options) => {
|
|
8697
8709
|
if (typeof src === "string") {
|
|
@@ -8801,7 +8813,7 @@ function assign(assignment) {
|
|
|
8801
8813
|
}
|
|
8802
8814
|
|
|
8803
8815
|
//#endregion
|
|
8804
|
-
//#region ../../node_modules/xstate/dist/StateMachine-9ef88566.esm.js
|
|
8816
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dist/StateMachine-9ef88566.esm.js
|
|
8805
8817
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
8806
8818
|
function memo(object, key, fn) {
|
|
8807
8819
|
let memoizedData = cache.get(object);
|
|
@@ -9267,7 +9279,7 @@ var StateMachine = class StateMachine {
|
|
|
9267
9279
|
};
|
|
9268
9280
|
|
|
9269
9281
|
//#endregion
|
|
9270
|
-
//#region ../../node_modules/xstate/dist/log-1324d455.esm.js
|
|
9282
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dist/log-1324d455.esm.js
|
|
9271
9283
|
function resolveEmit(_, snapshot, args, actionParams, { event: eventOrExpr }) {
|
|
9272
9284
|
return [
|
|
9273
9285
|
snapshot,
|
|
@@ -9551,7 +9563,7 @@ function log(value = ({ context, event }) => ({
|
|
|
9551
9563
|
}
|
|
9552
9564
|
|
|
9553
9565
|
//#endregion
|
|
9554
|
-
//#region ../../node_modules/xstate/dist/xstate.esm.js
|
|
9566
|
+
//#region ../../node_modules/.pnpm/xstate@5.28.0/node_modules/xstate/dist/xstate.esm.js
|
|
9555
9567
|
/**
|
|
9556
9568
|
* Creates a state machine (statechart) with the given configuration.
|
|
9557
9569
|
*
|
|
@@ -9800,6 +9812,7 @@ const FieldKindSchema = _enum([
|
|
|
9800
9812
|
"number",
|
|
9801
9813
|
"date",
|
|
9802
9814
|
"select",
|
|
9815
|
+
"custom-select",
|
|
9803
9816
|
"multiselect",
|
|
9804
9817
|
"checkbox",
|
|
9805
9818
|
"radio",
|
|
@@ -9826,11 +9839,17 @@ const FillFormBatchResultEntrySchema = object({
|
|
|
9826
9839
|
"error"
|
|
9827
9840
|
]),
|
|
9828
9841
|
error: string().optional(),
|
|
9829
|
-
actualValue: string().optional()
|
|
9842
|
+
actualValue: string().optional(),
|
|
9843
|
+
signal: object({
|
|
9844
|
+
filled: boolean(),
|
|
9845
|
+
matchesConfirmField: boolean().optional(),
|
|
9846
|
+
valueSatisfiesIntent: boolean().optional()
|
|
9847
|
+
}).strict().optional()
|
|
9830
9848
|
}).strict();
|
|
9831
9849
|
const FillFormBatchResultSchema = object({
|
|
9832
9850
|
results: array(FillFormBatchResultEntrySchema),
|
|
9833
|
-
domGrew: boolean()
|
|
9851
|
+
domGrew: boolean(),
|
|
9852
|
+
fieldTimingsMs: array(number().nonnegative()).optional()
|
|
9834
9853
|
}).strict();
|
|
9835
9854
|
|
|
9836
9855
|
//#endregion
|
|
@@ -9882,13 +9901,31 @@ const GenerateParameterizedStepNameRequestSchema = object({
|
|
|
9882
9901
|
scenarioId: string().min(1).optional(),
|
|
9883
9902
|
projectId: string().min(1).optional()
|
|
9884
9903
|
});
|
|
9904
|
+
const AiChatFormFieldSnapshotSchema = object({
|
|
9905
|
+
tag: string().min(1),
|
|
9906
|
+
type: string().nullable(),
|
|
9907
|
+
id: string().nullable(),
|
|
9908
|
+
name: string().nullable(),
|
|
9909
|
+
ariaLabel: string().nullable(),
|
|
9910
|
+
placeholder: string().nullable(),
|
|
9911
|
+
required: boolean(),
|
|
9912
|
+
disabled: boolean(),
|
|
9913
|
+
readOnly: boolean().default(false),
|
|
9914
|
+
label: string().nullable(),
|
|
9915
|
+
selector: string().nullable(),
|
|
9916
|
+
options: array(string()).optional(),
|
|
9917
|
+
formIndex: number().int().nonnegative().nullable().optional(),
|
|
9918
|
+
formName: string().nullable().optional()
|
|
9919
|
+
}).strict();
|
|
9885
9920
|
const AiChatPageContextSchema = object({
|
|
9886
9921
|
url: string().url(),
|
|
9887
9922
|
title: string().min(1),
|
|
9888
9923
|
accessibilityTree: string().min(1),
|
|
9889
9924
|
visibleText: string().min(1).optional(),
|
|
9890
9925
|
domSnapshot: string().min(1).optional(),
|
|
9891
|
-
screenshotBase64: string().min(1).optional()
|
|
9926
|
+
screenshotBase64: string().min(1).optional(),
|
|
9927
|
+
formFields: array(AiChatFormFieldSnapshotSchema).optional(),
|
|
9928
|
+
formFieldsCapped: boolean().optional()
|
|
9892
9929
|
}).strict();
|
|
9893
9930
|
const ValidationComplexitySchema = _enum([
|
|
9894
9931
|
"simple",
|
|
@@ -9927,6 +9964,7 @@ const ExecutionResultSchema = object({
|
|
|
9927
9964
|
logs: array(string()),
|
|
9928
9965
|
checkpoints: array(CheckpointSchema).optional().default([]),
|
|
9929
9966
|
duration: number().nonnegative(),
|
|
9967
|
+
screenshotBefore: string().optional(),
|
|
9930
9968
|
screenshotAfter: string().optional(),
|
|
9931
9969
|
mutationSignals: SegmentMutationSignalsSchema.optional()
|
|
9932
9970
|
}).strict();
|
|
@@ -12157,11 +12195,11 @@ function attachDownloadInterceptor(page, options) {
|
|
|
12157
12195
|
//#endregion
|
|
12158
12196
|
//#region ../../core/bvt-agent/src/agent/recovery/types.ts
|
|
12159
12197
|
const RECOVERY_USER_FACING_MESSAGES = {
|
|
12160
|
-
analyzing: "
|
|
12161
|
-
trying_fix: "
|
|
12162
|
-
checking_fix: "
|
|
12163
|
-
fixed: "
|
|
12164
|
-
failed: "
|
|
12198
|
+
analyzing: "AI Test Engineer is analyzing the failure",
|
|
12199
|
+
trying_fix: "AI Test Engineer is trying a fix",
|
|
12200
|
+
checking_fix: "AI Test Engineer is checking the fix",
|
|
12201
|
+
fixed: "AI Test Engineer fixed this automatically",
|
|
12202
|
+
failed: "AI Test Engineer could not fix this automatically"
|
|
12165
12203
|
};
|
|
12166
12204
|
|
|
12167
12205
|
//#endregion
|
|
@@ -12183,7 +12221,7 @@ var NoOpRecoveryController = class {
|
|
|
12183
12221
|
};
|
|
12184
12222
|
|
|
12185
12223
|
//#endregion
|
|
12186
|
-
//#region ../../node_modules/ulid/dist/node/index.js
|
|
12224
|
+
//#region ../../node_modules/.pnpm/ulid@3.0.1/node_modules/ulid/dist/node/index.js
|
|
12187
12225
|
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
12188
12226
|
const ENCODING_LEN = 32;
|
|
12189
12227
|
const RANDOM_LEN = 16;
|
|
@@ -12465,7 +12503,7 @@ var CommandPreprocessorPipeline = class {
|
|
|
12465
12503
|
};
|
|
12466
12504
|
|
|
12467
12505
|
//#endregion
|
|
12468
|
-
//#region ../../node_modules/acorn/dist/acorn.mjs
|
|
12506
|
+
//#region ../../node_modules/.pnpm/acorn@8.16.0/node_modules/acorn/dist/acorn.mjs
|
|
12469
12507
|
var astralIdentifierCodes = [
|
|
12470
12508
|
509,
|
|
12471
12509
|
0,
|
|
@@ -13642,10 +13680,10 @@ function nextLineBreak(code, from, end) {
|
|
|
13642
13680
|
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
|
13643
13681
|
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
13644
13682
|
var ref = Object.prototype;
|
|
13645
|
-
var hasOwnProperty = ref.hasOwnProperty;
|
|
13683
|
+
var hasOwnProperty$1 = ref.hasOwnProperty;
|
|
13646
13684
|
var toString = ref.toString;
|
|
13647
13685
|
var hasOwn = Object.hasOwn || (function(obj, propName) {
|
|
13648
|
-
return hasOwnProperty.call(obj, propName);
|
|
13686
|
+
return hasOwnProperty$1.call(obj, propName);
|
|
13649
13687
|
});
|
|
13650
13688
|
var isArray = Array.isArray || (function(obj) {
|
|
13651
13689
|
return toString.call(obj) === "[object Array]";
|
|
@@ -17552,7 +17590,7 @@ function parse(input, options) {
|
|
|
17552
17590
|
}
|
|
17553
17591
|
|
|
17554
17592
|
//#endregion
|
|
17555
|
-
//#region ../../node_modules/acorn-walk/dist/walk.mjs
|
|
17593
|
+
//#region ../../node_modules/.pnpm/acorn-walk@8.3.5/node_modules/acorn-walk/dist/walk.mjs
|
|
17556
17594
|
function simple(node, visitors, baseVisitor, state, override) {
|
|
17557
17595
|
if (!baseVisitor) baseVisitor = base;
|
|
17558
17596
|
(function c(node, st, override) {
|
|
@@ -17943,11 +17981,11 @@ async function validatePlaywrightCode(code) {
|
|
|
17943
17981
|
}
|
|
17944
17982
|
|
|
17945
17983
|
//#endregion
|
|
17946
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/version.js
|
|
17984
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js
|
|
17947
17985
|
const VERSION = "1.9.1";
|
|
17948
17986
|
|
|
17949
17987
|
//#endregion
|
|
17950
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
17988
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
17951
17989
|
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
17952
17990
|
/**
|
|
17953
17991
|
* Create a function to test an API version to see if it is compatible with the provided ownVersion.
|
|
@@ -18026,7 +18064,7 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
18026
18064
|
const isCompatible = _makeCompatibilityCheck(VERSION);
|
|
18027
18065
|
|
|
18028
18066
|
//#endregion
|
|
18029
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
18067
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
18030
18068
|
const major = VERSION.split(".")[0];
|
|
18031
18069
|
const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
18032
18070
|
const _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
@@ -18060,7 +18098,7 @@ function unregisterGlobal(type, diag) {
|
|
|
18060
18098
|
}
|
|
18061
18099
|
|
|
18062
18100
|
//#endregion
|
|
18063
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
18101
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
18064
18102
|
/**
|
|
18065
18103
|
* Component Logger which is meant to be used as part of any component which
|
|
18066
18104
|
* will add automatically additional namespace in front of the log message.
|
|
@@ -18097,7 +18135,7 @@ function logProxy(funcName, namespace, args) {
|
|
|
18097
18135
|
}
|
|
18098
18136
|
|
|
18099
18137
|
//#endregion
|
|
18100
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
18138
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
18101
18139
|
/**
|
|
18102
18140
|
* Defines the available internal logging levels for the diagnostic logger, the numeric values
|
|
18103
18141
|
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
@@ -18125,7 +18163,7 @@ var DiagLogLevel;
|
|
|
18125
18163
|
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
18126
18164
|
|
|
18127
18165
|
//#endregion
|
|
18128
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
18166
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
18129
18167
|
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
18130
18168
|
if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
|
|
18131
18169
|
else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
|
|
@@ -18145,7 +18183,7 @@ function createLogLevelDiagLogger(maxLevel, logger) {
|
|
|
18145
18183
|
}
|
|
18146
18184
|
|
|
18147
18185
|
//#endregion
|
|
18148
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
18186
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
18149
18187
|
const API_NAME$2 = "diag";
|
|
18150
18188
|
/**
|
|
18151
18189
|
* Singleton object which represents the entry point to the OpenTelemetry internal
|
|
@@ -18205,7 +18243,7 @@ var DiagAPI = class DiagAPI {
|
|
|
18205
18243
|
};
|
|
18206
18244
|
|
|
18207
18245
|
//#endregion
|
|
18208
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
18246
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
18209
18247
|
/**
|
|
18210
18248
|
* Get a key to uniquely identify a context value
|
|
18211
18249
|
*
|
|
@@ -18244,7 +18282,7 @@ var BaseContext = class BaseContext {
|
|
|
18244
18282
|
const ROOT_CONTEXT = new BaseContext();
|
|
18245
18283
|
|
|
18246
18284
|
//#endregion
|
|
18247
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
18285
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
18248
18286
|
var NoopContextManager = class {
|
|
18249
18287
|
active() {
|
|
18250
18288
|
return ROOT_CONTEXT;
|
|
@@ -18264,7 +18302,7 @@ var NoopContextManager = class {
|
|
|
18264
18302
|
};
|
|
18265
18303
|
|
|
18266
18304
|
//#endregion
|
|
18267
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
18305
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
18268
18306
|
const API_NAME$1 = "context";
|
|
18269
18307
|
const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
18270
18308
|
/**
|
|
@@ -18325,7 +18363,7 @@ var ContextAPI = class ContextAPI {
|
|
|
18325
18363
|
};
|
|
18326
18364
|
|
|
18327
18365
|
//#endregion
|
|
18328
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
18366
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
18329
18367
|
/**
|
|
18330
18368
|
* @since 1.0.0
|
|
18331
18369
|
*/
|
|
@@ -18338,7 +18376,7 @@ var TraceFlags;
|
|
|
18338
18376
|
})(TraceFlags || (TraceFlags = {}));
|
|
18339
18377
|
|
|
18340
18378
|
//#endregion
|
|
18341
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
18379
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
18342
18380
|
/**
|
|
18343
18381
|
* @since 1.0.0
|
|
18344
18382
|
*/
|
|
@@ -18357,7 +18395,7 @@ const INVALID_SPAN_CONTEXT = {
|
|
|
18357
18395
|
};
|
|
18358
18396
|
|
|
18359
18397
|
//#endregion
|
|
18360
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
18398
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
18361
18399
|
/**
|
|
18362
18400
|
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
18363
18401
|
* implementation is available. All operations are no-op including context
|
|
@@ -18399,7 +18437,7 @@ var NonRecordingSpan = class {
|
|
|
18399
18437
|
};
|
|
18400
18438
|
|
|
18401
18439
|
//#endregion
|
|
18402
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
18440
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
18403
18441
|
/**
|
|
18404
18442
|
* span key
|
|
18405
18443
|
*/
|
|
@@ -18456,7 +18494,7 @@ function getSpanContext(context) {
|
|
|
18456
18494
|
}
|
|
18457
18495
|
|
|
18458
18496
|
//#endregion
|
|
18459
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
18497
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
18460
18498
|
const isHex = new Uint8Array([
|
|
18461
18499
|
0,
|
|
18462
18500
|
0,
|
|
@@ -18600,7 +18638,7 @@ function wrapSpanContext(spanContext) {
|
|
|
18600
18638
|
}
|
|
18601
18639
|
|
|
18602
18640
|
//#endregion
|
|
18603
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
18641
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
18604
18642
|
const contextApi = ContextAPI.getInstance();
|
|
18605
18643
|
/**
|
|
18606
18644
|
* No-op implementations of {@link Tracer}.
|
|
@@ -18637,7 +18675,7 @@ function isSpanContext(spanContext) {
|
|
|
18637
18675
|
}
|
|
18638
18676
|
|
|
18639
18677
|
//#endregion
|
|
18640
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
18678
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
18641
18679
|
const NOOP_TRACER = new NoopTracer();
|
|
18642
18680
|
/**
|
|
18643
18681
|
* Proxy tracer provided by the proxy tracer provider
|
|
@@ -18672,7 +18710,7 @@ var ProxyTracer = class {
|
|
|
18672
18710
|
};
|
|
18673
18711
|
|
|
18674
18712
|
//#endregion
|
|
18675
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
18713
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
18676
18714
|
/**
|
|
18677
18715
|
* An implementation of the {@link TracerProvider} which returns an impotent
|
|
18678
18716
|
* Tracer for all calls to `getTracer`.
|
|
@@ -18686,7 +18724,7 @@ var NoopTracerProvider = class {
|
|
|
18686
18724
|
};
|
|
18687
18725
|
|
|
18688
18726
|
//#endregion
|
|
18689
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
18727
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
18690
18728
|
const NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
18691
18729
|
/**
|
|
18692
18730
|
* Tracer provider which provides {@link ProxyTracer}s.
|
|
@@ -18724,7 +18762,7 @@ var ProxyTracerProvider = class {
|
|
|
18724
18762
|
};
|
|
18725
18763
|
|
|
18726
18764
|
//#endregion
|
|
18727
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/span_kind.js
|
|
18765
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js
|
|
18728
18766
|
/**
|
|
18729
18767
|
* @since 1.0.0
|
|
18730
18768
|
*/
|
|
@@ -18757,7 +18795,7 @@ var SpanKind;
|
|
|
18757
18795
|
})(SpanKind || (SpanKind = {}));
|
|
18758
18796
|
|
|
18759
18797
|
//#endregion
|
|
18760
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
18798
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
18761
18799
|
/**
|
|
18762
18800
|
* An enumeration of status codes.
|
|
18763
18801
|
*
|
|
@@ -18781,7 +18819,7 @@ var SpanStatusCode;
|
|
|
18781
18819
|
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
18782
18820
|
|
|
18783
18821
|
//#endregion
|
|
18784
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
18822
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
18785
18823
|
const API_NAME = "trace";
|
|
18786
18824
|
/**
|
|
18787
18825
|
* Singleton object which represents the entry point to the OpenTelemetry Tracing API
|
|
@@ -18836,7 +18874,7 @@ var TraceAPI = class TraceAPI {
|
|
|
18836
18874
|
};
|
|
18837
18875
|
|
|
18838
18876
|
//#endregion
|
|
18839
|
-
//#region ../../node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
18877
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
18840
18878
|
/**
|
|
18841
18879
|
* Entrypoint for trace API
|
|
18842
18880
|
*
|
|
@@ -18845,7 +18883,7 @@ var TraceAPI = class TraceAPI {
|
|
|
18845
18883
|
const trace = TraceAPI.getInstance();
|
|
18846
18884
|
|
|
18847
18885
|
//#endregion
|
|
18848
|
-
//#region ../../node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/SemanticConventions.js
|
|
18886
|
+
//#region ../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.4.0/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/SemanticConventions.js
|
|
18849
18887
|
/**
|
|
18850
18888
|
* Semantic conventions for OpenInference tracing
|
|
18851
18889
|
*/
|
|
@@ -20614,6 +20652,269 @@ async function executePlaywrightCode({ page, code, context, timeoutMs = PLAYWRIG
|
|
|
20614
20652
|
}
|
|
20615
20653
|
}
|
|
20616
20654
|
|
|
20655
|
+
//#endregion
|
|
20656
|
+
//#region ../../shared/observability/src/log-message.ts
|
|
20657
|
+
function resolveLogMessageClass(controls) {
|
|
20658
|
+
if (controls.isMilestone) return "MILESTONE";
|
|
20659
|
+
if (controls.severity === "critical") return "CRITICAL_ERR";
|
|
20660
|
+
if (controls.severity === "error") return "ERR";
|
|
20661
|
+
return controls.messageClass;
|
|
20662
|
+
}
|
|
20663
|
+
function buildClassifiedEventMessage(controls) {
|
|
20664
|
+
if (!controls.eventName) return;
|
|
20665
|
+
const resolvedClass = resolveLogMessageClass(controls);
|
|
20666
|
+
if (!resolvedClass) return;
|
|
20667
|
+
return `[${resolvedClass}][${controls.eventName}]`;
|
|
20668
|
+
}
|
|
20669
|
+
function extractStructuredLogMessageControls(metadata) {
|
|
20670
|
+
if (!metadata) return {};
|
|
20671
|
+
const rawEventName = metadata.eventName;
|
|
20672
|
+
const eventName = typeof rawEventName === "string" && rawEventName.trim().length > 0 ? rawEventName : void 0;
|
|
20673
|
+
const rawMessageClass = metadata.messageClass;
|
|
20674
|
+
const messageClass = rawMessageClass === "USER_EVENT" || rawMessageClass === "INFRA_EVENT" || rawMessageClass === "MILESTONE" || rawMessageClass === "ERR" || rawMessageClass === "CRITICAL_ERR" ? rawMessageClass : void 0;
|
|
20675
|
+
const rawSeverity = metadata.severity;
|
|
20676
|
+
const severity = rawSeverity === "error" || rawSeverity === "critical" ? rawSeverity : void 0;
|
|
20677
|
+
const isMilestone = metadata.isMilestone === true;
|
|
20678
|
+
const { eventName: _eventName, messageClass: _messageClass, severity: _severity, isMilestone: _isMilestone, ...restMetadata } = metadata;
|
|
20679
|
+
return {
|
|
20680
|
+
...eventName ? { eventName } : {},
|
|
20681
|
+
...messageClass ? { messageClass } : {},
|
|
20682
|
+
...severity ? { severity } : {},
|
|
20683
|
+
...isMilestone ? { isMilestone } : {},
|
|
20684
|
+
...Object.keys(restMetadata).length > 0 ? { sanitizedMetadata: restMetadata } : {}
|
|
20685
|
+
};
|
|
20686
|
+
}
|
|
20687
|
+
|
|
20688
|
+
//#endregion
|
|
20689
|
+
//#region ../../shared/observability/src/logger.ts
|
|
20690
|
+
var Logger = class Logger {
|
|
20691
|
+
constructor(transports, defaultContext = { system: true }) {
|
|
20692
|
+
this.transports = transports;
|
|
20693
|
+
this.defaultContext = defaultContext;
|
|
20694
|
+
}
|
|
20695
|
+
debug(message, metadata, context) {
|
|
20696
|
+
this.emit("debug", message, metadata, context);
|
|
20697
|
+
}
|
|
20698
|
+
info(message, metadata, context) {
|
|
20699
|
+
this.emit("info", message, metadata, context);
|
|
20700
|
+
}
|
|
20701
|
+
warn(message, metadata, context) {
|
|
20702
|
+
this.emit("warn", message, metadata, context);
|
|
20703
|
+
}
|
|
20704
|
+
error(message, metadata, context) {
|
|
20705
|
+
this.emit("error", message, metadata, context);
|
|
20706
|
+
}
|
|
20707
|
+
userEvent(eventName, metadata, context) {
|
|
20708
|
+
this.emit("info", eventName, {
|
|
20709
|
+
eventName,
|
|
20710
|
+
messageClass: "USER_EVENT",
|
|
20711
|
+
...metadata
|
|
20712
|
+
}, context);
|
|
20713
|
+
}
|
|
20714
|
+
infraEvent(eventName, metadata, context) {
|
|
20715
|
+
this.emit("info", eventName, {
|
|
20716
|
+
eventName,
|
|
20717
|
+
messageClass: "INFRA_EVENT",
|
|
20718
|
+
...metadata
|
|
20719
|
+
}, context);
|
|
20720
|
+
}
|
|
20721
|
+
milestone(eventName, metadata, context) {
|
|
20722
|
+
this.emit("info", eventName, {
|
|
20723
|
+
eventName,
|
|
20724
|
+
isMilestone: true,
|
|
20725
|
+
...metadata
|
|
20726
|
+
}, context);
|
|
20727
|
+
}
|
|
20728
|
+
errorEvent(eventName, metadata, context, options) {
|
|
20729
|
+
this.emit("error", eventName, {
|
|
20730
|
+
eventName,
|
|
20731
|
+
severity: options?.critical ? "critical" : "error",
|
|
20732
|
+
...metadata
|
|
20733
|
+
}, context);
|
|
20734
|
+
}
|
|
20735
|
+
/** Returns a new Logger instance bound to the given context. */
|
|
20736
|
+
withContext(context) {
|
|
20737
|
+
return new Logger(this.transports, context);
|
|
20738
|
+
}
|
|
20739
|
+
emit(level, message, metadata, context) {
|
|
20740
|
+
const { eventName, messageClass, severity, isMilestone, sanitizedMetadata } = extractStructuredLogMessageControls(metadata);
|
|
20741
|
+
const entry = {
|
|
20742
|
+
level,
|
|
20743
|
+
message: buildClassifiedEventMessage({
|
|
20744
|
+
eventName,
|
|
20745
|
+
messageClass,
|
|
20746
|
+
severity,
|
|
20747
|
+
isMilestone
|
|
20748
|
+
}) ?? message,
|
|
20749
|
+
...eventName ? { eventName } : {},
|
|
20750
|
+
context: context ?? this.defaultContext,
|
|
20751
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
20752
|
+
metadata: sanitizedMetadata
|
|
20753
|
+
};
|
|
20754
|
+
for (const transport of this.transports) try {
|
|
20755
|
+
const result = transport.log?.(entry);
|
|
20756
|
+
if (result instanceof Promise) result.catch((err) => {
|
|
20757
|
+
console.error(`[observability] Transport "${transport.name}" log() failed:`, err);
|
|
20758
|
+
});
|
|
20759
|
+
} catch (err) {
|
|
20760
|
+
console.error(`[observability] Transport "${transport.name}" log() threw:`, err);
|
|
20761
|
+
}
|
|
20762
|
+
}
|
|
20763
|
+
};
|
|
20764
|
+
|
|
20765
|
+
//#endregion
|
|
20766
|
+
//#region ../../shared/observability/src/error-serialization.ts
|
|
20767
|
+
const DEFAULT_MAX_DEPTH = 8;
|
|
20768
|
+
const DEFAULT_MAX_ARRAY_LENGTH = 100;
|
|
20769
|
+
const DEFAULT_MAX_OBJECT_KEYS = 100;
|
|
20770
|
+
const DEFAULT_MAX_STRING_LENGTH = Number.MAX_SAFE_INTEGER;
|
|
20771
|
+
const ERROR_FIELD_NAMES = [
|
|
20772
|
+
"name",
|
|
20773
|
+
"message",
|
|
20774
|
+
"code",
|
|
20775
|
+
"status",
|
|
20776
|
+
"statusCode",
|
|
20777
|
+
"stack"
|
|
20778
|
+
];
|
|
20779
|
+
const ERROR_RESERVED_FIELDS = new Set([
|
|
20780
|
+
...ERROR_FIELD_NAMES,
|
|
20781
|
+
"cause",
|
|
20782
|
+
"errors",
|
|
20783
|
+
"details"
|
|
20784
|
+
]);
|
|
20785
|
+
function safeString(value) {
|
|
20786
|
+
try {
|
|
20787
|
+
return String(value);
|
|
20788
|
+
} catch {
|
|
20789
|
+
return "[Unstringifiable]";
|
|
20790
|
+
}
|
|
20791
|
+
}
|
|
20792
|
+
function createSerializationState(options = {}) {
|
|
20793
|
+
return {
|
|
20794
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
20795
|
+
maxDepth: options.maxDepth ?? DEFAULT_MAX_DEPTH,
|
|
20796
|
+
maxArrayLength: options.maxArrayLength ?? DEFAULT_MAX_ARRAY_LENGTH,
|
|
20797
|
+
maxObjectKeys: options.maxObjectKeys ?? DEFAULT_MAX_OBJECT_KEYS,
|
|
20798
|
+
maxStringLength: options.maxStringLength ?? DEFAULT_MAX_STRING_LENGTH
|
|
20799
|
+
};
|
|
20800
|
+
}
|
|
20801
|
+
function truncateString(value, state) {
|
|
20802
|
+
if (value.length <= state.maxStringLength) return value;
|
|
20803
|
+
return `${value.slice(0, state.maxStringLength)}...[truncated ${value.length - state.maxStringLength} chars]`;
|
|
20804
|
+
}
|
|
20805
|
+
function readProperty(record, key) {
|
|
20806
|
+
try {
|
|
20807
|
+
return record[key];
|
|
20808
|
+
} catch (error) {
|
|
20809
|
+
return `[Unreadable property: ${error instanceof Error ? error.message : safeString(error)}]`;
|
|
20810
|
+
}
|
|
20811
|
+
}
|
|
20812
|
+
function hasOwnProperty(value, key) {
|
|
20813
|
+
return Object.prototype.hasOwnProperty.call(value, key);
|
|
20814
|
+
}
|
|
20815
|
+
function tryCustomToString(value) {
|
|
20816
|
+
const toStringMethod = value.toString;
|
|
20817
|
+
if (typeof toStringMethod !== "function" || toStringMethod === Object.prototype.toString || toStringMethod === Error.prototype.toString) return;
|
|
20818
|
+
try {
|
|
20819
|
+
const result = toStringMethod.call(value);
|
|
20820
|
+
return typeof result === "string" ? result : void 0;
|
|
20821
|
+
} catch {
|
|
20822
|
+
return;
|
|
20823
|
+
}
|
|
20824
|
+
}
|
|
20825
|
+
function toSafeValue(value, state, depth = 0) {
|
|
20826
|
+
if (value === null || value === void 0) return value;
|
|
20827
|
+
if (typeof value === "string") return truncateString(value, state);
|
|
20828
|
+
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
20829
|
+
if (typeof value === "bigint") return value.toString();
|
|
20830
|
+
if (typeof value === "symbol") return value.toString();
|
|
20831
|
+
if (typeof value === "function") return `[Function ${value.name || "anonymous"}]`;
|
|
20832
|
+
if (value instanceof Date) return Number.isNaN(value.getTime()) ? value.toString() : value.toISOString();
|
|
20833
|
+
if (value instanceof Error) return serializeErrorInternal(value, state, depth);
|
|
20834
|
+
if (typeof value !== "object") return safeString(value);
|
|
20835
|
+
if (state.seen.has(value)) return "[Circular]";
|
|
20836
|
+
if (depth >= state.maxDepth) return "[MaxDepth]";
|
|
20837
|
+
state.seen.add(value);
|
|
20838
|
+
try {
|
|
20839
|
+
if (Array.isArray(value)) {
|
|
20840
|
+
const items = value.slice(0, state.maxArrayLength).map((item) => toSafeValue(item, state, depth + 1));
|
|
20841
|
+
if (value.length > state.maxArrayLength) items.push(`[Truncated ${value.length - state.maxArrayLength} items]`);
|
|
20842
|
+
return items;
|
|
20843
|
+
}
|
|
20844
|
+
if (value instanceof Map) return {
|
|
20845
|
+
type: "Map",
|
|
20846
|
+
entries: toSafeValue(Array.from(value.entries()), state, depth + 1)
|
|
20847
|
+
};
|
|
20848
|
+
if (value instanceof Set) return {
|
|
20849
|
+
type: "Set",
|
|
20850
|
+
values: toSafeValue(Array.from(value.values()), state, depth + 1)
|
|
20851
|
+
};
|
|
20852
|
+
const record = value;
|
|
20853
|
+
const output = {};
|
|
20854
|
+
const customToString = tryCustomToString(value);
|
|
20855
|
+
if (customToString) output.stringValue = truncateString(customToString, state);
|
|
20856
|
+
const keys = Object.keys(record);
|
|
20857
|
+
for (const key of keys.slice(0, state.maxObjectKeys)) output[key] = toSafeValue(readProperty(record, key), state, depth + 1);
|
|
20858
|
+
if (keys.length > state.maxObjectKeys) output.__truncatedKeys = keys.length - state.maxObjectKeys;
|
|
20859
|
+
return output;
|
|
20860
|
+
} finally {
|
|
20861
|
+
state.seen.delete(value);
|
|
20862
|
+
}
|
|
20863
|
+
}
|
|
20864
|
+
function copyErrorField(output, input, fieldName, state, depth) {
|
|
20865
|
+
if (!hasOwnProperty(input, fieldName)) return;
|
|
20866
|
+
const value = readProperty(input, fieldName);
|
|
20867
|
+
if (value !== void 0) output[fieldName] = toSafeValue(value, state, depth + 1);
|
|
20868
|
+
}
|
|
20869
|
+
function serializeErrorInternal(error, state, depth = 0) {
|
|
20870
|
+
if (error === null || error === void 0) return { message: safeString(error) };
|
|
20871
|
+
if (typeof error !== "object") return { message: safeString(error) };
|
|
20872
|
+
if (state.seen.has(error)) return { message: "[Circular]" };
|
|
20873
|
+
state.seen.add(error);
|
|
20874
|
+
try {
|
|
20875
|
+
const record = error;
|
|
20876
|
+
const output = {};
|
|
20877
|
+
if (error instanceof Error) {
|
|
20878
|
+
output.name = error.name;
|
|
20879
|
+
output.message = error.message;
|
|
20880
|
+
if (error.stack) output.stack = truncateString(error.stack, state);
|
|
20881
|
+
}
|
|
20882
|
+
for (const fieldName of ERROR_FIELD_NAMES) copyErrorField(output, record, fieldName, state, depth);
|
|
20883
|
+
const customToString = tryCustomToString(error);
|
|
20884
|
+
if (customToString) output.stringValue = truncateString(customToString, state);
|
|
20885
|
+
if (hasOwnProperty(record, "details")) output.details = toSafeValue(readProperty(record, "details"), state, depth + 1);
|
|
20886
|
+
if (hasOwnProperty(record, "cause")) output.cause = serializeErrorInternal(readProperty(record, "cause"), state, depth + 1);
|
|
20887
|
+
if (hasOwnProperty(record, "errors")) output.errors = toSafeValue(readProperty(record, "errors"), state, depth + 1);
|
|
20888
|
+
for (const key of Object.keys(record).slice(0, state.maxObjectKeys)) {
|
|
20889
|
+
if (ERROR_RESERVED_FIELDS.has(key) || key in output) continue;
|
|
20890
|
+
output[key] = toSafeValue(readProperty(record, key), state, depth + 1);
|
|
20891
|
+
}
|
|
20892
|
+
if (Object.keys(output).length === 0) return {
|
|
20893
|
+
message: safeString(error),
|
|
20894
|
+
value: toSafeValue(error, state, depth + 1)
|
|
20895
|
+
};
|
|
20896
|
+
return output;
|
|
20897
|
+
} finally {
|
|
20898
|
+
state.seen.delete(error);
|
|
20899
|
+
}
|
|
20900
|
+
}
|
|
20901
|
+
function serializeErrorLike(error, options = {}) {
|
|
20902
|
+
return serializeErrorInternal(error, createSerializationState(options));
|
|
20903
|
+
}
|
|
20904
|
+
function toJsonSafeValue(value, options = {}) {
|
|
20905
|
+
return toSafeValue(value, createSerializationState(options));
|
|
20906
|
+
}
|
|
20907
|
+
function safeJsonStringify(value, space) {
|
|
20908
|
+
try {
|
|
20909
|
+
return JSON.stringify(toJsonSafeValue(value), null, space) ?? "undefined";
|
|
20910
|
+
} catch (error) {
|
|
20911
|
+
return JSON.stringify({
|
|
20912
|
+
serializationError: error instanceof Error ? error.message : safeString(error),
|
|
20913
|
+
fallback: safeString(value)
|
|
20914
|
+
});
|
|
20915
|
+
}
|
|
20916
|
+
}
|
|
20917
|
+
|
|
20617
20918
|
//#endregion
|
|
20618
20919
|
//#region ../../core/bvt-agent/src/agent/utils.ts
|
|
20619
20920
|
const hasUnresolvedTokens = (obj) => {
|
|
@@ -20632,6 +20933,25 @@ const formatForLog = (value) => {
|
|
|
20632
20933
|
return String(value);
|
|
20633
20934
|
}
|
|
20634
20935
|
};
|
|
20936
|
+
const OBJECT_OBJECT_TOKEN = "[object Object]";
|
|
20937
|
+
const stripObjectObject = (message) => {
|
|
20938
|
+
const trimmed = message.trim();
|
|
20939
|
+
if (!trimmed.includes(OBJECT_OBJECT_TOKEN)) return trimmed;
|
|
20940
|
+
return trimmed.split(OBJECT_OBJECT_TOKEN).join("").replace(/[A-Za-z$_][\w$]*:\s*$/, "").replace(/[\s:]+$/, "").trim();
|
|
20941
|
+
};
|
|
20942
|
+
const getErrorMessage = (error, fallback = "Unknown error") => {
|
|
20943
|
+
const serialized = serializeErrorLike(error);
|
|
20944
|
+
const message = typeof serialized.message === "string" ? stripObjectObject(serialized.message) : "";
|
|
20945
|
+
if (message) return message;
|
|
20946
|
+
if (error !== null && typeof error === "object" && !(error instanceof Error)) {
|
|
20947
|
+
const json = stripObjectObject(safeJsonStringify(error));
|
|
20948
|
+
if (json && json !== "{}") return json;
|
|
20949
|
+
}
|
|
20950
|
+
return fallback;
|
|
20951
|
+
};
|
|
20952
|
+
const toExecutionError = (error, fallback = "Unknown error") => {
|
|
20953
|
+
return error instanceof Error ? error : new Error(getErrorMessage(error, fallback));
|
|
20954
|
+
};
|
|
20635
20955
|
const getValueFromStringOrRegex = (input) => {
|
|
20636
20956
|
switch (input.type) {
|
|
20637
20957
|
case "string": return input.value;
|
|
@@ -20860,6 +21180,11 @@ async function restoreSessionStorageState(page, value) {
|
|
|
20860
21180
|
|
|
20861
21181
|
//#endregion
|
|
20862
21182
|
//#region ../../core/bvt-agent/src/agent/tester.ts
|
|
21183
|
+
function getResolvedChosenSelectorIndex(result) {
|
|
21184
|
+
if (!result || typeof result !== "object") return;
|
|
21185
|
+
const candidate = result.resolvedChosenSelectorIndex;
|
|
21186
|
+
return Number.isInteger(candidate) ? candidate : void 0;
|
|
21187
|
+
}
|
|
20863
21188
|
const browserTypesMap = {
|
|
20864
21189
|
chromium,
|
|
20865
21190
|
firefox,
|
|
@@ -20928,7 +21253,7 @@ var Tester = class {
|
|
|
20928
21253
|
return this.pageList[this.pageList.length - 1] ?? null;
|
|
20929
21254
|
}
|
|
20930
21255
|
toExecutionError(error) {
|
|
20931
|
-
return
|
|
21256
|
+
return toExecutionError(error);
|
|
20932
21257
|
}
|
|
20933
21258
|
toFailureResult(error) {
|
|
20934
21259
|
const executionError = this.toExecutionError(error);
|
|
@@ -20943,7 +21268,7 @@ var Tester = class {
|
|
|
20943
21268
|
name: error.name,
|
|
20944
21269
|
message: error.message
|
|
20945
21270
|
};
|
|
20946
|
-
return { message:
|
|
21271
|
+
return { message: getErrorMessage(error) };
|
|
20947
21272
|
}
|
|
20948
21273
|
summarizeSessionForExecutionLog(session) {
|
|
20949
21274
|
if (!session) return { type: "none" };
|
|
@@ -21018,7 +21343,7 @@ var Tester = class {
|
|
|
21018
21343
|
startedAt: /* @__PURE__ */ new Date()
|
|
21019
21344
|
};
|
|
21020
21345
|
}
|
|
21021
|
-
async onCommandPass(command, stepDefinitionId, session,
|
|
21346
|
+
async onCommandPass(command, stepDefinitionId, session, metadata) {
|
|
21022
21347
|
this.obs.logger.log(`Command executed successfully: ${command}`);
|
|
21023
21348
|
if (session?.type === "run") {
|
|
21024
21349
|
this.obs.logger.log(`Ending Playwright tracing group for command: ${command}`);
|
|
@@ -21035,7 +21360,8 @@ var Tester = class {
|
|
|
21035
21360
|
stepDefinitionId,
|
|
21036
21361
|
completedAt,
|
|
21037
21362
|
result: { type: "success" },
|
|
21038
|
-
|
|
21363
|
+
...typeof metadata?.resolvedChosenSelectorIndex === "number" ? { resolvedChosenSelectorIndex: metadata.resolvedChosenSelectorIndex } : {},
|
|
21364
|
+
...metadata?.recovery ? { recovery: metadata.recovery } : {}
|
|
21039
21365
|
};
|
|
21040
21366
|
}
|
|
21041
21367
|
async onCommandFail(command, stepDefinitionId, error, session, recovery) {
|
|
@@ -21328,7 +21654,7 @@ var Tester = class {
|
|
|
21328
21654
|
});
|
|
21329
21655
|
if ((command.type === "custom" || command.type === "custom.code") && commandResult && isFailedCustomCommandResult(commandResult)) throw new Error(commandResult.error || `Custom command "${command._id}" failed.`);
|
|
21330
21656
|
this.obs.logger.log(`Finished executing command: ${command}`);
|
|
21331
|
-
yield await this.onCommandPass(command, stepDefinitionId, session);
|
|
21657
|
+
yield await this.onCommandPass(command, stepDefinitionId, session, { resolvedChosenSelectorIndex: getResolvedChosenSelectorIndex(commandResult) });
|
|
21332
21658
|
} catch (error) {
|
|
21333
21659
|
const executionError = this.toExecutionError(error);
|
|
21334
21660
|
let terminalExecutionError = executionError;
|
|
@@ -21447,7 +21773,7 @@ var Tester = class {
|
|
|
21447
21773
|
};
|
|
21448
21774
|
emittedTerminalRecoveryStatus = true;
|
|
21449
21775
|
this.obs.logger.log(`Recovered command ${command._id} with whole-step repair`);
|
|
21450
|
-
yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
|
|
21776
|
+
yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
|
|
21451
21777
|
commandIndex = recorderStep.definition.commands.length - 1;
|
|
21452
21778
|
continue;
|
|
21453
21779
|
} catch (retryError) {
|
|
@@ -21565,7 +21891,7 @@ var Tester = class {
|
|
|
21565
21891
|
};
|
|
21566
21892
|
emittedTerminalRecoveryStatus = true;
|
|
21567
21893
|
this.obs.logger.log(`Recovered command ${command._id} with step repair`);
|
|
21568
|
-
yield await this.onCommandPass(command, stepDefinitionId, session, recoveryMeta);
|
|
21894
|
+
yield await this.onCommandPass(command, stepDefinitionId, session, { recovery: recoveryMeta });
|
|
21569
21895
|
if (decision.stepRepairPlan.type === "command-operations" || decision.stepRepairPlan.preserveSuffix) commandIndex = recorderStep.definition.commands.length - 1;
|
|
21570
21896
|
continue;
|
|
21571
21897
|
} catch (retryError) {
|
|
@@ -22135,7 +22461,7 @@ var Tester = class {
|
|
|
22135
22461
|
return;
|
|
22136
22462
|
} catch (error) {
|
|
22137
22463
|
this.obs.logger.warn(`Action "${data.type}" failed on selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22138
|
-
errors.push(
|
|
22464
|
+
errors.push(this.toExecutionError(error));
|
|
22139
22465
|
}
|
|
22140
22466
|
for (let i = 0; i < target.uniqueSelectors.length; i++) {
|
|
22141
22467
|
if (i === chosenSelectorIndex) continue;
|
|
@@ -22153,10 +22479,10 @@ var Tester = class {
|
|
|
22153
22479
|
};
|
|
22154
22480
|
await this.executeElementAction(locator.target, dataWithModifiedTimeout);
|
|
22155
22481
|
this.obs.logger.info(`Action "${data.type}" completed successfully on target "${target.name}" with fallback selector`);
|
|
22156
|
-
return;
|
|
22482
|
+
return { resolvedChosenSelectorIndex: i };
|
|
22157
22483
|
} catch (error) {
|
|
22158
22484
|
this.obs.logger.warn(`Action "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22159
|
-
errors.push(
|
|
22485
|
+
errors.push(this.toExecutionError(error));
|
|
22160
22486
|
}
|
|
22161
22487
|
}
|
|
22162
22488
|
throw new Error(`All selectors failed for element action "${data.type}". Errors: ${errors.map((e) => e.message).join("; ")}`);
|
|
@@ -22186,7 +22512,7 @@ var Tester = class {
|
|
|
22186
22512
|
return;
|
|
22187
22513
|
} catch (error) {
|
|
22188
22514
|
this.obs.logger.warn(`Assertion "${data.type}" failed on selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22189
|
-
errors.push(
|
|
22515
|
+
errors.push(this.toExecutionError(error));
|
|
22190
22516
|
}
|
|
22191
22517
|
for (let i = 0; i < target.uniqueSelectors.length; i++) {
|
|
22192
22518
|
if (i === chosenSelectorIndex) continue;
|
|
@@ -22203,10 +22529,10 @@ var Tester = class {
|
|
|
22203
22529
|
this.obs.logger.info(`Retrying assertion "${data.type}" using next selector: ${JSON.stringify(selectorInfo)}`);
|
|
22204
22530
|
await this.executeElementAssertion(locator.target, dataWithModifiedTimeout, isNegativeAssertion);
|
|
22205
22531
|
this.obs.logger.info(`Assertion "${data.type}" passed on target "${target.name}" with fallback selector`);
|
|
22206
|
-
return;
|
|
22532
|
+
return { resolvedChosenSelectorIndex: i };
|
|
22207
22533
|
} catch (error) {
|
|
22208
22534
|
this.obs.logger.warn(`Assertion "${data.type}" failed on fallback selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22209
|
-
errors.push(
|
|
22535
|
+
errors.push(this.toExecutionError(error));
|
|
22210
22536
|
}
|
|
22211
22537
|
}
|
|
22212
22538
|
throw new Error(`All selectors failed for element assertion "${data.type}". Errors: ${errors.map((e) => e.message).join("; ")}`);
|
|
@@ -22232,7 +22558,7 @@ var Tester = class {
|
|
|
22232
22558
|
return;
|
|
22233
22559
|
} catch (error) {
|
|
22234
22560
|
this.obs.logger.warn(`Extraction "${extract.type}" failed on selector "${JSON.stringify(selectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22235
|
-
errors.push(
|
|
22561
|
+
errors.push(this.toExecutionError(error));
|
|
22236
22562
|
}
|
|
22237
22563
|
for (let i = 0; i < target.uniqueSelectors.length; i++) {
|
|
22238
22564
|
if (i === chosenSelectorIndex) continue;
|
|
@@ -22242,10 +22568,10 @@ var Tester = class {
|
|
|
22242
22568
|
this.obs.logger.info(`Retrying extraction "${extract.type}" using next selector: ${JSON.stringify(fallbackSelectorInfo)}`);
|
|
22243
22569
|
await this.executeElementExtraction(fallbackLocator.target, extract, storageDetails);
|
|
22244
22570
|
this.obs.logger.info(`Extraction "${extract.type}" completed successfully on target "${target.name}" with fallback selector`);
|
|
22245
|
-
return;
|
|
22571
|
+
return { resolvedChosenSelectorIndex: i };
|
|
22246
22572
|
} catch (error) {
|
|
22247
22573
|
this.obs.logger.warn(`Extraction "${extract.type}" failed on fallback selector "${JSON.stringify(fallbackSelectorInfo, null, 2)}". Trying next selector if available...`, error);
|
|
22248
|
-
errors.push(
|
|
22574
|
+
errors.push(this.toExecutionError(error));
|
|
22249
22575
|
}
|
|
22250
22576
|
}
|
|
22251
22577
|
throw new Error(`All selectors failed for element extraction "${extract.type}". Errors: ${errors.map((e) => e.message).join("; ")}`);
|
|
@@ -22528,101 +22854,6 @@ function createStepParameterPreprocessor() {
|
|
|
22528
22854
|
};
|
|
22529
22855
|
}
|
|
22530
22856
|
|
|
22531
|
-
//#endregion
|
|
22532
|
-
//#region ../../core/bvt-agent/src/agent/data-resolver.preprocessor.ts
|
|
22533
|
-
function createDataResolverPreprocessor(resolver) {
|
|
22534
|
-
return async (command, context) => {
|
|
22535
|
-
if (!context.resolutionContext) return command;
|
|
22536
|
-
if (command.type === "custom" && typeof command.code === "string" && !command.code.includes("{{")) {
|
|
22537
|
-
const { code, ...rest } = command;
|
|
22538
|
-
return {
|
|
22539
|
-
...await resolver.resolveObject(rest, context.resolutionContext),
|
|
22540
|
-
code
|
|
22541
|
-
};
|
|
22542
|
-
}
|
|
22543
|
-
if (command.type === "custom.code" && typeof command.code === "string") {
|
|
22544
|
-
const { code, ...rest } = command;
|
|
22545
|
-
return {
|
|
22546
|
-
...await resolver.resolveObject(rest, context.resolutionContext),
|
|
22547
|
-
code
|
|
22548
|
-
};
|
|
22549
|
-
}
|
|
22550
|
-
return resolver.resolveObject(command, context.resolutionContext);
|
|
22551
|
-
};
|
|
22552
|
-
}
|
|
22553
|
-
|
|
22554
|
-
//#endregion
|
|
22555
|
-
//#region ../../shared/observability/src/logger.ts
|
|
22556
|
-
function extractEventName(metadata) {
|
|
22557
|
-
if (!metadata) return {};
|
|
22558
|
-
const rawEventName = metadata.eventName;
|
|
22559
|
-
if (typeof rawEventName !== "string" || rawEventName.trim().length === 0) return { sanitizedMetadata: metadata };
|
|
22560
|
-
const { eventName: _eventName, ...restMetadata } = metadata;
|
|
22561
|
-
return {
|
|
22562
|
-
eventName: rawEventName,
|
|
22563
|
-
sanitizedMetadata: Object.keys(restMetadata).length > 0 ? restMetadata : void 0
|
|
22564
|
-
};
|
|
22565
|
-
}
|
|
22566
|
-
var Logger = class Logger {
|
|
22567
|
-
constructor(transports, defaultContext = { system: true }) {
|
|
22568
|
-
this.transports = transports;
|
|
22569
|
-
this.defaultContext = defaultContext;
|
|
22570
|
-
}
|
|
22571
|
-
debug(message, metadata, context) {
|
|
22572
|
-
this.emit("debug", message, metadata, context);
|
|
22573
|
-
}
|
|
22574
|
-
info(message, metadata, context) {
|
|
22575
|
-
this.emit("info", message, metadata, context);
|
|
22576
|
-
}
|
|
22577
|
-
warn(message, metadata, context) {
|
|
22578
|
-
this.emit("warn", message, metadata, context);
|
|
22579
|
-
}
|
|
22580
|
-
error(message, metadata, context) {
|
|
22581
|
-
this.emit("error", message, metadata, context);
|
|
22582
|
-
}
|
|
22583
|
-
/** Returns a new Logger instance bound to the given context. */
|
|
22584
|
-
withContext(context) {
|
|
22585
|
-
return new Logger(this.transports, context);
|
|
22586
|
-
}
|
|
22587
|
-
emit(level, message, metadata, context) {
|
|
22588
|
-
const { eventName, sanitizedMetadata } = extractEventName(metadata);
|
|
22589
|
-
const entry = {
|
|
22590
|
-
level,
|
|
22591
|
-
message,
|
|
22592
|
-
...eventName ? { eventName } : {},
|
|
22593
|
-
context: context ?? this.defaultContext,
|
|
22594
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
22595
|
-
metadata: sanitizedMetadata
|
|
22596
|
-
};
|
|
22597
|
-
for (const transport of this.transports) try {
|
|
22598
|
-
const result = transport.log?.(entry);
|
|
22599
|
-
if (result instanceof Promise) result.catch((err) => {
|
|
22600
|
-
console.error(`[observability] Transport "${transport.name}" log() failed:`, err);
|
|
22601
|
-
});
|
|
22602
|
-
} catch (err) {
|
|
22603
|
-
console.error(`[observability] Transport "${transport.name}" log() threw:`, err);
|
|
22604
|
-
}
|
|
22605
|
-
}
|
|
22606
|
-
};
|
|
22607
|
-
|
|
22608
|
-
//#endregion
|
|
22609
|
-
//#region ../../shared/observability/src/error-serialization.ts
|
|
22610
|
-
const DEFAULT_MAX_STRING_LENGTH = Number.MAX_SAFE_INTEGER;
|
|
22611
|
-
const ERROR_FIELD_NAMES = [
|
|
22612
|
-
"name",
|
|
22613
|
-
"message",
|
|
22614
|
-
"code",
|
|
22615
|
-
"status",
|
|
22616
|
-
"statusCode",
|
|
22617
|
-
"stack"
|
|
22618
|
-
];
|
|
22619
|
-
const ERROR_RESERVED_FIELDS = new Set([
|
|
22620
|
-
...ERROR_FIELD_NAMES,
|
|
22621
|
-
"cause",
|
|
22622
|
-
"errors",
|
|
22623
|
-
"details"
|
|
22624
|
-
]);
|
|
22625
|
-
|
|
22626
22857
|
//#endregion
|
|
22627
22858
|
//#region ../../core/data-resolver/src/types.ts
|
|
22628
22859
|
var CircularDependencyError = class extends Error {
|
|
@@ -22946,7 +23177,7 @@ function parsePath(path) {
|
|
|
22946
23177
|
}
|
|
22947
23178
|
|
|
22948
23179
|
//#endregion
|
|
22949
|
-
//#region ../../node_modules/dlv/dist/dlv.js
|
|
23180
|
+
//#region ../../node_modules/.pnpm/dlv@1.1.3/node_modules/dlv/dist/dlv.js
|
|
22950
23181
|
var require_dlv = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22951
23182
|
module.exports = function(t, e, l, n, o) {
|
|
22952
23183
|
for (e = e.split ? e.split(".") : e, n = 0; n < e.length; n++) t = t ? t[e[n]] : o;
|
|
@@ -23034,7 +23265,7 @@ async function decrypt(encrypted, keyMaterial) {
|
|
|
23034
23265
|
* @returns 6-digit TOTP code as a string
|
|
23035
23266
|
*/
|
|
23036
23267
|
async function generateTOTP(seed) {
|
|
23037
|
-
const { TOTP } = await import("./otpauth.node-
|
|
23268
|
+
const { TOTP } = await import("./otpauth.node-flL8gowF.mjs");
|
|
23038
23269
|
return new TOTP({
|
|
23039
23270
|
secret: seed,
|
|
23040
23271
|
digits: 6,
|
|
@@ -23074,6 +23305,7 @@ var DataResolver = class {
|
|
|
23074
23305
|
encryptionKey;
|
|
23075
23306
|
decryptSecret;
|
|
23076
23307
|
decryptTotpSeed;
|
|
23308
|
+
skipJSNormalization;
|
|
23077
23309
|
constructor(scopeManager, evaluatorRegistry, options) {
|
|
23078
23310
|
this.scopeManager = scopeManager;
|
|
23079
23311
|
this.registry = evaluatorRegistry;
|
|
@@ -23081,6 +23313,7 @@ var DataResolver = class {
|
|
|
23081
23313
|
this.encryptionKey = options?.encryptionKey;
|
|
23082
23314
|
this.decryptSecret = options?.decryptSecret;
|
|
23083
23315
|
this.decryptTotpSeed = options?.decryptTotpSeed;
|
|
23316
|
+
this.skipJSNormalization = options?.skipJSNormalization ?? false;
|
|
23084
23317
|
this.logger = options?.logger ?? silentLogger;
|
|
23085
23318
|
if (!this.registry.has("literal")) this.registry.register(new LiteralEvaluator());
|
|
23086
23319
|
}
|
|
@@ -23127,7 +23360,12 @@ var DataResolver = class {
|
|
|
23127
23360
|
return this.resolveValue(input, new ResolutionStack(), [], [], log, context);
|
|
23128
23361
|
}
|
|
23129
23362
|
async resolveString(input, stack, warnings, usedKeys, log, context) {
|
|
23130
|
-
const normalized = normalizeJSTokens(input);
|
|
23363
|
+
const normalized = this.skipJSNormalization ? input : normalizeJSTokens(input);
|
|
23364
|
+
if (normalized !== input && !this.skipJSNormalization) log.warn("[DataResolver] ${...} shorthand is deprecated — use {{js:...}} instead", {
|
|
23365
|
+
input,
|
|
23366
|
+
normalized,
|
|
23367
|
+
projectId: context?.projectId
|
|
23368
|
+
});
|
|
23131
23369
|
if (!hasTokens(normalized)) return input;
|
|
23132
23370
|
if (stack.depth >= this.maxRecursionDepth) {
|
|
23133
23371
|
const message = `Maximum recursion depth (${this.maxRecursionDepth}) reached`;
|
|
@@ -23596,7 +23834,7 @@ var FakerEvaluator = class {
|
|
|
23596
23834
|
this.fakerInstance = faker;
|
|
23597
23835
|
return faker;
|
|
23598
23836
|
} catch {
|
|
23599
|
-
const { faker } = await import("./en-
|
|
23837
|
+
const { faker } = await import("./en-KbNSnMPf.mjs");
|
|
23600
23838
|
this.fakerInstance = faker;
|
|
23601
23839
|
return faker;
|
|
23602
23840
|
}
|
|
@@ -23670,7 +23908,7 @@ var FakerEvaluator = class {
|
|
|
23670
23908
|
};
|
|
23671
23909
|
|
|
23672
23910
|
//#endregion
|
|
23673
|
-
//#region ../../node_modules/jsep/dist/jsep.js
|
|
23911
|
+
//#region ../../node_modules/.pnpm/jsep@1.4.0/node_modules/jsep/dist/jsep.js
|
|
23674
23912
|
/**
|
|
23675
23913
|
* @implements {IHooks}
|
|
23676
23914
|
*/
|
|
@@ -25034,39 +25272,2636 @@ var JSEvaluator = class {
|
|
|
25034
25272
|
};
|
|
25035
25273
|
|
|
25036
25274
|
//#endregion
|
|
25037
|
-
//#region ../../
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25275
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/types.js
|
|
25276
|
+
var Meridiem;
|
|
25277
|
+
(function(Meridiem) {
|
|
25278
|
+
Meridiem[Meridiem["AM"] = 0] = "AM";
|
|
25279
|
+
Meridiem[Meridiem["PM"] = 1] = "PM";
|
|
25280
|
+
})(Meridiem || (Meridiem = {}));
|
|
25281
|
+
var Weekday;
|
|
25282
|
+
(function(Weekday) {
|
|
25283
|
+
Weekday[Weekday["SUNDAY"] = 0] = "SUNDAY";
|
|
25284
|
+
Weekday[Weekday["MONDAY"] = 1] = "MONDAY";
|
|
25285
|
+
Weekday[Weekday["TUESDAY"] = 2] = "TUESDAY";
|
|
25286
|
+
Weekday[Weekday["WEDNESDAY"] = 3] = "WEDNESDAY";
|
|
25287
|
+
Weekday[Weekday["THURSDAY"] = 4] = "THURSDAY";
|
|
25288
|
+
Weekday[Weekday["FRIDAY"] = 5] = "FRIDAY";
|
|
25289
|
+
Weekday[Weekday["SATURDAY"] = 6] = "SATURDAY";
|
|
25290
|
+
})(Weekday || (Weekday = {}));
|
|
25291
|
+
var Month;
|
|
25292
|
+
(function(Month) {
|
|
25293
|
+
Month[Month["JANUARY"] = 1] = "JANUARY";
|
|
25294
|
+
Month[Month["FEBRUARY"] = 2] = "FEBRUARY";
|
|
25295
|
+
Month[Month["MARCH"] = 3] = "MARCH";
|
|
25296
|
+
Month[Month["APRIL"] = 4] = "APRIL";
|
|
25297
|
+
Month[Month["MAY"] = 5] = "MAY";
|
|
25298
|
+
Month[Month["JUNE"] = 6] = "JUNE";
|
|
25299
|
+
Month[Month["JULY"] = 7] = "JULY";
|
|
25300
|
+
Month[Month["AUGUST"] = 8] = "AUGUST";
|
|
25301
|
+
Month[Month["SEPTEMBER"] = 9] = "SEPTEMBER";
|
|
25302
|
+
Month[Month["OCTOBER"] = 10] = "OCTOBER";
|
|
25303
|
+
Month[Month["NOVEMBER"] = 11] = "NOVEMBER";
|
|
25304
|
+
Month[Month["DECEMBER"] = 12] = "DECEMBER";
|
|
25305
|
+
})(Month || (Month = {}));
|
|
25050
25306
|
|
|
25051
25307
|
//#endregion
|
|
25052
|
-
//#region ../../
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25059
|
-
|
|
25060
|
-
|
|
25061
|
-
|
|
25062
|
-
|
|
25063
|
-
|
|
25064
|
-
|
|
25065
|
-
|
|
25066
|
-
|
|
25067
|
-
|
|
25308
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/utils/dates.js
|
|
25309
|
+
function assignSimilarDate(component, target) {
|
|
25310
|
+
component.assign("day", target.getDate());
|
|
25311
|
+
component.assign("month", target.getMonth() + 1);
|
|
25312
|
+
component.assign("year", target.getFullYear());
|
|
25313
|
+
}
|
|
25314
|
+
function assignSimilarTime(component, target) {
|
|
25315
|
+
component.assign("hour", target.getHours());
|
|
25316
|
+
component.assign("minute", target.getMinutes());
|
|
25317
|
+
component.assign("second", target.getSeconds());
|
|
25318
|
+
component.assign("millisecond", target.getMilliseconds());
|
|
25319
|
+
component.assign("meridiem", target.getHours() < 12 ? Meridiem.AM : Meridiem.PM);
|
|
25320
|
+
}
|
|
25321
|
+
function implySimilarDate(component, target) {
|
|
25322
|
+
component.imply("day", target.getDate());
|
|
25323
|
+
component.imply("month", target.getMonth() + 1);
|
|
25324
|
+
component.imply("year", target.getFullYear());
|
|
25325
|
+
}
|
|
25326
|
+
function implySimilarTime(component, target) {
|
|
25327
|
+
component.imply("hour", target.getHours());
|
|
25328
|
+
component.imply("minute", target.getMinutes());
|
|
25329
|
+
component.imply("second", target.getSeconds());
|
|
25330
|
+
component.imply("millisecond", target.getMilliseconds());
|
|
25331
|
+
component.imply("meridiem", target.getHours() < 12 ? Meridiem.AM : Meridiem.PM);
|
|
25332
|
+
}
|
|
25333
|
+
|
|
25334
|
+
//#endregion
|
|
25335
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/timezone.js
|
|
25336
|
+
const TIMEZONE_ABBR_MAP = {
|
|
25337
|
+
ACDT: 630,
|
|
25338
|
+
ACST: 570,
|
|
25339
|
+
ADT: -180,
|
|
25340
|
+
AEDT: 660,
|
|
25341
|
+
AEST: 600,
|
|
25342
|
+
AFT: 270,
|
|
25343
|
+
AKDT: -480,
|
|
25344
|
+
AKST: -540,
|
|
25345
|
+
ALMT: 360,
|
|
25346
|
+
AMST: -180,
|
|
25347
|
+
AMT: -240,
|
|
25348
|
+
ANAST: 720,
|
|
25349
|
+
ANAT: 720,
|
|
25350
|
+
AQTT: 300,
|
|
25351
|
+
ART: -180,
|
|
25352
|
+
AST: -240,
|
|
25353
|
+
AWDT: 540,
|
|
25354
|
+
AWST: 480,
|
|
25355
|
+
AZOST: 0,
|
|
25356
|
+
AZOT: -60,
|
|
25357
|
+
AZST: 300,
|
|
25358
|
+
AZT: 240,
|
|
25359
|
+
BNT: 480,
|
|
25360
|
+
BOT: -240,
|
|
25361
|
+
BRST: -120,
|
|
25362
|
+
BRT: -180,
|
|
25363
|
+
BST: 60,
|
|
25364
|
+
BTT: 360,
|
|
25365
|
+
CAST: 480,
|
|
25366
|
+
CAT: 120,
|
|
25367
|
+
CCT: 390,
|
|
25368
|
+
CDT: -300,
|
|
25369
|
+
CEST: 120,
|
|
25370
|
+
CET: {
|
|
25371
|
+
timezoneOffsetDuringDst: 120,
|
|
25372
|
+
timezoneOffsetNonDst: 60,
|
|
25373
|
+
dstStart: (year) => getLastWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2),
|
|
25374
|
+
dstEnd: (year) => getLastWeekdayOfMonth(year, Month.OCTOBER, Weekday.SUNDAY, 3)
|
|
25375
|
+
},
|
|
25376
|
+
CHADT: 825,
|
|
25377
|
+
CHAST: 765,
|
|
25378
|
+
CKT: -600,
|
|
25379
|
+
CLST: -180,
|
|
25380
|
+
CLT: -240,
|
|
25381
|
+
COT: -300,
|
|
25382
|
+
CST: -360,
|
|
25383
|
+
CT: {
|
|
25384
|
+
timezoneOffsetDuringDst: -300,
|
|
25385
|
+
timezoneOffsetNonDst: -360,
|
|
25386
|
+
dstStart: (year) => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
|
25387
|
+
dstEnd: (year) => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
|
25388
|
+
},
|
|
25389
|
+
CVT: -60,
|
|
25390
|
+
CXT: 420,
|
|
25391
|
+
ChST: 600,
|
|
25392
|
+
DAVT: 420,
|
|
25393
|
+
EASST: -300,
|
|
25394
|
+
EAST: -360,
|
|
25395
|
+
EAT: 180,
|
|
25396
|
+
ECT: -300,
|
|
25397
|
+
EDT: -240,
|
|
25398
|
+
EEST: 180,
|
|
25399
|
+
EET: 120,
|
|
25400
|
+
EGST: 0,
|
|
25401
|
+
EGT: -60,
|
|
25402
|
+
EST: -300,
|
|
25403
|
+
ET: {
|
|
25404
|
+
timezoneOffsetDuringDst: -240,
|
|
25405
|
+
timezoneOffsetNonDst: -300,
|
|
25406
|
+
dstStart: (year) => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
|
25407
|
+
dstEnd: (year) => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
|
25408
|
+
},
|
|
25409
|
+
FJST: 780,
|
|
25410
|
+
FJT: 720,
|
|
25411
|
+
FKST: -180,
|
|
25412
|
+
FKT: -240,
|
|
25413
|
+
FNT: -120,
|
|
25414
|
+
GALT: -360,
|
|
25415
|
+
GAMT: -540,
|
|
25416
|
+
GET: 240,
|
|
25417
|
+
GFT: -180,
|
|
25418
|
+
GILT: 720,
|
|
25419
|
+
GMT: 0,
|
|
25420
|
+
GST: 240,
|
|
25421
|
+
GYT: -240,
|
|
25422
|
+
HAA: -180,
|
|
25423
|
+
HAC: -300,
|
|
25424
|
+
HADT: -540,
|
|
25425
|
+
HAE: -240,
|
|
25426
|
+
HAP: -420,
|
|
25427
|
+
HAR: -360,
|
|
25428
|
+
HAST: -600,
|
|
25429
|
+
HAT: -90,
|
|
25430
|
+
HAY: -480,
|
|
25431
|
+
HKT: 480,
|
|
25432
|
+
HLV: -210,
|
|
25433
|
+
HNA: -240,
|
|
25434
|
+
HNC: -360,
|
|
25435
|
+
HNE: -300,
|
|
25436
|
+
HNP: -480,
|
|
25437
|
+
HNR: -420,
|
|
25438
|
+
HNT: -150,
|
|
25439
|
+
HNY: -540,
|
|
25440
|
+
HOVT: 420,
|
|
25441
|
+
ICT: 420,
|
|
25442
|
+
IDT: 180,
|
|
25443
|
+
IOT: 360,
|
|
25444
|
+
IRDT: 270,
|
|
25445
|
+
IRKST: 540,
|
|
25446
|
+
IRKT: 540,
|
|
25447
|
+
IRST: 210,
|
|
25448
|
+
IST: 330,
|
|
25449
|
+
JST: 540,
|
|
25450
|
+
KGT: 360,
|
|
25451
|
+
KRAST: 480,
|
|
25452
|
+
KRAT: 480,
|
|
25453
|
+
KST: 540,
|
|
25454
|
+
KUYT: 240,
|
|
25455
|
+
LHDT: 660,
|
|
25456
|
+
LHST: 630,
|
|
25457
|
+
LINT: 840,
|
|
25458
|
+
MAGST: 720,
|
|
25459
|
+
MAGT: 720,
|
|
25460
|
+
MART: -510,
|
|
25461
|
+
MAWT: 300,
|
|
25462
|
+
MDT: -360,
|
|
25463
|
+
MESZ: 120,
|
|
25464
|
+
MEZ: 60,
|
|
25465
|
+
MHT: 720,
|
|
25466
|
+
MMT: 390,
|
|
25467
|
+
MSD: 240,
|
|
25468
|
+
MSK: 180,
|
|
25469
|
+
MST: -420,
|
|
25470
|
+
MT: {
|
|
25471
|
+
timezoneOffsetDuringDst: -360,
|
|
25472
|
+
timezoneOffsetNonDst: -420,
|
|
25473
|
+
dstStart: (year) => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
|
25474
|
+
dstEnd: (year) => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
|
25475
|
+
},
|
|
25476
|
+
MUT: 240,
|
|
25477
|
+
MVT: 300,
|
|
25478
|
+
MYT: 480,
|
|
25479
|
+
NCT: 660,
|
|
25480
|
+
NDT: -90,
|
|
25481
|
+
NFT: 690,
|
|
25482
|
+
NOVST: 420,
|
|
25483
|
+
NOVT: 360,
|
|
25484
|
+
NPT: 345,
|
|
25485
|
+
NST: -150,
|
|
25486
|
+
NUT: -660,
|
|
25487
|
+
NZDT: 780,
|
|
25488
|
+
NZST: 720,
|
|
25489
|
+
OMSST: 420,
|
|
25490
|
+
OMST: 420,
|
|
25491
|
+
PDT: -420,
|
|
25492
|
+
PET: -300,
|
|
25493
|
+
PETST: 720,
|
|
25494
|
+
PETT: 720,
|
|
25495
|
+
PGT: 600,
|
|
25496
|
+
PHOT: 780,
|
|
25497
|
+
PHT: 480,
|
|
25498
|
+
PKT: 300,
|
|
25499
|
+
PMDT: -120,
|
|
25500
|
+
PMST: -180,
|
|
25501
|
+
PONT: 660,
|
|
25502
|
+
PST: -480,
|
|
25503
|
+
PT: {
|
|
25504
|
+
timezoneOffsetDuringDst: -420,
|
|
25505
|
+
timezoneOffsetNonDst: -480,
|
|
25506
|
+
dstStart: (year) => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
|
25507
|
+
dstEnd: (year) => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
|
25508
|
+
},
|
|
25509
|
+
PWT: 540,
|
|
25510
|
+
PYST: -180,
|
|
25511
|
+
PYT: -240,
|
|
25512
|
+
RET: 240,
|
|
25513
|
+
SAMT: 240,
|
|
25514
|
+
SAST: 120,
|
|
25515
|
+
SBT: 660,
|
|
25516
|
+
SCT: 240,
|
|
25517
|
+
SGT: 480,
|
|
25518
|
+
SRT: -180,
|
|
25519
|
+
SST: -660,
|
|
25520
|
+
TAHT: -600,
|
|
25521
|
+
TFT: 300,
|
|
25522
|
+
TJT: 300,
|
|
25523
|
+
TKT: 780,
|
|
25524
|
+
TLT: 540,
|
|
25525
|
+
TMT: 300,
|
|
25526
|
+
TVT: 720,
|
|
25527
|
+
ULAT: 480,
|
|
25528
|
+
UTC: 0,
|
|
25529
|
+
UYST: -120,
|
|
25530
|
+
UYT: -180,
|
|
25531
|
+
UZT: 300,
|
|
25532
|
+
VET: -210,
|
|
25533
|
+
VLAST: 660,
|
|
25534
|
+
VLAT: 660,
|
|
25535
|
+
VUT: 660,
|
|
25536
|
+
WAST: 120,
|
|
25537
|
+
WAT: 60,
|
|
25538
|
+
WEST: 60,
|
|
25539
|
+
WESZ: 60,
|
|
25540
|
+
WET: 0,
|
|
25541
|
+
WEZ: 0,
|
|
25542
|
+
WFT: 720,
|
|
25543
|
+
WGST: -120,
|
|
25544
|
+
WGT: -180,
|
|
25545
|
+
WIB: 420,
|
|
25546
|
+
WIT: 540,
|
|
25547
|
+
WITA: 480,
|
|
25548
|
+
WST: 780,
|
|
25549
|
+
WT: 0,
|
|
25550
|
+
YAKST: 600,
|
|
25551
|
+
YAKT: 600,
|
|
25552
|
+
YAPT: 600,
|
|
25553
|
+
YEKST: 360,
|
|
25554
|
+
YEKT: 360
|
|
25555
|
+
};
|
|
25556
|
+
function getNthWeekdayOfMonth(year, month, weekday, n, hour = 0) {
|
|
25557
|
+
let dayOfMonth = 0;
|
|
25068
25558
|
let i = 0;
|
|
25069
|
-
|
|
25559
|
+
while (i < n) {
|
|
25560
|
+
dayOfMonth++;
|
|
25561
|
+
if (new Date(year, month - 1, dayOfMonth).getDay() === weekday) i++;
|
|
25562
|
+
}
|
|
25563
|
+
return new Date(year, month - 1, dayOfMonth, hour);
|
|
25564
|
+
}
|
|
25565
|
+
function getLastWeekdayOfMonth(year, month, weekday, hour = 0) {
|
|
25566
|
+
const oneIndexedWeekday = weekday === 0 ? 7 : weekday;
|
|
25567
|
+
const date = new Date(year, month - 1 + 1, 1, 12);
|
|
25568
|
+
const firstWeekdayNextMonth = date.getDay() === 0 ? 7 : date.getDay();
|
|
25569
|
+
let dayDiff;
|
|
25570
|
+
if (firstWeekdayNextMonth === oneIndexedWeekday) dayDiff = 7;
|
|
25571
|
+
else if (firstWeekdayNextMonth < oneIndexedWeekday) dayDiff = 7 + firstWeekdayNextMonth - oneIndexedWeekday;
|
|
25572
|
+
else dayDiff = firstWeekdayNextMonth - oneIndexedWeekday;
|
|
25573
|
+
date.setDate(date.getDate() - dayDiff);
|
|
25574
|
+
return new Date(year, month - 1, date.getDate(), hour);
|
|
25575
|
+
}
|
|
25576
|
+
function toTimezoneOffset(timezoneInput, date, timezoneOverrides = {}) {
|
|
25577
|
+
if (timezoneInput == null) return null;
|
|
25578
|
+
if (typeof timezoneInput === "number") return timezoneInput;
|
|
25579
|
+
const matchedTimezone = timezoneOverrides[timezoneInput] ?? TIMEZONE_ABBR_MAP[timezoneInput];
|
|
25580
|
+
if (matchedTimezone == null) return null;
|
|
25581
|
+
if (typeof matchedTimezone == "number") return matchedTimezone;
|
|
25582
|
+
if (date == null) return null;
|
|
25583
|
+
if (date > matchedTimezone.dstStart(date.getFullYear()) && !(date > matchedTimezone.dstEnd(date.getFullYear()))) return matchedTimezone.timezoneOffsetDuringDst;
|
|
25584
|
+
return matchedTimezone.timezoneOffsetNonDst;
|
|
25585
|
+
}
|
|
25586
|
+
|
|
25587
|
+
//#endregion
|
|
25588
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/calculation/duration.js
|
|
25589
|
+
const EmptyDuration = {
|
|
25590
|
+
day: 0,
|
|
25591
|
+
second: 0,
|
|
25592
|
+
millisecond: 0
|
|
25593
|
+
};
|
|
25594
|
+
function addDuration(ref, duration) {
|
|
25595
|
+
let date = new Date(ref);
|
|
25596
|
+
if (duration["y"]) {
|
|
25597
|
+
duration["year"] = duration["y"];
|
|
25598
|
+
delete duration["y"];
|
|
25599
|
+
}
|
|
25600
|
+
if (duration["mo"]) {
|
|
25601
|
+
duration["month"] = duration["mo"];
|
|
25602
|
+
delete duration["mo"];
|
|
25603
|
+
}
|
|
25604
|
+
if (duration["M"]) {
|
|
25605
|
+
duration["month"] = duration["M"];
|
|
25606
|
+
delete duration["M"];
|
|
25607
|
+
}
|
|
25608
|
+
if (duration["w"]) {
|
|
25609
|
+
duration["week"] = duration["w"];
|
|
25610
|
+
delete duration["w"];
|
|
25611
|
+
}
|
|
25612
|
+
if (duration["d"]) {
|
|
25613
|
+
duration["day"] = duration["d"];
|
|
25614
|
+
delete duration["d"];
|
|
25615
|
+
}
|
|
25616
|
+
if (duration["h"]) {
|
|
25617
|
+
duration["hour"] = duration["h"];
|
|
25618
|
+
delete duration["h"];
|
|
25619
|
+
}
|
|
25620
|
+
if (duration["m"]) {
|
|
25621
|
+
duration["minute"] = duration["m"];
|
|
25622
|
+
delete duration["m"];
|
|
25623
|
+
}
|
|
25624
|
+
if (duration["s"]) {
|
|
25625
|
+
duration["second"] = duration["s"];
|
|
25626
|
+
delete duration["s"];
|
|
25627
|
+
}
|
|
25628
|
+
if (duration["ms"]) {
|
|
25629
|
+
duration["millisecond"] = duration["ms"];
|
|
25630
|
+
delete duration["ms"];
|
|
25631
|
+
}
|
|
25632
|
+
if ("year" in duration) {
|
|
25633
|
+
const floor = Math.floor(duration["year"]);
|
|
25634
|
+
date.setFullYear(date.getFullYear() + floor);
|
|
25635
|
+
const remainingFraction = duration["year"] - floor;
|
|
25636
|
+
if (remainingFraction > 0) {
|
|
25637
|
+
duration.month = duration?.month ?? 0;
|
|
25638
|
+
duration.month += remainingFraction * 12;
|
|
25639
|
+
}
|
|
25640
|
+
}
|
|
25641
|
+
if ("quarter" in duration) {
|
|
25642
|
+
const floor = Math.floor(duration["quarter"]);
|
|
25643
|
+
date.setMonth(date.getMonth() + floor * 3);
|
|
25644
|
+
}
|
|
25645
|
+
if ("month" in duration) {
|
|
25646
|
+
const floor = Math.floor(duration["month"]);
|
|
25647
|
+
date.setMonth(date.getMonth() + floor);
|
|
25648
|
+
const remainingFraction = duration["month"] - floor;
|
|
25649
|
+
if (remainingFraction > 0) {
|
|
25650
|
+
duration.week = duration?.week ?? 0;
|
|
25651
|
+
duration.week += remainingFraction * 4;
|
|
25652
|
+
}
|
|
25653
|
+
}
|
|
25654
|
+
if ("week" in duration) {
|
|
25655
|
+
const floor = Math.floor(duration["week"]);
|
|
25656
|
+
date.setDate(date.getDate() + floor * 7);
|
|
25657
|
+
const remainingFraction = duration["week"] - floor;
|
|
25658
|
+
if (remainingFraction > 0) {
|
|
25659
|
+
duration.day = duration?.day ?? 0;
|
|
25660
|
+
duration.day += Math.round(remainingFraction * 7);
|
|
25661
|
+
}
|
|
25662
|
+
}
|
|
25663
|
+
if ("day" in duration) {
|
|
25664
|
+
const floor = Math.floor(duration["day"]);
|
|
25665
|
+
date.setDate(date.getDate() + floor);
|
|
25666
|
+
const remainingFraction = duration["day"] - floor;
|
|
25667
|
+
if (remainingFraction > 0) {
|
|
25668
|
+
duration.hour = duration?.hour ?? 0;
|
|
25669
|
+
duration.hour += Math.round(remainingFraction * 24);
|
|
25670
|
+
}
|
|
25671
|
+
}
|
|
25672
|
+
if ("hour" in duration) {
|
|
25673
|
+
const floor = Math.floor(duration["hour"]);
|
|
25674
|
+
date.setHours(date.getHours() + floor);
|
|
25675
|
+
const remainingFraction = duration["hour"] - floor;
|
|
25676
|
+
if (remainingFraction > 0) {
|
|
25677
|
+
duration.minute = duration?.minute ?? 0;
|
|
25678
|
+
duration.minute += Math.round(remainingFraction * 60);
|
|
25679
|
+
}
|
|
25680
|
+
}
|
|
25681
|
+
if ("minute" in duration) {
|
|
25682
|
+
const floor = Math.floor(duration["minute"]);
|
|
25683
|
+
date.setMinutes(date.getMinutes() + floor);
|
|
25684
|
+
const remainingFraction = duration["minute"] - floor;
|
|
25685
|
+
if (remainingFraction > 0) {
|
|
25686
|
+
duration.second = duration?.second ?? 0;
|
|
25687
|
+
duration.second += Math.round(remainingFraction * 60);
|
|
25688
|
+
}
|
|
25689
|
+
}
|
|
25690
|
+
if ("second" in duration) {
|
|
25691
|
+
const floor = Math.floor(duration["second"]);
|
|
25692
|
+
date.setSeconds(date.getSeconds() + floor);
|
|
25693
|
+
const remainingFraction = duration["second"] - floor;
|
|
25694
|
+
if (remainingFraction > 0) {
|
|
25695
|
+
duration.millisecond = duration?.millisecond ?? 0;
|
|
25696
|
+
duration.millisecond += Math.round(remainingFraction * 1e3);
|
|
25697
|
+
}
|
|
25698
|
+
}
|
|
25699
|
+
if ("millisecond" in duration) {
|
|
25700
|
+
const floor = Math.floor(duration["millisecond"]);
|
|
25701
|
+
date.setMilliseconds(date.getMilliseconds() + floor);
|
|
25702
|
+
}
|
|
25703
|
+
return date;
|
|
25704
|
+
}
|
|
25705
|
+
function reverseDuration(duration) {
|
|
25706
|
+
const reversed = {};
|
|
25707
|
+
for (const key in duration) reversed[key] = -duration[key];
|
|
25708
|
+
return reversed;
|
|
25709
|
+
}
|
|
25710
|
+
|
|
25711
|
+
//#endregion
|
|
25712
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/results.js
|
|
25713
|
+
var ReferenceWithTimezone = class ReferenceWithTimezone {
|
|
25714
|
+
instant;
|
|
25715
|
+
timezoneOffset;
|
|
25716
|
+
constructor(instant, timezoneOffset) {
|
|
25717
|
+
this.instant = instant ?? /* @__PURE__ */ new Date();
|
|
25718
|
+
this.timezoneOffset = timezoneOffset ?? null;
|
|
25719
|
+
}
|
|
25720
|
+
static fromDate(date) {
|
|
25721
|
+
return new ReferenceWithTimezone(date);
|
|
25722
|
+
}
|
|
25723
|
+
static fromInput(input, timezoneOverrides) {
|
|
25724
|
+
if (input instanceof Date) return ReferenceWithTimezone.fromDate(input);
|
|
25725
|
+
const instant = input?.instant ?? /* @__PURE__ */ new Date();
|
|
25726
|
+
return new ReferenceWithTimezone(instant, toTimezoneOffset(input?.timezone, instant, timezoneOverrides));
|
|
25727
|
+
}
|
|
25728
|
+
getDateWithAdjustedTimezone() {
|
|
25729
|
+
const date = new Date(this.instant);
|
|
25730
|
+
if (this.timezoneOffset !== null) date.setMinutes(date.getMinutes() - this.getSystemTimezoneAdjustmentMinute(this.instant));
|
|
25731
|
+
return date;
|
|
25732
|
+
}
|
|
25733
|
+
getSystemTimezoneAdjustmentMinute(date, overrideTimezoneOffset) {
|
|
25734
|
+
if (!date || date.getTime() < 0) date = /* @__PURE__ */ new Date();
|
|
25735
|
+
const currentTimezoneOffset = -date.getTimezoneOffset();
|
|
25736
|
+
return currentTimezoneOffset - (overrideTimezoneOffset ?? this.timezoneOffset ?? currentTimezoneOffset);
|
|
25737
|
+
}
|
|
25738
|
+
getTimezoneOffset() {
|
|
25739
|
+
return this.timezoneOffset ?? -this.instant.getTimezoneOffset();
|
|
25740
|
+
}
|
|
25741
|
+
};
|
|
25742
|
+
var ParsingComponents = class ParsingComponents {
|
|
25743
|
+
knownValues;
|
|
25744
|
+
impliedValues;
|
|
25745
|
+
reference;
|
|
25746
|
+
_tags = /* @__PURE__ */ new Set();
|
|
25747
|
+
constructor(reference, knownComponents) {
|
|
25748
|
+
this.reference = reference;
|
|
25749
|
+
this.knownValues = {};
|
|
25750
|
+
this.impliedValues = {};
|
|
25751
|
+
if (knownComponents) for (const key in knownComponents) this.knownValues[key] = knownComponents[key];
|
|
25752
|
+
const date = reference.getDateWithAdjustedTimezone();
|
|
25753
|
+
this.imply("day", date.getDate());
|
|
25754
|
+
this.imply("month", date.getMonth() + 1);
|
|
25755
|
+
this.imply("year", date.getFullYear());
|
|
25756
|
+
this.imply("hour", 12);
|
|
25757
|
+
this.imply("minute", 0);
|
|
25758
|
+
this.imply("second", 0);
|
|
25759
|
+
this.imply("millisecond", 0);
|
|
25760
|
+
}
|
|
25761
|
+
static createRelativeFromReference(reference, duration = EmptyDuration) {
|
|
25762
|
+
let date = addDuration(reference.getDateWithAdjustedTimezone(), duration);
|
|
25763
|
+
const components = new ParsingComponents(reference);
|
|
25764
|
+
components.addTag("result/relativeDate");
|
|
25765
|
+
if ("hour" in duration || "minute" in duration || "second" in duration || "millisecond" in duration) {
|
|
25766
|
+
components.addTag("result/relativeDateAndTime");
|
|
25767
|
+
assignSimilarTime(components, date);
|
|
25768
|
+
assignSimilarDate(components, date);
|
|
25769
|
+
components.assign("timezoneOffset", reference.getTimezoneOffset());
|
|
25770
|
+
} else {
|
|
25771
|
+
implySimilarTime(components, date);
|
|
25772
|
+
components.imply("timezoneOffset", reference.getTimezoneOffset());
|
|
25773
|
+
if ("day" in duration) {
|
|
25774
|
+
components.assign("day", date.getDate());
|
|
25775
|
+
components.assign("month", date.getMonth() + 1);
|
|
25776
|
+
components.assign("year", date.getFullYear());
|
|
25777
|
+
components.assign("weekday", date.getDay());
|
|
25778
|
+
} else if ("week" in duration) {
|
|
25779
|
+
components.assign("day", date.getDate());
|
|
25780
|
+
components.assign("month", date.getMonth() + 1);
|
|
25781
|
+
components.assign("year", date.getFullYear());
|
|
25782
|
+
components.imply("weekday", date.getDay());
|
|
25783
|
+
} else {
|
|
25784
|
+
components.imply("day", date.getDate());
|
|
25785
|
+
if ("month" in duration) {
|
|
25786
|
+
components.assign("month", date.getMonth() + 1);
|
|
25787
|
+
components.assign("year", date.getFullYear());
|
|
25788
|
+
} else {
|
|
25789
|
+
components.imply("month", date.getMonth() + 1);
|
|
25790
|
+
if ("year" in duration) components.assign("year", date.getFullYear());
|
|
25791
|
+
else components.imply("year", date.getFullYear());
|
|
25792
|
+
}
|
|
25793
|
+
}
|
|
25794
|
+
}
|
|
25795
|
+
return components;
|
|
25796
|
+
}
|
|
25797
|
+
get(component) {
|
|
25798
|
+
if (component in this.knownValues) return this.knownValues[component];
|
|
25799
|
+
if (component in this.impliedValues) return this.impliedValues[component];
|
|
25800
|
+
return null;
|
|
25801
|
+
}
|
|
25802
|
+
isCertain(component) {
|
|
25803
|
+
return component in this.knownValues;
|
|
25804
|
+
}
|
|
25805
|
+
getCertainComponents() {
|
|
25806
|
+
return Object.keys(this.knownValues);
|
|
25807
|
+
}
|
|
25808
|
+
imply(component, value) {
|
|
25809
|
+
if (component in this.knownValues) return this;
|
|
25810
|
+
this.impliedValues[component] = value;
|
|
25811
|
+
return this;
|
|
25812
|
+
}
|
|
25813
|
+
assign(component, value) {
|
|
25814
|
+
this.knownValues[component] = value;
|
|
25815
|
+
delete this.impliedValues[component];
|
|
25816
|
+
return this;
|
|
25817
|
+
}
|
|
25818
|
+
addDurationAsImplied(duration) {
|
|
25819
|
+
const date = addDuration(this.dateWithoutTimezoneAdjustment(), duration);
|
|
25820
|
+
if ("day" in duration || "week" in duration || "month" in duration || "year" in duration) {
|
|
25821
|
+
this.delete([
|
|
25822
|
+
"day",
|
|
25823
|
+
"weekday",
|
|
25824
|
+
"month",
|
|
25825
|
+
"year"
|
|
25826
|
+
]);
|
|
25827
|
+
this.imply("day", date.getDate());
|
|
25828
|
+
this.imply("weekday", date.getDay());
|
|
25829
|
+
this.imply("month", date.getMonth() + 1);
|
|
25830
|
+
this.imply("year", date.getFullYear());
|
|
25831
|
+
}
|
|
25832
|
+
if ("second" in duration || "minute" in duration || "hour" in duration) {
|
|
25833
|
+
this.delete([
|
|
25834
|
+
"second",
|
|
25835
|
+
"minute",
|
|
25836
|
+
"hour"
|
|
25837
|
+
]);
|
|
25838
|
+
this.imply("second", date.getSeconds());
|
|
25839
|
+
this.imply("minute", date.getMinutes());
|
|
25840
|
+
this.imply("hour", date.getHours());
|
|
25841
|
+
}
|
|
25842
|
+
return this;
|
|
25843
|
+
}
|
|
25844
|
+
delete(components) {
|
|
25845
|
+
if (typeof components === "string") components = [components];
|
|
25846
|
+
for (const component of components) {
|
|
25847
|
+
delete this.knownValues[component];
|
|
25848
|
+
delete this.impliedValues[component];
|
|
25849
|
+
}
|
|
25850
|
+
}
|
|
25851
|
+
clone() {
|
|
25852
|
+
const component = new ParsingComponents(this.reference);
|
|
25853
|
+
component.knownValues = {};
|
|
25854
|
+
component.impliedValues = {};
|
|
25855
|
+
for (const key in this.knownValues) component.knownValues[key] = this.knownValues[key];
|
|
25856
|
+
for (const key in this.impliedValues) component.impliedValues[key] = this.impliedValues[key];
|
|
25857
|
+
return component;
|
|
25858
|
+
}
|
|
25859
|
+
isOnlyDate() {
|
|
25860
|
+
return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
|
|
25861
|
+
}
|
|
25862
|
+
isOnlyTime() {
|
|
25863
|
+
return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month") && !this.isCertain("year");
|
|
25864
|
+
}
|
|
25865
|
+
isOnlyWeekdayComponent() {
|
|
25866
|
+
return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
|
25867
|
+
}
|
|
25868
|
+
isDateWithUnknownYear() {
|
|
25869
|
+
return this.isCertain("month") && !this.isCertain("year");
|
|
25870
|
+
}
|
|
25871
|
+
isValidDate() {
|
|
25872
|
+
const date = this.dateWithoutTimezoneAdjustment();
|
|
25873
|
+
if (date.getFullYear() !== this.get("year")) return false;
|
|
25874
|
+
if (date.getMonth() !== this.get("month") - 1) return false;
|
|
25875
|
+
if (date.getDate() !== this.get("day")) return false;
|
|
25876
|
+
if (this.get("hour") != null && date.getHours() != this.get("hour")) return false;
|
|
25877
|
+
if (this.get("minute") != null && date.getMinutes() != this.get("minute")) return false;
|
|
25878
|
+
return true;
|
|
25879
|
+
}
|
|
25880
|
+
toString() {
|
|
25881
|
+
return `[ParsingComponents {
|
|
25882
|
+
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
|
25883
|
+
knownValues: ${JSON.stringify(this.knownValues)},
|
|
25884
|
+
impliedValues: ${JSON.stringify(this.impliedValues)}},
|
|
25885
|
+
reference: ${JSON.stringify(this.reference)}]`;
|
|
25886
|
+
}
|
|
25887
|
+
date() {
|
|
25888
|
+
const date = this.dateWithoutTimezoneAdjustment();
|
|
25889
|
+
const timezoneAdjustment = this.reference.getSystemTimezoneAdjustmentMinute(date, this.get("timezoneOffset"));
|
|
25890
|
+
return new Date(date.getTime() + timezoneAdjustment * 6e4);
|
|
25891
|
+
}
|
|
25892
|
+
addTag(tag) {
|
|
25893
|
+
this._tags.add(tag);
|
|
25894
|
+
return this;
|
|
25895
|
+
}
|
|
25896
|
+
addTags(tags) {
|
|
25897
|
+
for (const tag of tags) this._tags.add(tag);
|
|
25898
|
+
return this;
|
|
25899
|
+
}
|
|
25900
|
+
tags() {
|
|
25901
|
+
return new Set(this._tags);
|
|
25902
|
+
}
|
|
25903
|
+
dateWithoutTimezoneAdjustment() {
|
|
25904
|
+
const date = new Date(this.get("year"), this.get("month") - 1, this.get("day"), this.get("hour"), this.get("minute"), this.get("second"), this.get("millisecond"));
|
|
25905
|
+
date.setFullYear(this.get("year"));
|
|
25906
|
+
return date;
|
|
25907
|
+
}
|
|
25908
|
+
};
|
|
25909
|
+
var ParsingResult = class ParsingResult {
|
|
25910
|
+
refDate;
|
|
25911
|
+
index;
|
|
25912
|
+
text;
|
|
25913
|
+
reference;
|
|
25914
|
+
start;
|
|
25915
|
+
end;
|
|
25916
|
+
constructor(reference, index, text, start, end) {
|
|
25917
|
+
this.reference = reference;
|
|
25918
|
+
this.refDate = reference.instant;
|
|
25919
|
+
this.index = index;
|
|
25920
|
+
this.text = text;
|
|
25921
|
+
this.start = start || new ParsingComponents(reference);
|
|
25922
|
+
this.end = end;
|
|
25923
|
+
}
|
|
25924
|
+
clone() {
|
|
25925
|
+
const result = new ParsingResult(this.reference, this.index, this.text);
|
|
25926
|
+
result.start = this.start ? this.start.clone() : null;
|
|
25927
|
+
result.end = this.end ? this.end.clone() : null;
|
|
25928
|
+
return result;
|
|
25929
|
+
}
|
|
25930
|
+
date() {
|
|
25931
|
+
return this.start.date();
|
|
25932
|
+
}
|
|
25933
|
+
addTag(tag) {
|
|
25934
|
+
this.start.addTag(tag);
|
|
25935
|
+
if (this.end) this.end.addTag(tag);
|
|
25936
|
+
return this;
|
|
25937
|
+
}
|
|
25938
|
+
addTags(tags) {
|
|
25939
|
+
this.start.addTags(tags);
|
|
25940
|
+
if (this.end) this.end.addTags(tags);
|
|
25941
|
+
return this;
|
|
25942
|
+
}
|
|
25943
|
+
tags() {
|
|
25944
|
+
const combinedTags = new Set(this.start.tags());
|
|
25945
|
+
if (this.end) for (const tag of this.end.tags()) combinedTags.add(tag);
|
|
25946
|
+
return combinedTags;
|
|
25947
|
+
}
|
|
25948
|
+
toString() {
|
|
25949
|
+
const tags = Array.from(this.tags()).sort();
|
|
25950
|
+
return `[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(tags)} ...}]`;
|
|
25951
|
+
}
|
|
25952
|
+
};
|
|
25953
|
+
|
|
25954
|
+
//#endregion
|
|
25955
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/utils/pattern.js
|
|
25956
|
+
function repeatedTimeunitPattern(prefix, singleTimeunitPattern, connectorPattern = "\\s{0,5},?\\s{0,5}") {
|
|
25957
|
+
const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:");
|
|
25958
|
+
return `${prefix}${singleTimeunitPatternNoCapture}(?:${connectorPattern}${singleTimeunitPatternNoCapture}){0,10}`;
|
|
25959
|
+
}
|
|
25960
|
+
function extractTerms(dictionary) {
|
|
25961
|
+
let keys;
|
|
25962
|
+
if (dictionary instanceof Array) keys = [...dictionary];
|
|
25963
|
+
else if (dictionary instanceof Map) keys = Array.from(dictionary.keys());
|
|
25964
|
+
else keys = Object.keys(dictionary);
|
|
25965
|
+
return keys;
|
|
25966
|
+
}
|
|
25967
|
+
function matchAnyPattern(dictionary) {
|
|
25968
|
+
return `(?:${extractTerms(dictionary).sort((a, b) => b.length - a.length).join("|").replace(/\./g, "\\.")})`;
|
|
25969
|
+
}
|
|
25970
|
+
|
|
25971
|
+
//#endregion
|
|
25972
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/calculation/years.js
|
|
25973
|
+
function findMostLikelyADYear(yearNumber) {
|
|
25974
|
+
if (yearNumber < 100) if (yearNumber > 50) yearNumber = yearNumber + 1900;
|
|
25975
|
+
else yearNumber = yearNumber + 2e3;
|
|
25976
|
+
return yearNumber;
|
|
25977
|
+
}
|
|
25978
|
+
function findYearClosestToRef(refDate, day, month) {
|
|
25979
|
+
let date = new Date(refDate);
|
|
25980
|
+
date.setMonth(month - 1);
|
|
25981
|
+
date.setDate(day);
|
|
25982
|
+
const nextYear = addDuration(date, { "year": 1 });
|
|
25983
|
+
const lastYear = addDuration(date, { "year": -1 });
|
|
25984
|
+
if (Math.abs(nextYear.getTime() - refDate.getTime()) < Math.abs(date.getTime() - refDate.getTime())) date = nextYear;
|
|
25985
|
+
else if (Math.abs(lastYear.getTime() - refDate.getTime()) < Math.abs(date.getTime() - refDate.getTime())) date = lastYear;
|
|
25986
|
+
return date.getFullYear();
|
|
25987
|
+
}
|
|
25988
|
+
|
|
25989
|
+
//#endregion
|
|
25990
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/constants.js
|
|
25991
|
+
const WEEKDAY_DICTIONARY = {
|
|
25992
|
+
sunday: 0,
|
|
25993
|
+
sun: 0,
|
|
25994
|
+
"sun.": 0,
|
|
25995
|
+
monday: 1,
|
|
25996
|
+
mon: 1,
|
|
25997
|
+
"mon.": 1,
|
|
25998
|
+
tuesday: 2,
|
|
25999
|
+
tue: 2,
|
|
26000
|
+
"tue.": 2,
|
|
26001
|
+
wednesday: 3,
|
|
26002
|
+
wed: 3,
|
|
26003
|
+
"wed.": 3,
|
|
26004
|
+
thursday: 4,
|
|
26005
|
+
thurs: 4,
|
|
26006
|
+
"thurs.": 4,
|
|
26007
|
+
thur: 4,
|
|
26008
|
+
"thur.": 4,
|
|
26009
|
+
thu: 4,
|
|
26010
|
+
"thu.": 4,
|
|
26011
|
+
friday: 5,
|
|
26012
|
+
fri: 5,
|
|
26013
|
+
"fri.": 5,
|
|
26014
|
+
saturday: 6,
|
|
26015
|
+
sat: 6,
|
|
26016
|
+
"sat.": 6
|
|
26017
|
+
};
|
|
26018
|
+
const FULL_MONTH_NAME_DICTIONARY = {
|
|
26019
|
+
january: 1,
|
|
26020
|
+
february: 2,
|
|
26021
|
+
march: 3,
|
|
26022
|
+
april: 4,
|
|
26023
|
+
may: 5,
|
|
26024
|
+
june: 6,
|
|
26025
|
+
july: 7,
|
|
26026
|
+
august: 8,
|
|
26027
|
+
september: 9,
|
|
26028
|
+
october: 10,
|
|
26029
|
+
november: 11,
|
|
26030
|
+
december: 12
|
|
26031
|
+
};
|
|
26032
|
+
const MONTH_DICTIONARY = {
|
|
26033
|
+
...FULL_MONTH_NAME_DICTIONARY,
|
|
26034
|
+
jan: 1,
|
|
26035
|
+
"jan.": 1,
|
|
26036
|
+
feb: 2,
|
|
26037
|
+
"feb.": 2,
|
|
26038
|
+
mar: 3,
|
|
26039
|
+
"mar.": 3,
|
|
26040
|
+
apr: 4,
|
|
26041
|
+
"apr.": 4,
|
|
26042
|
+
jun: 6,
|
|
26043
|
+
"jun.": 6,
|
|
26044
|
+
jul: 7,
|
|
26045
|
+
"jul.": 7,
|
|
26046
|
+
aug: 8,
|
|
26047
|
+
"aug.": 8,
|
|
26048
|
+
sep: 9,
|
|
26049
|
+
"sep.": 9,
|
|
26050
|
+
sept: 9,
|
|
26051
|
+
"sept.": 9,
|
|
26052
|
+
oct: 10,
|
|
26053
|
+
"oct.": 10,
|
|
26054
|
+
nov: 11,
|
|
26055
|
+
"nov.": 11,
|
|
26056
|
+
dec: 12,
|
|
26057
|
+
"dec.": 12
|
|
26058
|
+
};
|
|
26059
|
+
const INTEGER_WORD_DICTIONARY = {
|
|
26060
|
+
one: 1,
|
|
26061
|
+
two: 2,
|
|
26062
|
+
three: 3,
|
|
26063
|
+
four: 4,
|
|
26064
|
+
five: 5,
|
|
26065
|
+
six: 6,
|
|
26066
|
+
seven: 7,
|
|
26067
|
+
eight: 8,
|
|
26068
|
+
nine: 9,
|
|
26069
|
+
ten: 10,
|
|
26070
|
+
eleven: 11,
|
|
26071
|
+
twelve: 12
|
|
26072
|
+
};
|
|
26073
|
+
const ORDINAL_WORD_DICTIONARY = {
|
|
26074
|
+
first: 1,
|
|
26075
|
+
second: 2,
|
|
26076
|
+
third: 3,
|
|
26077
|
+
fourth: 4,
|
|
26078
|
+
fifth: 5,
|
|
26079
|
+
sixth: 6,
|
|
26080
|
+
seventh: 7,
|
|
26081
|
+
eighth: 8,
|
|
26082
|
+
ninth: 9,
|
|
26083
|
+
tenth: 10,
|
|
26084
|
+
eleventh: 11,
|
|
26085
|
+
twelfth: 12,
|
|
26086
|
+
thirteenth: 13,
|
|
26087
|
+
fourteenth: 14,
|
|
26088
|
+
fifteenth: 15,
|
|
26089
|
+
sixteenth: 16,
|
|
26090
|
+
seventeenth: 17,
|
|
26091
|
+
eighteenth: 18,
|
|
26092
|
+
nineteenth: 19,
|
|
26093
|
+
twentieth: 20,
|
|
26094
|
+
"twenty first": 21,
|
|
26095
|
+
"twenty-first": 21,
|
|
26096
|
+
"twenty second": 22,
|
|
26097
|
+
"twenty-second": 22,
|
|
26098
|
+
"twenty third": 23,
|
|
26099
|
+
"twenty-third": 23,
|
|
26100
|
+
"twenty fourth": 24,
|
|
26101
|
+
"twenty-fourth": 24,
|
|
26102
|
+
"twenty fifth": 25,
|
|
26103
|
+
"twenty-fifth": 25,
|
|
26104
|
+
"twenty sixth": 26,
|
|
26105
|
+
"twenty-sixth": 26,
|
|
26106
|
+
"twenty seventh": 27,
|
|
26107
|
+
"twenty-seventh": 27,
|
|
26108
|
+
"twenty eighth": 28,
|
|
26109
|
+
"twenty-eighth": 28,
|
|
26110
|
+
"twenty ninth": 29,
|
|
26111
|
+
"twenty-ninth": 29,
|
|
26112
|
+
"thirtieth": 30,
|
|
26113
|
+
"thirty first": 31,
|
|
26114
|
+
"thirty-first": 31
|
|
26115
|
+
};
|
|
26116
|
+
const TIME_UNIT_DICTIONARY_NO_ABBR = {
|
|
26117
|
+
second: "second",
|
|
26118
|
+
seconds: "second",
|
|
26119
|
+
minute: "minute",
|
|
26120
|
+
minutes: "minute",
|
|
26121
|
+
hour: "hour",
|
|
26122
|
+
hours: "hour",
|
|
26123
|
+
day: "day",
|
|
26124
|
+
days: "day",
|
|
26125
|
+
week: "week",
|
|
26126
|
+
weeks: "week",
|
|
26127
|
+
month: "month",
|
|
26128
|
+
months: "month",
|
|
26129
|
+
quarter: "quarter",
|
|
26130
|
+
quarters: "quarter",
|
|
26131
|
+
year: "year",
|
|
26132
|
+
years: "year"
|
|
26133
|
+
};
|
|
26134
|
+
const TIME_UNIT_DICTIONARY = {
|
|
26135
|
+
s: "second",
|
|
26136
|
+
sec: "second",
|
|
26137
|
+
second: "second",
|
|
26138
|
+
seconds: "second",
|
|
26139
|
+
m: "minute",
|
|
26140
|
+
min: "minute",
|
|
26141
|
+
mins: "minute",
|
|
26142
|
+
minute: "minute",
|
|
26143
|
+
minutes: "minute",
|
|
26144
|
+
h: "hour",
|
|
26145
|
+
hr: "hour",
|
|
26146
|
+
hrs: "hour",
|
|
26147
|
+
hour: "hour",
|
|
26148
|
+
hours: "hour",
|
|
26149
|
+
d: "day",
|
|
26150
|
+
day: "day",
|
|
26151
|
+
days: "day",
|
|
26152
|
+
w: "week",
|
|
26153
|
+
week: "week",
|
|
26154
|
+
weeks: "week",
|
|
26155
|
+
mo: "month",
|
|
26156
|
+
mon: "month",
|
|
26157
|
+
mos: "month",
|
|
26158
|
+
month: "month",
|
|
26159
|
+
months: "month",
|
|
26160
|
+
qtr: "quarter",
|
|
26161
|
+
quarter: "quarter",
|
|
26162
|
+
quarters: "quarter",
|
|
26163
|
+
y: "year",
|
|
26164
|
+
yr: "year",
|
|
26165
|
+
year: "year",
|
|
26166
|
+
years: "year",
|
|
26167
|
+
...TIME_UNIT_DICTIONARY_NO_ABBR
|
|
26168
|
+
};
|
|
26169
|
+
const NUMBER_PATTERN = `(?:${matchAnyPattern(INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;
|
|
26170
|
+
function parseNumberPattern(match) {
|
|
26171
|
+
const num = match.toLowerCase();
|
|
26172
|
+
if (INTEGER_WORD_DICTIONARY[num] !== void 0) return INTEGER_WORD_DICTIONARY[num];
|
|
26173
|
+
else if (num === "a" || num === "an" || num == "the") return 1;
|
|
26174
|
+
else if (num.match(/few/)) return 3;
|
|
26175
|
+
else if (num.match(/half/)) return .5;
|
|
26176
|
+
else if (num.match(/couple/)) return 2;
|
|
26177
|
+
else if (num.match(/several/)) return 7;
|
|
26178
|
+
return parseFloat(num);
|
|
26179
|
+
}
|
|
26180
|
+
const ORDINAL_NUMBER_PATTERN = `(?:${matchAnyPattern(ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
|
|
26181
|
+
function parseOrdinalNumberPattern(match) {
|
|
26182
|
+
let num = match.toLowerCase();
|
|
26183
|
+
if (ORDINAL_WORD_DICTIONARY[num] !== void 0) return ORDINAL_WORD_DICTIONARY[num];
|
|
26184
|
+
num = num.replace(/(?:st|nd|rd|th)$/i, "");
|
|
26185
|
+
return parseInt(num);
|
|
26186
|
+
}
|
|
26187
|
+
const YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])`;
|
|
26188
|
+
function parseYear(match) {
|
|
26189
|
+
if (/BE/i.test(match)) {
|
|
26190
|
+
match = match.replace(/BE/i, "");
|
|
26191
|
+
return parseInt(match) - 543;
|
|
26192
|
+
}
|
|
26193
|
+
if (/BCE?/i.test(match)) {
|
|
26194
|
+
match = match.replace(/BCE?/i, "");
|
|
26195
|
+
return -parseInt(match);
|
|
26196
|
+
}
|
|
26197
|
+
if (/(AD|CE)/i.test(match)) {
|
|
26198
|
+
match = match.replace(/(AD|CE)/i, "");
|
|
26199
|
+
return parseInt(match);
|
|
26200
|
+
}
|
|
26201
|
+
return findMostLikelyADYear(parseInt(match));
|
|
26202
|
+
}
|
|
26203
|
+
const SINGLE_TIME_UNIT_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(TIME_UNIT_DICTIONARY)})`;
|
|
26204
|
+
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
|
26205
|
+
const SINGLE_TIME_UNIT_NO_ABBR_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(TIME_UNIT_DICTIONARY_NO_ABBR)})`;
|
|
26206
|
+
const TIME_UNIT_CONNECTOR_PATTERN = `\\s{0,5},?(?:\\s*and)?\\s{0,5}`;
|
|
26207
|
+
const TIME_UNITS_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN, TIME_UNIT_CONNECTOR_PATTERN);
|
|
26208
|
+
const TIME_UNITS_NO_ABBR_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_NO_ABBR_PATTERN, TIME_UNIT_CONNECTOR_PATTERN);
|
|
26209
|
+
function parseDuration(timeunitText) {
|
|
26210
|
+
const fragments = {};
|
|
26211
|
+
let remainingText = timeunitText;
|
|
26212
|
+
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
|
26213
|
+
while (match) {
|
|
26214
|
+
collectDateTimeFragment(fragments, match);
|
|
26215
|
+
remainingText = remainingText.substring(match[0].length).trim();
|
|
26216
|
+
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
|
26217
|
+
}
|
|
26218
|
+
if (Object.keys(fragments).length == 0) return null;
|
|
26219
|
+
return fragments;
|
|
26220
|
+
}
|
|
26221
|
+
function collectDateTimeFragment(fragments, match) {
|
|
26222
|
+
if (match[0].match(/^[a-zA-Z]+$/)) return;
|
|
26223
|
+
const num = parseNumberPattern(match[1]);
|
|
26224
|
+
const unit = TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
|
26225
|
+
fragments[unit] = num;
|
|
26226
|
+
}
|
|
26227
|
+
|
|
26228
|
+
//#endregion
|
|
26229
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/parsers/AbstractParserWithWordBoundary.js
|
|
26230
|
+
var AbstractParserWithWordBoundaryChecking = class {
|
|
26231
|
+
innerPatternHasChange(context, currentInnerPattern) {
|
|
26232
|
+
return this.innerPattern(context) !== currentInnerPattern;
|
|
26233
|
+
}
|
|
26234
|
+
patternLeftBoundary() {
|
|
26235
|
+
return `(\\W|^)`;
|
|
26236
|
+
}
|
|
26237
|
+
cachedInnerPattern = null;
|
|
26238
|
+
cachedPattern = null;
|
|
26239
|
+
pattern(context) {
|
|
26240
|
+
if (this.cachedInnerPattern) {
|
|
26241
|
+
if (!this.innerPatternHasChange(context, this.cachedInnerPattern)) return this.cachedPattern;
|
|
26242
|
+
}
|
|
26243
|
+
this.cachedInnerPattern = this.innerPattern(context);
|
|
26244
|
+
this.cachedPattern = new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`, this.cachedInnerPattern.flags);
|
|
26245
|
+
return this.cachedPattern;
|
|
26246
|
+
}
|
|
26247
|
+
extract(context, match) {
|
|
26248
|
+
const header = match[1] ?? "";
|
|
26249
|
+
match.index = match.index + header.length;
|
|
26250
|
+
match[0] = match[0].substring(header.length);
|
|
26251
|
+
for (let i = 2; i < match.length; i++) match[i - 1] = match[i];
|
|
26252
|
+
return this.innerExtract(context, match);
|
|
26253
|
+
}
|
|
26254
|
+
};
|
|
26255
|
+
|
|
26256
|
+
//#endregion
|
|
26257
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitWithinFormatParser.js
|
|
26258
|
+
const PATTERN_WITH_OPTIONAL_PREFIX = new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
|
26259
|
+
const PATTERN_WITH_PREFIX = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
|
26260
|
+
const PATTERN_WITH_PREFIX_STRICT = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_NO_ABBR_PATTERN})(?=\\W|$)`, "i");
|
|
26261
|
+
var ENTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26262
|
+
strictMode;
|
|
26263
|
+
constructor(strictMode) {
|
|
26264
|
+
super();
|
|
26265
|
+
this.strictMode = strictMode;
|
|
26266
|
+
}
|
|
26267
|
+
innerPattern(context) {
|
|
26268
|
+
if (this.strictMode) return PATTERN_WITH_PREFIX_STRICT;
|
|
26269
|
+
return context.option.forwardDate ? PATTERN_WITH_OPTIONAL_PREFIX : PATTERN_WITH_PREFIX;
|
|
26270
|
+
}
|
|
26271
|
+
innerExtract(context, match) {
|
|
26272
|
+
if (match[0].match(/^for\s*the\s*\w+/)) return null;
|
|
26273
|
+
const timeUnits = parseDuration(match[1]);
|
|
26274
|
+
if (!timeUnits) return null;
|
|
26275
|
+
return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
26276
|
+
}
|
|
26277
|
+
};
|
|
26278
|
+
|
|
26279
|
+
//#endregion
|
|
26280
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameLittleEndianParser.js
|
|
26281
|
+
const PATTERN$13 = new RegExp(`(?:on\\s{0,3})?(${ORDINAL_NUMBER_PATTERN})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${matchAnyPattern(MONTH_DICTIONARY)})(?:(?:-|/|,?\\s{0,3})(${YEAR_PATTERN}(?!\\w)))?(?=\\W|\$)`, "i");
|
|
26282
|
+
const DATE_GROUP$1 = 1;
|
|
26283
|
+
const DATE_TO_GROUP$1 = 2;
|
|
26284
|
+
const MONTH_NAME_GROUP$3 = 3;
|
|
26285
|
+
const YEAR_GROUP$5 = 4;
|
|
26286
|
+
var ENMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26287
|
+
innerPattern() {
|
|
26288
|
+
return PATTERN$13;
|
|
26289
|
+
}
|
|
26290
|
+
innerExtract(context, match) {
|
|
26291
|
+
const result = context.createParsingResult(match.index, match[0]);
|
|
26292
|
+
const month = MONTH_DICTIONARY[match[MONTH_NAME_GROUP$3].toLowerCase()];
|
|
26293
|
+
const day = parseOrdinalNumberPattern(match[DATE_GROUP$1]);
|
|
26294
|
+
if (day > 31) {
|
|
26295
|
+
match.index = match.index + match[DATE_GROUP$1].length;
|
|
26296
|
+
return null;
|
|
26297
|
+
}
|
|
26298
|
+
result.start.assign("month", month);
|
|
26299
|
+
result.start.assign("day", day);
|
|
26300
|
+
if (match[YEAR_GROUP$5]) {
|
|
26301
|
+
const yearNumber = parseYear(match[YEAR_GROUP$5]);
|
|
26302
|
+
result.start.assign("year", yearNumber);
|
|
26303
|
+
} else {
|
|
26304
|
+
const year = findYearClosestToRef(context.refDate, day, month);
|
|
26305
|
+
result.start.imply("year", year);
|
|
26306
|
+
}
|
|
26307
|
+
if (match[DATE_TO_GROUP$1]) {
|
|
26308
|
+
const endDate = parseOrdinalNumberPattern(match[DATE_TO_GROUP$1]);
|
|
26309
|
+
result.end = result.start.clone();
|
|
26310
|
+
result.end.assign("day", endDate);
|
|
26311
|
+
}
|
|
26312
|
+
return result;
|
|
26313
|
+
}
|
|
26314
|
+
};
|
|
26315
|
+
|
|
26316
|
+
//#endregion
|
|
26317
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js
|
|
26318
|
+
const PATTERN$12 = new RegExp(`(${matchAnyPattern(MONTH_DICTIONARY)})(?:-|/|\\s*,?\\s*)(${ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${ORDINAL_NUMBER_PATTERN})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${YEAR_PATTERN}))?(?=\\W|\$)(?!\\:\\d)`, "i");
|
|
26319
|
+
const MONTH_NAME_GROUP$2 = 1;
|
|
26320
|
+
const DATE_GROUP = 2;
|
|
26321
|
+
const DATE_TO_GROUP = 3;
|
|
26322
|
+
const YEAR_GROUP$4 = 4;
|
|
26323
|
+
var ENMonthNameMiddleEndianParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26324
|
+
shouldSkipYearLikeDate;
|
|
26325
|
+
constructor(shouldSkipYearLikeDate) {
|
|
26326
|
+
super();
|
|
26327
|
+
this.shouldSkipYearLikeDate = shouldSkipYearLikeDate;
|
|
26328
|
+
}
|
|
26329
|
+
innerPattern() {
|
|
26330
|
+
return PATTERN$12;
|
|
26331
|
+
}
|
|
26332
|
+
innerExtract(context, match) {
|
|
26333
|
+
const month = MONTH_DICTIONARY[match[MONTH_NAME_GROUP$2].toLowerCase()];
|
|
26334
|
+
const day = parseOrdinalNumberPattern(match[DATE_GROUP]);
|
|
26335
|
+
if (day > 31) return null;
|
|
26336
|
+
if (this.shouldSkipYearLikeDate) {
|
|
26337
|
+
if (!match[DATE_TO_GROUP] && !match[YEAR_GROUP$4] && match[DATE_GROUP].match(/^2[0-5]$/)) return null;
|
|
26338
|
+
}
|
|
26339
|
+
const components = context.createParsingComponents({
|
|
26340
|
+
day,
|
|
26341
|
+
month
|
|
26342
|
+
}).addTag("parser/ENMonthNameMiddleEndianParser");
|
|
26343
|
+
if (match[YEAR_GROUP$4]) {
|
|
26344
|
+
const year = parseYear(match[YEAR_GROUP$4]);
|
|
26345
|
+
components.assign("year", year);
|
|
26346
|
+
} else {
|
|
26347
|
+
const year = findYearClosestToRef(context.refDate, day, month);
|
|
26348
|
+
components.imply("year", year);
|
|
26349
|
+
}
|
|
26350
|
+
if (!match[DATE_TO_GROUP]) return components;
|
|
26351
|
+
const endDate = parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
|
26352
|
+
const result = context.createParsingResult(match.index, match[0]);
|
|
26353
|
+
result.start = components;
|
|
26354
|
+
result.end = components.clone();
|
|
26355
|
+
result.end.assign("day", endDate);
|
|
26356
|
+
return result;
|
|
26357
|
+
}
|
|
26358
|
+
};
|
|
26359
|
+
|
|
26360
|
+
//#endregion
|
|
26361
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameParser.js
|
|
26362
|
+
const PATTERN$11 = new RegExp(`((?:in)\\s*)?(${matchAnyPattern(MONTH_DICTIONARY)})\\s*(?:(?:,|-|of)?\\s*(${YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+\$|\$)`, "i");
|
|
26363
|
+
const PREFIX_GROUP$1 = 1;
|
|
26364
|
+
const MONTH_NAME_GROUP$1 = 2;
|
|
26365
|
+
const YEAR_GROUP$3 = 3;
|
|
26366
|
+
var ENMonthNameParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26367
|
+
innerPattern() {
|
|
26368
|
+
return PATTERN$11;
|
|
26369
|
+
}
|
|
26370
|
+
innerExtract(context, match) {
|
|
26371
|
+
const monthName = match[MONTH_NAME_GROUP$1].toLowerCase();
|
|
26372
|
+
if (match[0].length <= 3 && !FULL_MONTH_NAME_DICTIONARY[monthName]) return null;
|
|
26373
|
+
const result = context.createParsingResult(match.index + (match[PREFIX_GROUP$1] || "").length, match.index + match[0].length);
|
|
26374
|
+
result.start.imply("day", 1);
|
|
26375
|
+
result.start.addTag("parser/ENMonthNameParser");
|
|
26376
|
+
const month = MONTH_DICTIONARY[monthName];
|
|
26377
|
+
result.start.assign("month", month);
|
|
26378
|
+
if (match[YEAR_GROUP$3]) {
|
|
26379
|
+
const year = parseYear(match[YEAR_GROUP$3]);
|
|
26380
|
+
result.start.assign("year", year);
|
|
26381
|
+
} else {
|
|
26382
|
+
const year = findYearClosestToRef(context.refDate, 1, month);
|
|
26383
|
+
result.start.imply("year", year);
|
|
26384
|
+
}
|
|
26385
|
+
return result;
|
|
26386
|
+
}
|
|
26387
|
+
};
|
|
26388
|
+
|
|
26389
|
+
//#endregion
|
|
26390
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENYearMonthDayParser.js
|
|
26391
|
+
const PATTERN$10 = new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${matchAnyPattern(MONTH_DICTIONARY)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|\$)`, "i");
|
|
26392
|
+
const YEAR_NUMBER_GROUP$1 = 1;
|
|
26393
|
+
const MONTH_NAME_GROUP = 2;
|
|
26394
|
+
const MONTH_NUMBER_GROUP$1 = 3;
|
|
26395
|
+
const DATE_NUMBER_GROUP$1 = 4;
|
|
26396
|
+
var ENYearMonthDayParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26397
|
+
strictMonthDateOrder;
|
|
26398
|
+
constructor(strictMonthDateOrder) {
|
|
26399
|
+
super();
|
|
26400
|
+
this.strictMonthDateOrder = strictMonthDateOrder;
|
|
26401
|
+
}
|
|
26402
|
+
innerPattern() {
|
|
26403
|
+
return PATTERN$10;
|
|
26404
|
+
}
|
|
26405
|
+
innerExtract(context, match) {
|
|
26406
|
+
const year = parseInt(match[YEAR_NUMBER_GROUP$1]);
|
|
26407
|
+
let day = parseInt(match[DATE_NUMBER_GROUP$1]);
|
|
26408
|
+
let month = match[MONTH_NUMBER_GROUP$1] ? parseInt(match[MONTH_NUMBER_GROUP$1]) : MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
|
26409
|
+
if (month < 1 || month > 12) {
|
|
26410
|
+
if (this.strictMonthDateOrder) return null;
|
|
26411
|
+
if (day >= 1 && day <= 12) [month, day] = [day, month];
|
|
26412
|
+
}
|
|
26413
|
+
if (day < 1 || day > 31) return null;
|
|
26414
|
+
return {
|
|
26415
|
+
day,
|
|
26416
|
+
month,
|
|
26417
|
+
year
|
|
26418
|
+
};
|
|
26419
|
+
}
|
|
26420
|
+
};
|
|
26421
|
+
|
|
26422
|
+
//#endregion
|
|
26423
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENSlashMonthFormatParser.js
|
|
26424
|
+
const PATTERN$9 = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i");
|
|
26425
|
+
const MONTH_GROUP = 1;
|
|
26426
|
+
const YEAR_GROUP$2 = 2;
|
|
26427
|
+
var ENSlashMonthFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26428
|
+
innerPattern() {
|
|
26429
|
+
return PATTERN$9;
|
|
26430
|
+
}
|
|
26431
|
+
innerExtract(context, match) {
|
|
26432
|
+
const year = parseInt(match[YEAR_GROUP$2]);
|
|
26433
|
+
const month = parseInt(match[MONTH_GROUP]);
|
|
26434
|
+
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
|
|
26435
|
+
}
|
|
26436
|
+
};
|
|
26437
|
+
|
|
26438
|
+
//#endregion
|
|
26439
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/parsers/AbstractTimeExpressionParser.js
|
|
26440
|
+
function primaryTimePattern(leftBoundary, primaryPrefix, primarySuffix, flags) {
|
|
26441
|
+
return new RegExp(`${leftBoundary}${primaryPrefix}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${primarySuffix}`, flags);
|
|
26442
|
+
}
|
|
26443
|
+
function followingTimePatten(followingPhase, followingSuffix) {
|
|
26444
|
+
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");
|
|
26445
|
+
}
|
|
26446
|
+
const HOUR_GROUP = 2;
|
|
26447
|
+
const MINUTE_GROUP = 3;
|
|
26448
|
+
const SECOND_GROUP = 4;
|
|
26449
|
+
const MILLI_SECOND_GROUP = 5;
|
|
26450
|
+
const AM_PM_HOUR_GROUP = 6;
|
|
26451
|
+
var AbstractTimeExpressionParser = class {
|
|
26452
|
+
strictMode;
|
|
26453
|
+
constructor(strictMode = false) {
|
|
26454
|
+
this.strictMode = strictMode;
|
|
26455
|
+
}
|
|
26456
|
+
patternFlags() {
|
|
26457
|
+
return "i";
|
|
26458
|
+
}
|
|
26459
|
+
primaryPatternLeftBoundary() {
|
|
26460
|
+
return `(^|\\s|T|\\b)`;
|
|
26461
|
+
}
|
|
26462
|
+
primarySuffix() {
|
|
26463
|
+
return `(?!/)(?=\\W|$)`;
|
|
26464
|
+
}
|
|
26465
|
+
followingSuffix() {
|
|
26466
|
+
return `(?!/)(?=\\W|$)`;
|
|
26467
|
+
}
|
|
26468
|
+
pattern(context) {
|
|
26469
|
+
return this.getPrimaryTimePatternThroughCache();
|
|
26470
|
+
}
|
|
26471
|
+
extract(context, match) {
|
|
26472
|
+
const startComponents = this.extractPrimaryTimeComponents(context, match);
|
|
26473
|
+
if (!startComponents) {
|
|
26474
|
+
if (match[0].match(/^\d{4}/)) {
|
|
26475
|
+
match.index += 4;
|
|
26476
|
+
return null;
|
|
26477
|
+
}
|
|
26478
|
+
match.index += match[0].length;
|
|
26479
|
+
return null;
|
|
26480
|
+
}
|
|
26481
|
+
const index = match.index + match[1].length;
|
|
26482
|
+
const text = match[0].substring(match[1].length);
|
|
26483
|
+
const result = context.createParsingResult(index, text, startComponents);
|
|
26484
|
+
match.index += match[0].length;
|
|
26485
|
+
const remainingText = context.text.substring(match.index);
|
|
26486
|
+
const followingMatch = this.getFollowingTimePatternThroughCache().exec(remainingText);
|
|
26487
|
+
if (text.match(/^\d{3,4}/) && followingMatch) {
|
|
26488
|
+
if (followingMatch[0].match(/^\s*([+-])\s*\d{2,4}$/)) return null;
|
|
26489
|
+
if (followingMatch[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/)) return null;
|
|
26490
|
+
}
|
|
26491
|
+
if (!followingMatch || followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) return this.checkAndReturnWithoutFollowingPattern(result);
|
|
26492
|
+
result.end = this.extractFollowingTimeComponents(context, followingMatch, result);
|
|
26493
|
+
if (result.end) result.text += followingMatch[0];
|
|
26494
|
+
return this.checkAndReturnWithFollowingPattern(result);
|
|
26495
|
+
}
|
|
26496
|
+
extractPrimaryTimeComponents(context, match, strict = false) {
|
|
26497
|
+
const components = context.createParsingComponents();
|
|
26498
|
+
let minute = 0;
|
|
26499
|
+
let meridiem = null;
|
|
26500
|
+
let hour = parseInt(match[HOUR_GROUP]);
|
|
26501
|
+
if (hour > 100) {
|
|
26502
|
+
if (match[HOUR_GROUP].length == 4 && match[MINUTE_GROUP] == null && !match[AM_PM_HOUR_GROUP]) return null;
|
|
26503
|
+
if (this.strictMode || match[MINUTE_GROUP] != null) return null;
|
|
26504
|
+
minute = hour % 100;
|
|
26505
|
+
hour = Math.floor(hour / 100);
|
|
26506
|
+
}
|
|
26507
|
+
if (hour > 24) return null;
|
|
26508
|
+
if (match[MINUTE_GROUP] != null) {
|
|
26509
|
+
if (match[MINUTE_GROUP].length == 1 && !match[AM_PM_HOUR_GROUP]) return null;
|
|
26510
|
+
minute = parseInt(match[MINUTE_GROUP]);
|
|
26511
|
+
}
|
|
26512
|
+
if (minute >= 60) return null;
|
|
26513
|
+
if (hour > 12) meridiem = Meridiem.PM;
|
|
26514
|
+
if (match[AM_PM_HOUR_GROUP] != null) {
|
|
26515
|
+
if (hour > 12) return null;
|
|
26516
|
+
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
|
26517
|
+
if (ampm == "a") {
|
|
26518
|
+
meridiem = Meridiem.AM;
|
|
26519
|
+
if (hour == 12) hour = 0;
|
|
26520
|
+
}
|
|
26521
|
+
if (ampm == "p") {
|
|
26522
|
+
meridiem = Meridiem.PM;
|
|
26523
|
+
if (hour != 12) hour += 12;
|
|
26524
|
+
}
|
|
26525
|
+
}
|
|
26526
|
+
components.assign("hour", hour);
|
|
26527
|
+
components.assign("minute", minute);
|
|
26528
|
+
if (meridiem !== null) components.assign("meridiem", meridiem);
|
|
26529
|
+
else if (hour < 12) components.imply("meridiem", Meridiem.AM);
|
|
26530
|
+
else components.imply("meridiem", Meridiem.PM);
|
|
26531
|
+
if (match[MILLI_SECOND_GROUP] != null) {
|
|
26532
|
+
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
|
26533
|
+
if (millisecond >= 1e3) return null;
|
|
26534
|
+
components.assign("millisecond", millisecond);
|
|
26535
|
+
}
|
|
26536
|
+
if (match[SECOND_GROUP] != null) {
|
|
26537
|
+
const second = parseInt(match[SECOND_GROUP]);
|
|
26538
|
+
if (second >= 60) return null;
|
|
26539
|
+
components.assign("second", second);
|
|
26540
|
+
}
|
|
26541
|
+
return components;
|
|
26542
|
+
}
|
|
26543
|
+
extractFollowingTimeComponents(context, match, result) {
|
|
26544
|
+
const components = context.createParsingComponents();
|
|
26545
|
+
if (match[MILLI_SECOND_GROUP] != null) {
|
|
26546
|
+
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
|
26547
|
+
if (millisecond >= 1e3) return null;
|
|
26548
|
+
components.assign("millisecond", millisecond);
|
|
26549
|
+
}
|
|
26550
|
+
if (match[SECOND_GROUP] != null) {
|
|
26551
|
+
const second = parseInt(match[SECOND_GROUP]);
|
|
26552
|
+
if (second >= 60) return null;
|
|
26553
|
+
components.assign("second", second);
|
|
26554
|
+
}
|
|
26555
|
+
let hour = parseInt(match[HOUR_GROUP]);
|
|
26556
|
+
let minute = 0;
|
|
26557
|
+
let meridiem = -1;
|
|
26558
|
+
if (match[MINUTE_GROUP] != null) minute = parseInt(match[MINUTE_GROUP]);
|
|
26559
|
+
else if (hour > 100) {
|
|
26560
|
+
minute = hour % 100;
|
|
26561
|
+
hour = Math.floor(hour / 100);
|
|
26562
|
+
}
|
|
26563
|
+
if (minute >= 60 || hour > 24) return null;
|
|
26564
|
+
if (hour >= 12) meridiem = Meridiem.PM;
|
|
26565
|
+
if (match[AM_PM_HOUR_GROUP] != null) {
|
|
26566
|
+
if (hour > 12) return null;
|
|
26567
|
+
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
|
26568
|
+
if (ampm == "a") {
|
|
26569
|
+
meridiem = Meridiem.AM;
|
|
26570
|
+
if (hour == 12) {
|
|
26571
|
+
hour = 0;
|
|
26572
|
+
if (!components.isCertain("day")) components.imply("day", components.get("day") + 1);
|
|
26573
|
+
}
|
|
26574
|
+
}
|
|
26575
|
+
if (ampm == "p") {
|
|
26576
|
+
meridiem = Meridiem.PM;
|
|
26577
|
+
if (hour != 12) hour += 12;
|
|
26578
|
+
}
|
|
26579
|
+
if (!result.start.isCertain("meridiem")) if (meridiem == Meridiem.AM) {
|
|
26580
|
+
result.start.imply("meridiem", Meridiem.AM);
|
|
26581
|
+
if (result.start.get("hour") == 12) result.start.assign("hour", 0);
|
|
26582
|
+
} else {
|
|
26583
|
+
result.start.imply("meridiem", Meridiem.PM);
|
|
26584
|
+
if (result.start.get("hour") != 12) result.start.assign("hour", result.start.get("hour") + 12);
|
|
26585
|
+
}
|
|
26586
|
+
}
|
|
26587
|
+
components.assign("hour", hour);
|
|
26588
|
+
components.assign("minute", minute);
|
|
26589
|
+
if (meridiem >= 0) components.assign("meridiem", meridiem);
|
|
26590
|
+
else if (result.start.isCertain("meridiem") && result.start.get("hour") > 12) {
|
|
26591
|
+
if (result.start.get("hour") - 12 > hour) components.imply("meridiem", Meridiem.AM);
|
|
26592
|
+
else if (hour <= 12) {
|
|
26593
|
+
components.assign("hour", hour + 12);
|
|
26594
|
+
components.assign("meridiem", Meridiem.PM);
|
|
26595
|
+
}
|
|
26596
|
+
} else if (hour > 12) components.imply("meridiem", Meridiem.PM);
|
|
26597
|
+
else if (hour <= 12) components.imply("meridiem", Meridiem.AM);
|
|
26598
|
+
if (components.date().getTime() < result.start.date().getTime()) components.imply("day", components.get("day") + 1);
|
|
26599
|
+
return components;
|
|
26600
|
+
}
|
|
26601
|
+
checkAndReturnWithoutFollowingPattern(result) {
|
|
26602
|
+
if (result.text.match(/^\d$/)) return null;
|
|
26603
|
+
if (result.text.match(/^\d\d\d+$/)) return null;
|
|
26604
|
+
if (result.text.match(/\d[apAP]$/)) return null;
|
|
26605
|
+
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)$/);
|
|
26606
|
+
if (endingWithNumbers) {
|
|
26607
|
+
const endingNumbers = endingWithNumbers[1];
|
|
26608
|
+
if (this.strictMode) return null;
|
|
26609
|
+
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) return null;
|
|
26610
|
+
if (parseInt(endingNumbers) > 24) return null;
|
|
26611
|
+
}
|
|
26612
|
+
return result;
|
|
26613
|
+
}
|
|
26614
|
+
checkAndReturnWithFollowingPattern(result) {
|
|
26615
|
+
if (result.text.match(/^\d+-\d+$/)) return null;
|
|
26616
|
+
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);
|
|
26617
|
+
if (endingWithNumbers) {
|
|
26618
|
+
if (this.strictMode) return null;
|
|
26619
|
+
const startingNumbers = endingWithNumbers[1];
|
|
26620
|
+
const endingNumbers = endingWithNumbers[2];
|
|
26621
|
+
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) return null;
|
|
26622
|
+
if (parseInt(endingNumbers) > 24 || parseInt(startingNumbers) > 24) return null;
|
|
26623
|
+
}
|
|
26624
|
+
return result;
|
|
26625
|
+
}
|
|
26626
|
+
cachedPrimaryPrefix = null;
|
|
26627
|
+
cachedPrimarySuffix = null;
|
|
26628
|
+
cachedPrimaryTimePattern = null;
|
|
26629
|
+
getPrimaryTimePatternThroughCache() {
|
|
26630
|
+
const primaryPrefix = this.primaryPrefix();
|
|
26631
|
+
const primarySuffix = this.primarySuffix();
|
|
26632
|
+
if (this.cachedPrimaryPrefix === primaryPrefix && this.cachedPrimarySuffix === primarySuffix) return this.cachedPrimaryTimePattern;
|
|
26633
|
+
this.cachedPrimaryTimePattern = primaryTimePattern(this.primaryPatternLeftBoundary(), primaryPrefix, primarySuffix, this.patternFlags());
|
|
26634
|
+
this.cachedPrimaryPrefix = primaryPrefix;
|
|
26635
|
+
this.cachedPrimarySuffix = primarySuffix;
|
|
26636
|
+
return this.cachedPrimaryTimePattern;
|
|
26637
|
+
}
|
|
26638
|
+
cachedFollowingPhase = null;
|
|
26639
|
+
cachedFollowingSuffix = null;
|
|
26640
|
+
cachedFollowingTimePatten = null;
|
|
26641
|
+
getFollowingTimePatternThroughCache() {
|
|
26642
|
+
const followingPhase = this.followingPhase();
|
|
26643
|
+
const followingSuffix = this.followingSuffix();
|
|
26644
|
+
if (this.cachedFollowingPhase === followingPhase && this.cachedFollowingSuffix === followingSuffix) return this.cachedFollowingTimePatten;
|
|
26645
|
+
this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix);
|
|
26646
|
+
this.cachedFollowingPhase = followingPhase;
|
|
26647
|
+
this.cachedFollowingSuffix = followingSuffix;
|
|
26648
|
+
return this.cachedFollowingTimePatten;
|
|
26649
|
+
}
|
|
26650
|
+
};
|
|
26651
|
+
|
|
26652
|
+
//#endregion
|
|
26653
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeExpressionParser.js
|
|
26654
|
+
var ENTimeExpressionParser = class extends AbstractTimeExpressionParser {
|
|
26655
|
+
constructor(strictMode) {
|
|
26656
|
+
super(strictMode);
|
|
26657
|
+
}
|
|
26658
|
+
followingPhase() {
|
|
26659
|
+
return "\\s*(?:\\-|\\–|\\~|\\〜|to|until|through|till|\\?)\\s*";
|
|
26660
|
+
}
|
|
26661
|
+
primaryPrefix() {
|
|
26662
|
+
return "(?:(?:at|from)\\s*)??";
|
|
26663
|
+
}
|
|
26664
|
+
primarySuffix() {
|
|
26665
|
+
return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)";
|
|
26666
|
+
}
|
|
26667
|
+
extractPrimaryTimeComponents(context, match) {
|
|
26668
|
+
const components = super.extractPrimaryTimeComponents(context, match);
|
|
26669
|
+
if (!components) return components;
|
|
26670
|
+
if (match[0].endsWith("night")) {
|
|
26671
|
+
const hour = components.get("hour");
|
|
26672
|
+
if (hour >= 6 && hour < 12) {
|
|
26673
|
+
components.assign("hour", components.get("hour") + 12);
|
|
26674
|
+
components.assign("meridiem", Meridiem.PM);
|
|
26675
|
+
} else if (hour < 6) components.assign("meridiem", Meridiem.AM);
|
|
26676
|
+
}
|
|
26677
|
+
if (match[0].endsWith("afternoon")) {
|
|
26678
|
+
components.assign("meridiem", Meridiem.PM);
|
|
26679
|
+
const hour = components.get("hour");
|
|
26680
|
+
if (hour >= 0 && hour <= 6) components.assign("hour", components.get("hour") + 12);
|
|
26681
|
+
}
|
|
26682
|
+
if (match[0].endsWith("morning")) {
|
|
26683
|
+
components.assign("meridiem", Meridiem.AM);
|
|
26684
|
+
if (components.get("hour") < 12) components.assign("hour", components.get("hour"));
|
|
26685
|
+
}
|
|
26686
|
+
return components.addTag("parser/ENTimeExpressionParser");
|
|
26687
|
+
}
|
|
26688
|
+
extractFollowingTimeComponents(context, match, result) {
|
|
26689
|
+
const followingComponents = super.extractFollowingTimeComponents(context, match, result);
|
|
26690
|
+
if (followingComponents) followingComponents.addTag("parser/ENTimeExpressionParser");
|
|
26691
|
+
return followingComponents;
|
|
26692
|
+
}
|
|
26693
|
+
};
|
|
26694
|
+
|
|
26695
|
+
//#endregion
|
|
26696
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitAgoFormatParser.js
|
|
26697
|
+
const PATTERN$8 = new RegExp(`(${TIME_UNITS_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i");
|
|
26698
|
+
const STRICT_PATTERN$1 = new RegExp(`(${TIME_UNITS_NO_ABBR_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i");
|
|
26699
|
+
var ENTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26700
|
+
strictMode;
|
|
26701
|
+
constructor(strictMode) {
|
|
26702
|
+
super();
|
|
26703
|
+
this.strictMode = strictMode;
|
|
26704
|
+
}
|
|
26705
|
+
innerPattern() {
|
|
26706
|
+
return this.strictMode ? STRICT_PATTERN$1 : PATTERN$8;
|
|
26707
|
+
}
|
|
26708
|
+
innerExtract(context, match) {
|
|
26709
|
+
const duration = parseDuration(match[1]);
|
|
26710
|
+
if (!duration) return null;
|
|
26711
|
+
return ParsingComponents.createRelativeFromReference(context.reference, reverseDuration(duration));
|
|
26712
|
+
}
|
|
26713
|
+
};
|
|
26714
|
+
|
|
26715
|
+
//#endregion
|
|
26716
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitLaterFormatParser.js
|
|
26717
|
+
const PATTERN$7 = new RegExp(`(${TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|\$))`, "i");
|
|
26718
|
+
const STRICT_PATTERN = new RegExp(`(${TIME_UNITS_NO_ABBR_PATTERN})\\s{0,5}(later|after|from now)(?=\\W|$)`, "i");
|
|
26719
|
+
const GROUP_NUM_TIMEUNITS = 1;
|
|
26720
|
+
var ENTimeUnitLaterFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
26721
|
+
strictMode;
|
|
26722
|
+
constructor(strictMode) {
|
|
26723
|
+
super();
|
|
26724
|
+
this.strictMode = strictMode;
|
|
26725
|
+
}
|
|
26726
|
+
innerPattern() {
|
|
26727
|
+
return this.strictMode ? STRICT_PATTERN : PATTERN$7;
|
|
26728
|
+
}
|
|
26729
|
+
innerExtract(context, match) {
|
|
26730
|
+
const timeUnits = parseDuration(match[GROUP_NUM_TIMEUNITS]);
|
|
26731
|
+
if (!timeUnits) return null;
|
|
26732
|
+
return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
26733
|
+
}
|
|
26734
|
+
};
|
|
26735
|
+
|
|
26736
|
+
//#endregion
|
|
26737
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/abstractRefiners.js
|
|
26738
|
+
var Filter = class {
|
|
26739
|
+
refine(context, results) {
|
|
26740
|
+
return results.filter((r) => this.isValid(context, r));
|
|
26741
|
+
}
|
|
26742
|
+
};
|
|
26743
|
+
var MergingRefiner = class {
|
|
26744
|
+
refine(context, results) {
|
|
26745
|
+
if (results.length < 2) return results;
|
|
26746
|
+
const mergedResults = [];
|
|
26747
|
+
let curResult = results[0];
|
|
26748
|
+
let nextResult = null;
|
|
26749
|
+
for (let i = 1; i < results.length; i++) {
|
|
26750
|
+
nextResult = results[i];
|
|
26751
|
+
const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index);
|
|
26752
|
+
if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) {
|
|
26753
|
+
mergedResults.push(curResult);
|
|
26754
|
+
curResult = nextResult;
|
|
26755
|
+
} else {
|
|
26756
|
+
const left = curResult;
|
|
26757
|
+
const right = nextResult;
|
|
26758
|
+
const mergedResult = this.mergeResults(textBetween, left, right, context);
|
|
26759
|
+
context.debug(() => {
|
|
26760
|
+
console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`);
|
|
26761
|
+
});
|
|
26762
|
+
curResult = mergedResult;
|
|
26763
|
+
}
|
|
26764
|
+
}
|
|
26765
|
+
if (curResult != null) mergedResults.push(curResult);
|
|
26766
|
+
return mergedResults;
|
|
26767
|
+
}
|
|
26768
|
+
};
|
|
26769
|
+
|
|
26770
|
+
//#endregion
|
|
26771
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateRangeRefiner.js
|
|
26772
|
+
var AbstractMergeDateRangeRefiner = class extends MergingRefiner {
|
|
26773
|
+
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
26774
|
+
return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null;
|
|
26775
|
+
}
|
|
26776
|
+
mergeResults(textBetween, fromResult, toResult) {
|
|
26777
|
+
if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) {
|
|
26778
|
+
toResult.start.getCertainComponents().forEach((key) => {
|
|
26779
|
+
if (!fromResult.start.isCertain(key)) fromResult.start.imply(key, toResult.start.get(key));
|
|
26780
|
+
});
|
|
26781
|
+
fromResult.start.getCertainComponents().forEach((key) => {
|
|
26782
|
+
if (!toResult.start.isCertain(key)) toResult.start.imply(key, fromResult.start.get(key));
|
|
26783
|
+
});
|
|
26784
|
+
}
|
|
26785
|
+
if (fromResult.start.date() > toResult.start.date()) {
|
|
26786
|
+
let fromDate = fromResult.start.date();
|
|
26787
|
+
let toDate = toResult.start.date();
|
|
26788
|
+
if (toResult.start.isOnlyWeekdayComponent() && addDuration(toDate, { day: 7 }) > fromDate) {
|
|
26789
|
+
toDate = addDuration(toDate, { day: 7 });
|
|
26790
|
+
toResult.start.imply("day", toDate.getDate());
|
|
26791
|
+
toResult.start.imply("month", toDate.getMonth() + 1);
|
|
26792
|
+
toResult.start.imply("year", toDate.getFullYear());
|
|
26793
|
+
} else if (fromResult.start.isOnlyWeekdayComponent() && addDuration(fromDate, { day: -7 }) < toDate) {
|
|
26794
|
+
fromDate = addDuration(fromDate, { day: -7 });
|
|
26795
|
+
fromResult.start.imply("day", fromDate.getDate());
|
|
26796
|
+
fromResult.start.imply("month", fromDate.getMonth() + 1);
|
|
26797
|
+
fromResult.start.imply("year", fromDate.getFullYear());
|
|
26798
|
+
} else if (toResult.start.isDateWithUnknownYear() && addDuration(toDate, { year: 1 }) > fromDate) {
|
|
26799
|
+
toDate = addDuration(toDate, { year: 1 });
|
|
26800
|
+
toResult.start.imply("year", toDate.getFullYear());
|
|
26801
|
+
} else if (fromResult.start.isDateWithUnknownYear() && addDuration(fromDate, { year: -1 }) < toDate) {
|
|
26802
|
+
fromDate = addDuration(fromDate, { year: -1 });
|
|
26803
|
+
fromResult.start.imply("year", fromDate.getFullYear());
|
|
26804
|
+
} else [toResult, fromResult] = [fromResult, toResult];
|
|
26805
|
+
}
|
|
26806
|
+
const result = fromResult.clone();
|
|
26807
|
+
result.start = fromResult.start;
|
|
26808
|
+
result.end = toResult.start;
|
|
26809
|
+
result.index = Math.min(fromResult.index, toResult.index);
|
|
26810
|
+
if (fromResult.index < toResult.index) result.text = fromResult.text + textBetween + toResult.text;
|
|
26811
|
+
else result.text = toResult.text + textBetween + fromResult.text;
|
|
26812
|
+
return result;
|
|
26813
|
+
}
|
|
26814
|
+
};
|
|
26815
|
+
|
|
26816
|
+
//#endregion
|
|
26817
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateRangeRefiner.js
|
|
26818
|
+
var ENMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner {
|
|
26819
|
+
patternBetween() {
|
|
26820
|
+
return /^\s*(to|-|–|until|through|till)\s*$/i;
|
|
26821
|
+
}
|
|
26822
|
+
};
|
|
26823
|
+
|
|
26824
|
+
//#endregion
|
|
26825
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/calculation/mergingCalculation.js
|
|
26826
|
+
function mergeDateTimeResult(dateResult, timeResult) {
|
|
26827
|
+
const result = dateResult.clone();
|
|
26828
|
+
const beginDate = dateResult.start;
|
|
26829
|
+
const beginTime = timeResult.start;
|
|
26830
|
+
result.start = mergeDateTimeComponent(beginDate, beginTime);
|
|
26831
|
+
if (dateResult.end != null || timeResult.end != null) {
|
|
26832
|
+
const endDateTime = mergeDateTimeComponent(dateResult.end == null ? dateResult.start : dateResult.end, timeResult.end == null ? timeResult.start : timeResult.end);
|
|
26833
|
+
if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) {
|
|
26834
|
+
const nextDay = new Date(endDateTime.date().getTime());
|
|
26835
|
+
nextDay.setDate(nextDay.getDate() + 1);
|
|
26836
|
+
if (endDateTime.isCertain("day")) assignSimilarDate(endDateTime, nextDay);
|
|
26837
|
+
else implySimilarDate(endDateTime, nextDay);
|
|
26838
|
+
}
|
|
26839
|
+
result.end = endDateTime;
|
|
26840
|
+
}
|
|
26841
|
+
return result;
|
|
26842
|
+
}
|
|
26843
|
+
function mergeDateTimeComponent(dateComponent, timeComponent) {
|
|
26844
|
+
const dateTimeComponent = dateComponent.clone();
|
|
26845
|
+
if (timeComponent.isCertain("hour")) {
|
|
26846
|
+
dateTimeComponent.assign("hour", timeComponent.get("hour"));
|
|
26847
|
+
dateTimeComponent.assign("minute", timeComponent.get("minute"));
|
|
26848
|
+
if (timeComponent.isCertain("second")) {
|
|
26849
|
+
dateTimeComponent.assign("second", timeComponent.get("second"));
|
|
26850
|
+
if (timeComponent.isCertain("millisecond")) dateTimeComponent.assign("millisecond", timeComponent.get("millisecond"));
|
|
26851
|
+
else dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
|
26852
|
+
} else {
|
|
26853
|
+
dateTimeComponent.imply("second", timeComponent.get("second"));
|
|
26854
|
+
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
|
26855
|
+
}
|
|
26856
|
+
} else {
|
|
26857
|
+
dateTimeComponent.imply("hour", timeComponent.get("hour"));
|
|
26858
|
+
dateTimeComponent.imply("minute", timeComponent.get("minute"));
|
|
26859
|
+
dateTimeComponent.imply("second", timeComponent.get("second"));
|
|
26860
|
+
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
|
26861
|
+
}
|
|
26862
|
+
if (timeComponent.isCertain("timezoneOffset")) dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset"));
|
|
26863
|
+
if (timeComponent.isCertain("meridiem")) dateTimeComponent.assign("meridiem", timeComponent.get("meridiem"));
|
|
26864
|
+
else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) dateTimeComponent.imply("meridiem", timeComponent.get("meridiem"));
|
|
26865
|
+
if (dateTimeComponent.get("meridiem") == Meridiem.PM && dateTimeComponent.get("hour") < 12) if (timeComponent.isCertain("hour")) dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12);
|
|
26866
|
+
else dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12);
|
|
26867
|
+
dateTimeComponent.addTags(dateComponent.tags());
|
|
26868
|
+
dateTimeComponent.addTags(timeComponent.tags());
|
|
26869
|
+
return dateTimeComponent;
|
|
26870
|
+
}
|
|
26871
|
+
|
|
26872
|
+
//#endregion
|
|
26873
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateTimeRefiner.js
|
|
26874
|
+
var AbstractMergeDateTimeRefiner = class extends MergingRefiner {
|
|
26875
|
+
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
26876
|
+
return (currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime() || nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime()) && textBetween.match(this.patternBetween()) != null;
|
|
26877
|
+
}
|
|
26878
|
+
mergeResults(textBetween, currentResult, nextResult) {
|
|
26879
|
+
const result = currentResult.start.isOnlyDate() ? mergeDateTimeResult(currentResult, nextResult) : mergeDateTimeResult(nextResult, currentResult);
|
|
26880
|
+
result.index = currentResult.index;
|
|
26881
|
+
result.text = currentResult.text + textBetween + nextResult.text;
|
|
26882
|
+
return result;
|
|
26883
|
+
}
|
|
26884
|
+
};
|
|
26885
|
+
|
|
26886
|
+
//#endregion
|
|
26887
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateTimeRefiner.js
|
|
26888
|
+
var ENMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner {
|
|
26889
|
+
patternBetween() {
|
|
26890
|
+
return /* @__PURE__ */ new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$");
|
|
26891
|
+
}
|
|
26892
|
+
};
|
|
26893
|
+
|
|
26894
|
+
//#endregion
|
|
26895
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneAbbrRefiner.js
|
|
26896
|
+
const TIMEZONE_NAME_PATTERN = /* @__PURE__ */ new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
|
|
26897
|
+
var ExtractTimezoneAbbrRefiner = class {
|
|
26898
|
+
timezoneOverrides;
|
|
26899
|
+
constructor(timezoneOverrides) {
|
|
26900
|
+
this.timezoneOverrides = timezoneOverrides;
|
|
26901
|
+
}
|
|
26902
|
+
refine(context, results) {
|
|
26903
|
+
const timezoneOverrides = context.option.timezones ?? {};
|
|
26904
|
+
results.forEach((result) => {
|
|
26905
|
+
const suffix = context.text.substring(result.index + result.text.length);
|
|
26906
|
+
const match = TIMEZONE_NAME_PATTERN.exec(suffix);
|
|
26907
|
+
if (!match) return;
|
|
26908
|
+
const timezoneAbbr = match[1].toUpperCase();
|
|
26909
|
+
const extractedTimezoneOffset = toTimezoneOffset(timezoneAbbr, result.start.date() ?? result.refDate ?? /* @__PURE__ */ new Date(), {
|
|
26910
|
+
...this.timezoneOverrides,
|
|
26911
|
+
...timezoneOverrides
|
|
26912
|
+
});
|
|
26913
|
+
if (extractedTimezoneOffset == null) return;
|
|
26914
|
+
context.debug(() => {
|
|
26915
|
+
console.log(`Extracting timezone: '${timezoneAbbr}' into: ${extractedTimezoneOffset} for: ${result.start}`);
|
|
26916
|
+
});
|
|
26917
|
+
const currentTimezoneOffset = result.start.get("timezoneOffset");
|
|
26918
|
+
if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) {
|
|
26919
|
+
if (result.start.isCertain("timezoneOffset")) return;
|
|
26920
|
+
if (timezoneAbbr != match[1]) return;
|
|
26921
|
+
}
|
|
26922
|
+
if (result.start.isOnlyDate()) {
|
|
26923
|
+
if (timezoneAbbr != match[1]) return;
|
|
26924
|
+
}
|
|
26925
|
+
result.text += match[0];
|
|
26926
|
+
if (!result.start.isCertain("timezoneOffset")) result.start.assign("timezoneOffset", extractedTimezoneOffset);
|
|
26927
|
+
if (result.end != null && !result.end.isCertain("timezoneOffset")) result.end.assign("timezoneOffset", extractedTimezoneOffset);
|
|
26928
|
+
});
|
|
26929
|
+
return results;
|
|
26930
|
+
}
|
|
26931
|
+
};
|
|
26932
|
+
|
|
26933
|
+
//#endregion
|
|
26934
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneOffsetRefiner.js
|
|
26935
|
+
const TIMEZONE_OFFSET_PATTERN = /* @__PURE__ */ new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i");
|
|
26936
|
+
const TIMEZONE_OFFSET_SIGN_GROUP = 1;
|
|
26937
|
+
const TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2;
|
|
26938
|
+
const TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3;
|
|
26939
|
+
var ExtractTimezoneOffsetRefiner = class {
|
|
26940
|
+
refine(context, results) {
|
|
26941
|
+
results.forEach(function(result) {
|
|
26942
|
+
if (result.start.isCertain("timezoneOffset")) return;
|
|
26943
|
+
const suffix = context.text.substring(result.index + result.text.length);
|
|
26944
|
+
const match = TIMEZONE_OFFSET_PATTERN.exec(suffix);
|
|
26945
|
+
if (!match) return;
|
|
26946
|
+
context.debug(() => {
|
|
26947
|
+
console.log(`Extracting timezone: '${match[0]}' into : ${result}`);
|
|
26948
|
+
});
|
|
26949
|
+
const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]);
|
|
26950
|
+
const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0");
|
|
26951
|
+
let timezoneOffset = hourOffset * 60 + minuteOffset;
|
|
26952
|
+
if (timezoneOffset > 840) return;
|
|
26953
|
+
if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") timezoneOffset = -timezoneOffset;
|
|
26954
|
+
if (result.end != null) result.end.assign("timezoneOffset", timezoneOffset);
|
|
26955
|
+
result.start.assign("timezoneOffset", timezoneOffset);
|
|
26956
|
+
result.text += match[0];
|
|
26957
|
+
});
|
|
26958
|
+
return results;
|
|
26959
|
+
}
|
|
26960
|
+
};
|
|
26961
|
+
|
|
26962
|
+
//#endregion
|
|
26963
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/OverlapRemovalRefiner.js
|
|
26964
|
+
var OverlapRemovalRefiner = class {
|
|
26965
|
+
refine(context, results) {
|
|
26966
|
+
if (results.length < 2) return results;
|
|
26967
|
+
const filteredResults = [];
|
|
26968
|
+
let prevResult = results[0];
|
|
26969
|
+
for (let i = 1; i < results.length; i++) {
|
|
26970
|
+
const result = results[i];
|
|
26971
|
+
if (result.index >= prevResult.index + prevResult.text.length) {
|
|
26972
|
+
filteredResults.push(prevResult);
|
|
26973
|
+
prevResult = result;
|
|
26974
|
+
continue;
|
|
26975
|
+
}
|
|
26976
|
+
let kept = null;
|
|
26977
|
+
let removed = null;
|
|
26978
|
+
if (result.text.length > prevResult.text.length) {
|
|
26979
|
+
kept = result;
|
|
26980
|
+
removed = prevResult;
|
|
26981
|
+
} else {
|
|
26982
|
+
kept = prevResult;
|
|
26983
|
+
removed = result;
|
|
26984
|
+
}
|
|
26985
|
+
context.debug(() => {
|
|
26986
|
+
console.log(`${this.constructor.name} remove ${removed} by ${kept}`);
|
|
26987
|
+
});
|
|
26988
|
+
prevResult = kept;
|
|
26989
|
+
}
|
|
26990
|
+
if (prevResult != null) filteredResults.push(prevResult);
|
|
26991
|
+
return filteredResults;
|
|
26992
|
+
}
|
|
26993
|
+
};
|
|
26994
|
+
|
|
26995
|
+
//#endregion
|
|
26996
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/ForwardDateRefiner.js
|
|
26997
|
+
var ForwardDateRefiner = class {
|
|
26998
|
+
refine(context, results) {
|
|
26999
|
+
if (!context.option.forwardDate) return results;
|
|
27000
|
+
results.forEach((result) => {
|
|
27001
|
+
let refDate = context.reference.getDateWithAdjustedTimezone();
|
|
27002
|
+
if (result.start.isOnlyTime() && context.reference.instant > result.start.date()) {
|
|
27003
|
+
const refDate = context.reference.getDateWithAdjustedTimezone();
|
|
27004
|
+
const refFollowingDay = new Date(refDate);
|
|
27005
|
+
refFollowingDay.setDate(refFollowingDay.getDate() + 1);
|
|
27006
|
+
implySimilarDate(result.start, refFollowingDay);
|
|
27007
|
+
context.debug(() => {
|
|
27008
|
+
console.log(`${this.constructor.name} adjusted ${result} time from the ref date (${refDate}) to the following day (${refFollowingDay})`);
|
|
27009
|
+
});
|
|
27010
|
+
if (result.end && result.end.isOnlyTime()) {
|
|
27011
|
+
implySimilarDate(result.end, refFollowingDay);
|
|
27012
|
+
if (result.start.date() > result.end.date()) {
|
|
27013
|
+
refFollowingDay.setDate(refFollowingDay.getDate() + 1);
|
|
27014
|
+
implySimilarDate(result.end, refFollowingDay);
|
|
27015
|
+
}
|
|
27016
|
+
}
|
|
27017
|
+
}
|
|
27018
|
+
if (result.start.isOnlyWeekdayComponent() && refDate > result.start.date()) {
|
|
27019
|
+
let daysToAdd = result.start.get("weekday") - refDate.getDay();
|
|
27020
|
+
if (daysToAdd <= 0) daysToAdd += 7;
|
|
27021
|
+
refDate = addDuration(refDate, { day: daysToAdd });
|
|
27022
|
+
implySimilarDate(result.start, refDate);
|
|
27023
|
+
context.debug(() => {
|
|
27024
|
+
console.log(`${this.constructor.name} adjusted ${result} weekday (${result.start})`);
|
|
27025
|
+
});
|
|
27026
|
+
if (result.end && result.end.isOnlyWeekdayComponent()) {
|
|
27027
|
+
let daysToAdd = result.end.get("weekday") - refDate.getDay();
|
|
27028
|
+
if (daysToAdd <= 0) daysToAdd += 7;
|
|
27029
|
+
refDate = addDuration(refDate, { day: daysToAdd });
|
|
27030
|
+
implySimilarDate(result.end, refDate);
|
|
27031
|
+
context.debug(() => {
|
|
27032
|
+
console.log(`${this.constructor.name} adjusted ${result} weekday (${result.end})`);
|
|
27033
|
+
});
|
|
27034
|
+
}
|
|
27035
|
+
}
|
|
27036
|
+
if (result.start.isDateWithUnknownYear() && refDate > result.start.date()) for (let i = 0; i < 3 && refDate > result.start.date(); i++) {
|
|
27037
|
+
result.start.imply("year", result.start.get("year") + 1);
|
|
27038
|
+
context.debug(() => {
|
|
27039
|
+
console.log(`${this.constructor.name} adjusted ${result} year (${result.start})`);
|
|
27040
|
+
});
|
|
27041
|
+
if (result.end && !result.end.isCertain("year")) {
|
|
27042
|
+
result.end.imply("year", result.end.get("year") + 1);
|
|
27043
|
+
context.debug(() => {
|
|
27044
|
+
console.log(`${this.constructor.name} adjusted ${result} month (${result.start})`);
|
|
27045
|
+
});
|
|
27046
|
+
}
|
|
27047
|
+
}
|
|
27048
|
+
});
|
|
27049
|
+
return results;
|
|
27050
|
+
}
|
|
27051
|
+
};
|
|
27052
|
+
|
|
27053
|
+
//#endregion
|
|
27054
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/UnlikelyFormatFilter.js
|
|
27055
|
+
var UnlikelyFormatFilter = class extends Filter {
|
|
27056
|
+
strictMode;
|
|
27057
|
+
constructor(strictMode) {
|
|
27058
|
+
super();
|
|
27059
|
+
this.strictMode = strictMode;
|
|
27060
|
+
}
|
|
27061
|
+
isValid(context, result) {
|
|
27062
|
+
if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) {
|
|
27063
|
+
context.debug(() => {
|
|
27064
|
+
console.log(`Removing unlikely result '${result.text}'`);
|
|
27065
|
+
});
|
|
27066
|
+
return false;
|
|
27067
|
+
}
|
|
27068
|
+
if (!result.start.isValidDate()) {
|
|
27069
|
+
context.debug(() => {
|
|
27070
|
+
console.log(`Removing invalid result: ${result} (${result.start})`);
|
|
27071
|
+
});
|
|
27072
|
+
return false;
|
|
27073
|
+
}
|
|
27074
|
+
if (result.end && !result.end.isValidDate()) {
|
|
27075
|
+
context.debug(() => {
|
|
27076
|
+
console.log(`Removing invalid result: ${result} (${result.end})`);
|
|
27077
|
+
});
|
|
27078
|
+
return false;
|
|
27079
|
+
}
|
|
27080
|
+
if (this.strictMode) return this.isStrictModeValid(context, result);
|
|
27081
|
+
return true;
|
|
27082
|
+
}
|
|
27083
|
+
isStrictModeValid(context, result) {
|
|
27084
|
+
if (result.start.isOnlyWeekdayComponent()) {
|
|
27085
|
+
context.debug(() => {
|
|
27086
|
+
console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`);
|
|
27087
|
+
});
|
|
27088
|
+
return false;
|
|
27089
|
+
}
|
|
27090
|
+
return true;
|
|
27091
|
+
}
|
|
27092
|
+
};
|
|
27093
|
+
|
|
27094
|
+
//#endregion
|
|
27095
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/parsers/ISOFormatParser.js
|
|
27096
|
+
const PATTERN$6 = 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");
|
|
27097
|
+
const YEAR_NUMBER_GROUP = 1;
|
|
27098
|
+
const MONTH_NUMBER_GROUP = 2;
|
|
27099
|
+
const DATE_NUMBER_GROUP = 3;
|
|
27100
|
+
const HOUR_NUMBER_GROUP = 4;
|
|
27101
|
+
const MINUTE_NUMBER_GROUP = 5;
|
|
27102
|
+
const SECOND_NUMBER_GROUP = 6;
|
|
27103
|
+
const MILLISECOND_NUMBER_GROUP = 7;
|
|
27104
|
+
const TZD_GROUP = 8;
|
|
27105
|
+
const TZD_HOUR_OFFSET_GROUP = 9;
|
|
27106
|
+
const TZD_MINUTE_OFFSET_GROUP = 10;
|
|
27107
|
+
var ISOFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27108
|
+
innerPattern() {
|
|
27109
|
+
return PATTERN$6;
|
|
27110
|
+
}
|
|
27111
|
+
innerExtract(context, match) {
|
|
27112
|
+
const components = context.createParsingComponents({
|
|
27113
|
+
"year": parseInt(match[YEAR_NUMBER_GROUP]),
|
|
27114
|
+
"month": parseInt(match[MONTH_NUMBER_GROUP]),
|
|
27115
|
+
"day": parseInt(match[DATE_NUMBER_GROUP])
|
|
27116
|
+
});
|
|
27117
|
+
if (match[HOUR_NUMBER_GROUP] != null) {
|
|
27118
|
+
components.assign("hour", parseInt(match[HOUR_NUMBER_GROUP]));
|
|
27119
|
+
components.assign("minute", parseInt(match[MINUTE_NUMBER_GROUP]));
|
|
27120
|
+
if (match[SECOND_NUMBER_GROUP] != null) components.assign("second", parseInt(match[SECOND_NUMBER_GROUP]));
|
|
27121
|
+
if (match[MILLISECOND_NUMBER_GROUP] != null) components.assign("millisecond", parseInt(match[MILLISECOND_NUMBER_GROUP]));
|
|
27122
|
+
if (match[TZD_GROUP] != null) {
|
|
27123
|
+
let offset = 0;
|
|
27124
|
+
if (match[TZD_HOUR_OFFSET_GROUP]) {
|
|
27125
|
+
const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]);
|
|
27126
|
+
let minuteOffset = 0;
|
|
27127
|
+
if (match[TZD_MINUTE_OFFSET_GROUP] != null) minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]);
|
|
27128
|
+
offset = hourOffset * 60;
|
|
27129
|
+
if (offset < 0) offset -= minuteOffset;
|
|
27130
|
+
else offset += minuteOffset;
|
|
27131
|
+
}
|
|
27132
|
+
components.assign("timezoneOffset", offset);
|
|
27133
|
+
}
|
|
27134
|
+
}
|
|
27135
|
+
return components.addTag("parser/ISOFormatParser");
|
|
27136
|
+
}
|
|
27137
|
+
};
|
|
27138
|
+
|
|
27139
|
+
//#endregion
|
|
27140
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/refiners/MergeWeekdayComponentRefiner.js
|
|
27141
|
+
var MergeWeekdayComponentRefiner = class extends MergingRefiner {
|
|
27142
|
+
mergeResults(textBetween, currentResult, nextResult) {
|
|
27143
|
+
const newResult = nextResult.clone();
|
|
27144
|
+
newResult.index = currentResult.index;
|
|
27145
|
+
newResult.text = currentResult.text + textBetween + newResult.text;
|
|
27146
|
+
newResult.start.assign("weekday", currentResult.start.get("weekday"));
|
|
27147
|
+
if (newResult.end) newResult.end.assign("weekday", currentResult.start.get("weekday"));
|
|
27148
|
+
return newResult;
|
|
27149
|
+
}
|
|
27150
|
+
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
27151
|
+
return currentResult.start.isOnlyWeekdayComponent() && !currentResult.start.isCertain("hour") && nextResult.start.isCertain("day") && textBetween.match(/^,?\s*$/) != null;
|
|
27152
|
+
}
|
|
27153
|
+
};
|
|
27154
|
+
|
|
27155
|
+
//#endregion
|
|
27156
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/configurations.js
|
|
27157
|
+
function includeCommonConfiguration(configuration, strictMode = false) {
|
|
27158
|
+
configuration.parsers.unshift(new ISOFormatParser());
|
|
27159
|
+
configuration.refiners.unshift(new MergeWeekdayComponentRefiner());
|
|
27160
|
+
configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner());
|
|
27161
|
+
configuration.refiners.unshift(new OverlapRemovalRefiner());
|
|
27162
|
+
configuration.refiners.push(new ExtractTimezoneAbbrRefiner());
|
|
27163
|
+
configuration.refiners.push(new OverlapRemovalRefiner());
|
|
27164
|
+
configuration.refiners.push(new ForwardDateRefiner());
|
|
27165
|
+
configuration.refiners.push(new UnlikelyFormatFilter(strictMode));
|
|
27166
|
+
return configuration;
|
|
27167
|
+
}
|
|
27168
|
+
|
|
27169
|
+
//#endregion
|
|
27170
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/casualReferences.js
|
|
27171
|
+
function now(reference) {
|
|
27172
|
+
const targetDate = reference.getDateWithAdjustedTimezone();
|
|
27173
|
+
const component = new ParsingComponents(reference, {});
|
|
27174
|
+
assignSimilarDate(component, targetDate);
|
|
27175
|
+
assignSimilarTime(component, targetDate);
|
|
27176
|
+
component.assign("timezoneOffset", reference.getTimezoneOffset());
|
|
27177
|
+
component.addTag("casualReference/now");
|
|
27178
|
+
return component;
|
|
27179
|
+
}
|
|
27180
|
+
function today(reference) {
|
|
27181
|
+
const targetDate = reference.getDateWithAdjustedTimezone();
|
|
27182
|
+
const component = new ParsingComponents(reference, {});
|
|
27183
|
+
assignSimilarDate(component, targetDate);
|
|
27184
|
+
implySimilarTime(component, targetDate);
|
|
27185
|
+
component.delete("meridiem");
|
|
27186
|
+
component.addTag("casualReference/today");
|
|
27187
|
+
return component;
|
|
27188
|
+
}
|
|
27189
|
+
function yesterday(reference) {
|
|
27190
|
+
return theDayBefore(reference, 1).addTag("casualReference/yesterday");
|
|
27191
|
+
}
|
|
27192
|
+
function tomorrow(reference) {
|
|
27193
|
+
return theDayAfter(reference, 1).addTag("casualReference/tomorrow");
|
|
27194
|
+
}
|
|
27195
|
+
function theDayBefore(reference, numDay) {
|
|
27196
|
+
return theDayAfter(reference, -numDay);
|
|
27197
|
+
}
|
|
27198
|
+
function theDayAfter(reference, nDays) {
|
|
27199
|
+
const targetDate = reference.getDateWithAdjustedTimezone();
|
|
27200
|
+
const component = new ParsingComponents(reference, {});
|
|
27201
|
+
const newDate = new Date(targetDate.getTime());
|
|
27202
|
+
newDate.setDate(newDate.getDate() + nDays);
|
|
27203
|
+
assignSimilarDate(component, newDate);
|
|
27204
|
+
implySimilarTime(component, newDate);
|
|
27205
|
+
component.delete("meridiem");
|
|
27206
|
+
return component;
|
|
27207
|
+
}
|
|
27208
|
+
function tonight(reference, implyHour = 22) {
|
|
27209
|
+
const targetDate = reference.getDateWithAdjustedTimezone();
|
|
27210
|
+
const component = new ParsingComponents(reference, {});
|
|
27211
|
+
assignSimilarDate(component, targetDate);
|
|
27212
|
+
component.imply("hour", implyHour);
|
|
27213
|
+
component.imply("meridiem", Meridiem.PM);
|
|
27214
|
+
component.addTag("casualReference/tonight");
|
|
27215
|
+
return component;
|
|
27216
|
+
}
|
|
27217
|
+
function evening(reference, implyHour = 20) {
|
|
27218
|
+
const component = new ParsingComponents(reference, {});
|
|
27219
|
+
component.imply("meridiem", Meridiem.PM);
|
|
27220
|
+
component.imply("hour", implyHour);
|
|
27221
|
+
component.addTag("casualReference/evening");
|
|
27222
|
+
return component;
|
|
27223
|
+
}
|
|
27224
|
+
function midnight(reference) {
|
|
27225
|
+
const component = new ParsingComponents(reference, {});
|
|
27226
|
+
if (reference.getDateWithAdjustedTimezone().getHours() > 2) component.addDurationAsImplied({ day: 1 });
|
|
27227
|
+
component.assign("hour", 0);
|
|
27228
|
+
component.imply("minute", 0);
|
|
27229
|
+
component.imply("second", 0);
|
|
27230
|
+
component.imply("millisecond", 0);
|
|
27231
|
+
component.addTag("casualReference/midnight");
|
|
27232
|
+
return component;
|
|
27233
|
+
}
|
|
27234
|
+
function morning(reference, implyHour = 6) {
|
|
27235
|
+
const component = new ParsingComponents(reference, {});
|
|
27236
|
+
component.imply("meridiem", Meridiem.AM);
|
|
27237
|
+
component.imply("hour", implyHour);
|
|
27238
|
+
component.imply("minute", 0);
|
|
27239
|
+
component.imply("second", 0);
|
|
27240
|
+
component.imply("millisecond", 0);
|
|
27241
|
+
component.addTag("casualReference/morning");
|
|
27242
|
+
return component;
|
|
27243
|
+
}
|
|
27244
|
+
function afternoon(reference, implyHour = 15) {
|
|
27245
|
+
const component = new ParsingComponents(reference, {});
|
|
27246
|
+
component.imply("meridiem", Meridiem.PM);
|
|
27247
|
+
component.imply("hour", implyHour);
|
|
27248
|
+
component.imply("minute", 0);
|
|
27249
|
+
component.imply("second", 0);
|
|
27250
|
+
component.imply("millisecond", 0);
|
|
27251
|
+
component.addTag("casualReference/afternoon");
|
|
27252
|
+
return component;
|
|
27253
|
+
}
|
|
27254
|
+
function noon(reference) {
|
|
27255
|
+
const component = new ParsingComponents(reference, {});
|
|
27256
|
+
component.imply("meridiem", Meridiem.AM);
|
|
27257
|
+
component.assign("hour", 12);
|
|
27258
|
+
component.imply("minute", 0);
|
|
27259
|
+
component.imply("second", 0);
|
|
27260
|
+
component.imply("millisecond", 0);
|
|
27261
|
+
component.addTag("casualReference/noon");
|
|
27262
|
+
return component;
|
|
27263
|
+
}
|
|
27264
|
+
|
|
27265
|
+
//#endregion
|
|
27266
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualDateParser.js
|
|
27267
|
+
const PATTERN$5 = /(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i;
|
|
27268
|
+
var ENCasualDateParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27269
|
+
innerPattern(context) {
|
|
27270
|
+
return PATTERN$5;
|
|
27271
|
+
}
|
|
27272
|
+
innerExtract(context, match) {
|
|
27273
|
+
let targetDate = context.refDate;
|
|
27274
|
+
const lowerText = match[0].toLowerCase();
|
|
27275
|
+
let component = context.createParsingComponents();
|
|
27276
|
+
switch (lowerText) {
|
|
27277
|
+
case "now":
|
|
27278
|
+
component = now(context.reference);
|
|
27279
|
+
break;
|
|
27280
|
+
case "today":
|
|
27281
|
+
component = today(context.reference);
|
|
27282
|
+
break;
|
|
27283
|
+
case "yesterday":
|
|
27284
|
+
component = yesterday(context.reference);
|
|
27285
|
+
break;
|
|
27286
|
+
case "tomorrow":
|
|
27287
|
+
case "tmr":
|
|
27288
|
+
case "tmrw":
|
|
27289
|
+
component = tomorrow(context.reference);
|
|
27290
|
+
break;
|
|
27291
|
+
case "tonight":
|
|
27292
|
+
component = tonight(context.reference);
|
|
27293
|
+
break;
|
|
27294
|
+
case "overmorrow":
|
|
27295
|
+
component = theDayAfter(context.reference, 2);
|
|
27296
|
+
break;
|
|
27297
|
+
default:
|
|
27298
|
+
if (lowerText.match(/last\s*night/)) {
|
|
27299
|
+
if (targetDate.getHours() > 6) {
|
|
27300
|
+
const previousDay = new Date(targetDate.getTime());
|
|
27301
|
+
previousDay.setDate(previousDay.getDate() - 1);
|
|
27302
|
+
targetDate = previousDay;
|
|
27303
|
+
}
|
|
27304
|
+
assignSimilarDate(component, targetDate);
|
|
27305
|
+
component.imply("hour", 0);
|
|
27306
|
+
}
|
|
27307
|
+
break;
|
|
27308
|
+
}
|
|
27309
|
+
component.addTag("parser/ENCasualDateParser");
|
|
27310
|
+
return component;
|
|
27311
|
+
}
|
|
27312
|
+
};
|
|
27313
|
+
|
|
27314
|
+
//#endregion
|
|
27315
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualTimeParser.js
|
|
27316
|
+
const PATTERN$4 = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;
|
|
27317
|
+
var ENCasualTimeParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27318
|
+
innerPattern() {
|
|
27319
|
+
return PATTERN$4;
|
|
27320
|
+
}
|
|
27321
|
+
innerExtract(context, match) {
|
|
27322
|
+
let component = null;
|
|
27323
|
+
switch (match[1].toLowerCase()) {
|
|
27324
|
+
case "afternoon":
|
|
27325
|
+
component = afternoon(context.reference);
|
|
27326
|
+
break;
|
|
27327
|
+
case "evening":
|
|
27328
|
+
case "night":
|
|
27329
|
+
component = evening(context.reference);
|
|
27330
|
+
break;
|
|
27331
|
+
case "midnight":
|
|
27332
|
+
component = midnight(context.reference);
|
|
27333
|
+
break;
|
|
27334
|
+
case "morning":
|
|
27335
|
+
component = morning(context.reference);
|
|
27336
|
+
break;
|
|
27337
|
+
case "noon":
|
|
27338
|
+
case "midday":
|
|
27339
|
+
component = noon(context.reference);
|
|
27340
|
+
break;
|
|
27341
|
+
}
|
|
27342
|
+
if (component) component.addTag("parser/ENCasualTimeParser");
|
|
27343
|
+
return component;
|
|
27344
|
+
}
|
|
27345
|
+
};
|
|
27346
|
+
|
|
27347
|
+
//#endregion
|
|
27348
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/calculation/weekdays.js
|
|
27349
|
+
function createParsingComponentsAtWeekday(reference, weekday, modifier) {
|
|
27350
|
+
const daysToWeekday = getDaysToWeekday(reference.getDateWithAdjustedTimezone(), weekday, modifier);
|
|
27351
|
+
let components = new ParsingComponents(reference);
|
|
27352
|
+
components = components.addDurationAsImplied({ day: daysToWeekday });
|
|
27353
|
+
components.assign("weekday", weekday);
|
|
27354
|
+
return components;
|
|
27355
|
+
}
|
|
27356
|
+
function getDaysToWeekday(refDate, weekday, modifier) {
|
|
27357
|
+
const refWeekday = refDate.getDay();
|
|
27358
|
+
switch (modifier) {
|
|
27359
|
+
case "this": return getDaysForwardToWeekday(refDate, weekday);
|
|
27360
|
+
case "last": return getBackwardDaysToWeekday(refDate, weekday);
|
|
27361
|
+
case "next":
|
|
27362
|
+
if (refWeekday == Weekday.SUNDAY) return weekday == Weekday.SUNDAY ? 7 : weekday;
|
|
27363
|
+
if (refWeekday == Weekday.SATURDAY) {
|
|
27364
|
+
if (weekday == Weekday.SATURDAY) return 7;
|
|
27365
|
+
if (weekday == Weekday.SUNDAY) return 8;
|
|
27366
|
+
return 1 + weekday;
|
|
27367
|
+
}
|
|
27368
|
+
if (weekday < refWeekday && weekday != Weekday.SUNDAY) return getDaysForwardToWeekday(refDate, weekday);
|
|
27369
|
+
else return getDaysForwardToWeekday(refDate, weekday) + 7;
|
|
27370
|
+
}
|
|
27371
|
+
return getDaysToWeekdayClosest(refDate, weekday);
|
|
27372
|
+
}
|
|
27373
|
+
function getDaysToWeekdayClosest(refDate, weekday) {
|
|
27374
|
+
const backward = getBackwardDaysToWeekday(refDate, weekday);
|
|
27375
|
+
const forward = getDaysForwardToWeekday(refDate, weekday);
|
|
27376
|
+
return forward < -backward ? forward : backward;
|
|
27377
|
+
}
|
|
27378
|
+
function getDaysForwardToWeekday(refDate, weekday) {
|
|
27379
|
+
let forwardCount = weekday - refDate.getDay();
|
|
27380
|
+
if (forwardCount < 0) forwardCount += 7;
|
|
27381
|
+
return forwardCount;
|
|
27382
|
+
}
|
|
27383
|
+
function getBackwardDaysToWeekday(refDate, weekday) {
|
|
27384
|
+
let backwardCount = weekday - refDate.getDay();
|
|
27385
|
+
if (backwardCount >= 0) backwardCount -= 7;
|
|
27386
|
+
return backwardCount;
|
|
27387
|
+
}
|
|
27388
|
+
|
|
27389
|
+
//#endregion
|
|
27390
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENWeekdayParser.js
|
|
27391
|
+
const PATTERN$3 = new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${matchAnyPattern(WEEKDAY_DICTIONARY)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|\$)`, "i");
|
|
27392
|
+
const PREFIX_GROUP = 1;
|
|
27393
|
+
const WEEKDAY_GROUP = 2;
|
|
27394
|
+
const POSTFIX_GROUP = 3;
|
|
27395
|
+
var ENWeekdayParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27396
|
+
innerPattern() {
|
|
27397
|
+
return PATTERN$3;
|
|
27398
|
+
}
|
|
27399
|
+
innerExtract(context, match) {
|
|
27400
|
+
const prefix = match[PREFIX_GROUP];
|
|
27401
|
+
const postfix = match[POSTFIX_GROUP];
|
|
27402
|
+
let modifierWord = prefix || postfix;
|
|
27403
|
+
modifierWord = modifierWord || "";
|
|
27404
|
+
modifierWord = modifierWord.toLowerCase();
|
|
27405
|
+
let modifier = null;
|
|
27406
|
+
if (modifierWord == "last" || modifierWord == "past") modifier = "last";
|
|
27407
|
+
else if (modifierWord == "next") modifier = "next";
|
|
27408
|
+
else if (modifierWord == "this") modifier = "this";
|
|
27409
|
+
const weekday_word = match[WEEKDAY_GROUP].toLowerCase();
|
|
27410
|
+
let weekday;
|
|
27411
|
+
if (WEEKDAY_DICTIONARY[weekday_word] !== void 0) weekday = WEEKDAY_DICTIONARY[weekday_word];
|
|
27412
|
+
else if (weekday_word == "weekend") weekday = modifier == "last" ? Weekday.SUNDAY : Weekday.SATURDAY;
|
|
27413
|
+
else if (weekday_word == "weekday") {
|
|
27414
|
+
const refWeekday = context.reference.getDateWithAdjustedTimezone().getDay();
|
|
27415
|
+
if (refWeekday == Weekday.SUNDAY || refWeekday == Weekday.SATURDAY) weekday = modifier == "last" ? Weekday.FRIDAY : Weekday.MONDAY;
|
|
27416
|
+
else {
|
|
27417
|
+
weekday = refWeekday - 1;
|
|
27418
|
+
weekday = modifier == "last" ? weekday - 1 : weekday + 1;
|
|
27419
|
+
weekday = weekday % 5 + 1;
|
|
27420
|
+
}
|
|
27421
|
+
} else return null;
|
|
27422
|
+
return createParsingComponentsAtWeekday(context.reference, weekday, modifier);
|
|
27423
|
+
}
|
|
27424
|
+
};
|
|
27425
|
+
|
|
27426
|
+
//#endregion
|
|
27427
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENRelativeDateFormatParser.js
|
|
27428
|
+
const PATTERN$2 = new RegExp(`(this|last|past|next|after\\s*this)\\s*(${matchAnyPattern(TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|\$)`, "i");
|
|
27429
|
+
const MODIFIER_WORD_GROUP = 1;
|
|
27430
|
+
const RELATIVE_WORD_GROUP = 2;
|
|
27431
|
+
var ENRelativeDateFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27432
|
+
innerPattern() {
|
|
27433
|
+
return PATTERN$2;
|
|
27434
|
+
}
|
|
27435
|
+
innerExtract(context, match) {
|
|
27436
|
+
const modifier = match[MODIFIER_WORD_GROUP].toLowerCase();
|
|
27437
|
+
const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase();
|
|
27438
|
+
const timeunit = TIME_UNIT_DICTIONARY[unitWord];
|
|
27439
|
+
if (modifier == "next" || modifier.startsWith("after")) {
|
|
27440
|
+
const timeUnits = {};
|
|
27441
|
+
timeUnits[timeunit] = 1;
|
|
27442
|
+
return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
27443
|
+
}
|
|
27444
|
+
if (modifier == "last" || modifier == "past") {
|
|
27445
|
+
const timeUnits = {};
|
|
27446
|
+
timeUnits[timeunit] = -1;
|
|
27447
|
+
return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
27448
|
+
}
|
|
27449
|
+
const components = context.createParsingComponents();
|
|
27450
|
+
let date = new Date(context.reference.instant.getTime());
|
|
27451
|
+
if (unitWord.match(/week/i)) {
|
|
27452
|
+
date.setDate(date.getDate() - date.getDay());
|
|
27453
|
+
components.imply("day", date.getDate());
|
|
27454
|
+
components.imply("month", date.getMonth() + 1);
|
|
27455
|
+
components.imply("year", date.getFullYear());
|
|
27456
|
+
} else if (unitWord.match(/month/i)) {
|
|
27457
|
+
date.setDate(1);
|
|
27458
|
+
components.imply("day", date.getDate());
|
|
27459
|
+
components.assign("year", date.getFullYear());
|
|
27460
|
+
components.assign("month", date.getMonth() + 1);
|
|
27461
|
+
} else if (unitWord.match(/year/i)) {
|
|
27462
|
+
date.setDate(1);
|
|
27463
|
+
date.setMonth(0);
|
|
27464
|
+
components.imply("day", date.getDate());
|
|
27465
|
+
components.imply("month", date.getMonth() + 1);
|
|
27466
|
+
components.assign("year", date.getFullYear());
|
|
27467
|
+
}
|
|
27468
|
+
return components;
|
|
27469
|
+
}
|
|
27470
|
+
};
|
|
27471
|
+
|
|
27472
|
+
//#endregion
|
|
27473
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/common/parsers/SlashDateFormatParser.js
|
|
27474
|
+
const PATTERN$1 = 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");
|
|
27475
|
+
const OPENING_GROUP = 1;
|
|
27476
|
+
const ENDING_GROUP = 5;
|
|
27477
|
+
const FIRST_NUMBERS_GROUP = 2;
|
|
27478
|
+
const SECOND_NUMBERS_GROUP = 3;
|
|
27479
|
+
const YEAR_GROUP$1 = 4;
|
|
27480
|
+
var SlashDateFormatParser = class {
|
|
27481
|
+
groupNumberMonth;
|
|
27482
|
+
groupNumberDay;
|
|
27483
|
+
constructor(littleEndian) {
|
|
27484
|
+
this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP;
|
|
27485
|
+
this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP;
|
|
27486
|
+
}
|
|
27487
|
+
pattern() {
|
|
27488
|
+
return PATTERN$1;
|
|
27489
|
+
}
|
|
27490
|
+
extract(context, match) {
|
|
27491
|
+
const index = match.index + match[OPENING_GROUP].length;
|
|
27492
|
+
const indexEnd = match.index + match[0].length - match[ENDING_GROUP].length;
|
|
27493
|
+
if (index > 0) {
|
|
27494
|
+
if (context.text.substring(0, index).match("\\d/?$")) return;
|
|
27495
|
+
}
|
|
27496
|
+
if (indexEnd < context.text.length) {
|
|
27497
|
+
if (context.text.substring(indexEnd).match("^/?\\d")) return;
|
|
27498
|
+
}
|
|
27499
|
+
const text = context.text.substring(index, indexEnd);
|
|
27500
|
+
if (text.match(/^\d\.\d$/) || text.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) return;
|
|
27501
|
+
if (!match[YEAR_GROUP$1] && text.indexOf("/") < 0) return;
|
|
27502
|
+
const result = context.createParsingResult(index, text);
|
|
27503
|
+
let month = parseInt(match[this.groupNumberMonth]);
|
|
27504
|
+
let day = parseInt(match[this.groupNumberDay]);
|
|
27505
|
+
if (month < 1 || month > 12) {
|
|
27506
|
+
if (month > 12) if (day >= 1 && day <= 12 && month <= 31) [day, month] = [month, day];
|
|
27507
|
+
else return null;
|
|
27508
|
+
}
|
|
27509
|
+
if (day < 1 || day > 31) return null;
|
|
27510
|
+
result.start.assign("day", day);
|
|
27511
|
+
result.start.assign("month", month);
|
|
27512
|
+
if (match[YEAR_GROUP$1]) {
|
|
27513
|
+
const year = findMostLikelyADYear(parseInt(match[YEAR_GROUP$1]));
|
|
27514
|
+
result.start.assign("year", year);
|
|
27515
|
+
} else {
|
|
27516
|
+
const year = findYearClosestToRef(context.refDate, day, month);
|
|
27517
|
+
result.start.imply("year", year);
|
|
27518
|
+
}
|
|
27519
|
+
return result.addTag("parser/SlashDateFormatParser");
|
|
27520
|
+
}
|
|
27521
|
+
};
|
|
27522
|
+
|
|
27523
|
+
//#endregion
|
|
27524
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js
|
|
27525
|
+
const PATTERN = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
|
27526
|
+
const PATTERN_NO_ABBR = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${TIME_UNITS_NO_ABBR_PATTERN})(?=\\W|$)`, "i");
|
|
27527
|
+
var ENTimeUnitCasualRelativeFormatParser = class extends AbstractParserWithWordBoundaryChecking {
|
|
27528
|
+
allowAbbreviations;
|
|
27529
|
+
constructor(allowAbbreviations = true) {
|
|
27530
|
+
super();
|
|
27531
|
+
this.allowAbbreviations = allowAbbreviations;
|
|
27532
|
+
}
|
|
27533
|
+
innerPattern() {
|
|
27534
|
+
return this.allowAbbreviations ? PATTERN : PATTERN_NO_ABBR;
|
|
27535
|
+
}
|
|
27536
|
+
innerExtract(context, match) {
|
|
27537
|
+
const prefix = match[1].toLowerCase();
|
|
27538
|
+
let duration = parseDuration(match[2]);
|
|
27539
|
+
if (!duration) return null;
|
|
27540
|
+
switch (prefix) {
|
|
27541
|
+
case "last":
|
|
27542
|
+
case "past":
|
|
27543
|
+
case "-":
|
|
27544
|
+
duration = reverseDuration(duration);
|
|
27545
|
+
break;
|
|
27546
|
+
}
|
|
27547
|
+
return ParsingComponents.createRelativeFromReference(context.reference, duration);
|
|
27548
|
+
}
|
|
27549
|
+
};
|
|
27550
|
+
|
|
27551
|
+
//#endregion
|
|
27552
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeAfterDateRefiner.js
|
|
27553
|
+
function IsPositiveFollowingReference(result) {
|
|
27554
|
+
return result.text.match(/^[+-]/i) != null;
|
|
27555
|
+
}
|
|
27556
|
+
function IsNegativeFollowingReference(result) {
|
|
27557
|
+
return result.text.match(/^-/i) != null;
|
|
27558
|
+
}
|
|
27559
|
+
var ENMergeRelativeAfterDateRefiner = class extends MergingRefiner {
|
|
27560
|
+
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
27561
|
+
if (!textBetween.match(/^\s*$/i)) return false;
|
|
27562
|
+
return IsPositiveFollowingReference(nextResult) || IsNegativeFollowingReference(nextResult);
|
|
27563
|
+
}
|
|
27564
|
+
mergeResults(textBetween, currentResult, nextResult, context) {
|
|
27565
|
+
let timeUnits = parseDuration(nextResult.text);
|
|
27566
|
+
if (IsNegativeFollowingReference(nextResult)) timeUnits = reverseDuration(timeUnits);
|
|
27567
|
+
const components = ParsingComponents.createRelativeFromReference(ReferenceWithTimezone.fromDate(currentResult.start.date()), timeUnits);
|
|
27568
|
+
return new ParsingResult(currentResult.reference, currentResult.index, `${currentResult.text}${textBetween}${nextResult.text}`, components);
|
|
27569
|
+
}
|
|
27570
|
+
};
|
|
27571
|
+
|
|
27572
|
+
//#endregion
|
|
27573
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeFollowByDateRefiner.js
|
|
27574
|
+
function hasImpliedEarlierReferenceDate(result) {
|
|
27575
|
+
return result.text.match(/\s+(before|from)$/i) != null;
|
|
27576
|
+
}
|
|
27577
|
+
function hasImpliedLaterReferenceDate(result) {
|
|
27578
|
+
return result.text.match(/\s+(after|since)$/i) != null;
|
|
27579
|
+
}
|
|
27580
|
+
var ENMergeRelativeFollowByDateRefiner = class extends MergingRefiner {
|
|
27581
|
+
patternBetween() {
|
|
27582
|
+
return /^\s*$/i;
|
|
27583
|
+
}
|
|
27584
|
+
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
27585
|
+
if (!textBetween.match(this.patternBetween())) return false;
|
|
27586
|
+
if (!hasImpliedEarlierReferenceDate(currentResult) && !hasImpliedLaterReferenceDate(currentResult)) return false;
|
|
27587
|
+
return !!nextResult.start.get("day") && !!nextResult.start.get("month") && !!nextResult.start.get("year");
|
|
27588
|
+
}
|
|
27589
|
+
mergeResults(textBetween, currentResult, nextResult) {
|
|
27590
|
+
let duration = parseDuration(currentResult.text);
|
|
27591
|
+
if (hasImpliedEarlierReferenceDate(currentResult)) duration = reverseDuration(duration);
|
|
27592
|
+
const components = ParsingComponents.createRelativeFromReference(ReferenceWithTimezone.fromDate(nextResult.start.date()), duration);
|
|
27593
|
+
return new ParsingResult(nextResult.reference, currentResult.index, `${currentResult.text}${textBetween}${nextResult.text}`, components);
|
|
27594
|
+
}
|
|
27595
|
+
};
|
|
27596
|
+
|
|
27597
|
+
//#endregion
|
|
27598
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENExtractYearSuffixRefiner.js
|
|
27599
|
+
const YEAR_SUFFIX_PATTERN = new RegExp(`^\\s*(${YEAR_PATTERN})`, "i");
|
|
27600
|
+
const YEAR_GROUP = 1;
|
|
27601
|
+
var ENExtractYearSuffixRefiner = class {
|
|
27602
|
+
refine(context, results) {
|
|
27603
|
+
results.forEach(function(result) {
|
|
27604
|
+
if (!result.start.isDateWithUnknownYear()) return;
|
|
27605
|
+
const suffix = context.text.substring(result.index + result.text.length);
|
|
27606
|
+
const match = YEAR_SUFFIX_PATTERN.exec(suffix);
|
|
27607
|
+
if (!match) return;
|
|
27608
|
+
if (match[0].trim().length <= 3) return;
|
|
27609
|
+
context.debug(() => {
|
|
27610
|
+
console.log(`Extracting year: '${match[0]}' into : ${result}`);
|
|
27611
|
+
});
|
|
27612
|
+
const year = parseYear(match[YEAR_GROUP]);
|
|
27613
|
+
if (result.end != null) result.end.assign("year", year);
|
|
27614
|
+
result.start.assign("year", year);
|
|
27615
|
+
result.text += match[0];
|
|
27616
|
+
});
|
|
27617
|
+
return results;
|
|
27618
|
+
}
|
|
27619
|
+
};
|
|
27620
|
+
|
|
27621
|
+
//#endregion
|
|
27622
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/refiners/ENUnlikelyFormatFilter.js
|
|
27623
|
+
var ENUnlikelyFormatFilter = class extends Filter {
|
|
27624
|
+
constructor() {
|
|
27625
|
+
super();
|
|
27626
|
+
}
|
|
27627
|
+
isValid(context, result) {
|
|
27628
|
+
const text = result.text.trim();
|
|
27629
|
+
if (text === context.text.trim()) return true;
|
|
27630
|
+
if (text.toLowerCase() === "may") {
|
|
27631
|
+
if (!context.text.substring(0, result.index).trim().match(/\b(in)$/i)) {
|
|
27632
|
+
context.debug(() => {
|
|
27633
|
+
console.log(`Removing unlikely result: ${result}`);
|
|
27634
|
+
});
|
|
27635
|
+
return false;
|
|
27636
|
+
}
|
|
27637
|
+
}
|
|
27638
|
+
if (text.toLowerCase().endsWith("the second")) {
|
|
27639
|
+
if (context.text.substring(result.index + result.text.length).trim().length > 0) context.debug(() => {
|
|
27640
|
+
console.log(`Removing unlikely result: ${result}`);
|
|
27641
|
+
});
|
|
27642
|
+
return false;
|
|
27643
|
+
}
|
|
27644
|
+
return true;
|
|
27645
|
+
}
|
|
27646
|
+
};
|
|
27647
|
+
|
|
27648
|
+
//#endregion
|
|
27649
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/configuration.js
|
|
27650
|
+
var ENDefaultConfiguration = class {
|
|
27651
|
+
createCasualConfiguration(littleEndian = false) {
|
|
27652
|
+
const option = this.createConfiguration(false, littleEndian);
|
|
27653
|
+
option.parsers.push(new ENCasualDateParser());
|
|
27654
|
+
option.parsers.push(new ENCasualTimeParser());
|
|
27655
|
+
option.parsers.push(new ENMonthNameParser());
|
|
27656
|
+
option.parsers.push(new ENRelativeDateFormatParser());
|
|
27657
|
+
option.parsers.push(new ENTimeUnitCasualRelativeFormatParser());
|
|
27658
|
+
option.refiners.push(new ENUnlikelyFormatFilter());
|
|
27659
|
+
return option;
|
|
27660
|
+
}
|
|
27661
|
+
createConfiguration(strictMode = true, littleEndian = false) {
|
|
27662
|
+
const options = includeCommonConfiguration({
|
|
27663
|
+
parsers: [
|
|
27664
|
+
new SlashDateFormatParser(littleEndian),
|
|
27665
|
+
new ENTimeUnitWithinFormatParser(strictMode),
|
|
27666
|
+
new ENMonthNameLittleEndianParser(),
|
|
27667
|
+
new ENMonthNameMiddleEndianParser(littleEndian),
|
|
27668
|
+
new ENWeekdayParser(),
|
|
27669
|
+
new ENSlashMonthFormatParser(),
|
|
27670
|
+
new ENTimeExpressionParser(strictMode),
|
|
27671
|
+
new ENTimeUnitAgoFormatParser(strictMode),
|
|
27672
|
+
new ENTimeUnitLaterFormatParser(strictMode)
|
|
27673
|
+
],
|
|
27674
|
+
refiners: [new ENMergeDateTimeRefiner()]
|
|
27675
|
+
}, strictMode);
|
|
27676
|
+
options.parsers.unshift(new ENYearMonthDayParser(strictMode));
|
|
27677
|
+
options.refiners.unshift(new ENMergeRelativeFollowByDateRefiner());
|
|
27678
|
+
options.refiners.unshift(new ENMergeRelativeAfterDateRefiner());
|
|
27679
|
+
options.refiners.unshift(new OverlapRemovalRefiner());
|
|
27680
|
+
options.refiners.push(new ENMergeDateTimeRefiner());
|
|
27681
|
+
options.refiners.push(new ENExtractYearSuffixRefiner());
|
|
27682
|
+
options.refiners.push(new ENMergeDateRangeRefiner());
|
|
27683
|
+
return options;
|
|
27684
|
+
}
|
|
27685
|
+
};
|
|
27686
|
+
|
|
27687
|
+
//#endregion
|
|
27688
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/chrono.js
|
|
27689
|
+
var Chrono = class Chrono {
|
|
27690
|
+
parsers;
|
|
27691
|
+
refiners;
|
|
27692
|
+
defaultConfig = new ENDefaultConfiguration();
|
|
27693
|
+
constructor(configuration) {
|
|
27694
|
+
configuration = configuration || this.defaultConfig.createCasualConfiguration();
|
|
27695
|
+
this.parsers = [...configuration.parsers];
|
|
27696
|
+
this.refiners = [...configuration.refiners];
|
|
27697
|
+
}
|
|
27698
|
+
clone() {
|
|
27699
|
+
return new Chrono({
|
|
27700
|
+
parsers: [...this.parsers],
|
|
27701
|
+
refiners: [...this.refiners]
|
|
27702
|
+
});
|
|
27703
|
+
}
|
|
27704
|
+
parseDate(text, referenceDate, option) {
|
|
27705
|
+
const results = this.parse(text, referenceDate, option);
|
|
27706
|
+
return results.length > 0 ? results[0].start.date() : null;
|
|
27707
|
+
}
|
|
27708
|
+
parse(text, referenceDate, option) {
|
|
27709
|
+
const context = new ParsingContext(text, referenceDate, option);
|
|
27710
|
+
let results = [];
|
|
27711
|
+
this.parsers.forEach((parser) => {
|
|
27712
|
+
const parsedResults = Chrono.executeParser(context, parser);
|
|
27713
|
+
results = results.concat(parsedResults);
|
|
27714
|
+
});
|
|
27715
|
+
results.sort((a, b) => {
|
|
27716
|
+
return a.index - b.index;
|
|
27717
|
+
});
|
|
27718
|
+
this.refiners.forEach(function(refiner) {
|
|
27719
|
+
results = refiner.refine(context, results);
|
|
27720
|
+
});
|
|
27721
|
+
return results;
|
|
27722
|
+
}
|
|
27723
|
+
static executeParser(context, parser) {
|
|
27724
|
+
const results = [];
|
|
27725
|
+
const pattern = parser.pattern(context);
|
|
27726
|
+
const originalText = context.text;
|
|
27727
|
+
let remainingText = context.text;
|
|
27728
|
+
let match = pattern.exec(remainingText);
|
|
27729
|
+
while (match) {
|
|
27730
|
+
const index = match.index + originalText.length - remainingText.length;
|
|
27731
|
+
match.index = index;
|
|
27732
|
+
const result = parser.extract(context, match);
|
|
27733
|
+
if (!result) {
|
|
27734
|
+
remainingText = originalText.substring(match.index + 1);
|
|
27735
|
+
match = pattern.exec(remainingText);
|
|
27736
|
+
continue;
|
|
27737
|
+
}
|
|
27738
|
+
let parsedResult = null;
|
|
27739
|
+
if (result instanceof ParsingResult) parsedResult = result;
|
|
27740
|
+
else if (result instanceof ParsingComponents) {
|
|
27741
|
+
parsedResult = context.createParsingResult(match.index, match[0]);
|
|
27742
|
+
parsedResult.start = result;
|
|
27743
|
+
} else parsedResult = context.createParsingResult(match.index, match[0], result);
|
|
27744
|
+
const parsedIndex = parsedResult.index;
|
|
27745
|
+
const parsedText = parsedResult.text;
|
|
27746
|
+
context.debug(() => console.log(`${parser.constructor.name} extracted (at index=${parsedIndex}) '${parsedText}'`));
|
|
27747
|
+
results.push(parsedResult);
|
|
27748
|
+
remainingText = originalText.substring(parsedIndex + parsedText.length);
|
|
27749
|
+
match = pattern.exec(remainingText);
|
|
27750
|
+
}
|
|
27751
|
+
return results;
|
|
27752
|
+
}
|
|
27753
|
+
};
|
|
27754
|
+
var ParsingContext = class {
|
|
27755
|
+
text;
|
|
27756
|
+
option;
|
|
27757
|
+
reference;
|
|
27758
|
+
refDate;
|
|
27759
|
+
constructor(text, refDate, option) {
|
|
27760
|
+
this.text = text;
|
|
27761
|
+
this.option = option ?? {};
|
|
27762
|
+
this.reference = ReferenceWithTimezone.fromInput(refDate, this.option.timezones);
|
|
27763
|
+
this.refDate = this.reference.instant;
|
|
27764
|
+
}
|
|
27765
|
+
createParsingComponents(components) {
|
|
27766
|
+
if (components instanceof ParsingComponents) return components;
|
|
27767
|
+
return new ParsingComponents(this.reference, components);
|
|
27768
|
+
}
|
|
27769
|
+
createParsingResult(index, textOrEndIndex, startComponents, endComponents) {
|
|
27770
|
+
const text = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex);
|
|
27771
|
+
const start = startComponents ? this.createParsingComponents(startComponents) : null;
|
|
27772
|
+
const end = endComponents ? this.createParsingComponents(endComponents) : null;
|
|
27773
|
+
return new ParsingResult(this.reference, index, text, start, end);
|
|
27774
|
+
}
|
|
27775
|
+
debug(block) {
|
|
27776
|
+
if (this.option.debug) if (this.option.debug instanceof Function) this.option.debug(block);
|
|
27777
|
+
else this.option.debug.debug(block);
|
|
27778
|
+
}
|
|
27779
|
+
};
|
|
27780
|
+
|
|
27781
|
+
//#endregion
|
|
27782
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/locales/en/index.js
|
|
27783
|
+
const configuration = new ENDefaultConfiguration();
|
|
27784
|
+
const casual$1 = new Chrono(configuration.createCasualConfiguration(false));
|
|
27785
|
+
const strict$1 = new Chrono(configuration.createConfiguration(true, false));
|
|
27786
|
+
const GB = new Chrono(configuration.createCasualConfiguration(true));
|
|
27787
|
+
|
|
27788
|
+
//#endregion
|
|
27789
|
+
//#region ../../node_modules/.pnpm/chrono-node@2.9.0/node_modules/chrono-node/dist/esm/index.js
|
|
27790
|
+
const strict = strict$1;
|
|
27791
|
+
const casual = casual$1;
|
|
27792
|
+
function parseDate(text, ref, option) {
|
|
27793
|
+
return casual.parseDate(text, ref, option);
|
|
27794
|
+
}
|
|
27795
|
+
|
|
27796
|
+
//#endregion
|
|
27797
|
+
//#region ../../core/data-resolver/src/evaluators/date-evaluator.ts
|
|
27798
|
+
/**
|
|
27799
|
+
* DateEvaluator: Parses and formats dates using chrono-node.
|
|
27800
|
+
*
|
|
27801
|
+
* Syntax:
|
|
27802
|
+
* {{date:tomorrow|iso}}
|
|
27803
|
+
* {{date: next friday >> dd-mm-yyyy}}
|
|
27804
|
+
* {{date: random 3 months >> yyyy-MM-ddT09:30:00}}
|
|
27805
|
+
* {{date: random}} — random date in next 30 days, ISO output
|
|
27806
|
+
*
|
|
27807
|
+
* Format tokens: yyyy/YYYY, MM (month), dd/DD. Non-token chars are literal.
|
|
27808
|
+
* "iso" format → full ISO 8601 string.
|
|
27809
|
+
*/
|
|
27810
|
+
var DateEvaluator = class {
|
|
27811
|
+
prefix = "date";
|
|
27812
|
+
async evaluate(expression, _scopeValues) {
|
|
27813
|
+
const separatorMatch = expression.match(/^(.*?)\s*(?:>>|\|)\s*(.+)$/);
|
|
27814
|
+
let dateExpr;
|
|
27815
|
+
let format;
|
|
27816
|
+
if (separatorMatch) {
|
|
27817
|
+
dateExpr = separatorMatch[1].trim();
|
|
27818
|
+
format = separatorMatch[2].trim();
|
|
27819
|
+
} else {
|
|
27820
|
+
dateExpr = expression.trim();
|
|
27821
|
+
format = "iso";
|
|
27822
|
+
}
|
|
27823
|
+
const date = this.parseDate(dateExpr);
|
|
27824
|
+
if (!date) throw new Error(`DateEvaluator: could not parse date expression "${dateExpr}"`);
|
|
27825
|
+
return this.formatDate(date, format);
|
|
27826
|
+
}
|
|
27827
|
+
parseDate(expr) {
|
|
27828
|
+
const now = /* @__PURE__ */ new Date();
|
|
27829
|
+
if (expr.toLowerCase().startsWith("random")) {
|
|
27830
|
+
const rest = expr.slice(6).trim();
|
|
27831
|
+
const upperBound = rest ? parseDate(`in ${rest}`, now, { forwardDate: true }) ?? new Date(now.getTime() + 720 * 60 * 60 * 1e3) : new Date(now.getTime() + 720 * 60 * 60 * 1e3);
|
|
27832
|
+
return new Date(now.getTime() + Math.random() * (upperBound.getTime() - now.getTime()));
|
|
27833
|
+
}
|
|
27834
|
+
const monthDay = this.parseMonthWithDay(expr, now);
|
|
27835
|
+
if (monthDay) return monthDay;
|
|
27836
|
+
return parseDate(this.normalizeExpression(expr), now, { forwardDate: true });
|
|
27837
|
+
}
|
|
27838
|
+
normalizeExpression(expr) {
|
|
27839
|
+
return expr.replace(/\b(next|last|previous|this)\s+week\s+(mon|tues?|wed(?:nes)?|thurs?|fri|sat(?:ur)?|sun)(day)?\b/gi, (_match, qualifier, weekdayStem, daySuffix) => `${weekdayStem}${daySuffix ?? ""} ${qualifier} week`);
|
|
27840
|
+
}
|
|
27841
|
+
parseMonthWithDay(expr, now) {
|
|
27842
|
+
const trimmed = expr.trim();
|
|
27843
|
+
const qualifierFirst = trimmed.match(/^(next|last|previous|this)\s+month\s+(\d{1,2})(?:st|nd|rd|th)?$/i);
|
|
27844
|
+
const dayFirst = trimmed.match(/^(\d{1,2})(?:st|nd|rd|th)?\s+(?:of\s+)?(next|last|previous|this)\s+month$/i);
|
|
27845
|
+
const match = qualifierFirst ?? dayFirst;
|
|
27846
|
+
if (!match) return null;
|
|
27847
|
+
const qualifier = (qualifierFirst ? match[1] : match[2]).toLowerCase();
|
|
27848
|
+
const day = parseInt(qualifierFirst ? match[2] : match[1], 10);
|
|
27849
|
+
const monthOffset = qualifier === "next" ? 1 : qualifier === "last" || qualifier === "previous" ? -1 : 0;
|
|
27850
|
+
const target = new Date(now.getFullYear(), now.getMonth() + monthOffset, day, now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
|
|
27851
|
+
if (target.getDate() !== day) return null;
|
|
27852
|
+
return target;
|
|
27853
|
+
}
|
|
27854
|
+
formatDate(date, format) {
|
|
27855
|
+
if (format === "iso") return date.toISOString();
|
|
27856
|
+
const yyyy = date.getFullYear().toString();
|
|
27857
|
+
const MM = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
27858
|
+
const dd = date.getDate().toString().padStart(2, "0");
|
|
27859
|
+
return format.replace(/yyyy/gi, yyyy).replace(/MM/gi, MM).replace(/dd/gi, dd);
|
|
27860
|
+
}
|
|
27861
|
+
};
|
|
27862
|
+
|
|
27863
|
+
//#endregion
|
|
27864
|
+
//#region ../../core/bvt-agent/src/agent/data-resolver.preprocessor.ts
|
|
27865
|
+
function createDataResolverPreprocessor(resolver) {
|
|
27866
|
+
return async (command, context) => {
|
|
27867
|
+
if (!context.resolutionContext) return command;
|
|
27868
|
+
if (command.type === "custom" && typeof command.code === "string" && !command.code.includes("{{")) {
|
|
27869
|
+
const { code, ...rest } = command;
|
|
27870
|
+
return {
|
|
27871
|
+
...await resolver.resolveObject(rest, context.resolutionContext),
|
|
27872
|
+
code
|
|
27873
|
+
};
|
|
27874
|
+
}
|
|
27875
|
+
if (command.type === "custom.code" && typeof command.code === "string") {
|
|
27876
|
+
const { code, ...rest } = command;
|
|
27877
|
+
return {
|
|
27878
|
+
...await resolver.resolveObject(rest, context.resolutionContext),
|
|
27879
|
+
code
|
|
27880
|
+
};
|
|
27881
|
+
}
|
|
27882
|
+
return resolver.resolveObject(command, context.resolutionContext);
|
|
27883
|
+
};
|
|
27884
|
+
}
|
|
27885
|
+
|
|
27886
|
+
//#endregion
|
|
27887
|
+
//#region ../../core/bvt-agent/src/agent/ai-chat-code-token.preprocessor.ts
|
|
27888
|
+
var UnknownKeyError = class extends Error {
|
|
27889
|
+
constructor(key) {
|
|
27890
|
+
super(`Unknown test-data key in ai-chat generated code: ${key}`);
|
|
27891
|
+
this.key = key;
|
|
27892
|
+
this.name = "UnknownKeyError";
|
|
27893
|
+
}
|
|
27894
|
+
toString() {
|
|
27895
|
+
return `${this.name}: ${this.message}`;
|
|
27896
|
+
}
|
|
27897
|
+
};
|
|
27898
|
+
function scanJsContext(source) {
|
|
27899
|
+
const stateAt = Array.from({ length: source.length });
|
|
27900
|
+
const stringLiterals = [];
|
|
27901
|
+
const commentRanges = [];
|
|
27902
|
+
const stack = [];
|
|
27903
|
+
let i = 0;
|
|
27904
|
+
let literalStart = -1;
|
|
25070
27905
|
while (i < source.length) {
|
|
25071
27906
|
const top = stack.length > 0 ? stack[stack.length - 1] : void 0;
|
|
25072
27907
|
const state = top?.state ?? "TEXT";
|
|
@@ -25535,6 +28370,63 @@ function toMatcherValue(value) {
|
|
|
25535
28370
|
default: throw new Error(`Invalid matcher value: unknown type "${value.type}"`);
|
|
25536
28371
|
}
|
|
25537
28372
|
}
|
|
28373
|
+
var BlinqApiRuntime = class {
|
|
28374
|
+
last;
|
|
28375
|
+
constructor(testDataApi) {
|
|
28376
|
+
this.testDataApi = testDataApi;
|
|
28377
|
+
}
|
|
28378
|
+
get lastResponse() {
|
|
28379
|
+
return this.last;
|
|
28380
|
+
}
|
|
28381
|
+
async request(request) {
|
|
28382
|
+
const response = await executeApiRequest(request);
|
|
28383
|
+
this.last = response;
|
|
28384
|
+
if (request.saveAs) await this.testDataApi.setRuntime(request.saveAs, serializeApiResponseForRuntime(response), { dataType: "string" });
|
|
28385
|
+
return response;
|
|
28386
|
+
}
|
|
28387
|
+
async assert(assertion) {
|
|
28388
|
+
if (!this.last) throw new Error("API assertion requires a previous API request command in the same step.");
|
|
28389
|
+
assertApiResponse(this.last, assertion);
|
|
28390
|
+
}
|
|
28391
|
+
};
|
|
28392
|
+
const AI_CHAT_COMMAND_DELAY_MS = 1e3;
|
|
28393
|
+
/**
|
|
28394
|
+
* Build the AI-chat command globals. Mirrors the recorder sandbox:
|
|
28395
|
+
* `onCommandStart` waits the watch-delay then records the command boundary,
|
|
28396
|
+
* `onCommandPass` waits the (overridable) watch-delay, and `checkpoint`
|
|
28397
|
+
* records a labelled marker. In a standalone Playwright run the sandbox's
|
|
28398
|
+
* live-timeline bridge is replaced by Playwright test annotations (via the
|
|
28399
|
+
* injected `annotate` callback).
|
|
28400
|
+
*/
|
|
28401
|
+
function createAiChatGlobals(input) {
|
|
28402
|
+
const { testDataApi, parameters, annotate } = input;
|
|
28403
|
+
return {
|
|
28404
|
+
context: {
|
|
28405
|
+
testData: testDataApi,
|
|
28406
|
+
...parameters.projectId ? { projectId: parameters.projectId } : {},
|
|
28407
|
+
...parameters.environmentId ? { environmentId: parameters.environmentId } : {},
|
|
28408
|
+
...parameters.featureId ? { featureId: parameters.featureId } : {},
|
|
28409
|
+
...parameters.scenarioId ? { scenarioId: parameters.scenarioId } : {},
|
|
28410
|
+
...parameters.executionId ? { executionId: parameters.executionId } : {}
|
|
28411
|
+
},
|
|
28412
|
+
checkpoint(label, data) {
|
|
28413
|
+
annotate({
|
|
28414
|
+
type: "blinq:checkpoint",
|
|
28415
|
+
description: data === void 0 ? label : `${label} ${JSON.stringify(data)}`
|
|
28416
|
+
});
|
|
28417
|
+
},
|
|
28418
|
+
async onCommandStart(label) {
|
|
28419
|
+
await sleep(AI_CHAT_COMMAND_DELAY_MS);
|
|
28420
|
+
annotate({
|
|
28421
|
+
type: "blinq:command-start",
|
|
28422
|
+
description: label
|
|
28423
|
+
});
|
|
28424
|
+
},
|
|
28425
|
+
async onCommandPass(opts) {
|
|
28426
|
+
await sleep(opts && typeof opts.delayMs === "number" && opts.delayMs >= 0 ? opts.delayMs : AI_CHAT_COMMAND_DELAY_MS);
|
|
28427
|
+
}
|
|
28428
|
+
};
|
|
28429
|
+
}
|
|
25538
28430
|
const DEFAULT_PROJECT_ID = "01K00000000000000000000000";
|
|
25539
28431
|
const BLINQ_ENVIRONMENT_ENV_VAR = "BLINQ_ENVIRONMENT";
|
|
25540
28432
|
function toFilePath(target) {
|
|
@@ -25690,6 +28582,7 @@ var PlaywrightRunner = class {
|
|
|
25690
28582
|
scopeManager;
|
|
25691
28583
|
preprocessors;
|
|
25692
28584
|
resolutionContext;
|
|
28585
|
+
apiRuntime;
|
|
25693
28586
|
constructor(options = {}, dependencies = {}) {
|
|
25694
28587
|
this.parameters = options.parameters ?? {};
|
|
25695
28588
|
this.resolutionContext = createResolutionContext(this.parameters);
|
|
@@ -25731,6 +28624,20 @@ var PlaywrightRunner = class {
|
|
|
25731
28624
|
detach() {
|
|
25732
28625
|
this.activePage = null;
|
|
25733
28626
|
}
|
|
28627
|
+
/**
|
|
28628
|
+
* Stateful API helper for `api.action` / `api.assertion` steps. Lazily built
|
|
28629
|
+
* and held for the runner's lifetime so a request and its following assertion
|
|
28630
|
+
* share `lastResponse`. Throws if no test-data provider/context is available
|
|
28631
|
+
* (the `saveAs` path needs it).
|
|
28632
|
+
*/
|
|
28633
|
+
get api() {
|
|
28634
|
+
if (!this.apiRuntime) {
|
|
28635
|
+
const testDataApi = this.tester.testDataApi;
|
|
28636
|
+
if (!testDataApi) throw new Error("bvt.api is unavailable: the runner has no test-data provider/context. API steps require a configured test-data layer.");
|
|
28637
|
+
this.apiRuntime = new BlinqApiRuntime(testDataApi);
|
|
28638
|
+
}
|
|
28639
|
+
return this.apiRuntime;
|
|
28640
|
+
}
|
|
25734
28641
|
async executeCommand(command, parameters = {}) {
|
|
25735
28642
|
if (!this.activePage) throw new Error("PlaywrightRunner has no active page. Call attach(page) before executeCommand.");
|
|
25736
28643
|
this.runtimeContext = {
|
|
@@ -25881,11 +28788,21 @@ function createBlinqTest(options = {}) {
|
|
|
25881
28788
|
runner.attach(page);
|
|
25882
28789
|
const testDataApi = runner.tester.testDataApi;
|
|
25883
28790
|
if (!testDataApi) throw new Error("bvt.testDataApi is unavailable: the runner has no test-data provider/context. Extract steps require a configured test-data layer.");
|
|
28791
|
+
const aiChat = createAiChatGlobals({
|
|
28792
|
+
testDataApi,
|
|
28793
|
+
parameters: runner.parameters,
|
|
28794
|
+
annotate: (annotation) => testInfo.annotations.push(annotation)
|
|
28795
|
+
});
|
|
25884
28796
|
try {
|
|
25885
28797
|
await use({
|
|
25886
28798
|
page,
|
|
25887
28799
|
parameters: runner.parameters,
|
|
25888
28800
|
testDataApi,
|
|
28801
|
+
api: runner.api,
|
|
28802
|
+
aiChatContext: aiChat.context,
|
|
28803
|
+
checkpoint: aiChat.checkpoint,
|
|
28804
|
+
onCommandStart: aiChat.onCommandStart,
|
|
28805
|
+
onCommandPass: aiChat.onCommandPass,
|
|
25889
28806
|
executeCommand: (command, stepParameters) => runner.executeCommand(command, stepParameters),
|
|
25890
28807
|
resolveCommand: (command, stepParameters) => runner.resolveCommand(command, stepParameters),
|
|
25891
28808
|
find: (command) => runner.find(command),
|
|
@@ -25903,5 +28820,5 @@ function createBlinqTest(options = {}) {
|
|
|
25903
28820
|
}
|
|
25904
28821
|
|
|
25905
28822
|
//#endregion
|
|
25906
|
-
export { PlaywrightRunner, TempFileTestDataProvider, createBlinqTest, createBlinqTest as default, toMatcherValue };
|
|
28823
|
+
export { PlaywrightRunner, TempFileTestDataProvider, createAiChatGlobals, createBlinqTest, createBlinqTest as default, toMatcherValue };
|
|
25907
28824
|
//# sourceMappingURL=index.mjs.map
|