1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3 | typeof define === 'function' && define.amd ? define(factory) :
|
4 | (global.supergloo = factory());
|
5 | }(this, (function () { 'use strict';
|
6 |
|
7 | var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
8 |
|
9 | function commonjsRequire () {
|
10 | throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 | function createCommonjsModule(fn, module) {
|
16 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
17 | }
|
18 |
|
19 | var es6Promise = createCommonjsModule(function (module, exports) {
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | (function (global, factory) {
|
29 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
30 | typeof undefined === 'function' && undefined.amd ? undefined(factory) :
|
31 | (global.ES6Promise = factory());
|
32 | }(commonjsGlobal, (function () { 'use strict';
|
33 |
|
34 | function objectOrFunction(x) {
|
35 | return typeof x === 'function' || typeof x === 'object' && x !== null;
|
36 | }
|
37 |
|
38 | function isFunction(x) {
|
39 | return typeof x === 'function';
|
40 | }
|
41 |
|
42 | var _isArray = undefined;
|
43 | if (!Array.isArray) {
|
44 | _isArray = function (x) {
|
45 | return Object.prototype.toString.call(x) === '[object Array]';
|
46 | };
|
47 | } else {
|
48 | _isArray = Array.isArray;
|
49 | }
|
50 |
|
51 | var isArray = _isArray;
|
52 |
|
53 | var len = 0;
|
54 | var vertxNext = undefined;
|
55 | var customSchedulerFn = undefined;
|
56 |
|
57 | var asap = function asap(callback, arg) {
|
58 | queue[len] = callback;
|
59 | queue[len + 1] = arg;
|
60 | len += 2;
|
61 | if (len === 2) {
|
62 |
|
63 |
|
64 |
|
65 | if (customSchedulerFn) {
|
66 | customSchedulerFn(flush);
|
67 | } else {
|
68 | scheduleFlush();
|
69 | }
|
70 | }
|
71 | };
|
72 |
|
73 | function setScheduler(scheduleFn) {
|
74 | customSchedulerFn = scheduleFn;
|
75 | }
|
76 |
|
77 | function setAsap(asapFn) {
|
78 | asap = asapFn;
|
79 | }
|
80 |
|
81 | var browserWindow = typeof window !== 'undefined' ? window : undefined;
|
82 | var browserGlobal = browserWindow || {};
|
83 | var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
84 | var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
|
85 |
|
86 |
|
87 | var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
|
88 |
|
89 |
|
90 | function useNextTick() {
|
91 |
|
92 |
|
93 | return function () {
|
94 | return process.nextTick(flush);
|
95 | };
|
96 | }
|
97 |
|
98 |
|
99 | function useVertxTimer() {
|
100 | if (typeof vertxNext !== 'undefined') {
|
101 | return function () {
|
102 | vertxNext(flush);
|
103 | };
|
104 | }
|
105 |
|
106 | return useSetTimeout();
|
107 | }
|
108 |
|
109 | function useMutationObserver() {
|
110 | var iterations = 0;
|
111 | var observer = new BrowserMutationObserver(flush);
|
112 | var node = document.createTextNode('');
|
113 | observer.observe(node, { characterData: true });
|
114 |
|
115 | return function () {
|
116 | node.data = iterations = ++iterations % 2;
|
117 | };
|
118 | }
|
119 |
|
120 |
|
121 | function useMessageChannel() {
|
122 | var channel = new MessageChannel();
|
123 | channel.port1.onmessage = flush;
|
124 | return function () {
|
125 | return channel.port2.postMessage(0);
|
126 | };
|
127 | }
|
128 |
|
129 | function useSetTimeout() {
|
130 |
|
131 |
|
132 | var globalSetTimeout = setTimeout;
|
133 | return function () {
|
134 | return globalSetTimeout(flush, 1);
|
135 | };
|
136 | }
|
137 |
|
138 | var queue = new Array(1000);
|
139 | function flush() {
|
140 | for (var i = 0; i < len; i += 2) {
|
141 | var callback = queue[i];
|
142 | var arg = queue[i + 1];
|
143 |
|
144 | callback(arg);
|
145 |
|
146 | queue[i] = undefined;
|
147 | queue[i + 1] = undefined;
|
148 | }
|
149 |
|
150 | len = 0;
|
151 | }
|
152 |
|
153 | function attemptVertx() {
|
154 | try {
|
155 | var r = commonjsRequire;
|
156 | var vertx = r('vertx');
|
157 | vertxNext = vertx.runOnLoop || vertx.runOnContext;
|
158 | return useVertxTimer();
|
159 | } catch (e) {
|
160 | return useSetTimeout();
|
161 | }
|
162 | }
|
163 |
|
164 | var scheduleFlush = undefined;
|
165 |
|
166 | if (isNode) {
|
167 | scheduleFlush = useNextTick();
|
168 | } else if (BrowserMutationObserver) {
|
169 | scheduleFlush = useMutationObserver();
|
170 | } else if (isWorker) {
|
171 | scheduleFlush = useMessageChannel();
|
172 | } else if (browserWindow === undefined && typeof commonjsRequire === 'function') {
|
173 | scheduleFlush = attemptVertx();
|
174 | } else {
|
175 | scheduleFlush = useSetTimeout();
|
176 | }
|
177 |
|
178 | function then(onFulfillment, onRejection) {
|
179 | var _arguments = arguments;
|
180 |
|
181 | var parent = this;
|
182 |
|
183 | var child = new this.constructor(noop);
|
184 |
|
185 | if (child[PROMISE_ID] === undefined) {
|
186 | makePromise(child);
|
187 | }
|
188 |
|
189 | var _state = parent._state;
|
190 |
|
191 | if (_state) {
|
192 | (function () {
|
193 | var callback = _arguments[_state - 1];
|
194 | asap(function () {
|
195 | return invokeCallback(_state, child, callback, parent._result);
|
196 | });
|
197 | })();
|
198 | } else {
|
199 | subscribe(parent, child, onFulfillment, onRejection);
|
200 | }
|
201 |
|
202 | return child;
|
203 | }
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | function resolve(object) {
|
237 |
|
238 | var Constructor = this;
|
239 |
|
240 | if (object && typeof object === 'object' && object.constructor === Constructor) {
|
241 | return object;
|
242 | }
|
243 |
|
244 | var promise = new Constructor(noop);
|
245 | _resolve(promise, object);
|
246 | return promise;
|
247 | }
|
248 |
|
249 | var PROMISE_ID = Math.random().toString(36).substring(16);
|
250 |
|
251 | function noop() {}
|
252 |
|
253 | var PENDING = void 0;
|
254 | var FULFILLED = 1;
|
255 | var REJECTED = 2;
|
256 |
|
257 | var GET_THEN_ERROR = new ErrorObject();
|
258 |
|
259 | function selfFulfillment() {
|
260 | return new TypeError("You cannot resolve a promise with itself");
|
261 | }
|
262 |
|
263 | function cannotReturnOwn() {
|
264 | return new TypeError('A promises callback cannot return that same promise.');
|
265 | }
|
266 |
|
267 | function getThen(promise) {
|
268 | try {
|
269 | return promise.then;
|
270 | } catch (error) {
|
271 | GET_THEN_ERROR.error = error;
|
272 | return GET_THEN_ERROR;
|
273 | }
|
274 | }
|
275 |
|
276 | function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
|
277 | try {
|
278 | then.call(value, fulfillmentHandler, rejectionHandler);
|
279 | } catch (e) {
|
280 | return e;
|
281 | }
|
282 | }
|
283 |
|
284 | function handleForeignThenable(promise, thenable, then) {
|
285 | asap(function (promise) {
|
286 | var sealed = false;
|
287 | var error = tryThen(then, thenable, function (value) {
|
288 | if (sealed) {
|
289 | return;
|
290 | }
|
291 | sealed = true;
|
292 | if (thenable !== value) {
|
293 | _resolve(promise, value);
|
294 | } else {
|
295 | fulfill(promise, value);
|
296 | }
|
297 | }, function (reason) {
|
298 | if (sealed) {
|
299 | return;
|
300 | }
|
301 | sealed = true;
|
302 |
|
303 | _reject(promise, reason);
|
304 | }, 'Settle: ' + (promise._label || ' unknown promise'));
|
305 |
|
306 | if (!sealed && error) {
|
307 | sealed = true;
|
308 | _reject(promise, error);
|
309 | }
|
310 | }, promise);
|
311 | }
|
312 |
|
313 | function handleOwnThenable(promise, thenable) {
|
314 | if (thenable._state === FULFILLED) {
|
315 | fulfill(promise, thenable._result);
|
316 | } else if (thenable._state === REJECTED) {
|
317 | _reject(promise, thenable._result);
|
318 | } else {
|
319 | subscribe(thenable, undefined, function (value) {
|
320 | return _resolve(promise, value);
|
321 | }, function (reason) {
|
322 | return _reject(promise, reason);
|
323 | });
|
324 | }
|
325 | }
|
326 |
|
327 | function handleMaybeThenable(promise, maybeThenable, then$$) {
|
328 | if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
|
329 | handleOwnThenable(promise, maybeThenable);
|
330 | } else {
|
331 | if (then$$ === GET_THEN_ERROR) {
|
332 | _reject(promise, GET_THEN_ERROR.error);
|
333 | GET_THEN_ERROR.error = null;
|
334 | } else if (then$$ === undefined) {
|
335 | fulfill(promise, maybeThenable);
|
336 | } else if (isFunction(then$$)) {
|
337 | handleForeignThenable(promise, maybeThenable, then$$);
|
338 | } else {
|
339 | fulfill(promise, maybeThenable);
|
340 | }
|
341 | }
|
342 | }
|
343 |
|
344 | function _resolve(promise, value) {
|
345 | if (promise === value) {
|
346 | _reject(promise, selfFulfillment());
|
347 | } else if (objectOrFunction(value)) {
|
348 | handleMaybeThenable(promise, value, getThen(value));
|
349 | } else {
|
350 | fulfill(promise, value);
|
351 | }
|
352 | }
|
353 |
|
354 | function publishRejection(promise) {
|
355 | if (promise._onerror) {
|
356 | promise._onerror(promise._result);
|
357 | }
|
358 |
|
359 | publish(promise);
|
360 | }
|
361 |
|
362 | function fulfill(promise, value) {
|
363 | if (promise._state !== PENDING) {
|
364 | return;
|
365 | }
|
366 |
|
367 | promise._result = value;
|
368 | promise._state = FULFILLED;
|
369 |
|
370 | if (promise._subscribers.length !== 0) {
|
371 | asap(publish, promise);
|
372 | }
|
373 | }
|
374 |
|
375 | function _reject(promise, reason) {
|
376 | if (promise._state !== PENDING) {
|
377 | return;
|
378 | }
|
379 | promise._state = REJECTED;
|
380 | promise._result = reason;
|
381 |
|
382 | asap(publishRejection, promise);
|
383 | }
|
384 |
|
385 | function subscribe(parent, child, onFulfillment, onRejection) {
|
386 | var _subscribers = parent._subscribers;
|
387 | var length = _subscribers.length;
|
388 |
|
389 | parent._onerror = null;
|
390 |
|
391 | _subscribers[length] = child;
|
392 | _subscribers[length + FULFILLED] = onFulfillment;
|
393 | _subscribers[length + REJECTED] = onRejection;
|
394 |
|
395 | if (length === 0 && parent._state) {
|
396 | asap(publish, parent);
|
397 | }
|
398 | }
|
399 |
|
400 | function publish(promise) {
|
401 | var subscribers = promise._subscribers;
|
402 | var settled = promise._state;
|
403 |
|
404 | if (subscribers.length === 0) {
|
405 | return;
|
406 | }
|
407 |
|
408 | var child = undefined,
|
409 | callback = undefined,
|
410 | detail = promise._result;
|
411 |
|
412 | for (var i = 0; i < subscribers.length; i += 3) {
|
413 | child = subscribers[i];
|
414 | callback = subscribers[i + settled];
|
415 |
|
416 | if (child) {
|
417 | invokeCallback(settled, child, callback, detail);
|
418 | } else {
|
419 | callback(detail);
|
420 | }
|
421 | }
|
422 |
|
423 | promise._subscribers.length = 0;
|
424 | }
|
425 |
|
426 | function ErrorObject() {
|
427 | this.error = null;
|
428 | }
|
429 |
|
430 | var TRY_CATCH_ERROR = new ErrorObject();
|
431 |
|
432 | function tryCatch(callback, detail) {
|
433 | try {
|
434 | return callback(detail);
|
435 | } catch (e) {
|
436 | TRY_CATCH_ERROR.error = e;
|
437 | return TRY_CATCH_ERROR;
|
438 | }
|
439 | }
|
440 |
|
441 | function invokeCallback(settled, promise, callback, detail) {
|
442 | var hasCallback = isFunction(callback),
|
443 | value = undefined,
|
444 | error = undefined,
|
445 | succeeded = undefined,
|
446 | failed = undefined;
|
447 |
|
448 | if (hasCallback) {
|
449 | value = tryCatch(callback, detail);
|
450 |
|
451 | if (value === TRY_CATCH_ERROR) {
|
452 | failed = true;
|
453 | error = value.error;
|
454 | value.error = null;
|
455 | } else {
|
456 | succeeded = true;
|
457 | }
|
458 |
|
459 | if (promise === value) {
|
460 | _reject(promise, cannotReturnOwn());
|
461 | return;
|
462 | }
|
463 | } else {
|
464 | value = detail;
|
465 | succeeded = true;
|
466 | }
|
467 |
|
468 | if (promise._state !== PENDING) {
|
469 |
|
470 | } else if (hasCallback && succeeded) {
|
471 | _resolve(promise, value);
|
472 | } else if (failed) {
|
473 | _reject(promise, error);
|
474 | } else if (settled === FULFILLED) {
|
475 | fulfill(promise, value);
|
476 | } else if (settled === REJECTED) {
|
477 | _reject(promise, value);
|
478 | }
|
479 | }
|
480 |
|
481 | function initializePromise(promise, resolver) {
|
482 | try {
|
483 | resolver(function resolvePromise(value) {
|
484 | _resolve(promise, value);
|
485 | }, function rejectPromise(reason) {
|
486 | _reject(promise, reason);
|
487 | });
|
488 | } catch (e) {
|
489 | _reject(promise, e);
|
490 | }
|
491 | }
|
492 |
|
493 | var id = 0;
|
494 | function nextId() {
|
495 | return id++;
|
496 | }
|
497 |
|
498 | function makePromise(promise) {
|
499 | promise[PROMISE_ID] = id++;
|
500 | promise._state = undefined;
|
501 | promise._result = undefined;
|
502 | promise._subscribers = [];
|
503 | }
|
504 |
|
505 | function Enumerator(Constructor, input) {
|
506 | this._instanceConstructor = Constructor;
|
507 | this.promise = new Constructor(noop);
|
508 |
|
509 | if (!this.promise[PROMISE_ID]) {
|
510 | makePromise(this.promise);
|
511 | }
|
512 |
|
513 | if (isArray(input)) {
|
514 | this._input = input;
|
515 | this.length = input.length;
|
516 | this._remaining = input.length;
|
517 |
|
518 | this._result = new Array(this.length);
|
519 |
|
520 | if (this.length === 0) {
|
521 | fulfill(this.promise, this._result);
|
522 | } else {
|
523 | this.length = this.length || 0;
|
524 | this._enumerate();
|
525 | if (this._remaining === 0) {
|
526 | fulfill(this.promise, this._result);
|
527 | }
|
528 | }
|
529 | } else {
|
530 | _reject(this.promise, validationError());
|
531 | }
|
532 | }
|
533 |
|
534 | function validationError() {
|
535 | return new Error('Array Methods must be provided an Array');
|
536 | }
|
537 |
|
538 | Enumerator.prototype._enumerate = function () {
|
539 | var length = this.length;
|
540 | var _input = this._input;
|
541 |
|
542 | for (var i = 0; this._state === PENDING && i < length; i++) {
|
543 | this._eachEntry(_input[i], i);
|
544 | }
|
545 | };
|
546 |
|
547 | Enumerator.prototype._eachEntry = function (entry, i) {
|
548 | var c = this._instanceConstructor;
|
549 | var resolve$$ = c.resolve;
|
550 |
|
551 | if (resolve$$ === resolve) {
|
552 | var _then = getThen(entry);
|
553 |
|
554 | if (_then === then && entry._state !== PENDING) {
|
555 | this._settledAt(entry._state, i, entry._result);
|
556 | } else if (typeof _then !== 'function') {
|
557 | this._remaining--;
|
558 | this._result[i] = entry;
|
559 | } else if (c === Promise) {
|
560 | var promise = new c(noop);
|
561 | handleMaybeThenable(promise, entry, _then);
|
562 | this._willSettleAt(promise, i);
|
563 | } else {
|
564 | this._willSettleAt(new c(function (resolve$$) {
|
565 | return resolve$$(entry);
|
566 | }), i);
|
567 | }
|
568 | } else {
|
569 | this._willSettleAt(resolve$$(entry), i);
|
570 | }
|
571 | };
|
572 |
|
573 | Enumerator.prototype._settledAt = function (state, i, value) {
|
574 | var promise = this.promise;
|
575 |
|
576 | if (promise._state === PENDING) {
|
577 | this._remaining--;
|
578 |
|
579 | if (state === REJECTED) {
|
580 | _reject(promise, value);
|
581 | } else {
|
582 | this._result[i] = value;
|
583 | }
|
584 | }
|
585 |
|
586 | if (this._remaining === 0) {
|
587 | fulfill(promise, this._result);
|
588 | }
|
589 | };
|
590 |
|
591 | Enumerator.prototype._willSettleAt = function (promise, i) {
|
592 | var enumerator = this;
|
593 |
|
594 | subscribe(promise, undefined, function (value) {
|
595 | return enumerator._settledAt(FULFILLED, i, value);
|
596 | }, function (reason) {
|
597 | return enumerator._settledAt(REJECTED, i, reason);
|
598 | });
|
599 | };
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 | function all(entries) {
|
649 | return new Enumerator(this, entries).promise;
|
650 | }
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
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 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | function race(entries) {
|
718 |
|
719 | var Constructor = this;
|
720 |
|
721 | if (!isArray(entries)) {
|
722 | return new Constructor(function (_, reject) {
|
723 | return reject(new TypeError('You must pass an array to race.'));
|
724 | });
|
725 | } else {
|
726 | return new Constructor(function (resolve, reject) {
|
727 | var length = entries.length;
|
728 | for (var i = 0; i < length; i++) {
|
729 | Constructor.resolve(entries[i]).then(resolve, reject);
|
730 | }
|
731 | });
|
732 | }
|
733 | }
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 | function reject(reason) {
|
770 |
|
771 | var Constructor = this;
|
772 | var promise = new Constructor(noop);
|
773 | _reject(promise, reason);
|
774 | return promise;
|
775 | }
|
776 |
|
777 | function needsResolver() {
|
778 | throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
|
779 | }
|
780 |
|
781 | function needsNew() {
|
782 | throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
783 | }
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
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 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 | function Promise(resolver) {
|
889 | this[PROMISE_ID] = nextId();
|
890 | this._result = this._state = undefined;
|
891 | this._subscribers = [];
|
892 |
|
893 | if (noop !== resolver) {
|
894 | typeof resolver !== 'function' && needsResolver();
|
895 | this instanceof Promise ? initializePromise(this, resolver) : needsNew();
|
896 | }
|
897 | }
|
898 |
|
899 | Promise.all = all;
|
900 | Promise.race = race;
|
901 | Promise.resolve = resolve;
|
902 | Promise.reject = reject;
|
903 | Promise._setScheduler = setScheduler;
|
904 | Promise._setAsap = setAsap;
|
905 | Promise._asap = asap;
|
906 |
|
907 | Promise.prototype = {
|
908 | constructor: Promise,
|
909 |
|
910 | /**
|
911 | The primary way of interacting with a promise is through its `then` method,
|
912 | which registers callbacks to receive either a promise's eventual value or the
|
913 | reason why the promise cannot be fulfilled.
|
914 |
|
915 | ```js
|
916 | findUser().then(function(user){
|
917 |
|
918 | }, function(reason){
|
919 |
|
920 | });
|
921 | ```
|
922 |
|
923 | Chaining
|
924 | --------
|
925 |
|
926 | The return value of `then` is itself a promise. This second, 'downstream'
|
927 | promise is resolved with the return value of the first promise's fulfillment
|
928 | or rejection handler, or rejected if the handler throws an exception.
|
929 |
|
930 | ```js
|
931 | findUser().then(function (user) {
|
932 | return user.name;
|
933 | }, function (reason) {
|
934 | return 'default name';
|
935 | }).then(function (userName) {
|
936 |
|
937 |
|
938 | });
|
939 |
|
940 | findUser().then(function (user) {
|
941 | throw new Error('Found user, but still unhappy');
|
942 | }, function (reason) {
|
943 | throw new Error('`findUser` rejected and we're unhappy');
|
944 | }).then(function (value) {
|
945 |
|
946 | }, function (reason) {
|
947 |
|
948 |
|
949 | });
|
950 | ```
|
951 | If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
|
952 |
|
953 | ```js
|
954 | findUser().then(function (user) {
|
955 | throw new PedagogicalException('Upstream error');
|
956 | }).then(function (value) {
|
957 |
|
958 | }).then(function (value) {
|
959 |
|
960 | }, function (reason) {
|
961 |
|
962 | });
|
963 | ```
|
964 |
|
965 | Assimilation
|
966 | ------------
|
967 |
|
968 | Sometimes the value you want to propagate to a downstream promise can only be
|
969 | retrieved asynchronously. This can be achieved by returning a promise in the
|
970 | fulfillment or rejection handler. The downstream promise will then be pending
|
971 | until the returned promise is settled. This is called *assimilation*.
|
972 |
|
973 | ```js
|
974 | findUser().then(function (user) {
|
975 | return findCommentsByAuthor(user);
|
976 | }).then(function (comments) {
|
977 |
|
978 | });
|
979 | ```
|
980 |
|
981 | If the assimliated promise rejects, then the downstream promise will also reject.
|
982 |
|
983 | ```js
|
984 | findUser().then(function (user) {
|
985 | return findCommentsByAuthor(user);
|
986 | }).then(function (comments) {
|
987 |
|
988 | }, function (reason) {
|
989 |
|
990 | });
|
991 | ```
|
992 |
|
993 | Simple Example
|
994 | --------------
|
995 |
|
996 | Synchronous Example
|
997 |
|
998 | ```javascript
|
999 | let result;
|
1000 |
|
1001 | try {
|
1002 | result = findResult();
|
1003 |
|
1004 | } catch(reason) {
|
1005 |
|
1006 | }
|
1007 | ```
|
1008 |
|
1009 | Errback Example
|
1010 |
|
1011 | ```js
|
1012 | findResult(function(result, err){
|
1013 | if (err) {
|
1014 |
|
1015 | } else {
|
1016 |
|
1017 | }
|
1018 | });
|
1019 | ```
|
1020 |
|
1021 | Promise Example;
|
1022 |
|
1023 | ```javascript
|
1024 | findResult().then(function(result){
|
1025 |
|
1026 | }, function(reason){
|
1027 |
|
1028 | });
|
1029 | ```
|
1030 |
|
1031 | Advanced Example
|
1032 | --------------
|
1033 |
|
1034 | Synchronous Example
|
1035 |
|
1036 | ```javascript
|
1037 | let author, books;
|
1038 |
|
1039 | try {
|
1040 | author = findAuthor();
|
1041 | books = findBooksByAuthor(author);
|
1042 |
|
1043 | } catch(reason) {
|
1044 |
|
1045 | }
|
1046 | ```
|
1047 |
|
1048 | Errback Example
|
1049 |
|
1050 | ```js
|
1051 |
|
1052 | function foundBooks(books) {
|
1053 |
|
1054 | }
|
1055 |
|
1056 | function failure(reason) {
|
1057 |
|
1058 | }
|
1059 |
|
1060 | findAuthor(function(author, err){
|
1061 | if (err) {
|
1062 | failure(err);
|
1063 |
|
1064 | } else {
|
1065 | try {
|
1066 | findBoooksByAuthor(author, function(books, err) {
|
1067 | if (err) {
|
1068 | failure(err);
|
1069 | } else {
|
1070 | try {
|
1071 | foundBooks(books);
|
1072 | } catch(reason) {
|
1073 | failure(reason);
|
1074 | }
|
1075 | }
|
1076 | });
|
1077 | } catch(error) {
|
1078 | failure(err);
|
1079 | }
|
1080 |
|
1081 | }
|
1082 | });
|
1083 | ```
|
1084 |
|
1085 | Promise Example;
|
1086 |
|
1087 | ```javascript
|
1088 | findAuthor().
|
1089 | then(findBooksByAuthor).
|
1090 | then(function(books){
|
1091 |
|
1092 | }).catch(function(reason){
|
1093 |
|
1094 | });
|
1095 | ```
|
1096 |
|
1097 | @method then
|
1098 | @param {Function} onFulfilled
|
1099 | @param {Function} onRejected
|
1100 | Useful for tooling.
|
1101 | @return {Promise}
|
1102 | */
|
1103 | then: then,
|
1104 |
|
1105 | /**
|
1106 | `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
1107 | as the catch block of a try/catch statement.
|
1108 |
|
1109 | ```js
|
1110 | function findAuthor(){
|
1111 | throw new Error('couldn't find that author');
|
1112 | }
|
1113 |
|
1114 |
|
1115 | try {
|
1116 | findAuthor();
|
1117 | } catch(reason) {
|
1118 |
|
1119 | }
|
1120 |
|
1121 |
|
1122 | findAuthor().catch(function(reason){
|
1123 |
|
1124 | });
|
1125 | ```
|
1126 |
|
1127 | @method catch
|
1128 | @param {Function} onRejection
|
1129 | Useful for tooling.
|
1130 | @return {Promise}
|
1131 | */
|
1132 | 'catch': function _catch(onRejection) {
|
1133 | return this.then(null, onRejection);
|
1134 | }
|
1135 | };
|
1136 |
|
1137 | function polyfill() {
|
1138 | var local = undefined;
|
1139 |
|
1140 | if (typeof commonjsGlobal !== 'undefined') {
|
1141 | local = commonjsGlobal;
|
1142 | } else if (typeof self !== 'undefined') {
|
1143 | local = self;
|
1144 | } else {
|
1145 | try {
|
1146 | local = Function('return this')();
|
1147 | } catch (e) {
|
1148 | throw new Error('polyfill failed because global object is unavailable in this environment');
|
1149 | }
|
1150 | }
|
1151 |
|
1152 | var P = local.Promise;
|
1153 |
|
1154 | if (P) {
|
1155 | var promiseToString = null;
|
1156 | try {
|
1157 | promiseToString = Object.prototype.toString.call(P.resolve());
|
1158 | } catch (e) {
|
1159 | // silently ignored
|
1160 | }
|
1161 |
|
1162 | if (promiseToString === '[object Promise]' && !P.cast) {
|
1163 | return;
|
1164 | }
|
1165 | }
|
1166 |
|
1167 | local.Promise = Promise;
|
1168 | }
|
1169 |
|
1170 | // Strange compat..
|
1171 | Promise.polyfill = polyfill;
|
1172 | Promise.Promise = Promise;
|
1173 |
|
1174 | return Promise;
|
1175 |
|
1176 | })));
|
1177 |
|
1178 | });
|
1179 |
|
1180 | var name = 'audioCategory';
|
1181 | var pluralName = 'audioCategories';
|
1182 |
|
1183 | var defaultProperties = ['id', 'name'];
|
1184 |
|
1185 | var audioCategory = Object.freeze({
|
1186 | name: name,
|
1187 | pluralName: pluralName,
|
1188 | defaultProperties: defaultProperties
|
1189 | });
|
1190 |
|
1191 | var name$1 = 'audioTrack';
|
1192 | var pluralName$1 = 'audioTracks';
|
1193 |
|
1194 | var defaultProperties$1 = ['id', 'name', 'author', 'duration', 'src'];
|
1195 |
|
1196 | var audioTrack = Object.freeze({
|
1197 | name: name$1,
|
1198 | pluralName: pluralName$1,
|
1199 | defaultProperties: defaultProperties$1
|
1200 | });
|
1201 |
|
1202 | var name$2 = 'champion';
|
1203 | var pluralName$2 = 'champions';
|
1204 |
|
1205 | var defaultProperties$2 = ['id'];
|
1206 |
|
1207 | var champion = Object.freeze({
|
1208 | name: name$2,
|
1209 | pluralName: pluralName$2,
|
1210 | defaultProperties: defaultProperties$2
|
1211 | });
|
1212 |
|
1213 | var name$3 = 'cohort';
|
1214 | var pluralName$3 = 'cohorts';
|
1215 |
|
1216 | var defaultProperties$3 = ['id', 'name', 'description'];
|
1217 |
|
1218 | var cohort = Object.freeze({
|
1219 | name: name$3,
|
1220 | pluralName: pluralName$3,
|
1221 | defaultProperties: defaultProperties$3
|
1222 | });
|
1223 |
|
1224 | /**
|
1225 | * Gets the first element of `array`.
|
1226 | *
|
1227 | * @static
|
1228 | * @memberOf _
|
1229 | * @since 0.1.0
|
1230 | * @alias first
|
1231 | * @category Array
|
1232 | * @param {Array} array The array to query.
|
1233 | * @returns {*} Returns the first element of `array`.
|
1234 | * @example
|
1235 | *
|
1236 | * _.head([1, 2, 3]);
|
1237 | * // => 1
|
1238 | *
|
1239 | * _.head([]);
|
1240 | * // => undefined
|
1241 | */
|
1242 | function head(array) {
|
1243 | return (array && array.length) ? array[0] : undefined;
|
1244 | }
|
1245 |
|
1246 | var head_1 = head;
|
1247 |
|
1248 | /**
|
1249 | * The base implementation of `_.times` without support for iteratee shorthands
|
1250 | * or max array length checks.
|
1251 | *
|
1252 | * @private
|
1253 | * @param {number} n The number of times to invoke `iteratee`.
|
1254 | * @param {Function} iteratee The function invoked per iteration.
|
1255 | * @returns {Array} Returns the array of results.
|
1256 | */
|
1257 | function baseTimes$1(n, iteratee) {
|
1258 | var index = -1,
|
1259 | result = Array(n);
|
1260 |
|
1261 | while (++index < n) {
|
1262 | result[index] = iteratee(index);
|
1263 | }
|
1264 | return result;
|
1265 | }
|
1266 |
|
1267 | var _baseTimes = baseTimes$1;
|
1268 |
|
1269 | /** Detect free variable `global` from Node.js. */
|
1270 | var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
1271 |
|
1272 | var _freeGlobal = freeGlobal$1;
|
1273 |
|
1274 | var freeGlobal = _freeGlobal;
|
1275 |
|
1276 | /** Detect free variable `self`. */
|
1277 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
1278 |
|
1279 | /** Used as a reference to the global object. */
|
1280 | var root$1 = freeGlobal || freeSelf || Function('return this')();
|
1281 |
|
1282 | var _root = root$1;
|
1283 |
|
1284 | var root = _root;
|
1285 |
|
1286 | /** Built-in value references. */
|
1287 | var Symbol$1 = root.Symbol;
|
1288 |
|
1289 | var _Symbol = Symbol$1;
|
1290 |
|
1291 | var Symbol$2 = _Symbol;
|
1292 |
|
1293 | /** Used for built-in method references. */
|
1294 | var objectProto$2 = Object.prototype;
|
1295 |
|
1296 | /** Used to check objects for own properties. */
|
1297 | var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
1298 |
|
1299 | /**
|
1300 | * Used to resolve the
|
1301 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
1302 | * of values.
|
1303 | */
|
1304 | var nativeObjectToString = objectProto$2.toString;
|
1305 |
|
1306 | /** Built-in value references. */
|
1307 | var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
1308 |
|
1309 | /**
|
1310 | * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
1311 | *
|
1312 | * @private
|
1313 | * @param {*} value The value to query.
|
1314 | * @returns {string} Returns the raw `toStringTag`.
|
1315 | */
|
1316 | function getRawTag$1(value) {
|
1317 | var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
|
1318 | tag = value[symToStringTag$1];
|
1319 |
|
1320 | try {
|
1321 | value[symToStringTag$1] = undefined;
|
1322 | var unmasked = true;
|
1323 | } catch (e) {}
|
1324 |
|
1325 | var result = nativeObjectToString.call(value);
|
1326 | if (unmasked) {
|
1327 | if (isOwn) {
|
1328 | value[symToStringTag$1] = tag;
|
1329 | } else {
|
1330 | delete value[symToStringTag$1];
|
1331 | }
|
1332 | }
|
1333 | return result;
|
1334 | }
|
1335 |
|
1336 | var _getRawTag = getRawTag$1;
|
1337 |
|
1338 | /** Used for built-in method references. */
|
1339 | var objectProto$3 = Object.prototype;
|
1340 |
|
1341 | /**
|
1342 | * Used to resolve the
|
1343 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
1344 | * of values.
|
1345 | */
|
1346 | var nativeObjectToString$1 = objectProto$3.toString;
|
1347 |
|
1348 | /**
|
1349 | * Converts `value` to a string using `Object.prototype.toString`.
|
1350 | *
|
1351 | * @private
|
1352 | * @param {*} value The value to convert.
|
1353 | * @returns {string} Returns the converted string.
|
1354 | */
|
1355 | function objectToString$1(value) {
|
1356 | return nativeObjectToString$1.call(value);
|
1357 | }
|
1358 |
|
1359 | var _objectToString = objectToString$1;
|
1360 |
|
1361 | var Symbol = _Symbol;
|
1362 | var getRawTag = _getRawTag;
|
1363 | var objectToString = _objectToString;
|
1364 |
|
1365 | /** `Object#toString` result references. */
|
1366 | var nullTag = '[object Null]';
|
1367 | var undefinedTag = '[object Undefined]';
|
1368 |
|
1369 |
|
1370 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 | function baseGetTag$1(value) {
|
1380 | if (value == null) {
|
1381 | return value === undefined ? undefinedTag : nullTag;
|
1382 | }
|
1383 | return (symToStringTag && symToStringTag in Object(value))
|
1384 | ? getRawTag(value)
|
1385 | : objectToString(value);
|
1386 | }
|
1387 |
|
1388 | var _baseGetTag = baseGetTag$1;
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 | function isObjectLike$2(value) {
|
1415 | return value != null && typeof value == 'object';
|
1416 | }
|
1417 |
|
1418 | var isObjectLike_1 = isObjectLike$2;
|
1419 |
|
1420 | var baseGetTag = _baseGetTag;
|
1421 | var isObjectLike$1 = isObjectLike_1;
|
1422 |
|
1423 |
|
1424 | var argsTag = '[object Arguments]';
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 | function baseIsArguments$1(value) {
|
1434 | return isObjectLike$1(value) && baseGetTag(value) == argsTag;
|
1435 | }
|
1436 |
|
1437 | var _baseIsArguments = baseIsArguments$1;
|
1438 |
|
1439 | var baseIsArguments = _baseIsArguments;
|
1440 | var isObjectLike = isObjectLike_1;
|
1441 |
|
1442 |
|
1443 | var objectProto$1 = Object.prototype;
|
1444 |
|
1445 |
|
1446 | var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
1447 |
|
1448 |
|
1449 | var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 | var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
1470 | return isObjectLike(value) && hasOwnProperty$1.call(value, 'callee') &&
|
1471 | !propertyIsEnumerable.call(value, 'callee');
|
1472 | };
|
1473 |
|
1474 | var isArguments_1 = isArguments$1;
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 | var isArray$1 = Array.isArray;
|
1500 |
|
1501 | var isArray_1 = isArray$1;
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 | function stubFalse() {
|
1517 | return false;
|
1518 | }
|
1519 |
|
1520 | var stubFalse_1 = stubFalse;
|
1521 |
|
1522 | var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
1523 | var root = _root,
|
1524 | stubFalse = stubFalse_1;
|
1525 |
|
1526 |
|
1527 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
1528 |
|
1529 |
|
1530 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
1531 |
|
1532 |
|
1533 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1534 |
|
1535 |
|
1536 | var Buffer = moduleExports ? root.Buffer : undefined;
|
1537 |
|
1538 |
|
1539 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 | var isBuffer = nativeIsBuffer || stubFalse;
|
1559 |
|
1560 | module.exports = isBuffer;
|
1561 | });
|
1562 |
|
1563 |
|
1564 | var MAX_SAFE_INTEGER = 9007199254740991;
|
1565 |
|
1566 |
|
1567 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 | function isIndex$1(value, length) {
|
1578 | length = length == null ? MAX_SAFE_INTEGER : length;
|
1579 | return !!length &&
|
1580 | (typeof value == 'number' || reIsUint.test(value)) &&
|
1581 | (value > -1 && value % 1 == 0 && value < length);
|
1582 | }
|
1583 |
|
1584 | var _isIndex = isIndex$1;
|
1585 |
|
1586 |
|
1587 | var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
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 isLength$1(value) {
|
1616 | return typeof value == 'number' &&
|
1617 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
|
1618 | }
|
1619 |
|
1620 | var isLength_1 = isLength$1;
|
1621 |
|
1622 | var baseGetTag$2 = _baseGetTag;
|
1623 | var isLength = isLength_1;
|
1624 | var isObjectLike$3 = isObjectLike_1;
|
1625 |
|
1626 |
|
1627 | var argsTag$1 = '[object Arguments]';
|
1628 | var arrayTag = '[object Array]';
|
1629 | var boolTag = '[object Boolean]';
|
1630 | var dateTag = '[object Date]';
|
1631 | var errorTag = '[object Error]';
|
1632 | var funcTag = '[object Function]';
|
1633 | var mapTag = '[object Map]';
|
1634 | var numberTag = '[object Number]';
|
1635 | var objectTag = '[object Object]';
|
1636 | var regexpTag = '[object RegExp]';
|
1637 | var setTag = '[object Set]';
|
1638 | var stringTag = '[object String]';
|
1639 | var weakMapTag = '[object WeakMap]';
|
1640 |
|
1641 | var arrayBufferTag = '[object ArrayBuffer]';
|
1642 | var dataViewTag = '[object DataView]';
|
1643 | var float32Tag = '[object Float32Array]';
|
1644 | var float64Tag = '[object Float64Array]';
|
1645 | var int8Tag = '[object Int8Array]';
|
1646 | var int16Tag = '[object Int16Array]';
|
1647 | var int32Tag = '[object Int32Array]';
|
1648 | var uint8Tag = '[object Uint8Array]';
|
1649 | var uint8ClampedTag = '[object Uint8ClampedArray]';
|
1650 | var uint16Tag = '[object Uint16Array]';
|
1651 | var uint32Tag = '[object Uint32Array]';
|
1652 |
|
1653 |
|
1654 | var typedArrayTags = {};
|
1655 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
1656 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
1657 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
1658 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
1659 | typedArrayTags[uint32Tag] = true;
|
1660 | typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
|
1661 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
1662 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
1663 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
1664 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
1665 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
1666 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
1667 | typedArrayTags[weakMapTag] = false;
|
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 | function baseIsTypedArray$1(value) {
|
1677 | return isObjectLike$3(value) &&
|
1678 | isLength(value.length) && !!typedArrayTags[baseGetTag$2(value)];
|
1679 | }
|
1680 |
|
1681 | var _baseIsTypedArray = baseIsTypedArray$1;
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 | function baseUnary$1(func) {
|
1691 | return function(value) {
|
1692 | return func(value);
|
1693 | };
|
1694 | }
|
1695 |
|
1696 | var _baseUnary = baseUnary$1;
|
1697 |
|
1698 | var _nodeUtil = createCommonjsModule(function (module, exports) {
|
1699 | var freeGlobal = _freeGlobal;
|
1700 |
|
1701 |
|
1702 | var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
1703 |
|
1704 |
|
1705 | var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
1706 |
|
1707 |
|
1708 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1709 |
|
1710 |
|
1711 | var freeProcess = moduleExports && freeGlobal.process;
|
1712 |
|
1713 |
|
1714 | var nodeUtil = (function() {
|
1715 | try {
|
1716 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
1717 | } catch (e) {}
|
1718 | }());
|
1719 |
|
1720 | module.exports = nodeUtil;
|
1721 | });
|
1722 |
|
1723 | var baseIsTypedArray = _baseIsTypedArray;
|
1724 | var baseUnary = _baseUnary;
|
1725 | var nodeUtil = _nodeUtil;
|
1726 |
|
1727 |
|
1728 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 | var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
1748 |
|
1749 | var isTypedArray_1 = isTypedArray$1;
|
1750 |
|
1751 | var baseTimes = _baseTimes;
|
1752 | var isArguments = isArguments_1;
|
1753 | var isArray = isArray_1;
|
1754 | var isBuffer = isBuffer_1;
|
1755 | var isIndex = _isIndex;
|
1756 | var isTypedArray = isTypedArray_1;
|
1757 |
|
1758 |
|
1759 | var objectProto = Object.prototype;
|
1760 |
|
1761 |
|
1762 | var hasOwnProperty = objectProto.hasOwnProperty;
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 | function arrayLikeKeys$1(value, inherited) {
|
1773 | var isArr = isArray(value),
|
1774 | isArg = !isArr && isArguments(value),
|
1775 | isBuff = !isArr && !isArg && isBuffer(value),
|
1776 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
1777 | skipIndexes = isArr || isArg || isBuff || isType,
|
1778 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
1779 | length = result.length;
|
1780 |
|
1781 | for (var key in value) {
|
1782 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
1783 | !(skipIndexes && (
|
1784 |
|
1785 | key == 'length' ||
|
1786 |
|
1787 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
1788 |
|
1789 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
1790 |
|
1791 | isIndex(key, length)
|
1792 | ))) {
|
1793 | result.push(key);
|
1794 | }
|
1795 | }
|
1796 | return result;
|
1797 | }
|
1798 |
|
1799 | var _arrayLikeKeys = arrayLikeKeys$1;
|
1800 |
|
1801 |
|
1802 | var objectProto$5 = Object.prototype;
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 | function isPrototype$1(value) {
|
1812 | var Ctor = value && value.constructor,
|
1813 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
|
1814 |
|
1815 | return value === proto;
|
1816 | }
|
1817 |
|
1818 | var _isPrototype = isPrototype$1;
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 | function overArg$1(func, transform) {
|
1829 | return function(arg) {
|
1830 | return func(transform(arg));
|
1831 | };
|
1832 | }
|
1833 |
|
1834 | var _overArg = overArg$1;
|
1835 |
|
1836 | var overArg = _overArg;
|
1837 |
|
1838 |
|
1839 | var nativeKeys$1 = overArg(Object.keys, Object);
|
1840 |
|
1841 | var _nativeKeys = nativeKeys$1;
|
1842 |
|
1843 | var isPrototype = _isPrototype;
|
1844 | var nativeKeys = _nativeKeys;
|
1845 |
|
1846 |
|
1847 | var objectProto$4 = Object.prototype;
|
1848 |
|
1849 |
|
1850 | var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 | function baseKeys$1(object) {
|
1860 | if (!isPrototype(object)) {
|
1861 | return nativeKeys(object);
|
1862 | }
|
1863 | var result = [];
|
1864 | for (var key in Object(object)) {
|
1865 | if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
|
1866 | result.push(key);
|
1867 | }
|
1868 | }
|
1869 | return result;
|
1870 | }
|
1871 |
|
1872 | var _baseKeys = baseKeys$1;
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 | function isObject$1(value) {
|
1900 | var type = typeof value;
|
1901 | return value != null && (type == 'object' || type == 'function');
|
1902 | }
|
1903 |
|
1904 | var isObject_1 = isObject$1;
|
1905 |
|
1906 | var baseGetTag$3 = _baseGetTag;
|
1907 | var isObject = isObject_1;
|
1908 |
|
1909 |
|
1910 | var asyncTag = '[object AsyncFunction]';
|
1911 | var funcTag$1 = '[object Function]';
|
1912 | var genTag = '[object GeneratorFunction]';
|
1913 | var proxyTag = '[object Proxy]';
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 | function isFunction$1(value) {
|
1933 | if (!isObject(value)) {
|
1934 | return false;
|
1935 | }
|
1936 |
|
1937 |
|
1938 | var tag = baseGetTag$3(value);
|
1939 | return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
1940 | }
|
1941 |
|
1942 | var isFunction_1 = isFunction$1;
|
1943 |
|
1944 | var isFunction = isFunction_1;
|
1945 | var isLength$2 = isLength_1;
|
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 | function isArrayLike$1(value) {
|
1973 | return value != null && isLength$2(value.length) && !isFunction(value);
|
1974 | }
|
1975 |
|
1976 | var isArrayLike_1 = isArrayLike$1;
|
1977 |
|
1978 | var arrayLikeKeys = _arrayLikeKeys;
|
1979 | var baseKeys = _baseKeys;
|
1980 | var isArrayLike = isArrayLike_1;
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 | function keys(object) {
|
2011 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
2012 | }
|
2013 |
|
2014 | var keys_1 = keys;
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 | function arrayMap$1(array, iteratee) {
|
2026 | var index = -1,
|
2027 | length = array == null ? 0 : array.length,
|
2028 | result = Array(length);
|
2029 |
|
2030 | while (++index < length) {
|
2031 | result[index] = iteratee(array[index], index, array);
|
2032 | }
|
2033 | return result;
|
2034 | }
|
2035 |
|
2036 | var _arrayMap = arrayMap$1;
|
2037 |
|
2038 | var baseGetTag$4 = _baseGetTag;
|
2039 | var isObjectLike$4 = isObjectLike_1;
|
2040 |
|
2041 |
|
2042 | var symbolTag = '[object Symbol]';
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 | function isSymbol$1(value) {
|
2062 | return typeof value == 'symbol' ||
|
2063 | (isObjectLike$4(value) && baseGetTag$4(value) == symbolTag);
|
2064 | }
|
2065 |
|
2066 | var isSymbol_1 = isSymbol$1;
|
2067 |
|
2068 | var Symbol$3 = _Symbol;
|
2069 | var arrayMap = _arrayMap;
|
2070 | var isArray$3 = isArray_1;
|
2071 | var isSymbol = isSymbol_1;
|
2072 |
|
2073 |
|
2074 | var INFINITY = 1 / 0;
|
2075 |
|
2076 |
|
2077 | var symbolProto = Symbol$3 ? Symbol$3.prototype : undefined;
|
2078 | var symbolToString = symbolProto ? symbolProto.toString : undefined;
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 | function baseToString$1(value) {
|
2089 |
|
2090 | if (typeof value == 'string') {
|
2091 | return value;
|
2092 | }
|
2093 | if (isArray$3(value)) {
|
2094 |
|
2095 | return arrayMap(value, baseToString$1) + '';
|
2096 | }
|
2097 | if (isSymbol(value)) {
|
2098 | return symbolToString ? symbolToString.call(value) : '';
|
2099 | }
|
2100 | var result = (value + '');
|
2101 | return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
2102 | }
|
2103 |
|
2104 | var _baseToString = baseToString$1;
|
2105 |
|
2106 | var baseToString = _baseToString;
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 | function toString$1(value) {
|
2130 | return value == null ? '' : baseToString(value);
|
2131 | }
|
2132 |
|
2133 | var toString_1 = toString$1;
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 | function baseSlice$1(array, start, end) {
|
2145 | var index = -1,
|
2146 | length = array.length;
|
2147 |
|
2148 | if (start < 0) {
|
2149 | start = -start > length ? 0 : (length + start);
|
2150 | }
|
2151 | end = end > length ? length : end;
|
2152 | if (end < 0) {
|
2153 | end += length;
|
2154 | }
|
2155 | length = start > end ? 0 : ((end - start) >>> 0);
|
2156 | start >>>= 0;
|
2157 |
|
2158 | var result = Array(length);
|
2159 | while (++index < length) {
|
2160 | result[index] = array[index + start];
|
2161 | }
|
2162 | return result;
|
2163 | }
|
2164 |
|
2165 | var _baseSlice = baseSlice$1;
|
2166 |
|
2167 | var baseSlice = _baseSlice;
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 | function castSlice$1(array, start, end) {
|
2179 | var length = array.length;
|
2180 | end = end === undefined ? length : end;
|
2181 | return (!start && end >= length) ? array : baseSlice(array, start, end);
|
2182 | }
|
2183 |
|
2184 | var _castSlice = castSlice$1;
|
2185 |
|
2186 |
|
2187 | var rsAstralRange = '\\ud800-\\udfff';
|
2188 | var rsComboMarksRange = '\\u0300-\\u036f';
|
2189 | var reComboHalfMarksRange = '\\ufe20-\\ufe2f';
|
2190 | var rsComboSymbolsRange = '\\u20d0-\\u20ff';
|
2191 | var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
2192 | var rsVarRange = '\\ufe0e\\ufe0f';
|
2193 |
|
2194 |
|
2195 | var rsZWJ = '\\u200d';
|
2196 |
|
2197 |
|
2198 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 | function hasUnicode$1(string) {
|
2208 | return reHasUnicode.test(string);
|
2209 | }
|
2210 |
|
2211 | var _hasUnicode = hasUnicode$1;
|
2212 |
|
2213 |
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 | function asciiToArray$1(string) {
|
2221 | return string.split('');
|
2222 | }
|
2223 |
|
2224 | var _asciiToArray = asciiToArray$1;
|
2225 |
|
2226 |
|
2227 | var rsAstralRange$1 = '\\ud800-\\udfff';
|
2228 | var rsComboMarksRange$1 = '\\u0300-\\u036f';
|
2229 | var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f';
|
2230 | var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff';
|
2231 | var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
|
2232 | var rsVarRange$1 = '\\ufe0e\\ufe0f';
|
2233 |
|
2234 |
|
2235 | var rsAstral = '[' + rsAstralRange$1 + ']';
|
2236 | var rsCombo = '[' + rsComboRange$1 + ']';
|
2237 | var rsFitz = '\\ud83c[\\udffb-\\udfff]';
|
2238 | var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
|
2239 | var rsNonAstral = '[^' + rsAstralRange$1 + ']';
|
2240 | var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
|
2241 | var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
|
2242 | var rsZWJ$1 = '\\u200d';
|
2243 |
|
2244 |
|
2245 | var reOptMod = rsModifier + '?';
|
2246 | var rsOptVar = '[' + rsVarRange$1 + ']?';
|
2247 | var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
|
2248 | var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
2249 | var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
2250 |
|
2251 |
|
2252 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 | function unicodeToArray$1(string) {
|
2262 | return string.match(reUnicode) || [];
|
2263 | }
|
2264 |
|
2265 | var _unicodeToArray = unicodeToArray$1;
|
2266 |
|
2267 | var asciiToArray = _asciiToArray;
|
2268 | var hasUnicode$2 = _hasUnicode;
|
2269 | var unicodeToArray = _unicodeToArray;
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 | function stringToArray$1(string) {
|
2279 | return hasUnicode$2(string)
|
2280 | ? unicodeToArray(string)
|
2281 | : asciiToArray(string);
|
2282 | }
|
2283 |
|
2284 | var _stringToArray = stringToArray$1;
|
2285 |
|
2286 | var castSlice = _castSlice;
|
2287 | var hasUnicode = _hasUnicode;
|
2288 | var stringToArray = _stringToArray;
|
2289 | var toString$2 = toString_1;
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 | function createCaseFirst$1(methodName) {
|
2299 | return function(string) {
|
2300 | string = toString$2(string);
|
2301 |
|
2302 | var strSymbols = hasUnicode(string)
|
2303 | ? stringToArray(string)
|
2304 | : undefined;
|
2305 |
|
2306 | var chr = strSymbols
|
2307 | ? strSymbols[0]
|
2308 | : string.charAt(0);
|
2309 |
|
2310 | var trailing = strSymbols
|
2311 | ? castSlice(strSymbols, 1).join('')
|
2312 | : string.slice(1);
|
2313 |
|
2314 | return chr[methodName]() + trailing;
|
2315 | };
|
2316 | }
|
2317 |
|
2318 | var _createCaseFirst = createCaseFirst$1;
|
2319 |
|
2320 | var createCaseFirst = _createCaseFirst;
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 | var upperFirst$1 = createCaseFirst('toUpperCase');
|
2340 |
|
2341 | var upperFirst_1 = upperFirst$1;
|
2342 |
|
2343 | var toString = toString_1;
|
2344 | var upperFirst = upperFirst_1;
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 | function capitalize$1(string) {
|
2362 | return upperFirst(toString(string).toLowerCase());
|
2363 | }
|
2364 |
|
2365 | var capitalize_1 = capitalize$1;
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 | function arrayReduce$1(array, iteratee, accumulator, initAccum) {
|
2380 | var index = -1,
|
2381 | length = array == null ? 0 : array.length;
|
2382 |
|
2383 | if (initAccum && length) {
|
2384 | accumulator = array[++index];
|
2385 | }
|
2386 | while (++index < length) {
|
2387 | accumulator = iteratee(accumulator, array[index], index, array);
|
2388 | }
|
2389 | return accumulator;
|
2390 | }
|
2391 |
|
2392 | var _arrayReduce = arrayReduce$1;
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 | function basePropertyOf$1(object) {
|
2402 | return function(key) {
|
2403 | return object == null ? undefined : object[key];
|
2404 | };
|
2405 | }
|
2406 |
|
2407 | var _basePropertyOf = basePropertyOf$1;
|
2408 |
|
2409 | var basePropertyOf = _basePropertyOf;
|
2410 |
|
2411 |
|
2412 | var deburredLetters = {
|
2413 |
|
2414 | '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
2415 | '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
2416 | '\xc7': 'C', '\xe7': 'c',
|
2417 | '\xd0': 'D', '\xf0': 'd',
|
2418 | '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
2419 | '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
2420 | '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
2421 | '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
2422 | '\xd1': 'N', '\xf1': 'n',
|
2423 | '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
2424 | '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
2425 | '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
|
2426 | '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
|
2427 | '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
2428 | '\xc6': 'Ae', '\xe6': 'ae',
|
2429 | '\xde': 'Th', '\xfe': 'th',
|
2430 | '\xdf': 'ss',
|
2431 |
|
2432 | '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
2433 | '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
2434 | '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
2435 | '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
2436 | '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
2437 | '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
2438 | '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
2439 | '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
2440 | '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
2441 | '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
2442 | '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
2443 | '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
2444 | '\u0134': 'J', '\u0135': 'j',
|
2445 | '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
2446 | '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
2447 | '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
2448 | '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
2449 | '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
2450 | '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
2451 | '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
2452 | '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
2453 | '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
2454 | '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
2455 | '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
2456 | '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
2457 | '\u0163': 't', '\u0165': 't', '\u0167': 't',
|
2458 | '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
2459 | '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
2460 | '\u0174': 'W', '\u0175': 'w',
|
2461 | '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
2462 | '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
2463 | '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
2464 | '\u0132': 'IJ', '\u0133': 'ij',
|
2465 | '\u0152': 'Oe', '\u0153': 'oe',
|
2466 | '\u0149': "'n", '\u017f': 's'
|
2467 | };
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 | var deburrLetter$1 = basePropertyOf(deburredLetters);
|
2478 |
|
2479 | var _deburrLetter = deburrLetter$1;
|
2480 |
|
2481 | var deburrLetter = _deburrLetter;
|
2482 | var toString$3 = toString_1;
|
2483 |
|
2484 |
|
2485 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
2486 |
|
2487 |
|
2488 | var rsComboMarksRange$2 = '\\u0300-\\u036f';
|
2489 | var reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f';
|
2490 | var rsComboSymbolsRange$2 = '\\u20d0-\\u20ff';
|
2491 | var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
|
2492 |
|
2493 |
|
2494 | var rsCombo$1 = '[' + rsComboRange$2 + ']';
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 | var reComboMark = RegExp(rsCombo$1, 'g');
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 | function deburr$1(string) {
|
2521 | string = toString$3(string);
|
2522 | return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
2523 | }
|
2524 |
|
2525 | var deburr_1 = deburr$1;
|
2526 |
|
2527 |
|
2528 | var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 | function asciiWords$1(string) {
|
2538 | return string.match(reAsciiWord) || [];
|
2539 | }
|
2540 |
|
2541 | var _asciiWords = asciiWords$1;
|
2542 |
|
2543 |
|
2544 | var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 | function hasUnicodeWord$1(string) {
|
2554 | return reHasUnicodeWord.test(string);
|
2555 | }
|
2556 |
|
2557 | var _hasUnicodeWord = hasUnicodeWord$1;
|
2558 |
|
2559 |
|
2560 | var rsAstralRange$2 = '\\ud800-\\udfff';
|
2561 | var rsComboMarksRange$3 = '\\u0300-\\u036f';
|
2562 | var reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f';
|
2563 | var rsComboSymbolsRange$3 = '\\u20d0-\\u20ff';
|
2564 | var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
|
2565 | var rsDingbatRange = '\\u2700-\\u27bf';
|
2566 | var rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff';
|
2567 | var rsMathOpRange = '\\xac\\xb1\\xd7\\xf7';
|
2568 | var rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf';
|
2569 | var rsPunctuationRange = '\\u2000-\\u206f';
|
2570 | var rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000';
|
2571 | var rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde';
|
2572 | var rsVarRange$2 = '\\ufe0e\\ufe0f';
|
2573 | var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
2574 |
|
2575 |
|
2576 | var rsApos$1 = "['\u2019]";
|
2577 | var rsBreak = '[' + rsBreakRange + ']';
|
2578 | var rsCombo$2 = '[' + rsComboRange$3 + ']';
|
2579 | var rsDigits = '\\d+';
|
2580 | var rsDingbat = '[' + rsDingbatRange + ']';
|
2581 | var rsLower = '[' + rsLowerRange + ']';
|
2582 | var rsMisc = '[^' + rsAstralRange$2 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']';
|
2583 | var rsFitz$1 = '\\ud83c[\\udffb-\\udfff]';
|
2584 | var rsModifier$1 = '(?:' + rsCombo$2 + '|' + rsFitz$1 + ')';
|
2585 | var rsNonAstral$1 = '[^' + rsAstralRange$2 + ']';
|
2586 | var rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}';
|
2587 | var rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]';
|
2588 | var rsUpper = '[' + rsUpperRange + ']';
|
2589 | var rsZWJ$2 = '\\u200d';
|
2590 |
|
2591 |
|
2592 | var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')';
|
2593 | var rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')';
|
2594 | var rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?';
|
2595 | var rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?';
|
2596 | var reOptMod$1 = rsModifier$1 + '?';
|
2597 | var rsOptVar$1 = '[' + rsVarRange$2 + ']?';
|
2598 | var rsOptJoin$1 = '(?:' + rsZWJ$2 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*';
|
2599 | var rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)';
|
2600 | var rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)';
|
2601 | var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
|
2602 | var rsEmoji = '(?:' + [rsDingbat, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsSeq$1;
|
2603 |
|
2604 |
|
2605 | var reUnicodeWord = RegExp([
|
2606 | rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
2607 | rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
|
2608 | rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
2609 | rsUpper + '+' + rsOptContrUpper,
|
2610 | rsOrdUpper,
|
2611 | rsOrdLower,
|
2612 | rsDigits,
|
2613 | rsEmoji
|
2614 | ].join('|'), 'g');
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 | function unicodeWords$1(string) {
|
2624 | return string.match(reUnicodeWord) || [];
|
2625 | }
|
2626 |
|
2627 | var _unicodeWords = unicodeWords$1;
|
2628 |
|
2629 | var asciiWords = _asciiWords;
|
2630 | var hasUnicodeWord = _hasUnicodeWord;
|
2631 | var toString$4 = toString_1;
|
2632 | var unicodeWords = _unicodeWords;
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 | function words$1(string, pattern, guard) {
|
2654 | string = toString$4(string);
|
2655 | pattern = guard ? undefined : pattern;
|
2656 |
|
2657 | if (pattern === undefined) {
|
2658 | return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
2659 | }
|
2660 | return string.match(pattern) || [];
|
2661 | }
|
2662 |
|
2663 | var words_1 = words$1;
|
2664 |
|
2665 | var arrayReduce = _arrayReduce;
|
2666 | var deburr = deburr_1;
|
2667 | var words = words_1;
|
2668 |
|
2669 |
|
2670 | var rsApos = "['\u2019]";
|
2671 |
|
2672 |
|
2673 | var reApos = RegExp(rsApos, 'g');
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 | function createCompounder$1(callback) {
|
2683 | return function(string) {
|
2684 | return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
2685 | };
|
2686 | }
|
2687 |
|
2688 | var _createCompounder = createCompounder$1;
|
2689 |
|
2690 | var capitalize = capitalize_1;
|
2691 | var createCompounder = _createCompounder;
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 | var camelCase = createCompounder(function(result, word, index) {
|
2714 | word = word.toLowerCase();
|
2715 | return result + (index ? capitalize(word) : word);
|
2716 | });
|
2717 |
|
2718 | var camelCase_1 = camelCase;
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 | function arrayPush$1(array, values) {
|
2729 | var index = -1,
|
2730 | length = values.length,
|
2731 | offset = array.length;
|
2732 |
|
2733 | while (++index < length) {
|
2734 | array[offset + index] = values[index];
|
2735 | }
|
2736 | return array;
|
2737 | }
|
2738 |
|
2739 | var _arrayPush = arrayPush$1;
|
2740 |
|
2741 | var Symbol$4 = _Symbol;
|
2742 | var isArguments$2 = isArguments_1;
|
2743 | var isArray$5 = isArray_1;
|
2744 |
|
2745 |
|
2746 | var spreadableSymbol = Symbol$4 ? Symbol$4.isConcatSpreadable : undefined;
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 | function isFlattenable$1(value) {
|
2756 | return isArray$5(value) || isArguments$2(value) ||
|
2757 | !!(spreadableSymbol && value && value[spreadableSymbol]);
|
2758 | }
|
2759 |
|
2760 | var _isFlattenable = isFlattenable$1;
|
2761 |
|
2762 | var arrayPush$2 = _arrayPush;
|
2763 | var isFlattenable = _isFlattenable;
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 | function baseFlatten$1(array, depth, predicate, isStrict, result) {
|
2777 | var index = -1,
|
2778 | length = array.length;
|
2779 |
|
2780 | predicate || (predicate = isFlattenable);
|
2781 | result || (result = []);
|
2782 |
|
2783 | while (++index < length) {
|
2784 | var value = array[index];
|
2785 | if (depth > 0 && predicate(value)) {
|
2786 | if (depth > 1) {
|
2787 |
|
2788 | baseFlatten$1(value, depth - 1, predicate, isStrict, result);
|
2789 | } else {
|
2790 | arrayPush$2(result, value);
|
2791 | }
|
2792 | } else if (!isStrict) {
|
2793 | result[result.length] = value;
|
2794 | }
|
2795 | }
|
2796 | return result;
|
2797 | }
|
2798 |
|
2799 | var _baseFlatten = baseFlatten$1;
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 | function copyArray$1(source, array) {
|
2810 | var index = -1,
|
2811 | length = source.length;
|
2812 |
|
2813 | array || (array = Array(length));
|
2814 | while (++index < length) {
|
2815 | array[index] = source[index];
|
2816 | }
|
2817 | return array;
|
2818 | }
|
2819 |
|
2820 | var _copyArray = copyArray$1;
|
2821 |
|
2822 | var arrayPush = _arrayPush;
|
2823 | var baseFlatten = _baseFlatten;
|
2824 | var copyArray = _copyArray;
|
2825 | var isArray$4 = isArray_1;
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 | function concat() {
|
2850 | var length = arguments.length;
|
2851 | if (!length) {
|
2852 | return [];
|
2853 | }
|
2854 | var args = Array(length - 1),
|
2855 | array = arguments[0],
|
2856 | index = length;
|
2857 |
|
2858 | while (index--) {
|
2859 | args[index - 1] = arguments[index];
|
2860 | }
|
2861 | return arrayPush(isArray$4(array) ? copyArray(array) : [array], baseFlatten(args, 1));
|
2862 | }
|
2863 |
|
2864 | var concat_1 = concat;
|
2865 |
|
2866 | var isArray$7 = isArray_1;
|
2867 | var isSymbol$2 = isSymbol_1;
|
2868 |
|
2869 |
|
2870 | var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
2871 | var reIsPlainProp = /^\w*$/;
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 | function isKey$1(value, object) {
|
2882 | if (isArray$7(value)) {
|
2883 | return false;
|
2884 | }
|
2885 | var type = typeof value;
|
2886 | if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
2887 | value == null || isSymbol$2(value)) {
|
2888 | return true;
|
2889 | }
|
2890 | return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
2891 | (object != null && value in Object(object));
|
2892 | }
|
2893 |
|
2894 | var _isKey = isKey$1;
|
2895 |
|
2896 | var root$2 = _root;
|
2897 |
|
2898 |
|
2899 | var coreJsData$1 = root$2['__core-js_shared__'];
|
2900 |
|
2901 | var _coreJsData = coreJsData$1;
|
2902 |
|
2903 | var coreJsData = _coreJsData;
|
2904 |
|
2905 |
|
2906 | var maskSrcKey = (function() {
|
2907 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
2908 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
2909 | }());
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 | function isMasked$1(func) {
|
2919 | return !!maskSrcKey && (maskSrcKey in func);
|
2920 | }
|
2921 |
|
2922 | var _isMasked = isMasked$1;
|
2923 |
|
2924 |
|
2925 | var funcProto$1 = Function.prototype;
|
2926 |
|
2927 |
|
2928 | var funcToString$1 = funcProto$1.toString;
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 | function toSource$1(func) {
|
2938 | if (func != null) {
|
2939 | try {
|
2940 | return funcToString$1.call(func);
|
2941 | } catch (e) {}
|
2942 | try {
|
2943 | return (func + '');
|
2944 | } catch (e) {}
|
2945 | }
|
2946 | return '';
|
2947 | }
|
2948 |
|
2949 | var _toSource = toSource$1;
|
2950 |
|
2951 | var isFunction$3 = isFunction_1;
|
2952 | var isMasked = _isMasked;
|
2953 | var isObject$2 = isObject_1;
|
2954 | var toSource = _toSource;
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 |
|
2960 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
2961 |
|
2962 |
|
2963 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
2964 |
|
2965 |
|
2966 | var funcProto = Function.prototype;
|
2967 | var objectProto$6 = Object.prototype;
|
2968 |
|
2969 |
|
2970 | var funcToString = funcProto.toString;
|
2971 |
|
2972 |
|
2973 | var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
2974 |
|
2975 |
|
2976 | var reIsNative = RegExp('^' +
|
2977 | funcToString.call(hasOwnProperty$4).replace(reRegExpChar, '\\$&')
|
2978 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
2979 | );
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 | function baseIsNative$1(value) {
|
2990 | if (!isObject$2(value) || isMasked(value)) {
|
2991 | return false;
|
2992 | }
|
2993 | var pattern = isFunction$3(value) ? reIsNative : reIsHostCtor;
|
2994 | return pattern.test(toSource(value));
|
2995 | }
|
2996 |
|
2997 | var _baseIsNative = baseIsNative$1;
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 | function getValue$1(object, key) {
|
3008 | return object == null ? undefined : object[key];
|
3009 | }
|
3010 |
|
3011 | var _getValue = getValue$1;
|
3012 |
|
3013 | var baseIsNative = _baseIsNative;
|
3014 | var getValue = _getValue;
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 | function getNative$1(object, key) {
|
3025 | var value = getValue(object, key);
|
3026 | return baseIsNative(value) ? value : undefined;
|
3027 | }
|
3028 |
|
3029 | var _getNative = getNative$1;
|
3030 |
|
3031 | var getNative = _getNative;
|
3032 |
|
3033 |
|
3034 | var nativeCreate$1 = getNative(Object, 'create');
|
3035 |
|
3036 | var _nativeCreate = nativeCreate$1;
|
3037 |
|
3038 | var nativeCreate = _nativeCreate;
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 | function hashClear$1() {
|
3048 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
3049 | this.size = 0;
|
3050 | }
|
3051 |
|
3052 | var _hashClear = hashClear$1;
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 | function hashDelete$1(key) {
|
3065 | var result = this.has(key) && delete this.__data__[key];
|
3066 | this.size -= result ? 1 : 0;
|
3067 | return result;
|
3068 | }
|
3069 |
|
3070 | var _hashDelete = hashDelete$1;
|
3071 |
|
3072 | var nativeCreate$2 = _nativeCreate;
|
3073 |
|
3074 |
|
3075 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
3076 |
|
3077 |
|
3078 | var objectProto$7 = Object.prototype;
|
3079 |
|
3080 |
|
3081 | var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 | function hashGet$1(key) {
|
3093 | var data = this.__data__;
|
3094 | if (nativeCreate$2) {
|
3095 | var result = data[key];
|
3096 | return result === HASH_UNDEFINED ? undefined : result;
|
3097 | }
|
3098 | return hasOwnProperty$5.call(data, key) ? data[key] : undefined;
|
3099 | }
|
3100 |
|
3101 | var _hashGet = hashGet$1;
|
3102 |
|
3103 | var nativeCreate$3 = _nativeCreate;
|
3104 |
|
3105 |
|
3106 | var objectProto$8 = Object.prototype;
|
3107 |
|
3108 |
|
3109 | var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 | function hashHas$1(key) {
|
3121 | var data = this.__data__;
|
3122 | return nativeCreate$3 ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
|
3123 | }
|
3124 |
|
3125 | var _hashHas = hashHas$1;
|
3126 |
|
3127 | var nativeCreate$4 = _nativeCreate;
|
3128 |
|
3129 |
|
3130 | var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 | function hashSet$1(key, value) {
|
3143 | var data = this.__data__;
|
3144 | this.size += this.has(key) ? 0 : 1;
|
3145 | data[key] = (nativeCreate$4 && value === undefined) ? HASH_UNDEFINED$1 : value;
|
3146 | return this;
|
3147 | }
|
3148 |
|
3149 | var _hashSet = hashSet$1;
|
3150 |
|
3151 | var hashClear = _hashClear;
|
3152 | var hashDelete = _hashDelete;
|
3153 | var hashGet = _hashGet;
|
3154 | var hashHas = _hashHas;
|
3155 | var hashSet = _hashSet;
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 | function Hash$1(entries) {
|
3165 | var index = -1,
|
3166 | length = entries == null ? 0 : entries.length;
|
3167 |
|
3168 | this.clear();
|
3169 | while (++index < length) {
|
3170 | var entry = entries[index];
|
3171 | this.set(entry[0], entry[1]);
|
3172 | }
|
3173 | }
|
3174 |
|
3175 |
|
3176 | Hash$1.prototype.clear = hashClear;
|
3177 | Hash$1.prototype['delete'] = hashDelete;
|
3178 | Hash$1.prototype.get = hashGet;
|
3179 | Hash$1.prototype.has = hashHas;
|
3180 | Hash$1.prototype.set = hashSet;
|
3181 |
|
3182 | var _Hash = Hash$1;
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 | function listCacheClear$1() {
|
3192 | this.__data__ = [];
|
3193 | this.size = 0;
|
3194 | }
|
3195 |
|
3196 | var _listCacheClear = listCacheClear$1;
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 | function eq$1(value, other) {
|
3231 | return value === other || (value !== value && other !== other);
|
3232 | }
|
3233 |
|
3234 | var eq_1 = eq$1;
|
3235 |
|
3236 | var eq = eq_1;
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 | function assocIndexOf$1(array, key) {
|
3247 | var length = array.length;
|
3248 | while (length--) {
|
3249 | if (eq(array[length][0], key)) {
|
3250 | return length;
|
3251 | }
|
3252 | }
|
3253 | return -1;
|
3254 | }
|
3255 |
|
3256 | var _assocIndexOf = assocIndexOf$1;
|
3257 |
|
3258 | var assocIndexOf = _assocIndexOf;
|
3259 |
|
3260 |
|
3261 | var arrayProto = Array.prototype;
|
3262 |
|
3263 |
|
3264 | var splice = arrayProto.splice;
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 | function listCacheDelete$1(key) {
|
3276 | var data = this.__data__,
|
3277 | index = assocIndexOf(data, key);
|
3278 |
|
3279 | if (index < 0) {
|
3280 | return false;
|
3281 | }
|
3282 | var lastIndex = data.length - 1;
|
3283 | if (index == lastIndex) {
|
3284 | data.pop();
|
3285 | } else {
|
3286 | splice.call(data, index, 1);
|
3287 | }
|
3288 | --this.size;
|
3289 | return true;
|
3290 | }
|
3291 |
|
3292 | var _listCacheDelete = listCacheDelete$1;
|
3293 |
|
3294 | var assocIndexOf$2 = _assocIndexOf;
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 | function listCacheGet$1(key) {
|
3306 | var data = this.__data__,
|
3307 | index = assocIndexOf$2(data, key);
|
3308 |
|
3309 | return index < 0 ? undefined : data[index][1];
|
3310 | }
|
3311 |
|
3312 | var _listCacheGet = listCacheGet$1;
|
3313 |
|
3314 | var assocIndexOf$3 = _assocIndexOf;
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 | function listCacheHas$1(key) {
|
3326 | return assocIndexOf$3(this.__data__, key) > -1;
|
3327 | }
|
3328 |
|
3329 | var _listCacheHas = listCacheHas$1;
|
3330 |
|
3331 | var assocIndexOf$4 = _assocIndexOf;
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 | function listCacheSet$1(key, value) {
|
3344 | var data = this.__data__,
|
3345 | index = assocIndexOf$4(data, key);
|
3346 |
|
3347 | if (index < 0) {
|
3348 | ++this.size;
|
3349 | data.push([key, value]);
|
3350 | } else {
|
3351 | data[index][1] = value;
|
3352 | }
|
3353 | return this;
|
3354 | }
|
3355 |
|
3356 | var _listCacheSet = listCacheSet$1;
|
3357 |
|
3358 | var listCacheClear = _listCacheClear;
|
3359 | var listCacheDelete = _listCacheDelete;
|
3360 | var listCacheGet = _listCacheGet;
|
3361 | var listCacheHas = _listCacheHas;
|
3362 | var listCacheSet = _listCacheSet;
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 | function ListCache$1(entries) {
|
3372 | var index = -1,
|
3373 | length = entries == null ? 0 : entries.length;
|
3374 |
|
3375 | this.clear();
|
3376 | while (++index < length) {
|
3377 | var entry = entries[index];
|
3378 | this.set(entry[0], entry[1]);
|
3379 | }
|
3380 | }
|
3381 |
|
3382 |
|
3383 | ListCache$1.prototype.clear = listCacheClear;
|
3384 | ListCache$1.prototype['delete'] = listCacheDelete;
|
3385 | ListCache$1.prototype.get = listCacheGet;
|
3386 | ListCache$1.prototype.has = listCacheHas;
|
3387 | ListCache$1.prototype.set = listCacheSet;
|
3388 |
|
3389 | var _ListCache = ListCache$1;
|
3390 |
|
3391 | var getNative$2 = _getNative;
|
3392 | var root$3 = _root;
|
3393 |
|
3394 |
|
3395 | var Map$1 = getNative$2(root$3, 'Map');
|
3396 |
|
3397 | var _Map = Map$1;
|
3398 |
|
3399 | var Hash = _Hash;
|
3400 | var ListCache = _ListCache;
|
3401 | var Map = _Map;
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 | function mapCacheClear$1() {
|
3411 | this.size = 0;
|
3412 | this.__data__ = {
|
3413 | 'hash': new Hash,
|
3414 | 'map': new (Map || ListCache),
|
3415 | 'string': new Hash
|
3416 | };
|
3417 | }
|
3418 |
|
3419 | var _mapCacheClear = mapCacheClear$1;
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 | function isKeyable$1(value) {
|
3429 | var type = typeof value;
|
3430 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
3431 | ? (value !== '__proto__')
|
3432 | : (value === null);
|
3433 | }
|
3434 |
|
3435 | var _isKeyable = isKeyable$1;
|
3436 |
|
3437 | var isKeyable = _isKeyable;
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 | function getMapData$1(map, key) {
|
3448 | var data = map.__data__;
|
3449 | return isKeyable(key)
|
3450 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
3451 | : data.map;
|
3452 | }
|
3453 |
|
3454 | var _getMapData = getMapData$1;
|
3455 |
|
3456 | var getMapData = _getMapData;
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 | function mapCacheDelete$1(key) {
|
3468 | var result = getMapData(this, key)['delete'](key);
|
3469 | this.size -= result ? 1 : 0;
|
3470 | return result;
|
3471 | }
|
3472 |
|
3473 | var _mapCacheDelete = mapCacheDelete$1;
|
3474 |
|
3475 | var getMapData$2 = _getMapData;
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 | function mapCacheGet$1(key) {
|
3487 | return getMapData$2(this, key).get(key);
|
3488 | }
|
3489 |
|
3490 | var _mapCacheGet = mapCacheGet$1;
|
3491 |
|
3492 | var getMapData$3 = _getMapData;
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 | function mapCacheHas$1(key) {
|
3504 | return getMapData$3(this, key).has(key);
|
3505 | }
|
3506 |
|
3507 | var _mapCacheHas = mapCacheHas$1;
|
3508 |
|
3509 | var getMapData$4 = _getMapData;
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 | function mapCacheSet$1(key, value) {
|
3522 | var data = getMapData$4(this, key),
|
3523 | size = data.size;
|
3524 |
|
3525 | data.set(key, value);
|
3526 | this.size += data.size == size ? 0 : 1;
|
3527 | return this;
|
3528 | }
|
3529 |
|
3530 | var _mapCacheSet = mapCacheSet$1;
|
3531 |
|
3532 | var mapCacheClear = _mapCacheClear;
|
3533 | var mapCacheDelete = _mapCacheDelete;
|
3534 | var mapCacheGet = _mapCacheGet;
|
3535 | var mapCacheHas = _mapCacheHas;
|
3536 | var mapCacheSet = _mapCacheSet;
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 |
|
3545 | function MapCache$1(entries) {
|
3546 | var index = -1,
|
3547 | length = entries == null ? 0 : entries.length;
|
3548 |
|
3549 | this.clear();
|
3550 | while (++index < length) {
|
3551 | var entry = entries[index];
|
3552 | this.set(entry[0], entry[1]);
|
3553 | }
|
3554 | }
|
3555 |
|
3556 |
|
3557 | MapCache$1.prototype.clear = mapCacheClear;
|
3558 | MapCache$1.prototype['delete'] = mapCacheDelete;
|
3559 | MapCache$1.prototype.get = mapCacheGet;
|
3560 | MapCache$1.prototype.has = mapCacheHas;
|
3561 | MapCache$1.prototype.set = mapCacheSet;
|
3562 |
|
3563 | var _MapCache = MapCache$1;
|
3564 |
|
3565 | var MapCache = _MapCache;
|
3566 |
|
3567 |
|
3568 | var FUNC_ERROR_TEXT = 'Expected a function';
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 | function memoize$1(func, resolver) {
|
3615 | if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
3616 | throw new TypeError(FUNC_ERROR_TEXT);
|
3617 | }
|
3618 | var memoized = function() {
|
3619 | var args = arguments,
|
3620 | key = resolver ? resolver.apply(this, args) : args[0],
|
3621 | cache = memoized.cache;
|
3622 |
|
3623 | if (cache.has(key)) {
|
3624 | return cache.get(key);
|
3625 | }
|
3626 | var result = func.apply(this, args);
|
3627 | memoized.cache = cache.set(key, result) || cache;
|
3628 | return result;
|
3629 | };
|
3630 | memoized.cache = new (memoize$1.Cache || MapCache);
|
3631 | return memoized;
|
3632 | }
|
3633 |
|
3634 |
|
3635 | memoize$1.Cache = MapCache;
|
3636 |
|
3637 | var memoize_1 = memoize$1;
|
3638 |
|
3639 | var memoize = memoize_1;
|
3640 |
|
3641 |
|
3642 | var MAX_MEMOIZE_SIZE = 500;
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 | function memoizeCapped$1(func) {
|
3653 | var result = memoize(func, function(key) {
|
3654 | if (cache.size === MAX_MEMOIZE_SIZE) {
|
3655 | cache.clear();
|
3656 | }
|
3657 | return key;
|
3658 | });
|
3659 |
|
3660 | var cache = result.cache;
|
3661 | return result;
|
3662 | }
|
3663 |
|
3664 | var _memoizeCapped = memoizeCapped$1;
|
3665 |
|
3666 | var memoizeCapped = _memoizeCapped;
|
3667 |
|
3668 |
|
3669 | var reLeadingDot = /^\./;
|
3670 | var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
3671 |
|
3672 |
|
3673 | var reEscapeChar = /\\(\\)?/g;
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 | var stringToPath$1 = memoizeCapped(function(string) {
|
3683 | var result = [];
|
3684 | if (reLeadingDot.test(string)) {
|
3685 | result.push('');
|
3686 | }
|
3687 | string.replace(rePropName, function(match, number, quote, string) {
|
3688 | result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
3689 | });
|
3690 | return result;
|
3691 | });
|
3692 |
|
3693 | var _stringToPath = stringToPath$1;
|
3694 |
|
3695 | var isArray$6 = isArray_1;
|
3696 | var isKey = _isKey;
|
3697 | var stringToPath = _stringToPath;
|
3698 | var toString$5 = toString_1;
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 | function castPath$1(value, object) {
|
3709 | if (isArray$6(value)) {
|
3710 | return value;
|
3711 | }
|
3712 | return isKey(value, object) ? [value] : stringToPath(toString$5(value));
|
3713 | }
|
3714 |
|
3715 | var _castPath = castPath$1;
|
3716 |
|
3717 | var isSymbol$3 = isSymbol_1;
|
3718 |
|
3719 |
|
3720 | var INFINITY$1 = 1 / 0;
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 |
|
3729 | function toKey$1(value) {
|
3730 | if (typeof value == 'string' || isSymbol$3(value)) {
|
3731 | return value;
|
3732 | }
|
3733 | var result = (value + '');
|
3734 | return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
3735 | }
|
3736 |
|
3737 | var _toKey = toKey$1;
|
3738 |
|
3739 | var castPath = _castPath;
|
3740 | var toKey = _toKey;
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 | function baseGet$1(object, path) {
|
3751 | path = castPath(path, object);
|
3752 |
|
3753 | var index = 0,
|
3754 | length = path.length;
|
3755 |
|
3756 | while (object != null && index < length) {
|
3757 | object = object[toKey(path[index++])];
|
3758 | }
|
3759 | return (index && index == length) ? object : undefined;
|
3760 | }
|
3761 |
|
3762 | var _baseGet = baseGet$1;
|
3763 |
|
3764 | var baseGet = _baseGet;
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 | function get(object, path, defaultValue) {
|
3792 | var result = object == null ? undefined : baseGet(object, path);
|
3793 | return result === undefined ? defaultValue : result;
|
3794 | }
|
3795 |
|
3796 | var get_1 = get;
|
3797 |
|
3798 | var getNative$3 = _getNative;
|
3799 | var root$4 = _root;
|
3800 |
|
3801 | /* Built-in method references that are verified to be native. */
|
3802 | var DataView$1 = getNative$3(root$4, 'DataView');
|
3803 |
|
3804 | var _DataView = DataView$1;
|
3805 |
|
3806 | var getNative$4 = _getNative;
|
3807 | var root$5 = _root;
|
3808 |
|
3809 | /* Built-in method references that are verified to be native. */
|
3810 | var Promise$2 = getNative$4(root$5, 'Promise');
|
3811 |
|
3812 | var _Promise = Promise$2;
|
3813 |
|
3814 | var getNative$5 = _getNative;
|
3815 | var root$6 = _root;
|
3816 |
|
3817 | /* Built-in method references that are verified to be native. */
|
3818 | var Set$1 = getNative$5(root$6, 'Set');
|
3819 |
|
3820 | var _Set = Set$1;
|
3821 |
|
3822 | var getNative$6 = _getNative;
|
3823 | var root$7 = _root;
|
3824 |
|
3825 | /* Built-in method references that are verified to be native. */
|
3826 | var WeakMap$1 = getNative$6(root$7, 'WeakMap');
|
3827 |
|
3828 | var _WeakMap = WeakMap$1;
|
3829 |
|
3830 | var DataView = _DataView;
|
3831 | var Map$2 = _Map;
|
3832 | var Promise$1 = _Promise;
|
3833 | var Set = _Set;
|
3834 | var WeakMap = _WeakMap;
|
3835 | var baseGetTag$5 = _baseGetTag;
|
3836 | var toSource$2 = _toSource;
|
3837 |
|
3838 | /** `Object#toString` result references. */
|
3839 | var mapTag$2 = '[object Map]';
|
3840 | var objectTag$1 = '[object Object]';
|
3841 | var promiseTag = '[object Promise]';
|
3842 | var setTag$2 = '[object Set]';
|
3843 | var weakMapTag$1 = '[object WeakMap]';
|
3844 |
|
3845 | var dataViewTag$1 = '[object DataView]';
|
3846 |
|
3847 | /** Used to detect maps, sets, and weakmaps. */
|
3848 | var dataViewCtorString = toSource$2(DataView);
|
3849 | var mapCtorString = toSource$2(Map$2);
|
3850 | var promiseCtorString = toSource$2(Promise$1);
|
3851 | var setCtorString = toSource$2(Set);
|
3852 | var weakMapCtorString = toSource$2(WeakMap);
|
3853 |
|
3854 | /**
|
3855 | * Gets the `toStringTag` of `value`.
|
3856 | *
|
3857 | * @private
|
3858 | * @param {*} value The value to query.
|
3859 | * @returns {string} Returns the `toStringTag`.
|
3860 | */
|
3861 | var getTag$1 = baseGetTag$5;
|
3862 |
|
3863 |
|
3864 | if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
|
3865 | (Map$2 && getTag$1(new Map$2) != mapTag$2) ||
|
3866 | (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
|
3867 | (Set && getTag$1(new Set) != setTag$2) ||
|
3868 | (WeakMap && getTag$1(new WeakMap) != weakMapTag$1)) {
|
3869 | getTag$1 = function(value) {
|
3870 | var result = baseGetTag$5(value),
|
3871 | Ctor = result == objectTag$1 ? value.constructor : undefined,
|
3872 | ctorString = Ctor ? toSource$2(Ctor) : '';
|
3873 |
|
3874 | if (ctorString) {
|
3875 | switch (ctorString) {
|
3876 | case dataViewCtorString: return dataViewTag$1;
|
3877 | case mapCtorString: return mapTag$2;
|
3878 | case promiseCtorString: return promiseTag;
|
3879 | case setCtorString: return setTag$2;
|
3880 | case weakMapCtorString: return weakMapTag$1;
|
3881 | }
|
3882 | }
|
3883 | return result;
|
3884 | };
|
3885 | }
|
3886 |
|
3887 | var _getTag = getTag$1;
|
3888 |
|
3889 | var baseKeys$2 = _baseKeys;
|
3890 | var getTag = _getTag;
|
3891 | var isArguments$3 = isArguments_1;
|
3892 | var isArray$8 = isArray_1;
|
3893 | var isArrayLike$2 = isArrayLike_1;
|
3894 | var isBuffer$1 = isBuffer_1;
|
3895 | var isPrototype$2 = _isPrototype;
|
3896 | var isTypedArray$2 = isTypedArray_1;
|
3897 |
|
3898 |
|
3899 | var mapTag$1 = '[object Map]';
|
3900 | var setTag$1 = '[object Set]';
|
3901 |
|
3902 |
|
3903 | var objectProto$9 = Object.prototype;
|
3904 |
|
3905 |
|
3906 | var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 | function isEmpty(value) {
|
3942 | if (value == null) {
|
3943 | return true;
|
3944 | }
|
3945 | if (isArrayLike$2(value) &&
|
3946 | (isArray$8(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
3947 | isBuffer$1(value) || isTypedArray$2(value) || isArguments$3(value))) {
|
3948 | return !value.length;
|
3949 | }
|
3950 | var tag = getTag(value);
|
3951 | if (tag == mapTag$1 || tag == setTag$1) {
|
3952 | return !value.size;
|
3953 | }
|
3954 | if (isPrototype$2(value)) {
|
3955 | return !baseKeys$2(value).length;
|
3956 | }
|
3957 | for (var key in value) {
|
3958 | if (hasOwnProperty$7.call(value, key)) {
|
3959 | return false;
|
3960 | }
|
3961 | }
|
3962 | return true;
|
3963 | }
|
3964 |
|
3965 | var isEmpty_1 = isEmpty;
|
3966 |
|
3967 | var createCompounder$2 = _createCompounder;
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 | var kebabCase = createCompounder$2(function(result, word, index) {
|
3991 | return result + (index ? '-' : '') + word.toLowerCase();
|
3992 | });
|
3993 |
|
3994 | var kebabCase_1 = kebabCase;
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 | function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
|
4008 | var length = array.length,
|
4009 | index = fromIndex + (fromRight ? 1 : -1);
|
4010 |
|
4011 | while ((fromRight ? index-- : ++index < length)) {
|
4012 | if (predicate(array[index], index, array)) {
|
4013 | return index;
|
4014 | }
|
4015 | }
|
4016 | return -1;
|
4017 | }
|
4018 |
|
4019 | var _baseFindIndex = baseFindIndex$1;
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 | function baseIsNaN$1(value) {
|
4029 | return value !== value;
|
4030 | }
|
4031 |
|
4032 | var _baseIsNaN = baseIsNaN$1;
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 | function strictIndexOf$1(array, value, fromIndex) {
|
4045 | var index = fromIndex - 1,
|
4046 | length = array.length;
|
4047 |
|
4048 | while (++index < length) {
|
4049 | if (array[index] === value) {
|
4050 | return index;
|
4051 | }
|
4052 | }
|
4053 | return -1;
|
4054 | }
|
4055 |
|
4056 | var _strictIndexOf = strictIndexOf$1;
|
4057 |
|
4058 | var baseFindIndex = _baseFindIndex;
|
4059 | var baseIsNaN = _baseIsNaN;
|
4060 | var strictIndexOf = _strictIndexOf;
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 | function baseIndexOf$1(array, value, fromIndex) {
|
4072 | return value === value
|
4073 | ? strictIndexOf(array, value, fromIndex)
|
4074 | : baseFindIndex(array, baseIsNaN, fromIndex);
|
4075 | }
|
4076 |
|
4077 | var _baseIndexOf = baseIndexOf$1;
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 | function baseIndexOfWith$1(array, value, fromIndex, comparator) {
|
4090 | var index = fromIndex - 1,
|
4091 | length = array.length;
|
4092 |
|
4093 | while (++index < length) {
|
4094 | if (comparator(array[index], value)) {
|
4095 | return index;
|
4096 | }
|
4097 | }
|
4098 | return -1;
|
4099 | }
|
4100 |
|
4101 | var _baseIndexOfWith = baseIndexOfWith$1;
|
4102 |
|
4103 | var arrayMap$2 = _arrayMap;
|
4104 | var baseIndexOf = _baseIndexOf;
|
4105 | var baseIndexOfWith = _baseIndexOfWith;
|
4106 | var baseUnary$2 = _baseUnary;
|
4107 | var copyArray$2 = _copyArray;
|
4108 |
|
4109 |
|
4110 | var arrayProto$1 = Array.prototype;
|
4111 |
|
4112 |
|
4113 | var splice$1 = arrayProto$1.splice;
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 | function basePullAll$1(array, values, iteratee, comparator) {
|
4127 | var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
|
4128 | index = -1,
|
4129 | length = values.length,
|
4130 | seen = array;
|
4131 |
|
4132 | if (array === values) {
|
4133 | values = copyArray$2(values);
|
4134 | }
|
4135 | if (iteratee) {
|
4136 | seen = arrayMap$2(array, baseUnary$2(iteratee));
|
4137 | }
|
4138 | while (++index < length) {
|
4139 | var fromIndex = 0,
|
4140 | value = values[index],
|
4141 | computed = iteratee ? iteratee(value) : value;
|
4142 |
|
4143 | while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
4144 | if (seen !== array) {
|
4145 | splice$1.call(seen, fromIndex, 1);
|
4146 | }
|
4147 | splice$1.call(array, fromIndex, 1);
|
4148 | }
|
4149 | }
|
4150 | return array;
|
4151 | }
|
4152 |
|
4153 | var _basePullAll = basePullAll$1;
|
4154 |
|
4155 | var basePullAll = _basePullAll;
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 | function pullAll(array, values) {
|
4178 | return (array && array.length && values && values.length)
|
4179 | ? basePullAll(array, values)
|
4180 | : array;
|
4181 | }
|
4182 |
|
4183 | var pullAll_1 = pullAll;
|
4184 |
|
4185 | var createCompounder$3 = _createCompounder;
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 | var snakeCase = createCompounder$3(function(result, word, index) {
|
4209 | return result + (index ? '_' : '') + word.toLowerCase();
|
4210 | });
|
4211 |
|
4212 | var snakeCase_1 = snakeCase;
|
4213 |
|
4214 |
|
4215 | var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 | function setCacheAdd$1(value) {
|
4228 | this.__data__.set(value, HASH_UNDEFINED$2);
|
4229 | return this;
|
4230 | }
|
4231 |
|
4232 | var _setCacheAdd = setCacheAdd$1;
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 | function setCacheHas$1(value) {
|
4244 | return this.__data__.has(value);
|
4245 | }
|
4246 |
|
4247 | var _setCacheHas = setCacheHas$1;
|
4248 |
|
4249 | var MapCache$2 = _MapCache;
|
4250 | var setCacheAdd = _setCacheAdd;
|
4251 | var setCacheHas = _setCacheHas;
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 | function SetCache$1(values) {
|
4262 | var index = -1,
|
4263 | length = values == null ? 0 : values.length;
|
4264 |
|
4265 | this.__data__ = new MapCache$2;
|
4266 | while (++index < length) {
|
4267 | this.add(values[index]);
|
4268 | }
|
4269 | }
|
4270 |
|
4271 |
|
4272 | SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
|
4273 | SetCache$1.prototype.has = setCacheHas;
|
4274 |
|
4275 | var _SetCache = SetCache$1;
|
4276 |
|
4277 | var baseIndexOf$2 = _baseIndexOf;
|
4278 |
|
4279 |
|
4280 |
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 | function arrayIncludes$1(array, value) {
|
4289 | var length = array == null ? 0 : array.length;
|
4290 | return !!length && baseIndexOf$2(array, value, 0) > -1;
|
4291 | }
|
4292 |
|
4293 | var _arrayIncludes = arrayIncludes$1;
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 | function arrayIncludesWith$1(array, value, comparator) {
|
4305 | var index = -1,
|
4306 | length = array == null ? 0 : array.length;
|
4307 |
|
4308 | while (++index < length) {
|
4309 | if (comparator(value, array[index])) {
|
4310 | return true;
|
4311 | }
|
4312 | }
|
4313 | return false;
|
4314 | }
|
4315 |
|
4316 | var _arrayIncludesWith = arrayIncludesWith$1;
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 | function cacheHas$1(cache, key) {
|
4327 | return cache.has(key);
|
4328 | }
|
4329 |
|
4330 | var _cacheHas = cacheHas$1;
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 | function noop$1() {
|
4345 |
|
4346 | }
|
4347 |
|
4348 | var noop_1 = noop$1;
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | function setToArray$2(set) {
|
4358 | var index = -1,
|
4359 | result = Array(set.size);
|
4360 |
|
4361 | set.forEach(function(value) {
|
4362 | result[++index] = value;
|
4363 | });
|
4364 | return result;
|
4365 | }
|
4366 |
|
4367 | var _setToArray = setToArray$2;
|
4368 |
|
4369 | var Set$2 = _Set;
|
4370 | var noop = noop_1;
|
4371 | var setToArray$1 = _setToArray;
|
4372 |
|
4373 |
|
4374 | var INFINITY$2 = 1 / 0;
|
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 | var createSet$1 = !(Set$2 && (1 / setToArray$1(new Set$2([,-0]))[1]) == INFINITY$2) ? noop : function(values) {
|
4384 | return new Set$2(values);
|
4385 | };
|
4386 |
|
4387 | var _createSet = createSet$1;
|
4388 |
|
4389 | var SetCache = _SetCache;
|
4390 | var arrayIncludes = _arrayIncludes;
|
4391 | var arrayIncludesWith = _arrayIncludesWith;
|
4392 | var cacheHas = _cacheHas;
|
4393 | var createSet = _createSet;
|
4394 | var setToArray = _setToArray;
|
4395 |
|
4396 |
|
4397 | var LARGE_ARRAY_SIZE = 200;
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 | function baseUniq$1(array, iteratee, comparator) {
|
4409 | var index = -1,
|
4410 | includes = arrayIncludes,
|
4411 | length = array.length,
|
4412 | isCommon = true,
|
4413 | result = [],
|
4414 | seen = result;
|
4415 |
|
4416 | if (comparator) {
|
4417 | isCommon = false;
|
4418 | includes = arrayIncludesWith;
|
4419 | }
|
4420 | else if (length >= LARGE_ARRAY_SIZE) {
|
4421 | var set = iteratee ? null : createSet(array);
|
4422 | if (set) {
|
4423 | return setToArray(set);
|
4424 | }
|
4425 | isCommon = false;
|
4426 | includes = cacheHas;
|
4427 | seen = new SetCache;
|
4428 | }
|
4429 | else {
|
4430 | seen = iteratee ? [] : result;
|
4431 | }
|
4432 | outer:
|
4433 | while (++index < length) {
|
4434 | var value = array[index],
|
4435 | computed = iteratee ? iteratee(value) : value;
|
4436 |
|
4437 | value = (comparator || value !== 0) ? value : 0;
|
4438 | if (isCommon && computed === computed) {
|
4439 | var seenIndex = seen.length;
|
4440 | while (seenIndex--) {
|
4441 | if (seen[seenIndex] === computed) {
|
4442 | continue outer;
|
4443 | }
|
4444 | }
|
4445 | if (iteratee) {
|
4446 | seen.push(computed);
|
4447 | }
|
4448 | result.push(value);
|
4449 | }
|
4450 | else if (!includes(seen, computed, comparator)) {
|
4451 | if (seen !== result) {
|
4452 | seen.push(computed);
|
4453 | }
|
4454 | result.push(value);
|
4455 | }
|
4456 | }
|
4457 | return result;
|
4458 | }
|
4459 |
|
4460 | var _baseUniq = baseUniq$1;
|
4461 |
|
4462 | var baseUniq = _baseUniq;
|
4463 |
|
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 | function uniq(array) {
|
4483 | return (array && array.length) ? baseUniq(array) : [];
|
4484 | }
|
4485 |
|
4486 | var uniq_1 = uniq;
|
4487 |
|
4488 | var DEFAULT_FROM_INDEX = 0;
|
4489 | var DEFAULT_TO_INDEX = 19;
|
4490 | var MY_PATH_KEYWORD = 'self';
|
4491 |
|
4492 | function buildPaging(options) {
|
4493 | return {
|
4494 | from: get_1(options, 'paging.from') || DEFAULT_FROM_INDEX,
|
4495 | to: get_1(options, 'paging.to') || DEFAULT_TO_INDEX
|
4496 | };
|
4497 | }
|
4498 |
|
4499 | function buildProperties(defaults, options) {
|
4500 | var properties = concat_1([], options.properties || defaults);
|
4501 |
|
4502 | var toAnd = options.andProperties;
|
4503 | if (isArray_1(toAnd) && !isEmpty_1(toAnd)) {
|
4504 | properties = concat_1(properties, toAnd);
|
4505 | }
|
4506 |
|
4507 | var toNot = options.notProperties;
|
4508 | if (isArray_1(toNot) && !isEmpty_1(toNot)) {
|
4509 | properties = pullAll_1(properties, toNot);
|
4510 | }
|
4511 |
|
4512 | properties = uniq_1(properties);
|
4513 |
|
4514 | return properties;
|
4515 | }
|
4516 |
|
4517 | function entityNameToFilename(name) {
|
4518 | return kebabCase_1(name) + '.js';
|
4519 | }
|
4520 |
|
4521 | function entityToAPIEnvelopeKey(entity) {
|
4522 | return snakeCase_1(entity.name);
|
4523 | }
|
4524 |
|
4525 | function entityToFalcorListLeaf(entity) {
|
4526 | return snakeCase_1(entity.name) + '_list';
|
4527 | }
|
4528 |
|
4529 | function entityToFalcorMembershipsListLeaf(entity) {
|
4530 | return 'membership_' + entityToFalcorListLeaf(entity);
|
4531 | }
|
4532 |
|
4533 | function entityToFalcorMyListLeaf(entity) {
|
4534 | return 'my_' + entityToFalcorListLeaf(entity);
|
4535 | }
|
4536 |
|
4537 | function entityToFalcorRootLeaf(entity) {
|
4538 | return snakeCase_1(entity.pluralName);
|
4539 | }
|
4540 |
|
4541 | function falcorListLeafToEntityName(listLeaf) {
|
4542 | return camelCase_1(listLeaf.replace(/_list$/, ''));
|
4543 | }
|
4544 |
|
4545 | function falcorRootLeafToEntityName(rootLeaf) {
|
4546 | return camelCase_1(rootLeaf);
|
4547 | }
|
4548 |
|
4549 | function optionsHasQuery(options) {
|
4550 | return keys_1(options.query).length > 0;
|
4551 | }
|
4552 |
|
4553 | var name$4 = 'comment';
|
4554 | var pluralName$4 = 'comments';
|
4555 |
|
4556 | var defaultProperties$4 = ['id', 'body', 'markup_tokens', 'post', 'owner.id', 'owner.first_name', 'owner.last_name', 'owner.name', 'owner.avatar.src', 'created_at'];
|
4557 |
|
4558 | function invalidateAfterCreate() {
|
4559 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4560 |
|
4561 | var parentEntityName = head_1(keys_1(options.parent));
|
4562 | var parentEntity = entities[parentEntityName];
|
4563 | var parentId = options.parent[parentEntityName].id;
|
4564 |
|
4565 | var rootLeaf = entityToFalcorRootLeaf(parentEntity);
|
4566 |
|
4567 | var paths = [[rootLeaf, parentId, 'comment_list'], [rootLeaf, parentId, 'comment_count']];
|
4568 |
|
4569 | return paths;
|
4570 | }
|
4571 |
|
4572 |
|
4573 |
|
4574 | function invalidateAfterDestroy() {
|
4575 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
4576 |
|
4577 | var rootEntityLeaf = entityToFalcorRootLeaf({ pluralName: pluralName$4 });
|
4578 | var entityId = options.id;
|
4579 |
|
4580 | var parentEntityName = head_1(keys_1(options.parent));
|
4581 | var parentEntity = entities[parentEntityName];
|
4582 | var rootParentLeaf = entityToFalcorRootLeaf(parentEntity);
|
4583 | var parentId = options.parent[parentEntityName].id;
|
4584 |
|
4585 | var paths = [[rootEntityLeaf, entityId], [rootParentLeaf, parentId, 'comment_list'], [rootParentLeaf, parentId, 'comment_count']];
|
4586 |
|
4587 | return paths;
|
4588 | }
|
4589 |
|
4590 | var comment = Object.freeze({
|
4591 | name: name$4,
|
4592 | pluralName: pluralName$4,
|
4593 | defaultProperties: defaultProperties$4,
|
4594 | invalidateAfterCreate: invalidateAfterCreate,
|
4595 | invalidateAfterDestroy: invalidateAfterDestroy
|
4596 | });
|
4597 |
|
4598 | var name$5 = 'directMessage';
|
4599 | var pluralName$5 = 'directMessages';
|
4600 |
|
4601 | var defaultProperties$5 = ['id', 'name'];
|
4602 |
|
4603 | var directMessage = Object.freeze({
|
4604 | name: name$5,
|
4605 | pluralName: pluralName$5,
|
4606 | defaultProperties: defaultProperties$5
|
4607 | });
|
4608 |
|
4609 | var name$6 = 'featuredContent';
|
4610 | var pluralName$6 = 'featuredContents';
|
4611 |
|
4612 | var defaultProperties$6 = ['id', 'content_id', 'content_type', 'new', 'position'];
|
4613 |
|
4614 | var featuredContent = Object.freeze({
|
4615 | name: name$6,
|
4616 | pluralName: pluralName$6,
|
4617 | defaultProperties: defaultProperties$6
|
4618 | });
|
4619 |
|
4620 | var TokenTypes = {
|
4621 | token: 'token',
|
4622 | dotSeparator: '.',
|
4623 | commaSeparator: ',',
|
4624 | openingBracket: '[',
|
4625 | closingBracket: ']',
|
4626 | openingBrace: '{',
|
4627 | closingBrace: '}',
|
4628 | escape: '\\',
|
4629 | space: ' ',
|
4630 | colon: ':',
|
4631 | quote: 'quote',
|
4632 | unknown: 'unknown'
|
4633 | };
|
4634 |
|
4635 | var TokenTypes_1 = TokenTypes;
|
4636 |
|
4637 | var index$1 = createCommonjsModule(function (module) {
|
4638 | var TokenTypes = TokenTypes_1;
|
4639 | var DOT_SEPARATOR = '.';
|
4640 | var COMMA_SEPARATOR = ',';
|
4641 | var OPENING_BRACKET = '[';
|
4642 | var CLOSING_BRACKET = ']';
|
4643 | var OPENING_BRACE = '{';
|
4644 | var CLOSING_BRACE = '}';
|
4645 | var COLON = ':';
|
4646 | var ESCAPE = '\\';
|
4647 | var DOUBLE_OUOTES = '"';
|
4648 | var SINGE_OUOTES = "'";
|
4649 | var SPACE = " ";
|
4650 | var SPECIAL_CHARACTERS = '\\\'"[]., ';
|
4651 | var EXT_SPECIAL_CHARACTERS = '\\{}\'"[]., :';
|
4652 |
|
4653 | var Tokenizer = module.exports = function(string, ext) {
|
4654 | this._string = string;
|
4655 | this._idx = -1;
|
4656 | this._extended = ext;
|
4657 | this.parseString = '';
|
4658 | };
|
4659 |
|
4660 | Tokenizer.prototype = {
|
4661 | |
4662 |
|
4663 |
|
4664 |
|
4665 | next: function() {
|
4666 | var nextToken = this._nextToken ?
|
4667 | this._nextToken : getNext(this._string, this._idx, this._extended);
|
4668 |
|
4669 | this._idx = nextToken.idx;
|
4670 | this._nextToken = false;
|
4671 | this.parseString += nextToken.token.token;
|
4672 |
|
4673 | return nextToken.token;
|
4674 | },
|
4675 |
|
4676 | |
4677 |
|
4678 |
|
4679 | peek: function() {
|
4680 | var nextToken = this._nextToken ?
|
4681 | this._nextToken : getNext(this._string, this._idx, this._extended);
|
4682 | this._nextToken = nextToken;
|
4683 |
|
4684 | return nextToken.token;
|
4685 | }
|
4686 | };
|
4687 |
|
4688 | Tokenizer.toNumber = function toNumber(x) {
|
4689 | if (!isNaN(+x)) {
|
4690 | return +x;
|
4691 | }
|
4692 | return NaN;
|
4693 | };
|
4694 |
|
4695 | function toOutput(token, type, done) {
|
4696 | return {
|
4697 | token: token,
|
4698 | done: done,
|
4699 | type: type
|
4700 | };
|
4701 | }
|
4702 |
|
4703 | function getNext(string, idx, ext) {
|
4704 | var output = false;
|
4705 | var token = '';
|
4706 | var specialChars = ext ?
|
4707 | EXT_SPECIAL_CHARACTERS : SPECIAL_CHARACTERS;
|
4708 | var done;
|
4709 |
|
4710 | do {
|
4711 |
|
4712 | done = idx + 1 >= string.length;
|
4713 | if (done) {
|
4714 | break;
|
4715 | }
|
4716 |
|
4717 |
|
4718 | var character = string[idx + 1];
|
4719 |
|
4720 | if (character !== undefined &&
|
4721 | specialChars.indexOf(character) === -1) {
|
4722 |
|
4723 | token += character;
|
4724 | ++idx;
|
4725 | continue;
|
4726 | }
|
4727 |
|
4728 |
|
4729 | else if (token.length) {
|
4730 | break;
|
4731 | }
|
4732 |
|
4733 | ++idx;
|
4734 | var type;
|
4735 | switch (character) {
|
4736 | case DOT_SEPARATOR:
|
4737 | type = TokenTypes.dotSeparator;
|
4738 | break;
|
4739 | case COMMA_SEPARATOR:
|
4740 | type = TokenTypes.commaSeparator;
|
4741 | break;
|
4742 | case OPENING_BRACKET:
|
4743 | type = TokenTypes.openingBracket;
|
4744 | break;
|
4745 | case CLOSING_BRACKET:
|
4746 | type = TokenTypes.closingBracket;
|
4747 | break;
|
4748 | case OPENING_BRACE:
|
4749 | type = TokenTypes.openingBrace;
|
4750 | break;
|
4751 | case CLOSING_BRACE:
|
4752 | type = TokenTypes.closingBrace;
|
4753 | break;
|
4754 | case SPACE:
|
4755 | type = TokenTypes.space;
|
4756 | break;
|
4757 | case DOUBLE_OUOTES:
|
4758 | case SINGE_OUOTES:
|
4759 | type = TokenTypes.quote;
|
4760 | break;
|
4761 | case ESCAPE:
|
4762 | type = TokenTypes.escape;
|
4763 | break;
|
4764 | case COLON:
|
4765 | type = TokenTypes.colon;
|
4766 | break;
|
4767 | default:
|
4768 | type = TokenTypes.unknown;
|
4769 | break;
|
4770 | }
|
4771 | output = toOutput(character, type, false);
|
4772 | break;
|
4773 | } while (!done);
|
4774 |
|
4775 | if (!output && token.length) {
|
4776 | output = toOutput(token, TokenTypes.token, false);
|
4777 | }
|
4778 |
|
4779 | if (!output) {
|
4780 | output = {done: true};
|
4781 | }
|
4782 |
|
4783 | return {
|
4784 | token: output,
|
4785 | idx: idx
|
4786 | };
|
4787 | }
|
4788 | });
|
4789 |
|
4790 | var index$3 = {
|
4791 | indexer: {
|
4792 | nested: 'Indexers cannot be nested.',
|
4793 | needQuotes: 'unquoted indexers must be numeric.',
|
4794 | empty: 'cannot have empty indexers.',
|
4795 | leadingDot: 'Indexers cannot have leading dots.',
|
4796 | leadingComma: 'Indexers cannot have leading comma.',
|
4797 | requiresComma: 'Indexers require commas between indexer args.',
|
4798 | routedTokens: 'Only one token can be used per indexer when specifying routed tokens.'
|
4799 | },
|
4800 | range: {
|
4801 | precedingNaN: 'ranges must be preceded by numbers.',
|
4802 | suceedingNaN: 'ranges must be suceeded by numbers.'
|
4803 | },
|
4804 | routed: {
|
4805 | invalid: 'Invalid routed token. only integers|ranges|keys are supported.'
|
4806 | },
|
4807 | quote: {
|
4808 | empty: 'cannot have empty quoted keys.',
|
4809 | illegalEscape: 'Invalid escape character. Only quotes are escapable.'
|
4810 | },
|
4811 | unexpectedToken: 'Unexpected token.',
|
4812 | invalidIdentifier: 'Invalid Identifier.',
|
4813 | invalidPath: 'Please provide a valid path.',
|
4814 | throwError: function(err, tokenizer, token) {
|
4815 | if (token) {
|
4816 | throw err + ' -- ' + tokenizer.parseString + ' with next token: ' + token;
|
4817 | }
|
4818 | throw err + ' -- ' + tokenizer.parseString;
|
4819 | }
|
4820 | };
|
4821 |
|
4822 | var Tokenizer$1 = index$1;
|
4823 | var TokenTypes$3 = TokenTypes_1;
|
4824 | var E$2 = index$3;
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 | var range$1 = function range(tokenizer, openingToken, state, out) {
|
4831 | var token = tokenizer.peek();
|
4832 | var dotCount = 1;
|
4833 | var done = false;
|
4834 | var inclusive = true;
|
4835 |
|
4836 |
|
4837 | var idx = state.indexer.length - 1;
|
4838 | var from = Tokenizer$1.toNumber(state.indexer[idx]);
|
4839 | var to;
|
4840 |
|
4841 | if (isNaN(from)) {
|
4842 | E$2.throwError(E$2.range.precedingNaN, tokenizer);
|
4843 | }
|
4844 |
|
4845 |
|
4846 |
|
4847 | while (!done && !token.done) {
|
4848 |
|
4849 | switch (token.type) {
|
4850 |
|
4851 |
|
4852 | case TokenTypes$3.dotSeparator:
|
4853 | if (dotCount === 3) {
|
4854 | E$2.throwError(E$2.unexpectedToken, tokenizer);
|
4855 | }
|
4856 | ++dotCount;
|
4857 |
|
4858 | if (dotCount === 3) {
|
4859 | inclusive = false;
|
4860 | }
|
4861 | break;
|
4862 |
|
4863 | case TokenTypes$3.token:
|
4864 |
|
4865 | to = Tokenizer$1.toNumber(tokenizer.next().token);
|
4866 |
|
4867 |
|
4868 | if (isNaN(to)) {
|
4869 | E$2.throwError(E$2.range.suceedingNaN, tokenizer);
|
4870 | }
|
4871 |
|
4872 | done = true;
|
4873 | break;
|
4874 |
|
4875 | default:
|
4876 | done = true;
|
4877 | break;
|
4878 | }
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 | if (!done) {
|
4884 | tokenizer.next();
|
4885 |
|
4886 |
|
4887 | token = tokenizer.peek();
|
4888 | }
|
4889 |
|
4890 |
|
4891 | else {
|
4892 | break;
|
4893 | }
|
4894 | }
|
4895 |
|
4896 | state.indexer[idx] = {from: from, to: inclusive ? to : to - 1};
|
4897 | };
|
4898 |
|
4899 | var TokenTypes$4 = TokenTypes_1;
|
4900 | var E$3 = index$3;
|
4901 | var quoteE = E$3.quote;
|
4902 |
|
4903 |
|
4904 |
|
4905 |
|
4906 |
|
4907 |
|
4908 |
|
4909 |
|
4910 | var quote$1 = function quote(tokenizer, openingToken, state, out) {
|
4911 | var token = tokenizer.next();
|
4912 | var innerToken = '';
|
4913 | var openingQuote = openingToken.token;
|
4914 | var escaping = false;
|
4915 | var done = false;
|
4916 |
|
4917 | while (!token.done) {
|
4918 |
|
4919 | switch (token.type) {
|
4920 | case TokenTypes$4.token:
|
4921 | case TokenTypes$4.space:
|
4922 |
|
4923 | case TokenTypes$4.dotSeparator:
|
4924 | case TokenTypes$4.commaSeparator:
|
4925 |
|
4926 | case TokenTypes$4.openingBracket:
|
4927 | case TokenTypes$4.closingBracket:
|
4928 | case TokenTypes$4.openingBrace:
|
4929 | case TokenTypes$4.closingBrace:
|
4930 | if (escaping) {
|
4931 | E$3.throwError(quoteE.illegalEscape, tokenizer);
|
4932 | }
|
4933 |
|
4934 | innerToken += token.token;
|
4935 | break;
|
4936 |
|
4937 |
|
4938 | case TokenTypes$4.quote:
|
4939 |
|
4940 | if (escaping) {
|
4941 | innerToken += token.token;
|
4942 | escaping = false;
|
4943 | }
|
4944 |
|
4945 |
|
4946 | else if (token.token !== openingQuote) {
|
4947 | innerToken += token.token;
|
4948 | }
|
4949 |
|
4950 |
|
4951 |
|
4952 | else {
|
4953 | done = true;
|
4954 | }
|
4955 |
|
4956 | break;
|
4957 | case TokenTypes$4.escape:
|
4958 | escaping = true;
|
4959 | break;
|
4960 |
|
4961 | default:
|
4962 | E$3.throwError(E$3.unexpectedToken, tokenizer);
|
4963 | }
|
4964 |
|
4965 |
|
4966 | if (done) {
|
4967 | break;
|
4968 | }
|
4969 |
|
4970 |
|
4971 | token = tokenizer.next();
|
4972 | }
|
4973 |
|
4974 | if (innerToken.length === 0) {
|
4975 | E$3.throwError(quoteE.empty, tokenizer);
|
4976 | }
|
4977 |
|
4978 | state.indexer[state.indexer.length] = innerToken;
|
4979 | };
|
4980 |
|
4981 | var RoutedTokens$2 = {
|
4982 | integers: 'integers',
|
4983 | ranges: 'ranges',
|
4984 | keys: 'keys'
|
4985 | };
|
4986 |
|
4987 | var TokenTypes$5 = TokenTypes_1;
|
4988 | var RoutedTokens$1 = RoutedTokens$2;
|
4989 | var E$4 = index$3;
|
4990 | var routedE = E$4.routed;
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 | var routed$1 = function routed(tokenizer, openingToken, state, out) {
|
4999 | var routeToken = tokenizer.next();
|
5000 | var named = false;
|
5001 | var name = '';
|
5002 |
|
5003 |
|
5004 | switch (routeToken.token) {
|
5005 | case RoutedTokens$1.integers:
|
5006 | case RoutedTokens$1.ranges:
|
5007 | case RoutedTokens$1.keys:
|
5008 |
|
5009 | break;
|
5010 | default:
|
5011 | E$4.throwError(routedE.invalid, tokenizer);
|
5012 | break;
|
5013 | }
|
5014 |
|
5015 |
|
5016 | var next = tokenizer.next();
|
5017 |
|
5018 |
|
5019 | if (next.type === TokenTypes$5.colon) {
|
5020 | named = true;
|
5021 |
|
5022 |
|
5023 | next = tokenizer.next();
|
5024 | if (next.type !== TokenTypes$5.token) {
|
5025 | E$4.throwError(routedE.invalid, tokenizer);
|
5026 | }
|
5027 | name = next.token;
|
5028 |
|
5029 |
|
5030 | next = tokenizer.next();
|
5031 | }
|
5032 |
|
5033 |
|
5034 |
|
5035 | if (next.type === TokenTypes$5.closingBrace) {
|
5036 | var outputToken = {
|
5037 | type: routeToken.token,
|
5038 | named: named,
|
5039 | name: name
|
5040 | };
|
5041 | state.indexer[state.indexer.length] = outputToken;
|
5042 | }
|
5043 |
|
5044 |
|
5045 | else {
|
5046 | E$4.throwError(routedE.invalid, tokenizer);
|
5047 | }
|
5048 |
|
5049 | };
|
5050 |
|
5051 | var TokenTypes$2 = TokenTypes_1;
|
5052 | var E$1 = index$3;
|
5053 | var idxE = E$1.indexer;
|
5054 | var range = range$1;
|
5055 | var quote = quote$1;
|
5056 | var routed = routed$1;
|
5057 |
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 | var indexer$1 = function indexer(tokenizer, openingToken, state, out) {
|
5063 | var token = tokenizer.next();
|
5064 | var done = false;
|
5065 | var allowedMaxLength = 1;
|
5066 | var routedIndexer = false;
|
5067 |
|
5068 |
|
5069 | state.indexer = [];
|
5070 |
|
5071 | while (!token.done) {
|
5072 |
|
5073 | switch (token.type) {
|
5074 | case TokenTypes$2.token:
|
5075 | case TokenTypes$2.quote:
|
5076 |
|
5077 |
|
5078 | if (state.indexer.length === allowedMaxLength) {
|
5079 | E$1.throwError(idxE.requiresComma, tokenizer);
|
5080 | }
|
5081 | break;
|
5082 | }
|
5083 |
|
5084 | switch (token.type) {
|
5085 |
|
5086 | case TokenTypes$2.openingBrace:
|
5087 | routedIndexer = true;
|
5088 | routed(tokenizer, token, state, out);
|
5089 | break;
|
5090 |
|
5091 |
|
5092 | case TokenTypes$2.token:
|
5093 | var t = +token.token;
|
5094 | if (isNaN(t)) {
|
5095 | E$1.throwError(idxE.needQuotes, tokenizer);
|
5096 | }
|
5097 | state.indexer[state.indexer.length] = t;
|
5098 | break;
|
5099 |
|
5100 |
|
5101 | case TokenTypes$2.dotSeparator:
|
5102 | if (!state.indexer.length) {
|
5103 | E$1.throwError(idxE.leadingDot, tokenizer);
|
5104 | }
|
5105 | range(tokenizer, token, state, out);
|
5106 | break;
|
5107 |
|
5108 |
|
5109 | case TokenTypes$2.space:
|
5110 | break;
|
5111 |
|
5112 | case TokenTypes$2.closingBracket:
|
5113 | done = true;
|
5114 | break;
|
5115 |
|
5116 |
|
5117 |
|
5118 | case TokenTypes$2.quote:
|
5119 | quote(tokenizer, token, state, out);
|
5120 | break;
|
5121 |
|
5122 |
|
5123 |
|
5124 | case TokenTypes$2.openingBracket:
|
5125 | E$1.throwError(idxE.nested, tokenizer);
|
5126 | break;
|
5127 |
|
5128 | case TokenTypes$2.commaSeparator:
|
5129 | ++allowedMaxLength;
|
5130 | break;
|
5131 |
|
5132 | default:
|
5133 | E$1.throwError(E$1.unexpectedToken, tokenizer);
|
5134 | break;
|
5135 | }
|
5136 |
|
5137 |
|
5138 | if (done) {
|
5139 | break;
|
5140 | }
|
5141 |
|
5142 |
|
5143 | token = tokenizer.next();
|
5144 | }
|
5145 |
|
5146 | if (state.indexer.length === 0) {
|
5147 | E$1.throwError(idxE.empty, tokenizer);
|
5148 | }
|
5149 |
|
5150 | if (state.indexer.length > 1 && routedIndexer) {
|
5151 | E$1.throwError(idxE.routedTokens, tokenizer);
|
5152 | }
|
5153 |
|
5154 |
|
5155 | if (state.indexer.length === 1) {
|
5156 | state.indexer = state.indexer[0];
|
5157 | }
|
5158 |
|
5159 | out[out.length] = state.indexer;
|
5160 |
|
5161 |
|
5162 | state.indexer = undefined;
|
5163 | };
|
5164 |
|
5165 | var TokenTypes$1 = TokenTypes_1;
|
5166 | var E = index$3;
|
5167 | var indexer = indexer$1;
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 | var head$3 = function head(tokenizer) {
|
5174 | var token = tokenizer.next();
|
5175 | var state = {};
|
5176 | var out = [];
|
5177 |
|
5178 | while (!token.done) {
|
5179 |
|
5180 | switch (token.type) {
|
5181 | case TokenTypes$1.token:
|
5182 | var first = +token.token[0];
|
5183 | if (!isNaN(first)) {
|
5184 | E.throwError(E.invalidIdentifier, tokenizer);
|
5185 | }
|
5186 | out[out.length] = token.token;
|
5187 | break;
|
5188 |
|
5189 |
|
5190 | case TokenTypes$1.dotSeparator:
|
5191 | if (out.length === 0) {
|
5192 | E.throwError(E.unexpectedToken, tokenizer);
|
5193 | }
|
5194 | break;
|
5195 |
|
5196 |
|
5197 | case TokenTypes$1.space:
|
5198 |
|
5199 |
|
5200 | break;
|
5201 |
|
5202 |
|
5203 |
|
5204 | case TokenTypes$1.openingBracket:
|
5205 | indexer(tokenizer, token, state, out);
|
5206 | break;
|
5207 |
|
5208 | default:
|
5209 | E.throwError(E.unexpectedToken, tokenizer);
|
5210 | break;
|
5211 | }
|
5212 |
|
5213 |
|
5214 | token = tokenizer.next();
|
5215 | }
|
5216 |
|
5217 | if (out.length === 0) {
|
5218 | E.throwError(E.invalidPath, tokenizer);
|
5219 | }
|
5220 |
|
5221 | return out;
|
5222 | };
|
5223 |
|
5224 | var Tokenizer = index$1;
|
5225 | var head$2 = head$3;
|
5226 | var RoutedTokens = RoutedTokens$2;
|
5227 |
|
5228 | var parser = function parser(string, extendedRules) {
|
5229 | return head$2(new Tokenizer(string, extendedRules));
|
5230 | };
|
5231 |
|
5232 | var index = parser;
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 | parser.fromPathsOrPathValues = function(paths, ext) {
|
5238 | if (!paths) {
|
5239 | return [];
|
5240 | }
|
5241 |
|
5242 | var out = [];
|
5243 | for (var i = 0, len = paths.length; i < len; i++) {
|
5244 |
|
5245 |
|
5246 | if (typeof paths[i] === 'string') {
|
5247 | out[i] = parser(paths[i], ext);
|
5248 | }
|
5249 |
|
5250 |
|
5251 | else if (typeof paths[i].path === 'string') {
|
5252 | out[i] = {
|
5253 | path: parser(paths[i].path, ext), value: paths[i].value
|
5254 | };
|
5255 | }
|
5256 |
|
5257 |
|
5258 | else {
|
5259 | out[i] = paths[i];
|
5260 | }
|
5261 | }
|
5262 |
|
5263 | return out;
|
5264 | };
|
5265 |
|
5266 |
|
5267 |
|
5268 | parser.fromPath = function(path, ext) {
|
5269 | if (!path) {
|
5270 | return [];
|
5271 | }
|
5272 |
|
5273 | if (typeof path === 'string') {
|
5274 | return parser(path, ext);
|
5275 | }
|
5276 |
|
5277 | return path;
|
5278 | };
|
5279 |
|
5280 |
|
5281 | parser.RoutedTokens = RoutedTokens;
|
5282 |
|
5283 | var ListCache$3 = _ListCache;
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 |
|
5290 |
|
5291 |
|
5292 | function stackClear$1() {
|
5293 | this.__data__ = new ListCache$3;
|
5294 | this.size = 0;
|
5295 | }
|
5296 |
|
5297 | var _stackClear = stackClear$1;
|
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 |
|
5307 |
|
5308 | function stackDelete$1(key) {
|
5309 | var data = this.__data__,
|
5310 | result = data['delete'](key);
|
5311 |
|
5312 | this.size = data.size;
|
5313 | return result;
|
5314 | }
|
5315 |
|
5316 | var _stackDelete = stackDelete$1;
|
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 | function stackGet$1(key) {
|
5328 | return this.__data__.get(key);
|
5329 | }
|
5330 |
|
5331 | var _stackGet = stackGet$1;
|
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 |
|
5338 |
|
5339 |
|
5340 |
|
5341 |
|
5342 | function stackHas$1(key) {
|
5343 | return this.__data__.has(key);
|
5344 | }
|
5345 |
|
5346 | var _stackHas = stackHas$1;
|
5347 |
|
5348 | var ListCache$4 = _ListCache;
|
5349 | var Map$3 = _Map;
|
5350 | var MapCache$3 = _MapCache;
|
5351 |
|
5352 |
|
5353 | var LARGE_ARRAY_SIZE$1 = 200;
|
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 | function stackSet$1(key, value) {
|
5366 | var data = this.__data__;
|
5367 | if (data instanceof ListCache$4) {
|
5368 | var pairs = data.__data__;
|
5369 | if (!Map$3 || (pairs.length < LARGE_ARRAY_SIZE$1 - 1)) {
|
5370 | pairs.push([key, value]);
|
5371 | this.size = ++data.size;
|
5372 | return this;
|
5373 | }
|
5374 | data = this.__data__ = new MapCache$3(pairs);
|
5375 | }
|
5376 | data.set(key, value);
|
5377 | this.size = data.size;
|
5378 | return this;
|
5379 | }
|
5380 |
|
5381 | var _stackSet = stackSet$1;
|
5382 |
|
5383 | var ListCache$2 = _ListCache;
|
5384 | var stackClear = _stackClear;
|
5385 | var stackDelete = _stackDelete;
|
5386 | var stackGet = _stackGet;
|
5387 | var stackHas = _stackHas;
|
5388 | var stackSet = _stackSet;
|
5389 |
|
5390 |
|
5391 |
|
5392 |
|
5393 |
|
5394 |
|
5395 |
|
5396 |
|
5397 | function Stack$1(entries) {
|
5398 | var data = this.__data__ = new ListCache$2(entries);
|
5399 | this.size = data.size;
|
5400 | }
|
5401 |
|
5402 |
|
5403 | Stack$1.prototype.clear = stackClear;
|
5404 | Stack$1.prototype['delete'] = stackDelete;
|
5405 | Stack$1.prototype.get = stackGet;
|
5406 | Stack$1.prototype.has = stackHas;
|
5407 | Stack$1.prototype.set = stackSet;
|
5408 |
|
5409 | var _Stack = Stack$1;
|
5410 |
|
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 |
|
5416 |
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 | function arraySome$1(array, predicate) {
|
5422 | var index = -1,
|
5423 | length = array == null ? 0 : array.length;
|
5424 |
|
5425 | while (++index < length) {
|
5426 | if (predicate(array[index], index, array)) {
|
5427 | return true;
|
5428 | }
|
5429 | }
|
5430 | return false;
|
5431 | }
|
5432 |
|
5433 | var _arraySome = arraySome$1;
|
5434 |
|
5435 | var SetCache$2 = _SetCache;
|
5436 | var arraySome = _arraySome;
|
5437 | var cacheHas$2 = _cacheHas;
|
5438 |
|
5439 |
|
5440 | var COMPARE_PARTIAL_FLAG$2 = 1;
|
5441 | var COMPARE_UNORDERED_FLAG$1 = 2;
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 | function equalArrays$1(array, other, bitmask, customizer, equalFunc, stack) {
|
5457 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
|
5458 | arrLength = array.length,
|
5459 | othLength = other.length;
|
5460 |
|
5461 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
5462 | return false;
|
5463 | }
|
5464 |
|
5465 | var stacked = stack.get(array);
|
5466 | if (stacked && stack.get(other)) {
|
5467 | return stacked == other;
|
5468 | }
|
5469 | var index = -1,
|
5470 | result = true,
|
5471 | seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache$2 : undefined;
|
5472 |
|
5473 | stack.set(array, other);
|
5474 | stack.set(other, array);
|
5475 |
|
5476 |
|
5477 | while (++index < arrLength) {
|
5478 | var arrValue = array[index],
|
5479 | othValue = other[index];
|
5480 |
|
5481 | if (customizer) {
|
5482 | var compared = isPartial
|
5483 | ? customizer(othValue, arrValue, index, other, array, stack)
|
5484 | : customizer(arrValue, othValue, index, array, other, stack);
|
5485 | }
|
5486 | if (compared !== undefined) {
|
5487 | if (compared) {
|
5488 | continue;
|
5489 | }
|
5490 | result = false;
|
5491 | break;
|
5492 | }
|
5493 |
|
5494 | if (seen) {
|
5495 | if (!arraySome(other, function(othValue, othIndex) {
|
5496 | if (!cacheHas$2(seen, othIndex) &&
|
5497 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
5498 | return seen.push(othIndex);
|
5499 | }
|
5500 | })) {
|
5501 | result = false;
|
5502 | break;
|
5503 | }
|
5504 | } else if (!(
|
5505 | arrValue === othValue ||
|
5506 | equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
5507 | )) {
|
5508 | result = false;
|
5509 | break;
|
5510 | }
|
5511 | }
|
5512 | stack['delete'](array);
|
5513 | stack['delete'](other);
|
5514 | return result;
|
5515 | }
|
5516 |
|
5517 | var _equalArrays = equalArrays$1;
|
5518 |
|
5519 | var root$8 = _root;
|
5520 |
|
5521 |
|
5522 | var Uint8Array$1 = root$8.Uint8Array;
|
5523 |
|
5524 | var _Uint8Array = Uint8Array$1;
|
5525 |
|
5526 |
|
5527 |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 | function mapToArray$1(map) {
|
5534 | var index = -1,
|
5535 | result = Array(map.size);
|
5536 |
|
5537 | map.forEach(function(value, key) {
|
5538 | result[++index] = [key, value];
|
5539 | });
|
5540 | return result;
|
5541 | }
|
5542 |
|
5543 | var _mapToArray = mapToArray$1;
|
5544 |
|
5545 | var Symbol$5 = _Symbol;
|
5546 | var Uint8Array = _Uint8Array;
|
5547 | var eq$2 = eq_1;
|
5548 | var equalArrays$2 = _equalArrays;
|
5549 | var mapToArray = _mapToArray;
|
5550 | var setToArray$3 = _setToArray;
|
5551 |
|
5552 |
|
5553 | var COMPARE_PARTIAL_FLAG$3 = 1;
|
5554 | var COMPARE_UNORDERED_FLAG$2 = 2;
|
5555 |
|
5556 |
|
5557 | var boolTag$1 = '[object Boolean]';
|
5558 | var dateTag$1 = '[object Date]';
|
5559 | var errorTag$1 = '[object Error]';
|
5560 | var mapTag$3 = '[object Map]';
|
5561 | var numberTag$1 = '[object Number]';
|
5562 | var regexpTag$1 = '[object RegExp]';
|
5563 | var setTag$3 = '[object Set]';
|
5564 | var stringTag$1 = '[object String]';
|
5565 | var symbolTag$1 = '[object Symbol]';
|
5566 |
|
5567 | var arrayBufferTag$1 = '[object ArrayBuffer]';
|
5568 | var dataViewTag$2 = '[object DataView]';
|
5569 |
|
5570 |
|
5571 | var symbolProto$1 = Symbol$5 ? Symbol$5.prototype : undefined;
|
5572 | var symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 | function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
5592 | switch (tag) {
|
5593 | case dataViewTag$2:
|
5594 | if ((object.byteLength != other.byteLength) ||
|
5595 | (object.byteOffset != other.byteOffset)) {
|
5596 | return false;
|
5597 | }
|
5598 | object = object.buffer;
|
5599 | other = other.buffer;
|
5600 |
|
5601 | case arrayBufferTag$1:
|
5602 | if ((object.byteLength != other.byteLength) ||
|
5603 | !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
5604 | return false;
|
5605 | }
|
5606 | return true;
|
5607 |
|
5608 | case boolTag$1:
|
5609 | case dateTag$1:
|
5610 | case numberTag$1:
|
5611 |
|
5612 |
|
5613 | return eq$2(+object, +other);
|
5614 |
|
5615 | case errorTag$1:
|
5616 | return object.name == other.name && object.message == other.message;
|
5617 |
|
5618 | case regexpTag$1:
|
5619 | case stringTag$1:
|
5620 |
|
5621 |
|
5622 |
|
5623 | return object == (other + '');
|
5624 |
|
5625 | case mapTag$3:
|
5626 | var convert = mapToArray;
|
5627 |
|
5628 | case setTag$3:
|
5629 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3;
|
5630 | convert || (convert = setToArray$3);
|
5631 |
|
5632 | if (object.size != other.size && !isPartial) {
|
5633 | return false;
|
5634 | }
|
5635 |
|
5636 | var stacked = stack.get(object);
|
5637 | if (stacked) {
|
5638 | return stacked == other;
|
5639 | }
|
5640 | bitmask |= COMPARE_UNORDERED_FLAG$2;
|
5641 |
|
5642 |
|
5643 | stack.set(object, other);
|
5644 | var result = equalArrays$2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
5645 | stack['delete'](object);
|
5646 | return result;
|
5647 |
|
5648 | case symbolTag$1:
|
5649 | if (symbolValueOf) {
|
5650 | return symbolValueOf.call(object) == symbolValueOf.call(other);
|
5651 | }
|
5652 | }
|
5653 | return false;
|
5654 | }
|
5655 |
|
5656 | var _equalByTag = equalByTag$1;
|
5657 |
|
5658 | var arrayPush$3 = _arrayPush;
|
5659 | var isArray$12 = isArray_1;
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 | function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
|
5673 | var result = keysFunc(object);
|
5674 | return isArray$12(object) ? result : arrayPush$3(result, symbolsFunc(object));
|
5675 | }
|
5676 |
|
5677 | var _baseGetAllKeys = baseGetAllKeys$1;
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 | function arrayFilter$1(array, predicate) {
|
5689 | var index = -1,
|
5690 | length = array == null ? 0 : array.length,
|
5691 | resIndex = 0,
|
5692 | result = [];
|
5693 |
|
5694 | while (++index < length) {
|
5695 | var value = array[index];
|
5696 | if (predicate(value, index, array)) {
|
5697 | result[resIndex++] = value;
|
5698 | }
|
5699 | }
|
5700 | return result;
|
5701 | }
|
5702 |
|
5703 | var _arrayFilter = arrayFilter$1;
|
5704 |
|
5705 |
|
5706 |
|
5707 |
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 | function stubArray$1() {
|
5724 | return [];
|
5725 | }
|
5726 |
|
5727 | var stubArray_1 = stubArray$1;
|
5728 |
|
5729 | var arrayFilter = _arrayFilter;
|
5730 | var stubArray = stubArray_1;
|
5731 |
|
5732 |
|
5733 | var objectProto$12 = Object.prototype;
|
5734 |
|
5735 |
|
5736 | var propertyIsEnumerable$1 = objectProto$12.propertyIsEnumerable;
|
5737 |
|
5738 |
|
5739 | var nativeGetSymbols = Object.getOwnPropertySymbols;
|
5740 |
|
5741 |
|
5742 |
|
5743 |
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 | var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object) {
|
5749 | if (object == null) {
|
5750 | return [];
|
5751 | }
|
5752 | object = Object(object);
|
5753 | return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
5754 | return propertyIsEnumerable$1.call(object, symbol);
|
5755 | });
|
5756 | };
|
5757 |
|
5758 | var _getSymbols = getSymbols$1;
|
5759 |
|
5760 | var baseGetAllKeys = _baseGetAllKeys;
|
5761 | var getSymbols = _getSymbols;
|
5762 | var keys$2 = keys_1;
|
5763 |
|
5764 |
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 | function getAllKeys$1(object) {
|
5772 | return baseGetAllKeys(object, keys$2, getSymbols);
|
5773 | }
|
5774 |
|
5775 | var _getAllKeys = getAllKeys$1;
|
5776 |
|
5777 | var getAllKeys = _getAllKeys;
|
5778 |
|
5779 |
|
5780 | var COMPARE_PARTIAL_FLAG$4 = 1;
|
5781 |
|
5782 |
|
5783 | var objectProto$11 = Object.prototype;
|
5784 |
|
5785 |
|
5786 | var hasOwnProperty$9 = objectProto$11.hasOwnProperty;
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 | function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
|
5802 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4,
|
5803 | objProps = getAllKeys(object),
|
5804 | objLength = objProps.length,
|
5805 | othProps = getAllKeys(other),
|
5806 | othLength = othProps.length;
|
5807 |
|
5808 | if (objLength != othLength && !isPartial) {
|
5809 | return false;
|
5810 | }
|
5811 | var index = objLength;
|
5812 | while (index--) {
|
5813 | var key = objProps[index];
|
5814 | if (!(isPartial ? key in other : hasOwnProperty$9.call(other, key))) {
|
5815 | return false;
|
5816 | }
|
5817 | }
|
5818 |
|
5819 | var stacked = stack.get(object);
|
5820 | if (stacked && stack.get(other)) {
|
5821 | return stacked == other;
|
5822 | }
|
5823 | var result = true;
|
5824 | stack.set(object, other);
|
5825 | stack.set(other, object);
|
5826 |
|
5827 | var skipCtor = isPartial;
|
5828 | while (++index < objLength) {
|
5829 | key = objProps[index];
|
5830 | var objValue = object[key],
|
5831 | othValue = other[key];
|
5832 |
|
5833 | if (customizer) {
|
5834 | var compared = isPartial
|
5835 | ? customizer(othValue, objValue, key, other, object, stack)
|
5836 | : customizer(objValue, othValue, key, object, other, stack);
|
5837 | }
|
5838 |
|
5839 | if (!(compared === undefined
|
5840 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
5841 | : compared
|
5842 | )) {
|
5843 | result = false;
|
5844 | break;
|
5845 | }
|
5846 | skipCtor || (skipCtor = key == 'constructor');
|
5847 | }
|
5848 | if (result && !skipCtor) {
|
5849 | var objCtor = object.constructor,
|
5850 | othCtor = other.constructor;
|
5851 |
|
5852 |
|
5853 | if (objCtor != othCtor &&
|
5854 | ('constructor' in object && 'constructor' in other) &&
|
5855 | !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
5856 | typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
5857 | result = false;
|
5858 | }
|
5859 | }
|
5860 | stack['delete'](object);
|
5861 | stack['delete'](other);
|
5862 | return result;
|
5863 | }
|
5864 |
|
5865 | var _equalObjects = equalObjects$1;
|
5866 |
|
5867 | var Stack$2 = _Stack;
|
5868 | var equalArrays = _equalArrays;
|
5869 | var equalByTag = _equalByTag;
|
5870 | var equalObjects = _equalObjects;
|
5871 | var getTag$2 = _getTag;
|
5872 | var isArray$11 = isArray_1;
|
5873 | var isBuffer$2 = isBuffer_1;
|
5874 | var isTypedArray$3 = isTypedArray_1;
|
5875 |
|
5876 |
|
5877 | var COMPARE_PARTIAL_FLAG$1 = 1;
|
5878 |
|
5879 |
|
5880 | var argsTag$2 = '[object Arguments]';
|
5881 | var arrayTag$1 = '[object Array]';
|
5882 | var objectTag$2 = '[object Object]';
|
5883 |
|
5884 |
|
5885 | var objectProto$10 = Object.prototype;
|
5886 |
|
5887 |
|
5888 | var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 |
|
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 | function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
|
5905 | var objIsArr = isArray$11(object),
|
5906 | othIsArr = isArray$11(other),
|
5907 | objTag = objIsArr ? arrayTag$1 : getTag$2(object),
|
5908 | othTag = othIsArr ? arrayTag$1 : getTag$2(other);
|
5909 |
|
5910 | objTag = objTag == argsTag$2 ? objectTag$2 : objTag;
|
5911 | othTag = othTag == argsTag$2 ? objectTag$2 : othTag;
|
5912 |
|
5913 | var objIsObj = objTag == objectTag$2,
|
5914 | othIsObj = othTag == objectTag$2,
|
5915 | isSameTag = objTag == othTag;
|
5916 |
|
5917 | if (isSameTag && isBuffer$2(object)) {
|
5918 | if (!isBuffer$2(other)) {
|
5919 | return false;
|
5920 | }
|
5921 | objIsArr = true;
|
5922 | objIsObj = false;
|
5923 | }
|
5924 | if (isSameTag && !objIsObj) {
|
5925 | stack || (stack = new Stack$2);
|
5926 | return (objIsArr || isTypedArray$3(object))
|
5927 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
5928 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
5929 | }
|
5930 | if (!(bitmask & COMPARE_PARTIAL_FLAG$1)) {
|
5931 | var objIsWrapped = objIsObj && hasOwnProperty$8.call(object, '__wrapped__'),
|
5932 | othIsWrapped = othIsObj && hasOwnProperty$8.call(other, '__wrapped__');
|
5933 |
|
5934 | if (objIsWrapped || othIsWrapped) {
|
5935 | var objUnwrapped = objIsWrapped ? object.value() : object,
|
5936 | othUnwrapped = othIsWrapped ? other.value() : other;
|
5937 |
|
5938 | stack || (stack = new Stack$2);
|
5939 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
5940 | }
|
5941 | }
|
5942 | if (!isSameTag) {
|
5943 | return false;
|
5944 | }
|
5945 | stack || (stack = new Stack$2);
|
5946 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
5947 | }
|
5948 |
|
5949 | var _baseIsEqualDeep = baseIsEqualDeep$1;
|
5950 |
|
5951 | var baseIsEqualDeep = _baseIsEqualDeep;
|
5952 | var isObjectLike$5 = isObjectLike_1;
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 | function baseIsEqual$1(value, other, bitmask, customizer, stack) {
|
5969 | if (value === other) {
|
5970 | return true;
|
5971 | }
|
5972 | if (value == null || other == null || (!isObjectLike$5(value) && !isObjectLike$5(other))) {
|
5973 | return value !== value && other !== other;
|
5974 | }
|
5975 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$1, stack);
|
5976 | }
|
5977 |
|
5978 | var _baseIsEqual = baseIsEqual$1;
|
5979 |
|
5980 | var Stack = _Stack;
|
5981 | var baseIsEqual = _baseIsEqual;
|
5982 |
|
5983 |
|
5984 | var COMPARE_PARTIAL_FLAG = 1;
|
5985 | var COMPARE_UNORDERED_FLAG = 2;
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 | function baseIsMatch$1(object, source, matchData, customizer) {
|
5998 | var index = matchData.length,
|
5999 | length = index,
|
6000 | noCustomizer = !customizer;
|
6001 |
|
6002 | if (object == null) {
|
6003 | return !length;
|
6004 | }
|
6005 | object = Object(object);
|
6006 | while (index--) {
|
6007 | var data = matchData[index];
|
6008 | if ((noCustomizer && data[2])
|
6009 | ? data[1] !== object[data[0]]
|
6010 | : !(data[0] in object)
|
6011 | ) {
|
6012 | return false;
|
6013 | }
|
6014 | }
|
6015 | while (++index < length) {
|
6016 | data = matchData[index];
|
6017 | var key = data[0],
|
6018 | objValue = object[key],
|
6019 | srcValue = data[1];
|
6020 |
|
6021 | if (noCustomizer && data[2]) {
|
6022 | if (objValue === undefined && !(key in object)) {
|
6023 | return false;
|
6024 | }
|
6025 | } else {
|
6026 | var stack = new Stack;
|
6027 | if (customizer) {
|
6028 | var result = customizer(objValue, srcValue, key, object, source, stack);
|
6029 | }
|
6030 | if (!(result === undefined
|
6031 | ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
6032 | : result
|
6033 | )) {
|
6034 | return false;
|
6035 | }
|
6036 | }
|
6037 | }
|
6038 | return true;
|
6039 | }
|
6040 |
|
6041 | var _baseIsMatch = baseIsMatch$1;
|
6042 |
|
6043 | var isObject$3 = isObject_1;
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 | function isStrictComparable$1(value) {
|
6054 | return value === value && !isObject$3(value);
|
6055 | }
|
6056 |
|
6057 | var _isStrictComparable = isStrictComparable$1;
|
6058 |
|
6059 | var isStrictComparable = _isStrictComparable;
|
6060 | var keys$3 = keys_1;
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 | function getMatchData$1(object) {
|
6070 | var result = keys$3(object),
|
6071 | length = result.length;
|
6072 |
|
6073 | while (length--) {
|
6074 | var key = result[length],
|
6075 | value = object[key];
|
6076 |
|
6077 | result[length] = [key, value, isStrictComparable(value)];
|
6078 | }
|
6079 | return result;
|
6080 | }
|
6081 |
|
6082 | var _getMatchData = getMatchData$1;
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 | function matchesStrictComparable$1(key, srcValue) {
|
6094 | return function(object) {
|
6095 | if (object == null) {
|
6096 | return false;
|
6097 | }
|
6098 | return object[key] === srcValue &&
|
6099 | (srcValue !== undefined || (key in Object(object)));
|
6100 | };
|
6101 | }
|
6102 |
|
6103 | var _matchesStrictComparable = matchesStrictComparable$1;
|
6104 |
|
6105 | var baseIsMatch = _baseIsMatch;
|
6106 | var getMatchData = _getMatchData;
|
6107 | var matchesStrictComparable = _matchesStrictComparable;
|
6108 |
|
6109 |
|
6110 |
|
6111 |
|
6112 |
|
6113 |
|
6114 |
|
6115 |
|
6116 | function baseMatches$1(source) {
|
6117 | var matchData = getMatchData(source);
|
6118 | if (matchData.length == 1 && matchData[0][2]) {
|
6119 | return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
6120 | }
|
6121 | return function(object) {
|
6122 | return object === source || baseIsMatch(object, source, matchData);
|
6123 | };
|
6124 | }
|
6125 |
|
6126 | var _baseMatches = baseMatches$1;
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 | function baseHasIn$1(object, key) {
|
6137 | return object != null && key in Object(object);
|
6138 | }
|
6139 |
|
6140 | var _baseHasIn = baseHasIn$1;
|
6141 |
|
6142 | var castPath$2 = _castPath;
|
6143 | var isArguments$4 = isArguments_1;
|
6144 | var isArray$13 = isArray_1;
|
6145 | var isIndex$2 = _isIndex;
|
6146 | var isLength$3 = isLength_1;
|
6147 | var toKey$3 = _toKey;
|
6148 |
|
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 | function hasPath$1(object, path, hasFunc) {
|
6159 | path = castPath$2(path, object);
|
6160 |
|
6161 | var index = -1,
|
6162 | length = path.length,
|
6163 | result = false;
|
6164 |
|
6165 | while (++index < length) {
|
6166 | var key = toKey$3(path[index]);
|
6167 | if (!(result = object != null && hasFunc(object, key))) {
|
6168 | break;
|
6169 | }
|
6170 | object = object[key];
|
6171 | }
|
6172 | if (result || ++index != length) {
|
6173 | return result;
|
6174 | }
|
6175 | length = object == null ? 0 : object.length;
|
6176 | return !!length && isLength$3(length) && isIndex$2(key, length) &&
|
6177 | (isArray$13(object) || isArguments$4(object));
|
6178 | }
|
6179 |
|
6180 | var _hasPath = hasPath$1;
|
6181 |
|
6182 | var baseHasIn = _baseHasIn;
|
6183 | var hasPath = _hasPath;
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 |
|
6189 |
|
6190 |
|
6191 |
|
6192 |
|
6193 |
|
6194 |
|
6195 |
|
6196 |
|
6197 |
|
6198 |
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 | function hasIn$1(object, path) {
|
6212 | return object != null && hasPath(object, path, baseHasIn);
|
6213 | }
|
6214 |
|
6215 | var hasIn_1 = hasIn$1;
|
6216 |
|
6217 | var baseIsEqual$2 = _baseIsEqual;
|
6218 | var get$2 = get_1;
|
6219 | var hasIn = hasIn_1;
|
6220 | var isKey$2 = _isKey;
|
6221 | var isStrictComparable$2 = _isStrictComparable;
|
6222 | var matchesStrictComparable$2 = _matchesStrictComparable;
|
6223 | var toKey$2 = _toKey;
|
6224 |
|
6225 | /** Used to compose bitmasks for value comparisons. */
|
6226 | var COMPARE_PARTIAL_FLAG$5 = 1;
|
6227 | var COMPARE_UNORDERED_FLAG$3 = 2;
|
6228 |
|
6229 | /**
|
6230 | * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
6231 | *
|
6232 | * @private
|
6233 | * @param {string} path The path of the property to get.
|
6234 | * @param {*} srcValue The value to match.
|
6235 | * @returns {Function} Returns the new spec function.
|
6236 | */
|
6237 | function baseMatchesProperty$1(path, srcValue) {
|
6238 | if (isKey$2(path) && isStrictComparable$2(srcValue)) {
|
6239 | return matchesStrictComparable$2(toKey$2(path), srcValue);
|
6240 | }
|
6241 | return function(object) {
|
6242 | var objValue = get$2(object, path);
|
6243 | return (objValue === undefined && objValue === srcValue)
|
6244 | ? hasIn(object, path)
|
6245 | : baseIsEqual$2(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3);
|
6246 | };
|
6247 | }
|
6248 |
|
6249 | var _baseMatchesProperty = baseMatchesProperty$1;
|
6250 |
|
6251 | /**
|
6252 | * This method returns the first argument it receives.
|
6253 | *
|
6254 | * @static
|
6255 | * @since 0.1.0
|
6256 | * @memberOf _
|
6257 | * @category Util
|
6258 | * @param {*} value Any value.
|
6259 | * @returns {*} Returns `value`.
|
6260 | * @example
|
6261 | *
|
6262 | * var object = { 'a': 1 };
|
6263 | *
|
6264 | * console.log(_.identity(object) === object);
|
6265 | *
|
6266 | */
|
6267 | function identity$1(value) {
|
6268 | return value;
|
6269 | }
|
6270 |
|
6271 | var identity_1 = identity$1;
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 | function baseProperty$1(key) {
|
6281 | return function(object) {
|
6282 | return object == null ? undefined : object[key];
|
6283 | };
|
6284 | }
|
6285 |
|
6286 | var _baseProperty = baseProperty$1;
|
6287 |
|
6288 | var baseGet$2 = _baseGet;
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 |
|
6294 |
|
6295 |
|
6296 |
|
6297 | function basePropertyDeep$1(path) {
|
6298 | return function(object) {
|
6299 | return baseGet$2(object, path);
|
6300 | };
|
6301 | }
|
6302 |
|
6303 | var _basePropertyDeep = basePropertyDeep$1;
|
6304 |
|
6305 | var baseProperty = _baseProperty;
|
6306 | var basePropertyDeep = _basePropertyDeep;
|
6307 | var isKey$3 = _isKey;
|
6308 | var toKey$4 = _toKey;
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 |
|
6321 |
|
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 | function property$1(path) {
|
6333 | return isKey$3(path) ? baseProperty(toKey$4(path)) : basePropertyDeep(path);
|
6334 | }
|
6335 |
|
6336 | var property_1 = property$1;
|
6337 |
|
6338 | var baseMatches = _baseMatches;
|
6339 | var baseMatchesProperty = _baseMatchesProperty;
|
6340 | var identity = identity_1;
|
6341 | var isArray$10 = isArray_1;
|
6342 | var property = property_1;
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 | function baseIteratee$1(value) {
|
6352 |
|
6353 |
|
6354 | if (typeof value == 'function') {
|
6355 | return value;
|
6356 | }
|
6357 | if (value == null) {
|
6358 | return identity;
|
6359 | }
|
6360 | if (typeof value == 'object') {
|
6361 | return isArray$10(value)
|
6362 | ? baseMatchesProperty(value[0], value[1])
|
6363 | : baseMatches(value);
|
6364 | }
|
6365 | return property(value);
|
6366 | }
|
6367 |
|
6368 | var _baseIteratee = baseIteratee$1;
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 | function createBaseFor$1(fromRight) {
|
6378 | return function(object, iteratee, keysFunc) {
|
6379 | var index = -1,
|
6380 | iterable = Object(object),
|
6381 | props = keysFunc(object),
|
6382 | length = props.length;
|
6383 |
|
6384 | while (length--) {
|
6385 | var key = props[fromRight ? length : ++index];
|
6386 | if (iteratee(iterable[key], key, iterable) === false) {
|
6387 | break;
|
6388 | }
|
6389 | }
|
6390 | return object;
|
6391 | };
|
6392 | }
|
6393 |
|
6394 | var _createBaseFor = createBaseFor$1;
|
6395 |
|
6396 | var createBaseFor = _createBaseFor;
|
6397 |
|
6398 |
|
6399 |
|
6400 |
|
6401 |
|
6402 |
|
6403 |
|
6404 |
|
6405 |
|
6406 |
|
6407 |
|
6408 |
|
6409 | var baseFor$1 = createBaseFor();
|
6410 |
|
6411 | var _baseFor = baseFor$1;
|
6412 |
|
6413 | var baseFor = _baseFor;
|
6414 | var keys$4 = keys_1;
|
6415 |
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 | function baseForOwn$1(object, iteratee) {
|
6425 | return object && baseFor(object, iteratee, keys$4);
|
6426 | }
|
6427 |
|
6428 | var _baseForOwn = baseForOwn$1;
|
6429 |
|
6430 | var isArrayLike$4 = isArrayLike_1;
|
6431 |
|
6432 |
|
6433 |
|
6434 |
|
6435 |
|
6436 |
|
6437 |
|
6438 |
|
6439 |
|
6440 | function createBaseEach$1(eachFunc, fromRight) {
|
6441 | return function(collection, iteratee) {
|
6442 | if (collection == null) {
|
6443 | return collection;
|
6444 | }
|
6445 | if (!isArrayLike$4(collection)) {
|
6446 | return eachFunc(collection, iteratee);
|
6447 | }
|
6448 | var length = collection.length,
|
6449 | index = fromRight ? length : -1,
|
6450 | iterable = Object(collection);
|
6451 |
|
6452 | while ((fromRight ? index-- : ++index < length)) {
|
6453 | if (iteratee(iterable[index], index, iterable) === false) {
|
6454 | break;
|
6455 | }
|
6456 | }
|
6457 | return collection;
|
6458 | };
|
6459 | }
|
6460 |
|
6461 | var _createBaseEach = createBaseEach$1;
|
6462 |
|
6463 | var baseForOwn = _baseForOwn;
|
6464 | var createBaseEach = _createBaseEach;
|
6465 |
|
6466 |
|
6467 |
|
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 |
|
6473 |
|
6474 | var baseEach$1 = createBaseEach(baseForOwn);
|
6475 |
|
6476 | var _baseEach = baseEach$1;
|
6477 |
|
6478 | var baseEach = _baseEach;
|
6479 | var isArrayLike$3 = isArrayLike_1;
|
6480 |
|
6481 |
|
6482 |
|
6483 |
|
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 |
|
6489 | function baseMap$1(collection, iteratee) {
|
6490 | var index = -1,
|
6491 | result = isArrayLike$3(collection) ? Array(collection.length) : [];
|
6492 |
|
6493 | baseEach(collection, function(value, key, collection) {
|
6494 | result[++index] = iteratee(value, key, collection);
|
6495 | });
|
6496 | return result;
|
6497 | }
|
6498 |
|
6499 | var _baseMap = baseMap$1;
|
6500 |
|
6501 | var arrayMap$3 = _arrayMap;
|
6502 | var baseIteratee = _baseIteratee;
|
6503 | var baseMap = _baseMap;
|
6504 | var isArray$9 = isArray_1;
|
6505 |
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 |
|
6516 |
|
6517 |
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 |
|
6528 |
|
6529 |
|
6530 |
|
6531 |
|
6532 |
|
6533 |
|
6534 |
|
6535 |
|
6536 |
|
6537 |
|
6538 |
|
6539 |
|
6540 |
|
6541 |
|
6542 |
|
6543 |
|
6544 |
|
6545 |
|
6546 |
|
6547 |
|
6548 | function map(collection, iteratee) {
|
6549 | var func = isArray$9(collection) ? arrayMap$3 : baseMap;
|
6550 | return func(collection, baseIteratee(iteratee, 3));
|
6551 | }
|
6552 |
|
6553 | var map_1 = map;
|
6554 |
|
6555 | var name$8 = 'post';
|
6556 | var pluralName$8 = 'posts';
|
6557 |
|
6558 | var defaultProperties$7 = ['id', 'body'];
|
6559 |
|
6560 | var post = Object.freeze({
|
6561 | name: name$8,
|
6562 | pluralName: pluralName$8,
|
6563 | defaultProperties: defaultProperties$7
|
6564 | });
|
6565 |
|
6566 | var name$7 = 'feedPost';
|
6567 | var pluralName$7 = 'feedPosts';
|
6568 | function getMany() {
|
6569 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6570 |
|
6571 | var _buildPaging = buildPaging(options),
|
6572 | from = _buildPaging.from,
|
6573 | to = _buildPaging.to;
|
6574 |
|
6575 | var properties = buildProperties(defaultProperties$7, options);
|
6576 | var listLeaf = entityToFalcorListLeaf({ name: name$7 });
|
6577 |
|
6578 | var paths = map_1(properties, function (property) {
|
6579 | var propertyPath = index(property);
|
6580 | var path = concat_1(['self', listLeaf, { from: from, to: to }], propertyPath);
|
6581 |
|
6582 | return path;
|
6583 | });
|
6584 |
|
6585 | return paths;
|
6586 | }
|
6587 |
|
6588 | function extractMany() {
|
6589 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6590 | var jsonGraph = arguments[1];
|
6591 |
|
6592 | var listLeaf = entityToFalcorListLeaf({ name: name$7 });
|
6593 | var postList = jsonGraph.json.self[listLeaf];
|
6594 |
|
6595 | var posts = map_1(postList, function (post) {
|
6596 | return post;
|
6597 | });
|
6598 |
|
6599 | return posts;
|
6600 | }
|
6601 |
|
6602 | var feedPost = Object.freeze({
|
6603 | name: name$7,
|
6604 | pluralName: pluralName$7,
|
6605 | defaultProperties: defaultProperties$7,
|
6606 | getMany: getMany,
|
6607 | extractMany: extractMany
|
6608 | });
|
6609 |
|
6610 | var name$9 = 'growthAction';
|
6611 | var pluralName$9 = 'growthActions';
|
6612 |
|
6613 | var defaultProperties$8 = ['id', 'agent.id', 'agent.name', 'growee.id', 'growee.name', 'relationship.id', 'relationship.owner.id', 'growth_relationship_id', 'state', 'title', 'due_at', 'trigger_prompt_at', 'completed_at', 'progress_current', 'progress_total'];
|
6614 |
|
6615 | var growthAction = Object.freeze({
|
6616 | name: name$9,
|
6617 | pluralName: pluralName$9,
|
6618 | defaultProperties: defaultProperties$8
|
6619 | });
|
6620 |
|
6621 | var name$10 = 'growthRelationship';
|
6622 | var pluralName$10 = 'growthRelationships';
|
6623 |
|
6624 | var defaultProperties$9 = ['id', 'owner_type', 'owner.id', 'owner.name', 'growee.id', 'growee.name', 'agent.id', 'agent.name'];
|
6625 |
|
6626 | var growthRelationship = Object.freeze({
|
6627 | name: name$10,
|
6628 | pluralName: pluralName$10,
|
6629 | defaultProperties: defaultProperties$9
|
6630 | });
|
6631 |
|
6632 | var name$11 = 'growthAgentPrompt';
|
6633 | var pluralName$11 = 'growthAgentPrompts';
|
6634 |
|
6635 | var defaultProperties$10 = ['id', 'title', 'state', 'type', 'display_type', 'status', 'action.id', 'action.due_at', 'action.state', 'action.trigger_prompt_at', 'action.progress_total', 'action.progress_current', 'action.growee.id', 'action.growee.name', 'action.growee.email', 'action.growee.avatar.id', 'action.growee.avatar.src', 'action.agent.id', 'action.agent.name', 'action.relationship.id', 'action.relationship.owner.id'];
|
6636 |
|
6637 | var growthAgentPrompt = Object.freeze({
|
6638 | name: name$11,
|
6639 | pluralName: pluralName$11,
|
6640 | defaultProperties: defaultProperties$10
|
6641 | });
|
6642 |
|
6643 | var name$12 = 'growthAgentResponse';
|
6644 | var pluralName$12 = 'growthAgentResponses';
|
6645 |
|
6646 | var defaultProperties$11 = ['id', 'message'];
|
6647 |
|
6648 | var growthAgentResponse = Object.freeze({
|
6649 | name: name$12,
|
6650 | pluralName: pluralName$12,
|
6651 | defaultProperties: defaultProperties$11
|
6652 | });
|
6653 |
|
6654 | var name$13 = 'license';
|
6655 | var pluralName$13 = 'licenses';
|
6656 |
|
6657 | var defaultProperties$12 = ['id', 'updated_at'];
|
6658 |
|
6659 | var license = Object.freeze({
|
6660 | name: name$13,
|
6661 | pluralName: pluralName$13,
|
6662 | defaultProperties: defaultProperties$12
|
6663 | });
|
6664 |
|
6665 | var name$14 = 'licensedCohort';
|
6666 | var pluralName$14 = 'licensedCohorts';
|
6667 |
|
6668 | var defaultProperties$13 = ['id', 'updated_at'];
|
6669 |
|
6670 | var licensedCohort = Object.freeze({
|
6671 | name: name$14,
|
6672 | pluralName: pluralName$14,
|
6673 | defaultProperties: defaultProperties$13
|
6674 | });
|
6675 |
|
6676 | var name$15 = 'licensedContentItem';
|
6677 | var pluralName$15 = 'licensedContentItems';
|
6678 |
|
6679 | var defaultProperties$14 = ['id', 'updated_at'];
|
6680 |
|
6681 | var licensedContentItem = Object.freeze({
|
6682 | name: name$15,
|
6683 | pluralName: pluralName$15,
|
6684 | defaultProperties: defaultProperties$14
|
6685 | });
|
6686 |
|
6687 | var name$16 = 'moment';
|
6688 | var pluralName$16 = 'moments';
|
6689 |
|
6690 | var defaultProperties$15 = ['id', 'description', 'title', 'owner_type', 'owner.name', 'owner.avatar.src', 'owner.icon.src', 'cover_image_media.id', 'cover_image_media.src', 'background_music.src', 'background_music.duration', 'background_music.author'];
|
6691 |
|
6692 | var moment = Object.freeze({
|
6693 | name: name$16,
|
6694 | pluralName: pluralName$16,
|
6695 | defaultProperties: defaultProperties$15
|
6696 | });
|
6697 |
|
6698 | var name$17 = 'myGrowthAgentPrompt';
|
6699 | var pluralName$17 = 'myGrowthAgentPrompts';
|
6700 |
|
6701 | var defaultProperties$16 = ['id', 'title', 'state', 'type', 'display_type', 'status', 'action.id', 'action.due_at', 'action.state', 'action.trigger_prompt_at', 'action.progress_total', 'action.progress_current', 'action.growee.id', 'action.growee.name', 'action.growee.email', 'action.growee.avatar.id', 'action.growee.avatar.src', 'action.agent.id', 'action.agent.name', 'action.relationship.id', 'action.relationship.owner.id'];
|
6702 |
|
6703 | function getMany$1() {
|
6704 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6705 |
|
6706 | var _buildPaging = buildPaging(options),
|
6707 | from = _buildPaging.from,
|
6708 | to = _buildPaging.to;
|
6709 |
|
6710 | var properties = buildProperties(defaultProperties$16, options);
|
6711 | var listLeaf = entityToFalcorListLeaf({ name: name$17 });
|
6712 |
|
6713 | var paths = map_1(properties, function (property) {
|
6714 | var propertyPath = index(property);
|
6715 | var path = concat_1(['self', listLeaf, { from: from, to: to }], propertyPath);
|
6716 |
|
6717 | return path;
|
6718 | });
|
6719 |
|
6720 | return paths;
|
6721 | }
|
6722 |
|
6723 | function extractMany$1() {
|
6724 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6725 | var jsonGraph = arguments[1];
|
6726 |
|
6727 | var listLeaf = entityToFalcorListLeaf({ name: name$17 });
|
6728 | var viewList = jsonGraph.json.self[listLeaf];
|
6729 |
|
6730 | var views = map_1(viewList, function (view) {
|
6731 | return view;
|
6732 | });
|
6733 |
|
6734 | return views;
|
6735 | }
|
6736 |
|
6737 | var myGrowthAgentPrompt = Object.freeze({
|
6738 | name: name$17,
|
6739 | pluralName: pluralName$17,
|
6740 | defaultProperties: defaultProperties$16,
|
6741 | getMany: getMany$1,
|
6742 | extractMany: extractMany$1
|
6743 | });
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 |
|
6758 |
|
6759 |
|
6760 |
|
6761 |
|
6762 |
|
6763 |
|
6764 |
|
6765 | function isNil(value) {
|
6766 | return value == null;
|
6767 | }
|
6768 |
|
6769 | var isNil_1 = isNil;
|
6770 |
|
6771 | var name$19 = 'review';
|
6772 | var pluralName$19 = 'reviews';
|
6773 |
|
6774 | var defaultProperties$17 = ['id', 'rating'];
|
6775 |
|
6776 | var review = Object.freeze({
|
6777 | name: name$19,
|
6778 | pluralName: pluralName$19,
|
6779 | defaultProperties: defaultProperties$17
|
6780 | });
|
6781 |
|
6782 | var name$20 = 'tree';
|
6783 | var pluralName$20 = 'trees';
|
6784 |
|
6785 | var treeEntity = Object.freeze({
|
6786 | name: name$20,
|
6787 | pluralName: pluralName$20
|
6788 | });
|
6789 |
|
6790 |
|
6791 |
|
6792 |
|
6793 |
|
6794 |
|
6795 |
|
6796 | var name$18 = 'myTreeReview';
|
6797 | var pluralName$18 = 'myTreeReviews';
|
6798 | function getOne() {
|
6799 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6800 | var tree = options.tree;
|
6801 |
|
6802 |
|
6803 | if (isNil_1(tree) || isNil_1(tree.id)) {
|
6804 | return new Error("options.tree.id is required when getting the current user's tree review");
|
6805 | }
|
6806 |
|
6807 | var properties = buildProperties(defaultProperties$17, options);
|
6808 |
|
6809 | var paths = properties.map(function (property) {
|
6810 | var rootLeaf = entityToFalcorRootLeaf(treeEntity);
|
6811 | var path = index(property);
|
6812 |
|
6813 | return concat_1([rootLeaf, tree.id, 'my_review'], path);
|
6814 | });
|
6815 |
|
6816 | return paths;
|
6817 | }
|
6818 |
|
6819 | function extractOne() {
|
6820 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6821 | var jsonGraph = arguments[1];
|
6822 | var tree = options.tree;
|
6823 |
|
6824 |
|
6825 | if (isNil_1(tree) || isNil_1(tree.id)) {
|
6826 | return new Error("options.tree.id is required when getting the current user's tree review");
|
6827 | }
|
6828 |
|
6829 | var rootLeaf = entityToFalcorRootLeaf(treeEntity);
|
6830 |
|
6831 | return jsonGraph.json[rootLeaf][tree.id].my_review;
|
6832 | }
|
6833 |
|
6834 | var myTreeReview = Object.freeze({
|
6835 | name: name$18,
|
6836 | pluralName: pluralName$18,
|
6837 | defaultProperties: defaultProperties$17,
|
6838 | getOne: getOne,
|
6839 | extractOne: extractOne
|
6840 | });
|
6841 |
|
6842 | var name$21 = 'note';
|
6843 | var pluralName$21 = 'notes';
|
6844 |
|
6845 | var defaultProperties$18 = ['id', 'body'];
|
6846 |
|
6847 | var note = Object.freeze({
|
6848 | name: name$21,
|
6849 | pluralName: pluralName$21,
|
6850 | defaultProperties: defaultProperties$18
|
6851 | });
|
6852 |
|
6853 | var name$22 = 'progressItem';
|
6854 | var pluralName$22 = 'progressItems';
|
6855 |
|
6856 | var defaultProperties$19 = ['id', 'action', 'title', 'description', 'completed', 'hidden', 'assigner_type', 'linkable_type', 'updated_at', 'date_due'];
|
6857 |
|
6858 | var progressItem = Object.freeze({
|
6859 | name: name$22,
|
6860 | pluralName: pluralName$22,
|
6861 | defaultProperties: defaultProperties$19
|
6862 | });
|
6863 |
|
6864 | var name$23 = 'space';
|
6865 | var pluralName$23 = 'spaces';
|
6866 |
|
6867 | var defaultProperties$20 = ['id', 'name', 'topic'];
|
6868 |
|
6869 | var space = Object.freeze({
|
6870 | name: name$23,
|
6871 | pluralName: pluralName$23,
|
6872 | defaultProperties: defaultProperties$20
|
6873 | });
|
6874 |
|
6875 | var name$24 = 'timeline';
|
6876 | var pluralName$24 = 'timelines';
|
6877 |
|
6878 | var timeline = Object.freeze({
|
6879 | name: name$24,
|
6880 | pluralName: pluralName$24
|
6881 | });
|
6882 |
|
6883 | var name$25 = 'toDoItem';
|
6884 | var pluralName$25 = 'toDoItems';
|
6885 |
|
6886 | var defaultProperties$21 = ['id', 'title', 'description', 'action', 'date_due'];
|
6887 |
|
6888 | var toDoItem = Object.freeze({
|
6889 | name: name$25,
|
6890 | pluralName: pluralName$25,
|
6891 | defaultProperties: defaultProperties$21
|
6892 | });
|
6893 |
|
6894 | var name$26 = 'toDoList';
|
6895 | var pluralName$26 = 'toDoLists';
|
6896 |
|
6897 | var defaultProperties$22 = ['id', 'name', 'created_at', 'updated_at'];
|
6898 |
|
6899 | var toDoList = Object.freeze({
|
6900 | name: name$26,
|
6901 | pluralName: pluralName$26,
|
6902 | defaultProperties: defaultProperties$22
|
6903 | });
|
6904 |
|
6905 | var name$27 = 'topic';
|
6906 | var pluralName$27 = 'topics';
|
6907 |
|
6908 | var defaultProperties$23 = ['id', 'name'];
|
6909 |
|
6910 | var topic = Object.freeze({
|
6911 | name: name$27,
|
6912 | pluralName: pluralName$27,
|
6913 | defaultProperties: defaultProperties$23
|
6914 | });
|
6915 |
|
6916 | var name$28 = 'tourTipView';
|
6917 | var pluralName$28 = 'tourTipViews';
|
6918 |
|
6919 | var defaultProperties$24 = ['id', 'state'];
|
6920 |
|
6921 | function getMany$2() {
|
6922 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6923 |
|
6924 | var _buildPaging = buildPaging(options),
|
6925 | from = _buildPaging.from,
|
6926 | to = _buildPaging.to;
|
6927 |
|
6928 | var properties = buildProperties(defaultProperties$24, options);
|
6929 | var listLeaf = entityToFalcorListLeaf({ name: name$28 });
|
6930 |
|
6931 | var paths = map_1(properties, function (property) {
|
6932 | var propertyPath = index(property);
|
6933 | var path = concat_1(['self', listLeaf, { from: from, to: to }], propertyPath);
|
6934 |
|
6935 | return path;
|
6936 | });
|
6937 |
|
6938 | return paths;
|
6939 | }
|
6940 |
|
6941 | function extractMany$2() {
|
6942 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
6943 | var jsonGraph = arguments[1];
|
6944 |
|
6945 | var listLeaf = entityToFalcorListLeaf({ name: name$28 });
|
6946 | var viewList = jsonGraph.json.self[listLeaf];
|
6947 |
|
6948 | var views = map_1(viewList, function (view) {
|
6949 | return view;
|
6950 | });
|
6951 |
|
6952 | return views;
|
6953 | }
|
6954 |
|
6955 | var tourTipView = Object.freeze({
|
6956 | name: name$28,
|
6957 | pluralName: pluralName$28,
|
6958 | defaultProperties: defaultProperties$24,
|
6959 | getMany: getMany$2,
|
6960 | extractMany: extractMany$2
|
6961 | });
|
6962 |
|
6963 | var name$29 = 'user';
|
6964 | var pluralName$29 = 'users';
|
6965 |
|
6966 | var defaultProperties$25 = ['id', 'username', 'name'];
|
6967 |
|
6968 | var user = Object.freeze({
|
6969 | name: name$29,
|
6970 | pluralName: pluralName$29,
|
6971 | defaultProperties: defaultProperties$25
|
6972 | });
|
6973 |
|
6974 | var name$30 = 'userToDoList';
|
6975 | var pluralName$30 = 'userToDoLists';
|
6976 |
|
6977 | var defaultProperties$26 = ['id', 'name'];
|
6978 |
|
6979 | var userToDoList = Object.freeze({
|
6980 | name: name$30,
|
6981 | pluralName: pluralName$30,
|
6982 | defaultProperties: defaultProperties$26
|
6983 | });
|
6984 |
|
6985 | var name$31 = 'view';
|
6986 | var pluralName$31 = 'views';
|
6987 |
|
6988 | var defaultProperties$27 = ['id', 'viewable_id', 'viewable_type'];
|
6989 |
|
6990 | var view = Object.freeze({
|
6991 | name: name$31,
|
6992 | pluralName: pluralName$31,
|
6993 | defaultProperties: defaultProperties$27
|
6994 | });
|
6995 |
|
6996 |
|
6997 |
|
6998 | var entities = Object.freeze({
|
6999 | audioCategory: audioCategory,
|
7000 | audioTrack: audioTrack,
|
7001 | champion: champion,
|
7002 | cohort: cohort,
|
7003 | comment: comment,
|
7004 | directMessage: directMessage,
|
7005 | featuredContent: featuredContent,
|
7006 | feedPost: feedPost,
|
7007 | growthAction: growthAction,
|
7008 | growthRelationship: growthRelationship,
|
7009 | growthAgentPrompt: growthAgentPrompt,
|
7010 | growthAgentResponse: growthAgentResponse,
|
7011 | license: license,
|
7012 | licensedCohort: licensedCohort,
|
7013 | licensedContentItem: licensedContentItem,
|
7014 | moment: moment,
|
7015 | myGrowthAgentPrompt: myGrowthAgentPrompt,
|
7016 | myTreeReview: myTreeReview,
|
7017 | note: note,
|
7018 | post: post,
|
7019 | progressItem: progressItem,
|
7020 | review: review,
|
7021 | space: space,
|
7022 | timeline: timeline,
|
7023 | toDoItem: toDoItem,
|
7024 | toDoList: toDoList,
|
7025 | topic: topic,
|
7026 | tourTipView: tourTipView,
|
7027 | tree: treeEntity,
|
7028 | user: user,
|
7029 | userToDoList: userToDoList,
|
7030 | view: view
|
7031 | });
|
7032 |
|
7033 |
|
7034 |
|
7035 |
|
7036 |
|
7037 |
|
7038 |
|
7039 |
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 |
|
7047 |
|
7048 |
|
7049 |
|
7050 |
|
7051 |
|
7052 |
|
7053 |
|
7054 |
|
7055 |
|
7056 |
|
7057 |
|
7058 | var isArray$14 = Array.isArray || function (xs) {
|
7059 | return Object.prototype.toString.call(xs) === '[object Array]';
|
7060 | };
|
7061 | function stringifyPrimitive(v) {
|
7062 | switch (typeof v) {
|
7063 | case 'string':
|
7064 | return v;
|
7065 |
|
7066 | case 'boolean':
|
7067 | return v ? 'true' : 'false';
|
7068 |
|
7069 | case 'number':
|
7070 | return isFinite(v) ? v : '';
|
7071 |
|
7072 | default:
|
7073 | return '';
|
7074 | }
|
7075 | }
|
7076 |
|
7077 | function stringify (obj, sep, eq, name) {
|
7078 | sep = sep || '&';
|
7079 | eq = eq || '=';
|
7080 | if (obj === null) {
|
7081 | obj = undefined;
|
7082 | }
|
7083 |
|
7084 | if (typeof obj === 'object') {
|
7085 | return map$2(objectKeys(obj), function(k) {
|
7086 | var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
7087 | if (isArray$14(obj[k])) {
|
7088 | return map$2(obj[k], function(v) {
|
7089 | return ks + encodeURIComponent(stringifyPrimitive(v));
|
7090 | }).join(sep);
|
7091 | } else {
|
7092 | return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
7093 | }
|
7094 | }).join(sep);
|
7095 |
|
7096 | }
|
7097 |
|
7098 | if (!name) return '';
|
7099 | return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
7100 | encodeURIComponent(stringifyPrimitive(obj));
|
7101 | }
|
7102 |
|
7103 | function map$2 (xs, f) {
|
7104 | if (xs.map) return xs.map(f);
|
7105 | var res = [];
|
7106 | for (var i = 0; i < xs.length; i++) {
|
7107 | res.push(f(xs[i], i));
|
7108 | }
|
7109 | return res;
|
7110 | }
|
7111 |
|
7112 | var objectKeys = Object.keys || function (obj) {
|
7113 | var res = [];
|
7114 | for (var key in obj) {
|
7115 | if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
7116 | }
|
7117 | return res;
|
7118 | };
|
7119 |
|
7120 | var baseEach$2 = _baseEach;
|
7121 |
|
7122 |
|
7123 |
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 | function baseFilter$1(collection, predicate) {
|
7131 | var result = [];
|
7132 | baseEach$2(collection, function(value, index, collection) {
|
7133 | if (predicate(value, index, collection)) {
|
7134 | result.push(value);
|
7135 | }
|
7136 | });
|
7137 | return result;
|
7138 | }
|
7139 |
|
7140 | var _baseFilter = baseFilter$1;
|
7141 |
|
7142 | var arrayFilter$2 = _arrayFilter;
|
7143 | var baseFilter = _baseFilter;
|
7144 | var baseIteratee$2 = _baseIteratee;
|
7145 | var isArray$15 = isArray_1;
|
7146 |
|
7147 |
|
7148 |
|
7149 |
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 |
|
7161 |
|
7162 |
|
7163 |
|
7164 |
|
7165 |
|
7166 |
|
7167 |
|
7168 |
|
7169 |
|
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 |
|
7178 |
|
7179 |
|
7180 |
|
7181 |
|
7182 |
|
7183 |
|
7184 | function filter(collection, predicate) {
|
7185 | var func = isArray$15(collection) ? arrayFilter$2 : baseFilter;
|
7186 | return func(collection, baseIteratee$2(predicate, 3));
|
7187 | }
|
7188 |
|
7189 | var filter_1 = filter;
|
7190 |
|
7191 | var entitySrc = 'entities';
|
7192 |
|
7193 | function entityIsUndefinedError(entityName) {
|
7194 | var filename = entityNameToFilename(entityName);
|
7195 | return new Error('The ' + entityName + ' entity is undefined. Ensure ' + entitySrc + '/' + filename + ' exists and is exported by ' + entitySrc + '/_catalog.js');
|
7196 | }
|
7197 |
|
7198 | function entityMustExportError(entityName, property) {
|
7199 | var filename = entityNameToFilename(entityName);
|
7200 | return new Error(entitySrc + '/' + filename + ' must export ' + property);
|
7201 | }
|
7202 |
|
7203 | function optionsMustHaveError(property) {
|
7204 | return new Error('options.' + property + ' is required');
|
7205 | }
|
7206 |
|
7207 | function entityExports(entity, property) {
|
7208 | return !isNil_1(entity[property]);
|
7209 | }
|
7210 |
|
7211 |
|
7212 |
|
7213 | function optionsHas(options, property) {
|
7214 | return !isNil_1(get_1(options, property));
|
7215 | }
|
7216 |
|
7217 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7218 |
|
7219 | function getOne$1(entityName, entity) {
|
7220 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7221 |
|
7222 | if (!entityExports(entity, 'pluralName')) {
|
7223 | return entityMustExportError(entityName, 'pluralName');
|
7224 | }
|
7225 |
|
7226 | if (!entityExports(entity, 'defaultProperties')) {
|
7227 | return entityMustExportError(entityName, 'defaultProperties');
|
7228 | }
|
7229 |
|
7230 | if (!optionsHas(options, 'id')) {
|
7231 | return optionsMustHaveError('id');
|
7232 | }
|
7233 |
|
7234 | var properties = buildProperties(entity.defaultProperties, options);
|
7235 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7236 |
|
7237 | var paths = map_1(properties, function (property) {
|
7238 | var propertyPath = index(property);
|
7239 | var path = concat_1([rootLeaf, options.id], propertyPath);
|
7240 |
|
7241 | return path;
|
7242 | });
|
7243 |
|
7244 | return paths;
|
7245 | }
|
7246 |
|
7247 | function extractOne$1(entity) {
|
7248 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7249 | var jsonGraph = arguments[2];
|
7250 |
|
7251 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7252 | var extractedEntity = jsonGraph.json[rootLeaf][options.id];
|
7253 |
|
7254 | return extractedEntity;
|
7255 | }
|
7256 |
|
7257 | function getMany$3(entityName, entity) {
|
7258 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7259 |
|
7260 | if (!entityExports(entity, 'name')) {
|
7261 | return entityMustExportError(entityName, 'name');
|
7262 | }
|
7263 |
|
7264 | if (!entityExports(entity, 'pluralName')) {
|
7265 | return entityMustExportError(entityName, 'pluralName');
|
7266 | }
|
7267 |
|
7268 | if (!entityExports(entity, 'defaultProperties')) {
|
7269 | return entityMustExportError(entityName, 'defaultProperties');
|
7270 | }
|
7271 |
|
7272 | var _buildPaging = buildPaging(options),
|
7273 | from = _buildPaging.from,
|
7274 | to = _buildPaging.to;
|
7275 |
|
7276 | var properties = buildProperties(entity.defaultProperties, options);
|
7277 |
|
7278 | var parentEntity = void 0,
|
7279 | parentOptions = void 0;
|
7280 | if (!isNil_1(options.parent)) {
|
7281 | var parentEntityName = head_1(keys_1(options.parent));
|
7282 | parentEntity = entities[parentEntityName];
|
7283 | parentOptions = options.parent[parentEntityName];
|
7284 | }
|
7285 |
|
7286 | var basePath = void 0;
|
7287 | if (parentEntity) {
|
7288 | var rootLeaf = entityToFalcorRootLeaf(parentEntity);
|
7289 | var listLeaf = entityToFalcorListLeaf(entity);
|
7290 |
|
7291 | basePath = [rootLeaf, parentOptions.id, listLeaf];
|
7292 | } else {
|
7293 | var _listLeaf = entityToFalcorListLeaf(entity);
|
7294 |
|
7295 | basePath = [_listLeaf];
|
7296 | }
|
7297 |
|
7298 | if (optionsHasQuery(options)) {
|
7299 | var qs = stringify(options.query);
|
7300 | basePath = concat_1(basePath, qs);
|
7301 | }
|
7302 |
|
7303 | basePath = concat_1(basePath, { from: from, to: to });
|
7304 |
|
7305 | var paths = map_1(properties, function (property) {
|
7306 | var propertyPath = index(property);
|
7307 | var path = concat_1(basePath, propertyPath);
|
7308 |
|
7309 | return path;
|
7310 | });
|
7311 |
|
7312 | return paths;
|
7313 | }
|
7314 |
|
7315 | function extractMany$3(entity) {
|
7316 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7317 | var jsonGraph = arguments[2];
|
7318 |
|
7319 | var parentEntity = void 0,
|
7320 | parentOptions = void 0;
|
7321 | if (!isNil_1(options.parent)) {
|
7322 | var parentEntityName = head_1(keys_1(options.parent));
|
7323 | parentEntity = entities[parentEntityName];
|
7324 | parentOptions = options.parent[parentEntityName];
|
7325 | }
|
7326 |
|
7327 | var entityList = void 0;
|
7328 | if (parentEntity) {
|
7329 | var parentRootLeaf = entityToFalcorRootLeaf(parentEntity);
|
7330 | var entityListLeaf = entityToFalcorListLeaf(entity);
|
7331 |
|
7332 | entityList = jsonGraph.json[parentRootLeaf][parentOptions.id][entityListLeaf];
|
7333 | } else {
|
7334 | var listLeaf = entityToFalcorListLeaf(entity);
|
7335 |
|
7336 | entityList = jsonGraph.json[listLeaf];
|
7337 | }
|
7338 |
|
7339 | if (optionsHasQuery(options)) {
|
7340 | var qs = stringify(options.query);
|
7341 | entityList = entityList[qs];
|
7342 | }
|
7343 |
|
7344 | var extractedEntities = map_1(entityList, function (entity) {
|
7345 | return entity;
|
7346 | });
|
7347 |
|
7348 | return extractedEntities;
|
7349 | }
|
7350 |
|
7351 | function getMy(entityName, entity) {
|
7352 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7353 |
|
7354 | if (!entityExports(entity, 'name')) {
|
7355 | return entityMustExportError(entityName, 'name');
|
7356 | }
|
7357 |
|
7358 | if (!entityExports(entity, 'defaultProperties')) {
|
7359 | return entityMustExportError(entityName, 'defaultProperties');
|
7360 | }
|
7361 |
|
7362 | var _buildPaging2 = buildPaging(options),
|
7363 | from = _buildPaging2.from,
|
7364 | to = _buildPaging2.to;
|
7365 |
|
7366 | var properties = buildProperties(entity.defaultProperties, options);
|
7367 | var listLeaf = entityToFalcorMyListLeaf(entity);
|
7368 | var basePath = [MY_PATH_KEYWORD, listLeaf];
|
7369 |
|
7370 | if (optionsHasQuery(options)) {
|
7371 | var qs = stringify(options.query);
|
7372 | basePath = concat_1(basePath, qs);
|
7373 | }
|
7374 |
|
7375 | basePath = concat_1(basePath, { from: from, to: to });
|
7376 |
|
7377 | var paths = map_1(properties, function (property) {
|
7378 | var propertyPath = index(property);
|
7379 | var path = concat_1(basePath, propertyPath);
|
7380 |
|
7381 | return path;
|
7382 | });
|
7383 |
|
7384 | return paths;
|
7385 | }
|
7386 |
|
7387 | function extractMy(entity) {
|
7388 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7389 | var jsonGraph = arguments[2];
|
7390 |
|
7391 | var listLeaf = entityToFalcorMyListLeaf(entity);
|
7392 | var entityList = jsonGraph.json[MY_PATH_KEYWORD][listLeaf];
|
7393 |
|
7394 | if (optionsHasQuery(options)) {
|
7395 | var qs = stringify(options.query);
|
7396 | entityList = entityList[qs];
|
7397 | }
|
7398 |
|
7399 | var extractedEntities = map_1(entityList, function (entity) {
|
7400 | return entity;
|
7401 | });
|
7402 |
|
7403 | return extractedEntities;
|
7404 | }
|
7405 |
|
7406 | function getMemberships(entityName, entity) {
|
7407 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7408 |
|
7409 | if (!entityExports(entity, 'name')) {
|
7410 | return entityMustExportError(entityName, 'name');
|
7411 | }
|
7412 |
|
7413 | if (!entityExports(entity, 'defaultProperties')) {
|
7414 | return entityMustExportError(entityName, 'defaultProperties');
|
7415 | }
|
7416 |
|
7417 | var _buildPaging3 = buildPaging(options),
|
7418 | from = _buildPaging3.from,
|
7419 | to = _buildPaging3.to;
|
7420 |
|
7421 | var properties = buildProperties(entity.defaultProperties, options);
|
7422 | var listLeaf = entityToFalcorMembershipsListLeaf(entity);
|
7423 | var basePath = [MY_PATH_KEYWORD, listLeaf];
|
7424 |
|
7425 | basePath = concat_1(basePath, { from: from, to: to });
|
7426 |
|
7427 | var paths = map_1(properties, function (property) {
|
7428 | var propertyPath = index(property);
|
7429 | var path = concat_1(basePath, propertyPath);
|
7430 |
|
7431 | return path;
|
7432 | });
|
7433 |
|
7434 | return paths;
|
7435 | }
|
7436 |
|
7437 | function extractMemberships(entity) {
|
7438 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7439 | var jsonGraph = arguments[2];
|
7440 |
|
7441 | var listLeaf = entityToFalcorMembershipsListLeaf(entity);
|
7442 | var entityList = jsonGraph.json[MY_PATH_KEYWORD][listLeaf];
|
7443 |
|
7444 | if (optionsHasQuery(options)) {
|
7445 | var qs = stringify(options.query);
|
7446 | entityList = entityList[qs];
|
7447 | }
|
7448 |
|
7449 | var extractedEntities = map_1(entityList, function (entity) {
|
7450 | return entity;
|
7451 | });
|
7452 |
|
7453 | return extractedEntities;
|
7454 | }
|
7455 |
|
7456 | function create(entityName, entity) {
|
7457 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7458 |
|
7459 | if (!entityExports(entity, 'name')) {
|
7460 | return entityMustExportError(entityName, 'name');
|
7461 | }
|
7462 |
|
7463 | if (!entityExports(entity, 'pluralName')) {
|
7464 | return entityMustExportError(entityName, 'pluralName');
|
7465 | }
|
7466 |
|
7467 | if (!optionsHas(options, entityName)) {
|
7468 | return optionsMustHaveError(entityName);
|
7469 | }
|
7470 |
|
7471 | var parentEntity = void 0,
|
7472 | parentOptions = void 0;
|
7473 | if (!isNil_1(options.parent)) {
|
7474 | var parentEntityName = head_1(keys_1(options.parent));
|
7475 | parentEntity = entities[parentEntityName];
|
7476 | parentOptions = options.parent[parentEntityName];
|
7477 |
|
7478 | if (isNil_1(parentEntity)) {
|
7479 | return entityIsUndefinedError(parentEntityName);
|
7480 | }
|
7481 |
|
7482 | if (!entityExports(parentEntity, 'pluralName')) {
|
7483 | return entityMustExportError(parentEntityName, 'pluralName');
|
7484 | }
|
7485 |
|
7486 | if (!optionsHas(parentOptions, 'id')) {
|
7487 | return optionsMustHaveError('parent.' + parentEntityName + '.id');
|
7488 | }
|
7489 | }
|
7490 |
|
7491 | var path = void 0;
|
7492 | if (parentEntity) {
|
7493 | var rootLeaf = entityToFalcorRootLeaf(parentEntity);
|
7494 | var listLeaf = entityToFalcorListLeaf(entity);
|
7495 |
|
7496 | path = [rootLeaf, parentOptions.id, listLeaf, 'add'];
|
7497 | } else {
|
7498 | var _rootLeaf = entityToFalcorRootLeaf(entity);
|
7499 |
|
7500 | path = [_rootLeaf, 'create'];
|
7501 | }
|
7502 |
|
7503 | var envelopeKey = entityToAPIEnvelopeKey(entity);
|
7504 | var args = [_defineProperty({}, envelopeKey, options[entity.name])];
|
7505 |
|
7506 | return { path: path, args: args };
|
7507 | }
|
7508 |
|
7509 | function extractCreated(entity) {
|
7510 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7511 | var jsonGraph = arguments[2];
|
7512 |
|
7513 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7514 | var entities = jsonGraph.json[rootLeaf];
|
7515 | var first = head_1(keys_1(entities));
|
7516 | var extractedEntity = entities[first];
|
7517 |
|
7518 | return extractedEntity;
|
7519 | }
|
7520 |
|
7521 | function invalidateAfterCreate$1(entity) {
|
7522 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7523 |
|
7524 | if (!isNil_1(options.parent)) {
|
7525 | var parentEntityName = head_1(keys_1(options.parent));
|
7526 | var parentEntity = entities[parentEntityName];
|
7527 | var parentId = options.parent[parentEntityName].id;
|
7528 |
|
7529 | var rootLeaf = entityToFalcorRootLeaf(parentEntity);
|
7530 | var listLeaf = entityToFalcorListLeaf(entity);
|
7531 |
|
7532 | var paths = [[rootLeaf, parentId, listLeaf], [rootLeaf, parentId, listLeaf, 'length']];
|
7533 |
|
7534 | return paths;
|
7535 | }
|
7536 | }
|
7537 |
|
7538 | function update(entityName, entity) {
|
7539 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7540 |
|
7541 | if (!entityExports(entity, 'pluralName')) {
|
7542 | return entityMustExportError(entityName, 'pluralName');
|
7543 | }
|
7544 |
|
7545 | if (!optionsHas(options, 'id')) {
|
7546 | return optionsMustHaveError('id');
|
7547 | }
|
7548 |
|
7549 | if (keys_1(options).length === 1) {
|
7550 | return new Error('options must include at least one property to update');
|
7551 | }
|
7552 |
|
7553 | var properties = filter_1(keys_1(options), function (key) {
|
7554 | return key !== 'id';
|
7555 | });
|
7556 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7557 |
|
7558 | var paths = map_1(properties, function (property) {
|
7559 | var path = {
|
7560 | path: [rootLeaf, options.id, property],
|
7561 | value: options[property]
|
7562 | };
|
7563 |
|
7564 | return path;
|
7565 | });
|
7566 |
|
7567 | return paths;
|
7568 | }
|
7569 |
|
7570 | function extractUpdated(entity) {
|
7571 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7572 | var jsonGraph = arguments[2];
|
7573 |
|
7574 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7575 | var updatedProperties = jsonGraph.json[rootLeaf][options.id];
|
7576 |
|
7577 | return updatedProperties;
|
7578 | }
|
7579 |
|
7580 | function destroy(entityName, entity) {
|
7581 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
7582 |
|
7583 | if (!entityExports(entity, 'pluralName')) {
|
7584 | return entityMustExportError(entityName, 'pluralName');
|
7585 | }
|
7586 |
|
7587 | if (!optionsHas(options, 'id')) {
|
7588 | return optionsMustHaveError('id');
|
7589 | }
|
7590 |
|
7591 | var rootLeaf = entityToFalcorRootLeaf(entity);
|
7592 | var destroyPath = [rootLeaf, options.id, 'delete'];
|
7593 |
|
7594 | return destroyPath;
|
7595 | }
|
7596 |
|
7597 | function invalidateAfterDestroy$1(entity) {
|
7598 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
7599 |
|
7600 | var rootEntityLeaf = entityToFalcorRootLeaf(entity);
|
7601 | var entityId = options.id;
|
7602 |
|
7603 | var paths = [[rootEntityLeaf, entityId]];
|
7604 |
|
7605 | if (!isNil_1(options.parent)) {
|
7606 | var parentEntityName = head_1(keys_1(options.parent));
|
7607 | var parentEntity = entities[parentEntityName];
|
7608 | var parentId = options.parent[parentEntityName].id;
|
7609 |
|
7610 | var rootParentLeaf = entityToFalcorRootLeaf(parentEntity);
|
7611 | var listLeaf = entityToFalcorListLeaf(entity);
|
7612 |
|
7613 | paths.push([rootParentLeaf, parentId, listLeaf], [rootParentLeaf, parentId, listLeaf, 'length']);
|
7614 | }
|
7615 |
|
7616 | return paths;
|
7617 | }
|
7618 |
|
7619 |
|
7620 |
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 | function arrayEach$1(array, iteratee) {
|
7629 | var index = -1,
|
7630 | length = array == null ? 0 : array.length;
|
7631 |
|
7632 | while (++index < length) {
|
7633 | if (iteratee(array[index], index, array) === false) {
|
7634 | break;
|
7635 | }
|
7636 | }
|
7637 | return array;
|
7638 | }
|
7639 |
|
7640 | var _arrayEach = arrayEach$1;
|
7641 |
|
7642 | var identity$2 = identity_1;
|
7643 |
|
7644 |
|
7645 |
|
7646 |
|
7647 |
|
7648 |
|
7649 |
|
7650 |
|
7651 | function castFunction$1(value) {
|
7652 | return typeof value == 'function' ? value : identity$2;
|
7653 | }
|
7654 |
|
7655 | var _castFunction = castFunction$1;
|
7656 |
|
7657 | var arrayEach = _arrayEach;
|
7658 | var baseEach$3 = _baseEach;
|
7659 | var castFunction = _castFunction;
|
7660 | var isArray$16 = isArray_1;
|
7661 |
|
7662 |
|
7663 |
|
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 |
|
7669 |
|
7670 |
|
7671 |
|
7672 |
|
7673 |
|
7674 |
|
7675 |
|
7676 |
|
7677 |
|
7678 |
|
7679 |
|
7680 |
|
7681 |
|
7682 |
|
7683 |
|
7684 |
|
7685 |
|
7686 |
|
7687 |
|
7688 |
|
7689 |
|
7690 |
|
7691 |
|
7692 | function forEach(collection, iteratee) {
|
7693 | var func = isArray$16(collection) ? arrayEach : baseEach$3;
|
7694 | return func(collection, castFunction(iteratee));
|
7695 | }
|
7696 |
|
7697 | var forEach_1 = forEach;
|
7698 |
|
7699 | var overArg$2 = _overArg;
|
7700 |
|
7701 |
|
7702 | var getPrototype$1 = overArg$2(Object.getPrototypeOf, Object);
|
7703 |
|
7704 | var _getPrototype = getPrototype$1;
|
7705 |
|
7706 | var baseGetTag$7 = _baseGetTag;
|
7707 | var getPrototype = _getPrototype;
|
7708 | var isObjectLike$7 = isObjectLike_1;
|
7709 |
|
7710 |
|
7711 | var objectTag$3 = '[object Object]';
|
7712 |
|
7713 |
|
7714 | var funcProto$2 = Function.prototype;
|
7715 | var objectProto$13 = Object.prototype;
|
7716 |
|
7717 |
|
7718 | var funcToString$2 = funcProto$2.toString;
|
7719 |
|
7720 |
|
7721 | var hasOwnProperty$11 = objectProto$13.hasOwnProperty;
|
7722 |
|
7723 |
|
7724 | var objectCtorString = funcToString$2.call(Object);
|
7725 |
|
7726 |
|
7727 |
|
7728 |
|
7729 |
|
7730 |
|
7731 |
|
7732 |
|
7733 |
|
7734 |
|
7735 |
|
7736 |
|
7737 |
|
7738 |
|
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 |
|
7745 |
|
7746 |
|
7747 |
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 | function isPlainObject$1(value) {
|
7755 | if (!isObjectLike$7(value) || baseGetTag$7(value) != objectTag$3) {
|
7756 | return false;
|
7757 | }
|
7758 | var proto = getPrototype(value);
|
7759 | if (proto === null) {
|
7760 | return true;
|
7761 | }
|
7762 | var Ctor = hasOwnProperty$11.call(proto, 'constructor') && proto.constructor;
|
7763 | return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
7764 | funcToString$2.call(Ctor) == objectCtorString;
|
7765 | }
|
7766 |
|
7767 | var isPlainObject_1 = isPlainObject$1;
|
7768 |
|
7769 | var baseGetTag$6 = _baseGetTag;
|
7770 | var isObjectLike$6 = isObjectLike_1;
|
7771 | var isPlainObject = isPlainObject_1;
|
7772 |
|
7773 |
|
7774 | var domExcTag = '[object DOMException]';
|
7775 | var errorTag$2 = '[object Error]';
|
7776 |
|
7777 |
|
7778 |
|
7779 |
|
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 |
|
7785 |
|
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 |
|
7791 |
|
7792 |
|
7793 |
|
7794 |
|
7795 | function isError(value) {
|
7796 | if (!isObjectLike$6(value)) {
|
7797 | return false;
|
7798 | }
|
7799 | var tag = baseGetTag$6(value);
|
7800 | return tag == errorTag$2 || tag == domExcTag ||
|
7801 | (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
7802 | }
|
7803 |
|
7804 | var isError_1 = isError;
|
7805 |
|
7806 |
|
7807 |
|
7808 |
|
7809 |
|
7810 |
|
7811 |
|
7812 |
|
7813 |
|
7814 |
|
7815 |
|
7816 |
|
7817 |
|
7818 |
|
7819 |
|
7820 | function last(array) {
|
7821 | var length = array == null ? 0 : array.length;
|
7822 | return length ? array[length - 1] : undefined;
|
7823 | }
|
7824 |
|
7825 | var last_1 = last;
|
7826 |
|
7827 | var isIndex$3 = _isIndex;
|
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 |
|
7833 |
|
7834 |
|
7835 |
|
7836 |
|
7837 | function baseNth$1(array, n) {
|
7838 | var length = array.length;
|
7839 | if (!length) {
|
7840 | return;
|
7841 | }
|
7842 | n += n < 0 ? length : 0;
|
7843 | return isIndex$3(n, length) ? array[n] : undefined;
|
7844 | }
|
7845 |
|
7846 | var _baseNth = baseNth$1;
|
7847 |
|
7848 | var isObject$4 = isObject_1;
|
7849 | var isSymbol$4 = isSymbol_1;
|
7850 |
|
7851 |
|
7852 | var NAN = 0 / 0;
|
7853 |
|
7854 |
|
7855 | var reTrim = /^\s+|\s+$/g;
|
7856 |
|
7857 |
|
7858 | var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
7859 |
|
7860 |
|
7861 | var reIsBinary = /^0b[01]+$/i;
|
7862 |
|
7863 |
|
7864 | var reIsOctal = /^0o[0-7]+$/i;
|
7865 |
|
7866 |
|
7867 | var freeParseInt = parseInt;
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 |
|
7882 |
|
7883 |
|
7884 |
|
7885 |
|
7886 |
|
7887 |
|
7888 |
|
7889 |
|
7890 |
|
7891 |
|
7892 | function toNumber$1(value) {
|
7893 | if (typeof value == 'number') {
|
7894 | return value;
|
7895 | }
|
7896 | if (isSymbol$4(value)) {
|
7897 | return NAN;
|
7898 | }
|
7899 | if (isObject$4(value)) {
|
7900 | var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
7901 | value = isObject$4(other) ? (other + '') : other;
|
7902 | }
|
7903 | if (typeof value != 'string') {
|
7904 | return value === 0 ? value : +value;
|
7905 | }
|
7906 | value = value.replace(reTrim, '');
|
7907 | var isBinary = reIsBinary.test(value);
|
7908 | return (isBinary || reIsOctal.test(value))
|
7909 | ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
7910 | : (reIsBadHex.test(value) ? NAN : +value);
|
7911 | }
|
7912 |
|
7913 | var toNumber_1 = toNumber$1;
|
7914 |
|
7915 | var toNumber = toNumber_1;
|
7916 |
|
7917 |
|
7918 | var INFINITY$3 = 1 / 0;
|
7919 | var MAX_INTEGER = 1.7976931348623157e+308;
|
7920 |
|
7921 |
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 | function toFinite$1(value) {
|
7945 | if (!value) {
|
7946 | return value === 0 ? value : 0;
|
7947 | }
|
7948 | value = toNumber(value);
|
7949 | if (value === INFINITY$3 || value === -INFINITY$3) {
|
7950 | var sign = (value < 0 ? -1 : 1);
|
7951 | return sign * MAX_INTEGER;
|
7952 | }
|
7953 | return value === value ? value : 0;
|
7954 | }
|
7955 |
|
7956 | var toFinite_1 = toFinite$1;
|
7957 |
|
7958 | var toFinite = toFinite_1;
|
7959 |
|
7960 |
|
7961 |
|
7962 |
|
7963 |
|
7964 |
|
7965 |
|
7966 |
|
7967 |
|
7968 |
|
7969 |
|
7970 |
|
7971 |
|
7972 |
|
7973 |
|
7974 |
|
7975 |
|
7976 |
|
7977 |
|
7978 |
|
7979 |
|
7980 |
|
7981 |
|
7982 |
|
7983 |
|
7984 |
|
7985 |
|
7986 | function toInteger$1(value) {
|
7987 | var result = toFinite(value),
|
7988 | remainder = result % 1;
|
7989 |
|
7990 | return result === result ? (remainder ? result - remainder : result) : 0;
|
7991 | }
|
7992 |
|
7993 | var toInteger_1 = toInteger$1;
|
7994 |
|
7995 | var baseNth = _baseNth;
|
7996 | var toInteger = toInteger_1;
|
7997 |
|
7998 |
|
7999 |
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 |
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 | function nth(array, n) {
|
8020 | return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
8021 | }
|
8022 |
|
8023 | var nth_1 = nth;
|
8024 |
|
8025 | var baseEach$4 = _baseEach;
|
8026 |
|
8027 |
|
8028 |
|
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 | function baseSome$1(collection, predicate) {
|
8037 | var result;
|
8038 |
|
8039 | baseEach$4(collection, function(value, index, collection) {
|
8040 | result = predicate(value, index, collection);
|
8041 | return !result;
|
8042 | });
|
8043 | return !!result;
|
8044 | }
|
8045 |
|
8046 | var _baseSome = baseSome$1;
|
8047 |
|
8048 | var eq$3 = eq_1;
|
8049 | var isArrayLike$5 = isArrayLike_1;
|
8050 | var isIndex$4 = _isIndex;
|
8051 | var isObject$5 = isObject_1;
|
8052 |
|
8053 |
|
8054 |
|
8055 |
|
8056 |
|
8057 |
|
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 | function isIterateeCall$1(value, index, object) {
|
8064 | if (!isObject$5(object)) {
|
8065 | return false;
|
8066 | }
|
8067 | var type = typeof index;
|
8068 | if (type == 'number'
|
8069 | ? (isArrayLike$5(object) && isIndex$4(index, object.length))
|
8070 | : (type == 'string' && index in object)
|
8071 | ) {
|
8072 | return eq$3(object[index], value);
|
8073 | }
|
8074 | return false;
|
8075 | }
|
8076 |
|
8077 | var _isIterateeCall = isIterateeCall$1;
|
8078 |
|
8079 | var arraySome$2 = _arraySome;
|
8080 | var baseIteratee$3 = _baseIteratee;
|
8081 | var baseSome = _baseSome;
|
8082 | var isArray$17 = isArray_1;
|
8083 | var isIterateeCall = _isIterateeCall;
|
8084 |
|
8085 |
|
8086 |
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 |
|
8095 |
|
8096 |
|
8097 |
|
8098 |
|
8099 |
|
8100 |
|
8101 |
|
8102 |
|
8103 |
|
8104 |
|
8105 |
|
8106 |
|
8107 |
|
8108 |
|
8109 |
|
8110 |
|
8111 |
|
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 |
|
8117 |
|
8118 |
|
8119 |
|
8120 |
|
8121 | function some(collection, predicate, guard) {
|
8122 | var func = isArray$17(collection) ? arraySome$2 : baseSome;
|
8123 | if (guard && isIterateeCall(collection, predicate, guard)) {
|
8124 | predicate = undefined;
|
8125 | }
|
8126 | return func(collection, baseIteratee$3(predicate, 3));
|
8127 | }
|
8128 |
|
8129 | var some_1 = some;
|
8130 |
|
8131 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
8132 |
|
8133 | function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
8134 |
|
8135 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8136 |
|
8137 | es6Promise.polyfill();
|
8138 |
|
8139 | var SuperGloo = function () {
|
8140 | function SuperGloo() {
|
8141 | var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
8142 |
|
8143 | _classCallCheck(this, SuperGloo);
|
8144 |
|
8145 | var requiredProperties = ['falcorModel'];
|
8146 |
|
8147 | if (some_1(requiredProperties, function (_) {
|
8148 | return isNil_1(get_1(config, _));
|
8149 | })) {
|
8150 | throw new Error('One of the following required config parameters is undefined: ' + requiredProperties.join(', '));
|
8151 | }
|
8152 |
|
8153 | this.falcor = config.falcorModel;
|
8154 | }
|
8155 |
|
8156 | |
8157 |
|
8158 |
|
8159 |
|
8160 | _createClass(SuperGloo, [{
|
8161 | key: 'setModel',
|
8162 | value: function setModel(model) {
|
8163 | if (isNil_1(model)) {
|
8164 | throw new Error('When setting the model, the model cannot be null or undefined');
|
8165 | }
|
8166 |
|
8167 | this.falcor = model;
|
8168 | }
|
8169 | }, {
|
8170 | key: 'getOne',
|
8171 | value: function getOne$$1(entityName) {
|
8172 | var _falcor;
|
8173 |
|
8174 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8175 |
|
8176 | var entity = entities[entityName];
|
8177 |
|
8178 | if (isNil_1(entity)) {
|
8179 | return Promise.reject(entityIsUndefinedError(entityName));
|
8180 | }
|
8181 |
|
8182 | var paths = isFunction_1(entity.getOne) ? entity.getOne(options) : getOne$1(entityName, entity, options);
|
8183 |
|
8184 | if (isError_1(paths)) {
|
8185 | return Promise.reject(paths);
|
8186 | }
|
8187 |
|
8188 | return (_falcor = this.falcor).get.apply(_falcor, _toConsumableArray(paths)).then(function (jsonGraph) {
|
8189 | var extractedEntity = void 0;
|
8190 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8191 | extractedEntity = null;
|
8192 | } else {
|
8193 | extractedEntity = isFunction_1(entity.extractOne) ? entity.extractOne(options, jsonGraph) : extractOne$1(entity, options, jsonGraph);
|
8194 | }
|
8195 |
|
8196 | return extractedEntity;
|
8197 | }).catch(function (response) {
|
8198 | var message = buildGetOneErrorMessage(response);
|
8199 | return Promise.reject(new Error(message));
|
8200 | });
|
8201 | }
|
8202 | }, {
|
8203 | key: 'getMany',
|
8204 | value: function getMany$$1(entityName) {
|
8205 | var _falcor2;
|
8206 |
|
8207 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8208 |
|
8209 | var entity = entities[entityName];
|
8210 |
|
8211 | if (isNil_1(entity)) {
|
8212 | return Promise.reject(entityIsUndefinedError(entityName));
|
8213 | }
|
8214 |
|
8215 | var paths = isFunction_1(entity.getMany) ? entity.getMany(options) : getMany$3(entityName, entity, options);
|
8216 |
|
8217 | if (isError_1(paths)) {
|
8218 | return Promise.reject(paths);
|
8219 | }
|
8220 |
|
8221 | return (_falcor2 = this.falcor).get.apply(_falcor2, _toConsumableArray(paths)).then(function (jsonGraph) {
|
8222 | var extractedEntities = void 0;
|
8223 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8224 | extractedEntities = null;
|
8225 | } else {
|
8226 | extractedEntities = isFunction_1(entity.extractMany) ? entity.extractMany(options, jsonGraph) : extractMany$3(entity, options, jsonGraph);
|
8227 | }
|
8228 |
|
8229 | return extractedEntities;
|
8230 | }).catch(function (response) {
|
8231 | var message = buildGetManyErrorMessage(response);
|
8232 | return Promise.reject(new Error(message));
|
8233 | });
|
8234 | }
|
8235 | }, {
|
8236 | key: 'getMy',
|
8237 | value: function getMy$$1(entityName) {
|
8238 | var _falcor3;
|
8239 |
|
8240 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8241 |
|
8242 | var entity = entities[entityName];
|
8243 |
|
8244 | if (isNil_1(entity)) {
|
8245 | return Promise.reject(entityIsUndefinedError(entityName));
|
8246 | }
|
8247 |
|
8248 | var paths = isFunction_1(entity.getMy) ? entity.getMy(options) : getMy(entityName, entity, options);
|
8249 |
|
8250 | if (isError_1(paths)) {
|
8251 | return Promise.reject(paths);
|
8252 | }
|
8253 |
|
8254 | return (_falcor3 = this.falcor).get.apply(_falcor3, _toConsumableArray(paths)).then(function (jsonGraph) {
|
8255 | var extractedEntities = void 0;
|
8256 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8257 | extractedEntities = null;
|
8258 | } else {
|
8259 | extractedEntities = isFunction_1(entity.extractMy) ? entity.extractMy(options, jsonGraph) : extractMy(entity, options, jsonGraph);
|
8260 | }
|
8261 |
|
8262 | return extractedEntities;
|
8263 | }).catch(function (response) {
|
8264 | var message = buildGetMyErrorMessage(response);
|
8265 | return Promise.reject(new Error(message));
|
8266 | });
|
8267 | }
|
8268 | }, {
|
8269 | key: 'getMemberships',
|
8270 | value: function getMemberships$$1(entityName) {
|
8271 | var _falcor4;
|
8272 |
|
8273 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8274 |
|
8275 | var entity = entities[entityName];
|
8276 |
|
8277 | if (isNil_1(entity)) {
|
8278 | return Promise.reject(entityIsUndefinedError(entityName));
|
8279 | }
|
8280 |
|
8281 | var paths = isFunction_1(entity.getMemberships) ? entity.getMemberships(options) : getMemberships(entityName, entity, options);
|
8282 |
|
8283 | if (isError_1(paths)) {
|
8284 | return Promise.reject(paths);
|
8285 | }
|
8286 |
|
8287 | return (_falcor4 = this.falcor).get.apply(_falcor4, _toConsumableArray(paths)).then(function (jsonGraph) {
|
8288 | var extractedEntities = void 0;
|
8289 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8290 | extractedEntities = null;
|
8291 | } else {
|
8292 | extractedEntities = isFunction_1(entity.extractMemberships) ? entity.extractMemberships(options, jsonGraph) : extractMemberships(entity, options, jsonGraph);
|
8293 | }
|
8294 |
|
8295 | return extractedEntities;
|
8296 | }).catch(function (response) {
|
8297 | var message = buildGetMembershipsErrorMessage(response);
|
8298 | return Promise.reject(new Error(message));
|
8299 | });
|
8300 | }
|
8301 | }, {
|
8302 | key: 'create',
|
8303 | value: function create$$1(entityName) {
|
8304 | var _this = this;
|
8305 |
|
8306 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8307 |
|
8308 | var entity = entities[entityName];
|
8309 |
|
8310 | if (isNil_1(entity)) {
|
8311 | return Promise.reject(entityIsUndefinedError(entityName));
|
8312 | }
|
8313 |
|
8314 | var callOptions = isFunction_1(entity.create) ? entity.create(options) : create(entityName, entity, options);
|
8315 |
|
8316 | if (isError_1(callOptions)) {
|
8317 | return Promise.reject(callOptions);
|
8318 | }
|
8319 |
|
8320 | var path = callOptions.path,
|
8321 | args = callOptions.args;
|
8322 |
|
8323 |
|
8324 | return this.falcor.call(path, args).then(function (jsonGraph) {
|
8325 | var extractedEntity = void 0;
|
8326 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8327 | extractedEntity = null;
|
8328 | } else {
|
8329 | extractedEntity = isFunction_1(entity.extractCreated) ? entity.extractCreated(options, jsonGraph) : extractCreated(entity, options, jsonGraph);
|
8330 | }
|
8331 |
|
8332 | var pathsToInvalidate = isFunction_1(entity.invalidateAfterCreate) ? entity.invalidateAfterCreate(options) : invalidateAfterCreate$1(entity, options);
|
8333 |
|
8334 | if (!isEmpty_1(pathsToInvalidate)) {
|
8335 | forEach_1(pathsToInvalidate, function (path) {
|
8336 | _this.falcor.invalidate(path);
|
8337 | });
|
8338 | }
|
8339 |
|
8340 | return extractedEntity;
|
8341 | }).catch(function (response) {
|
8342 | var message = buildCreateErrorMessage(response);
|
8343 | return Promise.reject(new Error(message));
|
8344 | });
|
8345 | }
|
8346 | }, {
|
8347 | key: 'update',
|
8348 | value: function update$$1(entityName) {
|
8349 | var _falcor5;
|
8350 |
|
8351 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8352 |
|
8353 | var entity = entities[entityName];
|
8354 |
|
8355 | if (isNil_1(entity)) {
|
8356 | return Promise.reject(entityIsUndefinedError(entityName));
|
8357 | }
|
8358 |
|
8359 | var paths = isFunction_1(entity.update) ? entity.update(options) : update(entityName, entity, options);
|
8360 |
|
8361 | if (isError_1(paths)) {
|
8362 | return Promise.reject(paths);
|
8363 | }
|
8364 |
|
8365 | return (_falcor5 = this.falcor).set.apply(_falcor5, _toConsumableArray(paths)).then(function (jsonGraph) {
|
8366 | var updatedProperties = void 0;
|
8367 | if (isNil_1(get_1(jsonGraph, 'json'))) {
|
8368 | updatedProperties = null;
|
8369 | } else {
|
8370 | updatedProperties = isFunction_1(entity.extractUpdated) ? entity.extractUpdated(options, jsonGraph) : extractUpdated(entity, options, jsonGraph);
|
8371 | }
|
8372 |
|
8373 | return updatedProperties;
|
8374 | }).catch(function (response) {
|
8375 | var message = buildUpdateErrorMessage(response);
|
8376 | return Promise.reject(new Error(message));
|
8377 | });
|
8378 | }
|
8379 | }, {
|
8380 | key: 'destroy',
|
8381 | value: function destroy$$1(entityName) {
|
8382 | var _this2 = this;
|
8383 |
|
8384 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
8385 |
|
8386 | var entity = entities[entityName];
|
8387 |
|
8388 | if (isNil_1(entity)) {
|
8389 | return Promise.reject(entityIsUndefinedError(entityName));
|
8390 | }
|
8391 |
|
8392 | var destroyPath = isFunction_1(entity.destroy) ? entity.destroy(options) : destroy(entityName, entity, options);
|
8393 |
|
8394 | if (isError_1(destroyPath)) {
|
8395 | return Promise.reject(destroyPath);
|
8396 | }
|
8397 |
|
8398 | return this.falcor.call(destroyPath).then(function () {
|
8399 | var pathsToInvalidate = isFunction_1(entity.invalidateAfterDestroy) ? entity.invalidateAfterDestroy(options) : invalidateAfterDestroy$1(entity, options);
|
8400 |
|
8401 | if (!isEmpty_1(pathsToInvalidate)) {
|
8402 | forEach_1(pathsToInvalidate, function (path) {
|
8403 | _this2.falcor.invalidate(path);
|
8404 | });
|
8405 | }
|
8406 |
|
8407 | return 'Entity destroyed';
|
8408 | }).catch(function (response) {
|
8409 | var message = buildDestroyErrorMessage(response);
|
8410 | return Promise.reject(new Error(message));
|
8411 | });
|
8412 | }
|
8413 | }]);
|
8414 |
|
8415 | return SuperGloo;
|
8416 | }();
|
8417 |
|
8418 | var codeToMessageMap = {
|
8419 | 400: 'request is malformed',
|
8420 | 401: 'user is not authorized',
|
8421 | 403: 'user is forbidden',
|
8422 | 404: 'entity does not exist',
|
8423 | 422: 'entity is not valid',
|
8424 | default: 'unspecified error encountered'
|
8425 | };
|
8426 |
|
8427 | function buildGetOneErrorMessage(response) {
|
8428 | if (response instanceof Error) {
|
8429 | return response.message;
|
8430 | }
|
8431 |
|
8432 | var firstPath = response[0];
|
8433 | var entity = camelCase_1(firstPath.path[0]);
|
8434 | var entityId = firstPath.path[1];
|
8435 | var originalMessage = firstPath.value.message || firstPath.value;
|
8436 |
|
8437 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8438 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8439 |
|
8440 | var improvedMessage = codeToMessageMap[code];
|
8441 |
|
8442 | return 'Could not get ' + entity + ' ' + entityId + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8443 | }
|
8444 |
|
8445 | function buildGetManyErrorMessage(response) {
|
8446 | if (response instanceof Error) {
|
8447 | return response.message;
|
8448 | }
|
8449 |
|
8450 | var firstPath = response[0];
|
8451 | var entity = camelCase_1(firstPath.path[0]);
|
8452 | var originalMessage = firstPath.value.message || firstPath.value;
|
8453 |
|
8454 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8455 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8456 |
|
8457 | var improvedMessage = codeToMessageMap[code];
|
8458 |
|
8459 | return 'Could not get many ' + entity + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8460 | }
|
8461 |
|
8462 | function buildGetMyErrorMessage(response) {
|
8463 | if (response instanceof Error) {
|
8464 | return response.message;
|
8465 | }
|
8466 |
|
8467 | var firstPath = response[0];
|
8468 | var entity = camelCase_1(firstPath.path[0]);
|
8469 | var originalMessage = firstPath.value.message || firstPath.value;
|
8470 |
|
8471 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8472 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8473 |
|
8474 | var improvedMessage = codeToMessageMap[code];
|
8475 |
|
8476 | return 'Could not get my ' + entity + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8477 | }
|
8478 |
|
8479 | function buildGetMembershipsErrorMessage(response) {
|
8480 | if (response instanceof Error) {
|
8481 | return response.message;
|
8482 | }
|
8483 |
|
8484 | var firstPath = response[0];
|
8485 | var entity = camelCase_1(firstPath.path[0]);
|
8486 | var originalMessage = firstPath.value.message || firstPath.value;
|
8487 |
|
8488 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8489 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8490 |
|
8491 | var improvedMessage = codeToMessageMap[code];
|
8492 |
|
8493 | return 'Could not get ' + entity + ' memberships: ' + improvedMessage + ' (' + originalMessage + ')';
|
8494 | }
|
8495 |
|
8496 | function buildCreateErrorMessage(response) {
|
8497 | if (response instanceof Error) {
|
8498 | return response.message;
|
8499 | }
|
8500 |
|
8501 | var firstError = head_1(response);
|
8502 |
|
8503 | var entityName = void 0;
|
8504 | if (last_1(firstError.path) === 'add') {
|
8505 | var listLeaf = nth_1(firstError.path, -2);
|
8506 | entityName = falcorListLeafToEntityName(listLeaf);
|
8507 | } else {
|
8508 | var rootLeaf = head_1(firstError.path);
|
8509 | entityName = falcorRootLeafToEntityName(rootLeaf);
|
8510 | }
|
8511 |
|
8512 | var originalMessage = firstError.value.message || firstError.value;
|
8513 |
|
8514 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8515 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8516 |
|
8517 | var improvedMessage = codeToMessageMap[code];
|
8518 |
|
8519 | return 'Could not create a new ' + entityName + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8520 | }
|
8521 |
|
8522 | function buildUpdateErrorMessage(response) {
|
8523 | if (response instanceof Error) {
|
8524 | return response.message;
|
8525 | }
|
8526 |
|
8527 | var firstPath = response[0];
|
8528 | var entity = camelCase_1(firstPath.path[0]);
|
8529 | var entityId = firstPath.path[1];
|
8530 | var originalMessage = firstPath.value.message || firstPath.value;
|
8531 |
|
8532 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8533 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8534 |
|
8535 | var improvedMessage = codeToMessageMap[code];
|
8536 |
|
8537 | return 'Could not update ' + entity + ' ' + entityId + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8538 | }
|
8539 |
|
8540 | function buildDestroyErrorMessage(response) {
|
8541 | if (response instanceof Error) {
|
8542 | return response.message;
|
8543 | }
|
8544 |
|
8545 | var firstPath = response[0];
|
8546 | var entity = camelCase_1(firstPath.path[0]);
|
8547 | var entityId = firstPath.path[1];
|
8548 | var originalMessage = firstPath.value.message || firstPath.value;
|
8549 |
|
8550 | var match = originalMessage.match(/\b[4,5][0-9][0-9]\b/);
|
8551 | var code = !isNil_1(match) && !isNil_1(codeToMessageMap[match[0]]) ? match[0] : 'default';
|
8552 |
|
8553 | var improvedMessage = codeToMessageMap[code];
|
8554 |
|
8555 | return 'Could not destroy ' + entity + ' ' + entityId + ': ' + improvedMessage + ' (' + originalMessage + ')';
|
8556 | }
|
8557 |
|
8558 | return SuperGloo;
|
8559 |
|
8560 | })));
|