@zengenti/contensis-react-base 3.0.0-beta.8 → 3.0.0-beta.80

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