1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392 | 1
1
1
1
1
1
5
5
5
1
1
1
1
9
9
9
1
1
1
1
1
1
1
14
14
6
1
5
5
13
13
5
5
5
13
1
1
1
1
9
9
1
8
1
5
5
1
1
1
14
1
1
14
1
1
1
1
1
1
1
1
1
1
1
1
| System.register(["core-js"], function (_export) {
"use strict";
var core, functionPrototype, _Map, _Set, _WeakMap, __Metadata__;
function decorate(decorators, target, targetKey, targetDescriptor) {
if (!IsUndefined(targetDescriptor)) {
if (!IsArray(decorators)) {
throw new TypeError();
} else if (!IsObject(target)) {
throw new TypeError();
} else if (IsUndefined(targetKey)) {
throw new TypeError();
} else if (!IsObject(targetDescriptor)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor);
} else if (!IsUndefined(targetKey)) {
if (!IsArray(decorators)) {
throw new TypeError();
} else if (!IsObject(target)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
return DecoratePropertyWithoutDescriptor(decorators, target, targetKey);
} else {
if (!IsArray(decorators)) {
throw new TypeError();
} else if (!IsConstructor(target)) {
throw new TypeError();
}
return DecorateConstructor(decorators, target);
}
}
function metadata(metadataKey, metadataValue) {
function decorator(target, targetKey) {
if (!IsUndefined(targetKey)) {
if (!IsObject(target)) {
throw new TypeError();
}
targetKey = ToPropertyKey(targetKey);
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
} else {
if (!IsConstructor(target)) {
throw new TypeError();
}
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined);
}
}
return decorator;
}
function defineMetadata(metadataKey, metadataValue, target, targetKey) {
Iif (!IsObject(target)) {
throw new TypeError();
} else Iif (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
}
function hasMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryHasMetadata(metadataKey, target, targetKey);
}
function hasOwnMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryHasOwnMetadata(metadataKey, target, targetKey);
}
function getMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryGetMetadata(metadataKey, target, targetKey);
}
function getOwnMetadata(metadataKey, target, targetKey) {
Iif (!IsObject(target)) {
throw new TypeError();
} else Iif (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryGetOwnMetadata(metadataKey, target, targetKey);
}
function getMetadataKeys(target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryMetadataKeys(target, targetKey);
}
function getOwnMetadataKeys(target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
return OrdinaryOwnMetadataKeys(target, targetKey);
}
function deleteMetadata(metadataKey, target, targetKey) {
if (!IsObject(target)) {
throw new TypeError();
} else if (!IsUndefined(targetKey)) {
targetKey = ToPropertyKey(targetKey);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p-
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
if (IsUndefined(metadataMap)) {
return false;
}
if (!metadataMap["delete"](metadataKey)) {
return false;
}
if (metadataMap.size > 0) {
return true;
}
var targetMetadata = __Metadata__.get(target);
targetMetadata["delete"](targetKey);
if (targetMetadata.size > 0) {
return true;
}
__Metadata__["delete"](target);
return true;
}
function DecorateConstructor(decorators, target) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
var decorated = decorator(target);
if (!IsUndefined(decorated)) {
if (!IsConstructor(decorated)) {
throw new TypeError();
}
target = decorated;
}
}
return target;
}
function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
var decorated = decorator(target, propertyKey, descriptor);
if (!IsUndefined(decorated)) {
if (!IsObject(decorated)) {
throw new TypeError();
}
descriptor = decorated;
}
}
return descriptor;
}
function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) {
for (var i = decorators.length - 1; i >= 0; --i) {
var decorator = decorators[i];
decorator(target, propertyKey);
}
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create-
function GetOrCreateMetadataMap(target, targetKey, create) {
var targetMetadata = __Metadata__.get(target);
if (!targetMetadata) {
if (!create) {
return undefined;
}
targetMetadata = new _Map();
__Metadata__.set(target, targetMetadata);
}
var keyMetadata = targetMetadata.get(targetKey);
if (!keyMetadata) {
Iif (!create) {
return undefined;
}
keyMetadata = new _Map();
targetMetadata.set(targetKey, keyMetadata);
}
return keyMetadata;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p-
function OrdinaryHasMetadata(_x, _x2, _x3) {
var _again = true;
_function: while (_again) {
var MetadataKey = _x,
O = _x2,
P = _x3;
hasOwn = parent = undefined;
_again = false;
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
if (hasOwn) {
return true;
}
var parent = GetPrototypeOf(O);
if (parent !== null) {
_x = MetadataKey;
_x2 = parent;
_x3 = P;
_again = true;
continue _function;
}
return false;
}
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p-
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, false);
if (metadataMap === undefined) {
return false;
}
return Boolean(metadataMap.has(MetadataKey));
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p-
function OrdinaryGetMetadata(_x4, _x5, _x6) {
var _again2 = true;
_function2: while (_again2) {
var MetadataKey = _x4,
O = _x5,
P = _x6;
hasOwn = parent = undefined;
_again2 = false;
var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
if (hasOwn) {
return OrdinaryGetOwnMetadata(MetadataKey, O, P);
}
var parent = GetPrototypeOf(O);
if (parent !== null) {
_x4 = MetadataKey;
_x5 = parent;
_x6 = P;
_again2 = true;
continue _function2;
}
return undefined;
}
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p-
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, false);
if (metadataMap === undefined) {
return undefined;
}
return metadataMap.get(MetadataKey);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p-
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
var metadataMap = GetOrCreateMetadataMap(O, P, true);
metadataMap.set(MetadataKey, MetadataValue);
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p-
function OrdinaryMetadataKeys(O, P) {
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
var parent = GetPrototypeOf(O);
if (parent === null) {
return ownKeys;
}
var parentKeys = OrdinaryMetadataKeys(parent, P);
if (parentKeys.length <= 0) {
return ownKeys;
}
if (ownKeys.length <= 0) {
return parentKeys;
}
var set = new _Set();
var keys = [];
for (var _i = 0; _i < ownKeys.length; _i++) {
var key = ownKeys[_i];
var hasKey = set.has(key);
if (!hasKey) {
set.add(key);
keys.push(key);
}
}
for (var _a = 0; _a < parentKeys.length; _a++) {
var key = parentKeys[_a];
var hasKey = set.has(key);
if (!hasKey) {
set.add(key);
keys.push(key);
}
}
return keys;
}
// https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p-
function OrdinaryOwnMetadataKeys(target, targetKey) {
var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
var keys = [];
if (metadataMap) {
metadataMap.forEach(function (_, key) {
return keys.push(key);
});
}
return keys;
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type
function IsUndefined(x) {
return x === undefined;
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
function IsArray(x) {
return Array.isArray(x);
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type
function IsObject(x) {
return typeof x === "object" ? x !== null : typeof x === "function";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
function IsConstructor(x) {
return typeof x === "function";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type
function IsSymbol(x) {
return typeof x === "symbol";
}
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
function ToPropertyKey(value) {
if (IsSymbol(value)) {
return value;
}
return String(value);
}
function GetPrototypeOf(O) {
var proto = Object.getPrototypeOf(O);
if (typeof O !== "function" || O === functionPrototype) {
return proto;
}
// TypeScript doesn't set __proto__ in ES5, as it's non-standard.
// Try to determine the superclass constructor. Compatible implementations
// must either set __proto__ on a subclass constructor to the superclass constructor,
// or ensure each class has a valid `constructor` property on its prototype that
// points back to the constructor.
// If this is not the same as Function.[[Prototype]], then this is definately inherited.
// This is the case when in ES6 or when using __proto__ in a compatible browser.
if (proto !== functionPrototype) {
return proto;
}
// If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
var prototype = O.prototype;
var prototypeProto = Object.getPrototypeOf(prototype);
if (prototypeProto == null || prototypeProto === Object.prototype) {
return proto;
}
// if the constructor was not a function, then we cannot determine the heritage.
var constructor = prototypeProto.constructor;
if (typeof constructor !== "function") {
return proto;
}
// if we have some kind of self-reference, then we cannot determine the heritage.
if (constructor === O) {
return proto;
}
// we have a pretty good guess at the heritage.
return constructor;
}
return {
setters: [function (_coreJs) {
core = _coreJs["default"];
}],
execute: function () {
// Load global or shim versions of Map, Set, and WeakMap
functionPrototype = Object.getPrototypeOf(Function);
_Map = Map;
_Set = Set;
_WeakMap = WeakMap;
// [[Metadata]] internal slot
__Metadata__ = new _WeakMap();
Reflect.decorate = decorate;Reflect.metadata = metadata;Reflect.defineMetadata = defineMetadata;Reflect.hasMetadata = hasMetadata;Reflect.hasOwnMetadata = hasOwnMetadata;Reflect.getMetadata = getMetadata;Reflect.getOwnMetadata = getOwnMetadata;Reflect.getMetadataKeys = getMetadataKeys;Reflect.getOwnMetadataKeys = getOwnMetadataKeys;Reflect.deleteMetadata = deleteMetadata;
}
};
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9FaXNlbmJlcmdFZmZlY3QvRG9jdW1lbnRzL0dpdEh1Yi9UaGUgRHVyYW5kYWwgUHJvamVjdC9hdXJlbGlhL21ldGFkYXRhL3NyYy9yZWZsZWN0LW1ldGFkYXRhLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztjQUdJLGlCQUFpQixFQUNqQixJQUFJLEVBQ0osSUFBSSxFQUNKLFFBQVEsRUFHUixZQUFZOztBQUVoQixhQUFTLFFBQVEsQ0FBQyxVQUFVLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxnQkFBZ0IsRUFBRTtBQUMvRCxZQUFJLENBQUMsV0FBVyxDQUFDLGdCQUFnQixDQUFDLEVBQUU7QUFDaEMsZ0JBQUksQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLEVBQUU7QUFDdEIsc0JBQU0sSUFBSSxTQUFTLEVBQUUsQ0FBQzthQUN6QixNQUNJLElBQUksQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLEVBQUU7QUFDeEIsc0JBQU0sSUFBSSxTQUFTLEVBQUUsQ0FBQzthQUN6QixNQUNJLElBQUksV0FBVyxDQUFDLFNBQVMsQ0FBQyxFQUFFO0FBQzdCLHNCQUFNLElBQUksU0FBUyxFQUFFLENBQUM7YUFDekIsTUFDSSxJQUFJLENBQUMsUUFBUSxDQUFDLGdCQUFnQixDQUFDLEVBQUU7QUFDbEMsc0JBQU0sSUFBSSxTQUFTLEVBQUUsQ0FBQzthQUN6QjtBQUNELHFCQUFTLEdBQUcsYUFBYSxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQ3JDLG1CQUFPLDh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