@nmshd/content 2.3.1 → 2.3.3

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.
@@ -301,6 +301,79 @@ var AttributeValues;
301
301
 
302
302
  /***/ }),
303
303
 
304
+ /***/ "./dist/attributes/IQLQuery.js":
305
+ /*!*************************************!*\
306
+ !*** ./dist/attributes/IQLQuery.js ***!
307
+ \*************************************/
308
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
309
+
310
+
311
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
312
+ if (k2 === undefined) k2 = k;
313
+ var desc = Object.getOwnPropertyDescriptor(m, k);
314
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
315
+ desc = { enumerable: true, get: function() { return m[k]; } };
316
+ }
317
+ Object.defineProperty(o, k2, desc);
318
+ }) : (function(o, m, k, k2) {
319
+ if (k2 === undefined) k2 = k;
320
+ o[k2] = m[k];
321
+ }));
322
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
323
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
324
+ }) : function(o, v) {
325
+ o["default"] = v;
326
+ });
327
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
328
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
329
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
330
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
331
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
332
+ };
333
+ var __importStar = (this && this.__importStar) || function (mod) {
334
+ if (mod && mod.__esModule) return mod;
335
+ var result = {};
336
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
337
+ __setModuleDefault(result, mod);
338
+ return result;
339
+ };
340
+ var __metadata = (this && this.__metadata) || function (k, v) {
341
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
342
+ };
343
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
344
+ exports.IQLQuery = void 0;
345
+ const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
346
+ const Iql = __importStar(__webpack_require__(/*! @nmshd/iql */ "./node_modules/@nmshd/iql/dist/src/index.js"));
347
+ const AbstractAttributeQuery_1 = __webpack_require__(/*! ./AbstractAttributeQuery */ "./dist/attributes/AbstractAttributeQuery.js");
348
+ let IQLQuery = class IQLQuery extends AbstractAttributeQuery_1.AbstractAttributeQuery {
349
+ static from(value) {
350
+ return this.fromAny(value);
351
+ }
352
+ toJSON(verbose, serializeAsString) {
353
+ return super.toJSON(verbose, serializeAsString);
354
+ }
355
+ };
356
+ __decorate([
357
+ (0, ts_serval_1.serialize)(),
358
+ (0, ts_serval_1.validate)({
359
+ max: 4096,
360
+ customValidator: (v) => {
361
+ const result = Iql.validate(v);
362
+ return !result.isValid
363
+ ? `invalid IQL query at character offset ${result.error?.location.start.column}`
364
+ : undefined;
365
+ }
366
+ }),
367
+ __metadata("design:type", String)
368
+ ], IQLQuery.prototype, "queryString", void 0);
369
+ IQLQuery = __decorate([
370
+ (0, ts_serval_1.type)("IQLQuery")
371
+ ], IQLQuery);
372
+ exports.IQLQuery = IQLQuery;
373
+ //# sourceMappingURL=IQLQuery.js.map
374
+
375
+ /***/ }),
376
+
304
377
  /***/ "./dist/attributes/IdentityAttribute.js":
305
378
  /*!**********************************************!*\
306
379
  !*** ./dist/attributes/IdentityAttribute.js ***!
@@ -2120,14 +2193,15 @@ __exportStar(__webpack_require__(/*! ./AbstractAttributeQuery */ "./dist/attribu
2120
2193
  __exportStar(__webpack_require__(/*! ./AbstractAttributeValue */ "./dist/attributes/AbstractAttributeValue.js"), exports);
2121
2194
  __exportStar(__webpack_require__(/*! ./AbstractComplexValue */ "./dist/attributes/AbstractComplexValue.js"), exports);
2122
2195
  __exportStar(__webpack_require__(/*! ./AttributeValueTypes */ "./dist/attributes/AttributeValueTypes.js"), exports);
2123
- __exportStar(__webpack_require__(/*! ./constants */ "./dist/attributes/constants/index.js"), exports);
2124
- __exportStar(__webpack_require__(/*! ./hints */ "./dist/attributes/hints/index.js"), exports);
2196
+ __exportStar(__webpack_require__(/*! ./IQLQuery */ "./dist/attributes/IQLQuery.js"), exports);
2125
2197
  __exportStar(__webpack_require__(/*! ./IdentityAttribute */ "./dist/attributes/IdentityAttribute.js"), exports);
2126
2198
  __exportStar(__webpack_require__(/*! ./IdentityAttributeQuery */ "./dist/attributes/IdentityAttributeQuery.js"), exports);
2127
2199
  __exportStar(__webpack_require__(/*! ./RelationshipAttribute */ "./dist/attributes/RelationshipAttribute.js"), exports);
2128
2200
  __exportStar(__webpack_require__(/*! ./RelationshipAttributeConfidentiality */ "./dist/attributes/RelationshipAttributeConfidentiality.js"), exports);
2129
2201
  __exportStar(__webpack_require__(/*! ./RelationshipAttributeQuery */ "./dist/attributes/RelationshipAttributeQuery.js"), exports);
2130
2202
  __exportStar(__webpack_require__(/*! ./ThirdPartyRelationshipAttributeQuery */ "./dist/attributes/ThirdPartyRelationshipAttributeQuery.js"), exports);
2203
+ __exportStar(__webpack_require__(/*! ./constants */ "./dist/attributes/constants/index.js"), exports);
2204
+ __exportStar(__webpack_require__(/*! ./hints */ "./dist/attributes/hints/index.js"), exports);
2131
2205
  __exportStar(__webpack_require__(/*! ./types */ "./dist/attributes/types/index.js"), exports);
2132
2206
  //# sourceMappingURL=index.js.map
2133
2207
 
@@ -6147,11 +6221,11 @@ const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-s
6147
6221
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
6148
6222
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
6149
6223
  exports.buildInformation = {
6150
- version: "2.3.1",
6151
- build: "129",
6152
- date: "2023-01-30T12:56:50+00:00",
6153
- commit: "38d80aa128a01aa87fb51340cd5c35a7f4a654e8",
6154
- dependencies: {"@js-soft/logging-abstractions":"^1.0.0","easy-tsnameof":"^3.0.6","mocha-param":"^2.0.1"},
6224
+ version: "2.3.3",
6225
+ build: "132",
6226
+ date: "2023-07-07T14:43:20+00:00",
6227
+ commit: "06d8af0cdd884006ca8818565990ae34f854273b",
6228
+ dependencies: {"@js-soft/logging-abstractions":"^1.0.0","@nmshd/iql":"^0.0.1","easy-tsnameof":"^3.0.6","mocha-param":"^2.0.1"},
6155
6229
  libraries: {
6156
6230
  serval: ts_serval_1.buildInformation,
6157
6231
  crypto: crypto_1.buildInformation,
@@ -6972,7 +7046,7 @@ let ProposeAttributeRequestItem = ProposeAttributeRequestItem_1 = class ProposeA
6972
7046
  }
6973
7047
  };
6974
7048
  __decorate([
6975
- (0, ts_serval_1.serialize)({ unionTypes: [attributes_1.IdentityAttributeQuery, attributes_1.RelationshipAttributeQuery] }),
7049
+ (0, ts_serval_1.serialize)({ unionTypes: [attributes_1.IdentityAttributeQuery, attributes_1.RelationshipAttributeQuery, attributes_1.IQLQuery] }),
6976
7050
  (0, ts_serval_1.validate)(),
6977
7051
  __metadata("design:type", Object)
6978
7052
  ], ProposeAttributeRequestItem.prototype, "query", void 0);
@@ -7065,7 +7139,7 @@ let ReadAttributeRequestItem = class ReadAttributeRequestItem extends RequestIte
7065
7139
  };
