j1-template 2021.2.12 → 2021.3.0

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/compress.html +12 -4
  3. data/assets/data/private.json +49 -0
  4. data/assets/themes/j1/adapter/js/{j1scroll.js → scroller.js} +285 -304
  5. data/assets/themes/j1/core/js/template.js +4098 -223
  6. data/assets/themes/j1/core/js/template.min.js +9 -8
  7. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  8. data/assets/themes/j1/modules/{j1Deepl/js/j1deepl.js → deeplAPI/js/deeplAPI.js} +36 -11
  9. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.min.js +18 -0
  10. data/assets/themes/j1/modules/{j1Scroll → scroller}/css/theme/uno.css +2 -2
  11. data/assets/themes/j1/modules/{j1Scroll → scroller}/css/theme/uno.min.css +0 -0
  12. data/assets/themes/j1/modules/scroller/js/scroller.js +346 -0
  13. data/assets/themes/j1/modules/scroller/js/scroller.min.js +15 -0
  14. data/lib/j1/version.rb +1 -1
  15. data/lib/starter_web/Gemfile +1 -1
  16. data/lib/starter_web/_config.yml +6 -2
  17. data/lib/starter_web/_data/modules/{j1scroll.yml → scroller.yml} +30 -5
  18. data/lib/starter_web/_data/private.default.yml +8 -1
  19. data/lib/starter_web/_data/private.yml +8 -1
  20. data/lib/starter_web/_data/resources.yml +14 -35
  21. data/lib/starter_web/_includes/attributes.asciidoc +1 -1
  22. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  23. data/lib/starter_web/index.html +2 -1
  24. data/lib/starter_web/package.json +1 -1
  25. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
  26. data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +743 -743
  27. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  28. data/lib/starter_web/utilsrv/package.json +1 -1
  29. metadata +11 -12
  30. data/assets/themes/j1/modules/j1Deepl/js/j1deepl.min.js +0 -18
  31. data/assets/themes/j1/modules/j1Scroll/js/j1scroll.js +0 -280
  32. data/assets/themes/j1/modules/j1Scroll/js/j1scroll.min.js +0 -15
  33. data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.js +0 -73
  34. data/assets/themes/j1/modules/showOnScroll/js/showOnScroll.min.js +0 -15
@@ -192,9 +192,11 @@ window.deeplTranslator = __webpack_require__(14); // window.j1.fam
192
192
  //const Bootstrap = require('./js/bootstrap/bootstrap.js');
193
193
  //const J1JekyllSearch = require('./js/jekyll_search/jekyll_search.js');
194
194
 
195
- var J1Tocbot = __webpack_require__(24);
195
+ var J1Yaml = __webpack_require__(24);
196
196
 
197
- var J1AttrChangeListener = __webpack_require__(30); //const J1ThemeSwitcher = require('./js/bs_theme_switcher/switcher.js');
197
+ var J1Tocbot = __webpack_require__(25);
198
+
199
+ var J1AttrChangeListener = __webpack_require__(31); //const J1ThemeSwitcher = require('./js/bs_theme_switcher/switcher.js');
198
200
  // const J1MmenuLight = require('./js/mmenu-light/mmenu.js');
199
201
  // Passing log data over Internet|SeeMe (currently NOT used)
200
202
  // -----------------------------------------------------------------------------
@@ -227,7 +229,7 @@ var J1AttrChangeListener = __webpack_require__(30); //const J1ThemeSwitcher
227
229
  // -----------------------------------------------------------------------------
228
230
 
229
231
 
230
- var J1AdocResultViewer = __webpack_require__(31); // const MSIEPolyfills = require('./js/polyfills/ms-ie.js');
232
+ var J1AdocResultViewer = __webpack_require__(32); // const MSIEPolyfills = require('./js/polyfills/ms-ie.js');
231
233
  // HMR messages (currently NOT used)
232
234
  // -----------------------------------------------------------------------------
233
235
  // if (module.hot) {
@@ -7165,290 +7167,4163 @@ exports.homedir = function () {
7165
7167
 
7166
7168
  /***/ }),
7167
7169
  /* 24 */
7168
- /***/ (function(module, exports, __webpack_require__) {
7170
+ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
7169
7171
 
7170
- /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
7172
+ "use strict";
7173
+ __webpack_require__.r(__webpack_exports__);
7174
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CORE_SCHEMA", function() { return CORE_SCHEMA; });
7175
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_SCHEMA", function() { return DEFAULT_SCHEMA; });
7176
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FAILSAFE_SCHEMA", function() { return FAILSAFE_SCHEMA; });
7177
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JSON_SCHEMA", function() { return JSON_SCHEMA; });
7178
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Schema", function() { return Schema; });
7179
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
7180
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "YAMLException", function() { return YAMLException; });
7181
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dump", function() { return dump; });
7182
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "load", function() { return load; });
7183
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadAll", function() { return loadAll; });
7184
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeDump", function() { return safeDump; });
7185
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeLoad", function() { return safeLoad; });
7186
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeLoadAll", function() { return safeLoadAll; });
7187
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "types", function() { return types; });
7171
7188
 
7172
- /*
7173
- # -----------------------------------------------------------------------------
7174
- # ~/js/tocbot/tocbot.js
7175
- # Tocbot v4.12.0 implementation for J1 template
7176
- #
7177
- # Product/Info:
7178
- # https://jekyll.one
7179
- # https://tscanlin.github.io/tocbot
7180
- # https://github.com/tscanlin/tocbot
7181
- #
7182
- # Copyright (C) 2021 Juergen Adams
7183
- # Copyright (C) 2016 Tim Scanlin
7184
- #
7185
- # J1 Template is licensed under MIT License.
7186
- # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
7187
- # Tocbot is licensed under the MIT License.
7188
- # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE
7189
- # -----------------------------------------------------------------------------
7190
- # rules:
7191
- # "eslint:tocbot": "eslint --ignore-path .eslintignore src/tocbot/js"
7192
- # -----------------------------------------------------------------------------
7193
- */
7194
- // -----------------------------------------------------------------------------
7195
- // ESLint shimming
7196
- // -----------------------------------------------------------------------------
7189
+ /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
7190
+ function isNothing(subject) {
7191
+ return (typeof subject === 'undefined') || (subject === null);
7192
+ }
7197
7193
 
7198
- /* eslint indent: "off" */
7199
7194
 
7200
- /* eslint no-undef: "off" */
7195
+ function isObject(subject) {
7196
+ return (typeof subject === 'object') && (subject !== null);
7197
+ }
7201
7198
 
7202
- /* eslint semi: "off" */
7203
- // -----------------------------------------------------------------------------
7204
7199
 
7205
- /**
7206
- * Tocbot
7207
- * Tocbot creates a toble of contents based on HTML headings on a page,
7208
- * this allows users to easily jump to different sections of the document.
7209
- * Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/).
7210
- * The main differences are that it works natively without any need for jquery or jquery UI).
7211
- *
7212
- * @author Tim Scanlin
7213
- */
7200
+ function toArray(sequence) {
7201
+ if (Array.isArray(sequence)) return sequence;
7202
+ else if (isNothing(sequence)) return [];
7214
7203
 
7215
- /* globals define */
7216
- (function (root, factory) {
7217
- if (true) {
7218
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)),
7219
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
7220
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
7221
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
7222
- } else {}
7223
- })(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {
7224
- 'use strict'; // Default options.
7204
+ return [ sequence ];
7205
+ }
7225
7206
 
7226
- var defaultOptions = __webpack_require__(25); // Object to store current options.
7227
7207
 
7208
+ function extend(target, source) {
7209
+ var index, length, key, sourceKeys;
7228
7210
 
7229
- var options = {}; // Object for public APIs.
7211
+ if (source) {
7212
+ sourceKeys = Object.keys(source);
7230
7213
 
7231
- var tocbot = {};
7214
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
7215
+ key = sourceKeys[index];
7216
+ target[key] = source[key];
7217
+ }
7218
+ }
7232
7219
 
7233
- var BuildHtml = __webpack_require__(26);
7220
+ return target;
7221
+ }
7234
7222
 
7235
- var ParseContent = __webpack_require__(27);
7236
7223
 
7237
- var updateTocScroll = __webpack_require__(28); // Keep these variables at top scope once options are passed in.
7224
+ function repeat(string, count) {
7225
+ var result = '', cycle;
7238
7226
 
7227
+ for (cycle = 0; cycle < count; cycle += 1) {
7228
+ result += string;
7229
+ }
7239
7230
 
7240
- var buildHtml;
7241
- var parseContent; // Just return if its not a browser.
7231
+ return result;
7232
+ }
7242
7233
 
7243
- var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener; // Feature test
7244
7234
 
7245
- if (typeof window === 'undefined' && !supports) {
7246
- return;
7247
- }
7235
+ function isNegativeZero(number) {
7236
+ return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
7237
+ }
7248
7238
 
7249
- var headingsArray; // From: https://github.com/Raynos/xtend
7250
7239
 
7251
- var hasOwnProperty = Object.prototype.hasOwnProperty;
7240
+ var isNothing_1 = isNothing;
7241
+ var isObject_1 = isObject;
7242
+ var toArray_1 = toArray;
7243
+ var repeat_1 = repeat;
7244
+ var isNegativeZero_1 = isNegativeZero;
7245
+ var extend_1 = extend;
7252
7246
 
7253
- function extend() {
7254
- var target = {};
7247
+ var common = {
7248
+ isNothing: isNothing_1,
7249
+ isObject: isObject_1,
7250
+ toArray: toArray_1,
7251
+ repeat: repeat_1,
7252
+ isNegativeZero: isNegativeZero_1,
7253
+ extend: extend_1
7254
+ };
7255
7255
 
7256
- for (var i = 0; i < arguments.length; i++) {
7257
- var source = arguments[i];
7256
+ // YAML error class. http://stackoverflow.com/questions/8458984
7258
7257
 
7259
- for (var key in source) {
7260
- if (hasOwnProperty.call(source, key)) {
7261
- target[key] = source[key];
7262
- }
7263
- }
7264
- }
7265
7258
 
7266
- return target;
7267
- } // From: https://remysharp.com/2010/07/21/throttling-function-calls
7259
+ function formatError(exception, compact) {
7260
+ var where = '', message = exception.reason || '(unknown reason)';
7268
7261
 
7262
+ if (!exception.mark) return message;
7269
7263
 
7270
- function throttle(fn, threshold, scope) {
7271
- threshold || (threshold = 250);
7272
- var last;
7273
- var deferTimer;
7274
- return function () {
7275
- var context = scope || this;
7276
- var now = +new Date();
7277
- var args = arguments;
7264
+ if (exception.mark.name) {
7265
+ where += 'in "' + exception.mark.name + '" ';
7266
+ }
7278
7267
 
7279
- if (last && now < last + threshold) {
7280
- // hold on to it
7281
- clearTimeout(deferTimer);
7282
- deferTimer = setTimeout(function () {
7283
- last = now;
7284
- fn.apply(context, args);
7285
- }, threshold);
7286
- } else {
7287
- last = now;
7288
- fn.apply(context, args);
7289
- }
7290
- };
7268
+ where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
7269
+
7270
+ if (!compact && exception.mark.snippet) {
7271
+ where += '\n\n' + exception.mark.snippet;
7291
7272
  }
7292
- /**
7293
- * Destroy tocbot.
7294
- */
7295
7273
 
7274
+ return message + ' ' + where;
7275
+ }
7296
7276
 
7297
- tocbot.destroy = function () {
7298
- if (!options.skipRendering) {
7299
- // Clear HTML.
7300
- try {
7301
- document.querySelector(options.tocSelector).innerHTML = '';
7302
- } catch (e) {
7303
- console.warn('Element not found: ' + options.tocSelector); // eslint-disable-line
7304
- }
7305
- } // Remove event listeners.
7306
7277
 
7278
+ function YAMLException$1(reason, mark) {
7279
+ // Super constructor
7280
+ Error.call(this);
7307
7281
 
7308
- if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
7309
- document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false);
7310
- document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false);
7282
+ this.name = 'YAMLException';
7283
+ this.reason = reason;
7284
+ this.mark = mark;
7285
+ this.message = formatError(this, false);
7311
7286
 
7312
- if (buildHtml) {
7313
- document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false);
7314
- }
7315
- } else {
7316
- document.removeEventListener('scroll', this._scrollListener, false);
7317
- document.removeEventListener('resize', this._scrollListener, false);
7287
+ // Include stack trace in error object
7288
+ if (Error.captureStackTrace) {
7289
+ // Chrome and NodeJS
7290
+ Error.captureStackTrace(this, this.constructor);
7291
+ } else {
7292
+ // FF, IE 10+ and Safari 6+. Fallback for others
7293
+ this.stack = (new Error()).stack || '';
7294
+ }
7295
+ }
7318
7296
 
7319
- if (buildHtml) {
7320
- document.removeEventListener('click', this._clickListener, false);
7321
- }
7322
- }
7323
- };
7324
- /**
7325
- * Initialize tocbot.
7326
- * @param {object} customOptions
7327
- */
7328
7297
 
7298
+ // Inherit from Error
7299
+ YAMLException$1.prototype = Object.create(Error.prototype);
7300
+ YAMLException$1.prototype.constructor = YAMLException$1;
7329
7301
 
7330
- tocbot.init = function (customOptions) {
7331
- // feature test
7332
- if (!supports) {
7333
- return;
7334
- } // Merge defaults with user options.
7335
- // Set to options variable at the top.
7336
7302
 
7303
+ YAMLException$1.prototype.toString = function toString(compact) {
7304
+ return this.name + ': ' + formatError(this, compact);
7305
+ };
7337
7306
 
7338
- options = extend(defaultOptions, customOptions || {});
7339
- this.options = options;
7340
- this.state = {}; // Init smooth scroll if enabled (default).
7341
7307
 
7342
- if (options.scrollSmooth) {
7343
- options.duration = options.scrollSmoothDuration;
7344
- options.offset = options.scrollSmoothOffset;
7345
- tocbot.scrollSmooth = __webpack_require__(29).initSmoothScrolling(options);
7346
- } // Pass options to these modules.
7308
+ var exception = YAMLException$1;
7347
7309
 
7310
+ // get snippet for a single line, respecting maxLength
7311
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
7312
+ var head = '';
7313
+ var tail = '';
7314
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
7348
7315
 
7349
- buildHtml = BuildHtml(options);
7350
- parseContent = ParseContent(options); // For testing purposes.
7316
+ if (position - lineStart > maxHalfLength) {
7317
+ head = ' ... ';
7318
+ lineStart = position - maxHalfLength + head.length;
7319
+ }
7351
7320
 
7352
- this._buildHtml = buildHtml;
7353
- this._parseContent = parseContent; // Destroy it if it exists first.
7321
+ if (lineEnd - position > maxHalfLength) {
7322
+ tail = ' ...';
7323
+ lineEnd = position + maxHalfLength - tail.length;
7324
+ }
7354
7325
 
7355
- tocbot.destroy(); // Get headings array.
7326
+ return {
7327
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
7328
+ pos: position - lineStart + head.length // relative position
7329
+ };
7330
+ }
7356
7331
 
7357
- headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector); // Return if no headings are found.
7358
7332
 
7359
- if (headingsArray === null) {
7360
- return;
7361
- } // Build nested headings array.
7333
+ function padStart(string, max) {
7334
+ return common.repeat(' ', max - string.length) + string;
7335
+ }
7362
7336
 
7363
7337
 
7364
- var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray);
7365
- var nestedHeadings = nestedHeadingsObj.nest; // Render.
7338
+ function makeSnippet(mark, options) {
7339
+ options = Object.create(options || null);
7366
7340
 
7367
- if (!options.skipRendering) {
7368
- buildHtml.render(options.tocSelector, nestedHeadings);
7369
- } // Update Sidebar and bind listeners.
7341
+ if (!mark.buffer) return null;
7370
7342
 
7343
+ if (!options.maxLength) options.maxLength = 79;
7344
+ if (typeof options.indent !== 'number') options.indent = 1;
7345
+ if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
7346
+ if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
7371
7347
 
7372
- this._scrollListener = throttle(function (e) {
7373
- buildHtml.updateToc(headingsArray);
7374
- !options.disableTocScrollSync && updateTocScroll(options);
7375
- var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0;
7348
+ var re = /\r?\n|\r|\0/g;
7349
+ var lineStarts = [ 0 ];
7350
+ var lineEnds = [];
7351
+ var match;
7352
+ var foundLineNo = -1;
7376
7353
 
7377
- if (e && (e.eventPhase === 0 || e.currentTarget === null) || isTop) {
7378
- buildHtml.updateToc(headingsArray);
7354
+ while ((match = re.exec(mark.buffer))) {
7355
+ lineEnds.push(match.index);
7356
+ lineStarts.push(match.index + match[0].length);
7379
7357
 
7380
- if (options.scrollEndCallback) {
7381
- options.scrollEndCallback(e);
7382
- }
7383
- }
7384
- }, options.throttleTimeout);
7358
+ if (mark.position <= match.index && foundLineNo < 0) {
7359
+ foundLineNo = lineStarts.length - 2;
7360
+ }
7361
+ }
7385
7362
 
7386
- this._scrollListener();
7363
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
7387
7364
 
7388
- if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
7389
- document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false);
7390
- document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false);
7391
- } else {
7392
- document.addEventListener('scroll', this._scrollListener, false);
7393
- document.addEventListener('resize', this._scrollListener, false);
7394
- } // Bind click listeners to disable animation.
7365
+ var result = '', i, line;
7366
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
7367
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
7395
7368
 
7369
+ for (i = 1; i <= options.linesBefore; i++) {
7370
+ if (foundLineNo - i < 0) break;
7371
+ line = getLine(
7372
+ mark.buffer,
7373
+ lineStarts[foundLineNo - i],
7374
+ lineEnds[foundLineNo - i],
7375
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
7376
+ maxLineLength
7377
+ );
7378
+ result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
7379
+ ' | ' + line.str + '\n' + result;
7380
+ }
7381
+
7382
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
7383
+ result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
7384
+ ' | ' + line.str + '\n';
7385
+ result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
7386
+
7387
+ for (i = 1; i <= options.linesAfter; i++) {
7388
+ if (foundLineNo + i >= lineEnds.length) break;
7389
+ line = getLine(
7390
+ mark.buffer,
7391
+ lineStarts[foundLineNo + i],
7392
+ lineEnds[foundLineNo + i],
7393
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
7394
+ maxLineLength
7395
+ );
7396
+ result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
7397
+ ' | ' + line.str + '\n';
7398
+ }
7396
7399
 
7397
- var timeout = null;
7398
- this._clickListener = throttle(function (event) {
7399
- if (options.scrollSmooth) {
7400
- buildHtml.disableTocAnimation(event);
7401
- }
7400
+ return result.replace(/\n$/, '');
7401
+ }
7402
7402
 
7403
- buildHtml.updateToc(headingsArray); // Timeout to re-enable the animation.
7404
7403
 
7405
- timeout && clearTimeout(timeout);
7406
- timeout = setTimeout(function () {
7407
- buildHtml.enableTocAnimation();
7408
- }, options.scrollSmoothDuration);
7409
- }, options.throttleTimeout);
7404
+ var snippet = makeSnippet;
7410
7405
 
