swagger-client 3.27.3 → 3.27.5

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.
@@ -41,19 +41,21 @@ __webpack_require__.r(__webpack_exports__);
41
41
  /* harmony export */ self: () => (/* binding */ self)
42
42
  /* harmony export */ });
43
43
  /* harmony import */ var cookie__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57427);
44
- /* harmony import */ var is_plain_object__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(58270);
45
- /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(19500);
46
- /* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(83748);
44
+ /* harmony import */ var is_plain_object__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(58270);
45
+ /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(49408);
46
+ /* harmony import */ var _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(19500);
47
+ /* harmony import */ var _swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(83748);
47
48
  /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3832);
48
49
  /* harmony import */ var _http_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51670);
49
50
  /* harmony import */ var _http_serializers_request_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29382);
50
51
  /* harmony import */ var _swagger2_parameter_builders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(90520);
51
- /* harmony import */ var _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42276);
52
- /* harmony import */ var _oas3_build_request_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53044);
53
- /* harmony import */ var _swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77768);
54
- /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(47555);
52
+ /* harmony import */ var _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42276);
53
+ /* harmony import */ var _oas3_build_request_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(53044);
54
+ /* harmony import */ var _swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(77768);
55
+ /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47555);
55
56
  /* harmony import */ var _helpers_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(50324);
56
- /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(50918);
57
+ /* harmony import */ var _helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(50918);
58
+
57
59
 
58
60
 
59
61
 
@@ -95,7 +97,7 @@ const parseURIReference = uriReference => {
95
97
  };
96
98
  }
97
99
  };
98
- class OperationNotFoundError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_7__["default"] {}
100
+ class OperationNotFoundError extends _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_8__["default"] {}
99
101
  const findParametersWithName = (name, parameters) => parameters.filter(p => p.name === name);
100
102
 
101
103
  // removes parameters that have duplicate 'in' and 'name' properties
@@ -139,7 +141,7 @@ function execute({
139
141
  const http = userHttp || fetch || _http_index_js__WEBPACK_IMPORTED_MODULE_2__["default"]; // Default to _our_ http
140
142
 
141
143
  if (pathName && method && !operationId) {
142
- operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_8__["default"])(pathName, method);
144
+ operationId = (0,_helpers_index_js__WEBPACK_IMPORTED_MODULE_9__["default"])(pathName, method);
143
145
  }
144
146
  const request = self.buildRequest({
145
147
  spec,
@@ -149,7 +151,7 @@ function execute({
149
151
  http,
150
152
  ...extras
151
153
  });
152
- if (request.body && ((0,is_plain_object__WEBPACK_IMPORTED_MODULE_9__.isPlainObject)(request.body) || Array.isArray(request.body))) {
154
+ if (request.body && ((0,is_plain_object__WEBPACK_IMPORTED_MODULE_10__.isPlainObject)(request.body) || Array.isArray(request.body))) {
153
155
  request.body = JSON.stringify(request.body);
154
156
  }
155
157
 
@@ -177,11 +179,11 @@ function buildRequest(options) {
177
179
  parameters,
178
180
  parameterBuilders
179
181
  } = options;
180
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__.isOpenAPI3)(spec);
182
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__.isOpenAPI3)(spec);
181
183
  if (!parameterBuilders) {
182
184
  // user did not provide custom parameter builders
183
185
  if (specIsOAS3) {
184
- parameterBuilders = _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_11__;
186
+ parameterBuilders = _oas3_parameter_builders_js__WEBPACK_IMPORTED_MODULE_5__;
185
187
  } else {
186
188
  parameterBuilders = _swagger2_parameter_builders_js__WEBPACK_IMPORTED_MODULE_4__["default"];
187
189
  }
@@ -289,7 +291,8 @@ function buildRequest(options) {
289
291
  parameter,
290
292
  value,
291
293
  operation,
292
- spec
294
+ spec,
295
+ pathName
293
296
  });
294
297
  }
295
298
  });
@@ -300,10 +303,10 @@ function buildRequest(options) {
300
303
  operation
301
304
  };
302
305
  if (specIsOAS3) {
303
- req = (0,_oas3_build_request_js__WEBPACK_IMPORTED_MODULE_5__["default"])(versionSpecificOptions, req);
306
+ req = (0,_oas3_build_request_js__WEBPACK_IMPORTED_MODULE_6__["default"])(versionSpecificOptions, req);
304
307
  } else {
305
308
  // If not OAS3, then treat as Swagger2.
306
- req = (0,_swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_6__["default"])(versionSpecificOptions, req);
309
+ req = (0,_swagger2_build_request_js__WEBPACK_IMPORTED_MODULE_7__["default"])(versionSpecificOptions, req);
307
310
  }
308
311
 
309
312
  // If the cookie convenience object exists in our request,
@@ -332,7 +335,7 @@ const stripNonAlpha = str => str ? str.replace(/\W/g, '') : null;
332
335
 
333
336
  // be careful when modifying this! it is a publicly-exposed method.
334
337
  function baseUrl(obj) {
335
- const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_10__.isOpenAPI3)(obj.spec);
338
+ const specIsOAS3 = (0,_helpers_openapi_predicates_js__WEBPACK_IMPORTED_MODULE_11__.isOpenAPI3)(obj.spec);
336
339
  return specIsOAS3 ? oas3BaseUrl(obj) : swagger2BaseUrl(obj);
337
340
  }
338
341
  const isNonEmptyServerList = value => Array.isArray(value) && value.length > 0;
@@ -375,7 +378,7 @@ function oas3BaseUrl({
375
378
  // variable is defined in server
376
379
  const variableDefinition = selectedServerObj.variables[variable];
377
380
  const variableValue = serverVariables[variable] || variableDefinition.default;
378
- const re = new RegExp(`{${variable}}`, 'g');
381
+ const re = new RegExp(`{${(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_13__["default"])(variable)}}`, 'g');
379
382
  selectedServerUrl = selectedServerUrl.replace(re, variableValue);
380
383
  }
381
384
  });
@@ -384,7 +387,7 @@ function oas3BaseUrl({
384
387
  }
385
388
  function buildOas3UrlWithContext(ourUrl = '', contextUrl = '') {
386
389
  // relative server url should be resolved against contextUrl
387
- const parsedUrl = ourUrl && contextUrl ? parseURIReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_13__.resolve(contextUrl, ourUrl)) : parseURIReference(ourUrl);
390
+ const parsedUrl = ourUrl && contextUrl ? parseURIReference(_swagger_api_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_14__.resolve(contextUrl, ourUrl)) : parseURIReference(ourUrl);
388
391
  const parsedContextUrl = parseURIReference(contextUrl);
389
392
  const computedScheme = stripNonAlpha(parsedUrl.protocol) || stripNonAlpha(parsedContextUrl.protocol);
390
393
  const computedHost = parsedUrl.host || parsedContextUrl.host;
@@ -667,14 +670,17 @@ __webpack_require__.r(__webpack_exports__);
667
670
  /* harmony export */ path: () => (/* binding */ path),
668
671
  /* harmony export */ query: () => (/* binding */ query)
669
672
  /* harmony export */ });
670
- /* harmony import */ var _style_serializer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33838);
671
- /* harmony import */ var _content_serializer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27986);
673
+ /* harmony import */ var openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61546);
674
+ /* harmony import */ var _style_serializer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33838);
675
+ /* harmony import */ var _content_serializer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27986);
676
+
672
677
 
673
678
 
674
679
  function path({
675
680
  req,
676
681
  value,
677
- parameter
682
+ parameter,
683
+ pathName
678
684
  }) {
679
685
  const {
680
686
  name,
@@ -683,19 +689,28 @@ function path({
683
689
  content
684
690
  } = parameter;
685
691
  if (value === undefined) return;
692
+ let resolvedPathname;
686
693
  if (content) {
687
694
  const effectiveMediaType = Object.keys(content)[0];
688
- req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)));
695
+ resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
696
+ [name]: value
697
+ }, {
698
+ encoder: val => (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(val, effectiveMediaType))
699
+ });
689
700
  } else {
690
- const styledValue = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
691
- key: parameter.name,
692
- value,
693
- style: style || 'simple',
694
- explode: explode || false,
695
- escape: 'reserved'
701
+ resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
702
+ [name]: value
703
+ }, {
704
+ encoder: val => (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
705
+ key: parameter.name,
706
+ value: val,
707
+ style: style || 'simple',
708
+ explode: explode || false,
709
+ escape: 'reserved'
710
+ })
696
711
  });
697
- req.url = req.url.replace(new RegExp(`{${name}}`, 'g'), styledValue);
698
712
  }
713
+ req.url = req.url.replace(pathName, resolvedPathname);
699
714
  }
