UNPKG

229 kBJavaScriptView Raw
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
7var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
9function commonjsRequire () {
10 throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
11}
12
13
14
15function createCommonjsModule(fn, module) {
16 return module = { exports: {} }, fn(module, module.exports), module.exports;
17}
18
19var es6Promise = createCommonjsModule(function (module, exports) {
20/*!
21 * @overview es6-promise - a tiny implementation of Promises/A+.
22 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
23 * @license Licensed under MIT license
24 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
25 * @version 4.1.0
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
34function objectOrFunction(x) {
35 return typeof x === 'function' || typeof x === 'object' && x !== null;
36}
37
38function isFunction(x) {
39 return typeof x === 'function';
40}
41
42var _isArray = undefined;
43if (!Array.isArray) {
44 _isArray = function (x) {
45 return Object.prototype.toString.call(x) === '[object Array]';
46 };
47} else {
48 _isArray = Array.isArray;
49}
50
51var isArray = _isArray;
52
53var len = 0;
54var vertxNext = undefined;
55var customSchedulerFn = undefined;
56
57var asap = function asap(callback, arg) {
58 queue[len] = callback;
59 queue[len + 1] = arg;
60 len += 2;
61 if (len === 2) {
62 // If len is 2, that means that we need to schedule an async flush.
63 // If additional callbacks are queued before the queue is flushed, they
64 // will be processed by this flush that we are scheduling.
65 if (customSchedulerFn) {
66 customSchedulerFn(flush);
67 } else {
68 scheduleFlush();
69 }
70 }
71};
72
73function setScheduler(scheduleFn) {
74 customSchedulerFn = scheduleFn;
75}
76
77function setAsap(asapFn) {
78 asap = asapFn;
79}
80
81var browserWindow = typeof window !== 'undefined' ? window : undefined;
82var browserGlobal = browserWindow || {};
83var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
84var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
85
86// test for web worker but not in IE10
87var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
88
89// node
90function useNextTick() {
91 // node version 0.10.x displays a deprecation warning when nextTick is used recursively
92 // see https://github.com/cujojs/when/issues/410 for details
93 return function () {
94 return process.nextTick(flush);
95 };
96}
97
98// vertx
99function useVertxTimer() {
100 if (typeof vertxNext !== 'undefined') {
101 return function () {
102 vertxNext(flush);
103 };
104 }
105
106 return useSetTimeout();
107}
108
109function 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// web worker
121function useMessageChannel() {
122 var channel = new MessageChannel();
123 channel.port1.onmessage = flush;
124 return function () {
125 return channel.port2.postMessage(0);
126 };
127}
128
129function useSetTimeout() {
130 // Store setTimeout reference so es6-promise will be unaffected by
131 // other code modifying setTimeout (like sinon.useFakeTimers())
132 var globalSetTimeout = setTimeout;
133 return function () {
134 return globalSetTimeout(flush, 1);
135 };
136}
137
138var queue = new Array(1000);
139function 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
153function 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
164var scheduleFlush = undefined;
165// Decide what async method to use to triggering processing of queued callbacks:
166if (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
178function 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 `Promise.resolve` returns a promise that will become resolved with the
207 passed `value`. It is shorthand for the following:
208
209 ```javascript
210 let promise = new Promise(function(resolve, reject){
211 resolve(1);
212 });
213
214 promise.then(function(value){
215 // value === 1
216 });
217 ```
218
219 Instead of writing the above, your code now simply becomes the following:
220
221 ```javascript
222 let promise = Promise.resolve(1);
223
224 promise.then(function(value){
225 // value === 1
226 });
227 ```
228
229 @method resolve
230 @static
231 @param {Any} value value that the returned promise will be resolved with
232 Useful for tooling.
233 @return {Promise} a promise that will become fulfilled with the given
234 `value`
235*/
236function resolve(object) {
237 /*jshint validthis:true */
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
249var PROMISE_ID = Math.random().toString(36).substring(16);
250
251function noop() {}
252
253var PENDING = void 0;
254var FULFILLED = 1;
255var REJECTED = 2;
256
257var GET_THEN_ERROR = new ErrorObject();
258
259function selfFulfillment() {
260 return new TypeError("You cannot resolve a promise with itself");
261}
262
263function cannotReturnOwn() {
264 return new TypeError('A promises callback cannot return that same promise.');
265}
266
267function 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
276function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
277 try {
278 then.call(value, fulfillmentHandler, rejectionHandler);
279 } catch (e) {
280 return e;
281 }
282}
283
284function 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
313function 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
327function 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
344function _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
354function publishRejection(promise) {
355 if (promise._onerror) {
356 promise._onerror(promise._result);
357 }
358
359 publish(promise);
360}
361
362function 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
375function _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
385function 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
400function 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
426function ErrorObject() {
427 this.error = null;
428}
429
430var TRY_CATCH_ERROR = new ErrorObject();
431
432function 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
441function 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 // noop
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
481function 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
493var id = 0;
494function nextId() {
495 return id++;
496}
497
498function makePromise(promise) {
499 promise[PROMISE_ID] = id++;
500 promise._state = undefined;
501 promise._result = undefined;
502 promise._subscribers = [];
503}
504
505function 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
534function validationError() {
535 return new Error('Array Methods must be provided an Array');
536}
537
538Enumerator.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
547Enumerator.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
573Enumerator.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
591Enumerator.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 `Promise.all` accepts an array of promises, and returns a new promise which
603 is fulfilled with an array of fulfillment values for the passed promises, or
604 rejected with the reason of the first passed promise to be rejected. It casts all
605 elements of the passed iterable to promises as it runs this algorithm.
606
607 Example:
608
609 ```javascript
610 let promise1 = resolve(1);
611 let promise2 = resolve(2);
612 let promise3 = resolve(3);
613 let promises = [ promise1, promise2, promise3 ];
614
615 Promise.all(promises).then(function(array){
616 // The array here would be [ 1, 2, 3 ];
617 });
618 ```
619
620 If any of the `promises` given to `all` are rejected, the first promise
621 that is rejected will be given as an argument to the returned promises's
622 rejection handler. For example:
623
624 Example:
625
626 ```javascript
627 let promise1 = resolve(1);
628 let promise2 = reject(new Error("2"));
629 let promise3 = reject(new Error("3"));
630 let promises = [ promise1, promise2, promise3 ];
631
632 Promise.all(promises).then(function(array){
633 // Code here never runs because there are rejected promises!
634 }, function(error) {
635 // error.message === "2"
636 });
637 ```
638
639 @method all
640 @static
641 @param {Array} entries array of promises
642 @param {String} label optional string for labeling the promise.
643 Useful for tooling.
644 @return {Promise} promise that is fulfilled when all `promises` have been
645 fulfilled, or rejected if any of them become rejected.
646 @static
647*/
648function all(entries) {
649 return new Enumerator(this, entries).promise;
650}
651
652/**
653 `Promise.race` returns a new promise which is settled in the same way as the
654 first passed promise to settle.
655
656 Example:
657
658 ```javascript
659 let promise1 = new Promise(function(resolve, reject){
660 setTimeout(function(){
661 resolve('promise 1');
662 }, 200);
663 });
664
665 let promise2 = new Promise(function(resolve, reject){
666 setTimeout(function(){
667 resolve('promise 2');
668 }, 100);
669 });
670
671 Promise.race([promise1, promise2]).then(function(result){
672 // result === 'promise 2' because it was resolved before promise1
673 // was resolved.
674 });
675 ```
676
677 `Promise.race` is deterministic in that only the state of the first
678 settled promise matters. For example, even if other promises given to the
679 `promises` array argument are resolved, but the first settled promise has
680 become rejected before the other promises became fulfilled, the returned
681 promise will become rejected:
682
683 ```javascript
684 let promise1 = new Promise(function(resolve, reject){
685 setTimeout(function(){
686 resolve('promise 1');
687 }, 200);
688 });
689
690 let promise2 = new Promise(function(resolve, reject){
691 setTimeout(function(){
692 reject(new Error('promise 2'));
693 }, 100);
694 });
695
696 Promise.race([promise1, promise2]).then(function(result){
697 // Code here never runs
698 }, function(reason){
699 // reason.message === 'promise 2' because promise 2 became rejected before
700 // promise 1 became fulfilled
701 });
702 ```
703
704 An example real-world use case is implementing timeouts:
705
706 ```javascript
707 Promise.race([ajax('foo.json'), timeout(5000)])
708 ```
709
710 @method race
711 @static
712 @param {Array} promises array of promises to observe
713 Useful for tooling.
714 @return {Promise} a promise which settles in the same way as the first passed
715 promise to settle.
716*/
717function race(entries) {
718 /*jshint validthis:true */
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 `Promise.reject` returns a promise rejected with the passed `reason`.
737 It is shorthand for the following:
738
739 ```javascript
740 let promise = new Promise(function(resolve, reject){
741 reject(new Error('WHOOPS'));
742 });
743
744 promise.then(function(value){
745 // Code here doesn't run because the promise is rejected!
746 }, function(reason){
747 // reason.message === 'WHOOPS'
748 });
749 ```
750
751 Instead of writing the above, your code now simply becomes the following:
752
753 ```javascript
754 let promise = Promise.reject(new Error('WHOOPS'));
755
756 promise.then(function(value){
757 // Code here doesn't run because the promise is rejected!
758 }, function(reason){
759 // reason.message === 'WHOOPS'
760 });
761 ```
762
763 @method reject
764 @static
765 @param {Any} reason value that the returned promise will be rejected with.
766 Useful for tooling.
767 @return {Promise} a promise rejected with the given `reason`.
768*/
769function reject(reason) {
770 /*jshint validthis:true */
771 var Constructor = this;
772 var promise = new Constructor(noop);
773 _reject(promise, reason);
774 return promise;
775}
776
777function needsResolver() {
778 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
779}
780
781function 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 Promise objects represent the eventual result of an asynchronous operation. The
787 primary way of interacting with a promise is through its `then` method, which
788 registers callbacks to receive either a promise's eventual value or the reason
789 why the promise cannot be fulfilled.
790
791 Terminology
792 -----------
793
794 - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
795 - `thenable` is an object or function that defines a `then` method.
796 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
797 - `exception` is a value that is thrown using the throw statement.
798 - `reason` is a value that indicates why a promise was rejected.
799 - `settled` the final resting state of a promise, fulfilled or rejected.
800
801 A promise can be in one of three states: pending, fulfilled, or rejected.
802
803 Promises that are fulfilled have a fulfillment value and are in the fulfilled
804 state. Promises that are rejected have a rejection reason and are in the
805 rejected state. A fulfillment value is never a thenable.
806
807 Promises can also be said to *resolve* a value. If this value is also a
808 promise, then the original promise's settled state will match the value's
809 settled state. So a promise that *resolves* a promise that rejects will
810 itself reject, and a promise that *resolves* a promise that fulfills will
811 itself fulfill.
812
813
814 Basic Usage:
815 ------------
816
817 ```js
818 let promise = new Promise(function(resolve, reject) {
819 // on success
820 resolve(value);
821
822 // on failure
823 reject(reason);
824 });
825
826 promise.then(function(value) {
827 // on fulfillment
828 }, function(reason) {
829 // on rejection
830 });
831 ```
832
833 Advanced Usage:
834 ---------------
835
836 Promises shine when abstracting away asynchronous interactions such as
837 `XMLHttpRequest`s.
838
839 ```js
840 function getJSON(url) {
841 return new Promise(function(resolve, reject){
842 let xhr = new XMLHttpRequest();
843
844 xhr.open('GET', url);
845 xhr.onreadystatechange = handler;
846 xhr.responseType = 'json';
847 xhr.setRequestHeader('Accept', 'application/json');
848 xhr.send();
849
850 function handler() {
851 if (this.readyState === this.DONE) {
852 if (this.status === 200) {
853 resolve(this.response);
854 } else {
855 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
856 }
857 }
858 };
859 });
860 }
861
862 getJSON('/posts.json').then(function(json) {
863 // on fulfillment
864 }, function(reason) {
865 // on rejection
866 });
867 ```
868
869 Unlike callbacks, promises are great composable primitives.
870
871 ```js
872 Promise.all([
873 getJSON('/posts'),
874 getJSON('/comments')
875 ]).then(function(values){
876 values[0] // => postsJSON
877 values[1] // => commentsJSON
878
879 return values;
880 });
881 ```
882
883 @class Promise
884 @param {function} resolver
885 Useful for tooling.
886 @constructor
887*/
888function 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
899Promise.all = all;
900Promise.race = race;
901Promise.resolve = resolve;
902Promise.reject = reject;
903Promise._setScheduler = setScheduler;
904Promise._setAsap = setAsap;
905Promise._asap = asap;
906
907Promise.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 // user is available
918 }, function(reason){
919 // user is unavailable, and you are given the reason why
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 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
937 // will be `'default name'`
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 // never reached
946 }, function (reason) {
947 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
948 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
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 // never reached
958 }).then(function (value) {
959 // never reached
960 }, function (reason) {
961 // The `PedgagocialException` is propagated all the way down to here
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 // The user's comments are now available
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 // If `findCommentsByAuthor` fulfills, we'll have the value here
988 }, function (reason) {
989 // If `findCommentsByAuthor` rejects, we'll have the reason here
990 });
991 ```
992
993 Simple Example
994 --------------
995
996 Synchronous Example
997
998 ```javascript
999 let result;
1000
1001 try {
1002 result = findResult();
1003 // success
1004 } catch(reason) {
1005 // failure
1006 }
1007 ```
1008
1009 Errback Example
1010
1011 ```js
1012 findResult(function(result, err){
1013 if (err) {
1014 // failure
1015 } else {
1016 // success
1017 }
1018 });
1019 ```
1020
1021 Promise Example;
1022
1023 ```javascript
1024 findResult().then(function(result){
1025 // success
1026 }, function(reason){
1027 // failure
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 // success
1043 } catch(reason) {
1044 // failure
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 // failure
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 // success
1081 }
1082 });
1083 ```
1084
1085 Promise Example;
1086
1087 ```javascript
1088 findAuthor().
1089 then(findBooksByAuthor).
1090 then(function(books){
1091 // found books
1092 }).catch(function(reason){
1093 // something went wrong
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 // synchronous
1115 try {
1116 findAuthor();
1117 } catch(reason) {
1118 // something went wrong
1119 }
1120
1121 // async with promises
1122 findAuthor().catch(function(reason){
1123 // something went wrong
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
1137function 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..
1171Promise.polyfill = polyfill;
1172Promise.Promise = Promise;
1173
1174return Promise;
1175
1176})));
1177
1178});
1179
1180var name = 'audioCategory';
1181var pluralName = 'audioCategories';
1182
1183var defaultProperties = ['id', 'name'];
1184
1185var audioCategory = Object.freeze({
1186 name: name,
1187 pluralName: pluralName,
1188 defaultProperties: defaultProperties
1189});
1190
1191var name$1 = 'audioTrack';
1192var pluralName$1 = 'audioTracks';
1193
1194var defaultProperties$1 = ['id', 'name', 'author', 'duration', 'src'];
1195
1196var audioTrack = Object.freeze({
1197 name: name$1,
1198 pluralName: pluralName$1,
1199 defaultProperties: defaultProperties$1
1200});
1201
1202var name$2 = 'champion';
1203var pluralName$2 = 'champions';
1204
1205var defaultProperties$2 = ['id'];
1206
1207var champion = Object.freeze({
1208 name: name$2,
1209 pluralName: pluralName$2,
1210 defaultProperties: defaultProperties$2
1211});
1212
1213var name$3 = 'cohort';
1214var pluralName$3 = 'cohorts';
1215
1216var defaultProperties$3 = ['id', 'name', 'description'];
1217
1218var 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 */
1242function head(array) {
1243 return (array && array.length) ? array[0] : undefined;
1244}
1245
1246var 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 */
1257function 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
1267var _baseTimes = baseTimes$1;
1268
1269/** Detect free variable `global` from Node.js. */
1270var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
1271
1272var _freeGlobal = freeGlobal$1;
1273
1274var freeGlobal = _freeGlobal;
1275
1276/** Detect free variable `self`. */
1277var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1278
1279/** Used as a reference to the global object. */
1280var root$1 = freeGlobal || freeSelf || Function('return this')();
1281
1282var _root = root$1;
1283
1284var root = _root;
1285
1286/** Built-in value references. */
1287var Symbol$1 = root.Symbol;
1288
1289var _Symbol = Symbol$1;
1290
1291var Symbol$2 = _Symbol;
1292
1293/** Used for built-in method references. */
1294var objectProto$2 = Object.prototype;
1295
1296/** Used to check objects for own properties. */
1297var 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 */
1304var nativeObjectToString = objectProto$2.toString;
1305
1306/** Built-in value references. */
1307var 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 */
1316function 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
1336var _getRawTag = getRawTag$1;
1337
1338/** Used for built-in method references. */
1339var 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 */
1346var 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 */
1355function objectToString$1(value) {
1356 return nativeObjectToString$1.call(value);
1357}
1358
1359var _objectToString = objectToString$1;
1360
1361var Symbol = _Symbol;
1362var getRawTag = _getRawTag;
1363var objectToString = _objectToString;
1364
1365/** `Object#toString` result references. */
1366var nullTag = '[object Null]';
1367var undefinedTag = '[object Undefined]';
1368
1369/** Built-in value references. */
1370var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1371
1372/**
1373 * The base implementation of `getTag` without fallbacks for buggy environments.
1374 *
1375 * @private
1376 * @param {*} value The value to query.
1377 * @returns {string} Returns the `toStringTag`.
1378 */
1379function 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
1388var _baseGetTag = baseGetTag$1;
1389
1390/**
1391 * Checks if `value` is object-like. A value is object-like if it's not `null`
1392 * and has a `typeof` result of "object".
1393 *
1394 * @static
1395 * @memberOf _
1396 * @since 4.0.0
1397 * @category Lang
1398 * @param {*} value The value to check.
1399 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1400 * @example
1401 *
1402 * _.isObjectLike({});
1403 * // => true
1404 *
1405 * _.isObjectLike([1, 2, 3]);
1406 * // => true
1407 *
1408 * _.isObjectLike(_.noop);
1409 * // => false
1410 *
1411 * _.isObjectLike(null);
1412 * // => false
1413 */
1414function isObjectLike$2(value) {
1415 return value != null && typeof value == 'object';
1416}
1417
1418var isObjectLike_1 = isObjectLike$2;
1419
1420var baseGetTag = _baseGetTag;
1421var isObjectLike$1 = isObjectLike_1;
1422
1423/** `Object#toString` result references. */
1424var argsTag = '[object Arguments]';
1425
1426/**
1427 * The base implementation of `_.isArguments`.
1428 *
1429 * @private
1430 * @param {*} value The value to check.
1431 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1432 */
1433function baseIsArguments$1(value) {
1434 return isObjectLike$1(value) && baseGetTag(value) == argsTag;
1435}
1436
1437var _baseIsArguments = baseIsArguments$1;
1438
1439var baseIsArguments = _baseIsArguments;
1440var isObjectLike = isObjectLike_1;
1441
1442/** Used for built-in method references. */
1443var objectProto$1 = Object.prototype;
1444
1445/** Used to check objects for own properties. */
1446var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1447
1448/** Built-in value references. */
1449var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
1450
1451/**
1452 * Checks if `value` is likely an `arguments` object.
1453 *
1454 * @static
1455 * @memberOf _
1456 * @since 0.1.0
1457 * @category Lang
1458 * @param {*} value The value to check.
1459 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1460 * else `false`.
1461 * @example
1462 *
1463 * _.isArguments(function() { return arguments; }());
1464 * // => true
1465 *
1466 * _.isArguments([1, 2, 3]);
1467 * // => false
1468 */
1469var 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
1474var isArguments_1 = isArguments$1;
1475
1476/**
1477 * Checks if `value` is classified as an `Array` object.
1478 *
1479 * @static
1480 * @memberOf _
1481 * @since 0.1.0
1482 * @category Lang
1483 * @param {*} value The value to check.
1484 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1485 * @example
1486 *
1487 * _.isArray([1, 2, 3]);
1488 * // => true
1489 *
1490 * _.isArray(document.body.children);
1491 * // => false
1492 *
1493 * _.isArray('abc');
1494 * // => false
1495 *
1496 * _.isArray(_.noop);
1497 * // => false
1498 */
1499var isArray$1 = Array.isArray;
1500
1501var isArray_1 = isArray$1;
1502
1503/**
1504 * This method returns `false`.
1505 *
1506 * @static
1507 * @memberOf _
1508 * @since 4.13.0
1509 * @category Util
1510 * @returns {boolean} Returns `false`.
1511 * @example
1512 *
1513 * _.times(2, _.stubFalse);
1514 * // => [false, false]
1515 */
1516function stubFalse() {
1517 return false;
1518}
1519
1520var stubFalse_1 = stubFalse;
1521
1522var isBuffer_1 = createCommonjsModule(function (module, exports) {
1523var root = _root,
1524 stubFalse = stubFalse_1;
1525
1526/** Detect free variable `exports`. */
1527var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1528
1529/** Detect free variable `module`. */
1530var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1531
1532/** Detect the popular CommonJS extension `module.exports`. */
1533var moduleExports = freeModule && freeModule.exports === freeExports;
1534
1535/** Built-in value references. */
1536var Buffer = moduleExports ? root.Buffer : undefined;
1537
1538/* Built-in method references for those with the same name as other `lodash` methods. */
1539var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1540
1541/**
1542 * Checks if `value` is a buffer.
1543 *
1544 * @static
1545 * @memberOf _
1546 * @since 4.3.0
1547 * @category Lang
1548 * @param {*} value The value to check.
1549 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1550 * @example
1551 *
1552 * _.isBuffer(new Buffer(2));
1553 * // => true
1554 *
1555 * _.isBuffer(new Uint8Array(2));
1556 * // => false
1557 */
1558var isBuffer = nativeIsBuffer || stubFalse;
1559
1560module.exports = isBuffer;
1561});
1562
1563/** Used as references for various `Number` constants. */
1564var MAX_SAFE_INTEGER = 9007199254740991;
1565
1566/** Used to detect unsigned integer values. */
1567var reIsUint = /^(?:0|[1-9]\d*)$/;
1568
1569/**
1570 * Checks if `value` is a valid array-like index.
1571 *
1572 * @private
1573 * @param {*} value The value to check.
1574 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1575 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1576 */
1577function 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
1584var _isIndex = isIndex$1;
1585
1586/** Used as references for various `Number` constants. */
1587var MAX_SAFE_INTEGER$1 = 9007199254740991;
1588
1589/**
1590 * Checks if `value` is a valid array-like length.
1591 *
1592 * **Note:** This method is loosely based on
1593 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1594 *
1595 * @static
1596 * @memberOf _
1597 * @since 4.0.0
1598 * @category Lang
1599 * @param {*} value The value to check.
1600 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1601 * @example
1602 *
1603 * _.isLength(3);
1604 * // => true
1605 *
1606 * _.isLength(Number.MIN_VALUE);
1607 * // => false
1608 *
1609 * _.isLength(Infinity);
1610 * // => false
1611 *
1612 * _.isLength('3');
1613 * // => false
1614 */
1615function isLength$1(value) {
1616 return typeof value == 'number' &&
1617 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
1618}
1619
1620var isLength_1 = isLength$1;
1621
1622var baseGetTag$2 = _baseGetTag;
1623var isLength = isLength_1;
1624var isObjectLike$3 = isObjectLike_1;
1625
1626/** `Object#toString` result references. */
1627var argsTag$1 = '[object Arguments]';
1628var arrayTag = '[object Array]';
1629var boolTag = '[object Boolean]';
1630var dateTag = '[object Date]';
1631var errorTag = '[object Error]';
1632var funcTag = '[object Function]';
1633var mapTag = '[object Map]';
1634var numberTag = '[object Number]';
1635var objectTag = '[object Object]';
1636var regexpTag = '[object RegExp]';
1637var setTag = '[object Set]';
1638var stringTag = '[object String]';
1639var weakMapTag = '[object WeakMap]';
1640
1641var arrayBufferTag = '[object ArrayBuffer]';
1642var dataViewTag = '[object DataView]';
1643var float32Tag = '[object Float32Array]';
1644var float64Tag = '[object Float64Array]';
1645var int8Tag = '[object Int8Array]';
1646var int16Tag = '[object Int16Array]';
1647var int32Tag = '[object Int32Array]';
1648var uint8Tag = '[object Uint8Array]';
1649var uint8ClampedTag = '[object Uint8ClampedArray]';
1650var uint16Tag = '[object Uint16Array]';
1651var uint32Tag = '[object Uint32Array]';
1652
1653/** Used to identify `toStringTag` values of typed arrays. */
1654var typedArrayTags = {};
1655typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1656typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1657typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1658typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1659typedArrayTags[uint32Tag] = true;
1660typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
1661typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1662typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
1663typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1664typedArrayTags[mapTag] = typedArrayTags[numberTag] =
1665typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
1666typedArrayTags[setTag] = typedArrayTags[stringTag] =
1667typedArrayTags[weakMapTag] = false;
1668
1669/**
1670 * The base implementation of `_.isTypedArray` without Node.js optimizations.
1671 *
1672 * @private
1673 * @param {*} value The value to check.
1674 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1675 */
1676function baseIsTypedArray$1(value) {
1677 return isObjectLike$3(value) &&
1678 isLength(value.length) && !!typedArrayTags[baseGetTag$2(value)];
1679}
1680
1681var _baseIsTypedArray = baseIsTypedArray$1;
1682
1683/**
1684 * The base implementation of `_.unary` without support for storing metadata.
1685 *
1686 * @private
1687 * @param {Function} func The function to cap arguments for.
1688 * @returns {Function} Returns the new capped function.
1689 */
1690function baseUnary$1(func) {
1691 return function(value) {
1692 return func(value);
1693 };
1694}
1695
1696var _baseUnary = baseUnary$1;
1697
1698var _nodeUtil = createCommonjsModule(function (module, exports) {
1699var freeGlobal = _freeGlobal;
1700
1701/** Detect free variable `exports`. */
1702var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1703
1704/** Detect free variable `module`. */
1705var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1706
1707/** Detect the popular CommonJS extension `module.exports`. */
1708var moduleExports = freeModule && freeModule.exports === freeExports;
1709
1710/** Detect free variable `process` from Node.js. */
1711var freeProcess = moduleExports && freeGlobal.process;
1712
1713/** Used to access faster Node.js helpers. */
1714var nodeUtil = (function() {
1715 try {
1716 return freeProcess && freeProcess.binding && freeProcess.binding('util');
1717 } catch (e) {}
1718}());
1719
1720module.exports = nodeUtil;
1721});
1722
1723var baseIsTypedArray = _baseIsTypedArray;
1724var baseUnary = _baseUnary;
1725var nodeUtil = _nodeUtil;
1726
1727/* Node.js helper references. */
1728var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1729
1730/**
1731 * Checks if `value` is classified as a typed array.
1732 *
1733 * @static
1734 * @memberOf _
1735 * @since 3.0.0
1736 * @category Lang
1737 * @param {*} value The value to check.
1738 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1739 * @example
1740 *
1741 * _.isTypedArray(new Uint8Array);
1742 * // => true
1743 *
1744 * _.isTypedArray([]);
1745 * // => false
1746 */
1747var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1748
1749var isTypedArray_1 = isTypedArray$1;
1750
1751var baseTimes = _baseTimes;
1752var isArguments = isArguments_1;
1753var isArray = isArray_1;
1754var isBuffer = isBuffer_1;
1755var isIndex = _isIndex;
1756var isTypedArray = isTypedArray_1;
1757
1758/** Used for built-in method references. */
1759var objectProto = Object.prototype;
1760
1761/** Used to check objects for own properties. */
1762var hasOwnProperty = objectProto.hasOwnProperty;
1763
1764/**
1765 * Creates an array of the enumerable property names of the array-like `value`.
1766 *
1767 * @private
1768 * @param {*} value The value to query.
1769 * @param {boolean} inherited Specify returning inherited property names.
1770 * @returns {Array} Returns the array of property names.
1771 */
1772function 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 // Safari 9 has enumerable `arguments.length` in strict mode.
1785 key == 'length' ||
1786 // Node.js 0.10 has enumerable non-index properties on buffers.
1787 (isBuff && (key == 'offset' || key == 'parent')) ||
1788 // PhantomJS 2 has enumerable non-index properties on typed arrays.
1789 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1790 // Skip index properties.
1791 isIndex(key, length)
1792 ))) {
1793 result.push(key);
1794 }
1795 }
1796 return result;
1797}
1798
1799var _arrayLikeKeys = arrayLikeKeys$1;
1800
1801/** Used for built-in method references. */
1802var objectProto$5 = Object.prototype;
1803
1804/**
1805 * Checks if `value` is likely a prototype object.
1806 *
1807 * @private
1808 * @param {*} value The value to check.
1809 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1810 */
1811function 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
1818var _isPrototype = isPrototype$1;
1819
1820/**
1821 * Creates a unary function that invokes `func` with its argument transformed.
1822 *
1823 * @private
1824 * @param {Function} func The function to wrap.
1825 * @param {Function} transform The argument transform.
1826 * @returns {Function} Returns the new function.
1827 */
1828function overArg$1(func, transform) {
1829 return function(arg) {
1830 return func(transform(arg));
1831 };
1832}
1833
1834var _overArg = overArg$1;
1835
1836var overArg = _overArg;
1837
1838/* Built-in method references for those with the same name as other `lodash` methods. */
1839var nativeKeys$1 = overArg(Object.keys, Object);
1840
1841var _nativeKeys = nativeKeys$1;
1842
1843var isPrototype = _isPrototype;
1844var nativeKeys = _nativeKeys;
1845
1846/** Used for built-in method references. */
1847var objectProto$4 = Object.prototype;
1848
1849/** Used to check objects for own properties. */
1850var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1851
1852/**
1853 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1854 *
1855 * @private
1856 * @param {Object} object The object to query.
1857 * @returns {Array} Returns the array of property names.
1858 */
1859function 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
1872var _baseKeys = baseKeys$1;
1873
1874/**
1875 * Checks if `value` is the
1876 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1877 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1878 *
1879 * @static
1880 * @memberOf _
1881 * @since 0.1.0
1882 * @category Lang
1883 * @param {*} value The value to check.
1884 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1885 * @example
1886 *
1887 * _.isObject({});
1888 * // => true
1889 *
1890 * _.isObject([1, 2, 3]);
1891 * // => true
1892 *
1893 * _.isObject(_.noop);
1894 * // => true
1895 *
1896 * _.isObject(null);
1897 * // => false
1898 */
1899function isObject$1(value) {
1900 var type = typeof value;
1901 return value != null && (type == 'object' || type == 'function');
1902}
1903
1904var isObject_1 = isObject$1;
1905
1906var baseGetTag$3 = _baseGetTag;
1907var isObject = isObject_1;
1908
1909/** `Object#toString` result references. */
1910var asyncTag = '[object AsyncFunction]';
1911var funcTag$1 = '[object Function]';
1912var genTag = '[object GeneratorFunction]';
1913var proxyTag = '[object Proxy]';
1914
1915/**
1916 * Checks if `value` is classified as a `Function` object.
1917 *
1918 * @static
1919 * @memberOf _
1920 * @since 0.1.0
1921 * @category Lang
1922 * @param {*} value The value to check.
1923 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1924 * @example
1925 *
1926 * _.isFunction(_);
1927 * // => true
1928 *
1929 * _.isFunction(/abc/);
1930 * // => false
1931 */
1932function isFunction$1(value) {
1933 if (!isObject(value)) {
1934 return false;
1935 }
1936 // The use of `Object#toString` avoids issues with the `typeof` operator
1937 // in Safari 9 which returns 'object' for typed arrays and other constructors.
1938 var tag = baseGetTag$3(value);
1939 return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
1940}
1941
1942var isFunction_1 = isFunction$1;
1943
1944var isFunction = isFunction_1;
1945var isLength$2 = isLength_1;
1946
1947/**
1948 * Checks if `value` is array-like. A value is considered array-like if it's
1949 * not a function and has a `value.length` that's an integer greater than or
1950 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1951 *
1952 * @static
1953 * @memberOf _
1954 * @since 4.0.0
1955 * @category Lang
1956 * @param {*} value The value to check.
1957 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1958 * @example
1959 *
1960 * _.isArrayLike([1, 2, 3]);
1961 * // => true
1962 *
1963 * _.isArrayLike(document.body.children);
1964 * // => true
1965 *
1966 * _.isArrayLike('abc');
1967 * // => true
1968 *
1969 * _.isArrayLike(_.noop);
1970 * // => false
1971 */
1972function isArrayLike$1(value) {
1973 return value != null && isLength$2(value.length) && !isFunction(value);
1974}
1975
1976var isArrayLike_1 = isArrayLike$1;
1977
1978var arrayLikeKeys = _arrayLikeKeys;
1979var baseKeys = _baseKeys;
1980var isArrayLike = isArrayLike_1;
1981
1982/**
1983 * Creates an array of the own enumerable property names of `object`.
1984 *
1985 * **Note:** Non-object values are coerced to objects. See the
1986 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1987 * for more details.
1988 *
1989 * @static
1990 * @since 0.1.0
1991 * @memberOf _
1992 * @category Object
1993 * @param {Object} object The object to query.
1994 * @returns {Array} Returns the array of property names.
1995 * @example
1996 *
1997 * function Foo() {
1998 * this.a = 1;
1999 * this.b = 2;
2000 * }
2001 *
2002 * Foo.prototype.c = 3;
2003 *
2004 * _.keys(new Foo);
2005 * // => ['a', 'b'] (iteration order is not guaranteed)
2006 *
2007 * _.keys('hi');
2008 * // => ['0', '1']
2009 */
2010function keys(object) {
2011 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2012}
2013
2014var keys_1 = keys;
2015
2016/**
2017 * A specialized version of `_.map` for arrays without support for iteratee
2018 * shorthands.
2019 *
2020 * @private
2021 * @param {Array} [array] The array to iterate over.
2022 * @param {Function} iteratee The function invoked per iteration.
2023 * @returns {Array} Returns the new mapped array.
2024 */
2025function 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
2036var _arrayMap = arrayMap$1;
2037
2038var baseGetTag$4 = _baseGetTag;
2039var isObjectLike$4 = isObjectLike_1;
2040
2041/** `Object#toString` result references. */
2042var symbolTag = '[object Symbol]';
2043
2044/**
2045 * Checks if `value` is classified as a `Symbol` primitive or object.
2046 *
2047 * @static
2048 * @memberOf _
2049 * @since 4.0.0
2050 * @category Lang
2051 * @param {*} value The value to check.
2052 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
2053 * @example
2054 *
2055 * _.isSymbol(Symbol.iterator);
2056 * // => true
2057 *
2058 * _.isSymbol('abc');
2059 * // => false
2060 */
2061function isSymbol$1(value) {
2062 return typeof value == 'symbol' ||
2063 (isObjectLike$4(value) && baseGetTag$4(value) == symbolTag);
2064}
2065
2066var isSymbol_1 = isSymbol$1;
2067
2068var Symbol$3 = _Symbol;
2069var arrayMap = _arrayMap;
2070var isArray$3 = isArray_1;
2071var isSymbol = isSymbol_1;
2072
2073/** Used as references for various `Number` constants. */
2074var INFINITY = 1 / 0;
2075
2076/** Used to convert symbols to primitives and strings. */
2077var symbolProto = Symbol$3 ? Symbol$3.prototype : undefined;
2078var symbolToString = symbolProto ? symbolProto.toString : undefined;
2079
2080/**
2081 * The base implementation of `_.toString` which doesn't convert nullish
2082 * values to empty strings.
2083 *
2084 * @private
2085 * @param {*} value The value to process.
2086 * @returns {string} Returns the string.
2087 */
2088function baseToString$1(value) {
2089 // Exit early for strings to avoid a performance hit in some environments.
2090 if (typeof value == 'string') {
2091 return value;
2092 }
2093 if (isArray$3(value)) {
2094 // Recursively convert values (susceptible to call stack limits).
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
2104var _baseToString = baseToString$1;
2105
2106var baseToString = _baseToString;
2107
2108/**
2109 * Converts `value` to a string. An empty string is returned for `null`
2110 * and `undefined` values. The sign of `-0` is preserved.
2111 *
2112 * @static
2113 * @memberOf _
2114 * @since 4.0.0
2115 * @category Lang
2116 * @param {*} value The value to convert.
2117 * @returns {string} Returns the converted string.
2118 * @example
2119 *
2120 * _.toString(null);
2121 * // => ''
2122 *
2123 * _.toString(-0);
2124 * // => '-0'
2125 *
2126 * _.toString([1, 2, 3]);
2127 * // => '1,2,3'
2128 */
2129function toString$1(value) {
2130 return value == null ? '' : baseToString(value);
2131}
2132
2133var toString_1 = toString$1;
2134
2135/**
2136 * The base implementation of `_.slice` without an iteratee call guard.
2137 *
2138 * @private
2139 * @param {Array} array The array to slice.
2140 * @param {number} [start=0] The start position.
2141 * @param {number} [end=array.length] The end position.
2142 * @returns {Array} Returns the slice of `array`.
2143 */
2144function 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
2165var _baseSlice = baseSlice$1;
2166
2167var baseSlice = _baseSlice;
2168
2169/**
2170 * Casts `array` to a slice if it's needed.
2171 *
2172 * @private
2173 * @param {Array} array The array to inspect.
2174 * @param {number} start The start position.
2175 * @param {number} [end=array.length] The end position.
2176 * @returns {Array} Returns the cast slice.
2177 */
2178function 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
2184var _castSlice = castSlice$1;
2185
2186/** Used to compose unicode character classes. */
2187var rsAstralRange = '\\ud800-\\udfff';
2188var rsComboMarksRange = '\\u0300-\\u036f';
2189var reComboHalfMarksRange = '\\ufe20-\\ufe2f';
2190var rsComboSymbolsRange = '\\u20d0-\\u20ff';
2191var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
2192var rsVarRange = '\\ufe0e\\ufe0f';
2193
2194/** Used to compose unicode capture groups. */
2195var rsZWJ = '\\u200d';
2196
2197/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
2198var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
2199
2200/**
2201 * Checks if `string` contains Unicode symbols.
2202 *
2203 * @private
2204 * @param {string} string The string to inspect.
2205 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
2206 */
2207function hasUnicode$1(string) {
2208 return reHasUnicode.test(string);
2209}
2210
2211var _hasUnicode = hasUnicode$1;
2212
2213/**
2214 * Converts an ASCII `string` to an array.
2215 *
2216 * @private
2217 * @param {string} string The string to convert.
2218 * @returns {Array} Returns the converted array.
2219 */
2220function asciiToArray$1(string) {
2221 return string.split('');
2222}
2223
2224var _asciiToArray = asciiToArray$1;
2225
2226/** Used to compose unicode character classes. */
2227var rsAstralRange$1 = '\\ud800-\\udfff';
2228var rsComboMarksRange$1 = '\\u0300-\\u036f';
2229var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f';
2230var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff';
2231var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
2232var rsVarRange$1 = '\\ufe0e\\ufe0f';
2233
2234/** Used to compose unicode capture groups. */
2235var rsAstral = '[' + rsAstralRange$1 + ']';
2236var rsCombo = '[' + rsComboRange$1 + ']';
2237var rsFitz = '\\ud83c[\\udffb-\\udfff]';
2238var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
2239var rsNonAstral = '[^' + rsAstralRange$1 + ']';
2240var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
2241var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
2242var rsZWJ$1 = '\\u200d';
2243
2244/** Used to compose unicode regexes. */
2245var reOptMod = rsModifier + '?';
2246var rsOptVar = '[' + rsVarRange$1 + ']?';
2247var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
2248var rsSeq = rsOptVar + reOptMod + rsOptJoin;
2249var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
2250
2251/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
2252var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
2253
2254/**
2255 * Converts a Unicode `string` to an array.
2256 *
2257 * @private
2258 * @param {string} string The string to convert.
2259 * @returns {Array} Returns the converted array.
2260 */
2261function unicodeToArray$1(string) {
2262 return string.match(reUnicode) || [];
2263}
2264
2265var _unicodeToArray = unicodeToArray$1;
2266
2267var asciiToArray = _asciiToArray;
2268var hasUnicode$2 = _hasUnicode;
2269var unicodeToArray = _unicodeToArray;
2270
2271/**
2272 * Converts `string` to an array.
2273 *
2274 * @private
2275 * @param {string} string The string to convert.
2276 * @returns {Array} Returns the converted array.
2277 */
2278function stringToArray$1(string) {
2279 return hasUnicode$2(string)
2280 ? unicodeToArray(string)
2281 : asciiToArray(string);
2282}
2283
2284var _stringToArray = stringToArray$1;
2285
2286var castSlice = _castSlice;
2287var hasUnicode = _hasUnicode;
2288var stringToArray = _stringToArray;
2289var toString$2 = toString_1;
2290
2291/**
2292 * Creates a function like `_.lowerFirst`.
2293 *
2294 * @private
2295 * @param {string} methodName The name of the `String` case method to use.
2296 * @returns {Function} Returns the new case function.
2297 */
2298function 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
2318var _createCaseFirst = createCaseFirst$1;
2319
2320var createCaseFirst = _createCaseFirst;
2321
2322/**
2323 * Converts the first character of `string` to upper case.
2324 *
2325 * @static
2326 * @memberOf _
2327 * @since 4.0.0
2328 * @category String
2329 * @param {string} [string=''] The string to convert.
2330 * @returns {string} Returns the converted string.
2331 * @example
2332 *
2333 * _.upperFirst('fred');
2334 * // => 'Fred'
2335 *
2336 * _.upperFirst('FRED');
2337 * // => 'FRED'
2338 */
2339var upperFirst$1 = createCaseFirst('toUpperCase');
2340
2341var upperFirst_1 = upperFirst$1;
2342
2343var toString = toString_1;
2344var upperFirst = upperFirst_1;
2345
2346/**
2347 * Converts the first character of `string` to upper case and the remaining
2348 * to lower case.
2349 *
2350 * @static
2351 * @memberOf _
2352 * @since 3.0.0
2353 * @category String
2354 * @param {string} [string=''] The string to capitalize.
2355 * @returns {string} Returns the capitalized string.
2356 * @example
2357 *
2358 * _.capitalize('FRED');
2359 * // => 'Fred'
2360 */
2361function capitalize$1(string) {
2362 return upperFirst(toString(string).toLowerCase());
2363}
2364
2365var capitalize_1 = capitalize$1;
2366
2367/**
2368 * A specialized version of `_.reduce` for arrays without support for
2369 * iteratee shorthands.
2370 *
2371 * @private
2372 * @param {Array} [array] The array to iterate over.
2373 * @param {Function} iteratee The function invoked per iteration.
2374 * @param {*} [accumulator] The initial value.
2375 * @param {boolean} [initAccum] Specify using the first element of `array` as
2376 * the initial value.
2377 * @returns {*} Returns the accumulated value.
2378 */
2379function 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
2392var _arrayReduce = arrayReduce$1;
2393
2394/**
2395 * The base implementation of `_.propertyOf` without support for deep paths.
2396 *
2397 * @private
2398 * @param {Object} object The object to query.
2399 * @returns {Function} Returns the new accessor function.
2400 */
2401function basePropertyOf$1(object) {
2402 return function(key) {
2403 return object == null ? undefined : object[key];
2404 };
2405}
2406
2407var _basePropertyOf = basePropertyOf$1;
2408
2409var basePropertyOf = _basePropertyOf;
2410
2411/** Used to map Latin Unicode letters to basic Latin letters. */
2412var deburredLetters = {
2413 // Latin-1 Supplement block.
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 // Latin Extended-A block.
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 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
2471 * letters to basic Latin letters.
2472 *
2473 * @private
2474 * @param {string} letter The matched letter to deburr.
2475 * @returns {string} Returns the deburred letter.
2476 */
2477var deburrLetter$1 = basePropertyOf(deburredLetters);
2478
2479var _deburrLetter = deburrLetter$1;
2480
2481var deburrLetter = _deburrLetter;
2482var toString$3 = toString_1;
2483
2484/** Used to match Latin Unicode letters (excluding mathematical operators). */
2485var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
2486
2487/** Used to compose unicode character classes. */
2488var rsComboMarksRange$2 = '\\u0300-\\u036f';
2489var reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f';
2490var rsComboSymbolsRange$2 = '\\u20d0-\\u20ff';
2491var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
2492
2493/** Used to compose unicode capture groups. */
2494var rsCombo$1 = '[' + rsComboRange$2 + ']';
2495
2496/**
2497 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
2498 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
2499 */
2500var reComboMark = RegExp(rsCombo$1, 'g');
2501
2502/**
2503 * Deburrs `string` by converting
2504 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
2505 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
2506 * letters to basic Latin letters and removing
2507 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
2508 *
2509 * @static
2510 * @memberOf _
2511 * @since 3.0.0
2512 * @category String
2513 * @param {string} [string=''] The string to deburr.
2514 * @returns {string} Returns the deburred string.
2515 * @example
2516 *
2517 * _.deburr('déjà vu');
2518 * // => 'deja vu'
2519 */
2520function deburr$1(string) {
2521 string = toString$3(string);
2522 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
2523}
2524
2525var deburr_1 = deburr$1;
2526
2527/** Used to match words composed of alphanumeric characters. */
2528var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
2529
2530/**
2531 * Splits an ASCII `string` into an array of its words.
2532 *
2533 * @private
2534 * @param {string} The string to inspect.
2535 * @returns {Array} Returns the words of `string`.
2536 */
2537function asciiWords$1(string) {
2538 return string.match(reAsciiWord) || [];
2539}
2540
2541var _asciiWords = asciiWords$1;
2542
2543/** Used to detect strings that need a more robust regexp to match words. */
2544var 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 * Checks if `string` contains a word composed of Unicode symbols.
2548 *
2549 * @private
2550 * @param {string} string The string to inspect.
2551 * @returns {boolean} Returns `true` if a word is found, else `false`.
2552 */
2553function hasUnicodeWord$1(string) {
2554 return reHasUnicodeWord.test(string);
2555}
2556
2557var _hasUnicodeWord = hasUnicodeWord$1;
2558
2559/** Used to compose unicode character classes. */
2560var rsAstralRange$2 = '\\ud800-\\udfff';
2561var rsComboMarksRange$3 = '\\u0300-\\u036f';
2562var reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f';
2563var rsComboSymbolsRange$3 = '\\u20d0-\\u20ff';
2564var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
2565var rsDingbatRange = '\\u2700-\\u27bf';
2566var rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff';
2567var rsMathOpRange = '\\xac\\xb1\\xd7\\xf7';
2568var rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf';
2569var rsPunctuationRange = '\\u2000-\\u206f';
2570var 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';
2571var rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde';
2572var rsVarRange$2 = '\\ufe0e\\ufe0f';
2573var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
2574
2575/** Used to compose unicode capture groups. */
2576var rsApos$1 = "['\u2019]";
2577var rsBreak = '[' + rsBreakRange + ']';
2578var rsCombo$2 = '[' + rsComboRange$3 + ']';
2579var rsDigits = '\\d+';
2580var rsDingbat = '[' + rsDingbatRange + ']';
2581var rsLower = '[' + rsLowerRange + ']';
2582var rsMisc = '[^' + rsAstralRange$2 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']';
2583var rsFitz$1 = '\\ud83c[\\udffb-\\udfff]';
2584var rsModifier$1 = '(?:' + rsCombo$2 + '|' + rsFitz$1 + ')';
2585var rsNonAstral$1 = '[^' + rsAstralRange$2 + ']';
2586var rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}';
2587var rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]';
2588var rsUpper = '[' + rsUpperRange + ']';
2589var rsZWJ$2 = '\\u200d';
2590
2591/** Used to compose unicode regexes. */
2592var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')';
2593var rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')';
2594var rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?';
2595var rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?';
2596var reOptMod$1 = rsModifier$1 + '?';
2597var rsOptVar$1 = '[' + rsVarRange$2 + ']?';
2598var rsOptJoin$1 = '(?:' + rsZWJ$2 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*';
2599var rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)';
2600var rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)';
2601var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
2602var rsEmoji = '(?:' + [rsDingbat, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsSeq$1;
2603
2604/** Used to match complex or compound words. */
2605var 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 * Splits a Unicode `string` into an array of its words.
2618 *
2619 * @private
2620 * @param {string} The string to inspect.
2621 * @returns {Array} Returns the words of `string`.
2622 */
2623function unicodeWords$1(string) {
2624 return string.match(reUnicodeWord) || [];
2625}
2626
2627var _unicodeWords = unicodeWords$1;
2628
2629var asciiWords = _asciiWords;
2630var hasUnicodeWord = _hasUnicodeWord;
2631var toString$4 = toString_1;
2632var unicodeWords = _unicodeWords;
2633
2634/**
2635 * Splits `string` into an array of its words.
2636 *
2637 * @static
2638 * @memberOf _
2639 * @since 3.0.0
2640 * @category String
2641 * @param {string} [string=''] The string to inspect.
2642 * @param {RegExp|string} [pattern] The pattern to match words.
2643 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
2644 * @returns {Array} Returns the words of `string`.
2645 * @example
2646 *
2647 * _.words('fred, barney, & pebbles');
2648 * // => ['fred', 'barney', 'pebbles']
2649 *
2650 * _.words('fred, barney, & pebbles', /[^, ]+/g);
2651 * // => ['fred', 'barney', '&', 'pebbles']
2652 */
2653function 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
2663var words_1 = words$1;
2664
2665var arrayReduce = _arrayReduce;
2666var deburr = deburr_1;
2667var words = words_1;
2668
2669/** Used to compose unicode capture groups. */
2670var rsApos = "['\u2019]";
2671
2672/** Used to match apostrophes. */
2673var reApos = RegExp(rsApos, 'g');
2674
2675/**
2676 * Creates a function like `_.camelCase`.
2677 *
2678 * @private
2679 * @param {Function} callback The function to combine each word.
2680 * @returns {Function} Returns the new compounder function.
2681 */
2682function createCompounder$1(callback) {
2683 return function(string) {
2684 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
2685 };
2686}
2687
2688var _createCompounder = createCompounder$1;
2689
2690var capitalize = capitalize_1;
2691var createCompounder = _createCompounder;
2692
2693/**
2694 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
2695 *
2696 * @static
2697 * @memberOf _
2698 * @since 3.0.0
2699 * @category String
2700 * @param {string} [string=''] The string to convert.
2701 * @returns {string} Returns the camel cased string.
2702 * @example
2703 *
2704 * _.camelCase('Foo Bar');
2705 * // => 'fooBar'
2706 *
2707 * _.camelCase('--foo-bar--');
2708 * // => 'fooBar'
2709 *
2710 * _.camelCase('__FOO_BAR__');
2711 * // => 'fooBar'
2712 */
2713var camelCase = createCompounder(function(result, word, index) {
2714 word = word.toLowerCase();
2715 return result + (index ? capitalize(word) : word);
2716});
2717
2718var camelCase_1 = camelCase;
2719
2720/**
2721 * Appends the elements of `values` to `array`.
2722 *
2723 * @private
2724 * @param {Array} array The array to modify.
2725 * @param {Array} values The values to append.
2726 * @returns {Array} Returns `array`.
2727 */
2728function 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
2739var _arrayPush = arrayPush$1;
2740
2741var Symbol$4 = _Symbol;
2742var isArguments$2 = isArguments_1;
2743var isArray$5 = isArray_1;
2744
2745/** Built-in value references. */
2746var spreadableSymbol = Symbol$4 ? Symbol$4.isConcatSpreadable : undefined;
2747
2748/**
2749 * Checks if `value` is a flattenable `arguments` object or array.
2750 *
2751 * @private
2752 * @param {*} value The value to check.
2753 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
2754 */
2755function isFlattenable$1(value) {
2756 return isArray$5(value) || isArguments$2(value) ||
2757 !!(spreadableSymbol && value && value[spreadableSymbol]);
2758}
2759
2760var _isFlattenable = isFlattenable$1;
2761
2762var arrayPush$2 = _arrayPush;
2763var isFlattenable = _isFlattenable;
2764
2765/**
2766 * The base implementation of `_.flatten` with support for restricting flattening.
2767 *
2768 * @private
2769 * @param {Array} array The array to flatten.
2770 * @param {number} depth The maximum recursion depth.
2771 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2772 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2773 * @param {Array} [result=[]] The initial result value.
2774 * @returns {Array} Returns the new flattened array.
2775 */
2776function 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 // Recursively flatten arrays (susceptible to call stack limits).
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
2799var _baseFlatten = baseFlatten$1;
2800
2801/**
2802 * Copies the values of `source` to `array`.
2803 *
2804 * @private
2805 * @param {Array} source The array to copy values from.
2806 * @param {Array} [array=[]] The array to copy values to.
2807 * @returns {Array} Returns `array`.
2808 */
2809function 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
2820var _copyArray = copyArray$1;
2821
2822var arrayPush = _arrayPush;
2823var baseFlatten = _baseFlatten;
2824var copyArray = _copyArray;
2825var isArray$4 = isArray_1;
2826
2827/**
2828 * Creates a new array concatenating `array` with any additional arrays
2829 * and/or values.
2830 *
2831 * @static
2832 * @memberOf _
2833 * @since 4.0.0
2834 * @category Array
2835 * @param {Array} array The array to concatenate.
2836 * @param {...*} [values] The values to concatenate.
2837 * @returns {Array} Returns the new concatenated array.
2838 * @example
2839 *
2840 * var array = [1];
2841 * var other = _.concat(array, 2, [3], [[4]]);
2842 *
2843 * console.log(other);
2844 * // => [1, 2, 3, [4]]
2845 *
2846 * console.log(array);
2847 * // => [1]
2848 */
2849function 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
2864var concat_1 = concat;
2865
2866var isArray$7 = isArray_1;
2867var isSymbol$2 = isSymbol_1;
2868
2869/** Used to match property names within property paths. */
2870var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
2871var reIsPlainProp = /^\w*$/;
2872
2873/**
2874 * Checks if `value` is a property name and not a property path.
2875 *
2876 * @private
2877 * @param {*} value The value to check.
2878 * @param {Object} [object] The object to query keys on.
2879 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
2880 */
2881function 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
2894var _isKey = isKey$1;
2895
2896var root$2 = _root;
2897
2898/** Used to detect overreaching core-js shims. */
2899var coreJsData$1 = root$2['__core-js_shared__'];
2900
2901var _coreJsData = coreJsData$1;
2902
2903var coreJsData = _coreJsData;
2904
2905/** Used to detect methods masquerading as native. */
2906var maskSrcKey = (function() {
2907 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
2908 return uid ? ('Symbol(src)_1.' + uid) : '';
2909}());
2910
2911/**
2912 * Checks if `func` has its source masked.
2913 *
2914 * @private
2915 * @param {Function} func The function to check.
2916 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
2917 */
2918function isMasked$1(func) {
2919 return !!maskSrcKey && (maskSrcKey in func);
2920}
2921
2922var _isMasked = isMasked$1;
2923
2924/** Used for built-in method references. */
2925var funcProto$1 = Function.prototype;
2926
2927/** Used to resolve the decompiled source of functions. */
2928var funcToString$1 = funcProto$1.toString;
2929
2930/**
2931 * Converts `func` to its source code.
2932 *
2933 * @private
2934 * @param {Function} func The function to convert.
2935 * @returns {string} Returns the source code.
2936 */
2937function 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
2949var _toSource = toSource$1;
2950
2951var isFunction$3 = isFunction_1;
2952var isMasked = _isMasked;
2953var isObject$2 = isObject_1;
2954var toSource = _toSource;
2955
2956/**
2957 * Used to match `RegExp`
2958 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
2959 */
2960var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2961
2962/** Used to detect host constructors (Safari). */
2963var reIsHostCtor = /^\[object .+?Constructor\]$/;
2964
2965/** Used for built-in method references. */
2966var funcProto = Function.prototype;
2967var objectProto$6 = Object.prototype;
2968
2969/** Used to resolve the decompiled source of functions. */
2970var funcToString = funcProto.toString;
2971
2972/** Used to check objects for own properties. */
2973var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
2974
2975/** Used to detect if a method is native. */
2976var reIsNative = RegExp('^' +
2977 funcToString.call(hasOwnProperty$4).replace(reRegExpChar, '\\$&')
2978 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
2979);
2980
2981/**
2982 * The base implementation of `_.isNative` without bad shim checks.
2983 *
2984 * @private
2985 * @param {*} value The value to check.
2986 * @returns {boolean} Returns `true` if `value` is a native function,
2987 * else `false`.
2988 */
2989function 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
2997var _baseIsNative = baseIsNative$1;
2998
2999/**
3000 * Gets the value at `key` of `object`.
3001 *
3002 * @private
3003 * @param {Object} [object] The object to query.
3004 * @param {string} key The key of the property to get.
3005 * @returns {*} Returns the property value.
3006 */
3007function getValue$1(object, key) {
3008 return object == null ? undefined : object[key];
3009}
3010
3011var _getValue = getValue$1;
3012
3013var baseIsNative = _baseIsNative;
3014var getValue = _getValue;
3015
3016/**
3017 * Gets the native function at `key` of `object`.
3018 *
3019 * @private
3020 * @param {Object} object The object to query.
3021 * @param {string} key The key of the method to get.
3022 * @returns {*} Returns the function if it's native, else `undefined`.
3023 */
3024function getNative$1(object, key) {
3025 var value = getValue(object, key);
3026 return baseIsNative(value) ? value : undefined;
3027}
3028
3029var _getNative = getNative$1;
3030
3031var getNative = _getNative;
3032
3033/* Built-in method references that are verified to be native. */
3034var nativeCreate$1 = getNative(Object, 'create');
3035
3036var _nativeCreate = nativeCreate$1;
3037
3038var nativeCreate = _nativeCreate;
3039
3040/**
3041 * Removes all key-value entries from the hash.
3042 *
3043 * @private
3044 * @name clear
3045 * @memberOf Hash
3046 */
3047function hashClear$1() {
3048 this.__data__ = nativeCreate ? nativeCreate(null) : {};
3049 this.size = 0;
3050}
3051
3052var _hashClear = hashClear$1;
3053
3054/**
3055 * Removes `key` and its value from the hash.
3056 *
3057 * @private
3058 * @name delete
3059 * @memberOf Hash
3060 * @param {Object} hash The hash to modify.
3061 * @param {string} key The key of the value to remove.
3062 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3063 */
3064function hashDelete$1(key) {
3065 var result = this.has(key) && delete this.__data__[key];
3066 this.size -= result ? 1 : 0;
3067 return result;
3068}
3069
3070var _hashDelete = hashDelete$1;
3071
3072var nativeCreate$2 = _nativeCreate;
3073
3074/** Used to stand-in for `undefined` hash values. */
3075var HASH_UNDEFINED = '__lodash_hash_undefined__';
3076
3077/** Used for built-in method references. */
3078var objectProto$7 = Object.prototype;
3079
3080/** Used to check objects for own properties. */
3081var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
3082
3083/**
3084 * Gets the hash value for `key`.
3085 *
3086 * @private
3087 * @name get
3088 * @memberOf Hash
3089 * @param {string} key The key of the value to get.
3090 * @returns {*} Returns the entry value.
3091 */
3092function 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
3101var _hashGet = hashGet$1;
3102
3103var nativeCreate$3 = _nativeCreate;
3104
3105/** Used for built-in method references. */
3106var objectProto$8 = Object.prototype;
3107
3108/** Used to check objects for own properties. */
3109var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
3110
3111/**
3112 * Checks if a hash value for `key` exists.
3113 *
3114 * @private
3115 * @name has
3116 * @memberOf Hash
3117 * @param {string} key The key of the entry to check.
3118 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3119 */
3120function hashHas$1(key) {
3121 var data = this.__data__;
3122 return nativeCreate$3 ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
3123}
3124
3125var _hashHas = hashHas$1;
3126
3127var nativeCreate$4 = _nativeCreate;
3128
3129/** Used to stand-in for `undefined` hash values. */
3130var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
3131
3132/**
3133 * Sets the hash `key` to `value`.
3134 *
3135 * @private
3136 * @name set
3137 * @memberOf Hash
3138 * @param {string} key The key of the value to set.
3139 * @param {*} value The value to set.
3140 * @returns {Object} Returns the hash instance.
3141 */
3142function 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
3149var _hashSet = hashSet$1;
3150
3151var hashClear = _hashClear;
3152var hashDelete = _hashDelete;
3153var hashGet = _hashGet;
3154var hashHas = _hashHas;
3155var hashSet = _hashSet;
3156
3157/**
3158 * Creates a hash object.
3159 *
3160 * @private
3161 * @constructor
3162 * @param {Array} [entries] The key-value pairs to cache.
3163 */
3164function 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// Add methods to `Hash`.
3176Hash$1.prototype.clear = hashClear;
3177Hash$1.prototype['delete'] = hashDelete;
3178Hash$1.prototype.get = hashGet;
3179Hash$1.prototype.has = hashHas;
3180Hash$1.prototype.set = hashSet;
3181
3182var _Hash = Hash$1;
3183
3184/**
3185 * Removes all key-value entries from the list cache.
3186 *
3187 * @private
3188 * @name clear
3189 * @memberOf ListCache
3190 */
3191function listCacheClear$1() {
3192 this.__data__ = [];
3193 this.size = 0;
3194}
3195
3196var _listCacheClear = listCacheClear$1;
3197
3198/**
3199 * Performs a
3200 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3201 * comparison between two values to determine if they are equivalent.
3202 *
3203 * @static
3204 * @memberOf _
3205 * @since 4.0.0
3206 * @category Lang
3207 * @param {*} value The value to compare.
3208 * @param {*} other The other value to compare.
3209 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3210 * @example
3211 *
3212 * var object = { 'a': 1 };
3213 * var other = { 'a': 1 };
3214 *
3215 * _.eq(object, object);
3216 * // => true
3217 *
3218 * _.eq(object, other);
3219 * // => false
3220 *
3221 * _.eq('a', 'a');
3222 * // => true
3223 *
3224 * _.eq('a', Object('a'));
3225 * // => false
3226 *
3227 * _.eq(NaN, NaN);
3228 * // => true
3229 */
3230function eq$1(value, other) {
3231 return value === other || (value !== value && other !== other);
3232}
3233
3234var eq_1 = eq$1;
3235
3236var eq = eq_1;
3237
3238/**
3239 * Gets the index at which the `key` is found in `array` of key-value pairs.
3240 *
3241 * @private
3242 * @param {Array} array The array to inspect.
3243 * @param {*} key The key to search for.
3244 * @returns {number} Returns the index of the matched value, else `-1`.
3245 */
3246function 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
3256var _assocIndexOf = assocIndexOf$1;
3257
3258var assocIndexOf = _assocIndexOf;
3259
3260/** Used for built-in method references. */
3261var arrayProto = Array.prototype;
3262
3263/** Built-in value references. */
3264var splice = arrayProto.splice;
3265
3266/**
3267 * Removes `key` and its value from the list cache.
3268 *
3269 * @private
3270 * @name delete
3271 * @memberOf ListCache
3272 * @param {string} key The key of the value to remove.
3273 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3274 */
3275function 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
3292var _listCacheDelete = listCacheDelete$1;
3293
3294var assocIndexOf$2 = _assocIndexOf;
3295
3296/**
3297 * Gets the list cache value for `key`.
3298 *
3299 * @private
3300 * @name get
3301 * @memberOf ListCache
3302 * @param {string} key The key of the value to get.
3303 * @returns {*} Returns the entry value.
3304 */
3305function 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
3312var _listCacheGet = listCacheGet$1;
3313
3314var assocIndexOf$3 = _assocIndexOf;
3315
3316/**
3317 * Checks if a list cache value for `key` exists.
3318 *
3319 * @private
3320 * @name has
3321 * @memberOf ListCache
3322 * @param {string} key The key of the entry to check.
3323 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3324 */
3325function listCacheHas$1(key) {
3326 return assocIndexOf$3(this.__data__, key) > -1;
3327}
3328
3329var _listCacheHas = listCacheHas$1;
3330
3331var assocIndexOf$4 = _assocIndexOf;
3332
3333/**
3334 * Sets the list cache `key` to `value`.
3335 *
3336 * @private
3337 * @name set
3338 * @memberOf ListCache
3339 * @param {string} key The key of the value to set.
3340 * @param {*} value The value to set.
3341 * @returns {Object} Returns the list cache instance.
3342 */
3343function 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
3356var _listCacheSet = listCacheSet$1;
3357
3358var listCacheClear = _listCacheClear;
3359var listCacheDelete = _listCacheDelete;
3360var listCacheGet = _listCacheGet;
3361var listCacheHas = _listCacheHas;
3362var listCacheSet = _listCacheSet;
3363
3364/**
3365 * Creates an list cache object.
3366 *
3367 * @private
3368 * @constructor
3369 * @param {Array} [entries] The key-value pairs to cache.
3370 */
3371function 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// Add methods to `ListCache`.
3383ListCache$1.prototype.clear = listCacheClear;
3384ListCache$1.prototype['delete'] = listCacheDelete;
3385ListCache$1.prototype.get = listCacheGet;
3386ListCache$1.prototype.has = listCacheHas;
3387ListCache$1.prototype.set = listCacheSet;
3388
3389var _ListCache = ListCache$1;
3390
3391var getNative$2 = _getNative;
3392var root$3 = _root;
3393
3394/* Built-in method references that are verified to be native. */
3395var Map$1 = getNative$2(root$3, 'Map');
3396
3397var _Map = Map$1;
3398
3399var Hash = _Hash;
3400var ListCache = _ListCache;
3401var Map = _Map;
3402
3403/**
3404 * Removes all key-value entries from the map.
3405 *
3406 * @private
3407 * @name clear
3408 * @memberOf MapCache
3409 */
3410function 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
3419var _mapCacheClear = mapCacheClear$1;
3420
3421/**
3422 * Checks if `value` is suitable for use as unique object key.
3423 *
3424 * @private
3425 * @param {*} value The value to check.
3426 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
3427 */
3428function 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
3435var _isKeyable = isKeyable$1;
3436
3437var isKeyable = _isKeyable;
3438
3439/**
3440 * Gets the data for `map`.
3441 *
3442 * @private
3443 * @param {Object} map The map to query.
3444 * @param {string} key The reference key.
3445 * @returns {*} Returns the map data.
3446 */
3447function 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
3454var _getMapData = getMapData$1;
3455
3456var getMapData = _getMapData;
3457
3458/**
3459 * Removes `key` and its value from the map.
3460 *
3461 * @private
3462 * @name delete
3463 * @memberOf MapCache
3464 * @param {string} key The key of the value to remove.
3465 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3466 */
3467function mapCacheDelete$1(key) {
3468 var result = getMapData(this, key)['delete'](key);
3469 this.size -= result ? 1 : 0;
3470 return result;
3471}
3472
3473var _mapCacheDelete = mapCacheDelete$1;
3474
3475var getMapData$2 = _getMapData;
3476
3477/**
3478 * Gets the map value for `key`.
3479 *
3480 * @private
3481 * @name get
3482 * @memberOf MapCache
3483 * @param {string} key The key of the value to get.
3484 * @returns {*} Returns the entry value.
3485 */
3486function mapCacheGet$1(key) {
3487 return getMapData$2(this, key).get(key);
3488}
3489
3490var _mapCacheGet = mapCacheGet$1;
3491
3492var getMapData$3 = _getMapData;
3493
3494/**
3495 * Checks if a map value for `key` exists.
3496 *
3497 * @private
3498 * @name has
3499 * @memberOf MapCache
3500 * @param {string} key The key of the entry to check.
3501 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3502 */
3503function mapCacheHas$1(key) {
3504 return getMapData$3(this, key).has(key);
3505}
3506
3507var _mapCacheHas = mapCacheHas$1;
3508
3509var getMapData$4 = _getMapData;
3510
3511/**
3512 * Sets the map `key` to `value`.
3513 *
3514 * @private
3515 * @name set
3516 * @memberOf MapCache
3517 * @param {string} key The key of the value to set.
3518 * @param {*} value The value to set.
3519 * @returns {Object} Returns the map cache instance.
3520 */
3521function 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
3530var _mapCacheSet = mapCacheSet$1;
3531
3532var mapCacheClear = _mapCacheClear;
3533var mapCacheDelete = _mapCacheDelete;
3534var mapCacheGet = _mapCacheGet;
3535var mapCacheHas = _mapCacheHas;
3536var mapCacheSet = _mapCacheSet;
3537
3538/**
3539 * Creates a map cache object to store key-value pairs.
3540 *
3541 * @private
3542 * @constructor
3543 * @param {Array} [entries] The key-value pairs to cache.
3544 */
3545function 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// Add methods to `MapCache`.
3557MapCache$1.prototype.clear = mapCacheClear;
3558MapCache$1.prototype['delete'] = mapCacheDelete;
3559MapCache$1.prototype.get = mapCacheGet;
3560MapCache$1.prototype.has = mapCacheHas;
3561MapCache$1.prototype.set = mapCacheSet;
3562
3563var _MapCache = MapCache$1;
3564
3565var MapCache = _MapCache;
3566
3567/** Error message constants. */
3568var FUNC_ERROR_TEXT = 'Expected a function';
3569
3570/**
3571 * Creates a function that memoizes the result of `func`. If `resolver` is
3572 * provided, it determines the cache key for storing the result based on the
3573 * arguments provided to the memoized function. By default, the first argument
3574 * provided to the memoized function is used as the map cache key. The `func`
3575 * is invoked with the `this` binding of the memoized function.
3576 *
3577 * **Note:** The cache is exposed as the `cache` property on the memoized
3578 * function. Its creation may be customized by replacing the `_.memoize.Cache`
3579 * constructor with one whose instances implement the
3580 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
3581 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
3582 *
3583 * @static
3584 * @memberOf _
3585 * @since 0.1.0
3586 * @category Function
3587 * @param {Function} func The function to have its output memoized.
3588 * @param {Function} [resolver] The function to resolve the cache key.
3589 * @returns {Function} Returns the new memoized function.
3590 * @example
3591 *
3592 * var object = { 'a': 1, 'b': 2 };
3593 * var other = { 'c': 3, 'd': 4 };
3594 *
3595 * var values = _.memoize(_.values);
3596 * values(object);
3597 * // => [1, 2]
3598 *
3599 * values(other);
3600 * // => [3, 4]
3601 *
3602 * object.a = 2;
3603 * values(object);
3604 * // => [1, 2]
3605 *
3606 * // Modify the result cache.
3607 * values.cache.set(object, ['a', 'b']);
3608 * values(object);
3609 * // => ['a', 'b']
3610 *
3611 * // Replace `_.memoize.Cache`.
3612 * _.memoize.Cache = WeakMap;
3613 */
3614function 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// Expose `MapCache`.
3635memoize$1.Cache = MapCache;
3636
3637var memoize_1 = memoize$1;
3638
3639var memoize = memoize_1;
3640
3641/** Used as the maximum memoize cache size. */
3642var MAX_MEMOIZE_SIZE = 500;
3643
3644/**
3645 * A specialized version of `_.memoize` which clears the memoized function's
3646 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
3647 *
3648 * @private
3649 * @param {Function} func The function to have its output memoized.
3650 * @returns {Function} Returns the new memoized function.
3651 */
3652function 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
3664var _memoizeCapped = memoizeCapped$1;
3665
3666var memoizeCapped = _memoizeCapped;
3667
3668/** Used to match property names within property paths. */
3669var reLeadingDot = /^\./;
3670var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
3671
3672/** Used to match backslashes in property paths. */
3673var reEscapeChar = /\\(\\)?/g;
3674
3675/**
3676 * Converts `string` to a property path array.
3677 *
3678 * @private
3679 * @param {string} string The string to convert.
3680 * @returns {Array} Returns the property path array.
3681 */
3682var 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
3693var _stringToPath = stringToPath$1;
3694
3695var isArray$6 = isArray_1;
3696var isKey = _isKey;
3697var stringToPath = _stringToPath;
3698var toString$5 = toString_1;
3699
3700/**
3701 * Casts `value` to a path array if it's not one.
3702 *
3703 * @private
3704 * @param {*} value The value to inspect.
3705 * @param {Object} [object] The object to query keys on.
3706 * @returns {Array} Returns the cast property path array.
3707 */
3708function 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
3715var _castPath = castPath$1;
3716
3717var isSymbol$3 = isSymbol_1;
3718
3719/** Used as references for various `Number` constants. */
3720var INFINITY$1 = 1 / 0;
3721
3722/**
3723 * Converts `value` to a string key if it's not a string or symbol.
3724 *
3725 * @private
3726 * @param {*} value The value to inspect.
3727 * @returns {string|symbol} Returns the key.
3728 */
3729function 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
3737var _toKey = toKey$1;
3738
3739var castPath = _castPath;
3740var toKey = _toKey;
3741
3742/**
3743 * The base implementation of `_.get` without support for default values.
3744 *
3745 * @private
3746 * @param {Object} object The object to query.
3747 * @param {Array|string} path The path of the property to get.
3748 * @returns {*} Returns the resolved value.
3749 */
3750function 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
3762var _baseGet = baseGet$1;
3763
3764var baseGet = _baseGet;
3765
3766/**
3767 * Gets the value at `path` of `object`. If the resolved value is
3768 * `undefined`, the `defaultValue` is returned in its place.
3769 *
3770 * @static
3771 * @memberOf _
3772 * @since 3.7.0
3773 * @category Object
3774 * @param {Object} object The object to query.
3775 * @param {Array|string} path The path of the property to get.
3776 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
3777 * @returns {*} Returns the resolved value.
3778 * @example
3779 *
3780 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
3781 *
3782 * _.get(object, 'a[0].b.c');
3783 * // => 3
3784 *
3785 * _.get(object, ['a', '0', 'b', 'c']);
3786 * // => 3
3787 *
3788 * _.get(object, 'a.b.c', 'default');
3789 * // => 'default'
3790 */
3791function get(object, path, defaultValue) {
3792 var result = object == null ? undefined : baseGet(object, path);
3793 return result === undefined ? defaultValue : result;
3794}
3795
3796var get_1 = get;
3797
3798var getNative$3 = _getNative;
3799var root$4 = _root;
3800
3801/* Built-in method references that are verified to be native. */
3802var DataView$1 = getNative$3(root$4, 'DataView');
3803
3804var _DataView = DataView$1;
3805
3806var getNative$4 = _getNative;
3807var root$5 = _root;
3808
3809/* Built-in method references that are verified to be native. */
3810var Promise$2 = getNative$4(root$5, 'Promise');
3811
3812var _Promise = Promise$2;
3813
3814var getNative$5 = _getNative;
3815var root$6 = _root;
3816
3817/* Built-in method references that are verified to be native. */
3818var Set$1 = getNative$5(root$6, 'Set');
3819
3820var _Set = Set$1;
3821
3822var getNative$6 = _getNative;
3823var root$7 = _root;
3824
3825/* Built-in method references that are verified to be native. */
3826var WeakMap$1 = getNative$6(root$7, 'WeakMap');
3827
3828var _WeakMap = WeakMap$1;
3829
3830var DataView = _DataView;
3831var Map$2 = _Map;
3832var Promise$1 = _Promise;
3833var Set = _Set;
3834var WeakMap = _WeakMap;
3835var baseGetTag$5 = _baseGetTag;
3836var toSource$2 = _toSource;
3837
3838/** `Object#toString` result references. */
3839var mapTag$2 = '[object Map]';
3840var objectTag$1 = '[object Object]';
3841var promiseTag = '[object Promise]';
3842var setTag$2 = '[object Set]';
3843var weakMapTag$1 = '[object WeakMap]';
3844
3845var dataViewTag$1 = '[object DataView]';
3846
3847/** Used to detect maps, sets, and weakmaps. */
3848var dataViewCtorString = toSource$2(DataView);
3849var mapCtorString = toSource$2(Map$2);
3850var promiseCtorString = toSource$2(Promise$1);
3851var setCtorString = toSource$2(Set);
3852var 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 */
3861var getTag$1 = baseGetTag$5;
3862
3863// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
3864if ((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
3887var _getTag = getTag$1;
3888
3889var baseKeys$2 = _baseKeys;
3890var getTag = _getTag;
3891var isArguments$3 = isArguments_1;
3892var isArray$8 = isArray_1;
3893var isArrayLike$2 = isArrayLike_1;
3894var isBuffer$1 = isBuffer_1;
3895var isPrototype$2 = _isPrototype;
3896var isTypedArray$2 = isTypedArray_1;
3897
3898/** `Object#toString` result references. */
3899var mapTag$1 = '[object Map]';
3900var setTag$1 = '[object Set]';
3901
3902/** Used for built-in method references. */
3903var objectProto$9 = Object.prototype;
3904
3905/** Used to check objects for own properties. */
3906var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
3907
3908/**
3909 * Checks if `value` is an empty object, collection, map, or set.
3910 *
3911 * Objects are considered empty if they have no own enumerable string keyed
3912 * properties.
3913 *
3914 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
3915 * jQuery-like collections are considered empty if they have a `length` of `0`.
3916 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
3917 *
3918 * @static
3919 * @memberOf _
3920 * @since 0.1.0
3921 * @category Lang
3922 * @param {*} value The value to check.
3923 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
3924 * @example
3925 *
3926 * _.isEmpty(null);
3927 * // => true
3928 *
3929 * _.isEmpty(true);
3930 * // => true
3931 *
3932 * _.isEmpty(1);
3933 * // => true
3934 *
3935 * _.isEmpty([1, 2, 3]);
3936 * // => false
3937 *
3938 * _.isEmpty({ 'a': 1 });
3939 * // => false
3940 */
3941function 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
3965var isEmpty_1 = isEmpty;
3966
3967var createCompounder$2 = _createCompounder;
3968
3969/**
3970 * Converts `string` to
3971 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
3972 *
3973 * @static
3974 * @memberOf _
3975 * @since 3.0.0
3976 * @category String
3977 * @param {string} [string=''] The string to convert.
3978 * @returns {string} Returns the kebab cased string.
3979 * @example
3980 *
3981 * _.kebabCase('Foo Bar');
3982 * // => 'foo-bar'
3983 *
3984 * _.kebabCase('fooBar');
3985 * // => 'foo-bar'
3986 *
3987 * _.kebabCase('__FOO_BAR__');
3988 * // => 'foo-bar'
3989 */
3990var kebabCase = createCompounder$2(function(result, word, index) {
3991 return result + (index ? '-' : '') + word.toLowerCase();
3992});
3993
3994var kebabCase_1 = kebabCase;
3995
3996/**
3997 * The base implementation of `_.findIndex` and `_.findLastIndex` without
3998 * support for iteratee shorthands.
3999 *
4000 * @private
4001 * @param {Array} array The array to inspect.
4002 * @param {Function} predicate The function invoked per iteration.
4003 * @param {number} fromIndex The index to search from.
4004 * @param {boolean} [fromRight] Specify iterating from right to left.
4005 * @returns {number} Returns the index of the matched value, else `-1`.
4006 */
4007function 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
4019var _baseFindIndex = baseFindIndex$1;
4020
4021/**
4022 * The base implementation of `_.isNaN` without support for number objects.
4023 *
4024 * @private
4025 * @param {*} value The value to check.
4026 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
4027 */
4028function baseIsNaN$1(value) {
4029 return value !== value;
4030}
4031
4032var _baseIsNaN = baseIsNaN$1;
4033
4034/**
4035 * A specialized version of `_.indexOf` which performs strict equality
4036 * comparisons of values, i.e. `===`.
4037 *
4038 * @private
4039 * @param {Array} array The array to inspect.
4040 * @param {*} value The value to search for.
4041 * @param {number} fromIndex The index to search from.
4042 * @returns {number} Returns the index of the matched value, else `-1`.
4043 */
4044function 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
4056var _strictIndexOf = strictIndexOf$1;
4057
4058var baseFindIndex = _baseFindIndex;
4059var baseIsNaN = _baseIsNaN;
4060var strictIndexOf = _strictIndexOf;
4061
4062/**
4063 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
4064 *
4065 * @private
4066 * @param {Array} array The array to inspect.
4067 * @param {*} value The value to search for.
4068 * @param {number} fromIndex The index to search from.
4069 * @returns {number} Returns the index of the matched value, else `-1`.
4070 */
4071function baseIndexOf$1(array, value, fromIndex) {
4072 return value === value
4073 ? strictIndexOf(array, value, fromIndex)
4074 : baseFindIndex(array, baseIsNaN, fromIndex);
4075}
4076
4077var _baseIndexOf = baseIndexOf$1;
4078
4079/**
4080 * This function is like `baseIndexOf` except that it accepts a comparator.
4081 *
4082 * @private
4083 * @param {Array} array The array to inspect.
4084 * @param {*} value The value to search for.
4085 * @param {number} fromIndex The index to search from.
4086 * @param {Function} comparator The comparator invoked per element.
4087 * @returns {number} Returns the index of the matched value, else `-1`.
4088 */
4089function 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
4101var _baseIndexOfWith = baseIndexOfWith$1;
4102
4103var arrayMap$2 = _arrayMap;
4104var baseIndexOf = _baseIndexOf;
4105var baseIndexOfWith = _baseIndexOfWith;
4106var baseUnary$2 = _baseUnary;
4107var copyArray$2 = _copyArray;
4108
4109/** Used for built-in method references. */
4110var arrayProto$1 = Array.prototype;
4111
4112/** Built-in value references. */
4113var splice$1 = arrayProto$1.splice;
4114
4115/**
4116 * The base implementation of `_.pullAllBy` without support for iteratee
4117 * shorthands.
4118 *
4119 * @private
4120 * @param {Array} array The array to modify.
4121 * @param {Array} values The values to remove.
4122 * @param {Function} [iteratee] The iteratee invoked per element.
4123 * @param {Function} [comparator] The comparator invoked per element.
4124 * @returns {Array} Returns `array`.
4125 */
4126function 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
4153var _basePullAll = basePullAll$1;
4154
4155var basePullAll = _basePullAll;
4156
4157/**
4158 * This method is like `_.pull` except that it accepts an array of values to remove.
4159 *
4160 * **Note:** Unlike `_.difference`, this method mutates `array`.
4161 *
4162 * @static
4163 * @memberOf _
4164 * @since 4.0.0
4165 * @category Array
4166 * @param {Array} array The array to modify.
4167 * @param {Array} values The values to remove.
4168 * @returns {Array} Returns `array`.
4169 * @example
4170 *
4171 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
4172 *
4173 * _.pullAll(array, ['a', 'c']);
4174 * console.log(array);
4175 * // => ['b', 'b']
4176 */
4177function pullAll(array, values) {
4178 return (array && array.length && values && values.length)
4179 ? basePullAll(array, values)
4180 : array;
4181}
4182
4183var pullAll_1 = pullAll;
4184
4185var createCompounder$3 = _createCompounder;
4186
4187/**
4188 * Converts `string` to
4189 * [snake case](https://en.wikipedia.org/wiki/Snake_case).
4190 *
4191 * @static
4192 * @memberOf _
4193 * @since 3.0.0
4194 * @category String
4195 * @param {string} [string=''] The string to convert.
4196 * @returns {string} Returns the snake cased string.
4197 * @example
4198 *
4199 * _.snakeCase('Foo Bar');
4200 * // => 'foo_bar'
4201 *
4202 * _.snakeCase('fooBar');
4203 * // => 'foo_bar'
4204 *
4205 * _.snakeCase('--FOO-BAR--');
4206 * // => 'foo_bar'
4207 */
4208var snakeCase = createCompounder$3(function(result, word, index) {
4209 return result + (index ? '_' : '') + word.toLowerCase();
4210});
4211
4212var snakeCase_1 = snakeCase;
4213
4214/** Used to stand-in for `undefined` hash values. */
4215var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
4216
4217/**
4218 * Adds `value` to the array cache.
4219 *
4220 * @private
4221 * @name add
4222 * @memberOf SetCache
4223 * @alias push
4224 * @param {*} value The value to cache.
4225 * @returns {Object} Returns the cache instance.
4226 */
4227function setCacheAdd$1(value) {
4228 this.__data__.set(value, HASH_UNDEFINED$2);
4229 return this;
4230}
4231
4232var _setCacheAdd = setCacheAdd$1;
4233
4234/**
4235 * Checks if `value` is in the array cache.
4236 *
4237 * @private
4238 * @name has
4239 * @memberOf SetCache
4240 * @param {*} value The value to search for.
4241 * @returns {number} Returns `true` if `value` is found, else `false`.
4242 */
4243function setCacheHas$1(value) {
4244 return this.__data__.has(value);
4245}
4246
4247var _setCacheHas = setCacheHas$1;
4248
4249var MapCache$2 = _MapCache;
4250var setCacheAdd = _setCacheAdd;
4251var setCacheHas = _setCacheHas;
4252
4253/**
4254 *
4255 * Creates an array cache object to store unique values.
4256 *
4257 * @private
4258 * @constructor
4259 * @param {Array} [values] The values to cache.
4260 */
4261function 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// Add methods to `SetCache`.
4272SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
4273SetCache$1.prototype.has = setCacheHas;
4274
4275var _SetCache = SetCache$1;
4276
4277var baseIndexOf$2 = _baseIndexOf;
4278
4279/**
4280 * A specialized version of `_.includes` for arrays without support for
4281 * specifying an index to search from.
4282 *
4283 * @private
4284 * @param {Array} [array] The array to inspect.
4285 * @param {*} target The value to search for.
4286 * @returns {boolean} Returns `true` if `target` is found, else `false`.
4287 */
4288function arrayIncludes$1(array, value) {
4289 var length = array == null ? 0 : array.length;
4290 return !!length && baseIndexOf$2(array, value, 0) > -1;
4291}
4292
4293var _arrayIncludes = arrayIncludes$1;
4294
4295/**
4296 * This function is like `arrayIncludes` except that it accepts a comparator.
4297 *
4298 * @private
4299 * @param {Array} [array] The array to inspect.
4300 * @param {*} target The value to search for.
4301 * @param {Function} comparator The comparator invoked per element.
4302 * @returns {boolean} Returns `true` if `target` is found, else `false`.
4303 */
4304function 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
4316var _arrayIncludesWith = arrayIncludesWith$1;
4317
4318/**
4319 * Checks if a `cache` value for `key` exists.
4320 *
4321 * @private
4322 * @param {Object} cache The cache to query.
4323 * @param {string} key The key of the entry to check.
4324 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
4325 */
4326function cacheHas$1(cache, key) {
4327 return cache.has(key);
4328}
4329
4330var _cacheHas = cacheHas$1;
4331
4332/**
4333 * This method returns `undefined`.
4334 *
4335 * @static
4336 * @memberOf _
4337 * @since 2.3.0
4338 * @category Util
4339 * @example
4340 *
4341 * _.times(2, _.noop);
4342 * // => [undefined, undefined]
4343 */
4344function noop$1() {
4345 // No operation performed.
4346}
4347
4348var noop_1 = noop$1;
4349
4350/**
4351 * Converts `set` to an array of its values.
4352 *
4353 * @private
4354 * @param {Object} set The set to convert.
4355 * @returns {Array} Returns the values.
4356 */
4357function 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
4367var _setToArray = setToArray$2;
4368
4369var Set$2 = _Set;
4370var noop = noop_1;
4371var setToArray$1 = _setToArray;
4372
4373/** Used as references for various `Number` constants. */
4374var INFINITY$2 = 1 / 0;
4375
4376/**
4377 * Creates a set object of `values`.
4378 *
4379 * @private
4380 * @param {Array} values The values to add to the set.
4381 * @returns {Object} Returns the new set.
4382 */
4383var 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
4387var _createSet = createSet$1;
4388
4389var SetCache = _SetCache;
4390var arrayIncludes = _arrayIncludes;
4391var arrayIncludesWith = _arrayIncludesWith;
4392var cacheHas = _cacheHas;
4393var createSet = _createSet;
4394var setToArray = _setToArray;
4395
4396/** Used as the size to enable large array optimizations. */
4397var LARGE_ARRAY_SIZE = 200;
4398
4399/**
4400 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
4401 *
4402 * @private
4403 * @param {Array} array The array to inspect.
4404 * @param {Function} [iteratee] The iteratee invoked per element.
4405 * @param {Function} [comparator] The comparator invoked per element.
4406 * @returns {Array} Returns the new duplicate free array.
4407 */
4408function 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
4460var _baseUniq = baseUniq$1;
4461
4462var baseUniq = _baseUniq;
4463
4464/**
4465 * Creates a duplicate-free version of an array, using
4466 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4467 * for equality comparisons, in which only the first occurrence of each element
4468 * is kept. The order of result values is determined by the order they occur
4469 * in the array.
4470 *
4471 * @static
4472 * @memberOf _
4473 * @since 0.1.0
4474 * @category Array
4475 * @param {Array} array The array to inspect.
4476 * @returns {Array} Returns the new duplicate free array.
4477 * @example
4478 *
4479 * _.uniq([2, 1, 2]);
4480 * // => [2, 1]
4481 */
4482function uniq(array) {
4483 return (array && array.length) ? baseUniq(array) : [];
4484}
4485
4486var uniq_1 = uniq;
4487
4488var DEFAULT_FROM_INDEX = 0;
4489var DEFAULT_TO_INDEX = 19;
4490var MY_PATH_KEYWORD = 'self';
4491
4492function 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
4499function 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
4517function entityNameToFilename(name) {
4518 return kebabCase_1(name) + '.js';
4519}
4520
4521function entityToAPIEnvelopeKey(entity) {
4522 return snakeCase_1(entity.name);
4523}
4524
4525function entityToFalcorListLeaf(entity) {
4526 return snakeCase_1(entity.name) + '_list';
4527}
4528
4529function entityToFalcorMembershipsListLeaf(entity) {
4530 return 'membership_' + entityToFalcorListLeaf(entity);
4531}
4532
4533function entityToFalcorMyListLeaf(entity) {
4534 return 'my_' + entityToFalcorListLeaf(entity);
4535}
4536
4537function entityToFalcorRootLeaf(entity) {
4538 return snakeCase_1(entity.pluralName);
4539}
4540
4541function falcorListLeafToEntityName(listLeaf) {
4542 return camelCase_1(listLeaf.replace(/_list$/, ''));
4543}
4544
4545function falcorRootLeafToEntityName(rootLeaf) {
4546 return camelCase_1(rootLeaf);
4547}
4548
4549function optionsHasQuery(options) {
4550 return keys_1(options.query).length > 0;
4551}
4552
4553var name$4 = 'comment';
4554var pluralName$4 = 'comments';
4555
4556var defaultProperties$4 = ['id', 'body', 'markup_tokens', 'post', 'owner.id', 'owner.first_name', 'owner.last_name', 'owner.name', 'owner.avatar.src', 'created_at'];
4557
4558function 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// TODO: Update Falcor comment routes to follow standard entity
4573// *_list and length conventions and then remove this override
4574function 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
4590var comment = Object.freeze({
4591 name: name$4,
4592 pluralName: pluralName$4,
4593 defaultProperties: defaultProperties$4,
4594 invalidateAfterCreate: invalidateAfterCreate,
4595 invalidateAfterDestroy: invalidateAfterDestroy
4596});
4597
4598var name$5 = 'directMessage';
4599var pluralName$5 = 'directMessages';
4600
4601var defaultProperties$5 = ['id', 'name'];
4602
4603var directMessage = Object.freeze({
4604 name: name$5,
4605 pluralName: pluralName$5,
4606 defaultProperties: defaultProperties$5
4607});
4608
4609var name$6 = 'featuredContent';
4610var pluralName$6 = 'featuredContents';
4611
4612var defaultProperties$6 = ['id', 'content_id', 'content_type', 'new', 'position'];
4613
4614var featuredContent = Object.freeze({
4615 name: name$6,
4616 pluralName: pluralName$6,
4617 defaultProperties: defaultProperties$6
4618});
4619
4620var 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
4635var TokenTypes_1 = TokenTypes;
4636
4637var index$1 = createCommonjsModule(function (module) {
4638var TokenTypes = TokenTypes_1;
4639var DOT_SEPARATOR = '.';
4640var COMMA_SEPARATOR = ',';
4641var OPENING_BRACKET = '[';
4642var CLOSING_BRACKET = ']';
4643var OPENING_BRACE = '{';
4644var CLOSING_BRACE = '}';
4645var COLON = ':';
4646var ESCAPE = '\\';
4647var DOUBLE_OUOTES = '"';
4648var SINGE_OUOTES = "'";
4649var SPACE = " ";
4650var SPECIAL_CHARACTERS = '\\\'"[]., ';
4651var EXT_SPECIAL_CHARACTERS = '\\{}\'"[]., :';
4652
4653var Tokenizer = module.exports = function(string, ext) {
4654 this._string = string;
4655 this._idx = -1;
4656 this._extended = ext;
4657 this.parseString = '';
4658};
4659
4660Tokenizer.prototype = {
4661 /**
4662 * grabs the next token either from the peek operation or generates the
4663 * next token.
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 * will peak but not increment the tokenizer
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
4688Tokenizer.toNumber = function toNumber(x) {
4689 if (!isNaN(+x)) {
4690 return +x;
4691 }
4692 return NaN;
4693};
4694
4695function toOutput(token, type, done) {
4696 return {
4697 token: token,
4698 done: done,
4699 type: type
4700 };
4701}
4702
4703function 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 // we have to peek at the next token
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 // The token to delimiting character transition.
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
4790var 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
4822var Tokenizer$1 = index$1;
4823var TokenTypes$3 = TokenTypes_1;
4824var E$2 = index$3;
4825
4826/**
4827 * The indexer is all the logic that happens in between
4828 * the '[', opening bracket, and ']' closing bracket.
4829 */
4830var 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 // Grab the last token off the stack. Must be an integer.
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 // Why is number checking so difficult in javascript.
4846
4847 while (!done && !token.done) {
4848
4849 switch (token.type) {
4850
4851 // dotSeparators at the top level have no meaning
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 // move the tokenizer forward and save to.
4865 to = Tokenizer$1.toNumber(tokenizer.next().token);
4866
4867 // throw potential error.
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 // Keep cycling through the tokenizer. But ranges have to peek
4881 // before they go to the next token since there is no 'terminating'
4882 // character.
4883 if (!done) {
4884 tokenizer.next();
4885
4886 // go to the next token without consuming.
4887 token = tokenizer.peek();
4888 }
4889
4890 // break and remove state information.
4891 else {
4892 break;
4893 }
4894 }
4895
4896 state.indexer[idx] = {from: from, to: inclusive ? to : to - 1};
4897};
4898
4899var TokenTypes$4 = TokenTypes_1;
4900var E$3 = index$3;
4901var quoteE = E$3.quote;
4902
4903/**
4904 * quote is all the parse tree in between quotes. This includes the only
4905 * escaping logic.
4906 *
4907 * parse-tree:
4908 * <opening-quote>(.|(<escape><opening-quote>))*<opening-quote>
4909 */
4910var 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 // the simple case. We are escaping
4940 if (escaping) {
4941 innerToken += token.token;
4942 escaping = false;
4943 }
4944
4945 // its not a quote that is the opening quote
4946 else if (token.token !== openingQuote) {
4947 innerToken += token.token;
4948 }
4949
4950 // last thing left. Its a quote that is the opening quote
4951 // therefore we must produce the inner token of the indexer.
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 // If done, leave loop
4966 if (done) {
4967 break;
4968 }
4969
4970 // Keep cycling through the tokenizer.
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
4981var RoutedTokens$2 = {
4982 integers: 'integers',
4983 ranges: 'ranges',
4984 keys: 'keys'
4985};
4986
4987var TokenTypes$5 = TokenTypes_1;
4988var RoutedTokens$1 = RoutedTokens$2;
4989var E$4 = index$3;
4990var routedE = E$4.routed;
4991
4992/**
4993 * The routing logic.
4994 *
4995 * parse-tree:
4996 * <opening-brace><routed-token>(:<token>)<closing-brace>
4997 */
4998var routed$1 = function routed(tokenizer, openingToken, state, out) {
4999 var routeToken = tokenizer.next();
5000 var named = false;
5001 var name = '';
5002
5003 // ensure the routed token is a valid ident.
5004 switch (routeToken.token) {
5005 case RoutedTokens$1.integers:
5006 case RoutedTokens$1.ranges:
5007 case RoutedTokens$1.keys:
5008 //valid
5009 break;
5010 default:
5011 E$4.throwError(routedE.invalid, tokenizer);
5012 break;
5013 }
5014
5015 // Now its time for colon or ending brace.
5016 var next = tokenizer.next();
5017
5018 // we are parsing a named identifier.
5019 if (next.type === TokenTypes$5.colon) {
5020 named = true;
5021
5022 // Get the token name.
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 // move to the closing brace.
5030 next = tokenizer.next();
5031 }
5032
5033 // must close with a brace.
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 // closing brace expected
5045 else {
5046 E$4.throwError(routedE.invalid, tokenizer);
5047 }
5048
5049};
5050
5051var TokenTypes$2 = TokenTypes_1;
5052var E$1 = index$3;
5053var idxE = E$1.indexer;
5054var range = range$1;
5055var quote = quote$1;
5056var routed = routed$1;
5057
5058/**
5059 * The indexer is all the logic that happens in between
5060 * the '[', opening bracket, and ']' closing bracket.
5061 */
5062var 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 // State variables
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 // ensures that token adders are properly delimited.
5078 if (state.indexer.length === allowedMaxLength) {
5079 E$1.throwError(idxE.requiresComma, tokenizer);
5080 }
5081 break;
5082 }
5083
5084 switch (token.type) {
5085 // Extended syntax case
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 // dotSeparators at the top level have no meaning
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 // Spaces do nothing.
5109 case TokenTypes$2.space:
5110 break;
5111
5112 case TokenTypes$2.closingBracket:
5113 done = true;
5114 break;
5115
5116
5117 // The quotes require their own tree due to what can be in it.
5118 case TokenTypes$2.quote:
5119 quote(tokenizer, token, state, out);
5120 break;
5121
5122
5123 // Its time to decend the parse tree.
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 // If done, leave loop
5138 if (done) {
5139 break;
5140 }
5141
5142 // Keep cycling through the tokenizer.
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 // Remember, if an array of 1, keySets will be generated.
5155 if (state.indexer.length === 1) {
5156 state.indexer = state.indexer[0];
5157 }
5158
5159 out[out.length] = state.indexer;
5160
5161 // Clean state.
5162 state.indexer = undefined;
5163};
5164
5165var TokenTypes$1 = TokenTypes_1;
5166var E = index$3;
5167var indexer = indexer$1;
5168
5169/**
5170 * The top level of the parse tree. This returns the generated path
5171 * from the tokenizer.
5172 */
5173var 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 // dotSeparators at the top level have no meaning
5190 case TokenTypes$1.dotSeparator:
5191 if (out.length === 0) {
5192 E.throwError(E.unexpectedToken, tokenizer);
5193 }
5194 break;
5195
5196 // Spaces do nothing.
5197 case TokenTypes$1.space:
5198 // NOTE: Spaces at the top level are allowed.
5199 // titlesById .summary is a valid path.
5200 break;
5201
5202
5203 // Its time to decend the parse tree.
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 // Keep cycling through the tokenizer.
5214 token = tokenizer.next();
5215 }
5216
5217 if (out.length === 0) {
5218 E.throwError(E.invalidPath, tokenizer);
5219 }
5220
5221 return out;
5222};
5223
5224var Tokenizer = index$1;
5225var head$2 = head$3;
5226var RoutedTokens = RoutedTokens$2;
5227
5228var parser = function parser(string, extendedRules) {
5229 return head$2(new Tokenizer(string, extendedRules));
5230};
5231
5232var index = parser;
5233
5234// Constructs the paths from paths / pathValues that have strings.
5235// If it does not have a string, just moves the value into the return
5236// results.
5237parser.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 // Is the path a string
5246 if (typeof paths[i] === 'string') {
5247 out[i] = parser(paths[i], ext);
5248 }
5249
5250 // is the path a path value with a string value.
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 // just copy it over.
5258 else {
5259 out[i] = paths[i];
5260 }
5261 }
5262
5263 return out;
5264};
5265
5266// If the argument is a string, this with convert, else just return
5267// the path provided.
5268parser.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// Potential routed tokens.
5281parser.RoutedTokens = RoutedTokens;
5282
5283var ListCache$3 = _ListCache;
5284
5285/**
5286 * Removes all key-value entries from the stack.
5287 *
5288 * @private
5289 * @name clear
5290 * @memberOf Stack
5291 */
5292function stackClear$1() {
5293 this.__data__ = new ListCache$3;
5294 this.size = 0;
5295}
5296
5297var _stackClear = stackClear$1;
5298
5299/**
5300 * Removes `key` and its value from the stack.
5301 *
5302 * @private
5303 * @name delete
5304 * @memberOf Stack
5305 * @param {string} key The key of the value to remove.
5306 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
5307 */
5308function stackDelete$1(key) {
5309 var data = this.__data__,
5310 result = data['delete'](key);
5311
5312 this.size = data.size;
5313 return result;
5314}
5315
5316var _stackDelete = stackDelete$1;
5317
5318/**
5319 * Gets the stack value for `key`.
5320 *
5321 * @private
5322 * @name get
5323 * @memberOf Stack
5324 * @param {string} key The key of the value to get.
5325 * @returns {*} Returns the entry value.
5326 */
5327function stackGet$1(key) {
5328 return this.__data__.get(key);
5329}
5330
5331var _stackGet = stackGet$1;
5332
5333/**
5334 * Checks if a stack value for `key` exists.
5335 *
5336 * @private
5337 * @name has
5338 * @memberOf Stack
5339 * @param {string} key The key of the entry to check.
5340 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
5341 */
5342function stackHas$1(key) {
5343 return this.__data__.has(key);
5344}
5345
5346var _stackHas = stackHas$1;
5347
5348var ListCache$4 = _ListCache;
5349var Map$3 = _Map;
5350var MapCache$3 = _MapCache;
5351
5352/** Used as the size to enable large array optimizations. */
5353var LARGE_ARRAY_SIZE$1 = 200;
5354
5355/**
5356 * Sets the stack `key` to `value`.
5357 *
5358 * @private
5359 * @name set
5360 * @memberOf Stack
5361 * @param {string} key The key of the value to set.
5362 * @param {*} value The value to set.
5363 * @returns {Object} Returns the stack cache instance.
5364 */
5365function 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
5381var _stackSet = stackSet$1;
5382
5383var ListCache$2 = _ListCache;
5384var stackClear = _stackClear;
5385var stackDelete = _stackDelete;
5386var stackGet = _stackGet;
5387var stackHas = _stackHas;
5388var stackSet = _stackSet;
5389
5390/**
5391 * Creates a stack cache object to store key-value pairs.
5392 *
5393 * @private
5394 * @constructor
5395 * @param {Array} [entries] The key-value pairs to cache.
5396 */
5397function Stack$1(entries) {
5398 var data = this.__data__ = new ListCache$2(entries);
5399 this.size = data.size;
5400}
5401
5402// Add methods to `Stack`.
5403Stack$1.prototype.clear = stackClear;
5404Stack$1.prototype['delete'] = stackDelete;
5405Stack$1.prototype.get = stackGet;
5406Stack$1.prototype.has = stackHas;
5407Stack$1.prototype.set = stackSet;
5408
5409var _Stack = Stack$1;
5410
5411/**
5412 * A specialized version of `_.some` for arrays without support for iteratee
5413 * shorthands.
5414 *
5415 * @private
5416 * @param {Array} [array] The array to iterate over.
5417 * @param {Function} predicate The function invoked per iteration.
5418 * @returns {boolean} Returns `true` if any element passes the predicate check,
5419 * else `false`.
5420 */
5421function 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
5433var _arraySome = arraySome$1;
5434
5435var SetCache$2 = _SetCache;
5436var arraySome = _arraySome;
5437var cacheHas$2 = _cacheHas;
5438
5439/** Used to compose bitmasks for value comparisons. */
5440var COMPARE_PARTIAL_FLAG$2 = 1;
5441var COMPARE_UNORDERED_FLAG$1 = 2;
5442
5443/**
5444 * A specialized version of `baseIsEqualDeep` for arrays with support for
5445 * partial deep comparisons.
5446 *
5447 * @private
5448 * @param {Array} array The array to compare.
5449 * @param {Array} other The other array to compare.
5450 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5451 * @param {Function} customizer The function to customize comparisons.
5452 * @param {Function} equalFunc The function to determine equivalents of values.
5453 * @param {Object} stack Tracks traversed `array` and `other` objects.
5454 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
5455 */
5456function 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 // Assume cyclic values are equal.
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 // Ignore non-index properties.
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 // Recursively compare arrays (susceptible to call stack limits).
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
5517var _equalArrays = equalArrays$1;
5518
5519var root$8 = _root;
5520
5521/** Built-in value references. */
5522var Uint8Array$1 = root$8.Uint8Array;
5523
5524var _Uint8Array = Uint8Array$1;
5525
5526/**
5527 * Converts `map` to its key-value pairs.
5528 *
5529 * @private
5530 * @param {Object} map The map to convert.
5531 * @returns {Array} Returns the key-value pairs.
5532 */
5533function 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
5543var _mapToArray = mapToArray$1;
5544
5545var Symbol$5 = _Symbol;
5546var Uint8Array = _Uint8Array;
5547var eq$2 = eq_1;
5548var equalArrays$2 = _equalArrays;
5549var mapToArray = _mapToArray;
5550var setToArray$3 = _setToArray;
5551
5552/** Used to compose bitmasks for value comparisons. */
5553var COMPARE_PARTIAL_FLAG$3 = 1;
5554var COMPARE_UNORDERED_FLAG$2 = 2;
5555
5556/** `Object#toString` result references. */
5557var boolTag$1 = '[object Boolean]';
5558var dateTag$1 = '[object Date]';
5559var errorTag$1 = '[object Error]';
5560var mapTag$3 = '[object Map]';
5561var numberTag$1 = '[object Number]';
5562var regexpTag$1 = '[object RegExp]';
5563var setTag$3 = '[object Set]';
5564var stringTag$1 = '[object String]';
5565var symbolTag$1 = '[object Symbol]';
5566
5567var arrayBufferTag$1 = '[object ArrayBuffer]';
5568var dataViewTag$2 = '[object DataView]';
5569
5570/** Used to convert symbols to primitives and strings. */
5571var symbolProto$1 = Symbol$5 ? Symbol$5.prototype : undefined;
5572var symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
5573
5574/**
5575 * A specialized version of `baseIsEqualDeep` for comparing objects of
5576 * the same `toStringTag`.
5577 *
5578 * **Note:** This function only supports comparing values with tags of
5579 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
5580 *
5581 * @private
5582 * @param {Object} object The object to compare.
5583 * @param {Object} other The other object to compare.
5584 * @param {string} tag The `toStringTag` of the objects to compare.
5585 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5586 * @param {Function} customizer The function to customize comparisons.
5587 * @param {Function} equalFunc The function to determine equivalents of values.
5588 * @param {Object} stack Tracks traversed `object` and `other` objects.
5589 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5590 */
5591function 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 // Coerce booleans to `1` or `0` and dates to milliseconds.
5612 // Invalid dates are coerced to `NaN`.
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 // Coerce regexes to strings and treat strings, primitives and objects,
5621 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
5622 // for more details.
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 // Assume cyclic values are equal.
5636 var stacked = stack.get(object);
5637 if (stacked) {
5638 return stacked == other;
5639 }
5640 bitmask |= COMPARE_UNORDERED_FLAG$2;
5641
5642 // Recursively compare objects (susceptible to call stack limits).
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
5656var _equalByTag = equalByTag$1;
5657
5658var arrayPush$3 = _arrayPush;
5659var isArray$12 = isArray_1;
5660
5661/**
5662 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
5663 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
5664 * symbols of `object`.
5665 *
5666 * @private
5667 * @param {Object} object The object to query.
5668 * @param {Function} keysFunc The function to get the keys of `object`.
5669 * @param {Function} symbolsFunc The function to get the symbols of `object`.
5670 * @returns {Array} Returns the array of property names and symbols.
5671 */
5672function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
5673 var result = keysFunc(object);
5674 return isArray$12(object) ? result : arrayPush$3(result, symbolsFunc(object));
5675}
5676
5677var _baseGetAllKeys = baseGetAllKeys$1;
5678
5679/**
5680 * A specialized version of `_.filter` for arrays without support for
5681 * iteratee shorthands.
5682 *
5683 * @private
5684 * @param {Array} [array] The array to iterate over.
5685 * @param {Function} predicate The function invoked per iteration.
5686 * @returns {Array} Returns the new filtered array.
5687 */
5688function 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
5703var _arrayFilter = arrayFilter$1;
5704
5705/**
5706 * This method returns a new empty array.
5707 *
5708 * @static
5709 * @memberOf _
5710 * @since 4.13.0
5711 * @category Util
5712 * @returns {Array} Returns the new empty array.
5713 * @example
5714 *
5715 * var arrays = _.times(2, _.stubArray);
5716 *
5717 * console.log(arrays);
5718 * // => [[], []]
5719 *
5720 * console.log(arrays[0] === arrays[1]);
5721 * // => false
5722 */
5723function stubArray$1() {
5724 return [];
5725}
5726
5727var stubArray_1 = stubArray$1;
5728
5729var arrayFilter = _arrayFilter;
5730var stubArray = stubArray_1;
5731
5732/** Used for built-in method references. */
5733var objectProto$12 = Object.prototype;
5734
5735/** Built-in value references. */
5736var propertyIsEnumerable$1 = objectProto$12.propertyIsEnumerable;
5737
5738/* Built-in method references for those with the same name as other `lodash` methods. */
5739var nativeGetSymbols = Object.getOwnPropertySymbols;
5740
5741/**
5742 * Creates an array of the own enumerable symbols of `object`.
5743 *
5744 * @private
5745 * @param {Object} object The object to query.
5746 * @returns {Array} Returns the array of symbols.
5747 */
5748var 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
5758var _getSymbols = getSymbols$1;
5759
5760var baseGetAllKeys = _baseGetAllKeys;
5761var getSymbols = _getSymbols;
5762var keys$2 = keys_1;
5763
5764/**
5765 * Creates an array of own enumerable property names and symbols of `object`.
5766 *
5767 * @private
5768 * @param {Object} object The object to query.
5769 * @returns {Array} Returns the array of property names and symbols.
5770 */
5771function getAllKeys$1(object) {
5772 return baseGetAllKeys(object, keys$2, getSymbols);
5773}
5774
5775var _getAllKeys = getAllKeys$1;
5776
5777var getAllKeys = _getAllKeys;
5778
5779/** Used to compose bitmasks for value comparisons. */
5780var COMPARE_PARTIAL_FLAG$4 = 1;
5781
5782/** Used for built-in method references. */
5783var objectProto$11 = Object.prototype;
5784
5785/** Used to check objects for own properties. */
5786var hasOwnProperty$9 = objectProto$11.hasOwnProperty;
5787
5788/**
5789 * A specialized version of `baseIsEqualDeep` for objects with support for
5790 * partial deep comparisons.
5791 *
5792 * @private
5793 * @param {Object} object The object to compare.
5794 * @param {Object} other The other object to compare.
5795 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5796 * @param {Function} customizer The function to customize comparisons.
5797 * @param {Function} equalFunc The function to determine equivalents of values.
5798 * @param {Object} stack Tracks traversed `object` and `other` objects.
5799 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5800 */
5801function 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 // Assume cyclic values are equal.
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 // Recursively compare objects (susceptible to call stack limits).
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 // Non `Object` object instances with different constructors are not equal.
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
5865var _equalObjects = equalObjects$1;
5866
5867var Stack$2 = _Stack;
5868var equalArrays = _equalArrays;
5869var equalByTag = _equalByTag;
5870var equalObjects = _equalObjects;
5871var getTag$2 = _getTag;
5872var isArray$11 = isArray_1;
5873var isBuffer$2 = isBuffer_1;
5874var isTypedArray$3 = isTypedArray_1;
5875
5876/** Used to compose bitmasks for value comparisons. */
5877var COMPARE_PARTIAL_FLAG$1 = 1;
5878
5879/** `Object#toString` result references. */
5880var argsTag$2 = '[object Arguments]';
5881var arrayTag$1 = '[object Array]';
5882var objectTag$2 = '[object Object]';
5883
5884/** Used for built-in method references. */
5885var objectProto$10 = Object.prototype;
5886
5887/** Used to check objects for own properties. */
5888var hasOwnProperty$8 = objectProto$10.hasOwnProperty;
5889
5890/**
5891 * A specialized version of `baseIsEqual` for arrays and objects which performs
5892 * deep comparisons and tracks traversed objects enabling objects with circular
5893 * references to be compared.
5894 *
5895 * @private
5896 * @param {Object} object The object to compare.
5897 * @param {Object} other The other object to compare.
5898 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5899 * @param {Function} customizer The function to customize comparisons.
5900 * @param {Function} equalFunc The function to determine equivalents of values.
5901 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
5902 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
5903 */
5904function 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
5949var _baseIsEqualDeep = baseIsEqualDeep$1;
5950
5951var baseIsEqualDeep = _baseIsEqualDeep;
5952var isObjectLike$5 = isObjectLike_1;
5953
5954/**
5955 * The base implementation of `_.isEqual` which supports partial comparisons
5956 * and tracks traversed objects.
5957 *
5958 * @private
5959 * @param {*} value The value to compare.
5960 * @param {*} other The other value to compare.
5961 * @param {boolean} bitmask The bitmask flags.
5962 * 1 - Unordered comparison
5963 * 2 - Partial comparison
5964 * @param {Function} [customizer] The function to customize comparisons.
5965 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
5966 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
5967 */
5968function 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
5978var _baseIsEqual = baseIsEqual$1;
5979
5980var Stack = _Stack;
5981var baseIsEqual = _baseIsEqual;
5982
5983/** Used to compose bitmasks for value comparisons. */
5984var COMPARE_PARTIAL_FLAG = 1;
5985var COMPARE_UNORDERED_FLAG = 2;
5986
5987/**
5988 * The base implementation of `_.isMatch` without support for iteratee shorthands.
5989 *
5990 * @private
5991 * @param {Object} object The object to inspect.
5992 * @param {Object} source The object of property values to match.
5993 * @param {Array} matchData The property names, values, and compare flags to match.
5994 * @param {Function} [customizer] The function to customize comparisons.
5995 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
5996 */
5997function 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
6041var _baseIsMatch = baseIsMatch$1;
6042
6043var isObject$3 = isObject_1;
6044
6045/**
6046 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
6047 *
6048 * @private
6049 * @param {*} value The value to check.
6050 * @returns {boolean} Returns `true` if `value` if suitable for strict
6051 * equality comparisons, else `false`.
6052 */
6053function isStrictComparable$1(value) {
6054 return value === value && !isObject$3(value);
6055}
6056
6057var _isStrictComparable = isStrictComparable$1;
6058
6059var isStrictComparable = _isStrictComparable;
6060var keys$3 = keys_1;
6061
6062/**
6063 * Gets the property names, values, and compare flags of `object`.
6064 *
6065 * @private
6066 * @param {Object} object The object to query.
6067 * @returns {Array} Returns the match data of `object`.
6068 */
6069function 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
6082var _getMatchData = getMatchData$1;
6083
6084/**
6085 * A specialized version of `matchesProperty` for source values suitable
6086 * for strict equality comparisons, i.e. `===`.
6087 *
6088 * @private
6089 * @param {string} key The key of the property to get.
6090 * @param {*} srcValue The value to match.
6091 * @returns {Function} Returns the new spec function.
6092 */
6093function 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
6103var _matchesStrictComparable = matchesStrictComparable$1;
6104
6105var baseIsMatch = _baseIsMatch;
6106var getMatchData = _getMatchData;
6107var matchesStrictComparable = _matchesStrictComparable;
6108
6109/**
6110 * The base implementation of `_.matches` which doesn't clone `source`.
6111 *
6112 * @private
6113 * @param {Object} source The object of property values to match.
6114 * @returns {Function} Returns the new spec function.
6115 */
6116function 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
6126var _baseMatches = baseMatches$1;
6127
6128/**
6129 * The base implementation of `_.hasIn` without support for deep paths.
6130 *
6131 * @private
6132 * @param {Object} [object] The object to query.
6133 * @param {Array|string} key The key to check.
6134 * @returns {boolean} Returns `true` if `key` exists, else `false`.
6135 */
6136function baseHasIn$1(object, key) {
6137 return object != null && key in Object(object);
6138}
6139
6140var _baseHasIn = baseHasIn$1;
6141
6142var castPath$2 = _castPath;
6143var isArguments$4 = isArguments_1;
6144var isArray$13 = isArray_1;
6145var isIndex$2 = _isIndex;
6146var isLength$3 = isLength_1;
6147var toKey$3 = _toKey;
6148
6149/**
6150 * Checks if `path` exists on `object`.
6151 *
6152 * @private
6153 * @param {Object} object The object to query.
6154 * @param {Array|string} path The path to check.
6155 * @param {Function} hasFunc The function to check properties.
6156 * @returns {boolean} Returns `true` if `path` exists, else `false`.
6157 */
6158function 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
6180var _hasPath = hasPath$1;
6181
6182var baseHasIn = _baseHasIn;
6183var hasPath = _hasPath;
6184
6185/**
6186 * Checks if `path` is a direct or inherited property of `object`.
6187 *
6188 * @static
6189 * @memberOf _
6190 * @since 4.0.0
6191 * @category Object
6192 * @param {Object} object The object to query.
6193 * @param {Array|string} path The path to check.
6194 * @returns {boolean} Returns `true` if `path` exists, else `false`.
6195 * @example
6196 *
6197 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
6198 *
6199 * _.hasIn(object, 'a');
6200 * // => true
6201 *
6202 * _.hasIn(object, 'a.b');
6203 * // => true
6204 *
6205 * _.hasIn(object, ['a', 'b']);
6206 * // => true
6207 *
6208 * _.hasIn(object, 'b');
6209 * // => false
6210 */
6211function hasIn$1(object, path) {
6212 return object != null && hasPath(object, path, baseHasIn);
6213}
6214
6215var hasIn_1 = hasIn$1;
6216
6217var baseIsEqual$2 = _baseIsEqual;
6218var get$2 = get_1;
6219var hasIn = hasIn_1;
6220var isKey$2 = _isKey;
6221var isStrictComparable$2 = _isStrictComparable;
6222var matchesStrictComparable$2 = _matchesStrictComparable;
6223var toKey$2 = _toKey;
6224
6225/** Used to compose bitmasks for value comparisons. */
6226var COMPARE_PARTIAL_FLAG$5 = 1;
6227var 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 */
6237function 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
6249var _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 * // => true
6266 */
6267function identity$1(value) {
6268 return value;
6269}
6270
6271var identity_1 = identity$1;
6272
6273/**
6274 * The base implementation of `_.property` without support for deep paths.
6275 *
6276 * @private
6277 * @param {string} key The key of the property to get.
6278 * @returns {Function} Returns the new accessor function.
6279 */
6280function baseProperty$1(key) {
6281 return function(object) {
6282 return object == null ? undefined : object[key];
6283 };
6284}
6285
6286var _baseProperty = baseProperty$1;
6287
6288var baseGet$2 = _baseGet;
6289
6290/**
6291 * A specialized version of `baseProperty` which supports deep paths.
6292 *
6293 * @private
6294 * @param {Array|string} path The path of the property to get.
6295 * @returns {Function} Returns the new accessor function.
6296 */
6297function basePropertyDeep$1(path) {
6298 return function(object) {
6299 return baseGet$2(object, path);
6300 };
6301}
6302
6303var _basePropertyDeep = basePropertyDeep$1;
6304
6305var baseProperty = _baseProperty;
6306var basePropertyDeep = _basePropertyDeep;
6307var isKey$3 = _isKey;
6308var toKey$4 = _toKey;
6309
6310/**
6311 * Creates a function that returns the value at `path` of a given object.
6312 *
6313 * @static
6314 * @memberOf _
6315 * @since 2.4.0
6316 * @category Util
6317 * @param {Array|string} path The path of the property to get.
6318 * @returns {Function} Returns the new accessor function.
6319 * @example
6320 *
6321 * var objects = [
6322 * { 'a': { 'b': 2 } },
6323 * { 'a': { 'b': 1 } }
6324 * ];
6325 *
6326 * _.map(objects, _.property('a.b'));
6327 * // => [2, 1]
6328 *
6329 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
6330 * // => [1, 2]
6331 */
6332function property$1(path) {
6333 return isKey$3(path) ? baseProperty(toKey$4(path)) : basePropertyDeep(path);
6334}
6335
6336var property_1 = property$1;
6337
6338var baseMatches = _baseMatches;
6339var baseMatchesProperty = _baseMatchesProperty;
6340var identity = identity_1;
6341var isArray$10 = isArray_1;
6342var property = property_1;
6343
6344/**
6345 * The base implementation of `_.iteratee`.
6346 *
6347 * @private
6348 * @param {*} [value=_.identity] The value to convert to an iteratee.
6349 * @returns {Function} Returns the iteratee.
6350 */
6351function baseIteratee$1(value) {
6352 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
6353 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
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
6368var _baseIteratee = baseIteratee$1;
6369
6370/**
6371 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
6372 *
6373 * @private
6374 * @param {boolean} [fromRight] Specify iterating from right to left.
6375 * @returns {Function} Returns the new base function.
6376 */
6377function 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
6394var _createBaseFor = createBaseFor$1;
6395
6396var createBaseFor = _createBaseFor;
6397
6398/**
6399 * The base implementation of `baseForOwn` which iterates over `object`
6400 * properties returned by `keysFunc` and invokes `iteratee` for each property.
6401 * Iteratee functions may exit iteration early by explicitly returning `false`.
6402 *
6403 * @private
6404 * @param {Object} object The object to iterate over.
6405 * @param {Function} iteratee The function invoked per iteration.
6406 * @param {Function} keysFunc The function to get the keys of `object`.
6407 * @returns {Object} Returns `object`.
6408 */
6409var baseFor$1 = createBaseFor();
6410
6411var _baseFor = baseFor$1;
6412
6413var baseFor = _baseFor;
6414var keys$4 = keys_1;
6415
6416/**
6417 * The base implementation of `_.forOwn` without support for iteratee shorthands.
6418 *
6419 * @private
6420 * @param {Object} object The object to iterate over.
6421 * @param {Function} iteratee The function invoked per iteration.
6422 * @returns {Object} Returns `object`.
6423 */
6424function baseForOwn$1(object, iteratee) {
6425 return object && baseFor(object, iteratee, keys$4);
6426}
6427
6428var _baseForOwn = baseForOwn$1;
6429
6430var isArrayLike$4 = isArrayLike_1;
6431
6432/**
6433 * Creates a `baseEach` or `baseEachRight` function.
6434 *
6435 * @private
6436 * @param {Function} eachFunc The function to iterate over a collection.
6437 * @param {boolean} [fromRight] Specify iterating from right to left.
6438 * @returns {Function} Returns the new base function.
6439 */
6440function 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
6461var _createBaseEach = createBaseEach$1;
6462
6463var baseForOwn = _baseForOwn;
6464var createBaseEach = _createBaseEach;
6465
6466/**
6467 * The base implementation of `_.forEach` without support for iteratee shorthands.
6468 *
6469 * @private
6470 * @param {Array|Object} collection The collection to iterate over.
6471 * @param {Function} iteratee The function invoked per iteration.
6472 * @returns {Array|Object} Returns `collection`.
6473 */
6474var baseEach$1 = createBaseEach(baseForOwn);
6475
6476var _baseEach = baseEach$1;
6477
6478var baseEach = _baseEach;
6479var isArrayLike$3 = isArrayLike_1;
6480
6481/**
6482 * The base implementation of `_.map` without support for iteratee shorthands.
6483 *
6484 * @private
6485 * @param {Array|Object} collection The collection to iterate over.
6486 * @param {Function} iteratee The function invoked per iteration.
6487 * @returns {Array} Returns the new mapped array.
6488 */
6489function 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
6499var _baseMap = baseMap$1;
6500
6501var arrayMap$3 = _arrayMap;
6502var baseIteratee = _baseIteratee;
6503var baseMap = _baseMap;
6504var isArray$9 = isArray_1;
6505
6506/**
6507 * Creates an array of values by running each element in `collection` thru
6508 * `iteratee`. The iteratee is invoked with three arguments:
6509 * (value, index|key, collection).
6510 *
6511 * Many lodash methods are guarded to work as iteratees for methods like
6512 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
6513 *
6514 * The guarded methods are:
6515 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
6516 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
6517 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
6518 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
6519 *
6520 * @static
6521 * @memberOf _
6522 * @since 0.1.0
6523 * @category Collection
6524 * @param {Array|Object} collection The collection to iterate over.
6525 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
6526 * @returns {Array} Returns the new mapped array.
6527 * @example
6528 *
6529 * function square(n) {
6530 * return n * n;
6531 * }
6532 *
6533 * _.map([4, 8], square);
6534 * // => [16, 64]
6535 *
6536 * _.map({ 'a': 4, 'b': 8 }, square);
6537 * // => [16, 64] (iteration order is not guaranteed)
6538 *
6539 * var users = [
6540 * { 'user': 'barney' },
6541 * { 'user': 'fred' }
6542 * ];
6543 *
6544 * // The `_.property` iteratee shorthand.
6545 * _.map(users, 'user');
6546 * // => ['barney', 'fred']
6547 */
6548function map(collection, iteratee) {
6549 var func = isArray$9(collection) ? arrayMap$3 : baseMap;
6550 return func(collection, baseIteratee(iteratee, 3));
6551}
6552
6553var map_1 = map;
6554
6555var name$8 = 'post';
6556var pluralName$8 = 'posts';
6557
6558var defaultProperties$7 = ['id', 'body'];
6559
6560var post = Object.freeze({
6561 name: name$8,
6562 pluralName: pluralName$8,
6563 defaultProperties: defaultProperties$7
6564});
6565
6566var name$7 = 'feedPost';
6567var pluralName$7 = 'feedPosts';
6568function 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
6588function 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
6602var feedPost = Object.freeze({
6603 name: name$7,
6604 pluralName: pluralName$7,
6605 defaultProperties: defaultProperties$7,
6606 getMany: getMany,
6607 extractMany: extractMany
6608});
6609
6610var name$9 = 'growthAction';
6611var pluralName$9 = 'growthActions';
6612
6613var 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
6615var growthAction = Object.freeze({
6616 name: name$9,
6617 pluralName: pluralName$9,
6618 defaultProperties: defaultProperties$8
6619});
6620
6621var name$10 = 'growthRelationship';
6622var pluralName$10 = 'growthRelationships';
6623
6624var defaultProperties$9 = ['id', 'owner_type', 'owner.id', 'owner.name', 'growee.id', 'growee.name', 'agent.id', 'agent.name'];
6625
6626var growthRelationship = Object.freeze({
6627 name: name$10,
6628 pluralName: pluralName$10,
6629 defaultProperties: defaultProperties$9
6630});
6631
6632var name$11 = 'growthAgentPrompt';
6633var pluralName$11 = 'growthAgentPrompts';
6634
6635var 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
6637var growthAgentPrompt = Object.freeze({
6638 name: name$11,
6639 pluralName: pluralName$11,
6640 defaultProperties: defaultProperties$10
6641});
6642
6643var name$12 = 'growthAgentResponse';
6644var pluralName$12 = 'growthAgentResponses';
6645
6646var defaultProperties$11 = ['id', 'message'];
6647
6648var growthAgentResponse = Object.freeze({
6649 name: name$12,
6650 pluralName: pluralName$12,
6651 defaultProperties: defaultProperties$11
6652});
6653
6654var name$13 = 'license';
6655var pluralName$13 = 'licenses';
6656
6657var defaultProperties$12 = ['id', 'updated_at'];
6658
6659var license = Object.freeze({
6660 name: name$13,
6661 pluralName: pluralName$13,
6662 defaultProperties: defaultProperties$12
6663});
6664
6665var name$14 = 'licensedCohort';
6666var pluralName$14 = 'licensedCohorts';
6667
6668var defaultProperties$13 = ['id', 'updated_at'];
6669
6670var licensedCohort = Object.freeze({
6671 name: name$14,
6672 pluralName: pluralName$14,
6673 defaultProperties: defaultProperties$13
6674});
6675
6676var name$15 = 'licensedContentItem';
6677var pluralName$15 = 'licensedContentItems';
6678
6679var defaultProperties$14 = ['id', 'updated_at'];
6680
6681var licensedContentItem = Object.freeze({
6682 name: name$15,
6683 pluralName: pluralName$15,
6684 defaultProperties: defaultProperties$14
6685});
6686
6687var name$16 = 'moment';
6688var pluralName$16 = 'moments';
6689
6690var 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
6692var moment = Object.freeze({
6693 name: name$16,
6694 pluralName: pluralName$16,
6695 defaultProperties: defaultProperties$15
6696});
6697
6698var name$17 = 'myGrowthAgentPrompt';
6699var pluralName$17 = 'myGrowthAgentPrompts';
6700
6701var 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
6703function 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
6723function 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
6737var 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 * Checks if `value` is `null` or `undefined`.
6747 *
6748 * @static
6749 * @memberOf _
6750 * @since 4.0.0
6751 * @category Lang
6752 * @param {*} value The value to check.
6753 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
6754 * @example
6755 *
6756 * _.isNil(null);
6757 * // => true
6758 *
6759 * _.isNil(void 0);
6760 * // => true
6761 *
6762 * _.isNil(NaN);
6763 * // => false
6764 */
6765function isNil(value) {
6766 return value == null;
6767}
6768
6769var isNil_1 = isNil;
6770
6771var name$19 = 'review';
6772var pluralName$19 = 'reviews';
6773
6774var defaultProperties$17 = ['id', 'rating'];
6775
6776var review = Object.freeze({
6777 name: name$19,
6778 pluralName: pluralName$19,
6779 defaultProperties: defaultProperties$17
6780});
6781
6782var name$20 = 'tree';
6783var pluralName$20 = 'trees';
6784
6785var treeEntity = Object.freeze({
6786 name: name$20,
6787 pluralName: pluralName$20
6788});
6789
6790/*
6791 * This entity is temporary while we figure out how to handle "my" entities
6792 * in a standard entity way. We expect to delete it once we have settled on a
6793 * standard "my" approach.
6794 */
6795
6796var name$18 = 'myTreeReview';
6797var pluralName$18 = 'myTreeReviews';
6798function 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
6819function 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
6834var myTreeReview = Object.freeze({
6835 name: name$18,
6836 pluralName: pluralName$18,
6837 defaultProperties: defaultProperties$17,
6838 getOne: getOne,
6839 extractOne: extractOne
6840});
6841
6842var name$21 = 'note';
6843var pluralName$21 = 'notes';
6844
6845var defaultProperties$18 = ['id', 'body'];
6846
6847var note = Object.freeze({
6848 name: name$21,
6849 pluralName: pluralName$21,
6850 defaultProperties: defaultProperties$18
6851});
6852
6853var name$22 = 'progressItem';
6854var pluralName$22 = 'progressItems';
6855
6856var defaultProperties$19 = ['id', 'action', 'title', 'description', 'completed', 'hidden', 'assigner_type', 'linkable_type', 'updated_at', 'date_due'];
6857
6858var progressItem = Object.freeze({
6859 name: name$22,
6860 pluralName: pluralName$22,
6861 defaultProperties: defaultProperties$19
6862});
6863
6864var name$23 = 'space';
6865var pluralName$23 = 'spaces';
6866
6867var defaultProperties$20 = ['id', 'name', 'topic'];
6868
6869var space = Object.freeze({
6870 name: name$23,
6871 pluralName: pluralName$23,
6872 defaultProperties: defaultProperties$20
6873});
6874
6875var name$24 = 'timeline';
6876var pluralName$24 = 'timelines';
6877
6878var timeline = Object.freeze({
6879 name: name$24,
6880 pluralName: pluralName$24
6881});
6882
6883var name$25 = 'toDoItem';
6884var pluralName$25 = 'toDoItems';
6885
6886var defaultProperties$21 = ['id', 'title', 'description', 'action', 'date_due'];
6887
6888var toDoItem = Object.freeze({
6889 name: name$25,
6890 pluralName: pluralName$25,
6891 defaultProperties: defaultProperties$21
6892});
6893
6894var name$26 = 'toDoList';
6895var pluralName$26 = 'toDoLists';
6896
6897var defaultProperties$22 = ['id', 'name', 'created_at', 'updated_at'];
6898
6899var toDoList = Object.freeze({
6900 name: name$26,
6901 pluralName: pluralName$26,
6902 defaultProperties: defaultProperties$22
6903});
6904
6905var name$27 = 'topic';
6906var pluralName$27 = 'topics';
6907
6908var defaultProperties$23 = ['id', 'name'];
6909
6910var topic = Object.freeze({
6911 name: name$27,
6912 pluralName: pluralName$27,
6913 defaultProperties: defaultProperties$23
6914});
6915
6916var name$28 = 'tourTipView';
6917var pluralName$28 = 'tourTipViews';
6918
6919var defaultProperties$24 = ['id', 'state'];
6920
6921function 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
6941function 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
6955var 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
6963var name$29 = 'user';
6964var pluralName$29 = 'users';
6965
6966var defaultProperties$25 = ['id', 'username', 'name'];
6967
6968var user = Object.freeze({
6969 name: name$29,
6970 pluralName: pluralName$29,
6971 defaultProperties: defaultProperties$25
6972});
6973
6974var name$30 = 'userToDoList';
6975var pluralName$30 = 'userToDoLists';
6976
6977var defaultProperties$26 = ['id', 'name'];
6978
6979var userToDoList = Object.freeze({
6980 name: name$30,
6981 pluralName: pluralName$30,
6982 defaultProperties: defaultProperties$26
6983});
6984
6985var name$31 = 'view';
6986var pluralName$31 = 'views';
6987
6988var defaultProperties$27 = ['id', 'viewable_id', 'viewable_type'];
6989
6990var view = Object.freeze({
6991 name: name$31,
6992 pluralName: pluralName$31,
6993 defaultProperties: defaultProperties$27
6994});
6995
6996
6997
6998var 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// Copyright Joyent, Inc. and other Node contributors.
7034//
7035// Permission is hereby granted, free of charge, to any person obtaining a
7036// copy of this software and associated documentation files (the
7037// "Software"), to deal in the Software without restriction, including
7038// without limitation the rights to use, copy, modify, merge, publish,
7039// distribute, sublicense, and/or sell copies of the Software, and to permit
7040// persons to whom the Software is furnished to do so, subject to the
7041// following conditions:
7042//
7043// The above copyright notice and this permission notice shall be included
7044// in all copies or substantial portions of the Software.
7045//
7046// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
7047// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7048// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
7049// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
7050// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
7051// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
7052// USE OR OTHER DEALINGS IN THE SOFTWARE.
7053
7054
7055// If obj.hasOwnProperty has been overridden, then calling
7056// obj.hasOwnProperty(prop) will break.
7057// See: https://github.com/joyent/node/issues/1707
7058var isArray$14 = Array.isArray || function (xs) {
7059 return Object.prototype.toString.call(xs) === '[object Array]';
7060};
7061function 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
7077function 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
7103function 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
7112var 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
7120var baseEach$2 = _baseEach;
7121
7122/**
7123 * The base implementation of `_.filter` without support for iteratee shorthands.
7124 *
7125 * @private
7126 * @param {Array|Object} collection The collection to iterate over.
7127 * @param {Function} predicate The function invoked per iteration.
7128 * @returns {Array} Returns the new filtered array.
7129 */
7130function 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
7140var _baseFilter = baseFilter$1;
7141
7142var arrayFilter$2 = _arrayFilter;
7143var baseFilter = _baseFilter;
7144var baseIteratee$2 = _baseIteratee;
7145var isArray$15 = isArray_1;
7146
7147/**
7148 * Iterates over elements of `collection`, returning an array of all elements
7149 * `predicate` returns truthy for. The predicate is invoked with three
7150 * arguments: (value, index|key, collection).
7151 *
7152 * **Note:** Unlike `_.remove`, this method returns a new array.
7153 *
7154 * @static
7155 * @memberOf _
7156 * @since 0.1.0
7157 * @category Collection
7158 * @param {Array|Object} collection The collection to iterate over.
7159 * @param {Function} [predicate=_.identity] The function invoked per iteration.
7160 * @returns {Array} Returns the new filtered array.
7161 * @see _.reject
7162 * @example
7163 *
7164 * var users = [
7165 * { 'user': 'barney', 'age': 36, 'active': true },
7166 * { 'user': 'fred', 'age': 40, 'active': false }
7167 * ];
7168 *
7169 * _.filter(users, function(o) { return !o.active; });
7170 * // => objects for ['fred']
7171 *
7172 * // The `_.matches` iteratee shorthand.
7173 * _.filter(users, { 'age': 36, 'active': true });
7174 * // => objects for ['barney']
7175 *
7176 * // The `_.matchesProperty` iteratee shorthand.
7177 * _.filter(users, ['active', false]);
7178 * // => objects for ['fred']
7179 *
7180 * // The `_.property` iteratee shorthand.
7181 * _.filter(users, 'active');
7182 * // => objects for ['barney']
7183 */
7184function filter(collection, predicate) {
7185 var func = isArray$15(collection) ? arrayFilter$2 : baseFilter;
7186 return func(collection, baseIteratee$2(predicate, 3));
7187}
7188
7189var filter_1 = filter;
7190
7191var entitySrc = 'entities';
7192
7193function 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
7198function entityMustExportError(entityName, property) {
7199 var filename = entityNameToFilename(entityName);
7200 return new Error(entitySrc + '/' + filename + ' must export ' + property);
7201}
7202
7203function optionsMustHaveError(property) {
7204 return new Error('options.' + property + ' is required');
7205}
7206
7207function entityExports(entity, property) {
7208 return !isNil_1(entity[property]);
7209}
7210
7211
7212
7213function optionsHas(options, property) {
7214 return !isNil_1(get_1(options, property));
7215}
7216
7217function _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
7219function 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
7247function 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
7257function 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
7315function 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
7351function 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
7387function 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
7406function 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
7437function 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
7456function 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
7509function 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
7521function 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
7538function 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
7570function 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
7580function 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
7597function 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 * A specialized version of `_.forEach` for arrays without support for
7621 * iteratee shorthands.
7622 *
7623 * @private
7624 * @param {Array} [array] The array to iterate over.
7625 * @param {Function} iteratee The function invoked per iteration.
7626 * @returns {Array} Returns `array`.
7627 */
7628function 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
7640var _arrayEach = arrayEach$1;
7641
7642var identity$2 = identity_1;
7643
7644/**
7645 * Casts `value` to `identity` if it's not a function.
7646 *
7647 * @private
7648 * @param {*} value The value to inspect.
7649 * @returns {Function} Returns cast function.
7650 */
7651function castFunction$1(value) {
7652 return typeof value == 'function' ? value : identity$2;
7653}
7654
7655var _castFunction = castFunction$1;
7656
7657var arrayEach = _arrayEach;
7658var baseEach$3 = _baseEach;
7659var castFunction = _castFunction;
7660var isArray$16 = isArray_1;
7661
7662/**
7663 * Iterates over elements of `collection` and invokes `iteratee` for each element.
7664 * The iteratee is invoked with three arguments: (value, index|key, collection).
7665 * Iteratee functions may exit iteration early by explicitly returning `false`.
7666 *
7667 * **Note:** As with other "Collections" methods, objects with a "length"
7668 * property are iterated like arrays. To avoid this behavior use `_.forIn`
7669 * or `_.forOwn` for object iteration.
7670 *
7671 * @static
7672 * @memberOf _
7673 * @since 0.1.0
7674 * @alias each
7675 * @category Collection
7676 * @param {Array|Object} collection The collection to iterate over.
7677 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
7678 * @returns {Array|Object} Returns `collection`.
7679 * @see _.forEachRight
7680 * @example
7681 *
7682 * _.forEach([1, 2], function(value) {
7683 * console.log(value);
7684 * });
7685 * // => Logs `1` then `2`.
7686 *
7687 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
7688 * console.log(key);
7689 * });
7690 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
7691 */
7692function forEach(collection, iteratee) {
7693 var func = isArray$16(collection) ? arrayEach : baseEach$3;
7694 return func(collection, castFunction(iteratee));
7695}
7696
7697var forEach_1 = forEach;
7698
7699var overArg$2 = _overArg;
7700
7701/** Built-in value references. */
7702var getPrototype$1 = overArg$2(Object.getPrototypeOf, Object);
7703
7704var _getPrototype = getPrototype$1;
7705
7706var baseGetTag$7 = _baseGetTag;
7707var getPrototype = _getPrototype;
7708var isObjectLike$7 = isObjectLike_1;
7709
7710/** `Object#toString` result references. */
7711var objectTag$3 = '[object Object]';
7712
7713/** Used for built-in method references. */
7714var funcProto$2 = Function.prototype;
7715var objectProto$13 = Object.prototype;
7716
7717/** Used to resolve the decompiled source of functions. */
7718var funcToString$2 = funcProto$2.toString;
7719
7720/** Used to check objects for own properties. */
7721var hasOwnProperty$11 = objectProto$13.hasOwnProperty;
7722
7723/** Used to infer the `Object` constructor. */
7724var objectCtorString = funcToString$2.call(Object);
7725
7726/**
7727 * Checks if `value` is a plain object, that is, an object created by the
7728 * `Object` constructor or one with a `[[Prototype]]` of `null`.
7729 *
7730 * @static
7731 * @memberOf _
7732 * @since 0.8.0
7733 * @category Lang
7734 * @param {*} value The value to check.
7735 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
7736 * @example
7737 *
7738 * function Foo() {
7739 * this.a = 1;
7740 * }
7741 *
7742 * _.isPlainObject(new Foo);
7743 * // => false
7744 *
7745 * _.isPlainObject([1, 2, 3]);
7746 * // => false
7747 *
7748 * _.isPlainObject({ 'x': 0, 'y': 0 });
7749 * // => true
7750 *
7751 * _.isPlainObject(Object.create(null));
7752 * // => true
7753 */
7754function 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
7767var isPlainObject_1 = isPlainObject$1;
7768
7769var baseGetTag$6 = _baseGetTag;
7770var isObjectLike$6 = isObjectLike_1;
7771var isPlainObject = isPlainObject_1;
7772
7773/** `Object#toString` result references. */
7774var domExcTag = '[object DOMException]';
7775var errorTag$2 = '[object Error]';
7776
7777/**
7778 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
7779 * `SyntaxError`, `TypeError`, or `URIError` object.
7780 *
7781 * @static
7782 * @memberOf _
7783 * @since 3.0.0
7784 * @category Lang
7785 * @param {*} value The value to check.
7786 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
7787 * @example
7788 *
7789 * _.isError(new Error);
7790 * // => true
7791 *
7792 * _.isError(Error);
7793 * // => false
7794 */
7795function 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
7804var isError_1 = isError;
7805
7806/**
7807 * Gets the last element of `array`.
7808 *
7809 * @static
7810 * @memberOf _
7811 * @since 0.1.0
7812 * @category Array
7813 * @param {Array} array The array to query.
7814 * @returns {*} Returns the last element of `array`.
7815 * @example
7816 *
7817 * _.last([1, 2, 3]);
7818 * // => 3
7819 */
7820function last(array) {
7821 var length = array == null ? 0 : array.length;
7822 return length ? array[length - 1] : undefined;
7823}
7824
7825var last_1 = last;
7826
7827var isIndex$3 = _isIndex;
7828
7829/**
7830 * The base implementation of `_.nth` which doesn't coerce arguments.
7831 *
7832 * @private
7833 * @param {Array} array The array to query.
7834 * @param {number} n The index of the element to return.
7835 * @returns {*} Returns the nth element of `array`.
7836 */
7837function 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
7846var _baseNth = baseNth$1;
7847
7848var isObject$4 = isObject_1;
7849var isSymbol$4 = isSymbol_1;
7850
7851/** Used as references for various `Number` constants. */
7852var NAN = 0 / 0;
7853
7854/** Used to match leading and trailing whitespace. */
7855var reTrim = /^\s+|\s+$/g;
7856
7857/** Used to detect bad signed hexadecimal string values. */
7858var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
7859
7860/** Used to detect binary string values. */
7861var reIsBinary = /^0b[01]+$/i;
7862
7863/** Used to detect octal string values. */
7864var reIsOctal = /^0o[0-7]+$/i;
7865
7866/** Built-in method references without a dependency on `root`. */
7867var freeParseInt = parseInt;
7868
7869/**
7870 * Converts `value` to a number.
7871 *
7872 * @static
7873 * @memberOf _
7874 * @since 4.0.0
7875 * @category Lang
7876 * @param {*} value The value to process.
7877 * @returns {number} Returns the number.
7878 * @example
7879 *
7880 * _.toNumber(3.2);
7881 * // => 3.2
7882 *
7883 * _.toNumber(Number.MIN_VALUE);
7884 * // => 5e-324
7885 *
7886 * _.toNumber(Infinity);
7887 * // => Infinity
7888 *
7889 * _.toNumber('3.2');
7890 * // => 3.2
7891 */
7892function 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
7913var toNumber_1 = toNumber$1;
7914
7915var toNumber = toNumber_1;
7916
7917/** Used as references for various `Number` constants. */
7918var INFINITY$3 = 1 / 0;
7919var MAX_INTEGER = 1.7976931348623157e+308;
7920
7921/**
7922 * Converts `value` to a finite number.
7923 *
7924 * @static
7925 * @memberOf _
7926 * @since 4.12.0
7927 * @category Lang
7928 * @param {*} value The value to convert.
7929 * @returns {number} Returns the converted number.
7930 * @example
7931 *
7932 * _.toFinite(3.2);
7933 * // => 3.2
7934 *
7935 * _.toFinite(Number.MIN_VALUE);
7936 * // => 5e-324
7937 *
7938 * _.toFinite(Infinity);
7939 * // => 1.7976931348623157e+308
7940 *
7941 * _.toFinite('3.2');
7942 * // => 3.2
7943 */
7944function 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
7956var toFinite_1 = toFinite$1;
7957
7958var toFinite = toFinite_1;
7959
7960/**
7961 * Converts `value` to an integer.
7962 *
7963 * **Note:** This method is loosely based on
7964 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
7965 *
7966 * @static
7967 * @memberOf _
7968 * @since 4.0.0
7969 * @category Lang
7970 * @param {*} value The value to convert.
7971 * @returns {number} Returns the converted integer.
7972 * @example
7973 *
7974 * _.toInteger(3.2);
7975 * // => 3
7976 *
7977 * _.toInteger(Number.MIN_VALUE);
7978 * // => 0
7979 *
7980 * _.toInteger(Infinity);
7981 * // => 1.7976931348623157e+308
7982 *
7983 * _.toInteger('3.2');
7984 * // => 3
7985 */
7986function toInteger$1(value) {
7987 var result = toFinite(value),
7988 remainder = result % 1;
7989
7990 return result === result ? (remainder ? result - remainder : result) : 0;
7991}
7992
7993var toInteger_1 = toInteger$1;
7994
7995var baseNth = _baseNth;
7996var toInteger = toInteger_1;
7997
7998/**
7999 * Gets the element at index `n` of `array`. If `n` is negative, the nth
8000 * element from the end is returned.
8001 *
8002 * @static
8003 * @memberOf _
8004 * @since 4.11.0
8005 * @category Array
8006 * @param {Array} array The array to query.
8007 * @param {number} [n=0] The index of the element to return.
8008 * @returns {*} Returns the nth element of `array`.
8009 * @example
8010 *
8011 * var array = ['a', 'b', 'c', 'd'];
8012 *
8013 * _.nth(array, 1);
8014 * // => 'b'
8015 *
8016 * _.nth(array, -2);
8017 * // => 'c';
8018 */
8019function nth(array, n) {
8020 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
8021}
8022
8023var nth_1 = nth;
8024
8025var baseEach$4 = _baseEach;
8026
8027/**
8028 * The base implementation of `_.some` without support for iteratee shorthands.
8029 *
8030 * @private
8031 * @param {Array|Object} collection The collection to iterate over.
8032 * @param {Function} predicate The function invoked per iteration.
8033 * @returns {boolean} Returns `true` if any element passes the predicate check,
8034 * else `false`.
8035 */
8036function 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
8046var _baseSome = baseSome$1;
8047
8048var eq$3 = eq_1;
8049var isArrayLike$5 = isArrayLike_1;
8050var isIndex$4 = _isIndex;
8051var isObject$5 = isObject_1;
8052
8053/**
8054 * Checks if the given arguments are from an iteratee call.
8055 *
8056 * @private
8057 * @param {*} value The potential iteratee value argument.
8058 * @param {*} index The potential iteratee index or key argument.
8059 * @param {*} object The potential iteratee object argument.
8060 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
8061 * else `false`.
8062 */
8063function 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
8077var _isIterateeCall = isIterateeCall$1;
8078
8079var arraySome$2 = _arraySome;
8080var baseIteratee$3 = _baseIteratee;
8081var baseSome = _baseSome;
8082var isArray$17 = isArray_1;
8083var isIterateeCall = _isIterateeCall;
8084
8085/**
8086 * Checks if `predicate` returns truthy for **any** element of `collection`.
8087 * Iteration is stopped once `predicate` returns truthy. The predicate is
8088 * invoked with three arguments: (value, index|key, collection).
8089 *
8090 * @static
8091 * @memberOf _
8092 * @since 0.1.0
8093 * @category Collection
8094 * @param {Array|Object} collection The collection to iterate over.
8095 * @param {Function} [predicate=_.identity] The function invoked per iteration.
8096 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
8097 * @returns {boolean} Returns `true` if any element passes the predicate check,
8098 * else `false`.
8099 * @example
8100 *
8101 * _.some([null, 0, 'yes', false], Boolean);
8102 * // => true
8103 *
8104 * var users = [
8105 * { 'user': 'barney', 'active': true },
8106 * { 'user': 'fred', 'active': false }
8107 * ];
8108 *
8109 * // The `_.matches` iteratee shorthand.
8110 * _.some(users, { 'user': 'barney', 'active': false });
8111 * // => false
8112 *
8113 * // The `_.matchesProperty` iteratee shorthand.
8114 * _.some(users, ['active', false]);
8115 * // => true
8116 *
8117 * // The `_.property` iteratee shorthand.
8118 * _.some(users, 'active');
8119 * // => true
8120 */
8121function 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
8129var some_1 = some;
8130
8131var _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
8133function _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
8135function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8136
8137es6Promise.polyfill();
8138
8139var 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 * Standard interfaces
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
8418var 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
8427function 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
8445function 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
8462function 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
8479function 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
8496function 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
8522function 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
8540function 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
8558return SuperGloo;
8559
8560})));