7411
- if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
7412
- document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false);
7413
- } else {
7414
- document.addEventListener('click', this._clickListener, false);
7406
+ var TYPE_CONSTRUCTOR_OPTIONS = [
7407
+ 'kind',
7408
+ 'multi',
7409
+ 'resolve',
7410
+ 'construct',
7411
+ 'instanceOf',
7412
+ 'predicate',
7413
+ 'represent',
7414
+ 'representName',
7415
+ 'defaultStyle',
7416
+ 'styleAliases'
7417
+ ];
7418
+
7419
+ var YAML_NODE_KINDS = [
7420
+ 'scalar',
7421
+ 'sequence',
7422
+ 'mapping'
7423
+ ];
7424
+
7425
+ function compileStyleAliases(map) {
7426
+ var result = {};
7427
+
7428
+ if (map !== null) {
7429
+ Object.keys(map).forEach(function (style) {
7430
+ map[style].forEach(function (alias) {
7431
+ result[String(alias)] = style;
7432
+ });
7433
+ });
7434
+ }
7435
+
7436
+ return result;
7437
+ }
7438
+
7439
+ function Type$1(tag, options) {
7440
+ options = options || {};
7441
+
7442
+ Object.keys(options).forEach(function (name) {
7443
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
7444
+ throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
7415
7445
  }
7446
+ });
7416
7447
 
7417
- return this;
7418
- };
7419
- /**
7420
- * Refresh tocbot.
7421
- */
7448
+ // TODO: Add tag format check.
7449
+ this.options = options; // keep original options in case user wants to extend this type later
7450
+ this.tag = tag;
7451
+ this.kind = options['kind'] || null;
7452
+ this.resolve = options['resolve'] || function () { return true; };
7453
+ this.construct = options['construct'] || function (data) { return data; };
7454
+ this.instanceOf = options['instanceOf'] || null;
7455
+ this.predicate = options['predicate'] || null;
7456
+ this.represent = options['represent'] || null;
7457
+ this.representName = options['representName'] || null;
7458
+ this.defaultStyle = options['defaultStyle'] || null;
7459
+ this.multi = options['multi'] || false;
7460
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
7422
7461
 
7462
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
7463
+ throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
7464
+ }
7465
+ }
7423
7466
 
7424
- tocbot.refresh = function (customOptions) {
7425
- tocbot.destroy();
7426
- tocbot.init(customOptions || this.options);
7427
- }; // Make tocbot available globally.
7467
+ var type = Type$1;
7428
7468
 
7469
+ /*eslint-disable max-len*/
7429
7470
 
7430
- root.tocbot = tocbot;
7431
- return tocbot;
7432
- });
7433
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0)))
7434
7471
 
7435
- /***/ }),
7436
- /* 25 */
7437
- /***/ (function(module, exports) {
7438
7472
 
7439
- // -----------------------------------------------------------------------------
7440
- // ESLint shimming
7441
- // -----------------------------------------------------------------------------
7442
7473
 
7443
- /* eslint indent: "off" */
7444
7474
 
7445
- /* eslint no-undef: "off" */
7475
+ function compileList(schema, name) {
7476
+ var result = [];
7446
7477
 
7447
- /* eslint no-unused-vars: "off" */
7448
- // -----------------------------------------------------------------------------
7449
- module.exports = {
7450
- // Where to render the table of contents.
7451
- tocSelector: '.js-toc',
7478
+ schema[name].forEach(function (currentType) {
7479
+ var newIndex = result.length;
7480
+
7481
+ result.forEach(function (previousType, previousIndex) {
7482
+ if (previousType.tag === currentType.tag &&
7483
+ previousType.kind === currentType.kind &&
7484
+ previousType.multi === currentType.multi) {
7485
+
7486
+ newIndex = previousIndex;
7487
+ }
7488
+ });
7489
+
7490
+ result[newIndex] = currentType;
7491
+ });
7492
+
7493
+ return result;
7494
+ }
7495
+
7496
+
7497
+ function compileMap(/* lists... */) {
7498
+ var result = {
7499
+ scalar: {},
7500
+ sequence: {},
7501
+ mapping: {},
7502
+ fallback: {},
7503
+ multi: {
7504
+ scalar: [],
7505
+ sequence: [],
7506
+ mapping: [],
7507
+ fallback: []
7508
+ }
7509
+ }, index, length;
7510
+
7511
+ function collectType(type) {
7512
+ if (type.multi) {
7513
+ result.multi[type.kind].push(type);
7514
+ result.multi['fallback'].push(type);
7515
+ } else {
7516
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
7517
+ }
7518
+ }
7519
+
7520
+ for (index = 0, length = arguments.length; index < length; index += 1) {
7521
+ arguments[index].forEach(collectType);
7522
+ }
7523
+ return result;
7524
+ }
7525
+
7526
+
7527
+ function Schema$1(definition) {
7528
+ return this.extend(definition);
7529
+ }
7530
+
7531
+
7532
+ Schema$1.prototype.extend = function extend(definition) {
7533
+ var implicit = [];
7534
+ var explicit = [];
7535
+
7536
+ if (definition instanceof type) {
7537
+ // Schema.extend(type)
7538
+ explicit.push(definition);
7539
+
7540
+ } else if (Array.isArray(definition)) {
7541
+ // Schema.extend([ type1, type2, ... ])
7542
+ explicit = explicit.concat(definition);
7543
+
7544
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
7545
+ // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
7546
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
7547
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
7548
+
7549
+ } else {
7550
+ throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
7551
+ 'or a schema definition ({ implicit: [...], explicit: [...] })');
7552
+ }
7553
+
7554
+ implicit.forEach(function (type$1) {
7555
+ if (!(type$1 instanceof type)) {
7556
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
7557
+ }
7558
+
7559
+ if (type$1.loadKind && type$1.loadKind !== 'scalar') {
7560
+ throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
7561
+ }
7562
+
7563
+ if (type$1.multi) {
7564
+ throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
7565
+ }
7566
+ });
7567
+
7568
+ explicit.forEach(function (type$1) {
7569
+ if (!(type$1 instanceof type)) {
7570
+ throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
7571
+ }
7572
+ });
7573
+
7574
+ var result = Object.create(Schema$1.prototype);
7575
+
7576
+ result.implicit = (this.implicit || []).concat(implicit);
7577
+ result.explicit = (this.explicit || []).concat(explicit);
7578
+
7579
+ result.compiledImplicit = compileList(result, 'implicit');
7580
+ result.compiledExplicit = compileList(result, 'explicit');
7581
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
7582
+
7583
+ return result;
7584
+ };
7585
+
7586
+
7587
+ var schema = Schema$1;
7588
+
7589
+ var str = new type('tag:yaml.org,2002:str', {
7590
+ kind: 'scalar',
7591
+ construct: function (data) { return data !== null ? data : ''; }
7592
+ });
7593
+
7594
+ var seq = new type('tag:yaml.org,2002:seq', {
7595
+ kind: 'sequence',
7596
+ construct: function (data) { return data !== null ? data : []; }
7597
+ });
7598
+
7599
+ var map = new type('tag:yaml.org,2002:map', {
7600
+ kind: 'mapping',
7601
+ construct: function (data) { return data !== null ? data : {}; }
7602
+ });
7603
+
7604
+ var failsafe = new schema({
7605
+ explicit: [
7606
+ str,
7607
+ seq,
7608
+ map
7609
+ ]
7610
+ });
7611
+
7612
+ function resolveYamlNull(data) {
7613
+ if (data === null) return true;
7614
+
7615
+ var max = data.length;
7616
+
7617
+ return (max === 1 && data === '~') ||
7618
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
7619
+ }
7620
+
7621
+ function constructYamlNull() {
7622
+ return null;
7623
+ }
7624
+
7625
+ function isNull(object) {
7626
+ return object === null;
7627
+ }
7628
+
7629
+ var _null = new type('tag:yaml.org,2002:null', {
7630
+ kind: 'scalar',
7631
+ resolve: resolveYamlNull,
7632
+ construct: constructYamlNull,
7633
+ predicate: isNull,
7634
+ represent: {
7635
+ canonical: function () { return '~'; },
7636
+ lowercase: function () { return 'null'; },
7637
+ uppercase: function () { return 'NULL'; },
7638
+ camelcase: function () { return 'Null'; },
7639
+ empty: function () { return ''; }
7640
+ },
7641
+ defaultStyle: 'lowercase'
7642
+ });
7643
+
7644
+ function resolveYamlBoolean(data) {
7645
+ if (data === null) return false;
7646
+
7647
+ var max = data.length;
7648
+
7649
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
7650
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
7651
+ }
7652
+
7653
+ function constructYamlBoolean(data) {
7654
+ return data === 'true' ||
7655
+ data === 'True' ||
7656
+ data === 'TRUE';
7657
+ }
7658
+
7659
+ function isBoolean(object) {
7660
+ return Object.prototype.toString.call(object) === '[object Boolean]';
7661
+ }
7662
+
7663
+ var bool = new type('tag:yaml.org,2002:bool', {
7664
+ kind: 'scalar',
7665
+ resolve: resolveYamlBoolean,
7666
+ construct: constructYamlBoolean,
7667
+ predicate: isBoolean,
7668
+ represent: {
7669
+ lowercase: function (object) { return object ? 'true' : 'false'; },
7670
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
7671
+ camelcase: function (object) { return object ? 'True' : 'False'; }
7672
+ },
7673
+ defaultStyle: 'lowercase'
7674
+ });
7675
+
7676
+ function isHexCode(c) {
7677
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
7678
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
7679
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
7680
+ }
7681
+
7682
+ function isOctCode(c) {
7683
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
7684
+ }
7685
+
7686
+ function isDecCode(c) {
7687
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
7688
+ }
7689
+
7690
+ function resolveYamlInteger(data) {
7691
+ if (data === null) return false;
7692
+
7693
+ var max = data.length,
7694
+ index = 0,
7695
+ hasDigits = false,
7696
+ ch;
7697
+
7698
+ if (!max) return false;
7699
+
7700
+ ch = data[index];
7701
+
7702
+ // sign
7703
+ if (ch === '-' || ch === '+') {
7704
+ ch = data[++index];
7705
+ }
7706
+
7707
+ if (ch === '0') {
7708
+ // 0
7709
+ if (index + 1 === max) return true;
7710
+ ch = data[++index];
7711
+
7712
+ // base 2, base 8, base 16
7713
+
7714
+ if (ch === 'b') {
7715
+ // base 2
7716
+ index++;
7717
+
7718
+ for (; index < max; index++) {
7719
+ ch = data[index];
7720
+ if (ch === '_') continue;
7721
+ if (ch !== '0' && ch !== '1') return false;
7722
+ hasDigits = true;
7723
+ }
7724
+ return hasDigits && ch !== '_';
7725
+ }
7726
+
7727
+
7728
+ if (ch === 'x') {
7729
+ // base 16
7730
+ index++;
7731
+
7732
+ for (; index < max; index++) {
7733
+ ch = data[index];
7734
+ if (ch === '_') continue;
7735
+ if (!isHexCode(data.charCodeAt(index))) return false;
7736
+ hasDigits = true;
7737
+ }
7738
+ return hasDigits && ch !== '_';
7739
+ }
7740
+
7741
+
7742
+ if (ch === 'o') {
7743
+ // base 8
7744
+ index++;
7745
+
7746
+ for (; index < max; index++) {
7747
+ ch = data[index];
7748
+ if (ch === '_') continue;
7749
+ if (!isOctCode(data.charCodeAt(index))) return false;
7750
+ hasDigits = true;
7751
+ }
7752
+ return hasDigits && ch !== '_';
7753
+ }
7754
+ }
7755
+
7756
+ // base 10 (except 0)
7757
+
7758
+ // value should not start with `_`;
7759
+ if (ch === '_') return false;
7760
+
7761
+ for (; index < max; index++) {
7762
+ ch = data[index];
7763
+ if (ch === '_') continue;
7764
+ if (!isDecCode(data.charCodeAt(index))) {
7765
+ return false;
7766
+ }
7767
+ hasDigits = true;
7768
+ }
7769
+
7770
+ // Should have digits and should not end with `_`
7771
+ if (!hasDigits || ch === '_') return false;
7772
+
7773
+ return true;
7774
+ }
7775
+
7776
+ function constructYamlInteger(data) {
7777
+ var value = data, sign = 1, ch;
7778
+
7779
+ if (value.indexOf('_') !== -1) {
7780
+ value = value.replace(/_/g, '');
7781
+ }
7782
+
7783
+ ch = value[0];
7784
+
7785
+ if (ch === '-' || ch === '+') {
7786
+ if (ch === '-') sign = -1;
7787
+ value = value.slice(1);
7788
+ ch = value[0];
7789
+ }
7790
+
7791
+ if (value === '0') return 0;
7792
+
7793
+ if (ch === '0') {
7794
+ if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
7795
+ if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
7796
+ if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
7797
+ }
7798
+
7799
+ return sign * parseInt(value, 10);
7800
+ }
7801
+
7802
+ function isInteger(object) {
7803
+ return (Object.prototype.toString.call(object)) === '[object Number]' &&
7804
+ (object % 1 === 0 && !common.isNegativeZero(object));
7805
+ }
7806
+
7807
+ var int = new type('tag:yaml.org,2002:int', {
7808
+ kind: 'scalar',
7809
+ resolve: resolveYamlInteger,
7810
+ construct: constructYamlInteger,
7811
+ predicate: isInteger,
7812
+ represent: {
7813
+ binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
7814
+ octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
7815
+ decimal: function (obj) { return obj.toString(10); },
7816
+ /* eslint-disable max-len */
7817
+ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
7818
+ },
7819
+ defaultStyle: 'decimal',
7820
+ styleAliases: {
7821
+ binary: [ 2, 'bin' ],
7822
+ octal: [ 8, 'oct' ],
7823
+ decimal: [ 10, 'dec' ],
7824
+ hexadecimal: [ 16, 'hex' ]
7825
+ }
7826
+ });
7827
+
7828
+ var YAML_FLOAT_PATTERN = new RegExp(
7829
+ // 2.5e4, 2.5 and integers
7830
+ '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
7831
+ // .2e4, .2
7832
+ // special case, seems not from spec
7833
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
7834
+ // .inf
7835
+ '|[-+]?\\.(?:inf|Inf|INF)' +
7836
+ // .nan
7837
+ '|\\.(?:nan|NaN|NAN))$');
7838
+
7839
+ function resolveYamlFloat(data) {
7840
+ if (data === null) return false;
7841
+
7842
+ if (!YAML_FLOAT_PATTERN.test(data) ||
7843
+ // Quick hack to not allow integers end with `_`
7844
+ // Probably should update regexp & check speed
7845
+ data[data.length - 1] === '_') {
7846
+ return false;
7847
+ }
7848
+
7849
+ return true;
7850
+ }
7851
+
7852
+ function constructYamlFloat(data) {
7853
+ var value, sign;
7854
+
7855
+ value = data.replace(/_/g, '').toLowerCase();
7856
+ sign = value[0] === '-' ? -1 : 1;
7857
+
7858
+ if ('+-'.indexOf(value[0]) >= 0) {
7859
+ value = value.slice(1);
7860
+ }
7861
+
7862
+ if (value === '.inf') {
7863
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
7864
+
7865
+ } else if (value === '.nan') {
7866
+ return NaN;
7867
+ }
7868
+ return sign * parseFloat(value, 10);
7869
+ }
7870
+
7871
+
7872
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
7873
+
7874
+ function representYamlFloat(object, style) {
7875
+ var res;
7876
+
7877
+ if (isNaN(object)) {
7878
+ switch (style) {
7879
+ case 'lowercase': return '.nan';
7880
+ case 'uppercase': return '.NAN';
7881
+ case 'camelcase': return '.NaN';
7882
+ }
7883
+ } else if (Number.POSITIVE_INFINITY === object) {
7884
+ switch (style) {
7885
+ case 'lowercase': return '.inf';
7886
+ case 'uppercase': return '.INF';
7887
+ case 'camelcase': return '.Inf';
7888
+ }
7889
+ } else if (Number.NEGATIVE_INFINITY === object) {
7890
+ switch (style) {
7891
+ case 'lowercase': return '-.inf';
7892
+ case 'uppercase': return '-.INF';
7893
+ case 'camelcase': return '-.Inf';
7894
+ }
7895
+ } else if (common.isNegativeZero(object)) {
7896
+ return '-0.0';
7897
+ }
7898
+
7899
+ res = object.toString(10);
7900
+
7901
+ // JS stringifier can build scientific format without dots: 5e-100,
7902
+ // while YAML requres dot: 5.e-100. Fix it with simple hack
7903
+
7904
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
7905
+ }
7906
+
7907
+ function isFloat(object) {
7908
+ return (Object.prototype.toString.call(object) === '[object Number]') &&
7909
+ (object % 1 !== 0 || common.isNegativeZero(object));
7910
+ }
7911
+
7912
+ var float = new type('tag:yaml.org,2002:float', {
7913
+ kind: 'scalar',
7914
+ resolve: resolveYamlFloat,
7915
+ construct: constructYamlFloat,
7916
+ predicate: isFloat,
7917
+ represent: representYamlFloat,
7918
+ defaultStyle: 'lowercase'
7919
+ });
7920
+
7921
+ var json = failsafe.extend({
7922
+ implicit: [
7923
+ _null,
7924
+ bool,
7925
+ int,
7926
+ float
7927
+ ]
7928
+ });
7929
+
7930
+ var core = json;
7931
+
7932
+ var YAML_DATE_REGEXP = new RegExp(
7933
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
7934
+ '-([0-9][0-9])' + // [2] month
7935
+ '-([0-9][0-9])$'); // [3] day
7936
+
7937
+ var YAML_TIMESTAMP_REGEXP = new RegExp(
7938
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
7939
+ '-([0-9][0-9]?)' + // [2] month
7940
+ '-([0-9][0-9]?)' + // [3] day
7941
+ '(?:[Tt]|[ \\t]+)' + // ...
7942
+ '([0-9][0-9]?)' + // [4] hour
7943
+ ':([0-9][0-9])' + // [5] minute
7944
+ ':([0-9][0-9])' + // [6] second
7945
+ '(?:\\.([0-9]*))?' + // [7] fraction
7946
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
7947
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
7948
+
7949
+ function resolveYamlTimestamp(data) {
7950
+ if (data === null) return false;
7951
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
7952
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
7953
+ return false;
7954
+ }
7955
+
7956
+ function constructYamlTimestamp(data) {
7957
+ var match, year, month, day, hour, minute, second, fraction = 0,
7958
+ delta = null, tz_hour, tz_minute, date;
7959
+
7960
+ match = YAML_DATE_REGEXP.exec(data);
7961
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
7962
+
7963
+ if (match === null) throw new Error('Date resolve error');
7964
+
7965
+ // match: [1] year [2] month [3] day
7966
+
7967
+ year = +(match[1]);
7968
+ month = +(match[2]) - 1; // JS month starts with 0
7969
+ day = +(match[3]);
7970
+
7971
+ if (!match[4]) { // no hour
7972
+ return new Date(Date.UTC(year, month, day));
7973
+ }
7974
+
7975
+ // match: [4] hour [5] minute [6] second [7] fraction
7976
+
7977
+ hour = +(match[4]);
7978
+ minute = +(match[5]);
7979
+ second = +(match[6]);
7980
+
7981
+ if (match[7]) {
7982
+ fraction = match[7].slice(0, 3);
7983
+ while (fraction.length < 3) { // milli-seconds
7984
+ fraction += '0';
7985
+ }
7986
+ fraction = +fraction;
7987
+ }
7988
+
7989
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
7990
+
7991
+ if (match[9]) {
7992
+ tz_hour = +(match[10]);
7993
+ tz_minute = +(match[11] || 0);
7994
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
7995
+ if (match[9] === '-') delta = -delta;
7996
+ }
7997
+
7998
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
7999
+
8000
+ if (delta) date.setTime(date.getTime() - delta);
8001
+
8002
+ return date;
8003
+ }
8004
+
8005
+ function representYamlTimestamp(object /*, style*/) {
8006
+ return object.toISOString();
8007
+ }
8008
+
8009
+ var timestamp = new type('tag:yaml.org,2002:timestamp', {
8010
+ kind: 'scalar',
8011
+ resolve: resolveYamlTimestamp,
8012
+ construct: constructYamlTimestamp,
8013
+ instanceOf: Date,
8014
+ represent: representYamlTimestamp
8015
+ });
8016
+
8017
+ function resolveYamlMerge(data) {
8018
+ return data === '<<' || data === null;
8019
+ }
8020
+
8021
+ var merge = new type('tag:yaml.org,2002:merge', {
8022
+ kind: 'scalar',
8023
+ resolve: resolveYamlMerge
8024
+ });
8025
+
8026
+ /*eslint-disable no-bitwise*/
8027
+
8028
+
8029
+
8030
+
8031
+
8032
+ // [ 64, 65, 66 ] -> [ padding, CR, LF ]
8033
+ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
8034
+
8035
+
8036
+ function resolveYamlBinary(data) {
8037
+ if (data === null) return false;
8038
+
8039
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
8040
+
8041
+ // Convert one by one.
8042
+ for (idx = 0; idx < max; idx++) {
8043
+ code = map.indexOf(data.charAt(idx));
8044
+
8045
+ // Skip CR/LF
8046
+ if (code > 64) continue;
8047
+
8048
+ // Fail on illegal characters
8049
+ if (code < 0) return false;
8050
+
8051
+ bitlen += 6;
8052
+ }
8053
+
8054
+ // If there are any bits left, source was corrupted
8055
+ return (bitlen % 8) === 0;
8056
+ }
8057
+
8058
+ function constructYamlBinary(data) {
8059
+ var idx, tailbits,
8060
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
8061
+ max = input.length,
8062
+ map = BASE64_MAP,
8063
+ bits = 0,
8064
+ result = [];
8065
+
8066
+ // Collect by 6*4 bits (3 bytes)
8067
+
8068
+ for (idx = 0; idx < max; idx++) {
8069
+ if ((idx % 4 === 0) && idx) {
8070
+ result.push((bits >> 16) & 0xFF);
8071
+ result.push((bits >> 8) & 0xFF);
8072
+ result.push(bits & 0xFF);
8073
+ }
8074
+
8075
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
8076
+ }
8077
+
8078
+ // Dump tail
8079
+
8080
+ tailbits = (max % 4) * 6;
8081
+
8082
+ if (tailbits === 0) {
8083
+ result.push((bits >> 16) & 0xFF);
8084
+ result.push((bits >> 8) & 0xFF);
8085
+ result.push(bits & 0xFF);
8086
+ } else if (tailbits === 18) {
8087
+ result.push((bits >> 10) & 0xFF);
8088
+ result.push((bits >> 2) & 0xFF);
8089
+ } else if (tailbits === 12) {
8090
+ result.push((bits >> 4) & 0xFF);
8091
+ }
8092
+
8093
+ return new Uint8Array(result);
8094
+ }
8095
+
8096
+ function representYamlBinary(object /*, style*/) {
8097
+ var result = '', bits = 0, idx, tail,
8098
+ max = object.length,
8099
+ map = BASE64_MAP;
8100
+
8101
+ // Convert every three bytes to 4 ASCII characters.
8102
+
8103
+ for (idx = 0; idx < max; idx++) {
8104
+ if ((idx % 3 === 0) && idx) {
8105
+ result += map[(bits >> 18) & 0x3F];
8106
+ result += map[(bits >> 12) & 0x3F];
8107
+ result += map[(bits >> 6) & 0x3F];
8108
+ result += map[bits & 0x3F];
8109
+ }
8110
+
8111
+ bits = (bits << 8) + object[idx];
8112
+ }
8113
+
8114
+ // Dump tail
8115
+
8116
+ tail = max % 3;
8117
+
8118
+ if (tail === 0) {
8119
+ result += map[(bits >> 18) & 0x3F];
8120
+ result += map[(bits >> 12) & 0x3F];
8121
+ result += map[(bits >> 6) & 0x3F];
8122
+ result += map[bits & 0x3F];
8123
+ } else if (tail === 2) {
8124
+ result += map[(bits >> 10) & 0x3F];
8125
+ result += map[(bits >> 4) & 0x3F];
8126
+ result += map[(bits << 2) & 0x3F];
8127
+ result += map[64];
8128
+ } else if (tail === 1) {
8129
+ result += map[(bits >> 2) & 0x3F];
8130
+ result += map[(bits << 4) & 0x3F];
8131
+ result += map[64];
8132
+ result += map[64];
8133
+ }
8134
+
8135
+ return result;
8136
+ }
8137
+
8138
+ function isBinary(obj) {
8139
+ return Object.prototype.toString.call(obj) === '[object Uint8Array]';
8140
+ }
8141
+
8142
+ var binary = new type('tag:yaml.org,2002:binary', {
8143
+ kind: 'scalar',
8144
+ resolve: resolveYamlBinary,
8145
+ construct: constructYamlBinary,
8146
+ predicate: isBinary,
8147
+ represent: representYamlBinary
8148
+ });
8149
+
8150
+ var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
8151
+ var _toString$2 = Object.prototype.toString;
8152
+
8153
+ function resolveYamlOmap(data) {
8154
+ if (data === null) return true;
8155
+
8156
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
8157
+ object = data;
8158
+
8159
+ for (index = 0, length = object.length; index < length; index += 1) {
8160
+ pair = object[index];
8161
+ pairHasKey = false;
8162
+
8163
+ if (_toString$2.call(pair) !== '[object Object]') return false;
8164
+
8165
+ for (pairKey in pair) {
8166
+ if (_hasOwnProperty$3.call(pair, pairKey)) {
8167
+ if (!pairHasKey) pairHasKey = true;
8168
+ else return false;
8169
+ }
8170
+ }
8171
+
8172
+ if (!pairHasKey) return false;
8173
+
8174
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
8175
+ else return false;
8176
+ }
8177
+
8178
+ return true;
8179
+ }
8180
+
8181
+ function constructYamlOmap(data) {
8182
+ return data !== null ? data : [];
8183
+ }
8184
+
8185
+ var omap = new type('tag:yaml.org,2002:omap', {
8186
+ kind: 'sequence',
8187
+ resolve: resolveYamlOmap,
8188
+ construct: constructYamlOmap
8189
+ });
8190
+
8191
+ var _toString$1 = Object.prototype.toString;
8192
+
8193
+ function resolveYamlPairs(data) {
8194
+ if (data === null) return true;
8195
+
8196
+ var index, length, pair, keys, result,
8197
+ object = data;
8198
+
8199
+ result = new Array(object.length);
8200
+
8201
+ for (index = 0, length = object.length; index < length; index += 1) {
8202
+ pair = object[index];
8203
+
8204
+ if (_toString$1.call(pair) !== '[object Object]') return false;
8205
+
8206
+ keys = Object.keys(pair);
8207
+
8208
+ if (keys.length !== 1) return false;
8209
+
8210
+ result[index] = [ keys[0], pair[keys[0]] ];
8211
+ }
8212
+
8213
+ return true;
8214
+ }
8215
+
8216
+ function constructYamlPairs(data) {
8217
+ if (data === null) return [];
8218
+
8219
+ var index, length, pair, keys, result,
8220
+ object = data;
8221
+
8222
+ result = new Array(object.length);
8223
+
8224
+ for (index = 0, length = object.length; index < length; index += 1) {
8225
+ pair = object[index];
8226
+
8227
+ keys = Object.keys(pair);
8228
+
8229
+ result[index] = [ keys[0], pair[keys[0]] ];
8230
+ }
8231
+
8232
+ return result;
8233
+ }
8234
+
8235
+ var pairs = new type('tag:yaml.org,2002:pairs', {
8236
+ kind: 'sequence',
8237
+ resolve: resolveYamlPairs,
8238
+ construct: constructYamlPairs
8239
+ });
8240
+
8241
+ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
8242
+
8243
+ function resolveYamlSet(data) {
8244
+ if (data === null) return true;
8245
+
8246
+ var key, object = data;
8247
+
8248
+ for (key in object) {
8249
+ if (_hasOwnProperty$2.call(object, key)) {
8250
+ if (object[key] !== null) return false;
8251
+ }
8252
+ }
8253
+
8254
+ return true;
8255
+ }
8256
+
8257
+ function constructYamlSet(data) {
8258
+ return data !== null ? data : {};
8259
+ }
8260
+
8261
+ var set = new type('tag:yaml.org,2002:set', {
8262
+ kind: 'mapping',
8263
+ resolve: resolveYamlSet,
8264
+ construct: constructYamlSet
8265
+ });
8266
+
8267
+ var _default = core.extend({
8268
+ implicit: [
8269
+ timestamp,
8270
+ merge
8271
+ ],
8272
+ explicit: [
8273
+ binary,
8274
+ omap,
8275
+ pairs,
8276
+ set
8277
+ ]
8278
+ });
8279
+
8280
+ /*eslint-disable max-len,no-use-before-define*/
8281
+
8282
+
8283
+
8284
+
8285
+
8286
+
8287
+
8288
+ var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
8289
+
8290
+
8291
+ var CONTEXT_FLOW_IN = 1;
8292
+ var CONTEXT_FLOW_OUT = 2;
8293
+ var CONTEXT_BLOCK_IN = 3;
8294
+ var CONTEXT_BLOCK_OUT = 4;
8295
+
8296
+
8297
+ var CHOMPING_CLIP = 1;
8298
+ var CHOMPING_STRIP = 2;
8299
+ var CHOMPING_KEEP = 3;
8300
+
8301
+
8302
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
8303
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
8304
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
8305
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
8306
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
8307
+
8308
+
8309
+ function _class(obj) { return Object.prototype.toString.call(obj); }
8310
+
8311
+ function is_EOL(c) {
8312
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
8313
+ }
8314
+
8315
+ function is_WHITE_SPACE(c) {
8316
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
8317
+ }
8318
+
8319
+ function is_WS_OR_EOL(c) {
8320
+ return (c === 0x09/* Tab */) ||
8321
+ (c === 0x20/* Space */) ||
8322
+ (c === 0x0A/* LF */) ||
8323
+ (c === 0x0D/* CR */);
8324
+ }
8325
+
8326
+ function is_FLOW_INDICATOR(c) {
8327
+ return c === 0x2C/* , */ ||
8328
+ c === 0x5B/* [ */ ||
8329
+ c === 0x5D/* ] */ ||
8330
+ c === 0x7B/* { */ ||
8331
+ c === 0x7D/* } */;
8332
+ }
8333
+
8334
+ function fromHexCode(c) {
8335
+ var lc;
8336
+
8337
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
8338
+ return c - 0x30;
8339
+ }
8340
+
8341
+ /*eslint-disable no-bitwise*/
8342
+ lc = c | 0x20;
8343
+
8344
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
8345
+ return lc - 0x61 + 10;
8346
+ }
8347
+
8348
+ return -1;
8349
+ }
8350
+
8351
+ function escapedHexLen(c) {
8352
+ if (c === 0x78/* x */) { return 2; }
8353
+ if (c === 0x75/* u */) { return 4; }
8354
+ if (c === 0x55/* U */) { return 8; }
8355
+ return 0;
8356
+ }
8357
+
8358
+ function fromDecimalCode(c) {
8359
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
8360
+ return c - 0x30;
8361
+ }
8362
+
8363
+ return -1;
8364
+ }
8365
+
8366
+ function simpleEscapeSequence(c) {
8367
+ /* eslint-disable indent */
8368
+ return (c === 0x30/* 0 */) ? '\x00' :
8369
+ (c === 0x61/* a */) ? '\x07' :
8370
+ (c === 0x62/* b */) ? '\x08' :
8371
+ (c === 0x74/* t */) ? '\x09' :
8372
+ (c === 0x09/* Tab */) ? '\x09' :
8373
+ (c === 0x6E/* n */) ? '\x0A' :
8374
+ (c === 0x76/* v */) ? '\x0B' :
8375
+ (c === 0x66/* f */) ? '\x0C' :
8376
+ (c === 0x72/* r */) ? '\x0D' :
8377
+ (c === 0x65/* e */) ? '\x1B' :
8378
+ (c === 0x20/* Space */) ? ' ' :
8379
+ (c === 0x22/* " */) ? '\x22' :
8380
+ (c === 0x2F/* / */) ? '/' :
8381
+ (c === 0x5C/* \ */) ? '\x5C' :
8382
+ (c === 0x4E/* N */) ? '\x85' :
8383
+ (c === 0x5F/* _ */) ? '\xA0' :
8384
+ (c === 0x4C/* L */) ? '\u2028' :
8385
+ (c === 0x50/* P */) ? '\u2029' : '';
8386
+ }
8387
+
8388
+ function charFromCodepoint(c) {
8389
+ if (c <= 0xFFFF) {
8390
+ return String.fromCharCode(c);
8391
+ }
8392
+ // Encode UTF-16 surrogate pair
8393
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
8394
+ return String.fromCharCode(
8395
+ ((c - 0x010000) >> 10) + 0xD800,
8396
+ ((c - 0x010000) & 0x03FF) + 0xDC00
8397
+ );
8398
+ }
8399
+
8400
+ var simpleEscapeCheck = new Array(256); // integer, for fast access
8401
+ var simpleEscapeMap = new Array(256);
8402
+ for (var i = 0; i < 256; i++) {
8403
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
8404
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
8405
+ }
8406
+
8407
+
8408
+ function State$1(input, options) {
8409
+ this.input = input;
8410
+
8411
+ this.filename = options['filename'] || null;
8412
+ this.schema = options['schema'] || _default;
8413
+ this.onWarning = options['onWarning'] || null;
8414
+ // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
8415
+ // if such documents have no explicit %YAML directive
8416
+ this.legacy = options['legacy'] || false;
8417
+
8418
+ this.json = options['json'] || false;
8419
+ this.listener = options['listener'] || null;
8420
+
8421
+ this.implicitTypes = this.schema.compiledImplicit;
8422
+ this.typeMap = this.schema.compiledTypeMap;
8423
+
8424
+ this.length = input.length;
8425
+ this.position = 0;
8426
+ this.line = 0;
8427
+ this.lineStart = 0;
8428
+ this.lineIndent = 0;
8429
+
8430
+ // position of first leading tab in the current line,
8431
+ // used to make sure there are no tabs in the indentation
8432
+ this.firstTabInLine = -1;
8433
+
8434
+ this.documents = [];
8435
+
8436
+ /*
8437
+ this.version;
8438
+ this.checkLineBreaks;
8439
+ this.tagMap;
8440
+ this.anchorMap;
8441
+ this.tag;
8442
+ this.anchor;
8443
+ this.kind;
8444
+ this.result;*/
8445
+
8446
+ }
8447
+
8448
+
8449
+ function generateError(state, message) {
8450
+ var mark = {
8451
+ name: state.filename,
8452
+ buffer: state.input.slice(0, -1), // omit trailing \0
8453
+ position: state.position,
8454
+ line: state.line,
8455
+ column: state.position - state.lineStart
8456
+ };
8457
+
8458
+ mark.snippet = snippet(mark);
8459
+
8460
+ return new exception(message, mark);
8461
+ }
8462
+
8463
+ function throwError(state, message) {
8464
+ throw generateError(state, message);
8465
+ }
8466
+
8467
+ function throwWarning(state, message) {
8468
+ if (state.onWarning) {
8469
+ state.onWarning.call(null, generateError(state, message));
8470
+ }
8471
+ }
8472
+
8473
+
8474
+ var directiveHandlers = {
8475
+
8476
+ YAML: function handleYamlDirective(state, name, args) {
8477
+
8478
+ var match, major, minor;
8479
+
8480
+ if (state.version !== null) {
8481
+ throwError(state, 'duplication of %YAML directive');
8482
+ }
8483
+
8484
+ if (args.length !== 1) {
8485
+ throwError(state, 'YAML directive accepts exactly one argument');
8486
+ }
8487
+
8488
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
8489
+
8490
+ if (match === null) {
8491
+ throwError(state, 'ill-formed argument of the YAML directive');
8492
+ }
8493
+
8494
+ major = parseInt(match[1], 10);
8495
+ minor = parseInt(match[2], 10);
8496
+
8497
+ if (major !== 1) {
8498
+ throwError(state, 'unacceptable YAML version of the document');
8499
+ }
8500
+
8501
+ state.version = args[0];
8502
+ state.checkLineBreaks = (minor < 2);
8503
+
8504
+ if (minor !== 1 && minor !== 2) {
8505
+ throwWarning(state, 'unsupported YAML version of the document');
8506
+ }
8507
+ },
8508
+
8509
+ TAG: function handleTagDirective(state, name, args) {
8510
+
8511
+ var handle, prefix;
8512
+
8513
+ if (args.length !== 2) {
8514
+ throwError(state, 'TAG directive accepts exactly two arguments');
8515
+ }
8516
+
8517
+ handle = args[0];
8518
+ prefix = args[1];
8519
+
8520
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
8521
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
8522
+ }
8523
+
8524
+ if (_hasOwnProperty$1.call(state.tagMap, handle)) {
8525
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
8526
+ }
8527
+
8528
+ if (!PATTERN_TAG_URI.test(prefix)) {
8529
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
8530
+ }
8531
+
8532
+ try {
8533
+ prefix = decodeURIComponent(prefix);
8534
+ } catch (err) {
8535
+ throwError(state, 'tag prefix is malformed: ' + prefix);
8536
+ }
8537
+
8538
+ state.tagMap[handle] = prefix;
8539
+ }
8540
+ };
8541
+
8542
+
8543
+ function captureSegment(state, start, end, checkJson) {
8544
+ var _position, _length, _character, _result;
8545
+
8546
+ if (start < end) {
8547
+ _result = state.input.slice(start, end);
8548
+
8549
+ if (checkJson) {
8550
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
8551
+ _character = _result.charCodeAt(_position);
8552
+ if (!(_character === 0x09 ||
8553
+ (0x20 <= _character && _character <= 0x10FFFF))) {
8554
+ throwError(state, 'expected valid JSON character');
8555
+ }
8556
+ }
8557
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
8558
+ throwError(state, 'the stream contains non-printable characters');
8559
+ }
8560
+
8561
+ state.result += _result;
8562
+ }
8563
+ }
8564
+
8565
+ function mergeMappings(state, destination, source, overridableKeys) {
8566
+ var sourceKeys, key, index, quantity;
8567
+
8568
+ if (!common.isObject(source)) {
8569
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
8570
+ }
8571
+
8572
+ sourceKeys = Object.keys(source);
8573
+
8574
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
8575
+ key = sourceKeys[index];
8576
+
8577
+ if (!_hasOwnProperty$1.call(destination, key)) {
8578
+ destination[key] = source[key];
8579
+ overridableKeys[key] = true;
8580
+ }
8581
+ }
8582
+ }
8583
+
8584
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
8585
+ startLine, startLineStart, startPos) {
8586
+
8587
+ var index, quantity;
8588
+
8589
+ // The output is a plain object here, so keys can only be strings.
8590
+ // We need to convert keyNode to a string, but doing so can hang the process
8591
+ // (deeply nested arrays that explode exponentially using aliases).
8592
+ if (Array.isArray(keyNode)) {
8593
+ keyNode = Array.prototype.slice.call(keyNode);
8594
+
8595
+ for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
8596
+ if (Array.isArray(keyNode[index])) {
8597
+ throwError(state, 'nested arrays are not supported inside keys');
8598
+ }
8599
+
8600
+ if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
8601
+ keyNode[index] = '[object Object]';
8602
+ }
8603
+ }
8604
+ }
8605
+
8606
+ // Avoid code execution in load() via toString property
8607
+ // (still use its own toString for arrays, timestamps,
8608
+ // and whatever user schema extensions happen to have @@toStringTag)
8609
+ if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
8610
+ keyNode = '[object Object]';
8611
+ }
8612
+
8613
+
8614
+ keyNode = String(keyNode);
8615
+
8616
+ if (_result === null) {
8617
+ _result = {};
8618
+ }
8619
+
8620
+ if (keyTag === 'tag:yaml.org,2002:merge') {
8621
+ if (Array.isArray(valueNode)) {
8622
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
8623
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
8624
+ }
8625
+ } else {
8626
+ mergeMappings(state, _result, valueNode, overridableKeys);
8627
+ }
8628
+ } else {
8629
+ if (!state.json &&
8630
+ !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
8631
+ _hasOwnProperty$1.call(_result, keyNode)) {
8632
+ state.line = startLine || state.line;
8633
+ state.lineStart = startLineStart || state.lineStart;
8634
+ state.position = startPos || state.position;
8635
+ throwError(state, 'duplicated mapping key');
8636
+ }
8637
+
8638
+ // used for this specific key only because Object.defineProperty is slow
8639
+ if (keyNode === '__proto__') {
8640
+ Object.defineProperty(_result, keyNode, {
8641
+ configurable: true,
8642
+ enumerable: true,
8643
+ writable: true,
8644
+ value: valueNode
8645
+ });
8646
+ } else {
8647
+ _result[keyNode] = valueNode;
8648
+ }
8649
+ delete overridableKeys[keyNode];
8650
+ }
8651
+
8652
+ return _result;
8653
+ }
8654
+
8655
+ function readLineBreak(state) {
8656
+ var ch;
8657
+
8658
+ ch = state.input.charCodeAt(state.position);
8659
+
8660
+ if (ch === 0x0A/* LF */) {
8661
+ state.position++;
8662
+ } else if (ch === 0x0D/* CR */) {
8663
+ state.position++;
8664
+ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
8665
+ state.position++;
8666
+ }
8667
+ } else {
8668
+ throwError(state, 'a line break is expected');
8669
+ }
8670
+
8671
+ state.line += 1;
8672
+ state.lineStart = state.position;
8673
+ state.firstTabInLine = -1;
8674
+ }
8675
+
8676
+ function skipSeparationSpace(state, allowComments, checkIndent) {
8677
+ var lineBreaks = 0,
8678
+ ch = state.input.charCodeAt(state.position);
8679
+
8680
+ while (ch !== 0) {
8681
+ while (is_WHITE_SPACE(ch)) {
8682
+ if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
8683
+ state.firstTabInLine = state.position;
8684
+ }
8685
+ ch = state.input.charCodeAt(++state.position);
8686
+ }
8687
+
8688
+ if (allowComments && ch === 0x23/* # */) {
8689
+ do {
8690
+ ch = state.input.charCodeAt(++state.position);
8691
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
8692
+ }
8693
+
8694
+ if (is_EOL(ch)) {
8695
+ readLineBreak(state);
8696
+
8697
+ ch = state.input.charCodeAt(state.position);
8698
+ lineBreaks++;
8699
+ state.lineIndent = 0;
8700
+
8701
+ while (ch === 0x20/* Space */) {
8702
+ state.lineIndent++;
8703
+ ch = state.input.charCodeAt(++state.position);
8704
+ }
8705
+ } else {
8706
+ break;
8707
+ }
8708
+ }
8709
+
8710
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
8711
+ throwWarning(state, 'deficient indentation');
8712
+ }
8713
+
8714
+ return lineBreaks;
8715
+ }
8716
+
8717
+ function testDocumentSeparator(state) {
8718
+ var _position = state.position,
8719
+ ch;
8720
+
8721
+ ch = state.input.charCodeAt(_position);
8722
+
8723
+ // Condition state.position === state.lineStart is tested
8724
+ // in parent on each call, for efficiency. No needs to test here again.
8725
+ if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
8726
+ ch === state.input.charCodeAt(_position + 1) &&
8727
+ ch === state.input.charCodeAt(_position + 2)) {
8728
+
8729
+ _position += 3;
8730
+
8731
+ ch = state.input.charCodeAt(_position);
8732
+
8733
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
8734
+ return true;
8735
+ }
8736
+ }
8737
+
8738
+ return false;
8739
+ }
8740
+
8741
+ function writeFoldedLines(state, count) {
8742
+ if (count === 1) {
8743
+ state.result += ' ';
8744
+ } else if (count > 1) {
8745
+ state.result += common.repeat('\n', count - 1);
8746
+ }
8747
+ }
8748
+
8749
+
8750
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
8751
+ var preceding,
8752
+ following,
8753
+ captureStart,
8754
+ captureEnd,
8755
+ hasPendingContent,
8756
+ _line,
8757
+ _lineStart,
8758
+ _lineIndent,
8759
+ _kind = state.kind,
8760
+ _result = state.result,
8761
+ ch;
8762
+
8763
+ ch = state.input.charCodeAt(state.position);
8764
+
8765
+ if (is_WS_OR_EOL(ch) ||
8766
+ is_FLOW_INDICATOR(ch) ||
8767
+ ch === 0x23/* # */ ||
8768
+ ch === 0x26/* & */ ||
8769
+ ch === 0x2A/* * */ ||
8770
+ ch === 0x21/* ! */ ||
8771
+ ch === 0x7C/* | */ ||
8772
+ ch === 0x3E/* > */ ||
8773
+ ch === 0x27/* ' */ ||
8774
+ ch === 0x22/* " */ ||
8775
+ ch === 0x25/* % */ ||
8776
+ ch === 0x40/* @ */ ||
8777
+ ch === 0x60/* ` */) {
8778
+ return false;
8779
+ }
8780
+
8781
+ if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
8782
+ following = state.input.charCodeAt(state.position + 1);
8783
+
8784
+ if (is_WS_OR_EOL(following) ||
8785
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
8786
+ return false;
8787
+ }
8788
+ }
8789
+
8790
+ state.kind = 'scalar';
8791
+ state.result = '';
8792
+ captureStart = captureEnd = state.position;
8793
+ hasPendingContent = false;
8794
+
8795
+ while (ch !== 0) {
8796
+ if (ch === 0x3A/* : */) {
8797
+ following = state.input.charCodeAt(state.position + 1);
8798
+
8799
+ if (is_WS_OR_EOL(following) ||
8800
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
8801
+ break;
8802
+ }
8803
+
8804
+ } else if (ch === 0x23/* # */) {
8805
+ preceding = state.input.charCodeAt(state.position - 1);
8806
+
8807
+ if (is_WS_OR_EOL(preceding)) {
8808
+ break;
8809
+ }
8810
+
8811
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
8812
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
8813
+ break;
8814
+
8815
+ } else if (is_EOL(ch)) {
8816
+ _line = state.line;
8817
+ _lineStart = state.lineStart;
8818
+ _lineIndent = state.lineIndent;
8819
+ skipSeparationSpace(state, false, -1);
8820
+
8821
+ if (state.lineIndent >= nodeIndent) {
8822
+ hasPendingContent = true;
8823
+ ch = state.input.charCodeAt(state.position);
8824
+ continue;
8825
+ } else {
8826
+ state.position = captureEnd;
8827
+ state.line = _line;
8828
+ state.lineStart = _lineStart;
8829
+ state.lineIndent = _lineIndent;
8830
+ break;
8831
+ }
8832
+ }
8833
+
8834
+ if (hasPendingContent) {
8835
+ captureSegment(state, captureStart, captureEnd, false);
8836
+ writeFoldedLines(state, state.line - _line);
8837
+ captureStart = captureEnd = state.position;
8838
+ hasPendingContent = false;
8839
+ }
8840
+
8841
+ if (!is_WHITE_SPACE(ch)) {
8842
+ captureEnd = state.position + 1;
8843
+ }
8844
+
8845
+ ch = state.input.charCodeAt(++state.position);
8846
+ }
8847
+
8848
+ captureSegment(state, captureStart, captureEnd, false);
8849
+
8850
+ if (state.result) {
8851
+ return true;
8852
+ }
8853
+
8854
+ state.kind = _kind;
8855
+ state.result = _result;
8856
+ return false;
8857
+ }
8858
+
8859
+ function readSingleQuotedScalar(state, nodeIndent) {
8860
+ var ch,
8861
+ captureStart, captureEnd;
8862
+
8863
+ ch = state.input.charCodeAt(state.position);
8864
+
8865
+ if (ch !== 0x27/* ' */) {
8866
+ return false;
8867
+ }
8868
+
8869
+ state.kind = 'scalar';
8870
+ state.result = '';
8871
+ state.position++;
8872
+ captureStart = captureEnd = state.position;
8873
+
8874
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8875
+ if (ch === 0x27/* ' */) {
8876
+ captureSegment(state, captureStart, state.position, true);
8877
+ ch = state.input.charCodeAt(++state.position);
8878
+
8879
+ if (ch === 0x27/* ' */) {
8880
+ captureStart = state.position;
8881
+ state.position++;
8882
+ captureEnd = state.position;
8883
+ } else {
8884
+ return true;
8885
+ }
8886
+
8887
+ } else if (is_EOL(ch)) {
8888
+ captureSegment(state, captureStart, captureEnd, true);
8889
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8890
+ captureStart = captureEnd = state.position;
8891
+
8892
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8893
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
8894
+
8895
+ } else {
8896
+ state.position++;
8897
+ captureEnd = state.position;
8898
+ }
8899
+ }
8900
+
8901
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
8902
+ }
8903
+
8904
+ function readDoubleQuotedScalar(state, nodeIndent) {
8905
+ var captureStart,
8906
+ captureEnd,
8907
+ hexLength,
8908
+ hexResult,
8909
+ tmp,
8910
+ ch;
8911
+
8912
+ ch = state.input.charCodeAt(state.position);
8913
+
8914
+ if (ch !== 0x22/* " */) {
8915
+ return false;
8916
+ }
8917
+
8918
+ state.kind = 'scalar';
8919
+ state.result = '';
8920
+ state.position++;
8921
+ captureStart = captureEnd = state.position;
8922
+
8923
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
8924
+ if (ch === 0x22/* " */) {
8925
+ captureSegment(state, captureStart, state.position, true);
8926
+ state.position++;
8927
+ return true;
8928
+
8929
+ } else if (ch === 0x5C/* \ */) {
8930
+ captureSegment(state, captureStart, state.position, true);
8931
+ ch = state.input.charCodeAt(++state.position);
8932
+
8933
+ if (is_EOL(ch)) {
8934
+ skipSeparationSpace(state, false, nodeIndent);
8935
+
8936
+ // TODO: rework to inline fn with no type cast?
8937
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
8938
+ state.result += simpleEscapeMap[ch];
8939
+ state.position++;
8940
+
8941
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
8942
+ hexLength = tmp;
8943
+ hexResult = 0;
8944
+
8945
+ for (; hexLength > 0; hexLength--) {
8946
+ ch = state.input.charCodeAt(++state.position);
8947
+
8948
+ if ((tmp = fromHexCode(ch)) >= 0) {
8949
+ hexResult = (hexResult << 4) + tmp;
8950
+
8951
+ } else {
8952
+ throwError(state, 'expected hexadecimal character');
8953
+ }
8954
+ }
8955
+
8956
+ state.result += charFromCodepoint(hexResult);
8957
+
8958
+ state.position++;
8959
+
8960
+ } else {
8961
+ throwError(state, 'unknown escape sequence');
8962
+ }
8963
+
8964
+ captureStart = captureEnd = state.position;
8965
+
8966
+ } else if (is_EOL(ch)) {
8967
+ captureSegment(state, captureStart, captureEnd, true);
8968
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8969
+ captureStart = captureEnd = state.position;
8970
+
8971
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8972
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
8973
+
8974
+ } else {
8975
+ state.position++;
8976
+ captureEnd = state.position;
8977
+ }
8978
+ }
8979
+
8980
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
8981
+ }
8982
+
8983
+ function readFlowCollection(state, nodeIndent) {
8984
+ var readNext = true,
8985
+ _line,
8986
+ _lineStart,
8987
+ _pos,
8988
+ _tag = state.tag,
8989
+ _result,
8990
+ _anchor = state.anchor,
8991
+ following,
8992
+ terminator,
8993
+ isPair,
8994
+ isExplicitPair,
8995
+ isMapping,
8996
+ overridableKeys = Object.create(null),
8997
+ keyNode,
8998
+ keyTag,
8999
+ valueNode,
9000
+ ch;
9001
+
9002
+ ch = state.input.charCodeAt(state.position);
9003
+
9004
+ if (ch === 0x5B/* [ */) {
9005
+ terminator = 0x5D;/* ] */
9006
+ isMapping = false;
9007
+ _result = [];
9008
+ } else if (ch === 0x7B/* { */) {
9009
+ terminator = 0x7D;/* } */
9010
+ isMapping = true;
9011
+ _result = {};
9012
+ } else {
9013
+ return false;
9014
+ }
9015
+
9016
+ if (state.anchor !== null) {
9017
+ state.anchorMap[state.anchor] = _result;
9018
+ }
9019
+
9020
+ ch = state.input.charCodeAt(++state.position);
9021
+
9022
+ while (ch !== 0) {
9023
+ skipSeparationSpace(state, true, nodeIndent);
9024
+
9025
+ ch = state.input.charCodeAt(state.position);
9026
+
9027
+ if (ch === terminator) {
9028
+ state.position++;
9029
+ state.tag = _tag;
9030
+ state.anchor = _anchor;
9031
+ state.kind = isMapping ? 'mapping' : 'sequence';
9032
+ state.result = _result;
9033
+ return true;
9034
+ } else if (!readNext) {
9035
+ throwError(state, 'missed comma between flow collection entries');
9036
+ } else if (ch === 0x2C/* , */) {
9037
+ // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
9038
+ throwError(state, "expected the node content, but found ','");
9039
+ }
9040
+
9041
+ keyTag = keyNode = valueNode = null;
9042
+ isPair = isExplicitPair = false;
9043
+
9044
+ if (ch === 0x3F/* ? */) {
9045
+ following = state.input.charCodeAt(state.position + 1);
9046
+
9047
+ if (is_WS_OR_EOL(following)) {
9048
+ isPair = isExplicitPair = true;
9049
+ state.position++;
9050
+ skipSeparationSpace(state, true, nodeIndent);
9051
+ }
9052
+ }
9053
+
9054
+ _line = state.line; // Save the current line.
9055
+ _lineStart = state.lineStart;
9056
+ _pos = state.position;
9057
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
9058
+ keyTag = state.tag;
9059
+ keyNode = state.result;
9060
+ skipSeparationSpace(state, true, nodeIndent);
9061
+
9062
+ ch = state.input.charCodeAt(state.position);
9063
+
9064
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
9065
+ isPair = true;
9066
+ ch = state.input.charCodeAt(++state.position);
9067
+ skipSeparationSpace(state, true, nodeIndent);
9068
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
9069
+ valueNode = state.result;
9070
+ }
9071
+
9072
+ if (isMapping) {
9073
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
9074
+ } else if (isPair) {
9075
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
9076
+ } else {
9077
+ _result.push(keyNode);
9078
+ }
9079
+
9080
+ skipSeparationSpace(state, true, nodeIndent);
9081
+
9082
+ ch = state.input.charCodeAt(state.position);
9083
+
9084
+ if (ch === 0x2C/* , */) {
9085
+ readNext = true;
9086
+ ch = state.input.charCodeAt(++state.position);
9087
+ } else {
9088
+ readNext = false;
9089
+ }
9090
+ }
9091
+
9092
+ throwError(state, 'unexpected end of the stream within a flow collection');
9093
+ }
9094
+
9095
+ function readBlockScalar(state, nodeIndent) {
9096
+ var captureStart,
9097
+ folding,
9098
+ chomping = CHOMPING_CLIP,
9099
+ didReadContent = false,
9100
+ detectedIndent = false,
9101
+ textIndent = nodeIndent,
9102
+ emptyLines = 0,
9103
+ atMoreIndented = false,
9104
+ tmp,
9105
+ ch;
9106
+
9107
+ ch = state.input.charCodeAt(state.position);
9108
+
9109
+ if (ch === 0x7C/* | */) {
9110
+ folding = false;
9111
+ } else if (ch === 0x3E/* > */) {
9112
+ folding = true;
9113
+ } else {
9114
+ return false;
9115
+ }
9116
+
9117
+ state.kind = 'scalar';
9118
+ state.result = '';
9119
+
9120
+ while (ch !== 0) {
9121
+ ch = state.input.charCodeAt(++state.position);
9122
+
9123
+ if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
9124
+ if (CHOMPING_CLIP === chomping) {
9125
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
9126
+ } else {
9127
+ throwError(state, 'repeat of a chomping mode identifier');
9128
+ }
9129
+
9130
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
9131
+ if (tmp === 0) {
9132
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
9133
+ } else if (!detectedIndent) {
9134
+ textIndent = nodeIndent + tmp - 1;
9135
+ detectedIndent = true;
9136
+ } else {
9137
+ throwError(state, 'repeat of an indentation width identifier');
9138
+ }
9139
+
9140
+ } else {
9141
+ break;
9142
+ }
9143
+ }
9144
+
9145
+ if (is_WHITE_SPACE(ch)) {
9146
+ do { ch = state.input.charCodeAt(++state.position); }
9147
+ while (is_WHITE_SPACE(ch));
9148
+
9149
+ if (ch === 0x23/* # */) {
9150
+ do { ch = state.input.charCodeAt(++state.position); }
9151
+ while (!is_EOL(ch) && (ch !== 0));
9152
+ }
9153
+ }
9154
+
9155
+ while (ch !== 0) {
9156
+ readLineBreak(state);
9157
+ state.lineIndent = 0;
9158
+
9159
+ ch = state.input.charCodeAt(state.position);
9160
+
9161
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
9162
+ (ch === 0x20/* Space */)) {
9163
+ state.lineIndent++;
9164
+ ch = state.input.charCodeAt(++state.position);
9165
+ }
9166
+
9167
+ if (!detectedIndent && state.lineIndent > textIndent) {
9168
+ textIndent = state.lineIndent;
9169
+ }
9170
+
9171
+ if (is_EOL(ch)) {
9172
+ emptyLines++;
9173
+ continue;
9174
+ }
9175
+
9176
+ // End of the scalar.
9177
+ if (state.lineIndent < textIndent) {
9178
+
9179
+ // Perform the chomping.
9180
+ if (chomping === CHOMPING_KEEP) {
9181
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
9182
+ } else if (chomping === CHOMPING_CLIP) {
9183
+ if (didReadContent) { // i.e. only if the scalar is not empty.
9184
+ state.result += '\n';
9185
+ }
9186
+ }
9187
+
9188
+ // Break this `while` cycle and go to the funciton's epilogue.
9189
+ break;
9190
+ }
9191
+
9192
+ // Folded style: use fancy rules to handle line breaks.
9193
+ if (folding) {
9194
+
9195
+ // Lines starting with white space characters (more-indented lines) are not folded.
9196
+ if (is_WHITE_SPACE(ch)) {
9197
+ atMoreIndented = true;
9198
+ // except for the first content line (cf. Example 8.1)
9199
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
9200
+
9201
+ // End of more-indented block.
9202
+ } else if (atMoreIndented) {
9203
+ atMoreIndented = false;
9204
+ state.result += common.repeat('\n', emptyLines + 1);
9205
+
9206
+ // Just one line break - perceive as the same line.
9207
+ } else if (emptyLines === 0) {
9208
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
9209
+ state.result += ' ';
9210
+ }
9211
+
9212
+ // Several line breaks - perceive as different lines.
9213
+ } else {
9214
+ state.result += common.repeat('\n', emptyLines);
9215
+ }
9216
+
9217
+ // Literal style: just add exact number of line breaks between content lines.
9218
+ } else {
9219
+ // Keep all line breaks except the header line break.
9220
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
9221
+ }
9222
+
9223
+ didReadContent = true;
9224
+ detectedIndent = true;
9225
+ emptyLines = 0;
9226
+ captureStart = state.position;
9227
+
9228
+ while (!is_EOL(ch) && (ch !== 0)) {
9229
+ ch = state.input.charCodeAt(++state.position);
9230
+ }
9231
+
9232
+ captureSegment(state, captureStart, state.position, false);
9233
+ }
9234
+
9235
+ return true;
9236
+ }
9237
+
9238
+ function readBlockSequence(state, nodeIndent) {
9239
+ var _line,
9240
+ _tag = state.tag,
9241
+ _anchor = state.anchor,
9242
+ _result = [],
9243
+ following,
9244
+ detected = false,
9245
+ ch;
9246
+
9247
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
9248
+ // it can still be flow sequence/mapping or a scalar
9249
+ if (state.firstTabInLine !== -1) return false;
9250
+
9251
+ if (state.anchor !== null) {
9252
+ state.anchorMap[state.anchor] = _result;
9253
+ }
9254
+
9255
+ ch = state.input.charCodeAt(state.position);
9256
+
9257
+ while (ch !== 0) {
9258
+ if (state.firstTabInLine !== -1) {
9259
+ state.position = state.firstTabInLine;
9260
+ throwError(state, 'tab characters must not be used in indentation');
9261
+ }
9262
+
9263
+ if (ch !== 0x2D/* - */) {
9264
+ break;
9265
+ }
9266
+
9267
+ following = state.input.charCodeAt(state.position + 1);
9268
+
9269
+ if (!is_WS_OR_EOL(following)) {
9270
+ break;
9271
+ }
9272
+
9273
+ detected = true;
9274
+ state.position++;
9275
+
9276
+ if (skipSeparationSpace(state, true, -1)) {
9277
+ if (state.lineIndent <= nodeIndent) {
9278
+ _result.push(null);
9279
+ ch = state.input.charCodeAt(state.position);
9280
+ continue;
9281
+ }
9282
+ }
9283
+
9284
+ _line = state.line;
9285
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
9286
+ _result.push(state.result);
9287
+ skipSeparationSpace(state, true, -1);
9288
+
9289
+ ch = state.input.charCodeAt(state.position);
9290
+
9291
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
9292
+ throwError(state, 'bad indentation of a sequence entry');
9293
+ } else if (state.lineIndent < nodeIndent) {
9294
+ break;
9295
+ }
9296
+ }
9297
+
9298
+ if (detected) {
9299
+ state.tag = _tag;
9300
+ state.anchor = _anchor;
9301
+ state.kind = 'sequence';
9302
+ state.result = _result;
9303
+ return true;
9304
+ }
9305
+ return false;
9306
+ }
9307
+
9308
+ function readBlockMapping(state, nodeIndent, flowIndent) {
9309
+ var following,
9310
+ allowCompact,
9311
+ _line,
9312
+ _keyLine,
9313
+ _keyLineStart,
9314
+ _keyPos,
9315
+ _tag = state.tag,
9316
+ _anchor = state.anchor,
9317
+ _result = {},
9318
+ overridableKeys = Object.create(null),
9319
+ keyTag = null,
9320
+ keyNode = null,
9321
+ valueNode = null,
9322
+ atExplicitKey = false,
9323
+ detected = false,
9324
+ ch;
9325
+
9326
+ // there is a leading tab before this token, so it can't be a block sequence/mapping;
9327
+ // it can still be flow sequence/mapping or a scalar
9328
+ if (state.firstTabInLine !== -1) return false;
9329
+
9330
+ if (state.anchor !== null) {
9331
+ state.anchorMap[state.anchor] = _result;
9332
+ }
9333
+
9334
+ ch = state.input.charCodeAt(state.position);
9335
+
9336
+ while (ch !== 0) {
9337
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
9338
+ state.position = state.firstTabInLine;
9339
+ throwError(state, 'tab characters must not be used in indentation');
9340
+ }
9341
+
9342
+ following = state.input.charCodeAt(state.position + 1);
9343
+ _line = state.line; // Save the current line.
9344
+
9345
+ //
9346
+ // Explicit notation case. There are two separate blocks:
9347
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
9348
+ //
9349
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
9350
+
9351
+ if (ch === 0x3F/* ? */) {
9352
+ if (atExplicitKey) {
9353
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
9354
+ keyTag = keyNode = valueNode = null;
9355
+ }
9356
+
9357
+ detected = true;
9358
+ atExplicitKey = true;
9359
+ allowCompact = true;
9360
+
9361
+ } else if (atExplicitKey) {
9362
+ // i.e. 0x3A/* : */ === character after the explicit key.
9363
+ atExplicitKey = false;
9364
+ allowCompact = true;
9365
+
9366
+ } else {
9367
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
9368
+ }
9369
+
9370
+ state.position += 1;
9371
+ ch = following;
9372
+
9373
+ //
9374
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
9375
+ //
9376
+ } else {
9377
+ _keyLine = state.line;
9378
+ _keyLineStart = state.lineStart;
9379
+ _keyPos = state.position;
9380
+
9381
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
9382
+ // Neither implicit nor explicit notation.
9383
+ // Reading is done. Go to the epilogue.
9384
+ break;
9385
+ }
9386
+
9387
+ if (state.line === _line) {
9388
+ ch = state.input.charCodeAt(state.position);
9389
+
9390
+ while (is_WHITE_SPACE(ch)) {
9391
+ ch = state.input.charCodeAt(++state.position);
9392
+ }
9393
+
9394
+ if (ch === 0x3A/* : */) {
9395
+ ch = state.input.charCodeAt(++state.position);
9396
+
9397
+ if (!is_WS_OR_EOL(ch)) {
9398
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
9399
+ }
9400
+
9401
+ if (atExplicitKey) {
9402
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
9403
+ keyTag = keyNode = valueNode = null;
9404
+ }
9405
+
9406
+ detected = true;
9407
+ atExplicitKey = false;
9408
+ allowCompact = false;
9409
+ keyTag = state.tag;
9410
+ keyNode = state.result;
9411
+
9412
+ } else if (detected) {
9413
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
9414
+
9415
+ } else {
9416
+ state.tag = _tag;
9417
+ state.anchor = _anchor;
9418
+ return true; // Keep the result of `composeNode`.
9419
+ }
9420
+
9421
+ } else if (detected) {
9422
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
9423
+
9424
+ } else {
9425
+ state.tag = _tag;
9426
+ state.anchor = _anchor;
9427
+ return true; // Keep the result of `composeNode`.
9428
+ }
9429
+ }
9430
+
9431
+ //
9432
+ // Common reading code for both explicit and implicit notations.
9433
+ //
9434
+ if (state.line === _line || state.lineIndent > nodeIndent) {
9435
+ if (atExplicitKey) {
9436
+ _keyLine = state.line;
9437
+ _keyLineStart = state.lineStart;
9438
+ _keyPos = state.position;
9439
+ }
9440
+
9441
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
9442
+ if (atExplicitKey) {
9443
+ keyNode = state.result;
9444
+ } else {
9445
+ valueNode = state.result;
9446
+ }
9447
+ }
9448
+
9449
+ if (!atExplicitKey) {
9450
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
9451
+ keyTag = keyNode = valueNode = null;
9452
+ }
9453
+
9454
+ skipSeparationSpace(state, true, -1);
9455
+ ch = state.input.charCodeAt(state.position);
9456
+ }
9457
+
9458
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
9459
+ throwError(state, 'bad indentation of a mapping entry');
9460
+ } else if (state.lineIndent < nodeIndent) {
9461
+ break;
9462
+ }
9463
+ }
9464
+
9465
+ //
9466
+ // Epilogue.
9467
+ //
9468
+
9469
+ // Special case: last mapping's node contains only the key in explicit notation.
9470
+ if (atExplicitKey) {
9471
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
9472
+ }
9473
+
9474
+ // Expose the resulting mapping.
9475
+ if (detected) {
9476
+ state.tag = _tag;
9477
+ state.anchor = _anchor;
9478
+ state.kind = 'mapping';
9479
+ state.result = _result;
9480
+ }
9481
+
9482
+ return detected;
9483
+ }
9484
+
9485
+ function readTagProperty(state) {
9486
+ var _position,
9487
+ isVerbatim = false,
9488
+ isNamed = false,
9489
+ tagHandle,
9490
+ tagName,
9491
+ ch;
9492
+
9493
+ ch = state.input.charCodeAt(state.position);
9494
+
9495
+ if (ch !== 0x21/* ! */) return false;
9496
+
9497
+ if (state.tag !== null) {
9498
+ throwError(state, 'duplication of a tag property');
9499
+ }
9500
+
9501
+ ch = state.input.charCodeAt(++state.position);
9502
+
9503
+ if (ch === 0x3C/* < */) {
9504
+ isVerbatim = true;
9505
+ ch = state.input.charCodeAt(++state.position);
9506
+
9507
+ } else if (ch === 0x21/* ! */) {
9508
+ isNamed = true;
9509
+ tagHandle = '!!';
9510
+ ch = state.input.charCodeAt(++state.position);
9511
+
9512
+ } else {
9513
+ tagHandle = '!';
9514
+ }
9515
+
9516
+ _position = state.position;
9517
+
9518
+ if (isVerbatim) {
9519
+ do { ch = state.input.charCodeAt(++state.position); }
9520
+ while (ch !== 0 && ch !== 0x3E/* > */);
9521
+
9522
+ if (state.position < state.length) {
9523
+ tagName = state.input.slice(_position, state.position);
9524
+ ch = state.input.charCodeAt(++state.position);
9525
+ } else {
9526
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
9527
+ }
9528
+ } else {
9529
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
9530
+
9531
+ if (ch === 0x21/* ! */) {
9532
+ if (!isNamed) {
9533
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
9534
+
9535
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
9536
+ throwError(state, 'named tag handle cannot contain such characters');
9537
+ }
9538
+
9539
+ isNamed = true;
9540
+ _position = state.position + 1;
9541
+ } else {
9542
+ throwError(state, 'tag suffix cannot contain exclamation marks');
9543
+ }
9544
+ }
9545
+
9546
+ ch = state.input.charCodeAt(++state.position);
9547
+ }
9548
+
9549
+ tagName = state.input.slice(_position, state.position);
9550
+
9551
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
9552
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
9553
+ }
9554
+ }
9555
+
9556
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
9557
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
9558
+ }
9559
+
9560
+ try {
9561
+ tagName = decodeURIComponent(tagName);
9562
+ } catch (err) {
9563
+ throwError(state, 'tag name is malformed: ' + tagName);
9564
+ }
9565
+
9566
+ if (isVerbatim) {
9567
+ state.tag = tagName;
9568
+
9569
+ } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
9570
+ state.tag = state.tagMap[tagHandle] + tagName;
9571
+
9572
+ } else if (tagHandle === '!') {
9573
+ state.tag = '!' + tagName;
9574
+
9575
+ } else if (tagHandle === '!!') {
9576
+ state.tag = 'tag:yaml.org,2002:' + tagName;
9577
+
9578
+ } else {
9579
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
9580
+ }
9581
+
9582
+ return true;
9583
+ }
9584
+
9585
+ function readAnchorProperty(state) {
9586
+ var _position,
9587
+ ch;
9588
+
9589
+ ch = state.input.charCodeAt(state.position);
9590
+
9591
+ if (ch !== 0x26/* & */) return false;
9592
+
9593
+ if (state.anchor !== null) {
9594
+ throwError(state, 'duplication of an anchor property');
9595
+ }
9596
+
9597
+ ch = state.input.charCodeAt(++state.position);
9598
+ _position = state.position;
9599
+
9600
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
9601
+ ch = state.input.charCodeAt(++state.position);
9602
+ }
9603
+
9604
+ if (state.position === _position) {
9605
+ throwError(state, 'name of an anchor node must contain at least one character');
9606
+ }
9607
+
9608
+ state.anchor = state.input.slice(_position, state.position);
9609
+ return true;
9610
+ }
9611
+
9612
+ function readAlias(state) {
9613
+ var _position, alias,
9614
+ ch;
9615
+
9616
+ ch = state.input.charCodeAt(state.position);
9617
+
9618
+ if (ch !== 0x2A/* * */) return false;
9619
+
9620
+ ch = state.input.charCodeAt(++state.position);
9621
+ _position = state.position;
9622
+
9623
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
9624
+ ch = state.input.charCodeAt(++state.position);
9625
+ }
9626
+
9627
+ if (state.position === _position) {
9628
+ throwError(state, 'name of an alias node must contain at least one character');
9629
+ }
9630
+
9631
+ alias = state.input.slice(_position, state.position);
9632
+
9633
+ if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
9634
+ throwError(state, 'unidentified alias "' + alias + '"');
9635
+ }
9636
+
9637
+ state.result = state.anchorMap[alias];
9638
+ skipSeparationSpace(state, true, -1);
9639
+ return true;
9640
+ }
9641
+
9642
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
9643
+ var allowBlockStyles,
9644
+ allowBlockScalars,
9645
+ allowBlockCollections,
9646
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
9647
+ atNewLine = false,
9648
+ hasContent = false,
9649
+ typeIndex,
9650
+ typeQuantity,
9651
+ typeList,
9652
+ type,
9653
+ flowIndent,
9654
+ blockIndent;
9655
+
9656
+ if (state.listener !== null) {
9657
+ state.listener('open', state);
9658
+ }
9659
+
9660
+ state.tag = null;
9661
+ state.anchor = null;
9662
+ state.kind = null;
9663
+ state.result = null;
9664
+
9665
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
9666
+ CONTEXT_BLOCK_OUT === nodeContext ||
9667
+ CONTEXT_BLOCK_IN === nodeContext;
9668
+
9669
+ if (allowToSeek) {
9670
+ if (skipSeparationSpace(state, true, -1)) {
9671
+ atNewLine = true;
9672
+
9673
+ if (state.lineIndent > parentIndent) {
9674
+ indentStatus = 1;
9675
+ } else if (state.lineIndent === parentIndent) {
9676
+ indentStatus = 0;
9677
+ } else if (state.lineIndent < parentIndent) {
9678
+ indentStatus = -1;
9679
+ }
9680
+ }
9681
+ }
9682
+
9683
+ if (indentStatus === 1) {
9684
+ while (readTagProperty(state) || readAnchorProperty(state)) {
9685
+ if (skipSeparationSpace(state, true, -1)) {
9686
+ atNewLine = true;
9687
+ allowBlockCollections = allowBlockStyles;
9688
+
9689
+ if (state.lineIndent > parentIndent) {
9690
+ indentStatus = 1;
9691
+ } else if (state.lineIndent === parentIndent) {
9692
+ indentStatus = 0;
9693
+ } else if (state.lineIndent < parentIndent) {
9694
+ indentStatus = -1;
9695
+ }
9696
+ } else {
9697
+ allowBlockCollections = false;
9698
+ }
9699
+ }
9700
+ }
9701
+
9702
+ if (allowBlockCollections) {
9703
+ allowBlockCollections = atNewLine || allowCompact;
9704
+ }
9705
+
9706
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
9707
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
9708
+ flowIndent = parentIndent;
9709
+ } else {
9710
+ flowIndent = parentIndent + 1;
9711
+ }
9712
+
9713
+ blockIndent = state.position - state.lineStart;
9714
+
9715
+ if (indentStatus === 1) {
9716
+ if (allowBlockCollections &&
9717
+ (readBlockSequence(state, blockIndent) ||
9718
+ readBlockMapping(state, blockIndent, flowIndent)) ||
9719
+ readFlowCollection(state, flowIndent)) {
9720
+ hasContent = true;
9721
+ } else {
9722
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
9723
+ readSingleQuotedScalar(state, flowIndent) ||
9724
+ readDoubleQuotedScalar(state, flowIndent)) {
9725
+ hasContent = true;
9726
+
9727
+ } else if (readAlias(state)) {
9728
+ hasContent = true;
9729
+
9730
+ if (state.tag !== null || state.anchor !== null) {
9731
+ throwError(state, 'alias node should not have any properties');
9732
+ }
9733
+
9734
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
9735
+ hasContent = true;
9736
+
9737
+ if (state.tag === null) {
9738
+ state.tag = '?';
9739
+ }
9740
+ }
9741
+
9742
+ if (state.anchor !== null) {
9743
+ state.anchorMap[state.anchor] = state.result;
9744
+ }
9745
+ }
9746
+ } else if (indentStatus === 0) {
9747
+ // Special case: block sequences are allowed to have same indentation level as the parent.
9748
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
9749
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
9750
+ }
9751
+ }
9752
+
9753
+ if (state.tag === null) {
9754
+ if (state.anchor !== null) {
9755
+ state.anchorMap[state.anchor] = state.result;
9756
+ }
9757
+
9758
+ } else if (state.tag === '?') {
9759
+ // Implicit resolving is not allowed for non-scalar types, and '?'
9760
+ // non-specific tag is only automatically assigned to plain scalars.
9761
+ //
9762
+ // We only need to check kind conformity in case user explicitly assigns '?'
9763
+ // tag, for example like this: "!<?> [0]"
9764
+ //
9765
+ if (state.result !== null && state.kind !== 'scalar') {
9766
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
9767
+ }
9768
+
9769
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
9770
+ type = state.implicitTypes[typeIndex];
9771
+
9772
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
9773
+ state.result = type.construct(state.result);
9774
+ state.tag = type.tag;
9775
+ if (state.anchor !== null) {
9776
+ state.anchorMap[state.anchor] = state.result;
9777
+ }
9778
+ break;
9779
+ }
9780
+ }
9781
+ } else if (state.tag !== '!') {
9782
+ if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
9783
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
9784
+ } else {
9785
+ // looking for multi type
9786
+ type = null;
9787
+ typeList = state.typeMap.multi[state.kind || 'fallback'];
9788
+
9789
+ for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
9790
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
9791
+ type = typeList[typeIndex];
9792
+ break;
9793
+ }
9794
+ }
9795
+ }
9796
+
9797
+ if (!type) {
9798
+ throwError(state, 'unknown tag !<' + state.tag + '>');
9799
+ }
9800
+
9801
+ if (state.result !== null && type.kind !== state.kind) {
9802
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
9803
+ }
9804
+
9805
+ if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
9806
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
9807
+ } else {
9808
+ state.result = type.construct(state.result, state.tag);
9809
+ if (state.anchor !== null) {
9810
+ state.anchorMap[state.anchor] = state.result;
9811
+ }
9812
+ }
9813
+ }
9814
+
9815
+ if (state.listener !== null) {
9816
+ state.listener('close', state);
9817
+ }
9818
+ return state.tag !== null || state.anchor !== null || hasContent;
9819
+ }
9820
+
9821
+ function readDocument(state) {
9822
+ var documentStart = state.position,
9823
+ _position,
9824
+ directiveName,
9825
+ directiveArgs,
9826
+ hasDirectives = false,
9827
+ ch;
9828
+
9829
+ state.version = null;
9830
+ state.checkLineBreaks = state.legacy;
9831
+ state.tagMap = Object.create(null);
9832
+ state.anchorMap = Object.create(null);
9833
+
9834
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
9835
+ skipSeparationSpace(state, true, -1);
9836
+
9837
+ ch = state.input.charCodeAt(state.position);
9838
+
9839
+ if (state.lineIndent > 0 || ch !== 0x25/* % */) {
9840
+ break;
9841
+ }
9842
+
9843
+ hasDirectives = true;
9844
+ ch = state.input.charCodeAt(++state.position);
9845
+ _position = state.position;
9846
+
9847
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
9848
+ ch = state.input.charCodeAt(++state.position);
9849
+ }
9850
+
9851
+ directiveName = state.input.slice(_position, state.position);
9852
+ directiveArgs = [];
9853
+
9854
+ if (directiveName.length < 1) {
9855
+ throwError(state, 'directive name must not be less than one character in length');
9856
+ }
9857
+
9858
+ while (ch !== 0) {
9859
+ while (is_WHITE_SPACE(ch)) {
9860
+ ch = state.input.charCodeAt(++state.position);
9861
+ }
9862
+
9863
+ if (ch === 0x23/* # */) {
9864
+ do { ch = state.input.charCodeAt(++state.position); }
9865
+ while (ch !== 0 && !is_EOL(ch));
9866
+ break;
9867
+ }
9868
+
9869
+ if (is_EOL(ch)) break;
9870
+
9871
+ _position = state.position;
9872
+
9873
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
9874
+ ch = state.input.charCodeAt(++state.position);
9875
+ }
9876
+
9877
+ directiveArgs.push(state.input.slice(_position, state.position));
9878
+ }
9879
+
9880
+ if (ch !== 0) readLineBreak(state);
9881
+
9882
+ if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
9883
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
9884
+ } else {
9885
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
9886
+ }
9887
+ }
9888
+
9889
+ skipSeparationSpace(state, true, -1);
9890
+
9891
+ if (state.lineIndent === 0 &&
9892
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
9893
+ state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
9894
+ state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
9895
+ state.position += 3;
9896
+ skipSeparationSpace(state, true, -1);
9897
+
9898
+ } else if (hasDirectives) {
9899
+ throwError(state, 'directives end mark is expected');
9900
+ }
9901
+
9902
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
9903
+ skipSeparationSpace(state, true, -1);
9904
+
9905
+ if (state.checkLineBreaks &&
9906
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
9907
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
9908
+ }
9909
+
9910
+ state.documents.push(state.result);
9911
+
9912
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
9913
+
9914
+ if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
9915
+ state.position += 3;
9916
+ skipSeparationSpace(state, true, -1);
9917
+ }
9918
+ return;
9919
+ }
9920
+
9921
+ if (state.position < (state.length - 1)) {
9922
+ throwError(state, 'end of the stream or a document separator is expected');
9923
+ } else {
9924
+ return;
9925
+ }
9926
+ }
9927
+
9928
+
9929
+ function loadDocuments(input, options) {
9930
+ input = String(input);
9931
+ options = options || {};
9932
+
9933
+ if (input.length !== 0) {
9934
+
9935
+ // Add tailing `\n` if not exists
9936
+ if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
9937
+ input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
9938
+ input += '\n';
9939
+ }
9940
+
9941
+ // Strip BOM
9942
+ if (input.charCodeAt(0) === 0xFEFF) {
9943
+ input = input.slice(1);
9944
+ }
9945
+ }
9946
+
9947
+ var state = new State$1(input, options);
9948
+
9949
+ var nullpos = input.indexOf('\0');
9950
+
9951
+ if (nullpos !== -1) {
9952
+ state.position = nullpos;
9953
+ throwError(state, 'null byte is not allowed in input');
9954
+ }
9955
+
9956
+ // Use 0 as string terminator. That significantly simplifies bounds check.
9957
+ state.input += '\0';
9958
+
9959
+ while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
9960
+ state.lineIndent += 1;
9961
+ state.position += 1;
9962
+ }
9963
+
9964
+ while (state.position < (state.length - 1)) {
9965
+ readDocument(state);
9966
+ }
9967
+
9968
+ return state.documents;
9969
+ }
9970
+
9971
+
9972
+ function loadAll$1(input, iterator, options) {
9973
+ if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
9974
+ options = iterator;
9975
+ iterator = null;
9976
+ }
9977
+
9978
+ var documents = loadDocuments(input, options);
9979
+
9980
+ if (typeof iterator !== 'function') {
9981
+ return documents;
9982
+ }
9983
+
9984
+ for (var index = 0, length = documents.length; index < length; index += 1) {
9985
+ iterator(documents[index]);
9986
+ }
9987
+ }
9988
+
9989
+
9990
+ function load$1(input, options) {
9991
+ var documents = loadDocuments(input, options);
9992
+
9993
+ if (documents.length === 0) {
9994
+ /*eslint-disable no-undefined*/
9995
+ return undefined;
9996
+ } else if (documents.length === 1) {
9997
+ return documents[0];
9998
+ }
9999
+ throw new exception('expected a single document in the stream, but found more');
10000
+ }
10001
+
10002
+
10003
+ var loadAll_1 = loadAll$1;
10004
+ var load_1 = load$1;
10005
+
10006
+ var loader = {
10007
+ loadAll: loadAll_1,
10008
+ load: load_1
10009
+ };
10010
+
10011
+ /*eslint-disable no-use-before-define*/
10012
+
10013
+
10014
+
10015
+
10016
+
10017
+ var _toString = Object.prototype.toString;
10018
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
10019
+
10020
+ var CHAR_BOM = 0xFEFF;
10021
+ var CHAR_TAB = 0x09; /* Tab */
10022
+ var CHAR_LINE_FEED = 0x0A; /* LF */
10023
+ var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
10024
+ var CHAR_SPACE = 0x20; /* Space */
10025
+ var CHAR_EXCLAMATION = 0x21; /* ! */
10026
+ var CHAR_DOUBLE_QUOTE = 0x22; /* " */
10027
+ var CHAR_SHARP = 0x23; /* # */
10028
+ var CHAR_PERCENT = 0x25; /* % */
10029
+ var CHAR_AMPERSAND = 0x26; /* & */
10030
+ var CHAR_SINGLE_QUOTE = 0x27; /* ' */
10031
+ var CHAR_ASTERISK = 0x2A; /* * */
10032
+ var CHAR_COMMA = 0x2C; /* , */
10033
+ var CHAR_MINUS = 0x2D; /* - */
10034
+ var CHAR_COLON = 0x3A; /* : */
10035
+ var CHAR_EQUALS = 0x3D; /* = */
10036
+ var CHAR_GREATER_THAN = 0x3E; /* > */
10037
+ var CHAR_QUESTION = 0x3F; /* ? */
10038
+ var CHAR_COMMERCIAL_AT = 0x40; /* @ */
10039
+ var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
10040
+ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
10041
+ var CHAR_GRAVE_ACCENT = 0x60; /* ` */
10042
+ var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
10043
+ var CHAR_VERTICAL_LINE = 0x7C; /* | */
10044
+ var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
10045
+
10046
+ var ESCAPE_SEQUENCES = {};
10047
+
10048
+ ESCAPE_SEQUENCES[0x00] = '\\0';
10049
+ ESCAPE_SEQUENCES[0x07] = '\\a';
10050
+ ESCAPE_SEQUENCES[0x08] = '\\b';
10051
+ ESCAPE_SEQUENCES[0x09] = '\\t';
10052
+ ESCAPE_SEQUENCES[0x0A] = '\\n';
10053
+ ESCAPE_SEQUENCES[0x0B] = '\\v';
10054
+ ESCAPE_SEQUENCES[0x0C] = '\\f';
10055
+ ESCAPE_SEQUENCES[0x0D] = '\\r';
10056
+ ESCAPE_SEQUENCES[0x1B] = '\\e';
10057
+ ESCAPE_SEQUENCES[0x22] = '\\"';
10058
+ ESCAPE_SEQUENCES[0x5C] = '\\\\';
10059
+ ESCAPE_SEQUENCES[0x85] = '\\N';
10060
+ ESCAPE_SEQUENCES[0xA0] = '\\_';
10061
+ ESCAPE_SEQUENCES[0x2028] = '\\L';
10062
+ ESCAPE_SEQUENCES[0x2029] = '\\P';
10063
+
10064
+ var DEPRECATED_BOOLEANS_SYNTAX = [
10065
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
10066
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
10067
+ ];
10068
+
10069
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
10070
+
10071
+ function compileStyleMap(schema, map) {
10072
+ var result, keys, index, length, tag, style, type;
10073
+
10074
+ if (map === null) return {};
10075
+
10076
+ result = {};
10077
+ keys = Object.keys(map);
10078
+
10079
+ for (index = 0, length = keys.length; index < length; index += 1) {
10080
+ tag = keys[index];
10081
+ style = String(map[tag]);
10082
+
10083
+ if (tag.slice(0, 2) === '!!') {
10084
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
10085
+ }
10086
+ type = schema.compiledTypeMap['fallback'][tag];
10087
+
10088
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
10089
+ style = type.styleAliases[style];
10090
+ }
10091
+
10092
+ result[tag] = style;
10093
+ }
10094
+
10095
+ return result;
10096
+ }
10097
+
10098
+ function encodeHex(character) {
10099
+ var string, handle, length;
10100
+
10101
+ string = character.toString(16).toUpperCase();
10102
+
10103
+ if (character <= 0xFF) {
10104
+ handle = 'x';
10105
+ length = 2;
10106
+ } else if (character <= 0xFFFF) {
10107
+ handle = 'u';
10108
+ length = 4;
10109
+ } else if (character <= 0xFFFFFFFF) {
10110
+ handle = 'U';
10111
+ length = 8;
10112
+ } else {
10113
+ throw new exception('code point within a string may not be greater than 0xFFFFFFFF');
10114
+ }
10115
+
10116
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
10117
+ }
10118
+
10119
+
10120
+ var QUOTING_TYPE_SINGLE = 1,
10121
+ QUOTING_TYPE_DOUBLE = 2;
10122
+
10123
+ function State(options) {
10124
+ this.schema = options['schema'] || _default;
10125
+ this.indent = Math.max(1, (options['indent'] || 2));
10126
+ this.noArrayIndent = options['noArrayIndent'] || false;
10127
+ this.skipInvalid = options['skipInvalid'] || false;
10128
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
10129
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
10130
+ this.sortKeys = options['sortKeys'] || false;
10131
+ this.lineWidth = options['lineWidth'] || 80;
10132
+ this.noRefs = options['noRefs'] || false;
10133
+ this.noCompatMode = options['noCompatMode'] || false;
10134
+ this.condenseFlow = options['condenseFlow'] || false;
10135
+ this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
10136
+ this.forceQuotes = options['forceQuotes'] || false;
10137
+ this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
10138
+
10139
+ this.implicitTypes = this.schema.compiledImplicit;
10140
+ this.explicitTypes = this.schema.compiledExplicit;
10141
+
10142
+ this.tag = null;
10143
+ this.result = '';
10144
+
10145
+ this.duplicates = [];
10146
+ this.usedDuplicates = null;
10147
+ }
10148
+
10149
+ // Indents every line in a string. Empty lines (\n only) are not indented.
10150
+ function indentString(string, spaces) {
10151
+ var ind = common.repeat(' ', spaces),
10152
+ position = 0,
10153
+ next = -1,
10154
+ result = '',
10155
+ line,
10156
+ length = string.length;
10157
+
10158
+ while (position < length) {
10159
+ next = string.indexOf('\n', position);
10160
+ if (next === -1) {
10161
+ line = string.slice(position);
10162
+ position = length;
10163
+ } else {
10164
+ line = string.slice(position, next + 1);
10165
+ position = next + 1;
10166
+ }
10167
+
10168
+ if (line.length && line !== '\n') result += ind;
10169
+
10170
+ result += line;
10171
+ }
10172
+
10173
+ return result;
10174
+ }
10175
+
10176
+ function generateNextLine(state, level) {
10177
+ return '\n' + common.repeat(' ', state.indent * level);
10178
+ }
10179
+
10180
+ function testImplicitResolving(state, str) {
10181
+ var index, length, type;
10182
+
10183
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
10184
+ type = state.implicitTypes[index];
10185
+
10186
+ if (type.resolve(str)) {
10187
+ return true;
10188
+ }
10189
+ }
10190
+
10191
+ return false;
10192
+ }
10193
+
10194
+ // [33] s-white ::= s-space | s-tab
10195
+ function isWhitespace(c) {
10196
+ return c === CHAR_SPACE || c === CHAR_TAB;
10197
+ }
10198
+
10199
+ // Returns true if the character can be printed without escaping.
10200
+ // From YAML 1.2: "any allowed characters known to be non-printable
10201
+ // should also be escaped. [However,] This isn’t mandatory"
10202
+ // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
10203
+ function isPrintable(c) {
10204
+ return (0x00020 <= c && c <= 0x00007E)
10205
+ || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
10206
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
10207
+ || (0x10000 <= c && c <= 0x10FFFF);
10208
+ }
10209
+
10210
+ // [34] ns-char ::= nb-char - s-white
10211
+ // [27] nb-char ::= c-printable - b-char - c-byte-order-mark
10212
+ // [26] b-char ::= b-line-feed | b-carriage-return
10213
+ // Including s-white (for some reason, examples doesn't match specs in this aspect)
10214
+ // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
10215
+ function isNsCharOrWhitespace(c) {
10216
+ return isPrintable(c)
10217
+ && c !== CHAR_BOM
10218
+ // - b-char
10219
+ && c !== CHAR_CARRIAGE_RETURN
10220
+ && c !== CHAR_LINE_FEED;
10221
+ }
10222
+
10223
+ // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
10224
+ // c = flow-in ⇒ ns-plain-safe-in
10225
+ // c = block-key ⇒ ns-plain-safe-out
10226
+ // c = flow-key ⇒ ns-plain-safe-in
10227
+ // [128] ns-plain-safe-out ::= ns-char
10228
+ // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator
10229
+ // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
10230
+ // | ( /* An ns-char preceding */ “#” )
10231
+ // | ( “:” /* Followed by an ns-plain-safe(c) */ )
10232
+ function isPlainSafe(c, prev, inblock) {
10233
+ var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
10234
+ var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
10235
+ return (
10236
+ // ns-plain-safe
10237
+ inblock ? // c = flow-in
10238
+ cIsNsCharOrWhitespace
10239
+ : cIsNsCharOrWhitespace
10240
+ // - c-flow-indicator
10241
+ && c !== CHAR_COMMA
10242
+ && c !== CHAR_LEFT_SQUARE_BRACKET
10243
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
10244
+ && c !== CHAR_LEFT_CURLY_BRACKET
10245
+ && c !== CHAR_RIGHT_CURLY_BRACKET
10246
+ )
10247
+ // ns-plain-char
10248
+ && c !== CHAR_SHARP // false on '#'
10249
+ && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
10250
+ || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
10251
+ || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
10252
+ }
10253
+
10254
+ // Simplified test for values allowed as the first character in plain style.
10255
+ function isPlainSafeFirst(c) {
10256
+ // Uses a subset of ns-char - c-indicator
10257
+ // where ns-char = nb-char - s-white.
10258
+ // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
10259
+ return isPrintable(c) && c !== CHAR_BOM
10260
+ && !isWhitespace(c) // - s-white
10261
+ // - (c-indicator ::=
10262
+ // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
10263
+ && c !== CHAR_MINUS
10264
+ && c !== CHAR_QUESTION
10265
+ && c !== CHAR_COLON
10266
+ && c !== CHAR_COMMA
10267
+ && c !== CHAR_LEFT_SQUARE_BRACKET
10268
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
10269
+ && c !== CHAR_LEFT_CURLY_BRACKET
10270
+ && c !== CHAR_RIGHT_CURLY_BRACKET
10271
+ // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
10272
+ && c !== CHAR_SHARP
10273
+ && c !== CHAR_AMPERSAND
10274
+ && c !== CHAR_ASTERISK
10275
+ && c !== CHAR_EXCLAMATION
10276
+ && c !== CHAR_VERTICAL_LINE
10277
+ && c !== CHAR_EQUALS
10278
+ && c !== CHAR_GREATER_THAN
10279
+ && c !== CHAR_SINGLE_QUOTE
10280
+ && c !== CHAR_DOUBLE_QUOTE
10281
+ // | “%” | “@” | “`”)
10282
+ && c !== CHAR_PERCENT
10283
+ && c !== CHAR_COMMERCIAL_AT
10284
+ && c !== CHAR_GRAVE_ACCENT;
10285
+ }
10286
+
10287
+ // Simplified test for values allowed as the last character in plain style.
10288
+ function isPlainSafeLast(c) {
10289
+ // just not whitespace or colon, it will be checked to be plain character later
10290
+ return !isWhitespace(c) && c !== CHAR_COLON;
10291
+ }
10292
+
10293
+ // Same as 'string'.codePointAt(pos), but works in older browsers.
10294
+ function codePointAt(string, pos) {
10295
+ var first = string.charCodeAt(pos), second;
10296
+ if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
10297
+ second = string.charCodeAt(pos + 1);
10298
+ if (second >= 0xDC00 && second <= 0xDFFF) {
10299
+ // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
10300
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
10301
+ }
10302
+ }
10303
+ return first;
10304
+ }
10305
+
10306
+ // Determines whether block indentation indicator is required.
10307
+ function needIndentIndicator(string) {
10308
+ var leadingSpaceRe = /^\n* /;
10309
+ return leadingSpaceRe.test(string);
10310
+ }
10311
+
10312
+ var STYLE_PLAIN = 1,
10313
+ STYLE_SINGLE = 2,
10314
+ STYLE_LITERAL = 3,
10315
+ STYLE_FOLDED = 4,
10316
+ STYLE_DOUBLE = 5;
10317
+
10318
+ // Determines which scalar styles are possible and returns the preferred style.
10319
+ // lineWidth = -1 => no limit.
10320
+ // Pre-conditions: str.length > 0.
10321
+ // Post-conditions:
10322
+ // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
10323
+ // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
10324
+ // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
10325
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
10326
+ testAmbiguousType, quotingType, forceQuotes, inblock) {
10327
+
10328
+ var i;
10329
+ var char = 0;
10330
+ var prevChar = null;
10331
+ var hasLineBreak = false;
10332
+ var hasFoldableLine = false; // only checked if shouldTrackWidth
10333
+ var shouldTrackWidth = lineWidth !== -1;
10334
+ var previousLineBreak = -1; // count the first line correctly
10335
+ var plain = isPlainSafeFirst(codePointAt(string, 0))
10336
+ && isPlainSafeLast(codePointAt(string, string.length - 1));
10337
+
10338
+ if (singleLineOnly || forceQuotes) {
10339
+ // Case: no block styles.
10340
+ // Check for disallowed characters to rule out plain and single.
10341
+ for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
10342
+ char = codePointAt(string, i);
10343
+ if (!isPrintable(char)) {
10344
+ return STYLE_DOUBLE;
10345
+ }
10346
+ plain = plain && isPlainSafe(char, prevChar, inblock);
10347
+ prevChar = char;
10348
+ }
10349
+ } else {
10350
+ // Case: block styles permitted.
10351
+ for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
10352
+ char = codePointAt(string, i);
10353
+ if (char === CHAR_LINE_FEED) {
10354
+ hasLineBreak = true;
10355
+ // Check if any line can be folded.
10356
+ if (shouldTrackWidth) {
10357
+ hasFoldableLine = hasFoldableLine ||
10358
+ // Foldable line = too long, and not more-indented.
10359
+ (i - previousLineBreak - 1 > lineWidth &&
10360
+ string[previousLineBreak + 1] !== ' ');
10361
+ previousLineBreak = i;
10362
+ }
10363
+ } else if (!isPrintable(char)) {
10364
+ return STYLE_DOUBLE;
10365
+ }
10366
+ plain = plain && isPlainSafe(char, prevChar, inblock);
10367
+ prevChar = char;
10368
+ }
10369
+ // in case the end is missing a \n
10370
+ hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
10371
+ (i - previousLineBreak - 1 > lineWidth &&
10372
+ string[previousLineBreak + 1] !== ' '));
10373
+ }
10374
+ // Although every style can represent \n without escaping, prefer block styles
10375
+ // for multiline, since they're more readable and they don't add empty lines.
10376
+ // Also prefer folding a super-long line.
10377
+ if (!hasLineBreak && !hasFoldableLine) {
10378
+ // Strings interpretable as another type have to be quoted;
10379
+ // e.g. the string 'true' vs. the boolean true.
10380
+ if (plain && !forceQuotes && !testAmbiguousType(string)) {
10381
+ return STYLE_PLAIN;
10382
+ }
10383
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
10384
+ }
10385
+ // Edge case: block indentation indicator can only have one digit.
10386
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
10387
+ return STYLE_DOUBLE;
10388
+ }
10389
+ // At this point we know block styles are valid.
10390
+ // Prefer literal style unless we want to fold.
10391
+ if (!forceQuotes) {
10392
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
10393
+ }
10394
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
10395
+ }
10396
+
10397
+ // Note: line breaking/folding is implemented for only the folded style.
10398
+ // NB. We drop the last trailing newline (if any) of a returned block scalar
10399
+ // since the dumper adds its own newline. This always works:
10400
+ // • No ending newline => unaffected; already using strip "-" chomping.
10401
+ // • Ending newline => removed then restored.
10402
+ // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
10403
+ function writeScalar(state, string, level, iskey, inblock) {
10404
+ state.dump = (function () {
10405
+ if (string.length === 0) {
10406
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
10407
+ }
10408
+ if (!state.noCompatMode) {
10409
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
10410
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
10411
+ }
10412
+ }
10413
+
10414
+ var indent = state.indent * Math.max(1, level); // no 0-indent scalars
10415
+ // As indentation gets deeper, let the width decrease monotonically
10416
+ // to the lower bound min(state.lineWidth, 40).
10417
+ // Note that this implies
10418
+ // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
10419
+ // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
10420
+ // This behaves better than a constant minimum width which disallows narrower options,
10421
+ // or an indent threshold which causes the width to suddenly increase.
10422
+ var lineWidth = state.lineWidth === -1
10423
+ ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
10424
+
10425
+ // Without knowing if keys are implicit/explicit, assume implicit for safety.
10426
+ var singleLineOnly = iskey
10427
+ // No block styles in flow mode.
10428
+ || (state.flowLevel > -1 && level >= state.flowLevel);
10429
+ function testAmbiguity(string) {
10430
+ return testImplicitResolving(state, string);
10431
+ }
10432
+
10433
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
10434
+ testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
10435
+
10436
+ case STYLE_PLAIN:
10437
+ return string;
10438
+ case STYLE_SINGLE:
10439
+ return "'" + string.replace(/'/g, "''") + "'";
10440
+ case STYLE_LITERAL:
10441
+ return '|' + blockHeader(string, state.indent)
10442
+ + dropEndingNewline(indentString(string, indent));
10443
+ case STYLE_FOLDED:
10444
+ return '>' + blockHeader(string, state.indent)
10445
+ + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
10446
+ case STYLE_DOUBLE:
10447
+ return '"' + escapeString(string) + '"';
10448
+ default:
10449
+ throw new exception('impossible error: invalid scalar style');
10450
+ }
10451
+ }());
10452
+ }
10453
+
10454
+ // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
10455
+ function blockHeader(string, indentPerLevel) {
10456
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
10457
+
10458
+ // note the special case: the string '\n' counts as a "trailing" empty line.
10459
+ var clip = string[string.length - 1] === '\n';
10460
+ var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
10461
+ var chomp = keep ? '+' : (clip ? '' : '-');
10462
+
10463
+ return indentIndicator + chomp + '\n';
10464
+ }
10465
+
10466
+ // (See the note for writeScalar.)
10467
+ function dropEndingNewline(string) {
10468
+ return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
10469
+ }
10470
+
10471
+ // Note: a long line without a suitable break point will exceed the width limit.
10472
+ // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
10473
+ function foldString(string, width) {
10474
+ // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
10475
+ // unless they're before or after a more-indented line, or at the very
10476
+ // beginning or end, in which case $k$ maps to $k$.
10477
+ // Therefore, parse each chunk as newline(s) followed by a content line.
10478
+ var lineRe = /(\n+)([^\n]*)/g;
10479
+
10480
+ // first line (possibly an empty line)
10481
+ var result = (function () {
10482
+ var nextLF = string.indexOf('\n');
10483
+ nextLF = nextLF !== -1 ? nextLF : string.length;
10484
+ lineRe.lastIndex = nextLF;
10485
+ return foldLine(string.slice(0, nextLF), width);
10486
+ }());
10487
+ // If we haven't reached the first content line yet, don't add an extra \n.
10488
+ var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
10489
+ var moreIndented;
10490
+
10491
+ // rest of the lines
10492
+ var match;
10493
+ while ((match = lineRe.exec(string))) {
10494
+ var prefix = match[1], line = match[2];
10495
+ moreIndented = (line[0] === ' ');
10496
+ result += prefix
10497
+ + (!prevMoreIndented && !moreIndented && line !== ''
10498
+ ? '\n' : '')
10499
+ + foldLine(line, width);
10500
+ prevMoreIndented = moreIndented;
10501
+ }
10502
+
10503
+ return result;
10504
+ }
10505
+
10506
+ // Greedy line breaking.
10507
+ // Picks the longest line under the limit each time,
10508
+ // otherwise settles for the shortest line over the limit.
10509
+ // NB. More-indented lines *cannot* be folded, as that would add an extra \n.
10510
+ function foldLine(line, width) {
10511
+ if (line === '' || line[0] === ' ') return line;
10512
+
10513
+ // Since a more-indented line adds a \n, breaks can't be followed by a space.
10514
+ var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
10515
+ var match;
10516
+ // start is an inclusive index. end, curr, and next are exclusive.
10517
+ var start = 0, end, curr = 0, next = 0;
10518
+ var result = '';
10519
+
10520
+ // Invariants: 0 <= start <= length-1.
10521
+ // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
10522
+ // Inside the loop:
10523
+ // A match implies length >= 2, so curr and next are <= length-2.
10524
+ while ((match = breakRe.exec(line))) {
10525
+ next = match.index;
10526
+ // maintain invariant: curr - start <= width
10527
+ if (next - start > width) {
10528
+ end = (curr > start) ? curr : next; // derive end <= length-2
10529
+ result += '\n' + line.slice(start, end);
10530
+ // skip the space that was output as \n
10531
+ start = end + 1; // derive start <= length-1
10532
+ }
10533
+ curr = next;
10534
+ }
10535
+
10536
+ // By the invariants, start <= length-1, so there is something left over.
10537
+ // It is either the whole string or a part starting from non-whitespace.
10538
+ result += '\n';
10539
+ // Insert a break if the remainder is too long and there is a break available.
10540
+ if (line.length - start > width && curr > start) {
10541
+ result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
10542
+ } else {
10543
+ result += line.slice(start);
10544
+ }
10545
+
10546
+ return result.slice(1); // drop extra \n joiner
10547
+ }
10548
+
10549
+ // Escapes a double-quoted string.
10550
+ function escapeString(string) {
10551
+ var result = '';
10552
+ var char = 0;
10553
+ var escapeSeq;
10554
+
10555
+ for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
10556
+ char = codePointAt(string, i);
10557
+ escapeSeq = ESCAPE_SEQUENCES[char];
10558
+
10559
+ if (!escapeSeq && isPrintable(char)) {
10560
+ result += string[i];
10561
+ if (char >= 0x10000) result += string[i + 1];
10562
+ } else {
10563
+ result += escapeSeq || encodeHex(char);
10564
+ }
10565
+ }
10566
+
10567
+ return result;
10568
+ }
10569
+
10570
+ function writeFlowSequence(state, level, object) {
10571
+ var _result = '',
10572
+ _tag = state.tag,
10573
+ index,
10574
+ length,
10575
+ value;
10576
+
10577
+ for (index = 0, length = object.length; index < length; index += 1) {
10578
+ value = object[index];
10579
+
10580
+ if (state.replacer) {
10581
+ value = state.replacer.call(object, String(index), value);
10582
+ }
10583
+
10584
+ // Write only valid elements, put null instead of invalid elements.
10585
+ if (writeNode(state, level, value, false, false) ||
10586
+ (typeof value === 'undefined' &&
10587
+ writeNode(state, level, null, false, false))) {
10588
+
10589
+ if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
10590
+ _result += state.dump;
10591
+ }
10592
+ }
10593
+
10594
+ state.tag = _tag;
10595
+ state.dump = '[' + _result + ']';
10596
+ }
10597
+
10598
+ function writeBlockSequence(state, level, object, compact) {
10599
+ var _result = '',
10600
+ _tag = state.tag,
10601
+ index,
10602
+ length,
10603
+ value;
10604
+
10605
+ for (index = 0, length = object.length; index < length; index += 1) {
10606
+ value = object[index];
10607
+
10608
+ if (state.replacer) {
10609
+ value = state.replacer.call(object, String(index), value);
10610
+ }
10611
+
10612
+ // Write only valid elements, put null instead of invalid elements.
10613
+ if (writeNode(state, level + 1, value, true, true, false, true) ||
10614
+ (typeof value === 'undefined' &&
10615
+ writeNode(state, level + 1, null, true, true, false, true))) {
10616
+
10617
+ if (!compact || _result !== '') {
10618
+ _result += generateNextLine(state, level);
10619
+ }
10620
+
10621
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
10622
+ _result += '-';
10623
+ } else {
10624
+ _result += '- ';
10625
+ }
10626
+
10627
+ _result += state.dump;
10628
+ }
10629
+ }
10630
+
10631
+ state.tag = _tag;
10632
+ state.dump = _result || '[]'; // Empty sequence if no valid values.
10633
+ }
10634
+
10635
+ function writeFlowMapping(state, level, object) {
10636
+ var _result = '',
10637
+ _tag = state.tag,
10638
+ objectKeyList = Object.keys(object),
10639
+ index,
10640
+ length,
10641
+ objectKey,
10642
+ objectValue,
10643
+ pairBuffer;
10644
+
10645
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
10646
+
10647
+ pairBuffer = '';
10648
+ if (_result !== '') pairBuffer += ', ';
10649
+
10650
+ if (state.condenseFlow) pairBuffer += '"';
10651
+
10652
+ objectKey = objectKeyList[index];
10653
+ objectValue = object[objectKey];
10654
+
10655
+ if (state.replacer) {
10656
+ objectValue = state.replacer.call(object, objectKey, objectValue);
10657
+ }
10658
+
10659
+ if (!writeNode(state, level, objectKey, false, false)) {
10660
+ continue; // Skip this pair because of invalid key;
10661
+ }
10662
+
10663
+ if (state.dump.length > 1024) pairBuffer += '? ';
10664
+
10665
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
10666
+
10667
+ if (!writeNode(state, level, objectValue, false, false)) {
10668
+ continue; // Skip this pair because of invalid value.
10669
+ }
10670
+
10671
+ pairBuffer += state.dump;
10672
+
10673
+ // Both key and value are valid.
10674
+ _result += pairBuffer;
10675
+ }
10676
+
10677
+ state.tag = _tag;
10678
+ state.dump = '{' + _result + '}';
10679
+ }
10680
+
10681
+ function writeBlockMapping(state, level, object, compact) {
10682
+ var _result = '',
10683
+ _tag = state.tag,
10684
+ objectKeyList = Object.keys(object),
10685
+ index,
10686
+ length,
10687
+ objectKey,
10688
+ objectValue,
10689
+ explicitPair,
10690
+ pairBuffer;
10691
+
10692
+ // Allow sorting keys so that the output file is deterministic
10693
+ if (state.sortKeys === true) {
10694
+ // Default sorting
10695
+ objectKeyList.sort();
10696
+ } else if (typeof state.sortKeys === 'function') {
10697
+ // Custom sort function
10698
+ objectKeyList.sort(state.sortKeys);
10699
+ } else if (state.sortKeys) {
10700
+ // Something is wrong
10701
+ throw new exception('sortKeys must be a boolean or a function');
10702
+ }
10703
+
10704
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
10705
+ pairBuffer = '';
10706
+
10707
+ if (!compact || _result !== '') {
10708
+ pairBuffer += generateNextLine(state, level);
10709
+ }
10710
+
10711
+ objectKey = objectKeyList[index];
10712
+ objectValue = object[objectKey];
10713
+
10714
+ if (state.replacer) {
10715
+ objectValue = state.replacer.call(object, objectKey, objectValue);
10716
+ }
10717
+
10718
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
10719
+ continue; // Skip this pair because of invalid key.
10720
+ }
10721
+
10722
+ explicitPair = (state.tag !== null && state.tag !== '?') ||
10723
+ (state.dump && state.dump.length > 1024);
10724
+
10725
+ if (explicitPair) {
10726
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
10727
+ pairBuffer += '?';
10728
+ } else {
10729
+ pairBuffer += '? ';
10730
+ }
10731
+ }
10732
+
10733
+ pairBuffer += state.dump;
10734
+
10735
+ if (explicitPair) {
10736
+ pairBuffer += generateNextLine(state, level);
10737
+ }
10738
+
10739
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
10740
+ continue; // Skip this pair because of invalid value.
10741
+ }
10742
+
10743
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
10744
+ pairBuffer += ':';
10745
+ } else {
10746
+ pairBuffer += ': ';
10747
+ }
10748
+
10749
+ pairBuffer += state.dump;
10750
+
10751
+ // Both key and value are valid.
10752
+ _result += pairBuffer;
10753
+ }
10754
+
10755
+ state.tag = _tag;
10756
+ state.dump = _result || '{}'; // Empty mapping if no valid pairs.
10757
+ }
10758
+
10759
+ function detectType(state, object, explicit) {
10760
+ var _result, typeList, index, length, type, style;
10761
+
10762
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
10763
+
10764
+ for (index = 0, length = typeList.length; index < length; index += 1) {
10765
+ type = typeList[index];
10766
+
10767
+ if ((type.instanceOf || type.predicate) &&
10768
+ (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
10769
+ (!type.predicate || type.predicate(object))) {
10770
+
10771
+ if (explicit) {
10772
+ if (type.multi && type.representName) {
10773
+ state.tag = type.representName(object);
10774
+ } else {
10775
+ state.tag = type.tag;
10776
+ }
10777
+ } else {
10778
+ state.tag = '?';
10779
+ }
10780
+
10781
+ if (type.represent) {
10782
+ style = state.styleMap[type.tag] || type.defaultStyle;
10783
+
10784
+ if (_toString.call(type.represent) === '[object Function]') {
10785
+ _result = type.represent(object, style);
10786
+ } else if (_hasOwnProperty.call(type.represent, style)) {
10787
+ _result = type.represent[style](object, style);
10788
+ } else {
10789
+ throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
10790
+ }
10791
+
10792
+ state.dump = _result;
10793
+ }
10794
+
10795
+ return true;
10796
+ }
10797
+ }
10798
+
10799
+ return false;
10800
+ }
10801
+
10802
+ // Serializes `object` and writes it to global `result`.
10803
+ // Returns true on success, or false on invalid object.
10804
+ //
10805
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
10806
+ state.tag = null;
10807
+ state.dump = object;
10808
+
10809
+ if (!detectType(state, object, false)) {
10810
+ detectType(state, object, true);
10811
+ }
10812
+
10813
+ var type = _toString.call(state.dump);
10814
+ var inblock = block;
10815
+ var tagStr;
10816
+
10817
+ if (block) {
10818
+ block = (state.flowLevel < 0 || state.flowLevel > level);
10819
+ }
10820
+
10821
+ var objectOrArray = type === '[object Object]' || type === '[object Array]',
10822
+ duplicateIndex,
10823
+ duplicate;
10824
+
10825
+ if (objectOrArray) {
10826
+ duplicateIndex = state.duplicates.indexOf(object);
10827
+ duplicate = duplicateIndex !== -1;
10828
+ }
10829
+
10830
+ if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
10831
+ compact = false;
10832
+ }
10833
+
10834
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
10835
+ state.dump = '*ref_' + duplicateIndex;
10836
+ } else {
10837
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
10838
+ state.usedDuplicates[duplicateIndex] = true;
10839
+ }
10840
+ if (type === '[object Object]') {
10841
+ if (block && (Object.keys(state.dump).length !== 0)) {
10842
+ writeBlockMapping(state, level, state.dump, compact);
10843
+ if (duplicate) {
10844
+ state.dump = '&ref_' + duplicateIndex + state.dump;
10845
+ }
10846
+ } else {
10847
+ writeFlowMapping(state, level, state.dump);
10848
+ if (duplicate) {
10849
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
10850
+ }
10851
+ }
10852
+ } else if (type === '[object Array]') {
10853
+ if (block && (state.dump.length !== 0)) {
10854
+ if (state.noArrayIndent && !isblockseq && level > 0) {
10855
+ writeBlockSequence(state, level - 1, state.dump, compact);
10856
+ } else {
10857
+ writeBlockSequence(state, level, state.dump, compact);
10858
+ }
10859
+ if (duplicate) {
10860
+ state.dump = '&ref_' + duplicateIndex + state.dump;
10861
+ }
10862
+ } else {
10863
+ writeFlowSequence(state, level, state.dump);
10864
+ if (duplicate) {
10865
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
10866
+ }
10867
+ }
10868
+ } else if (type === '[object String]') {
10869
+ if (state.tag !== '?') {
10870
+ writeScalar(state, state.dump, level, iskey, inblock);
10871
+ }
10872
+ } else if (type === '[object Undefined]') {
10873
+ return false;
10874
+ } else {
10875
+ if (state.skipInvalid) return false;
10876
+ throw new exception('unacceptable kind of an object to dump ' + type);
10877
+ }
10878
+
10879
+ if (state.tag !== null && state.tag !== '?') {
10880
+ // Need to encode all characters except those allowed by the spec:
10881
+ //
10882
+ // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */
10883
+ // [36] ns-hex-digit ::= ns-dec-digit
10884
+ // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */
10885
+ // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */
10886
+ // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”
10887
+ // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”
10888
+ // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”
10889
+ // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”
10890
+ //
10891
+ // Also need to encode '!' because it has special meaning (end of tag prefix).
10892
+ //
10893
+ tagStr = encodeURI(
10894
+ state.tag[0] === '!' ? state.tag.slice(1) : state.tag
10895
+ ).replace(/!/g, '%21');
10896
+
10897
+ if (state.tag[0] === '!') {
10898
+ tagStr = '!' + tagStr;
10899
+ } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
10900
+ tagStr = '!!' + tagStr.slice(18);
10901
+ } else {
10902
+ tagStr = '!<' + tagStr + '>';
10903
+ }
10904
+
10905
+ state.dump = tagStr + ' ' + state.dump;
10906
+ }
10907
+ }
10908
+
10909
+ return true;
10910
+ }
10911
+
10912
+ function getDuplicateReferences(object, state) {
10913
+ var objects = [],
10914
+ duplicatesIndexes = [],
10915
+ index,
10916
+ length;
10917
+
10918
+ inspectNode(object, objects, duplicatesIndexes);
10919
+
10920
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
10921
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
10922
+ }
10923
+ state.usedDuplicates = new Array(length);
10924
+ }
10925
+
10926
+ function inspectNode(object, objects, duplicatesIndexes) {
10927
+ var objectKeyList,
10928
+ index,
10929
+ length;
10930
+
10931
+ if (object !== null && typeof object === 'object') {
10932
+ index = objects.indexOf(object);
10933
+ if (index !== -1) {
10934
+ if (duplicatesIndexes.indexOf(index) === -1) {
10935
+ duplicatesIndexes.push(index);
10936
+ }
10937
+ } else {
10938
+ objects.push(object);
10939
+
10940
+ if (Array.isArray(object)) {
10941
+ for (index = 0, length = object.length; index < length; index += 1) {
10942
+ inspectNode(object[index], objects, duplicatesIndexes);
10943
+ }
10944
+ } else {
10945
+ objectKeyList = Object.keys(object);
10946
+
10947
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
10948
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
10949
+ }
10950
+ }
10951
+ }
10952
+ }
10953
+ }
10954
+
10955
+ function dump$1(input, options) {
10956
+ options = options || {};
10957
+
10958
+ var state = new State(options);
10959
+
10960
+ if (!state.noRefs) getDuplicateReferences(input, state);
10961
+
10962
+ var value = input;
10963
+
10964
+ if (state.replacer) {
10965
+ value = state.replacer.call({ '': value }, '', value);
10966
+ }
10967
+
10968
+ if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
10969
+
10970
+ return '';
10971
+ }
10972
+
10973
+ var dump_1 = dump$1;
10974
+
10975
+ var dumper = {
10976
+ dump: dump_1
10977
+ };
10978
+
10979
+ function renamed(from, to) {
10980
+ return function () {
10981
+ throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
10982
+ 'Use yaml.' + to + ' instead, which is now safe by default.');
10983
+ };
10984
+ }
10985
+
10986
+
10987
+ var Type = type;
10988
+ var Schema = schema;
10989
+ var FAILSAFE_SCHEMA = failsafe;
10990
+ var JSON_SCHEMA = json;
10991
+ var CORE_SCHEMA = core;
10992
+ var DEFAULT_SCHEMA = _default;
10993
+ var load = loader.load;
10994
+ var loadAll = loader.loadAll;
10995
+ var dump = dumper.dump;
10996
+ var YAMLException = exception;
10997
+
10998
+ // Re-export all types in case user wants to create custom schema
10999
+ var types = {
11000
+ binary: binary,
11001
+ float: float,
11002
+ map: map,
11003
+ null: _null,
11004
+ pairs: pairs,
11005
+ set: set,
11006
+ timestamp: timestamp,
11007
+ bool: bool,
11008
+ int: int,
11009
+ merge: merge,
11010
+ omap: omap,
11011
+ seq: seq,
11012
+ str: str
11013
+ };
11014
+
11015
+ // Removed functions from JS-YAML 3.0.x
11016
+ var safeLoad = renamed('safeLoad', 'load');
11017
+ var safeLoadAll = renamed('safeLoadAll', 'loadAll');
11018
+ var safeDump = renamed('safeDump', 'dump');
11019
+
11020
+ var jsYaml = {
11021
+ Type: Type,
11022
+ Schema: Schema,
11023
+ FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
11024
+ JSON_SCHEMA: JSON_SCHEMA,
11025
+ CORE_SCHEMA: CORE_SCHEMA,
11026
+ DEFAULT_SCHEMA: DEFAULT_SCHEMA,
11027
+ load: load,
11028
+ loadAll: loadAll,
11029
+ dump: dump,
11030
+ YAMLException: YAMLException,
11031
+ types: types,
11032
+ safeLoad: safeLoad,
11033
+ safeLoadAll: safeLoadAll,
11034
+ safeDump: safeDump
11035
+ };
11036
+
11037
+ /* harmony default export */ __webpack_exports__["default"] = (jsYaml);
11038
+
11039
+
11040
+
11041
+ /***/ }),
11042
+ /* 25 */
11043
+ /***/ (function(module, exports, __webpack_require__) {
11044
+
11045
+ /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
11046
+
11047
+ /*
11048
+ # -----------------------------------------------------------------------------
11049
+ # ~/js/tocbot/tocbot.js
11050
+ # Tocbot v4.12.0 implementation for J1 template
11051
+ #
11052
+ # Product/Info:
11053
+ # https://jekyll.one
11054
+ # https://tscanlin.github.io/tocbot
11055
+ # https://github.com/tscanlin/tocbot
11056
+ #
11057
+ # Copyright (C) 2021 Juergen Adams
11058
+ # Copyright (C) 2016 Tim Scanlin
11059
+ #
11060
+ # J1 Template is licensed under MIT License.
11061
+ # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
11062
+ # Tocbot is licensed under the MIT License.
11063
+ # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE
11064
+ # -----------------------------------------------------------------------------
11065
+ # rules:
11066
+ # "eslint:tocbot": "eslint --ignore-path .eslintignore src/tocbot/js"
11067
+ # -----------------------------------------------------------------------------
11068
+ */
11069
+ // -----------------------------------------------------------------------------
11070
+ // ESLint shimming
11071
+ // -----------------------------------------------------------------------------
11072
+
11073
+ /* eslint indent: "off" */
11074
+
11075
+ /* eslint no-undef: "off" */
11076
+
11077
+ /* eslint semi: "off" */
11078
+ // -----------------------------------------------------------------------------
11079
+
11080
+ /**
11081
+ * Tocbot
11082
+ * Tocbot creates a toble of contents based on HTML headings on a page,
11083
+ * this allows users to easily jump to different sections of the document.
11084
+ * Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/).
11085
+ * The main differences are that it works natively without any need for jquery or jquery UI).
11086
+ *
11087
+ * @author Tim Scanlin
11088
+ */
11089
+
11090
+ /* globals define */
11091
+ (function (root, factory) {
11092
+ if (true) {
11093
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)),
11094
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
11095
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
11096
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
11097
+ } else {}
11098
+ })(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {
11099
+ 'use strict'; // Default options.
11100
+
11101
+ var defaultOptions = __webpack_require__(26); // Object to store current options.
11102
+
11103
+
11104
+ var options = {}; // Object for public APIs.
11105
+
11106
+ var tocbot = {};
11107
+
11108
+ var BuildHtml = __webpack_require__(27);
11109
+
11110
+ var ParseContent = __webpack_require__(28);
11111
+
11112
+ var updateTocScroll = __webpack_require__(29); // Keep these variables at top scope once options are passed in.
11113
+
11114
+
11115
+ var buildHtml;
11116
+ var parseContent; // Just return if its not a browser.
11117
+
11118
+ var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener; // Feature test
11119
+
11120
+ if (typeof window === 'undefined' && !supports) {
11121
+ return;
11122
+ }
11123
+
11124
+ var headingsArray; // From: https://github.com/Raynos/xtend
11125
+
11126
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
11127
+
11128
+ function extend() {
11129
+ var target = {};
11130
+
11131
+ for (var i = 0; i < arguments.length; i++) {
11132
+ var source = arguments[i];
11133
+
11134
+ for (var key in source) {
11135
+ if (hasOwnProperty.call(source, key)) {
11136
+ target[key] = source[key];
11137
+ }
11138
+ }
11139
+ }
11140
+
11141
+ return target;
11142
+ } // From: https://remysharp.com/2010/07/21/throttling-function-calls
11143
+
11144
+
11145
+ function throttle(fn, threshold, scope) {
11146
+ threshold || (threshold = 250);
11147
+ var last;
11148
+ var deferTimer;
11149
+ return function () {
11150
+ var context = scope || this;
11151
+ var now = +new Date();
11152
+ var args = arguments;
11153
+
11154
+ if (last && now < last + threshold) {
11155
+ // hold on to it
11156
+ clearTimeout(deferTimer);
11157
+ deferTimer = setTimeout(function () {
11158
+ last = now;
11159
+ fn.apply(context, args);
11160
+ }, threshold);
11161
+ } else {
11162
+ last = now;
11163
+ fn.apply(context, args);
11164
+ }
11165
+ };
11166
+ }
11167
+ /**
11168
+ * Destroy tocbot.
11169
+ */
11170
+
11171
+
11172
+ tocbot.destroy = function () {
11173
+ if (!options.skipRendering) {
11174
+ // Clear HTML.
11175
+ try {
11176
+ document.querySelector(options.tocSelector).innerHTML = '';
11177
+ } catch (e) {
11178
+ console.warn('Element not found: ' + options.tocSelector); // eslint-disable-line
11179
+ }
11180
+ } // Remove event listeners.
11181
+
11182
+
11183
+ if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
11184
+ document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false);
11185
+ document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false);
11186
+
11187
+ if (buildHtml) {
11188
+ document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false);
11189
+ }
11190
+ } else {
11191
+ document.removeEventListener('scroll', this._scrollListener, false);
11192
+ document.removeEventListener('resize', this._scrollListener, false);
11193
+
11194
+ if (buildHtml) {
11195
+ document.removeEventListener('click', this._clickListener, false);
11196
+ }
11197
+ }
11198
+ };
11199
+ /**
11200
+ * Initialize tocbot.
11201
+ * @param {object} customOptions
11202
+ */
11203
+
11204
+
11205
+ tocbot.init = function (customOptions) {
11206
+ // feature test
11207
+ if (!supports) {
11208
+ return;
11209
+ } // Merge defaults with user options.
11210
+ // Set to options variable at the top.
11211
+
11212
+
11213
+ options = extend(defaultOptions, customOptions || {});
11214
+ this.options = options;
11215
+ this.state = {}; // Init smooth scroll if enabled (default).
11216
+
11217
+ if (options.scrollSmooth) {
11218
+ options.duration = options.scrollSmoothDuration;
11219
+ options.offset = options.scrollSmoothOffset;
11220
+ tocbot.scrollSmooth = __webpack_require__(30).initSmoothScrolling(options);
11221
+ } // Pass options to these modules.
11222
+
11223
+
11224
+ buildHtml = BuildHtml(options);
11225
+ parseContent = ParseContent(options); // For testing purposes.
11226
+
11227
+ this._buildHtml = buildHtml;
11228
+ this._parseContent = parseContent; // Destroy it if it exists first.
11229
+
11230
+ tocbot.destroy(); // Get headings array.
11231
+
11232
+ headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector); // Return if no headings are found.
11233
+
11234
+ if (headingsArray === null) {
11235
+ return;
11236
+ } // Build nested headings array.
11237
+
11238
+
11239
+ var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray);
11240
+ var nestedHeadings = nestedHeadingsObj.nest; // Render.
11241
+
11242
+ if (!options.skipRendering) {
11243
+ buildHtml.render(options.tocSelector, nestedHeadings);
11244
+ } // Update Sidebar and bind listeners.
11245
+
11246
+
11247
+ this._scrollListener = throttle(function (e) {
11248
+ buildHtml.updateToc(headingsArray);
11249
+ !options.disableTocScrollSync && updateTocScroll(options);
11250
+ var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0;
11251
+
11252
+ if (e && (e.eventPhase === 0 || e.currentTarget === null) || isTop) {
11253
+ buildHtml.updateToc(headingsArray);
11254
+
11255
+ if (options.scrollEndCallback) {
11256
+ options.scrollEndCallback(e);
11257
+ }
11258
+ }
11259
+ }, options.throttleTimeout);
11260
+
11261
+ this._scrollListener();
11262
+
11263
+ if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
11264
+ document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false);
11265
+ document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false);
11266
+ } else {
11267
+ document.addEventListener('scroll', this._scrollListener, false);
11268
+ document.addEventListener('resize', this._scrollListener, false);
11269
+ } // Bind click listeners to disable animation.
11270
+
11271
+
11272
+ var timeout = null;
11273
+ this._clickListener = throttle(function (event) {
11274
+ if (options.scrollSmooth) {
11275
+ buildHtml.disableTocAnimation(event);
11276
+ }
11277
+
11278
+ buildHtml.updateToc(headingsArray); // Timeout to re-enable the animation.
11279
+
11280
+ timeout && clearTimeout(timeout);
11281
+ timeout = setTimeout(function () {
11282
+ buildHtml.enableTocAnimation();
11283
+ }, options.scrollSmoothDuration);
11284
+ }, options.throttleTimeout);
11285
+
11286
+ if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
11287
+ document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false);
11288
+ } else {
11289
+ document.addEventListener('click', this._clickListener, false);
11290
+ }
11291
+
11292
+ return this;
11293
+ };
11294
+ /**
11295
+ * Refresh tocbot.
11296
+ */
11297
+
11298
+
11299
+ tocbot.refresh = function (customOptions) {
11300
+ tocbot.destroy();
11301
+ tocbot.init(customOptions || this.options);
11302
+ }; // Make tocbot available globally.
11303
+
11304
+
11305
+ root.tocbot = tocbot;
11306
+ return tocbot;
11307
+ });
11308
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0)))
11309
+
11310
+ /***/ }),
11311
+ /* 26 */
11312
+ /***/ (function(module, exports) {
11313
+
11314
+ // -----------------------------------------------------------------------------
11315
+ // ESLint shimming
11316
+ // -----------------------------------------------------------------------------
11317
+
11318
+ /* eslint indent: "off" */
11319
+
11320
+ /* eslint no-undef: "off" */
11321
+
11322
+ /* eslint no-unused-vars: "off" */
11323
+ // -----------------------------------------------------------------------------
11324
+ module.exports = {
11325
+ // Where to render the table of contents.
11326
+ tocSelector: '.js-toc',
7452
11327
  // Where to grab the headings to build the table of contents.
7453
11328
  contentSelector: '.js-toc-content',
7454
11329
  // Which headings to grab inside of the contentSelector element.
@@ -7540,7 +11415,7 @@ module.exports = {
7540
11415
  };
7541
11416
 
7542
11417
  /***/ }),
7543
- /* 26 */
11418
+ /* 27 */
7544
11419
  /***/ (function(module, exports) {
7545
11420
 
7546
11421
  /**
@@ -7845,7 +11720,7 @@ module.exports = function (options) {
7845
11720
  };
7846
11721
 
7847
11722
  /***/ }),
7848
- /* 27 */
11723
+ /* 28 */
7849
11724
  /***/ (function(module, exports) {
7850
11725
 
7851
11726
  /**
@@ -8006,7 +11881,7 @@ module.exports = function parseContent(options) {
8006
11881
  };
8007
11882
 
8008
11883
  /***/ }),
8009
- /* 28 */
11884
+ /* 29 */
8010
11885
  /***/ (function(module, exports) {
8011
11886
 
8012
11887
  // -----------------------------------------------------------------------------
@@ -8032,7 +11907,7 @@ module.exports = function updateTocScroll(options) {
8032
11907
  };
8033
11908
 
8034
11909
  /***/ }),
8035
- /* 29 */
11910
+ /* 30 */
8036
11911
  /***/ (function(module, exports) {
8037
11912
 
8038
11913
  /*
@@ -8176,7 +12051,7 @@ function jump(target, options) {
8176
12051
  }
8177
12052
 
8178
12053
  /***/ }),
8179
- /* 30 */
12054
+ /* 31 */
8180
12055
  /***/ (function(module, exports) {
8181
12056
 
8182
12057
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
@@ -8458,7 +12333,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
8458
12333
  })(jQuery);
8459
12334
 
8460
12335
  /***/ }),
8461
- /* 31 */
12336
+ /* 32 */
8462
12337
  /***/ (function(module, exports) {
8463
12338
 
8464
12339
  /*