@nejs/basic-extensions 2.7.0 → 2.9.0

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 (271) hide show
  1. package/.vscode/settings.json +5 -0
  2. package/README.md +6250 -1574
  3. package/bin/version +100 -0
  4. package/dist/@nejs/basic-extensions.bundle.2.8.0.js +19 -0
  5. package/dist/@nejs/basic-extensions.bundle.2.8.0.js.map +7 -0
  6. package/dist/cjs/array.extensions.d.ts +39 -0
  7. package/dist/cjs/array.extensions.js +303 -0
  8. package/dist/cjs/array.extensions.js.map +1 -0
  9. package/dist/cjs/big.int.extension.d.ts +31 -0
  10. package/dist/cjs/big.int.extension.js +164 -0
  11. package/dist/cjs/big.int.extension.js.map +1 -0
  12. package/dist/cjs/{newClasses → classes}/asyncIterable.js +32 -44
  13. package/dist/cjs/classes/asyncIterable.js.map +1 -0
  14. package/dist/cjs/{newClasses → classes}/deferred.js +66 -138
  15. package/dist/cjs/classes/deferred.js.map +1 -0
  16. package/dist/cjs/{newClasses → classes}/descriptor.js +56 -90
  17. package/dist/cjs/classes/descriptor.js.map +1 -0
  18. package/dist/cjs/classes/index.d.ts +13 -0
  19. package/dist/cjs/classes/index.js +57 -0
  20. package/dist/cjs/classes/index.js.map +1 -0
  21. package/dist/cjs/classes/introspector.d.ts +20 -0
  22. package/dist/cjs/classes/introspector.js +130 -0
  23. package/dist/cjs/classes/introspector.js.map +1 -0
  24. package/dist/cjs/{newClasses → classes}/iterable.js +42 -63
  25. package/dist/cjs/classes/iterable.js.map +1 -0
  26. package/dist/cjs/classes/param.parser.d.ts +227 -0
  27. package/dist/cjs/classes/param.parser.js +242 -0
  28. package/dist/cjs/classes/param.parser.js.map +1 -0
  29. package/dist/cjs/classes/pluggable.proxy.d.ts +152 -0
  30. package/dist/cjs/classes/pluggable.proxy.js +444 -0
  31. package/dist/cjs/classes/pluggable.proxy.js.map +1 -0
  32. package/dist/cjs/{newClasses → classes}/refmap.js +18 -30
  33. package/dist/cjs/classes/refmap.js.map +1 -0
  34. package/dist/cjs/{newClasses → classes}/refset.js +28 -47
  35. package/dist/cjs/classes/refset.js.map +1 -0
  36. package/dist/cjs/classes/symkeys.d.ts +292 -0
  37. package/dist/cjs/classes/symkeys.js +424 -0
  38. package/dist/cjs/classes/symkeys.js.map +1 -0
  39. package/dist/cjs/classes/type.d.ts +56 -0
  40. package/dist/cjs/classes/type.js +405 -0
  41. package/dist/cjs/classes/type.js.map +1 -0
  42. package/dist/cjs/function.extensions.js +757 -0
  43. package/dist/cjs/function.extensions.js.map +1 -0
  44. package/dist/cjs/global.this.js +261 -0
  45. package/dist/cjs/global.this.js.map +1 -0
  46. package/dist/cjs/index.d.ts +4 -3
  47. package/dist/cjs/index.js +62 -32
  48. package/dist/cjs/index.js.map +1 -1
  49. package/dist/cjs/json.extensions.d.ts +2 -0
  50. package/dist/cjs/json.extensions.js +108 -0
  51. package/dist/cjs/json.extensions.js.map +1 -0
  52. package/dist/{mjs/mapextensions.d.ts → cjs/map.extensions.d.ts} +1 -0
  53. package/dist/cjs/map.extensions.js +142 -0
  54. package/dist/cjs/map.extensions.js.map +1 -0
  55. package/dist/cjs/number.extension.d.ts +44 -0
  56. package/dist/cjs/number.extension.js +260 -0
  57. package/dist/cjs/number.extension.js.map +1 -0
  58. package/dist/cjs/object.extensions.d.ts +62 -0
  59. package/dist/cjs/object.extensions.js +1128 -0
  60. package/dist/cjs/object.extensions.js.map +1 -0
  61. package/dist/cjs/proxy.extensions.d.ts +2 -0
  62. package/dist/cjs/proxy.extensions.js +207 -0
  63. package/dist/cjs/proxy.extensions.js.map +1 -0
  64. package/dist/cjs/reflect.extensions.js +316 -0
  65. package/dist/cjs/reflect.extensions.js.map +1 -0
  66. package/dist/cjs/regular.expression.extensions.d.ts +2 -0
  67. package/dist/cjs/regular.expression.extensions.js +423 -0
  68. package/dist/cjs/regular.expression.extensions.js.map +1 -0
  69. package/dist/cjs/set.extensions.d.ts +40 -0
  70. package/dist/cjs/{setextensions.js → set.extensions.js} +150 -2
  71. package/dist/cjs/set.extensions.js.map +1 -0
  72. package/dist/cjs/string.extensions.js +661 -0
  73. package/dist/cjs/string.extensions.js.map +1 -0
  74. package/dist/{mjs/symbolextensions.d.ts → cjs/symbol.extensions.d.ts} +1 -0
  75. package/dist/cjs/symbol.extensions.js +380 -0
  76. package/dist/cjs/symbol.extensions.js.map +1 -0
  77. package/dist/cjs/{weakrefextensions.js → weakref.extensions.js} +1 -1
  78. package/dist/cjs/weakref.extensions.js.map +1 -0
  79. package/dist/mjs/array.extensions.d.ts +39 -0
  80. package/dist/mjs/array.extensions.js +300 -0
  81. package/dist/mjs/array.extensions.js.map +1 -0
  82. package/dist/mjs/big.int.extension.d.ts +31 -0
  83. package/dist/mjs/big.int.extension.js +161 -0
  84. package/dist/mjs/big.int.extension.js.map +1 -0
  85. package/dist/mjs/classes/asyncIterable.js.map +1 -0
  86. package/dist/mjs/classes/deferred.js.map +1 -0
  87. package/dist/mjs/{newClasses → classes}/descriptor.js +7 -4
  88. package/dist/mjs/classes/descriptor.js.map +1 -0
  89. package/dist/mjs/classes/index.d.ts +13 -0
  90. package/dist/mjs/classes/index.js +40 -0
  91. package/dist/mjs/classes/index.js.map +1 -0
  92. package/dist/mjs/classes/introspector.d.ts +20 -0
  93. package/dist/mjs/classes/introspector.js +126 -0
  94. package/dist/mjs/classes/introspector.js.map +1 -0
  95. package/dist/mjs/classes/iterable.js.map +1 -0
  96. package/dist/mjs/classes/param.parser.d.ts +227 -0
  97. package/dist/mjs/classes/param.parser.js +238 -0
  98. package/dist/mjs/classes/param.parser.js.map +1 -0
  99. package/dist/mjs/classes/pluggable.proxy.d.ts +152 -0
  100. package/dist/mjs/classes/pluggable.proxy.js +438 -0
  101. package/dist/mjs/classes/pluggable.proxy.js.map +1 -0
  102. package/dist/mjs/{newClasses → classes}/refmap.js +3 -3
  103. package/dist/mjs/classes/refmap.js.map +1 -0
  104. package/dist/mjs/classes/refset.js.map +1 -0
  105. package/dist/mjs/classes/symkeys.d.ts +292 -0
  106. package/dist/mjs/classes/symkeys.js +420 -0
  107. package/dist/mjs/classes/symkeys.js.map +1 -0
  108. package/dist/mjs/classes/type.d.ts +56 -0
  109. package/dist/mjs/classes/type.js +401 -0
  110. package/dist/mjs/classes/type.js.map +1 -0
  111. package/dist/mjs/function.extensions.js +754 -0
  112. package/dist/mjs/function.extensions.js.map +1 -0
  113. package/dist/mjs/global.this.js +258 -0
  114. package/dist/mjs/global.this.js.map +1 -0
  115. package/dist/mjs/index.d.ts +4 -3
  116. package/dist/mjs/index.js +49 -19
  117. package/dist/mjs/index.js.map +1 -1
  118. package/dist/mjs/json.extensions.d.ts +2 -0
  119. package/dist/mjs/json.extensions.js +105 -0
  120. package/dist/mjs/json.extensions.js.map +1 -0
  121. package/dist/{cjs/mapextensions.d.ts → mjs/map.extensions.d.ts} +1 -0
  122. package/dist/mjs/map.extensions.js +139 -0
  123. package/dist/mjs/map.extensions.js.map +1 -0
  124. package/dist/mjs/number.extension.d.ts +44 -0
  125. package/dist/mjs/number.extension.js +257 -0
  126. package/dist/mjs/number.extension.js.map +1 -0
  127. package/dist/mjs/object.extensions.d.ts +62 -0
  128. package/dist/mjs/object.extensions.js +1124 -0
  129. package/dist/mjs/object.extensions.js.map +1 -0
  130. package/dist/mjs/proxy.extensions.d.ts +2 -0
  131. package/dist/mjs/proxy.extensions.js +204 -0
  132. package/dist/mjs/proxy.extensions.js.map +1 -0
  133. package/dist/mjs/reflect.extensions.js +313 -0
  134. package/dist/mjs/reflect.extensions.js.map +1 -0
  135. package/dist/mjs/regular.expression.extensions.d.ts +2 -0
  136. package/dist/mjs/regular.expression.extensions.js +420 -0
  137. package/dist/mjs/regular.expression.extensions.js.map +1 -0
  138. package/dist/mjs/set.extensions.d.ts +40 -0
  139. package/dist/mjs/{setextensions.js → set.extensions.js} +149 -1
  140. package/dist/mjs/set.extensions.js.map +1 -0
  141. package/dist/mjs/string.extensions.js +658 -0
  142. package/dist/mjs/string.extensions.js.map +1 -0
  143. package/dist/{cjs/symbolextensions.d.ts → mjs/symbol.extensions.d.ts} +1 -0
  144. package/dist/mjs/symbol.extensions.js +377 -0
  145. package/dist/mjs/symbol.extensions.js.map +1 -0
  146. package/dist/mjs/{weakrefextensions.js → weakref.extensions.js} +1 -1
  147. package/dist/mjs/weakref.extensions.js.map +1 -0
  148. package/docs/index.html +24452 -5692
  149. package/package.json +7 -5
  150. package/src/array.extensions.js +322 -0
  151. package/src/big.int.extension.js +163 -0
  152. package/src/{newClasses → classes}/descriptor.js +16 -12
  153. package/src/classes/index.js +51 -0
  154. package/src/classes/introspector.js +167 -0
  155. package/src/classes/param.parser.js +253 -0
  156. package/src/classes/pluggable.proxy.js +485 -0
  157. package/src/{newClasses → classes}/refmap.js +5 -3
  158. package/src/classes/symkeys.js +464 -0
  159. package/src/classes/type.js +427 -0
  160. package/src/function.extensions.js +818 -0
  161. package/src/global.this.js +304 -0
  162. package/src/index.js +56 -23
  163. package/src/json.extensions.js +109 -0
  164. package/src/map.extensions.js +144 -0
  165. package/src/number.extension.js +273 -0
  166. package/src/object.extensions.js +1237 -0
  167. package/src/proxy.extensions.js +229 -0
  168. package/src/reflect.extensions.js +346 -0
  169. package/src/regular.expression.extensions.js +451 -0
  170. package/src/{setextensions.js → set.extensions.js} +151 -2
  171. package/src/string.extensions.js +734 -0
  172. package/src/symbol.extensions.js +389 -0
  173. package/tests/newClasses/refmap.test.js +3 -2
  174. package/tsconfig.base.json +5 -3
  175. package/tsconfig.cjs.json +2 -2
  176. package/tsconfig.esm.json +2 -2
  177. package/dist/@nejs/basic-extensions.bundle.2.6.0.js +0 -17
  178. package/dist/@nejs/basic-extensions.bundle.2.6.0.js.map +0 -7
  179. package/dist/cjs/arrayextensions.d.ts +0 -10
  180. package/dist/cjs/arrayextensions.js +0 -73
  181. package/dist/cjs/arrayextensions.js.map +0 -1
  182. package/dist/cjs/functionextensions.js +0 -202
  183. package/dist/cjs/functionextensions.js.map +0 -1
  184. package/dist/cjs/globals.js +0 -166
  185. package/dist/cjs/globals.js.map +0 -1
  186. package/dist/cjs/mapextensions.js +0 -32
  187. package/dist/cjs/mapextensions.js.map +0 -1
  188. package/dist/cjs/newClasses/asyncIterable.js.map +0 -1
  189. package/dist/cjs/newClasses/deferred.js.map +0 -1
  190. package/dist/cjs/newClasses/descriptor.js.map +0 -1
  191. package/dist/cjs/newClasses/iterable.js.map +0 -1
  192. package/dist/cjs/newClasses/refmap.js.map +0 -1
  193. package/dist/cjs/newClasses/refset.js.map +0 -1
  194. package/dist/cjs/objectextensions.d.ts +0 -11
  195. package/dist/cjs/objectextensions.js +0 -232
  196. package/dist/cjs/objectextensions.js.map +0 -1
  197. package/dist/cjs/reflectextensions.js +0 -111
  198. package/dist/cjs/reflectextensions.js.map +0 -1
  199. package/dist/cjs/setextensions.d.ts +0 -2
  200. package/dist/cjs/setextensions.js.map +0 -1
  201. package/dist/cjs/stringextensions.js +0 -158
  202. package/dist/cjs/stringextensions.js.map +0 -1
  203. package/dist/cjs/symbolextensions.js +0 -69
  204. package/dist/cjs/symbolextensions.js.map +0 -1
  205. package/dist/cjs/weakrefextensions.js.map +0 -1
  206. package/dist/mjs/arrayextensions.d.ts +0 -10
  207. package/dist/mjs/arrayextensions.js +0 -70
  208. package/dist/mjs/arrayextensions.js.map +0 -1
  209. package/dist/mjs/functionextensions.js +0 -199
  210. package/dist/mjs/functionextensions.js.map +0 -1
  211. package/dist/mjs/globals.js +0 -163
  212. package/dist/mjs/globals.js.map +0 -1
  213. package/dist/mjs/mapextensions.js +0 -29
  214. package/dist/mjs/mapextensions.js.map +0 -1
  215. package/dist/mjs/newClasses/asyncIterable.js.map +0 -1
  216. package/dist/mjs/newClasses/deferred.js.map +0 -1
  217. package/dist/mjs/newClasses/descriptor.js.map +0 -1
  218. package/dist/mjs/newClasses/iterable.js.map +0 -1
  219. package/dist/mjs/newClasses/refmap.js.map +0 -1
  220. package/dist/mjs/newClasses/refset.js.map +0 -1
  221. package/dist/mjs/objectextensions.d.ts +0 -11
  222. package/dist/mjs/objectextensions.js +0 -229
  223. package/dist/mjs/objectextensions.js.map +0 -1
  224. package/dist/mjs/reflectextensions.js +0 -108
  225. package/dist/mjs/reflectextensions.js.map +0 -1
  226. package/dist/mjs/setextensions.d.ts +0 -2
  227. package/dist/mjs/setextensions.js.map +0 -1
  228. package/dist/mjs/stringextensions.js +0 -155
  229. package/dist/mjs/stringextensions.js.map +0 -1
  230. package/dist/mjs/symbolextensions.js +0 -66
  231. package/dist/mjs/symbolextensions.js.map +0 -1
  232. package/dist/mjs/weakrefextensions.js.map +0 -1
  233. package/src/arrayextensions.js +0 -75
  234. package/src/functionextensions.js +0 -225
  235. package/src/globals.js +0 -196
  236. package/src/mapextensions.js +0 -32
  237. package/src/objectextensions.js +0 -256
  238. package/src/reflectextensions.js +0 -118
  239. package/src/stringextensions.js +0 -166
  240. package/src/symbolextensions.js +0 -69
  241. /package/dist/cjs/{newClasses → classes}/asyncIterable.d.ts +0 -0
  242. /package/dist/cjs/{newClasses → classes}/deferred.d.ts +0 -0
  243. /package/dist/cjs/{newClasses → classes}/descriptor.d.ts +0 -0
  244. /package/dist/cjs/{newClasses → classes}/iterable.d.ts +0 -0
  245. /package/dist/cjs/{newClasses → classes}/refmap.d.ts +0 -0
  246. /package/dist/cjs/{newClasses → classes}/refset.d.ts +0 -0
  247. /package/dist/cjs/{functionextensions.d.ts → function.extensions.d.ts} +0 -0
  248. /package/dist/cjs/{globals.d.ts → global.this.d.ts} +0 -0
  249. /package/dist/cjs/{reflectextensions.d.ts → reflect.extensions.d.ts} +0 -0
  250. /package/dist/cjs/{stringextensions.d.ts → string.extensions.d.ts} +0 -0
  251. /package/dist/cjs/{weakrefextensions.d.ts → weakref.extensions.d.ts} +0 -0
  252. /package/dist/mjs/{newClasses → classes}/asyncIterable.d.ts +0 -0
  253. /package/dist/mjs/{newClasses → classes}/asyncIterable.js +0 -0
  254. /package/dist/mjs/{newClasses → classes}/deferred.d.ts +0 -0
  255. /package/dist/mjs/{newClasses → classes}/deferred.js +0 -0
  256. /package/dist/mjs/{newClasses → classes}/descriptor.d.ts +0 -0
  257. /package/dist/mjs/{newClasses → classes}/iterable.d.ts +0 -0
  258. /package/dist/mjs/{newClasses → classes}/iterable.js +0 -0
  259. /package/dist/mjs/{newClasses → classes}/refmap.d.ts +0 -0
  260. /package/dist/mjs/{newClasses → classes}/refset.d.ts +0 -0
  261. /package/dist/mjs/{newClasses → classes}/refset.js +0 -0
  262. /package/dist/mjs/{functionextensions.d.ts → function.extensions.d.ts} +0 -0
  263. /package/dist/mjs/{globals.d.ts → global.this.d.ts} +0 -0
  264. /package/dist/mjs/{reflectextensions.d.ts → reflect.extensions.d.ts} +0 -0
  265. /package/dist/mjs/{stringextensions.d.ts → string.extensions.d.ts} +0 -0
  266. /package/dist/mjs/{weakrefextensions.d.ts → weakref.extensions.d.ts} +0 -0
  267. /package/src/{newClasses → classes}/asyncIterable.js +0 -0
  268. /package/src/{newClasses → classes}/deferred.js +0 -0
  269. /package/src/{newClasses → classes}/iterable.js +0 -0
  270. /package/src/{newClasses → classes}/refset.js +0 -0
  271. /package/src/{weakrefextensions.js → weakref.extensions.js} +0 -0