7066
7140
  __decorate([
7067
7141
  (0, ts_serval_1.serialize)({
7068
- unionTypes: [attributes_1.IdentityAttributeQuery, attributes_1.RelationshipAttributeQuery, attributes_1.ThirdPartyRelationshipAttributeQuery]
7142
+ unionTypes: [attributes_1.IdentityAttributeQuery, attributes_1.RelationshipAttributeQuery, attributes_1.ThirdPartyRelationshipAttributeQuery, attributes_1.IQLQuery]
7069
7143
  }),
7070
7144
  (0, ts_serval_1.validate)(),
7071
7145
  __metadata("design:type", Object)
@@ -7678,6 +7752,1572 @@ __exportStar(__webpack_require__(/*! ./ResponseItemResult */ "./dist/requests/re
7678
7752
 
7679
7753
  /***/ }),
7680
7754
 
7755
+ /***/ "./node_modules/@nmshd/iql/dist/generated/iql.js":
7756
+ /*!*******************************************************!*\
7757
+ !*** ./node_modules/@nmshd/iql/dist/generated/iql.js ***!
7758
+ \*******************************************************/
7759
+ /***/ ((module) => {
7760
+
7761
+ // Generated by Peggy 3.0.2.
7762
+ //
7763
+ // https://peggyjs.org/
7764
+
7765
+ /**
7766
+ * Takes the path through a nested dict as an array of strings and returns
7767
+ * the value, or a fallback value, if the path does not exist.
7768
+ */
7769
+ function resolvePath(dict, path, fallback = null) {
7770
+ let val = dict;
7771
+ for (const e of path) {
7772
+ if (!Object.keys(val).includes(e)) {
7773
+ return fallback;
7774
+ }
7775
+ val = val[e];
7776
+ }
7777
+ return val;
7778
+ }
7779
+ /**
7780
+ * Generic matching function for attributes.
7781
+ *
7782
+ * attributes: Array of attributes
7783
+ * path: Path to data field to apply matchFn to, represented as an
7784
+ * array of strings. E.g. Foo.bar.baz is represented as ["Foo",
7785
+ * "bar", "baz"].
7786
+ * matchFn: Predicate function applied to the value of the extracted
7787
+ * attribute data field represented by 'path'.
7788
+ * attributeType: See comment below.
7789
+ */
7790
+ function match(attributes, path, matchFn, attributeType = undefined) {
7791
+ const indices = [];
7792
+ for (let ii = 0; ii < attributes.length; ii++) {
7793
+ const val = resolvePath(attributes[ii], path, null);
7794
+ // If attributeType is defined, assert that it matches the attribute's
7795
+ // type. When matching primary fields the mechanism presented by matchFn
7796
+ // below is insufficient as it's not given the full attribute but only
7797
+ // the selected data field.
7798
+ if (attributeType !== undefined && attributes[ii].value["@type"] !== attributeType) {
7799
+ continue;
7800
+ }
7801
+ if (val !== null && matchFn(val)) {
7802
+ indices.push(ii);
7803
+ }
7804
+ }
7805
+ return indices;
7806
+ }
7807
+ /**
7808
+ * Returns the union of two sets (represented as arrays of primitive
7809
+ * elements).
7810
+ */
7811
+ function union(arr1, arr2) {
7812
+ const result = Array.from(new Set([...arr1, ...arr2]));
7813
+ result.sort((a, b) => { return a - b; });
7814
+ return result;
7815
+ }
7816
+ /**
7817
+ * Returns the intersection of two sets (represented as arrays of primitive
7818
+ * elements).
7819
+ */
7820
+ function intersect(b, ...a) {
7821
+ const result = [b, ...a].reduce((p, c) => p.filter(e => c.includes(e)));
7822
+ result.sort((a, b) => { return a - b; });
7823
+ return result;
7824
+ }
7825
+ /**
7826
+ * Returns the asymmetric difference of two sets (represented as arrays of
7827
+ * primitive elements).
7828
+ */
7829
+ function diffAsym(arr1, arr2) {
7830
+ const result = arr1.filter((x) => { return !arr2.includes(x); });
7831
+ result.sort((a, b) => { return a - b; });
7832
+ return result;
7833
+ }
7834
+ function peg$subclass(child, parent) {
7835
+ function C() { this.constructor = child; }
7836
+ C.prototype = parent.prototype;
7837
+ child.prototype = new C();
7838
+ }
7839
+ function peg$SyntaxError(message, expected, found, location) {
7840
+ var self = Error.call(this, message);
7841
+ // istanbul ignore next Check is a necessary evil to support older environments
7842
+ if (Object.setPrototypeOf) {
7843
+ Object.setPrototypeOf(self, peg$SyntaxError.prototype);
7844
+ }
7845
+ self.expected = expected;
7846
+ self.found = found;
7847
+ self.location = location;
7848
+ self.name = "SyntaxError";
7849
+ return self;
7850
+ }
7851
+ peg$subclass(peg$SyntaxError, Error);
7852
+ function peg$padEnd(str, targetLength, padString) {
7853
+ padString = padString || " ";
7854
+ if (str.length > targetLength) {
7855
+ return str;
7856
+ }
7857
+ targetLength -= str.length;
7858
+ padString += padString.repeat(targetLength);
7859
+ return str + padString.slice(0, targetLength);
7860
+ }
7861
+ peg$SyntaxError.prototype.format = function (sources) {
7862
+ var str = "Error: " + this.message;
7863
+ if (this.location) {
7864
+ var src = null;
7865
+ var k;
7866
+ for (k = 0; k < sources.length; k++) {
7867
+ if (sources[k].source === this.location.source) {
7868
+ src = sources[k].text.split(/\r\n|\n|\r/g);
7869
+ break;
7870
+ }
7871
+ }
7872
+ var s = this.location.start;
7873
+ var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
7874
+ ? this.location.source.offset(s)
7875
+ : s;
7876
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
7877
+ if (src) {
7878
+ var e = this.location.end;
7879
+ var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
7880
+ var line = src[s.line - 1];
7881
+ var last = s.line === e.line ? e.column : line.length + 1;
7882
+ var hatLen = (last - s.column) || 1;
7883
+ str += "\n --> " + loc + "\n"
7884
+ + filler + " |\n"
7885
+ + offset_s.line + " | " + line + "\n"
7886
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
7887
+ + peg$padEnd("", hatLen, "^");
7888
+ }
7889
+ else {
7890
+ str += "\n at " + loc;
7891
+ }
7892
+ }
7893
+ return str;
7894
+ };
7895
+ peg$SyntaxError.buildMessage = function (expected, found) {
7896
+ var DESCRIBE_EXPECTATION_FNS = {
7897
+ literal: function (expectation) {
7898
+ return "\"" + literalEscape(expectation.text) + "\"";
7899
+ },
7900
+ class: function (expectation) {
7901
+ var escapedParts = expectation.parts.map(function (part) {
7902
+ return Array.isArray(part)
7903
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
7904
+ : classEscape(part);
7905
+ });
7906
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
7907
+ },
7908
+ any: function () {
7909
+ return "any character";
7910
+ },
7911
+ end: function () {
7912
+ return "end of input";
7913
+ },
7914
+ other: function (expectation) {
7915
+ return expectation.description;
7916
+ }
7917
+ };
7918
+ function hex(ch) {
7919
+ return ch.charCodeAt(0).toString(16).toUpperCase();
7920
+ }
7921
+ function literalEscape(s) {
7922
+ return s
7923
+ .replace(/\\/g, "\\\\")
7924
+ .replace(/"/g, "\\\"")
7925
+ .replace(/\0/g, "\\0")
7926
+ .replace(/\t/g, "\\t")
7927
+ .replace(/\n/g, "\\n")
7928
+ .replace(/\r/g, "\\r")
7929
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
7930
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
7931
+ }
7932
+ function classEscape(s) {
7933
+ return s
7934
+ .replace(/\\/g, "\\\\")
7935
+ .replace(/\]/g, "\\]")
7936
+ .replace(/\^/g, "\\^")
7937
+ .replace(/-/g, "\\-")
7938
+ .replace(/\0/g, "\\0")
7939
+ .replace(/\t/g, "\\t")
7940
+ .replace(/\n/g, "\\n")
7941
+ .replace(/\r/g, "\\r")
7942
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
7943
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
7944
+ }
7945
+ function describeExpectation(expectation) {
7946
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
7947
+ }
7948
+ function describeExpected(expected) {
7949
+ var descriptions = expected.map(describeExpectation);
7950
+ var i, j;
7951
+ descriptions.sort();
7952
+ if (descriptions.length > 0) {
7953
+ for (i = 1, j = 1; i < descriptions.length; i++) {
7954
+ if (descriptions[i - 1] !== descriptions[i]) {
7955
+ descriptions[j] = descriptions[i];
7956
+ j++;
7957
+ }
7958
+ }
7959
+ descriptions.length = j;
7960
+ }
7961
+ switch (descriptions.length) {
7962
+ case 1:
7963
+ return descriptions[0];
7964
+ case 2:
7965
+ return descriptions[0] + " or " + descriptions[1];
7966
+ default:
7967
+ return descriptions.slice(0, -1).join(", ")
7968
+ + ", or "
7969
+ + descriptions[descriptions.length - 1];
7970
+ }
7971
+ }
7972
+ function describeFound(found) {
7973
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
7974
+ }
7975
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
7976
+ };
7977
+ function peg$parse(input, options) {
7978
+ options = options !== undefined ? options : {};
7979
+ var peg$FAILED = {};
7980
+ var peg$source = options.grammarSource;
7981
+ var peg$startRuleFunctions = { Expr: peg$parseExpr };
7982
+ var peg$startRuleFunction = peg$parseExpr;
7983
+ var peg$c0 = "||";
7984
+ var peg$c1 = "&&";
7985
+ var peg$c2 = "!";
7986
+ var peg$c3 = "(";
7987
+ var peg$c4 = ")";
7988
+ var peg$c5 = ".";
7989
+ var peg$c6 = "#";
7990
+ var peg$c7 = "'";
7991
+ var peg$c8 = "\\\\";
7992
+ var peg$c9 = "\\'";
7993
+ var peg$r0 = /^[=><~]/;
7994
+ var peg$r1 = /^[?]/;
7995
+ var peg$r2 = /^[^'\\]/;
7996
+ var peg$r3 = /^[^'\\ ]/;
7997
+ var peg$r4 = /^[a-z]/;
7998
+ var peg$r5 = /^[A-za-z0-9]/;
7999
+ var peg$r6 = /^[A-Z]/;
8000
+ var peg$r7 = /^[A-Za-z0-9]/;
8001
+ var peg$r8 = /^[ \t\n\r]/;
8002
+ var peg$e0 = peg$literalExpectation("||", false);
8003
+ var peg$e1 = peg$literalExpectation("&&", false);
8004
+ var peg$e2 = peg$literalExpectation("!", false);
8005
+ var peg$e3 = peg$literalExpectation("(", false);
8006
+ var peg$e4 = peg$literalExpectation(")", false);
8007
+ var peg$e5 = peg$otherExpectation("metadata field term");
8008
+ var peg$e6 = peg$literalExpectation(".", false);
8009
+ var peg$e7 = peg$otherExpectation("tag term");
8010
+ var peg$e8 = peg$literalExpectation("#", false);
8011
+ var peg$e9 = peg$otherExpectation("primary field term");
8012
+ var peg$e10 = peg$classExpectation(["=", ">", "<", "~"], false, false);
8013
+ var peg$e11 = peg$classExpectation(["?"], false, false);
8014
+ var peg$e12 = peg$literalExpectation("'", false);
8015
+ var peg$e13 = peg$literalExpectation("\\\\", false);
8016
+ var peg$e14 = peg$literalExpectation("\\'", false);
8017
+ var peg$e15 = peg$classExpectation(["'", "\\"], true, false);
8018
+ var peg$e16 = peg$classExpectation(["'", "\\", " "], true, false);
8019
+ var peg$e17 = peg$classExpectation([["a", "z"]], false, false);
8020
+ var peg$e18 = peg$classExpectation([["A", "z"], ["a", "z"], ["0", "9"]], false, false);
8021
+ var peg$e19 = peg$otherExpectation("attribute type");
8022
+ var peg$e20 = peg$classExpectation([["A", "Z"]], false, false);
8023
+ var peg$e21 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"]], false, false);
8024
+ var peg$e22 = peg$otherExpectation("whitespace");
8025
+ var peg$e23 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false);
8026
+ var peg$f0 = function (h, t) {
8027
+ return t.reduce((acc, element) => {
8028
+ return union(acc, element);
8029
+ }, h);
8030
+ };
8031
+ var peg$f1 = function (h, t) {
8032
+ return t.reduce((acc, element) => {
8033
+ return intersect(acc, element);
8034
+ }, h);
8035
+ };
8036
+ var peg$f2 = function (expr) {
8037
+ const allIndices = [...Array(options.attributes.length).keys()];
8038
+ return diffAsym(allIndices, expr);
8039
+ };
8040
+ var peg$f3 = function (pathPrefix, pathSuffix, matchFn) {
8041
+ return match(options.attributes, [pathPrefix, ...pathSuffix], matchFn);
8042
+ };
8043
+ var peg$f4 = function (tag) {
8044
+ return match(options.attributes, ["tags"], (fieldVal) => { return Array.isArray(fieldVal) && fieldVal.includes(tag); });
8045
+ };
8046
+ var peg$f5 = function (attributeType, path, matchFn) {
8047
+ const result = match(options.attributes, ["value", ...path], matchFn, attributeType);
8048
+ return result;
8049
+ };
8050
+ var peg$f6 = function (attributeType, matchFn) {
8051
+ return match(options.attributes, ["value", "value"], matchFn, attributeType);
8052
+ };
8053
+ var peg$f7 = function (attributeType) {
8054
+ // Providing only the attribute type returns attributes whose type
8055
+ // matches. E.g. 'PhoneNumber' will return all attributes whose type is
8056
+ // 'PhoneNumber', regardless of the values of any of their fields.
8057
+ return match(options.attributes, ["value", "@type"], (fieldVal) => { return fieldVal === attributeType; });
8058
+ };
8059
+ var peg$f8 = function (op, rhs) {
8060
+ switch (op) {
8061
+ case "=":
8062
+ return (fieldVal) => { return String(fieldVal) === rhs; };
8063
+ case ">":
8064
+ return (fieldVal) => { return new Date(fieldVal) >= new Date(rhs); };
8065
+ case "<":
8066
+ return (fieldVal) => { return new Date(fieldVal) <= new Date(rhs); };
8067
+ case "~":
8068
+ return (fieldVal) => { return Array.isArray(fieldVal) && fieldVal.includes(rhs); };
8069
+ }
8070
+ };
8071
+ var peg$f9 = function (op) {
8072
+ switch (op) {
8073
+ case "?":
8074
+ return (fieldVal) => { return fieldVal != undefined; };
8075
+ }
8076
+ };
8077
+ var peg$f10 = function (val) {
8078
+ return val.join("").replaceAll("\\\\", "\\").replaceAll("\\'", "'");
8079
+ };
8080
+ var peg$f11 = function (val) {
8081
+ return val.join("").replaceAll("\\\\", "\\").replaceAll("\\'", "'");
8082
+ };
8083
+ var peg$currPos = 0;
8084
+ var peg$savedPos = 0;
8085
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
8086
+ var peg$maxFailPos = 0;
8087
+ var peg$maxFailExpected = [];
8088
+ var peg$silentFails = 0;
8089
+ var peg$result;
8090
+ if ("startRule" in options) {
8091
+ if (!(options.startRule in peg$startRuleFunctions)) {
8092
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
8093
+ }
8094
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
8095
+ }
8096
+ function text() {
8097
+ return input.substring(peg$savedPos, peg$currPos);
8098
+ }
8099
+ function offset() {
8100
+ return peg$savedPos;
8101
+ }
8102
+ function range() {
8103
+ return {
8104
+ source: peg$source,
8105
+ start: peg$savedPos,
8106
+ end: peg$currPos
8107
+ };
8108
+ }
8109
+ function location() {
8110
+ return peg$computeLocation(peg$savedPos, peg$currPos);
8111
+ }
8112
+ function expected(description, location) {
8113
+ location = location !== undefined
8114
+ ? location
8115
+ : peg$computeLocation(peg$savedPos, peg$currPos);
8116
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
8117
+ }
8118
+ function error(message, location) {
8119
+ location = location !== undefined
8120
+ ? location
8121
+ : peg$computeLocation(peg$savedPos, peg$currPos);
8122
+ throw peg$buildSimpleError(message, location);
8123
+ }
8124
+ function peg$literalExpectation(text, ignoreCase) {
8125
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
8126
+ }
8127
+ function peg$classExpectation(parts, inverted, ignoreCase) {
8128
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
8129
+ }
8130
+ function peg$anyExpectation() {
8131
+ return { type: "any" };
8132
+ }
8133
+ function peg$endExpectation() {
8134
+ return { type: "end" };
8135
+ }
8136
+ function peg$otherExpectation(description) {
8137
+ return { type: "other", description: description };
8138
+ }
8139
+ function peg$computePosDetails(pos) {
8140
+ var details = peg$posDetailsCache[pos];
8141
+ var p;
8142
+ if (details) {
8143
+ return details;
8144
+ }
8145
+ else {
8146
+ p = pos - 1;
8147
+ while (!peg$posDetailsCache[p]) {
8148
+ p--;
8149
+ }
8150
+ details = peg$posDetailsCache[p];
8151
+ details = {
8152
+ line: details.line,
8153
+ column: details.column
8154
+ };
8155
+ while (p < pos) {
8156
+ if (input.charCodeAt(p) === 10) {
8157
+ details.line++;
8158
+ details.column = 1;
8159
+ }
8160
+ else {
8161
+ details.column++;
8162
+ }
8163
+ p++;
8164
+ }
8165
+ peg$posDetailsCache[pos] = details;
8166
+ return details;
8167
+ }
8168
+ }
8169
+ function peg$computeLocation(startPos, endPos, offset) {
8170
+ var startPosDetails = peg$computePosDetails(startPos);
8171
+ var endPosDetails = peg$computePosDetails(endPos);
8172
+ var res = {
8173
+ source: peg$source,
8174
+ start: {
8175
+ offset: startPos,
8176
+ line: startPosDetails.line,
8177
+ column: startPosDetails.column
8178
+ },
8179
+ end: {
8180
+ offset: endPos,
8181
+ line: endPosDetails.line,
8182
+ column: endPosDetails.column
8183
+ }
8184
+ };
8185
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
8186
+ res.start = peg$source.offset(res.start);
8187
+ res.end = peg$source.offset(res.end);
8188
+ }
8189
+ return res;
8190
+ }
8191
+ function peg$fail(expected) {
8192
+ if (peg$currPos < peg$maxFailPos) {
8193
+ return;
8194
+ }
8195
+ if (peg$currPos > peg$maxFailPos) {
8196
+ peg$maxFailPos = peg$currPos;
8197
+ peg$maxFailExpected = [];
8198
+ }
8199
+ peg$maxFailExpected.push(expected);
8200
+ }
8201
+ function peg$buildSimpleError(message, location) {
8202
+ return new peg$SyntaxError(message, null, null, location);
8203
+ }
8204
+ function peg$buildStructuredError(expected, found, location) {
8205
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
8206
+ }
8207
+ function peg$parseExpr() {
8208
+ var s0, s1, s2, s3, s4, s5, s6, s7;
8209
+ s0 = peg$currPos;
8210
+ s1 = peg$parseExpr0();
8211
+ if (s1 !== peg$FAILED) {
8212
+ s2 = [];
8213
+ s3 = peg$currPos;
8214
+ s4 = [];
8215
+ s5 = peg$parse_();
8216
+ if (s5 !== peg$FAILED) {
8217
+ while (s5 !== peg$FAILED) {
8218
+ s4.push(s5);
8219
+ s5 = peg$parse_();
8220
+ }
8221
+ }
8222
+ else {
8223
+ s4 = peg$FAILED;
8224
+ }
8225
+ if (s4 !== peg$FAILED) {
8226
+ if (input.substr(peg$currPos, 2) === peg$c0) {
8227
+ s5 = peg$c0;
8228
+ peg$currPos += 2;
8229
+ }
8230
+ else {
8231
+ s5 = peg$FAILED;
8232
+ if (peg$silentFails === 0) {
8233
+ peg$fail(peg$e0);
8234
+ }
8235
+ }
8236
+ if (s5 !== peg$FAILED) {
8237
+ s6 = [];
8238
+ s7 = peg$parse_();
8239
+ if (s7 !== peg$FAILED) {
8240
+ while (s7 !== peg$FAILED) {
8241
+ s6.push(s7);
8242
+ s7 = peg$parse_();
8243
+ }
8244
+ }
8245
+ else {
8246
+ s6 = peg$FAILED;
8247
+ }
8248
+ if (s6 !== peg$FAILED) {
8249
+ s7 = peg$parseExpr0();
8250
+ if (s7 !== peg$FAILED) {
8251
+ s3 = s7;
8252
+ }
8253
+ else {
8254
+ peg$currPos = s3;
8255
+ s3 = peg$FAILED;
8256
+ }
8257
+ }
8258
+ else {
8259
+ peg$currPos = s3;
8260
+ s3 = peg$FAILED;
8261
+ }
8262
+ }
8263
+ else {
8264
+ peg$currPos = s3;
8265
+ s3 = peg$FAILED;
8266
+ }
8267
+ }
8268
+ else {
8269
+ peg$currPos = s3;
8270
+ s3 = peg$FAILED;
8271
+ }
8272
+ while (s3 !== peg$FAILED) {
8273
+ s2.push(s3);
8274
+ s3 = peg$currPos;
8275
+ s4 = [];
8276
+ s5 = peg$parse_();
8277
+ if (s5 !== peg$FAILED) {
8278
+ while (s5 !== peg$FAILED) {
8279
+ s4.push(s5);
8280
+ s5 = peg$parse_();
8281
+ }
8282
+ }
8283
+ else {
8284
+ s4 = peg$FAILED;
8285
+ }
8286
+ if (s4 !== peg$FAILED) {
8287
+ if (input.substr(peg$currPos, 2) === peg$c0) {
8288
+ s5 = peg$c0;
8289
+ peg$currPos += 2;
8290
+ }
8291
+ else {
8292
+ s5 = peg$FAILED;
8293
+ if (peg$silentFails === 0) {
8294
+ peg$fail(peg$e0);
8295
+ }
8296
+ }
8297
+ if (s5 !== peg$FAILED) {
8298
+ s6 = [];
8299
+ s7 = peg$parse_();
8300
+ if (s7 !== peg$FAILED) {
8301
+ while (s7 !== peg$FAILED) {
8302
+ s6.push(s7);
8303
+ s7 = peg$parse_();
8304
+ }
8305
+ }
8306
+ else {
8307
+ s6 = peg$FAILED;
8308
+ }
8309
+ if (s6 !== peg$FAILED) {
8310
+ s7 = peg$parseExpr0();
8311
+ if (s7 !== peg$FAILED) {
8312
+ s3 = s7;
8313
+ }
8314
+ else {
8315
+ peg$currPos = s3;
8316
+ s3 = peg$FAILED;
8317
+ }
8318
+ }
8319
+ else {
8320
+ peg$currPos = s3;
8321
+ s3 = peg$FAILED;
8322
+ }
8323
+ }
8324
+ else {
8325
+ peg$currPos = s3;
8326
+ s3 = peg$FAILED;
8327
+ }
8328
+ }
8329
+ else {
8330
+ peg$currPos = s3;
8331
+ s3 = peg$FAILED;
8332
+ }
8333
+ }
8334
+ peg$savedPos = s0;
8335
+ s0 = peg$f0(s1, s2);
8336
+ }
8337
+ else {
8338
+ peg$currPos = s0;
8339
+ s0 = peg$FAILED;
8340
+ }
8341
+ return s0;
8342
+ }
8343
+ function peg$parseExpr0() {
8344
+ var s0, s1, s2, s3, s4, s5, s6, s7;
8345
+ s0 = peg$currPos;
8346
+ s1 = peg$parseExpr1();
8347
+ if (s1 !== peg$FAILED) {
8348
+ s2 = [];
8349
+ s3 = peg$currPos;
8350
+ s4 = [];
8351
+ s5 = peg$parse_();
8352
+ if (s5 !== peg$FAILED) {
8353
+ while (s5 !== peg$FAILED) {
8354
+ s4.push(s5);
8355
+ s5 = peg$parse_();
8356
+ }
8357
+ }
8358
+ else {
8359
+ s4 = peg$FAILED;
8360
+ }
8361
+ if (s4 !== peg$FAILED) {
8362
+ if (input.substr(peg$currPos, 2) === peg$c1) {
8363
+ s5 = peg$c1;
8364
+ peg$currPos += 2;
8365
+ }
8366
+ else {
8367
+ s5 = peg$FAILED;
8368
+ if (peg$silentFails === 0) {
8369
+ peg$fail(peg$e1);
8370
+ }
8371
+ }
8372
+ if (s5 !== peg$FAILED) {
8373
+ s6 = [];
8374
+ s7 = peg$parse_();
8375
+ if (s7 !== peg$FAILED) {
8376
+ while (s7 !== peg$FAILED) {
8377
+ s6.push(s7);
8378
+ s7 = peg$parse_();
8379
+ }
8380
+ }
8381
+ else {
8382
+ s6 = peg$FAILED;
8383
+ }
8384
+ if (s6 !== peg$FAILED) {
8385
+ s7 = peg$parseExpr1();
8386
+ if (s7 !== peg$FAILED) {
8387
+ s3 = s7;
8388
+ }
8389
+ else {
8390
+ peg$currPos = s3;
8391
+ s3 = peg$FAILED;
8392
+ }
8393
+ }
8394
+ else {
8395
+ peg$currPos = s3;
8396
+ s3 = peg$FAILED;
8397
+ }
8398
+ }
8399
+ else {
8400
+ peg$currPos = s3;
8401
+ s3 = peg$FAILED;
8402
+ }
8403
+ }
8404
+ else {
8405
+ peg$currPos = s3;
8406
+ s3 = peg$FAILED;
8407
+ }
8408
+ while (s3 !== peg$FAILED) {
8409
+ s2.push(s3);
8410
+ s3 = peg$currPos;
8411
+ s4 = [];
8412
+ s5 = peg$parse_();
8413
+ if (s5 !== peg$FAILED) {
8414
+ while (s5 !== peg$FAILED) {
8415
+ s4.push(s5);
8416
+ s5 = peg$parse_();
8417
+ }
8418
+ }
8419
+ else {
8420
+ s4 = peg$FAILED;
8421
+ }
8422
+ if (s4 !== peg$FAILED) {
8423
+ if (input.substr(peg$currPos, 2) === peg$c1) {
8424
+ s5 = peg$c1;
8425
+ peg$currPos += 2;
8426
+ }
8427
+ else {
8428
+ s5 = peg$FAILED;
8429
+ if (peg$silentFails === 0) {
8430
+ peg$fail(peg$e1);
8431
+ }
8432
+ }
8433
+ if (s5 !== peg$FAILED) {
8434
+ s6 = [];
8435
+ s7 = peg$parse_();
8436
+ if (s7 !== peg$FAILED) {
8437
+ while (s7 !== peg$FAILED) {
8438
+ s6.push(s7);
8439
+ s7 = peg$parse_();
8440
+ }
8441
+ }
8442
+ else {
8443
+ s6 = peg$FAILED;
8444
+ }
8445
+ if (s6 !== peg$FAILED) {
8446
+ s7 = peg$parseExpr1();
8447
+ if (s7 !== peg$FAILED) {
8448
+ s3 = s7;
8449
+ }
8450
+ else {
8451
+ peg$currPos = s3;
8452
+ s3 = peg$FAILED;
8453
+ }
8454
+ }
8455
+ else {
8456
+ peg$currPos = s3;
8457
+ s3 = peg$FAILED;
8458
+ }
8459
+ }
8460
+ else {
8461
+ peg$currPos = s3;
8462
+ s3 = peg$FAILED;
8463
+ }
8464
+ }
8465
+ else {
8466
+ peg$currPos = s3;
8467
+ s3 = peg$FAILED;
8468
+ }
8469
+ }
8470
+ peg$savedPos = s0;
8471
+ s0 = peg$f1(s1, s2);
8472
+ }
8473
+ else {
8474
+ peg$currPos = s0;
8475
+ s0 = peg$FAILED;
8476
+ }
8477
+ return s0;
8478
+ }
8479
+ function peg$parseExpr1() {
8480
+ var s0, s1, s2;
8481
+ s0 = peg$currPos;
8482
+ if (input.charCodeAt(peg$currPos) === 33) {
8483
+ s1 = peg$c2;
8484
+ peg$currPos++;
8485
+ }
8486
+ else {
8487
+ s1 = peg$FAILED;
8488
+ if (peg$silentFails === 0) {
8489
+ peg$fail(peg$e2);
8490
+ }
8491
+ }
8492
+ if (s1 !== peg$FAILED) {
8493
+ s2 = peg$parseExpr1();
8494
+ if (s2 !== peg$FAILED) {
8495
+ peg$savedPos = s0;
8496
+ s0 = peg$f2(s2);
8497
+ }
8498
+ else {
8499
+ peg$currPos = s0;
8500
+ s0 = peg$FAILED;
8501
+ }
8502
+ }
8503
+ else {
8504
+ peg$currPos = s0;
8505
+ s0 = peg$FAILED;
8506
+ }
8507
+ if (s0 === peg$FAILED) {
8508
+ s0 = peg$parseExpr2();
8509
+ }
8510
+ return s0;
8511
+ }
8512
+ function peg$parseExpr2() {
8513
+ var s0, s1, s2, s3, s4, s5;
8514
+ s0 = peg$currPos;
8515
+ if (input.charCodeAt(peg$currPos) === 40) {
8516
+ s1 = peg$c3;
8517
+ peg$currPos++;
8518
+ }
8519
+ else {
8520
+ s1 = peg$FAILED;
8521
+ if (peg$silentFails === 0) {
8522
+ peg$fail(peg$e3);
8523
+ }
8524
+ }
8525
+ if (s1 !== peg$FAILED) {
8526
+ s2 = [];
8527
+ s3 = peg$parse_();
8528
+ if (s3 !== peg$FAILED) {
8529
+ while (s3 !== peg$FAILED) {
8530
+ s2.push(s3);
8531
+ s3 = peg$parse_();
8532
+ }
8533
+ }
8534
+ else {
8535
+ s2 = peg$FAILED;
8536
+ }
8537
+ if (s2 !== peg$FAILED) {
8538
+ s3 = peg$parseExpr();
8539
+ if (s3 !== peg$FAILED) {
8540
+ s4 = [];
8541
+ s5 = peg$parse_();
8542
+ if (s5 !== peg$FAILED) {
8543
+ while (s5 !== peg$FAILED) {
8544
+ s4.push(s5);
8545
+ s5 = peg$parse_();
8546
+ }
8547
+ }
8548
+ else {
8549
+ s4 = peg$FAILED;
8550
+ }
8551
+ if (s4 !== peg$FAILED) {
8552
+ if (input.charCodeAt(peg$currPos) === 41) {
8553
+ s5 = peg$c4;
8554
+ peg$currPos++;
8555
+ }
8556
+ else {
8557
+ s5 = peg$FAILED;
8558
+ if (peg$silentFails === 0) {
8559
+ peg$fail(peg$e4);
8560
+ }
8561
+ }
8562
+ if (s5 !== peg$FAILED) {
8563
+ s0 = s3;
8564
+ }
8565
+ else {
8566
+ peg$currPos = s0;
8567
+ s0 = peg$FAILED;
8568
+ }
8569
+ }
8570
+ else {
8571
+ peg$currPos = s0;
8572
+ s0 = peg$FAILED;
8573
+ }
8574
+ }
8575
+ else {
8576
+ peg$currPos = s0;
8577
+ s0 = peg$FAILED;
8578
+ }
8579
+ }
8580
+ else {
8581
+ peg$currPos = s0;
8582
+ s0 = peg$FAILED;
8583
+ }
8584
+ }
8585
+ else {
8586
+ peg$currPos = s0;
8587
+ s0 = peg$FAILED;
8588
+ }
8589
+ if (s0 === peg$FAILED) {
8590
+ s0 = peg$parseTerm();
8591
+ }
8592
+ return s0;
8593
+ }
8594
+ function peg$parseTerm() {
8595
+ var s0;
8596
+ s0 = peg$parsePrimaryFieldTerm();
8597
+ if (s0 === peg$FAILED) {
8598
+ s0 = peg$parseMetadataFieldTerm();
8599
+ if (s0 === peg$FAILED) {
8600
+ s0 = peg$parseTagTerm();
8601
+ }
8602
+ }
8603
+ return s0;
8604
+ }
8605
+ function peg$parseMetadataFieldTerm() {
8606
+ var s0, s1, s2, s3, s4, s5;
8607
+ peg$silentFails++;
8608
+ s0 = peg$currPos;
8609
+ s1 = peg$parsePathSegment();
8610
+ if (s1 !== peg$FAILED) {
8611
+ s2 = [];
8612
+ s3 = peg$currPos;
8613
+ if (input.charCodeAt(peg$currPos) === 46) {
8614
+ s4 = peg$c5;
8615
+ peg$currPos++;
8616
+ }
8617
+ else {
8618
+ s4 = peg$FAILED;
8619
+ if (peg$silentFails === 0) {
8620
+ peg$fail(peg$e6);
8621
+ }
8622
+ }
8623
+ if (s4 !== peg$FAILED) {
8624
+ s5 = peg$parsePathSegment();
8625
+ if (s5 !== peg$FAILED) {
8626
+ s3 = s5;
8627
+ }
8628
+ else {
8629
+ peg$currPos = s3;
8630
+ s3 = peg$FAILED;
8631
+ }
8632
+ }
8633
+ else {
8634
+ peg$currPos = s3;
8635
+ s3 = peg$FAILED;
8636
+ }
8637
+ while (s3 !== peg$FAILED) {
8638
+ s2.push(s3);
8639
+ s3 = peg$currPos;
8640
+ if (input.charCodeAt(peg$currPos) === 46) {
8641
+ s4 = peg$c5;
8642
+ peg$currPos++;
8643
+ }
8644
+ else {
8645
+ s4 = peg$FAILED;
8646
+ if (peg$silentFails === 0) {
8647
+ peg$fail(peg$e6);
8648
+ }
8649
+ }
8650
+ if (s4 !== peg$FAILED) {
8651
+ s5 = peg$parsePathSegment();
8652
+ if (s5 !== peg$FAILED) {
8653
+ s3 = s5;
8654
+ }
8655
+ else {
8656
+ peg$currPos = s3;
8657
+ s3 = peg$FAILED;
8658
+ }
8659
+ }
8660
+ else {
8661
+ peg$currPos = s3;
8662
+ s3 = peg$FAILED;
8663
+ }
8664
+ }
8665
+ s3 = peg$parsePredicate();
8666
+ if (s3 !== peg$FAILED) {
8667
+ peg$savedPos = s0;
8668
+ s0 = peg$f3(s1, s2, s3);
8669
+ }
8670
+ else {
8671
+ peg$currPos = s0;
8672
+ s0 = peg$FAILED;
8673
+ }
8674
+ }
8675
+ else {
8676
+ peg$currPos = s0;
8677
+ s0 = peg$FAILED;
8678
+ }
8679
+ peg$silentFails--;
8680
+ if (s0 === peg$FAILED) {
8681
+ s1 = peg$FAILED;
8682
+ if (peg$silentFails === 0) {
8683
+ peg$fail(peg$e5);
8684
+ }
8685
+ }
8686
+ return s0;
8687
+ }
8688
+ function peg$parseTagTerm() {
8689
+ var s0, s1, s2;
8690
+ peg$silentFails++;
8691
+ s0 = peg$currPos;
8692
+ if (input.charCodeAt(peg$currPos) === 35) {
8693
+ s1 = peg$c6;
8694
+ peg$currPos++;
8695
+ }
8696
+ else {
8697
+ s1 = peg$FAILED;
8698
+ if (peg$silentFails === 0) {
8699
+ peg$fail(peg$e8);
8700
+ }
8701
+ }
8702
+ if (s1 !== peg$FAILED) {
8703
+ s2 = peg$parsePredicateRHS();
8704
+ if (s2 !== peg$FAILED) {
8705
+ peg$savedPos = s0;
8706
+ s0 = peg$f4(s2);
8707
+ }
8708
+ else {
8709
+ peg$currPos = s0;
8710
+ s0 = peg$FAILED;
8711
+ }
8712
+ }
8713
+ else {
8714
+ peg$currPos = s0;
8715
+ s0 = peg$FAILED;
8716
+ }
8717
+ peg$silentFails--;
8718
+ if (s0 === peg$FAILED) {
8719
+ s1 = peg$FAILED;
8720
+ if (peg$silentFails === 0) {
8721
+ peg$fail(peg$e7);
8722
+ }
8723
+ }
8724
+ return s0;
8725
+ }
8726
+ function peg$parsePrimaryFieldTerm() {
8727
+ var s0, s1, s2, s3, s4, s5;
8728
+ peg$silentFails++;
8729
+ s0 = peg$currPos;
8730
+ s1 = peg$parseAttributeType();
8731
+ if (s1 !== peg$FAILED) {
8732
+ s2 = [];
8733
+ s3 = peg$currPos;
8734
+ if (input.charCodeAt(peg$currPos) === 46) {
8735
+ s4 = peg$c5;
8736
+ peg$currPos++;
8737
+ }
8738
+ else {
8739
+ s4 = peg$FAILED;
8740
+ if (peg$silentFails === 0) {
8741
+ peg$fail(peg$e6);
8742
+ }
8743
+ }
8744
+ if (s4 !== peg$FAILED) {
8745
+ s5 = peg$parsePathSegment();
8746
+ if (s5 !== peg$FAILED) {
8747
+ s3 = s5;
8748
+ }
8749
+ else {
8750
+ peg$currPos = s3;
8751
+ s3 = peg$FAILED;
8752
+ }
8753
+ }
8754
+ else {
8755
+ peg$currPos = s3;
8756
+ s3 = peg$FAILED;
8757
+ }
8758
+ if (s3 !== peg$FAILED) {
8759
+ while (s3 !== peg$FAILED) {
8760
+ s2.push(s3);
8761
+ s3 = peg$currPos;
8762
+ if (input.charCodeAt(peg$currPos) === 46) {
8763
+ s4 = peg$c5;
8764
+ peg$currPos++;
8765
+ }
8766
+ else {
8767
+ s4 = peg$FAILED;
8768
+ if (peg$silentFails === 0) {
8769
+ peg$fail(peg$e6);
8770
+ }
8771
+ }
8772
+ if (s4 !== peg$FAILED) {
8773
+ s5 = peg$parsePathSegment();
8774
+ if (s5 !== peg$FAILED) {
8775
+ s3 = s5;
8776
+ }
8777
+ else {
8778
+ peg$currPos = s3;
8779
+ s3 = peg$FAILED;
8780
+ }
8781
+ }
8782
+ else {
8783
+ peg$currPos = s3;
8784
+ s3 = peg$FAILED;
8785
+ }
8786
+ }
8787
+ }
8788
+ else {
8789
+ s2 = peg$FAILED;
8790
+ }
8791
+ if (s2 !== peg$FAILED) {
8792
+ s3 = peg$parsePredicate();
8793
+ if (s3 !== peg$FAILED) {
8794
+ peg$savedPos = s0;
8795
+ s0 = peg$f5(s1, s2, s3);
8796
+ }
8797
+ else {
8798
+ peg$currPos = s0;
8799
+ s0 = peg$FAILED;
8800
+ }
8801
+ }
8802
+ else {
8803
+ peg$currPos = s0;
8804
+ s0 = peg$FAILED;
8805
+ }
8806
+ }
8807
+ else {
8808
+ peg$currPos = s0;
8809
+ s0 = peg$FAILED;
8810
+ }
8811
+ if (s0 === peg$FAILED) {
8812
+ s0 = peg$currPos;
8813
+ s1 = peg$parseAttributeType();
8814
+ if (s1 !== peg$FAILED) {
8815
+ s2 = peg$parsePredicate();
8816
+ if (s2 !== peg$FAILED) {
8817
+ peg$savedPos = s0;
8818
+ s0 = peg$f6(s1, s2);
8819
+ }
8820
+ else {
8821
+ peg$currPos = s0;
8822
+ s0 = peg$FAILED;
8823
+ }
8824
+ }
8825
+ else {
8826
+ peg$currPos = s0;
8827
+ s0 = peg$FAILED;
8828
+ }
8829
+ if (s0 === peg$FAILED) {
8830
+ s0 = peg$currPos;
8831
+ s1 = peg$parseAttributeType();
8832
+ if (s1 !== peg$FAILED) {
8833
+ peg$savedPos = s0;
8834
+ s1 = peg$f7(s1);
8835
+ }
8836
+ s0 = s1;
8837
+ }
8838
+ }
8839
+ peg$silentFails--;
8840
+ if (s0 === peg$FAILED) {
8841
+ s1 = peg$FAILED;
8842
+ if (peg$silentFails === 0) {
8843
+ peg$fail(peg$e9);
8844
+ }
8845
+ }
8846
+ return s0;
8847
+ }
8848
+ function peg$parsePredicate() {
8849
+ var s0, s1, s2;
8850
+ s0 = peg$currPos;
8851
+ if (peg$r0.test(input.charAt(peg$currPos))) {
8852
+ s1 = input.charAt(peg$currPos);
8853
+ peg$currPos++;
8854
+ }
8855
+ else {
8856
+ s1 = peg$FAILED;
8857
+ if (peg$silentFails === 0) {
8858
+ peg$fail(peg$e10);
8859
+ }
8860
+ }
8861
+ if (s1 !== peg$FAILED) {
8862
+ s2 = peg$parsePredicateRHS();
8863
+ if (s2 !== peg$FAILED) {
8864
+ peg$savedPos = s0;
8865
+ s0 = peg$f8(s1, s2);
8866
+ }
8867
+ else {
8868
+ peg$currPos = s0;
8869
+ s0 = peg$FAILED;
8870
+ }
8871
+ }
8872
+ else {
8873
+ peg$currPos = s0;
8874
+ s0 = peg$FAILED;
8875
+ }
8876
+ if (s0 === peg$FAILED) {
8877
+ s0 = peg$currPos;
8878
+ if (peg$r1.test(input.charAt(peg$currPos))) {
8879
+ s1 = input.charAt(peg$currPos);
8880
+ peg$currPos++;
8881
+ }
8882
+ else {
8883
+ s1 = peg$FAILED;
8884
+ if (peg$silentFails === 0) {
8885
+ peg$fail(peg$e11);
8886
+ }
8887
+ }
8888
+ if (s1 !== peg$FAILED) {
8889
+ peg$savedPos = s0;
8890
+ s1 = peg$f9(s1);
8891
+ }
8892
+ s0 = s1;
8893
+ }
8894
+ return s0;
8895
+ }
8896
+ function peg$parsePredicateRHS() {
8897
+ var s0, s1, s2, s3;
8898
+ s0 = peg$currPos;
8899
+ if (input.charCodeAt(peg$currPos) === 39) {
8900
+ s1 = peg$c7;
8901
+ peg$currPos++;
8902
+ }
8903
+ else {
8904
+ s1 = peg$FAILED;
8905
+ if (peg$silentFails === 0) {
8906
+ peg$fail(peg$e12);
8907
+ }
8908
+ }
8909
+ if (s1 !== peg$FAILED) {
8910
+ s2 = [];
8911
+ if (input.substr(peg$currPos, 2) === peg$c8) {
8912
+ s3 = peg$c8;
8913
+ peg$currPos += 2;
8914
+ }
8915
+ else {
8916
+ s3 = peg$FAILED;
8917
+ if (peg$silentFails === 0) {
8918
+ peg$fail(peg$e13);
8919
+ }
8920
+ }
8921
+ if (s3 === peg$FAILED) {
8922
+ if (input.substr(peg$currPos, 2) === peg$c9) {
8923
+ s3 = peg$c9;
8924
+ peg$currPos += 2;
8925
+ }
8926
+ else {
8927
+ s3 = peg$FAILED;
8928
+ if (peg$silentFails === 0) {
8929
+ peg$fail(peg$e14);
8930
+ }
8931
+ }
8932
+ if (s3 === peg$FAILED) {
8933
+ if (peg$r2.test(input.charAt(peg$currPos))) {
8934
+ s3 = input.charAt(peg$currPos);
8935
+ peg$currPos++;
8936
+ }
8937
+ else {
8938
+ s3 = peg$FAILED;
8939
+ if (peg$silentFails === 0) {
8940
+ peg$fail(peg$e15);
8941
+ }
8942
+ }
8943
+ }
8944
+ }
8945
+ while (s3 !== peg$FAILED) {
8946
+ s2.push(s3);
8947
+ if (input.substr(peg$currPos, 2) === peg$c8) {
8948
+ s3 = peg$c8;
8949
+ peg$currPos += 2;
8950
+ }
8951
+ else {
8952
+ s3 = peg$FAILED;
8953
+ if (peg$silentFails === 0) {
8954
+ peg$fail(peg$e13);
8955
+ }
8956
+ }
8957
+ if (s3 === peg$FAILED) {
8958
+ if (input.substr(peg$currPos, 2) === peg$c9) {
8959
+ s3 = peg$c9;
8960
+ peg$currPos += 2;
8961
+ }
8962
+ else {
8963
+ s3 = peg$FAILED;
8964
+ if (peg$silentFails === 0) {
8965
+ peg$fail(peg$e14);
8966
+ }
8967
+ }
8968
+ if (s3 === peg$FAILED) {
8969
+ if (peg$r2.test(input.charAt(peg$currPos))) {
8970
+ s3 = input.charAt(peg$currPos);
8971
+ peg$currPos++;
8972
+ }
8973
+ else {
8974
+ s3 = peg$FAILED;
8975
+ if (peg$silentFails === 0) {
8976
+ peg$fail(peg$e15);
8977
+ }
8978
+ }
8979
+ }
8980
+ }
8981
+ }
8982
+ if (input.charCodeAt(peg$currPos) === 39) {
8983
+ s3 = peg$c7;
8984
+ peg$currPos++;
8985
+ }
8986
+ else {
8987
+ s3 = peg$FAILED;
8988
+ if (peg$silentFails === 0) {
8989
+ peg$fail(peg$e12);
8990
+ }
8991
+ }
8992
+ if (s3 !== peg$FAILED) {
8993
+ peg$savedPos = s0;
8994
+ s0 = peg$f10(s2);
8995
+ }
8996
+ else {
8997
+ peg$currPos = s0;
8998
+ s0 = peg$FAILED;
8999
+ }
9000
+ }
9001
+ else {
9002
+ peg$currPos = s0;
9003
+ s0 = peg$FAILED;
9004
+ }
9005
+ if (s0 === peg$FAILED) {
9006
+ s0 = peg$currPos;
9007
+ s1 = [];
9008
+ if (input.substr(peg$currPos, 2) === peg$c8) {
9009
+ s2 = peg$c8;
9010
+ peg$currPos += 2;
9011
+ }
9012
+ else {
9013
+ s2 = peg$FAILED;
9014
+ if (peg$silentFails === 0) {
9015
+ peg$fail(peg$e13);
9016
+ }
9017
+ }
9018
+ if (s2 === peg$FAILED) {
9019
+ if (input.substr(peg$currPos, 2) === peg$c9) {
9020
+ s2 = peg$c9;
9021
+ peg$currPos += 2;
9022
+ }
9023
+ else {
9024
+ s2 = peg$FAILED;
9025
+ if (peg$silentFails === 0) {
9026
+ peg$fail(peg$e14);
9027
+ }
9028
+ }
9029
+ if (s2 === peg$FAILED) {
9030
+ if (peg$r3.test(input.charAt(peg$currPos))) {
9031
+ s2 = input.charAt(peg$currPos);
9032
+ peg$currPos++;
9033
+ }
9034
+ else {
9035
+ s2 = peg$FAILED;
9036
+ if (peg$silentFails === 0) {
9037
+ peg$fail(peg$e16);
9038
+ }
9039
+ }
9040
+ }
9041
+ }
9042
+ while (s2 !== peg$FAILED) {
9043
+ s1.push(s2);
9044
+ if (input.substr(peg$currPos, 2) === peg$c8) {
9045
+ s2 = peg$c8;
9046
+ peg$currPos += 2;
9047
+ }
9048
+ else {
9049
+ s2 = peg$FAILED;
9050
+ if (peg$silentFails === 0) {
9051
+ peg$fail(peg$e13);
9052
+ }
9053
+ }
9054
+ if (s2 === peg$FAILED) {
9055
+ if (input.substr(peg$currPos, 2) === peg$c9) {
9056
+ s2 = peg$c9;
9057
+ peg$currPos += 2;
9058
+ }
9059
+ else {
9060
+ s2 = peg$FAILED;
9061
+ if (peg$silentFails === 0) {
9062
+ peg$fail(peg$e14);
9063
+ }
9064
+ }
9065
+ if (s2 === peg$FAILED) {
9066
+ if (peg$r3.test(input.charAt(peg$currPos))) {
9067
+ s2 = input.charAt(peg$currPos);
9068
+ peg$currPos++;
9069
+ }
9070
+ else {
9071
+ s2 = peg$FAILED;
9072
+ if (peg$silentFails === 0) {
9073
+ peg$fail(peg$e16);
9074
+ }
9075
+ }
9076
+ }
9077
+ }
9078
+ }
9079
+ peg$savedPos = s0;
9080
+ s1 = peg$f11(s1);
9081
+ s0 = s1;
9082
+ }
9083
+ return s0;
9084
+ }
9085
+ function peg$parsePathSegment() {
9086
+ var s0, s1, s2, s3, s4;
9087
+ s0 = peg$currPos;
9088
+ s1 = peg$currPos;
9089
+ if (peg$r4.test(input.charAt(peg$currPos))) {
9090
+ s2 = input.charAt(peg$currPos);
9091
+ peg$currPos++;
9092
+ }
9093
+ else {
9094
+ s2 = peg$FAILED;
9095
+ if (peg$silentFails === 0) {
9096
+ peg$fail(peg$e17);
9097
+ }
9098
+ }
9099
+ if (s2 !== peg$FAILED) {
9100
+ s3 = [];
9101
+ if (peg$r5.test(input.charAt(peg$currPos))) {
9102
+ s4 = input.charAt(peg$currPos);
9103
+ peg$currPos++;
9104
+ }
9105
+ else {
9106
+ s4 = peg$FAILED;
9107
+ if (peg$silentFails === 0) {
9108
+ peg$fail(peg$e18);
9109
+ }
9110
+ }
9111
+ if (s4 !== peg$FAILED) {
9112
+ while (s4 !== peg$FAILED) {
9113
+ s3.push(s4);
9114
+ if (peg$r5.test(input.charAt(peg$currPos))) {
9115
+ s4 = input.charAt(peg$currPos);
9116
+ peg$currPos++;
9117
+ }
9118
+ else {
9119
+ s4 = peg$FAILED;
9120
+ if (peg$silentFails === 0) {
9121
+ peg$fail(peg$e18);
9122
+ }
9123
+ }
9124
+ }
9125
+ }
9126
+ else {
9127
+ s3 = peg$FAILED;
9128
+ }
9129
+ if (s3 !== peg$FAILED) {
9130
+ s2 = [s2, s3];
9131
+ s1 = s2;
9132
+ }
9133
+ else {
9134
+ peg$currPos = s1;
9135
+ s1 = peg$FAILED;
9136
+ }
9137
+ }
9138
+ else {
9139
+ peg$currPos = s1;
9140
+ s1 = peg$FAILED;
9141
+ }
9142
+ if (s1 !== peg$FAILED) {
9143
+ s0 = input.substring(s0, peg$currPos);
9144
+ }
9145
+ else {
9146
+ s0 = s1;
9147
+ }
9148
+ return s0;
9149
+ }
9150
+ function peg$parseAttributeType() {
9151
+ var s0, s1, s2, s3, s4;
9152
+ peg$silentFails++;
9153
+ s0 = peg$currPos;
9154
+ s1 = peg$currPos;
9155
+ if (peg$r6.test(input.charAt(peg$currPos))) {
9156
+ s2 = input.charAt(peg$currPos);
9157
+ peg$currPos++;
9158
+ }
9159
+ else {
9160
+ s2 = peg$FAILED;
9161
+ if (peg$silentFails === 0) {
9162
+ peg$fail(peg$e20);
9163
+ }
9164
+ }
9165
+ if (s2 !== peg$FAILED) {
9166
+ s3 = [];
9167
+ if (peg$r7.test(input.charAt(peg$currPos))) {
9168
+ s4 = input.charAt(peg$currPos);
9169
+ peg$currPos++;
9170
+ }
9171
+ else {
9172
+ s4 = peg$FAILED;
9173
+ if (peg$silentFails === 0) {
9174
+ peg$fail(peg$e21);
9175
+ }
9176
+ }
9177
+ while (s4 !== peg$FAILED) {
9178
+ s3.push(s4);
9179
+ if (peg$r7.test(input.charAt(peg$currPos))) {
9180
+ s4 = input.charAt(peg$currPos);
9181
+ peg$currPos++;
9182
+ }
9183
+ else {
9184
+ s4 = peg$FAILED;
9185
+ if (peg$silentFails === 0) {
9186
+ peg$fail(peg$e21);
9187
+ }
9188
+ }
9189
+ }
9190
+ s2 = [s2, s3];
9191
+ s1 = s2;
9192
+ }
9193
+ else {
9194
+ peg$currPos = s1;
9195
+ s1 = peg$FAILED;
9196
+ }
9197
+ if (s1 !== peg$FAILED) {
9198
+ s0 = input.substring(s0, peg$currPos);
9199
+ }
9200
+ else {
9201
+ s0 = s1;
9202
+ }
9203
+ peg$silentFails--;
9204
+ if (s0 === peg$FAILED) {
9205
+ s1 = peg$FAILED;
9206
+ if (peg$silentFails === 0) {
9207
+ peg$fail(peg$e19);
9208
+ }
9209
+ }
9210
+ return s0;
9211
+ }
9212
+ function peg$parse_() {
9213
+ var s0, s1;
9214
+ peg$silentFails++;
9215
+ if (peg$r8.test(input.charAt(peg$currPos))) {
9216
+ s0 = input.charAt(peg$currPos);
9217
+ peg$currPos++;
9218
+ }
9219
+ else {
9220
+ s0 = peg$FAILED;
9221
+ if (peg$silentFails === 0) {
9222
+ peg$fail(peg$e23);
9223
+ }
9224
+ }
9225
+ peg$silentFails--;
9226
+ if (s0 === peg$FAILED) {
9227
+ s1 = peg$FAILED;
9228
+ if (peg$silentFails === 0) {
9229
+ peg$fail(peg$e22);
9230
+ }
9231
+ }
9232
+ return s0;
9233
+ }
9234
+ peg$result = peg$startRuleFunction();
9235
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
9236
+ return peg$result;
9237
+ }
9238
+ else {
9239
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
9240
+ peg$fail(peg$endExpectation());
9241
+ }
9242
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
9243
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
9244
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
9245
+ }
9246
+ }
9247
+ module.exports = {
9248
+ SyntaxError: peg$SyntaxError,
9249
+ parse: peg$parse
9250
+ };
9251
+ //# sourceMappingURL=iql.js.map
9252
+
9253
+ /***/ }),
9254
+
9255
+ /***/ "./node_modules/@nmshd/iql/dist/src/index.js":
9256
+ /*!***************************************************!*\
9257
+ !*** ./node_modules/@nmshd/iql/dist/src/index.js ***!
9258
+ \***************************************************/
9259
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9260
+
9261
+
9262
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9263
+ exports.validate = exports.execute = void 0;
9264
+ const iql_js_1 = __webpack_require__(/*! ../generated/iql.js */ "./node_modules/@nmshd/iql/dist/generated/iql.js");
9265
+ /**
9266
+ * Executes IQL query, returning array of indicies of matched attributes in
9267
+ * attribute array.
9268
+ */
9269
+ function execute(iqlQuery, attributes) {
9270
+ return (0, iql_js_1.parse)(iqlQuery, { attributes });
9271
+ }
9272
+ exports.execute = execute;
9273
+ function validate(iqlQuery) {
9274
+ try {
9275
+ (0, iql_js_1.parse)(iqlQuery, { attributes: [] });
9276
+ return { isValid: true };
9277
+ }
9278
+ catch (error) {
9279
+ // FIXME: Is there a cleaner way to catch IQL SyntaxErrors?
9280
+ // For the sake of backwards compatibility peggy compiles to old
9281
+ // js without the use of classes. Thus the static type inference
9282
+ // for the SyntaxError type is severely crippled.
9283
+ if (error instanceof iql_js_1.SyntaxError) {
9284
+ const err = error; // see FIXME above.
9285
+ return {
9286
+ isValid: false,
9287
+ error: {
9288
+ message: err.message,
9289
+ location: {
9290
+ start: err.location.start,
9291
+ end: err.location.end
9292
+ }
9293
+ }
9294
+ };
9295
+ }
9296
+ return {
9297
+ isValid: false,
9298
+ error: {
9299
+ message: JSON.stringify(error),
9300
+ location: {
9301
+ start: {
9302
+ column: 0,
9303
+ line: 0,
9304
+ offset: 0
9305
+ },
9306
+ end: {
9307
+ column: 0,
9308
+ line: 0,
9309
+ offset: 0
9310
+ }
9311
+ }
9312
+ }
9313
+ };
9314
+ }
9315
+ }
9316
+ exports.validate = validate;
9317
+ //# sourceMappingURL=index.js.map
9318
+
9319
+ /***/ }),
9320
+
7681
9321
  /***/ "./node_modules/easy-tsnameof/dist/easy-tsnameof.esm.js":
7682
9322
  /*!**************************************************************!*\
7683
9323
  !*** ./node_modules/easy-tsnameof/dist/easy-tsnameof.esm.js ***!
@@ -7687,7 +9327,7 @@ __exportStar(__webpack_require__(/*! ./ResponseItemResult */ "./dist/requests/re
7687
9327
  __webpack_require__.r(__webpack_exports__);
7688
9328
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7689
9329
  /* harmony export */ "default": () => (/* binding */ nameOf),
7690
- /* harmony export */ "nameOf": () => (/* binding */ nameOf)
9330
+ /* harmony export */ nameOf: () => (/* binding */ nameOf)
7691
9331
  /* harmony export */ });
7692
9332
  var _handlersConfig;
7693
9333
 
@@ -8520,8 +10160,12 @@ class PolyNumberFormatter {
8520
10160
  class PolyDateFormatter {
8521
10161
  constructor(dt, intl, opts) {
8522
10162
  this.opts = opts;
10163
+ this.originalZone = undefined;
8523
10164
  let z = undefined;
8524
- if (dt.zone.isUniversal) {
10165
+ if (this.opts.timeZone) {
10166
+ // Don't apply any workarounds if a timeZone is explicitly provided in opts
10167
+ this.dt = dt;
10168
+ } else if (dt.zone.type === "fixed") {
8525
10169
  // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.
8526
10170
  // That is why fixed-offset TZ is set to that unless it is:
8527
10171
  // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.
@@ -8534,25 +10178,27 @@ class PolyDateFormatter {
8534
10178
  z = offsetZ;
8535
10179
  this.dt = dt;
8536
10180
  } else {
8537
- // Not all fixed-offset zones like Etc/+4:30 are present in tzdata.
8538
- // So we have to make do. Two cases:
8539
- // 1. The format options tell us to show the zone. We can't do that, so the best
8540
- // we can do is format the date in UTC.
8541
- // 2. The format options don't tell us to show the zone. Then we can adjust them
8542
- // the time and tell the formatter to show it to us in UTC, so that the time is right
8543
- // and the bad zone doesn't show up.
10181
+ // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so
10182
+ // we manually apply the offset and substitute the zone as needed.
8544
10183
  z = "UTC";
8545
- if (opts.timeZoneName) {
8546
- this.dt = dt;
8547
- } else {
8548
- this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
8549
- }
10184
+ this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
10185
+ minutes: dt.offset
10186
+ });
10187
+ this.originalZone = dt.zone;
8550
10188
  }
8551
10189
  } else if (dt.zone.type === "system") {
8552
10190
  this.dt = dt;
8553
- } else {
10191
+ } else if (dt.zone.type === "iana") {
8554
10192
  this.dt = dt;
8555
10193
  z = dt.zone.name;
10194
+ } else {
10195
+ // Custom zones can have any offset / offsetName so we just manually
10196
+ // apply the offset and substitute the zone as needed.
10197
+ z = "UTC";
10198
+ this.dt = dt.setZone("UTC").plus({
10199
+ minutes: dt.offset
10200
+ });
10201
+ this.originalZone = dt.zone;
8556
10202
  }
8557
10203
  const intlOpts = {
8558
10204
  ...this.opts
@@ -8561,10 +10207,34 @@ class PolyDateFormatter {
8561
10207
  this.dtf = getCachedDTF(intl, intlOpts);
8562
10208
  }
8563
10209
  format() {
10210
+ if (this.originalZone) {
10211
+ // If we have to substitute in the actual zone name, we have to use
10212
+ // formatToParts so that the timezone can be replaced.
10213
+ return this.formatToParts().map(({
10214
+ value
10215
+ }) => value).join("");
10216
+ }
8564
10217
  return this.dtf.format(this.dt.toJSDate());
8565
10218
  }
8566
10219
  formatToParts() {
8567
- return this.dtf.formatToParts(this.dt.toJSDate());
10220
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
10221
+ if (this.originalZone) {
10222
+ return parts.map(part => {
10223
+ if (part.type === "timeZoneName") {
10224
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
10225
+ locale: this.dt.locale,
10226
+ format: this.opts.timeZoneName
10227
+ });
10228
+ return {
10229
+ ...part,
10230
+ value: offsetName
10231
+ };
10232
+ } else {
10233
+ return part;
10234
+ }
10235
+ });
10236
+ }
10237
+ return parts;
8568
10238
  }
8569
10239
  resolvedOptions() {
8570
10240
  return this.dtf.resolvedOptions();
@@ -9223,7 +10893,10 @@ function objToLocalTS(obj) {
9223
10893
  // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that
9224
10894
  if (obj.year < 100 && obj.year >= 0) {
9225
10895
  d = new Date(d);
9226
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
10896
+ // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not
10897
+ // so if obj.year is in 99, but obj.day makes it roll over into year 100,
10898
+ // the calculations done by Date.UTC are using year 2000 - which is incorrect
10899
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
9227
10900
  }
9228
10901
  return +d;
9229
10902
  }
@@ -9455,6 +11128,9 @@ class Formatter {
9455
11128
  return new Formatter(locale, opts);
9456
11129
  }
9457
11130
  static parseFormat(fmt) {
11131
+ // white-space is always considered a literal in user-provided formats
11132
+ // the " " token has a special meaning (see unitForToken)
11133
+
9458
11134
  let current = null,
9459
11135
  currentFull = "",
9460
11136
  bracketed = false;
@@ -9464,7 +11140,7 @@ class Formatter {
9464
11140
  if (c === "'") {
9465
11141
  if (currentFull.length > 0) {
9466
11142
  splits.push({
9467
- literal: bracketed,
11143
+ literal: bracketed || /^\s+$/.test(currentFull),
9468
11144
  val: currentFull
9469
11145
  });
9470
11146
  }
@@ -9478,7 +11154,7 @@ class Formatter {
9478
11154
  } else {
9479
11155
  if (currentFull.length > 0) {
9480
11156
  splits.push({
9481
- literal: false,
11157
+ literal: /^\s+$/.test(currentFull),
9482
11158
  val: currentFull
9483
11159
  });
9484
11160
  }
@@ -9488,7 +11164,7 @@ class Formatter {
9488
11164
  }
9489
11165
  if (currentFull.length > 0) {
9490
11166
  splits.push({
9491
- literal: bracketed,
11167
+ literal: bracketed || /^\s+$/.test(currentFull),
9492
11168
  val: currentFull
9493
11169
  });
9494
11170
  }
@@ -11216,7 +12892,7 @@ class Interval {
11216
12892
  if (!this.isValid) return NaN;
11217
12893
  const start = this.start.startOf(unit),
11218
12894
  end = this.end.startOf(unit);
11219
- return Math.floor(end.diff(start, unit).get(unit)) + 1;
12895
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
11220
12896
  }
11221
12897
 
11222
12898
  /**
@@ -12082,6 +13758,10 @@ function unitForToken(token, loc) {
12082
13758
  // because we don't have any way to figure out what they are
12083
13759
  case "z":
12084
13760
  return simple(/[a-z_+-/]{1,256}?/i);
13761
+ // this special-case "token" represents a place where a macro-token expanded into a white-space literal
13762
+ // in this case we accept any non-newline white-space
13763
+ case " ":
13764
+ return simple(/[^\S\n\r]/);
12085
13765
  default:
12086
13766
  return literal(t);
12087
13767
  }
@@ -12136,9 +13816,10 @@ function tokenForPart(part, formatOpts) {
12136
13816
  value
12137
13817
  } = part;
12138
13818
  if (type === "literal") {
13819
+ const isSpace = /^\s+$/.test(value);
12139
13820
  return {
12140
- literal: true,
12141
- val: value
13821
+ literal: !isSpace,
13822
+ val: isSpace ? " " : value
12142
13823
  };
12143
13824
  }
12144
13825
  const style = formatOpts[type];
@@ -12613,7 +14294,7 @@ function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOff
12613
14294
  setZone,
12614
14295
  zone
12615
14296
  } = opts;
12616
- if (parsed && Object.keys(parsed).length !== 0) {
14297
+ if (parsed && Object.keys(parsed).length !== 0 || parsedZone) {
12617
14298
  const interpretationZone = parsedZone || zone,
12618
14299
  inst = DateTime.fromObject(parsed, {
12619
14300
  ...opts,
@@ -14660,7 +16341,7 @@ function friendlyDateTime(dateTimeish) {
14660
16341
  }
14661
16342
  }
14662
16343
 
14663
- const VERSION = "3.2.1";
16344
+ const VERSION = "3.3.0";
14664
16345
 
14665
16346
  exports.DateTime = DateTime;
14666
16347
  exports.Duration = Duration;