@zengenti/contensis-react-base 3.0.0-beta.6 → 3.0.0-beta.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +4 -4
  2. package/cjs/{App-3324f784.js → App-36c7bf3a.js} +124 -140
  3. package/cjs/App-36c7bf3a.js.map +1 -0
  4. package/cjs/{RouteLoader-c7957b14.js → RouteLoader-ece762dc.js} +31 -23
  5. package/cjs/RouteLoader-ece762dc.js.map +1 -0
  6. package/cjs/ToJs-09204afd.js +129 -0
  7. package/cjs/ToJs-09204afd.js.map +1 -0
  8. package/cjs/VersionInfo-df35c917.js +181 -0
  9. package/cjs/VersionInfo-df35c917.js.map +1 -0
  10. package/cjs/{actions-a24bf46e.js → actions-6b9ef168.js} +5 -4
  11. package/cjs/actions-6b9ef168.js.map +1 -0
  12. package/cjs/client.js +16 -21
  13. package/cjs/client.js.map +1 -1
  14. package/cjs/contensis-react-base.js +3583 -38
  15. package/cjs/contensis-react-base.js.map +1 -1
  16. package/cjs/forms.js +4114 -195
  17. package/cjs/forms.js.map +1 -1
  18. package/cjs/{fromJSLeaveImmer-c00d597f.js → fromJSLeaveImmer-e74c673c.js} +2 -16
  19. package/cjs/fromJSLeaveImmer-e74c673c.js.map +1 -0
  20. package/cjs/{login-c810cc4c.js → login-d67b82aa.js} +92 -55
  21. package/cjs/login-d67b82aa.js.map +1 -0
  22. package/cjs/{reducers-fde41d6b.js → reducers-3a4f8971.js} +26 -25
  23. package/cjs/reducers-3a4f8971.js.map +1 -0
  24. package/cjs/redux.js +6 -5
  25. package/cjs/redux.js.map +1 -1
  26. package/cjs/routing.js +5 -4
  27. package/cjs/routing.js.map +1 -1
  28. package/cjs/sagas-8cf21563.js +2038 -0
  29. package/cjs/sagas-8cf21563.js.map +1 -0
  30. package/cjs/search.js +280 -1907
  31. package/cjs/search.js.map +1 -1
  32. package/cjs/{selectors-0ec95076.js → selectors-2c1b1183.js} +7 -3
  33. package/cjs/selectors-2c1b1183.js.map +1 -0
  34. package/cjs/user.js +21 -12
  35. package/cjs/user.js.map +1 -1
  36. package/cjs/util.js +55 -212
  37. package/cjs/util.js.map +1 -1
  38. package/cjs/{version-4f0f5fa6.js → version-ca4173a8.js} +28 -20
  39. package/cjs/version-ca4173a8.js.map +1 -0
  40. package/cjs/{version-085d203d.js → version-dcfdafd9.js} +5 -5
  41. package/cjs/version-dcfdafd9.js.map +1 -0
  42. package/esm/{App-1b05ab11.js → App-61bf1832.js} +124 -141
  43. package/esm/App-61bf1832.js.map +1 -0
  44. package/esm/{RouteLoader-e5f0e8cb.js → RouteLoader-7749ad3f.js} +31 -23
  45. package/esm/RouteLoader-7749ad3f.js.map +1 -0
  46. package/esm/ToJs-2627ce21.js +99 -0
  47. package/esm/ToJs-2627ce21.js.map +1 -0
  48. package/esm/VersionInfo-add96cdb.js +172 -0
  49. package/esm/VersionInfo-add96cdb.js.map +1 -0
  50. package/esm/{actions-927d9698.js → actions-5437f43d.js} +5 -4
  51. package/esm/actions-5437f43d.js.map +1 -0
  52. package/esm/client.js +17 -22
  53. package/esm/client.js.map +1 -1
  54. package/esm/contensis-react-base.js +3581 -37
  55. package/esm/contensis-react-base.js.map +1 -1
  56. package/esm/forms.js +4114 -198
  57. package/esm/forms.js.map +1 -1
  58. package/esm/{fromJSLeaveImmer-392af4e3.js → fromJSLeaveImmer-0114ffcf.js} +2 -16
  59. package/esm/fromJSLeaveImmer-0114ffcf.js.map +1 -0
  60. package/esm/{login-f8ba3aeb.js → login-f6dfbe1b.js} +92 -55
  61. package/esm/login-f6dfbe1b.js.map +1 -0
  62. package/esm/{reducers-d6c0edb1.js → reducers-8e5d6232.js} +26 -25
  63. package/esm/reducers-8e5d6232.js.map +1 -0
  64. package/esm/redux.js +8 -7
  65. package/esm/redux.js.map +1 -1
  66. package/esm/routing.js +5 -4
  67. package/esm/routing.js.map +1 -1
  68. package/esm/sagas-a22fc54a.js +1952 -0
  69. package/esm/sagas-a22fc54a.js.map +1 -0
  70. package/esm/search.js +240 -1848
  71. package/esm/search.js.map +1 -1
  72. package/esm/{selectors-b98d5c76.js → selectors-65f0f31c.js} +7 -4
  73. package/esm/selectors-65f0f31c.js.map +1 -0
  74. package/esm/user.js +23 -14
  75. package/esm/user.js.map +1 -1
  76. package/esm/util.js +54 -209
  77. package/esm/util.js.map +1 -1
  78. package/esm/{version-16aa83eb.js → version-1d46bde8.js} +27 -20
  79. package/esm/version-1d46bde8.js.map +1 -0
  80. package/esm/version-696796d7.js +15 -0
  81. package/esm/version-696796d7.js.map +1 -0
  82. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
  83. package/models/forms/index.d.ts +2 -0
  84. package/models/index.d.ts +1 -0
  85. package/models/redux/appstate.d.ts +5 -10
  86. package/models/redux/selectors/navigation.d.ts +2 -1
  87. package/models/routing/components/RouteLoader.d.ts +2 -19
  88. package/models/routing/redux/actions.d.ts +1 -1
  89. package/models/routing/redux/selectors.d.ts +1 -1
  90. package/models/routing/routes.d.ts +3 -2
  91. package/models/routing/util/expressions.d.ts +3 -2
  92. package/models/routing/util/queries.d.ts +1 -1
  93. package/models/search/containers/withListing.d.ts +1 -1
  94. package/models/search/containers/withSearch.d.ts +1 -1
  95. package/models/search/hooks/useFacets.hook.d.ts +3 -0
  96. package/models/search/hooks/useListing.hook.d.ts +3 -0
  97. package/models/search/hooks/useMinilist.hook.d.ts +2 -9
  98. package/models/search/index.d.ts +4 -1
  99. package/models/search/models/Queries.d.ts +8 -5
  100. package/models/search/models/Search.d.ts +60 -28
  101. package/models/search/models/SearchActions.d.ts +4 -3
  102. package/models/search/models/SearchProps.d.ts +52 -7
  103. package/models/search/models/SearchState.d.ts +5 -1
  104. package/models/search/models/index.d.ts +3 -1
  105. package/models/search/redux/actions.d.ts +2 -1
  106. package/models/search/redux/reducers.d.ts +230 -314
  107. package/models/search/redux/sagas.d.ts +5 -5
  108. package/models/search/redux/selectors.d.ts +19 -22
  109. package/models/search/search/ContensisDeliveryApi.d.ts +1 -0
  110. package/models/search/search/expressions.d.ts +3 -6
  111. package/models/search/{redux → search}/queries.d.ts +0 -0
  112. package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -1
  113. package/models/search/transformations/filter-to-filterexpression.mapper.d.ts +6 -0
  114. package/models/search/transformations/filters-to-filterexpressions.mapper.d.ts +3 -0
  115. package/models/search/transformations/index.d.ts +3 -0
  116. package/models/search/transformations/queryParams-to-customapi.mapper.d.ts +3 -0
  117. package/models/search/transformations/state-to-searchuri.d.ts +2 -13
  118. package/models/server/features/linkdepth-api/api.d.ts +12 -0
  119. package/models/server/features/linkdepth-api/events-api.config.d.ts +37 -0
  120. package/models/server/middleware/bundleManipulation.d.ts +2 -1
  121. package/models/server/util/headers.d.ts +3 -2
  122. package/models/user/components/Login.d.ts +1 -2
  123. package/models/user/components/LoginForm.d.ts +1 -2
  124. package/models/user/hocs/withLogin.d.ts +4 -2
  125. package/models/user/hocs/withRegistration.d.ts +4 -2
  126. package/models/user/hooks/useChangePassword.d.ts +5 -5
  127. package/models/user/hooks/useForgotPassword.d.ts +6 -6
  128. package/models/user/hooks/useLogin.d.ts +9 -45
  129. package/models/user/hooks/useRegistration.d.ts +4 -4
  130. package/models/user/redux/reducers.d.ts +4 -5
  131. package/models/user/redux/sagas/login.d.ts +11 -8
  132. package/models/user/redux/selectors.d.ts +33 -71
  133. package/models/user/util/LoginHelper.class.d.ts +4 -3
  134. package/models/util/ContensisDeliveryApi.d.ts +1 -3
  135. package/models/util/json-mapper.d.ts +9 -3
  136. package/models/util/merge.d.ts +1 -0
  137. package/package-lock.json +2690 -3400
  138. package/package.json +60 -55
  139. package/cjs/App-3324f784.js.map +0 -1
  140. package/cjs/RouteLoader-c7957b14.js.map +0 -1
  141. package/cjs/ToJs-a38fa20e.js +0 -230
  142. package/cjs/ToJs-a38fa20e.js.map +0 -1
  143. package/cjs/actions-a24bf46e.js.map +0 -1
  144. package/cjs/fromJSLeaveImmer-c00d597f.js.map +0 -1
  145. package/cjs/login-c810cc4c.js.map +0 -1
  146. package/cjs/reducers-fde41d6b.js.map +0 -1
  147. package/cjs/selectors-0ec95076.js.map +0 -1
  148. package/cjs/version-085d203d.js.map +0 -1
  149. package/cjs/version-4f0f5fa6.js.map +0 -1
  150. package/esm/App-1b05ab11.js.map +0 -1
  151. package/esm/RouteLoader-e5f0e8cb.js.map +0 -1
  152. package/esm/ToJs-879a5a85.js +0 -199
  153. package/esm/ToJs-879a5a85.js.map +0 -1
  154. package/esm/actions-927d9698.js.map +0 -1
  155. package/esm/fromJSLeaveImmer-392af4e3.js.map +0 -1
  156. package/esm/login-f8ba3aeb.js.map +0 -1
  157. package/esm/reducers-d6c0edb1.js.map +0 -1
  158. package/esm/selectors-b98d5c76.js.map +0 -1
  159. package/esm/version-16aa83eb.js.map +0 -1
  160. package/esm/version-3833e8b5.js +0 -15
  161. package/esm/version-3833e8b5.js.map +0 -1
  162. package/models/search/transformations/filters-to-filterexpression.d.ts +0 -1
  163. package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +0 -2
  164. package/models/server/features/caching/cacheHashing.d.ts +0 -1