@@ -0,0 +1,389 @@
1
+ import { Patch, PatchToggle } from '@nejs/extension';
2
+
3
+ import { Symkeys } from './classes/symkeys.js'
4
+ import { JSONExtensions } from './json.extensions.js'
5
+
6
+ const JSONToggle = new PatchToggle(JSONExtensions)
7
+
8
+ /**
9
+ * `SymbolExtensions` is a patch for the JavaScript built-in `Symbol` class. It
10
+ * adds utility methods to the `Symbol` class without modifying the global namespace
11
+ * directly. This patch includes methods for key validation, object type checking,
12
+ * and retrieving the string tag of an object. These methods are useful for
13
+ * enhancing the capabilities of the standard `Symbol` class with additional
14
+ * utility functions.
15
+ */
16
+ export const SymbolExtensions = new Patch(Symbol, {
17
+ add(named, associatedData = {}) {
18
+ return this.keys.add(named, associatedData)
19
+ },
20
+
21
+ deleteData(forSymbol, replaceWith = undefined) {
22
+ return this.keys.deleteData(forSymbol, replaceWith)
23
+ },
24
+
25
+ hasData(forSymbol) {
26
+ return this.keys.hasData(forSymbol)
27
+ },
28
+
29
+ /**
30
+ * The `isSymbol` method does exactly what one would it expect. It returns
31
+ * true if the string matches typeof or instanceof as a symbol.
32
+ *
33
+ * @param {*} value checks to see if the `value` is a string
34
+ * @returns {boolean} `true` if it is a `Symbol`, `false` otherwise
35
+ */
36
+ isSymbol(value) {
37
+ return value && (typeof value === 'symbol');
38
+ },
39
+
40
+ /**
41
+ * Returns true if the supplied value is a Symbol created using
42
+ * `Symbol.for()`.
43
+ *
44
+ * @param {any} value assumption is that the supplied value is of type
45
+ * 'symbol' however, unless `allowOnlySymbols` is set to `true`, `false`
46
+ * will be returned for any non-symbol values.
47
+ * @param {boolean} allowOnlySymbols true if an error should be thrown
48
+ * if the supplied value is not of type 'symbol'
49
+ * @returns true if the symbol is registered, meaning, none of the spec
50
+ * static symbols (`toStringTag`, `iterator`, etc...), and no symbols
51
+ * created by passing a value directly to the Symbol function, such as
52
+ * `Symbol('name')`
53
+ */
54
+ isRegistered(value, allowOnlySymbols = false) {
55
+ if (!Symbol.isSymbol(value)) {
56
+ if (allowOnlySymbols) {
57
+ throw new TypeError('allowOnlySymbols specified; value is not a symbol')
58
+ }
59
+ return false
60
+ }
61
+
62
+ return Symbol.keyFor(value) !== undefined
63
+ },
64
+
65
+ /**
66
+ * A function that returns true if the symbol is not registered, meaning,
67
+ * any of the spec static symbols (`toStringTag`, `iterator`, etc...), and
68
+ * any symbols created by passing a value directly to the `Symbol` function,
69
+ * such as `Symbol('name')`.
70
+ *
71
+ * @param {any} value assumption is that the supplied value is of type
72
+ * 'symbol' however, unless allowOnlySymbols is set to true, false will
73
+ * be returned for any non-symbol values.
74
+ * @param {boolean} allowOnlySymbols true if an error should be thrown
75
+ * if the supplied value is not of type 'symbol'
76
+ * @returns true if the symbol is not registered, meaning, any of the
77
+ * spec static symbols (`toStringTag`, `iterator`, etc...), and any symbols
78
+ * created by passing a value directly to the `Symbol` function, such as
79
+ * `Symbol('name')`
80
+ * @returns true if the `value` in question is both a `symbol` and has
81
+ * returns `undefined` if passed to `Symbol.keyFor`
82
+ */
83
+ isNonRegistered(value, allowOnlySymbols = false) {
84
+ return !Symbol.isRegistered(value, allowOnlySymbols)
85
+ },
86
+
87
+ /**
88
+ * `keys` is an instance of the `Symkeys` class, initialized with the
89
+ * domain 'nejs'. The `Symkeys` class provides a way to easily generate
90
+ * Symbol.for elements that follow particular pattern. Symkeys also
91
+ * allows associated data storage with each generated key.
92
+ *
93
+ * @type {Symkeys}
94
+ * @see {@link SymKeys}
95
+ * @example
96
+ * // Returns something like Symbol.for('@nejs.prototype #rwiy2o905d')
97
+ * const kOriginal = Symbol.keys.add('prototypes')
98
+ *
99
+ * // Which can be used to retrieve and fetch data associated with that key
100
+ * // The value stored is an array by default, but can be anything. It can
101
+ * // be accessed one property at a time
102
+ * Symbol.keys[kOriginal].original = Object.prototype
103
+ * Symbol.keys[kOriginal].modified = Object.create(Object.prototype, ...)
104
+ *
105
+ * // Or wholesale replaced
106
+ * Symbol.keys[kOriginal] = [Object.prototype, Array.prototype]
107
+ *
108
+ * // But if all Symbol Extensions are in place, including prototype add-ons
109
+ * kOriginal.data.original = Object.prototype // ...and...
110
+ * kOriginal.data = [Object.prototype, Array.prototype] // ...both work
111
+ */
112
+ keys: new Symkeys('nejs'),
113
+
114
+ setData(forSymbol, value) {
115
+ this.keys.setData(forSymbol, value)
116
+ },
117
+
118
+ /**
119
+ * Creates a new Symbol with the given name and optional data. If data
120
+ * is provided, it will be stringified and appended to the symbol's
121
+ * name. This method is useful for creating unique symbols that carry
122
+ * additional metadata.
123
+ *
124
+ * @param {string} name The name of the symbol.
125
+ * @param {*} [data] Optional data to be associated with the symbol.
126
+ * @returns {symbol} A new symbol created with Symbol.for(), using the
127
+ * provided name and stringified data (if provided).
128
+ *
129
+ * @example
130
+ * const symbolWithData = Symbol.withData('mySymbol', { foo: 'bar' })
131
+ * console.log(symbolWithData.toString())
132
+ * // Output: "Symbol(mySymbol {"foo":"bar"})"
133
+ *
134
+ * @example
135
+ * const symbolWithoutData = Symbol.withData('mySymbol')
136
+ * console.log(symbolWithoutData.toString())
137
+ * // Output: "Symbol(mySymbol)"
138
+ */
139
+ withData(name, data) {
140
+ return data !== undefined
141
+ ? Symbol.for(`${name} ${JSON.stringify(data)}`)
142
+ : Symbol.for(name)
143
+ },
144
+ });
145
+
146
+ export const SymbolPrototypeExtensions = new Patch(Symbol.prototype, {
147
+ [Patch.kMutablyHidden]: {
148
+ /**
149
+ * Returns an object representation of the symbol instance.
150
+ *
151
+ * This getter method creates and returns an object that wraps the
152
+ * symbol instance, allowing it to be treated as an object. The
153
+ * returned object is created using the `Object()` constructor,
154
+ * which takes the symbol instance as its argument.
155
+ *
156
+ * @type {Object}
157
+ * @readonly
158
+ *
159
+ * @example
160
+ * const sym = Symbol('example')
161
+ * console.log(typeof sym) // 'symbol'
162
+ * console.log(typeof sym.instance) // 'object'
163
+ */
164
+ get instance() {
165
+ return Object(this)
166
+ },
167
+
168
+ /**
169
+ * Getter method for retrieving the data associated with a symbol.
170
+ *
171
+ * This method first checks if the symbol is a Symkey created symbol
172
+ * by checking the existence of Symbol.keys and if the symbol's
173
+ * description matches the Symkey pattern. If it is a Symkey symbol,
174
+ * it attempts to fetch its associated data.
175
+ *
176
+ * NOTE: Symkey data is returned as its value directly, this is because
177
+ * it is stored in a {@link Map}. Embedded JSON data might be expensive
178
+ * to parse and as such a function is returned when data is accessed that
179
+ * needs to be invoked in order to decode its contents. See
180
+ * `{@link mightHaveEmbeddedJSON}` for more information.
181
+ *
182
+ * If the symbol is not a Symkey symbol or if no data is associated
183
+ * with it, the method attempts to parse the symbol's description as
184
+ * JSON and returns the first valid JSON object found.
185
+ *
186
+ * If no valid JSON object is found in the description, the method
187
+ * returns undefined.
188
+ *
189
+ * @type {Object|Function}
190
+ * @readonly
191
+ *
192
+ * @example
193
+ * const keys = new Symkeys
194
+ * const key = keys.add('example', {count: 0})
195
+ * const data = key.data // note this isn't function!!
196
+ * const count = data.count
197
+ *
198
+ * @example
199
+ * const sym = Symbol.for('fun {"name":"Brie"}')
200
+ * let json = sym.data() // {name: 'Brie'} JS object
201
+ *
202
+ * @example
203
+ * const sym = Symbol('mySymbol')
204
+ * let data = sym.data() // undefined
205
+ */
206
+ get data() {
207
+ if (Symbol?.keys && Symkeys.isSymkey(this)) {
208
+ const possibleData = Symbol.keys[this]
209
+ if (possibleData) {
210
+ return possibleData
211
+ }
212
+ }
213
+
214
+ let result = undefined;
215
+ let revertToggle = false
216
+ if (!JSONExtensions.applied) {
217
+ JSONToggle.start()
218
+ revertToggle = true
219
+ }
220
+
221
+ if (JSON.mightContain(this.description)) {
222
+ try { result = JSON.extractFrom(this.description) }
223
+ catch (ignore) { }
224
+ }
225
+
226
+ if (revertToggle) {
227
+ JSONToggle.stop()
228
+ }
229
+
230
+ return result
231
+ },
232
+
233
+ /**
234
+ * Sets the data associated with a symbol.
235
+ *
236
+ * This setter method checks if the symbol is a Symkey and if it has
237
+ * associated data. If both conditions are met, it sets the data of the
238
+ * symbol to the provided value and returns true. If the conditions are
239
+ * not met, it simply returns false.
240
+ *
241
+ * While Symbols have been upgraded to also support embedded JSON data
242
+ * with this extension, symbol descriptions are static. Non Symkey symbols
243
+ * do not associated their data outside of a symbol, and cannot be changed,
244
+ * there new data cannot be set on them.
245
+ *
246
+ * @param {any} value - The value to be set as the symbol's data.
247
+ * @returns {boolean} - Returns true if the data was successfully set,
248
+ * false otherwise.
249
+ *
250
+ * @example
251
+ * const sym = Symbol.for('fun {"name":"Brie"}')
252
+ * Symkeys.isSymkey(sym) // false; not in Symkey format
253
+ * let json = sym.data() // {name: 'Brie'} JS object
254
+ * sym.data = JSON.stringify({name: 'Jane'}) // fails silently
255
+ * json = sym.data() // {name: 'Brie'} is hard-coded in description
256
+ *
257
+ * @example
258
+ * const sym = Symbol('mySymbol')
259
+ * Symkeys.isSymkey(sym) // false; not in Symkey format
260
+ * Symkeys.hasData(sym) // false
261
+ * sym.data = { name: 'John', age: 30 } // will fail silently
262
+ * Symkeys.hasData(sym) // still false
263
+ *
264
+ * // Now let's create a Symkey with data
265
+ * const symWithData = Symkeys.create('mySymbolWithData',
266
+ * { name: 'Jane', age: 25 })
267
+ * Symkeys.isSymkey(symWithData) // true
268
+ * Symkeys.hasData(symWithData) // true
269
+ * symWithData.data = { name: 'Jane', age: 26 } // will succeed
270
+ * Symkeys.getData(symWithData) // returns { name: 'Jane', age: 26 }
271
+ */
272
+ set data(value) {
273
+ if (Symkeys.isSymkey(this) && Symkeys.hasData(this)) {
274
+ Symbol.keys.setData(this, value)
275
+ }
276
+ },
277
+
278
+ /**
279
+ * Checks if the symbol might have embedded JSON data.
280
+ *
281
+ * This getter method checks if the symbol's description might contain
282
+ * JSON data and if the data property of the symbol is a function. If both
283
+ * conditions are met, it returns true, otherwise it returns false.
284
+ *
285
+ * @returns {boolean} - Returns true if the symbol might have embedded
286
+ * JSON, false otherwise.
287
+ *
288
+ * @example
289
+ * const sym = Symbol.for('fun {"name":"Brie"}')
290
+ * console.log(sym.mightHaveEmbeddedJSON) // Output: true
291
+ *
292
+ * @example
293
+ * const sym = Symbol('mySymbol')
294
+ * console.log(sym.mightHaveEmbeddedJSON) // Output: false
295
+ */
296
+ get mightHaveEmbeddedJSON() {
297
+ return mightContain(this.description)
298
+ },
299
+
300
+ get sgrString() {
301
+ let revert = false
302
+ let detail = undefined
303
+
304
+ let { sgr } = String
305
+ if (!sgr) { sgr = (string, ...args) => string }
306
+
307
+ if (!JSONExtensions.applied) { JSONToggle.start(); revert = true }
308
+ if ((detail = JSON.mightContain(this.description, true))) {
309
+ let jsonText = detail[2][0]
310
+ let index = detail[1]
311
+
312
+ if (~index && jsonText && jsonText.length > 30) {
313
+ let desc = this.description
314
+ let newDescription = [
315
+ sgr(`Symbol.for(${desc.slice(0, index)}`, 'green'),
316
+ sgr(jsonText.slice(0, 10), 'di'),
317
+ '...',
318
+ sgr(jsonText.slice(-5), 'di'),
319
+ sgr(`${desc.slice(index + jsonText.length + 1)})`, 'green'),
320
+ ].join('')
321
+
322
+ if (revert) { JSONToggle.stop() }
323
+ return `${newDescription}`
324
+ }
325
+ }
326
+
327
+ if (revert) { JSONToggle.stop() }
328
+
329
+ return newDescription
330
+ },
331
+
332
+ /**
333
+ * Custom inspect method for Node.js util.inspect.
334
+ *
335
+ * NOTE: this will only apply if looking at an instance of Symbol,
336
+ * sadly; {@see SymbolPrototypeExtensions.instance}
337
+ *
338
+ * This method is used by Node.js util.inspect to provide a custom
339
+ * representation of the symbol when inspected. It checks if the
340
+ * symbol's description might contain JSON data and if so, it
341
+ * truncates the JSON data in the description to a maximum of 30
342
+ * characters and formats the output with colors using the `sgr`
343
+ * function from the `String` object.
344
+ *
345
+ * @param {number} depth - The current depth of the recursive
346
+ * inspection.
347
+ * @param {Object} options - The options object passed to
348
+ * util.inspect.
349
+ * @param {Function} inspect - The original util.inspect function.
350
+ *
351
+ * @returns {string} - The formatted representation of the symbol.
352
+ *
353
+ * @example
354
+ * const sym = Symbol.for('fun {"name":"John Doe"}')
355
+ * console.log(util.inspect(sym))
356
+ * // Output: Symbol.for(fun {"name":"John ...hn Doe"})
357
+ */
358
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
359
+ let revert = false
360
+ let detail = undefined
361
+
362
+ let { sgr } = String
363
+ if (!sgr) { sgr = (string, ...args) => string }
364
+
365
+ if (!JSONExtensions.applied) { JSONToggle.start(); revert = true }
366
+ if ((detail = JSON.mightContain(this.description, true))) {
367
+ let jsonText = detail[2][0]
368
+ let index = detail[1]
369
+
370
+ if (~index && jsonText && jsonText.length > 30) {
371
+ let desc = this.description
372
+ let newDescription = [
373
+ sgr(`Symbol.for(${desc.slice(0, index)}`, 'green'),
374
+ sgr(jsonText.slice(0, 10), 'di'),
375
+ '...',
376
+ sgr(jsonText.slice(-5), 'di'),
377
+ sgr(`${desc.slice(index + jsonText.length + 1)})`, 'green'),
378
+ ].join('')
379
+
380
+ if (revert) { JSONToggle.stop() }
381
+ return `${newDescription}`
382
+ }
383
+ }
384
+
385
+ if (revert) { JSONToggle.stop() }
386
+ return inspect(this, { colors: true })
387
+ },
388
+ },
389
+ })
@@ -1,5 +1,6 @@
1
- const { Extensions } = require('../../dist/cjs/index.js')
2
- const RefMap = Extensions.RefMap.class
1
+ const { Classes } = require('../../dist/cjs/index.js')
2
+ const { RefMap } = Classes
3
+
3
4
 
