@nanoporetech-digital/components 5.2.1 → 5.3.1

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 (262) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/{_commonjsHelpers-9f2314fc.js → _commonjsHelpers-29614748.js} +1 -17
  3. package/dist/cjs/_commonjsHelpers-29614748.js.map +1 -0
  4. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js +922 -0
  5. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js.map +1 -0
  6. package/dist/cjs/component-store-21cb4901.js +328 -0
  7. package/dist/cjs/component-store-21cb4901.js.map +1 -0
  8. package/dist/cjs/events-db0a42ee.js +39 -0
  9. package/dist/cjs/events-db0a42ee.js.map +1 -0
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/nano-alert.cjs.entry.js +9 -2
  12. package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nano-algolia-filter.cjs.entry.js +1 -2
  14. package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-algolia-input.cjs.entry.js +8 -4
  16. package/dist/cjs/nano-algolia-input.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-algolia.cjs.entry.js +4 -4
  18. package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-components.cjs.js +1 -1
  20. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  21. package/dist/cjs/nano-dialog.cjs.entry.js +23 -22
  22. package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-drawer.cjs.entry.js +169 -111
  24. package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
  25. package/dist/cjs/nano-dropdown.cjs.entry.js +16 -2
  26. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  27. package/dist/cjs/nano-global-nav.cjs.entry.js +5 -6
  28. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nano-global-search-results.cjs.entry.js +2 -1
  30. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  31. package/dist/cjs/nano-slides.cjs.entry.js +1 -1
  32. package/dist/cjs/nano-sortable.cjs.entry.js +3 -15
  33. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nano-sticker.cjs.entry.js +16 -9
  35. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nano-tab-group.cjs.entry.js +1 -2
  37. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  38. package/dist/cjs/{nano-table-10a40ab3.js → nano-table-3bfe9c30.js} +9 -10
  39. package/dist/cjs/nano-table-3bfe9c30.js.map +1 -0
  40. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  41. package/dist/cjs/{slot-a448c1a7.js → slot-2dd6ed1d.js} +20 -15
  42. package/dist/cjs/slot-2dd6ed1d.js.map +1 -0
  43. package/dist/cjs/{table.worker-f04588c1.js → table.worker-b3818c42.js} +2 -2
  44. package/dist/cjs/table.worker-b3818c42.js.map +1 -0
  45. package/dist/collection/components/alert/alert.css +15 -0
  46. package/dist/collection/components/alert/alert.js +10 -2
  47. package/dist/collection/components/alert/alert.js.map +1 -1
  48. package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
  49. package/dist/collection/components/algolia/algolia.js +1 -1
  50. package/dist/collection/components/algolia/algolia.js.map +1 -1
  51. package/dist/collection/components/dialog/dialog.css +1 -17
  52. package/dist/collection/components/dialog/dialog.js +31 -20
  53. package/dist/collection/components/dialog/dialog.js.map +1 -1
  54. package/dist/collection/components/drawer/drawer.css +136 -67
  55. package/dist/collection/components/drawer/drawer.js +282 -154
  56. package/dist/collection/components/drawer/drawer.js.map +1 -1
  57. package/dist/collection/components/dropdown/dropdown.css +10 -0
  58. package/dist/collection/components/dropdown/dropdown.js +15 -1
  59. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  60. package/dist/collection/components/global-nav/global-nav.js +2 -2
  61. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  62. package/dist/collection/components/global-nav/style/global-nav.css +5 -1
  63. package/dist/collection/components/global-search-results/global-search-results.js +2 -1
  64. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  65. package/dist/collection/components/sticker/sticker.js +16 -9
  66. package/dist/collection/components/sticker/sticker.js.map +1 -1
  67. package/dist/collection/components/table/table.css +21 -12
  68. package/dist/collection/components/table/table.js +0 -1
  69. package/dist/collection/components/table/table.js.map +1 -1
  70. package/dist/collection/components/table/table.pin-service.js +6 -6
  71. package/dist/collection/components/table/table.pin-service.js.map +1 -1
  72. package/dist/collection/utils/events.js +17 -0
  73. package/dist/collection/utils/events.js.map +1 -1
  74. package/dist/collection/utils/slot.js +19 -14
  75. package/dist/collection/utils/slot.js.map +1 -1
  76. package/dist/collection/utils/store/get-set.js +6 -12
  77. package/dist/collection/utils/store/get-set.js.map +1 -1
  78. package/dist/components/_commonjsHelpers.js +1 -16
  79. package/dist/components/_commonjsHelpers.js.map +1 -1
  80. package/dist/components/algolia.js +2 -2
  81. package/dist/components/algolia.js.map +1 -1
  82. package/dist/components/algoliasearch-lite.esm.browser.js +920 -0
  83. package/dist/components/algoliasearch-lite.esm.browser.js.map +1 -0
  84. package/dist/components/component-store.js +68 -2001
  85. package/dist/components/component-store.js.map +1 -1
  86. package/dist/components/dropdown.js +16 -2
  87. package/dist/components/dropdown.js.map +1 -1
  88. package/dist/components/events.js +36 -0
  89. package/dist/components/events.js.map +1 -0
  90. package/dist/components/nano-alert.js +10 -2
  91. package/dist/components/nano-alert.js.map +1 -1
  92. package/dist/components/nano-algolia-input.js +6 -1
  93. package/dist/components/nano-algolia-input.js.map +1 -1
  94. package/dist/components/nano-dialog.js +21 -20
  95. package/dist/components/nano-dialog.js.map +1 -1
  96. package/dist/components/nano-drawer.js +205 -122
  97. package/dist/components/nano-drawer.js.map +1 -1
  98. package/dist/components/nano-global-nav.js +4 -4
  99. package/dist/components/nano-global-nav.js.map +1 -1
  100. package/dist/components/nano-global-search-results.js +2 -1
  101. package/dist/components/nano-global-search-results.js.map +1 -1
  102. package/dist/components/nano-sortable.js +1 -13
  103. package/dist/components/nano-sortable.js.map +1 -1
  104. package/dist/components/slot.js +19 -14
  105. package/dist/components/slot.js.map +1 -1
  106. package/dist/components/sticker.js +16 -9
  107. package/dist/components/sticker.js.map +1 -1
  108. package/dist/components/table.js +7 -8
  109. package/dist/components/table.js.map +1 -1
  110. package/dist/esm/{_commonjsHelpers-e401b2a2.js → _commonjsHelpers-04a0e019.js} +2 -17
  111. package/dist/esm/_commonjsHelpers-04a0e019.js.map +1 -0
  112. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js +920 -0
  113. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js.map +1 -0
  114. package/dist/esm/component-store-65d7e36a.js +326 -0
  115. package/dist/esm/component-store-65d7e36a.js.map +1 -0
  116. package/dist/esm/events-6a805b42.js +36 -0
  117. package/dist/esm/events-6a805b42.js.map +1 -0
  118. package/dist/esm/loader.js +1 -1
  119. package/dist/esm/nano-alert.entry.js +9 -2
  120. package/dist/esm/nano-alert.entry.js.map +1 -1
  121. package/dist/esm/nano-algolia-filter.entry.js +1 -2
  122. package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
  123. package/dist/esm/nano-algolia-input.entry.js +7 -3
  124. package/dist/esm/nano-algolia-input.entry.js.map +1 -1
  125. package/dist/esm/nano-algolia.entry.js +4 -4
  126. package/dist/esm/nano-algolia.entry.js.map +1 -1
  127. package/dist/esm/nano-components.js +1 -1
  128. package/dist/esm/nano-datalist_3.entry.js +1 -1
  129. package/dist/esm/nano-dialog.entry.js +23 -22
  130. package/dist/esm/nano-dialog.entry.js.map +1 -1
  131. package/dist/esm/nano-drawer.entry.js +171 -113
  132. package/dist/esm/nano-drawer.entry.js.map +1 -1
  133. package/dist/esm/nano-dropdown.entry.js +16 -2
  134. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  135. package/dist/esm/nano-global-nav.entry.js +5 -6
  136. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  137. package/dist/esm/nano-global-search-results.entry.js +2 -1
  138. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  139. package/dist/esm/nano-slides.entry.js +1 -1
  140. package/dist/esm/nano-sortable.entry.js +1 -13
  141. package/dist/esm/nano-sortable.entry.js.map +1 -1
  142. package/dist/esm/nano-sticker.entry.js +16 -9
  143. package/dist/esm/nano-sticker.entry.js.map +1 -1
  144. package/dist/esm/nano-tab-group.entry.js +1 -2
  145. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  146. package/dist/esm/{nano-table-2bbcaa8d.js → nano-table-7fb21169.js} +9 -10
  147. package/dist/esm/nano-table-7fb21169.js.map +1 -0
  148. package/dist/esm/nano-table.entry.js +1 -1
  149. package/dist/esm/{slot-a4f6e2af.js → slot-8126e238.js} +20 -15
  150. package/dist/esm/slot-8126e238.js.map +1 -0
  151. package/dist/esm/{table.worker-7324ad73.js → table.worker-a37fa949.js} +2 -2
  152. package/dist/esm/table.worker-a37fa949.js.map +1 -0
  153. package/dist/nano-components/nano-components.css +1 -1
  154. package/dist/nano-components/nano-components.esm.js +1 -1
  155. package/dist/nano-components/nano-components.esm.js.map +1 -1
  156. package/dist/nano-components/p-00a18187.js +5 -0
  157. package/dist/nano-components/p-00a18187.js.map +1 -0
  158. package/dist/nano-components/p-0301e8f7.entry.js +5 -0
  159. package/dist/nano-components/p-0301e8f7.entry.js.map +1 -0
  160. package/dist/nano-components/p-27422aa9.entry.js +5 -0
  161. package/dist/nano-components/{p-6920ad69.entry.js.map → p-27422aa9.entry.js.map} +1 -1
  162. package/dist/nano-components/{p-0697795a.entry.js → p-31c23d6e.entry.js} +2 -2
  163. package/dist/nano-components/p-31c23d6e.entry.js.map +1 -0
  164. package/dist/nano-components/{p-39aec880.entry.js → p-35d3072e.entry.js} +2 -2
  165. package/dist/nano-components/p-487de04d.entry.js.map +1 -1
  166. package/dist/nano-components/p-570d2e50.entry.js +5 -0
  167. package/dist/nano-components/p-570d2e50.entry.js.map +1 -0
  168. package/dist/nano-components/{p-3eb6d833.entry.js → p-5a4b3fa9.entry.js} +2 -2
  169. package/dist/nano-components/p-653ae985.js +5 -0
  170. package/dist/nano-components/p-653ae985.js.map +1 -0
  171. package/dist/nano-components/p-676a4744.entry.js +5 -0
  172. package/dist/nano-components/{p-d0eefd52.entry.js.map → p-676a4744.entry.js.map} +1 -1
  173. package/dist/nano-components/p-8fe51abf.js +5 -0
  174. package/dist/nano-components/{p-4884b65a.entry.js → p-90cd4f56.entry.js} +2 -2
  175. package/dist/nano-components/p-90cd4f56.entry.js.map +1 -0
  176. package/dist/nano-components/p-9bfdee71.js +5 -0
  177. package/dist/nano-components/p-9bfdee71.js.map +1 -0
  178. package/dist/nano-components/p-a8d6ca38.entry.js +5 -0
  179. package/dist/nano-components/p-a8d6ca38.entry.js.map +1 -0
  180. package/dist/nano-components/p-ace7743c.entry.js +5 -0
  181. package/dist/nano-components/p-ace7743c.entry.js.map +1 -0
  182. package/dist/nano-components/p-bdb5b6fc.entry.js +5 -0
  183. package/dist/nano-components/p-bdb5b6fc.entry.js.map +1 -0
  184. package/dist/nano-components/{p-52ae36ec.js → p-c579d9aa.js} +2 -2
  185. package/dist/nano-components/p-cad86fb8.js +5 -0
  186. package/dist/nano-components/p-cad86fb8.js.map +1 -0
  187. package/dist/nano-components/p-dc565459.js +5 -0
  188. package/dist/nano-components/p-dc565459.js.map +1 -0
  189. package/dist/nano-components/p-ede12d35.entry.js +5 -0
  190. package/dist/nano-components/p-ede12d35.entry.js.map +1 -0
  191. package/dist/nano-components/p-f504b1df.entry.js +7 -0
  192. package/dist/nano-components/p-f504b1df.entry.js.map +1 -0
  193. package/dist/nano-components/{p-db370094.entry.js → p-f7a4c62b.entry.js} +2 -2
  194. package/dist/themes/london-calling.css.map +1 -1
  195. package/dist/themes/nanopore.cn.css.map +1 -1
  196. package/dist/themes/nanopore.css.map +1 -1
  197. package/dist/types/components/alert/alert.d.ts +1 -0
  198. package/dist/types/components/algolia/algolia-interface.d.ts +1 -1
  199. package/dist/types/components/algolia/algolia.d.ts +1 -1
  200. package/dist/types/components/dialog/dialog.d.ts +15 -4
  201. package/dist/types/components/drawer/drawer.d.ts +69 -50
  202. package/dist/types/components/sticker/sticker.d.ts +4 -4
  203. package/dist/types/components.d.ts +50 -28
  204. package/dist/types/types/algolia.d.ts +4 -0
  205. package/dist/types/types/scss.vars.d.ts +4 -0
  206. package/dist/types/utils/events.d.ts +7 -0
  207. package/dist/types/utils/slot.d.ts +3 -3
  208. package/docs-json.json +268 -61
  209. package/docs-vscode.json +28 -11
  210. package/hydrate/index.js +1338 -2240
  211. package/package.json +4 -4
  212. package/dist/cjs/_commonjsHelpers-9f2314fc.js.map +0 -1
  213. package/dist/cjs/algoliasearch.umd-689c1560.js +0 -15
  214. package/dist/cjs/algoliasearch.umd-689c1560.js.map +0 -1
  215. package/dist/cjs/component-store-f1dc1276.js +0 -2261
  216. package/dist/cjs/component-store-f1dc1276.js.map +0 -1
  217. package/dist/cjs/nano-table-10a40ab3.js.map +0 -1
  218. package/dist/cjs/slot-a448c1a7.js.map +0 -1
  219. package/dist/cjs/table.worker-f04588c1.js.map +0 -1
  220. package/dist/components/algoliasearch.umd.js +0 -13
  221. package/dist/components/algoliasearch.umd.js.map +0 -1
  222. package/dist/esm/_commonjsHelpers-e401b2a2.js.map +0 -1
  223. package/dist/esm/algoliasearch.umd-4f7efa84.js +0 -13
  224. package/dist/esm/algoliasearch.umd-4f7efa84.js.map +0 -1
  225. package/dist/esm/component-store-c23ebc9c.js +0 -2259
  226. package/dist/esm/component-store-c23ebc9c.js.map +0 -1
  227. package/dist/esm/nano-table-2bbcaa8d.js.map +0 -1
  228. package/dist/esm/slot-a4f6e2af.js.map +0 -1
  229. package/dist/esm/table.worker-7324ad73.js.map +0 -1
  230. package/dist/nano-components/p-0697795a.entry.js.map +0 -1
  231. package/dist/nano-components/p-17b099cc.entry.js +0 -5
  232. package/dist/nano-components/p-17b099cc.entry.js.map +0 -1
  233. package/dist/nano-components/p-1a0b5bc3.js +0 -5
  234. package/dist/nano-components/p-1a0b5bc3.js.map +0 -1
  235. package/dist/nano-components/p-4884b65a.entry.js.map +0 -1
  236. package/dist/nano-components/p-58cf5446.js +0 -5
  237. package/dist/nano-components/p-58cf5446.js.map +0 -1
  238. package/dist/nano-components/p-6920ad69.entry.js +0 -5
  239. package/dist/nano-components/p-69a3e911.js +0 -5
  240. package/dist/nano-components/p-7baa9e14.entry.js +0 -5
  241. package/dist/nano-components/p-7baa9e14.entry.js.map +0 -1
  242. package/dist/nano-components/p-9b533dc3.js +0 -5
  243. package/dist/nano-components/p-9b533dc3.js.map +0 -1
  244. package/dist/nano-components/p-a362bd23.entry.js +0 -5
  245. package/dist/nano-components/p-a362bd23.entry.js.map +0 -1
  246. package/dist/nano-components/p-b04fd7ca.entry.js +0 -5
  247. package/dist/nano-components/p-b04fd7ca.entry.js.map +0 -1
  248. package/dist/nano-components/p-b72df1aa.entry.js +0 -5
  249. package/dist/nano-components/p-b72df1aa.entry.js.map +0 -1
  250. package/dist/nano-components/p-ce5efc3f.entry.js +0 -5
  251. package/dist/nano-components/p-ce5efc3f.entry.js.map +0 -1
  252. package/dist/nano-components/p-d0eefd52.entry.js +0 -5
  253. package/dist/nano-components/p-e2b2b015.entry.js +0 -5
  254. package/dist/nano-components/p-e2b2b015.entry.js.map +0 -1
  255. package/dist/nano-components/p-ed6adde2.js +0 -7
  256. package/dist/nano-components/p-ed6adde2.js.map +0 -1
  257. package/dist/types/dom.ie.d.ts +0 -3
  258. /package/dist/nano-components/{p-39aec880.entry.js.map → p-35d3072e.entry.js.map} +0 -0
  259. /package/dist/nano-components/{p-3eb6d833.entry.js.map → p-5a4b3fa9.entry.js.map} +0 -0
  260. /package/dist/nano-components/{p-52ae36ec.js.map → p-8fe51abf.js.map} +0 -0
  261. /package/dist/nano-components/{p-69a3e911.js.map → p-c579d9aa.js.map} +0 -0
  262. /package/dist/nano-components/{p-db370094.entry.js.map → p-f7a4c62b.entry.js.map} +0 -0