@@ -1,43 +1,456 @@
1
+ import { Op, Query } from 'contensis-core-api';
2
+ import React from 'react';
3
+ import { Provider } from 'react-redux';
4
+ import { d as defaultExpressions, c as contentTypeIdExpression, f as filterExpressions, t as termExpressions, o as orderByExpression, a as customWhereExpressions } from './sagas-a22fc54a.js';
5
+ import mapJson from 'jsonpath-mapper';
6
+ import 'reselect';
7
+ import 'deepmerge';
8
+ import 'query-string';
9
+ import 'immer';
10
+ import 'deep-equal';
11
+ import { s as setCachingHeaders } from './VersionInfo-add96cdb.js';
12
+ import { c as cachedSearch, h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-61bf1832.js';
13
+ export { A as ReactApp } from './App-61bf1832.js';
1
14
  import 'isomorphic-fetch';
2
15
  import express from 'express';
3
16
  import httpProxy from 'http-proxy';
4
17
  import fs from 'fs';
5
18
  import path from 'path';
6
19
  import { path as path$1 } from 'app-root-path';
7
- import React from 'react';
8
20
  import { renderToString } from 'react-dom/server';
9
21
  import { StaticRouter } from 'react-router-dom';
10
- import { Provider } from 'react-redux';
11
22
  import { matchRoutes } from 'react-router-config';
12
23
  import { Helmet } from 'react-helmet';
13
24
  import { ServerStyleSheet } from 'styled-components';
14
- import serialize from 'serialize-javascript';
25
+ import serialize$1 from 'serialize-javascript';
15
26
  import minifyCssString from 'minify-css-string';
16
- import mapJson from 'jsonpath-mapper';
17
27
  import { ChunkExtractor, ChunkExtractorManager } from '@loadable/server';
18
- import { c as createStore, s as setVersionStatus, a as setVersion } from './version-16aa83eb.js';
19
- import { h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-1b05ab11.js';
20
- export { A as ReactApp } from './App-1b05ab11.js';
21
- import { s as setCurrentProject } from './actions-927d9698.js';
22
- import { g as getImmutableOrJS, s as selectRouteEntry, a as selectCurrentProject } from './selectors-b98d5c76.js';
28
+ import { identity, noop } from 'lodash';
29
+ import { buildCleaner } from 'lodash-clean';
30
+ import { CookiesProvider } from 'react-cookie';
31
+ import { c as createStore, s as setVersionStatus, a as setVersion } from './version-1d46bde8.js';
32
+ import { s as setCurrentProject } from './actions-5437f43d.js';
33
+ import { s as selectSurrogateKeys, a as selectRouteEntry, b as selectCurrentProject, g as getImmutableOrJS } from './selectors-65f0f31c.js';
34
+ import 'loglevel';
23
35
  import '@redux-saga/core/effects';
24
- import 'redux';
25
- import 'redux-thunk';
26
- import 'redux-saga';
27
- import 'redux-injectors';
28
- import 'immer';
29
- import './reducers-d6c0edb1.js';
30
- import 'history';
31
36
  import 'contensis-delivery-api';
32
- import './version-3833e8b5.js';
33
- import 'loglevel';
34
- import './login-f8ba3aeb.js';
35
- import './ToJs-879a5a85.js';
37
+ import './version-696796d7.js';
38
+ import 'history';
39
+ import './login-f6dfbe1b.js';
40
+ import './reducers-8e5d6232.js';
41
+ import './ToJs-2627ce21.js';
36
42
  import 'await-to-js';
37
43
  import 'js-cookie';
38
44
  import 'react-hot-loader';
39
- import 'query-string';
40
- import './RouteLoader-e5f0e8cb.js';
45
+ import './RouteLoader-7749ad3f.js';
46
+ import 'redux';
47
+ import 'redux-thunk';
48
+ import 'redux-saga';
49
+ import 'redux-injectors';
50
+
51
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
52
+
53
+ /**
54
+ * Make a LinkDepth api at the uri specified in middlewareConfig.
55
+ * The api supports a GET request and specified filters are supplied as query-string parameters.
56
+ * The response should be a normal Delivery API response.
57
+ * @param app Express app instance
58
+ * @param middlewareConfig Middleware configuration that represents the content types we want to search within, any filters that are required and any linkFields we wish to search within to derive a set of search results from the entries that contain the linkFields. Each key inside of linkFields represents another "linkDepth" of entries and we can specify all the same contentTypeId, filters, and linkFields of their own. There is no currently no limit on how deep these linkFields can go
59
+ * @returns Returns nothing if uri, contentTypeId or linkFields is not set in middlewareConfig
60
+ */
61
+ const makeLinkDepthApi = (app, middlewareConfig) => {
62
+ const {
63
+ uri,
64
+ contentTypeId,
65
+ linkFields
66
+ } = middlewareConfig;
67
+ if (!contentTypeId || !linkFields || !uri) return;
68
+ app.get(uri, makeLinkDepthMiddleware(middlewareConfig));
69
+ };
70
+ /** Create a content type hierarchy from supplied config and produces
71
+ * a RequestHandler function to serve our Express middleware */
72
+
73
+
74
+ const makeLinkDepthMiddleware = ({
75
+ contentTypeId,
76
+ filters,
77
+ sharedFilters,
78
+ linkFields
79
+ }) => {
80
+ try {
81
+ // Recursive function to flatten and index a provided nested config
82
+ const returnFieldIdKeys = (obj, level = 1) => {
83
+ var _Object$entries$map;
84
+
85
+ if (!obj) return {};
86
+ const mappedConfig = Object.entries(obj).map(([k, v]) => ({
87
+ contentTypeIds: Array.isArray(v.contentTypeId) ? v.contentTypeId : [v.contentTypeId || k],
88
+ fieldId: k,
89
+ filters: v.filters,
90
+ sharedFilters: v.sharedFilters
91
+ }));
92
+ const inner = (_Object$entries$map = Object.entries(obj).map(([k, v]) => returnFieldIdKeys(v.linkFields, level + 1))) === null || _Object$entries$map === void 0 ? void 0 : _Object$entries$map[0];
93
+ return {
94
+ [level]: mappedConfig,
95
+ ...inner
96
+ };
97
+ };
98
+
99
+ const others = returnFieldIdKeys(linkFields); // Level 0 is read from the top-level of config
100
+
101
+ const contentTypeHierarchy = {
102
+ 0: [{
103
+ contentTypeIds: Array.isArray(contentTypeId) ? contentTypeId : [contentTypeId],
104
+ filters,
105
+ sharedFilters
106
+ }],
107
+ ...others
108
+ }; // The runtime express request handler
109
+
110
+ const linkDepthMiddleware = async (req, res) => {
111
+ try {
112
+ // Short cache duration copied from canterbury project
113
+ setCachingHeaders(res, {
114
+ cacheControl: 'private',
115
+ surrogateControl: '10'
116
+ }); // Run our queries and provide a final result
117
+ // our params are sourced from the query-string
118
+
119
+ const result = await searchEventsTopDown(contentTypeHierarchy, req.query); // const result = await searchLinkDepthEntries(
120
+ // contentTypeHierarchy,
121
+ // req.query
122
+ // );
123
+
124
+ res.json(result);
125
+ } catch (error) {
126
+ // This is a runtime error encountered when processing a given request
127
+ console.error(error);
128
+ res.statusCode = 500;
129
+ res.json(error);
130
+ }
131
+ };
132
+
133
+ return linkDepthMiddleware;
134
+ } catch (error) {
135
+ // This will be an error building the middleware
136
+ // we can only serve what the error was as the request handler instead
137
+ console.error(error);
138
+
139
+ const errorMiddleware = async (req, res) => {
140
+ res.statusCode = 500;
141
+ res.json(JSON.stringify(error));
142
+ };
143
+
144
+ return errorMiddleware;
145
+ }
146
+ };
147
+
148
+ const getVarsFromConfig = (config, params) => {
149
+ // Build variables from query config to use in our Delivery API Query
150
+ const contentTypeIds = config.map(c => c.contentTypeIds).flat(); // Filters are the filters we are looking to include with the Query at this level
151
+
152
+ let filters = {}; // Shared filters are filters that share the same querystring key and are valid in multiple levels
153
+
154
+ let sharedFilters = {};
155
+ config.forEach(c => {
156
+ filters = { ...filters,
157
+ ...c.filters
158
+ };
159
+ sharedFilters = { ...sharedFilters,
160
+ ...c.sharedFilters
161
+ };
162
+ }); // FieldIds are the field name(s) in the parent/current entry that the
163
+ // entries are linked to, used to surface the next level based on id
164
+ // retrieved at the previous level
165
+
166
+ const fieldIds = config.map(c => c.fieldId).flat();
167
+ const queryFilters = makeFilterExpressions(filters, params);
168
+ const sharedQueryFilters = makeFilterExpressions(sharedFilters, params);
169
+ return {
170
+ contentTypeIds,
171
+ fieldIds,
172
+ filters,
173
+ queryFilters,
174
+ sharedFilters,
175
+ sharedQueryFilters
176
+ };
177
+ };
178
+
179
+ const makeDerivedIdsFilterExpression = (level, resultsAtLevel, ownIds = false, useFieldIds = false) => {
180
+ const previouslyDerivedIdsFilter = [];
181
+ const [prevFieldId, entries] = resultsAtLevel[level];
182
+ const prevKey = prevFieldId;
183
+ const prevResultIds = Util.GetIds(entries, useFieldIds ? prevFieldId : undefined);
184
+ if (prevKey && (prevResultIds === null || prevResultIds === void 0 ? void 0 : prevResultIds.length) > 0) previouslyDerivedIdsFilter.push({
185
+ key: ownIds ? 'sys.id' : `${prevFieldId}.sys.id`,
186
+ values: prevResultIds,
187
+ fieldOperator: 'in'
188
+ });else previouslyDerivedIdsFilter.push({
189
+ key: 'dud',
190
+ values: ['1'],
191
+ fieldOperator: 'in'
192
+ });
193
+ return previouslyDerivedIdsFilter;
194
+ };
195
+
196
+ const searchEventsTopDown = async (contentTypeHierarchy, params) => {
197
+ // Determine linkDepth for the final query by how many levels are in
198
+ // the contentTypeHierarchy object
199
+ const linkDepth = Object.keys(contentTypeHierarchy).length - 1 || 0; // Pre-size our results array to the size of our hierarchy
200
+
201
+ const resultsAtLevel = Object.values(contentTypeHierarchy).map((v, i, a) => {
202
+ const fieldId = i === 0 ? a[i + 1][0] : v[0];
203
+ return [fieldId.fieldId, []];
204
+ }); // [fieldId, results][]
205
+
206
+ for (const [level, levelConfig] of Object.entries(contentTypeHierarchy)) {
207
+ // LinkDepth level / current index
208
+ const currentLevel = Number(level); // Build variables from query config to use in our Delivery API Query
209
+
210
+ const {
211
+ contentTypeIds,
212
+ fieldIds,
213
+ queryFilters,
214
+ sharedQueryFilters
215
+ } = getVarsFromConfig(levelConfig, params); // We won't have fetched any derived results to
216
+ // include as a field filter with the very first query
217
+
218
+ let previouslyDerivedIdsFilter = [];
219
+
220
+ if (currentLevel !== 0) {
221
+ previouslyDerivedIdsFilter = makeDerivedIdsFilterExpression(currentLevel - 1, resultsAtLevel, true, true);
222
+ }
223
+
224
+ const query = searchQuery({
225
+ contentTypeIds,
226
+ filters: queryFilters,
227
+ idFilters: previouslyDerivedIdsFilter,
228
+ sharedFilters: sharedQueryFilters,
229
+ versionStatus: params.versionStatus || 'published'
230
+ }); // These are all sub-queries, we only want ids returned in these to include
231
+ // them to filter by in our next level(s) queries, along with any other filters
232
+ // configured and found at this level
233
+
234
+ query.fields = currentLevel === 0 ? [] : ['sys.id']; // Scalability limitation for today
235
+
236
+ query.pageSize = 2000;
237
+ const levelQueryResult = await cachedSearch.searchUsingPost(query, 0);
238
+ resultsAtLevel[currentLevel][1] = Util.GetItems(levelQueryResult);
239
+ } // Build and run our final query containing all results
240
+
241
+
242
+ const {
243
+ contentTypeIds,
244
+ queryFilters,
245
+ sharedQueryFilters
246
+ } = getVarsFromConfig(Object.values(contentTypeHierarchy)[0], params);
247
+ const previouslyDerivedIdsFilter = makeDerivedIdsFilterExpression(1, resultsAtLevel);
248
+ const query = finalQuery({
249
+ contentTypeIds,
250
+ filters: queryFilters,
251
+ idFilters: previouslyDerivedIdsFilter,
252
+ sharedFilters: sharedQueryFilters,
253
+ versionStatus: params.versionStatus || 'published'
254
+ }, Object.entries(contentTypeHierarchy).filter(([k]) => k !== '0').map(([level, levelConfig]) => {
255
+ // LinkDepth level / current index
256
+ const currentLevel = Number(level); // Build variables from query config to use in our Delivery API Query
257
+
258
+ const {
259
+ contentTypeIds,
260
+ queryFilters,
261
+ sharedQueryFilters
262
+ } = getVarsFromConfig(levelConfig, params);
263
+ const previousIdsFilter = makeDerivedIdsFilterExpression(currentLevel, resultsAtLevel, true);
264
+ return {
265
+ contentTypeIds,
266
+ filters: queryFilters,
267
+ idFilters: previousIdsFilter,
268
+ sharedFilters: sharedQueryFilters,
269
+ versionStatus: params.versionStatus || 'published'
270
+ };
271
+ })); // This is the final query to be run and response returned to the caller
272
+ // Only this bit cares about linkDepth, fields and pagination parameters
273
+
274
+ query.fields = JSON.parse(params.fields || '[]');
275
+ query.pageSize = params.pageSize;
276
+ query.pageIndex = params.pageIndex;
277
+ query.orderBy = params.orderBy; // console.log(JSON.stringify(query.toJSON()));
278
+
279
+ const finalQueryResult = await cachedSearch.searchUsingPost(query, linkDepth);
280
+ const entriesWithResolvedParents = await resolveParentEntries(contentTypeIds, Array.from(new Set(resultsAtLevel[1][1].map(e => e.sys.contentTypeId || ''))), resultsAtLevel[0][0], Util.GetItems(finalQueryResult), params);
281
+ return { ...finalQueryResult,
282
+ items: entriesWithResolvedParents
283
+ };
284
+ };
285
+
286
+ const resolveParentEntries = async (parentContentTypeIds, replaceContentTypeIds, parentFieldId, results, params) => {
287
+ // Build variables from query config to use in our Delivery API Query
288
+ const previousIdsFilter = makeDerivedIdsFilterExpression(0, [[parentFieldId, results]]);
289
+ const query = searchQuery({
290
+ contentTypeIds: parentContentTypeIds,
291
+ idFilters: previousIdsFilter
292
+ });
293
+ query.fields = JSON.parse(params.fields || '[]');
294
+ console.log(JSON.stringify(query.toJSON()));
295
+ const parentResults = await cachedSearch.search(query, 0);
296
+ return mergeResults(results, Util.GetItems(parentResults), replaceContentTypeIds, parentFieldId);
297
+ };
298
+
299
+ const mergeResults = (results, parentResults, replaceContentTypeIds, linkFieldId) => results.map(r => {
300
+ if (replaceContentTypeIds.some(c => c === r.sys.contentTypeId)) {
301
+ const resolvedParent = parentResults === null || parentResults === void 0 ? void 0 : parentResults.find(e => {
302
+ var _e$linkFieldId;
303
+
304
+ return (_e$linkFieldId = e[linkFieldId]) === null || _e$linkFieldId === void 0 ? void 0 : _e$linkFieldId.some(l => {
305
+ var _l$sys;
306
+
307
+ return ((_l$sys = l.sys) === null || _l$sys === void 0 ? void 0 : _l$sys.id) === r.sys.id;
308
+ });
309
+ });
310
+ if (resolvedParent) return { ...resolvedParent,
311
+ ...r,
312
+ entryTitle: resolvedParent.entryTitle,
313
+ entryDescription: resolvedParent.entryDescription,
314
+ sys: resolvedParent.sys,
315
+ originalSys: r.sys
316
+ };else return r;
317
+ }
318
+
319
+ return r;
320
+ }).filter(r => r);
321
+
322
+ const finalQuery = ({
323
+ assetTypes,
324
+ contentTypeIds,
325
+ fields,
326
+ filters,
327
+ idFilters,
328
+ sharedFilters,
329
+ pageSize,
330
+ pageIndex,
331
+ orderBy,
332
+ searchTerm,
333
+ versionStatus = 'published',
334
+ webpageTemplates,
335
+ weightedSearchFields
336
+ }, children) => {
337
+ const expressions$1 = [...defaultExpressions(versionStatus), Op.or(Op.and(...contentTypeIdExpression(contentTypeIds, webpageTemplates, assetTypes), ...filterExpressions(filters), Op.or(...filterExpressions(sharedFilters) // Op.and(
338
+ // ...sharedFilters.map(sf =>
339
+ // Op.not(exp.fieldExpression(sf.key, true, 'exists')[0])
340
+ // ),
341
+ // ...exp.filterExpressions(idFilters)
342
+ // )
343
+ )), ...children.map(child => Op.and(...contentTypeIdExpression(child.contentTypeIds, child.webpageTemplates, child.assetTypes), ...filterExpressions(child.sharedFilters), ...filterExpressions(child.idFilters)))), ...termExpressions(searchTerm, weightedSearchFields)];
344
+ const query = new Query(...expressions$1);
345
+ query.orderBy = orderByExpression(orderBy);
346
+
347
+ if (fields && fields.length > 0) {
348
+ query.fields = fields;
349
+ } // (query as any).includeArchived = true;
350
+ // (query as any).includeDeleted = true;
351
+
352
+
353
+ query.pageIndex = pageIndex;
354
+ query.pageSize = pageSize;
355
+ return query;
356
+ };
357
+ /**
358
+ * Create a filter expression from a provided filters configuration object
359
+ * and populate them based on the presence of that key in params, filter
360
+ * out any filter keys that do not have a value set in params
361
+ * @param f filters configuration from any level
362
+ * @param params request.query object from Express middleware
363
+ * @returns FilterExpression[] we can use to use with searchQuery function
364
+ */
365
+
366
+
367
+ const makeFilterExpressions = (f, params) => Object.entries(f).map(([paramKey, filterConfig]) => {
368
+ var _params$paramKey;
369
+
370
+ const filterValues = (_params$paramKey = params[paramKey]) === null || _params$paramKey === void 0 ? void 0 : _params$paramKey.split(',');
371
+ return typeof filterValues !== 'undefined' ? {
372
+ key: typeof filterConfig === 'object' ? filterConfig.fieldId : filterConfig,
373
+ values: filterValues,
374
+ fieldOperator: typeof filterConfig === 'object' ? filterConfig.fieldOperator : 'equalTo',
375
+ logicOperator: typeof filterConfig === 'object' ? filterConfig.logicOperator : 'or'
376
+ } : null;
377
+ }).filter(o => o);
378
+ /**
379
+ * Builds our complete Delivery API Query object from a set of provided arguments
380
+ * @param queryParams
381
+ * @returns Delivery API Query
382
+ */
383
+
384
+
385
+ const searchQuery = ({
386
+ assetTypes,
387
+ contentTypeIds,
388
+ customWhere,
389
+ fields,
390
+ filters,
391
+ idFilters,
392
+ sharedFilters,
393
+ pageSize,
394
+ pageIndex,
395
+ orderBy,
396
+ searchTerm,
397
+ versionStatus = 'published',
398
+ webpageTemplates,
399
+ weightedSearchFields
400
+ }) => {
401
+ const expressions$1 = [...defaultExpressions(versionStatus), ...contentTypeIdExpression(contentTypeIds, webpageTemplates, assetTypes), ...customWhereExpressions(customWhere), ...filterExpressions(filters), ...filterExpressions(idFilters), ...((sharedFilters === null || sharedFilters === void 0 ? void 0 : sharedFilters.length) > 0 ? [Op.or(...filterExpressions(sharedFilters, true))] : []), ...termExpressions(searchTerm, weightedSearchFields)];
402
+ const query = new Query(...expressions$1);
403
+ query.orderBy = orderByExpression(orderBy);
404
+
405
+ if (fields && fields.length > 0) {
406
+ query.fields = fields;
407
+ } // (query as any).includeArchived = true;
408
+ // (query as any).includeDeleted = true;
409
+
410
+
411
+ query.pageIndex = pageIndex;
412
+ query.pageSize = pageSize;
413
+ return query;
414
+ };
415
+ /**
416
+ * Util class holds our search results helper boilerplate methods
417
+ */
418
+
419
+
420
+ class Util {
421
+ static GetIds(entries, fieldId) {
422
+ if (fieldId) {
423
+ return entries.map(e => {
424
+ var _e$fieldId, _e$fieldId2, _e$fieldId2$sys;
425
+
426
+ return Array.isArray(e === null || e === void 0 ? void 0 : e[fieldId]) ? e === null || e === void 0 ? void 0 : (_e$fieldId = e[fieldId]) === null || _e$fieldId === void 0 ? void 0 : _e$fieldId.map(f => {
427
+ var _f$sys;
428
+
429
+ return f === null || f === void 0 ? void 0 : (_f$sys = f.sys) === null || _f$sys === void 0 ? void 0 : _f$sys.id;
430
+ }) : (e === null || e === void 0 ? void 0 : (_e$fieldId2 = e[fieldId]) === null || _e$fieldId2 === void 0 ? void 0 : (_e$fieldId2$sys = _e$fieldId2.sys) === null || _e$fieldId2$sys === void 0 ? void 0 : _e$fieldId2$sys.id) || '';
431
+ }).flat();
432
+ }
433
+
434
+ return entries.map(e => {
435
+ var _e$sys;
436
+
437
+ return (e === null || e === void 0 ? void 0 : (_e$sys = e.sys) === null || _e$sys === void 0 ? void 0 : _e$sys.id) || '';
438
+ });
439
+ }
440
+
441
+ static GetItems(result) {
442
+ return this.GetResults(result) ? result.items : [];
443
+ }
444
+
445
+ static GetResults(result) {
446
+ if (result !== null && result !== void 0 && result.items) {
447
+ return result;
448
+ } else {
449
+ return null;
450
+ }
451
+ }
452
+
453
+ }
41
454
 
42
455
  const servers$1 = SERVERS;
43
456
  /* global SERVERS */
@@ -56,6 +469,7 @@ const DisplayStartupConfiguration = config => {
56
469
  console.log();
57
470
  console.log('Reverse proxy paths: ', JSON.stringify(config.reverseProxyPaths, null, 2));
58
471
  console.log();
472
+ if (config.staticFolderPath) console.log(`Serving static assets from: "/dist/${config.staticFolderPath}/"`);
59
473
  /* eslint-enable no-console */
60
474
  };
61
475
 
@@ -116,6 +530,7 @@ const replaceStaticPath = (str, staticFolderPath = 'static') => str.replace(/sta
116
530
  const bundleManipulationMiddleware = ({
117
531
  appRootPath,
118
532
  maxage,
533
+ staticFolderPath,
119
534
  staticRoutePath
120
535
  }) => (req, res, next) => {
121
536
  const filename = path.basename(req.path);
@@ -123,7 +538,7 @@ const bundleManipulationMiddleware = ({
123
538
  const legacyBundle = filename.endsWith('.js');
124
539
 
125
540
  if ((legacyBundle || modernBundle) && filename.startsWith('runtime.')) {
126
- const jsRuntimeLocation = path.resolve(appRootPath, `dist/static/${modernBundle ? 'modern/js' : 'legacy/js'}/${filename}`);
541
+ const jsRuntimeLocation = path.resolve(appRootPath, `dist/${staticFolderPath}/${modernBundle ? 'modern/js' : 'legacy/js'}/${filename}`);
127
542
 
128
543
  try {
129
544
  const jsRuntimeBundle = fs.readFileSync(jsRuntimeLocation, 'utf8');
@@ -153,13 +568,22 @@ const resolveStartupMiddleware = ({
153
568
  maxage,
154
569
  staticFolderPath,
155
570
  startupScriptFilename
156
- }) => (req, res, next) => {
571
+ }) => async (req, res, next) => {
157
572
  if (startupScriptFilename !== 'startup.js' && req.path === `/${startupScriptFilename}`) {
158
- const startupFilePath = `dist/${staticFolderPath}/startup.js`;
159
- const startupFileLocation = path.resolve(appRootPath, startupFilePath);
160
- if (maxage) res.set('Cache-Control', `public, max-age=${maxage}`);
573
+ let startupFileLocation = '';
161
574
 
162
575
  try {
576
+ const startupFilePaths = [`dist/static/startup.js`, `dist/${staticFolderPath}/startup.js`];
577
+ let startupFilePath = '';
578
+ startupFilePaths.forEach(async testPath => {
579
+ try {
580
+ fs.accessSync(testPath);
581
+ startupFilePath = testPath;
582
+ } catch (ex) {// Do nothing
583
+ }
584
+ });
585
+ startupFileLocation = path.resolve(appRootPath, startupFilePath);
586
+ if (maxage) res.set('Cache-Control', `public, max-age=${maxage}`);
163
587
  res.sendFile(startupFileLocation);
164
588
  } catch (sendFileError) {
165
589
  // eslint-disable-next-line no-console
@@ -185,6 +609,7 @@ const staticAssets = (app, {
185
609
  // these maxage values are different in config but the same in runtime,
186
610
  // this one is the true value in seconds
187
611
  maxage: CacheDuration.static,
612
+ staticFolderPath,
188
613
  staticRoutePath
189
614
  }), resolveStartupMiddleware({
190
615
  appRootPath,
@@ -199,6 +624,3114 @@ const staticAssets = (app, {
199
624
  }));
200
625
  };
201
626
 
627
+ /**
628
+ * Removes all key-value entries from the list cache.
629
+ *
630
+ * @private
631
+ * @name clear
632
+ * @memberOf ListCache
633
+ */
634
+
635
+ function listCacheClear$1() {
636
+ this.__data__ = [];
637
+ this.size = 0;
638
+ }
639
+
640
+ var _listCacheClear = listCacheClear$1;
641
+
642
+ /**
643
+ * Performs a
644
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
645
+ * comparison between two values to determine if they are equivalent.
646
+ *
647
+ * @static
648
+ * @memberOf _
649
+ * @since 4.0.0
650
+ * @category Lang
651
+ * @param {*} value The value to compare.
652
+ * @param {*} other The other value to compare.
653
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
654
+ * @example
655
+ *
656
+ * var object = { 'a': 1 };
657
+ * var other = { 'a': 1 };
658
+ *
659
+ * _.eq(object, object);
660
+ * // => true
661
+ *
662
+ * _.eq(object, other);
663
+ * // => false
664
+ *
665
+ * _.eq('a', 'a');
666
+ * // => true
667
+ *
668
+ * _.eq('a', Object('a'));
669
+ * // => false
670
+ *
671
+ * _.eq(NaN, NaN);
672
+ * // => true
673
+ */
674
+
675
+ function eq$2(value, other) {
676
+ return value === other || (value !== value && other !== other);
677
+ }
678
+
679
+ var eq_1 = eq$2;
680
+
681
+ var eq$1 = eq_1;
682
+
683
+ /**
684
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
685
+ *
686
+ * @private
687
+ * @param {Array} array The array to inspect.
688
+ * @param {*} key The key to search for.
689
+ * @returns {number} Returns the index of the matched value, else `-1`.
690
+ */
691
+ function assocIndexOf$4(array, key) {
692
+ var length = array.length;
693
+ while (length--) {
694
+ if (eq$1(array[length][0], key)) {
695
+ return length;
696
+ }
697
+ }
698
+ return -1;
699
+ }
700
+
701
+ var _assocIndexOf = assocIndexOf$4;
702
+
703
+ var assocIndexOf$3 = _assocIndexOf;
704
+
705
+ /** Used for built-in method references. */
706
+ var arrayProto = Array.prototype;
707
+
708
+ /** Built-in value references. */
709
+ var splice = arrayProto.splice;
710
+
711
+ /**
712
+ * Removes `key` and its value from the list cache.
713
+ *
714
+ * @private
715
+ * @name delete
716
+ * @memberOf ListCache
717
+ * @param {string} key The key of the value to remove.
718
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
719
+ */
720
+ function listCacheDelete$1(key) {
721
+ var data = this.__data__,
722
+ index = assocIndexOf$3(data, key);
723
+
724
+ if (index < 0) {
725
+ return false;
726
+ }
727
+ var lastIndex = data.length - 1;
728
+ if (index == lastIndex) {
729
+ data.pop();
730
+ } else {
731
+ splice.call(data, index, 1);
732
+ }
733
+ --this.size;
734
+ return true;
735
+ }
736
+
737
+ var _listCacheDelete = listCacheDelete$1;
738
+
739
+ var assocIndexOf$2 = _assocIndexOf;
740
+
741
+ /**
742
+ * Gets the list cache value for `key`.
743
+ *
744
+ * @private
745
+ * @name get
746
+ * @memberOf ListCache
747
+ * @param {string} key The key of the value to get.
748
+ * @returns {*} Returns the entry value.
749
+ */
750
+ function listCacheGet$1(key) {
751
+ var data = this.__data__,
752
+ index = assocIndexOf$2(data, key);
753
+
754
+ return index < 0 ? undefined : data[index][1];
755
+ }
756
+
757
+ var _listCacheGet = listCacheGet$1;
758
+
759
+ var assocIndexOf$1 = _assocIndexOf;
760
+
761
+ /**
762
+ * Checks if a list cache value for `key` exists.
763
+ *
764
+ * @private
765
+ * @name has
766
+ * @memberOf ListCache
767
+ * @param {string} key The key of the entry to check.
768
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
769
+ */
770
+ function listCacheHas$1(key) {
771
+ return assocIndexOf$1(this.__data__, key) > -1;
772
+ }
773
+
774
+ var _listCacheHas = listCacheHas$1;
775
+
776
+ var assocIndexOf = _assocIndexOf;
777
+
778
+ /**
779
+ * Sets the list cache `key` to `value`.
780
+ *
781
+ * @private
782
+ * @name set
783
+ * @memberOf ListCache
784
+ * @param {string} key The key of the value to set.
785
+ * @param {*} value The value to set.
786
+ * @returns {Object} Returns the list cache instance.
787
+ */
788
+ function listCacheSet$1(key, value) {
789
+ var data = this.__data__,
790
+ index = assocIndexOf(data, key);
791
+
792
+ if (index < 0) {
793
+ ++this.size;
794
+ data.push([key, value]);
795
+ } else {
796
+ data[index][1] = value;
797
+ }
798
+ return this;
799
+ }
800
+
801
+ var _listCacheSet = listCacheSet$1;
802
+
803
+ var listCacheClear = _listCacheClear,
804
+ listCacheDelete = _listCacheDelete,
805
+ listCacheGet = _listCacheGet,
806
+ listCacheHas = _listCacheHas,
807
+ listCacheSet = _listCacheSet;
808
+
809
+ /**
810
+ * Creates an list cache object.
811
+ *
812
+ * @private
813
+ * @constructor
814
+ * @param {Array} [entries] The key-value pairs to cache.
815
+ */
816
+ function ListCache$4(entries) {
817
+ var index = -1,
818
+ length = entries == null ? 0 : entries.length;
819
+
820
+ this.clear();
821
+ while (++index < length) {
822
+ var entry = entries[index];
823
+ this.set(entry[0], entry[1]);
824
+ }
825
+ }
826
+
827
+ // Add methods to `ListCache`.
828
+ ListCache$4.prototype.clear = listCacheClear;
829
+ ListCache$4.prototype['delete'] = listCacheDelete;
830
+ ListCache$4.prototype.get = listCacheGet;
831
+ ListCache$4.prototype.has = listCacheHas;
832
+ ListCache$4.prototype.set = listCacheSet;
833
+
834
+ var _ListCache = ListCache$4;
835
+
836
+ var ListCache$3 = _ListCache;
837
+
838
+ /**
839
+ * Removes all key-value entries from the stack.
840
+ *
841
+ * @private
842
+ * @name clear
843
+ * @memberOf Stack
844
+ */
845
+ function stackClear$1() {
846
+ this.__data__ = new ListCache$3;
847
+ this.size = 0;
848
+ }
849
+
850
+ var _stackClear = stackClear$1;
851
+
852
+ /**
853
+ * Removes `key` and its value from the stack.
854
+ *
855
+ * @private
856
+ * @name delete
857
+ * @memberOf Stack
858
+ * @param {string} key The key of the value to remove.
859
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
860
+ */
861
+
862
+ function stackDelete$1(key) {
863
+ var data = this.__data__,
864
+ result = data['delete'](key);
865
+
866
+ this.size = data.size;
867
+ return result;
868
+ }
869
+
870
+ var _stackDelete = stackDelete$1;
871
+
872
+ /**
873
+ * Gets the stack value for `key`.
874
+ *
875
+ * @private
876
+ * @name get
877
+ * @memberOf Stack
878
+ * @param {string} key The key of the value to get.
879
+ * @returns {*} Returns the entry value.
880
+ */
881
+
882
+ function stackGet$1(key) {
883
+ return this.__data__.get(key);
884
+ }
885
+
886
+ var _stackGet = stackGet$1;
887
+
888
+ /**
889
+ * Checks if a stack value for `key` exists.
890
+ *
891
+ * @private
892
+ * @name has
893
+ * @memberOf Stack
894
+ * @param {string} key The key of the entry to check.
895
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
896
+ */
897
+
898
+ function stackHas$1(key) {
899
+ return this.__data__.has(key);
900
+ }
901
+
902
+ var _stackHas = stackHas$1;
903
+
904
+ /** Detect free variable `global` from Node.js. */
905
+
906
+ var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
907
+
908
+ var _freeGlobal = freeGlobal$1;
909
+
910
+ var freeGlobal = _freeGlobal;
911
+
912
+ /** Detect free variable `self`. */
913
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
914
+
915
+ /** Used as a reference to the global object. */
916
+ var root$8 = freeGlobal || freeSelf || Function('return this')();
917
+
918
+ var _root = root$8;
919
+
920
+ var root$7 = _root;
921
+
922
+ /** Built-in value references. */
923
+ var Symbol$3 = root$7.Symbol;
924
+
925
+ var _Symbol = Symbol$3;
926
+
927
+ var Symbol$2 = _Symbol;
928
+
929
+ /** Used for built-in method references. */
930
+ var objectProto$c = Object.prototype;
931
+
932
+ /** Used to check objects for own properties. */
933
+ var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
934
+
935
+ /**
936
+ * Used to resolve the
937
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
938
+ * of values.
939
+ */
940
+ var nativeObjectToString$1 = objectProto$c.toString;
941
+
942
+ /** Built-in value references. */
943
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
944
+
945
+ /**
946
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
947
+ *
948
+ * @private
949
+ * @param {*} value The value to query.
950
+ * @returns {string} Returns the raw `toStringTag`.
951
+ */
952
+ function getRawTag$1(value) {
953
+ var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
954
+ tag = value[symToStringTag$1];
955
+
956
+ try {
957
+ value[symToStringTag$1] = undefined;
958
+ var unmasked = true;
959
+ } catch (e) {}
960
+
961
+ var result = nativeObjectToString$1.call(value);
962
+ if (unmasked) {
963
+ if (isOwn) {
964
+ value[symToStringTag$1] = tag;
965
+ } else {
966
+ delete value[symToStringTag$1];
967
+ }
968
+ }
969
+ return result;
970
+ }
971
+
972
+ var _getRawTag = getRawTag$1;
973
+
974
+ /** Used for built-in method references. */
975
+
976
+ var objectProto$b = Object.prototype;
977
+
978
+ /**
979
+ * Used to resolve the
980
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
981
+ * of values.
982
+ */
983
+ var nativeObjectToString = objectProto$b.toString;
984
+
985
+ /**
986
+ * Converts `value` to a string using `Object.prototype.toString`.
987
+ *
988
+ * @private
989
+ * @param {*} value The value to convert.
990
+ * @returns {string} Returns the converted string.
991
+ */
992
+ function objectToString$1(value) {
993
+ return nativeObjectToString.call(value);
994
+ }
995
+
996
+ var _objectToString = objectToString$1;
997
+
998
+ var Symbol$1 = _Symbol,
999
+ getRawTag = _getRawTag,
1000
+ objectToString = _objectToString;
1001
+
1002
+ /** `Object#toString` result references. */
1003
+ var nullTag = '[object Null]',
1004
+ undefinedTag = '[object Undefined]';
1005
+
1006
+ /** Built-in value references. */
1007
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
1008
+
1009
+ /**
1010
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1011
+ *
1012
+ * @private
1013
+ * @param {*} value The value to query.
1014
+ * @returns {string} Returns the `toStringTag`.
1015
+ */
1016
+ function baseGetTag$4(value) {
1017
+ if (value == null) {
1018
+ return value === undefined ? undefinedTag : nullTag;
1019
+ }
1020
+ return (symToStringTag && symToStringTag in Object(value))
1021
+ ? getRawTag(value)
1022
+ : objectToString(value);
1023
+ }
1024
+
1025
+ var _baseGetTag = baseGetTag$4;
1026
+
1027
+ /**
1028
+ * Checks if `value` is the
1029
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1030
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1031
+ *
1032
+ * @static
1033
+ * @memberOf _
1034
+ * @since 0.1.0
1035
+ * @category Lang
1036
+ * @param {*} value The value to check.
1037
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1038
+ * @example
1039
+ *
1040
+ * _.isObject({});
1041
+ * // => true
1042
+ *
1043
+ * _.isObject([1, 2, 3]);
1044
+ * // => true
1045
+ *
1046
+ * _.isObject(_.noop);
1047
+ * // => true
1048
+ *
1049
+ * _.isObject(null);
1050
+ * // => false
1051
+ */
1052
+
1053
+ function isObject$5(value) {
1054
+ var type = typeof value;
1055
+ return value != null && (type == 'object' || type == 'function');
1056
+ }
1057
+
1058
+ var isObject_1 = isObject$5;
1059
+
1060
+ var baseGetTag$3 = _baseGetTag,
1061
+ isObject$4 = isObject_1;
1062
+
1063
+ /** `Object#toString` result references. */
1064
+ var asyncTag = '[object AsyncFunction]',
1065
+ funcTag$2 = '[object Function]',
1066
+ genTag$1 = '[object GeneratorFunction]',
1067
+ proxyTag = '[object Proxy]';
1068
+
1069
+ /**
1070
+ * Checks if `value` is classified as a `Function` object.
1071
+ *
1072
+ * @static
1073
+ * @memberOf _
1074
+ * @since 0.1.0
1075
+ * @category Lang
1076
+ * @param {*} value The value to check.
1077
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1078
+ * @example
1079
+ *
1080
+ * _.isFunction(_);
1081
+ * // => true
1082
+ *
1083
+ * _.isFunction(/abc/);
1084
+ * // => false
1085
+ */
1086
+ function isFunction$2(value) {
1087
+ if (!isObject$4(value)) {
1088
+ return false;
1089
+ }
1090
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1091
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1092
+ var tag = baseGetTag$3(value);
1093
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
1094
+ }
1095
+
1096
+ var isFunction_1 = isFunction$2;
1097
+
1098
+ var root$6 = _root;
1099
+
1100
+ /** Used to detect overreaching core-js shims. */
1101
+ var coreJsData$1 = root$6['__core-js_shared__'];
1102
+
1103
+ var _coreJsData = coreJsData$1;
1104
+
1105
+ var coreJsData = _coreJsData;
1106
+
1107
+ /** Used to detect methods masquerading as native. */
1108
+ var maskSrcKey = (function() {
1109
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1110
+ return uid ? ('Symbol(src)_1.' + uid) : '';
1111
+ }());
1112
+
1113
+ /**
1114
+ * Checks if `func` has its source masked.
1115
+ *
1116
+ * @private
1117
+ * @param {Function} func The function to check.
1118
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1119
+ */
1120
+ function isMasked$1(func) {
1121
+ return !!maskSrcKey && (maskSrcKey in func);
1122
+ }
1123
+
1124
+ var _isMasked = isMasked$1;
1125
+
1126
+ /** Used for built-in method references. */
1127
+
1128
+ var funcProto$1 = Function.prototype;
1129
+
1130
+ /** Used to resolve the decompiled source of functions. */
1131
+ var funcToString$1 = funcProto$1.toString;
1132
+
1133
+ /**
1134
+ * Converts `func` to its source code.
1135
+ *
1136
+ * @private
1137
+ * @param {Function} func The function to convert.
1138
+ * @returns {string} Returns the source code.
1139
+ */
1140
+ function toSource$2(func) {
1141
+ if (func != null) {
1142
+ try {
1143
+ return funcToString$1.call(func);
1144
+ } catch (e) {}
1145
+ try {
1146
+ return (func + '');
1147
+ } catch (e) {}
1148
+ }
1149
+ return '';
1150
+ }
1151
+
1152
+ var _toSource = toSource$2;
1153
+
1154
+ var isFunction$1 = isFunction_1,
1155
+ isMasked = _isMasked,
1156
+ isObject$3 = isObject_1,
1157
+ toSource$1 = _toSource;
1158
+
1159
+ /**
1160
+ * Used to match `RegExp`
1161
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1162
+ */
1163
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1164
+
1165
+ /** Used to detect host constructors (Safari). */
1166
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1167
+
1168
+ /** Used for built-in method references. */
1169
+ var funcProto = Function.prototype,
1170
+ objectProto$a = Object.prototype;
1171
+
1172
+ /** Used to resolve the decompiled source of functions. */
1173
+ var funcToString = funcProto.toString;
1174
+
1175
+ /** Used to check objects for own properties. */
1176
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1177
+
1178
+ /** Used to detect if a method is native. */
1179
+ var reIsNative = RegExp('^' +
1180
+ funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
1181
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1182
+ );
1183
+
1184
+ /**
1185
+ * The base implementation of `_.isNative` without bad shim checks.
1186
+ *
1187
+ * @private
1188
+ * @param {*} value The value to check.
1189
+ * @returns {boolean} Returns `true` if `value` is a native function,
1190
+ * else `false`.
1191
+ */
1192
+ function baseIsNative$1(value) {
1193
+ if (!isObject$3(value) || isMasked(value)) {
1194
+ return false;
1195
+ }
1196
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
1197
+ return pattern.test(toSource$1(value));
1198
+ }
1199
+
1200
+ var _baseIsNative = baseIsNative$1;
1201
+
1202
+ /**
1203
+ * Gets the value at `key` of `object`.
1204
+ *
1205
+ * @private
1206
+ * @param {Object} [object] The object to query.
1207
+ * @param {string} key The key of the property to get.
1208
+ * @returns {*} Returns the property value.
1209
+ */
1210
+
1211
+ function getValue$1(object, key) {
1212
+ return object == null ? undefined : object[key];
1213
+ }
1214
+
1215
+ var _getValue = getValue$1;
1216
+
1217
+ var baseIsNative = _baseIsNative,
1218
+ getValue = _getValue;
1219
+
1220
+ /**
1221
+ * Gets the native function at `key` of `object`.
1222
+ *
1223
+ * @private
1224
+ * @param {Object} object The object to query.
1225
+ * @param {string} key The key of the method to get.
1226
+ * @returns {*} Returns the function if it's native, else `undefined`.
1227
+ */
1228
+ function getNative$7(object, key) {
1229
+ var value = getValue(object, key);
1230
+ return baseIsNative(value) ? value : undefined;
1231
+ }
1232
+
1233
+ var _getNative = getNative$7;
1234
+
1235
+ var getNative$6 = _getNative,
1236
+ root$5 = _root;
1237
+
1238
+ /* Built-in method references that are verified to be native. */
1239
+ var Map$3 = getNative$6(root$5, 'Map');
1240
+
1241
+ var _Map = Map$3;
1242
+
1243
+ var getNative$5 = _getNative;
1244
+
1245
+ /* Built-in method references that are verified to be native. */
1246
+ var nativeCreate$4 = getNative$5(Object, 'create');
1247
+
1248
+ var _nativeCreate = nativeCreate$4;
1249
+
1250
+ var nativeCreate$3 = _nativeCreate;
1251
+
1252
+ /**
1253
+ * Removes all key-value entries from the hash.
1254
+ *
1255
+ * @private
1256
+ * @name clear
1257
+ * @memberOf Hash
1258
+ */
1259
+ function hashClear$1() {
1260
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
1261
+ this.size = 0;
1262
+ }
1263
+
1264
+ var _hashClear = hashClear$1;
1265
+
1266
+ /**
1267
+ * Removes `key` and its value from the hash.
1268
+ *
1269
+ * @private
1270
+ * @name delete
1271
+ * @memberOf Hash
1272
+ * @param {Object} hash The hash to modify.
1273
+ * @param {string} key The key of the value to remove.
1274
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1275
+ */
1276
+
1277
+ function hashDelete$1(key) {
1278
+ var result = this.has(key) && delete this.__data__[key];
1279
+ this.size -= result ? 1 : 0;
1280
+ return result;
1281
+ }
1282
+
1283
+ var _hashDelete = hashDelete$1;
1284
+
1285
+ var nativeCreate$2 = _nativeCreate;
1286
+
1287
+ /** Used to stand-in for `undefined` hash values. */
1288
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1289
+
1290
+ /** Used for built-in method references. */
1291
+ var objectProto$9 = Object.prototype;
1292
+
1293
+ /** Used to check objects for own properties. */
1294
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1295
+
1296
+ /**
1297
+ * Gets the hash value for `key`.
1298
+ *
1299
+ * @private
1300
+ * @name get
1301
+ * @memberOf Hash
1302
+ * @param {string} key The key of the value to get.
1303
+ * @returns {*} Returns the entry value.
1304
+ */
1305
+ function hashGet$1(key) {
1306
+ var data = this.__data__;
1307
+ if (nativeCreate$2) {
1308
+ var result = data[key];
1309
+ return result === HASH_UNDEFINED$1 ? undefined : result;
1310
+ }
1311
+ return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
1312
+ }
1313
+
1314
+ var _hashGet = hashGet$1;
1315
+
1316
+ var nativeCreate$1 = _nativeCreate;
1317
+
1318
+ /** Used for built-in method references. */
1319
+ var objectProto$8 = Object.prototype;
1320
+
1321
+ /** Used to check objects for own properties. */
1322
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1323
+
1324
+ /**
1325
+ * Checks if a hash value for `key` exists.
1326
+ *
1327
+ * @private
1328
+ * @name has
1329
+ * @memberOf Hash
1330
+ * @param {string} key The key of the entry to check.
1331
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1332
+ */
1333
+ function hashHas$1(key) {
1334
+ var data = this.__data__;
1335
+ return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
1336
+ }
1337
+
1338
+ var _hashHas = hashHas$1;
1339
+
1340
+ var nativeCreate = _nativeCreate;
1341
+
1342
+ /** Used to stand-in for `undefined` hash values. */
1343
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
1344
+
1345
+ /**
1346
+ * Sets the hash `key` to `value`.
1347
+ *
1348
+ * @private
1349
+ * @name set
1350
+ * @memberOf Hash
1351
+ * @param {string} key The key of the value to set.
1352
+ * @param {*} value The value to set.
1353
+ * @returns {Object} Returns the hash instance.
1354
+ */
1355
+ function hashSet$1(key, value) {
1356
+ var data = this.__data__;
1357
+ this.size += this.has(key) ? 0 : 1;
1358
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
1359
+ return this;
1360
+ }
1361
+
1362
+ var _hashSet = hashSet$1;
1363
+
1364
+ var hashClear = _hashClear,
1365
+ hashDelete = _hashDelete,
1366
+ hashGet = _hashGet,
1367
+ hashHas = _hashHas,
1368
+ hashSet = _hashSet;
1369
+
1370
+ /**
1371
+ * Creates a hash object.
1372
+ *
1373
+ * @private
1374
+ * @constructor
1375
+ * @param {Array} [entries] The key-value pairs to cache.
1376
+ */
1377
+ function Hash$1(entries) {
1378
+ var index = -1,
1379
+ length = entries == null ? 0 : entries.length;
1380
+
1381
+ this.clear();
1382
+ while (++index < length) {
1383
+ var entry = entries[index];
1384
+ this.set(entry[0], entry[1]);
1385
+ }
1386
+ }
1387
+
1388
+ // Add methods to `Hash`.
1389
+ Hash$1.prototype.clear = hashClear;
1390
+ Hash$1.prototype['delete'] = hashDelete;
1391
+ Hash$1.prototype.get = hashGet;
1392
+ Hash$1.prototype.has = hashHas;
1393
+ Hash$1.prototype.set = hashSet;
1394
+
1395
+ var _Hash = Hash$1;
1396
+
1397
+ var Hash = _Hash,
1398
+ ListCache$2 = _ListCache,
1399
+ Map$2 = _Map;
1400
+
1401
+ /**
1402
+ * Removes all key-value entries from the map.
1403
+ *
1404
+ * @private
1405
+ * @name clear
1406
+ * @memberOf MapCache
1407
+ */
1408
+ function mapCacheClear$1() {
1409
+ this.size = 0;
1410
+ this.__data__ = {
1411
+ 'hash': new Hash,
1412
+ 'map': new (Map$2 || ListCache$2),
1413
+ 'string': new Hash
1414
+ };
1415
+ }
1416
+
1417
+ var _mapCacheClear = mapCacheClear$1;
1418
+
1419
+ /**
1420
+ * Checks if `value` is suitable for use as unique object key.
1421
+ *
1422
+ * @private
1423
+ * @param {*} value The value to check.
1424
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1425
+ */
1426
+
1427
+ function isKeyable$1(value) {
1428
+ var type = typeof value;
1429
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1430
+ ? (value !== '__proto__')
1431
+ : (value === null);
1432
+ }
1433
+
1434
+ var _isKeyable = isKeyable$1;
1435
+
1436
+ var isKeyable = _isKeyable;
1437
+
1438
+ /**
1439
+ * Gets the data for `map`.
1440
+ *
1441
+ * @private
1442
+ * @param {Object} map The map to query.
1443
+ * @param {string} key The reference key.
1444
+ * @returns {*} Returns the map data.
1445
+ */
1446
+ function getMapData$4(map, key) {
1447
+ var data = map.__data__;
1448
+ return isKeyable(key)
1449
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1450
+ : data.map;
1451
+ }
1452
+
1453
+ var _getMapData = getMapData$4;
1454
+
1455
+ var getMapData$3 = _getMapData;
1456
+
1457
+ /**
1458
+ * Removes `key` and its value from the map.
1459
+ *
1460
+ * @private
1461
+ * @name delete
1462
+ * @memberOf MapCache
1463
+ * @param {string} key The key of the value to remove.
1464
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1465
+ */
1466
+ function mapCacheDelete$1(key) {
1467
+ var result = getMapData$3(this, key)['delete'](key);
1468
+ this.size -= result ? 1 : 0;
1469
+ return result;
1470
+ }
1471
+
1472
+ var _mapCacheDelete = mapCacheDelete$1;
1473
+
1474
+ var getMapData$2 = _getMapData;
1475
+
1476
+ /**
1477
+ * Gets the map value for `key`.
1478
+ *
1479
+ * @private
1480
+ * @name get
1481
+ * @memberOf MapCache
1482
+ * @param {string} key The key of the value to get.
1483
+ * @returns {*} Returns the entry value.
1484
+ */
1485
+ function mapCacheGet$1(key) {
1486
+ return getMapData$2(this, key).get(key);
1487
+ }
1488
+
1489
+ var _mapCacheGet = mapCacheGet$1;
1490
+
1491
+ var getMapData$1 = _getMapData;
1492
+
1493
+ /**
1494
+ * Checks if a map value for `key` exists.
1495
+ *
1496
+ * @private
1497
+ * @name has
1498
+ * @memberOf MapCache
1499
+ * @param {string} key The key of the entry to check.
1500
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1501
+ */
1502
+ function mapCacheHas$1(key) {
1503
+ return getMapData$1(this, key).has(key);
1504
+ }
1505
+
1506
+ var _mapCacheHas = mapCacheHas$1;
1507
+
1508
+ var getMapData = _getMapData;
1509
+
1510
+ /**
1511
+ * Sets the map `key` to `value`.
1512
+ *
1513
+ * @private
1514
+ * @name set
1515
+ * @memberOf MapCache
1516
+ * @param {string} key The key of the value to set.
1517
+ * @param {*} value The value to set.
1518
+ * @returns {Object} Returns the map cache instance.
1519
+ */
1520
+ function mapCacheSet$1(key, value) {
1521
+ var data = getMapData(this, key),
1522
+ size = data.size;
1523
+
1524
+ data.set(key, value);
1525
+ this.size += data.size == size ? 0 : 1;
1526
+ return this;
1527
+ }
1528
+
1529
+ var _mapCacheSet = mapCacheSet$1;
1530
+
1531
+ var mapCacheClear = _mapCacheClear,
1532
+ mapCacheDelete = _mapCacheDelete,
1533
+ mapCacheGet = _mapCacheGet,
1534
+ mapCacheHas = _mapCacheHas,
1535
+ mapCacheSet = _mapCacheSet;
1536
+
1537
+ /**
1538
+ * Creates a map cache object to store key-value pairs.
1539
+ *
1540
+ * @private
1541
+ * @constructor
1542
+ * @param {Array} [entries] The key-value pairs to cache.
1543
+ */
1544
+ function MapCache$1(entries) {
1545
+ var index = -1,
1546
+ length = entries == null ? 0 : entries.length;
1547
+
1548
+ this.clear();
1549
+ while (++index < length) {
1550
+ var entry = entries[index];
1551
+ this.set(entry[0], entry[1]);
1552
+ }
1553
+ }
1554
+
1555
+ // Add methods to `MapCache`.
1556
+ MapCache$1.prototype.clear = mapCacheClear;
1557
+ MapCache$1.prototype['delete'] = mapCacheDelete;
1558
+ MapCache$1.prototype.get = mapCacheGet;
1559
+ MapCache$1.prototype.has = mapCacheHas;
1560
+ MapCache$1.prototype.set = mapCacheSet;
1561
+
1562
+ var _MapCache = MapCache$1;
1563
+
1564
+ var ListCache$1 = _ListCache,
1565
+ Map$1 = _Map,
1566
+ MapCache = _MapCache;
1567
+
1568
+ /** Used as the size to enable large array optimizations. */
1569
+ var LARGE_ARRAY_SIZE = 200;
1570
+
1571
+ /**
1572
+ * Sets the stack `key` to `value`.
1573
+ *
1574
+ * @private
1575
+ * @name set
1576
+ * @memberOf Stack
1577
+ * @param {string} key The key of the value to set.
1578
+ * @param {*} value The value to set.
1579
+ * @returns {Object} Returns the stack cache instance.
1580
+ */
1581
+ function stackSet$1(key, value) {
1582
+ var data = this.__data__;
1583
+ if (data instanceof ListCache$1) {
1584
+ var pairs = data.__data__;
1585
+ if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1586
+ pairs.push([key, value]);
1587
+ this.size = ++data.size;
1588
+ return this;
1589
+ }
1590
+ data = this.__data__ = new MapCache(pairs);
1591
+ }
1592
+ data.set(key, value);
1593
+ this.size = data.size;
1594
+ return this;
1595
+ }
1596
+
1597
+ var _stackSet = stackSet$1;
1598
+
1599
+ var ListCache = _ListCache,
1600
+ stackClear = _stackClear,
1601
+ stackDelete = _stackDelete,
1602
+ stackGet = _stackGet,
1603
+ stackHas = _stackHas,
1604
+ stackSet = _stackSet;
1605
+
1606
+ /**
1607
+ * Creates a stack cache object to store key-value pairs.
1608
+ *
1609
+ * @private
1610
+ * @constructor
1611
+ * @param {Array} [entries] The key-value pairs to cache.
1612
+ */
1613
+ function Stack$1(entries) {
1614
+ var data = this.__data__ = new ListCache(entries);
1615
+ this.size = data.size;
1616
+ }
1617
+
1618
+ // Add methods to `Stack`.
1619
+ Stack$1.prototype.clear = stackClear;
1620
+ Stack$1.prototype['delete'] = stackDelete;
1621
+ Stack$1.prototype.get = stackGet;
1622
+ Stack$1.prototype.has = stackHas;
1623
+ Stack$1.prototype.set = stackSet;
1624
+
1625
+ var _Stack = Stack$1;
1626
+
1627
+ /**
1628
+ * A specialized version of `_.forEach` for arrays without support for
1629
+ * iteratee shorthands.
1630
+ *
1631
+ * @private
1632
+ * @param {Array} [array] The array to iterate over.
1633
+ * @param {Function} iteratee The function invoked per iteration.
1634
+ * @returns {Array} Returns `array`.
1635
+ */
1636
+
1637
+ function arrayEach$1(array, iteratee) {
1638
+ var index = -1,
1639
+ length = array == null ? 0 : array.length;
1640
+
1641
+ while (++index < length) {
1642
+ if (iteratee(array[index], index, array) === false) {
1643
+ break;
1644
+ }
1645
+ }
1646
+ return array;
1647
+ }
1648
+
1649
+ var _arrayEach = arrayEach$1;
1650
+
1651
+ var getNative$4 = _getNative;
1652
+
1653
+ var defineProperty$1 = (function() {
1654
+ try {
1655
+ var func = getNative$4(Object, 'defineProperty');
1656
+ func({}, '', {});
1657
+ return func;
1658
+ } catch (e) {}
1659
+ }());
1660
+
1661
+ var _defineProperty = defineProperty$1;
1662
+
1663
+ var defineProperty = _defineProperty;
1664
+
1665
+ /**
1666
+ * The base implementation of `assignValue` and `assignMergeValue` without
1667
+ * value checks.
1668
+ *
1669
+ * @private
1670
+ * @param {Object} object The object to modify.
1671
+ * @param {string} key The key of the property to assign.
1672
+ * @param {*} value The value to assign.
1673
+ */
1674
+ function baseAssignValue$2(object, key, value) {
1675
+ if (key == '__proto__' && defineProperty) {
1676
+ defineProperty(object, key, {
1677
+ 'configurable': true,
1678
+ 'enumerable': true,
1679
+ 'value': value,
1680
+ 'writable': true
1681
+ });
1682
+ } else {
1683
+ object[key] = value;
1684
+ }
1685
+ }
1686
+
1687
+ var _baseAssignValue = baseAssignValue$2;
1688
+
1689
+ var baseAssignValue$1 = _baseAssignValue,
1690
+ eq = eq_1;
1691
+
1692
+ /** Used for built-in method references. */
1693
+ var objectProto$7 = Object.prototype;
1694
+
1695
+ /** Used to check objects for own properties. */
1696
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1697
+
1698
+ /**
1699
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
1700
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1701
+ * for equality comparisons.
1702
+ *
1703
+ * @private
1704
+ * @param {Object} object The object to modify.
1705
+ * @param {string} key The key of the property to assign.
1706
+ * @param {*} value The value to assign.
1707
+ */
1708
+ function assignValue$2(object, key, value) {
1709
+ var objValue = object[key];
1710
+ if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
1711
+ (value === undefined && !(key in object))) {
1712
+ baseAssignValue$1(object, key, value);
1713
+ }
1714
+ }
1715
+
1716
+ var _assignValue = assignValue$2;
1717
+
1718
+ var assignValue$1 = _assignValue,
1719
+ baseAssignValue = _baseAssignValue;
1720
+
1721
+ /**
1722
+ * Copies properties of `source` to `object`.
1723
+ *
1724
+ * @private
1725
+ * @param {Object} source The object to copy properties from.
1726
+ * @param {Array} props The property identifiers to copy.
1727
+ * @param {Object} [object={}] The object to copy properties to.
1728
+ * @param {Function} [customizer] The function to customize copied values.
1729
+ * @returns {Object} Returns `object`.
1730
+ */
1731
+ function copyObject$4(source, props, object, customizer) {
1732
+ var isNew = !object;
1733
+ object || (object = {});
1734
+
1735
+ var index = -1,
1736
+ length = props.length;
1737
+
1738
+ while (++index < length) {
1739
+ var key = props[index];
1740
+
1741
+ var newValue = customizer
1742
+ ? customizer(object[key], source[key], key, object, source)
1743
+ : undefined;
1744
+
1745
+ if (newValue === undefined) {
1746
+ newValue = source[key];
1747
+ }
1748
+ if (isNew) {
1749
+ baseAssignValue(object, key, newValue);
1750
+ } else {
1751
+ assignValue$1(object, key, newValue);
1752
+ }
1753
+ }
1754
+ return object;
1755
+ }
1756
+
1757
+ var _copyObject = copyObject$4;
1758
+
1759
+ /**
1760
+ * The base implementation of `_.times` without support for iteratee shorthands
1761
+ * or max array length checks.
1762
+ *
1763
+ * @private
1764
+ * @param {number} n The number of times to invoke `iteratee`.
1765
+ * @param {Function} iteratee The function invoked per iteration.
1766
+ * @returns {Array} Returns the array of results.
1767
+ */
1768
+
1769
+ function baseTimes$1(n, iteratee) {
1770
+ var index = -1,
1771
+ result = Array(n);
1772
+
1773
+ while (++index < n) {
1774
+ result[index] = iteratee(index);
1775
+ }
1776
+ return result;
1777
+ }
1778
+
1779
+ var _baseTimes = baseTimes$1;
1780
+
1781
+ /**
1782
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1783
+ * and has a `typeof` result of "object".
1784
+ *
1785
+ * @static
1786
+ * @memberOf _
1787
+ * @since 4.0.0
1788
+ * @category Lang
1789
+ * @param {*} value The value to check.
1790
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1791
+ * @example
1792
+ *
1793
+ * _.isObjectLike({});
1794
+ * // => true
1795
+ *
1796
+ * _.isObjectLike([1, 2, 3]);
1797
+ * // => true
1798
+ *
1799
+ * _.isObjectLike(_.noop);
1800
+ * // => false
1801
+ *
1802
+ * _.isObjectLike(null);
1803
+ * // => false
1804
+ */
1805
+
1806
+ function isObjectLike$5(value) {
1807
+ return value != null && typeof value == 'object';
1808
+ }
1809
+
1810
+ var isObjectLike_1 = isObjectLike$5;
1811
+
1812
+ var baseGetTag$2 = _baseGetTag,
1813
+ isObjectLike$4 = isObjectLike_1;
1814
+
1815
+ /** `Object#toString` result references. */
1816
+ var argsTag$2 = '[object Arguments]';
1817
+
1818
+ /**
1819
+ * The base implementation of `_.isArguments`.
1820
+ *
1821
+ * @private
1822
+ * @param {*} value The value to check.
1823
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1824
+ */
1825
+ function baseIsArguments$1(value) {
1826
+ return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
1827
+ }
1828
+
1829
+ var _baseIsArguments = baseIsArguments$1;
1830
+
1831
+ var baseIsArguments = _baseIsArguments,
1832
+ isObjectLike$3 = isObjectLike_1;
1833
+
1834
+ /** Used for built-in method references. */
1835
+ var objectProto$6 = Object.prototype;
1836
+
1837
+ /** Used to check objects for own properties. */
1838
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
1839
+
1840
+ /** Built-in value references. */
1841
+ var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1842
+
1843
+ /**
1844
+ * Checks if `value` is likely an `arguments` object.
1845
+ *
1846
+ * @static
1847
+ * @memberOf _
1848
+ * @since 0.1.0
1849
+ * @category Lang
1850
+ * @param {*} value The value to check.
1851
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1852
+ * else `false`.
1853
+ * @example
1854
+ *
1855
+ * _.isArguments(function() { return arguments; }());
1856
+ * // => true
1857
+ *
1858
+ * _.isArguments([1, 2, 3]);
1859
+ * // => false
1860
+ */
1861
+ var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1862
+ return isObjectLike$3(value) && hasOwnProperty$4.call(value, 'callee') &&
1863
+ !propertyIsEnumerable$1.call(value, 'callee');
1864
+ };
1865
+
1866
+ var isArguments_1 = isArguments$1;
1867
+
1868
+ /**
1869
+ * Checks if `value` is classified as an `Array` object.
1870
+ *
1871
+ * @static
1872
+ * @memberOf _
1873
+ * @since 0.1.0
1874
+ * @category Lang
1875
+ * @param {*} value The value to check.
1876
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1877
+ * @example
1878
+ *
1879
+ * _.isArray([1, 2, 3]);
1880
+ * // => true
1881
+ *
1882
+ * _.isArray(document.body.children);
1883
+ * // => false
1884
+ *
1885
+ * _.isArray('abc');
1886
+ * // => false
1887
+ *
1888
+ * _.isArray(_.noop);
1889
+ * // => false
1890
+ */
1891
+
1892
+ var isArray$3 = Array.isArray;
1893
+
1894
+ var isArray_1 = isArray$3;
1895
+
1896
+ var isBuffer$2 = {exports: {}};
1897
+
1898
+ /**
1899
+ * This method returns `false`.
1900
+ *
1901
+ * @static
1902
+ * @memberOf _
1903
+ * @since 4.13.0
1904
+ * @category Util
1905
+ * @returns {boolean} Returns `false`.
1906
+ * @example
1907
+ *
1908
+ * _.times(2, _.stubFalse);
1909
+ * // => [false, false]
1910
+ */
1911
+
1912
+ function stubFalse() {
1913
+ return false;
1914
+ }
1915
+
1916
+ var stubFalse_1 = stubFalse;
1917
+
1918
+ (function (module, exports) {
1919
+ var root = _root,
1920
+ stubFalse = stubFalse_1;
1921
+
1922
+ /** Detect free variable `exports`. */
1923
+ var freeExports = exports && !exports.nodeType && exports;
1924
+
1925
+ /** Detect free variable `module`. */
1926
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1927
+
1928
+ /** Detect the popular CommonJS extension `module.exports`. */
1929
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1930
+
1931
+ /** Built-in value references. */
1932
+ var Buffer = moduleExports ? root.Buffer : undefined;
1933
+
1934
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1935
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1936
+
1937
+ /**
1938
+ * Checks if `value` is a buffer.
1939
+ *
1940
+ * @static
1941
+ * @memberOf _
1942
+ * @since 4.3.0
1943
+ * @category Lang
1944
+ * @param {*} value The value to check.
1945
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1946
+ * @example
1947
+ *
1948
+ * _.isBuffer(new Buffer(2));
1949
+ * // => true
1950
+ *
1951
+ * _.isBuffer(new Uint8Array(2));
1952
+ * // => false
1953
+ */
1954
+ var isBuffer = nativeIsBuffer || stubFalse;
1955
+
1956
+ module.exports = isBuffer;
1957
+ }(isBuffer$2, isBuffer$2.exports));
1958
+
1959
+ /** Used as references for various `Number` constants. */
1960
+
1961
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1962
+
1963
+ /** Used to detect unsigned integer values. */
1964
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1965
+
1966
+ /**
1967
+ * Checks if `value` is a valid array-like index.
1968
+ *
1969
+ * @private
1970
+ * @param {*} value The value to check.
1971
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1972
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1973
+ */
1974
+ function isIndex$1(value, length) {
1975
+ var type = typeof value;
1976
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
1977
+
1978
+ return !!length &&
1979
+ (type == 'number' ||
1980
+ (type != 'symbol' && reIsUint.test(value))) &&
1981
+ (value > -1 && value % 1 == 0 && value < length);
1982
+ }
1983
+
1984
+ var _isIndex = isIndex$1;
1985
+
1986
+ /** Used as references for various `Number` constants. */
1987
+
1988
+ var MAX_SAFE_INTEGER = 9007199254740991;
1989
+
1990
+ /**
1991
+ * Checks if `value` is a valid array-like length.
1992
+ *
1993
+ * **Note:** This method is loosely based on
1994
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1995
+ *
1996
+ * @static
1997
+ * @memberOf _
1998
+ * @since 4.0.0
1999
+ * @category Lang
2000
+ * @param {*} value The value to check.
2001
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2002
+ * @example
2003
+ *
2004
+ * _.isLength(3);
2005
+ * // => true
2006
+ *
2007
+ * _.isLength(Number.MIN_VALUE);
2008
+ * // => false
2009
+ *
2010
+ * _.isLength(Infinity);
2011
+ * // => false
2012
+ *
2013
+ * _.isLength('3');
2014
+ * // => false
2015
+ */
2016
+ function isLength$2(value) {
2017
+ return typeof value == 'number' &&
2018
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2019
+ }
2020
+
2021
+ var isLength_1 = isLength$2;
2022
+
2023
+ var baseGetTag$1 = _baseGetTag,
2024
+ isLength$1 = isLength_1,
2025
+ isObjectLike$2 = isObjectLike_1;
2026
+
2027
+ /** `Object#toString` result references. */
2028
+ var argsTag$1 = '[object Arguments]',
2029
+ arrayTag$1 = '[object Array]',
2030
+ boolTag$2 = '[object Boolean]',
2031
+ dateTag$2 = '[object Date]',
2032
+ errorTag$1 = '[object Error]',
2033
+ funcTag$1 = '[object Function]',
2034
+ mapTag$4 = '[object Map]',
2035
+ numberTag$2 = '[object Number]',
2036
+ objectTag$2 = '[object Object]',
2037
+ regexpTag$2 = '[object RegExp]',
2038
+ setTag$4 = '[object Set]',
2039
+ stringTag$2 = '[object String]',
2040
+ weakMapTag$2 = '[object WeakMap]';
2041
+
2042
+ var arrayBufferTag$2 = '[object ArrayBuffer]',
2043
+ dataViewTag$3 = '[object DataView]',
2044
+ float32Tag$2 = '[object Float32Array]',
2045
+ float64Tag$2 = '[object Float64Array]',
2046
+ int8Tag$2 = '[object Int8Array]',
2047
+ int16Tag$2 = '[object Int16Array]',
2048
+ int32Tag$2 = '[object Int32Array]',
2049
+ uint8Tag$2 = '[object Uint8Array]',
2050
+ uint8ClampedTag$2 = '[object Uint8ClampedArray]',
2051
+ uint16Tag$2 = '[object Uint16Array]',
2052
+ uint32Tag$2 = '[object Uint32Array]';
2053
+
2054
+ /** Used to identify `toStringTag` values of typed arrays. */
2055
+ var typedArrayTags = {};
2056
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
2057
+ typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
2058
+ typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
2059
+ typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
2060
+ typedArrayTags[uint32Tag$2] = true;
2061
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
2062
+ typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
2063
+ typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
2064
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
2065
+ typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
2066
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] =
2067
+ typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
2068
+ typedArrayTags[weakMapTag$2] = false;
2069
+
2070
+ /**
2071
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
2072
+ *
2073
+ * @private
2074
+ * @param {*} value The value to check.
2075
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2076
+ */
2077
+ function baseIsTypedArray$1(value) {
2078
+ return isObjectLike$2(value) &&
2079
+ isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
2080
+ }
2081
+
2082
+ var _baseIsTypedArray = baseIsTypedArray$1;
2083
+
2084
+ /**
2085
+ * The base implementation of `_.unary` without support for storing metadata.
2086
+ *
2087
+ * @private
2088
+ * @param {Function} func The function to cap arguments for.
2089
+ * @returns {Function} Returns the new capped function.
2090
+ */
2091
+
2092
+ function baseUnary$3(func) {
2093
+ return function(value) {
2094
+ return func(value);
2095
+ };
2096
+ }
2097
+
2098
+ var _baseUnary = baseUnary$3;
2099
+
2100
+ var _nodeUtil = {exports: {}};
2101
+
2102
+ (function (module, exports) {
2103
+ var freeGlobal = _freeGlobal;
2104
+
2105
+ /** Detect free variable `exports`. */
2106
+ var freeExports = exports && !exports.nodeType && exports;
2107
+
2108
+ /** Detect free variable `module`. */
2109
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2110
+
2111
+ /** Detect the popular CommonJS extension `module.exports`. */
2112
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2113
+
2114
+ /** Detect free variable `process` from Node.js. */
2115
+ var freeProcess = moduleExports && freeGlobal.process;
2116
+
2117
+ /** Used to access faster Node.js helpers. */
2118
+ var nodeUtil = (function() {
2119
+ try {
2120
+ // Use `util.types` for Node.js 10+.
2121
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
2122
+
2123
+ if (types) {
2124
+ return types;
2125
+ }
2126
+
2127
+ // Legacy `process.binding('util')` for Node.js < 10.
2128
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
2129
+ } catch (e) {}
2130
+ }());
2131
+
2132
+ module.exports = nodeUtil;
2133
+ }(_nodeUtil, _nodeUtil.exports));
2134
+
2135
+ var baseIsTypedArray = _baseIsTypedArray,
2136
+ baseUnary$2 = _baseUnary,
2137
+ nodeUtil$2 = _nodeUtil.exports;
2138
+
2139
+ /* Node.js helper references. */
2140
+ var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
2141
+
2142
+ /**
2143
+ * Checks if `value` is classified as a typed array.
2144
+ *
2145
+ * @static
2146
+ * @memberOf _
2147
+ * @since 3.0.0
2148
+ * @category Lang
2149
+ * @param {*} value The value to check.
2150
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2151
+ * @example
2152
+ *
2153
+ * _.isTypedArray(new Uint8Array);
2154
+ * // => true
2155
+ *
2156
+ * _.isTypedArray([]);
2157
+ * // => false
2158
+ */
2159
+ var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
2160
+
2161
+ var isTypedArray_1 = isTypedArray$1;
2162
+
2163
+ var baseTimes = _baseTimes,
2164
+ isArguments = isArguments_1,
2165
+ isArray$2 = isArray_1,
2166
+ isBuffer$1 = isBuffer$2.exports,
2167
+ isIndex = _isIndex,
2168
+ isTypedArray = isTypedArray_1;
2169
+
2170
+ /** Used for built-in method references. */
2171
+ var objectProto$5 = Object.prototype;
2172
+
2173
+ /** Used to check objects for own properties. */
2174
+ var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
2175
+
2176
+ /**
2177
+ * Creates an array of the enumerable property names of the array-like `value`.
2178
+ *
2179
+ * @private
2180
+ * @param {*} value The value to query.
2181
+ * @param {boolean} inherited Specify returning inherited property names.
2182
+ * @returns {Array} Returns the array of property names.
2183
+ */
2184
+ function arrayLikeKeys$2(value, inherited) {
2185
+ var isArr = isArray$2(value),
2186
+ isArg = !isArr && isArguments(value),
2187
+ isBuff = !isArr && !isArg && isBuffer$1(value),
2188
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2189
+ skipIndexes = isArr || isArg || isBuff || isType,
2190
+ result = skipIndexes ? baseTimes(value.length, String) : [],
2191
+ length = result.length;
2192
+
2193
+ for (var key in value) {
2194
+ if ((inherited || hasOwnProperty$3.call(value, key)) &&
2195
+ !(skipIndexes && (
2196
+ // Safari 9 has enumerable `arguments.length` in strict mode.
2197
+ key == 'length' ||
2198
+ // Node.js 0.10 has enumerable non-index properties on buffers.
2199
+ (isBuff && (key == 'offset' || key == 'parent')) ||
2200
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
2201
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2202
+ // Skip index properties.
2203
+ isIndex(key, length)
2204
+ ))) {
2205
+ result.push(key);
2206
+ }
2207
+ }
2208
+ return result;
2209
+ }
2210
+
2211
+ var _arrayLikeKeys = arrayLikeKeys$2;
2212
+
2213
+ /** Used for built-in method references. */
2214
+
2215
+ var objectProto$4 = Object.prototype;
2216
+
2217
+ /**
2218
+ * Checks if `value` is likely a prototype object.
2219
+ *
2220
+ * @private
2221
+ * @param {*} value The value to check.
2222
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
2223
+ */
2224
+ function isPrototype$3(value) {
2225
+ var Ctor = value && value.constructor,
2226
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
2227
+
2228
+ return value === proto;
2229
+ }
2230
+
2231
+ var _isPrototype = isPrototype$3;
2232
+
2233
+ /**
2234
+ * Creates a unary function that invokes `func` with its argument transformed.
2235
+ *
2236
+ * @private
2237
+ * @param {Function} func The function to wrap.
2238
+ * @param {Function} transform The argument transform.
2239
+ * @returns {Function} Returns the new function.
2240
+ */
2241
+
2242
+ function overArg$2(func, transform) {
2243
+ return function(arg) {
2244
+ return func(transform(arg));
2245
+ };
2246
+ }
2247
+
2248
+ var _overArg = overArg$2;
2249
+
2250
+ var overArg$1 = _overArg;
2251
+
2252
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2253
+ var nativeKeys$1 = overArg$1(Object.keys, Object);
2254
+
2255
+ var _nativeKeys = nativeKeys$1;
2256
+
2257
+ var isPrototype$2 = _isPrototype,
2258
+ nativeKeys = _nativeKeys;
2259
+
2260
+ /** Used for built-in method references. */
2261
+ var objectProto$3 = Object.prototype;
2262
+
2263
+ /** Used to check objects for own properties. */
2264
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2265
+
2266
+ /**
2267
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2268
+ *
2269
+ * @private
2270
+ * @param {Object} object The object to query.
2271
+ * @returns {Array} Returns the array of property names.
2272
+ */
2273
+ function baseKeys$1(object) {
2274
+ if (!isPrototype$2(object)) {
2275
+ return nativeKeys(object);
2276
+ }
2277
+ var result = [];
2278
+ for (var key in Object(object)) {
2279
+ if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
2280
+ result.push(key);
2281
+ }
2282
+ }
2283
+ return result;
2284
+ }
2285
+
2286
+ var _baseKeys = baseKeys$1;
2287
+
2288
+ var isFunction = isFunction_1,
2289
+ isLength = isLength_1;
2290
+
2291
+ /**
2292
+ * Checks if `value` is array-like. A value is considered array-like if it's
2293
+ * not a function and has a `value.length` that's an integer greater than or
2294
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2295
+ *
2296
+ * @static
2297
+ * @memberOf _
2298
+ * @since 4.0.0
2299
+ * @category Lang
2300
+ * @param {*} value The value to check.
2301
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2302
+ * @example
2303
+ *
2304
+ * _.isArrayLike([1, 2, 3]);
2305
+ * // => true
2306
+ *
2307
+ * _.isArrayLike(document.body.children);
2308
+ * // => true
2309
+ *
2310
+ * _.isArrayLike('abc');
2311
+ * // => true
2312
+ *
2313
+ * _.isArrayLike(_.noop);
2314
+ * // => false
2315
+ */
2316
+ function isArrayLike$2(value) {
2317
+ return value != null && isLength(value.length) && !isFunction(value);
2318
+ }
2319
+
2320
+ var isArrayLike_1 = isArrayLike$2;
2321
+
2322
+ var arrayLikeKeys$1 = _arrayLikeKeys,
2323
+ baseKeys = _baseKeys,
2324
+ isArrayLike$1 = isArrayLike_1;
2325
+
2326
+ /**
2327
+ * Creates an array of the own enumerable property names of `object`.
2328
+ *
2329
+ * **Note:** Non-object values are coerced to objects. See the
2330
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2331
+ * for more details.
2332
+ *
2333
+ * @static
2334
+ * @since 0.1.0
2335
+ * @memberOf _
2336
+ * @category Object
2337
+ * @param {Object} object The object to query.
2338
+ * @returns {Array} Returns the array of property names.
2339
+ * @example
2340
+ *
2341
+ * function Foo() {
2342
+ * this.a = 1;
2343
+ * this.b = 2;
2344
+ * }
2345
+ *
2346
+ * Foo.prototype.c = 3;
2347
+ *
2348
+ * _.keys(new Foo);
2349
+ * // => ['a', 'b'] (iteration order is not guaranteed)
2350
+ *
2351
+ * _.keys('hi');
2352
+ * // => ['0', '1']
2353
+ */
2354
+ function keys$3(object) {
2355
+ return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
2356
+ }
2357
+
2358
+ var keys_1 = keys$3;
2359
+
2360
+ var copyObject$3 = _copyObject,
2361
+ keys$2 = keys_1;
2362
+
2363
+ /**
2364
+ * The base implementation of `_.assign` without support for multiple sources
2365
+ * or `customizer` functions.
2366
+ *
2367
+ * @private
2368
+ * @param {Object} object The destination object.
2369
+ * @param {Object} source The source object.
2370
+ * @returns {Object} Returns `object`.
2371
+ */
2372
+ function baseAssign$1(object, source) {
2373
+ return object && copyObject$3(source, keys$2(source), object);
2374
+ }
2375
+
2376
+ var _baseAssign = baseAssign$1;
2377
+
2378
+ /**
2379
+ * This function is like
2380
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2381
+ * except that it includes inherited enumerable properties.
2382
+ *
2383
+ * @private
2384
+ * @param {Object} object The object to query.
2385
+ * @returns {Array} Returns the array of property names.
2386
+ */
2387
+
2388
+ function nativeKeysIn$1(object) {
2389
+ var result = [];
2390
+ if (object != null) {
2391
+ for (var key in Object(object)) {
2392
+ result.push(key);
2393
+ }
2394
+ }
2395
+ return result;
2396
+ }
2397
+
2398
+ var _nativeKeysIn = nativeKeysIn$1;
2399
+
2400
+ var isObject$2 = isObject_1,
2401
+ isPrototype$1 = _isPrototype,
2402
+ nativeKeysIn = _nativeKeysIn;
2403
+
2404
+ /** Used for built-in method references. */
2405
+ var objectProto$2 = Object.prototype;
2406
+
2407
+ /** Used to check objects for own properties. */
2408
+ var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
2409
+
2410
+ /**
2411
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
2412
+ *
2413
+ * @private
2414
+ * @param {Object} object The object to query.
2415
+ * @returns {Array} Returns the array of property names.
2416
+ */
2417
+ function baseKeysIn$1(object) {
2418
+ if (!isObject$2(object)) {
2419
+ return nativeKeysIn(object);
2420
+ }
2421
+ var isProto = isPrototype$1(object),
2422
+ result = [];
2423
+
2424
+ for (var key in object) {
2425
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) {
2426
+ result.push(key);
2427
+ }
2428
+ }
2429
+ return result;
2430
+ }
2431
+
2432
+ var _baseKeysIn = baseKeysIn$1;
2433
+
2434
+ var arrayLikeKeys = _arrayLikeKeys,
2435
+ baseKeysIn = _baseKeysIn,
2436
+ isArrayLike = isArrayLike_1;
2437
+
2438
+ /**
2439
+ * Creates an array of the own and inherited enumerable property names of `object`.
2440
+ *
2441
+ * **Note:** Non-object values are coerced to objects.
2442
+ *
2443
+ * @static
2444
+ * @memberOf _
2445
+ * @since 3.0.0
2446
+ * @category Object
2447
+ * @param {Object} object The object to query.
2448
+ * @returns {Array} Returns the array of property names.
2449
+ * @example
2450
+ *
2451
+ * function Foo() {
2452
+ * this.a = 1;
2453
+ * this.b = 2;
2454
+ * }
2455
+ *
2456
+ * Foo.prototype.c = 3;
2457
+ *
2458
+ * _.keysIn(new Foo);
2459
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
2460
+ */
2461
+ function keysIn$3(object) {
2462
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
2463
+ }
2464
+
2465
+ var keysIn_1 = keysIn$3;
2466
+
2467
+ var copyObject$2 = _copyObject,
2468
+ keysIn$2 = keysIn_1;
2469
+
2470
+ /**
2471
+ * The base implementation of `_.assignIn` without support for multiple sources
2472
+ * or `customizer` functions.
2473
+ *
2474
+ * @private
2475
+ * @param {Object} object The destination object.
2476
+ * @param {Object} source The source object.
2477
+ * @returns {Object} Returns `object`.
2478
+ */
2479
+ function baseAssignIn$1(object, source) {
2480
+ return object && copyObject$2(source, keysIn$2(source), object);
2481
+ }
2482
+
2483
+ var _baseAssignIn = baseAssignIn$1;
2484
+
2485
+ var _cloneBuffer = {exports: {}};
2486
+
2487
+ (function (module, exports) {
2488
+ var root = _root;
2489
+
2490
+ /** Detect free variable `exports`. */
2491
+ var freeExports = exports && !exports.nodeType && exports;
2492
+
2493
+ /** Detect free variable `module`. */
2494
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2495
+
2496
+ /** Detect the popular CommonJS extension `module.exports`. */
2497
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2498
+
2499
+ /** Built-in value references. */
2500
+ var Buffer = moduleExports ? root.Buffer : undefined,
2501
+ allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
2502
+
2503
+ /**
2504
+ * Creates a clone of `buffer`.
2505
+ *
2506
+ * @private
2507
+ * @param {Buffer} buffer The buffer to clone.
2508
+ * @param {boolean} [isDeep] Specify a deep clone.
2509
+ * @returns {Buffer} Returns the cloned buffer.
2510
+ */
2511
+ function cloneBuffer(buffer, isDeep) {
2512
+ if (isDeep) {
2513
+ return buffer.slice();
2514
+ }
2515
+ var length = buffer.length,
2516
+ result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2517
+
2518
+ buffer.copy(result);
2519
+ return result;
2520
+ }
2521
+
2522
+ module.exports = cloneBuffer;
2523
+ }(_cloneBuffer, _cloneBuffer.exports));
2524
+
2525
+ /**
2526
+ * Copies the values of `source` to `array`.
2527
+ *
2528
+ * @private
2529
+ * @param {Array} source The array to copy values from.
2530
+ * @param {Array} [array=[]] The array to copy values to.
2531
+ * @returns {Array} Returns `array`.
2532
+ */
2533
+
2534
+ function copyArray$1(source, array) {
2535
+ var index = -1,
2536
+ length = source.length;
2537
+
2538
+ array || (array = Array(length));
2539
+ while (++index < length) {
2540
+ array[index] = source[index];
2541
+ }
2542
+ return array;
2543
+ }
2544
+
2545
+ var _copyArray = copyArray$1;
2546
+
2547
+ /**
2548
+ * A specialized version of `_.filter` for arrays without support for
2549
+ * iteratee shorthands.
2550
+ *
2551
+ * @private
2552
+ * @param {Array} [array] The array to iterate over.
2553
+ * @param {Function} predicate The function invoked per iteration.
2554
+ * @returns {Array} Returns the new filtered array.
2555
+ */
2556
+
2557
+ function arrayFilter$1(array, predicate) {
2558
+ var index = -1,
2559
+ length = array == null ? 0 : array.length,
2560
+ resIndex = 0,
2561
+ result = [];
2562
+
2563
+ while (++index < length) {
2564
+ var value = array[index];
2565
+ if (predicate(value, index, array)) {
2566
+ result[resIndex++] = value;
2567
+ }
2568
+ }
2569
+ return result;
2570
+ }
2571
+
2572
+ var _arrayFilter = arrayFilter$1;
2573
+
2574
+ /**
2575
+ * This method returns a new empty array.
2576
+ *
2577
+ * @static
2578
+ * @memberOf _
2579
+ * @since 4.13.0
2580
+ * @category Util
2581
+ * @returns {Array} Returns the new empty array.
2582
+ * @example
2583
+ *
2584
+ * var arrays = _.times(2, _.stubArray);
2585
+ *
2586
+ * console.log(arrays);
2587
+ * // => [[], []]
2588
+ *
2589
+ * console.log(arrays[0] === arrays[1]);
2590
+ * // => false
2591
+ */
2592
+
2593
+ function stubArray$2() {
2594
+ return [];
2595
+ }
2596
+
2597
+ var stubArray_1 = stubArray$2;
2598
+
2599
+ var arrayFilter = _arrayFilter,
2600
+ stubArray$1 = stubArray_1;
2601
+
2602
+ /** Used for built-in method references. */
2603
+ var objectProto$1 = Object.prototype;
2604
+
2605
+ /** Built-in value references. */
2606
+ var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
2607
+
2608
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2609
+ var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2610
+
2611
+ /**
2612
+ * Creates an array of the own enumerable symbols of `object`.
2613
+ *
2614
+ * @private
2615
+ * @param {Object} object The object to query.
2616
+ * @returns {Array} Returns the array of symbols.
2617
+ */
2618
+ var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
2619
+ if (object == null) {
2620
+ return [];
2621
+ }
2622
+ object = Object(object);
2623
+ return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2624
+ return propertyIsEnumerable.call(object, symbol);
2625
+ });
2626
+ };
2627
+
2628
+ var _getSymbols = getSymbols$3;
2629
+
2630
+ var copyObject$1 = _copyObject,
2631
+ getSymbols$2 = _getSymbols;
2632
+
2633
+ /**
2634
+ * Copies own symbols of `source` to `object`.
2635
+ *
2636
+ * @private
2637
+ * @param {Object} source The object to copy symbols from.
2638
+ * @param {Object} [object={}] The object to copy symbols to.
2639
+ * @returns {Object} Returns `object`.
2640
+ */
2641
+ function copySymbols$1(source, object) {
2642
+ return copyObject$1(source, getSymbols$2(source), object);
2643
+ }
2644
+
2645
+ var _copySymbols = copySymbols$1;
2646
+
2647
+ /**
2648
+ * Appends the elements of `values` to `array`.
2649
+ *
2650
+ * @private
2651
+ * @param {Array} array The array to modify.
2652
+ * @param {Array} values The values to append.
2653
+ * @returns {Array} Returns `array`.
2654
+ */
2655
+
2656
+ function arrayPush$2(array, values) {
2657
+ var index = -1,
2658
+ length = values.length,
2659
+ offset = array.length;
2660
+
2661
+ while (++index < length) {
2662
+ array[offset + index] = values[index];
2663
+ }
2664
+ return array;
2665
+ }
2666
+
2667
+ var _arrayPush = arrayPush$2;
2668
+
2669
+ var overArg = _overArg;
2670
+
2671
+ /** Built-in value references. */
2672
+ var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
2673
+
2674
+ var _getPrototype = getPrototype$2;
2675
+
2676
+ var arrayPush$1 = _arrayPush,
2677
+ getPrototype$1 = _getPrototype,
2678
+ getSymbols$1 = _getSymbols,
2679
+ stubArray = stubArray_1;
2680
+
2681
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2682
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
2683
+
2684
+ /**
2685
+ * Creates an array of the own and inherited enumerable symbols of `object`.
2686
+ *
2687
+ * @private
2688
+ * @param {Object} object The object to query.
2689
+ * @returns {Array} Returns the array of symbols.
2690
+ */
2691
+ var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
2692
+ var result = [];
2693
+ while (object) {
2694
+ arrayPush$1(result, getSymbols$1(object));
2695
+ object = getPrototype$1(object);
2696
+ }
2697
+ return result;
2698
+ };
2699
+
2700
+ var _getSymbolsIn = getSymbolsIn$2;
2701
+
2702
+ var copyObject = _copyObject,
2703
+ getSymbolsIn$1 = _getSymbolsIn;
2704
+
2705
+ /**
2706
+ * Copies own and inherited symbols of `source` to `object`.
2707
+ *
2708
+ * @private
2709
+ * @param {Object} source The object to copy symbols from.
2710
+ * @param {Object} [object={}] The object to copy symbols to.
2711
+ * @returns {Object} Returns `object`.
2712
+ */
2713
+ function copySymbolsIn$1(source, object) {
2714
+ return copyObject(source, getSymbolsIn$1(source), object);
2715
+ }
2716
+
2717
+ var _copySymbolsIn = copySymbolsIn$1;
2718
+
2719
+ var arrayPush = _arrayPush,
2720
+ isArray$1 = isArray_1;
2721
+
2722
+ /**
2723
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2724
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2725
+ * symbols of `object`.
2726
+ *
2727
+ * @private
2728
+ * @param {Object} object The object to query.
2729
+ * @param {Function} keysFunc The function to get the keys of `object`.
2730
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
2731
+ * @returns {Array} Returns the array of property names and symbols.
2732
+ */
2733
+ function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
2734
+ var result = keysFunc(object);
2735
+ return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
2736
+ }
2737
+
2738
+ var _baseGetAllKeys = baseGetAllKeys$2;
2739
+
2740
+ var baseGetAllKeys$1 = _baseGetAllKeys,
2741
+ getSymbols = _getSymbols,
2742
+ keys$1 = keys_1;
2743
+
2744
+ /**
2745
+ * Creates an array of own enumerable property names and symbols of `object`.
2746
+ *
2747
+ * @private
2748
+ * @param {Object} object The object to query.
2749
+ * @returns {Array} Returns the array of property names and symbols.
2750
+ */
2751
+ function getAllKeys$1(object) {
2752
+ return baseGetAllKeys$1(object, keys$1, getSymbols);
2753
+ }
2754
+
2755
+ var _getAllKeys = getAllKeys$1;
2756
+
2757
+ var baseGetAllKeys = _baseGetAllKeys,
2758
+ getSymbolsIn = _getSymbolsIn,
2759
+ keysIn$1 = keysIn_1;
2760
+
2761
+ /**
2762
+ * Creates an array of own and inherited enumerable property names and
2763
+ * symbols of `object`.
2764
+ *
2765
+ * @private
2766
+ * @param {Object} object The object to query.
2767
+ * @returns {Array} Returns the array of property names and symbols.
2768
+ */
2769
+ function getAllKeysIn$1(object) {
2770
+ return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
2771
+ }
2772
+
2773
+ var _getAllKeysIn = getAllKeysIn$1;
2774
+
2775
+ var getNative$3 = _getNative,
2776
+ root$4 = _root;
2777
+
2778
+ /* Built-in method references that are verified to be native. */
2779
+ var DataView$1 = getNative$3(root$4, 'DataView');
2780
+
2781
+ var _DataView = DataView$1;
2782
+
2783
+ var getNative$2 = _getNative,
2784
+ root$3 = _root;
2785
+
2786
+ /* Built-in method references that are verified to be native. */
2787
+ var Promise$2 = getNative$2(root$3, 'Promise');
2788
+
2789
+ var _Promise = Promise$2;
2790
+
2791
+ var getNative$1 = _getNative,
2792
+ root$2 = _root;
2793
+
2794
+ /* Built-in method references that are verified to be native. */
2795
+ var Set$2 = getNative$1(root$2, 'Set');
2796
+
2797
+ var _Set = Set$2;
2798
+
2799
+ var getNative = _getNative,
2800
+ root$1 = _root;
2801
+
2802
+ /* Built-in method references that are verified to be native. */
2803
+ var WeakMap$1 = getNative(root$1, 'WeakMap');
2804
+
2805
+ var _WeakMap = WeakMap$1;
2806
+
2807
+ var DataView = _DataView,
2808
+ Map = _Map,
2809
+ Promise$1 = _Promise,
2810
+ Set$1 = _Set,
2811
+ WeakMap = _WeakMap,
2812
+ baseGetTag = _baseGetTag,
2813
+ toSource = _toSource;
2814
+
2815
+ /** `Object#toString` result references. */
2816
+ var mapTag$3 = '[object Map]',
2817
+ objectTag$1 = '[object Object]',
2818
+ promiseTag = '[object Promise]',
2819
+ setTag$3 = '[object Set]',
2820
+ weakMapTag$1 = '[object WeakMap]';
2821
+
2822
+ var dataViewTag$2 = '[object DataView]';
2823
+
2824
+ /** Used to detect maps, sets, and weakmaps. */
2825
+ var dataViewCtorString = toSource(DataView),
2826
+ mapCtorString = toSource(Map),
2827
+ promiseCtorString = toSource(Promise$1),
2828
+ setCtorString = toSource(Set$1),
2829
+ weakMapCtorString = toSource(WeakMap);
2830
+
2831
+ /**
2832
+ * Gets the `toStringTag` of `value`.
2833
+ *
2834
+ * @private
2835
+ * @param {*} value The value to query.
2836
+ * @returns {string} Returns the `toStringTag`.
2837
+ */
2838
+ var getTag$3 = baseGetTag;
2839
+
2840
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2841
+ if ((DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
2842
+ (Map && getTag$3(new Map) != mapTag$3) ||
2843
+ (Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag) ||
2844
+ (Set$1 && getTag$3(new Set$1) != setTag$3) ||
2845
+ (WeakMap && getTag$3(new WeakMap) != weakMapTag$1)) {
2846
+ getTag$3 = function(value) {
2847
+ var result = baseGetTag(value),
2848
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
2849
+ ctorString = Ctor ? toSource(Ctor) : '';
2850
+
2851
+ if (ctorString) {
2852
+ switch (ctorString) {
2853
+ case dataViewCtorString: return dataViewTag$2;
2854
+ case mapCtorString: return mapTag$3;
2855
+ case promiseCtorString: return promiseTag;
2856
+ case setCtorString: return setTag$3;
2857
+ case weakMapCtorString: return weakMapTag$1;
2858
+ }
2859
+ }
2860
+ return result;
2861
+ };
2862
+ }
2863
+
2864
+ var _getTag = getTag$3;
2865
+
2866
+ /** Used for built-in method references. */
2867
+
2868
+ var objectProto = Object.prototype;
2869
+
2870
+ /** Used to check objects for own properties. */
2871
+ var hasOwnProperty = objectProto.hasOwnProperty;
2872
+
2873
+ /**
2874
+ * Initializes an array clone.
2875
+ *
2876
+ * @private
2877
+ * @param {Array} array The array to clone.
2878
+ * @returns {Array} Returns the initialized clone.
2879
+ */
2880
+ function initCloneArray$1(array) {
2881
+ var length = array.length,
2882
+ result = new array.constructor(length);
2883
+
2884
+ // Add properties assigned by `RegExp#exec`.
2885
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
2886
+ result.index = array.index;
2887
+ result.input = array.input;
2888
+ }
2889
+ return result;
2890
+ }
2891
+
2892
+ var _initCloneArray = initCloneArray$1;
2893
+
2894
+ var root = _root;
2895
+
2896
+ /** Built-in value references. */
2897
+ var Uint8Array$1 = root.Uint8Array;
2898
+
2899
+ var _Uint8Array = Uint8Array$1;
2900
+
2901
+ var Uint8Array = _Uint8Array;
2902
+
2903
+ /**
2904
+ * Creates a clone of `arrayBuffer`.
2905
+ *
2906
+ * @private
2907
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2908
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
2909
+ */
2910
+ function cloneArrayBuffer$3(arrayBuffer) {
2911
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2912
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2913
+ return result;
2914
+ }
2915
+
2916
+ var _cloneArrayBuffer = cloneArrayBuffer$3;
2917
+
2918
+ var cloneArrayBuffer$2 = _cloneArrayBuffer;
2919
+
2920
+ /**
2921
+ * Creates a clone of `dataView`.
2922
+ *
2923
+ * @private
2924
+ * @param {Object} dataView The data view to clone.
2925
+ * @param {boolean} [isDeep] Specify a deep clone.
2926
+ * @returns {Object} Returns the cloned data view.
2927
+ */
2928
+ function cloneDataView$1(dataView, isDeep) {
2929
+ var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
2930
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2931
+ }
2932
+
2933
+ var _cloneDataView = cloneDataView$1;
2934
+
2935
+ /** Used to match `RegExp` flags from their coerced string values. */
2936
+
2937
+ var reFlags = /\w*$/;
2938
+
2939
+ /**
2940
+ * Creates a clone of `regexp`.
2941
+ *
2942
+ * @private
2943
+ * @param {Object} regexp The regexp to clone.
2944
+ * @returns {Object} Returns the cloned regexp.
2945
+ */
2946
+ function cloneRegExp$1(regexp) {
2947
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2948
+ result.lastIndex = regexp.lastIndex;
2949
+ return result;
2950
+ }
2951
+
2952
+ var _cloneRegExp = cloneRegExp$1;
2953
+
2954
+ var Symbol = _Symbol;
2955
+
2956
+ /** Used to convert symbols to primitives and strings. */
2957
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
2958
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2959
+
2960
+ /**
2961
+ * Creates a clone of the `symbol` object.
2962
+ *
2963
+ * @private
2964
+ * @param {Object} symbol The symbol object to clone.
2965
+ * @returns {Object} Returns the cloned symbol object.
2966
+ */
2967
+ function cloneSymbol$1(symbol) {
2968
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2969
+ }
2970
+
2971
+ var _cloneSymbol = cloneSymbol$1;
2972
+
2973
+ var cloneArrayBuffer$1 = _cloneArrayBuffer;
2974
+
2975
+ /**
2976
+ * Creates a clone of `typedArray`.
2977
+ *
2978
+ * @private
2979
+ * @param {Object} typedArray The typed array to clone.
2980
+ * @param {boolean} [isDeep] Specify a deep clone.
2981
+ * @returns {Object} Returns the cloned typed array.
2982
+ */
2983
+ function cloneTypedArray$1(typedArray, isDeep) {
2984
+ var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
2985
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2986
+ }
2987
+
2988
+ var _cloneTypedArray = cloneTypedArray$1;
2989
+
2990
+ var cloneArrayBuffer = _cloneArrayBuffer,
2991
+ cloneDataView = _cloneDataView,
2992
+ cloneRegExp = _cloneRegExp,
2993
+ cloneSymbol = _cloneSymbol,
2994
+ cloneTypedArray = _cloneTypedArray;
2995
+
2996
+ /** `Object#toString` result references. */
2997
+ var boolTag$1 = '[object Boolean]',
2998
+ dateTag$1 = '[object Date]',
2999
+ mapTag$2 = '[object Map]',
3000
+ numberTag$1 = '[object Number]',
3001
+ regexpTag$1 = '[object RegExp]',
3002
+ setTag$2 = '[object Set]',
3003
+ stringTag$1 = '[object String]',
3004
+ symbolTag$1 = '[object Symbol]';
3005
+
3006
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
3007
+ dataViewTag$1 = '[object DataView]',
3008
+ float32Tag$1 = '[object Float32Array]',
3009
+ float64Tag$1 = '[object Float64Array]',
3010
+ int8Tag$1 = '[object Int8Array]',
3011
+ int16Tag$1 = '[object Int16Array]',
3012
+ int32Tag$1 = '[object Int32Array]',
3013
+ uint8Tag$1 = '[object Uint8Array]',
3014
+ uint8ClampedTag$1 = '[object Uint8ClampedArray]',
3015
+ uint16Tag$1 = '[object Uint16Array]',
3016
+ uint32Tag$1 = '[object Uint32Array]';
3017
+
3018
+ /**
3019
+ * Initializes an object clone based on its `toStringTag`.
3020
+ *
3021
+ * **Note:** This function only supports cloning values with tags of
3022
+ * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
3023
+ *
3024
+ * @private
3025
+ * @param {Object} object The object to clone.
3026
+ * @param {string} tag The `toStringTag` of the object to clone.
3027
+ * @param {boolean} [isDeep] Specify a deep clone.
3028
+ * @returns {Object} Returns the initialized clone.
3029
+ */
3030
+ function initCloneByTag$1(object, tag, isDeep) {
3031
+ var Ctor = object.constructor;
3032
+ switch (tag) {
3033
+ case arrayBufferTag$1:
3034
+ return cloneArrayBuffer(object);
3035
+
3036
+ case boolTag$1:
3037
+ case dateTag$1:
3038
+ return new Ctor(+object);
3039
+
3040
+ case dataViewTag$1:
3041
+ return cloneDataView(object, isDeep);
3042
+
3043
+ case float32Tag$1: case float64Tag$1:
3044
+ case int8Tag$1: case int16Tag$1: case int32Tag$1:
3045
+ case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
3046
+ return cloneTypedArray(object, isDeep);
3047
+
3048
+ case mapTag$2:
3049
+ return new Ctor;
3050
+
3051
+ case numberTag$1:
3052
+ case stringTag$1:
3053
+ return new Ctor(object);
3054
+
3055
+ case regexpTag$1:
3056
+ return cloneRegExp(object);
3057
+
3058
+ case setTag$2:
3059
+ return new Ctor;
3060
+
3061
+ case symbolTag$1:
3062
+ return cloneSymbol(object);
3063
+ }
3064
+ }
3065
+
3066
+ var _initCloneByTag = initCloneByTag$1;
3067
+
3068
+ var isObject$1 = isObject_1;
3069
+
3070
+ /** Built-in value references. */
3071
+ var objectCreate = Object.create;
3072
+
3073
+ /**
3074
+ * The base implementation of `_.create` without support for assigning
3075
+ * properties to the created object.
3076
+ *
3077
+ * @private
3078
+ * @param {Object} proto The object to inherit from.
3079
+ * @returns {Object} Returns the new object.
3080
+ */
3081
+ var baseCreate$1 = (function() {
3082
+ function object() {}
3083
+ return function(proto) {
3084
+ if (!isObject$1(proto)) {
3085
+ return {};
3086
+ }
3087
+ if (objectCreate) {
3088
+ return objectCreate(proto);
3089
+ }
3090
+ object.prototype = proto;
3091
+ var result = new object;
3092
+ object.prototype = undefined;
3093
+ return result;
3094
+ };
3095
+ }());
3096
+
3097
+ var _baseCreate = baseCreate$1;
3098
+
3099
+ var baseCreate = _baseCreate,
3100
+ getPrototype = _getPrototype,
3101
+ isPrototype = _isPrototype;
3102
+
3103
+ /**
3104
+ * Initializes an object clone.
3105
+ *
3106
+ * @private
3107
+ * @param {Object} object The object to clone.
3108
+ * @returns {Object} Returns the initialized clone.
3109
+ */
3110
+ function initCloneObject$1(object) {
3111
+ return (typeof object.constructor == 'function' && !isPrototype(object))
3112
+ ? baseCreate(getPrototype(object))
3113
+ : {};
3114
+ }
3115
+
3116
+ var _initCloneObject = initCloneObject$1;
3117
+
3118
+ var getTag$2 = _getTag,
3119
+ isObjectLike$1 = isObjectLike_1;
3120
+
3121
+ /** `Object#toString` result references. */
3122
+ var mapTag$1 = '[object Map]';
3123
+
3124
+ /**
3125
+ * The base implementation of `_.isMap` without Node.js optimizations.
3126
+ *
3127
+ * @private
3128
+ * @param {*} value The value to check.
3129
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3130
+ */
3131
+ function baseIsMap$1(value) {
3132
+ return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
3133
+ }
3134
+
3135
+ var _baseIsMap = baseIsMap$1;
3136
+
3137
+ var baseIsMap = _baseIsMap,
3138
+ baseUnary$1 = _baseUnary,
3139
+ nodeUtil$1 = _nodeUtil.exports;
3140
+
3141
+ /* Node.js helper references. */
3142
+ var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
3143
+
3144
+ /**
3145
+ * Checks if `value` is classified as a `Map` object.
3146
+ *
3147
+ * @static
3148
+ * @memberOf _
3149
+ * @since 4.3.0
3150
+ * @category Lang
3151
+ * @param {*} value The value to check.
3152
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3153
+ * @example
3154
+ *
3155
+ * _.isMap(new Map);
3156
+ * // => true
3157
+ *
3158
+ * _.isMap(new WeakMap);
3159
+ * // => false
3160
+ */
3161
+ var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
3162
+
3163
+ var isMap_1 = isMap$1;
3164
+
3165
+ var getTag$1 = _getTag,
3166
+ isObjectLike = isObjectLike_1;
3167
+
3168
+ /** `Object#toString` result references. */
3169
+ var setTag$1 = '[object Set]';
3170
+
3171
+ /**
3172
+ * The base implementation of `_.isSet` without Node.js optimizations.
3173
+ *
3174
+ * @private
3175
+ * @param {*} value The value to check.
3176
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3177
+ */
3178
+ function baseIsSet$1(value) {
3179
+ return isObjectLike(value) && getTag$1(value) == setTag$1;
3180
+ }
3181
+
3182
+ var _baseIsSet = baseIsSet$1;
3183
+
3184
+ var baseIsSet = _baseIsSet,
3185
+ baseUnary = _baseUnary,
3186
+ nodeUtil = _nodeUtil.exports;
3187
+
3188
+ /* Node.js helper references. */
3189
+ var nodeIsSet = nodeUtil && nodeUtil.isSet;
3190
+
3191
+ /**
3192
+ * Checks if `value` is classified as a `Set` object.
3193
+ *
3194
+ * @static
3195
+ * @memberOf _
3196
+ * @since 4.3.0
3197
+ * @category Lang
3198
+ * @param {*} value The value to check.
3199
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3200
+ * @example
3201
+ *
3202
+ * _.isSet(new Set);
3203
+ * // => true
3204
+ *
3205
+ * _.isSet(new WeakSet);
3206
+ * // => false
3207
+ */
3208
+ var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3209
+
3210
+ var isSet_1 = isSet$1;
3211
+
3212
+ var Stack = _Stack,
3213
+ arrayEach = _arrayEach,
3214
+ assignValue = _assignValue,
3215
+ baseAssign = _baseAssign,
3216
+ baseAssignIn = _baseAssignIn,
3217
+ cloneBuffer = _cloneBuffer.exports,
3218
+ copyArray = _copyArray,
3219
+ copySymbols = _copySymbols,
3220
+ copySymbolsIn = _copySymbolsIn,
3221
+ getAllKeys = _getAllKeys,
3222
+ getAllKeysIn = _getAllKeysIn,
3223
+ getTag = _getTag,
3224
+ initCloneArray = _initCloneArray,
3225
+ initCloneByTag = _initCloneByTag,
3226
+ initCloneObject = _initCloneObject,
3227
+ isArray = isArray_1,
3228
+ isBuffer = isBuffer$2.exports,
3229
+ isMap = isMap_1,
3230
+ isObject = isObject_1,
3231
+ isSet = isSet_1,
3232
+ keys = keys_1,
3233
+ keysIn = keysIn_1;
3234
+
3235
+ /** Used to compose bitmasks for cloning. */
3236
+ var CLONE_DEEP_FLAG$1 = 1,
3237
+ CLONE_FLAT_FLAG = 2,
3238
+ CLONE_SYMBOLS_FLAG$1 = 4;
3239
+
3240
+ /** `Object#toString` result references. */
3241
+ var argsTag = '[object Arguments]',
3242
+ arrayTag = '[object Array]',
3243
+ boolTag = '[object Boolean]',
3244
+ dateTag = '[object Date]',
3245
+ errorTag = '[object Error]',
3246
+ funcTag = '[object Function]',
3247
+ genTag = '[object GeneratorFunction]',
3248
+ mapTag = '[object Map]',
3249
+ numberTag = '[object Number]',
3250
+ objectTag = '[object Object]',
3251
+ regexpTag = '[object RegExp]',
3252
+ setTag = '[object Set]',
3253
+ stringTag = '[object String]',
3254
+ symbolTag = '[object Symbol]',
3255
+ weakMapTag = '[object WeakMap]';
3256
+
3257
+ var arrayBufferTag = '[object ArrayBuffer]',
3258
+ dataViewTag = '[object DataView]',
3259
+ float32Tag = '[object Float32Array]',
3260
+ float64Tag = '[object Float64Array]',
3261
+ int8Tag = '[object Int8Array]',
3262
+ int16Tag = '[object Int16Array]',
3263
+ int32Tag = '[object Int32Array]',
3264
+ uint8Tag = '[object Uint8Array]',
3265
+ uint8ClampedTag = '[object Uint8ClampedArray]',
3266
+ uint16Tag = '[object Uint16Array]',
3267
+ uint32Tag = '[object Uint32Array]';
3268
+
3269
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
3270
+ var cloneableTags = {};
3271
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
3272
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
3273
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
3274
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
3275
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
3276
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
3277
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
3278
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
3279
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
3280
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
3281
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
3282
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
3283
+ cloneableTags[weakMapTag] = false;
3284
+
3285
+ /**
3286
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
3287
+ * traversed objects.
3288
+ *
3289
+ * @private
3290
+ * @param {*} value The value to clone.
3291
+ * @param {boolean} bitmask The bitmask flags.
3292
+ * 1 - Deep clone
3293
+ * 2 - Flatten inherited properties
3294
+ * 4 - Clone symbols
3295
+ * @param {Function} [customizer] The function to customize cloning.
3296
+ * @param {string} [key] The key of `value`.
3297
+ * @param {Object} [object] The parent object of `value`.
3298
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
3299
+ * @returns {*} Returns the cloned value.
3300
+ */
3301
+ function baseClone$1(value, bitmask, customizer, key, object, stack) {
3302
+ var result,
3303
+ isDeep = bitmask & CLONE_DEEP_FLAG$1,
3304
+ isFlat = bitmask & CLONE_FLAT_FLAG,
3305
+ isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
3306
+
3307
+ if (customizer) {
3308
+ result = object ? customizer(value, key, object, stack) : customizer(value);
3309
+ }
3310
+ if (result !== undefined) {
3311
+ return result;
3312
+ }
3313
+ if (!isObject(value)) {
3314
+ return value;
3315
+ }
3316
+ var isArr = isArray(value);
3317
+ if (isArr) {
3318
+ result = initCloneArray(value);
3319
+ if (!isDeep) {
3320
+ return copyArray(value, result);
3321
+ }
3322
+ } else {
3323
+ var tag = getTag(value),
3324
+ isFunc = tag == funcTag || tag == genTag;
3325
+
3326
+ if (isBuffer(value)) {
3327
+ return cloneBuffer(value, isDeep);
3328
+ }
3329
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
3330
+ result = (isFlat || isFunc) ? {} : initCloneObject(value);
3331
+ if (!isDeep) {
3332
+ return isFlat
3333
+ ? copySymbolsIn(value, baseAssignIn(result, value))
3334
+ : copySymbols(value, baseAssign(result, value));
3335
+ }
3336
+ } else {
3337
+ if (!cloneableTags[tag]) {
3338
+ return object ? value : {};
3339
+ }
3340
+ result = initCloneByTag(value, tag, isDeep);
3341
+ }
3342
+ }
3343
+ // Check for circular references and return its corresponding clone.
3344
+ stack || (stack = new Stack);
3345
+ var stacked = stack.get(value);
3346
+ if (stacked) {
3347
+ return stacked;
3348
+ }
3349
+ stack.set(value, result);
3350
+
3351
+ if (isSet(value)) {
3352
+ value.forEach(function(subValue) {
3353
+ result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
3354
+ });
3355
+ } else if (isMap(value)) {
3356
+ value.forEach(function(subValue, key) {
3357
+ result.set(key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
3358
+ });
3359
+ }
3360
+
3361
+ var keysFunc = isFull
3362
+ ? (isFlat ? getAllKeysIn : getAllKeys)
3363
+ : (isFlat ? keysIn : keys);
3364
+
3365
+ var props = isArr ? undefined : keysFunc(value);
3366
+ arrayEach(props || value, function(subValue, key) {
3367
+ if (props) {
3368
+ key = subValue;
3369
+ subValue = value[key];
3370
+ }
3371
+ // Recursively populate clone (susceptible to call stack limits).
3372
+ assignValue(result, key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
3373
+ });
3374
+ return result;
3375
+ }
3376
+
3377
+ var _baseClone = baseClone$1;
3378
+
3379
+ var baseClone = _baseClone;
3380
+
3381
+ /** Used to compose bitmasks for cloning. */
3382
+ var CLONE_DEEP_FLAG = 1,
3383
+ CLONE_SYMBOLS_FLAG = 4;
3384
+
3385
+ /**
3386
+ * This method is like `_.clone` except that it recursively clones `value`.
3387
+ *
3388
+ * @static
3389
+ * @memberOf _
3390
+ * @since 1.0.0
3391
+ * @category Lang
3392
+ * @param {*} value The value to recursively clone.
3393
+ * @returns {*} Returns the deep cloned value.
3394
+ * @see _.clone
3395
+ * @example
3396
+ *
3397
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
3398
+ *
3399
+ * var deep = _.cloneDeep(objects);
3400
+ * console.log(deep[0] === objects[0]);
3401
+ * // => false
3402
+ */
3403
+ function cloneDeep(value) {
3404
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
3405
+ }
3406
+
3407
+ var cloneDeep_1 = cloneDeep;
3408
+
3409
+ /*!
3410
+ * cookie
3411
+ * Copyright(c) 2012-2014 Roman Shtylman
3412
+ * Copyright(c) 2015 Douglas Christopher Wilson
3413
+ * MIT Licensed
3414
+ */
3415
+
3416
+ /**
3417
+ * Module exports.
3418
+ * @public
3419
+ */
3420
+
3421
+ var parse_1 = parse;
3422
+ var serialize_1 = serialize;
3423
+
3424
+ /**
3425
+ * Module variables.
3426
+ * @private
3427
+ */
3428
+
3429
+ var decode = decodeURIComponent;
3430
+ var encode = encodeURIComponent;
3431
+
3432
+ /**
3433
+ * RegExp to match field-content in RFC 7230 sec 3.2
3434
+ *
3435
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
3436
+ * field-vchar = VCHAR / obs-text
3437
+ * obs-text = %x80-FF
3438
+ */
3439
+
3440
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3441
+
3442
+ /**
3443
+ * Parse a cookie header.
3444
+ *
3445
+ * Parse the given cookie header string into an object
3446
+ * The object has the various cookies as keys(names) => values
3447
+ *
3448
+ * @param {string} str
3449
+ * @param {object} [options]
3450
+ * @return {object}
3451
+ * @public
3452
+ */
3453
+
3454
+ function parse(str, options) {
3455
+ if (typeof str !== 'string') {
3456
+ throw new TypeError('argument str must be a string');
3457
+ }
3458
+
3459
+ var obj = {};
3460
+ var opt = options || {};
3461
+ var pairs = str.split(';');
3462
+ var dec = opt.decode || decode;
3463
+
3464
+ for (var i = 0; i < pairs.length; i++) {
3465
+ var pair = pairs[i];
3466
+ var index = pair.indexOf('=');
3467
+
3468
+ // skip things that don't look like key=value
3469
+ if (index < 0) {
3470
+ continue;
3471
+ }
3472
+
3473
+ var key = pair.substring(0, index).trim();
3474
+
3475
+ // only assign once
3476
+ if (undefined == obj[key]) {
3477
+ var val = pair.substring(index + 1, pair.length).trim();
3478
+
3479
+ // quoted values
3480
+ if (val[0] === '"') {
3481
+ val = val.slice(1, -1);
3482
+ }
3483
+
3484
+ obj[key] = tryDecode(val, dec);
3485
+ }
3486
+ }
3487
+
3488
+ return obj;
3489
+ }
3490
+
3491
+ /**
3492
+ * Serialize data into a cookie header.
3493
+ *
3494
+ * Serialize the a name value pair into a cookie string suitable for
3495
+ * http headers. An optional options object specified cookie parameters.
3496
+ *
3497
+ * serialize('foo', 'bar', { httpOnly: true })
3498
+ * => "foo=bar; httpOnly"
3499
+ *
3500
+ * @param {string} name
3501
+ * @param {string} val
3502
+ * @param {object} [options]
3503
+ * @return {string}
3504
+ * @public
3505
+ */
3506
+
3507
+ function serialize(name, val, options) {
3508
+ var opt = options || {};
3509
+ var enc = opt.encode || encode;
3510
+
3511
+ if (typeof enc !== 'function') {
3512
+ throw new TypeError('option encode is invalid');
3513
+ }
3514
+
3515
+ if (!fieldContentRegExp.test(name)) {
3516
+ throw new TypeError('argument name is invalid');
3517
+ }
3518
+
3519
+ var value = enc(val);
3520
+
3521
+ if (value && !fieldContentRegExp.test(value)) {
3522
+ throw new TypeError('argument val is invalid');
3523
+ }
3524
+
3525
+ var str = name + '=' + value;
3526
+
3527
+ if (null != opt.maxAge) {
3528
+ var maxAge = opt.maxAge - 0;
3529
+
3530
+ if (isNaN(maxAge) || !isFinite(maxAge)) {
3531
+ throw new TypeError('option maxAge is invalid')
3532
+ }
3533
+
3534
+ str += '; Max-Age=' + Math.floor(maxAge);
3535
+ }
3536
+
3537
+ if (opt.domain) {
3538
+ if (!fieldContentRegExp.test(opt.domain)) {
3539
+ throw new TypeError('option domain is invalid');
3540
+ }
3541
+
3542
+ str += '; Domain=' + opt.domain;
3543
+ }
3544
+
3545
+ if (opt.path) {
3546
+ if (!fieldContentRegExp.test(opt.path)) {
3547
+ throw new TypeError('option path is invalid');
3548
+ }
3549
+
3550
+ str += '; Path=' + opt.path;
3551
+ }
3552
+
3553
+ if (opt.expires) {
3554
+ if (typeof opt.expires.toUTCString !== 'function') {
3555
+ throw new TypeError('option expires is invalid');
3556
+ }
3557
+
3558
+ str += '; Expires=' + opt.expires.toUTCString();
3559
+ }
3560
+
3561
+ if (opt.httpOnly) {
3562
+ str += '; HttpOnly';
3563
+ }
3564
+
3565
+ if (opt.secure) {
3566
+ str += '; Secure';
3567
+ }
3568
+
3569
+ if (opt.sameSite) {
3570
+ var sameSite = typeof opt.sameSite === 'string'
3571
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
3572
+
3573
+ switch (sameSite) {
3574
+ case true:
3575
+ str += '; SameSite=Strict';
3576
+ break;
3577
+ case 'lax':
3578
+ str += '; SameSite=Lax';
3579
+ break;
3580
+ case 'strict':
3581
+ str += '; SameSite=Strict';
3582
+ break;
3583
+ case 'none':
3584
+ str += '; SameSite=None';
3585
+ break;
3586
+ default:
3587
+ throw new TypeError('option sameSite is invalid');
3588
+ }
3589
+ }
3590
+
3591
+ return str;
3592
+ }
3593
+
3594
+ /**
3595
+ * Try decoding a string using a decoding function.
3596
+ *
3597
+ * @param {string} str
3598
+ * @param {function} decode
3599
+ * @private
3600
+ */
3601
+
3602
+ function tryDecode(str, decode) {
3603
+ try {
3604
+ return decode(str);
3605
+ } catch (e) {
3606
+ return str;
3607
+ }
3608
+ }
3609
+
3610
+ function hasDocumentCookie() {
3611
+ // Can we get/set cookies on document.cookie?
3612
+ return typeof document === 'object' && typeof document.cookie === 'string';
3613
+ }
3614
+ function parseCookies(cookies, options) {
3615
+ if (typeof cookies === 'string') {
3616
+ return parse_1(cookies, options);
3617
+ }
3618
+ else if (typeof cookies === 'object' && cookies !== null) {
3619
+ return cookies;
3620
+ }
3621
+ else {
3622
+ return {};
3623
+ }
3624
+ }
3625
+ function isParsingCookie(value, doNotParse) {
3626
+ if (typeof doNotParse === 'undefined') {
3627
+ // We guess if the cookie start with { or [, it has been serialized
3628
+ doNotParse =
3629
+ !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
3630
+ }
3631
+ return !doNotParse;
3632
+ }
3633
+ function readCookie(value, options) {
3634
+ if (options === void 0) { options = {}; }
3635
+ var cleanValue = cleanupCookieValue(value);
3636
+ if (isParsingCookie(cleanValue, options.doNotParse)) {
3637
+ try {
3638
+ return JSON.parse(cleanValue);
3639
+ }
3640
+ catch (e) {
3641
+ // At least we tried
3642
+ }
3643
+ }
3644
+ // Ignore clean value if we failed the deserialization
3645
+ // It is not relevant anymore to trim those values
3646
+ return value;
3647
+ }
3648
+ function cleanupCookieValue(value) {
3649
+ // express prepend j: before serializing a cookie
3650
+ if (value && value[0] === 'j' && value[1] === ':') {
3651
+ return value.substr(2);
3652
+ }
3653
+ return value;
3654
+ }
3655
+
3656
+ var __assign = (undefined && undefined.__assign) || function () {
3657
+ __assign = Object.assign || function(t) {
3658
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
3659
+ s = arguments[i];
3660
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
3661
+ t[p] = s[p];
3662
+ }
3663
+ return t;
3664
+ };
3665
+ return __assign.apply(this, arguments);
3666
+ };
3667
+ var Cookies = /** @class */ (function () {
3668
+ function Cookies(cookies, options) {
3669
+ var _this = this;
3670
+ this.changeListeners = [];
3671
+ this.HAS_DOCUMENT_COOKIE = false;
3672
+ this.cookies = parseCookies(cookies, options);
3673
+ new Promise(function () {
3674
+ _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
3675
+ }).catch(function () { });
3676
+ }
3677
+ Cookies.prototype._updateBrowserValues = function (parseOptions) {
3678
+ if (!this.HAS_DOCUMENT_COOKIE) {
3679
+ return;
3680
+ }
3681
+ this.cookies = parse_1(document.cookie, parseOptions);
3682
+ };
3683
+ Cookies.prototype._emitChange = function (params) {
3684
+ for (var i = 0; i < this.changeListeners.length; ++i) {
3685
+ this.changeListeners[i](params);
3686
+ }
3687
+ };
3688
+ Cookies.prototype.get = function (name, options, parseOptions) {
3689
+ if (options === void 0) { options = {}; }
3690
+ this._updateBrowserValues(parseOptions);
3691
+ return readCookie(this.cookies[name], options);
3692
+ };
3693
+ Cookies.prototype.getAll = function (options, parseOptions) {
3694
+ if (options === void 0) { options = {}; }
3695
+ this._updateBrowserValues(parseOptions);
3696
+ var result = {};
3697
+ for (var name_1 in this.cookies) {
3698
+ result[name_1] = readCookie(this.cookies[name_1], options);
3699
+ }
3700
+ return result;
3701
+ };
3702
+ Cookies.prototype.set = function (name, value, options) {
3703
+ var _a;
3704
+ if (typeof value === 'object') {
3705
+ value = JSON.stringify(value);
3706
+ }
3707
+ this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
3708
+ if (this.HAS_DOCUMENT_COOKIE) {
3709
+ document.cookie = serialize_1(name, value, options);
3710
+ }
3711
+ this._emitChange({ name: name, value: value, options: options });
3712
+ };
3713
+ Cookies.prototype.remove = function (name, options) {
3714
+ var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
3715
+ this.cookies = __assign({}, this.cookies);
3716
+ delete this.cookies[name];
3717
+ if (this.HAS_DOCUMENT_COOKIE) {
3718
+ document.cookie = serialize_1(name, '', finalOptions);
3719
+ }
3720
+ this._emitChange({ name: name, value: undefined, options: options });
3721
+ };
3722
+ Cookies.prototype.addChangeListener = function (callback) {
3723
+ this.changeListeners.push(callback);
3724
+ };
3725
+ Cookies.prototype.removeChangeListener = function (callback) {
3726
+ var idx = this.changeListeners.indexOf(callback);
3727
+ if (idx >= 0) {
3728
+ this.changeListeners.splice(idx, 1);
3729
+ }
3730
+ };
3731
+ return Cookies;
3732
+ }());
3733
+ var Cookies$1 = Cookies;
3734
+
202
3735
  var stringifyAttributes = ((attributes = {}) => Object.entries(attributes).map(([key, value], idx) => `${idx !== 0 ? ' ' : ''}${key}${value ? `="${value}"` : ''}`).join(' '));