4
5
  describe('RefMap', () => {
5
6
  let refMap;
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "allowJs": true,
4
4
  "allowSyntheticDefaultImports": true,
5
- "baseUrl": "src",
5
+ "baseUrl": "./src",
6
6
  "declaration": true,
7
7
  "esModuleInterop": true,
8
8
  "inlineSourceMap": false,
@@ -13,7 +13,7 @@
13
13
  "noFallthroughCasesInSwitch": false,
14
14
  "pretty": true,
15
15
  "resolveJsonModule": true,
16
- "rootDir": "src",
16
+ "rootDir": "./src",
17
17
  "skipLibCheck": true,
18
18
  "sourceMap": true,
19
19
  "strict": true,
@@ -22,5 +22,7 @@
22
22
  },
23
23
  "compileOnSave": false,
24
24
  "exclude": ["node_modules", "dist"],
25
- "include": ["src"]
25
+ "include": [
26
+ "src/**/*.js"
27
+ ]
26
28
  }
package/tsconfig.cjs.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "extends": "./tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
4
+ "module": "CommonJS",
5
5
  "outDir": "dist/cjs",
6
- "target": "es2020"
6
+ "target": "ESNext"
7
7
  }
8
8
  }
package/tsconfig.esm.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "extends": "./tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "esnext",
4
+ "module": "ESNext",
5
5
  "outDir": "dist/mjs",
6
- "target": "esnext"
6
+ "target": "ESNext"
7
7
  }
8
8
  }
@@ -1,17 +0,0 @@
1
- var nejsBasicExtensions=(()=>{var M=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var dt=(r,t)=>{for(var e in t)M(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of pt(t))!ht.call(r,n)&&n!==e&&M(r,n,{get:()=>t[n],enumerable:!(s=ft(t,n))||s.enumerable});return r};var bt=r=>yt(M({},"__esModule",{value:!0}),r);var vt={};dt(vt,{Controls:()=>m,Extensions:()=>P,GlobalFunctionsAndProps:()=>w,InstancePatches:()=>j,Patches:()=>k,StaticPatches:()=>O,all:()=>lt,default:()=>Tt});var mt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],A=class extends Error{constructor(t,e){super(`${mt(t)} disallows tampering with ${e}.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var gt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],R=class extends Error{constructor(t,e){super(`${gt(t)} does not have a property named '${e}'.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var T=class{constructor(t,e=!1){this.started=!1,this.preventRevert=e,this.patch=t,this.patchName=t.owner?.name??t.owner?.constructor?.name??/(\w+)]/.exec(Object.prototype.toString.call(t.owner))[1],this.state={needsApplication:!1,needsReversion:!1}}start(){return this.started||(this.state.needsApplication=!this.patch.applied,this.state.needsReversion=this.patch.applied,this.started=!0,this.state.needsApplication&&this.patch.apply()),this}stop(){return this.started&&((this.preventRevert||this.patch.applied)&&this.patch.revert(),this.state.needsApplication=!1,this.state.needsReversion=!1,this.started=!1),this}get[Symbol.toStringTag](){return`${this.constructor.name}:${this.patchName}`}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n=this[Symbol.toStringTag],i=`(started: ${this.started} needed: ${this.state.needsApplication})`;return s(`${n} ${i}`,{...e,depth:t})}};var S=class{constructor(t,e=globalThis,s=void 0,n={}){let i=u=>u==null,o=(u,f=["string","symbol"])=>!i(u)&&!!f.find(g=>g===typeof u),c=u=>o(u,["object"]);if(!o(t))throw console.error("Property",t,`(type: ${typeof t})`,"owningObject",e,`(type: ${typeof e})`,"condition",s,`(type: ${typeof s})`),new TypeError("Property must be non-null and either a string or symbol");if(!c(e))throw new TypeError("Cannot create Patch entry as owning object is invalid");let l={...Object.getOwnPropertyDescriptor(e,t),...Object(n)};Object.assign(this,{key:t,descriptor:l,owner:e,condition:typeof s=="function"?s:void 0})}get computed(){return this.isAccessor?this.descriptor.get.bind(this.owner).call():this.descriptor.value}get isData(){return Reflect.has(this.descriptor,"value")}get isAccessor(){return Reflect.has(this.descriptor,"get")}get isReadOnly(){return Reflect.has(this.descriptor,"configurable")&&!this.descriptor.configurable||Reflect.has(this.descriptor,"writable")&&!this.descriptor.writable}get isAllowed(){return this.condition&&typeof this.condition=="function"?this.condition():!0}applyTo(t,e=!1){let s={...this.descriptor};e&&(typeof s.get=="function"&&(s.get=s.get.bind(this.owner)),typeof s.set=="function"&&(s.set=s.set.bind(this.owner))),Object.defineProperty(t,this.key,s)}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n=`\x1B[33m${this.key}\x1B[39m`,i=this.isData?" Data":" Accessor",o=this.isReadOnly?" [\x1B[2;3mReadOnly\x1B[22;23m]":"";return`PatchEntry<${n}${i}${o}>`}};var a=class r{patchConflicts=Object.create(null);patchEntries=Object.create(null);patchesOwner=void 0;patchCount=0;patchesApplied=0;ownerDisplayName=void 0;constructor(t,e,s=Object.create(null)){Object.assign(this,{owner:t,options:s}),this.ownerDisplayName=s?.displayName??r.extractName(t),this.patchesOwner=r.constructWithStore(e,this),this.generatePatchEntries(this.patchesOwner),r.patches.has(t)||r.patches.set(t,[]),r.patches.get(t).push(this)}generatePatchEntries(t,e=void 0){let s=this?.options.condition;Reflect.ownKeys(t).forEach(n=>{let i=this?.options?.conditions?.[n]??s;try{let o=e??r.getDescriptorOverridesFromSymbol(n),c=t;if(r.isKnownPatchSymbol(n)){c=r.constructWithStore(t[n],this,n),t[n]=c,this.generatePatchEntries(c,o);return}this.patchEntries[n]=new S(n,t,i,e),this.patchCount+=1}catch(o){console.error(`Failed to process patch for ${String(n)}
2
- `,o)}if(Reflect.has(this.owner,n))try{this.patchConflicts[n]=new S(n,this.owner)}catch(o){console.error(`Cannot capture conflicting patch key ${n}
3
- `,o)}})}get entries(){return Reflect.ownKeys(this.patchEntries).map(t=>[t,this.patchEntries[t]])}get appliedEntries(){return Reflect.ownKeys(this.patchEntries).filter(t=>this.patchState.get(t)===!0).map(t=>[t,this.patchEntries[t]])}get unappliedEntries(){return Reflect.ownKeys(this.patchEntries).filter(t=>this.patchState.get(t)===!1).map(t=>[t,this.patchEntries[t]])}get patches(){return this.entries.reduce((t,[e,s])=>(t[e]=s.computed,t),Object.create(null))}get appliedPatches(){return this.entries.reduce((t,[e,s])=>(this.patchState.get(e)===!0&&(t[e]=s.computed),t),Object.create(null))}get unappliedPatches(){return this.entries.reduce((t,[e,s])=>(this.patchState.get(e)===!1&&(t[e]=s.computed),t),Object.create(null))}get patchKeys(){return this.entries.map(([t,e])=>t)}get prettyEntries(){let t=this.entries.map(([e,s])=>r.stringRef(r.extractName(e),e,s));return Object.defineProperty(t,"asEntries",{get(){return this.map(e=>e.entry)},enumerable:!1,configurable:!0}),t}get conflicts(){return Reflect.ownKeys(this.patchConflicts).map(t=>[t,this.patchConflicts[t]])}get applied(){return this.patchesApplied>0}get isPartiallyPatched(){return this.applied}get isFullyPatched(){return this.patchCount==this.patchesApplied}apply(t){let e=this.entries,s={patches:e.length,applied:0,errors:[],notApplied:e.length};this.patchState.clear(),e.forEach(([,n])=>{if(n.isAllowed){Object.defineProperty(this.owner,n.key,n.descriptor);let i=Object.getOwnPropertyDescriptor(this.owner,n.key);this.#t(i,n.descriptor)?(s.applied+=1,s.notApplied-=1,this.patchState.set(n,!0)):(s.errors.push([n,new Error(`Could not apply patch for key ${n.key}`)]),this.patchState.set(n,!1))}else this.patchState.set(n,!1)}),this.patchesApplied=s.applied,typeof t=="function"&&t(s)}createToggle(t=!1){return new T(this,t)}revert(t){if(!this.applied)return;let e=this.entries,s=this.conflicts,n={patches:e.length,reverted:0,restored:0,conflicts:s.length,errors:[],stillApplied:0};e.forEach(([,i])=>{delete this.owner[i.key]?(this.patchesApplied-=1,n.reverted+=1,this.patchState.set(i,!1)):n.errors.push([i,new Error(`Failed to revert patch ${i.key}`)])}),s.forEach(([,i])=>{Object.defineProperty(this.owner,i.key,i.descriptor);let o=Object.getOwnPropertyDescriptor(this.owner,i.key);this.#t(i.descriptor,o)?n.restored+=1:n.errors.push([i,new Error(`Failed to restore original ${i.key}`)])}),n.stillApplied=this.patchesApplied,typeof t=="function"&&t(n)}release(){let t=r.patches.get(this.owner);t.splice(t.find(e=>e===this),1)}owner=null;options=null;patchState=new Map;[Symbol.iterator](){return this.entries.values()}#t(t,e){return!t||!e?!1:t.configurable===e.configurable&&t.enumerable===e.enumerable&&t.value===e.value&&t.writable===e.writable&&t.get===e.get&&t.set===e.set}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n=this.ownerDisplayName??"",i=n.length?`[\x1B[32m${n}\x1B[39m]`:"",o=this.prettyEntries.map(c=>`\x1B[2;33m${c}\x1B[22;39m`).join(", ");return`${this.constructor.name}${i} { ${o} }`}static patches=new Map;static enableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.apply()}static enableProbableStatics(){for(let t of r.patches.keys())typeof t=="function"&&r.enableFor(t)}static enableProbableInstances(){for(let t of r.patches.keys())typeof t!="function"&&r.enableFor(t)}static enableAll(){for(let t of r.patches.keys())r.enableFor(t)}static disableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.revert()}static disableAll(){for(let t of r.patches.keys())r.disableFor(t)}static disableProbableStatics(){for(let t of r.patches.keys())typeof t=="function"&&r.disableFor(t)}static disableProbableInstances(){for(let t of r.patches.keys())typeof t!="function"&&r.disableFor(t)}static get applied(){return this.#e(globalThis,!0)}static get known(){return this.#e(globalThis,!1)}static get use(){return this.#e(globalThis,!1,!0)}static get lazy(){return this.#e(globalThis,!1,!1,!0)}static scopedTo(t){let e=(s,n,i=!1,o=!1)=>this.#e(s,n,i,o);return{get applied(){return e(t,!0,!1)},get known(){return e(t,!1,!1)},get use(){return e(t,!1,!0)},get lazy(){return e(t,!1,!1,!0)}}}static#e(t,e,s=!1,n=!1){return[...r.patches.values()].flat().filter(i=>i.owner===t).reduce((i,o)=>{for(let[,c]of o.entries)if(!(e&&o.patchState.get(c)!==!0)){if(s){i[c.key]=async l=>{if(typeof l!="function")return;let u=Object.prototype.toString.call(l),f=o.createToggle();f.start(),u==="[object AsyncFunction]"?await l(c.computed,c):l(c.computed,c),f.stop()};continue}if(n){Object.defineProperty(i,c.key,{get(){return o.apply(),c.computed},enumerable:!0,configurable:!0});continue}if(c.isAccessor){let l=`applyAccessorFor_${String(c.key)}`,u={[l](f){return c.applyTo(f),f}};i[c.key]=u[l]}else c.applyTo(i)}return i},Object.create(null))}static get CustomInspect(){return Symbol.for("nodejs.util.inspect.custom")}static stripExtras(t){return t.replaceAll(/^(\x1B\[\d+m)?[\[\{]\s?|\s?[\]\}](\x1B\[\d+m)?$/gm,"$1$2").replaceAll(/['"](.*?)['"]/gm,"$1")}static get kMutablyHidden(){return Symbol.for('{"enumerable":false,"configurable":true}')}static mutablyHidden(t,e=Object.create(null)){return this.customDescriptorPatch(t,this.kMutablyHidden,e)}static get kMutablyVisible(){return Symbol.for('{"enumerable":true,"configurable":true}')}static mutablyVisible(t,e=Object.create(null)){return this.customDescriptorPatch(t,this.kMutablyVisible,e)}static get kImmutablyHidden(){return Symbol.for('{"enumerable":false,"configurable":false}')}static immutablyHidden(t,e=Object.create(null)){return this.customDescriptorPatch(t,this.kImmutablyHidden,e)}static get kImmutablyVisible(){return Symbol.for('{"enumerable":true,"configurable":false}')}static immutablyVisible(t,e=Object.create(null)){return this.customDescriptorPatch(t,this.kImmutablyVisible,e)}static customDescriptorPatch(t,e,s=Object.create(null)){return!this.stores.has(t)&&(this.stores.set(t,s),r.isKnownPatchSymbol(e))?(s[e]=Object.create(null),this.stores.get(t)[e]):this.stores.get(t)}static isKnownPatchSymbol(t){return typeof t=="symbol"?[this.kImmutablyHidden,this.kImmutablyVisible,this.kMutablyHidden,this.kMutablyVisible].some(e=>e===t):!1}static constructWithStore(t,e,s,n=Object.create(null)){if(typeof t!="function")return t;try{let i=r.customDescriptorPatch(e,s,n);return t(i)}catch(i){return console.error(i),t}}static getDescriptorOverridesFromSymbol(t){let e=Object.create(null);return this.isKnownPatchSymbol(t)&&(e=JSON.parse(t.description)),e}static stores=new WeakMap;static stringRef(t,e,s){return Object.assign(Object(t),{get key(){return e},get value(){return s},get entry(){return[e,s]},get entries(){return[this.entry]},valueOf(){return String(this)},[Symbol.toStringTag]:"String",[Symbol.for("nodejs.util.inspect.custom")](i,o,c){return c(String(this),{colors:!0})}})}static shareOwnPropertyNames(t,e){let s=n=>Object.getOwnPropertyNames(Object(n));return s(t).every(n=>s(e??t?.constructor?.prototype).some(i=>i==n))}static extractName(t,e){let s=(o,c)=>o.some(l=>l===c),n;s([Symbol.prototype,Date.prototype,BigInt.prototype],t)||(n=t?.valueOf?.());let i=n&&(n instanceof String||typeof n=="string")?String(n):void 0;return((typeof t=="symbol"?String(t):void 0)??(typeof t=="string"?t:void 0)??(t instanceof String?String(t):void 0))||(t===Function.prototype||typeof t!="function")&&typeof t!="symbol"&&r.shareOwnPropertyNames(t)&&t?.constructor?.name&&`${t.constructor.name}.prototype`||(t?.[Symbol.toStringTag]??t?.name??i??(typeof e=="function"?e(t):void 0)??(typeof e=="string"?e:void 0)??Object.entries({Reflect}).find(([o,c])=>c===t)?.[0]??`Unknown.${Math.random().toString(36).slice(2)}`)}};a.patches[Symbol.for("nodejs.util.inspect.custom")]=function(r,t,e){let s=["Patches [",[...this.entries()].map(([n,i])=>{let o=i.map(c=>`${" ".repeat(2)}${e(c,t)}`).toSorted().join(`
4
- `);return`\x1B[22;1m${a.extractName(n)}\x1B[22m =>
5
- ${o}
6
- `}).toSorted().join(`
7
- `),"]"];return s[1].includes(`
8
- `)?(s[1]=s[1].split(`
9
- `).map(i=>`${" ".repeat(2)}${i}`).join(`
10
- `),s.join(`
11
- `).replace(/\n\s*\n]$/m,`
12
- ]`)):(s[1]||(s[1]="\x1B[2;3mNo patches or extensions yet\x1B[22;23m"),s.join(""))};var St=["number","boolean","bigint","string","symbol"],p=class r extends a{constructor(t,e,s=globalThis,n={}){let i=r.determineInput(t),{key:o,extension:c,valid:l}=i;if(c=e||c,!l)throw new R(s,o);let u=Object.getOwnPropertyDescriptor(s,o);if(u&&(Reflect.has(u,"writable")&&!u.writable||Reflect.has(u,"configurable")&&!u.configurable))throw new A(s,o);super(s,{[o]:c},n),this.key=o,this.class=i.class,this.function=i.function}get isFunction(){return!!this.function}get isClass(){return!!this.class}get isPrimitive(){return~St.indexOf(typeof this.value)}get isObject(){return Object(this.value)===this.value}static get applied(){return a.applied}static get known(){return a.known}static get use(){return a.use}static get lazy(){return a.lazy}static scopedTo(t){return a.scopedTo(t)}static determineInput(t){let e={key:null,extension:null,valid:!1};return t instanceof Function?(e={key:t.name,extension:t,valid:!0},/^class .*/.exec(t.toString())&&(e.class=t),/^(async )?function .*/.exec(t.toString())&&(e.function=t)):(typeof t=="string"||t instanceof String)&&(e={key:t,extension:null,valid:!0}),e}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n={get braces(){return/^(\x1B\[\d+m)?[\[\{]|[\]\}](\x1B\[\d+m)?$/g}};return`Extension[${s(this.patches[this.key],e).replaceAll(n.braces,"$1$2")}]`}get[Symbol.toStringTag](){return this.constructor.name}static createSet(t,...e){return new r.ExtensionSet(t,...e)}static ExtensionSet=class{constructor(e,...s){this.name=e,this.extensionObjects=new Set,this.extensions=new Set;for(let n of s)n instanceof r?(this.extensions.add(n),this.extensionObjects.add(n.patches[n.key])):n instanceof Function&&(this.extensionObjects.add(n),this.extensions.add(new r(n)))}apply(){for(let e of this.extensions)e.apply()}revert(){for(let e of this.extensions)e.revert()}}};var d=new a(Object,{isNullDefined(r){return r==null},hasStringTag(r){return Object.isObject(r)&&Reflect.has(r,Symbol.toStringTag)},getStringTag(r,t=!1){if(Object.hasStringTag(r))return r[Symbol.toStringTag];if(!t)return r&&typeof r=="function"?r.name:/\s(.+)]/.exec(Object.prototype.toString.call(r))[1]},getType(r,t=globalThis){let e=Object.getStringTag(r);switch(e){case"Null":return null;case"Undefined":return;default:return t[e]}},isObject(r){return r&&(r instanceof Object||typeof r=="object")},isPrimitive(r){if(r===null)return!0;switch(typeof r){case"string":case"number":case"bigint":case"boolean":case"undefined":case"symbol":return!0;default:return!1}},isValidKey(r){return typeof r=="string"||typeof r=="symbol"},stripTo(r,t,e=!0){if(!r||typeof r!="object")throw new TypeError("Object.stripTo requires an object to strip. Received",r);let s={};if(!Array.isArray(t))return s;for(let n of t)if(Reflect.has(r,n)){let o={...Object.getOwnPropertyDescriptor(r,n)};(typeof o.get=="function"||typeof o.set=="function")&&e&&(o.get=o.get?.bind(r),o.set=o.set?.bind(r)),Object.defineProperty(s,n,o)}return s}}),Z=d.patches,_=new a(Object.prototype,{[a.kMutablyHidden](r){return{get hasStringTag(){return Z.hasStringTag(this)},getStringTag(t=!1){return Z.getStringTag(this,t)},stripTo(t,e=!0){return Object.stripTo(this,t,e)}}}});var{getStringTag:tt}=d.patches,D=new a(Function,{isAsync(r){let t=/(\w+)]/g.exec(Object.prototype.toString.call(r))[1];return r instanceof Function&&t.includes("Async")},isAsyncGenerator(r){let t=tt(r);return r instanceof Function&&t=="AsyncGeneratorFunction"},isBigArrow(r){return r instanceof Function&&String(r).includes("=>")&&!String(r).startsWith("bound")&&!Reflect.has(r,"prototype")},isBound(r){return r instanceof Function&&String(r).startsWith("bound")&&!Reflect.has(r,"prototype")},isClass(r){return r instanceof Function&&!!/^class\s/.exec(String(r))},isFunction(r){return r instanceof Function&&!Function.isClass(r)},isGenerator(r){let t=tt(r);return r instanceof Function&&t=="GeneratorFunction"}}),et=new a(Function.prototype,{[a.kMutablyHidden]:{get isAsync(){return Function.isAsync(this)},get isAsyncGenerator(){return Function.isAsyncGenerator(this)},get isBigArrow(){return Function.isBigArrow(this)},get isBound(){return Function.isBound(this)},get isClass(){return Function.isClass(this)},get isFunction(){return Function.isFunction(this)},get isGenerator(){return Function.isGenerator(this)}}});var rt=new a(Map.prototype,{[a.kMutablyHidden]:{getKey(r,t=!0){for(let[e,s]of this)return t&&r===s&&!t&&r==s?e:null}}});var st=new a(Set.prototype,{[a.kMutablyHidden]:{concat(...r){for(let t of r){if(typeof t=="string"||!Reflect.has(t,Symbol.iterator)){this.add(t);continue}for(let e of t)this.add(e)}},contains(r){for(let t of this)if(r==t)return!0;return!1},every(r,t){if(typeof r!="function")throw new TypeError(`everyFn must be a function! Received ${String(r)}`);let e=0;for(let s of this)r.call(t,s,NaN,this)&&e++;return e===this.size},find(r,t){if(typeof r!="function")throw new TypeError(`findFn must be a function! Received ${String(r)}`);for(let e of this)if(r.call(t,e,NaN,this))return e},findLast(r,t){if(typeof r!="function")throw new TypeError(`findFn must be a function! Received ${String(r)}`);let e=[];for(let s of this)r.call(t,s,NaN,this)&&e.push(s);if(e.length)return e[e.length-1]},get length(){return this.size},map(r,t){if(typeof r!="function")throw new TypeError(`mapFn must be a function! Received ${String(r)}`);let e=[];for(let s of this)e.push(r.call(t,s,NaN,this));return e},reduce(r,t,e){if(typeof r!="function")throw new TypeError(`reduceFn must be a Function! Received ${String(r)}`);let s=t;for(let n of this)s=r.call(e,s,n,NaN,this);return s},some(r,t){if(typeof r!="function")throw new TypeError(`someFn must be a function! Received ${String(r)}`);for(let e of this)if(r.call(t,e,NaN,this))return!0;return!1}}});var{isObject:nt}=d.patches,$=new a(Reflect,{hasAll(r,...t){return Object.isObject(r)&&t.flat(1/0).map(e=>Reflect.has(r,e)).every(e=>e)},ownDescriptors(r){if(!nt(r))throw new TypeError("The supplied object must be non-null and an object");let t={},e=Reflect.ownKeys(r);for(let s of e)t[s]=Object.getOwnPropertyDescriptor(s);return t},hasSome(r,...t){return nt(r)&&t.flat(1/0).map(e=>Reflect.has(r,e)).some(e=>e)},entries(r){return!r||typeof r!="object"?[]:Reflect.ownKeys(r).map(t=>[t,Object.getOwnPropertyDescriptor(r,t)])},values(r){return Reflect.entries.map(([,t])=>t)}});var xt=["(",")"],it=new a(String,{isString(r){return r&&(typeof r=="string"||r instanceof String)?r.length>0:!1},get parenthesisPair(){return["(",")"]},get squareBracketsPair(){return["[","]"]},get curlyBracketsPair(){return["{","}"]}}),ot=new a(String.prototype,{[a.kMutablyHidden]:{extractSubstring(r=0,t=xt){let[e,s]=t,n=0,i=-1,o=-1,c="",l=0;for(let h=r;h<this.length;h++){let b=this[h];if(b===e)n++,i===-1&&(i=h);else if(b===s&&(n--,n===0)){o=h;break}}let u=[Math.max(0,i-100),i],f=[...this.substring(u[0],u[1])].reverse().join(""),g;try{g=/([^ \,\"\'\`]+)/.exec(f)[1]??"",c=[...g].reverse().join("")}catch{}if(i!==-1&&o!==-1){let h=[i,o+1];return{extracted:this.slice(h[0],h[1]),range:[i,o],newOffset:o+1,leadingToken:c}}else return{extracted:null,range:[i,o],newOffset:r,leadingToken:c}}}});var N=new a(Symbol,{isSymbol(r){return r&&typeof r=="symbol"},isRegistered(r,t=!1){if(!Symbol.isSymbol(r)){if(t)throw new TypeError("allowOnlySymbols specified; value is not a symbol");return!1}return Symbol.keyFor(r)!==void 0},isNonRegistered(r,t=!1){return!Symbol.isRegistered(r,t)}});var ct=new a(Array.prototype,{[a.kMutablyHidden]:{contains(r){return!!this.find(t=>t===r)},findEntry(r){let t=this.entries(),e=1;for(let s of t)if(r(s[e]))return s},get first(){return this[0]},get last(){return this[this.length-1]}}});var{isObject:y,isValidKey:V}=d.patches,{hasSome:G}=$.patches,x=class r{#t=void 0;#e=void 0;constructor(t,e){if((t??e)===void 0?this.#t=r.enigmatic:r.isDescriptor(t)?(this.#t=t,this.#e=y(e)?e:void 0):y(t)&&V(e)&&(this.#t=Object.getOwnPropertyDescriptor(t,e),this.#e=t),!this.isDescriptor)throw console.error(`
13
- Descriptor(object,key) FAILED:
14
- object: ${t===globalThis?"[GLOBAL]":typeof e=="object"?JSON.stringify(t):String(t)}
15
- key: ${e===globalThis?"[GLOBAL]":typeof e=="object"?JSON.stringify(e):String(e)}
16
- descriptor: `,this.#t),new Error("Not a valid descriptor:",this.#t)}get isAccessor(){return r.isAccessor(this.#t)}get isData(){return r.isData(this.#t)}get isDescriptor(){return r.isDescriptor(this.#t)}get configurable(){return!!this.#t?.configurable}set configurable(t){(this.#t||{}).configurable=!!t}get enumerable(){return this.#t?.enumerable}set enumerable(t){(this.#t||{}).enumerable=t}get writable(){return this.#t?.writable}set writable(t){(this.#t||{}).writable=t}get value(){return this.#t?.value}set value(t){(this.#t||{}).value=t}get get(){return this.#t?.get}get boundGet(){return y(this.#e)?this.get?.bind(this.#e):this.get}set get(t){(this.#t||{}).get=t}get set(){return(this.#t||{}).set}get boundSet(){return y(this.#e)?this.set?.bind(this.#e):this.set}set set(t){(this.#t||{}).set=t}get hasObject(){return y(this.#e)}get object(){return this.#e}set object(t){this.#e=Object(t)}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){return`Descriptor${this.isAccessor?" (Accessor)":this.isData?" (Data)":""} ${s(this.#t,{...e,depth:t})}`}static for(t,e,s=!1){return!y(t)||!V(e)||!Reflect.has(t,e)?null:s?new r(Object.getOwnPropertyDescriptor(t,e)):Object.getOwnPropertyDescriptor(t,e)}applyTo(t,e,s=!1){if(!y(t)||!V(e))throw new Error("Cannot apply descriptor to non-object or invalid key");return Object.defineProperty(t,e,this.toObject(s))}toObject(t=!1){let e={...this.#t};return t&&this.isAccessor&&(this.hasObject?e={...e,get:this.boundGet,set:this.boundSet}:y(t)&&(e={...e,get:this.get?.bind(t),set:this.set?.bind(t)})),e}[Symbol.toPrimitive](t){switch(t){case"string":if(this.isAccessor){let e=Reflect.has(this.#t,"get")?"getter":"",s=Reflect.has(this.#t,"set")?"setter":"";return`Accessor (${e}${e&&s?", ":""}${s})`}else if(this.isData){let e=Reflect.has(this.#t,"value")?"value":"",s=Reflect.has(this.#t,"writable")?"writable":"";return`Data (${e}${e&&s?", ":""}${s})`}break;case"number":return NaN;default:return this.toObject()}}get[Symbol.toStringTag](){return this.constructor.name}static getData(t,e){if(!y(t)||!Reflect.has(t,e))return;let s=r.for(t,e,!0);return s.isData?s.value:null}static getAccessor(t,e){if(!y(t)||!Reflect.has(t,e))return;let s=r.for(t,e,!0);return s.isAccessor?s.get.bind(t)():null}static base(t=!1,e=!1){return{enumerable:t,configurable:e}}static accessor(t,e,{enumerable:s,configurable:n}=r.base()){return{get:t,set:e,enumerable:s,configurable:n}}static data(t,e=!0,{enumerable:s,configurable:n}=r.base()){return{value:t,enumerable:s,writable:e,configurable:n}}static isDescriptor(t){let e=[...r.SHARED_KEYS,...r.ACCESSOR_KEYS,...r.DATA_KEYS];return G(t,e)}static isData(t,e){let n=(typeof t=="object"||t instanceof Object)&&e instanceof String?r.for(t,e):t,{DATA_KEYS:i}=this,o=!1;return G(n,i)&&(o=!0),o}static isAccessor(t,e){let n=t&&e&&(typeof t=="object"||t instanceof Object)&&(e instanceof String||typeof e=="symbol")?r.for(t,e):t,{ACCESSOR_KEYS:i}=this,o=!1;return G(n,i)&&(o=!0),o}static get flexible(){return this.base(!0,!0)}static get enigmatic(){return this.base(!1,!0)}static get intrinsic(){return this.base(!1,!1)}static get transparent(){return this.base(!0,!1)}static get SHARED_KEYS(){return["configurable","enumerable"]}static get ACCESSOR_KEYS(){return["get","set"]}static get DATA_KEYS(){return["value","writable"]}},C=new p(x);var{isClass:wt,isFunction:F}=D.patches,Et=Symbol.for("nodejs.util.inspect.custom"),w=new a(globalThis,{maskAs(r,t,e){let{prototype:s,toPrimitive:n}=GenericMask({...e,prototype:t}),i={configurable:!0,enumerable:!1},o=F(s)?s.prototype:s,c=wt(s)?s:o?.constructor;return!c&&!o?null:(Object.setPrototypeOf(r,o),Object.defineProperties(r,{valueOf:{value(){return String(n("default",r))},...i},[Symbol.toPrimitive]:{value(l){return n(l,r)},...i},[Symbol.toStringTag]:{value:c.name,...i},[Symbol.species]:{get(){return c},...i},[Et]:{...i,value(l,u,f){return f(this[Symbol.toPrimitive](),{...u,depth:l})}}}),r)},maskAsString(r,t,e){return r&&Reflect.has(r,t)?maskAs(r,StringMask(t??"value",e)):null},maskAsNumber(r,t,e){return r&&Reflect.has(r,t)?maskAs(r,NumberMask(t??"value",e)):null},GenericMask({prototype:r,targetKey:t="value",toPrimitive:e}){let s={targetKey:t,toPrimitive:e,prototype:r};return F(e)||(s.toPrimitive=(n,i)=>{let o=i[t],c=typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&!isNaN(parseFloat(o))&&isFinite(o);switch(n){case"string":return c?String(o):o??String(i);case"number":return c?Number(o):NaN;case"default":default:return c?Number(o):o}}),s},StringMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:String.prototype};return F(t)||(e.toPrimitive=function(n,i){switch(n){case"default":return i[r];case"number":return parseInt(i[r],36);case"string":return String(i[r]);default:return i}}),e},NumberMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:Number.prototype};return F(t)||(e.toPrimitive=function(n,i){switch(n){case"default":return i[r];case"number":return Number(i[r]);case"string":return String(i[r]);default:return i}}),e}});var B=class r extends Set{#t=!1;objectifying(t=!0){return this.objectifyValues=t,this}get objectifyValues(){return this.#t}set objectifyValues(t){this.#t=!!t}add(t){if(this.#t&&(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||typeof t=="bigint")&&(t=Object(t)),typeof t=="symbol"&&Symbol.keyFor(t)!==void 0)throw new TypeError("RefSet cannot accept registered symbols as values");if(typeof t!="object"&&typeof t!="symbol")throw new TypeError("RefSet values must be objects, non-registered symbols, or objectified primitives");if(t==null)throw new TypeError("RefSet values cannot be null or undefined");super.add(new WeakRef(t))}addAll(t){if(!t||typeof t!="object"||!Reflect.has(t,Symbol.iterator))throw new TypeError("The supplied values are either falsey or non-iterable");for(let e of t)this.add(e)}clean(){for(let t of this)t.deref()||this.delete(t);return this}entries(){return Array.from(super.entries()).map(([e,s])=>[s.deref(),s.deref()]).filter(([e,s])=>!!s)}forEach(t,e){let s=this;super.forEach(function(n){let i=n.deref();i&&t.call(e,i,i,s)})}values(){let t=[];for(let e of this){let s=e.deref();s&&t.push(s)}return t}keys(){return this.values()}has(t){if(this.#t)return this.contains(t);for(let e of this.values())if(e===t)return!0;return!1}contains(t){return!!Array.from(this.values()).filter(e=>t==e).length}filter(t,e){let s=[];for(let n of this){let i=n?.deref();i&&t.call(e,i,NaN,this)&&s.push(i)}return s}find(t,e){for(let s of this){let n=s?.deref();if(n&&t.call(e,n,NaN,this))return n}}map(t,e,s,n){let i=[],o=!0,c=!0;for(let l of this){let u=l?.deref();if(u){let f=t.call(e,u,NaN,this);(o||c)&&(this.#e(f)||(o=!1,c&&(c=this.#e(Object(f))))),i.push(f)}}if(s){if(o)return new r(i).objectifying(n?this.objectifyValues:!1);if(c)return new r(i.map(l=>this.#e(l)?l:Object(l))).objectifying()}return i}get[Symbol.toStringTag](){return this.constructor.name}#e(t){return!(typeof t=="symbol"&&Symbol.keyFor(t)===void 0||typeof t!="object"&&typeof t!="symbol"||t==null)}},K=new p(B);var at=new a(WeakRef,{isValidReference(r){return!(typeof r=="symbol"&&Symbol.keyFor(r)===void 0||typeof r!="object"&&typeof r!="symbol"||r==null)}});var v=class{#t=[];constructor(t,...e){t!=null&&typeof t[Symbol.iterator]=="function"?this.#t=[...t,...e]:this.#t=[t,...e]}*[Symbol.iterator](){for(let t of this.#t)yield t}get asArray(){return this.#t}get[Symbol.toStringTag](){return this.constructor.name}static isIterable(t){return Object.prototype.toString.call(t?.[Symbol.iterator])==="[object GeneratorFunction]"}},E=class{#t=void 0;constructor(t,e){if(!t||!Reflect.has(t,Symbol.iterator))throw new TypeError("Value used to instantiate Iterator is not iterable");this.#e=t,this.#r=t[Symbol.iterator](),this.#t=typeof e=="function"?e:void 0}get asArray(){return Array.from(this.#e)}get iterable(){return this.#e}next(){let t=this.#r.next(),e=t;return e.done?{value:void 0,done:!0}:(this.#t&&typeof this.#t=="function"&&(e.value=this.#t(t.value)),{value:e.value,done:!1})}reset(){this.#r=this.#e[Symbol.iterator]()}[Symbol.iterator](){return this}get[Symbol.toStringTag](){return this.constructor.name}#e=null;#r=null},H=new p(v),W=new p(E);var{isObject:Ot,isNullDefined:jt,isValidKey:Pt}=d.patches,{isRegistered:At}=N.patches,{isValidReference:ut}=at.patches,L=class r extends Map{#t=!1;constructor(...t){super(...t)}objectifying(t=!0){return this.objectifyValues=t,this}asObject(){let t={};for(let[e,s]of this){let n=Pt(e)?e:String(e),i=s?.valueOf()||s;t[n]=i}return t}get objectifyValues(){return this.#t}get(t,e){let s=super.get(t);return!s||!s?.deref()?e:s?.deref()}set objectifyValues(t){this.#t=!!t}set(t,e){let s=e;if(this.#t&&(typeof s=="number"||typeof s=="string"||typeof s=="boolean"||typeof s=="bigint")&&(s=Object(s)),typeof s=="symbol"&&Symbol.keyFor(s)!==void 0)throw new TypeError("RefMap cannot accept registered symbols as values");if(typeof s!="object"&&typeof s!="symbol")throw new TypeError("RefMap values must be objects, non-registered symbols, or objectified primitives");if(s==null)throw new TypeError("RefMap values cannot be null or undefined");let n=new WeakRef(s);super.set(t,n)}setAll(t){if(!v.isIterable(t))throw new TypeError("The supplied list of entries must be an array of arrays in the format [[key1, value1], [key2, value2], ...].");let e=s=>{let[n,i]=s;!n||!Ot(i)||!At(i)||this.set(n,i)};for(let s of t)e(s);return this}clean(){for(let[t,e]of this)e||this.delete(t);return this}entries(){let t=super.entries();return new E(t,s=>{if(s){let[n,i]=s,o=i?.deref();return[n,o]}return s})}forEach(t,e){for(let[s,n]of super.entries()){let i=n?.deref();i&&t.call(e,i,s,this)}}values(){return new E(super.values(),function(e){return e?.deref()||e})}hasValue(t,e=!0){if(jt(t))return!1;this.#t&&(e=!1);for(let[s,n]of this)if(e&&t===n||!e&&t==n)return!0;return!1}filter(t,e){let s=[];for(let[n,i]of this)t.call(e,i,n,this)&&s.push([n,i]);return s}find(t,e){for(let[s,n]of this){let i=super.get(s),o=t.call(e,i,s,map);if(o||(o=t.call(e,n,s,map)),o)return n}return null}map(t,e,s,n){if(typeof t!="function")throw new TypeError("mapFn must be a function! Received",t);let i=[],o=[],c=n&&this.objectifyValues,l=n===void 0,u=c;for(let[f,g]of this){let[,h]=[0,1],b=t.call(e,[f,g],f,this);ut(b[h])||ut(Object(b[h]))&&(c=!0,l&&!u&&(u=!0,b[h]=Object(b[h]))),i.push(b)}return s?new r(i).objectifying(u):i}*[Symbol.iterator](){for(let[t,e]of this.entries())yield[t,e]}get[Symbol.toStringTag](){return this.constructor.name}},Y=new p(L);var z=class r extends Promise{#t=null;#e=null;#r=null;#n=!1;#i=!1;value=null;reason=null;#s=!1;constructor(t){let e=t&&typeof t=="object"?t:{};if(e?.resolve&&e?.reject)throw new TypeError("resolve and reject options cannot be simultaneously provided");let s,n;super((i,o)=>{s=i,n=o,e?.executor&&typeof e?.executor=="function"&&e?.executor(i,o)}),this.#r=i=>(e?.doNotTrackAnswers!==!0&&(this.value=i),this.#s=!0,this.#i=!0,s(i)),this.#e=async i=>(e?.doNotTrackAnswers!==!0&&(this.reason=i),this.#s=!0,this.#n=!0,n(i)),this.#t=this,e?.resolve?this.#r(e?.resolve):e?.reject&&this.#e(e?.reject)}get settled(){return this.#s}get wasRejected(){return this.#n}get wasResolved(){return this.#i}get promise(){return this.#t}resolve(t){return this.#r(t)}reject(t){return this.#e(t)}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){return["\x1B[1mDeferred [\x1B[22;3mPromise\x1B[23;1m]\x1B[22m ","{ ",this.settled?this.wasResolved?`resolved with \x1B[32m${this.value}\x1B[39m`:`rejected with \x1B[31m${this.reason?.message??this.reason}\x1B[39m`:"\x1B[33munsettled valued or reason\x1B[39m"," }"].join("")}static get[Symbol.species](){return class extends r{constructor(e){super({executor:e})}}}},U=new p(z);var q=class{#t=[];constructor(t,...e){t!=null&&(typeof t[Symbol.iterator]=="function"||typeof t[Symbol.asyncIterator]=="function")?this.#t=[...t,...e]:typeof t=="function"&&t.constructor.name==="AsyncGeneratorFunction"?this.#t=t():this.#t=[t,...e]}async*[Symbol.asyncIterator](){for await(let t of this.#t)yield t}get[Symbol.toStringTag](){return this.constructor.name}static isAsyncIterable(t){return Object.prototype.toString.call(t?.[Symbol.asyncIterator])==="[object AsyncGeneratorFunction]"}},J=class{constructor(t){if(typeof t=="function"&&t.constructor.name==="AsyncGeneratorFunction")this.#t=t();else{if(!t||!Reflect.has(t,Symbol.asyncIterator))throw new TypeError("Value used to instantiate AsyncIterator is not an async iterable");this.#t=t}this.#e=this.#t[Symbol.asyncIterator]()}async asArray(){let t=[];for await(let e of this)t.push(e);return t}get asyncIterable(){return this.#t}async next(){let t=await this.#e.next();return t.done?{value:void 0,done:!0}:{value:t.value,done:!1}}async reset(){this.#e=this.#t[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this}get[Symbol.toStringTag](){return this.constructor.name}#t=null;#e=null},Q=new p(q),X=new p(J);var O=[[Object,d,Object.name],[Function,D,Function.name],[Reflect,$,"Reflect"],[String,it,String.name],[Symbol,N,"Symbol"]],j=[[Object.prototype,_,Object.name],[String.prototype,ot,String.name],[Function.prototype,et,Function.name],[Array.prototype,ct,Array.name],[Map.prototype,rt,Map.name],[Set.prototype,st,Set.name]],k=new Map([...O,...j]),P={[Q.key]:Q,[X.key]:X,[U.key]:U,[C.key]:C,[H.key]:H,[W.key]:W,[Y.key]:Y,[K.key]:K},m={};Object.assign(m,{enableAll(){m.enablePatches(),m.enableExtensions()},enablePatches(){k.forEach(r=>{r.apply()})},enableStaticPatches(r=([t,e])=>!0){let t=O.filter(I(r));return t.forEach(([e,s])=>s.apply()),t},enableInstancePatches(r=([t,e])=>!0){let t=j.filter(I(r));return t.forEach(([e,s])=>s.apply()),t},enableExtensions(){Object.values(P).forEach(r=>{r.apply()}),w.apply()},disableAll(){m.disablePatches(),m.disableExtensions()},disablePatches(){k.forEach(r=>{r.revert()})},disableStaticPatches(r=([t,e])=>!0){let t=O.filter(I(r));return t.forEach(([e,s])=>s.revert()),t},disableInstancePatches(r=([t,e])=>!0){let t=j.filter(I(r));return t.forEach(([e,s])=>s.revert()),t},disableExtensions(){Object.values(P).forEach(r=>{r.revert()}),w.revert()}});var lt=(()=>{let r={patches:{},classes:{},global:{}},t=(n,[i,o])=>(new x(o.descriptor,o.owner).applyTo(n,i,!0),n),e=(n,[i,o,c])=>(n?.[c]||(n[c]={}),[...o].reduce(t,n[c]),n),s=(n,[i,o,c])=>(n?.[c]||(n[c]={}),n[c]?.prototype||(n[c].prototype={}),[...o].reduce(t,n[c].prototype),n);O.reduce(e,r.patches),j.reduce(s,r.patches),Object.values(P).flatMap(n=>[...n]).reduce(t,r.classes);for(let[n,i]of w){let o=new x(i.descriptor,i.owner);Object.defineProperty(r.global,n,o.toObject(!0))}return r})(),Rt={...m,Extensions:P,Patches:k,GlobalFunctionsAndProps:w,StaticPatches:O,InstancePatches:j,Controls:m,extensions:P,patches:k,all:lt},Tt=Rt;function I(r=([t,e])=>!0){let t=r;if(typeof t!="function"){let e=Array.isArray(r)?r:[r];t=([s,n])=>{for(let i of e){let o=String(i);if(o.startsWith("^")&&(s?.name??s)!=o.substring(1)||(s?.name??s)==o)return!0}return!1}}return t}return bt(vt);})();
17
- //# sourceMappingURL=basic-extensions.bundle.2.6.0.js.map