@@ -1,2259 +0,0 @@
1
- /*!
2
- * Web Components for Nanopore digital Web Apps
3
- */
4
- import { g as getElement } from './index-dad5627b.js';
5
- import { d as debounce } from './throttle-ac4fcefa.js';
6
- import { c as createCommonjsModule, g as getAugmentedNamespace } from './_commonjsHelpers-e401b2a2.js';
7
-
8
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
9
- var shams = function hasSymbols() {
10
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
11
- if (typeof Symbol.iterator === 'symbol') { return true; }
12
-
13
- var obj = {};
14
- var sym = Symbol('test');
15
- var symObj = Object(sym);
16
- if (typeof sym === 'string') { return false; }
17
-
18
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
19
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
20
-
21
- // temp disabled per https://github.com/ljharb/object.assign/issues/17
22
- // if (sym instanceof Symbol) { return false; }
23
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
24
- // if (!(symObj instanceof Symbol)) { return false; }
25
-
26
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
27
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
28
-
29
- var symVal = 42;
30
- obj[sym] = symVal;
31
- for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
32
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
33
-
34
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
35
-
36
- var syms = Object.getOwnPropertySymbols(obj);
37
- if (syms.length !== 1 || syms[0] !== sym) { return false; }
38
-
39
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
40
-
41
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
42
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
43
- if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
44
- }
45
-
46
- return true;
47
- };
48
-
49
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
50
-
51
-
52
- var hasSymbols$1 = function hasNativeSymbols() {
53
- if (typeof origSymbol !== 'function') { return false; }
54
- if (typeof Symbol !== 'function') { return false; }
55
- if (typeof origSymbol('foo') !== 'symbol') { return false; }
56
- if (typeof Symbol('bar') !== 'symbol') { return false; }
57
-
58
- return shams();
59
- };
60
-
61
- /* eslint no-invalid-this: 1 */
62
-
63
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
64
- var slice = Array.prototype.slice;
65
- var toStr$1 = Object.prototype.toString;
66
- var funcType = '[object Function]';
67
-
68
- var implementation = function bind(that) {
69
- var target = this;
70
- if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
71
- throw new TypeError(ERROR_MESSAGE + target);
72
- }
73
- var args = slice.call(arguments, 1);
74
-
75
- var bound;
76
- var binder = function () {
77
- if (this instanceof bound) {
78
- var result = target.apply(
79
- this,
80
- args.concat(slice.call(arguments))
81
- );
82
- if (Object(result) === result) {
83
- return result;
84
- }
85
- return this;
86
- } else {
87
- return target.apply(
88
- that,
89
- args.concat(slice.call(arguments))
90
- );
91
- }
92
- };
93
-
94
- var boundLength = Math.max(0, target.length - args.length);
95
- var boundArgs = [];
96
- for (var i = 0; i < boundLength; i++) {
97
- boundArgs.push('$' + i);
98
- }
99
-
100
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
101
-
102
- if (target.prototype) {
103
- var Empty = function Empty() {};
104
- Empty.prototype = target.prototype;
105
- bound.prototype = new Empty();
106
- Empty.prototype = null;
107
- }
108
-
109
- return bound;
110
- };
111
-
112
- var functionBind = Function.prototype.bind || implementation;
113
-
114
- var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
115
-
116
- var undefined$1;
117
-
118
- var $SyntaxError = SyntaxError;
119
- var $Function = Function;
120
- var $TypeError$1 = TypeError;
121
-
122
- // eslint-disable-next-line consistent-return
123
- var getEvalledConstructor = function (expressionSyntax) {
124
- try {
125
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
126
- } catch (e) {}
127
- };
128
-
129
- var $gOPD = Object.getOwnPropertyDescriptor;
130
-
131
- var throwTypeError = function () {
132
- throw new $TypeError$1();
133
- };
134
- var ThrowTypeError = $gOPD
135
- ? (function () {
136
- try {
137
- return throwTypeError;
138
- } catch (calleeThrows) {
139
- try {
140
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
141
- return $gOPD(arguments, 'callee').get;
142
- } catch (gOPDthrows) {
143
- return throwTypeError;
144
- }
145
- }
146
- }())
147
- : throwTypeError;
148
-
149
- var hasSymbols = hasSymbols$1();
150
-
151
- var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
152
-
153
- var needsEval = {};
154
-
155
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
156
-
157
- var INTRINSICS = {
158
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
159
- '%Array%': Array,
160
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
161
- '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
162
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
163
- '%AsyncFunction%': needsEval,
164
- '%AsyncGenerator%': needsEval,
165
- '%AsyncGeneratorFunction%': needsEval,
166
- '%AsyncIteratorPrototype%': needsEval,
167
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
168
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
169
- '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
170
- '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
171
- '%Boolean%': Boolean,
172
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
173
- '%Date%': Date,
174
- '%decodeURI%': decodeURI,
175
- '%decodeURIComponent%': decodeURIComponent,
176
- '%encodeURI%': encodeURI,
177
- '%encodeURIComponent%': encodeURIComponent,
178
- '%Error%': Error,
179
- '%eval%': eval, // eslint-disable-line no-eval
180
- '%EvalError%': EvalError,
181
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
182
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
183
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
184
- '%Function%': $Function,
185
- '%GeneratorFunction%': needsEval,
186
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
187
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
188
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
189
- '%isFinite%': isFinite,
190
- '%isNaN%': isNaN,
191
- '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
192
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
193
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
194
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
195
- '%Math%': Math,
196
- '%Number%': Number,
197
- '%Object%': Object,
198
- '%parseFloat%': parseFloat,
199
- '%parseInt%': parseInt,
200
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
201
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
202
- '%RangeError%': RangeError,
203
- '%ReferenceError%': ReferenceError,
204
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
205
- '%RegExp%': RegExp,
206
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
207
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
208
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
209
- '%String%': String,
210
- '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
211
- '%Symbol%': hasSymbols ? Symbol : undefined$1,
212
- '%SyntaxError%': $SyntaxError,
213
- '%ThrowTypeError%': ThrowTypeError,
214
- '%TypedArray%': TypedArray,
215
- '%TypeError%': $TypeError$1,
216
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
217
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
218
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
219
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
220
- '%URIError%': URIError,
221
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
222
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
223
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
224
- };
225
-
226
- var doEval = function doEval(name) {
227
- var value;
228
- if (name === '%AsyncFunction%') {
229
- value = getEvalledConstructor('async function () {}');
230
- } else if (name === '%GeneratorFunction%') {
231
- value = getEvalledConstructor('function* () {}');
232
- } else if (name === '%AsyncGeneratorFunction%') {
233
- value = getEvalledConstructor('async function* () {}');
234
- } else if (name === '%AsyncGenerator%') {
235
- var fn = doEval('%AsyncGeneratorFunction%');
236
- if (fn) {
237
- value = fn.prototype;
238
- }
239
- } else if (name === '%AsyncIteratorPrototype%') {
240
- var gen = doEval('%AsyncGenerator%');
241
- if (gen) {
242
- value = getProto(gen.prototype);
243
- }
244
- }
245
-
246
- INTRINSICS[name] = value;
247
-
248
- return value;
249
- };
250
-
251
- var LEGACY_ALIASES = {
252
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
253
- '%ArrayPrototype%': ['Array', 'prototype'],
254
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
255
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
256
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
257
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
258
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
259
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
260
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
261
- '%BooleanPrototype%': ['Boolean', 'prototype'],
262
- '%DataViewPrototype%': ['DataView', 'prototype'],
263
- '%DatePrototype%': ['Date', 'prototype'],
264
- '%ErrorPrototype%': ['Error', 'prototype'],
265
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
266
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
267
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
268
- '%FunctionPrototype%': ['Function', 'prototype'],
269
- '%Generator%': ['GeneratorFunction', 'prototype'],
270
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
271
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
272
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
273
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
274
- '%JSONParse%': ['JSON', 'parse'],
275
- '%JSONStringify%': ['JSON', 'stringify'],
276
- '%MapPrototype%': ['Map', 'prototype'],
277
- '%NumberPrototype%': ['Number', 'prototype'],
278
- '%ObjectPrototype%': ['Object', 'prototype'],
279
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
280
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
281
- '%PromisePrototype%': ['Promise', 'prototype'],
282
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
283
- '%Promise_all%': ['Promise', 'all'],
284
- '%Promise_reject%': ['Promise', 'reject'],
285
- '%Promise_resolve%': ['Promise', 'resolve'],
286
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
287
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
288
- '%RegExpPrototype%': ['RegExp', 'prototype'],
289
- '%SetPrototype%': ['Set', 'prototype'],
290
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
291
- '%StringPrototype%': ['String', 'prototype'],
292
- '%SymbolPrototype%': ['Symbol', 'prototype'],
293
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
294
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
295
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
296
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
297
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
298
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
299
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
300
- '%URIErrorPrototype%': ['URIError', 'prototype'],
301
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
302
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
303
- };
304
-
305
-
306
-
307
- var $concat$1 = functionBind.call(Function.call, Array.prototype.concat);
308
- var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
309
- var $replace$1 = functionBind.call(Function.call, String.prototype.replace);
310
- var $strSlice = functionBind.call(Function.call, String.prototype.slice);
311
- var $exec = functionBind.call(Function.call, RegExp.prototype.exec);
312
-
313
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
314
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
315
- var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
316
- var stringToPath = function stringToPath(string) {
317
- var first = $strSlice(string, 0, 1);
318
- var last = $strSlice(string, -1);
319
- if (first === '%' && last !== '%') {
320
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
321
- } else if (last === '%' && first !== '%') {
322
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
323
- }
324
- var result = [];
325
- $replace$1(string, rePropName, function (match, number, quote, subString) {
326
- result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
327
- });
328
- return result;
329
- };
330
- /* end adaptation */
331
-
332
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
333
- var intrinsicName = name;
334
- var alias;
335
- if (src(LEGACY_ALIASES, intrinsicName)) {
336
- alias = LEGACY_ALIASES[intrinsicName];
337
- intrinsicName = '%' + alias[0] + '%';
338
- }
339
-
340
- if (src(INTRINSICS, intrinsicName)) {
341
- var value = INTRINSICS[intrinsicName];
342
- if (value === needsEval) {
343
- value = doEval(intrinsicName);
344
- }
345
- if (typeof value === 'undefined' && !allowMissing) {
346
- throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
347
- }
348
-
349
- return {
350
- alias: alias,
351
- name: intrinsicName,
352
- value: value
353
- };
354
- }
355
-
356
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
357
- };
358
-
359
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
360
- if (typeof name !== 'string' || name.length === 0) {
361
- throw new $TypeError$1('intrinsic name must be a non-empty string');
362
- }
363
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
364
- throw new $TypeError$1('"allowMissing" argument must be a boolean');
365
- }
366
-
367
- if ($exec(/^%?[^%]*%?$/, name) === null) {
368
- throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
369
- }
370
- var parts = stringToPath(name);
371
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
372
-
373
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
374
- var intrinsicRealName = intrinsic.name;
375
- var value = intrinsic.value;
376
- var skipFurtherCaching = false;
377
-
378
- var alias = intrinsic.alias;
379
- if (alias) {
380
- intrinsicBaseName = alias[0];
381
- $spliceApply(parts, $concat$1([0, 1], alias));
382
- }
383
-
384
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
385
- var part = parts[i];
386
- var first = $strSlice(part, 0, 1);
387
- var last = $strSlice(part, -1);
388
- if (
389
- (
390
- (first === '"' || first === "'" || first === '`')
391
- || (last === '"' || last === "'" || last === '`')
392
- )
393
- && first !== last
394
- ) {
395
- throw new $SyntaxError('property names with quotes must have matching quotes');
396
- }
397
- if (part === 'constructor' || !isOwn) {
398
- skipFurtherCaching = true;
399
- }
400
-
401
- intrinsicBaseName += '.' + part;
402
- intrinsicRealName = '%' + intrinsicBaseName + '%';
403
-
404
- if (src(INTRINSICS, intrinsicRealName)) {
405
- value = INTRINSICS[intrinsicRealName];
406
- } else if (value != null) {
407
- if (!(part in value)) {
408
- if (!allowMissing) {
409
- throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
410
- }
411
- return void undefined$1;
412
- }
413
- if ($gOPD && (i + 1) >= parts.length) {
414
- var desc = $gOPD(value, part);
415
- isOwn = !!desc;
416
-
417
- // By convention, when a data property is converted to an accessor
418
- // property to emulate a data property that does not suffer from
419
- // the override mistake, that accessor's getter is marked with
420
- // an `originalValue` property. Here, when we detect this, we
421
- // uphold the illusion by pretending to see that original data
422
- // property, i.e., returning the value rather than the getter
423
- // itself.
424
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
425
- value = desc.get;
426
- } else {
427
- value = value[part];
428
- }
429
- } else {
430
- isOwn = src(value, part);
431
- value = value[part];
432
- }
433
-
434
- if (isOwn && !skipFurtherCaching) {
435
- INTRINSICS[intrinsicRealName] = value;
436
- }
437
- }
438
- }
439
- return value;
440
- };
441
-
442
- var callBind = createCommonjsModule(function (module) {
443
-
444
-
445
-
446
-
447
- var $apply = getIntrinsic('%Function.prototype.apply%');
448
- var $call = getIntrinsic('%Function.prototype.call%');
449
- var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
450
-
451
- var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
452
- var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
453
- var $max = getIntrinsic('%Math.max%');
454
-
455
- if ($defineProperty) {
456
- try {
457
- $defineProperty({}, 'a', { value: 1 });
458
- } catch (e) {
459
- // IE 8 has a broken defineProperty
460
- $defineProperty = null;
461
- }
462
- }
463
-
464
- module.exports = function callBind(originalFunction) {
465
- var func = $reflectApply(functionBind, $call, arguments);
466
- if ($gOPD && $defineProperty) {
467
- var desc = $gOPD(func, 'length');
468
- if (desc.configurable) {
469
- // original length, plus the receiver, minus any additional arguments (after the receiver)
470
- $defineProperty(
471
- func,
472
- 'length',
473
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
474
- );
475
- }
476
- }
477
- return func;
478
- };
479
-
480
- var applyBind = function applyBind() {
481
- return $reflectApply(functionBind, $apply, arguments);
482
- };
483
-
484
- if ($defineProperty) {
485
- $defineProperty(module.exports, 'apply', { value: applyBind });
486
- } else {
487
- module.exports.apply = applyBind;
488
- }
489
- });
490
-
491
- var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
492
-
493
- var callBound = function callBoundIntrinsic(name, allowMissing) {
494
- var intrinsic = getIntrinsic(name, !!allowMissing);
495
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
496
- return callBind(intrinsic);
497
- }
498
- return intrinsic;
499
- };
500
-
501
- const _nodeResolve_empty = {};
502
-
503
- const _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
504
- __proto__: null,
505
- 'default': _nodeResolve_empty
506
- });
507
-
508
- const utilInspect = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
509
-
510
- var hasMap = typeof Map === 'function' && Map.prototype;
511
- var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
512
- var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
513
- var mapForEach = hasMap && Map.prototype.forEach;
514
- var hasSet = typeof Set === 'function' && Set.prototype;
515
- var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
516
- var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
517
- var setForEach = hasSet && Set.prototype.forEach;
518
- var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
519
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
520
- var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
521
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
522
- var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
523
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
524
- var booleanValueOf = Boolean.prototype.valueOf;
525
- var objectToString = Object.prototype.toString;
526
- var functionToString = Function.prototype.toString;
527
- var $match = String.prototype.match;
528
- var $slice = String.prototype.slice;
529
- var $replace = String.prototype.replace;
530
- var $toUpperCase = String.prototype.toUpperCase;
531
- var $toLowerCase = String.prototype.toLowerCase;
532
- var $test = RegExp.prototype.test;
533
- var $concat = Array.prototype.concat;
534
- var $join = Array.prototype.join;
535
- var $arrSlice = Array.prototype.slice;
536
- var $floor = Math.floor;
537
- var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
538
- var gOPS = Object.getOwnPropertySymbols;
539
- var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
540
- var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
541
- // ie, `has-tostringtag/shams
542
- var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
543
- ? Symbol.toStringTag
544
- : null;
545
- var isEnumerable = Object.prototype.propertyIsEnumerable;
546
-
547
- var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
548
- [].__proto__ === Array.prototype // eslint-disable-line no-proto
549
- ? function (O) {
550
- return O.__proto__; // eslint-disable-line no-proto
551
- }
552
- : null
553
- );
554
-
555
- function addNumericSeparator(num, str) {
556
- if (
557
- num === Infinity
558
- || num === -Infinity
559
- || num !== num
560
- || (num && num > -1000 && num < 1000)
561
- || $test.call(/e/, str)
562
- ) {
563
- return str;
564
- }
565
- var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
566
- if (typeof num === 'number') {
567
- var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
568
- if (int !== num) {
569
- var intStr = String(int);
570
- var dec = $slice.call(str, intStr.length + 1);
571
- return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
572
- }
573
- }
574
- return $replace.call(str, sepRegex, '$&_');
575
- }
576
-
577
-
578
- var inspectCustom = utilInspect.custom;
579
- var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
580
-
581
- var objectInspect = function inspect_(obj, options, depth, seen) {
582
- var opts = options || {};
583
-
584
- if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
585
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
586
- }
587
- if (
588
- has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
589
- ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
590
- : opts.maxStringLength !== null
591
- )
592
- ) {
593
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
594
- }
595
- var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
596
- if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
597
- throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
598
- }
599
-
600
- if (
601
- has$3(opts, 'indent')
602
- && opts.indent !== null
603
- && opts.indent !== '\t'
604
- && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
605
- ) {
606
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
607
- }
608
- if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
609
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
610
- }
611
- var numericSeparator = opts.numericSeparator;
612
-
613
- if (typeof obj === 'undefined') {
614
- return 'undefined';
615
- }
616
- if (obj === null) {
617
- return 'null';
618
- }
619
- if (typeof obj === 'boolean') {
620
- return obj ? 'true' : 'false';
621
- }
622
-
623
- if (typeof obj === 'string') {
624
- return inspectString(obj, opts);
625
- }
626
- if (typeof obj === 'number') {
627
- if (obj === 0) {
628
- return Infinity / obj > 0 ? '0' : '-0';
629
- }
630
- var str = String(obj);
631
- return numericSeparator ? addNumericSeparator(obj, str) : str;
632
- }
633
- if (typeof obj === 'bigint') {
634
- var bigIntStr = String(obj) + 'n';
635
- return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
636
- }
637
-
638
- var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
639
- if (typeof depth === 'undefined') { depth = 0; }
640
- if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
641
- return isArray$3(obj) ? '[Array]' : '[Object]';
642
- }
643
-
644
- var indent = getIndent(opts, depth);
645
-
646
- if (typeof seen === 'undefined') {
647
- seen = [];
648
- } else if (indexOf(seen, obj) >= 0) {
649
- return '[Circular]';
650
- }
651
-
652
- function inspect(value, from, noIndent) {
653
- if (from) {
654
- seen = $arrSlice.call(seen);
655
- seen.push(from);
656
- }
657
- if (noIndent) {
658
- var newOpts = {
659
- depth: opts.depth
660
- };
661
- if (has$3(opts, 'quoteStyle')) {
662
- newOpts.quoteStyle = opts.quoteStyle;
663
- }
664
- return inspect_(value, newOpts, depth + 1, seen);
665
- }
666
- return inspect_(value, opts, depth + 1, seen);
667
- }
668
-
669
- if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
670
- var name = nameOf(obj);
671
- var keys = arrObjKeys(obj, inspect);
672
- return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
673
- }
674
- if (isSymbol(obj)) {
675
- var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
676
- return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
677
- }
678
- if (isElement(obj)) {
679
- var s = '<' + $toLowerCase.call(String(obj.nodeName));
680
- var attrs = obj.attributes || [];
681
- for (var i = 0; i < attrs.length; i++) {
682
- s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
683
- }
684
- s += '>';
685
- if (obj.childNodes && obj.childNodes.length) { s += '...'; }
686
- s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
687
- return s;
688
- }
689
- if (isArray$3(obj)) {
690
- if (obj.length === 0) { return '[]'; }
691
- var xs = arrObjKeys(obj, inspect);
692
- if (indent && !singleLineValues(xs)) {
693
- return '[' + indentedJoin(xs, indent) + ']';
694
- }
695
- return '[ ' + $join.call(xs, ', ') + ' ]';
696
- }
697
- if (isError(obj)) {
698
- var parts = arrObjKeys(obj, inspect);
699
- if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
700
- return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
701
- }
702
- if (parts.length === 0) { return '[' + String(obj) + ']'; }
703
- return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
704
- }
705
- if (typeof obj === 'object' && customInspect) {
706
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
707
- return utilInspect(obj, { depth: maxDepth - depth });
708
- } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
709
- return obj.inspect();
710
- }
711
- }
712
- if (isMap(obj)) {
713
- var mapParts = [];
714
- if (mapForEach) {
715
- mapForEach.call(obj, function (value, key) {
716
- mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
717
- });
718
- }
719
- return collectionOf('Map', mapSize.call(obj), mapParts, indent);
720
- }
721
- if (isSet(obj)) {
722
- var setParts = [];
723
- if (setForEach) {
724
- setForEach.call(obj, function (value) {
725
- setParts.push(inspect(value, obj));
726
- });
727
- }
728
- return collectionOf('Set', setSize.call(obj), setParts, indent);
729
- }
730
- if (isWeakMap(obj)) {
731
- return weakCollectionOf('WeakMap');
732
- }
733
- if (isWeakSet(obj)) {
734
- return weakCollectionOf('WeakSet');
735
- }
736
- if (isWeakRef(obj)) {
737
- return weakCollectionOf('WeakRef');
738
- }
739
- if (isNumber(obj)) {
740
- return markBoxed(inspect(Number(obj)));
741
- }
742
- if (isBigInt(obj)) {
743
- return markBoxed(inspect(bigIntValueOf.call(obj)));
744
- }
745
- if (isBoolean(obj)) {
746
- return markBoxed(booleanValueOf.call(obj));
747
- }
748
- if (isString(obj)) {
749
- return markBoxed(inspect(String(obj)));
750
- }
751
- if (!isDate(obj) && !isRegExp$1(obj)) {
752
- var ys = arrObjKeys(obj, inspect);
753
- var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
754
- var protoTag = obj instanceof Object ? '' : 'null prototype';
755
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
756
- var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
757
- var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
758
- if (ys.length === 0) { return tag + '{}'; }
759
- if (indent) {
760
- return tag + '{' + indentedJoin(ys, indent) + '}';
761
- }
762
- return tag + '{ ' + $join.call(ys, ', ') + ' }';
763
- }
764
- return String(obj);
765
- };
766
-
767
- function wrapQuotes(s, defaultStyle, opts) {
768
- var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
769
- return quoteChar + s + quoteChar;
770
- }
771
-
772
- function quote(s) {
773
- return $replace.call(String(s), /"/g, '&quot;');
774
- }
775
-
776
- function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
777
- function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
778
- function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
779
- function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
780
- function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
781
- function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
782
- function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
783
-
784
- // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
785
- function isSymbol(obj) {
786
- if (hasShammedSymbols) {
787
- return obj && typeof obj === 'object' && obj instanceof Symbol;
788
- }
789
- if (typeof obj === 'symbol') {
790
- return true;
791
- }
792
- if (!obj || typeof obj !== 'object' || !symToString) {
793
- return false;
794
- }
795
- try {
796
- symToString.call(obj);
797
- return true;
798
- } catch (e) {}
799
- return false;
800
- }
801
-
802
- function isBigInt(obj) {
803
- if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
804
- return false;
805
- }
806
- try {
807
- bigIntValueOf.call(obj);
808
- return true;
809
- } catch (e) {}
810
- return false;
811
- }
812
-
813
- var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
814
- function has$3(obj, key) {
815
- return hasOwn.call(obj, key);
816
- }
817
-
818
- function toStr(obj) {
819
- return objectToString.call(obj);
820
- }
821
-
822
- function nameOf(f) {
823
- if (f.name) { return f.name; }
824
- var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
825
- if (m) { return m[1]; }
826
- return null;
827
- }
828
-
829
- function indexOf(xs, x) {
830
- if (xs.indexOf) { return xs.indexOf(x); }
831
- for (var i = 0, l = xs.length; i < l; i++) {
832
- if (xs[i] === x) { return i; }
833
- }
834
- return -1;
835
- }
836
-
837
- function isMap(x) {
838
- if (!mapSize || !x || typeof x !== 'object') {
839
- return false;
840
- }
841
- try {
842
- mapSize.call(x);
843
- try {
844
- setSize.call(x);
845
- } catch (s) {
846
- return true;
847
- }
848
- return x instanceof Map; // core-js workaround, pre-v2.5.0
849
- } catch (e) {}
850
- return false;
851
- }
852
-
853
- function isWeakMap(x) {
854
- if (!weakMapHas || !x || typeof x !== 'object') {
855
- return false;
856
- }
857
- try {
858
- weakMapHas.call(x, weakMapHas);
859
- try {
860
- weakSetHas.call(x, weakSetHas);
861
- } catch (s) {
862
- return true;
863
- }
864
- return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
865
- } catch (e) {}
866
- return false;
867
- }
868
-
869
- function isWeakRef(x) {
870
- if (!weakRefDeref || !x || typeof x !== 'object') {
871
- return false;
872
- }
873
- try {
874
- weakRefDeref.call(x);
875
- return true;
876
- } catch (e) {}
877
- return false;
878
- }
879
-
880
- function isSet(x) {
881
- if (!setSize || !x || typeof x !== 'object') {
882
- return false;
883
- }
884
- try {
885
- setSize.call(x);
886
- try {
887
- mapSize.call(x);
888
- } catch (m) {
889
- return true;
890
- }
891
- return x instanceof Set; // core-js workaround, pre-v2.5.0
892
- } catch (e) {}
893
- return false;
894
- }
895
-
896
- function isWeakSet(x) {
897
- if (!weakSetHas || !x || typeof x !== 'object') {
898
- return false;
899
- }
900
- try {
901
- weakSetHas.call(x, weakSetHas);
902
- try {
903
- weakMapHas.call(x, weakMapHas);
904
- } catch (s) {
905
- return true;
906
- }
907
- return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
908
- } catch (e) {}
909
- return false;
910
- }
911
-
912
- function isElement(x) {
913
- if (!x || typeof x !== 'object') { return false; }
914
- if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
915
- return true;
916
- }
917
- return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
918
- }
919
-
920
- function inspectString(str, opts) {
921
- if (str.length > opts.maxStringLength) {
922
- var remaining = str.length - opts.maxStringLength;
923
- var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
924
- return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
925
- }
926
- // eslint-disable-next-line no-control-regex
927
- var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
928
- return wrapQuotes(s, 'single', opts);
929
- }
930
-
931
- function lowbyte(c) {
932
- var n = c.charCodeAt(0);
933
- var x = {
934
- 8: 'b',
935
- 9: 't',
936
- 10: 'n',
937
- 12: 'f',
938
- 13: 'r'
939
- }[n];
940
- if (x) { return '\\' + x; }
941
- return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
942
- }
943
-
944
- function markBoxed(str) {
945
- return 'Object(' + str + ')';
946
- }
947
-
948
- function weakCollectionOf(type) {
949
- return type + ' { ? }';
950
- }
951
-
952
- function collectionOf(type, size, entries, indent) {
953
- var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
954
- return type + ' (' + size + ') {' + joinedEntries + '}';
955
- }
956
-
957
- function singleLineValues(xs) {
958
- for (var i = 0; i < xs.length; i++) {
959
- if (indexOf(xs[i], '\n') >= 0) {
960
- return false;
961
- }
962
- }
963
- return true;
964
- }
965
-
966
- function getIndent(opts, depth) {
967
- var baseIndent;
968
- if (opts.indent === '\t') {
969
- baseIndent = '\t';
970
- } else if (typeof opts.indent === 'number' && opts.indent > 0) {
971
- baseIndent = $join.call(Array(opts.indent + 1), ' ');
972
- } else {
973
- return null;
974
- }
975
- return {
976
- base: baseIndent,
977
- prev: $join.call(Array(depth + 1), baseIndent)
978
- };
979
- }
980
-
981
- function indentedJoin(xs, indent) {
982
- if (xs.length === 0) { return ''; }
983
- var lineJoiner = '\n' + indent.prev + indent.base;
984
- return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
985
- }
986
-
987
- function arrObjKeys(obj, inspect) {
988
- var isArr = isArray$3(obj);
989
- var xs = [];
990
- if (isArr) {
991
- xs.length = obj.length;
992
- for (var i = 0; i < obj.length; i++) {
993
- xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
994
- }
995
- }
996
- var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
997
- var symMap;
998
- if (hasShammedSymbols) {
999
- symMap = {};
1000
- for (var k = 0; k < syms.length; k++) {
1001
- symMap['$' + syms[k]] = syms[k];
1002
- }
1003
- }
1004
-
1005
- for (var key in obj) { // eslint-disable-line no-restricted-syntax
1006
- if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1007
- if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1008
- if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1009
- // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1010
- continue; // eslint-disable-line no-restricted-syntax, no-continue
1011
- } else if ($test.call(/[^\w$]/, key)) {
1012
- xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1013
- } else {
1014
- xs.push(key + ': ' + inspect(obj[key], obj));
1015
- }
1016
- }
1017
- if (typeof gOPS === 'function') {
1018
- for (var j = 0; j < syms.length; j++) {
1019
- if (isEnumerable.call(obj, syms[j])) {
1020
- xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1021
- }
1022
- }
1023
- }
1024
- return xs;
1025
- }
1026
-
1027
- var $TypeError = getIntrinsic('%TypeError%');
1028
- var $WeakMap = getIntrinsic('%WeakMap%', true);
1029
- var $Map = getIntrinsic('%Map%', true);
1030
-
1031
- var $weakMapGet = callBound('WeakMap.prototype.get', true);
1032
- var $weakMapSet = callBound('WeakMap.prototype.set', true);
1033
- var $weakMapHas = callBound('WeakMap.prototype.has', true);
1034
- var $mapGet = callBound('Map.prototype.get', true);
1035
- var $mapSet = callBound('Map.prototype.set', true);
1036
- var $mapHas = callBound('Map.prototype.has', true);
1037
-
1038
- /*
1039
- * This function traverses the list returning the node corresponding to the
1040
- * given key.
1041
- *
1042
- * That node is also moved to the head of the list, so that if it's accessed
1043
- * again we don't need to traverse the whole list. By doing so, all the recently
1044
- * used nodes can be accessed relatively quickly.
1045
- */
1046
- var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1047
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1048
- if (curr.key === key) {
1049
- prev.next = curr.next;
1050
- curr.next = list.next;
1051
- list.next = curr; // eslint-disable-line no-param-reassign
1052
- return curr;
1053
- }
1054
- }
1055
- };
1056
-
1057
- var listGet = function (objects, key) {
1058
- var node = listGetNode(objects, key);
1059
- return node && node.value;
1060
- };
1061
- var listSet = function (objects, key, value) {
1062
- var node = listGetNode(objects, key);
1063
- if (node) {
1064
- node.value = value;
1065
- } else {
1066
- // Prepend the new node to the beginning of the list
1067
- objects.next = { // eslint-disable-line no-param-reassign
1068
- key: key,
1069
- next: objects.next,
1070
- value: value
1071
- };
1072
- }
1073
- };
1074
- var listHas = function (objects, key) {
1075
- return !!listGetNode(objects, key);
1076
- };
1077
-
1078
- var sideChannel = function getSideChannel() {
1079
- var $wm;
1080
- var $m;
1081
- var $o;
1082
- var channel = {
1083
- assert: function (key) {
1084
- if (!channel.has(key)) {
1085
- throw new $TypeError('Side channel does not contain ' + objectInspect(key));
1086
- }
1087
- },
1088
- get: function (key) { // eslint-disable-line consistent-return
1089
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1090
- if ($wm) {
1091
- return $weakMapGet($wm, key);
1092
- }
1093
- } else if ($Map) {
1094
- if ($m) {
1095
- return $mapGet($m, key);
1096
- }
1097
- } else {
1098
- if ($o) { // eslint-disable-line no-lonely-if
1099
- return listGet($o, key);
1100
- }
1101
- }
1102
- },
1103
- has: function (key) {
1104
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1105
- if ($wm) {
1106
- return $weakMapHas($wm, key);
1107
- }
1108
- } else if ($Map) {
1109
- if ($m) {
1110
- return $mapHas($m, key);
1111
- }
1112
- } else {
1113
- if ($o) { // eslint-disable-line no-lonely-if
1114
- return listHas($o, key);
1115
- }
1116
- }
1117
- return false;
1118
- },
1119
- set: function (key, value) {
1120
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1121
- if (!$wm) {
1122
- $wm = new $WeakMap();
1123
- }
1124
- $weakMapSet($wm, key, value);
1125
- } else if ($Map) {
1126
- if (!$m) {
1127
- $m = new $Map();
1128
- }
1129
- $mapSet($m, key, value);
1130
- } else {
1131
- if (!$o) {
1132
- /*
1133
- * Initialize the linked list as an empty node, so that we don't have
1134
- * to special-case handling of the first node: we can always refer to
1135
- * it as (previous node).next, instead of something like (list).head
1136
- */
1137
- $o = { key: {}, next: null };
1138
- }
1139
- listSet($o, key, value);
1140
- }
1141
- }
1142
- };
1143
- return channel;
1144
- };
1145
-
1146
- var replace = String.prototype.replace;
1147
- var percentTwenties = /%20/g;
1148
-
1149
- var Format = {
1150
- RFC1738: 'RFC1738',
1151
- RFC3986: 'RFC3986'
1152
- };
1153
-
1154
- var formats = {
1155
- 'default': Format.RFC3986,
1156
- formatters: {
1157
- RFC1738: function (value) {
1158
- return replace.call(value, percentTwenties, '+');
1159
- },
1160
- RFC3986: function (value) {
1161
- return String(value);
1162
- }
1163
- },
1164
- RFC1738: Format.RFC1738,
1165
- RFC3986: Format.RFC3986
1166
- };
1167
-
1168
- var has$2 = Object.prototype.hasOwnProperty;
1169
- var isArray$2 = Array.isArray;
1170
-
1171
- var hexTable = (function () {
1172
- var array = [];
1173
- for (var i = 0; i < 256; ++i) {
1174
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1175
- }
1176
-
1177
- return array;
1178
- }());
1179
-
1180
- var compactQueue = function compactQueue(queue) {
1181
- while (queue.length > 1) {
1182
- var item = queue.pop();
1183
- var obj = item.obj[item.prop];
1184
-
1185
- if (isArray$2(obj)) {
1186
- var compacted = [];
1187
-
1188
- for (var j = 0; j < obj.length; ++j) {
1189
- if (typeof obj[j] !== 'undefined') {
1190
- compacted.push(obj[j]);
1191
- }
1192
- }
1193
-
1194
- item.obj[item.prop] = compacted;
1195
- }
1196
- }
1197
- };
1198
-
1199
- var arrayToObject = function arrayToObject(source, options) {
1200
- var obj = options && options.plainObjects ? Object.create(null) : {};
1201
- for (var i = 0; i < source.length; ++i) {
1202
- if (typeof source[i] !== 'undefined') {
1203
- obj[i] = source[i];
1204
- }
1205
- }
1206
-
1207
- return obj;
1208
- };
1209
-
1210
- var merge = function merge(target, source, options) {
1211
- /* eslint no-param-reassign: 0 */
1212
- if (!source) {
1213
- return target;
1214
- }
1215
-
1216
- if (typeof source !== 'object') {
1217
- if (isArray$2(target)) {
1218
- target.push(source);
1219
- } else if (target && typeof target === 'object') {
1220
- if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
1221
- target[source] = true;
1222
- }
1223
- } else {
1224
- return [target, source];
1225
- }
1226
-
1227
- return target;
1228
- }
1229
-
1230
- if (!target || typeof target !== 'object') {
1231
- return [target].concat(source);
1232
- }
1233
-
1234
- var mergeTarget = target;
1235
- if (isArray$2(target) && !isArray$2(source)) {
1236
- mergeTarget = arrayToObject(target, options);
1237
- }
1238
-
1239
- if (isArray$2(target) && isArray$2(source)) {
1240
- source.forEach(function (item, i) {
1241
- if (has$2.call(target, i)) {
1242
- var targetItem = target[i];
1243
- if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1244
- target[i] = merge(targetItem, item, options);
1245
- } else {
1246
- target.push(item);
1247
- }
1248
- } else {
1249
- target[i] = item;
1250
- }
1251
- });
1252
- return target;
1253
- }
1254
-
1255
- return Object.keys(source).reduce(function (acc, key) {
1256
- var value = source[key];
1257
-
1258
- if (has$2.call(acc, key)) {
1259
- acc[key] = merge(acc[key], value, options);
1260
- } else {
1261
- acc[key] = value;
1262
- }
1263
- return acc;
1264
- }, mergeTarget);
1265
- };
1266
-
1267
- var assign = function assignSingleSource(target, source) {
1268
- return Object.keys(source).reduce(function (acc, key) {
1269
- acc[key] = source[key];
1270
- return acc;
1271
- }, target);
1272
- };
1273
-
1274
- var decode = function (str, decoder, charset) {
1275
- var strWithoutPlus = str.replace(/\+/g, ' ');
1276
- if (charset === 'iso-8859-1') {
1277
- // unescape never throws, no try...catch needed:
1278
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1279
- }
1280
- // utf-8
1281
- try {
1282
- return decodeURIComponent(strWithoutPlus);
1283
- } catch (e) {
1284
- return strWithoutPlus;
1285
- }
1286
- };
1287
-
1288
- var encode = function encode(str, defaultEncoder, charset, kind, format) {
1289
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1290
- // It has been adapted here for stricter adherence to RFC 3986
1291
- if (str.length === 0) {
1292
- return str;
1293
- }
1294
-
1295
- var string = str;
1296
- if (typeof str === 'symbol') {
1297
- string = Symbol.prototype.toString.call(str);
1298
- } else if (typeof str !== 'string') {
1299
- string = String(str);
1300
- }
1301
-
1302
- if (charset === 'iso-8859-1') {
1303
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1304
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1305
- });
1306
- }
1307
-
1308
- var out = '';
1309
- for (var i = 0; i < string.length; ++i) {
1310
- var c = string.charCodeAt(i);
1311
-
1312
- if (
1313
- c === 0x2D // -
1314
- || c === 0x2E // .
1315
- || c === 0x5F // _
1316
- || c === 0x7E // ~
1317
- || (c >= 0x30 && c <= 0x39) // 0-9
1318
- || (c >= 0x41 && c <= 0x5A) // a-z
1319
- || (c >= 0x61 && c <= 0x7A) // A-Z
1320
- || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1321
- ) {
1322
- out += string.charAt(i);
1323
- continue;
1324
- }
1325
-
1326
- if (c < 0x80) {
1327
- out = out + hexTable[c];
1328
- continue;
1329
- }
1330
-
1331
- if (c < 0x800) {
1332
- out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
1333
- continue;
1334
- }
1335
-
1336
- if (c < 0xD800 || c >= 0xE000) {
1337
- out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
1338
- continue;
1339
- }
1340
-
1341
- i += 1;
1342
- c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
1343
- /* eslint operator-linebreak: [2, "before"] */
1344
- out += hexTable[0xF0 | (c >> 18)]
1345
- + hexTable[0x80 | ((c >> 12) & 0x3F)]
1346
- + hexTable[0x80 | ((c >> 6) & 0x3F)]
1347
- + hexTable[0x80 | (c & 0x3F)];
1348
- }
1349
-
1350
- return out;
1351
- };
1352
-
1353
- var compact = function compact(value) {
1354
- var queue = [{ obj: { o: value }, prop: 'o' }];
1355
- var refs = [];
1356
-
1357
- for (var i = 0; i < queue.length; ++i) {
1358
- var item = queue[i];
1359
- var obj = item.obj[item.prop];
1360
-
1361
- var keys = Object.keys(obj);
1362
- for (var j = 0; j < keys.length; ++j) {
1363
- var key = keys[j];
1364
- var val = obj[key];
1365
- if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1366
- queue.push({ obj: obj, prop: key });
1367
- refs.push(val);
1368
- }
1369
- }
1370
- }
1371
-
1372
- compactQueue(queue);
1373
-
1374
- return value;
1375
- };
1376
-
1377
- var isRegExp = function isRegExp(obj) {
1378
- return Object.prototype.toString.call(obj) === '[object RegExp]';
1379
- };
1380
-
1381
- var isBuffer = function isBuffer(obj) {
1382
- if (!obj || typeof obj !== 'object') {
1383
- return false;
1384
- }
1385
-
1386
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1387
- };
1388
-
1389
- var combine = function combine(a, b) {
1390
- return [].concat(a, b);
1391
- };
1392
-
1393
- var maybeMap = function maybeMap(val, fn) {
1394
- if (isArray$2(val)) {
1395
- var mapped = [];
1396
- for (var i = 0; i < val.length; i += 1) {
1397
- mapped.push(fn(val[i]));
1398
- }
1399
- return mapped;
1400
- }
1401
- return fn(val);
1402
- };
1403
-
1404
- var utils = {
1405
- arrayToObject: arrayToObject,
1406
- assign: assign,
1407
- combine: combine,
1408
- compact: compact,
1409
- decode: decode,
1410
- encode: encode,
1411
- isBuffer: isBuffer,
1412
- isRegExp: isRegExp,
1413
- maybeMap: maybeMap,
1414
- merge: merge
1415
- };
1416
-
1417
- var has$1 = Object.prototype.hasOwnProperty;
1418
-
1419
- var arrayPrefixGenerators = {
1420
- brackets: function brackets(prefix) {
1421
- return prefix + '[]';
1422
- },
1423
- comma: 'comma',
1424
- indices: function indices(prefix, key) {
1425
- return prefix + '[' + key + ']';
1426
- },
1427
- repeat: function repeat(prefix) {
1428
- return prefix;
1429
- }
1430
- };
1431
-
1432
- var isArray$1 = Array.isArray;
1433
- var split = String.prototype.split;
1434
- var push = Array.prototype.push;
1435
- var pushToArray = function (arr, valueOrArray) {
1436
- push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
1437
- };
1438
-
1439
- var toISO = Date.prototype.toISOString;
1440
-
1441
- var defaultFormat = formats['default'];
1442
- var defaults$1 = {
1443
- addQueryPrefix: false,
1444
- allowDots: false,
1445
- charset: 'utf-8',
1446
- charsetSentinel: false,
1447
- delimiter: '&',
1448
- encode: true,
1449
- encoder: utils.encode,
1450
- encodeValuesOnly: false,
1451
- format: defaultFormat,
1452
- formatter: formats.formatters[defaultFormat],
1453
- // deprecated
1454
- indices: false,
1455
- serializeDate: function serializeDate(date) {
1456
- return toISO.call(date);
1457
- },
1458
- skipNulls: false,
1459
- strictNullHandling: false
1460
- };
1461
-
1462
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1463
- return typeof v === 'string'
1464
- || typeof v === 'number'
1465
- || typeof v === 'boolean'
1466
- || typeof v === 'symbol'
1467
- || typeof v === 'bigint';
1468
- };
1469
-
1470
- var sentinel = {};
1471
-
1472
- var stringify = function stringify(
1473
- object,
1474
- prefix,
1475
- generateArrayPrefix,
1476
- commaRoundTrip,
1477
- strictNullHandling,
1478
- skipNulls,
1479
- encoder,
1480
- filter,
1481
- sort,
1482
- allowDots,
1483
- serializeDate,
1484
- format,
1485
- formatter,
1486
- encodeValuesOnly,
1487
- charset,
1488
- sideChannel$1
1489
- ) {
1490
- var obj = object;
1491
-
1492
- var tmpSc = sideChannel$1;
1493
- var step = 0;
1494
- var findFlag = false;
1495
- while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
1496
- // Where object last appeared in the ref tree
1497
- var pos = tmpSc.get(object);
1498
- step += 1;
1499
- if (typeof pos !== 'undefined') {
1500
- if (pos === step) {
1501
- throw new RangeError('Cyclic object value');
1502
- } else {
1503
- findFlag = true; // Break while
1504
- }
1505
- }
1506
- if (typeof tmpSc.get(sentinel) === 'undefined') {
1507
- step = 0;
1508
- }
1509
- }
1510
-
1511
- if (typeof filter === 'function') {
1512
- obj = filter(prefix, obj);
1513
- } else if (obj instanceof Date) {
1514
- obj = serializeDate(obj);
1515
- } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
1516
- obj = utils.maybeMap(obj, function (value) {
1517
- if (value instanceof Date) {
1518
- return serializeDate(value);
1519
- }
1520
- return value;
1521
- });
1522
- }
1523
-
1524
- if (obj === null) {
1525
- if (strictNullHandling) {
1526
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
1527
- }
1528
-
1529
- obj = '';
1530
- }
1531
-
1532
- if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1533
- if (encoder) {
1534
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
1535
- if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
1536
- var valuesArray = split.call(String(obj), ',');
1537
- var valuesJoined = '';
1538
- for (var i = 0; i < valuesArray.length; ++i) {
1539
- valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults$1.encoder, charset, 'value', format));
1540
- }
1541
- return [formatter(keyValue) + (commaRoundTrip && isArray$1(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
1542
- }
1543
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
1544
- }
1545
- return [formatter(prefix) + '=' + formatter(String(obj))];
1546
- }
1547
-
1548
- var values = [];
1549
-
1550
- if (typeof obj === 'undefined') {
1551
- return values;
1552
- }
1553
-
1554
- var objKeys;
1555
- if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
1556
- // we need to join elements in
1557
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
1558
- } else if (isArray$1(filter)) {
1559
- objKeys = filter;
1560
- } else {
1561
- var keys = Object.keys(obj);
1562
- objKeys = sort ? keys.sort(sort) : keys;
1563
- }
1564
-
1565
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
1566
-
1567
- for (var j = 0; j < objKeys.length; ++j) {
1568
- var key = objKeys[j];
1569
- var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
1570
-
1571
- if (skipNulls && value === null) {
1572
- continue;
1573
- }
1574
-
1575
- var keyPrefix = isArray$1(obj)
1576
- ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
1577
- : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
1578
-
1579
- sideChannel$1.set(object, step);
1580
- var valueSideChannel = sideChannel();
1581
- valueSideChannel.set(sentinel, sideChannel$1);
1582
- pushToArray(values, stringify(
1583
- value,
1584
- keyPrefix,
1585
- generateArrayPrefix,
1586
- commaRoundTrip,
1587
- strictNullHandling,
1588
- skipNulls,
1589
- encoder,
1590
- filter,
1591
- sort,
1592
- allowDots,
1593
- serializeDate,
1594
- format,
1595
- formatter,
1596
- encodeValuesOnly,
1597
- charset,
1598
- valueSideChannel
1599
- ));
1600
- }
1601
-
1602
- return values;
1603
- };
1604
-
1605
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1606
- if (!opts) {
1607
- return defaults$1;
1608
- }
1609
-
1610
- if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
1611
- throw new TypeError('Encoder has to be a function.');
1612
- }
1613
-
1614
- var charset = opts.charset || defaults$1.charset;
1615
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1616
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1617
- }
1618
-
1619
- var format = formats['default'];
1620
- if (typeof opts.format !== 'undefined') {
1621
- if (!has$1.call(formats.formatters, opts.format)) {
1622
- throw new TypeError('Unknown format option provided.');
1623
- }
1624
- format = opts.format;
1625
- }
1626
- var formatter = formats.formatters[format];
1627
-
1628
- var filter = defaults$1.filter;
1629
- if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
1630
- filter = opts.filter;
1631
- }
1632
-
1633
- return {
1634
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
1635
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
1636
- charset: charset,
1637
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
1638
- delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
1639
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
1640
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
1641
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
1642
- filter: filter,
1643
- format: format,
1644
- formatter: formatter,
1645
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
1646
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
1647
- sort: typeof opts.sort === 'function' ? opts.sort : null,
1648
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
1649
- };
1650
- };
1651
-
1652
- var stringify_1 = function (object, opts) {
1653
- var obj = object;
1654
- var options = normalizeStringifyOptions(opts);
1655
-
1656
- var objKeys;
1657
- var filter;
1658
-
1659
- if (typeof options.filter === 'function') {
1660
- filter = options.filter;
1661
- obj = filter('', obj);
1662
- } else if (isArray$1(options.filter)) {
1663
- filter = options.filter;
1664
- objKeys = filter;
1665
- }
1666
-
1667
- var keys = [];
1668
-
1669
- if (typeof obj !== 'object' || obj === null) {
1670
- return '';
1671
- }
1672
-
1673
- var arrayFormat;
1674
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1675
- arrayFormat = opts.arrayFormat;
1676
- } else if (opts && 'indices' in opts) {
1677
- arrayFormat = opts.indices ? 'indices' : 'repeat';
1678
- } else {
1679
- arrayFormat = 'indices';
1680
- }
1681
-
1682
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
1683
- if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
1684
- throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
1685
- }
1686
- var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
1687
-
1688
- if (!objKeys) {
1689
- objKeys = Object.keys(obj);
1690
- }
1691
-
1692
- if (options.sort) {
1693
- objKeys.sort(options.sort);
1694
- }
1695
-
1696
- var sideChannel$1 = sideChannel();
1697
- for (var i = 0; i < objKeys.length; ++i) {
1698
- var key = objKeys[i];
1699
-
1700
- if (options.skipNulls && obj[key] === null) {
1701
- continue;
1702
- }
1703
- pushToArray(keys, stringify(
1704
- obj[key],
1705
- key,
1706
- generateArrayPrefix,
1707
- commaRoundTrip,
1708
- options.strictNullHandling,
1709
- options.skipNulls,
1710
- options.encode ? options.encoder : null,
1711
- options.filter,
1712
- options.sort,
1713
- options.allowDots,
1714
- options.serializeDate,
1715
- options.format,
1716
- options.formatter,
1717
- options.encodeValuesOnly,
1718
- options.charset,
1719
- sideChannel$1
1720
- ));
1721
- }
1722
-
1723
- var joined = keys.join(options.delimiter);
1724
- var prefix = options.addQueryPrefix === true ? '?' : '';
1725
-
1726
- if (options.charsetSentinel) {
1727
- if (options.charset === 'iso-8859-1') {
1728
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
1729
- prefix += 'utf8=%26%2310003%3B&';
1730
- } else {
1731
- // encodeURIComponent('✓')
1732
- prefix += 'utf8=%E2%9C%93&';
1733
- }
1734
- }
1735
-
1736
- return joined.length > 0 ? prefix + joined : '';
1737
- };
1738
-
1739
- var has = Object.prototype.hasOwnProperty;
1740
- var isArray = Array.isArray;
1741
-
1742
- var defaults = {
1743
- allowDots: false,
1744
- allowPrototypes: false,
1745
- allowSparse: false,
1746
- arrayLimit: 20,
1747
- charset: 'utf-8',
1748
- charsetSentinel: false,
1749
- comma: false,
1750
- decoder: utils.decode,
1751
- delimiter: '&',
1752
- depth: 5,
1753
- ignoreQueryPrefix: false,
1754
- interpretNumericEntities: false,
1755
- parameterLimit: 1000,
1756
- parseArrays: true,
1757
- plainObjects: false,
1758
- strictNullHandling: false
1759
- };
1760
-
1761
- var interpretNumericEntities = function (str) {
1762
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1763
- return String.fromCharCode(parseInt(numberStr, 10));
1764
- });
1765
- };
1766
-
1767
- var parseArrayValue = function (val, options) {
1768
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
1769
- return val.split(',');
1770
- }
1771
-
1772
- return val;
1773
- };
1774
-
1775
- // This is what browsers will submit when the ✓ character occurs in an
1776
- // application/x-www-form-urlencoded body and the encoding of the page containing
1777
- // the form is iso-8859-1, or when the submitted form has an accept-charset
1778
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
1779
- // the ✓ character, such as us-ascii.
1780
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
1781
-
1782
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1783
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
1784
-
1785
- var parseValues = function parseQueryStringValues(str, options) {
1786
- var obj = {};
1787
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
1788
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1789
- var parts = cleanStr.split(options.delimiter, limit);
1790
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
1791
- var i;
1792
-
1793
- var charset = options.charset;
1794
- if (options.charsetSentinel) {
1795
- for (i = 0; i < parts.length; ++i) {
1796
- if (parts[i].indexOf('utf8=') === 0) {
1797
- if (parts[i] === charsetSentinel) {
1798
- charset = 'utf-8';
1799
- } else if (parts[i] === isoSentinel) {
1800
- charset = 'iso-8859-1';
1801
- }
1802
- skipIndex = i;
1803
- i = parts.length; // The eslint settings do not allow break;
1804
- }
1805
- }
1806
- }
1807
-
1808
- for (i = 0; i < parts.length; ++i) {
1809
- if (i === skipIndex) {
1810
- continue;
1811
- }
1812
- var part = parts[i];
1813
-
1814
- var bracketEqualsPos = part.indexOf(']=');
1815
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
1816
-
1817
- var key, val;
1818
- if (pos === -1) {
1819
- key = options.decoder(part, defaults.decoder, charset, 'key');
1820
- val = options.strictNullHandling ? null : '';
1821
- } else {
1822
- key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
1823
- val = utils.maybeMap(
1824
- parseArrayValue(part.slice(pos + 1), options),
1825
- function (encodedVal) {
1826
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
1827
- }
1828
- );
1829
- }
1830
-
1831
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
1832
- val = interpretNumericEntities(val);
1833
- }
1834
-
1835
- if (part.indexOf('[]=') > -1) {
1836
- val = isArray(val) ? [val] : val;
1837
- }
1838
-
1839
- if (has.call(obj, key)) {
1840
- obj[key] = utils.combine(obj[key], val);
1841
- } else {
1842
- obj[key] = val;
1843
- }
1844
- }
1845
-
1846
- return obj;
1847
- };
1848
-
1849
- var parseObject = function (chain, val, options, valuesParsed) {
1850
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
1851
-
1852
- for (var i = chain.length - 1; i >= 0; --i) {
1853
- var obj;
1854
- var root = chain[i];
1855
-
1856
- if (root === '[]' && options.parseArrays) {
1857
- obj = [].concat(leaf);
1858
- } else {
1859
- obj = options.plainObjects ? Object.create(null) : {};
1860
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
1861
- var index = parseInt(cleanRoot, 10);
1862
- if (!options.parseArrays && cleanRoot === '') {
1863
- obj = { 0: leaf };
1864
- } else if (
1865
- !isNaN(index)
1866
- && root !== cleanRoot
1867
- && String(index) === cleanRoot
1868
- && index >= 0
1869
- && (options.parseArrays && index <= options.arrayLimit)
1870
- ) {
1871
- obj = [];
1872
- obj[index] = leaf;
1873
- } else if (cleanRoot !== '__proto__') {
1874
- obj[cleanRoot] = leaf;
1875
- }
1876
- }
1877
-
1878
- leaf = obj;
1879
- }
1880
-
1881
- return leaf;
1882
- };
1883
-
1884
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1885
- if (!givenKey) {
1886
- return;
1887
- }
1888
-
1889
- // Transform dot notation to bracket notation
1890
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
1891
-
1892
- // The regex chunks
1893
-
1894
- var brackets = /(\[[^[\]]*])/;
1895
- var child = /(\[[^[\]]*])/g;
1896
-
1897
- // Get the parent
1898
-
1899
- var segment = options.depth > 0 && brackets.exec(key);
1900
- var parent = segment ? key.slice(0, segment.index) : key;
1901
-
1902
- // Stash the parent if it exists
1903
-
1904
- var keys = [];
1905
- if (parent) {
1906
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
1907
- if (!options.plainObjects && has.call(Object.prototype, parent)) {
1908
- if (!options.allowPrototypes) {
1909
- return;
1910
- }
1911
- }
1912
-
1913
- keys.push(parent);
1914
- }
1915
-
1916
- // Loop through children appending to the array until we hit depth
1917
-
1918
- var i = 0;
1919
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
1920
- i += 1;
1921
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
1922
- if (!options.allowPrototypes) {
1923
- return;
1924
- }
1925
- }
1926
- keys.push(segment[1]);
1927
- }
1928
-
1929
- // If there's a remainder, just add whatever is left
1930
-
1931
- if (segment) {
1932
- keys.push('[' + key.slice(segment.index) + ']');
1933
- }
1934
-
1935
- return parseObject(keys, val, options, valuesParsed);
1936
- };
1937
-
1938
- var normalizeParseOptions = function normalizeParseOptions(opts) {
1939
- if (!opts) {
1940
- return defaults;
1941
- }
1942
-
1943
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
1944
- throw new TypeError('Decoder has to be a function.');
1945
- }
1946
-
1947
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1948
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1949
- }
1950
- var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
1951
-
1952
- return {
1953
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1954
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
1955
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
1956
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
1957
- charset: charset,
1958
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1959
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
1960
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
1961
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
1962
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
1963
- depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
1964
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
1965
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
1966
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
1967
- parseArrays: opts.parseArrays !== false,
1968
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
1969
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1970
- };
1971
- };
1972
-
1973
- var parse = function (str, opts) {
1974
- var options = normalizeParseOptions(opts);
1975
-
1976
- if (str === '' || str === null || typeof str === 'undefined') {
1977
- return options.plainObjects ? Object.create(null) : {};
1978
- }
1979
-
1980
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
1981
- var obj = options.plainObjects ? Object.create(null) : {};
1982
-
1983
- // Iterate over the keys and setup the new object
1984
-
1985
- var keys = Object.keys(tempObj);
1986
- for (var i = 0; i < keys.length; ++i) {
1987
- var key = keys[i];
1988
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
1989
- obj = utils.merge(obj, newObj, options);
1990
- }
1991
-
1992
- if (options.allowSparse === true) {
1993
- return obj;
1994
- }
1995
-
1996
- return utils.compact(obj);
1997
- };
1998
-
1999
- var lib = {
2000
- formats: formats,
2001
- parse: parse,
2002
- stringify: stringify_1
2003
- };
2004
-
2005
- const STORAGE_NAME_SPACE = 'nano-component-store:';
2006
- const urlRead = (from = 'hash', win = window) => {
2007
- if (!win || !win.location)
2008
- return {};
2009
- if (from === 'hash' && win.location.hash)
2010
- return lib.parse(win.location.hash.replace(/^\#/, ''), {
2011
- strictNullHandling: true,
2012
- });
2013
- else if (from === 'query' && win.location.search)
2014
- return lib.parse(win.location.search, { ignoreQueryPrefix: true });
2015
- return {};
2016
- };
2017
- const urlSave = (object, to = 'hash', win = window, method = 'replace') => {
2018
- if (!win || !win.history)
2019
- return;
2020
- const oldQuery = to === 'query' ? win.location.search : win.location.hash;
2021
- const basePath = to === 'query'
2022
- ? win.location.pathname
2023
- : win.location.pathname + win.location.search;
2024
- let queryStr = lib.stringify(object, {
2025
- strictNullHandling: true,
2026
- addQueryPrefix: false,
2027
- encodeValuesOnly: true,
2028
- });
2029
- if (!queryStr || !queryStr.length) {
2030
- if (!oldQuery || !oldQuery.length)
2031
- return;
2032
- if (method === 'replace')
2033
- win.history.replaceState(null, null, basePath);
2034
- else
2035
- win.history.pushState(null, null, basePath);
2036
- return;
2037
- }
2038
- if (to === 'hash' && win.location.hash === '#' + queryStr) {
2039
- try {
2040
- document.querySelector('#' + queryStr).focus();
2041
- }
2042
- catch (e) { }
2043
- return;
2044
- }
2045
- queryStr = (to === 'hash' ? '#' : '?') + queryStr;
2046
- if (queryStr === oldQuery)
2047
- return;
2048
- if (method === 'replace')
2049
- win.history.replaceState(null, null, basePath + queryStr);
2050
- else
2051
- win.history.pushState(null, null, basePath + queryStr);
2052
- };
2053
- const urlSet = (id, data, to = 'hash', win = window, method = 'replace') => {
2054
- // sanitize the incoming key
2055
- id = Object.keys(lib.parse(id))[0];
2056
- const object = {};
2057
- object[id] = data;
2058
- let currentData = urlRead(to, win);
2059
- currentData = Object.assign(Object.assign({}, currentData), object);
2060
- urlSave(currentData, to, win, method);
2061
- };
2062
- const urlGet = (key, to = 'hash', win = window) => {
2063
- // sanitize the incoming key
2064
- key = Object.keys(lib.parse(key))[0];
2065
- const currentData = urlRead(to, win);
2066
- return currentData[key] || null;
2067
- };
2068
- const sessionSet = (key, object, win = window) => {
2069
- try {
2070
- if (!object) {
2071
- win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);
2072
- return;
2073
- }
2074
- win.sessionStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));
2075
- }
2076
- catch (e) {
2077
- throw e;
2078
- }
2079
- };
2080
- const sessionGet = (key, win = window) => {
2081
- try {
2082
- const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);
2083
- return configStr !== null ? JSON.parse(configStr) : null;
2084
- }
2085
- catch (e) {
2086
- throw e;
2087
- }
2088
- };
2089
- const storageSet = (key, object, win = window) => {
2090
- try {
2091
- if (!object) {
2092
- win.localStorage.removeItem(STORAGE_NAME_SPACE + key);
2093
- return;
2094
- }
2095
- win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));
2096
- }
2097
- catch (e) {
2098
- throw e;
2099
- }
2100
- };
2101
- const storageGet = (key, win = window) => {
2102
- try {
2103
- const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);
2104
- return configStr !== null ? JSON.parse(configStr) : null;
2105
- }
2106
- catch (e) {
2107
- throw e;
2108
- }
2109
- };
2110
-
2111
- const store = new Map();
2112
- const ComponentStore = {
2113
- init(component, keys, method, id) {
2114
- const getId = id || component.storeId || getElement(component).id;
2115
- if (!getId) {
2116
- console.error('No id set. You can only instantiate a new component store with an id. ');
2117
- return;
2118
- }
2119
- if (store.get(getId)) {
2120
- console.error('Duplicate store id usage. A store ID must be unique!', getId);
2121
- return;
2122
- }
2123
- const initialState = keys.reduce((acc, key) => {
2124
- if (typeof component[key] !== undefined)
2125
- acc[key] = component[key];
2126
- return acc;
2127
- }, {});
2128
- store.set(getId, new Store(getId, component, keys, initialState, method));
2129
- const componentstore = store.get(getId);
2130
- componentstore.dispatchToProps();
2131
- const connectedCallback = component.connectedCallback;
2132
- component.connectedCallback = function () {
2133
- store.set(getId, new Store(getId, component, keys, initialState, method));
2134
- const componentstore = store.get(getId);
2135
- if (connectedCallback) {
2136
- connectedCallback.call(component);
2137
- }
2138
- if (componentstore)
2139
- componentstore.dispatchToProps();
2140
- };
2141
- const componentDidRender = component.componentDidRender;
2142
- component.componentDidRender = function () {
2143
- const componentstore = store.get(getId);
2144
- if (componentDidRender) {
2145
- componentDidRender.call(component);
2146
- }
2147
- if (componentstore)
2148
- componentstore.savePropsToStore();
2149
- };
2150
- const disconnectedCallback = component.disconnectedCallback;
2151
- component.disconnectedCallback = function () {
2152
- const componentstore = store.get(getId);
2153
- if (componentstore)
2154
- componentstore.delete();
2155
- store.delete(getId);
2156
- if (disconnectedCallback) {
2157
- disconnectedCallback.call(component);
2158
- }
2159
- };
2160
- },
2161
- };
2162
- class Store {
2163
- constructor(id, component, keys, initialState, method) {
2164
- this.method = 'session';
2165
- this.initialState = {};
2166
- this.updateStore = true;
2167
- this.onUrlChange = () => {
2168
- this.dispatchToProps(false);
2169
- };
2170
- this.savePropsToStore = () => {
2171
- if (this.updateStore) {
2172
- this.save(this.getData);
2173
- }
2174
- else if (!this.updateStore)
2175
- this.updateStore = true;
2176
- };
2177
- this.dispatchToProps = (updateStore = true) => {
2178
- const savedData = this.retrieve();
2179
- if (!savedData && updateStore)
2180
- return;
2181
- // console.log('dispatching', savedData, this.id, this.initialState);
2182
- this.updateStore = updateStore;
2183
- this.keys.forEach((key) => {
2184
- this.component[key] = savedData ? savedData[key] : undefined;
2185
- });
2186
- };
2187
- this.delete = () => {
2188
- if (this.method === 'url-hash-push' || this.method === 'url-query-push') {
2189
- window.removeEventListener('popstate', this.onUrlChange);
2190
- }
2191
- };
2192
- if (!id)
2193
- throw new Error('No id set. You can only instantiate a new component store with an id');
2194
- this.id = id;
2195
- this.keys = keys;
2196
- this.component = component;
2197
- if (initialState)
2198
- this.initialState = initialState;
2199
- if (method)
2200
- this.method = method;
2201
- this.savePropsToStore = debounce(this.savePropsToStore, 500);
2202
- if (this.method === 'url-hash-push' || this.method === 'url-query-push') {
2203
- window.addEventListener('popstate', this.onUrlChange);
2204
- }
2205
- }
2206
- equality(val1, val2) {
2207
- if (typeof val1 !== typeof val2)
2208
- return false;
2209
- if (typeof val1 !== 'object')
2210
- return val1 === val2;
2211
- return JSON.stringify(val1) === JSON.stringify(val2);
2212
- }
2213
- get getData() {
2214
- const data = this.keys.reduce((acc, key) => {
2215
- const isEqual = this.equality(this.component[key], this.initialState[key]);
2216
- if (typeof this.component[key] !== 'undefined' && !isEqual) {
2217
- acc[key] = this.component[key];
2218
- }
2219
- else if (isEqual)
2220
- delete acc[key];
2221
- return acc;
2222
- }, {});
2223
- return Object.keys(data).length ? data : undefined;
2224
- }
2225
- retrieve() {
2226
- switch (this.method) {
2227
- case 'url-hash':
2228
- case 'url-hash-push':
2229
- return urlGet(this.id, 'hash');
2230
- case 'url-query':
2231
- case 'url-query-push':
2232
- return urlGet(this.id, 'query');
2233
- case 'local':
2234
- return storageGet(this.id);
2235
- default:
2236
- return sessionGet(this.id);
2237
- }
2238
- }
2239
- save(data) {
2240
- switch (this.method) {
2241
- case 'url-hash':
2242
- return urlSet(this.id, data, 'hash');
2243
- case 'url-query':
2244
- return urlSet(this.id, data, 'query');
2245
- case 'url-hash-push':
2246
- return urlSet(this.id, data, 'hash', window, 'push');
2247
- case 'url-query-push':
2248
- return urlSet(this.id, data, 'query', window, 'push');
2249
- case 'local':
2250
- return storageSet(this.id, data);
2251
- default:
2252
- return sessionSet(this.id, data);
2253
- }
2254
- }
2255
- }
2256
-
2257
- export { ComponentStore as C };
2258
-
2259
- //# sourceMappingURL=component-store-c23ebc9c.js.map