UNPKG

125 kBJavaScriptView Raw
1/*!
2 * @nuxt/vue-renderer v2.14.2 (c) 2016-2020
3
4 * - All the amazing contributors
5 * Released under the MIT License.
6 * Website: https://nuxtjs.org
7*/
8'use strict';
9
10Object.defineProperty(exports, '__esModule', { value: true });
11
12const path = require('path');
13const fs = require('fs-extra');
14const consola = require('consola');
15const utils = require('@nuxt/utils');
16const VueMeta = require('vue-meta');
17const vueServerRenderer = require('vue-server-renderer');
18const LRU = require('lru-cache');
19const devalue = require('@nuxt/devalue');
20const crypto = require('crypto');
21const util = require('util');
22
23function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
25const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
26const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
27const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
28const VueMeta__default = /*#__PURE__*/_interopDefaultLegacy(VueMeta);
29const LRU__default = /*#__PURE__*/_interopDefaultLegacy(LRU);
30const devalue__default = /*#__PURE__*/_interopDefaultLegacy(devalue);
31const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
32
33var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
34
35function createCommonjsModule(fn, basedir, module) {
36 return module = {
37 path: basedir,
38 exports: {},
39 require: function (path, base) {
40 return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
41 }
42 }, fn(module, module.exports), module.exports;
43}
44
45function commonjsRequire () {
46 throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
47}
48
49/** Detect free variable `global` from Node.js. */
50var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
51
52var _freeGlobal = freeGlobal;
53
54/** Detect free variable `self`. */
55var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
56
57/** Used as a reference to the global object. */
58var root = _freeGlobal || freeSelf || Function('return this')();
59
60var _root = root;
61
62/** Built-in value references. */
63var Symbol = _root.Symbol;
64
65var _Symbol = Symbol;
66
67/** Used for built-in method references. */
68var objectProto = Object.prototype;
69
70/** Used to check objects for own properties. */
71var hasOwnProperty = objectProto.hasOwnProperty;
72
73/**
74 * Used to resolve the
75 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
76 * of values.
77 */
78var nativeObjectToString = objectProto.toString;
79
80/** Built-in value references. */
81var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
82
83/**
84 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
85 *
86 * @private
87 * @param {*} value The value to query.
88 * @returns {string} Returns the raw `toStringTag`.
89 */
90function getRawTag(value) {
91 var isOwn = hasOwnProperty.call(value, symToStringTag),
92 tag = value[symToStringTag];
93
94 try {
95 value[symToStringTag] = undefined;
96 var unmasked = true;
97 } catch (e) {}
98
99 var result = nativeObjectToString.call(value);
100 if (unmasked) {
101 if (isOwn) {
102 value[symToStringTag] = tag;
103 } else {
104 delete value[symToStringTag];
105 }
106 }
107 return result;
108}
109
110var _getRawTag = getRawTag;
111
112/** Used for built-in method references. */
113var objectProto$1 = Object.prototype;
114
115/**
116 * Used to resolve the
117 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
118 * of values.
119 */
120var nativeObjectToString$1 = objectProto$1.toString;
121
122/**
123 * Converts `value` to a string using `Object.prototype.toString`.
124 *
125 * @private
126 * @param {*} value The value to convert.
127 * @returns {string} Returns the converted string.
128 */
129function objectToString(value) {
130 return nativeObjectToString$1.call(value);
131}
132
133var _objectToString = objectToString;
134
135/** `Object#toString` result references. */
136var nullTag = '[object Null]',
137 undefinedTag = '[object Undefined]';
138
139/** Built-in value references. */
140var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
141
142/**
143 * The base implementation of `getTag` without fallbacks for buggy environments.
144 *
145 * @private
146 * @param {*} value The value to query.
147 * @returns {string} Returns the `toStringTag`.
148 */
149function baseGetTag(value) {
150 if (value == null) {
151 return value === undefined ? undefinedTag : nullTag;
152 }
153 return (symToStringTag$1 && symToStringTag$1 in Object(value))
154 ? _getRawTag(value)
155 : _objectToString(value);
156}
157
158var _baseGetTag = baseGetTag;
159
160/**
161 * Checks if `value` is the
162 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
163 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
164 *
165 * @static
166 * @memberOf _
167 * @since 0.1.0
168 * @category Lang
169 * @param {*} value The value to check.
170 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
171 * @example
172 *
173 * _.isObject({});
174 * // => true
175 *
176 * _.isObject([1, 2, 3]);
177 * // => true
178 *
179 * _.isObject(_.noop);
180 * // => true
181 *
182 * _.isObject(null);
183 * // => false
184 */
185function isObject(value) {
186 var type = typeof value;
187 return value != null && (type == 'object' || type == 'function');
188}
189
190var isObject_1 = isObject;
191
192/** `Object#toString` result references. */
193var asyncTag = '[object AsyncFunction]',
194 funcTag = '[object Function]',
195 genTag = '[object GeneratorFunction]',
196 proxyTag = '[object Proxy]';
197
198/**
199 * Checks if `value` is classified as a `Function` object.
200 *
201 * @static
202 * @memberOf _
203 * @since 0.1.0
204 * @category Lang
205 * @param {*} value The value to check.
206 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
207 * @example
208 *
209 * _.isFunction(_);
210 * // => true
211 *
212 * _.isFunction(/abc/);
213 * // => false
214 */
215function isFunction(value) {
216 if (!isObject_1(value)) {
217 return false;
218 }
219 // The use of `Object#toString` avoids issues with the `typeof` operator
220 // in Safari 9 which returns 'object' for typed arrays and other constructors.
221 var tag = _baseGetTag(value);
222 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
223}
224
225var isFunction_1 = isFunction;
226
227/** Used to detect overreaching core-js shims. */
228var coreJsData = _root['__core-js_shared__'];
229
230var _coreJsData = coreJsData;
231
232/** Used to detect methods masquerading as native. */
233var maskSrcKey = (function() {
234 var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
235 return uid ? ('Symbol(src)_1.' + uid) : '';
236}());
237
238/**
239 * Checks if `func` has its source masked.
240 *
241 * @private
242 * @param {Function} func The function to check.
243 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
244 */
245function isMasked(func) {
246 return !!maskSrcKey && (maskSrcKey in func);
247}
248
249var _isMasked = isMasked;
250
251/** Used for built-in method references. */
252var funcProto = Function.prototype;
253
254/** Used to resolve the decompiled source of functions. */
255var funcToString = funcProto.toString;
256
257/**
258 * Converts `func` to its source code.
259 *
260 * @private
261 * @param {Function} func The function to convert.
262 * @returns {string} Returns the source code.
263 */
264function toSource(func) {
265 if (func != null) {
266 try {
267 return funcToString.call(func);
268 } catch (e) {}
269 try {
270 return (func + '');
271 } catch (e) {}
272 }
273 return '';
274}
275
276var _toSource = toSource;
277
278/**
279 * Used to match `RegExp`
280 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
281 */
282var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
283
284/** Used to detect host constructors (Safari). */
285var reIsHostCtor = /^\[object .+?Constructor\]$/;
286
287/** Used for built-in method references. */
288var funcProto$1 = Function.prototype,
289 objectProto$2 = Object.prototype;
290
291/** Used to resolve the decompiled source of functions. */
292var funcToString$1 = funcProto$1.toString;
293
294/** Used to check objects for own properties. */
295var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
296
297/** Used to detect if a method is native. */
298var reIsNative = RegExp('^' +
299 funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
300 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
301);
302
303/**
304 * The base implementation of `_.isNative` without bad shim checks.
305 *
306 * @private
307 * @param {*} value The value to check.
308 * @returns {boolean} Returns `true` if `value` is a native function,
309 * else `false`.
310 */
311function baseIsNative(value) {
312 if (!isObject_1(value) || _isMasked(value)) {
313 return false;
314 }
315 var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
316 return pattern.test(_toSource(value));
317}
318
319var _baseIsNative = baseIsNative;
320
321/**
322 * Gets the value at `key` of `object`.
323 *
324 * @private
325 * @param {Object} [object] The object to query.
326 * @param {string} key The key of the property to get.
327 * @returns {*} Returns the property value.
328 */
329function getValue(object, key) {
330 return object == null ? undefined : object[key];
331}
332
333var _getValue = getValue;
334
335/**
336 * Gets the native function at `key` of `object`.
337 *
338 * @private
339 * @param {Object} object The object to query.
340 * @param {string} key The key of the method to get.
341 * @returns {*} Returns the function if it's native, else `undefined`.
342 */
343function getNative(object, key) {
344 var value = _getValue(object, key);
345 return _baseIsNative(value) ? value : undefined;
346}
347
348var _getNative = getNative;
349
350var defineProperty = (function() {
351 try {
352 var func = _getNative(Object, 'defineProperty');
353 func({}, '', {});
354 return func;
355 } catch (e) {}
356}());
357
358var _defineProperty = defineProperty;
359
360/**
361 * The base implementation of `assignValue` and `assignMergeValue` without
362 * value checks.
363 *
364 * @private
365 * @param {Object} object The object to modify.
366 * @param {string} key The key of the property to assign.
367 * @param {*} value The value to assign.
368 */
369function baseAssignValue(object, key, value) {
370 if (key == '__proto__' && _defineProperty) {
371 _defineProperty(object, key, {
372 'configurable': true,
373 'enumerable': true,
374 'value': value,
375 'writable': true
376 });
377 } else {
378 object[key] = value;
379 }
380}
381
382var _baseAssignValue = baseAssignValue;
383
384/**
385 * Performs a
386 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
387 * comparison between two values to determine if they are equivalent.
388 *
389 * @static
390 * @memberOf _
391 * @since 4.0.0
392 * @category Lang
393 * @param {*} value The value to compare.
394 * @param {*} other The other value to compare.
395 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
396 * @example
397 *
398 * var object = { 'a': 1 };
399 * var other = { 'a': 1 };
400 *
401 * _.eq(object, object);
402 * // => true
403 *
404 * _.eq(object, other);
405 * // => false
406 *
407 * _.eq('a', 'a');
408 * // => true
409 *
410 * _.eq('a', Object('a'));
411 * // => false
412 *
413 * _.eq(NaN, NaN);
414 * // => true
415 */
416function eq(value, other) {
417 return value === other || (value !== value && other !== other);
418}
419
420var eq_1 = eq;
421
422/** Used for built-in method references. */
423var objectProto$3 = Object.prototype;
424
425/** Used to check objects for own properties. */
426var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
427
428/**
429 * Assigns `value` to `key` of `object` if the existing value is not equivalent
430 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
431 * for equality comparisons.
432 *
433 * @private
434 * @param {Object} object The object to modify.
435 * @param {string} key The key of the property to assign.
436 * @param {*} value The value to assign.
437 */
438function assignValue(object, key, value) {
439 var objValue = object[key];
440 if (!(hasOwnProperty$2.call(object, key) && eq_1(objValue, value)) ||
441 (value === undefined && !(key in object))) {
442 _baseAssignValue(object, key, value);
443 }
444}
445
446var _assignValue = assignValue;
447
448/**
449 * Copies properties of `source` to `object`.
450 *
451 * @private
452 * @param {Object} source The object to copy properties from.
453 * @param {Array} props The property identifiers to copy.
454 * @param {Object} [object={}] The object to copy properties to.
455 * @param {Function} [customizer] The function to customize copied values.
456 * @returns {Object} Returns `object`.
457 */
458function copyObject(source, props, object, customizer) {
459 var isNew = !object;
460 object || (object = {});
461
462 var index = -1,
463 length = props.length;
464
465 while (++index < length) {
466 var key = props[index];
467
468 var newValue = customizer
469 ? customizer(object[key], source[key], key, object, source)
470 : undefined;
471
472 if (newValue === undefined) {
473 newValue = source[key];
474 }
475 if (isNew) {
476 _baseAssignValue(object, key, newValue);
477 } else {
478 _assignValue(object, key, newValue);
479 }
480 }
481 return object;
482}
483
484var _copyObject = copyObject;
485
486/**
487 * This method returns the first argument it receives.
488 *
489 * @static
490 * @since 0.1.0
491 * @memberOf _
492 * @category Util
493 * @param {*} value Any value.
494 * @returns {*} Returns `value`.
495 * @example
496 *
497 * var object = { 'a': 1 };
498 *
499 * console.log(_.identity(object) === object);
500 * // => true
501 */
502function identity(value) {
503 return value;
504}
505
506var identity_1 = identity;
507
508/**
509 * A faster alternative to `Function#apply`, this function invokes `func`
510 * with the `this` binding of `thisArg` and the arguments of `args`.
511 *
512 * @private
513 * @param {Function} func The function to invoke.
514 * @param {*} thisArg The `this` binding of `func`.
515 * @param {Array} args The arguments to invoke `func` with.
516 * @returns {*} Returns the result of `func`.
517 */
518function apply(func, thisArg, args) {
519 switch (args.length) {
520 case 0: return func.call(thisArg);
521 case 1: return func.call(thisArg, args[0]);
522 case 2: return func.call(thisArg, args[0], args[1]);
523 case 3: return func.call(thisArg, args[0], args[1], args[2]);
524 }
525 return func.apply(thisArg, args);
526}
527
528var _apply = apply;
529
530/* Built-in method references for those with the same name as other `lodash` methods. */
531var nativeMax = Math.max;
532
533/**
534 * A specialized version of `baseRest` which transforms the rest array.
535 *
536 * @private
537 * @param {Function} func The function to apply a rest parameter to.
538 * @param {number} [start=func.length-1] The start position of the rest parameter.
539 * @param {Function} transform The rest array transform.
540 * @returns {Function} Returns the new function.
541 */
542function overRest(func, start, transform) {
543 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
544 return function() {
545 var args = arguments,
546 index = -1,
547 length = nativeMax(args.length - start, 0),
548 array = Array(length);
549
550 while (++index < length) {
551 array[index] = args[start + index];
552 }
553 index = -1;
554 var otherArgs = Array(start + 1);
555 while (++index < start) {
556 otherArgs[index] = args[index];
557 }
558 otherArgs[start] = transform(array);
559 return _apply(func, this, otherArgs);
560 };
561}
562
563var _overRest = overRest;
564
565/**
566 * Creates a function that returns `value`.
567 *
568 * @static
569 * @memberOf _
570 * @since 2.4.0
571 * @category Util
572 * @param {*} value The value to return from the new function.
573 * @returns {Function} Returns the new constant function.
574 * @example
575 *
576 * var objects = _.times(2, _.constant({ 'a': 1 }));
577 *
578 * console.log(objects);
579 * // => [{ 'a': 1 }, { 'a': 1 }]
580 *
581 * console.log(objects[0] === objects[1]);
582 * // => true
583 */
584function constant(value) {
585 return function() {
586 return value;
587 };
588}
589
590var constant_1 = constant;
591
592/**
593 * The base implementation of `setToString` without support for hot loop shorting.
594 *
595 * @private
596 * @param {Function} func The function to modify.
597 * @param {Function} string The `toString` result.
598 * @returns {Function} Returns `func`.
599 */
600var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
601 return _defineProperty(func, 'toString', {
602 'configurable': true,
603 'enumerable': false,
604 'value': constant_1(string),
605 'writable': true
606 });
607};
608
609var _baseSetToString = baseSetToString;
610
611/** Used to detect hot functions by number of calls within a span of milliseconds. */
612var HOT_COUNT = 800,
613 HOT_SPAN = 16;
614
615/* Built-in method references for those with the same name as other `lodash` methods. */
616var nativeNow = Date.now;
617
618/**
619 * Creates a function that'll short out and invoke `identity` instead
620 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
621 * milliseconds.
622 *
623 * @private
624 * @param {Function} func The function to restrict.
625 * @returns {Function} Returns the new shortable function.
626 */
627function shortOut(func) {
628 var count = 0,
629 lastCalled = 0;
630
631 return function() {
632 var stamp = nativeNow(),
633 remaining = HOT_SPAN - (stamp - lastCalled);
634
635 lastCalled = stamp;
636 if (remaining > 0) {
637 if (++count >= HOT_COUNT) {
638 return arguments[0];
639 }
640 } else {
641 count = 0;
642 }
643 return func.apply(undefined, arguments);
644 };
645}
646
647var _shortOut = shortOut;
648
649/**
650 * Sets the `toString` method of `func` to return `string`.
651 *
652 * @private
653 * @param {Function} func The function to modify.
654 * @param {Function} string The `toString` result.
655 * @returns {Function} Returns `func`.
656 */
657var setToString = _shortOut(_baseSetToString);
658
659var _setToString = setToString;
660
661/**
662 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
663 *
664 * @private
665 * @param {Function} func The function to apply a rest parameter to.
666 * @param {number} [start=func.length-1] The start position of the rest parameter.
667 * @returns {Function} Returns the new function.
668 */
669function baseRest(func, start) {
670 return _setToString(_overRest(func, start, identity_1), func + '');
671}
672
673var _baseRest = baseRest;
674
675/** Used as references for various `Number` constants. */
676var MAX_SAFE_INTEGER = 9007199254740991;
677
678/**
679 * Checks if `value` is a valid array-like length.
680 *
681 * **Note:** This method is loosely based on
682 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
683 *
684 * @static
685 * @memberOf _
686 * @since 4.0.0
687 * @category Lang
688 * @param {*} value The value to check.
689 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
690 * @example
691 *
692 * _.isLength(3);
693 * // => true
694 *
695 * _.isLength(Number.MIN_VALUE);
696 * // => false
697 *
698 * _.isLength(Infinity);
699 * // => false
700 *
701 * _.isLength('3');
702 * // => false
703 */
704function isLength(value) {
705 return typeof value == 'number' &&
706 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
707}
708
709var isLength_1 = isLength;
710
711/**
712 * Checks if `value` is array-like. A value is considered array-like if it's
713 * not a function and has a `value.length` that's an integer greater than or
714 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
715 *
716 * @static
717 * @memberOf _
718 * @since 4.0.0
719 * @category Lang
720 * @param {*} value The value to check.
721 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
722 * @example
723 *
724 * _.isArrayLike([1, 2, 3]);
725 * // => true
726 *
727 * _.isArrayLike(document.body.children);
728 * // => true
729 *
730 * _.isArrayLike('abc');
731 * // => true
732 *
733 * _.isArrayLike(_.noop);
734 * // => false
735 */
736function isArrayLike(value) {
737 return value != null && isLength_1(value.length) && !isFunction_1(value);
738}
739
740var isArrayLike_1 = isArrayLike;
741
742/** Used as references for various `Number` constants. */
743var MAX_SAFE_INTEGER$1 = 9007199254740991;
744
745/** Used to detect unsigned integer values. */
746var reIsUint = /^(?:0|[1-9]\d*)$/;
747
748/**
749 * Checks if `value` is a valid array-like index.
750 *
751 * @private
752 * @param {*} value The value to check.
753 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
754 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
755 */
756function isIndex(value, length) {
757 var type = typeof value;
758 length = length == null ? MAX_SAFE_INTEGER$1 : length;
759
760 return !!length &&
761 (type == 'number' ||
762 (type != 'symbol' && reIsUint.test(value))) &&
763 (value > -1 && value % 1 == 0 && value < length);
764}
765
766var _isIndex = isIndex;
767
768/**
769 * Checks if the given arguments are from an iteratee call.
770 *
771 * @private
772 * @param {*} value The potential iteratee value argument.
773 * @param {*} index The potential iteratee index or key argument.
774 * @param {*} object The potential iteratee object argument.
775 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
776 * else `false`.
777 */
778function isIterateeCall(value, index, object) {
779 if (!isObject_1(object)) {
780 return false;
781 }
782 var type = typeof index;
783 if (type == 'number'
784 ? (isArrayLike_1(object) && _isIndex(index, object.length))
785 : (type == 'string' && index in object)
786 ) {
787 return eq_1(object[index], value);
788 }
789 return false;
790}
791
792var _isIterateeCall = isIterateeCall;
793
794/**
795 * Creates a function like `_.assign`.
796 *
797 * @private
798 * @param {Function} assigner The function to assign values.
799 * @returns {Function} Returns the new assigner function.
800 */
801function createAssigner(assigner) {
802 return _baseRest(function(object, sources) {
803 var index = -1,
804 length = sources.length,
805 customizer = length > 1 ? sources[length - 1] : undefined,
806 guard = length > 2 ? sources[2] : undefined;
807
808 customizer = (assigner.length > 3 && typeof customizer == 'function')
809 ? (length--, customizer)
810 : undefined;
811
812 if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
813 customizer = length < 3 ? undefined : customizer;
814 length = 1;
815 }
816 object = Object(object);
817 while (++index < length) {
818 var source = sources[index];
819 if (source) {
820 assigner(object, source, index, customizer);
821 }
822 }
823 return object;
824 });
825}
826
827var _createAssigner = createAssigner;
828
829/**
830 * The base implementation of `_.times` without support for iteratee shorthands
831 * or max array length checks.
832 *
833 * @private
834 * @param {number} n The number of times to invoke `iteratee`.
835 * @param {Function} iteratee The function invoked per iteration.
836 * @returns {Array} Returns the array of results.
837 */
838function baseTimes(n, iteratee) {
839 var index = -1,
840 result = Array(n);
841
842 while (++index < n) {
843 result[index] = iteratee(index);
844 }
845 return result;
846}
847
848var _baseTimes = baseTimes;
849
850/**
851 * Checks if `value` is object-like. A value is object-like if it's not `null`
852 * and has a `typeof` result of "object".
853 *
854 * @static
855 * @memberOf _
856 * @since 4.0.0
857 * @category Lang
858 * @param {*} value The value to check.
859 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
860 * @example
861 *
862 * _.isObjectLike({});
863 * // => true
864 *
865 * _.isObjectLike([1, 2, 3]);
866 * // => true
867 *
868 * _.isObjectLike(_.noop);
869 * // => false
870 *
871 * _.isObjectLike(null);
872 * // => false
873 */
874function isObjectLike(value) {
875 return value != null && typeof value == 'object';
876}
877
878var isObjectLike_1 = isObjectLike;
879
880/** `Object#toString` result references. */
881var argsTag = '[object Arguments]';
882
883/**
884 * The base implementation of `_.isArguments`.
885 *
886 * @private
887 * @param {*} value The value to check.
888 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
889 */
890function baseIsArguments(value) {
891 return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
892}
893
894var _baseIsArguments = baseIsArguments;
895
896/** Used for built-in method references. */
897var objectProto$4 = Object.prototype;
898
899/** Used to check objects for own properties. */
900var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
901
902/** Built-in value references. */
903var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
904
905/**
906 * Checks if `value` is likely an `arguments` object.
907 *
908 * @static
909 * @memberOf _
910 * @since 0.1.0
911 * @category Lang
912 * @param {*} value The value to check.
913 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
914 * else `false`.
915 * @example
916 *
917 * _.isArguments(function() { return arguments; }());
918 * // => true
919 *
920 * _.isArguments([1, 2, 3]);
921 * // => false
922 */
923var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
924 return isObjectLike_1(value) && hasOwnProperty$3.call(value, 'callee') &&
925 !propertyIsEnumerable.call(value, 'callee');
926};
927
928var isArguments_1 = isArguments;
929
930/**
931 * Checks if `value` is classified as an `Array` object.
932 *
933 * @static
934 * @memberOf _
935 * @since 0.1.0
936 * @category Lang
937 * @param {*} value The value to check.
938 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
939 * @example
940 *
941 * _.isArray([1, 2, 3]);
942 * // => true
943 *
944 * _.isArray(document.body.children);
945 * // => false
946 *
947 * _.isArray('abc');
948 * // => false
949 *
950 * _.isArray(_.noop);
951 * // => false
952 */
953var isArray = Array.isArray;
954
955var isArray_1 = isArray;
956
957/**
958 * This method returns `false`.
959 *
960 * @static
961 * @memberOf _
962 * @since 4.13.0
963 * @category Util
964 * @returns {boolean} Returns `false`.
965 * @example
966 *
967 * _.times(2, _.stubFalse);
968 * // => [false, false]
969 */
970function stubFalse() {
971 return false;
972}
973
974var stubFalse_1 = stubFalse;
975
976var isBuffer_1 = createCommonjsModule(function (module, exports) {
977/** Detect free variable `exports`. */
978var freeExports = exports && !exports.nodeType && exports;
979
980/** Detect free variable `module`. */
981var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
982
983/** Detect the popular CommonJS extension `module.exports`. */
984var moduleExports = freeModule && freeModule.exports === freeExports;
985
986/** Built-in value references. */
987var Buffer = moduleExports ? _root.Buffer : undefined;
988
989/* Built-in method references for those with the same name as other `lodash` methods. */
990var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
991
992/**
993 * Checks if `value` is a buffer.
994 *
995 * @static
996 * @memberOf _
997 * @since 4.3.0
998 * @category Lang
999 * @param {*} value The value to check.
1000 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1001 * @example
1002 *
1003 * _.isBuffer(new Buffer(2));
1004 * // => true
1005 *
1006 * _.isBuffer(new Uint8Array(2));
1007 * // => false
1008 */
1009var isBuffer = nativeIsBuffer || stubFalse_1;
1010
1011module.exports = isBuffer;
1012});
1013
1014/** `Object#toString` result references. */
1015var argsTag$1 = '[object Arguments]',
1016 arrayTag = '[object Array]',
1017 boolTag = '[object Boolean]',
1018 dateTag = '[object Date]',
1019 errorTag = '[object Error]',
1020 funcTag$1 = '[object Function]',
1021 mapTag = '[object Map]',
1022 numberTag = '[object Number]',
1023 objectTag = '[object Object]',
1024 regexpTag = '[object RegExp]',
1025 setTag = '[object Set]',
1026 stringTag = '[object String]',
1027 weakMapTag = '[object WeakMap]';
1028
1029var arrayBufferTag = '[object ArrayBuffer]',
1030 dataViewTag = '[object DataView]',
1031 float32Tag = '[object Float32Array]',
1032 float64Tag = '[object Float64Array]',
1033 int8Tag = '[object Int8Array]',
1034 int16Tag = '[object Int16Array]',
1035 int32Tag = '[object Int32Array]',
1036 uint8Tag = '[object Uint8Array]',
1037 uint8ClampedTag = '[object Uint8ClampedArray]',
1038 uint16Tag = '[object Uint16Array]',
1039 uint32Tag = '[object Uint32Array]';
1040
1041/** Used to identify `toStringTag` values of typed arrays. */
1042var typedArrayTags = {};
1043typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1044typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1045typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1046typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1047typedArrayTags[uint32Tag] = true;
1048typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
1049typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1050typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
1051typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
1052typedArrayTags[mapTag] = typedArrayTags[numberTag] =
1053typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
1054typedArrayTags[setTag] = typedArrayTags[stringTag] =
1055typedArrayTags[weakMapTag] = false;
1056
1057/**
1058 * The base implementation of `_.isTypedArray` without Node.js optimizations.
1059 *
1060 * @private
1061 * @param {*} value The value to check.
1062 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1063 */
1064function baseIsTypedArray(value) {
1065 return isObjectLike_1(value) &&
1066 isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
1067}
1068
1069var _baseIsTypedArray = baseIsTypedArray;
1070
1071/**
1072 * The base implementation of `_.unary` without support for storing metadata.
1073 *
1074 * @private
1075 * @param {Function} func The function to cap arguments for.
1076 * @returns {Function} Returns the new capped function.
1077 */
1078function baseUnary(func) {
1079 return function(value) {
1080 return func(value);
1081 };
1082}
1083
1084var _baseUnary = baseUnary;
1085
1086var _nodeUtil = createCommonjsModule(function (module, exports) {
1087/** Detect free variable `exports`. */
1088var freeExports = exports && !exports.nodeType && exports;
1089
1090/** Detect free variable `module`. */
1091var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1092
1093/** Detect the popular CommonJS extension `module.exports`. */
1094var moduleExports = freeModule && freeModule.exports === freeExports;
1095
1096/** Detect free variable `process` from Node.js. */
1097var freeProcess = moduleExports && _freeGlobal.process;
1098
1099/** Used to access faster Node.js helpers. */
1100var nodeUtil = (function() {
1101 try {
1102 // Use `util.types` for Node.js 10+.
1103 var types = freeModule && freeModule.require && freeModule.require('util').types;
1104
1105 if (types) {
1106 return types;
1107 }
1108
1109 // Legacy `process.binding('util')` for Node.js < 10.
1110 return freeProcess && freeProcess.binding && freeProcess.binding('util');
1111 } catch (e) {}
1112}());
1113
1114module.exports = nodeUtil;
1115});
1116
1117/* Node.js helper references. */
1118var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
1119
1120/**
1121 * Checks if `value` is classified as a typed array.
1122 *
1123 * @static
1124 * @memberOf _
1125 * @since 3.0.0
1126 * @category Lang
1127 * @param {*} value The value to check.
1128 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1129 * @example
1130 *
1131 * _.isTypedArray(new Uint8Array);
1132 * // => true
1133 *
1134 * _.isTypedArray([]);
1135 * // => false
1136 */
1137var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
1138
1139var isTypedArray_1 = isTypedArray;
1140
1141/** Used for built-in method references. */
1142var objectProto$5 = Object.prototype;
1143
1144/** Used to check objects for own properties. */
1145var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1146
1147/**
1148 * Creates an array of the enumerable property names of the array-like `value`.
1149 *
1150 * @private
1151 * @param {*} value The value to query.
1152 * @param {boolean} inherited Specify returning inherited property names.
1153 * @returns {Array} Returns the array of property names.
1154 */
1155function arrayLikeKeys(value, inherited) {
1156 var isArr = isArray_1(value),
1157 isArg = !isArr && isArguments_1(value),
1158 isBuff = !isArr && !isArg && isBuffer_1(value),
1159 isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
1160 skipIndexes = isArr || isArg || isBuff || isType,
1161 result = skipIndexes ? _baseTimes(value.length, String) : [],
1162 length = result.length;
1163
1164 for (var key in value) {
1165 if ((inherited || hasOwnProperty$4.call(value, key)) &&
1166 !(skipIndexes && (
1167 // Safari 9 has enumerable `arguments.length` in strict mode.
1168 key == 'length' ||
1169 // Node.js 0.10 has enumerable non-index properties on buffers.
1170 (isBuff && (key == 'offset' || key == 'parent')) ||
1171 // PhantomJS 2 has enumerable non-index properties on typed arrays.
1172 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1173 // Skip index properties.
1174 _isIndex(key, length)
1175 ))) {
1176 result.push(key);
1177 }
1178 }
1179 return result;
1180}
1181
1182var _arrayLikeKeys = arrayLikeKeys;
1183
1184/** Used for built-in method references. */
1185var objectProto$6 = Object.prototype;
1186
1187/**
1188 * Checks if `value` is likely a prototype object.
1189 *
1190 * @private
1191 * @param {*} value The value to check.
1192 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1193 */
1194function isPrototype(value) {
1195 var Ctor = value && value.constructor,
1196 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
1197
1198 return value === proto;
1199}
1200
1201var _isPrototype = isPrototype;
1202
1203/**
1204 * This function is like
1205 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1206 * except that it includes inherited enumerable properties.
1207 *
1208 * @private
1209 * @param {Object} object The object to query.
1210 * @returns {Array} Returns the array of property names.
1211 */
1212function nativeKeysIn(object) {
1213 var result = [];
1214 if (object != null) {
1215 for (var key in Object(object)) {
1216 result.push(key);
1217 }
1218 }
1219 return result;
1220}
1221
1222var _nativeKeysIn = nativeKeysIn;
1223
1224/** Used for built-in method references. */
1225var objectProto$7 = Object.prototype;
1226
1227/** Used to check objects for own properties. */
1228var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1229
1230/**
1231 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
1232 *
1233 * @private
1234 * @param {Object} object The object to query.
1235 * @returns {Array} Returns the array of property names.
1236 */
1237function baseKeysIn(object) {
1238 if (!isObject_1(object)) {
1239 return _nativeKeysIn(object);
1240 }
1241 var isProto = _isPrototype(object),
1242 result = [];
1243
1244 for (var key in object) {
1245 if (!(key == 'constructor' && (isProto || !hasOwnProperty$5.call(object, key)))) {
1246 result.push(key);
1247 }
1248 }
1249 return result;
1250}
1251
1252var _baseKeysIn = baseKeysIn;
1253
1254/**
1255 * Creates an array of the own and inherited enumerable property names of `object`.
1256 *
1257 * **Note:** Non-object values are coerced to objects.
1258 *
1259 * @static
1260 * @memberOf _
1261 * @since 3.0.0
1262 * @category Object
1263 * @param {Object} object The object to query.
1264 * @returns {Array} Returns the array of property names.
1265 * @example
1266 *
1267 * function Foo() {
1268 * this.a = 1;
1269 * this.b = 2;
1270 * }
1271 *
1272 * Foo.prototype.c = 3;
1273 *
1274 * _.keysIn(new Foo);
1275 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1276 */
1277function keysIn(object) {
1278 return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
1279}
1280
1281var keysIn_1 = keysIn;
1282
1283/**
1284 * This method is like `_.assignIn` except that it accepts `customizer`
1285 * which is invoked to produce the assigned values. If `customizer` returns
1286 * `undefined`, assignment is handled by the method instead. The `customizer`
1287 * is invoked with five arguments: (objValue, srcValue, key, object, source).
1288 *
1289 * **Note:** This method mutates `object`.
1290 *
1291 * @static
1292 * @memberOf _
1293 * @since 4.0.0
1294 * @alias extendWith
1295 * @category Object
1296 * @param {Object} object The destination object.
1297 * @param {...Object} sources The source objects.
1298 * @param {Function} [customizer] The function to customize assigned values.
1299 * @returns {Object} Returns `object`.
1300 * @see _.assignWith
1301 * @example
1302 *
1303 * function customizer(objValue, srcValue) {
1304 * return _.isUndefined(objValue) ? srcValue : objValue;
1305 * }
1306 *
1307 * var defaults = _.partialRight(_.assignInWith, customizer);
1308 *
1309 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
1310 * // => { 'a': 1, 'b': 2 }
1311 */
1312var assignInWith = _createAssigner(function(object, source, srcIndex, customizer) {
1313 _copyObject(source, keysIn_1(source), object, customizer);
1314});
1315
1316var assignInWith_1 = assignInWith;
1317
1318/**
1319 * Creates a unary function that invokes `func` with its argument transformed.
1320 *
1321 * @private
1322 * @param {Function} func The function to wrap.
1323 * @param {Function} transform The argument transform.
1324 * @returns {Function} Returns the new function.
1325 */
1326function overArg(func, transform) {
1327 return function(arg) {
1328 return func(transform(arg));
1329 };
1330}
1331
1332var _overArg = overArg;
1333
1334/** Built-in value references. */
1335var getPrototype = _overArg(Object.getPrototypeOf, Object);
1336
1337var _getPrototype = getPrototype;
1338
1339/** `Object#toString` result references. */
1340var objectTag$1 = '[object Object]';
1341
1342/** Used for built-in method references. */
1343var funcProto$2 = Function.prototype,
1344 objectProto$8 = Object.prototype;
1345
1346/** Used to resolve the decompiled source of functions. */
1347var funcToString$2 = funcProto$2.toString;
1348
1349/** Used to check objects for own properties. */
1350var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1351
1352/** Used to infer the `Object` constructor. */
1353var objectCtorString = funcToString$2.call(Object);
1354
1355/**
1356 * Checks if `value` is a plain object, that is, an object created by the
1357 * `Object` constructor or one with a `[[Prototype]]` of `null`.
1358 *
1359 * @static
1360 * @memberOf _
1361 * @since 0.8.0
1362 * @category Lang
1363 * @param {*} value The value to check.
1364 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
1365 * @example
1366 *
1367 * function Foo() {
1368 * this.a = 1;
1369 * }
1370 *
1371 * _.isPlainObject(new Foo);
1372 * // => false
1373 *
1374 * _.isPlainObject([1, 2, 3]);
1375 * // => false
1376 *
1377 * _.isPlainObject({ 'x': 0, 'y': 0 });
1378 * // => true
1379 *
1380 * _.isPlainObject(Object.create(null));
1381 * // => true
1382 */
1383function isPlainObject(value) {
1384 if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$1) {
1385 return false;
1386 }
1387 var proto = _getPrototype(value);
1388 if (proto === null) {
1389 return true;
1390 }
1391 var Ctor = hasOwnProperty$6.call(proto, 'constructor') && proto.constructor;
1392 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
1393 funcToString$2.call(Ctor) == objectCtorString;
1394}
1395
1396var isPlainObject_1 = isPlainObject;
1397
1398/** `Object#toString` result references. */
1399var domExcTag = '[object DOMException]',
1400 errorTag$1 = '[object Error]';
1401
1402/**
1403 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
1404 * `SyntaxError`, `TypeError`, or `URIError` object.
1405 *
1406 * @static
1407 * @memberOf _
1408 * @since 3.0.0
1409 * @category Lang
1410 * @param {*} value The value to check.
1411 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
1412 * @example
1413 *
1414 * _.isError(new Error);
1415 * // => true
1416 *
1417 * _.isError(Error);
1418 * // => false
1419 */
1420function isError(value) {
1421 if (!isObjectLike_1(value)) {
1422 return false;
1423 }
1424 var tag = _baseGetTag(value);
1425 return tag == errorTag$1 || tag == domExcTag ||
1426 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject_1(value));
1427}
1428
1429var isError_1 = isError;
1430
1431/**
1432 * Attempts to invoke `func`, returning either the result or the caught error
1433 * object. Any additional arguments are provided to `func` when it's invoked.
1434 *
1435 * @static
1436 * @memberOf _
1437 * @since 3.0.0
1438 * @category Util
1439 * @param {Function} func The function to attempt.
1440 * @param {...*} [args] The arguments to invoke `func` with.
1441 * @returns {*} Returns the `func` result or error object.
1442 * @example
1443 *
1444 * // Avoid throwing errors for invalid selectors.
1445 * var elements = _.attempt(function(selector) {
1446 * return document.querySelectorAll(selector);
1447 * }, '>_>');
1448 *
1449 * if (_.isError(elements)) {
1450 * elements = [];
1451 * }
1452 */
1453var attempt = _baseRest(function(func, args) {
1454 try {
1455 return _apply(func, undefined, args);
1456 } catch (e) {
1457 return isError_1(e) ? e : new Error(e);
1458 }
1459});
1460
1461var attempt_1 = attempt;
1462
1463/**
1464 * A specialized version of `_.map` for arrays without support for iteratee
1465 * shorthands.
1466 *
1467 * @private
1468 * @param {Array} [array] The array to iterate over.
1469 * @param {Function} iteratee The function invoked per iteration.
1470 * @returns {Array} Returns the new mapped array.
1471 */
1472function arrayMap(array, iteratee) {
1473 var index = -1,
1474 length = array == null ? 0 : array.length,
1475 result = Array(length);
1476
1477 while (++index < length) {
1478 result[index] = iteratee(array[index], index, array);
1479 }
1480 return result;
1481}
1482
1483var _arrayMap = arrayMap;
1484
1485/**
1486 * The base implementation of `_.values` and `_.valuesIn` which creates an
1487 * array of `object` property values corresponding to the property names
1488 * of `props`.
1489 *
1490 * @private
1491 * @param {Object} object The object to query.
1492 * @param {Array} props The property names to get values for.
1493 * @returns {Object} Returns the array of property values.
1494 */
1495function baseValues(object, props) {
1496 return _arrayMap(props, function(key) {
1497 return object[key];
1498 });
1499}
1500
1501var _baseValues = baseValues;
1502
1503/** Used for built-in method references. */
1504var objectProto$9 = Object.prototype;
1505
1506/** Used to check objects for own properties. */
1507var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1508
1509/**
1510 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
1511 * of source objects to the destination object for all destination properties
1512 * that resolve to `undefined`.
1513 *
1514 * @private
1515 * @param {*} objValue The destination value.
1516 * @param {*} srcValue The source value.
1517 * @param {string} key The key of the property to assign.
1518 * @param {Object} object The parent object of `objValue`.
1519 * @returns {*} Returns the value to assign.
1520 */
1521function customDefaultsAssignIn(objValue, srcValue, key, object) {
1522 if (objValue === undefined ||
1523 (eq_1(objValue, objectProto$9[key]) && !hasOwnProperty$7.call(object, key))) {
1524 return srcValue;
1525 }
1526 return objValue;
1527}
1528
1529var _customDefaultsAssignIn = customDefaultsAssignIn;
1530
1531/** Used to escape characters for inclusion in compiled string literals. */
1532var stringEscapes = {
1533 '\\': '\\',
1534 "'": "'",
1535 '\n': 'n',
1536 '\r': 'r',
1537 '\u2028': 'u2028',
1538 '\u2029': 'u2029'
1539};
1540
1541/**
1542 * Used by `_.template` to escape characters for inclusion in compiled string literals.
1543 *
1544 * @private
1545 * @param {string} chr The matched character to escape.
1546 * @returns {string} Returns the escaped character.
1547 */
1548function escapeStringChar(chr) {
1549 return '\\' + stringEscapes[chr];
1550}
1551
1552var _escapeStringChar = escapeStringChar;
1553
1554/* Built-in method references for those with the same name as other `lodash` methods. */
1555var nativeKeys = _overArg(Object.keys, Object);
1556
1557var _nativeKeys = nativeKeys;
1558
1559/** Used for built-in method references. */
1560var objectProto$a = Object.prototype;
1561
1562/** Used to check objects for own properties. */
1563var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1564
1565/**
1566 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1567 *
1568 * @private
1569 * @param {Object} object The object to query.
1570 * @returns {Array} Returns the array of property names.
1571 */
1572function baseKeys(object) {
1573 if (!_isPrototype(object)) {
1574 return _nativeKeys(object);
1575 }
1576 var result = [];
1577 for (var key in Object(object)) {
1578 if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
1579 result.push(key);
1580 }
1581 }
1582 return result;
1583}
1584
1585var _baseKeys = baseKeys;
1586
1587/**
1588 * Creates an array of the own enumerable property names of `object`.
1589 *
1590 * **Note:** Non-object values are coerced to objects. See the
1591 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1592 * for more details.
1593 *
1594 * @static
1595 * @since 0.1.0
1596 * @memberOf _
1597 * @category Object
1598 * @param {Object} object The object to query.
1599 * @returns {Array} Returns the array of property names.
1600 * @example
1601 *
1602 * function Foo() {
1603 * this.a = 1;
1604 * this.b = 2;
1605 * }
1606 *
1607 * Foo.prototype.c = 3;
1608 *
1609 * _.keys(new Foo);
1610 * // => ['a', 'b'] (iteration order is not guaranteed)
1611 *
1612 * _.keys('hi');
1613 * // => ['0', '1']
1614 */
1615function keys(object) {
1616 return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
1617}
1618
1619var keys_1 = keys;
1620
1621/** Used to match template delimiters. */
1622var reInterpolate = /<%=([\s\S]+?)%>/g;
1623
1624var _reInterpolate = reInterpolate;
1625
1626/**
1627 * The base implementation of `_.propertyOf` without support for deep paths.
1628 *
1629 * @private
1630 * @param {Object} object The object to query.
1631 * @returns {Function} Returns the new accessor function.
1632 */
1633function basePropertyOf(object) {
1634 return function(key) {
1635 return object == null ? undefined : object[key];
1636 };
1637}
1638
1639var _basePropertyOf = basePropertyOf;
1640
1641/** Used to map characters to HTML entities. */
1642var htmlEscapes = {
1643 '&': '&amp;',
1644 '<': '&lt;',
1645 '>': '&gt;',
1646 '"': '&quot;',
1647 "'": '&#39;'
1648};
1649
1650/**
1651 * Used by `_.escape` to convert characters to HTML entities.
1652 *
1653 * @private
1654 * @param {string} chr The matched character to escape.
1655 * @returns {string} Returns the escaped character.
1656 */
1657var escapeHtmlChar = _basePropertyOf(htmlEscapes);
1658
1659var _escapeHtmlChar = escapeHtmlChar;
1660
1661/** `Object#toString` result references. */
1662var symbolTag = '[object Symbol]';
1663
1664/**
1665 * Checks if `value` is classified as a `Symbol` primitive or object.
1666 *
1667 * @static
1668 * @memberOf _
1669 * @since 4.0.0
1670 * @category Lang
1671 * @param {*} value The value to check.
1672 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1673 * @example
1674 *
1675 * _.isSymbol(Symbol.iterator);
1676 * // => true
1677 *
1678 * _.isSymbol('abc');
1679 * // => false
1680 */
1681function isSymbol(value) {
1682 return typeof value == 'symbol' ||
1683 (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
1684}
1685
1686var isSymbol_1 = isSymbol;
1687
1688/** Used as references for various `Number` constants. */
1689var INFINITY = 1 / 0;
1690
1691/** Used to convert symbols to primitives and strings. */
1692var symbolProto = _Symbol ? _Symbol.prototype : undefined,
1693 symbolToString = symbolProto ? symbolProto.toString : undefined;
1694
1695/**
1696 * The base implementation of `_.toString` which doesn't convert nullish
1697 * values to empty strings.
1698 *
1699 * @private
1700 * @param {*} value The value to process.
1701 * @returns {string} Returns the string.
1702 */
1703function baseToString(value) {
1704 // Exit early for strings to avoid a performance hit in some environments.
1705 if (typeof value == 'string') {
1706 return value;
1707 }
1708 if (isArray_1(value)) {
1709 // Recursively convert values (susceptible to call stack limits).
1710 return _arrayMap(value, baseToString) + '';
1711 }
1712 if (isSymbol_1(value)) {
1713 return symbolToString ? symbolToString.call(value) : '';
1714 }
1715 var result = (value + '');
1716 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1717}
1718
1719var _baseToString = baseToString;
1720
1721/**
1722 * Converts `value` to a string. An empty string is returned for `null`
1723 * and `undefined` values. The sign of `-0` is preserved.
1724 *
1725 * @static
1726 * @memberOf _
1727 * @since 4.0.0
1728 * @category Lang
1729 * @param {*} value The value to convert.
1730 * @returns {string} Returns the converted string.
1731 * @example
1732 *
1733 * _.toString(null);
1734 * // => ''
1735 *
1736 * _.toString(-0);
1737 * // => '-0'
1738 *
1739 * _.toString([1, 2, 3]);
1740 * // => '1,2,3'
1741 */
1742function toString(value) {
1743 return value == null ? '' : _baseToString(value);
1744}
1745
1746var toString_1 = toString;
1747
1748/** Used to match HTML entities and HTML characters. */
1749var reUnescapedHtml = /[&<>"']/g,
1750 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
1751
1752/**
1753 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
1754 * corresponding HTML entities.
1755 *
1756 * **Note:** No other characters are escaped. To escape additional
1757 * characters use a third-party library like [_he_](https://mths.be/he).
1758 *
1759 * Though the ">" character is escaped for symmetry, characters like
1760 * ">" and "/" don't need escaping in HTML and have no special meaning
1761 * unless they're part of a tag or unquoted attribute value. See
1762 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
1763 * (under "semi-related fun fact") for more details.
1764 *
1765 * When working with HTML you should always
1766 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
1767 * XSS vectors.
1768 *
1769 * @static
1770 * @since 0.1.0
1771 * @memberOf _
1772 * @category String
1773 * @param {string} [string=''] The string to escape.
1774 * @returns {string} Returns the escaped string.
1775 * @example
1776 *
1777 * _.escape('fred, barney, & pebbles');
1778 * // => 'fred, barney, &amp; pebbles'
1779 */
1780function escape(string) {
1781 string = toString_1(string);
1782 return (string && reHasUnescapedHtml.test(string))
1783 ? string.replace(reUnescapedHtml, _escapeHtmlChar)
1784 : string;
1785}
1786
1787var _escape = escape;
1788
1789/** Used to match template delimiters. */
1790var reEscape = /<%-([\s\S]+?)%>/g;
1791
1792var _reEscape = reEscape;
1793
1794/** Used to match template delimiters. */
1795var reEvaluate = /<%([\s\S]+?)%>/g;
1796
1797var _reEvaluate = reEvaluate;
1798
1799/**
1800 * By default, the template delimiters used by lodash are like those in
1801 * embedded Ruby (ERB) as well as ES2015 template strings. Change the
1802 * following template settings to use alternative delimiters.
1803 *
1804 * @static
1805 * @memberOf _
1806 * @type {Object}
1807 */
1808var templateSettings = {
1809
1810 /**
1811 * Used to detect `data` property values to be HTML-escaped.
1812 *
1813 * @memberOf _.templateSettings
1814 * @type {RegExp}
1815 */
1816 'escape': _reEscape,
1817
1818 /**
1819 * Used to detect code to be evaluated.
1820 *
1821 * @memberOf _.templateSettings
1822 * @type {RegExp}
1823 */
1824 'evaluate': _reEvaluate,
1825
1826 /**
1827 * Used to detect `data` property values to inject.
1828 *
1829 * @memberOf _.templateSettings
1830 * @type {RegExp}
1831 */
1832 'interpolate': _reInterpolate,
1833
1834 /**
1835 * Used to reference the data object in the template text.
1836 *
1837 * @memberOf _.templateSettings
1838 * @type {string}
1839 */
1840 'variable': '',
1841
1842 /**
1843 * Used to import variables into the compiled template.
1844 *
1845 * @memberOf _.templateSettings
1846 * @type {Object}
1847 */
1848 'imports': {
1849
1850 /**
1851 * A reference to the `lodash` function.
1852 *
1853 * @memberOf _.templateSettings.imports
1854 * @type {Function}
1855 */
1856 '_': { 'escape': _escape }
1857 }
1858};
1859
1860var templateSettings_1 = templateSettings;
1861
1862/** Used to match empty string literals in compiled template source. */
1863var reEmptyStringLeading = /\b__p \+= '';/g,
1864 reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
1865 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
1866
1867/**
1868 * Used to match
1869 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
1870 */
1871var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
1872
1873/** Used to ensure capturing order of template delimiters. */
1874var reNoMatch = /($^)/;
1875
1876/** Used to match unescaped characters in compiled string literals. */
1877var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
1878
1879/** Used for built-in method references. */
1880var objectProto$b = Object.prototype;
1881
1882/** Used to check objects for own properties. */
1883var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
1884
1885/**
1886 * Creates a compiled template function that can interpolate data properties
1887 * in "interpolate" delimiters, HTML-escape interpolated data properties in
1888 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
1889 * properties may be accessed as free variables in the template. If a setting
1890 * object is given, it takes precedence over `_.templateSettings` values.
1891 *
1892 * **Note:** In the development build `_.template` utilizes
1893 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
1894 * for easier debugging.
1895 *
1896 * For more information on precompiling templates see
1897 * [lodash's custom builds documentation](https://lodash.com/custom-builds).
1898 *
1899 * For more information on Chrome extension sandboxes see
1900 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
1901 *
1902 * @static
1903 * @since 0.1.0
1904 * @memberOf _
1905 * @category String
1906 * @param {string} [string=''] The template string.
1907 * @param {Object} [options={}] The options object.
1908 * @param {RegExp} [options.escape=_.templateSettings.escape]
1909 * The HTML "escape" delimiter.
1910 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
1911 * The "evaluate" delimiter.
1912 * @param {Object} [options.imports=_.templateSettings.imports]
1913 * An object to import into the template as free variables.
1914 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
1915 * The "interpolate" delimiter.
1916 * @param {string} [options.sourceURL='templateSources[n]']
1917 * The sourceURL of the compiled template.
1918 * @param {string} [options.variable='obj']
1919 * The data object variable name.
1920 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
1921 * @returns {Function} Returns the compiled template function.
1922 * @example
1923 *
1924 * // Use the "interpolate" delimiter to create a compiled template.
1925 * var compiled = _.template('hello <%= user %>!');
1926 * compiled({ 'user': 'fred' });
1927 * // => 'hello fred!'
1928 *
1929 * // Use the HTML "escape" delimiter to escape data property values.
1930 * var compiled = _.template('<b><%- value %></b>');
1931 * compiled({ 'value': '<script>' });
1932 * // => '<b>&lt;script&gt;</b>'
1933 *
1934 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
1935 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
1936 * compiled({ 'users': ['fred', 'barney'] });
1937 * // => '<li>fred</li><li>barney</li>'
1938 *
1939 * // Use the internal `print` function in "evaluate" delimiters.
1940 * var compiled = _.template('<% print("hello " + user); %>!');
1941 * compiled({ 'user': 'barney' });
1942 * // => 'hello barney!'
1943 *
1944 * // Use the ES template literal delimiter as an "interpolate" delimiter.
1945 * // Disable support by replacing the "interpolate" delimiter.
1946 * var compiled = _.template('hello ${ user }!');
1947 * compiled({ 'user': 'pebbles' });
1948 * // => 'hello pebbles!'
1949 *
1950 * // Use backslashes to treat delimiters as plain text.
1951 * var compiled = _.template('<%= "\\<%- value %\\>" %>');
1952 * compiled({ 'value': 'ignored' });
1953 * // => '<%- value %>'
1954 *
1955 * // Use the `imports` option to import `jQuery` as `jq`.
1956 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
1957 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
1958 * compiled({ 'users': ['fred', 'barney'] });
1959 * // => '<li>fred</li><li>barney</li>'
1960 *
1961 * // Use the `sourceURL` option to specify a custom sourceURL for the template.
1962 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
1963 * compiled(data);
1964 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
1965 *
1966 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
1967 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
1968 * compiled.source;
1969 * // => function(data) {
1970 * // var __t, __p = '';
1971 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
1972 * // return __p;
1973 * // }
1974 *
1975 * // Use custom template delimiters.
1976 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
1977 * var compiled = _.template('hello {{ user }}!');
1978 * compiled({ 'user': 'mustache' });
1979 * // => 'hello mustache!'
1980 *
1981 * // Use the `source` property to inline compiled templates for meaningful
1982 * // line numbers in error messages and stack traces.
1983 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
1984 * var JST = {\
1985 * "main": ' + _.template(mainText).source + '\
1986 * };\
1987 * ');
1988 */
1989function template(string, options, guard) {
1990 // Based on John Resig's `tmpl` implementation
1991 // (http://ejohn.org/blog/javascript-micro-templating/)
1992 // and Laura Doktorova's doT.js (https://github.com/olado/doT).
1993 var settings = templateSettings_1.imports._.templateSettings || templateSettings_1;
1994
1995 if (guard && _isIterateeCall(string, options, guard)) {
1996 options = undefined;
1997 }
1998 string = toString_1(string);
1999 options = assignInWith_1({}, options, settings, _customDefaultsAssignIn);
2000
2001 var imports = assignInWith_1({}, options.imports, settings.imports, _customDefaultsAssignIn),
2002 importsKeys = keys_1(imports),
2003 importsValues = _baseValues(imports, importsKeys);
2004
2005 var isEscaping,
2006 isEvaluating,
2007 index = 0,
2008 interpolate = options.interpolate || reNoMatch,
2009 source = "__p += '";
2010
2011 // Compile the regexp to match each delimiter.
2012 var reDelimiters = RegExp(
2013 (options.escape || reNoMatch).source + '|' +
2014 interpolate.source + '|' +
2015 (interpolate === _reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
2016 (options.evaluate || reNoMatch).source + '|$'
2017 , 'g');
2018
2019 // Use a sourceURL for easier debugging.
2020 // The sourceURL gets injected into the source that's eval-ed, so be careful
2021 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
2022 // and escape the comment, thus injecting code that gets evaled.
2023 var sourceURL = hasOwnProperty$9.call(options, 'sourceURL')
2024 ? ('//# sourceURL=' +
2025 (options.sourceURL + '').replace(/\s/g, ' ') +
2026 '\n')
2027 : '';
2028
2029 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
2030 interpolateValue || (interpolateValue = esTemplateValue);
2031
2032 // Escape characters that can't be included in string literals.
2033 source += string.slice(index, offset).replace(reUnescapedString, _escapeStringChar);
2034
2035 // Replace delimiters with snippets.
2036 if (escapeValue) {
2037 isEscaping = true;
2038 source += "' +\n__e(" + escapeValue + ") +\n'";
2039 }
2040 if (evaluateValue) {
2041 isEvaluating = true;
2042 source += "';\n" + evaluateValue + ";\n__p += '";
2043 }
2044 if (interpolateValue) {
2045 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
2046 }
2047 index = offset + match.length;
2048
2049 // The JS engine embedded in Adobe products needs `match` returned in
2050 // order to produce the correct `offset` value.
2051 return match;
2052 });
2053
2054 source += "';\n";
2055
2056 // If `variable` is not specified wrap a with-statement around the generated
2057 // code to add the data object to the top of the scope chain.
2058 var variable = hasOwnProperty$9.call(options, 'variable') && options.variable;
2059 if (!variable) {
2060 source = 'with (obj) {\n' + source + '\n}\n';
2061 }
2062 // Cleanup code by stripping empty strings.
2063 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
2064 .replace(reEmptyStringMiddle, '$1')
2065 .replace(reEmptyStringTrailing, '$1;');
2066
2067 // Frame code as the function body.
2068 source = 'function(' + (variable || 'obj') + ') {\n' +
2069 (variable
2070 ? ''
2071 : 'obj || (obj = {});\n'
2072 ) +
2073 "var __t, __p = ''" +
2074 (isEscaping
2075 ? ', __e = _.escape'
2076 : ''
2077 ) +
2078 (isEvaluating
2079 ? ', __j = Array.prototype.join;\n' +
2080 "function print() { __p += __j.call(arguments, '') }\n"
2081 : ';\n'
2082 ) +
2083 source +
2084 'return __p\n}';
2085
2086 var result = attempt_1(function() {
2087 return Function(importsKeys, sourceURL + 'return ' + source)
2088 .apply(undefined, importsValues);
2089 });
2090
2091 // Provide the compiled function's source by its `toString` method or
2092 // the `source` property as a convenience for inlining compiled templates.
2093 result.source = source;
2094 if (isError_1(result)) {
2095 throw result;
2096 }
2097 return result;
2098}
2099
2100var template_1 = template;
2101
2102/**
2103 * Removes all key-value entries from the list cache.
2104 *
2105 * @private
2106 * @name clear
2107 * @memberOf ListCache
2108 */
2109function listCacheClear() {
2110 this.__data__ = [];
2111 this.size = 0;
2112}
2113
2114var _listCacheClear = listCacheClear;
2115
2116/**
2117 * Gets the index at which the `key` is found in `array` of key-value pairs.
2118 *
2119 * @private
2120 * @param {Array} array The array to inspect.
2121 * @param {*} key The key to search for.
2122 * @returns {number} Returns the index of the matched value, else `-1`.
2123 */
2124function assocIndexOf(array, key) {
2125 var length = array.length;
2126 while (length--) {
2127 if (eq_1(array[length][0], key)) {
2128 return length;
2129 }
2130 }
2131 return -1;
2132}
2133
2134var _assocIndexOf = assocIndexOf;
2135
2136/** Used for built-in method references. */
2137var arrayProto = Array.prototype;
2138
2139/** Built-in value references. */
2140var splice = arrayProto.splice;
2141
2142/**
2143 * Removes `key` and its value from the list cache.
2144 *
2145 * @private
2146 * @name delete
2147 * @memberOf ListCache
2148 * @param {string} key The key of the value to remove.
2149 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2150 */
2151function listCacheDelete(key) {
2152 var data = this.__data__,
2153 index = _assocIndexOf(data, key);
2154
2155 if (index < 0) {
2156 return false;
2157 }
2158 var lastIndex = data.length - 1;
2159 if (index == lastIndex) {
2160 data.pop();
2161 } else {
2162 splice.call(data, index, 1);
2163 }
2164 --this.size;
2165 return true;
2166}
2167
2168var _listCacheDelete = listCacheDelete;
2169
2170/**
2171 * Gets the list cache value for `key`.
2172 *
2173 * @private
2174 * @name get
2175 * @memberOf ListCache
2176 * @param {string} key The key of the value to get.
2177 * @returns {*} Returns the entry value.
2178 */
2179function listCacheGet(key) {
2180 var data = this.__data__,
2181 index = _assocIndexOf(data, key);
2182
2183 return index < 0 ? undefined : data[index][1];
2184}
2185
2186var _listCacheGet = listCacheGet;
2187
2188/**
2189 * Checks if a list cache value for `key` exists.
2190 *
2191 * @private
2192 * @name has
2193 * @memberOf ListCache
2194 * @param {string} key The key of the entry to check.
2195 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2196 */
2197function listCacheHas(key) {
2198 return _assocIndexOf(this.__data__, key) > -1;
2199}
2200
2201var _listCacheHas = listCacheHas;
2202
2203/**
2204 * Sets the list cache `key` to `value`.
2205 *
2206 * @private
2207 * @name set
2208 * @memberOf ListCache
2209 * @param {string} key The key of the value to set.
2210 * @param {*} value The value to set.
2211 * @returns {Object} Returns the list cache instance.
2212 */
2213function listCacheSet(key, value) {
2214 var data = this.__data__,
2215 index = _assocIndexOf(data, key);
2216
2217 if (index < 0) {
2218 ++this.size;
2219 data.push([key, value]);
2220 } else {
2221 data[index][1] = value;
2222 }
2223 return this;
2224}
2225
2226var _listCacheSet = listCacheSet;
2227
2228/**
2229 * Creates an list cache object.
2230 *
2231 * @private
2232 * @constructor
2233 * @param {Array} [entries] The key-value pairs to cache.
2234 */
2235function ListCache(entries) {
2236 var index = -1,
2237 length = entries == null ? 0 : entries.length;
2238
2239 this.clear();
2240 while (++index < length) {
2241 var entry = entries[index];
2242 this.set(entry[0], entry[1]);
2243 }
2244}
2245
2246// Add methods to `ListCache`.
2247ListCache.prototype.clear = _listCacheClear;
2248ListCache.prototype['delete'] = _listCacheDelete;
2249ListCache.prototype.get = _listCacheGet;
2250ListCache.prototype.has = _listCacheHas;
2251ListCache.prototype.set = _listCacheSet;
2252
2253var _ListCache = ListCache;
2254
2255/**
2256 * Removes all key-value entries from the stack.
2257 *
2258 * @private
2259 * @name clear
2260 * @memberOf Stack
2261 */
2262function stackClear() {
2263 this.__data__ = new _ListCache;
2264 this.size = 0;
2265}
2266
2267var _stackClear = stackClear;
2268
2269/**
2270 * Removes `key` and its value from the stack.
2271 *
2272 * @private
2273 * @name delete
2274 * @memberOf Stack
2275 * @param {string} key The key of the value to remove.
2276 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2277 */
2278function stackDelete(key) {
2279 var data = this.__data__,
2280 result = data['delete'](key);
2281
2282 this.size = data.size;
2283 return result;
2284}
2285
2286var _stackDelete = stackDelete;
2287
2288/**
2289 * Gets the stack value for `key`.
2290 *
2291 * @private
2292 * @name get
2293 * @memberOf Stack
2294 * @param {string} key The key of the value to get.
2295 * @returns {*} Returns the entry value.
2296 */
2297function stackGet(key) {
2298 return this.__data__.get(key);
2299}
2300
2301var _stackGet = stackGet;
2302
2303/**
2304 * Checks if a stack value for `key` exists.
2305 *
2306 * @private
2307 * @name has
2308 * @memberOf Stack
2309 * @param {string} key The key of the entry to check.
2310 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2311 */
2312function stackHas(key) {
2313 return this.__data__.has(key);
2314}
2315
2316var _stackHas = stackHas;
2317
2318/* Built-in method references that are verified to be native. */
2319var Map = _getNative(_root, 'Map');
2320
2321var _Map = Map;
2322
2323/* Built-in method references that are verified to be native. */
2324var nativeCreate = _getNative(Object, 'create');
2325
2326var _nativeCreate = nativeCreate;
2327
2328/**
2329 * Removes all key-value entries from the hash.
2330 *
2331 * @private
2332 * @name clear
2333 * @memberOf Hash
2334 */
2335function hashClear() {
2336 this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
2337 this.size = 0;
2338}
2339
2340var _hashClear = hashClear;
2341
2342/**
2343 * Removes `key` and its value from the hash.
2344 *
2345 * @private
2346 * @name delete
2347 * @memberOf Hash
2348 * @param {Object} hash The hash to modify.
2349 * @param {string} key The key of the value to remove.
2350 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2351 */
2352function hashDelete(key) {
2353 var result = this.has(key) && delete this.__data__[key];
2354 this.size -= result ? 1 : 0;
2355 return result;
2356}
2357
2358var _hashDelete = hashDelete;
2359
2360/** Used to stand-in for `undefined` hash values. */
2361var HASH_UNDEFINED = '__lodash_hash_undefined__';
2362
2363/** Used for built-in method references. */
2364var objectProto$c = Object.prototype;
2365
2366/** Used to check objects for own properties. */
2367var hasOwnProperty$a = objectProto$c.hasOwnProperty;
2368
2369/**
2370 * Gets the hash value for `key`.
2371 *
2372 * @private
2373 * @name get
2374 * @memberOf Hash
2375 * @param {string} key The key of the value to get.
2376 * @returns {*} Returns the entry value.
2377 */
2378function hashGet(key) {
2379 var data = this.__data__;
2380 if (_nativeCreate) {
2381 var result = data[key];
2382 return result === HASH_UNDEFINED ? undefined : result;
2383 }
2384 return hasOwnProperty$a.call(data, key) ? data[key] : undefined;
2385}
2386
2387var _hashGet = hashGet;
2388
2389/** Used for built-in method references. */
2390var objectProto$d = Object.prototype;
2391
2392/** Used to check objects for own properties. */
2393var hasOwnProperty$b = objectProto$d.hasOwnProperty;
2394
2395/**
2396 * Checks if a hash value for `key` exists.
2397 *
2398 * @private
2399 * @name has
2400 * @memberOf Hash
2401 * @param {string} key The key of the entry to check.
2402 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2403 */
2404function hashHas(key) {
2405 var data = this.__data__;
2406 return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$b.call(data, key);
2407}
2408
2409var _hashHas = hashHas;
2410
2411/** Used to stand-in for `undefined` hash values. */
2412var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
2413
2414/**
2415 * Sets the hash `key` to `value`.
2416 *
2417 * @private
2418 * @name set
2419 * @memberOf Hash
2420 * @param {string} key The key of the value to set.
2421 * @param {*} value The value to set.
2422 * @returns {Object} Returns the hash instance.
2423 */
2424function hashSet(key, value) {
2425 var data = this.__data__;
2426 this.size += this.has(key) ? 0 : 1;
2427 data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
2428 return this;
2429}
2430
2431var _hashSet = hashSet;
2432
2433/**
2434 * Creates a hash object.
2435 *
2436 * @private
2437 * @constructor
2438 * @param {Array} [entries] The key-value pairs to cache.
2439 */
2440function Hash(entries) {
2441 var index = -1,
2442 length = entries == null ? 0 : entries.length;
2443
2444 this.clear();
2445 while (++index < length) {
2446 var entry = entries[index];
2447 this.set(entry[0], entry[1]);
2448 }
2449}
2450
2451// Add methods to `Hash`.
2452Hash.prototype.clear = _hashClear;
2453Hash.prototype['delete'] = _hashDelete;
2454Hash.prototype.get = _hashGet;
2455Hash.prototype.has = _hashHas;
2456Hash.prototype.set = _hashSet;
2457
2458var _Hash = Hash;
2459
2460/**
2461 * Removes all key-value entries from the map.
2462 *
2463 * @private
2464 * @name clear
2465 * @memberOf MapCache
2466 */
2467function mapCacheClear() {
2468 this.size = 0;
2469 this.__data__ = {
2470 'hash': new _Hash,
2471 'map': new (_Map || _ListCache),
2472 'string': new _Hash
2473 };
2474}
2475
2476var _mapCacheClear = mapCacheClear;
2477
2478/**
2479 * Checks if `value` is suitable for use as unique object key.
2480 *
2481 * @private
2482 * @param {*} value The value to check.
2483 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2484 */
2485function isKeyable(value) {
2486 var type = typeof value;
2487 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
2488 ? (value !== '__proto__')
2489 : (value === null);
2490}
2491
2492var _isKeyable = isKeyable;
2493
2494/**
2495 * Gets the data for `map`.
2496 *
2497 * @private
2498 * @param {Object} map The map to query.
2499 * @param {string} key The reference key.
2500 * @returns {*} Returns the map data.
2501 */
2502function getMapData(map, key) {
2503 var data = map.__data__;
2504 return _isKeyable(key)
2505 ? data[typeof key == 'string' ? 'string' : 'hash']
2506 : data.map;
2507}
2508
2509var _getMapData = getMapData;
2510
2511/**
2512 * Removes `key` and its value from the map.
2513 *
2514 * @private
2515 * @name delete
2516 * @memberOf MapCache
2517 * @param {string} key The key of the value to remove.
2518 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2519 */
2520function mapCacheDelete(key) {
2521 var result = _getMapData(this, key)['delete'](key);
2522 this.size -= result ? 1 : 0;
2523 return result;
2524}
2525
2526var _mapCacheDelete = mapCacheDelete;
2527
2528/**
2529 * Gets the map value for `key`.
2530 *
2531 * @private
2532 * @name get
2533 * @memberOf MapCache
2534 * @param {string} key The key of the value to get.
2535 * @returns {*} Returns the entry value.
2536 */
2537function mapCacheGet(key) {
2538 return _getMapData(this, key).get(key);
2539}
2540
2541var _mapCacheGet = mapCacheGet;
2542
2543/**
2544 * Checks if a map value for `key` exists.
2545 *
2546 * @private
2547 * @name has
2548 * @memberOf MapCache
2549 * @param {string} key The key of the entry to check.
2550 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2551 */
2552function mapCacheHas(key) {
2553 return _getMapData(this, key).has(key);
2554}
2555
2556var _mapCacheHas = mapCacheHas;
2557
2558/**
2559 * Sets the map `key` to `value`.
2560 *
2561 * @private
2562 * @name set
2563 * @memberOf MapCache
2564 * @param {string} key The key of the value to set.
2565 * @param {*} value The value to set.
2566 * @returns {Object} Returns the map cache instance.
2567 */
2568function mapCacheSet(key, value) {
2569 var data = _getMapData(this, key),
2570 size = data.size;
2571
2572 data.set(key, value);
2573 this.size += data.size == size ? 0 : 1;
2574 return this;
2575}
2576
2577var _mapCacheSet = mapCacheSet;
2578
2579/**
2580 * Creates a map cache object to store key-value pairs.
2581 *
2582 * @private
2583 * @constructor
2584 * @param {Array} [entries] The key-value pairs to cache.
2585 */
2586function MapCache(entries) {
2587 var index = -1,
2588 length = entries == null ? 0 : entries.length;
2589
2590 this.clear();
2591 while (++index < length) {
2592 var entry = entries[index];
2593 this.set(entry[0], entry[1]);
2594 }
2595}
2596
2597// Add methods to `MapCache`.
2598MapCache.prototype.clear = _mapCacheClear;
2599MapCache.prototype['delete'] = _mapCacheDelete;
2600MapCache.prototype.get = _mapCacheGet;
2601MapCache.prototype.has = _mapCacheHas;
2602MapCache.prototype.set = _mapCacheSet;
2603
2604var _MapCache = MapCache;
2605
2606/** Used as the size to enable large array optimizations. */
2607var LARGE_ARRAY_SIZE = 200;
2608
2609/**
2610 * Sets the stack `key` to `value`.
2611 *
2612 * @private
2613 * @name set
2614 * @memberOf Stack
2615 * @param {string} key The key of the value to set.
2616 * @param {*} value The value to set.
2617 * @returns {Object} Returns the stack cache instance.
2618 */
2619function stackSet(key, value) {
2620 var data = this.__data__;
2621 if (data instanceof _ListCache) {
2622 var pairs = data.__data__;
2623 if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2624 pairs.push([key, value]);
2625 this.size = ++data.size;
2626 return this;
2627 }
2628 data = this.__data__ = new _MapCache(pairs);
2629 }
2630 data.set(key, value);
2631 this.size = data.size;
2632 return this;
2633}
2634
2635var _stackSet = stackSet;
2636
2637/**
2638 * Creates a stack cache object to store key-value pairs.
2639 *
2640 * @private
2641 * @constructor
2642 * @param {Array} [entries] The key-value pairs to cache.
2643 */
2644function Stack(entries) {
2645 var data = this.__data__ = new _ListCache(entries);
2646 this.size = data.size;
2647}
2648
2649// Add methods to `Stack`.
2650Stack.prototype.clear = _stackClear;
2651Stack.prototype['delete'] = _stackDelete;
2652Stack.prototype.get = _stackGet;
2653Stack.prototype.has = _stackHas;
2654Stack.prototype.set = _stackSet;
2655
2656var _Stack = Stack;
2657
2658/**
2659 * A specialized version of `_.forEach` for arrays without support for
2660 * iteratee shorthands.
2661 *
2662 * @private
2663 * @param {Array} [array] The array to iterate over.
2664 * @param {Function} iteratee The function invoked per iteration.
2665 * @returns {Array} Returns `array`.
2666 */
2667function arrayEach(array, iteratee) {
2668 var index = -1,
2669 length = array == null ? 0 : array.length;
2670
2671 while (++index < length) {
2672 if (iteratee(array[index], index, array) === false) {
2673 break;
2674 }
2675 }
2676 return array;
2677}
2678
2679var _arrayEach = arrayEach;
2680
2681/**
2682 * The base implementation of `_.assign` without support for multiple sources
2683 * or `customizer` functions.
2684 *
2685 * @private
2686 * @param {Object} object The destination object.
2687 * @param {Object} source The source object.
2688 * @returns {Object} Returns `object`.
2689 */
2690function baseAssign(object, source) {
2691 return object && _copyObject(source, keys_1(source), object);
2692}
2693
2694var _baseAssign = baseAssign;
2695
2696/**
2697 * The base implementation of `_.assignIn` without support for multiple sources
2698 * or `customizer` functions.
2699 *
2700 * @private
2701 * @param {Object} object The destination object.
2702 * @param {Object} source The source object.
2703 * @returns {Object} Returns `object`.
2704 */
2705function baseAssignIn(object, source) {
2706 return object && _copyObject(source, keysIn_1(source), object);
2707}
2708
2709var _baseAssignIn = baseAssignIn;
2710
2711var _cloneBuffer = createCommonjsModule(function (module, exports) {
2712/** Detect free variable `exports`. */
2713var freeExports = exports && !exports.nodeType && exports;
2714
2715/** Detect free variable `module`. */
2716var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2717
2718/** Detect the popular CommonJS extension `module.exports`. */
2719var moduleExports = freeModule && freeModule.exports === freeExports;
2720
2721/** Built-in value references. */
2722var Buffer = moduleExports ? _root.Buffer : undefined,
2723 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
2724
2725/**
2726 * Creates a clone of `buffer`.
2727 *
2728 * @private
2729 * @param {Buffer} buffer The buffer to clone.
2730 * @param {boolean} [isDeep] Specify a deep clone.
2731 * @returns {Buffer} Returns the cloned buffer.
2732 */
2733function cloneBuffer(buffer, isDeep) {
2734 if (isDeep) {
2735 return buffer.slice();
2736 }
2737 var length = buffer.length,
2738 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2739
2740 buffer.copy(result);
2741 return result;
2742}
2743
2744module.exports = cloneBuffer;
2745});
2746
2747/**
2748 * Copies the values of `source` to `array`.
2749 *
2750 * @private
2751 * @param {Array} source The array to copy values from.
2752 * @param {Array} [array=[]] The array to copy values to.
2753 * @returns {Array} Returns `array`.
2754 */
2755function copyArray(source, array) {
2756 var index = -1,
2757 length = source.length;
2758
2759 array || (array = Array(length));
2760 while (++index < length) {
2761 array[index] = source[index];
2762 }
2763 return array;
2764}
2765
2766var _copyArray = copyArray;
2767
2768/**
2769 * A specialized version of `_.filter` for arrays without support for
2770 * iteratee shorthands.
2771 *
2772 * @private
2773 * @param {Array} [array] The array to iterate over.
2774 * @param {Function} predicate The function invoked per iteration.
2775 * @returns {Array} Returns the new filtered array.
2776 */
2777function arrayFilter(array, predicate) {
2778 var index = -1,
2779 length = array == null ? 0 : array.length,
2780 resIndex = 0,
2781 result = [];
2782
2783 while (++index < length) {
2784 var value = array[index];
2785 if (predicate(value, index, array)) {
2786 result[resIndex++] = value;
2787 }
2788 }
2789 return result;
2790}
2791
2792var _arrayFilter = arrayFilter;
2793
2794/**
2795 * This method returns a new empty array.
2796 *
2797 * @static
2798 * @memberOf _
2799 * @since 4.13.0
2800 * @category Util
2801 * @returns {Array} Returns the new empty array.
2802 * @example
2803 *
2804 * var arrays = _.times(2, _.stubArray);
2805 *
2806 * console.log(arrays);
2807 * // => [[], []]
2808 *
2809 * console.log(arrays[0] === arrays[1]);
2810 * // => false
2811 */
2812function stubArray() {
2813 return [];
2814}
2815
2816var stubArray_1 = stubArray;
2817
2818/** Used for built-in method references. */
2819var objectProto$e = Object.prototype;
2820
2821/** Built-in value references. */
2822var propertyIsEnumerable$1 = objectProto$e.propertyIsEnumerable;
2823
2824/* Built-in method references for those with the same name as other `lodash` methods. */
2825var nativeGetSymbols = Object.getOwnPropertySymbols;
2826
2827/**
2828 * Creates an array of the own enumerable symbols of `object`.
2829 *
2830 * @private
2831 * @param {Object} object The object to query.
2832 * @returns {Array} Returns the array of symbols.
2833 */
2834var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
2835 if (object == null) {
2836 return [];
2837 }
2838 object = Object(object);
2839 return _arrayFilter(nativeGetSymbols(object), function(symbol) {
2840 return propertyIsEnumerable$1.call(object, symbol);
2841 });
2842};
2843
2844var _getSymbols = getSymbols;
2845
2846/**
2847 * Copies own symbols of `source` to `object`.
2848 *
2849 * @private
2850 * @param {Object} source The object to copy symbols from.
2851 * @param {Object} [object={}] The object to copy symbols to.
2852 * @returns {Object} Returns `object`.
2853 */
2854function copySymbols(source, object) {
2855 return _copyObject(source, _getSymbols(source), object);
2856}
2857
2858var _copySymbols = copySymbols;
2859
2860/**
2861 * Appends the elements of `values` to `array`.
2862 *
2863 * @private
2864 * @param {Array} array The array to modify.
2865 * @param {Array} values The values to append.
2866 * @returns {Array} Returns `array`.
2867 */
2868function arrayPush(array, values) {
2869 var index = -1,
2870 length = values.length,
2871 offset = array.length;
2872
2873 while (++index < length) {
2874 array[offset + index] = values[index];
2875 }
2876 return array;
2877}
2878
2879var _arrayPush = arrayPush;
2880
2881/* Built-in method references for those with the same name as other `lodash` methods. */
2882var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2883
2884/**
2885 * Creates an array of the own and inherited enumerable symbols of `object`.
2886 *
2887 * @private
2888 * @param {Object} object The object to query.
2889 * @returns {Array} Returns the array of symbols.
2890 */
2891var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
2892 var result = [];
2893 while (object) {
2894 _arrayPush(result, _getSymbols(object));
2895 object = _getPrototype(object);
2896 }
2897 return result;
2898};
2899
2900var _getSymbolsIn = getSymbolsIn;
2901
2902/**
2903 * Copies own and inherited symbols of `source` to `object`.
2904 *
2905 * @private
2906 * @param {Object} source The object to copy symbols from.
2907 * @param {Object} [object={}] The object to copy symbols to.
2908 * @returns {Object} Returns `object`.
2909 */
2910function copySymbolsIn(source, object) {
2911 return _copyObject(source, _getSymbolsIn(source), object);
2912}
2913
2914var _copySymbolsIn = copySymbolsIn;
2915
2916/**
2917 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2918 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2919 * symbols of `object`.
2920 *
2921 * @private
2922 * @param {Object} object The object to query.
2923 * @param {Function} keysFunc The function to get the keys of `object`.
2924 * @param {Function} symbolsFunc The function to get the symbols of `object`.
2925 * @returns {Array} Returns the array of property names and symbols.
2926 */
2927function baseGetAllKeys(object, keysFunc, symbolsFunc) {
2928 var result = keysFunc(object);
2929 return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
2930}
2931
2932var _baseGetAllKeys = baseGetAllKeys;
2933
2934/**
2935 * Creates an array of own enumerable property names and symbols of `object`.
2936 *
2937 * @private
2938 * @param {Object} object The object to query.
2939 * @returns {Array} Returns the array of property names and symbols.
2940 */
2941function getAllKeys(object) {
2942 return _baseGetAllKeys(object, keys_1, _getSymbols);
2943}
2944
2945var _getAllKeys = getAllKeys;
2946
2947/**
2948 * Creates an array of own and inherited enumerable property names and
2949 * symbols of `object`.
2950 *
2951 * @private
2952 * @param {Object} object The object to query.
2953 * @returns {Array} Returns the array of property names and symbols.
2954 */
2955function getAllKeysIn(object) {
2956 return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
2957}
2958
2959var _getAllKeysIn = getAllKeysIn;
2960
2961/* Built-in method references that are verified to be native. */
2962var DataView = _getNative(_root, 'DataView');
2963
2964var _DataView = DataView;
2965
2966/* Built-in method references that are verified to be native. */
2967var Promise$1 = _getNative(_root, 'Promise');
2968
2969var _Promise = Promise$1;
2970
2971/* Built-in method references that are verified to be native. */
2972var Set = _getNative(_root, 'Set');
2973
2974var _Set = Set;
2975
2976/* Built-in method references that are verified to be native. */
2977var WeakMap = _getNative(_root, 'WeakMap');
2978
2979var _WeakMap = WeakMap;
2980
2981/** `Object#toString` result references. */
2982var mapTag$1 = '[object Map]',
2983 objectTag$2 = '[object Object]',
2984 promiseTag = '[object Promise]',
2985 setTag$1 = '[object Set]',
2986 weakMapTag$1 = '[object WeakMap]';
2987
2988var dataViewTag$1 = '[object DataView]';
2989
2990/** Used to detect maps, sets, and weakmaps. */
2991var dataViewCtorString = _toSource(_DataView),
2992 mapCtorString = _toSource(_Map),
2993 promiseCtorString = _toSource(_Promise),
2994 setCtorString = _toSource(_Set),
2995 weakMapCtorString = _toSource(_WeakMap);
2996
2997/**
2998 * Gets the `toStringTag` of `value`.
2999 *
3000 * @private
3001 * @param {*} value The value to query.
3002 * @returns {string} Returns the `toStringTag`.
3003 */
3004var getTag = _baseGetTag;
3005
3006// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
3007if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
3008 (_Map && getTag(new _Map) != mapTag$1) ||
3009 (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
3010 (_Set && getTag(new _Set) != setTag$1) ||
3011 (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
3012 getTag = function(value) {
3013 var result = _baseGetTag(value),
3014 Ctor = result == objectTag$2 ? value.constructor : undefined,
3015 ctorString = Ctor ? _toSource(Ctor) : '';
3016
3017 if (ctorString) {
3018 switch (ctorString) {
3019 case dataViewCtorString: return dataViewTag$1;
3020 case mapCtorString: return mapTag$1;
3021 case promiseCtorString: return promiseTag;
3022 case setCtorString: return setTag$1;
3023 case weakMapCtorString: return weakMapTag$1;
3024 }
3025 }
3026 return result;
3027 };
3028}
3029
3030var _getTag = getTag;
3031
3032/** Used for built-in method references. */
3033var objectProto$f = Object.prototype;
3034
3035/** Used to check objects for own properties. */
3036var hasOwnProperty$c = objectProto$f.hasOwnProperty;
3037
3038/**
3039 * Initializes an array clone.
3040 *
3041 * @private
3042 * @param {Array} array The array to clone.
3043 * @returns {Array} Returns the initialized clone.
3044 */
3045function initCloneArray(array) {
3046 var length = array.length,
3047 result = new array.constructor(length);
3048
3049 // Add properties assigned by `RegExp#exec`.
3050 if (length && typeof array[0] == 'string' && hasOwnProperty$c.call(array, 'index')) {
3051 result.index = array.index;
3052 result.input = array.input;
3053 }
3054 return result;
3055}
3056
3057var _initCloneArray = initCloneArray;
3058
3059/** Built-in value references. */
3060var Uint8Array = _root.Uint8Array;
3061
3062var _Uint8Array = Uint8Array;
3063
3064/**
3065 * Creates a clone of `arrayBuffer`.
3066 *
3067 * @private
3068 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
3069 * @returns {ArrayBuffer} Returns the cloned array buffer.
3070 */
3071function cloneArrayBuffer(arrayBuffer) {
3072 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3073 new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
3074 return result;
3075}
3076
3077var _cloneArrayBuffer = cloneArrayBuffer;
3078
3079/**
3080 * Creates a clone of `dataView`.
3081 *
3082 * @private
3083 * @param {Object} dataView The data view to clone.
3084 * @param {boolean} [isDeep] Specify a deep clone.
3085 * @returns {Object} Returns the cloned data view.
3086 */
3087function cloneDataView(dataView, isDeep) {
3088 var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
3089 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
3090}
3091
3092var _cloneDataView = cloneDataView;
3093
3094/** Used to match `RegExp` flags from their coerced string values. */
3095var reFlags = /\w*$/;
3096
3097/**
3098 * Creates a clone of `regexp`.
3099 *
3100 * @private
3101 * @param {Object} regexp The regexp to clone.
3102 * @returns {Object} Returns the cloned regexp.
3103 */
3104function cloneRegExp(regexp) {
3105 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
3106 result.lastIndex = regexp.lastIndex;
3107 return result;
3108}
3109
3110var _cloneRegExp = cloneRegExp;
3111
3112/** Used to convert symbols to primitives and strings. */
3113var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
3114 symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
3115
3116/**
3117 * Creates a clone of the `symbol` object.
3118 *
3119 * @private
3120 * @param {Object} symbol The symbol object to clone.
3121 * @returns {Object} Returns the cloned symbol object.
3122 */
3123function cloneSymbol(symbol) {
3124 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
3125}
3126
3127var _cloneSymbol = cloneSymbol;
3128
3129/**
3130 * Creates a clone of `typedArray`.
3131 *
3132 * @private
3133 * @param {Object} typedArray The typed array to clone.
3134 * @param {boolean} [isDeep] Specify a deep clone.
3135 * @returns {Object} Returns the cloned typed array.
3136 */
3137function cloneTypedArray(typedArray, isDeep) {
3138 var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3139 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3140}
3141
3142var _cloneTypedArray = cloneTypedArray;
3143
3144/** `Object#toString` result references. */
3145var boolTag$1 = '[object Boolean]',
3146 dateTag$1 = '[object Date]',
3147 mapTag$2 = '[object Map]',
3148 numberTag$1 = '[object Number]',
3149 regexpTag$1 = '[object RegExp]',
3150 setTag$2 = '[object Set]',
3151 stringTag$1 = '[object String]',
3152 symbolTag$1 = '[object Symbol]';
3153
3154var arrayBufferTag$1 = '[object ArrayBuffer]',
3155 dataViewTag$2 = '[object DataView]',
3156 float32Tag$1 = '[object Float32Array]',
3157 float64Tag$1 = '[object Float64Array]',
3158 int8Tag$1 = '[object Int8Array]',
3159 int16Tag$1 = '[object Int16Array]',
3160 int32Tag$1 = '[object Int32Array]',
3161 uint8Tag$1 = '[object Uint8Array]',
3162 uint8ClampedTag$1 = '[object Uint8ClampedArray]',
3163 uint16Tag$1 = '[object Uint16Array]',
3164 uint32Tag$1 = '[object Uint32Array]';
3165
3166/**
3167 * Initializes an object clone based on its `toStringTag`.
3168 *
3169 * **Note:** This function only supports cloning values with tags of
3170 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
3171 *
3172 * @private
3173 * @param {Object} object The object to clone.
3174 * @param {string} tag The `toStringTag` of the object to clone.
3175 * @param {boolean} [isDeep] Specify a deep clone.
3176 * @returns {Object} Returns the initialized clone.
3177 */
3178function initCloneByTag(object, tag, isDeep) {
3179 var Ctor = object.constructor;
3180 switch (tag) {
3181 case arrayBufferTag$1:
3182 return _cloneArrayBuffer(object);
3183
3184 case boolTag$1:
3185 case dateTag$1:
3186 return new Ctor(+object);
3187
3188 case dataViewTag$2:
3189 return _cloneDataView(object, isDeep);
3190
3191 case float32Tag$1: case float64Tag$1:
3192 case int8Tag$1: case int16Tag$1: case int32Tag$1:
3193 case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
3194 return _cloneTypedArray(object, isDeep);
3195
3196 case mapTag$2:
3197 return new Ctor;
3198
3199 case numberTag$1:
3200 case stringTag$1:
3201 return new Ctor(object);
3202
3203 case regexpTag$1:
3204 return _cloneRegExp(object);
3205
3206 case setTag$2:
3207 return new Ctor;
3208
3209 case symbolTag$1:
3210 return _cloneSymbol(object);
3211 }
3212}
3213
3214var _initCloneByTag = initCloneByTag;
3215
3216/** Built-in value references. */
3217var objectCreate = Object.create;
3218
3219/**
3220 * The base implementation of `_.create` without support for assigning
3221 * properties to the created object.
3222 *
3223 * @private
3224 * @param {Object} proto The object to inherit from.
3225 * @returns {Object} Returns the new object.
3226 */
3227var baseCreate = (function() {
3228 function object() {}
3229 return function(proto) {
3230 if (!isObject_1(proto)) {
3231 return {};
3232 }
3233 if (objectCreate) {
3234 return objectCreate(proto);
3235 }
3236 object.prototype = proto;
3237 var result = new object;
3238 object.prototype = undefined;
3239 return result;
3240 };
3241}());
3242
3243var _baseCreate = baseCreate;
3244
3245/**
3246 * Initializes an object clone.
3247 *
3248 * @private
3249 * @param {Object} object The object to clone.
3250 * @returns {Object} Returns the initialized clone.
3251 */
3252function initCloneObject(object) {
3253 return (typeof object.constructor == 'function' && !_isPrototype(object))
3254 ? _baseCreate(_getPrototype(object))
3255 : {};
3256}
3257
3258var _initCloneObject = initCloneObject;
3259
3260/** `Object#toString` result references. */
3261var mapTag$3 = '[object Map]';
3262
3263/**
3264 * The base implementation of `_.isMap` without Node.js optimizations.
3265 *
3266 * @private
3267 * @param {*} value The value to check.
3268 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3269 */
3270function baseIsMap(value) {
3271 return isObjectLike_1(value) && _getTag(value) == mapTag$3;
3272}
3273
3274var _baseIsMap = baseIsMap;
3275
3276/* Node.js helper references. */
3277var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
3278
3279/**
3280 * Checks if `value` is classified as a `Map` object.
3281 *
3282 * @static
3283 * @memberOf _
3284 * @since 4.3.0
3285 * @category Lang
3286 * @param {*} value The value to check.
3287 * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3288 * @example
3289 *
3290 * _.isMap(new Map);
3291 * // => true
3292 *
3293 * _.isMap(new WeakMap);
3294 * // => false
3295 */
3296var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
3297
3298var isMap_1 = isMap;
3299
3300/** `Object#toString` result references. */
3301var setTag$3 = '[object Set]';
3302
3303/**
3304 * The base implementation of `_.isSet` without Node.js optimizations.
3305 *
3306 * @private
3307 * @param {*} value The value to check.
3308 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3309 */
3310function baseIsSet(value) {
3311 return isObjectLike_1(value) && _getTag(value) == setTag$3;
3312}
3313
3314var _baseIsSet = baseIsSet;
3315
3316/* Node.js helper references. */
3317var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
3318
3319/**
3320 * Checks if `value` is classified as a `Set` object.
3321 *
3322 * @static
3323 * @memberOf _
3324 * @since 4.3.0
3325 * @category Lang
3326 * @param {*} value The value to check.
3327 * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3328 * @example
3329 *
3330 * _.isSet(new Set);
3331 * // => true
3332 *
3333 * _.isSet(new WeakSet);
3334 * // => false
3335 */
3336var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
3337
3338var isSet_1 = isSet;
3339
3340/** Used to compose bitmasks for cloning. */
3341var CLONE_DEEP_FLAG = 1,
3342 CLONE_FLAT_FLAG = 2,
3343 CLONE_SYMBOLS_FLAG = 4;
3344
3345/** `Object#toString` result references. */
3346var argsTag$2 = '[object Arguments]',
3347 arrayTag$1 = '[object Array]',
3348 boolTag$2 = '[object Boolean]',
3349 dateTag$2 = '[object Date]',
3350 errorTag$2 = '[object Error]',
3351 funcTag$2 = '[object Function]',
3352 genTag$1 = '[object GeneratorFunction]',
3353 mapTag$4 = '[object Map]',
3354 numberTag$2 = '[object Number]',
3355 objectTag$3 = '[object Object]',
3356 regexpTag$2 = '[object RegExp]',
3357 setTag$4 = '[object Set]',
3358 stringTag$2 = '[object String]',
3359 symbolTag$2 = '[object Symbol]',
3360 weakMapTag$2 = '[object WeakMap]';
3361
3362var arrayBufferTag$2 = '[object ArrayBuffer]',
3363 dataViewTag$3 = '[object DataView]',
3364 float32Tag$2 = '[object Float32Array]',
3365 float64Tag$2 = '[object Float64Array]',
3366 int8Tag$2 = '[object Int8Array]',
3367 int16Tag$2 = '[object Int16Array]',
3368 int32Tag$2 = '[object Int32Array]',
3369 uint8Tag$2 = '[object Uint8Array]',
3370 uint8ClampedTag$2 = '[object Uint8ClampedArray]',
3371 uint16Tag$2 = '[object Uint16Array]',
3372 uint32Tag$2 = '[object Uint32Array]';
3373
3374/** Used to identify `toStringTag` values supported by `_.clone`. */
3375var cloneableTags = {};
3376cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
3377cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
3378cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
3379cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
3380cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
3381cloneableTags[int32Tag$2] = cloneableTags[mapTag$4] =
3382cloneableTags[numberTag$2] = cloneableTags[objectTag$3] =
3383cloneableTags[regexpTag$2] = cloneableTags[setTag$4] =
3384cloneableTags[stringTag$2] = cloneableTags[symbolTag$2] =
3385cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
3386cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
3387cloneableTags[errorTag$2] = cloneableTags[funcTag$2] =
3388cloneableTags[weakMapTag$2] = false;
3389
3390/**
3391 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
3392 * traversed objects.
3393 *
3394 * @private
3395 * @param {*} value The value to clone.
3396 * @param {boolean} bitmask The bitmask flags.
3397 * 1 - Deep clone
3398 * 2 - Flatten inherited properties
3399 * 4 - Clone symbols
3400 * @param {Function} [customizer] The function to customize cloning.
3401 * @param {string} [key] The key of `value`.
3402 * @param {Object} [object] The parent object of `value`.
3403 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
3404 * @returns {*} Returns the cloned value.
3405 */
3406function baseClone(value, bitmask, customizer, key, object, stack) {
3407 var result,
3408 isDeep = bitmask & CLONE_DEEP_FLAG,
3409 isFlat = bitmask & CLONE_FLAT_FLAG,
3410 isFull = bitmask & CLONE_SYMBOLS_FLAG;
3411
3412 if (customizer) {
3413 result = object ? customizer(value, key, object, stack) : customizer(value);
3414 }
3415 if (result !== undefined) {
3416 return result;
3417 }
3418 if (!isObject_1(value)) {
3419 return value;
3420 }
3421 var isArr = isArray_1(value);
3422 if (isArr) {
3423 result = _initCloneArray(value);
3424 if (!isDeep) {
3425 return _copyArray(value, result);
3426 }
3427 } else {
3428 var tag = _getTag(value),
3429 isFunc = tag == funcTag$2 || tag == genTag$1;
3430
3431 if (isBuffer_1(value)) {
3432 return _cloneBuffer(value, isDeep);
3433 }
3434 if (tag == objectTag$3 || tag == argsTag$2 || (isFunc && !object)) {
3435 result = (isFlat || isFunc) ? {} : _initCloneObject(value);
3436 if (!isDeep) {
3437 return isFlat
3438 ? _copySymbolsIn(value, _baseAssignIn(result, value))
3439 : _copySymbols(value, _baseAssign(result, value));
3440 }
3441 } else {
3442 if (!cloneableTags[tag]) {
3443 return object ? value : {};
3444 }
3445 result = _initCloneByTag(value, tag, isDeep);
3446 }
3447 }
3448 // Check for circular references and return its corresponding clone.
3449 stack || (stack = new _Stack);
3450 var stacked = stack.get(value);
3451 if (stacked) {
3452 return stacked;
3453 }
3454 stack.set(value, result);
3455
3456 if (isSet_1(value)) {
3457 value.forEach(function(subValue) {
3458 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
3459 });
3460 } else if (isMap_1(value)) {
3461 value.forEach(function(subValue, key) {
3462 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
3463 });
3464 }
3465
3466 var keysFunc = isFull
3467 ? (isFlat ? _getAllKeysIn : _getAllKeys)
3468 : (isFlat ? keysIn_1 : keys_1);
3469
3470 var props = isArr ? undefined : keysFunc(value);
3471 _arrayEach(props || value, function(subValue, key) {
3472 if (props) {
3473 key = subValue;
3474 subValue = value[key];
3475 }
3476 // Recursively populate clone (susceptible to call stack limits).
3477 _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
3478 });
3479 return result;
3480}
3481
3482var _baseClone = baseClone;
3483
3484/** Used to compose bitmasks for cloning. */
3485var CLONE_DEEP_FLAG$1 = 1,
3486 CLONE_SYMBOLS_FLAG$1 = 4;
3487
3488/**
3489 * This method is like `_.clone` except that it recursively clones `value`.
3490 *
3491 * @static
3492 * @memberOf _
3493 * @since 1.0.0
3494 * @category Lang
3495 * @param {*} value The value to recursively clone.
3496 * @returns {*} Returns the deep cloned value.
3497 * @see _.clone
3498 * @example
3499 *
3500 * var objects = [{ 'a': 1 }, { 'b': 2 }];
3501 *
3502 * var deep = _.cloneDeep(objects);
3503 * console.log(deep[0] === objects[0]);
3504 * // => false
3505 */
3506function cloneDeep(value) {
3507 return _baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
3508}
3509
3510var cloneDeep_1 = cloneDeep;
3511
3512class BaseRenderer {
3513 constructor (serverContext) {
3514 this.serverContext = serverContext;
3515 this.options = serverContext.options;
3516
3517 this.vueRenderer = this.createRenderer();
3518 }
3519
3520 createRenderer () {
3521 throw new Error('`createRenderer()` needs to be implemented')
3522 }
3523
3524 renderTemplate (templateFn, opts) {
3525 // Fix problem with HTMLPlugin's minify option (#3392)
3526 opts.html_attrs = opts.HTML_ATTRS;
3527 opts.head_attrs = opts.HEAD_ATTRS;
3528 opts.body_attrs = opts.BODY_ATTRS;
3529
3530 return templateFn(opts)
3531 }
3532
3533 render () {
3534 throw new Error('`render()` needs to be implemented')
3535 }
3536}
3537
3538class SPARenderer extends BaseRenderer {
3539 constructor (serverContext) {
3540 super(serverContext);
3541
3542 this.cache = new LRU__default['default']();
3543
3544 this.vueMetaConfig = {
3545 ssrAppId: '1',
3546 ...this.options.vueMeta,
3547 keyName: 'head',
3548 attribute: 'data-n-head',
3549 ssrAttribute: 'data-n-head-ssr',
3550 tagIDKeyName: 'hid'
3551 };
3552 }
3553
3554 createRenderer () {
3555 return vueServerRenderer.createRenderer()
3556 }
3557
3558 async render (renderContext) {
3559 const { url = '/', req = {} } = renderContext;
3560 const modernMode = this.options.modern;
3561 const modern = (modernMode && this.options.target === utils.TARGETS.static) || utils.isModernRequest(req, modernMode);
3562 const cacheKey = `${modern ? 'modern:' : 'legacy:'}${url}`;
3563 let meta = this.cache.get(cacheKey);
3564
3565 if (meta) {
3566 // Return a copy of the content, so that future
3567 // modifications do not effect the data in cache
3568 return cloneDeep_1(meta)
3569 }
3570
3571 meta = {
3572 HTML_ATTRS: '',
3573 HEAD_ATTRS: '',
3574 BODY_ATTRS: '',
3575 HEAD: '',
3576 BODY_SCRIPTS_PREPEND: '',
3577 BODY_SCRIPTS: ''
3578 };
3579
3580 if (this.options.features.meta) {
3581 // Get vue-meta context
3582 renderContext.head = typeof this.options.head === 'function'
3583 ? this.options.head()
3584 : cloneDeep_1(this.options.head);
3585 }
3586
3587 // Allow overriding renderContext
3588 await this.serverContext.nuxt.callHook('vue-renderer:spa:prepareContext', renderContext);
3589
3590 if (this.options.features.meta) {
3591 const m = VueMeta__default['default'].generate(renderContext.head || {}, this.vueMetaConfig);
3592
3593 // HTML_ATTRS
3594 meta.HTML_ATTRS = m.htmlAttrs.text();
3595
3596 // HEAD_ATTRS
3597 meta.HEAD_ATTRS = m.headAttrs.text();
3598
3599 // BODY_ATTRS
3600 meta.BODY_ATTRS = m.bodyAttrs.text();
3601
3602 // HEAD tags
3603 meta.HEAD =
3604 m.title.text() +
3605 m.meta.text() +
3606 m.link.text() +
3607 m.style.text() +
3608 m.script.text() +
3609 m.noscript.text();
3610
3611 // Add <base href=""> meta if router base specified
3612 if (this.options._routerBaseSpecified) {
3613 meta.HEAD += `<base href="${this.options.router.base}">`;
3614 }
3615
3616 // BODY_SCRIPTS (PREPEND)
3617 meta.BODY_SCRIPTS_PREPEND =
3618 m.meta.text({ pbody: true }) +
3619 m.link.text({ pbody: true }) +
3620 m.style.text({ pbody: true }) +
3621 m.script.text({ pbody: true }) +
3622 m.noscript.text({ pbody: true });
3623
3624 // BODY_SCRIPTS (APPEND)
3625 meta.BODY_SCRIPTS =
3626 m.meta.text({ body: true }) +
3627 m.link.text({ body: true }) +
3628 m.style.text({ body: true }) +
3629 m.script.text({ body: true }) +
3630 m.noscript.text({ body: true });
3631 }
3632
3633 // Resources Hints
3634 meta.resourceHints = '';
3635
3636 const { resources: { modernManifest, clientManifest } } = this.serverContext;
3637 const manifest = modern ? modernManifest : clientManifest;
3638
3639 const { shouldPreload, shouldPrefetch } = this.options.render.bundleRenderer;
3640
3641 if (this.options.render.resourceHints && manifest) {
3642 const publicPath = manifest.publicPath || '/_nuxt/';
3643
3644 // Preload initial resources
3645 if (Array.isArray(manifest.initial)) {
3646 const { crossorigin } = this.options.render;
3647 const cors = `${crossorigin ? ` crossorigin="${crossorigin}"` : ''}`;
3648
3649 meta.preloadFiles = manifest.initial
3650 .map(SPARenderer.normalizeFile)
3651 .filter(({ fileWithoutQuery, asType }) => shouldPreload(fileWithoutQuery, asType))
3652 .map(file => ({ ...file, modern }));
3653
3654 meta.resourceHints += meta.preloadFiles
3655 .map(({ file, extension, fileWithoutQuery, asType, modern }) => {
3656 let extra = '';
3657 if (asType === 'font') {
3658 extra = ` type="font/${extension}"${cors ? '' : ' crossorigin'}`;
3659 }
3660 const rel = modern && asType === 'script' ? 'modulepreload' : 'preload';
3661 return `<link rel="${rel}"${cors} href="${publicPath}${file}"${
3662 asType !== '' ? ` as="${asType}"` : ''}${extra}>`
3663 })
3664 .join('');
3665 }
3666
3667 // Prefetch async resources
3668 if (Array.isArray(manifest.async)) {
3669 meta.resourceHints += manifest.async
3670 .map(SPARenderer.normalizeFile)
3671 .filter(({ fileWithoutQuery, asType }) => shouldPrefetch(fileWithoutQuery, asType))
3672 .map(({ file }) => `<link rel="prefetch" href="${publicPath}${file}">`)
3673 .join('');
3674 }
3675
3676 // Add them to HEAD
3677 if (meta.resourceHints) {
3678 meta.HEAD += meta.resourceHints;
3679 }
3680 }
3681
3682 // Serialize state (runtime config)
3683 let APP = `${meta.BODY_SCRIPTS_PREPEND}<div id="${this.serverContext.globals.id}">${this.serverContext.resources.loadingHTML}</div>${meta.BODY_SCRIPTS}`;
3684
3685 APP += `<script>window.${this.serverContext.globals.context}=${devalue__default['default']({
3686 config: renderContext.runtimeConfig.public,
3687 staticAssetsBase: renderContext.staticAssetsBase
3688 })}</script>`;
3689
3690 // Prepare template params
3691 const templateParams = {
3692 ...meta,
3693 APP,
3694 ENV: this.options.env
3695 };
3696
3697 // Call spa:templateParams hook
3698 await this.serverContext.nuxt.callHook('vue-renderer:spa:templateParams', templateParams);
3699
3700 // Render with SPA template
3701 const html = this.renderTemplate(this.serverContext.resources.spaTemplate, templateParams);
3702 const content = {
3703 html,
3704 preloadFiles: meta.preloadFiles || []
3705 };
3706
3707 // Set meta tags inside cache
3708 this.cache.set(cacheKey, content);
3709
3710 // Return a copy of the content, so that future
3711 // modifications do not effect the data in cache
3712 return cloneDeep_1(content)
3713 }
3714
3715 static normalizeFile (file) {
3716 const withoutQuery = file.replace(/\?.*/, '');
3717 const extension = path.extname(withoutQuery).slice(1);
3718 return {
3719 file,
3720 extension,
3721 fileWithoutQuery: withoutQuery,
3722 asType: SPARenderer.getPreloadType(extension)
3723 }
3724 }
3725
3726 static getPreloadType (ext) {
3727 if (ext === 'js') {
3728 return 'script'
3729 } else if (ext === 'css') {
3730 return 'style'
3731 } else if (/jpe?g|png|svg|gif|webp|ico/.test(ext)) {
3732 return 'image'
3733 } else if (/woff2?|ttf|otf|eot/.test(ext)) {
3734 return 'font'
3735 } else {
3736 return ''
3737 }
3738 }
3739}
3740
3741class SSRRenderer extends BaseRenderer {
3742 get rendererOptions () {
3743 const hasModules = fs__default['default'].existsSync(path__default['default'].resolve(this.options.rootDir, 'node_modules'));
3744
3745 return {
3746 clientManifest: this.serverContext.resources.clientManifest,
3747 // for globally installed nuxt command, search dependencies in global dir
3748 basedir: hasModules ? this.options.rootDir : __dirname,
3749 ...this.options.render.bundleRenderer
3750 }
3751 }
3752
3753 renderScripts (renderContext) {
3754 const scripts = renderContext.renderScripts();
3755 const { render: { crossorigin } } = this.options;
3756 if (!crossorigin) {
3757 return scripts
3758 }
3759 return scripts.replace(
3760 /<script/g,
3761 `<script crossorigin="${crossorigin}"`
3762 )
3763 }
3764
3765 getPreloadFiles (renderContext) {
3766 return renderContext.getPreloadFiles()
3767 }
3768
3769 renderResourceHints (renderContext) {
3770 const resourceHints = renderContext.renderResourceHints();
3771 const { render: { crossorigin } } = this.options;
3772 if (!crossorigin) {
3773 return resourceHints
3774 }
3775 return resourceHints.replace(
3776 /rel="preload"/g,
3777 `rel="preload" crossorigin="${crossorigin}"`
3778 )
3779 }
3780
3781 createRenderer () {
3782 // Create bundle renderer for SSR
3783 return vueServerRenderer.createBundleRenderer(
3784 this.serverContext.resources.serverManifest,
3785 this.rendererOptions
3786 )
3787 }
3788
3789 useSSRLog () {
3790 if (!this.options.render.ssrLog) {
3791 return
3792 }
3793 const logs = [];
3794 const devReporter = {
3795 log (logObj) {
3796 logs.push({
3797 ...logObj,
3798 args: logObj.args.map(arg => util.format(arg))
3799 });
3800 }
3801 };
3802 consola__default['default'].addReporter(devReporter);
3803
3804 return () => {
3805 consola__default['default'].removeReporter(devReporter);
3806 return logs
3807 }
3808 }
3809
3810 async render (renderContext) {
3811 // Call ssr:context hook to extend context from modules
3812 await this.serverContext.nuxt.callHook('vue-renderer:ssr:prepareContext', renderContext);
3813
3814 const getSSRLog = this.useSSRLog();
3815
3816 // Call Vue renderer renderToString
3817 let APP = await this.vueRenderer.renderToString(renderContext);
3818
3819 if (typeof getSSRLog === 'function') {
3820 renderContext.nuxt.logs = getSSRLog();
3821 }
3822
3823 // Call ssr:context hook
3824 await this.serverContext.nuxt.callHook('vue-renderer:ssr:context', renderContext);
3825
3826 // TODO: Remove in next major release (#4722)
3827 await this.serverContext.nuxt.callHook('_render:context', renderContext.nuxt);
3828
3829 // Fallback to empty response
3830 if (!renderContext.nuxt.serverRendered) {
3831 APP = `<div id="${this.serverContext.globals.id}"></div>`;
3832 }
3833
3834 // Perf: early returns if server target and redirected
3835 if (renderContext.redirected && renderContext.target === utils.TARGETS.server) {
3836 return {
3837 html: APP,
3838 error: renderContext.nuxt.error,
3839 redirected: renderContext.redirected
3840 }
3841 }
3842
3843 let HEAD = '';
3844
3845 // Inject head meta
3846 // (this is unset when features.meta is false in server template)
3847 const meta = renderContext.meta && renderContext.meta.inject({
3848 isSSR: renderContext.nuxt.serverRendered,
3849 ln: this.options.dev
3850 });
3851
3852 if (meta) {
3853 HEAD += meta.title.text() + meta.meta.text();
3854 }
3855
3856 // Add <base href=""> meta if router base specified
3857 if (this.options._routerBaseSpecified) {
3858 HEAD += `<base href="${this.options.router.base}">`;
3859 }
3860
3861 if (meta) {
3862 HEAD += meta.link.text() +
3863 meta.style.text() +
3864 meta.script.text() +
3865 meta.noscript.text();
3866 }
3867
3868 // Check if we need to inject scripts and state
3869 const shouldInjectScripts = this.options.render.injectScripts !== false;
3870
3871 // Inject resource hints
3872 if (this.options.render.resourceHints && shouldInjectScripts) {
3873 HEAD += this.renderResourceHints(renderContext);
3874 }
3875
3876 // Inject styles
3877 HEAD += renderContext.renderStyles();
3878
3879 if (meta) {
3880 const prependInjectorOptions = { pbody: true };
3881
3882 const BODY_PREPEND =
3883 meta.meta.text(prependInjectorOptions) +
3884 meta.link.text(prependInjectorOptions) +
3885 meta.style.text(prependInjectorOptions) +
3886 meta.script.text(prependInjectorOptions) +
3887 meta.noscript.text(prependInjectorOptions);
3888
3889 if (BODY_PREPEND) {
3890 APP = `${BODY_PREPEND}${APP}`;
3891 }
3892 }
3893
3894 const { csp } = this.options.render;
3895 // Only add the hash if 'unsafe-inline' rule isn't present to avoid conflicts (#5387)
3896 const containsUnsafeInlineScriptSrc = csp.policies && csp.policies['script-src'] && csp.policies['script-src'].includes('\'unsafe-inline\'');
3897 const shouldHashCspScriptSrc = csp && (csp.unsafeInlineCompatibility || !containsUnsafeInlineScriptSrc);
3898 const inlineScripts = [];
3899
3900 if (renderContext.staticAssetsBase) {
3901 const preloadScripts = [];
3902 renderContext.staticAssets = [];
3903 const routerBase = this.options.router.base;
3904 const { staticAssetsBase, url, nuxt, staticAssets } = renderContext;
3905 const { data, fetch, mutations, ...state } = nuxt;
3906
3907 // Initial state
3908 const stateScript = `window.${this.serverContext.globals.context}=${devalue__default['default']({
3909 staticAssetsBase,
3910 ...state
3911 })};`;
3912
3913 // Make chunk for initial state > 10 KB
3914 const stateScriptKb = (stateScript.length * 4 /* utf8 */) / 100;
3915 if (stateScriptKb > 10) {
3916 const statePath = utils.urlJoin(url, 'state.js');
3917 const stateUrl = utils.urlJoin(routerBase, staticAssetsBase, statePath);
3918 staticAssets.push({ path: statePath, src: stateScript });
3919 APP += `<script defer src="${stateUrl}"></script>`;
3920 preloadScripts.push(stateUrl);
3921 } else {
3922 APP += `<script>${stateScript}</script>`;
3923 }
3924
3925 // Page level payload.js (async loaded for CSR)
3926 const payloadPath = utils.urlJoin(url, 'payload.js');
3927 const payloadUrl = utils.urlJoin(routerBase, staticAssetsBase, payloadPath);
3928 const routePath = (url.replace(/\/+$/, '') || '/').split('?')[0]; // remove trailing slah and query params
3929 const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue__default['default']({ data, fetch, mutations })});`;
3930 staticAssets.push({ path: payloadPath, src: payloadScript });
3931 preloadScripts.push(payloadUrl);
3932
3933 // Preload links
3934 for (const href of preloadScripts) {
3935 HEAD += `<link rel="preload" href="${href}" as="script">`;
3936 }
3937 } else {
3938 // Serialize state
3939 let serializedSession;
3940 if (shouldInjectScripts || shouldHashCspScriptSrc) {
3941 // Only serialized session if need inject scripts or csp hash
3942 serializedSession = `window.${this.serverContext.globals.context}=${devalue__default['default'](renderContext.nuxt)};`;
3943 inlineScripts.push(serializedSession);
3944 }
3945
3946 if (shouldInjectScripts) {
3947 APP += `<script>${serializedSession}</script>`;
3948 }
3949 }
3950
3951 // Calculate CSP hashes
3952 const cspScriptSrcHashes = [];
3953 if (csp) {
3954 if (shouldHashCspScriptSrc) {
3955 for (const script of inlineScripts) {
3956 const hash = crypto__default['default'].createHash(csp.hashAlgorithm);
3957 hash.update(script);
3958 cspScriptSrcHashes.push(`'${csp.hashAlgorithm}-${hash.digest('base64')}'`);
3959 }
3960 }
3961
3962 // Call ssr:csp hook
3963 await this.serverContext.nuxt.callHook('vue-renderer:ssr:csp', cspScriptSrcHashes);
3964
3965 // Add csp meta tags
3966 if (csp.addMeta) {
3967 HEAD += `<meta http-equiv="Content-Security-Policy" content="script-src ${cspScriptSrcHashes.join()}">`;
3968 }
3969 }
3970
3971 // Prepend scripts
3972 if (shouldInjectScripts) {
3973 APP += this.renderScripts(renderContext);
3974 }
3975
3976 if (meta) {
3977 const appendInjectorOptions = { body: true };
3978
3979 // Append body scripts
3980 APP += meta.meta.text(appendInjectorOptions);
3981 APP += meta.link.text(appendInjectorOptions);
3982 APP += meta.style.text(appendInjectorOptions);
3983 APP += meta.script.text(appendInjectorOptions);
3984 APP += meta.noscript.text(appendInjectorOptions);
3985 }
3986
3987 // Template params
3988 const templateParams = {
3989 HTML_ATTRS: meta ? meta.htmlAttrs.text(renderContext.nuxt.serverRendered /* addSrrAttribute */) : '',
3990 HEAD_ATTRS: meta ? meta.headAttrs.text() : '',
3991 BODY_ATTRS: meta ? meta.bodyAttrs.text() : '',
3992 HEAD,
3993 APP,
3994 ENV: this.options.env
3995 };
3996
3997 // Call ssr:templateParams hook
3998 await this.serverContext.nuxt.callHook('vue-renderer:ssr:templateParams', templateParams, renderContext);
3999
4000 // Render with SSR template
4001 const html = this.renderTemplate(this.serverContext.resources.ssrTemplate, templateParams);
4002
4003 let preloadFiles;
4004 if (this.options.render.http2.push) {
4005 preloadFiles = this.getPreloadFiles(renderContext);
4006 }
4007
4008 return {
4009 html,
4010 cspScriptSrcHashes,
4011 preloadFiles,
4012 error: renderContext.nuxt.error,
4013 redirected: renderContext.redirected
4014 }
4015 }
4016}
4017
4018class ModernRenderer extends SSRRenderer {
4019 constructor (serverContext) {
4020 super(serverContext);
4021
4022 const { build: { publicPath }, router: { base } } = this.options;
4023 this.publicPath = utils.isUrl(publicPath) ? publicPath : utils.urlJoin(base, publicPath);
4024 }
4025
4026 get assetsMapping () {
4027 if (this._assetsMapping) {
4028 return this._assetsMapping
4029 }
4030
4031 const { clientManifest, modernManifest } = this.serverContext.resources;
4032 const legacyAssets = clientManifest.assetsMapping;
4033 const modernAssets = modernManifest.assetsMapping;
4034 const mapping = {};
4035
4036 Object.keys(legacyAssets).forEach((componentHash) => {
4037 const modernComponentAssets = modernAssets[componentHash] || [];
4038 legacyAssets[componentHash].forEach((legacyAssetName, index) => {
4039 mapping[legacyAssetName] = modernComponentAssets[index];
4040 });
4041 });
4042 delete clientManifest.assetsMapping;
4043 delete modernManifest.assetsMapping;
4044 this._assetsMapping = mapping;
4045
4046 return mapping
4047 }
4048
4049 get isServerMode () {
4050 return this.options.modern === 'server'
4051 }
4052
4053 get rendererOptions () {
4054 const rendererOptions = super.rendererOptions;
4055 if (this.isServerMode) {
4056 rendererOptions.clientManifest = this.serverContext.resources.modernManifest;
4057 }
4058 return rendererOptions
4059 }
4060
4061 renderScripts (renderContext) {
4062 const scripts = super.renderScripts(renderContext);
4063
4064 if (this.isServerMode) {
4065 return scripts.replace('<script', `<script nomodule`)
4066 }
4067
4068 const scriptPattern = /<script[^>]*?src="([^"]*?)" defer><\/script>/g;
4069
4070 const modernScripts = scripts.replace(scriptPattern, (scriptTag, jsFile) => {
4071 const legacyJsFile = jsFile.replace(this.publicPath, '');
4072 const modernJsFile = this.assetsMapping[legacyJsFile];
4073 if (!modernJsFile) {
4074 return scriptTag
4075 }
4076 const moduleTag = scriptTag
4077 .replace('<script', `<script type="module"`)
4078 .replace(legacyJsFile, modernJsFile);
4079 const noModuleTag = scriptTag.replace('<script', `<script nomodule`);
4080
4081 return noModuleTag + moduleTag
4082 });
4083
4084 const safariNoModuleFixScript = `<script>${utils.safariNoModuleFix}</script>`;
4085
4086 return safariNoModuleFixScript + modernScripts
4087 }
4088
4089 getModernFiles (legacyFiles = []) {
4090 const modernFiles = [];
4091
4092 for (const legacyJsFile of legacyFiles) {
4093 const modernFile = { ...legacyJsFile, modern: true };
4094 if (modernFile.asType === 'script') {
4095 const file = this.assetsMapping[legacyJsFile.file];
4096 modernFile.file = file;
4097 modernFile.fileWithoutQuery = file.replace(/\?.*/, '');
4098 }
4099 modernFiles.push(modernFile);
4100 }
4101
4102 return modernFiles
4103 }
4104
4105 getPreloadFiles (renderContext) {
4106 const preloadFiles = super.getPreloadFiles(renderContext);
4107 // In eligible server modern mode, preloadFiles are modern bundles from modern renderer
4108 return this.isServerMode ? preloadFiles : this.getModernFiles(preloadFiles)
4109 }
4110
4111 renderResourceHints (renderContext) {
4112 const resourceHints = super.renderResourceHints(renderContext);
4113 if (this.isServerMode) {
4114 return resourceHints
4115 }
4116
4117 const linkPattern = /<link[^>]*?href="([^"]*?)"[^>]*?as="script"[^>]*?>/g;
4118
4119 return resourceHints.replace(linkPattern, (linkTag, jsFile) => {
4120 const legacyJsFile = jsFile.replace(this.publicPath, '');
4121 const modernJsFile = this.assetsMapping[legacyJsFile];
4122 if (!modernJsFile) {
4123 return ''
4124 }
4125 return linkTag
4126 .replace('rel="preload"', `rel="modulepreload"`)
4127 .replace(legacyJsFile, modernJsFile)
4128 })
4129 }
4130
4131 render (renderContext) {
4132 if (this.isServerMode) {
4133 renderContext.res.setHeader('Vary', 'User-Agent');
4134 }
4135 return super.render(renderContext)
4136 }
4137}
4138
4139class VueRenderer {
4140 constructor (context) {
4141 this.serverContext = context;
4142 this.options = this.serverContext.options;
4143
4144 // Will be set by createRenderer
4145 this.renderer = {
4146 ssr: undefined,
4147 modern: undefined,
4148 spa: undefined
4149 };
4150
4151 // Renderer runtime resources
4152 Object.assign(this.serverContext.resources, {
4153 clientManifest: undefined,
4154 modernManifest: undefined,
4155 serverManifest: undefined,
4156 ssrTemplate: undefined,
4157 spaTemplate: undefined,
4158 errorTemplate: this.parseTemplate('Nuxt.js Internal Server Error')
4159 });
4160
4161 // Default status
4162 this._state = 'created';
4163 this._error = null;
4164 }
4165
4166 ready () {
4167 if (!this._readyPromise) {
4168 this._state = 'loading';
4169 this._readyPromise = this._ready()
4170 .then(() => {
4171 this._state = 'ready';
4172 return this
4173 })
4174 .catch((error) => {
4175 this._state = 'error';
4176 this._error = error;
4177 throw error
4178 });
4179 }
4180
4181 return this._readyPromise
4182 }
4183
4184 async _ready () {
4185 // Resolve dist path
4186 this.distPath = path__default['default'].resolve(this.options.buildDir, 'dist', 'server');
4187
4188 // -- Development mode --
4189 if (this.options.dev) {
4190 this.serverContext.nuxt.hook('build:resources', mfs => this.loadResources(mfs));
4191 return
4192 }
4193
4194 // -- Production mode --
4195
4196 // Try once to load SSR resources from fs
4197 await this.loadResources(fs__default['default']);
4198
4199 // Without using `nuxt start` (programmatic, tests and generate)
4200 if (!this.options._start) {
4201 this.serverContext.nuxt.hook('build:resources', () => this.loadResources(fs__default['default']));
4202 return
4203 }
4204
4205 // Verify resources
4206 if (this.options.modern && !this.isModernReady) {
4207 throw new Error(
4208 `No modern build files found in ${this.distPath}.\nUse either \`nuxt build --modern\` or \`modern\` option to build modern files.`
4209 )
4210 } else if (!this.isReady) {
4211 throw new Error(
4212 `No build files found in ${this.distPath}.\nUse either \`nuxt build\` or \`builder.build()\` or start nuxt in development mode.`
4213 )
4214 }
4215 }
4216
4217 async loadResources (_fs) {
4218 const updated = [];
4219
4220 const readResource = async (fileName, encoding) => {
4221 try {
4222 const fullPath = path__default['default'].resolve(this.distPath, fileName);
4223
4224 if (!await _fs.exists(fullPath)) {
4225 return
4226 }
4227 const contents = await _fs.readFile(fullPath, encoding);
4228
4229 return contents
4230 } catch (err) {
4231 consola__default['default'].error('Unable to load resource:', fileName, err);
4232 }
4233 };
4234
4235 for (const resourceName in this.resourceMap) {
4236 const { fileName, transform, encoding } = this.resourceMap[resourceName];
4237
4238 // Load resource
4239 let resource = await readResource(fileName, encoding);
4240
4241 // Skip unavailable resources
4242 if (!resource) {
4243 continue
4244 }
4245
4246 // Apply transforms
4247 if (typeof transform === 'function') {
4248 resource = await transform(resource, { readResource });
4249 }
4250
4251 // Update resource
4252 this.serverContext.resources[resourceName] = resource;
4253 updated.push(resourceName);
4254 }
4255
4256 // Load templates
4257 await this.loadTemplates();
4258
4259 await this.serverContext.nuxt.callHook('render:resourcesLoaded', this.serverContext.resources);
4260
4261 // Detect if any resource updated
4262 if (updated.length > 0) {
4263 // Create new renderer
4264 this.createRenderer();
4265 }
4266 }
4267
4268 async loadTemplates () {
4269 // Reload error template
4270 const errorTemplatePath = path__default['default'].resolve(this.options.buildDir, 'views/error.html');
4271
4272 if (await fs__default['default'].exists(errorTemplatePath)) {
4273 const errorTemplate = await fs__default['default'].readFile(errorTemplatePath, 'utf8');
4274 this.serverContext.resources.errorTemplate = this.parseTemplate(errorTemplate);
4275 }
4276
4277 // Reload loading template
4278 const loadingHTMLPath = path__default['default'].resolve(this.options.buildDir, 'loading.html');
4279
4280 if (await fs__default['default'].exists(loadingHTMLPath)) {
4281 this.serverContext.resources.loadingHTML = await fs__default['default'].readFile(loadingHTMLPath, 'utf8');
4282 this.serverContext.resources.loadingHTML = this.serverContext.resources.loadingHTML.replace(/\r|\n|[\t\s]{3,}/g, '');
4283 } else {
4284 this.serverContext.resources.loadingHTML = '';
4285 }
4286 }
4287
4288 // TODO: Remove in Nuxt 3
4289 get noSSR () { /* Backward compatibility */
4290 return this.options.render.ssr === false
4291 }
4292
4293 get SSR () {
4294 return this.options.render.ssr === true
4295 }
4296
4297 get isReady () {
4298 // SPA
4299 if (!this.serverContext.resources.spaTemplate || !this.renderer.spa) {
4300 return false
4301 }
4302
4303 // SSR
4304 if (this.SSR && (!this.serverContext.resources.ssrTemplate || !this.renderer.ssr)) {
4305 return false
4306 }
4307
4308 return true
4309 }
4310
4311 get isModernReady () {
4312 return this.isReady && this.serverContext.resources.modernManifest
4313 }
4314
4315 // TODO: Remove in Nuxt 3
4316 get isResourcesAvailable () { /* Backward compatibility */
4317 return this.isReady
4318 }
4319
4320 detectModernBuild () {
4321 const { options, resources } = this.serverContext;
4322 if ([false, 'client', 'server'].includes(options.modern)) {
4323 return
4324 }
4325
4326 const isExplicitStaticModern = options.target === utils.TARGETS.static && options.modern;
4327 if (!resources.modernManifest && !isExplicitStaticModern) {
4328 options.modern = false;
4329 return
4330 }
4331
4332 options.modern = options.render.ssr ? 'server' : 'client';
4333 consola__default['default'].info(`Modern bundles are detected. Modern mode (\`${options.modern}\`) is enabled now.`);
4334 }
4335
4336 createRenderer () {
4337 // Resource clientManifest is always required
4338 if (!this.serverContext.resources.clientManifest) {
4339 return
4340 }
4341
4342 this.detectModernBuild();
4343
4344 // Create SPA renderer
4345 if (this.serverContext.resources.spaTemplate) {
4346 this.renderer.spa = new SPARenderer(this.serverContext);
4347 }
4348
4349 // Skip the rest if SSR resources are not available
4350 if (this.serverContext.resources.ssrTemplate && this.serverContext.resources.serverManifest) {
4351 // Create bundle renderer for SSR
4352 this.renderer.ssr = new SSRRenderer(this.serverContext);
4353
4354 if (this.options.modern !== false) {
4355 this.renderer.modern = new ModernRenderer(this.serverContext);
4356 }
4357 }
4358 }
4359
4360 renderSPA (renderContext) {
4361 return this.renderer.spa.render(renderContext)
4362 }
4363
4364 renderSSR (renderContext) {
4365 // Call renderToString from the bundleRenderer and generate the HTML (will update the renderContext as well)
4366 const renderer = renderContext.modern ? this.renderer.modern : this.renderer.ssr;
4367 return renderer.render(renderContext)
4368 }
4369
4370 async renderRoute (url, renderContext = {}, _retried = 0) {
4371 /* istanbul ignore if */
4372 if (!this.isReady) {
4373 // Fall-back to loading-screen if enabled
4374 if (this.options.build.loadingScreen) {
4375 // Tell nuxt middleware to use `server:nuxt:renderLoading hook
4376 return false
4377 }
4378
4379 // Retry
4380 const retryLimit = this.options.dev ? 60 : 3;
4381 if (_retried < retryLimit && this._state !== 'error') {
4382 await this.ready().then(() => utils.waitFor(1000));
4383 return this.renderRoute(url, renderContext, _retried + 1)
4384 }
4385
4386 // Throw Error
4387 switch (this._state) {
4388 case 'created':
4389 throw new Error('Renderer ready() is not called! Please ensure `nuxt.ready()` is called and awaited.')
4390 case 'loading':
4391 throw new Error('Renderer is loading.')
4392 case 'error':
4393 throw this._error
4394 case 'ready':
4395 throw new Error(`Renderer resources are not loaded! Please check possible console errors and ensure dist (${this.distPath}) exists.`)
4396 default:
4397 throw new Error('Renderer is in unknown state!')
4398 }
4399 }
4400
4401 // Log rendered url
4402 consola__default['default'].debug(`Rendering url ${url}`);
4403
4404 // Add url to the renderContext
4405 renderContext.url = url;
4406 // Add target to the renderContext
4407 renderContext.target = this.options.target;
4408
4409 const { req = {}, res = {} } = renderContext;
4410
4411 // renderContext.spa
4412 if (renderContext.spa === undefined) {
4413 // TODO: Remove reading from renderContext.res in Nuxt3
4414 renderContext.spa = !this.SSR || req.spa || res.spa;
4415 }
4416
4417 // renderContext.modern
4418 if (renderContext.modern === undefined) {
4419 const modernMode = this.options.modern;
4420 renderContext.modern = modernMode === 'client' || utils.isModernRequest(req, modernMode);
4421 }
4422
4423 // Set runtime config on renderContext
4424 renderContext.runtimeConfig = {
4425 private: renderContext.spa ? {} : { ...this.options.privateRuntimeConfig },
4426 public: { ...this.options.publicRuntimeConfig }
4427 };
4428
4429 // Call renderContext hook
4430 await this.serverContext.nuxt.callHook('vue-renderer:context', renderContext);
4431
4432 // Render SPA or SSR
4433 return renderContext.spa
4434 ? this.renderSPA(renderContext)
4435 : this.renderSSR(renderContext)
4436 }
4437
4438 get resourceMap () {
4439 return {
4440 clientManifest: {
4441 fileName: 'client.manifest.json',
4442 transform: src => JSON.parse(src)
4443 },
4444 modernManifest: {
4445 fileName: 'modern.manifest.json',
4446 transform: src => JSON.parse(src)
4447 },
4448 serverManifest: {
4449 fileName: 'server.manifest.json',
4450 // BundleRenderer needs resolved contents
4451 transform: async (src, { readResource }) => {
4452 const serverManifest = JSON.parse(src);
4453
4454 const readResources = async (obj) => {
4455 const _obj = {};
4456 await Promise.all(Object.keys(obj).map(async (key) => {
4457 _obj[key] = await readResource(obj[key]);
4458 }));
4459 return _obj
4460 };
4461
4462 const [files, maps] = await Promise.all([
4463 readResources(serverManifest.files),
4464 readResources(serverManifest.maps)
4465 ]);
4466
4467 // Try to parse sourcemaps
4468 for (const map in maps) {
4469 if (maps[map] && maps[map].version) {
4470 continue
4471 }
4472 try {
4473 maps[map] = JSON.parse(maps[map]);
4474 } catch (e) {
4475 maps[map] = { version: 3, sources: [], mappings: '' };
4476 }
4477 }
4478
4479 return {
4480 ...serverManifest,
4481 files,
4482 maps
4483 }
4484 }
4485 },
4486 ssrTemplate: {
4487 fileName: 'index.ssr.html',
4488 transform: src => this.parseTemplate(src)
4489 },
4490 spaTemplate: {
4491 fileName: 'index.spa.html',
4492 transform: src => this.parseTemplate(src)
4493 }
4494 }
4495 }
4496
4497 parseTemplate (templateStr) {
4498 return template_1(templateStr, {
4499 interpolate: /{{([\s\S]+?)}}/g,
4500 evaluate: /{%([\s\S]+?)%}/g
4501 })
4502 }
4503
4504 close () {
4505 if (this.__closed) {
4506 return
4507 }
4508 this.__closed = true;
4509
4510 for (const key in this.renderer) {
4511 delete this.renderer[key];
4512 }
4513 }
4514}
4515
4516exports.VueRenderer = VueRenderer;