203
3736
 
204
3737
  /* eslint-disable no-console */
@@ -293,7 +3826,8 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
293
3826
  const modernScriptTags = loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.modern.getScriptTags({
294
3827
  type: 'module'
295
3828
  });
296
- return `${startupTag}${legacyScriptTags || ''}${modernScriptTags || ''}`;
3829
+ const scriptTags = `${startupTag}${legacyScriptTags || ''}${modernScriptTags || ''}`.replace(/"\/static\//g, `"/${staticRoutePath}/`);
3830
+ return scriptTags;
297
3831
  }
298
3832
 
299
3833
  return startupTag;
@@ -303,7 +3837,7 @@ const addStandardHeaders = (state, response, packagejson, groups) => {
303
3837
  if (state) {
304
3838
  try {
305
3839
  console.info('About to add headers');
306
- const routingSurrogateKeys = getImmutableOrJS(state, ['routing', 'surrogateKeys'], '');
3840
+ const routingSurrogateKeys = selectSurrogateKeys(state);
307
3841
  const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
308
3842
  response.header('surrogate-key', surrogateKeyHeader);
309
3843
  addVarnishAuthenticationHeaders(state, response, groups);
@@ -362,6 +3896,7 @@ const webApp = (app, ReactApp, config) => {
362
3896
  const {
363
3897
  url
364
3898
  } = request;
3899
+ const cookies = new Cookies$1(request.headers.cookie);
365
3900
 
366
3901
  const matchedStaticRoute = () => matchRoutes(routes.StaticRoutes, request.path);
367
3902
 
@@ -407,6 +3942,8 @@ const webApp = (app, ReactApp, config) => {
407
3942
  const loadableExtractor = loadableChunkExtractors();
408
3943
  const jsx = /*#__PURE__*/React.createElement(ChunkExtractorManager, {
409
3944
  extractor: loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.commonLoadableExtractor
3945
+ }, /*#__PURE__*/React.createElement(CookiesProvider, {
3946
+ cookies: cookies
410
3947
  }, /*#__PURE__*/React.createElement(Provider, {
411
3948
  store: store
412
3949
  }, /*#__PURE__*/React.createElement(StaticRouter, {
@@ -415,7 +3952,7 @@ const webApp = (app, ReactApp, config) => {
415
3952
  }, /*#__PURE__*/React.createElement(ReactApp, {
416
3953
  routes: routes,
417
3954
  withEvents: withEvents
418
- }))));
3955
+ })))));
419
3956
  const {
420
3957
  templateHTML,
421
3958
  templateHTMLFragment,
@@ -427,7 +3964,7 @@ const webApp = (app, ReactApp, config) => {
427
3964
  renderToString(jsx); // Dynamic page render has only the necessary bundles to start up the app
428
3965
  // and does not include any react-loadable code-split bundles
429
3966
 
430
- const bundleTags = getBundleTags(loadableExtractor, scripts);
3967
+ const bundleTags = getBundleTags(loadableExtractor, scripts, staticRoutePath);
431
3968
  const isDynamicHint = `<script ${attributes}>window.isDynamic = true;</script>`;
432
3969
  const responseHtmlDynamic = templateHTML.replace('{{TITLE}}', '').replace('{{SEO_CRITICAL_METADATA}}', '').replace('{{CRITICAL_CSS}}', '').replace('{{APP}}', '').replace('{{LOADABLE_CHUNKS}}', bundleTags).replace('{{REDUX_DATA}}', isDynamicHint); // Dynamic pages always return a 200 so we can run
433
3970
  // the app and serve up all errors inside the client
@@ -445,7 +3982,7 @@ const webApp = (app, ReactApp, config) => {
445
3982
  Helmet.rewind();
446
3983
  const htmlAttributes = helmet.htmlAttributes.toString();
447
3984
  let title = helmet.title.toString();
448
- const metadata = helmet.meta.toString();
3985
+ const metadata = helmet.meta.toString().concat(helmet.link.toString());
449
3986
 
450
3987
  if (context.url) {
451
3988
  return response.redirect(302, context.url);
@@ -455,8 +3992,17 @@ const webApp = (app, ReactApp, config) => {
455
3992
  const styleTags = sheet.getStyleTags(); // After running rootSaga there should be an additional react-loadable
456
3993
  // code-split bundles for any page components as well as core app bundles
457
3994
 
458
- const bundleTags = getBundleTags(loadableExtractor, scripts);
459
- let serialisedReduxData = serialize(reduxState);
3995
+ const bundleTags = getBundleTags(loadableExtractor, scripts, staticRoutePath);
3996
+ let serialisedReduxData = serialize$1(buildCleaner({
3997
+ isArray: identity,
3998
+ isBoolean: identity,
3999
+ isDate: identity,
4000
+ isFunction: noop,
4001
+ isNull: identity,
4002
+ isPlainObject: identity,
4003
+ isString: identity,
4004
+ isUndefined: noop
4005
+ })(cloneDeep_1(reduxState)));
460
4006
 
461
4007
  if (context.statusCode !== 404) {
462
4008
  // For a request that returns a redux state object as a response
@@ -550,8 +4096,6 @@ const start = (ReactApp, config, ServerFeatures) => {
550
4096
  staticAssets(app, config);
551
4097
  webApp(app, ReactApp, config);
552
4098
  app.on('ready', async () => {
553
- // Configure DNS to make life easier
554
- // await ConfigureLocalDNS();
555
4099
  const server = app.listen(3001, () => {
556
4100
  console.info(`HTTP server is listening @ port 3001`);
557
4101
  setTimeout(function () {
@@ -572,5 +4116,5 @@ var internalServer = {
572
4116
  start
573
4117
  };
574
4118
 
575
- export { internalServer as default };
4119
+ export { internalServer as default, makeLinkDepthApi as linkDepthApi };
576
4120
  //# sourceMappingURL=contensis-react-base.js.map