1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | 'use strict';
|
9 |
|
10 | Object.defineProperty(exports, '__esModule', { value: true });
|
11 |
|
12 | const path = require('path');
|
13 | const fs = require('fs-extra');
|
14 | const consola = require('consola');
|
15 | const utils = require('@nuxt/utils');
|
16 | const VueMeta = require('vue-meta');
|
17 | const vueServerRenderer = require('vue-server-renderer');
|
18 | const LRU = require('lru-cache');
|
19 | const devalue = require('@nuxt/devalue');
|
20 | const crypto = require('crypto');
|
21 | const util = require('util');
|
22 |
|
23 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
24 |
|
25 | const path__default = _interopDefaultLegacy(path);
|
26 | const fs__default = _interopDefaultLegacy(fs);
|
27 | const consola__default = _interopDefaultLegacy(consola);
|
28 | const VueMeta__default = _interopDefaultLegacy(VueMeta);
|
29 | const LRU__default = _interopDefaultLegacy(LRU);
|
30 | const devalue__default = _interopDefaultLegacy(devalue);
|
31 | const crypto__default = _interopDefaultLegacy(crypto);
|
32 |
|
33 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
34 |
|
35 | function 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 |
|
45 | function commonjsRequire () {
|
46 | throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
47 | }
|
48 |
|
49 |
|
50 | var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
51 |
|
52 | var _freeGlobal = freeGlobal;
|
53 |
|
54 |
|
55 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
56 |
|
57 |
|
58 | var root = _freeGlobal || freeSelf || Function('return this')();
|
59 |
|
60 | var _root = root;
|
61 |
|
62 |
|
63 | var Symbol = _root.Symbol;
|
64 |
|
65 | var _Symbol = Symbol;
|
66 |
|
67 |
|
68 | var objectProto = Object.prototype;
|
69 |
|
70 |
|
71 | var hasOwnProperty = objectProto.hasOwnProperty;
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | var nativeObjectToString = objectProto.toString;
|
79 |
|
80 |
|
81 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | function 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 |
|
110 | var _getRawTag = getRawTag;
|
111 |
|
112 |
|
113 | var objectProto$1 = Object.prototype;
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | var nativeObjectToString$1 = objectProto$1.toString;
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | function objectToString(value) {
|
130 | return nativeObjectToString$1.call(value);
|
131 | }
|
132 |
|
133 | var _objectToString = objectToString;
|
134 |
|
135 |
|
136 | var nullTag = '[object Null]',
|
137 | undefinedTag = '[object Undefined]';
|
138 |
|
139 |
|
140 | var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | function 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 |
|
158 | var _baseGetTag = baseGetTag;
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | function isObject(value) {
|
186 | var type = typeof value;
|
187 | return value != null && (type == 'object' || type == 'function');
|
188 | }
|
189 |
|
190 | var isObject_1 = isObject;
|
191 |
|
192 |
|
193 | var asyncTag = '[object AsyncFunction]',
|
194 | funcTag = '[object Function]',
|
195 | genTag = '[object GeneratorFunction]',
|
196 | proxyTag = '[object Proxy]';
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | function isFunction(value) {
|
216 | if (!isObject_1(value)) {
|
217 | return false;
|
218 | }
|
219 |
|
220 |
|
221 | var tag = _baseGetTag(value);
|
222 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
223 | }
|
224 |
|
225 | var isFunction_1 = isFunction;
|
226 |
|
227 |
|
228 | var coreJsData = _root['__core-js_shared__'];
|
229 |
|
230 | var _coreJsData = coreJsData;
|
231 |
|
232 |
|
233 | var maskSrcKey = (function() {
|
234 | var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
235 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
236 | }());
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 | function isMasked(func) {
|
246 | return !!maskSrcKey && (maskSrcKey in func);
|
247 | }
|
248 |
|
249 | var _isMasked = isMasked;
|
250 |
|
251 |
|
252 | var funcProto = Function.prototype;
|
253 |
|
254 |
|
255 | var funcToString = funcProto.toString;
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 | function 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 |
|
276 | var _toSource = toSource;
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
283 |
|
284 |
|
285 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
286 |
|
287 |
|
288 | var funcProto$1 = Function.prototype,
|
289 | objectProto$2 = Object.prototype;
|
290 |
|
291 |
|
292 | var funcToString$1 = funcProto$1.toString;
|
293 |
|
294 |
|
295 | var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
296 |
|
297 |
|
298 | var reIsNative = RegExp('^' +
|
299 | funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
|
300 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
301 | );
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | function 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 |
|
319 | var _baseIsNative = baseIsNative;
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 | function getValue(object, key) {
|
330 | return object == null ? undefined : object[key];
|
331 | }
|
332 |
|
333 | var _getValue = getValue;
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 | function getNative(object, key) {
|
344 | var value = _getValue(object, key);
|
345 | return _baseIsNative(value) ? value : undefined;
|
346 | }
|
347 |
|
348 | var _getNative = getNative;
|
349 |
|
350 | var defineProperty = (function() {
|
351 | try {
|
352 | var func = _getNative(Object, 'defineProperty');
|
353 | func({}, '', {});
|
354 | return func;
|
355 | } catch (e) {}
|
356 | }());
|
357 |
|
358 | var _defineProperty = defineProperty;
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 | function 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 |
|
382 | var _baseAssignValue = baseAssignValue;
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 | function eq(value, other) {
|
417 | return value === other || (value !== value && other !== other);
|
418 | }
|
419 |
|
420 | var eq_1 = eq;
|
421 |
|
422 |
|
423 | var objectProto$3 = Object.prototype;
|
424 |
|
425 |
|
426 | var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 | function 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 |
|
446 | var _assignValue = assignValue;
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 | function 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 |
|
484 | var _copyObject = copyObject;
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 | function identity(value) {
|
503 | return value;
|
504 | }
|
505 |
|
506 | var identity_1 = identity;
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 | function 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 |
|
528 | var _apply = apply;
|
529 |
|
530 |
|
531 | var nativeMax = Math.max;
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 | function 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 |
|
563 | var _overRest = overRest;
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 | function constant(value) {
|
585 | return function() {
|
586 | return value;
|
587 | };
|
588 | }
|
589 |
|
590 | var constant_1 = constant;
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 | var 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 |
|
609 | var _baseSetToString = baseSetToString;
|
610 |
|
611 |
|
612 | var HOT_COUNT = 800,
|
613 | HOT_SPAN = 16;
|
614 |
|
615 |
|
616 | var nativeNow = Date.now;
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 | function 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 |
|
647 | var _shortOut = shortOut;
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 | var setToString = _shortOut(_baseSetToString);
|
658 |
|
659 | var _setToString = setToString;
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 | function baseRest(func, start) {
|
670 | return _setToString(_overRest(func, start, identity_1), func + '');
|
671 | }
|
672 |
|
673 | var _baseRest = baseRest;
|
674 |
|
675 |
|
676 | var MAX_SAFE_INTEGER = 9007199254740991;
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 | function isLength(value) {
|
705 | return typeof value == 'number' &&
|
706 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
707 | }
|
708 |
|
709 | var isLength_1 = isLength;
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 | function isArrayLike(value) {
|
737 | return value != null && isLength_1(value.length) && !isFunction_1(value);
|
738 | }
|
739 |
|
740 | var isArrayLike_1 = isArrayLike;
|
741 |
|
742 |
|
743 | var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
744 |
|
745 |
|
746 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 | function 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 |
|
766 | var _isIndex = isIndex;
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | function 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 |
|
792 | var _isIterateeCall = isIterateeCall;
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 | function 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 |
|
827 | var _createAssigner = createAssigner;
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 | function 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 |
|
848 | var _baseTimes = baseTimes;
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | function isObjectLike(value) {
|
875 | return value != null && typeof value == 'object';
|
876 | }
|
877 |
|
878 | var isObjectLike_1 = isObjectLike;
|
879 |
|
880 |
|
881 | var argsTag = '[object Arguments]';
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 | function baseIsArguments(value) {
|
891 | return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
|
892 | }
|
893 |
|
894 | var _baseIsArguments = baseIsArguments;
|
895 |
|
896 |
|
897 | var objectProto$4 = Object.prototype;
|
898 |
|
899 |
|
900 | var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
901 |
|
902 |
|
903 | var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 | var 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 |
|
928 | var isArguments_1 = isArguments;
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 | var isArray = Array.isArray;
|
954 |
|
955 | var isArray_1 = isArray;
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 | function stubFalse() {
|
971 | return false;
|
972 | }
|
973 |
|
974 | var stubFalse_1 = stubFalse;
|
975 |
|
976 | var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
977 |
|
978 | var freeExports = exports && !exports.nodeType && exports;
|
979 |
|
980 |
|
981 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
982 |
|
983 |
|
984 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
985 |
|
986 |
|
987 | var Buffer = moduleExports ? _root.Buffer : undefined;
|
988 |
|
989 |
|
990 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 | var isBuffer = nativeIsBuffer || stubFalse_1;
|
1010 |
|
1011 | module.exports = isBuffer;
|
1012 | });
|
1013 |
|
1014 |
|
1015 | var 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 |
|
1029 | var 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 |
|
1042 | var typedArrayTags = {};
|
1043 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
1044 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
1045 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
1046 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
1047 | typedArrayTags[uint32Tag] = true;
|
1048 | typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
|
1049 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
1050 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
1051 | typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
|
1052 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
1053 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
1054 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
1055 | typedArrayTags[weakMapTag] = false;
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 | function baseIsTypedArray(value) {
|
1065 | return isObjectLike_1(value) &&
|
1066 | isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
1067 | }
|
1068 |
|
1069 | var _baseIsTypedArray = baseIsTypedArray;
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | function baseUnary(func) {
|
1079 | return function(value) {
|
1080 | return func(value);
|
1081 | };
|
1082 | }
|
1083 |
|
1084 | var _baseUnary = baseUnary;
|
1085 |
|
1086 | var _nodeUtil = createCommonjsModule(function (module, exports) {
|
1087 |
|
1088 | var freeExports = exports && !exports.nodeType && exports;
|
1089 |
|
1090 |
|
1091 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
1092 |
|
1093 |
|
1094 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1095 |
|
1096 |
|
1097 | var freeProcess = moduleExports && _freeGlobal.process;
|
1098 |
|
1099 |
|
1100 | var nodeUtil = (function() {
|
1101 | try {
|
1102 |
|
1103 | var types = freeModule && freeModule.require && freeModule.require('util').types;
|
1104 |
|
1105 | if (types) {
|
1106 | return types;
|
1107 | }
|
1108 |
|
1109 |
|
1110 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
1111 | } catch (e) {}
|
1112 | }());
|
1113 |
|
1114 | module.exports = nodeUtil;
|
1115 | });
|
1116 |
|
1117 |
|
1118 | var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 | var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
1138 |
|
1139 | var isTypedArray_1 = isTypedArray;
|
1140 |
|
1141 |
|
1142 | var objectProto$5 = Object.prototype;
|
1143 |
|
1144 |
|
1145 | var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 | function 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 |
|
1168 | key == 'length' ||
|
1169 |
|
1170 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
1171 |
|
1172 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
1173 |
|
1174 | _isIndex(key, length)
|
1175 | ))) {
|
1176 | result.push(key);
|
1177 | }
|
1178 | }
|
1179 | return result;
|
1180 | }
|
1181 |
|
1182 | var _arrayLikeKeys = arrayLikeKeys;
|
1183 |
|
1184 |
|
1185 | var objectProto$6 = Object.prototype;
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 | function isPrototype(value) {
|
1195 | var Ctor = value && value.constructor,
|
1196 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
|
1197 |
|
1198 | return value === proto;
|
1199 | }
|
1200 |
|
1201 | var _isPrototype = isPrototype;
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 | function 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 |
|
1222 | var _nativeKeysIn = nativeKeysIn;
|
1223 |
|
1224 |
|
1225 | var objectProto$7 = Object.prototype;
|
1226 |
|
1227 |
|
1228 | var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 | function 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 |
|
1252 | var _baseKeysIn = baseKeysIn;
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 | function keysIn(object) {
|
1278 | return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
1279 | }
|
1280 |
|
1281 | var keysIn_1 = keysIn;
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 | var assignInWith = _createAssigner(function(object, source, srcIndex, customizer) {
|
1313 | _copyObject(source, keysIn_1(source), object, customizer);
|
1314 | });
|
1315 |
|
1316 | var assignInWith_1 = assignInWith;
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 | function overArg(func, transform) {
|
1327 | return function(arg) {
|
1328 | return func(transform(arg));
|
1329 | };
|
1330 | }
|
1331 |
|
1332 | var _overArg = overArg;
|
1333 |
|
1334 |
|
1335 | var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
1336 |
|
1337 | var _getPrototype = getPrototype;
|
1338 |
|
1339 |
|
1340 | var objectTag$1 = '[object Object]';
|
1341 |
|
1342 |
|
1343 | var funcProto$2 = Function.prototype,
|
1344 | objectProto$8 = Object.prototype;
|
1345 |
|
1346 |
|
1347 | var funcToString$2 = funcProto$2.toString;
|
1348 |
|
1349 |
|
1350 | var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
1351 |
|
1352 |
|
1353 | var objectCtorString = funcToString$2.call(Object);
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 | function 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 |
|
1396 | var isPlainObject_1 = isPlainObject;
|
1397 |
|
1398 |
|
1399 | var domExcTag = '[object DOMException]',
|
1400 | errorTag$1 = '[object Error]';
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 | function 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 |
|
1429 | var isError_1 = isError;
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 | var 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 |
|
1461 | var attempt_1 = attempt;
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 | function 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 |
|
1483 | var _arrayMap = arrayMap;
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 | function baseValues(object, props) {
|
1496 | return _arrayMap(props, function(key) {
|
1497 | return object[key];
|
1498 | });
|
1499 | }
|
1500 |
|
1501 | var _baseValues = baseValues;
|
1502 |
|
1503 |
|
1504 | var objectProto$9 = Object.prototype;
|
1505 |
|
1506 |
|
1507 | var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 | function 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 |
|
1529 | var _customDefaultsAssignIn = customDefaultsAssignIn;
|
1530 |
|
1531 |
|
1532 | var stringEscapes = {
|
1533 | '\\': '\\',
|
1534 | "'": "'",
|
1535 | '\n': 'n',
|
1536 | '\r': 'r',
|
1537 | '\u2028': 'u2028',
|
1538 | '\u2029': 'u2029'
|
1539 | };
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 | function escapeStringChar(chr) {
|
1549 | return '\\' + stringEscapes[chr];
|
1550 | }
|
1551 |
|
1552 | var _escapeStringChar = escapeStringChar;
|
1553 |
|
1554 |
|
1555 | var nativeKeys = _overArg(Object.keys, Object);
|
1556 |
|
1557 | var _nativeKeys = nativeKeys;
|
1558 |
|
1559 |
|
1560 | var objectProto$a = Object.prototype;
|
1561 |
|
1562 |
|
1563 | var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 | function 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 |
|
1585 | var _baseKeys = baseKeys;
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 | function keys(object) {
|
1616 | return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
|
1617 | }
|
1618 |
|
1619 | var keys_1 = keys;
|
1620 |
|
1621 |
|
1622 | var reInterpolate = /<%=([\s\S]+?)%>/g;
|
1623 |
|
1624 | var _reInterpolate = reInterpolate;
|
1625 |
|
1626 |
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 | function basePropertyOf(object) {
|
1634 | return function(key) {
|
1635 | return object == null ? undefined : object[key];
|
1636 | };
|
1637 | }
|
1638 |
|
1639 | var _basePropertyOf = basePropertyOf;
|
1640 |
|
1641 |
|
1642 | var htmlEscapes = {
|
1643 | '&': '&',
|
1644 | '<': '<',
|
1645 | '>': '>',
|
1646 | '"': '"',
|
1647 | "'": '''
|
1648 | };
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 | var escapeHtmlChar = _basePropertyOf(htmlEscapes);
|
1658 |
|
1659 | var _escapeHtmlChar = escapeHtmlChar;
|
1660 |
|
1661 |
|
1662 | var symbolTag = '[object Symbol]';
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 | function isSymbol(value) {
|
1682 | return typeof value == 'symbol' ||
|
1683 | (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
1684 | }
|
1685 |
|
1686 | var isSymbol_1 = isSymbol;
|
1687 |
|
1688 |
|
1689 | var INFINITY = 1 / 0;
|
1690 |
|
1691 |
|
1692 | var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
1693 | symbolToString = symbolProto ? symbolProto.toString : undefined;
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 | function baseToString(value) {
|
1704 |
|
1705 | if (typeof value == 'string') {
|
1706 | return value;
|
1707 | }
|
1708 | if (isArray_1(value)) {
|
1709 |
|
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 |
|
1719 | var _baseToString = baseToString;
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 | function toString(value) {
|
1743 | return value == null ? '' : _baseToString(value);
|
1744 | }
|
1745 |
|
1746 | var toString_1 = toString;
|
1747 |
|
1748 |
|
1749 | var reUnescapedHtml = /[&<>"']/g,
|
1750 | reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 | function escape(string) {
|
1781 | string = toString_1(string);
|
1782 | return (string && reHasUnescapedHtml.test(string))
|
1783 | ? string.replace(reUnescapedHtml, _escapeHtmlChar)
|
1784 | : string;
|
1785 | }
|
1786 |
|
1787 | var _escape = escape;
|
1788 |
|
1789 |
|
1790 | var reEscape = /<%-([\s\S]+?)%>/g;
|
1791 |
|
1792 | var _reEscape = reEscape;
|
1793 |
|
1794 |
|
1795 | var reEvaluate = /<%([\s\S]+?)%>/g;
|
1796 |
|
1797 | var _reEvaluate = reEvaluate;
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 | var templateSettings = {
|
1809 |
|
1810 | |
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 | 'escape': _reEscape,
|
1817 |
|
1818 | |
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 | 'evaluate': _reEvaluate,
|
1825 |
|
1826 | |
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 | 'interpolate': _reInterpolate,
|
1833 |
|
1834 | |
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 | 'variable': '',
|
1841 |
|
1842 | |
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 | 'imports': {
|
1849 |
|
1850 | |
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 | '_': { 'escape': _escape }
|
1857 | }
|
1858 | };
|
1859 |
|
1860 | var templateSettings_1 = templateSettings;
|
1861 |
|
1862 |
|
1863 | var reEmptyStringLeading = /\b__p \+= '';/g,
|
1864 | reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
1865 | reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 | var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
1872 |
|
1873 |
|
1874 | var reNoMatch = /($^)/;
|
1875 |
|
1876 |
|
1877 | var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
1878 |
|
1879 |
|
1880 | var objectProto$b = Object.prototype;
|
1881 |
|
1882 |
|
1883 | var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 | function template(string, options, guard) {
|
1990 |
|
1991 |
|
1992 |
|
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 |
|
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 |
|
2020 |
|
2021 |
|
2022 |
|
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 |
|
2033 | source += string.slice(index, offset).replace(reUnescapedString, _escapeStringChar);
|
2034 |
|
2035 |
|
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 |
|
2050 |
|
2051 | return match;
|
2052 | });
|
2053 |
|
2054 | source += "';\n";
|
2055 |
|
2056 |
|
2057 |
|
2058 | var variable = hasOwnProperty$9.call(options, 'variable') && options.variable;
|
2059 | if (!variable) {
|
2060 | source = 'with (obj) {\n' + source + '\n}\n';
|
2061 | }
|
2062 |
|
2063 | source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
|
2064 | .replace(reEmptyStringMiddle, '$1')
|
2065 | .replace(reEmptyStringTrailing, '$1;');
|
2066 |
|
2067 |
|
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 |
|
2092 |
|
2093 | result.source = source;
|
2094 | if (isError_1(result)) {
|
2095 | throw result;
|
2096 | }
|
2097 | return result;
|
2098 | }
|
2099 |
|
2100 | var template_1 = template;
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 | function listCacheClear() {
|
2110 | this.__data__ = [];
|
2111 | this.size = 0;
|
2112 | }
|
2113 |
|
2114 | var _listCacheClear = listCacheClear;
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 | function 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 |
|
2134 | var _assocIndexOf = assocIndexOf;
|
2135 |
|
2136 |
|
2137 | var arrayProto = Array.prototype;
|
2138 |
|
2139 |
|
2140 | var splice = arrayProto.splice;
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 | function 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 |
|
2168 | var _listCacheDelete = listCacheDelete;
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 | function listCacheGet(key) {
|
2180 | var data = this.__data__,
|
2181 | index = _assocIndexOf(data, key);
|
2182 |
|
2183 | return index < 0 ? undefined : data[index][1];
|
2184 | }
|
2185 |
|
2186 | var _listCacheGet = listCacheGet;
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 | function listCacheHas(key) {
|
2198 | return _assocIndexOf(this.__data__, key) > -1;
|
2199 | }
|
2200 |
|
2201 | var _listCacheHas = listCacheHas;
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 | function 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 |
|
2226 | var _listCacheSet = listCacheSet;
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 | function 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 |
|
2247 | ListCache.prototype.clear = _listCacheClear;
|
2248 | ListCache.prototype['delete'] = _listCacheDelete;
|
2249 | ListCache.prototype.get = _listCacheGet;
|
2250 | ListCache.prototype.has = _listCacheHas;
|
2251 | ListCache.prototype.set = _listCacheSet;
|
2252 |
|
2253 | var _ListCache = ListCache;
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 | function stackClear() {
|
2263 | this.__data__ = new _ListCache;
|
2264 | this.size = 0;
|
2265 | }
|
2266 |
|
2267 | var _stackClear = stackClear;
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 | function stackDelete(key) {
|
2279 | var data = this.__data__,
|
2280 | result = data['delete'](key);
|
2281 |
|
2282 | this.size = data.size;
|
2283 | return result;
|
2284 | }
|
2285 |
|
2286 | var _stackDelete = stackDelete;
|
2287 |
|
2288 |
|
2289 |
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 | function stackGet(key) {
|
2298 | return this.__data__.get(key);
|
2299 | }
|
2300 |
|
2301 | var _stackGet = stackGet;
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 | function stackHas(key) {
|
2313 | return this.__data__.has(key);
|
2314 | }
|
2315 |
|
2316 | var _stackHas = stackHas;
|
2317 |
|
2318 |
|
2319 | var Map = _getNative(_root, 'Map');
|
2320 |
|
2321 | var _Map = Map;
|
2322 |
|
2323 |
|
2324 | var nativeCreate = _getNative(Object, 'create');
|
2325 |
|
2326 | var _nativeCreate = nativeCreate;
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 | function hashClear() {
|
2336 | this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
2337 | this.size = 0;
|
2338 | }
|
2339 |
|
2340 | var _hashClear = hashClear;
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 | function hashDelete(key) {
|
2353 | var result = this.has(key) && delete this.__data__[key];
|
2354 | this.size -= result ? 1 : 0;
|
2355 | return result;
|
2356 | }
|
2357 |
|
2358 | var _hashDelete = hashDelete;
|
2359 |
|
2360 |
|
2361 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
2362 |
|
2363 |
|
2364 | var objectProto$c = Object.prototype;
|
2365 |
|
2366 |
|
2367 | var hasOwnProperty$a = objectProto$c.hasOwnProperty;
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 | function 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 |
|
2387 | var _hashGet = hashGet;
|
2388 |
|
2389 |
|
2390 | var objectProto$d = Object.prototype;
|
2391 |
|
2392 |
|
2393 | var hasOwnProperty$b = objectProto$d.hasOwnProperty;
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 | function hashHas(key) {
|
2405 | var data = this.__data__;
|
2406 | return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$b.call(data, key);
|
2407 | }
|
2408 |
|
2409 | var _hashHas = hashHas;
|
2410 |
|
2411 |
|
2412 | var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 | function 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 |
|
2431 | var _hashSet = hashSet;
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 | function 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 |
|
2452 | Hash.prototype.clear = _hashClear;
|
2453 | Hash.prototype['delete'] = _hashDelete;
|
2454 | Hash.prototype.get = _hashGet;
|
2455 | Hash.prototype.has = _hashHas;
|
2456 | Hash.prototype.set = _hashSet;
|
2457 |
|
2458 | var _Hash = Hash;
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 | function mapCacheClear() {
|
2468 | this.size = 0;
|
2469 | this.__data__ = {
|
2470 | 'hash': new _Hash,
|
2471 | 'map': new (_Map || _ListCache),
|
2472 | 'string': new _Hash
|
2473 | };
|
2474 | }
|
2475 |
|
2476 | var _mapCacheClear = mapCacheClear;
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 | function 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 |
|
2492 | var _isKeyable = isKeyable;
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 | function getMapData(map, key) {
|
2503 | var data = map.__data__;
|
2504 | return _isKeyable(key)
|
2505 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
2506 | : data.map;
|
2507 | }
|
2508 |
|
2509 | var _getMapData = getMapData;
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 | function mapCacheDelete(key) {
|
2521 | var result = _getMapData(this, key)['delete'](key);
|
2522 | this.size -= result ? 1 : 0;
|
2523 | return result;
|
2524 | }
|
2525 |
|
2526 | var _mapCacheDelete = mapCacheDelete;
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 | function mapCacheGet(key) {
|
2538 | return _getMapData(this, key).get(key);
|
2539 | }
|
2540 |
|
2541 | var _mapCacheGet = mapCacheGet;
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 | function mapCacheHas(key) {
|
2553 | return _getMapData(this, key).has(key);
|
2554 | }
|
2555 |
|
2556 | var _mapCacheHas = mapCacheHas;
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 | function 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 |
|
2577 | var _mapCacheSet = mapCacheSet;
|
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 | function 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 |
|
2598 | MapCache.prototype.clear = _mapCacheClear;
|
2599 | MapCache.prototype['delete'] = _mapCacheDelete;
|
2600 | MapCache.prototype.get = _mapCacheGet;
|
2601 | MapCache.prototype.has = _mapCacheHas;
|
2602 | MapCache.prototype.set = _mapCacheSet;
|
2603 |
|
2604 | var _MapCache = MapCache;
|
2605 |
|
2606 |
|
2607 | var LARGE_ARRAY_SIZE = 200;
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 | function 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 |
|
2635 | var _stackSet = stackSet;
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 | function Stack(entries) {
|
2645 | var data = this.__data__ = new _ListCache(entries);
|
2646 | this.size = data.size;
|
2647 | }
|
2648 |
|
2649 |
|
2650 | Stack.prototype.clear = _stackClear;
|
2651 | Stack.prototype['delete'] = _stackDelete;
|
2652 | Stack.prototype.get = _stackGet;
|
2653 | Stack.prototype.has = _stackHas;
|
2654 | Stack.prototype.set = _stackSet;
|
2655 |
|
2656 | var _Stack = Stack;
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 | function 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 |
|
2679 | var _arrayEach = arrayEach;
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 | function baseAssign(object, source) {
|
2691 | return object && _copyObject(source, keys_1(source), object);
|
2692 | }
|
2693 |
|
2694 | var _baseAssign = baseAssign;
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 | function baseAssignIn(object, source) {
|
2706 | return object && _copyObject(source, keysIn_1(source), object);
|
2707 | }
|
2708 |
|
2709 | var _baseAssignIn = baseAssignIn;
|
2710 |
|
2711 | var _cloneBuffer = createCommonjsModule(function (module, exports) {
|
2712 |
|
2713 | var freeExports = exports && !exports.nodeType && exports;
|
2714 |
|
2715 |
|
2716 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
2717 |
|
2718 |
|
2719 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
2720 |
|
2721 |
|
2722 | var Buffer = moduleExports ? _root.Buffer : undefined,
|
2723 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 | function 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 |
|
2744 | module.exports = cloneBuffer;
|
2745 | });
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 | function 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 |
|
2766 | var _copyArray = copyArray;
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 | function 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 |
|
2792 | var _arrayFilter = arrayFilter;
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 | function stubArray() {
|
2813 | return [];
|
2814 | }
|
2815 |
|
2816 | var stubArray_1 = stubArray;
|
2817 |
|
2818 |
|
2819 | var objectProto$e = Object.prototype;
|
2820 |
|
2821 |
|
2822 | var propertyIsEnumerable$1 = objectProto$e.propertyIsEnumerable;
|
2823 |
|
2824 |
|
2825 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 | var 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 |
|
2844 | var _getSymbols = getSymbols;
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 | function copySymbols(source, object) {
|
2855 | return _copyObject(source, _getSymbols(source), object);
|
2856 | }
|
2857 |
|
2858 | var _copySymbols = copySymbols;
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 | function 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 |
|
2879 | var _arrayPush = arrayPush;
|
2880 |
|
2881 |
|
2882 | var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 | var 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 |
|
2900 | var _getSymbolsIn = getSymbolsIn;
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 | function copySymbolsIn(source, object) {
|
2911 | return _copyObject(source, _getSymbolsIn(source), object);
|
2912 | }
|
2913 |
|
2914 | var _copySymbolsIn = copySymbolsIn;
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
2928 | var result = keysFunc(object);
|
2929 | return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
|
2930 | }
|
2931 |
|
2932 | var _baseGetAllKeys = baseGetAllKeys;
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 | function getAllKeys(object) {
|
2942 | return _baseGetAllKeys(object, keys_1, _getSymbols);
|
2943 | }
|
2944 |
|
2945 | var _getAllKeys = getAllKeys;
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 | function getAllKeysIn(object) {
|
2956 | return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
|
2957 | }
|
2958 |
|
2959 | var _getAllKeysIn = getAllKeysIn;
|
2960 |
|
2961 |
|
2962 | var DataView = _getNative(_root, 'DataView');
|
2963 |
|
2964 | var _DataView = DataView;
|
2965 |
|
2966 |
|
2967 | var Promise$1 = _getNative(_root, 'Promise');
|
2968 |
|
2969 | var _Promise = Promise$1;
|
2970 |
|
2971 |
|
2972 | var Set = _getNative(_root, 'Set');
|
2973 |
|
2974 | var _Set = Set;
|
2975 |
|
2976 |
|
2977 | var WeakMap = _getNative(_root, 'WeakMap');
|
2978 |
|
2979 | var _WeakMap = WeakMap;
|
2980 |
|
2981 |
|
2982 | var mapTag$1 = '[object Map]',
|
2983 | objectTag$2 = '[object Object]',
|
2984 | promiseTag = '[object Promise]',
|
2985 | setTag$1 = '[object Set]',
|
2986 | weakMapTag$1 = '[object WeakMap]';
|
2987 |
|
2988 | var dataViewTag$1 = '[object DataView]';
|
2989 |
|
2990 |
|
2991 | var dataViewCtorString = _toSource(_DataView),
|
2992 | mapCtorString = _toSource(_Map),
|
2993 | promiseCtorString = _toSource(_Promise),
|
2994 | setCtorString = _toSource(_Set),
|
2995 | weakMapCtorString = _toSource(_WeakMap);
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 |
|
3004 | var getTag = _baseGetTag;
|
3005 |
|
3006 |
|
3007 | if ((_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 |
|
3030 | var _getTag = getTag;
|
3031 |
|
3032 |
|
3033 | var objectProto$f = Object.prototype;
|
3034 |
|
3035 |
|
3036 | var hasOwnProperty$c = objectProto$f.hasOwnProperty;
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 | function initCloneArray(array) {
|
3046 | var length = array.length,
|
3047 | result = new array.constructor(length);
|
3048 |
|
3049 |
|
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 |
|
3057 | var _initCloneArray = initCloneArray;
|
3058 |
|
3059 |
|
3060 | var Uint8Array = _root.Uint8Array;
|
3061 |
|
3062 | var _Uint8Array = Uint8Array;
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 | function cloneArrayBuffer(arrayBuffer) {
|
3072 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
3073 | new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
|
3074 | return result;
|
3075 | }
|
3076 |
|
3077 | var _cloneArrayBuffer = cloneArrayBuffer;
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 | function cloneDataView(dataView, isDeep) {
|
3088 | var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
3089 | return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
3090 | }
|
3091 |
|
3092 | var _cloneDataView = cloneDataView;
|
3093 |
|
3094 |
|
3095 | var reFlags = /\w*$/;
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 | function cloneRegExp(regexp) {
|
3105 | var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
3106 | result.lastIndex = regexp.lastIndex;
|
3107 | return result;
|
3108 | }
|
3109 |
|
3110 | var _cloneRegExp = cloneRegExp;
|
3111 |
|
3112 |
|
3113 | var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
3114 | symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 | function cloneSymbol(symbol) {
|
3124 | return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
3125 | }
|
3126 |
|
3127 | var _cloneSymbol = cloneSymbol;
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 | function cloneTypedArray(typedArray, isDeep) {
|
3138 | var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
3139 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
3140 | }
|
3141 |
|
3142 | var _cloneTypedArray = cloneTypedArray;
|
3143 |
|
3144 |
|
3145 | var 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 |
|
3154 | var 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 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 | function 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 |
|
3214 | var _initCloneByTag = initCloneByTag;
|
3215 |
|
3216 |
|
3217 | var objectCreate = Object.create;
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 | var 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 |
|
3243 | var _baseCreate = baseCreate;
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 |
|
3252 | function initCloneObject(object) {
|
3253 | return (typeof object.constructor == 'function' && !_isPrototype(object))
|
3254 | ? _baseCreate(_getPrototype(object))
|
3255 | : {};
|
3256 | }
|
3257 |
|
3258 | var _initCloneObject = initCloneObject;
|
3259 |
|
3260 |
|
3261 | var mapTag$3 = '[object Map]';
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 | function baseIsMap(value) {
|
3271 | return isObjectLike_1(value) && _getTag(value) == mapTag$3;
|
3272 | }
|
3273 |
|
3274 | var _baseIsMap = baseIsMap;
|
3275 |
|
3276 |
|
3277 | var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 | var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
|
3297 |
|
3298 | var isMap_1 = isMap;
|
3299 |
|
3300 |
|
3301 | var setTag$3 = '[object Set]';
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 | function baseIsSet(value) {
|
3311 | return isObjectLike_1(value) && _getTag(value) == setTag$3;
|
3312 | }
|
3313 |
|
3314 | var _baseIsSet = baseIsSet;
|
3315 |
|
3316 |
|
3317 | var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 | var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
|
3337 |
|
3338 | var isSet_1 = isSet;
|
3339 |
|
3340 |
|
3341 | var CLONE_DEEP_FLAG = 1,
|
3342 | CLONE_FLAT_FLAG = 2,
|
3343 | CLONE_SYMBOLS_FLAG = 4;
|
3344 |
|
3345 |
|
3346 | var 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 |
|
3362 | var 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 |
|
3375 | var cloneableTags = {};
|
3376 | cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
|
3377 | cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
|
3378 | cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
|
3379 | cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
|
3380 | cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
|
3381 | cloneableTags[int32Tag$2] = cloneableTags[mapTag$4] =
|
3382 | cloneableTags[numberTag$2] = cloneableTags[objectTag$3] =
|
3383 | cloneableTags[regexpTag$2] = cloneableTags[setTag$4] =
|
3384 | cloneableTags[stringTag$2] = cloneableTags[symbolTag$2] =
|
3385 | cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
|
3386 | cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
|
3387 | cloneableTags[errorTag$2] = cloneableTags[funcTag$2] =
|
3388 | cloneableTags[weakMapTag$2] = false;
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 | function 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 |
|
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 |
|
3477 | _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
3478 | });
|
3479 | return result;
|
3480 | }
|
3481 |
|
3482 | var _baseClone = baseClone;
|
3483 |
|
3484 |
|
3485 | var CLONE_DEEP_FLAG$1 = 1,
|
3486 | CLONE_SYMBOLS_FLAG$1 = 4;
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 | function cloneDeep(value) {
|
3507 | return _baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
|
3508 | }
|
3509 |
|
3510 | var cloneDeep_1 = cloneDeep;
|
3511 |
|
3512 | class 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 |
|
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 |
|
3538 | class 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 |
|
3567 |
|
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 |
|
3582 | renderContext.head = typeof this.options.head === 'function'
|
3583 | ? this.options.head()
|
3584 | : cloneDeep_1(this.options.head);
|
3585 | }
|
3586 |
|
3587 |
|
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 |
|
3594 | meta.HTML_ATTRS = m.htmlAttrs.text();
|
3595 |
|
3596 |
|
3597 | meta.HEAD_ATTRS = m.headAttrs.text();
|
3598 |
|
3599 |
|
3600 | meta.BODY_ATTRS = m.bodyAttrs.text();
|
3601 |
|
3602 |
|
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 |
|
3612 | if (this.options._routerBaseSpecified) {
|
3613 | meta.HEAD += `<base href="${this.options.router.base}">`;
|
3614 | }
|
3615 |
|
3616 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
3677 | if (meta.resourceHints) {
|
3678 | meta.HEAD += meta.resourceHints;
|
3679 | }
|
3680 | }
|
3681 |
|
3682 |
|
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 |
|
3691 | const templateParams = {
|
3692 | ...meta,
|
3693 | APP,
|
3694 | ENV: this.options.env
|
3695 | };
|
3696 |
|
3697 |
|
3698 | await this.serverContext.nuxt.callHook('vue-renderer:spa:templateParams', templateParams);
|
3699 |
|
3700 |
|
3701 | const html = this.renderTemplate(this.serverContext.resources.spaTemplate, templateParams);
|
3702 | const content = {
|
3703 | html,
|
3704 | preloadFiles: meta.preloadFiles || []
|
3705 | };
|
3706 |
|
3707 |
|
3708 | this.cache.set(cacheKey, content);
|
3709 |
|
3710 |
|
3711 |
|
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|avif/.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 |
|
3741 | class 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 |
|
3748 | basedir: hasModules ? this.options.rootDir : __dirname,
|
3749 | ...this.options.render.bundleRenderer
|
3750 | }
|
3751 | }
|
3752 |
|
3753 | addAttrs (tags, referenceTag, referenceAttr) {
|
3754 | const reference = referenceTag ? `<${referenceTag}` : referenceAttr;
|
3755 | if (!reference) {
|
3756 | return tags
|
3757 | }
|
3758 |
|
3759 | const { render: { crossorigin } } = this.options;
|
3760 | if (crossorigin) {
|
3761 | tags = tags.replace(
|
3762 | new RegExp(reference, 'g'),
|
3763 | `${reference} crossorigin="${crossorigin}"`
|
3764 | );
|
3765 | }
|
3766 |
|
3767 | return tags
|
3768 | }
|
3769 |
|
3770 | renderResourceHints (renderContext) {
|
3771 | return this.addAttrs(renderContext.renderResourceHints(), null, 'rel="preload"')
|
3772 | }
|
3773 |
|
3774 | renderScripts (renderContext) {
|
3775 | return this.addAttrs(renderContext.renderScripts(), 'script')
|
3776 | }
|
3777 |
|
3778 | renderStyles (renderContext) {
|
3779 | return this.addAttrs(renderContext.renderStyles(), 'link')
|
3780 | }
|
3781 |
|
3782 | getPreloadFiles (renderContext) {
|
3783 | return renderContext.getPreloadFiles()
|
3784 | }
|
3785 |
|
3786 | createRenderer () {
|
3787 |
|
3788 | return vueServerRenderer.createBundleRenderer(
|
3789 | this.serverContext.resources.serverManifest,
|
3790 | this.rendererOptions
|
3791 | )
|
3792 | }
|
3793 |
|
3794 | useSSRLog () {
|
3795 | if (!this.options.render.ssrLog) {
|
3796 | return
|
3797 | }
|
3798 | const logs = [];
|
3799 | const devReporter = {
|
3800 | log (logObj) {
|
3801 | logs.push({
|
3802 | ...logObj,
|
3803 | args: logObj.args.map(arg => util.format(arg))
|
3804 | });
|
3805 | }
|
3806 | };
|
3807 | consola__default['default'].addReporter(devReporter);
|
3808 |
|
3809 | return () => {
|
3810 | consola__default['default'].removeReporter(devReporter);
|
3811 | return logs
|
3812 | }
|
3813 | }
|
3814 |
|
3815 | async render (renderContext) {
|
3816 |
|
3817 | await this.serverContext.nuxt.callHook('vue-renderer:ssr:prepareContext', renderContext);
|
3818 |
|
3819 | const getSSRLog = this.useSSRLog();
|
3820 |
|
3821 |
|
3822 | let APP = await this.vueRenderer.renderToString(renderContext);
|
3823 |
|
3824 | if (typeof getSSRLog === 'function') {
|
3825 | renderContext.nuxt.logs = getSSRLog();
|
3826 | }
|
3827 |
|
3828 |
|
3829 | await this.serverContext.nuxt.callHook('vue-renderer:ssr:context', renderContext);
|
3830 |
|
3831 |
|
3832 | await this.serverContext.nuxt.callHook('_render:context', renderContext.nuxt);
|
3833 |
|
3834 |
|
3835 | if (!renderContext.nuxt.serverRendered) {
|
3836 | APP = `<div id="${this.serverContext.globals.id}"></div>`;
|
3837 | }
|
3838 |
|
3839 |
|
3840 | if (renderContext.redirected && renderContext.target === utils.TARGETS.server) {
|
3841 | return {
|
3842 | html: APP,
|
3843 | error: renderContext.nuxt.error,
|
3844 | redirected: renderContext.redirected
|
3845 | }
|
3846 | }
|
3847 |
|
3848 | let HEAD = '';
|
3849 |
|
3850 |
|
3851 |
|
3852 | const meta = renderContext.meta && renderContext.meta.inject({
|
3853 | isSSR: renderContext.nuxt.serverRendered,
|
3854 | ln: this.options.dev
|
3855 | });
|
3856 |
|
3857 | if (meta) {
|
3858 | HEAD += meta.title.text() + meta.meta.text();
|
3859 | }
|
3860 |
|
3861 |
|
3862 | if (this.options._routerBaseSpecified) {
|
3863 | HEAD += `<base href="${this.options.router.base}">`;
|
3864 | }
|
3865 |
|
3866 | if (meta) {
|
3867 | HEAD += meta.link.text() +
|
3868 | meta.style.text() +
|
3869 | meta.script.text() +
|
3870 | meta.noscript.text();
|
3871 | }
|
3872 |
|
3873 |
|
3874 | const shouldInjectScripts = this.options.render.injectScripts !== false;
|
3875 |
|
3876 |
|
3877 | if (this.options.render.resourceHints && shouldInjectScripts) {
|
3878 | HEAD += this.renderResourceHints(renderContext);
|
3879 | }
|
3880 |
|
3881 |
|
3882 | HEAD += this.renderStyles(renderContext);
|
3883 |
|
3884 | if (meta) {
|
3885 | const prependInjectorOptions = { pbody: true };
|
3886 |
|
3887 | const BODY_PREPEND =
|
3888 | meta.meta.text(prependInjectorOptions) +
|
3889 | meta.link.text(prependInjectorOptions) +
|
3890 | meta.style.text(prependInjectorOptions) +
|
3891 | meta.script.text(prependInjectorOptions) +
|
3892 | meta.noscript.text(prependInjectorOptions);
|
3893 |
|
3894 | if (BODY_PREPEND) {
|
3895 | APP = `${BODY_PREPEND}${APP}`;
|
3896 | }
|
3897 | }
|
3898 |
|
3899 | const { csp } = this.options.render;
|
3900 |
|
3901 | const containsUnsafeInlineScriptSrc = csp.policies && csp.policies['script-src'] && csp.policies['script-src'].includes('\'unsafe-inline\'');
|
3902 | const shouldHashCspScriptSrc = csp && (csp.unsafeInlineCompatibility || !containsUnsafeInlineScriptSrc);
|
3903 | const inlineScripts = [];
|
3904 |
|
3905 | if (renderContext.staticAssetsBase) {
|
3906 | const preloadScripts = [];
|
3907 | renderContext.staticAssets = [];
|
3908 | const routerBase = this.options.router.base;
|
3909 | const { staticAssetsBase, url, nuxt, staticAssets } = renderContext;
|
3910 | const { data, fetch, mutations, ...state } = nuxt;
|
3911 |
|
3912 |
|
3913 | const stateScript = `window.${this.serverContext.globals.context}=${devalue__default['default']({
|
3914 | staticAssetsBase,
|
3915 | ...state
|
3916 | })};`;
|
3917 |
|
3918 |
|
3919 | const stateScriptKb = (stateScript.length * 4 ) / 100;
|
3920 | if (stateScriptKb > 10) {
|
3921 | const statePath = utils.urlJoin(url, 'state.js');
|
3922 | const stateUrl = utils.urlJoin(routerBase, staticAssetsBase, statePath);
|
3923 | staticAssets.push({ path: statePath, src: stateScript });
|
3924 | APP += `<script defer src="${stateUrl}"></script>`;
|
3925 | preloadScripts.push(stateUrl);
|
3926 | } else {
|
3927 | APP += `<script>${stateScript}</script>`;
|
3928 | }
|
3929 |
|
3930 |
|
3931 | const payloadPath = utils.urlJoin(url, 'payload.js');
|
3932 | const payloadUrl = utils.urlJoin(routerBase, staticAssetsBase, payloadPath);
|
3933 | const routePath = (url.replace(/\/+$/, '') || '/').split('?')[0];
|
3934 | const payloadScript = `__NUXT_JSONP__("${routePath}", ${devalue__default['default']({ data, fetch, mutations })});`;
|
3935 | staticAssets.push({ path: payloadPath, src: payloadScript });
|
3936 | preloadScripts.push(payloadUrl);
|
3937 |
|
3938 |
|
3939 | for (const href of preloadScripts) {
|
3940 | HEAD += `<link rel="preload" href="${href}" as="script">`;
|
3941 | }
|
3942 | } else {
|
3943 |
|
3944 | let serializedSession;
|
3945 | if (shouldInjectScripts || shouldHashCspScriptSrc) {
|
3946 |
|
3947 | serializedSession = `window.${this.serverContext.globals.context}=${devalue__default['default'](renderContext.nuxt)};`;
|
3948 | inlineScripts.push(serializedSession);
|
3949 | }
|
3950 |
|
3951 | if (shouldInjectScripts) {
|
3952 | APP += `<script>${serializedSession}</script>`;
|
3953 | }
|
3954 | }
|
3955 |
|
3956 |
|
3957 | const cspScriptSrcHashes = [];
|
3958 | if (csp) {
|
3959 | if (shouldHashCspScriptSrc) {
|
3960 | for (const script of inlineScripts) {
|
3961 | const hash = crypto__default['default'].createHash(csp.hashAlgorithm);
|
3962 | hash.update(script);
|
3963 | cspScriptSrcHashes.push(`'${csp.hashAlgorithm}-${hash.digest('base64')}'`);
|
3964 | }
|
3965 | }
|
3966 |
|
3967 |
|
3968 | await this.serverContext.nuxt.callHook('vue-renderer:ssr:csp', cspScriptSrcHashes);
|
3969 |
|
3970 |
|
3971 | if (csp.addMeta) {
|
3972 | HEAD += `<meta http-equiv="Content-Security-Policy" content="script-src ${cspScriptSrcHashes.join()}">`;
|
3973 | }
|
3974 | }
|
3975 |
|
3976 |
|
3977 | if (shouldInjectScripts) {
|
3978 | APP += this.renderScripts(renderContext);
|
3979 | }
|
3980 |
|
3981 | if (meta) {
|
3982 | const appendInjectorOptions = { body: true };
|
3983 |
|
3984 |
|
3985 | APP += meta.meta.text(appendInjectorOptions);
|
3986 | APP += meta.link.text(appendInjectorOptions);
|
3987 | APP += meta.style.text(appendInjectorOptions);
|
3988 | APP += meta.script.text(appendInjectorOptions);
|
3989 | APP += meta.noscript.text(appendInjectorOptions);
|
3990 | }
|
3991 |
|
3992 |
|
3993 | const templateParams = {
|
3994 | HTML_ATTRS: meta ? meta.htmlAttrs.text(renderContext.nuxt.serverRendered ) : '',
|
3995 | HEAD_ATTRS: meta ? meta.headAttrs.text() : '',
|
3996 | BODY_ATTRS: meta ? meta.bodyAttrs.text() : '',
|
3997 | HEAD,
|
3998 | APP,
|
3999 | ENV: this.options.env
|
4000 | };
|
4001 |
|
4002 |
|
4003 | await this.serverContext.nuxt.callHook('vue-renderer:ssr:templateParams', templateParams, renderContext);
|
4004 |
|
4005 |
|
4006 | const html = this.renderTemplate(this.serverContext.resources.ssrTemplate, templateParams);
|
4007 |
|
4008 | let preloadFiles;
|
4009 | if (this.options.render.http2.push) {
|
4010 | preloadFiles = this.getPreloadFiles(renderContext);
|
4011 | }
|
4012 |
|
4013 | return {
|
4014 | html,
|
4015 | cspScriptSrcHashes,
|
4016 | preloadFiles,
|
4017 | error: renderContext.nuxt.error,
|
4018 | redirected: renderContext.redirected
|
4019 | }
|
4020 | }
|
4021 | }
|
4022 |
|
4023 | class ModernRenderer extends SSRRenderer {
|
4024 | constructor (serverContext) {
|
4025 | super(serverContext);
|
4026 |
|
4027 | const { build: { publicPath }, router: { base } } = this.options;
|
4028 | this.publicPath = utils.isUrl(publicPath) ? publicPath : utils.urlJoin(base, publicPath);
|
4029 | }
|
4030 |
|
4031 | get assetsMapping () {
|
4032 | if (this._assetsMapping) {
|
4033 | return this._assetsMapping
|
4034 | }
|
4035 |
|
4036 | const { clientManifest, modernManifest } = this.serverContext.resources;
|
4037 | const legacyAssets = clientManifest.assetsMapping;
|
4038 | const modernAssets = modernManifest.assetsMapping;
|
4039 | const mapping = {};
|
4040 |
|
4041 | Object.keys(legacyAssets).forEach((componentHash) => {
|
4042 | const modernComponentAssets = modernAssets[componentHash] || [];
|
4043 | legacyAssets[componentHash].forEach((legacyAssetName, index) => {
|
4044 | mapping[legacyAssetName] = modernComponentAssets[index];
|
4045 | });
|
4046 | });
|
4047 | delete clientManifest.assetsMapping;
|
4048 | delete modernManifest.assetsMapping;
|
4049 | this._assetsMapping = mapping;
|
4050 |
|
4051 | return mapping
|
4052 | }
|
4053 |
|
4054 | get isServerMode () {
|
4055 | return this.options.modern === 'server'
|
4056 | }
|
4057 |
|
4058 | get rendererOptions () {
|
4059 | const rendererOptions = super.rendererOptions;
|
4060 | if (this.isServerMode) {
|
4061 | rendererOptions.clientManifest = this.serverContext.resources.modernManifest;
|
4062 | }
|
4063 | return rendererOptions
|
4064 | }
|
4065 |
|
4066 | renderScripts (renderContext) {
|
4067 | const scripts = super.renderScripts(renderContext);
|
4068 |
|
4069 | if (this.isServerMode) {
|
4070 | return scripts
|
4071 | }
|
4072 |
|
4073 | const scriptPattern = /<script[^>]*?src="([^"]*?)" defer><\/script>/g;
|
4074 |
|
4075 | const modernScripts = scripts.replace(scriptPattern, (scriptTag, jsFile) => {
|
4076 | const legacyJsFile = jsFile.replace(this.publicPath, '');
|
4077 | const modernJsFile = this.assetsMapping[legacyJsFile];
|
4078 | if (!modernJsFile) {
|
4079 | return scriptTag.replace('<script', `<script nomodule`)
|
4080 | }
|
4081 | const moduleTag = scriptTag
|
4082 | .replace('<script', `<script type="module"`)
|
4083 | .replace(legacyJsFile, modernJsFile);
|
4084 | const noModuleTag = scriptTag.replace('<script', `<script nomodule`);
|
4085 |
|
4086 | return noModuleTag + moduleTag
|
4087 | });
|
4088 |
|
4089 | const safariNoModuleFixScript = `<script>${utils.safariNoModuleFix}</script>`;
|
4090 |
|
4091 | return safariNoModuleFixScript + modernScripts
|
4092 | }
|
4093 |
|
4094 | getModernFiles (legacyFiles = []) {
|
4095 | const modernFiles = [];
|
4096 |
|
4097 | for (const legacyJsFile of legacyFiles) {
|
4098 | const modernFile = { ...legacyJsFile, modern: true };
|
4099 | if (modernFile.asType === 'script') {
|
4100 | const file = this.assetsMapping[legacyJsFile.file];
|
4101 | modernFile.file = file;
|
4102 | modernFile.fileWithoutQuery = file.replace(/\?.*/, '');
|
4103 | }
|
4104 | modernFiles.push(modernFile);
|
4105 | }
|
4106 |
|
4107 | return modernFiles
|
4108 | }
|
4109 |
|
4110 | getPreloadFiles (renderContext) {
|
4111 | const preloadFiles = super.getPreloadFiles(renderContext);
|
4112 |
|
4113 | return this.isServerMode ? preloadFiles : this.getModernFiles(preloadFiles)
|
4114 | }
|
4115 |
|
4116 | renderResourceHints (renderContext) {
|
4117 | const resourceHints = super.renderResourceHints(renderContext);
|
4118 | if (this.isServerMode) {
|
4119 | return resourceHints
|
4120 | }
|
4121 |
|
4122 | const linkPattern = /<link[^>]*?href="([^"]*?)"[^>]*?as="script"[^>]*?>/g;
|
4123 |
|
4124 | return resourceHints.replace(linkPattern, (linkTag, jsFile) => {
|
4125 | const legacyJsFile = jsFile.replace(this.publicPath, '');
|
4126 | const modernJsFile = this.assetsMapping[legacyJsFile];
|
4127 | if (!modernJsFile) {
|
4128 | return ''
|
4129 | }
|
4130 | return linkTag
|
4131 | .replace('rel="preload"', `rel="modulepreload"`)
|
4132 | .replace(legacyJsFile, modernJsFile)
|
4133 | })
|
4134 | }
|
4135 |
|
4136 | render (renderContext) {
|
4137 | if (this.isServerMode) {
|
4138 | renderContext.res.setHeader('Vary', 'User-Agent');
|
4139 | }
|
4140 | return super.render(renderContext)
|
4141 | }
|
4142 | }
|
4143 |
|
4144 | class VueRenderer {
|
4145 | constructor (context) {
|
4146 | this.serverContext = context;
|
4147 | this.options = this.serverContext.options;
|
4148 |
|
4149 |
|
4150 | this.renderer = {
|
4151 | ssr: undefined,
|
4152 | modern: undefined,
|
4153 | spa: undefined
|
4154 | };
|
4155 |
|
4156 |
|
4157 | Object.assign(this.serverContext.resources, {
|
4158 | clientManifest: undefined,
|
4159 | modernManifest: undefined,
|
4160 | serverManifest: undefined,
|
4161 | ssrTemplate: undefined,
|
4162 | spaTemplate: undefined,
|
4163 | errorTemplate: this.parseTemplate('Nuxt.js Internal Server Error')
|
4164 | });
|
4165 |
|
4166 |
|
4167 | this._state = 'created';
|
4168 | this._error = null;
|
4169 | }
|
4170 |
|
4171 | ready () {
|
4172 | if (!this._readyPromise) {
|
4173 | this._state = 'loading';
|
4174 | this._readyPromise = this._ready()
|
4175 | .then(() => {
|
4176 | this._state = 'ready';
|
4177 | return this
|
4178 | })
|
4179 | .catch((error) => {
|
4180 | this._state = 'error';
|
4181 | this._error = error;
|
4182 | throw error
|
4183 | });
|
4184 | }
|
4185 |
|
4186 | return this._readyPromise
|
4187 | }
|
4188 |
|
4189 | async _ready () {
|
4190 |
|
4191 | this.distPath = path__default['default'].resolve(this.options.buildDir, 'dist', 'server');
|
4192 |
|
4193 |
|
4194 | if (this.options.dev) {
|
4195 | this.serverContext.nuxt.hook('build:resources', mfs => this.loadResources(mfs));
|
4196 | return
|
4197 | }
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 | await this.loadResources(fs__default['default']);
|
4203 |
|
4204 |
|
4205 | if (!this.options._start) {
|
4206 | this.serverContext.nuxt.hook('build:resources', () => this.loadResources(fs__default['default']));
|
4207 | return
|
4208 | }
|
4209 |
|
4210 |
|
4211 | if (this.options.modern && !this.isModernReady) {
|
4212 | throw new Error(
|
4213 | `No modern build files found in ${this.distPath}.\nUse either \`nuxt build --modern\` or \`modern\` option to build modern files.`
|
4214 | )
|
4215 | } else if (!this.isReady) {
|
4216 | throw new Error(
|
4217 | `No build files found in ${this.distPath}.\nUse either \`nuxt build\` or \`builder.build()\` or start nuxt in development mode.`
|
4218 | )
|
4219 | }
|
4220 | }
|
4221 |
|
4222 | async loadResources (_fs) {
|
4223 | const updated = [];
|
4224 |
|
4225 | const readResource = async (fileName, encoding) => {
|
4226 | try {
|
4227 | const fullPath = path__default['default'].resolve(this.distPath, fileName);
|
4228 |
|
4229 | if (!await _fs.exists(fullPath)) {
|
4230 | return
|
4231 | }
|
4232 | const contents = await _fs.readFile(fullPath, encoding);
|
4233 |
|
4234 | return contents
|
4235 | } catch (err) {
|
4236 | consola__default['default'].error('Unable to load resource:', fileName, err);
|
4237 | }
|
4238 | };
|
4239 |
|
4240 | for (const resourceName in this.resourceMap) {
|
4241 | const { fileName, transform, encoding } = this.resourceMap[resourceName];
|
4242 |
|
4243 |
|
4244 | let resource = await readResource(fileName, encoding);
|
4245 |
|
4246 |
|
4247 | if (!resource) {
|
4248 | continue
|
4249 | }
|
4250 |
|
4251 |
|
4252 | if (typeof transform === 'function') {
|
4253 | resource = await transform(resource, { readResource });
|
4254 | }
|
4255 |
|
4256 |
|
4257 | this.serverContext.resources[resourceName] = resource;
|
4258 | updated.push(resourceName);
|
4259 | }
|
4260 |
|
4261 |
|
4262 | await this.loadTemplates();
|
4263 |
|
4264 | await this.serverContext.nuxt.callHook('render:resourcesLoaded', this.serverContext.resources);
|
4265 |
|
4266 |
|
4267 | if (updated.length > 0) {
|
4268 |
|
4269 | this.createRenderer();
|
4270 | }
|
4271 | }
|
4272 |
|
4273 | async loadTemplates () {
|
4274 |
|
4275 | const errorTemplatePath = path__default['default'].resolve(this.options.buildDir, 'views/error.html');
|
4276 |
|
4277 | if (await fs__default['default'].exists(errorTemplatePath)) {
|
4278 | const errorTemplate = await fs__default['default'].readFile(errorTemplatePath, 'utf8');
|
4279 | this.serverContext.resources.errorTemplate = this.parseTemplate(errorTemplate);
|
4280 | }
|
4281 |
|
4282 |
|
4283 | const loadingHTMLPath = path__default['default'].resolve(this.options.buildDir, 'loading.html');
|
4284 |
|
4285 | if (await fs__default['default'].exists(loadingHTMLPath)) {
|
4286 | this.serverContext.resources.loadingHTML = await fs__default['default'].readFile(loadingHTMLPath, 'utf8');
|
4287 | this.serverContext.resources.loadingHTML = this.serverContext.resources.loadingHTML.replace(/\r|\n|[\t\s]{3,}/g, '');
|
4288 | } else {
|
4289 | this.serverContext.resources.loadingHTML = '';
|
4290 | }
|
4291 | }
|
4292 |
|
4293 |
|
4294 | get noSSR () {
|
4295 | return this.options.render.ssr === false
|
4296 | }
|
4297 |
|
4298 | get SSR () {
|
4299 | return this.options.render.ssr === true
|
4300 | }
|
4301 |
|
4302 | get isReady () {
|
4303 |
|
4304 | if (!this.serverContext.resources.spaTemplate || !this.renderer.spa) {
|
4305 | return false
|
4306 | }
|
4307 |
|
4308 |
|
4309 | if (this.SSR && (!this.serverContext.resources.ssrTemplate || !this.renderer.ssr)) {
|
4310 | return false
|
4311 | }
|
4312 |
|
4313 | return true
|
4314 | }
|
4315 |
|
4316 | get isModernReady () {
|
4317 | return this.isReady && this.serverContext.resources.modernManifest
|
4318 | }
|
4319 |
|
4320 |
|
4321 | get isResourcesAvailable () {
|
4322 | return this.isReady
|
4323 | }
|
4324 |
|
4325 | detectModernBuild () {
|
4326 | const { options, resources } = this.serverContext;
|
4327 | if ([false, 'client', 'server'].includes(options.modern)) {
|
4328 | return
|
4329 | }
|
4330 |
|
4331 | const isExplicitStaticModern = options.target === utils.TARGETS.static && options.modern;
|
4332 | if (!resources.modernManifest && !isExplicitStaticModern) {
|
4333 | options.modern = false;
|
4334 | return
|
4335 | }
|
4336 |
|
4337 | options.modern = options.render.ssr ? 'server' : 'client';
|
4338 | consola__default['default'].info(`Modern bundles are detected. Modern mode (\`${options.modern}\`) is enabled now.`);
|
4339 | }
|
4340 |
|
4341 | createRenderer () {
|
4342 |
|
4343 | if (!this.serverContext.resources.clientManifest) {
|
4344 | return
|
4345 | }
|
4346 |
|
4347 | this.detectModernBuild();
|
4348 |
|
4349 |
|
4350 | if (this.serverContext.resources.spaTemplate) {
|
4351 | this.renderer.spa = new SPARenderer(this.serverContext);
|
4352 | }
|
4353 |
|
4354 |
|
4355 | if (this.serverContext.resources.ssrTemplate && this.serverContext.resources.serverManifest) {
|
4356 |
|
4357 | this.renderer.ssr = new SSRRenderer(this.serverContext);
|
4358 |
|
4359 | if (this.options.modern !== false) {
|
4360 | this.renderer.modern = new ModernRenderer(this.serverContext);
|
4361 | }
|
4362 | }
|
4363 | }
|
4364 |
|
4365 | renderSPA (renderContext) {
|
4366 | return this.renderer.spa.render(renderContext)
|
4367 | }
|
4368 |
|
4369 | renderSSR (renderContext) {
|
4370 |
|
4371 | const renderer = renderContext.modern ? this.renderer.modern : this.renderer.ssr;
|
4372 | return renderer.render(renderContext)
|
4373 | }
|
4374 |
|
4375 | async renderRoute (url, renderContext = {}, _retried = 0) {
|
4376 |
|
4377 | if (!this.isReady) {
|
4378 |
|
4379 | if (this.options.build.loadingScreen) {
|
4380 |
|
4381 | return false
|
4382 | }
|
4383 |
|
4384 |
|
4385 | const retryLimit = this.options.dev ? 60 : 3;
|
4386 | if (_retried < retryLimit && this._state !== 'error') {
|
4387 | await this.ready().then(() => utils.waitFor(1000));
|
4388 | return this.renderRoute(url, renderContext, _retried + 1)
|
4389 | }
|
4390 |
|
4391 |
|
4392 | switch (this._state) {
|
4393 | case 'created':
|
4394 | throw new Error('Renderer ready() is not called! Please ensure `nuxt.ready()` is called and awaited.')
|
4395 | case 'loading':
|
4396 | throw new Error('Renderer is loading.')
|
4397 | case 'error':
|
4398 | throw this._error
|
4399 | case 'ready':
|
4400 | throw new Error(`Renderer resources are not loaded! Please check possible console errors and ensure dist (${this.distPath}) exists.`)
|
4401 | default:
|
4402 | throw new Error('Renderer is in unknown state!')
|
4403 | }
|
4404 | }
|
4405 |
|
4406 |
|
4407 | consola__default['default'].debug(`Rendering url ${url}`);
|
4408 |
|
4409 |
|
4410 | renderContext.url = url;
|
4411 |
|
4412 | renderContext.target = this.options.target;
|
4413 |
|
4414 | const { req = {}, res = {} } = renderContext;
|
4415 |
|
4416 |
|
4417 | if (renderContext.spa === undefined) {
|
4418 |
|
4419 | renderContext.spa = !this.SSR || req.spa || res.spa;
|
4420 | }
|
4421 |
|
4422 |
|
4423 | if (renderContext.modern === undefined) {
|
4424 | const modernMode = this.options.modern;
|
4425 | renderContext.modern = modernMode === 'client' || utils.isModernRequest(req, modernMode);
|
4426 | }
|
4427 |
|
4428 |
|
4429 | renderContext.runtimeConfig = {
|
4430 | private: renderContext.spa ? {} : { ...this.options.privateRuntimeConfig },
|
4431 | public: { ...this.options.publicRuntimeConfig }
|
4432 | };
|
4433 |
|
4434 |
|
4435 | await this.serverContext.nuxt.callHook('vue-renderer:context', renderContext);
|
4436 |
|
4437 |
|
4438 | return renderContext.spa
|
4439 | ? this.renderSPA(renderContext)
|
4440 | : this.renderSSR(renderContext)
|
4441 | }
|
4442 |
|
4443 | get resourceMap () {
|
4444 | return {
|
4445 | clientManifest: {
|
4446 | fileName: 'client.manifest.json',
|
4447 | transform: src => JSON.parse(src)
|
4448 | },
|
4449 | modernManifest: {
|
4450 | fileName: 'modern.manifest.json',
|
4451 | transform: src => JSON.parse(src)
|
4452 | },
|
4453 | serverManifest: {
|
4454 | fileName: 'server.manifest.json',
|
4455 |
|
4456 | transform: async (src, { readResource }) => {
|
4457 | const serverManifest = JSON.parse(src);
|
4458 |
|
4459 | const readResources = async (obj) => {
|
4460 | const _obj = {};
|
4461 | await Promise.all(Object.keys(obj).map(async (key) => {
|
4462 | _obj[key] = await readResource(obj[key]);
|
4463 | }));
|
4464 | return _obj
|
4465 | };
|
4466 |
|
4467 | const [files, maps] = await Promise.all([
|
4468 | readResources(serverManifest.files),
|
4469 | readResources(serverManifest.maps)
|
4470 | ]);
|
4471 |
|
4472 |
|
4473 | for (const map in maps) {
|
4474 | if (maps[map] && maps[map].version) {
|
4475 | continue
|
4476 | }
|
4477 | try {
|
4478 | maps[map] = JSON.parse(maps[map]);
|
4479 | } catch (e) {
|
4480 | maps[map] = { version: 3, sources: [], mappings: '' };
|
4481 | }
|
4482 | }
|
4483 |
|
4484 | return {
|
4485 | ...serverManifest,
|
4486 | files,
|
4487 | maps
|
4488 | }
|
4489 | }
|
4490 | },
|
4491 | ssrTemplate: {
|
4492 | fileName: 'index.ssr.html',
|
4493 | transform: src => this.parseTemplate(src)
|
4494 | },
|
4495 | spaTemplate: {
|
4496 | fileName: 'index.spa.html',
|
4497 | transform: src => this.parseTemplate(src)
|
4498 | }
|
4499 | }
|
4500 | }
|
4501 |
|
4502 | parseTemplate (templateStr) {
|
4503 | return template_1(templateStr, {
|
4504 | interpolate: /{{([\s\S]+?)}}/g,
|
4505 | evaluate: /{%([\s\S]+?)%}/g
|
4506 | })
|
4507 | }
|
4508 |
|
4509 | close () {
|
4510 | if (this.__closed) {
|
4511 | return
|
4512 | }
|
4513 | this.__closed = true;
|
4514 |
|
4515 | for (const key in this.renderer) {
|
4516 | delete this.renderer[key];
|
4517 | }
|
4518 | }
|
4519 | }
|
4520 |
|
4521 | exports.VueRenderer = VueRenderer;
|