pfwr 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/index.js +532 -159
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -68486,10 +68486,19 @@ function transform$1(tree) {
|
|
|
68486
68486
|
|
|
68487
68487
|
}
|
|
68488
68488
|
|
|
68489
|
-
/*! js-yaml 5.
|
|
68489
|
+
/*! js-yaml 5.3.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
68490
68490
|
//#region src/tag.ts
|
|
68491
|
+
/**
|
|
68492
|
+
* Returned by a scalar resolver when the source does not match its tag.
|
|
68493
|
+
*
|
|
68494
|
+
* @category Tags
|
|
68495
|
+
*/
|
|
68491
68496
|
var NOT_RESOLVED = Symbol("NOT_RESOLVED");
|
|
68492
|
-
|
|
68497
|
+
/**
|
|
68498
|
+
* Create a normalized scalar tag definition.
|
|
68499
|
+
*
|
|
68500
|
+
* @category Tags
|
|
68501
|
+
*/
|
|
68493
68502
|
function defineScalarTag(tagName, options) {
|
|
68494
68503
|
return {
|
|
68495
68504
|
tagName,
|
|
@@ -68498,11 +68507,16 @@ function defineScalarTag(tagName, options) {
|
|
|
68498
68507
|
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
68499
68508
|
implicitFirstChars: options.implicitFirstChars ?? null,
|
|
68500
68509
|
resolve: options.resolve,
|
|
68501
|
-
identify: options.identify
|
|
68510
|
+
identify: options.identify,
|
|
68502
68511
|
represent: options.represent ?? ((data) => String(data)),
|
|
68503
|
-
representTagName: options.representTagName ??
|
|
68512
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
68504
68513
|
};
|
|
68505
68514
|
}
|
|
68515
|
+
/**
|
|
68516
|
+
* Create a normalized sequence tag definition.
|
|
68517
|
+
*
|
|
68518
|
+
* @category Tags
|
|
68519
|
+
*/
|
|
68506
68520
|
function defineSequenceTag(tagName, options) {
|
|
68507
68521
|
const carrierIsResult = options.finalize === void 0;
|
|
68508
68522
|
return {
|
|
@@ -68514,11 +68528,16 @@ function defineSequenceTag(tagName, options) {
|
|
|
68514
68528
|
addItem: options.addItem,
|
|
68515
68529
|
finalize: options.finalize ?? ((carrier) => carrier),
|
|
68516
68530
|
carrierIsResult,
|
|
68517
|
-
identify: options.identify
|
|
68531
|
+
identify: options.identify,
|
|
68518
68532
|
represent: options.represent ?? ((data) => data),
|
|
68519
|
-
representTagName: options.representTagName ??
|
|
68533
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
68520
68534
|
};
|
|
68521
68535
|
}
|
|
68536
|
+
/**
|
|
68537
|
+
* Create a normalized mapping tag definition.
|
|
68538
|
+
*
|
|
68539
|
+
* @category Tags
|
|
68540
|
+
*/
|
|
68522
68541
|
function defineMappingTag(tagName, options) {
|
|
68523
68542
|
const carrierIsResult = options.finalize === void 0;
|
|
68524
68543
|
return {
|
|
@@ -68533,13 +68552,14 @@ function defineMappingTag(tagName, options) {
|
|
|
68533
68552
|
get: options.get,
|
|
68534
68553
|
finalize: options.finalize ?? ((carrier) => carrier),
|
|
68535
68554
|
carrierIsResult,
|
|
68536
|
-
identify: options.identify
|
|
68555
|
+
identify: options.identify,
|
|
68537
68556
|
represent: options.represent ?? ((data) => data),
|
|
68538
|
-
representTagName: options.representTagName ??
|
|
68557
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
68539
68558
|
};
|
|
68540
68559
|
}
|
|
68541
68560
|
//#endregion
|
|
68542
68561
|
//#region src/tag/scalar/str.ts
|
|
68562
|
+
/** @category Tags */
|
|
68543
68563
|
var strTag = defineScalarTag("tag:yaml.org,2002:str", {
|
|
68544
68564
|
resolve: (source) => source,
|
|
68545
68565
|
identify: (data) => typeof data === "string"
|
|
@@ -68553,6 +68573,7 @@ var NULL_VALUES$1 = [
|
|
|
68553
68573
|
"Null",
|
|
68554
68574
|
"NULL"
|
|
68555
68575
|
];
|
|
68576
|
+
/** @category Tags */
|
|
68556
68577
|
var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68557
68578
|
implicit: true,
|
|
68558
68579
|
implicitFirstChars: [
|
|
@@ -68570,6 +68591,7 @@ var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
|
68570
68591
|
});
|
|
68571
68592
|
//#endregion
|
|
68572
68593
|
//#region src/tag/scalar/null_json.ts
|
|
68594
|
+
/** @category Tags */
|
|
68573
68595
|
var nullJsonTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68574
68596
|
implicit: true,
|
|
68575
68597
|
implicitFirstChars: ["n"],
|
|
@@ -68589,6 +68611,7 @@ var NULL_VALUES = [
|
|
|
68589
68611
|
"Null",
|
|
68590
68612
|
"NULL"
|
|
68591
68613
|
];
|
|
68614
|
+
/** @category Tags */
|
|
68592
68615
|
var nullYaml11Tag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68593
68616
|
implicit: true,
|
|
68594
68617
|
implicitFirstChars: [
|
|
@@ -68616,6 +68639,7 @@ var FALSE_VALUES$2 = [
|
|
|
68616
68639
|
"False",
|
|
68617
68640
|
"FALSE"
|
|
68618
68641
|
];
|
|
68642
|
+
/** @category Tags */
|
|
68619
68643
|
var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68620
68644
|
implicit: true,
|
|
68621
68645
|
implicitFirstChars: [
|
|
@@ -68636,6 +68660,7 @@ var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
|
68636
68660
|
//#region src/tag/scalar/bool_json.ts
|
|
68637
68661
|
var TRUE_VALUES$1 = ["true"];
|
|
68638
68662
|
var FALSE_VALUES$1 = ["false"];
|
|
68663
|
+
/** @category Tags */
|
|
68639
68664
|
var boolJsonTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68640
68665
|
implicit: true,
|
|
68641
68666
|
implicitFirstChars: ["t", "f"],
|
|
@@ -68675,6 +68700,7 @@ var FALSE_VALUES = [
|
|
|
68675
68700
|
"Off",
|
|
68676
68701
|
"OFF"
|
|
68677
68702
|
];
|
|
68703
|
+
/** @category Tags */
|
|
68678
68704
|
var boolYaml11Tag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68679
68705
|
implicit: true,
|
|
68680
68706
|
implicitFirstChars: [
|
|
@@ -68720,6 +68746,7 @@ function resolveYamlInteger$2(source, isExplicit) {
|
|
|
68720
68746
|
const result = parseYamlInteger$2(source);
|
|
68721
68747
|
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68722
68748
|
}
|
|
68749
|
+
/** @category Tags */
|
|
68723
68750
|
var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68724
68751
|
implicit: true,
|
|
68725
68752
|
implicitFirstChars: [
|
|
@@ -68754,6 +68781,7 @@ function resolveYamlInteger$1(source, isExplicit) {
|
|
|
68754
68781
|
const result = parseYamlInteger$1(source);
|
|
68755
68782
|
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68756
68783
|
}
|
|
68784
|
+
/** @category Tags */
|
|
68757
68785
|
var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68758
68786
|
implicit: true,
|
|
68759
68787
|
implicitFirstChars: ["-", ..."0123456789"],
|
|
@@ -68786,6 +68814,7 @@ function resolveYamlInteger(source) {
|
|
|
68786
68814
|
const result = parseYamlInteger(source);
|
|
68787
68815
|
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68788
68816
|
}
|
|
68817
|
+
/** @category Tags */
|
|
68789
68818
|
var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68790
68819
|
implicit: true,
|
|
68791
68820
|
implicitFirstChars: [
|
|
@@ -68820,6 +68849,7 @@ function representYamlFloat$2(object) {
|
|
|
68820
68849
|
const result = object.toString(10);
|
|
68821
68850
|
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68822
68851
|
}
|
|
68852
|
+
/** @category Tags */
|
|
68823
68853
|
var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68824
68854
|
implicit: true,
|
|
68825
68855
|
implicitFirstChars: [
|
|
@@ -68860,6 +68890,7 @@ function representYamlFloat$1(object) {
|
|
|
68860
68890
|
const result = object.toString(10);
|
|
68861
68891
|
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68862
68892
|
}
|
|
68893
|
+
/** @category Tags */
|
|
68863
68894
|
var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68864
68895
|
implicit: true,
|
|
68865
68896
|
implicitFirstChars: ["-", ..."0123456789"],
|
|
@@ -68894,6 +68925,7 @@ function representYamlFloat(object) {
|
|
|
68894
68925
|
const result = object.toString(10);
|
|
68895
68926
|
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68896
68927
|
}
|
|
68928
|
+
/** @category Tags */
|
|
68897
68929
|
var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68898
68930
|
implicit: true,
|
|
68899
68931
|
implicitFirstChars: [
|
|
@@ -68908,13 +68940,20 @@ var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
|
68908
68940
|
});
|
|
68909
68941
|
//#endregion
|
|
68910
68942
|
//#region src/tag/scalar/merge.ts
|
|
68943
|
+
/**
|
|
68944
|
+
* Enables merge keys in {@link CORE_SCHEMA} when added with
|
|
68945
|
+
* {@link Schema.withTags}.
|
|
68946
|
+
*
|
|
68947
|
+
* @category Tags
|
|
68948
|
+
*/
|
|
68911
68949
|
var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
|
68912
68950
|
implicit: true,
|
|
68913
68951
|
implicitFirstChars: ["<"],
|
|
68914
68952
|
resolve: (source, isExplicit) => {
|
|
68915
|
-
if (source === "<<" || isExplicit && source === "") return
|
|
68953
|
+
if (source === "<<" || isExplicit && source === "") return "<<";
|
|
68916
68954
|
return NOT_RESOLVED;
|
|
68917
|
-
}
|
|
68955
|
+
},
|
|
68956
|
+
identify: () => false
|
|
68918
68957
|
});
|
|
68919
68958
|
//#endregion
|
|
68920
68959
|
//#region src/tag/scalar/binary.ts
|
|
@@ -68932,6 +68971,11 @@ function representYamlBinary(object) {
|
|
|
68932
68971
|
for (let index = 0; index < object.length; index++) binary += String.fromCharCode(object[index]);
|
|
68933
68972
|
return btoa(binary);
|
|
68934
68973
|
}
|
|
68974
|
+
/**
|
|
68975
|
+
* The `!!binary` tag, represented as a `Uint8Array`.
|
|
68976
|
+
*
|
|
68977
|
+
* @category Tags
|
|
68978
|
+
*/
|
|
68935
68979
|
var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
68936
68980
|
resolve: resolveYamlBinary,
|
|
68937
68981
|
identify: (object) => Object.prototype.toString.call(object) === "[object Uint8Array]",
|
|
@@ -68941,6 +68985,11 @@ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
|
68941
68985
|
//#region src/tag/scalar/timestamp.ts
|
|
68942
68986
|
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
68943
68987
|
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
68988
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
68989
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
68990
|
+
date.setUTCFullYear(year, month, day);
|
|
68991
|
+
return date;
|
|
68992
|
+
}
|
|
68944
68993
|
function resolveYamlTimestamp(source) {
|
|
68945
68994
|
let match = YAML_DATE_REGEXP.exec(source);
|
|
68946
68995
|
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
@@ -68949,7 +68998,7 @@ function resolveYamlTimestamp(source) {
|
|
|
68949
68998
|
const month = +match[2] - 1;
|
|
68950
68999
|
const day = +match[3];
|
|
68951
69000
|
if (!match[4]) {
|
|
68952
|
-
const date =
|
|
69001
|
+
const date = makeUtcDate(year, month, day);
|
|
68953
69002
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
68954
69003
|
return date;
|
|
68955
69004
|
}
|
|
@@ -68963,7 +69012,7 @@ function resolveYamlTimestamp(source) {
|
|
|
68963
69012
|
while (value.length < 3) value += "0";
|
|
68964
69013
|
fraction = +value;
|
|
68965
69014
|
}
|
|
68966
|
-
const date =
|
|
69015
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
68967
69016
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
68968
69017
|
if (match[9]) {
|
|
68969
69018
|
const offsetHour = +match[10];
|
|
@@ -68974,6 +69023,11 @@ function resolveYamlTimestamp(source) {
|
|
|
68974
69023
|
}
|
|
68975
69024
|
return date;
|
|
68976
69025
|
}
|
|
69026
|
+
/**
|
|
69027
|
+
* The YAML 1.1 `!!timestamp` tag, represented as a JavaScript `Date`.
|
|
69028
|
+
*
|
|
69029
|
+
* @category Tags
|
|
69030
|
+
*/
|
|
68977
69031
|
var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
|
|
68978
69032
|
implicit: true,
|
|
68979
69033
|
implicitFirstChars: [..."0123456789"],
|
|
@@ -68983,6 +69037,7 @@ var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
|
|
|
68983
69037
|
});
|
|
68984
69038
|
//#endregion
|
|
68985
69039
|
//#region src/tag/sequence/seq.ts
|
|
69040
|
+
/** @category Tags */
|
|
68986
69041
|
var seqTag = defineSequenceTag("tag:yaml.org,2002:seq", {
|
|
68987
69042
|
create: () => [],
|
|
68988
69043
|
addItem: (container, item) => {
|
|
@@ -69004,6 +69059,28 @@ function pick(object, keys) {
|
|
|
69004
69059
|
}
|
|
69005
69060
|
//#endregion
|
|
69006
69061
|
//#region src/tag/sequence/omap.ts
|
|
69062
|
+
/**
|
|
69063
|
+
* Provided only for YAML 1.1 compatibility and supported by the loader only.
|
|
69064
|
+
* JavaScript has no dedicated class to represent this type, so it cannot be
|
|
69065
|
+
* identified and dumped.
|
|
69066
|
+
*
|
|
69067
|
+
* ```yaml
|
|
69068
|
+
* !!omap
|
|
69069
|
+
* - one: 1
|
|
69070
|
+
* - two: 2
|
|
69071
|
+
* ```
|
|
69072
|
+
*
|
|
69073
|
+
* is loaded as
|
|
69074
|
+
*
|
|
69075
|
+
* ```javascript
|
|
69076
|
+
* [
|
|
69077
|
+
* { one: 1 },
|
|
69078
|
+
* { two: 2 }
|
|
69079
|
+
* ]
|
|
69080
|
+
* ```
|
|
69081
|
+
*
|
|
69082
|
+
* @category Tags
|
|
69083
|
+
*/
|
|
69007
69084
|
var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
69008
69085
|
create: () => ({
|
|
69009
69086
|
list: [],
|
|
@@ -69024,10 +69101,33 @@ var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
|
69024
69101
|
carrier.list.push(item);
|
|
69025
69102
|
return "";
|
|
69026
69103
|
},
|
|
69027
|
-
finalize: (carrier) => carrier.list
|
|
69104
|
+
finalize: (carrier) => carrier.list,
|
|
69105
|
+
identify: () => false
|
|
69028
69106
|
});
|
|
69029
69107
|
//#endregion
|
|
69030
69108
|
//#region src/tag/sequence/pairs.ts
|
|
69109
|
+
/**
|
|
69110
|
+
* Provided only for YAML 1.1 compatibility and supported by the loader only.
|
|
69111
|
+
* JavaScript has no dedicated class to represent this type, so it cannot be
|
|
69112
|
+
* identified and dumped.
|
|
69113
|
+
*
|
|
69114
|
+
* ```yaml
|
|
69115
|
+
* !!pairs
|
|
69116
|
+
* - one: 1
|
|
69117
|
+
* - two: 2
|
|
69118
|
+
* ```
|
|
69119
|
+
*
|
|
69120
|
+
* is loaded as
|
|
69121
|
+
*
|
|
69122
|
+
* ```javascript
|
|
69123
|
+
* [
|
|
69124
|
+
* ['one', 1],
|
|
69125
|
+
* ['two', 2]
|
|
69126
|
+
* ]
|
|
69127
|
+
* ```
|
|
69128
|
+
*
|
|
69129
|
+
* @category Tags
|
|
69130
|
+
*/
|
|
69031
69131
|
var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
69032
69132
|
create: () => [],
|
|
69033
69133
|
addItem: (container, item) => {
|
|
@@ -69042,10 +69142,32 @@ var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
|
69042
69142
|
if (keys.length !== 1) return "cannot resolve a pairs item";
|
|
69043
69143
|
container.push([keys[0], object[keys[0]]]);
|
|
69044
69144
|
return "";
|
|
69045
|
-
}
|
|
69145
|
+
},
|
|
69146
|
+
identify: () => false
|
|
69046
69147
|
});
|
|
69047
69148
|
//#endregion
|
|
69048
69149
|
//#region src/tag/mapping/map.ts
|
|
69150
|
+
/**
|
|
69151
|
+
* This is the default mapping implementation. It uses `{}` objects and has only
|
|
69152
|
+
* partial functionality due to language limitations. This choice was made
|
|
69153
|
+
* because users expect to get JavaScript objects, and it was left unchanged to
|
|
69154
|
+
* avoid too many breaking changes in the v5 release.
|
|
69155
|
+
*
|
|
69156
|
+
* Side effects:
|
|
69157
|
+
*
|
|
69158
|
+
* - `Object.hasOwn()` checks or `for...of` loops are required for safe use (to
|
|
69159
|
+
* avoid falling through to prototypes).
|
|
69160
|
+
* - Only scalar string keys are supported properly.
|
|
69161
|
+
* - Other scalar keys, such as `null` and numbers, are converted to strings.
|
|
69162
|
+
* This is historical behaviour, and it can cause side effects such as
|
|
69163
|
+
* problems with `!!merge`.
|
|
69164
|
+
*
|
|
69165
|
+
* Note that non-string scalar keys may be deprecated in future versions.
|
|
69166
|
+
*
|
|
69167
|
+
* Ideally, use {@link realMapTag} instead.
|
|
69168
|
+
*
|
|
69169
|
+
* @category Tags
|
|
69170
|
+
*/
|
|
69049
69171
|
var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
69050
69172
|
create: () => ({}),
|
|
69051
69173
|
identify: isPlainObject,
|
|
@@ -69071,10 +69193,19 @@ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
69071
69193
|
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
69072
69194
|
},
|
|
69073
69195
|
keys: (container) => Object.keys(container),
|
|
69074
|
-
get: (container, key) =>
|
|
69196
|
+
get: (container, key) => {
|
|
69197
|
+
const normalizedKey = String(key);
|
|
69198
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
69199
|
+
return container[normalizedKey];
|
|
69200
|
+
}
|
|
69075
69201
|
});
|
|
69076
69202
|
//#endregion
|
|
69077
69203
|
//#region src/tag/mapping/set.ts
|
|
69204
|
+
/**
|
|
69205
|
+
* The YAML 1.1 `!!set` tag, represented as a JavaScript `Set`.
|
|
69206
|
+
*
|
|
69207
|
+
* @category Tags
|
|
69208
|
+
*/
|
|
69078
69209
|
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
69079
69210
|
create: () => /* @__PURE__ */ new Set(),
|
|
69080
69211
|
identify: (data) => data instanceof Set,
|
|
@@ -69096,9 +69227,9 @@ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
|
69096
69227
|
//#region src/schema.ts
|
|
69097
69228
|
function createTagDefinitionMap() {
|
|
69098
69229
|
return {
|
|
69099
|
-
scalar:
|
|
69100
|
-
sequence:
|
|
69101
|
-
mapping:
|
|
69230
|
+
scalar: Object.create(null),
|
|
69231
|
+
sequence: Object.create(null),
|
|
69232
|
+
mapping: Object.create(null)
|
|
69102
69233
|
};
|
|
69103
69234
|
}
|
|
69104
69235
|
function createTagDefinitionListMap() {
|
|
@@ -69123,13 +69254,42 @@ function compileTags(tags) {
|
|
|
69123
69254
|
}
|
|
69124
69255
|
return result;
|
|
69125
69256
|
}
|
|
69257
|
+
/**
|
|
69258
|
+
* Controls tag resolution when loading and type selection when dumping.
|
|
69259
|
+
*
|
|
69260
|
+
* @category Schemas
|
|
69261
|
+
*/
|
|
69126
69262
|
var Schema = class Schema {
|
|
69127
69263
|
tags;
|
|
69264
|
+
/** @internal */
|
|
69128
69265
|
implicitScalarTags;
|
|
69266
|
+
/**
|
|
69267
|
+
* Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds
|
|
69268
|
+
* the resolvers that may match that key, in schema order; a key absent from
|
|
69269
|
+
* the map uses
|
|
69270
|
+
* {@link Schema.implicitScalarAnyFirstChar}
|
|
69271
|
+
* (resolvers that declared no first-char constraint, so they apply to any
|
|
69272
|
+
* first character).
|
|
69273
|
+
*/
|
|
69129
69274
|
implicitScalarByFirstChar;
|
|
69130
69275
|
implicitScalarAnyFirstChar;
|
|
69276
|
+
/**
|
|
69277
|
+
* The default scalar tag (`!!str`), resolved once so the composer's fallback
|
|
69278
|
+
* for unresolved plain scalars avoids a keyed lookup per scalar.
|
|
69279
|
+
*
|
|
69280
|
+
* @internal
|
|
69281
|
+
*/
|
|
69131
69282
|
defaultScalarTag;
|
|
69283
|
+
/**
|
|
69284
|
+
* The default container tags (`!!seq` / `!!map`), used by the dumper: when a
|
|
69285
|
+
* value is identified by its default tag, the tag is implicit and not
|
|
69286
|
+
* printed. Undefined if the schema does not define them (then such values
|
|
69287
|
+
* can't be dumped).
|
|
69288
|
+
*
|
|
69289
|
+
* @internal
|
|
69290
|
+
*/
|
|
69132
69291
|
defaultSequenceTag;
|
|
69292
|
+
/** @internal */
|
|
69133
69293
|
defaultMappingTag;
|
|
69134
69294
|
exact;
|
|
69135
69295
|
prefix;
|
|
@@ -69175,17 +69335,74 @@ var Schema = class Schema {
|
|
|
69175
69335
|
this.exact = exact;
|
|
69176
69336
|
this.prefix = prefix;
|
|
69177
69337
|
}
|
|
69338
|
+
/** @internal */
|
|
69339
|
+
lookupScalarTag(tagName) {
|
|
69340
|
+
const exactTag = this.exact.scalar[tagName];
|
|
69341
|
+
if (exactTag) return exactTag;
|
|
69342
|
+
for (const tag of this.prefix.scalar) if (tagName.startsWith(tag.tagName)) return tag;
|
|
69343
|
+
}
|
|
69344
|
+
/** @internal */
|
|
69345
|
+
lookupSequenceTag(tagName) {
|
|
69346
|
+
const exactTag = this.exact.sequence[tagName];
|
|
69347
|
+
if (exactTag) return exactTag;
|
|
69348
|
+
for (const tag of this.prefix.sequence) if (tagName.startsWith(tag.tagName)) return tag;
|
|
69349
|
+
}
|
|
69350
|
+
/** @internal */
|
|
69351
|
+
lookupMappingTag(tagName) {
|
|
69352
|
+
const exactTag = this.exact.mapping[tagName];
|
|
69353
|
+
if (exactTag) return exactTag;
|
|
69354
|
+
for (const tag of this.prefix.mapping) if (tagName.startsWith(tag.tagName)) return tag;
|
|
69355
|
+
}
|
|
69356
|
+
/** @internal */
|
|
69357
|
+
resolveImplicitScalarTag(source) {
|
|
69358
|
+
const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ?? this.implicitScalarAnyFirstChar;
|
|
69359
|
+
for (const tag of candidates) {
|
|
69360
|
+
const value = tag.resolve(source, false, tag.tagName);
|
|
69361
|
+
if (value !== NOT_RESOLVED) return {
|
|
69362
|
+
value,
|
|
69363
|
+
tag
|
|
69364
|
+
};
|
|
69365
|
+
}
|
|
69366
|
+
const tag = this.defaultScalarTag;
|
|
69367
|
+
return {
|
|
69368
|
+
value: tag.resolve(source, false, tag.tagName),
|
|
69369
|
+
tag
|
|
69370
|
+
};
|
|
69371
|
+
}
|
|
69372
|
+
/**
|
|
69373
|
+
* Creates a new schema with the specified tags added. If a tag already
|
|
69374
|
+
* exists, it is replaced by the specified tag.
|
|
69375
|
+
*
|
|
69376
|
+
* @example
|
|
69377
|
+
*
|
|
69378
|
+
* ```javascript
|
|
69379
|
+
* import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'
|
|
69380
|
+
*
|
|
69381
|
+
* const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag)
|
|
69382
|
+
* ```
|
|
69383
|
+
*/
|
|
69178
69384
|
withTags(...tags) {
|
|
69179
69385
|
let flatTags = [];
|
|
69180
69386
|
for (const tag of tags) flatTags = flatTags.concat(tag);
|
|
69181
69387
|
return new Schema([...this.tags, ...flatTags]);
|
|
69182
69388
|
}
|
|
69183
69389
|
};
|
|
69390
|
+
/**
|
|
69391
|
+
* The YAML 1.2 Failsafe Schema: strings, sequences, and mappings.
|
|
69392
|
+
*
|
|
69393
|
+
* @category Schemas
|
|
69394
|
+
*/
|
|
69184
69395
|
var FAILSAFE_SCHEMA = new Schema([
|
|
69185
69396
|
strTag,
|
|
69186
69397
|
seqTag,
|
|
69187
69398
|
mapTag
|
|
69188
69399
|
]);
|
|
69400
|
+
/**
|
|
69401
|
+
* The YAML 1.2 JSON Schema. It uses JSON scalar forms while retaining YAML
|
|
69402
|
+
* collection syntax.
|
|
69403
|
+
*
|
|
69404
|
+
* @category Schemas
|
|
69405
|
+
*/
|
|
69189
69406
|
new Schema([
|
|
69190
69407
|
...FAILSAFE_SCHEMA.tags,
|
|
69191
69408
|
nullJsonTag,
|
|
@@ -69193,6 +69410,25 @@ new Schema([
|
|
|
69193
69410
|
intJsonTag,
|
|
69194
69411
|
floatJsonTag
|
|
69195
69412
|
]);
|
|
69413
|
+
/**
|
|
69414
|
+
* The default schema for the loaders. Note, {@link CORE_SCHEMA} comes
|
|
69415
|
+
* without the `!!merge` tag. You can easily enable it if needed.
|
|
69416
|
+
*
|
|
69417
|
+
* @example
|
|
69418
|
+
* Enable {@link mergeTag}:
|
|
69419
|
+
*
|
|
69420
|
+
* ```javascript
|
|
69421
|
+
* import { load, CORE_SCHEMA, mergeTag } from 'js-yaml'
|
|
69422
|
+
*
|
|
69423
|
+
* try {
|
|
69424
|
+
* load(data, { schema: CORE_SCHEMA.withTags(mergeTag) })
|
|
69425
|
+
* } catch (e) {
|
|
69426
|
+
* console.error(e)
|
|
69427
|
+
* }
|
|
69428
|
+
* ```
|
|
69429
|
+
*
|
|
69430
|
+
* @category Schemas
|
|
69431
|
+
*/
|
|
69196
69432
|
var CORE_SCHEMA = new Schema([
|
|
69197
69433
|
...FAILSAFE_SCHEMA.tags,
|
|
69198
69434
|
nullCoreTag,
|
|
@@ -69200,6 +69436,11 @@ var CORE_SCHEMA = new Schema([
|
|
|
69200
69436
|
intCoreTag,
|
|
69201
69437
|
floatCoreTag
|
|
69202
69438
|
]);
|
|
69439
|
+
/**
|
|
69440
|
+
* YAML 1.1-compatible schema.
|
|
69441
|
+
*
|
|
69442
|
+
* @category Schemas
|
|
69443
|
+
*/
|
|
69203
69444
|
var YAML11_SCHEMA = new Schema([
|
|
69204
69445
|
...FAILSAFE_SCHEMA.tags,
|
|
69205
69446
|
nullYaml11Tag,
|
|
@@ -69213,8 +69454,60 @@ var YAML11_SCHEMA = new Schema([
|
|
|
69213
69454
|
pairsTag,
|
|
69214
69455
|
setTag
|
|
69215
69456
|
]);
|
|
69457
|
+
/**
|
|
69458
|
+
* The dumper schema for maximum compatibility. It combines all supported type
|
|
69459
|
+
* variants from YAML 1.1 and YAML 1.2 so strings matching any of them are
|
|
69460
|
+
* quoted. This makes the generated YAML more compatible with other parsers.
|
|
69461
|
+
*
|
|
69462
|
+
* The schema is based on YAML 1.1, but extends `!!int` and `!!float` to accept
|
|
69463
|
+
* both YAML 1.1 and Core Schema forms, since Core Schema supports some forms
|
|
69464
|
+
* that YAML 1.1 does not.
|
|
69465
|
+
*
|
|
69466
|
+
* @category Schemas
|
|
69467
|
+
*/
|
|
69468
|
+
YAML11_SCHEMA.withTags({
|
|
69469
|
+
...intYaml11Tag,
|
|
69470
|
+
resolve: (source, isExplicit, tagName) => {
|
|
69471
|
+
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
69472
|
+
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
69473
|
+
}
|
|
69474
|
+
}, {
|
|
69475
|
+
...floatYaml11Tag,
|
|
69476
|
+
resolve: (source, isExplicit, tagName) => {
|
|
69477
|
+
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
69478
|
+
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
69479
|
+
}
|
|
69480
|
+
});
|
|
69216
69481
|
//#endregion
|
|
69217
69482
|
//#region src/tag/mapping/real_map.ts
|
|
69483
|
+
/**
|
|
69484
|
+
* Recommended when non-string keys are actually needed. It uses native
|
|
69485
|
+
* JavaScript `Map` objects, so keys keep their constructed types instead of
|
|
69486
|
+
* being converted to strings.
|
|
69487
|
+
*
|
|
69488
|
+
* It is not the default to avoid widespread breaking changes in existing
|
|
69489
|
+
* projects. `Map` has a different access API and does not pass deep equality
|
|
69490
|
+
* checks against `{}`-based fixtures. Alongside the other changes in v5,
|
|
69491
|
+
* making it the default was considered too disruptive.
|
|
69492
|
+
*
|
|
69493
|
+
* If these differences are acceptable for your project, we recommend using
|
|
69494
|
+
* {@link realMapTag} to guarantee the absence of problems and side effects.
|
|
69495
|
+
*
|
|
69496
|
+
* @example
|
|
69497
|
+
* Enable {@link realMapTag}:
|
|
69498
|
+
*
|
|
69499
|
+
* ```javascript
|
|
69500
|
+
* import { load, CORE_SCHEMA, realMapTag } from 'js-yaml'
|
|
69501
|
+
*
|
|
69502
|
+
* try {
|
|
69503
|
+
* load(data, { schema: CORE_SCHEMA.withTags(realMapTag) })
|
|
69504
|
+
* } catch (e) {
|
|
69505
|
+
* console.error(e)
|
|
69506
|
+
* }
|
|
69507
|
+
* ```
|
|
69508
|
+
*
|
|
69509
|
+
* @category Tags
|
|
69510
|
+
*/
|
|
69218
69511
|
defineMappingTag("tag:yaml.org,2002:map", {
|
|
69219
69512
|
create: () => /* @__PURE__ */ new Map(),
|
|
69220
69513
|
addPair: (container, key, value) => {
|
|
@@ -69247,6 +69540,13 @@ function normalizeKey(key) {
|
|
|
69247
69540
|
if (typeof key === "object" && Object.prototype.toString.call(key) === "[object Object]") return "[object Object]";
|
|
69248
69541
|
return String(key);
|
|
69249
69542
|
}
|
|
69543
|
+
/**
|
|
69544
|
+
* This implementation exists solely to reproduce v4 behavior exactly. Its use
|
|
69545
|
+
* is strongly discouraged. If complex or non-string keys are needed, use
|
|
69546
|
+
* {@link realMapTag} instead.
|
|
69547
|
+
*
|
|
69548
|
+
* @category Tags
|
|
69549
|
+
*/
|
|
69250
69550
|
defineMappingTag("tag:yaml.org,2002:map", {
|
|
69251
69551
|
create: () => ({}),
|
|
69252
69552
|
identify: isPlainObject,
|
|
@@ -69272,7 +69572,11 @@ defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
69272
69572
|
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
69273
69573
|
},
|
|
69274
69574
|
keys: (container) => Object.keys(container),
|
|
69275
|
-
get: (container, key) =>
|
|
69575
|
+
get: (container, key) => {
|
|
69576
|
+
const normalizedKey = String(key);
|
|
69577
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
69578
|
+
return container[normalizedKey];
|
|
69579
|
+
}
|
|
69276
69580
|
});
|
|
69277
69581
|
//#endregion
|
|
69278
69582
|
//#region src/common/snippet.ts
|
|
@@ -69347,9 +69651,19 @@ function formatError(exception, compact) {
|
|
|
69347
69651
|
if (!compact && exception.mark.snippet) where += `\n\n${exception.mark.snippet}`;
|
|
69348
69652
|
return `${exception.reason} ${where}`;
|
|
69349
69653
|
}
|
|
69350
|
-
|
|
69654
|
+
/**
|
|
69655
|
+
* A YAML error. Unlike an ordinary `Error`, it adds a source snippet showing
|
|
69656
|
+
* the location of the problem to the error message, when available.
|
|
69657
|
+
*
|
|
69658
|
+
* @category Main
|
|
69659
|
+
*/
|
|
69660
|
+
var YAMLException = class YAMLException extends Error {
|
|
69351
69661
|
reason;
|
|
69352
69662
|
mark;
|
|
69663
|
+
/**
|
|
69664
|
+
* Optional `mark` contains source snippet data. Usually, use
|
|
69665
|
+
* {@link YAMLException.throwAt} instead of passing it directly.
|
|
69666
|
+
*/
|
|
69353
69667
|
constructor(reason, mark) {
|
|
69354
69668
|
super();
|
|
69355
69669
|
this.name = "YAMLException";
|
|
@@ -69358,34 +69672,71 @@ var YAMLException = class extends Error {
|
|
|
69358
69672
|
this.message = formatError(this, false);
|
|
69359
69673
|
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
69360
69674
|
}
|
|
69675
|
+
/**
|
|
69676
|
+
* Returns the formatted error, omitting the source snippet in compact mode.
|
|
69677
|
+
*/
|
|
69361
69678
|
toString(compact) {
|
|
69362
69679
|
return `${this.name}: ${formatError(this, compact)}`;
|
|
69363
69680
|
}
|
|
69364
|
-
|
|
69365
|
-
|
|
69366
|
-
|
|
69367
|
-
|
|
69368
|
-
|
|
69369
|
-
|
|
69370
|
-
|
|
69371
|
-
|
|
69372
|
-
|
|
69373
|
-
|
|
69374
|
-
|
|
69375
|
-
|
|
69376
|
-
|
|
69681
|
+
/**
|
|
69682
|
+
* Builds a YAMLException with a source snippet and throws it. `source` is
|
|
69683
|
+
* the raw input text; `position` is an offset into it.
|
|
69684
|
+
*/
|
|
69685
|
+
static throwAt(source, position, message, filename = "") {
|
|
69686
|
+
let line = 0;
|
|
69687
|
+
let lineStart = 0;
|
|
69688
|
+
for (let index = 0; index < position; index++) {
|
|
69689
|
+
const ch = source.charCodeAt(index);
|
|
69690
|
+
if (ch === 10) {
|
|
69691
|
+
line++;
|
|
69692
|
+
lineStart = index + 1;
|
|
69693
|
+
} else if (ch === 13) {
|
|
69694
|
+
line++;
|
|
69695
|
+
if (source.charCodeAt(index + 1) === 10) index++;
|
|
69696
|
+
lineStart = index + 1;
|
|
69697
|
+
}
|
|
69377
69698
|
}
|
|
69699
|
+
const mark = {
|
|
69700
|
+
name: filename,
|
|
69701
|
+
buffer: source,
|
|
69702
|
+
position,
|
|
69703
|
+
line,
|
|
69704
|
+
column: position - lineStart
|
|
69705
|
+
};
|
|
69706
|
+
mark.snippet = makeSnippet(mark);
|
|
69707
|
+
throw new YAMLException(message, mark);
|
|
69378
69708
|
}
|
|
69379
|
-
|
|
69380
|
-
|
|
69381
|
-
|
|
69382
|
-
|
|
69383
|
-
|
|
69384
|
-
|
|
69385
|
-
|
|
69386
|
-
|
|
69387
|
-
|
|
69388
|
-
|
|
69709
|
+
};
|
|
69710
|
+
//#endregion
|
|
69711
|
+
//#region src/parser/events.ts
|
|
69712
|
+
/** @category Events */
|
|
69713
|
+
var EVENT_ID = {
|
|
69714
|
+
DOCUMENT: 1,
|
|
69715
|
+
SEQUENCE: 2,
|
|
69716
|
+
MAPPING: 3,
|
|
69717
|
+
SCALAR: 4,
|
|
69718
|
+
ALIAS: 5,
|
|
69719
|
+
POP: 6
|
|
69720
|
+
};
|
|
69721
|
+
/** @category Nodes */
|
|
69722
|
+
var SCALAR_STYLE = {
|
|
69723
|
+
PLAIN: 1,
|
|
69724
|
+
SINGLE_QUOTED: 2,
|
|
69725
|
+
DOUBLE_QUOTED: 3,
|
|
69726
|
+
LITERAL_BLOCK: 4,
|
|
69727
|
+
FOLDED_BLOCK: 5
|
|
69728
|
+
};
|
|
69729
|
+
/** @category Nodes */
|
|
69730
|
+
var COLLECTION_STYLE = {
|
|
69731
|
+
BLOCK: 1,
|
|
69732
|
+
FLOW: 2
|
|
69733
|
+
};
|
|
69734
|
+
/** @category Nodes */
|
|
69735
|
+
var CHOMPING_MODE = {
|
|
69736
|
+
CLIP: 1,
|
|
69737
|
+
STRIP: 2,
|
|
69738
|
+
KEEP: 3
|
|
69739
|
+
};
|
|
69389
69740
|
//#endregion
|
|
69390
69741
|
//#region src/parser/parser_scalar.ts
|
|
69391
69742
|
var NO_RANGE$3 = -1;
|
|
@@ -69566,30 +69917,35 @@ function getBlockValue(input, start, end, indent, chomping, folded) {
|
|
|
69566
69917
|
didReadContent = true;
|
|
69567
69918
|
emptyLines = 0;
|
|
69568
69919
|
}
|
|
69569
|
-
if (chomping ===
|
|
69570
|
-
else if (chomping !==
|
|
69920
|
+
if (chomping === CHOMPING_MODE.KEEP) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
69921
|
+
else if (chomping !== CHOMPING_MODE.STRIP) {
|
|
69571
69922
|
if (didReadContent) result += "\n";
|
|
69572
69923
|
}
|
|
69573
69924
|
return result;
|
|
69574
69925
|
}
|
|
69926
|
+
/**
|
|
69927
|
+
* Decodes the scalar referenced by event offsets in `input`.
|
|
69928
|
+
*
|
|
69929
|
+
* @category Events
|
|
69930
|
+
*/
|
|
69575
69931
|
function getScalarValue(input, scalar) {
|
|
69576
69932
|
if (scalar.valueStart === NO_RANGE$3) return "";
|
|
69577
69933
|
const { valueStart, valueEnd } = scalar;
|
|
69578
69934
|
if (scalar.fast) return input.slice(valueStart, valueEnd);
|
|
69579
69935
|
switch (scalar.style) {
|
|
69580
|
-
case
|
|
69581
|
-
case
|
|
69582
|
-
case
|
|
69583
|
-
case
|
|
69936
|
+
case SCALAR_STYLE.SINGLE_QUOTED: return getSingleQuotedValue(input, valueStart, valueEnd);
|
|
69937
|
+
case SCALAR_STYLE.DOUBLE_QUOTED: return getDoubleQuotedValue(input, valueStart, valueEnd);
|
|
69938
|
+
case SCALAR_STYLE.LITERAL_BLOCK: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
|
|
69939
|
+
case SCALAR_STYLE.FOLDED_BLOCK: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
|
|
69584
69940
|
default: return getPlainValue(input, valueStart, valueEnd);
|
|
69585
69941
|
}
|
|
69586
69942
|
}
|
|
69587
69943
|
//#endregion
|
|
69588
69944
|
//#region src/common/tagname.ts
|
|
69589
|
-
var DEFAULT_TAG_HANDLERS = {
|
|
69945
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(Object.create(null), {
|
|
69590
69946
|
"!": "!",
|
|
69591
69947
|
"!!": "tag:yaml.org,2002:"
|
|
69592
|
-
};
|
|
69948
|
+
});
|
|
69593
69949
|
function tagNameFull(rawTag, tagHandlers) {
|
|
69594
69950
|
if (rawTag.startsWith("!<") && rawTag.endsWith(">")) return decodeURIComponent(rawTag.slice(2, -1));
|
|
69595
69951
|
const handleEnd = rawTag.indexOf("!", 1);
|
|
@@ -69600,6 +69956,7 @@ function tagNameFull(rawTag, tagHandlers) {
|
|
|
69600
69956
|
//#endregion
|
|
69601
69957
|
//#region src/parser/constructor.ts
|
|
69602
69958
|
var NO_RANGE$2 = -1;
|
|
69959
|
+
var MERGE_TAG_NAME = "tag:yaml.org,2002:merge";
|
|
69603
69960
|
var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
|
69604
69961
|
filename: "",
|
|
69605
69962
|
schema: CORE_SCHEMA,
|
|
@@ -69615,26 +69972,16 @@ function eventPosition$1(event) {
|
|
|
69615
69972
|
return 0;
|
|
69616
69973
|
}
|
|
69617
69974
|
function throwError$1(state, message) {
|
|
69618
|
-
|
|
69975
|
+
YAMLException.throwAt(state.source, state.position, message, state.filename);
|
|
69619
69976
|
}
|
|
69620
69977
|
function finalizeCollection(state, position, tag, carrier) {
|
|
69621
69978
|
try {
|
|
69622
69979
|
return tag.finalize(carrier);
|
|
69623
69980
|
} catch (error) {
|
|
69624
69981
|
if (error instanceof YAMLException) throw error;
|
|
69625
|
-
|
|
69982
|
+
YAMLException.throwAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
|
|
69626
69983
|
}
|
|
69627
69984
|
}
|
|
69628
|
-
function lookupTag(exact, prefix, tagName) {
|
|
69629
|
-
const exactTag = exact[tagName];
|
|
69630
|
-
if (exactTag) return exactTag;
|
|
69631
|
-
for (const tag of prefix) if (tagName.startsWith(tag.tagName)) return tag;
|
|
69632
|
-
}
|
|
69633
|
-
function findExplicitTag(state, exact, prefix, tagName, nodeKind) {
|
|
69634
|
-
const tag = lookupTag(exact, prefix, tagName);
|
|
69635
|
-
if (tag) return tag;
|
|
69636
|
-
throwError$1(state, `unknown ${nodeKind} tag !<${tagName}>`);
|
|
69637
|
-
}
|
|
69638
69985
|
function constructScalar(state, event) {
|
|
69639
69986
|
const source = getScalarValue(state.source, event);
|
|
69640
69987
|
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
@@ -69645,7 +69992,7 @@ function constructScalar(state, event) {
|
|
|
69645
69992
|
tag: strTag
|
|
69646
69993
|
};
|
|
69647
69994
|
const tagName = tagNameFull(rawTag, state.tagHandlers);
|
|
69648
|
-
const scalarTag =
|
|
69995
|
+
const scalarTag = state.schema.lookupScalarTag(tagName);
|
|
69649
69996
|
if (scalarTag) {
|
|
69650
69997
|
const result = scalarTag.resolve(source, true, tagName);
|
|
69651
69998
|
if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
@@ -69654,7 +70001,7 @@ function constructScalar(state, event) {
|
|
|
69654
70001
|
tag: scalarTag
|
|
69655
70002
|
};
|
|
69656
70003
|
}
|
|
69657
|
-
const collectionTagDef =
|
|
70004
|
+
const collectionTagDef = state.schema.lookupMappingTag(tagName) ?? state.schema.lookupSequenceTag(tagName);
|
|
69658
70005
|
if (collectionTagDef) {
|
|
69659
70006
|
if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
69660
70007
|
const carrier = collectionTagDef.create(tagName);
|
|
@@ -69665,28 +70012,15 @@ function constructScalar(state, event) {
|
|
|
69665
70012
|
}
|
|
69666
70013
|
throwError$1(state, `unknown scalar tag !<${tagName}>`);
|
|
69667
70014
|
}
|
|
69668
|
-
if (event.style ===
|
|
69669
|
-
const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ?? state.schema.implicitScalarAnyFirstChar;
|
|
69670
|
-
for (const tag of candidates) {
|
|
69671
|
-
const result = tag.resolve(source, false, tag.tagName);
|
|
69672
|
-
if (result !== NOT_RESOLVED) return {
|
|
69673
|
-
value: result,
|
|
69674
|
-
tag
|
|
69675
|
-
};
|
|
69676
|
-
}
|
|
69677
|
-
}
|
|
70015
|
+
if (event.style === SCALAR_STYLE.PLAIN) return state.schema.resolveImplicitScalarTag(source);
|
|
69678
70016
|
return {
|
|
69679
70017
|
value: strTag.resolve(source, false, strTag.tagName),
|
|
69680
70018
|
tag: strTag
|
|
69681
70019
|
};
|
|
69682
70020
|
}
|
|
69683
|
-
function
|
|
70021
|
+
function collectionTagName(state, event, defaultTagName) {
|
|
69684
70022
|
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
69685
|
-
|
|
69686
|
-
return {
|
|
69687
|
-
tagName,
|
|
69688
|
-
tag: findExplicitTag(state, exact, prefix, tagName, nodeKind)
|
|
69689
|
-
};
|
|
70023
|
+
return rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers);
|
|
69690
70024
|
}
|
|
69691
70025
|
function isMappingTag(tag) {
|
|
69692
70026
|
return tag.nodeKind === "mapping";
|
|
@@ -69703,12 +70037,16 @@ function mergeKeys(state, frame, source, sourceTag) {
|
|
|
69703
70037
|
function mergeSource(state, frame, source, sourceTag) {
|
|
69704
70038
|
state.position = frame.keyPosition;
|
|
69705
70039
|
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
|
69706
|
-
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source)
|
|
70040
|
+
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) {
|
|
70041
|
+
const elementTag = state.nodeTags.get(element);
|
|
70042
|
+
if (!elementTag) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
70043
|
+
mergeKeys(state, frame, element, elementTag);
|
|
70044
|
+
}
|
|
69707
70045
|
else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
69708
70046
|
}
|
|
69709
70047
|
function addMappingValue(state, frame, key, value, tag) {
|
|
69710
70048
|
state.position = frame.keyPosition;
|
|
69711
|
-
if (
|
|
70049
|
+
if (frame.keyIsMerge) {
|
|
69712
70050
|
mergeSource(state, frame, value, tag);
|
|
69713
70051
|
return;
|
|
69714
70052
|
}
|
|
@@ -69723,9 +70061,7 @@ function addValue(state, value, tag) {
|
|
|
69723
70061
|
frame.value = value;
|
|
69724
70062
|
frame.hasValue = true;
|
|
69725
70063
|
} else if (frame.kind === "sequence") {
|
|
69726
|
-
if (
|
|
69727
|
-
if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
69728
|
-
}
|
|
70064
|
+
if (isMappingTag(tag)) state.nodeTags.set(value, tag);
|
|
69729
70065
|
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
|
69730
70066
|
if (err) throwError$1(state, err);
|
|
69731
70067
|
} else if (frame.hasKey) {
|
|
@@ -69737,6 +70073,7 @@ function addValue(state, value, tag) {
|
|
|
69737
70073
|
frame.key = value;
|
|
69738
70074
|
frame.keyPosition = state.position;
|
|
69739
70075
|
frame.hasKey = true;
|
|
70076
|
+
frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME;
|
|
69740
70077
|
}
|
|
69741
70078
|
}
|
|
69742
70079
|
function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
@@ -69751,6 +70088,12 @@ function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
|
69751
70088
|
}
|
|
69752
70089
|
return null;
|
|
69753
70090
|
}
|
|
70091
|
+
/**
|
|
70092
|
+
* Constructs JavaScript documents directly from parser events, without an
|
|
70093
|
+
* intermediate AST.
|
|
70094
|
+
*
|
|
70095
|
+
* @category Events
|
|
70096
|
+
*/
|
|
69754
70097
|
function constructFromEvents(events, options) {
|
|
69755
70098
|
const state = {
|
|
69756
70099
|
...DEFAULT_CONSTRUCTOR_OPTIONS,
|
|
@@ -69761,6 +70104,7 @@ function constructFromEvents(events, options) {
|
|
|
69761
70104
|
position: 0,
|
|
69762
70105
|
frames: [],
|
|
69763
70106
|
anchors: /* @__PURE__ */ new Map(),
|
|
70107
|
+
nodeTags: /* @__PURE__ */ new Map(),
|
|
69764
70108
|
tagHandlers: Object.create(null),
|
|
69765
70109
|
totalMergeKeys: 0,
|
|
69766
70110
|
aliasCount: 0
|
|
@@ -69769,8 +70113,9 @@ function constructFromEvents(events, options) {
|
|
|
69769
70113
|
const event = state.events[state.eventIndex++];
|
|
69770
70114
|
state.position = eventPosition$1(event);
|
|
69771
70115
|
switch (event.type) {
|
|
69772
|
-
case
|
|
70116
|
+
case EVENT_ID.DOCUMENT:
|
|
69773
70117
|
state.anchors = /* @__PURE__ */ new Map();
|
|
70118
|
+
state.nodeTags = /* @__PURE__ */ new Map();
|
|
69774
70119
|
state.aliasCount = 0;
|
|
69775
70120
|
state.tagHandlers = Object.create(null);
|
|
69776
70121
|
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
|
@@ -69781,47 +70126,49 @@ function constructFromEvents(events, options) {
|
|
|
69781
70126
|
hasValue: false
|
|
69782
70127
|
});
|
|
69783
70128
|
break;
|
|
69784
|
-
case
|
|
70129
|
+
case EVENT_ID.SCALAR: {
|
|
69785
70130
|
const { value, tag } = constructScalar(state, event);
|
|
69786
70131
|
storeAnchor(state, event, value, tag, true);
|
|
69787
70132
|
addValue(state, value, tag);
|
|
69788
70133
|
break;
|
|
69789
70134
|
}
|
|
69790
|
-
case
|
|
69791
|
-
const
|
|
69792
|
-
const
|
|
69793
|
-
|
|
69794
|
-
const
|
|
69795
|
-
const
|
|
70135
|
+
case EVENT_ID.SEQUENCE: {
|
|
70136
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:seq");
|
|
70137
|
+
const tag = state.schema.lookupSequenceTag(tagName);
|
|
70138
|
+
if (!tag) throwError$1(state, `unknown sequence tag !<${tagName}>`);
|
|
70139
|
+
const value = tag.create(tagName);
|
|
70140
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
69796
70141
|
state.frames.push({
|
|
69797
70142
|
kind: "sequence",
|
|
69798
70143
|
position: state.position,
|
|
69799
70144
|
value,
|
|
69800
|
-
tag
|
|
70145
|
+
tag,
|
|
69801
70146
|
anchor,
|
|
69802
|
-
index: 0
|
|
69803
|
-
merge
|
|
70147
|
+
index: 0
|
|
69804
70148
|
});
|
|
69805
70149
|
break;
|
|
69806
70150
|
}
|
|
69807
|
-
case
|
|
69808
|
-
const
|
|
69809
|
-
const
|
|
69810
|
-
|
|
70151
|
+
case EVENT_ID.MAPPING: {
|
|
70152
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:map");
|
|
70153
|
+
const tag = state.schema.lookupMappingTag(tagName);
|
|
70154
|
+
if (!tag) throwError$1(state, `unknown mapping tag !<${tagName}>`);
|
|
70155
|
+
const value = tag.create(tagName);
|
|
70156
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
69811
70157
|
state.frames.push({
|
|
69812
70158
|
kind: "mapping",
|
|
69813
70159
|
position: state.position,
|
|
69814
70160
|
value,
|
|
69815
|
-
tag
|
|
70161
|
+
tag,
|
|
69816
70162
|
anchor,
|
|
69817
70163
|
key: void 0,
|
|
69818
70164
|
keyPosition: state.position,
|
|
69819
70165
|
hasKey: false,
|
|
70166
|
+
keyIsMerge: false,
|
|
69820
70167
|
overridable: null
|
|
69821
70168
|
});
|
|
69822
70169
|
break;
|
|
69823
70170
|
}
|
|
69824
|
-
case
|
|
70171
|
+
case EVENT_ID.ALIAS: {
|
|
69825
70172
|
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
|
69826
70173
|
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
|
69827
70174
|
const anchor = state.anchors.get(name);
|
|
@@ -69830,8 +70177,12 @@ function constructFromEvents(events, options) {
|
|
|
69830
70177
|
addValue(state, anchor.value, anchor.tag);
|
|
69831
70178
|
break;
|
|
69832
70179
|
}
|
|
69833
|
-
case
|
|
70180
|
+
case EVENT_ID.POP: {
|
|
69834
70181
|
const frame = state.frames.pop();
|
|
70182
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
70183
|
+
state.position = frame.keyPosition;
|
|
70184
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
70185
|
+
}
|
|
69835
70186
|
if (frame.kind === "document") state.documents.push(frame.value);
|
|
69836
70187
|
else {
|
|
69837
70188
|
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
@@ -69869,7 +70220,7 @@ var DEFAULT_PARSER_OPTIONS = {
|
|
|
69869
70220
|
};
|
|
69870
70221
|
function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
69871
70222
|
state.events.push({
|
|
69872
|
-
type:
|
|
70223
|
+
type: EVENT_ID.DOCUMENT,
|
|
69873
70224
|
explicitStart,
|
|
69874
70225
|
explicitEnd,
|
|
69875
70226
|
directives: state.directives
|
|
@@ -69877,7 +70228,7 @@ function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
|
69877
70228
|
}
|
|
69878
70229
|
function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
69879
70230
|
state.events.push({
|
|
69880
|
-
type:
|
|
70231
|
+
type: EVENT_ID.SEQUENCE,
|
|
69881
70232
|
start,
|
|
69882
70233
|
anchorStart,
|
|
69883
70234
|
anchorEnd,
|
|
@@ -69888,7 +70239,7 @@ function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd
|
|
|
69888
70239
|
}
|
|
69889
70240
|
function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
69890
70241
|
state.events.push({
|
|
69891
|
-
type:
|
|
70242
|
+
type: EVENT_ID.MAPPING,
|
|
69892
70243
|
start,
|
|
69893
70244
|
anchorStart,
|
|
69894
70245
|
anchorEnd,
|
|
@@ -69897,9 +70248,20 @@ function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd,
|
|
|
69897
70248
|
style
|
|
69898
70249
|
});
|
|
69899
70250
|
}
|
|
69900
|
-
function
|
|
70251
|
+
function insertFlowPairMappingEvent(state, snapshot) {
|
|
70252
|
+
state.events.splice(snapshot.eventsLength, 0, {
|
|
70253
|
+
type: EVENT_ID.MAPPING,
|
|
70254
|
+
start: snapshot.position,
|
|
70255
|
+
anchorStart: NO_RANGE$1,
|
|
70256
|
+
anchorEnd: NO_RANGE$1,
|
|
70257
|
+
tagStart: NO_RANGE$1,
|
|
70258
|
+
tagEnd: NO_RANGE$1,
|
|
70259
|
+
style: COLLECTION_STYLE.FLOW
|
|
70260
|
+
});
|
|
70261
|
+
}
|
|
70262
|
+
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = CHOMPING_MODE.CLIP, indent = -1, fast = false) {
|
|
69901
70263
|
state.events.push({
|
|
69902
|
-
type:
|
|
70264
|
+
type: EVENT_ID.SCALAR,
|
|
69903
70265
|
valueStart,
|
|
69904
70266
|
valueEnd,
|
|
69905
70267
|
anchorStart,
|
|
@@ -69914,16 +70276,16 @@ function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tag
|
|
|
69914
70276
|
}
|
|
69915
70277
|
function addAliasEvent(state, anchorStart, anchorEnd) {
|
|
69916
70278
|
state.events.push({
|
|
69917
|
-
type:
|
|
70279
|
+
type: EVENT_ID.ALIAS,
|
|
69918
70280
|
anchorStart,
|
|
69919
70281
|
anchorEnd
|
|
69920
70282
|
});
|
|
69921
70283
|
}
|
|
69922
70284
|
function addPopEvent(state) {
|
|
69923
|
-
state.events.push({ type:
|
|
70285
|
+
state.events.push({ type: EVENT_ID.POP });
|
|
69924
70286
|
}
|
|
69925
70287
|
function addEmptyScalarEvent(state) {
|
|
69926
|
-
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1,
|
|
70288
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, SCALAR_STYLE.PLAIN);
|
|
69927
70289
|
}
|
|
69928
70290
|
function emptyProperties() {
|
|
69929
70291
|
return {
|
|
@@ -69952,7 +70314,7 @@ function restoreState(state, snapshot) {
|
|
|
69952
70314
|
state.events.length = snapshot.eventsLength;
|
|
69953
70315
|
}
|
|
69954
70316
|
function throwError(state, message) {
|
|
69955
|
-
|
|
70317
|
+
YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename);
|
|
69956
70318
|
}
|
|
69957
70319
|
function isEol(c) {
|
|
69958
70320
|
return c === 10 || c === 13;
|
|
@@ -70120,7 +70482,7 @@ function readSingleQuotedScalar(state, nodeIndent, props) {
|
|
|
70120
70482
|
}
|
|
70121
70483
|
const end = state.position;
|
|
70122
70484
|
state.position++;
|
|
70123
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70485
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
70124
70486
|
return true;
|
|
70125
70487
|
}
|
|
70126
70488
|
if (isEol(ch)) {
|
|
@@ -70142,7 +70504,7 @@ function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
|
70142
70504
|
if (ch === 34) {
|
|
70143
70505
|
const end = state.position;
|
|
70144
70506
|
state.position++;
|
|
70145
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70507
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
70146
70508
|
return true;
|
|
70147
70509
|
}
|
|
70148
70510
|
if (ch === 92) {
|
|
@@ -70170,18 +70532,18 @@ function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
|
70170
70532
|
}
|
|
70171
70533
|
function readBlockScalar(state, parentIndent, props) {
|
|
70172
70534
|
const ch = state.input.charCodeAt(state.position);
|
|
70173
|
-
let chomping =
|
|
70535
|
+
let chomping = CHOMPING_MODE.CLIP;
|
|
70174
70536
|
let indent = -1;
|
|
70175
70537
|
let detectedIndent = false;
|
|
70176
70538
|
if (ch !== 124 && ch !== 62) return false;
|
|
70177
|
-
const style = ch === 124 ?
|
|
70539
|
+
const style = ch === 124 ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK;
|
|
70178
70540
|
state.position++;
|
|
70179
70541
|
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70180
70542
|
const current = state.input.charCodeAt(state.position);
|
|
70181
70543
|
const digit = fromDecimalCode(current);
|
|
70182
70544
|
if (current === 43 || current === 45) {
|
|
70183
|
-
if (chomping !==
|
|
70184
|
-
chomping = current === 43 ?
|
|
70545
|
+
if (chomping !== CHOMPING_MODE.CLIP) throwError(state, "repeat of a chomping mode identifier");
|
|
70546
|
+
chomping = current === 43 ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP;
|
|
70185
70547
|
state.position++;
|
|
70186
70548
|
} else if (digit >= 0) {
|
|
70187
70549
|
if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
@@ -70296,7 +70658,7 @@ function readPlainScalar(state, nodeIndent, nodeContext, props) {
|
|
|
70296
70658
|
}
|
|
70297
70659
|
if (end === start) return false;
|
|
70298
70660
|
checkPrintable(state, start, end);
|
|
70299
|
-
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70661
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline);
|
|
70300
70662
|
return true;
|
|
70301
70663
|
}
|
|
70302
70664
|
function skipFlowSeparationSpace(state, nodeIndent) {
|
|
@@ -70311,8 +70673,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
70311
70673
|
let readNext = true;
|
|
70312
70674
|
if (ch !== 91 && ch !== 123) return false;
|
|
70313
70675
|
const terminator = isMapping ? 125 : 93;
|
|
70314
|
-
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70315
|
-
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70676
|
+
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
70677
|
+
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
70316
70678
|
state.position++;
|
|
70317
70679
|
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70318
70680
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
@@ -70340,12 +70702,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
70340
70702
|
state.position++;
|
|
70341
70703
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
70342
70704
|
if (!isMapping) {
|
|
70343
|
-
|
|
70344
|
-
|
|
70345
|
-
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
70346
|
-
skipFlowSeparationSpace(state, nodeIndent);
|
|
70347
|
-
state.position++;
|
|
70348
|
-
skipFlowSeparationSpace(state, nodeIndent);
|
|
70705
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
70706
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
70349
70707
|
} else if (!keyWasRead) addEmptyScalarEvent(state);
|
|
70350
70708
|
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
70351
70709
|
skipFlowSeparationSpace(state, nodeIndent);
|
|
@@ -70355,9 +70713,8 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
70355
70713
|
addEmptyScalarEvent(state);
|
|
70356
70714
|
} else if (isMapping) addEmptyScalarEvent(state);
|
|
70357
70715
|
else if (isPair) {
|
|
70358
|
-
|
|
70359
|
-
|
|
70360
|
-
parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
70716
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
70717
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
70361
70718
|
addEmptyScalarEvent(state);
|
|
70362
70719
|
addPopEvent(state);
|
|
70363
70720
|
}
|
|
@@ -70371,7 +70728,7 @@ function readFlowCollection(state, nodeIndent, props) {
|
|
|
70371
70728
|
}
|
|
70372
70729
|
function readBlockSequence(state, nodeIndent, props) {
|
|
70373
70730
|
if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
|
|
70374
|
-
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70731
|
+
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
70375
70732
|
while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
|
|
70376
70733
|
if (state.firstTabInLine !== -1) {
|
|
70377
70734
|
state.position = state.firstTabInLine;
|
|
@@ -70407,7 +70764,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
|
70407
70764
|
const entryLine = state.line;
|
|
70408
70765
|
if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
|
|
70409
70766
|
if (!mappingOpened) {
|
|
70410
|
-
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70767
|
+
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
70411
70768
|
mappingOpened = true;
|
|
70412
70769
|
}
|
|
70413
70770
|
if (ch === 63) {
|
|
@@ -70437,7 +70794,7 @@ function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
|
70437
70794
|
if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
70438
70795
|
if (!mappingOpened) {
|
|
70439
70796
|
restoreState(state, beforeKey);
|
|
70440
|
-
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70797
|
+
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
70441
70798
|
mappingOpened = true;
|
|
70442
70799
|
parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
|
|
70443
70800
|
ch = state.input.charCodeAt(state.position);
|
|
@@ -70498,10 +70855,6 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
70498
70855
|
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
70499
70856
|
else indentStatus = -1;
|
|
70500
70857
|
}
|
|
70501
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
70502
|
-
state.depth--;
|
|
70503
|
-
return false;
|
|
70504
|
-
}
|
|
70505
70858
|
if (indentStatus === 1) while (true) {
|
|
70506
70859
|
const ch = state.input.charCodeAt(state.position);
|
|
70507
70860
|
const propertyState = snapshotState(state);
|
|
@@ -70509,7 +70862,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
70509
70862
|
if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
|
|
70510
70863
|
const fallbackState = snapshotState(state);
|
|
70511
70864
|
const flowIndent = parentIndent + 1;
|
|
70512
|
-
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type ===
|
|
70865
|
+
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {
|
|
70513
70866
|
state.depth--;
|
|
70514
70867
|
return true;
|
|
70515
70868
|
}
|
|
@@ -70537,7 +70890,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
70537
70890
|
const fallbackState = snapshotState(state);
|
|
70538
70891
|
const propertyIndent = propertyStart.position - propertyStart.lineStart;
|
|
70539
70892
|
restoreState(state, propertyStart);
|
|
70540
|
-
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type ===
|
|
70893
|
+
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) hasContent = true;
|
|
70541
70894
|
else restoreState(state, fallbackState);
|
|
70542
70895
|
}
|
|
70543
70896
|
if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
|
|
@@ -70546,7 +70899,7 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
70546
70899
|
}
|
|
70547
70900
|
allowBlockScalars = allowBlockScalars && !hasContent;
|
|
70548
70901
|
if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
|
|
70549
|
-
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd,
|
|
70902
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN);
|
|
70550
70903
|
hasContent = true;
|
|
70551
70904
|
}
|
|
70552
70905
|
state.depth--;
|
|
@@ -70631,10 +70984,15 @@ function readDocument(state) {
|
|
|
70631
70984
|
}
|
|
70632
70985
|
}
|
|
70633
70986
|
const documentEvent = state.events[documentEventIndex];
|
|
70634
|
-
if (documentEvent?.type ===
|
|
70987
|
+
if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd;
|
|
70635
70988
|
addPopEvent(state);
|
|
70636
70989
|
if (!explicitEnd && state.position < state.length && !(state.position === state.lineStart && testDocumentSeparator(state))) throwError(state, "end of the stream or a document separator is expected");
|
|
70637
70990
|
}
|
|
70991
|
+
/**
|
|
70992
|
+
* Parses YAML into a flat event stream referencing source text by offsets.
|
|
70993
|
+
*
|
|
70994
|
+
* @category Events
|
|
70995
|
+
*/
|
|
70638
70996
|
function parseEvents(input, options) {
|
|
70639
70997
|
const length = input.length;
|
|
70640
70998
|
const state = {
|
|
@@ -70653,7 +71011,7 @@ function parseEvents(input, options) {
|
|
|
70653
71011
|
events: []
|
|
70654
71012
|
};
|
|
70655
71013
|
const nullpos = input.indexOf("\0");
|
|
70656
|
-
if (nullpos !== -1)
|
|
71014
|
+
if (nullpos !== -1) YAMLException.throwAt(input, nullpos, "null byte is not allowed in input", state.filename);
|
|
70657
71015
|
if (state.input.charCodeAt(state.position) === 65279) state.position++;
|
|
70658
71016
|
while (state.position < state.length) {
|
|
70659
71017
|
skipSeparationSpace(state, true);
|
|
@@ -70685,27 +71043,42 @@ function loadDocuments(input, options = {}) {
|
|
|
70685
71043
|
source
|
|
70686
71044
|
});
|
|
70687
71045
|
}
|
|
71046
|
+
/**
|
|
71047
|
+
* Parses `string` as a single YAML document. Throws {@link YAMLException} on
|
|
71048
|
+
* error. This function does not understand multi-document or empty sources; it
|
|
71049
|
+
* throws an exception on those.
|
|
71050
|
+
*
|
|
71051
|
+
* > [!NOTE]
|
|
71052
|
+
* > 1. When processing untrusted input, see the
|
|
71053
|
+
* > [security considerations](../docs/safety.md).
|
|
71054
|
+
* > 2. All exceptions MUST be caught, not just {@link YAMLException}.
|
|
71055
|
+
* > 3. The default {@link CORE_SCHEMA} comes without the `!!merge` tag. You can
|
|
71056
|
+
* > easily enable it if needed.
|
|
71057
|
+
* > 4. The default {@link mapTag} is `{}`-object based, with known limitations
|
|
71058
|
+
* > (see description). For full compatibility use {@link realMapTag}
|
|
71059
|
+
* > instead (it uses native JS `Map`).
|
|
71060
|
+
*
|
|
71061
|
+
* @example
|
|
71062
|
+
* Enable {@link mergeTag} and {@link realMapTag}:
|
|
71063
|
+
*
|
|
71064
|
+
* ```javascript
|
|
71065
|
+
* import { load, CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'
|
|
71066
|
+
*
|
|
71067
|
+
* try {
|
|
71068
|
+
* load(data, { schema: CORE_SCHEMA.withTags(mergeTag, realMapTag) })
|
|
71069
|
+
* } catch (e) {
|
|
71070
|
+
* console.error(e)
|
|
71071
|
+
* }
|
|
71072
|
+
* ```
|
|
71073
|
+
*
|
|
71074
|
+
* @category Main
|
|
71075
|
+
*/
|
|
70688
71076
|
function load(input, options) {
|
|
70689
71077
|
const documents = loadDocuments(input, options);
|
|
70690
71078
|
if (documents.length === 0) throw new YAMLException("expected a document, but the input is empty");
|
|
70691
71079
|
if (documents.length === 1) return documents[0];
|
|
70692
71080
|
throw new YAMLException("expected a single document in the stream, but found more");
|
|
70693
71081
|
}
|
|
70694
|
-
//#endregion
|
|
70695
|
-
//#region src/dump.ts
|
|
70696
|
-
YAML11_SCHEMA.withTags({
|
|
70697
|
-
...intYaml11Tag,
|
|
70698
|
-
resolve: (source, isExplicit, tagName) => {
|
|
70699
|
-
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
70700
|
-
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
70701
|
-
}
|
|
70702
|
-
}, {
|
|
70703
|
-
...floatYaml11Tag,
|
|
70704
|
-
resolve: (source, isExplicit, tagName) => {
|
|
70705
|
-
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
70706
|
-
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
70707
|
-
}
|
|
70708
|
-
});
|
|
70709
71082
|
|
|
70710
71083
|
function autoTag() {
|
|
70711
71084
|
return transform;
|
|
@@ -70781,7 +71154,7 @@ function tagSlide(node) {
|
|
|
70781
71154
|
|
|
70782
71155
|
var pfwrStyle = "html,\nbody {\n margin: 0;\n padding: 0;\n height: 100%;\n box-sizing: border-box;\n}\n\n:root {\n\n --font-scale: 1;\n\n /* base type scales with the slide container (cqmin), so the same slide\n renders legibly full-screen and as a small overview tile */\n --font-size-default: calc(var(--font-scale) * 5cqmin);\n --font-size-h1: 3.2em;\n --font-size-h2: 2.2em;\n --font-size-h3: 1.8em;\n --font-size-h4: 1.4em;\n --font-size-small: 1.5cqmin;\n --font-size-smaller: .7em;\n\n --font-size-default-print: 2.4em;\n\n --slide-margin: calc(var(--font-scale) * 6cqmin);\n\n --font-family-body: 'Montserrat', sans-serif;\n --font-family-heading: 'Roboto Slab', serif;\n --font-family-code: 'Roboto Mono', monospace;\n\n --list-margin: .5em;\n --line-height: 1.3;\n\n --color-navy: #001F3F;\n --color-blue: #0074D9;\n --color-aqua: #7FDBFF;\n --color-teal: #39CCCC;\n --color-olive: #3D9970;\n --color-green: #2ECC40;\n --color-lime: #01FF70;\n --color-yellow: #FFDC00;\n --color-orange: #FF851B;\n --color-red: #FF4136;\n --color-fuchsia: #F012BE;\n --color-purple: #B10DC9;\n --color-maroon: #85144B;\n --color-white: #FFFFFF;\n --color-gray-7: #FCFCFC;\n --color-gray-6: #F0F0F0;\n --color-gray-5: #DDDDDD;\n --color-gray-4: #AAAAAA;\n --color-gray-3: #888;\n --color-gray-2: #666;\n --color-gray-1: #333;\n --color-black: #111;\n\n --color-default: var(--color-gray-1);\n --color-bg: var(--color-white);\n\n --color-highlight: var(--color-gray-7);\n --color-highlight-bg: var(--color-fuchsia);\n\n --color-slide-number: var(--color-gray-3);\n\n --color-code-bg: #cfcaca59;\n --color-code: var(--color-gray-7);\n\n --color-link: var(--color-blue);\n\n --color-table-head: var(--color-gray-7);\n --color-table-head-bg: var(--color-orange);\n --color-table: var(--color-default);\n --color-table-bg: var(--color-gray-6);\n --color-table-border: var(--color-gray-5);\n}\n\n.slide[data-theme='funky'] {\n\n --color-default: var(--color-gray-7);\n --color-bg: var(--color-fuchsia);\n\n --color-slide-number: var(--color-gray-5);\n\n --color-code: var(--color-gray-7);\n --color-code-bg: #cfcaca59;\n\n --color-highlight: var(--color-gray-7);\n --color-highlight-bg: var(--color-orange);\n\n --color-link: var(--color-gray-7);\n\n --color-table-head: var(--color-gray-1);\n --color-table-head-bg: var(--color-yellow);\n --color-table-bg: var(--color-gray-7);\n --color-table-border: var(--color-gray-4);\n}\n\n.slide[data-theme='eco'] {\n\n --color-default: var(--color-gray-7);\n --color-bg: var(--color-olive);\n\n --color-slide-number: var(--color-gray-5);\n\n --color-code: var(--color-gray-7);\n --color-code-bg: #cfcaca59;\n\n --color-highlight: var(--color-white);\n --color-highlight-bg: var(--color-red);\n\n --color-link: var(--color-gray-7);\n\n --color-table-head: var(--color-gray-7);\n --color-table-head-bg: var(--color-orange);\n --color-table-bg: var(--color-gray-7);\n --color-table-border: var(--color-gray-4);\n}\n\ncode:not([class*=\"language-\"]) {\n padding: .2em .4em;\n margin: 0;\n font-size: 85%;\n border-radius: .1em;\n\n background-color: var(--color-code-bg);\n font-family: var(--font-family-code);\n}\n\nh1, h2, h3, h4 {\n font-family: var(--font-family-heading);\n}\n\nh1 {\n font-size: var(--font-size-h1);\n}\n\nh2 {\n font-size: var(--font-size-h2);\n}\n\nh3 {\n font-size: var(--font-size-h3);\n}\n\nh4 {\n font-size: var(--font-size-h4);\n}\n\nli + li {\n margin-top: var(--list-margin);\n}\n\na {\n color: var(--color-link);\n}\n\nsmall {\n font-size: var(--font-size-smaller);\n}\n\nem {\n background: var(--color-highlight-bg);\n font-style: normal;\n color: var(--color-highlight);\n}\n\ntable, pre {\n width: fit-content;\n min-width: 50%;\n}\n\np:has(> a > img:only-child:not(.emoji)),\np:has(> img:only-child:not(.emoji)),\na:has(> img:only-child:not(.emoji)) {\n display: flex;\n flex: initial;\n overflow: hidden;\n justify-content: center;\n}\n\nimg:not(.emoji) {\n max-width: 100%;\n object-fit: scale-down;\n}\n\n.slide-content > pre[class*=\"language-\"] {\n font-size: .5em;\n margin: 2em;\n}\n\n.slide-content > *:not(:first-child) {\n margin-top: 0 !important;\n}\n\n.slide-content > *,\n.slide-content > pre[class*=\"language-\"] {\n margin-left: var(--slide-margin);\n margin-right: var(--slide-margin);\n}\n\n.slide-content > *:first-child {\n margin-top: var(--slide-margin);\n}\n\n.slide-content > *:last-child {\n margin-bottom: var(--slide-margin);\n}\n\n.slide-container {\n font-family: var(--font-family-body);\n line-height: var(--line-height);\n}\n\n/* display: contents keeps the content elements as flex items of .slide\n (so layout/alignment is unchanged) while anchoring the responsive\n base font-size to .slide, which is the query container */\n.slide-content {\n display: contents;\n font-size: var(--font-size-default);\n}\n\n.slide-container {\n width: 100vw;\n height: 100vh;\n}\n\n.slide {\n position: relative;\n\n width: 100%;\n height: 100%;\n container-type: size;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n\n background: var(--color-bg);\n color: var(--color-default);\n}\n\n.slide[data-align='center'] {\n align-items: center;\n text-align: center;\n}\n\n.slide[data-align='left'] {\n align-items: flex-start;\n}\n\n.slide[data-align='right'] {\n align-items: flex-end;\n}\n\ntable {\n border-radius: .6em;\n overflow: hidden;\n border-collapse: collapse;\n\n color: var(--color-table);\n background: var(--color-table-bg);\n\n font-size: .7em;\n margin-bottom: 1em;\n}\n\nthead {\n color: var(--color-table-head);\n background: var(--color-table-head-bg);\n}\n\ntbody tr + tr {\n border-top: solid 1px var(--color-table-border);\n}\n\ntable td,\ntable th {\n padding: .7em .8em;\n}\n\ntable th:first-child,\ntable td:first-child {\n padding-left: 1.5em;\n}\n\ntable th:last-child,\ntable td:last-child {\n padding-right: 1.5em;\n}\n\nimg.emoji {\n height: 1em;\n width: 1em;\n margin: 0 .05em 0 .1em;\n vertical-align: -0.1em;\n}\n\n.slide-number {\n position: absolute;\n bottom: calc(var(--slide-margin) / 2);\n right: calc(var(--slide-margin) / 2);\n color: var(--color-slide-number);\n font-size: var(--font-size-small);\n margin: 0;\n}\n\n.slide-navigation {\n position: fixed;\n top: 20px;\n right: 20px;\n}\n\n.slide-navigation:not(.shown) {\n display: none;\n}\n\n.slide-navigation a {\n text-decoration: none;\n display: inline-block;\n margin: .05em;\n padding: .2em;\n\n background: var(--color-gray-5);\n color: var(--color-gray-1);\n opacity: .4;\n border-radius: .1em;\n}\n\n.slide-navigation a svg {\n display: block;\n}\n\n.slide-navigation a:hover {\n opacity: 1;\n}\n\n/* in overview only the toggle stays; slide navigation is meaningless */\n.slide-container.overview .navigation-button:not([data-navigate=\"overview\"]) {\n display: none;\n}\n\n@media print {\n\n .slide-navigation {\n display: none;\n }\n\n .slide-content {\n font-size: var(--font-size-default-print);\n }\n\n .slide {\n page-break-after: always;\n }\n}\n\n@media screen {\n .slide-container {\n overflow: hidden;\n }\n\n .slide {\n position: absolute;\n transform: translate(-100%, -100%);\n }\n\n .slide.current {\n top: 0;\n left: 0;\n transform: translate(0, 0);\n }\n\n /* overview: lay slides out as a responsive grid of clickable tiles.\n each tile is a size container, so the cqmin-based type scales down */\n .slide-container.overview {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));\n gap: 1.5rem;\n padding: 1.5rem;\n\n /* grow with the tiles and let the document scroll; a fixed height\n would collapse the auto rows (size-contained tiles report no\n height), making the aspect-ratio tiles overlap */\n height: auto;\n min-height: 100vh;\n overflow: visible;\n\n /* fill the available width instead of 100vw + padding (content-box),\n which would overflow past the scrollbar and force horizontal scroll */\n width: auto;\n align-items: start;\n background: var(--color-gray-5);\n }\n\n .overview .slide {\n position: static;\n transform: none;\n height: auto;\n min-height: 0;\n aspect-ratio: 16 / 9;\n overflow: hidden;\n cursor: pointer;\n border-radius: .5rem;\n box-shadow: 0 0 .2rem rgb(0 0 0 / .25);\n }\n\n .overview .slide.current {\n box-shadow: 0 0 0 .25rem var(--color-navy), 0.1rem .1rem .2rem rgb(0 0 0 / .25);\n }\n}\n\n";
|
|
70783
71156
|
|
|
70784
|
-
var pfwrScript = "function addNavigationControls(container, dispatch) {\n\n const html = `<nav class=\"slide-navigation shown\">\n <a class=\"navigation-button\" data-navigate=\"first\" title=\"First slide\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 16.5a4.5 4.5 0 100-9 4.5 4.5 0 000 9zm0 1.5a6 6 0 100-12 6 6 0 000 12z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"previous\" title=\"Previous slide (Left Arrow)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M8.854 11.646l5.792-5.792a.5.5 0 01.854.353v11.586a.5.5 0 01-.854.353l-5.792-5.792a.5.5 0 010-.708z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"next\" title=\"Next slide (Enter/Spacebar/Right Arrow)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M15.146 12.354l-5.792 5.792a.5.5 0 01-.854-.353V6.207a.5.5 0 01.854-.353l5.792 5.792a.5.5 0 010 .708z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"last\" title=\"Last slide\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M12 18a6 6 0 100-12 6 6 0 000 12z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"overview\" title=\"Toggle overview (O)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"-4 -4 24 24\"><path d=\"m14.12 10.163 1.715.858c.22.11.22.424 0 .534L8.267 15.34a.6.6 0 0 1-.534 0L.165 11.555a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.66zM7.733.063a.6.6 0 0 1 .534 0l7.568 3.784a.3.3 0 0 1 0 .535L8.267 8.165a.6.6 0 0 1-.534 0L.165 4.382a.299.299 0 0 1 0-.535z\"></path><path d=\"m14.12 6.576 1.715.858c.22.11.22.424 0 .534l-7.568 3.784a.6.6 0 0 1-.534 0L.165 7.968a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0z\"></path></svg>\n </a>\n </nav>`;\n\n const tmp = document.createElement('div');\n\n tmp.innerHTML = html;\n\n const nav = tmp.removeChild(tmp.lastChild);\n\n nav.addEventListener('mouseenter', function(event) {\n nav.classList.add('hovered');\n });\n\n nav.addEventListener('mouseleave', function(event) {\n nav.classList.remove('hovered');\n });\n\n nav.addEventListener('click', function(event) {\n\n event.preventDefault();\n\n let target = event.target;\n\n while (!target.matches('[data-navigate]')) {\n target = target.parentNode;\n }\n\n if (!target) {\n return;\n }\n\n dispatch(target.dataset.navigate);\n });\n\n container.appendChild(nav);\n\n return nav;\n}\n\n// eslint-disable-next-line no-unused-vars\nfunction pfwr(options) {\n\n const {\n container\n } = options;\n\n const slides = Array.from(container.querySelectorAll('.slide'));\n\n // mouse navigation controls\n const nav = addNavigationControls(container, dispatch);\n\n // event listeners ////////////////////////\n\n const listeners = [];\n\n function on(event, fn) {\n listeners.push([ event, fn ]);\n }\n\n function emit(event, data) {\n\n for (const [ eventType, fn ] of listeners) {\n if (event === eventType) {\n fn(data);\n }\n }\n }\n\n // slide life cycle ////////////////\n\n let slideIndex = -1;\n let overview = false;\n\n function emitState() {\n emit('change', { slide: slideIndex, overview });\n }\n\n function toggleOverview(value) {\n\n value = !!value;\n\n if (overview === value) {\n return;\n }\n\n overview = value;\n container.classList.toggle('overview', overview);\n\n if (overview) {\n const current = container.querySelector('.slide.current');\n\n current && current.scrollIntoView({ block: 'center' });\n }\n\n emitState();\n }\n\n function dispatch(action) {\n\n if (action === 'overview') {\n return toggleOverview(!overview);\n }\n\n goto(action);\n }\n\n function goto(next) {\n\n const slide = slides[slideIndex] || slides.find(s => s.dataset.name === slideIndex);\n\n const nextIndex = ((next, currentIndex, numberOfSlides) => {\n\n if (next === 'next') {\n return currentIndex + 1;\n }\n\n if (next === 'previous') {\n return currentIndex - 1;\n }\n\n if (next === 'first') {\n return 0;\n }\n\n if (next === 'last') {\n return numberOfSlides - 1;\n }\n\n if (next < 0) {\n return numberOfSlides + next;\n }\n\n return next;\n })(next, slides.indexOf(slide), slides.length);\n\n if (slideIndex === nextIndex) {\n return;\n }\n\n const nextSlide = slides[nextIndex] || slides.find(s => s.dataset.name === nextIndex);\n\n if (!nextSlide) {\n return;\n }\n\n slide && slide.classList.remove('current');\n nextSlide.classList.add('current');\n\n slideIndex = nextSlide.dataset.name || nextIndex;\n\n emitState();\n }\n\n // slide navigation\n\n function showNav() {\n nav && nav.classList.toggle('shown', true);\n }\n\n function hideNav() {\n nav && !nav.matches('.hovered') && nav.classList.toggle('shown', false);\n }\n\n let hideTimer;\n\n container.addEventListener('mousemove', function() {\n\n showNav();\n\n clearTimeout(hideTimer);\n\n hideTimer = setTimeout(hideNav, 2000);\n });\n\n // open a slide by clicking its tile in overview\n container.addEventListener('click', function(event) {\n\n if (!overview) {\n return;\n }\n\n const slide = event.target.closest('.slide');\n\n if (!slide) {\n return;\n }\n\n goto(slides.indexOf(slide));\n toggleOverview(false);\n });\n\n\n let initialTouch = null;\n\n function touchPosition(event) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY\n };\n }\n\n function handleTouchStart(event) {\n initialTouch = touchPosition(event);\n }\n\n function handleTouchMove(event) {\n\n if (!initialTouch) {\n return;\n }\n\n var currentTouch = touchPosition(event);\n\n var diff = {\n x: initialTouch.x - currentTouch.x,\n y: initialTouch.y - currentTouch.y\n };\n\n if (Math.abs(diff.x) > 30) {\n if (diff.x < 0) {\n goto('previous');\n } else {\n goto('next');\n }\n\n initialTouch = null;\n }\n }\n\n function handleKey(event) {\n\n const key = event.key;\n\n if (event.altKey || event.metaKey || event.ctrlKey) {\n return;\n }\n\n if (key === 'Home') {\n hideNav();\n goto('first');\n\n return false;\n }\n\n if (key === 'End') {\n hideNav();\n goto('last');\n\n return false;\n }\n\n if (key === 'ArrowRight' || key === 'Enter' || key === ' ') {\n hideNav();\n goto('next');\n\n return false;\n }\n\n if (key === 'ArrowLeft') {\n hideNav();\n goto('previous');\n\n return false;\n }\n\n if (key === 'o' || key === 'O') {\n toggleOverview(!overview);\n\n return false;\n }\n }\n\n function destroy() {\n document.removeEventListener('keydown', handleKey);\n\n document.removeEventListener('touchstart', handleTouchStart, false);\n document.removeEventListener('touchmove', handleTouchMove, false);\n }\n\n document.addEventListener('keydown', handleKey);\n\n document.addEventListener('touchstart', handleTouchStart, false);\n document.addEventListener('touchmove', handleTouchMove, false);\n\n return {\n on,\n goto,\n toggleOverview,\n destroy\n };\n}";
|
|
71157
|
+
var pfwrScript = "function addNavigationControls(container, dispatch) {\n\n const html = `<nav class=\"slide-navigation shown\">\n <a class=\"navigation-button\" data-navigate=\"first\" title=\"First slide\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 16.5a4.5 4.5 0 100-9 4.5 4.5 0 000 9zm0 1.5a6 6 0 100-12 6 6 0 000 12z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"previous\" title=\"Previous slide (Left Arrow)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M8.854 11.646l5.792-5.792a.5.5 0 01.854.353v11.586a.5.5 0 01-.854.353l-5.792-5.792a.5.5 0 010-.708z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"next\" title=\"Next slide (Enter/Spacebar/Right Arrow)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M15.146 12.354l-5.792 5.792a.5.5 0 01-.854-.353V6.207a.5.5 0 01.854-.353l5.792 5.792a.5.5 0 010 .708z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"last\" title=\"Last slide\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M12 18a6 6 0 100-12 6 6 0 000 12z\"></path></svg>\n </a>\n <a class=\"navigation-button\" data-navigate=\"overview\" title=\"Toggle overview (O)\" href>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"-4 -4 24 24\"><path d=\"m14.12 10.163 1.715.858c.22.11.22.424 0 .534L8.267 15.34a.6.6 0 0 1-.534 0L.165 11.555a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.66zM7.733.063a.6.6 0 0 1 .534 0l7.568 3.784a.3.3 0 0 1 0 .535L8.267 8.165a.6.6 0 0 1-.534 0L.165 4.382a.299.299 0 0 1 0-.535z\"></path><path d=\"m14.12 6.576 1.715.858c.22.11.22.424 0 .534l-7.568 3.784a.6.6 0 0 1-.534 0L.165 7.968a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0z\"></path></svg>\n </a>\n </nav>`;\n\n const tmp = document.createElement('div');\n\n tmp.innerHTML = html;\n\n const nav = tmp.removeChild(tmp.lastChild);\n\n nav.addEventListener('mouseenter', function(event) {\n nav.classList.add('hovered');\n });\n\n nav.addEventListener('mouseleave', function(event) {\n nav.classList.remove('hovered');\n });\n\n nav.addEventListener('click', function(event) {\n\n event.preventDefault();\n\n let target = event.target;\n\n while (!target.matches('[data-navigate]')) {\n target = target.parentNode;\n }\n\n if (!target) {\n return;\n }\n\n dispatch(target.dataset.navigate);\n });\n\n container.appendChild(nav);\n\n return nav;\n}\n\n// eslint-disable-next-line no-unused-vars\nfunction pfwr(options) {\n\n const {\n container\n } = options;\n\n const slides = Array.from(container.querySelectorAll('.slide'));\n\n // mouse navigation controls\n const nav = addNavigationControls(container, dispatch);\n\n // event listeners ////////////////////////\n\n const listeners = [];\n\n function on(event, fn) {\n listeners.push([ event, fn ]);\n }\n\n function emit(event, data) {\n\n for (const [ eventType, fn ] of listeners) {\n if (event === eventType) {\n fn(data);\n }\n }\n }\n\n // slide life cycle ////////////////\n\n let slideIndex = -1;\n let overview = false;\n\n function emitState() {\n emit('change', { slide: slideIndex, overview });\n }\n\n function toggleOverview(value) {\n\n value = !!value;\n\n if (overview === value) {\n return;\n }\n\n overview = value;\n container.classList.toggle('overview', overview);\n\n if (overview) {\n const current = container.querySelector('.slide.current');\n\n current && current.scrollIntoView({ block: 'center' });\n }\n\n emitState();\n }\n\n function dispatch(action) {\n\n if (action === 'overview') {\n return toggleOverview(!overview);\n }\n\n goto(action);\n }\n\n function goto(next) {\n\n const slide = slides[slideIndex] || slides.find(s => s.dataset.name === slideIndex);\n\n const nextIndex = ((next, currentIndex, numberOfSlides) => {\n\n if (next === 'next') {\n return currentIndex + 1;\n }\n\n if (next === 'previous') {\n return currentIndex - 1;\n }\n\n if (next === 'first') {\n return 0;\n }\n\n if (next === 'last') {\n return numberOfSlides - 1;\n }\n\n if (next < 0) {\n return numberOfSlides + next;\n }\n\n return next;\n })(next, slides.indexOf(slide), slides.length);\n\n if (slideIndex === nextIndex) {\n return;\n }\n\n const nextSlide = slides[nextIndex] || slides.find(s => s.dataset.name === nextIndex);\n\n if (!nextSlide) {\n return;\n }\n\n slide && slide.classList.remove('current');\n nextSlide.classList.add('current');\n\n slideIndex = nextSlide.dataset.name || nextIndex;\n\n emitState();\n }\n\n // slide navigation\n\n function showNav() {\n nav && nav.classList.toggle('shown', true);\n }\n\n function hideNav() {\n nav && !nav.matches('.hovered') && nav.classList.toggle('shown', false);\n }\n\n let hideTimer;\n\n container.addEventListener('mousemove', function() {\n\n showNav();\n\n clearTimeout(hideTimer);\n\n hideTimer = setTimeout(hideNav, 2000);\n });\n\n // open a slide by clicking its tile in overview\n container.addEventListener('click', function(event) {\n\n if (!overview) {\n return;\n }\n\n const slide = event.target.closest('.slide');\n\n if (!slide) {\n return;\n }\n\n // prevent links (and other default actions) from\n // triggering while navigating via overview\n event.preventDefault();\n\n goto(slides.indexOf(slide));\n toggleOverview(false);\n });\n\n\n let initialTouch = null;\n\n function touchPosition(event) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY\n };\n }\n\n function handleTouchStart(event) {\n initialTouch = touchPosition(event);\n }\n\n function handleTouchMove(event) {\n\n if (!initialTouch) {\n return;\n }\n\n var currentTouch = touchPosition(event);\n\n var diff = {\n x: initialTouch.x - currentTouch.x,\n y: initialTouch.y - currentTouch.y\n };\n\n if (Math.abs(diff.x) > 30) {\n if (diff.x < 0) {\n goto('previous');\n } else {\n goto('next');\n }\n\n initialTouch = null;\n }\n }\n\n function handleKey(event) {\n\n const key = event.key;\n\n if (event.altKey || event.metaKey || event.ctrlKey) {\n return;\n }\n\n if (key === 'Home') {\n hideNav();\n goto('first');\n\n return false;\n }\n\n if (key === 'End') {\n hideNav();\n goto('last');\n\n return false;\n }\n\n if (key === 'ArrowRight' || key === 'Enter' || key === ' ') {\n hideNav();\n goto('next');\n\n return false;\n }\n\n if (key === 'ArrowLeft') {\n hideNav();\n goto('previous');\n\n return false;\n }\n\n if (key === 'o' || key === 'O') {\n toggleOverview(!overview);\n\n return false;\n }\n }\n\n function destroy() {\n document.removeEventListener('keydown', handleKey);\n\n document.removeEventListener('touchstart', handleTouchStart, false);\n document.removeEventListener('touchmove', handleTouchMove, false);\n }\n\n document.addEventListener('keydown', handleKey);\n\n document.addEventListener('touchstart', handleTouchStart, false);\n document.addEventListener('touchmove', handleTouchMove, false);\n\n return {\n on,\n goto,\n toggleOverview,\n destroy\n };\n}";
|
|
70785
71158
|
|
|
70786
71159
|
var prismScript = "/* PrismJS 1.23.0\nhttps://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript */\nvar _self=\"undefined\"!=typeof window?window:\"undefined\"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\\blang(?:uage)?-([\\w-]+)\\b/i,n=0,_={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof M?new M(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,\"&\").replace(/</g,\"<\").replace(/\\u00a0/g,\" \")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,\"__id\",{value:++n}),e.__id},clone:function t(e,r){var a,n;switch(r=r||{},_.util.type(e)){case\"Object\":if(n=_.util.objId(e),r[n])return r[n];for(var i in a={},r[n]=a,e)e.hasOwnProperty(i)&&(a[i]=t(e[i],r));return a;case\"Array\":return n=_.util.objId(e),r[n]?r[n]:(a=[],r[n]=a,e.forEach(function(e,n){a[n]=t(e,r)}),a);default:return e}},getLanguage:function(e){for(;e&&!c.test(e.className);)e=e.parentElement;return e?(e.className.match(c)||[,\"none\"])[1].toLowerCase():\"none\"},currentScript:function(){if(\"undefined\"==typeof document)return null;if(\"currentScript\"in document)return document.currentScript;try{throw new Error}catch(e){var n=(/at [^(\\r\\n]*\\((.*):.+:.+\\)$/i.exec(e.stack)||[])[1];if(n){var t=document.getElementsByTagName(\"script\");for(var r in t)if(t[r].src==n)return t[r]}return null}},isActive:function(e,n,t){for(var r=\"no-\"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{extend:function(e,n){var t=_.util.clone(_.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(t,e,n,r){var a=(r=r||_.languages)[t],i={};for(var l in a)if(a.hasOwnProperty(l)){if(l==e)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);n.hasOwnProperty(l)||(i[l]=a[l])}var s=r[t];return r[t]=i,_.languages.DFS(_.languages,function(e,n){n===s&&e!=t&&(this[e]=i)}),i},DFS:function e(n,t,r,a){a=a||{};var i=_.util.objId;for(var l in n)if(n.hasOwnProperty(l)){t.call(n,l,n[l],r||l);var o=n[l],s=_.util.type(o);\"Object\"!==s||a[i(o)]?\"Array\"!==s||a[i(o)]||(a[i(o)]=!0,e(o,t,l,a)):(a[i(o)]=!0,e(o,t,null,a))}}},plugins:{},highlightAll:function(e,n){_.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'};_.hooks.run(\"before-highlightall\",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),_.hooks.run(\"before-all-elements-highlight\",r);for(var a,i=0;a=r.elements[i++];)_.highlightElement(a,!0===n,r.callback)},highlightElement:function(e,n,t){var r=_.util.getLanguage(e),a=_.languages[r];e.className=e.className.replace(c,\"\").replace(/\\s+/g,\" \")+\" language-\"+r;var i=e.parentElement;i&&\"pre\"===i.nodeName.toLowerCase()&&(i.className=i.className.replace(c,\"\").replace(/\\s+/g,\" \")+\" language-\"+r);var l={element:e,language:r,grammar:a,code:e.textContent};function o(e){l.highlightedCode=e,_.hooks.run(\"before-insert\",l),l.element.innerHTML=l.highlightedCode,_.hooks.run(\"after-highlight\",l),_.hooks.run(\"complete\",l),t&&t.call(l.element)}if(_.hooks.run(\"before-sanity-check\",l),!l.code)return _.hooks.run(\"complete\",l),void(t&&t.call(l.element));if(_.hooks.run(\"before-highlight\",l),l.grammar)if(n&&u.Worker){var s=new Worker(_.filename);s.onmessage=function(e){o(e.data)},s.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else o(_.highlight(l.code,l.grammar,l.language));else o(_.util.encode(l.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};return _.hooks.run(\"before-tokenize\",r),r.tokens=_.tokenize(r.code,r.grammar),_.hooks.run(\"after-tokenize\",r),M.stringify(_.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new i;return z(a,a.head,e),function e(n,t,r,a,i,l){for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var s=r[o];s=Array.isArray(s)?s:[s];for(var u=0;u<s.length;++u){if(l&&l.cause==o+\",\"+u)return;var c=s[u],g=c.inside,f=!!c.lookbehind,h=!!c.greedy,d=c.alias;if(h&&!c.pattern.global){var v=c.pattern.toString().match(/[imsuy]*$/)[0];c.pattern=RegExp(c.pattern.source,v+\"g\")}for(var p=c.pattern||c,m=a.next,y=i;m!==t.tail&&!(l&&y>=l.reach);y+=m.value.length,m=m.next){var k=m.value;if(t.length>n.length)return;if(!(k instanceof M)){var b,x=1;if(h){if(!(b=W(p,y,n,f)))break;var w=b.index,A=b.index+b[0].length,P=y;for(P+=m.value.length;P<=w;)m=m.next,P+=m.value.length;if(P-=m.value.length,y=P,m.value instanceof M)continue;for(var S=m;S!==t.tail&&(P<A||\"string\"==typeof S.value);S=S.next)x++,P+=S.value.length;x--,k=n.slice(y,P),b.index-=y}else if(!(b=W(p,0,k,f)))continue;var w=b.index,E=b[0],O=k.slice(0,w),L=k.slice(w+E.length),N=y+k.length;l&&N>l.reach&&(l.reach=N);var j=m.prev;O&&(j=z(t,j,O),y+=O.length),I(t,j,x);var C=new M(o,g?_.tokenize(E,g):E,d,E);m=z(t,j,C),L&&z(t,m,L),1<x&&e(n,t,r,m.prev,y,{cause:o+\",\"+u,reach:N})}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=_.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=_.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:M};function M(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||\"\").length}function W(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function z(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function I(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;(n.next=r).prev=n,e.length-=a}if(u.Prism=_,M.stringify=function n(e,t){if(\"string\"==typeof e)return e;if(Array.isArray(e)){var r=\"\";return e.forEach(function(e){r+=n(e,t)}),r}var a={type:e.type,content:n(e.content,t),tag:\"span\",classes:[\"token\",e.type],attributes:{},language:t},i=e.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(a.classes,i):a.classes.push(i)),_.hooks.run(\"wrap\",a);var l=\"\";for(var o in a.attributes)l+=\" \"+o+'=\"'+(a.attributes[o]||\"\").replace(/\"/g,\""\")+'\"';return\"<\"+a.tag+' class=\"'+a.classes.join(\" \")+'\"'+l+\">\"+a.content+\"</\"+a.tag+\">\"},!u.document)return u.addEventListener&&(_.disableWorkerMessageHandler||u.addEventListener(\"message\",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(_.highlight(r,_.languages[t],t)),a&&u.close()},!1)),_;var e=_.util.currentScript();function t(){_.manual||_.highlightAll()}if(e&&(_.filename=e.src,e.hasAttribute(\"data-manual\")&&(_.manual=!0)),!_.manual){var r=document.readyState;\"loading\"===r||\"interactive\"===r&&e&&e.defer?document.addEventListener(\"DOMContentLoaded\",t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t,16)}return _}(_self);\"undefined\"!=typeof module&&module.exports&&(module.exports=Prism),\"undefined\"!=typeof global&&(global.Prism=Prism);\nPrism.languages.markup={comment:/<!--[\\s\\S]*?-->/,prolog:/<\\?[\\s\\S]+?\\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>\"'[\\]]|\"[^\"]*\"|'[^']*')+(?:\\[(?:[^<\"'\\]]|\"[^\"]*\"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\\]\\s*)?>/i,greedy:!0,inside:{\"internal-subset\":{pattern:/(\\[)[\\s\\S]+(?=\\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/\"[^\"]*\"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\\]]/,\"doctype-tag\":/^DOCTYPE/,name:/[^\\s<>'\"]+/}},cdata:/<!\\[CDATA\\[[\\s\\S]*?]]>/i,tag:{pattern:/<\\/?(?!\\d)[^\\s>\\/=$<%]+(?:\\s(?:\\s*[^\\s>\\/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))|(?=[\\s/>])))+)?\\s*\\/?>/,greedy:!0,inside:{tag:{pattern:/^<\\/?[^\\s>\\/]+/,inside:{punctuation:/^<\\/?/,namespace:/^[^\\s>\\/:]+:/}},\"attr-value\":{pattern:/=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:\"attr-equals\"},/\"|'/]}},punctuation:/\\/?>/,\"attr-name\":{pattern:/[^\\s>\\/]+/,inside:{namespace:/^[^\\s>\\/:]+:/}}}},entity:[{pattern:/&[\\da-z]{1,8};/i,alias:\"named-entity\"},/&#x?[\\da-f]{1,8};/i]},Prism.languages.markup.tag.inside[\"attr-value\"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside[\"internal-subset\"].inside=Prism.languages.markup,Prism.hooks.add(\"wrap\",function(a){\"entity\"===a.type&&(a.attributes.title=a.content.replace(/&/,\"&\"))}),Object.defineProperty(Prism.languages.markup.tag,\"addInlined\",{value:function(a,e){var s={};s[\"language-\"+e]={pattern:/(^<!\\[CDATA\\[)[\\s\\S]+?(?=\\]\\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\\[CDATA\\[|\\]\\]>$/i;var n={\"included-cdata\":{pattern:/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,inside:s}};n[\"language-\"+e]={pattern:/[\\s\\S]+/,inside:Prism.languages[e]};var t={};t[a]={pattern:RegExp(\"(<__[^>]*>)(?:<!\\\\[CDATA\\\\[(?:[^\\\\]]|\\\\](?!\\\\]>))*\\\\]\\\\]>|(?!<!\\\\[CDATA\\\\[)[^])*?(?=</__>)\".replace(/__/g,function(){return a}),\"i\"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore(\"markup\",\"cdata\",t)}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend(\"markup\",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml;\n!function(s){var e=/(\"|')(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/;s.languages.css={comment:/\\/\\*[\\s\\S]*?\\*\\//,atrule:{pattern:/@[\\w-](?:[^;{\\s]|\\s+(?![\\s{]))*(?:;|(?=\\s*\\{))/,inside:{rule:/^@[\\w-]+/,\"selector-function-argument\":{pattern:/(\\bselector\\s*\\(\\s*(?![\\s)]))(?:[^()\\s]|\\s+(?![\\s)])|\\((?:[^()]|\\([^()]*\\))*\\))+(?=\\s*\\))/,lookbehind:!0,alias:\"selector\"},keyword:{pattern:/(^|[^\\w-])(?:and|not|only|or)(?![\\w-])/,lookbehind:!0}}},url:{pattern:RegExp(\"\\\\burl\\\\((?:\"+e.source+\"|(?:[^\\\\\\\\\\r\\n()\\\"']|\\\\\\\\[^])*)\\\\)\",\"i\"),greedy:!0,inside:{function:/^url/i,punctuation:/^\\(|\\)$/,string:{pattern:RegExp(\"^\"+e.source+\"$\"),alias:\"url\"}}},selector:RegExp(\"[^{}\\\\s](?:[^{};\\\"'\\\\s]|\\\\s+(?![\\\\s{])|\"+e.source+\")*(?=\\\\s*\\\\{)\"),string:{pattern:e,greedy:!0},property:/(?!\\s)[-_a-z\\xA0-\\uFFFF](?:(?!\\s)[-\\w\\xA0-\\uFFFF])*(?=\\s*:)/i,important:/!important\\b/i,function:/[-a-z0-9]+(?=\\()/i,punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var t=s.languages.markup;t&&(t.tag.addInlined(\"style\",\"css\"),s.languages.insertBefore(\"inside\",\"attr-value\",{\"style-attr\":{pattern:/(^|[\"'\\s])style\\s*=\\s*(?:\"[^\"]*\"|'[^']*')/i,lookbehind:!0,inside:{\"attr-value\":{pattern:/=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+)/,inside:{style:{pattern:/([\"'])[\\s\\S]+(?=[\"']$)/,lookbehind:!0,alias:\"language-css\",inside:s.languages.css},punctuation:[{pattern:/^=/,alias:\"attr-equals\"},/\"|'/]}},\"attr-name\":/^style/i}}},t.tag))}(Prism);\nPrism.languages.clike={comment:[{pattern:/(^|[^\\\\])\\/\\*[\\s\\S]*?(?:\\*\\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\\\:])\\/\\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/([\"'])(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/,greedy:!0},\"class-name\":{pattern:/(\\b(?:class|interface|extends|implements|trait|instanceof|new)\\s+|\\bcatch\\s+\\()[\\w.\\\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\\\]/}},keyword:/\\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\\b/,boolean:/\\b(?:true|false)\\b/,function:/\\w+(?=\\()/,number:/\\b0x[\\da-f]+\\b|(?:\\b\\d+(?:\\.\\d*)?|\\B\\.\\d+)(?:e[+-]?\\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\\+\\+?|&&?|\\|\\|?|[?*/~^%]/,punctuation:/[{}[\\];(),.:]/};\nPrism.languages.javascript=Prism.languages.extend(\"clike\",{\"class-name\":[Prism.languages.clike[\"class-name\"],{pattern:/(^|[^$\\w\\xA0-\\uFFFF])(?!\\s)[_$A-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\\s*)(?:catch|finally)\\b/,lookbehind:!0},{pattern:/(^|[^.]|\\.\\.\\.\\s*)\\b(?:as|async(?=\\s*(?:function\\b|\\(|[$\\w\\xA0-\\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\\s*[\\[$\\w\\xA0-\\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\\b/,lookbehind:!0}],function:/#?(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*(?:\\.\\s*(?:apply|bind|call)\\s*)?\\()/,number:/\\b(?:(?:0[xX](?:[\\dA-Fa-f](?:_[\\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\\d(?:_\\d)?)+n|NaN|Infinity)\\b|(?:\\b(?:\\d(?:_\\d)?)+\\.?(?:\\d(?:_\\d)?)*|\\B\\.(?:\\d(?:_\\d)?)+)(?:[Ee][+-]?(?:\\d(?:_\\d)?)+)?/,operator:/--|\\+\\+|\\*\\*=?|=>|&&=?|\\|\\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\\.{3}|\\?\\?=?|\\?\\.?|[~:]/}),Prism.languages.javascript[\"class-name\"][0].pattern=/(\\b(?:class|interface|extends|implements|instanceof|new)\\s+)[\\w.\\\\]+/,Prism.languages.insertBefore(\"javascript\",\"keyword\",{regex:{pattern:/((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[gimyus]{0,6}(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))/,lookbehind:!0,greedy:!0,inside:{\"regex-source\":{pattern:/^(\\/)[\\s\\S]+(?=\\/[a-z]*$)/,lookbehind:!0,alias:\"language-regex\",inside:Prism.languages.regex},\"regex-flags\":/[a-z]+$/,\"regex-delimiter\":/^\\/|\\/$/}},\"function-variable\":{pattern:/#?(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*[=:]\\s*(?:async\\s*)?(?:\\bfunction\\b|(?:\\((?:[^()]|\\([^()]*\\))*\\)|(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*)\\s*=>))/,alias:\"function\"},parameter:[{pattern:/(function(?:\\s+(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*)?\\s*\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\)\\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\\b|\\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\\w\\xA0-\\uFFFF]))(?:(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*\\s*)\\(\\s*|\\]\\s*\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\)\\s*\\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\\b[A-Z](?:[A-Z_]|\\dx?)*\\b/}),Prism.languages.insertBefore(\"javascript\",\"string\",{\"template-string\":{pattern:/`(?:\\\\[\\s\\S]|\\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\\${)[^\\\\`])*`/,greedy:!0,inside:{\"template-punctuation\":{pattern:/^`|`$/,alias:\"string\"},interpolation:{pattern:/((?:^|[^\\\\])(?:\\\\{2})*)\\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{\"interpolation-punctuation\":{pattern:/^\\${|}$/,alias:\"punctuation\"},rest:Prism.languages.javascript}},string:/[\\s\\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined(\"script\",\"javascript\"),Prism.languages.js=Prism.languages.javascript;\n";
|
|
70787
71160
|
|