700
715
  function query({
701
716
  req,
@@ -705,7 +720,7 @@ function query({
705
720
  req.query = req.query || {};
706
721
  if (value !== undefined && parameter.content) {
707
722
  const effectiveMediaType = Object.keys(parameter.content)[0];
708
- const serializedValue = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType);
723
+ const serializedValue = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType);
709
724
  if (serializedValue) {
710
725
  req.query[parameter.name] = serializedValue;
711
726
  } else if (parameter.allowEmptyValue) {
@@ -753,11 +768,11 @@ function header({
753
768
  }
754
769
  if (value !== undefined && parameter.content) {
755
770
  const effectiveMediaType = Object.keys(parameter.content)[0];
756
- req.headers[parameter.name] = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType);
771
+ req.headers[parameter.name] = (0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType);
757
772
  return;
758
773
  }
759
774
  if (value !== undefined && !(Array.isArray(value) && value.length === 0)) {
760
- req.headers[parameter.name] = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
775
+ req.headers[parameter.name] = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
761
776
  key: parameter.name,
762
777
  value,
763
778
  style: parameter.style || 'simple',
@@ -775,12 +790,12 @@ function cookie({
775
790
  const type = typeof value;
776
791
  if (value !== undefined && parameter.content) {
777
792
  const effectiveMediaType = Object.keys(parameter.content)[0];
778
- req.headers.Cookie = `${parameter.name}=${(0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)}`;
793
+ req.headers.Cookie = `${parameter.name}=${(0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value, effectiveMediaType)}`;
779
794
  return;
780
795
  }
781
796
  if (value !== undefined && !(Array.isArray(value) && value.length === 0)) {
782
797
  const prefix = type === 'object' && !Array.isArray(value) && parameter.explode ? '' : `${parameter.name}=`;
783
- req.headers.Cookie = prefix + (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
798
+ req.headers.Cookie = prefix + (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])({
784
799
  key: parameter.name,
785
800
  value,
786
801
  escape: false,
@@ -1085,6 +1100,9 @@ __webpack_require__.r(__webpack_exports__);
1085
1100
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1086
1101
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1087
1102
  /* harmony export */ });
1103
+ /* harmony import */ var openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61546);
1104
+
1105
+
1088
1106
  // These functions will update the request.
1089
1107
  // They'll be given {req, value, paramter, spec, operation}.
1090
1108
 
@@ -1148,10 +1166,14 @@ function headerBuilder({
1148
1166
  function pathBuilder({
1149
1167
  req,
1150
1168
  value,
1151
- parameter
1169
+ parameter,
1170
+ pathName
1152
1171
  }) {
1153
1172
  if (value !== undefined) {
1154
- req.url = req.url.replace(new RegExp(`{${parameter.name}}`, 'g'), encodeURIComponent(value));
1173
+ const resolvedPathname = (0,openapi_path_templating__WEBPACK_IMPORTED_MODULE_0__.resolve)(pathName, {
1174
+ [parameter.name]: value
1175
+ });
1176
+ req.url = req.url.replace(pathName, resolvedPathname);
1155
1177
  }
1156
1178
  }
1157
1179
 
@@ -39013,6 +39035,1250 @@ const unsanitize = uri => {
39013
39035
  return decodeURI(uri);
39014
39036
  };
39015
39037
 
39038
+ /***/ }),
39039
+
39040
+ /***/ 16646:
39041
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
39042
+
39043
+ "use strict";
39044
+ __webpack_require__.r(__webpack_exports__);
39045
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39046
+ /* harmony export */ Ast: () => (/* binding */ Ast),
39047
+ /* harmony export */ Parser: () => (/* binding */ Parser),
39048
+ /* harmony export */ Stats: () => (/* binding */ Stats),
39049
+ /* harmony export */ Trace: () => (/* binding */ Trace),
39050
+ /* harmony export */ identifiers: () => (/* binding */ identifiers),
39051
+ /* harmony export */ utilities: () => (/* binding */ utilities)
39052
+ /* harmony export */ });
39053
+ /* *************************************************************************************
39054
+ * copyright: Copyright (c) 2023 Lowell D. Thomas, all rights reserved
39055
+ * license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)
39056
+ *
39057
+ * Redistribution and use in source and binary forms, with or without
39058
+ * modification, are permitted provided that the following conditions are met:
39059
+ *
39060
+ * 1. Redistributions of source code must retain the above copyright notice, this
39061
+ * list of conditions and the following disclaimer.
39062
+ *
39063
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
39064
+ * this list of conditions and the following disclaimer in the documentation
39065
+ * and/or other materials provided with the distribution.
39066
+ *
39067
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39068
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39069
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39070
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
39071
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
39072
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39073
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39074
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39075
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39076
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39077
+ *
39078
+ * ********************************************************************************* */
39079
+
39080
+
39081
+ const Parser = function fnparser() {
39082
+ const id = identifiers;
39083
+ const utils = utilities;
39084
+ const p = this;
39085
+ const thisFileName = 'parser.js: Parser(): ';
39086
+ const systemData = function systemData() {
39087
+ this.state = id.ACTIVE;
39088
+ this.phraseLength = 0;
39089
+ this.refresh = () => {
39090
+ this.state = id.ACTIVE;
39091
+ this.phraseLength = 0;
39092
+ };
39093
+ };
39094
+ p.ast = undefined;
39095
+ p.stats = undefined;
39096
+ p.trace = undefined;
39097
+ p.callbacks = [];
39098
+ let lookAhead = 0;
39099
+ let treeDepth = 0;
39100
+ let maxTreeDepth = 0;
39101
+ let nodeHits = 0;
39102
+ let maxMatched = 0;
39103
+ let rules = undefined;
39104
+ let udts = undefined;
39105
+ let opcodes = undefined;
39106
+ let chars = undefined;
39107
+ let sysData = new systemData();
39108
+ let ruleCallbacks = undefined;
39109
+ let udtCallbacks = undefined;
39110
+ let userData = undefined;
39111
+ const clear = () => {
39112
+ lookAhead = 0;
39113
+ treeDepth = 0;
39114
+ maxTreeDepth = 0;
39115
+ nodeHits = 0;
39116
+ maxMatched = 0;
39117
+ rules = undefined;
39118
+ udts = undefined;
39119
+ opcodes = undefined;
39120
+ chars = undefined;
39121
+ sysData.refresh();
39122
+ ruleCallbacks = undefined;
39123
+ udtCallbacks = undefined;
39124
+ userData = undefined;
39125
+ };
39126
+
39127
+ const initializeCallbacks = () => {
39128
+ const functionName = `${thisFileName}initializeCallbacks(): `;
39129
+ let i;
39130
+ ruleCallbacks = [];
39131
+ udtCallbacks = [];
39132
+ for (i = 0; i < rules.length; i += 1) {
39133
+ ruleCallbacks[i] = undefined;
39134
+ }
39135
+ for (i = 0; i < udts.length; i += 1) {
39136
+ udtCallbacks[i] = undefined;
39137
+ }
39138
+ let func;
39139
+ const list = [];
39140
+ for (i = 0; i < rules.length; i += 1) {
39141
+ list.push(rules[i].lower);
39142
+ }
39143
+ for (i = 0; i < udts.length; i += 1) {
39144
+ list.push(udts[i].lower);
39145
+ }
39146
+ for (const index in p.callbacks) {
39147
+ i = list.indexOf(index.toLowerCase());
39148
+ if (i < 0) {
39149
+ throw new Error(`${functionName}syntax callback '${index}' not a rule or udt name`);
39150
+ }
39151
+ func = p.callbacks[index] ? p.callbacks[index] : undefined;
39152
+ if (typeof func === 'function' || func === undefined) {
39153
+ if (i < rules.length) {
39154
+ ruleCallbacks[i] = func;
39155
+ } else {
39156
+ udtCallbacks[i - rules.length] = func;
39157
+ }
39158
+ } else {
39159
+ throw new Error(`${functionName}syntax callback[${index}] must be function reference or falsy)`);
39160
+ }
39161
+ }
39162
+ };
39163
+
39164
+ p.parse = (grammar, startName, inputString, callbackData) => {
39165
+ const functionName = `${thisFileName}parse(): `;
39166
+ clear();
39167
+ chars = utils.stringToChars(inputString);
39168
+ rules = grammar.rules;
39169
+ udts = grammar.udts;
39170
+ const lower = startName.toLowerCase();
39171
+ let startIndex = undefined;
39172
+ for (const i in rules) {
39173
+ if (lower === rules[i].lower) {
39174
+ startIndex = rules[i].index;
39175
+ break;
39176
+ }
39177
+ }
39178
+ if (startIndex === undefined) {
39179
+ throw new Error(`${functionName}start rule name '${startRule}' not recognized`);
39180
+ }
39181
+ initializeCallbacks();
39182
+ if (p.trace) {
39183
+ p.trace.init(rules, udts, chars);
39184
+ }
39185
+ if (p.stats) {
39186
+ p.stats.init(rules, udts);
39187
+ }
39188
+ if (p.ast) {
39189
+ p.ast.init(rules, udts, chars);
39190
+ }
39191
+ userData = callbackData;
39192
+ /* create a dummy opcode for the start rule */
39193
+ opcodes = [
39194
+ {
39195
+ type: id.RNM,
39196
+ index: startIndex,
39197
+ },
39198
+ ];
39199
+ /* execute the start rule */
39200
+ opExecute(0, 0);
39201
+ opcodes = undefined;
39202
+ /* test and return the sysData */
39203
+ let success = false;
39204
+ switch (sysData.state) {
39205
+ case id.ACTIVE:
39206
+ throw new Error(`${functionName}final state should never be 'ACTIVE'`);
39207
+ case id.NOMATCH:
39208
+ success = false;
39209
+ break;
39210
+ case id.EMPTY:
39211
+ case id.MATCH:
39212
+ if (sysData.phraseLength === chars.length) {
39213
+ success = true;
39214
+ } else {
39215
+ success = false;
39216
+ }
39217
+ break;
39218
+ default:
39219
+ throw new Error('unrecognized state');
39220
+ }
39221
+ return {
39222
+ success,
39223
+ state: sysData.state,
39224
+ stateName: id.idName(sysData.state),
39225
+ length: chars.length,
39226
+ matched: sysData.phraseLength,
39227
+ maxMatched,
39228
+ maxTreeDepth,
39229
+ nodeHits,
39230
+ };
39231
+ };
39232
+ // The `ALT` operator.<br>
39233
+ // Executes its child nodes, from left to right, until it finds a match.
39234
+ // Fails if *all* of its child nodes fail.
39235
+ const opALT = (opIndex, phraseIndex) => {
39236
+ const op = opcodes[opIndex];
39237
+ for (let i = 0; i < op.children.length; i += 1) {
39238
+ opExecute(op.children[i], phraseIndex);
39239
+ if (sysData.state !== id.NOMATCH) {
39240
+ break;
39241
+ }
39242
+ }
39243
+ };
39244
+ // The `CAT` operator.<br>
39245
+ // Executes all of its child nodes, from left to right,
39246
+ // concatenating the matched phrases.
39247
+ // Fails if *any* child nodes fail.
39248
+ const opCAT = (opIndex, phraseIndex) => {
39249
+ let success;
39250
+ let astLength;
39251
+ let catCharIndex;
39252
+ let catPhrase;
39253
+ const op = opcodes[opIndex];
39254
+ if (p.ast) {
39255
+ astLength = p.ast.getLength();
39256
+ }
39257
+ success = true;
39258
+ catCharIndex = phraseIndex;
39259
+ catPhrase = 0;
39260
+ for (let i = 0; i < op.children.length; i += 1) {
39261
+ opExecute(op.children[i], catCharIndex);
39262
+ if (sysData.state === id.NOMATCH) {
39263
+ success = false;
39264
+ break;
39265
+ } else {
39266
+ catCharIndex += sysData.phraseLength;
39267
+ catPhrase += sysData.phraseLength;
39268
+ }
39269
+ }
39270
+ if (success) {
39271
+ sysData.state = catPhrase === 0 ? id.EMPTY : id.MATCH;
39272
+ sysData.phraseLength = catPhrase;
39273
+ } else {
39274
+ sysData.state = id.NOMATCH;
39275
+ sysData.phraseLength = 0;
39276
+ if (p.ast) {
39277
+ p.ast.setLength(astLength);
39278
+ }
39279
+ }
39280
+ };
39281
+ // The `REP` operator.<br>
39282
+ // Repeatedly executes its single child node,
39283
+ // concatenating each of the matched phrases found.
39284
+ // The number of repetitions executed and its final sysData depends
39285
+ // on its `min` & `max` repetition values.
39286
+ const opREP = (opIndex, phraseIndex) => {
39287
+ let astLength;
39288
+ let repCharIndex;
39289
+ let repPhrase;
39290
+ let repCount;
39291
+ const op = opcodes[opIndex];
39292
+ if (op.max === 0) {
39293
+ // this is an empty-string acceptor
39294
+ // deprecated: use the TLS empty string operator, "", instead
39295
+ sysData.state = id.EMPTY;
39296
+ sysData.phraseLength = 0;
39297
+ return;
39298
+ }
39299
+ repCharIndex = phraseIndex;
39300
+ repPhrase = 0;
39301
+ repCount = 0;
39302
+ if (p.ast) {
39303
+ astLength = p.ast.getLength();
39304
+ }
39305
+ while (1) {
39306
+ if (repCharIndex >= chars.length) {
39307
+ /* exit on end of input string */
39308
+ break;
39309
+ }
39310
+ opExecute(opIndex + 1, repCharIndex);
39311
+ if (sysData.state === id.NOMATCH) {
39312
+ /* always end if the child node fails */
39313
+ break;
39314
+ }
39315
+ if (sysData.state === id.EMPTY) {
39316
+ /* REP always succeeds when the child node returns an empty phrase */
39317
+ /* this may not seem obvious, but that's the way it works out */
39318
+ break;
39319
+ }
39320
+ repCount += 1;
39321
+ repPhrase += sysData.phraseLength;
39322
+ repCharIndex += sysData.phraseLength;
39323
+ if (repCount === op.max) {
39324
+ /* end on maxed out reps */
39325
+ break;
39326
+ }
39327
+ }
39328
+ /* evaluate the match count according to the min, max values */
39329
+ if (sysData.state === id.EMPTY) {
39330
+ sysData.state = repPhrase === 0 ? id.EMPTY : id.MATCH;
39331
+ sysData.phraseLength = repPhrase;
39332
+ } else if (repCount >= op.min) {
39333
+ sysData.state = repPhrase === 0 ? id.EMPTY : id.MATCH;
39334
+ sysData.phraseLength = repPhrase;
39335
+ } else {
39336
+ sysData.state = id.NOMATCH;
39337
+ sysData.phraseLength = 0;
39338
+ if (p.ast) {
39339
+ p.ast.setLength(astLength);
39340
+ }
39341
+ }
39342
+ };
39343
+ // Validate the callback function's returned sysData values.
39344
+ // It's the user's responsibility to get them right
39345
+ // but `RNM` fails if not.
39346
+ const validateRnmCallbackResult = (rule, sysData, charsLeft, down) => {
39347
+ if (sysData.phraseLength > charsLeft) {
39348
+ let str = `${thisFileName}opRNM(${rule.name}): callback function error: `;
39349
+ str += `sysData.phraseLength: ${sysData.phraseLength}`;
39350
+ str += ` must be <= remaining chars: ${charsLeft}`;
39351
+ throw new Error(str);
39352
+ }
39353
+ switch (sysData.state) {
39354
+ case id.ACTIVE:
39355
+ if (!down) {
39356
+ throw new Error(
39357
+ `${thisFileName}opRNM(${rule.name}): callback function return error. ACTIVE state not allowed.`
39358
+ );
39359
+ }
39360
+ break;
39361
+ case id.EMPTY:
39362
+ sysData.phraseLength = 0;
39363
+ break;
39364
+ case id.MATCH:
39365
+ if (sysData.phraseLength === 0) {
39366
+ sysData.state = id.EMPTY;
39367
+ }
39368
+ break;
39369
+ case id.NOMATCH:
39370
+ sysData.phraseLength = 0;
39371
+ break;
39372
+ default:
39373
+ throw new Error(
39374
+ `${thisFileName}opRNM(${rule.name}): callback function return error. Unrecognized return state: ${sysData.state}`
39375
+ );
39376
+ }
39377
+ };
39378
+ // The `RNM` operator.<br>
39379
+ // This operator will acts as a root node for a parse tree branch below and
39380
+ // returns the matched phrase to its parent.
39381
+ // However, its larger responsibility is handling user-defined callback functions and `AST` nodes.
39382
+ // Note that the `AST` is a separate object, but `RNM` calls its functions to create its nodes.
39383
+ const opRNM = (opIndex, phraseIndex) => {
39384
+ let astLength;
39385
+ let astDefined;
39386
+ let savedOpcodes;
39387
+ const op = opcodes[opIndex];
39388
+ const rule = rules[op.index];
39389
+ const callback = ruleCallbacks[rule.index];
39390
+ /* ignore AST in look ahead (AND or NOT operator above) */
39391
+ if (!lookAhead) {
39392
+ astDefined = p.ast && p.ast.ruleDefined(op.index);
39393
+ if (astDefined) {
39394
+ astLength = p.ast.getLength();
39395
+ p.ast.down(op.index, rules[op.index].name);
39396
+ }
39397
+ }
39398
+ if (callback) {
39399
+ /* call user's callback going down the parse tree*/
39400
+ const charsLeft = chars.length - phraseIndex;
39401
+ callback(sysData, chars, phraseIndex, userData);
39402
+ validateRnmCallbackResult(rule, sysData, charsLeft, true);
39403
+ if (sysData.state === id.ACTIVE) {
39404
+ savedOpcodes = opcodes;
39405
+ opcodes = rule.opcodes;
39406
+ opExecute(0, phraseIndex);
39407
+ opcodes = savedOpcodes;
39408
+ /* call user's callback going up the parse tree*/
39409
+ callback(sysData, chars, phraseIndex, userData);
39410
+ validateRnmCallbackResult(rule, sysData, charsLeft, false);
39411
+ } /* implied else clause: just accept the callback sysData - RNM acting as UDT */
39412
+ } else {
39413
+ /* no callback - just execute the rule */
39414
+ savedOpcodes = opcodes;
39415
+ opcodes = rule.opcodes;
39416
+ opExecute(0, phraseIndex, sysData);
39417
+ opcodes = savedOpcodes;
39418
+ }
39419
+ if (!lookAhead) {
39420
+ /* end AST */
39421
+ if (astDefined) {
39422
+ if (sysData.state === id.NOMATCH) {
39423
+ p.ast.setLength(astLength);
39424
+ } else {
39425
+ p.ast.up(op.index, rule.name, phraseIndex, sysData.phraseLength);
39426
+ }
39427
+ }
39428
+ }
39429
+ };
39430
+ // The `TRG` operator.<br>
39431
+ // Succeeds if the single first character of the phrase is
39432
+ // within the `min - max` range.
39433
+ const opTRG = (opIndex, phraseIndex) => {
39434
+ const op = opcodes[opIndex];
39435
+ sysData.state = id.NOMATCH;
39436
+ if (phraseIndex < chars.length) {
39437
+ if (op.min <= chars[phraseIndex] && chars[phraseIndex] <= op.max) {
39438
+ sysData.state = id.MATCH;
39439
+ sysData.phraseLength = 1;
39440
+ }
39441
+ }
39442
+ };
39443
+ // The `TBS` operator.<br>
39444
+ // Matches its pre-defined phrase against the input string.
39445
+ // All characters must match exactly.
39446
+ // Case-sensitive literal strings (`'string'` & `%s"string"`) are translated to `TBS`
39447
+ // operators by `apg`.
39448
+ // Phrase length of zero is not allowed.
39449
+ // Empty phrases can only be defined with `TLS` operators.
39450
+ const opTBS = (opIndex, phraseIndex) => {
39451
+ const op = opcodes[opIndex];
39452
+ const len = op.string.length;
39453
+ sysData.state = id.NOMATCH;
39454
+ if (phraseIndex + len <= chars.length) {
39455
+ for (let i = 0; i < len; i += 1) {
39456
+ if (chars[phraseIndex + i] !== op.string[i]) {
39457
+ return;
39458
+ }
39459
+ }
39460
+ sysData.state = id.MATCH;
39461
+ sysData.phraseLength = len;
39462
+ } /* implied else NOMATCH */
39463
+ };
39464
+ // The `TLS` operator.<br>
39465
+ // Matches its pre-defined phrase against the input string.
39466
+ // A case-insensitive match is attempted for ASCII alphbetical characters.
39467
+ // `TLS` is the only operator that explicitly allows empty phrases.
39468
+ // `apg` will fail for empty `TBS`, case-sensitive strings (`''`) or
39469
+ // zero repetitions (`0*0RuleName` or `0RuleName`).
39470
+ const opTLS = (opIndex, phraseIndex) => {
39471
+ let code;
39472
+ const op = opcodes[opIndex];
39473
+ sysData.state = id.NOMATCH;
39474
+ const len = op.string.length;
39475
+ if (len === 0) {
39476
+ /* EMPTY match allowed for TLS */
39477
+ sysData.state = id.EMPTY;
39478
+ return;
39479
+ }
39480
+ if (phraseIndex + len <= chars.length) {
39481
+ for (let i = 0; i < len; i += 1) {
39482
+ code = chars[phraseIndex + i];
39483
+ if (code >= 65 && code <= 90) {
39484
+ code += 32;
39485
+ }
39486
+ if (code !== op.string[i]) {
39487
+ return;
39488
+ }
39489
+ }
39490
+ sysData.state = id.MATCH;
39491
+ sysData.phraseLength = len;
39492
+ } /* implied else NOMATCH */
39493
+ };
39494
+ // Validate the callback function's returned sysData values.
39495
+ // It's the user's responsibility to get it right but `UDT` fails if not.
39496
+ const validateUdtCallbackResult = (udt, sysData, charsLeft) => {
39497
+ if (sysData.phraseLength > charsLeft) {
39498
+ let str = `${thisFileName}opUDT(${udt.name}): callback function error: `;
39499
+ str += `sysData.phraseLength: ${sysData.phraseLength}`;
39500
+ str += ` must be <= remaining chars: ${charsLeft}`;
39501
+ throw new Error(str);
39502
+ }
39503
+ switch (sysData.state) {
39504
+ case id.ACTIVE:
39505
+ throw new Error(`${thisFileName}opUDT(${udt.name}) ACTIVE state return not allowed.`);
39506
+ case id.EMPTY:
39507
+ if (udt.empty) {
39508
+ sysData.phraseLength = 0;
39509
+ } else {
39510
+ throw new Error(`${thisFileName}opUDT(${udt.name}) may not return EMPTY.`);
39511
+ }
39512
+ break;
39513
+ case id.MATCH:
39514
+ if (sysData.phraseLength === 0) {
39515
+ if (udt.empty) {
39516
+ sysData.state = id.EMPTY;
39517
+ } else {
39518
+ throw new Error(`${thisFileName}opUDT(${udt.name}) may not return EMPTY.`);
39519
+ }
39520
+ }
39521
+ break;
39522
+ case id.NOMATCH:
39523
+ sysData.phraseLength = 0;
39524
+ break;
39525
+ default:
39526
+ throw new Error(
39527
+ `${thisFileName}opUDT(${udt.name}): callback function return error. Unrecognized return state: ${sysData.state}`
39528
+ );
39529
+ }
39530
+ };
39531
+ // The `UDT` operator.<br>
39532
+ // Simply calls the user's callback function, but operates like `RNM` with regard to the `AST`
39533
+ // and back referencing.
39534
+ // There is some ambiguity here. `UDT`s act as terminals for phrase recognition but as named rules
39535
+ // for `AST` nodes and back referencing.
39536
+ // See [`ast.js`](./ast.html) for usage.
39537
+ const opUDT = (opIndex, phraseIndex) => {
39538
+ let astLength;
39539
+ let astIndex;
39540
+ let astDefined;
39541
+ const op = opcodes[opIndex];
39542
+ const udt = udts[op.index];
39543
+ sysData.UdtIndex = udt.index;
39544
+ /* ignore AST in look ahead */
39545
+ if (!lookAhead) {
39546
+ astDefined = p.ast && p.ast.udtDefined(op.index);
39547
+ if (astDefined) {
39548
+ astIndex = rules.length + op.index;
39549
+ astLength = p.ast.getLength();
39550
+ p.ast.down(astIndex, udt.name);
39551
+ }
39552
+ }
39553
+ /* call the UDT */
39554
+ const charsLeft = chars.length - phraseIndex;
39555
+ udtCallbacks[op.index](sysData, chars, phraseIndex, userData);
39556
+ validateUdtCallbackResult(udt, sysData, charsLeft);
39557
+ if (!lookAhead) {
39558
+ /* end AST */
39559
+ if (astDefined) {
39560
+ if (sysData.state === id.NOMATCH) {
39561
+ p.ast.setLength(astLength);
39562
+ } else {
39563
+ p.ast.up(astIndex, udt.name, phraseIndex, sysData.phraseLength);
39564
+ }
39565
+ }
39566
+ }
39567
+ };
39568
+ // The `AND` operator.<br>
39569
+ // This is the positive `look ahead` operator.
39570
+ // Executes its single child node, returning the EMPTY state
39571
+ // if it succeedsand NOMATCH if it fails.
39572
+ // *Always* backtracks on any matched phrase and returns EMPTY on success.
39573
+ const opAND = (opIndex, phraseIndex) => {
39574
+ lookAhead += 1;
39575
+ opExecute(opIndex + 1, phraseIndex);
39576
+ lookAhead -= 1;
39577
+ sysData.phraseLength = 0;
39578
+ switch (sysData.state) {
39579
+ case id.EMPTY:
39580
+ sysData.state = id.EMPTY;
39581
+ break;
39582
+ case id.MATCH:
39583
+ sysData.state = id.EMPTY;
39584
+ break;
39585
+ case id.NOMATCH:
39586
+ sysData.state = id.NOMATCH;
39587
+ break;
39588
+ default:
39589
+ throw new Error(`opAND: invalid state ${sysData.state}`);
39590
+ }
39591
+ };
39592
+ // The `NOT` operator.<br>
39593
+ // This is the negative `look ahead` operator.
39594
+ // Executes its single child node, returning the EMPTY state
39595
+ // if it *fails* and NOMATCH if it succeeds.
39596
+ // *Always* backtracks on any matched phrase and returns EMPTY
39597
+ // on success (failure of its child node).
39598
+ const opNOT = (opIndex, phraseIndex) => {
39599
+ lookAhead += 1;
39600
+ opExecute(opIndex + 1, phraseIndex);
39601
+ lookAhead -= 1;
39602
+ sysData.phraseLength = 0;
39603
+ switch (sysData.state) {
39604
+ case id.EMPTY:
39605
+ case id.MATCH:
39606
+ sysData.state = id.NOMATCH;
39607
+ break;
39608
+ case id.NOMATCH:
39609
+ sysData.state = id.EMPTY;
39610
+ break;
39611
+ default:
39612
+ throw new Error(`opNOT: invalid state ${sysData.state}`);
39613
+ }
39614
+ };
39615
+
39616
+ const opExecute = (opIndex, phraseIndex) => {
39617
+ const functionName = `${thisFileName}opExecute(): `;
39618
+ const op = opcodes[opIndex];
39619
+ nodeHits += 1;
39620
+ if (treeDepth > maxTreeDepth) {
39621
+ maxTreeDepth = treeDepth;
39622
+ }
39623
+ treeDepth += 1;
39624
+ sysData.refresh();
39625
+ if (p.trace) {
39626
+ p.trace.down(op, phraseIndex);
39627
+ }
39628
+ switch (op.type) {
39629
+ case id.ALT:
39630
+ opALT(opIndex, phraseIndex);
39631
+ break;
39632
+ case id.CAT:
39633
+ opCAT(opIndex, phraseIndex);
39634
+ break;
39635
+ case id.REP:
39636
+ opREP(opIndex, phraseIndex);
39637
+ break;
39638
+ case id.RNM:
39639
+ opRNM(opIndex, phraseIndex);
39640
+ break;
39641
+ case id.TRG:
39642
+ opTRG(opIndex, phraseIndex);
39643
+ break;
39644
+ case id.TBS:
39645
+ opTBS(opIndex, phraseIndex);
39646
+ break;
39647
+ case id.TLS:
39648
+ opTLS(opIndex, phraseIndex);
39649
+ break;
39650
+ case id.UDT:
39651
+ opUDT(opIndex, phraseIndex);
39652
+ break;
39653
+ case id.AND:
39654
+ opAND(opIndex, phraseIndex);
39655
+ break;
39656
+ case id.NOT:
39657
+ opNOT(opIndex, phraseIndex);
39658
+ break;
39659
+ default:
39660
+ throw new Error(`${functionName}unrecognized operator`);
39661
+ }
39662
+ if (!lookAhead) {
39663
+ if (phraseIndex + sysData.phraseLength > maxMatched) {
39664
+ maxMatched = phraseIndex + sysData.phraseLength;
39665
+ }
39666
+ }
39667
+ if (p.stats) {
39668
+ p.stats.collect(op, sysData);
39669
+ }
39670
+ if (p.trace) {
39671
+ p.trace.up(op, sysData.state, phraseIndex, sysData.phraseLength);
39672
+ }
39673
+ treeDepth -= 1;
39674
+ };
39675
+ };
39676
+
39677
+ const Ast = function fnast() {
39678
+ const thisFileName = 'parser.js: Ast()): ';
39679
+ const id = identifiers;
39680
+ const utils = utilities;
39681
+ const a = this;
39682
+ let rules = undefined;
39683
+ let udts = undefined;
39684
+ let chars = undefined;
39685
+ let nodeCount = 0;
39686
+ const nodeCallbacks = [];
39687
+ const stack = [];
39688
+ const records = [];
39689
+ a.callbacks = [];
39690
+ /* called by the parser to initialize the AST with the rules, UDTs and the input characters */
39691
+ a.init = (rulesIn, udtsIn, charsIn) => {
39692
+ stack.length = 0;
39693
+ records.length = 0;
39694
+ nodeCount = 0;
39695
+ rules = rulesIn;
39696
+ udts = udtsIn;
39697
+ chars = charsIn;
39698
+ let i;
39699
+ const list = [];
39700
+ for (i = 0; i < rules.length; i += 1) {
39701
+ list.push(rules[i].lower);
39702
+ }
39703
+ for (i = 0; i < udts.length; i += 1) {
39704
+ list.push(udts[i].lower);
39705
+ }
39706
+ nodeCount = rules.length + udts.length;
39707
+ for (i = 0; i < nodeCount; i += 1) {
39708
+ nodeCallbacks[i] = undefined;
39709
+ }
39710
+ for (const index in a.callbacks) {
39711
+ const lower = index.toLowerCase();
39712
+ i = list.indexOf(lower);
39713
+ if (i < 0) {
39714
+ throw new Error(`${thisFileName}init: node '${index}' not a rule or udt name`);
39715
+ }
39716
+ nodeCallbacks[i] = a.callbacks[index];
39717
+ }
39718
+ };
39719
+ /* AST node rule callbacks - called by the parser's `RNM` operator */
39720
+ a.ruleDefined = (index) => !!nodeCallbacks[index];
39721
+ /* AST node UDT callbacks - called by the parser's `UDT` operator */
39722
+ a.udtDefined = (index) => !!nodeCallbacks[rules.length + index];
39723
+ /* called by the parser's `RNM` & `UDT` operators
39724
+ builds a record for the downward traversal of the node */
39725
+ a.down = (callbackIndex, name) => {
39726
+ const thisIndex = records.length;
39727
+ stack.push(thisIndex);
39728
+ records.push({
39729
+ name,
39730
+ thisIndex,
39731
+ thatIndex: undefined,
39732
+ state: id.SEM_PRE,
39733
+ callbackIndex,
39734
+ phraseIndex: undefined,
39735
+ phraseLength: undefined,
39736
+ stack: stack.length,
39737
+ });
39738
+ return thisIndex;
39739
+ };
39740
+ /* called by the parser's `RNM` & `UDT` operators */
39741
+ /* builds a record for the upward traversal of the node */
39742
+ a.up = (callbackIndex, name, phraseIndex, phraseLength) => {
39743
+ const thisIndex = records.length;
39744
+ const thatIndex = stack.pop();
39745
+ records.push({
39746
+ name,
39747
+ thisIndex,
39748
+ thatIndex,
39749
+ state: id.SEM_POST,
39750
+ callbackIndex,
39751
+ phraseIndex,
39752
+ phraseLength,
39753
+ stack: stack.length,
39754
+ });
39755
+ records[thatIndex].thatIndex = thisIndex;
39756
+ records[thatIndex].phraseIndex = phraseIndex;
39757
+ records[thatIndex].phraseLength = phraseLength;
39758
+ return thisIndex;
39759
+ };
39760
+ // Called by the user to translate the AST.
39761
+ // Translate means to associate or apply some semantic action to the
39762
+ // phrases that were syntactically matched to the AST nodes according
39763
+ // to the defining grammar.
39764
+ // ```
39765
+ // data - optional user-defined data
39766
+ // passed to the callback functions by the translator
39767
+ // ```
39768
+ a.translate = (data) => {
39769
+ let ret;
39770
+ let callback;
39771
+ let record;
39772
+ for (let i = 0; i < records.length; i += 1) {
39773
+ record = records[i];
39774
+ callback = nodeCallbacks[record.callbackIndex];
39775
+ if (callback) {
39776
+ if (record.state === id.SEM_PRE) {
39777
+ callback(id.SEM_PRE, chars, record.phraseIndex, record.phraseLength, data);
39778
+ } else if (callback) {
39779
+ callback(id.SEM_POST, chars, record.phraseIndex, record.phraseLength, data);
39780
+ }
39781
+ }
39782
+ }
39783
+ };
39784
+ /* called by the parser to reset the length of the records array */
39785
+ /* necessary on backtracking */
39786
+ a.setLength = (length) => {
39787
+ records.length = length;
39788
+ if (length > 0) {
39789
+ stack.length = records[length - 1].stack;
39790
+ } else {
39791
+ stack.length = 0;
39792
+ }
39793
+ };
39794
+ /* called by the parser to get the length of the records array */
39795
+ a.getLength = () => records.length;
39796
+ /* helper for XML display */
39797
+ function indent(n) {
39798
+ let ret = '';
39799
+ while (n-- > 0) {
39800
+ ret += ' ';
39801
+ }
39802
+ return ret;
39803
+ }
39804
+ // Generate an `XML` version of the AST.
39805
+ // Useful if you want to use a special or favorite XML parser to translate the
39806
+ // AST. Node data are JavaScript strings.
39807
+ a.toXml = () => {
39808
+ let xml = '';
39809
+ let depth = 0;
39810
+ xml += '<?xml version="1.0" encoding="utf-8"?>\n';
39811
+ xml += `<root nodes="${records.length / 2}" characters="${chars.length}">\n`;
39812
+ xml += `<!-- input string -->\n`;
39813
+ xml += indent(depth + 2);
39814
+ xml += utils.charsToString(chars);
39815
+ xml += '\n';
39816
+ records.forEach((rec) => {
39817
+ if (rec.state === id.SEM_PRE) {
39818
+ depth += 1;
39819
+ xml += indent(depth);
39820
+ xml += `<node name="${rec.name}" index="${rec.phraseIndex}" length="${rec.phraseLength}">\n`;
39821
+ xml += indent(depth + 2);
39822
+ xml += utils.charsToString(chars, rec.phraseIndex, rec.phraseLength);
39823
+ xml += '\n';
39824
+ } else {
39825
+ xml += indent(depth);
39826
+ xml += `</node><!-- name="${rec.name}" -->\n`;
39827
+ depth -= 1;
39828
+ }
39829
+ });
39830
+
39831
+ xml += '</root>\n';
39832
+ return xml;
39833
+ };
39834
+ };
39835
+
39836
+ const Trace = function fntrace() {
39837
+ const id = identifiers;
39838
+ const utils = utilities;
39839
+ const thisFile = 'parser.js: Trace(): ';
39840
+ let chars = undefined;
39841
+ let rules = undefined;
39842
+ let udts = undefined;
39843
+ let out = '';
39844
+ let treeDepth = 0;
39845
+ const MAX_PHRASE = 100;
39846
+ const t = this;
39847
+ const indent = (n) => {
39848
+ let ret = '';
39849
+ let count = 0;
39850
+ if (n >= 0) {
39851
+ while (n--) {
39852
+ count += 1;
39853
+ if (count === 5) {
39854
+ ret += '|';
39855
+ count = 0;
39856
+ } else {
39857
+ ret += '.';
39858
+ }
39859
+ }
39860
+ }
39861
+ return ret;
39862
+ };
39863
+ t.init = (r, u, c) => {
39864
+ rules = r;
39865
+ udts = u;
39866
+ chars = c;
39867
+ };
39868
+ const opName = (op) => {
39869
+ let name;
39870
+ switch (op.type) {
39871
+ case id.ALT:
39872
+ name = 'ALT';
39873
+ break;
39874
+ case id.CAT:
39875
+ name = 'CAT';
39876
+ break;
39877
+ case id.REP:
39878
+ if (op.max === Infinity) {
39879
+ name = `REP(${op.min},inf)`;
39880
+ } else {
39881
+ name = `REP(${op.min},${op.max})`;
39882
+ }
39883
+ break;
39884
+ case id.RNM:
39885
+ name = `RNM(${rules[op.index].name})`;
39886
+ break;
39887
+ case id.TRG:
39888
+ name = `TRG(${op.min},${op.max})`;
39889
+ break;
39890
+ case id.TBS:
39891
+ if (op.string.length > 6) {
39892
+ name = `TBS(${utils.charsToString(op.string, 0, 3)}...)`;
39893
+ } else {
39894
+ name = `TBS(${utils.charsToString(op.string, 0, 6)})`;
39895
+ }
39896
+ break;
39897
+ case id.TLS:
39898
+ if (op.string.length > 6) {
39899
+ name = `TLS(${utils.charsToString(op.string, 0, 3)}...)`;
39900
+ } else {
39901
+ name = `TLS(${utils.charsToString(op.string, 0, 6)})`;
39902
+ }
39903
+ break;
39904
+ case id.UDT:
39905
+ name = `UDT(${udts[op.index].name})`;
39906
+ break;
39907
+ case id.AND:
39908
+ name = 'AND';
39909
+ break;
39910
+ case id.NOT:
39911
+ name = 'NOT';
39912
+ break;
39913
+ default:
39914
+ throw new Error(`${thisFile}Trace: opName: unrecognized opcode`);
39915
+ }
39916
+ return name;
39917
+ };
39918
+ t.down = (op, offset) => {
39919
+ const lead = indent(treeDepth);
39920
+ const len = Math.min(MAX_PHRASE, chars.length - offset);
39921
+ let phrase = utils.charsToString(chars, offset, len);
39922
+ if (len < chars.length - offset) {
39923
+ phrase += '...';
39924
+ }
39925
+ phrase = `${lead}|-|[${opName(op)}]${phrase}\n`;
39926
+ out += phrase;
39927
+ treeDepth += 1;
39928
+ };
39929
+ t.up = (op, state, offset, phraseLength) => {
39930
+ const thisFunc = `${thisFile}trace.up: `;
39931
+ treeDepth -= 1;
39932
+ const lead = indent(treeDepth);
39933
+ let len;
39934
+ let phrase;
39935
+ let st;
39936
+ switch (state) {
39937
+ case id.EMPTY:
39938
+ st = '|E|';
39939
+ phrase = `''`;
39940
+ break;
39941
+ case id.MATCH:
39942
+ st = '|M|';
39943
+ len = Math.min(MAX_PHRASE, phraseLength);
39944
+ if (len < phraseLength) {
39945
+ phrase = `'${utils.charsToString(chars, offset, len)}...'`;
39946
+ } else {
39947
+ phrase = `'${utils.charsToString(chars, offset, len)}'`;
39948
+ }
39949
+ break;
39950
+ case id.NOMATCH:
39951
+ st = '|N|';
39952
+ phrase = '';
39953
+ break;
39954
+ default:
39955
+ throw new Error(`${thisFunc} unrecognized state`);
39956
+ }
39957
+ phrase = `${lead}${st}[${opName(op)}]${phrase}\n`;
39958
+ out += phrase;
39959
+ };
39960
+ t.displayTrace = () => out;
39961
+ };
39962
+
39963
+ const Stats = function fnstats() {
39964
+ const id = identifiers;
39965
+ const thisFileName = 'parser.js: Stats(): ';
39966
+ let rules;
39967
+ let udts;
39968
+ let totals;
39969
+ const stats = [];
39970
+ const ruleStats = [];
39971
+ const udtStats = [];
39972
+ /* called by parser to initialize the stats */
39973
+ this.init = (r, u) => {
39974
+ rules = r;
39975
+ udts = u;
39976
+ clear();
39977
+ };
39978
+ /* This function is the main interaction with the parser. */
39979
+ /* The parser calls it after each node has been traversed. */
39980
+ this.collect = (op, sys) => {
39981
+ incStat(totals, sys.state, sys.phraseLength);
39982
+ incStat(stats[op.type], sys.state, sys.phraseLength);
39983
+ if (op.type === id.RNM) {
39984
+ incStat(ruleStats[op.index], sys.state, sys.phraseLength);
39985
+ }
39986
+ if (op.type === id.UDT) {
39987
+ incStat(udtStats[op.index], sys.state, sys.phraseLength);
39988
+ }
39989
+ };
39990
+ this.displayStats = () => {
39991
+ let out = '';
39992
+ const totals = {
39993
+ match: 0,
39994
+ empty: 0,
39995
+ nomatch: 0,
39996
+ total: 0,
39997
+ };
39998
+ const displayRow = (op, m, e, n, t) => {
39999
+ totals.match += m;
40000
+ totals.empty += e;
40001
+ totals.nomatch += n;
40002
+ totals.total += t;
40003
+ const mm = normalize(m);
40004
+ const ee = normalize(e);
40005
+ const nn = normalize(n);
40006
+ const tt = normalize(t);
40007
+ return `${op} | ${mm} | ${ee} | ${nn} | ${tt} |\n`;
40008
+ };
40009
+ out += ' OPERATOR STATS\n';
40010
+ out += ' | MATCH | EMPTY | NOMATCH | TOTAL |\n';
40011
+ out += displayRow(' ALT', stats[id.ALT].match, stats[id.ALT].empty, stats[id.ALT].nomatch, stats[id.ALT].total);
40012
+ out += displayRow(' CAT', stats[id.CAT].match, stats[id.CAT].empty, stats[id.CAT].nomatch, stats[id.CAT].total);
40013
+ out += displayRow(' REP', stats[id.REP].match, stats[id.REP].empty, stats[id.REP].nomatch, stats[id.REP].total);
40014
+ out += displayRow(' RNM', stats[id.RNM].match, stats[id.RNM].empty, stats[id.RNM].nomatch, stats[id.RNM].total);
40015
+ out += displayRow(' TRG', stats[id.TRG].match, stats[id.TRG].empty, stats[id.TRG].nomatch, stats[id.TRG].total);
40016
+ out += displayRow(' TBS', stats[id.TBS].match, stats[id.TBS].empty, stats[id.TBS].nomatch, stats[id.TBS].total);
40017
+ out += displayRow(' TLS', stats[id.TLS].match, stats[id.TLS].empty, stats[id.TLS].nomatch, stats[id.TLS].total);
40018
+ out += displayRow(' UDT', stats[id.UDT].match, stats[id.UDT].empty, stats[id.UDT].nomatch, stats[id.UDT].total);
40019
+ out += displayRow(' AND', stats[id.AND].match, stats[id.AND].empty, stats[id.AND].nomatch, stats[id.AND].total);
40020
+ out += displayRow(' NOT', stats[id.NOT].match, stats[id.NOT].empty, stats[id.NOT].nomatch, stats[id.NOT].total);
40021
+ out += displayRow('TOTAL', totals.match, totals.empty, totals.nomatch, totals.total);
40022
+ return out;
40023
+ };
40024
+ /*
40025
+ Display rule/udt
40026
+ */
40027
+ this.displayHits = (type) => {
40028
+ let out = '';
40029
+ const displayRow = (m, e, n, t, name) => {
40030
+ totals.match += m;
40031
+ totals.empty += e;
40032
+ totals.nomatch += n;
40033
+ totals.total += t;
40034
+ const mm = normalize(m);
40035
+ const ee = normalize(e);
40036
+ const nn = normalize(n);
40037
+ const tt = normalize(t);
40038
+ return `| ${mm} | ${ee} | ${nn} | ${tt} | ${name}\n`;
40039
+ };
40040
+ if (typeof type === 'string' && type.toLowerCase()[0] === 'a') {
40041
+ ruleStats.sort(sortAlpha);
40042
+ udtStats.sort(sortAlpha);
40043
+ out += ' RULES/UDTS ALPHABETICALLY\n';
40044
+ } else if (typeof type === 'string' && type.toLowerCase()[0] === 'i') {
40045
+ ruleStats.sort(sortIndex);
40046
+ udtStats.sort(sortIndex);
40047
+ out += ' RULES/UDTS BY INDEX\n';
40048
+ } else {
40049
+ ruleStats.sort(sortHits);
40050
+ udtStats.sort(sortHits);
40051
+ out += ' RULES/UDTS BY HIT COUNT\n';
40052
+ }
40053
+ out += '| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n';
40054
+ for (let i = 0; i < ruleStats.length; i += 1) {
40055
+ let r = ruleStats[i];
40056
+ if (r.total) {
40057
+ out += displayRow(r.match, r.empty, r.nomatch, r.total, r.name);
40058
+ }
40059
+ }
40060
+ for (let i = 0; i < udtStats.length; i += 1) {
40061
+ let r = udtStats[i];
40062
+ if (r.total) {
40063
+ out += displayRow(r.match, r.empty, r.nomatch, r.total, r.name);
40064
+ }
40065
+ }
40066
+ return out;
40067
+ };
40068
+ const normalize = (n) => {
40069
+ if (n < 10) {
40070
+ return ` ${n}`;
40071
+ }
40072
+ if (n < 100) {
40073
+ return ` ${n}`;
40074
+ }
40075
+ if (n < 1000) {
40076
+ return ` ${n}`;
40077
+ }
40078
+ if (n < 10000) {
40079
+ return ` ${n}`;
40080
+ }
40081
+ if (n < 100000) {
40082
+ return ` ${n}`;
40083
+ }
40084
+ if (n < 1000000) {
40085
+ return ` ${n}`;
40086
+ }
40087
+ return `${n}`;
40088
+ };
40089
+ const sortAlpha = (lhs, rhs) => {
40090
+ if (lhs.lower < rhs.lower) {
40091
+ return -1;
40092
+ }
40093
+ if (lhs.lower > rhs.lower) {
40094
+ return 1;
40095
+ }
40096
+ return 0;
40097
+ };
40098
+ const sortHits = (lhs, rhs) => {
40099
+ if (lhs.total < rhs.total) {
40100
+ return 1;
40101
+ }
40102
+ if (lhs.total > rhs.total) {
40103
+ return -1;
40104
+ }
40105
+ return sortAlpha(lhs, rhs);
40106
+ };
40107
+ const sortIndex = (lhs, rhs) => {
40108
+ if (lhs.index < rhs.index) {
40109
+ return -1;
40110
+ }
40111
+ if (lhs.index > rhs.index) {
40112
+ return 1;
40113
+ }
40114
+ return 0;
40115
+ };
40116
+ const EmptyStat = function fnempty() {
40117
+ this.empty = 0;
40118
+ this.match = 0;
40119
+ this.nomatch = 0;
40120
+ this.total = 0;
40121
+ };
40122
+ /* Zero out all stats */
40123
+ const clear = () => {
40124
+ stats.length = 0;
40125
+ totals = new EmptyStat();
40126
+ stats[id.ALT] = new EmptyStat();
40127
+ stats[id.CAT] = new EmptyStat();
40128
+ stats[id.REP] = new EmptyStat();
40129
+ stats[id.RNM] = new EmptyStat();
40130
+ stats[id.TRG] = new EmptyStat();
40131
+ stats[id.TBS] = new EmptyStat();
40132
+ stats[id.TLS] = new EmptyStat();
40133
+ stats[id.UDT] = new EmptyStat();
40134
+ stats[id.AND] = new EmptyStat();
40135
+ stats[id.NOT] = new EmptyStat();
40136
+ ruleStats.length = 0;
40137
+ for (let i = 0; i < rules.length; i += 1) {
40138
+ ruleStats.push({
40139
+ empty: 0,
40140
+ match: 0,
40141
+ nomatch: 0,
40142
+ total: 0,
40143
+ name: rules[i].name,
40144
+ lower: rules[i].lower,
40145
+ index: rules[i].index,
40146
+ });
40147
+ }
40148
+ if (udts.length > 0) {
40149
+ udtStats.length = 0;
40150
+ for (let i = 0; i < udts.length; i += 1) {
40151
+ udtStats.push({
40152
+ empty: 0,
40153
+ match: 0,
40154
+ nomatch: 0,
40155
+ total: 0,
40156
+ name: udts[i].name,
40157
+ lower: udts[i].lower,
40158
+ index: udts[i].index,
40159
+ });
40160
+ }
40161
+ }
40162
+ };
40163
+ /* increment the designated operator hit count by one */
40164
+ const incStat = (stat, state) => {
40165
+ stat.total += 1;
40166
+ switch (state) {
40167
+ case id.EMPTY:
40168
+ stat.empty += 1;
40169
+ break;
40170
+ case id.MATCH:
40171
+ stat.match += 1;
40172
+ break;
40173
+ case id.NOMATCH:
40174
+ stat.nomatch += 1;
40175
+ break;
40176
+ default:
40177
+ throw new Error(`${thisFileName}collect(): incStat(): unrecognized state: ${state}`);
40178
+ }
40179
+ };
40180
+ };
40181
+
40182
+ const utilities = {
40183
+ // utility functions
40184
+ stringToChars: (string) => [...string].map((cp) => cp.codePointAt(0)),
40185
+ charsToString: (chars, beg, len) => {
40186
+ let subChars = chars;
40187
+ while (1) {
40188
+ if (beg === undefined || beg < 0) {
40189
+ break;
40190
+ }
40191
+ if (len === undefined) {
40192
+ subChars = chars.slice(beg);
40193
+ break;
40194
+ }
40195
+ if (len <= 0) {
40196
+ // always an empty string
40197
+ return '';
40198
+ }
40199
+ subChars = chars.slice(beg, beg + len);
40200
+ break;
40201
+ }
40202
+ return String.fromCodePoint(...subChars);
40203
+ },
40204
+ };
40205
+
40206
+ const identifiers = {
40207
+ // Identifies the operator type.
40208
+ // NB: These must match the values in apg-js 4.3.0, apg-lib/identifiers.
40209
+ /* the original ABNF operators */
40210
+ ALT: 1 /* alternation */,
40211
+ CAT: 2 /* concatenation */,
40212
+ REP: 3 /* repetition */,
40213
+ RNM: 4 /* rule name */,
40214
+ TRG: 5 /* terminal range */,
40215
+ TBS: 6 /* terminal binary string, case sensitive */,
40216
+ TLS: 7 /* terminal literal string, case insensitive */,
40217
+ /* the super set, SABNF operators */
40218
+ UDT: 11 /* user-defined terminal */,
40219
+ AND: 12 /* positive look ahead */,
40220
+ NOT: 13 /* negative look ahead */,
40221
+ // Used by the parser and the user's `RNM` and `UDT` callback functions.
40222
+ // Identifies the parser state as it traverses the parse tree nodes.
40223
+ // - *ACTIVE* - indicates the downward direction through the parse tree node.
40224
+ // - *MATCH* - indicates the upward direction and a phrase, of length \> 0, has been successfully matched
40225
+ // - *EMPTY* - indicates the upward direction and a phrase, of length = 0, has been successfully matched
40226
+ // - *NOMATCH* - indicates the upward direction and the parser failed to match any phrase at all
40227
+ ACTIVE: 100,
40228
+ MATCH: 101,
40229
+ EMPTY: 102,
40230
+ NOMATCH: 103,
40231
+ // Used by [`AST` translator](./ast.html) (semantic analysis) and the user's callback functions
40232
+ // to indicate the direction of flow through the `AST` nodes.
40233
+ // - *SEM_PRE* - indicates the downward (pre-branch) direction through the `AST` node.
40234
+ // - *SEM_POST* - indicates the upward (post-branch) direction through the `AST` node.
40235
+ SEM_PRE: 200,
40236
+ SEM_POST: 201,
40237
+ // Ignored. Retained for backwords compatibility.
40238
+ SEM_OK: 300,
40239
+ idName: (s) => {
40240
+ switch (s) {
40241
+ case identifiers.ALT:
40242
+ return 'ALT';
40243
+ case identifiers.CAT:
40244
+ return 'CAT';
40245
+ case identifiers.REP:
40246
+ return 'REP';
40247
+ case identifiers.RNM:
40248
+ return 'RNM';
40249
+ case identifiers.TRG:
40250
+ return 'TRG';
40251
+ case identifiers.TBS:
40252
+ return 'TBS';
40253
+ case identifiers.TLS:
40254
+ return 'TLS';
40255
+ case identifiers.UDT:
40256
+ return 'UDT';
40257
+ case identifiers.AND:
40258
+ return 'AND';
40259
+ case identifiers.NOT:
40260
+ return 'NOT';
40261
+ case identifiers.ACTIVE:
40262
+ return 'ACTIVE';
40263
+ case identifiers.EMPTY:
40264
+ return 'EMPTY';
40265
+ case identifiers.MATCH:
40266
+ return 'MATCH';
40267
+ case identifiers.NOMATCH:
40268
+ return 'NOMATCH';
40269
+ case identifiers.SEM_PRE:
40270
+ return 'SEM_PRE';
40271
+ case identifiers.SEM_POST:
40272
+ return 'SEM_POST';
40273
+ case identifiers.SEM_OK:
40274
+ return 'SEM_OK';
40275
+ default:
40276
+ return 'UNRECOGNIZED STATE';
40277
+ }
40278
+ },
40279
+ };
40280
+
40281
+
39016
40282
  /***/ }),
39017
40283
 
39018
40284
  /***/ 16111:
@@ -43823,6 +45089,1113 @@ var jsYaml = {
43823
45089
 
43824
45090
 
43825
45091
 
45092
+ /***/ }),
45093
+
45094
+ /***/ 61546:
45095
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45096
+
45097
+ "use strict";
45098
+ __webpack_require__.r(__webpack_exports__);
45099
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45100
+ /* harmony export */ Grammar: () => (/* reexport safe */ _path_templating_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]),
45101
+ /* harmony export */ encodePathComponent: () => (/* reexport safe */ _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__.encodePathComponent),
45102
+ /* harmony export */ parse: () => (/* reexport safe */ _parse_index_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]),
45103
+ /* harmony export */ resolve: () => (/* reexport safe */ _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__["default"]),
45104
+ /* harmony export */ test: () => (/* reexport safe */ _test_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])
45105
+ /* harmony export */ });
45106
+ /* harmony import */ var _path_templating_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(56167);
45107
+ /* harmony import */ var _test_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62674);
45108
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10426);
45109
+ /* harmony import */ var _resolve_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97642);
45110
+
45111
+
45112
+
45113
+
45114
+
45115
+ /***/ }),
45116
+
45117
+ /***/ 41856:
45118
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45119
+
45120
+ "use strict";
45121
+ __webpack_require__.r(__webpack_exports__);
45122
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45123
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45124
+ /* harmony export */ });
45125
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45126
+
45127
+ const fragmentMarker = (state, chars, phraseIndex, phraseLength, data) => {
45128
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45129
+ data.push(['fragment-marker', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45130
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45131
+ /* not used in this example */
45132
+ }
45133
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45134
+ };
45135
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fragmentMarker);
45136
+
45137
+ /***/ }),
45138
+
45139
+ /***/ 97774:
45140
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45141
+
45142
+ "use strict";
45143
+ __webpack_require__.r(__webpack_exports__);
45144
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45145
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45146
+ /* harmony export */ });
45147
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45148
+
45149
+ const fragment = (state, chars, phraseIndex, phraseLength, data) => {
45150
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45151
+ data.push(['fragment', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45152
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45153
+ /* not used in this example */
45154
+ }
45155
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45156
+ };
45157
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fragment);
45158
+
45159
+ /***/ }),
45160
+
45161
+ /***/ 88430:
45162
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45163
+
45164
+ "use strict";
45165
+ __webpack_require__.r(__webpack_exports__);
45166
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45167
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45168
+ /* harmony export */ });
45169
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45170
+
45171
+ const pathLiteral = (state, chars, phraseIndex, phraseLength, data) => {
45172
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45173
+ data.push(['path-literal', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45174
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45175
+ /* not used in this example */
45176
+ }
45177
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45178
+ };
45179
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (pathLiteral);
45180
+
45181
+ /***/ }),
45182
+
45183
+ /***/ 33659:
45184
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45185
+
45186
+ "use strict";
45187
+ __webpack_require__.r(__webpack_exports__);
45188
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45189
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45190
+ /* harmony export */ });
45191
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45192
+
45193
+ const pathTemplate = (state, chars, phraseIndex, phraseLength, data) => {
45194
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45195
+ if (Array.isArray(data) === false) {
45196
+ throw new Error("parser's user data must be an array");
45197
+ }
45198
+ data.push(['path-template', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45199
+ }
45200
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45201
+ };
45202
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (pathTemplate);
45203
+
45204
+ /***/ }),
45205
+
45206
+ /***/ 28580:
45207
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45208
+
45209
+ "use strict";
45210
+ __webpack_require__.r(__webpack_exports__);
45211
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45212
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45213
+ /* harmony export */ });
45214
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45215
+
45216
+ const path = (state, chars, phraseIndex, phraseLength, data) => {
45217
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45218
+ data.push(['path', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45219
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45220
+ /* not used in this example */
45221
+ }
45222
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45223
+ };
45224
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (path);
45225
+
45226
+ /***/ }),
45227
+
45228
+ /***/ 34518:
45229
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45230
+
45231
+ "use strict";
45232
+ __webpack_require__.r(__webpack_exports__);
45233
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45234
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45235
+ /* harmony export */ });
45236
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45237
+
45238
+ const queryMarker = (state, chars, phraseIndex, phraseLength, data) => {
45239
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45240
+ data.push(['query-marker', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45241
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45242
+ /* not used in this example */
45243
+ }
45244
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45245
+ };
45246
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (queryMarker);
45247
+
45248
+ /***/ }),
45249
+
45250
+ /***/ 76559:
45251
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45252
+
45253
+ "use strict";
45254
+ __webpack_require__.r(__webpack_exports__);
45255
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45256
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45257
+ /* harmony export */ });
45258
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45259
+
45260
+ const query = (state, chars, phraseIndex, phraseLength, data) => {
45261
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45262
+ data.push(['query', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45263
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45264
+ /* not used in this example */
45265
+ }
45266
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45267
+ };
45268
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (query);
45269
+
45270
+ /***/ }),
45271
+
45272
+ /***/ 31696:
45273
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45274
+
45275
+ "use strict";
45276
+ __webpack_require__.r(__webpack_exports__);
45277
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45278
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45279
+ /* harmony export */ });
45280
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45281
+
45282
+ const slash = (state, chars, phraseIndex, phraseLength, data) => {
45283
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45284
+ data.push(['slash', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45285
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45286
+ /* not used in this example */
45287
+ }
45288
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45289
+ };
45290
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (slash);
45291
+
45292
+ /***/ }),
45293
+
45294
+ /***/ 21926:
45295
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45296
+
45297
+ "use strict";
45298
+ __webpack_require__.r(__webpack_exports__);
45299
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45300
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45301
+ /* harmony export */ });
45302
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45303
+
45304
+ const templateExpressionParamName = (state, chars, phraseIndex, phraseLength, data) => {
45305
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45306
+ data.push(['template-expression-param-name', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45307
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45308
+ /* not used in this example */
45309
+ }
45310
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45311
+ };
45312
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (templateExpressionParamName);
45313
+
45314
+ /***/ }),
45315
+
45316
+ /***/ 82966:
45317
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45318
+
45319
+ "use strict";
45320
+ __webpack_require__.r(__webpack_exports__);
45321
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45322
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45323
+ /* harmony export */ });
45324
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45325
+
45326
+ const templateExpression = (state, chars, phraseIndex, phraseLength, data) => {
45327
+ if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_PRE) {
45328
+ data.push(['template-expression', _apg_lite__WEBPACK_IMPORTED_MODULE_0__.utilities.charsToString(chars, phraseIndex, phraseLength)]);
45329
+ } else if (state === _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_POST) {
45330
+ /* not used in this example */
45331
+ }
45332
+ return _apg_lite__WEBPACK_IMPORTED_MODULE_0__.identifiers.SEM_OK;
45333
+ };
45334
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (templateExpression);
45335
+
45336
+ /***/ }),
45337
+
45338
+ /***/ 10426:
45339
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45340
+
45341
+ "use strict";
45342
+ __webpack_require__.r(__webpack_exports__);
45343
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45344
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
45345
+ /* harmony export */ });
45346
+ /* harmony import */ var _apg_lite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16646);
45347
+ /* harmony import */ var _path_templating_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(56167);
45348
+ /* harmony import */ var _callbacks_slash_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31696);
45349
+ /* harmony import */ var _callbacks_path_template_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33659);
45350
+ /* harmony import */ var _callbacks_path_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28580);
45351
+ /* harmony import */ var _callbacks_path_literal_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88430);
45352
+ /* harmony import */ var _callbacks_query_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(76559);
45353
+ /* harmony import */ var _callbacks_query_marker_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(34518);
45354
+ /* harmony import */ var _callbacks_fragment_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(97774);
45355
+ /* harmony import */ var _callbacks_fragment_marker_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(41856);
45356
+ /* harmony import */ var _callbacks_template_expression_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(82966);
45357
+ /* harmony import */ var _callbacks_template_expression_param_name_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(21926);
45358
+
45359
+
45360
+
45361
+
45362
+
45363
+
45364
+
45365
+
45366
+
45367
+
45368
+
45369
+
45370
+ const grammar = new _path_templating_mjs__WEBPACK_IMPORTED_MODULE_11__["default"]();
45371
+ const parse = str => {
45372
+ const parser = new _apg_lite__WEBPACK_IMPORTED_MODULE_0__.Parser();
45373
+ parser.ast = new _apg_lite__WEBPACK_IMPORTED_MODULE_0__.Ast();
45374
+ parser.ast.callbacks['path-template'] = _callbacks_path_template_mjs__WEBPACK_IMPORTED_MODULE_2__["default"];
45375
+ parser.ast.callbacks['path'] = _callbacks_path_mjs__WEBPACK_IMPORTED_MODULE_3__["default"];
45376
+ parser.ast.callbacks['query'] = _callbacks_query_mjs__WEBPACK_IMPORTED_MODULE_5__["default"];
45377
+ parser.ast.callbacks['query-marker'] = _callbacks_query_marker_mjs__WEBPACK_IMPORTED_MODULE_6__["default"];
45378
+ parser.ast.callbacks['fragment'] = _callbacks_fragment_mjs__WEBPACK_IMPORTED_MODULE_7__["default"];
45379
+ parser.ast.callbacks['fragment-marker'] = _callbacks_fragment_marker_mjs__WEBPACK_IMPORTED_MODULE_8__["default"];
45380
+ parser.ast.callbacks['slash'] = _callbacks_slash_mjs__WEBPACK_IMPORTED_MODULE_1__["default"];
45381
+ parser.ast.callbacks['path-literal'] = _callbacks_path_literal_mjs__WEBPACK_IMPORTED_MODULE_4__["default"];
45382
+ parser.ast.callbacks['template-expression'] = _callbacks_template_expression_mjs__WEBPACK_IMPORTED_MODULE_9__["default"];
45383
+ parser.ast.callbacks['template-expression-param-name'] = _callbacks_template_expression_param_name_mjs__WEBPACK_IMPORTED_MODULE_10__["default"];
45384
+ const result = parser.parse(grammar, 'path-template', str);
45385
+ return {
45386
+ result,
45387
+ ast: parser.ast
45388
+ };
45389
+ };
45390
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
45391
+
45392
+ /***/ }),
45393
+
45394
+ /***/ 56167:
45395
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
45396
+
45397
+ "use strict";
45398
+ __webpack_require__.r(__webpack_exports__);
45399
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
45400
+ /* harmony export */ "default": () => (/* binding */ grammar)
45401
+ /* harmony export */ });
45402
+ // copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
45403
+ // license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
45404
+ //
45405
+ // Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
45406
+ function grammar() {
45407
+ // ```
45408
+ // SUMMARY
45409
+ // rules = 20
45410
+ // udts = 0
45411
+ // opcodes = 113
45412
+ // --- ABNF original opcodes
45413
+ // ALT = 10
45414
+ // CAT = 7
45415
+ // REP = 11
45416
+ // RNM = 31
45417
+ // TLS = 51
45418
+ // TBS = 0
45419
+ // TRG = 3
45420
+ // --- SABNF superset opcodes
45421
+ // UDT = 0
45422
+ // AND = 0
45423
+ // NOT = 0
45424
+ // characters = [33 - 126]
45425
+ // ```
45426
+ /* OBJECT IDENTIFIER (for internal parser use) */
45427
+ this.grammarObject = 'grammarObject';
45428
+
45429
+ /* RULES */
45430
+ this.rules = [];
45431
+ this.rules[0] = {
45432
+ name: 'path-template',
45433
+ lower: 'path-template',
45434
+ index: 0,
45435
+ isBkr: false
45436
+ };
45437
+ this.rules[1] = {
45438
+ name: 'path',
45439
+ lower: 'path',
45440
+ index: 1,
45441
+ isBkr: false
45442
+ };
45443
+ this.rules[2] = {
45444
+ name: 'path-segment',
45445
+ lower: 'path-segment',
45446
+ index: 2,
45447
+ isBkr: false
45448
+ };
45449
+ this.rules[3] = {
45450
+ name: 'query',
45451
+ lower: 'query',
45452
+ index: 3,
45453
+ isBkr: false
45454
+ };
45455
+ this.rules[4] = {
45456
+ name: 'query-literal',
45457
+ lower: 'query-literal',
45458
+ index: 4,
45459
+ isBkr: false
45460
+ };
45461
+ this.rules[5] = {
45462
+ name: 'query-marker',
45463
+ lower: 'query-marker',
45464
+ index: 5,
45465
+ isBkr: false
45466
+ };
45467
+ this.rules[6] = {
45468
+ name: 'fragment',
45469
+ lower: 'fragment',
45470
+ index: 6,
45471
+ isBkr: false
45472
+ };
45473
+ this.rules[7] = {
45474
+ name: 'fragment-literal',
45475
+ lower: 'fragment-literal',
45476
+ index: 7,
45477
+ isBkr: false
45478
+ };
45479
+ this.rules[8] = {
45480
+ name: 'fragment-marker',
45481
+ lower: 'fragment-marker',
45482
+ index: 8,
45483
+ isBkr: false
45484
+ };
45485
+ this.rules[9] = {
45486
+ name: 'slash',
45487
+ lower: 'slash',
45488
+ index: 9,
45489
+ isBkr: false
45490
+ };
45491
+ this.rules[10] = {
45492
+ name: 'path-literal',
45493
+ lower: 'path-literal',
45494
+ index: 10,
45495
+ isBkr: false
45496
+ };
45497
+ this.rules[11] = {
45498
+ name: 'template-expression',
45499
+ lower: 'template-expression',
45500
+ index: 11,
45501
+ isBkr: false
45502
+ };
45503
+ this.rules[12] = {
45504
+ name: 'template-expression-param-name',
45505
+ lower: 'template-expression-param-name',
45506
+ index: 12,
45507
+ isBkr: false
45508
+ };
45509
+ this.rules[13] = {
45510
+ name: 'unreserved',
45511
+ lower: 'unreserved',
45512
+ index: 13,
45513
+ isBkr: false
45514
+ };
45515
+ this.rules[14] = {
45516
+ name: 'pct-encoded',
45517
+ lower: 'pct-encoded',
45518
+ index: 14,
45519
+ isBkr: false
45520
+ };
45521
+ this.rules[15] = {
45522
+ name: 'sub-delims',
45523
+ lower: 'sub-delims',
45524
+ index: 15,
45525
+ isBkr: false
45526
+ };
45527
+ this.rules[16] = {
45528
+ name: 'sub-delims-no-slash',
45529
+ lower: 'sub-delims-no-slash',
45530
+ index: 16,
45531
+ isBkr: false
45532
+ };
45533
+ this.rules[17] = {
45534
+ name: 'ALPHA',
45535
+ lower: 'alpha',
45536
+ index: 17,
45537
+ isBkr: false
45538
+ };
45539
+ this.rules[18] = {
45540
+ name: 'DIGIT',
45541
+ lower: 'digit',
45542
+ index: 18,
45543
+ isBkr: false
45544
+ };
45545
+ this.rules[19] = {
45546
+ name: 'HEXDIG',
45547
+ lower: 'hexdig',
45548
+ index: 19,
45549
+ isBkr: false
45550
+ };
45551
+
45552
+ /* UDTS */
45553
+ this.udts = [];
45554
+
45555
+ /* OPCODES */
45556
+ /* path-template */
45557
+ this.rules[0].opcodes = [];
45558
+ this.rules[0].opcodes[0] = {
45559
+ type: 2,
45560
+ children: [1, 2, 6]
45561
+ }; // CAT
45562
+ this.rules[0].opcodes[1] = {
45563
+ type: 4,
45564
+ index: 1
45565
+ }; // RNM(path)
45566
+ this.rules[0].opcodes[2] = {
45567
+ type: 3,
45568
+ min: 0,
45569
+ max: 1
45570
+ }; // REP
45571
+ this.rules[0].opcodes[3] = {
45572
+ type: 2,
45573
+ children: [4, 5]
45574
+ }; // CAT
45575
+ this.rules[0].opcodes[4] = {
45576
+ type: 4,
45577
+ index: 5
45578
+ }; // RNM(query-marker)
45579
+ this.rules[0].opcodes[5] = {
45580
+ type: 4,
45581
+ index: 3
45582
+ }; // RNM(query)
45583
+ this.rules[0].opcodes[6] = {
45584
+ type: 3,
45585
+ min: 0,
45586
+ max: 1
45587
+ }; // REP
45588
+ this.rules[0].opcodes[7] = {
45589
+ type: 2,
45590
+ children: [8, 9]
45591
+ }; // CAT
45592
+ this.rules[0].opcodes[8] = {
45593
+ type: 4,
45594
+ index: 8
45595
+ }; // RNM(fragment-marker)
45596
+ this.rules[0].opcodes[9] = {
45597
+ type: 4,
45598
+ index: 6
45599
+ }; // RNM(fragment)
45600
+
45601
+ /* path */
45602
+ this.rules[1].opcodes = [];
45603
+ this.rules[1].opcodes[0] = {
45604
+ type: 2,
45605
+ children: [1, 2, 6]
45606
+ }; // CAT
45607
+ this.rules[1].opcodes[1] = {
45608
+ type: 4,
45609
+ index: 9
45610
+ }; // RNM(slash)
45611
+ this.rules[1].opcodes[2] = {
45612
+ type: 3,
45613
+ min: 0,
45614
+ max: Infinity
45615
+ }; // REP
45616
+ this.rules[1].opcodes[3] = {
45617
+ type: 2,
45618
+ children: [4, 5]
45619
+ }; // CAT
45620
+ this.rules[1].opcodes[4] = {
45621
+ type: 4,
45622
+ index: 2
45623
+ }; // RNM(path-segment)
45624
+ this.rules[1].opcodes[5] = {
45625
+ type: 4,
45626
+ index: 9
45627
+ }; // RNM(slash)
45628
+ this.rules[1].opcodes[6] = {
45629
+ type: 3,
45630
+ min: 0,
45631
+ max: 1
45632
+ }; // REP
45633
+ this.rules[1].opcodes[7] = {
45634
+ type: 4,
45635
+ index: 2
45636
+ }; // RNM(path-segment)
45637
+
45638
+ /* path-segment */
45639
+ this.rules[2].opcodes = [];
45640
+ this.rules[2].opcodes[0] = {
45641
+ type: 3,
45642
+ min: 1,
45643
+ max: Infinity
45644
+ }; // REP
45645
+ this.rules[2].opcodes[1] = {
45646
+ type: 1,
45647
+ children: [2, 3]
45648
+ }; // ALT
45649
+ this.rules[2].opcodes[2] = {
45650
+ type: 4,
45651
+ index: 10
45652
+ }; // RNM(path-literal)
45653
+ this.rules[2].opcodes[3] = {
45654
+ type: 4,
45655
+ index: 11
45656
+ }; // RNM(template-expression)
45657
+
45658
+ /* query */
45659
+ this.rules[3].opcodes = [];
45660
+ this.rules[3].opcodes[0] = {
45661
+ type: 3,
45662
+ min: 0,
45663
+ max: Infinity
45664
+ }; // REP
45665
+ this.rules[3].opcodes[1] = {
45666
+ type: 4,
45667
+ index: 4
45668
+ }; // RNM(query-literal)
45669
+
45670
+ /* query-literal */
45671
+ this.rules[4].opcodes = [];
45672
+ this.rules[4].opcodes[0] = {
45673
+ type: 3,
45674
+ min: 1,
45675
+ max: Infinity
45676
+ }; // REP
45677
+ this.rules[4].opcodes[1] = {
45678
+ type: 1,
45679
+ children: [2, 3, 4, 5, 6, 7, 8, 9, 10]
45680
+ }; // ALT
45681
+ this.rules[4].opcodes[2] = {
45682
+ type: 4,
45683
+ index: 13
45684
+ }; // RNM(unreserved)
45685
+ this.rules[4].opcodes[3] = {
45686
+ type: 4,
45687
+ index: 14
45688
+ }; // RNM(pct-encoded)
45689
+ this.rules[4].opcodes[4] = {
45690
+ type: 4,
45691
+ index: 15
45692
+ }; // RNM(sub-delims)
45693
+ this.rules[4].opcodes[5] = {
45694
+ type: 7,
45695
+ string: [58]
45696
+ }; // TLS
45697
+ this.rules[4].opcodes[6] = {
45698
+ type: 7,
45699
+ string: [64]
45700
+ }; // TLS
45701
+ this.rules[4].opcodes[7] = {
45702
+ type: 7,
45703
+ string: [47]
45704
+ }; // TLS
45705
+ this.rules[4].opcodes[8] = {
45706
+ type: 7,
45707
+ string: [63]
45708
+ }; // TLS
45709
+ this.rules[4].opcodes[9] = {
45710
+ type: 7,
45711
+ string: [38]
45712
+ }; // TLS
45713
+ this.rules[4].opcodes[10] = {
45714
+ type: 7,
45715
+ string: [61]
45716
+ }; // TLS
45717
+
45718
+ /* query-marker */
45719
+ this.rules[5].opcodes = [];
45720
+ this.rules[5].opcodes[0] = {
45721
+ type: 7,
45722
+ string: [63]
45723
+ }; // TLS
45724
+
45725
+ /* fragment */
45726
+ this.rules[6].opcodes = [];
45727
+ this.rules[6].opcodes[0] = {
45728
+ type: 3,
45729
+ min: 0,
45730
+ max: Infinity
45731
+ }; // REP
45732
+ this.rules[6].opcodes[1] = {
45733
+ type: 4,
45734
+ index: 7
45735
+ }; // RNM(fragment-literal)
45736
+
45737
+ /* fragment-literal */
45738
+ this.rules[7].opcodes = [];
45739
+ this.rules[7].opcodes[0] = {
45740
+ type: 3,
45741
+ min: 1,
45742
+ max: Infinity
45743
+ }; // REP
45744
+ this.rules[7].opcodes[1] = {
45745
+ type: 1,
45746
+ children: [2, 3, 4, 5, 6, 7, 8]
45747
+ }; // ALT
45748
+ this.rules[7].opcodes[2] = {
45749
+ type: 4,
45750
+ index: 13
45751
+ }; // RNM(unreserved)
45752
+ this.rules[7].opcodes[3] = {
45753
+ type: 4,
45754
+ index: 14
45755
+ }; // RNM(pct-encoded)
45756
+ this.rules[7].opcodes[4] = {
45757
+ type: 4,
45758
+ index: 15
45759
+ }; // RNM(sub-delims)
45760
+ this.rules[7].opcodes[5] = {
45761
+ type: 7,
45762
+ string: [58]
45763
+ }; // TLS
45764
+ this.rules[7].opcodes[6] = {
45765
+ type: 7,
45766
+ string: [64]
45767
+ }; // TLS
45768
+ this.rules[7].opcodes[7] = {
45769
+ type: 7,
45770
+ string: [47]
45771
+ }; // TLS
45772
+ this.rules[7].opcodes[8] = {
45773
+ type: 7,
45774
+ string: [63]
45775
+ }; // TLS
45776
+
45777
+ /* fragment-marker */
45778
+ this.rules[8].opcodes = [];
45779
+ this.rules[8].opcodes[0] = {
45780
+ type: 7,
45781
+ string: [35]
45782
+ }; // TLS
45783
+
45784
+ /* slash */
45785
+ this.rules[9].opcodes = [];
45786
+ this.rules[9].opcodes[0] = {
45787
+ type: 7,
45788
+ string: [47]
45789
+ }; // TLS
45790
+
45791
+ /* path-literal */
45792
+ this.rules[10].opcodes = [];
45793
+ this.rules[10].opcodes[0] = {
45794
+ type: 3,
45795
+ min: 1,
45796
+ max: Infinity
45797
+ }; // REP
45798
+ this.rules[10].opcodes[1] = {
45799
+ type: 1,
45800
+ children: [2, 3, 4, 5, 6]
45801
+ }; // ALT
45802
+ this.rules[10].opcodes[2] = {
45803
+ type: 4,
45804
+ index: 13
45805
+ }; // RNM(unreserved)
45806
+ this.rules[10].opcodes[3] = {
45807
+ type: 4,
45808
+ index: 14
45809
+ }; // RNM(pct-encoded)
45810
+ this.rules[10].opcodes[4] = {
45811
+ type: 4,
45812
+ index: 16
45813
+ }; // RNM(sub-delims-no-slash)
45814
+ this.rules[10].opcodes[5] = {
45815
+ type: 7,
45816
+ string: [58]
45817
+ }; // TLS
45818
+ this.rules[10].opcodes[6] = {
45819
+ type: 7,
45820
+ string: [64]
45821
+ }; // TLS
45822
+
45823
+ /* template-expression */
45824
+ this.rules[11].opcodes = [];
45825
+ this.rules[11].opcodes[0] = {
45826
+ type: 2,
45827
+ children: [1, 2, 3]
45828
+ }; // CAT
45829
+ this.rules[11].opcodes[1] = {
45830
+ type: 7,
45831
+ string: [123]
45832
+ }; // TLS
45833
+ this.rules[11].opcodes[2] = {
45834
+ type: 4,
45835
+ index: 12
45836
+ }; // RNM(template-expression-param-name)
45837
+ this.rules[11].opcodes[3] = {
45838
+ type: 7,
45839
+ string: [125]
45840
+ }; // TLS
45841
+
45842
+ /* template-expression-param-name */
45843
+ this.rules[12].opcodes = [];
45844
+ this.rules[12].opcodes[0] = {
45845
+ type: 3,
45846
+ min: 1,
45847
+ max: Infinity
45848
+ }; // REP
45849
+ this.rules[12].opcodes[1] = {
45850
+ type: 1,
45851
+ children: [2, 3, 4, 5, 6]
45852
+ }; // ALT
45853
+ this.rules[12].opcodes[2] = {
45854
+ type: 4,
45855
+ index: 13
45856
+ }; // RNM(unreserved)
45857
+ this.rules[12].opcodes[3] = {
45858
+ type: 4,
45859
+ index: 14
45860
+ }; // RNM(pct-encoded)
45861
+ this.rules[12].opcodes[4] = {
45862
+ type: 4,
45863
+ index: 16
45864
+ }; // RNM(sub-delims-no-slash)
45865
+ this.rules[12].opcodes[5] = {
45866
+ type: 7,
45867
+ string: [58]
45868
+ }; // TLS
45869
+ this.rules[12].opcodes[6] = {
45870
+ type: 7,
45871
+ string: [64]
45872
+ }; // TLS
45873
+
45874
+ /* unreserved */
45875
+ this.rules[13].opcodes = [];
45876
+ this.rules[13].opcodes[0] = {
45877
+ type: 1,
45878
+ children: [1, 2, 3, 4, 5, 6]
45879
+ }; // ALT
45880
+ this.rules[13].opcodes[1] = {
45881
+ type: 4,
45882
+ index: 17
45883
+ }; // RNM(ALPHA)
45884
+ this.rules[13].opcodes[2] = {
45885
+ type: 4,
45886
+ index: 18
45887
+ }; // RNM(DIGIT)
45888
+ this.rules[13].opcodes[3] = {
45889
+ type: 7,
45890
+ string: [45]
45891
+ }; // TLS
45892
+ this.rules[13].opcodes[4] = {
45893
+ type: 7,
45894
+ string: [46]
45895
+ }; // TLS
45896
+ this.rules[13].opcodes[5] = {
45897
+ type: 7,
45898
+ string: [95]
45899
+ }; // TLS
45900
+ this.rules[13].opcodes[6] = {
45901
+ type: 7,
45902
+ string: [126]
45903
+ }; // TLS
45904
+
45905
+ /* pct-encoded */
45906
+ this.rules[14].opcodes = [];
45907
+ this.rules[14].opcodes[0] = {
45908
+ type: 2,
45909
+ children: [1, 2, 3]
45910
+ }; // CAT
45911
+ this.rules[14].opcodes[1] = {
45912
+ type: 7,
45913
+ string: [37]
45914
+ }; // TLS
45915
+ this.rules[14].opcodes[2] = {
45916
+ type: 4,
45917
+ index: 19
45918
+ }; // RNM(HEXDIG)
45919
+ this.rules[14].opcodes[3] = {
45920
+ type: 4,
45921
+ index: 19
45922
+ }; // RNM(HEXDIG)
45923
+
45924
+ /* sub-delims */
45925
+ this.rules[15].opcodes = [];
45926
+ this.rules[15].opcodes[0] = {
45927
+ type: 1,
45928
+ children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
45929
+ }; // ALT
45930
+ this.rules[15].opcodes[1] = {
45931
+ type: 7,
45932
+ string: [33]
45933
+ }; // TLS
45934
+ this.rules[15].opcodes[2] = {
45935
+ type: 7,
45936
+ string: [36]
45937
+ }; // TLS
45938
+ this.rules[15].opcodes[3] = {
45939
+ type: 7,
45940
+ string: [38]
45941
+ }; // TLS
45942
+ this.rules[15].opcodes[4] = {
45943
+ type: 7,
45944
+ string: [39]
45945
+ }; // TLS
45946
+ this.rules[15].opcodes[5] = {
45947
+ type: 7,
45948
+ string: [40]
45949
+ }; // TLS
45950
+ this.rules[15].opcodes[6] = {
45951
+ type: 7,
45952
+ string: [41]
45953
+ }; // TLS
45954
+ this.rules[15].opcodes[7] = {
45955
+ type: 7,
45956
+ string: [42]
45957
+ }; // TLS
45958
+ this.rules[15].opcodes[8] = {
45959
+ type: 7,
45960
+ string: [43]
45961
+ }; // TLS
45962
+ this.rules[15].opcodes[9] = {
45963
+ type: 7,
45964
+ string: [44]
45965
+ }; // TLS
45966
+ this.rules[15].opcodes[10] = {
45967
+ type: 7,
45968
+ string: [59]
45969
+ }; // TLS
45970
+ this.rules[15].opcodes[11] = {
45971
+ type: 7,
45972
+ string: [61]
45973
+ }; // TLS
45974
+
45975
+ /* sub-delims-no-slash */
45976
+ this.rules[16].opcodes = [];
45977
+ this.rules[16].opcodes[0] = {
45978
+ type: 1,
45979
+ children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
45980
+ }; // ALT
45981
+ this.rules[16].opcodes[1] = {
45982
+ type: 7,
45983
+ string: [33]
45984
+ }; // TLS
45985
+ this.rules[16].opcodes[2] = {
45986
+ type: 7,
45987
+ string: [36]
45988
+ }; // TLS
45989
+ this.rules[16].opcodes[3] = {
45990
+ type: 7,
45991
+ string: [38]
45992
+ }; // TLS
45993
+ this.rules[16].opcodes[4] = {
45994
+ type: 7,
45995
+ string: [39]
45996
+ }; // TLS
45997
+ this.rules[16].opcodes[5] = {
45998
+ type: 7,
45999
+ string: [40]
46000
+ }; // TLS
46001
+ this.rules[16].opcodes[6] = {
46002
+ type: 7,
46003
+ string: [41]
46004
+ }; // TLS
46005
+ this.rules[16].opcodes[7] = {
46006
+ type: 7,
46007
+ string: [42]
46008
+ }; // TLS
46009
+ this.rules[16].opcodes[8] = {
46010
+ type: 7,
46011
+ string: [43]
46012
+ }; // TLS
46013
+ this.rules[16].opcodes[9] = {
46014
+ type: 7,
46015
+ string: [44]
46016
+ }; // TLS
46017
+ this.rules[16].opcodes[10] = {
46018
+ type: 7,
46019
+ string: [59]
46020
+ }; // TLS
46021
+
46022
+ /* ALPHA */
46023
+ this.rules[17].opcodes = [];
46024
+ this.rules[17].opcodes[0] = {
46025
+ type: 1,
46026
+ children: [1, 2]
46027
+ }; // ALT
46028
+ this.rules[17].opcodes[1] = {
46029
+ type: 5,
46030
+ min: 65,
46031
+ max: 90
46032
+ }; // TRG
46033
+ this.rules[17].opcodes[2] = {
46034
+ type: 5,
46035
+ min: 97,
46036
+ max: 122
46037
+ }; // TRG
46038
+
46039
+ /* DIGIT */
46040
+ this.rules[18].opcodes = [];
46041
+ this.rules[18].opcodes[0] = {
46042
+ type: 5,
46043
+ min: 48,
46044
+ max: 57
46045
+ }; // TRG
46046
+
46047
+ /* HEXDIG */
46048
+ this.rules[19].opcodes = [];
46049
+ this.rules[19].opcodes[0] = {
46050
+ type: 1,
46051
+ children: [1, 2, 3, 4, 5, 6, 7]
46052
+ }; // ALT
46053
+ this.rules[19].opcodes[1] = {
46054
+ type: 4,
46055
+ index: 18
46056
+ }; // RNM(DIGIT)
46057
+ this.rules[19].opcodes[2] = {
46058
+ type: 7,
46059
+ string: [97]
46060
+ }; // TLS
46061
+ this.rules[19].opcodes[3] = {
46062
+ type: 7,
46063
+ string: [98]
46064
+ }; // TLS
46065
+ this.rules[19].opcodes[4] = {
46066
+ type: 7,
46067
+ string: [99]
46068
+ }; // TLS
46069
+ this.rules[19].opcodes[5] = {
46070
+ type: 7,
46071
+ string: [100]
46072
+ }; // TLS
46073
+ this.rules[19].opcodes[6] = {
46074
+ type: 7,
46075
+ string: [101]
46076
+ }; // TLS
46077
+ this.rules[19].opcodes[7] = {
46078
+ type: 7,
46079
+ string: [102]
46080
+ }; // TLS
46081
+
46082
+ // The `toString()` function will display the original grammar file(s) that produced these opcodes.
46083
+ this.toString = function toString() {
46084
+ let str = "";
46085
+ str += "; OpenAPI Path Templating ABNF syntax\n";
46086
+ str += "path-template = path [ query-marker query ] [ fragment-marker fragment ]\n";
46087
+ str += "path = slash *( path-segment slash ) [ path-segment ]\n";
46088
+ str += "path-segment = 1*( path-literal / template-expression )\n";
46089
+ str += "query = *( query-literal )\n";
46090
+ str += "query-literal = 1*( unreserved / pct-encoded / sub-delims / \":\" / \"@\" / \"/\" / \"?\" / \"&\" / \"=\" )\n";
46091
+ str += "query-marker = \"?\"\n";
46092
+ str += "fragment = *( fragment-literal )\n";
46093
+ str += "fragment-literal = 1*( unreserved / pct-encoded / sub-delims / \":\" / \"@\" / \"/\" / \"?\" )\n";
46094
+ str += "fragment-marker = \"#\"\n";
46095
+ str += "slash = \"/\"\n";
46096
+ str += "path-literal = 1*( unreserved / pct-encoded / sub-delims-no-slash / \":\" / \"@\" )\n";
46097
+ str += "template-expression = \"{\" template-expression-param-name \"}\"\n";
46098
+ str += "template-expression-param-name = 1*( unreserved / pct-encoded / sub-delims-no-slash / \":\" / \"@\" )\n";
46099
+ str += "\n";
46100
+ str += "; Characters definitions (from RFC 3986)\n";
46101
+ str += "unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n";
46102
+ str += "pct-encoded = \"%\" HEXDIG HEXDIG\n";
46103
+ str += "sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n";
46104
+ str += " / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n";
46105
+ str += "sub-delims-no-slash = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n";
46106
+ str += " / \"*\" / \"+\" / \",\" / \";\"\n";
46107
+ str += "ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n";
46108
+ str += "DIGIT = %x30-39 ; 0-9\n";
46109
+ str += "HEXDIG = DIGIT / \"A\" / \"B\" / \"C\" / \"D\" / \"E\" / \"F\"\n";
46110
+ return str;
46111
+ };
46112
+ }
46113
+
46114
+ /***/ }),
46115
+
46116
+ /***/ 97642:
46117
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
46118
+
46119
+ "use strict";
46120
+ __webpack_require__.r(__webpack_exports__);
46121
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
46122
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
46123
+ /* harmony export */ encodePathComponent: () => (/* binding */ encodePathComponent)
46124
+ /* harmony export */ });
46125
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10426);
46126
+
46127
+ const isEncoded = component => {
46128
+ try {
46129
+ return typeof component === 'string' && decodeURIComponent(component) !== component;
46130
+ } catch (e) {
46131
+ return false;
46132
+ }
46133
+ };
46134
+ const encodePathComponent = component => {
46135
+ if (isEncoded(component)) {
46136
+ return component;
46137
+ }
46138
+ return encodeURIComponent(component);
46139
+ };
46140
+ const significantTypes = ['slash', 'path-literal', 'query-marker', 'query-literal', 'template-expression-param-name'];
46141
+ const resolve = (pathTemplate, parameters = {}, options = {}) => {
46142
+ const defaultOptions = {
46143
+ encoder: encodePathComponent
46144
+ };
46145
+ const mergedOptions = {
46146
+ ...defaultOptions,
46147
+ ...options
46148
+ };
46149
+ const parseResult = (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(pathTemplate);
46150
+ if (!parseResult.result.success) return pathTemplate;
46151
+ const parts = [];
46152
+ parseResult.ast.translate(parts);
46153
+ const resolvedParts = parts.filter(([type]) => significantTypes.includes(type)).map(([type, value]) => {
46154
+ if (type === 'template-expression-param-name') {
46155
+ return Object.hasOwn(parameters, value) ? mergedOptions.encoder(parameters[value]) : `{${value}}`;
46156
+ }
46157
+ return value;
46158
+ });
46159
+ return resolvedParts.join('');
46160
+ };
46161
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolve);
46162
+
46163
+ /***/ }),
46164
+
46165
+ /***/ 62674:
46166
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
46167
+
46168
+ "use strict";
46169
+ __webpack_require__.r(__webpack_exports__);
46170
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
46171
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
46172
+ /* harmony export */ });
46173
+ /* harmony import */ var _parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10426);
46174
+
46175
+ /**
46176
+ * Test if a string is a path template.
46177
+ *
46178
+ * @param {string} str
46179
+ * @param {Object} [options={}] - An object.
46180
+ * @param {boolean} [options.strict=true] - A boolean indicating presence of at least one `template-expression` AST node.
46181
+ * @returns {boolean}
46182
+ */
46183
+ const test = (str, {
46184
+ strict = false
46185
+ } = {}) => {
46186
+ try {
46187
+ const parseResult = (0,_parse_index_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(str);
46188
+ if (!parseResult.result.success) return false;
46189
+ if (!strict) return true;
46190
+ const parts = [];
46191
+ parseResult.ast.translate(parts);
46192
+ return parts.some(([type]) => type === 'template-expression');
46193
+ } catch {
46194
+ return false;
46195
+ }
46196
+ };
46197
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (test);
46198
+
43826
46199
  /***/ }),
43827
46200
 
43828
46201
  /***/ 89360: