@nejs/basic-extensions 1.10.0 → 2.0.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.
- package/README.md +91 -60
- package/dist/@nejs/basic-extensions.bundle.1.10.0.js +8 -0
- package/dist/@nejs/basic-extensions.bundle.1.10.0.js.map +7 -0
- package/dist/cjs/index.d.ts +10 -6
- package/dist/cjs/index.js +48 -26
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/newClasses/asyncIterable.d.ts +16 -13
- package/dist/cjs/newClasses/asyncIterable.js +34 -19
- package/dist/cjs/newClasses/asyncIterable.js.map +1 -1
- package/dist/cjs/newClasses/descriptor.d.ts +31 -10
- package/dist/cjs/newClasses/descriptor.js +70 -19
- package/dist/cjs/newClasses/descriptor.js.map +1 -1
- package/dist/mjs/index.d.ts +10 -6
- package/dist/mjs/index.js +47 -26
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/newClasses/asyncIterable.d.ts +16 -13
- package/dist/mjs/newClasses/asyncIterable.js +34 -19
- package/dist/mjs/newClasses/asyncIterable.js.map +1 -1
- package/dist/mjs/newClasses/descriptor.d.ts +31 -10
- package/dist/mjs/newClasses/descriptor.js +57 -13
- package/dist/mjs/newClasses/descriptor.js.map +1 -1
- package/docs/index.html +324 -192
- package/package.json +3 -3
- package/src/index.js +55 -27
- package/src/newClasses/asyncIterable.js +35 -20
- package/src/newClasses/descriptor.js +62 -15
- package/dist/@nejs/basic-extensions.bundle.1.9.0.js +0 -4
- package/dist/@nejs/basic-extensions.bundle.1.9.0.js.map +0 -7
package/package.json
CHANGED
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"test": "jest"
|
|
59
59
|
},
|
|
60
60
|
"type": "module",
|
|
61
|
-
"version": "
|
|
61
|
+
"version": "2.0.0",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@nejs/extension": "^2.
|
|
63
|
+
"@nejs/extension": "^2.5.0"
|
|
64
64
|
},
|
|
65
|
-
"browser": "dist/@nejs/basic-extensions.bundle.1.
|
|
65
|
+
"browser": "dist/@nejs/basic-extensions.bundle.1.10.0.js"
|
|
66
66
|
}
|
package/src/index.js
CHANGED
|
@@ -23,19 +23,19 @@ import {
|
|
|
23
23
|
} from './newClasses/iterable.js'
|
|
24
24
|
|
|
25
25
|
const StaticPatches = [
|
|
26
|
-
[Object, ObjectExtensions],
|
|
27
|
-
[Function, FunctionExtensions],
|
|
28
|
-
[Reflect, ReflectExtensions],
|
|
29
|
-
[String, StringExtensions],
|
|
30
|
-
[Symbol, SymbolExtensions],
|
|
26
|
+
[Object, ObjectExtensions, Object.name],
|
|
27
|
+
[Function, FunctionExtensions, Function.name],
|
|
28
|
+
[Reflect, ReflectExtensions, 'Reflect'], // Missing a .name property
|
|
29
|
+
[String, StringExtensions, String.name],
|
|
30
|
+
[Symbol, SymbolExtensions, 'Symbol'], // Missing a .name property
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
const InstancePatches = [
|
|
34
|
-
[Object.prototype, ObjectPrototypeExtensions],
|
|
35
|
-
[Function.prototype, FunctionPrototypeExtensions],
|
|
36
|
-
[Array.prototype, ArrayPrototypeExtensions],
|
|
37
|
-
[Map.prototype, MapPrototypeExtensions],
|
|
38
|
-
[Set.prototype, SetPrototypeExtensions],
|
|
34
|
+
[Object.prototype, ObjectPrototypeExtensions, Object.name],
|
|
35
|
+
[Function.prototype, FunctionPrototypeExtensions, Function.name],
|
|
36
|
+
[Array.prototype, ArrayPrototypeExtensions, Array.name],
|
|
37
|
+
[Map.prototype, MapPrototypeExtensions, Map.name],
|
|
38
|
+
[Set.prototype, SetPrototypeExtensions, Set.name],
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
const Patches = new Map([
|
|
@@ -44,8 +44,6 @@ const Patches = new Map([
|
|
|
44
44
|
])
|
|
45
45
|
|
|
46
46
|
const Extensions = {
|
|
47
|
-
global: GlobalFunctionsAndProps,
|
|
48
|
-
|
|
49
47
|
[AsyncIterableExtensions.key]: AsyncIterableExtensions,
|
|
50
48
|
[AsyncIteratorExtensions.key]: AsyncIteratorExtensions,
|
|
51
49
|
[DeferredExtension.key]: DeferredExtension,
|
|
@@ -82,6 +80,7 @@ Object.assign(Controls, {
|
|
|
82
80
|
|
|
83
81
|
enableExtensions() {
|
|
84
82
|
Object.values(Extensions).forEach((extension) => { extension.apply() })
|
|
83
|
+
GlobalFunctionsAndProps.apply()
|
|
85
84
|
},
|
|
86
85
|
|
|
87
86
|
disableAll() {
|
|
@@ -107,37 +106,65 @@ Object.assign(Controls, {
|
|
|
107
106
|
|
|
108
107
|
disableExtensions() {
|
|
109
108
|
Object.values(Extensions).forEach((extension) => { extension.revert() })
|
|
109
|
+
GlobalFunctionsAndProps.revert()
|
|
110
110
|
},
|
|
111
111
|
})
|
|
112
112
|
|
|
113
113
|
export const all = (() => {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
const dest = {
|
|
115
|
+
patches: {},
|
|
116
|
+
classes: {},
|
|
117
|
+
global: {},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const entriesReducer = (accumulator, [key, entry]) => {
|
|
121
|
+
const descriptor = new Descriptor(entry.descriptor, entry.owner)
|
|
118
122
|
|
|
119
|
-
|
|
120
|
-
Reflect.ownKeys(extension.patchEntries).reduce((_, key) => {
|
|
121
|
-
const entry = extension.patchEntries[key]
|
|
123
|
+
descriptor.applyTo(accumulator, key, true)
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
else
|
|
126
|
-
accumulator[key] = entry.computed
|
|
125
|
+
return accumulator
|
|
126
|
+
}
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const staticPatchReducer = (accumulator, [_, patch, ownerName]) => {
|
|
129
|
+
if (!accumulator?.[ownerName]) {
|
|
130
|
+
accumulator[ownerName] = {}
|
|
131
|
+
}
|
|
130
132
|
|
|
133
|
+
[...patch].reduce(entriesReducer, accumulator[ownerName])
|
|
131
134
|
return accumulator
|
|
132
|
-
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const instancePatchReducer = (accumulator, [_, patch, ownerName]) => {
|
|
138
|
+
if (!accumulator?.[ownerName])
|
|
139
|
+
accumulator[ownerName] = {};
|
|
140
|
+
|
|
141
|
+
if (!accumulator[ownerName]?.prototype)
|
|
142
|
+
accumulator[ownerName].prototype = {};
|
|
143
|
+
|
|
144
|
+
[...patch].reduce(entriesReducer, accumulator[ownerName].prototype)
|
|
145
|
+
return accumulator
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
StaticPatches.reduce(staticPatchReducer, dest.patches);
|
|
149
|
+
InstancePatches.reduce(instancePatchReducer, dest.patches);
|
|
150
|
+
(Object.entries(Extensions)
|
|
151
|
+
.map(([k,v]) => [k, v, k])
|
|
152
|
+
.reduce(staticPatchReducer, dest.classes)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
for (const [key, entry] of GlobalFunctionsAndProps) {
|
|
156
|
+
const descriptor = new Descriptor(entry.descriptor, entry.owner)
|
|
157
|
+
Object.defineProperty(dest.global, key, descriptor.toObject(true))
|
|
158
|
+
}
|
|
133
159
|
|
|
134
|
-
return dest
|
|
160
|
+
return dest
|
|
135
161
|
})()
|
|
136
162
|
|
|
137
163
|
const results = {
|
|
138
164
|
...Controls,
|
|
139
165
|
Extensions,
|
|
140
166
|
Patches,
|
|
167
|
+
GlobalFunctionsAndProps,
|
|
141
168
|
StaticPatches,
|
|
142
169
|
InstancePatches,
|
|
143
170
|
Controls,
|
|
@@ -154,6 +181,7 @@ export {
|
|
|
154
181
|
StaticPatches,
|
|
155
182
|
InstancePatches,
|
|
156
183
|
Controls,
|
|
184
|
+
GlobalFunctionsAndProps,
|
|
157
185
|
}
|
|
158
186
|
|
|
159
187
|
function toFilterFn(filter = ([owner, extension]) => true) {
|
|
@@ -17,24 +17,32 @@ export class AsyncIterable {
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Constructs an instance of AsyncIterable. Similar to Iterable, it can be
|
|
20
|
-
* initialized with either an iterable object
|
|
21
|
-
* elements can be promises, direct values, or a
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* initialized with either an iterable object, an async generator function,
|
|
21
|
+
* or individual elements. The elements can be promises, direct values, or a
|
|
22
|
+
* mix of both. If the first argument is an iterable or an async generator
|
|
23
|
+
* function, the instance is initialized with the elements from the iterable
|
|
24
|
+
* or the generated elements from the async generator function, followed by
|
|
25
|
+
* any additional arguments. If the first argument is not an iterable or an
|
|
26
|
+
* async generator function, all arguments are treated as individual elements.
|
|
26
27
|
*
|
|
27
|
-
* @param {Iterable|Promise|*} elementsOrFirstElement -
|
|
28
|
-
* a Promise, or the first
|
|
28
|
+
* @param {Iterable|AsyncGeneratorFunction|Promise|*} elementsOrFirstElement -
|
|
29
|
+
* An iterable object, an async generator function, a Promise, or the first
|
|
30
|
+
* element.
|
|
29
31
|
* @param {...Promise|*} moreElements - Additional elements if the first
|
|
30
|
-
* argument is not an iterable.
|
|
32
|
+
* argument is not an iterable or an async generator function.
|
|
31
33
|
*/
|
|
32
34
|
constructor(elementsOrFirstElement, ...moreElements) {
|
|
33
35
|
if (
|
|
34
36
|
elementsOrFirstElement != null &&
|
|
35
|
-
typeof elementsOrFirstElement[Symbol.iterator] === 'function'
|
|
37
|
+
(typeof elementsOrFirstElement[Symbol.iterator] === 'function' ||
|
|
38
|
+
typeof elementsOrFirstElement[Symbol.asyncIterator] === 'function')
|
|
36
39
|
) {
|
|
37
40
|
this.#elements = [...elementsOrFirstElement, ...moreElements];
|
|
41
|
+
} else if (
|
|
42
|
+
typeof elementsOrFirstElement === 'function' &&
|
|
43
|
+
elementsOrFirstElement.constructor.name === 'AsyncGeneratorFunction'
|
|
44
|
+
) {
|
|
45
|
+
this.#elements = elementsOrFirstElement();
|
|
38
46
|
} else {
|
|
39
47
|
this.#elements = [elementsOrFirstElement, ...moreElements];
|
|
40
48
|
}
|
|
@@ -51,10 +59,10 @@ export class AsyncIterable {
|
|
|
51
59
|
* a Promise.
|
|
52
60
|
*/
|
|
53
61
|
async *[Symbol.asyncIterator]() {
|
|
54
|
-
for (const element of this.#elements) {
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
yield
|
|
62
|
+
for await (const element of this.#elements) {
|
|
63
|
+
// No need to wrap as a promise here since `for await...of` can handle
|
|
64
|
+
// both Promises and non-Promise values.
|
|
65
|
+
yield element;
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
|
|
@@ -98,18 +106,25 @@ export class AsyncIterator {
|
|
|
98
106
|
/**
|
|
99
107
|
* Creates a new `AsyncIterator` object instance.
|
|
100
108
|
*
|
|
101
|
-
* @param {object} asyncIterable any object that has a
|
|
102
|
-
* `[Symbol.asyncIterable]` property assigned to a generator function
|
|
109
|
+
* @param {object|AsyncGeneratorFunction} asyncIterable any object that has a
|
|
110
|
+
* `[Symbol.asyncIterable]` property assigned to a generator function or an
|
|
111
|
+
* async generator function itself.
|
|
103
112
|
*/
|
|
104
113
|
constructor(asyncIterable) {
|
|
105
|
-
if (
|
|
114
|
+
if (typeof asyncIterable === 'function' &&
|
|
115
|
+
asyncIterable.constructor.name === 'AsyncGeneratorFunction') {
|
|
116
|
+
this.#asyncIterable = asyncIterable();
|
|
117
|
+
} else if (
|
|
118
|
+
!asyncIterable ||
|
|
119
|
+
!Reflect.has(asyncIterable, Symbol.asyncIterator)
|
|
120
|
+
) {
|
|
106
121
|
throw new TypeError(
|
|
107
122
|
'Value used to instantiate AsyncIterator is not an async iterable'
|
|
108
123
|
);
|
|
124
|
+
} else {
|
|
125
|
+
this.#asyncIterable = asyncIterable;
|
|
109
126
|
}
|
|
110
|
-
|
|
111
|
-
this.#asyncIterable = asyncIterable;
|
|
112
|
-
this.#asyncIterator = asyncIterable[Symbol.asyncIterator]();
|
|
127
|
+
this.#asyncIterator = this.#asyncIterable[Symbol.asyncIterator]();
|
|
113
128
|
}
|
|
114
129
|
|
|
115
130
|
/**
|
|
@@ -24,30 +24,41 @@ export class Descriptor {
|
|
|
24
24
|
#object = undefined
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
27
|
+
* Constructs a Descriptor instance which wraps and manages an object
|
|
28
|
+
* property descriptor. The constructor can handle an existing descriptor
|
|
29
|
+
* object or create a new one based on an object and a property key.
|
|
30
|
+
*
|
|
31
|
+
* @param {object|Descriptor} object - The target object or an existing
|
|
32
|
+
* Descriptor instance. If it's an object, it is used in conjunction with
|
|
33
|
+
* `key` to create a descriptor. If it's a Descriptor instance, it is used
|
|
34
|
+
* directly as the descriptor.
|
|
35
|
+
* @param {string|symbol} [key] - The property key for which the descriptor
|
|
36
|
+
* is to be created. This parameter is ignored if `object` is a Descriptor
|
|
37
|
+
* instance. If `key` is an object and `object` is a valid descriptor, `key`
|
|
38
|
+
* is treated as the associated object.
|
|
39
|
+
* @throws {Error} Throws an error if the constructed descriptor is not
|
|
40
|
+
* valid.
|
|
34
41
|
*/
|
|
35
42
|
constructor(object, key) {
|
|
36
43
|
if ((object ?? key) === undefined) {
|
|
37
44
|
this.#desc = Descriptor.enigmatic
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
if (Descriptor.isDescriptor(object)) {
|
|
46
|
+
else if (Descriptor.isDescriptor(object)) {
|
|
41
47
|
this.#desc = object
|
|
42
|
-
this.#object = undefined
|
|
43
|
-
}
|
|
48
|
+
this.#object = isObject(key) ? key : undefined
|
|
49
|
+
}
|
|
44
50
|
else if (isObject(object) && isValidKey(key)) {
|
|
45
51
|
this.#desc = Object.getOwnPropertyDescriptor(object, key)
|
|
46
52
|
this.#object = object
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
if (!this.isDescriptor) {
|
|
50
|
-
console.error(
|
|
56
|
+
console.error(`
|
|
57
|
+
Descriptor(object,key) FAILED:
|
|
58
|
+
object: ${object === globalThis ? '[GLOBAL]' : (typeof key === 'object' ? JSON.stringify(object) : String(object))}
|
|
59
|
+
key: ${key === globalThis ? '[GLOBAL]' : (typeof key === 'object' ? JSON.stringify(key) : String(key))}
|
|
60
|
+
descriptor: `, this.#desc
|
|
61
|
+
)
|
|
51
62
|
throw new Error(`Not a valid descriptor:`, this.#desc)
|
|
52
63
|
}
|
|
53
64
|
}
|
|
@@ -314,12 +325,48 @@ export class Descriptor {
|
|
|
314
325
|
* @param {string|symbol} forKey the string or symbol for which this
|
|
315
326
|
* descriptor will abe applied
|
|
316
327
|
*/
|
|
317
|
-
applyTo(object, forKey) {
|
|
328
|
+
applyTo(object, forKey, bindAccessors = false) {
|
|
318
329
|
if (!isObject(object) || !isValidKey(forKey)) {
|
|
319
330
|
throw new Error(`Cannot apply descriptor to non-object or invalid key`)
|
|
320
331
|
}
|
|
321
332
|
|
|
322
|
-
return Object.defineProperty(object, forKey, this
|
|
333
|
+
return Object.defineProperty(object, forKey, this.toObject(bindAccessors))
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Converts this Descriptor class instance into a basic object descriptor
|
|
338
|
+
* that is accepted by all the standard JavaScript runtime methods that
|
|
339
|
+
* deal with object descriptors.
|
|
340
|
+
*
|
|
341
|
+
* @param {boolean|object} bindAccessors if `true`, a non-fatal attempt to
|
|
342
|
+
* bind accessor getter and setter methods is made before returning the
|
|
343
|
+
* object. If `bindAccessors` is truthy and is also an object, this is the
|
|
344
|
+
* object the accessors will be bound to. If the value is falsy or if the
|
|
345
|
+
* descriptor instance represents a data descriptor, nothing happens.
|
|
346
|
+
* @returns {object} the object instance's basic object representation as
|
|
347
|
+
* a descriptor.
|
|
348
|
+
*/
|
|
349
|
+
toObject(bindAccessors = false) {
|
|
350
|
+
let descriptor = { ...this.#desc }
|
|
351
|
+
|
|
352
|
+
if (bindAccessors && this.isAccessor) {
|
|
353
|
+
if (this.hasObject) {
|
|
354
|
+
descriptor = {
|
|
355
|
+
...descriptor,
|
|
356
|
+
get: this.boundGet,
|
|
357
|
+
set: this.boundSet
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else if (isObject(bindAccessors)) {
|
|
361
|
+
descriptor = {
|
|
362
|
+
...descriptor,
|
|
363
|
+
get: this.get?.bind(bindAccessors),
|
|
364
|
+
set: this.set?.bind(bindAccessors)
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return descriptor
|
|
323
370
|
}
|
|
324
371
|
|
|
325
372
|
/**
|
|
@@ -352,7 +399,7 @@ export class Descriptor {
|
|
|
352
399
|
return NaN
|
|
353
400
|
|
|
354
401
|
default:
|
|
355
|
-
return this
|
|
402
|
+
return this.toObject()
|
|
356
403
|
}
|
|
357
404
|
}
|
|
358
405
|
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var nejsBasicExtensions=(()=>{var I=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var pt=(r,t)=>{for(var e in t)I(r,e,{get:t[e],enumerable:!0})},ht=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ut(t))!lt.call(r,o)&&o!==e&&I(r,o,{get:()=>t[o],enumerable:!(s=ft(t,o))||s.enumerable});return r};var dt=r=>ht(I({},"__esModule",{value:!0}),r);var jt={};pt(jt,{Controls:()=>y,Extensions:()=>w,InstancePatches:()=>T,Patches:()=>b,StaticPatches:()=>j,all:()=>at,default:()=>Rt});var yt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],x=class extends Error{constructor(t,e){super(`${yt(t)} disallows tampering with ${e}.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var mt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],E=class extends Error{constructor(t,e){super(`${mt(t)} does not have a property named '${e}'.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var A=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 o=this[Symbol.toStringTag],n=`(started: ${this.started} needed: ${this.state.needsApplication})`;return s(`${o} ${n}`,{...e,depth:t})}};var m=class{constructor(t,e=globalThis,s=void 0){let o=c=>c==null,n=(c,f=["string","symbol"])=>!o(c)&&!!f.find(l=>l===typeof c),i=c=>n(c,["object"]);if(!n(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(!i(e))throw new TypeError("Cannot create Patch entry as owning object is invalid");Object.assign(this,{key:t,descriptor:Object.getOwnPropertyDescriptor(e,t),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}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let o=this.isData?" Data":" Accessor",n=this.isReadOnly?" [ReadOnly]":"";return`PatchEntry<${this.key}${o}${n}>`}};var a=class r{patchConflicts={};patchEntries={};patchesOwner=void 0;patchCount=0;patchesApplied=0;constructor(t,e,s={}){Object.assign(this,{owner:t,options:s}),this.patchesOwner=e;let o=this?.options.condition;Reflect.ownKeys(e).forEach(n=>{let i=this?.options?.conditions?.[n]??o;try{this.patchEntries[n]=new m(n,this.patchesOwner,i),this.patchCount+=1}catch(c){console.error(`Failed to process patch for ${n}
|
|
2
|
-
`,c)}if(Reflect.has(this.owner,n))try{this.patchConflicts[n]=new m(n,this.owner)}catch(c){console.error(`Cannot capture conflicting patch key ${n}
|
|
3
|
-
`,c)}}),r.patches.has(t)||r.patches.set(t,[]),r.patches.get(t).push(this)}get entries(){return Reflect.ownKeys(this.patchEntries).map(t=>[t,this.patchEntries[t]])}get patches(){return this.entries.reduce((t,[e,s])=>(t[e]=s.computed,t),{})}get patchKeys(){return this.entries.map(([t,e])=>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};e.forEach(([,o])=>{if(o.isAllowed){Object.defineProperty(this.owner,o.key,o.descriptor);let n=Object.getOwnPropertyDescriptor(this.owner,o.key);this.#t(n,o.descriptor)?(s.applied+=1,s.notApplied-=1):s.errors.push([o,new Error(`Could not apply patch for key ${o.key}`)])}}),this.patchesApplied=s.applied,typeof t=="function"&&t(s)}createToggle(t=!1){return new A(this,t)}revert(t){if(!this.applied)return;let e=this.entries,s=this.conflicts,o={patches:e.length,reverted:0,restored:0,conflicts:s.length,errors:[],stillApplied:0};e.forEach(([,n])=>{delete this.owner[n.key]?(this.patchesApplied-=1,o.reverted+=1):o.errors.push([n,new Error(`Failed to revert patch ${n.key}`)])}),s.forEach(([,n])=>{Object.defineProperty(this.owner,n.key,n.descriptor);let i=Object.getOwnPropertyDescriptor(this.owner,n.key);this.#t(n.descriptor,i)?o.restored+=1:o.errors.push([n,new Error(`Failed to restore original ${n.key}`)])}),o.stillApplied=this.patchesApplied,typeof t=="function"&&t(o)}release(){let t=r.patches.get(this.owner);t.splice(t.find(e=>e===this),1)}owner=null;options=null;#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 o={get quotes(){return/^(\x1B\[\d+m)?['"]|["'](\x1B\[\d+m)?$/g},get arrays(){return/^(\x1B\[\d+m)?\[ | \](\x1B\[\d+m)?$/g}},n={...e,depth:t},i=this.owner?.name??"",c=i.length?`[${s(i,e).replaceAll(o.quotes,"$1$2")}]`:"",f=s(this.patchKeys,n).replaceAll(o.arrays,"$1$2").replaceAll(/'(.*?)'/g,"$1");return`${this.constructor.name}${c} { ${f} }`}static patches=new Map;static enableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.apply()}static disableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.revert()}};var gt=["number","boolean","bigint","string","symbol"],u=class r extends a{constructor(t,e,s=globalThis,o={}){let n=r.determineInput(t),{key:i,extension:c,valid:f}=n;if(c=e||c,!f)throw new E(s,i);let l=Object.getOwnPropertyDescriptor(s,i);if(l&&(Reflect.has(l,"writable")&&!l.writable||Reflect.has(l,"configurable")&&!l.configurable))throw new x(s,i);super(s,{[i]:c},o),this.key=i,this.class=n.class,this.function=n.function}get isFunction(){return!!this.function}get isClass(){return!!this.class}get isPrimitive(){return~gt.indexOf(typeof this.value)}get isObject(){return Object(this.value)===this.value}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 o={get braces(){return/^(\x1B\[\d+m)?[\[\{]|[\]\}](\x1B\[\d+m)?$/g},get quotes(){return/^(\x1B\[\d+m)?['"]|["'](\x1B\[\d+m)?$/g}},n=s(this.key,e).replaceAll(o.quotes,"$1$2"),i=s(this.patches[this.key],e).replaceAll(o.braces,"$1$2");return`Extension[${n}:${i}]`}get[Symbol.toStringTag](){return this.constructor.name}};var p=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 o of t)if(Reflect.has(r,o)){let i={...Object.getOwnPropertyDescriptor(r,o)};(typeof i.get=="function"||typeof i.set=="function")&&e&&(i.get=i.get?.bind(r),i.set=i.set?.bind(r)),Object.defineProperty(s,o,i)}return s}}),X=new a(Object.prototype,{stripTo(r,t=!0){return Object.stripTo(this,r,t)}});var{getStringTag:Z}=p.patches,P=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=Z(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=Z(r);return r instanceof Function&&t=="GeneratorFunction"}}),_=new a(Function.prototype,{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 tt=new a(Map.prototype,{getKey(r,t=!0){for(let[e,s]of this)return t&&r===s&&!t&&r==s?e:null}});var et=new a(Set.prototype,{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 o of this)s=r.call(e,s,o,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:rt}=p.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(!rt(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 rt(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 st=new a(String,{isString(r){return r&&(typeof r=="string"||r instanceof String)?r.length>0:!1}});var D=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 nt=new a(Array.prototype,{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:d,isValidKey:F}=p.patches,{hasSome:V}=$.patches,O=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=void 0):d(t)&&F(e)&&(this.#t=Object.getOwnPropertyDescriptor(t,e),this.#e=t),!this.isDescriptor)throw console.error("Current 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 d(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 d(this.#e)?this.set?.bind(this.#e):this.set}set set(t){(this.#t||{}).set=t}get hasObject(){return d(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!d(t)||!F(e)||!Reflect.has(t,e)?null:s?new r(Object.getOwnPropertyDescriptor(t,e)):Object.getOwnPropertyDescriptor(t,e)}applyTo(t,e){if(!d(t)||!F(e))throw new Error("Cannot apply descriptor to non-object or invalid key");return Object.defineProperty(t,e,this.#t)}[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.#t}}get[Symbol.toStringTag](){return this.constructor.name}static getData(t,e){if(!d(t)||!Reflect.has(t,e))return;let s=r.for(t,e,!0);return s.isData?s.value:null}static getAccessor(t,e){if(!d(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:o}=r.base()){return{get:t,set:e,enumerable:s,configurable:o}}static data(t,e=!0,{enumerable:s,configurable:o}=r.base()){return{value:t,enumerable:s,writable:e,configurable:o}}static isDescriptor(t){let e=[...r.SHARED_KEYS,...r.ACCESSOR_KEYS,...r.DATA_KEYS];return V(t,e)}static isData(t,e){let o=(typeof t=="object"||t instanceof Object)&&e instanceof String?r.for(t,e):t,{DATA_KEYS:n}=this,i=!1;return V(o,n)&&(i=!0),i}static isAccessor(t,e){let o=t&&e&&(typeof t=="object"||t instanceof Object)&&(e instanceof String||typeof e=="symbol")?r.for(t,e):t,{ACCESSOR_KEYS:n}=this,i=!1;return V(o,n)&&(i=!0),i}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 u(O);var{isClass:bt,isFunction:k}=P.patches,wt=Symbol.for("nodejs.util.inspect.custom"),ot=new a(globalThis,{maskAs(r,t,e){let{prototype:s,toPrimitive:o}=GenericMask({...e,prototype:t}),n={configurable:!0,enumerable:!1},i=k(s)?s.prototype:s,c=bt(s)?s:i?.constructor;return!c&&!i?null:(Object.setPrototypeOf(r,i),Object.defineProperties(r,{valueOf:{value(){return String(o("default",r))},...n},[Symbol.toPrimitive]:{value(f){return o(f,r)},...n},[Symbol.toStringTag]:{value:c.name,...n},[Symbol.species]:{get(){return c},...n},[wt]:{...n,value(f,l,h){return h(this[Symbol.toPrimitive](),{...l,depth:f})}}}),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 k(e)||(s.toPrimitive=(o,n)=>{let i=n[t],c=typeof i=="number"&&Number.isFinite(i)||typeof i=="string"&&!isNaN(parseFloat(i))&&isFinite(i);switch(o){case"string":return c?String(i):i??String(n);case"number":return c?Number(i):NaN;case"default":default:return c?Number(i):i}}),s},StringMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:String.prototype};return k(t)||(e.toPrimitive=function(o,n){switch(o){case"default":return n[r];case"number":return parseInt(n[r],36);case"string":return String(n[r]);default:return n}}),e},NumberMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:Number.prototype};return k(t)||(e.toPrimitive=function(o,n){switch(o){case"default":return n[r];case"number":return Number(n[r]);case"string":return String(n[r]);default:return n}}),e}});var M=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(o){let n=o.deref();n&&t.call(e,n,n,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 o of this){let n=o?.deref();n&&t.call(e,n,NaN,this)&&s.push(n)}return s}find(t,e){for(let s of this){let o=s?.deref();if(o&&t.call(e,o,NaN,this))return o}}map(t,e,s,o){let n=[],i=!0,c=!0;for(let f of this){let l=f?.deref();if(l){let h=t.call(e,l,NaN,this);(i||c)&&(this.#e(h)||(i=!1,c&&(c=this.#e(Object(h))))),n.push(h)}}if(s){if(i)return new r(n).objectifying(o?this.objectifyValues:!1);if(c)return new r(n.map(f=>this.#e(f)?f:Object(f))).objectifying()}return n}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)}},G=new u(M);var it=new a(WeakRef,{isValidReference(r){return!(typeof r=="symbol"&&Symbol.keyFor(r)===void 0||typeof r!="object"&&typeof r!="symbol"||r==null)}});var R=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]"}},g=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},B=new u(R),K=new u(g);var{isObject:St,isNullDefined:xt,isValidKey:Et}=p.patches,{isRegistered:At}=D.patches,{isValidReference:ct}=it.patches,W=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 o=Et(e)?e:String(e),n=s?.valueOf()||s;t[o]=n}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 o=new WeakRef(s);super.set(t,o)}setAll(t){if(!R.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[o,n]=s;!o||!St(n)||!At(n)||this.set(o,n)};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 g(t,s=>{if(s){let[o,n]=s,i=n?.deref();return[o,i]}return s})}forEach(t,e){for(let[s,o]of super.entries()){let n=o?.deref();n&&t.call(e,n,s,this)}}values(){return new g(super.values(),function(e){return e?.deref()||e})}hasValue(t,e=!0){if(xt(t))return!1;this.#t&&(e=!1);for(let[s,o]of this)if(e&&t===o||!e&&t==o)return!0;return!1}filter(t,e){let s=[];for(let[o,n]of this)t.call(e,n,o,this)&&s.push([o,n]);return s}find(t,e){for(let[s,o]of this){let n=super.get(s),i=t.call(e,n,s,map);if(i||(i=t.call(e,o,s,map)),i)return o}return null}map(t,e,s,o){if(typeof t!="function")throw new TypeError("mapFn must be a function! Received",t);let n=[],i=[],c=o&&this.objectifyValues,f=o===void 0,l=c;for(let[h,Q]of this){let[,v]=[0,1],S=t.call(e,[h,Q],h,this);ct(S[v])||ct(Object(S[v]))&&(c=!0,f&&!l&&(l=!0,S[v]=Object(S[v]))),n.push(S)}return s?new r(n).objectifying(l):n}*[Symbol.iterator](){for(let[t,e]of this.entries())yield[t,e]}get[Symbol.toStringTag](){return this.constructor.name}},Y=new u(W);var q=class r extends Promise{#t=null;#e=null;#r=null;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,o;super((n,i)=>{s=n,o=i,e?.executor&&typeof e?.executor=="function"&&e?.executor(n,i)}),this.#r=n=>(e?.doNotTrackAnswers!==!0&&(this.value=n),this.#s=!0,s(n)),this.#e=async n=>(e?.doNotTrackAnswers!==!0&&(this.reason=n),this.#s=!0,o(n)),this.#t=this,e?.resolve?this.#r(e?.resolve):e?.reject&&this.#e(e?.reject)}get settled(){return this.#s}get promise(){return this.#t}resolve(t){return this.#r(t)}reject(t){return this.#e(t)}static get[Symbol.species](){return class extends r{constructor(e){super({executor:e})}}}},L=new u(q);var U=class{#t=[];constructor(t,...e){t!=null&&typeof t[Symbol.iterator]=="function"?this.#t=[...t,...e]:this.#t=[t,...e]}async*[Symbol.asyncIterator](){for(let t of this.#t)yield Promise.resolve(t)}get[Symbol.toStringTag](){return this.constructor.name}static isAsyncIterable(t){return Object.prototype.toString.call(t?.[Symbol.asyncIterator])==="[object AsyncGeneratorFunction]"}},z=class{constructor(t){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=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},H=new u(U),J=new u(z);var j=[[Object,p],[Function,P],[Reflect,$],[String,st],[Symbol,D]],T=[[Object.prototype,X],[Function.prototype,_],[Array.prototype,nt],[Map.prototype,tt],[Set.prototype,et]],b=new Map([...j,...T]),w={global:ot,[H.key]:H,[J.key]:J,[L.key]:L,[C.key]:C,[B.key]:B,[K.key]:K,[Y.key]:Y,[G.key]:G},y={};Object.assign(y,{enableAll(){y.enablePatches(),y.enableExtensions()},enablePatches(){b.forEach(r=>{r.apply()})},enableStaticPatches(r=([t,e])=>!0){let t=j.filter(N(r));return t.forEach(([e,s])=>s.apply()),t},enableInstancePatches(r=([t,e])=>!0){let t=T.filter(N(r));return t.forEach(([e,s])=>s.apply()),t},enableExtensions(){Object.values(w).forEach(r=>{r.apply()})},disableAll(){y.disablePatches(),y.disableExtensions()},disablePatches(){b.forEach(r=>{r.revert()})},disableStaticPatches(r=([t,e])=>!0){let t=j.filter(N(r));return t.forEach(([e,s])=>s.revert()),t},disableInstancePatches(r=([t,e])=>!0){let t=T.filter(N(r));return t.forEach(([e,s])=>s.revert()),t},disableExtensions(){Object.values(w).forEach(r=>{r.revert()})}});var at=[...Array.from(b.values()),...Array.from(Object.values(w))].reduce((e,s)=>(Reflect.ownKeys(s.patchEntries).reduce((o,n)=>{let i=s.patchEntries[n];return i.isAccessor?e[n]=new O(i.descriptor):e[n]=i.computed,e},e),e),{}),Ot={...y,Extensions:w,Patches:b,StaticPatches:j,InstancePatches:T,Controls:y,extensions:w,patches:b,all:at},Rt=Ot;function N(r=([t,e])=>!0){let t=r;if(typeof t!="function"){let e=Array.isArray(r)?r:[r];t=([s,o])=>{for(let n of e){let i=String(n);if(i.startsWith("^")&&(s?.name??s)!=i.substring(1)||(s?.name??s)==i)return!0}return!1}}return t}return dt(jt);})();
|
|
4
|
-
//# sourceMappingURL=basic-extensions.bundle.1.9.0.js.map
|