@rs-x/core 0.4.10 → 0.4.11

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 (2) hide show
  1. package/dist/index.js +1124 -1123
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44,6 +44,147 @@ function overrideMultiInjectServices(container, multiInjectToken, services) {
44
44
  }
45
45
  __name(overrideMultiInjectServices, "overrideMultiInjectServices");
46
46
 
47
+ // lib/index-value-accessor/array-index-accessor.ts
48
+ function _ts_decorate(decorators, target, key, desc) {
49
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
50
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
51
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
52
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
53
+ }
54
+ __name(_ts_decorate, "_ts_decorate");
55
+ var ArrayIndexAccessor = class {
56
+ static {
57
+ __name(this, "ArrayIndexAccessor");
58
+ }
59
+ priority = 5;
60
+ isAsync() {
61
+ return false;
62
+ }
63
+ getIndexes(array) {
64
+ return array.keys();
65
+ }
66
+ hasValue(array, index) {
67
+ return this.getValue(array, index) !== void 0;
68
+ }
69
+ getResolvedValue(array, index) {
70
+ return array[index];
71
+ }
72
+ getValue(array, index) {
73
+ return this.getResolvedValue(array, index);
74
+ }
75
+ setValue(array, index, value) {
76
+ array[index] = value;
77
+ }
78
+ applies(array) {
79
+ return Array.isArray(array);
80
+ }
81
+ };
82
+ ArrayIndexAccessor = _ts_decorate([
83
+ injectable()
84
+ ], ArrayIndexAccessor);
85
+
86
+ // lib/index-value-accessor/date-property-accessor.interface.ts
87
+ var dataProperties = [
88
+ "year",
89
+ "utcYear",
90
+ "month",
91
+ "utcMonth",
92
+ "date",
93
+ "utcDate",
94
+ "hours",
95
+ "utcHours",
96
+ "minutes",
97
+ "utcMinutes",
98
+ "seconds",
99
+ "utcSeconds",
100
+ "milliseconds",
101
+ "utcMilliseconds",
102
+ "time"
103
+ ];
104
+
105
+ // lib/index-value-accessor/date-property-accessor.ts
106
+ function _ts_decorate2(decorators, target, key, desc) {
107
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
108
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
109
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
110
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
111
+ }
112
+ __name(_ts_decorate2, "_ts_decorate");
113
+ var DatePropertyAccessor = class {
114
+ static {
115
+ __name(this, "DatePropertyAccessor");
116
+ }
117
+ priority = 0;
118
+ _setter = {
119
+ year: /* @__PURE__ */ __name((date, value) => date.setFullYear(value), "year"),
120
+ utcYear: /* @__PURE__ */ __name((date, value) => date.setUTCFullYear(value), "utcYear"),
121
+ month: /* @__PURE__ */ __name((date, value) => date.setMonth(value), "month"),
122
+ utcMonth: /* @__PURE__ */ __name((date, value) => date.setUTCMonth(value), "utcMonth"),
123
+ date: /* @__PURE__ */ __name((date, value) => date.setDate(value), "date"),
124
+ utcDate: /* @__PURE__ */ __name((date, value) => date.setUTCDate(value), "utcDate"),
125
+ hours: /* @__PURE__ */ __name((date, value) => date.setHours(value), "hours"),
126
+ utcHours: /* @__PURE__ */ __name((date, value) => date.setUTCHours(value), "utcHours"),
127
+ minutes: /* @__PURE__ */ __name((date, value) => date.setMinutes(value), "minutes"),
128
+ utcMinutes: /* @__PURE__ */ __name((date, value) => date.setUTCMinutes(value), "utcMinutes"),
129
+ seconds: /* @__PURE__ */ __name((date, value) => date.setSeconds(value), "seconds"),
130
+ utcSeconds: /* @__PURE__ */ __name((date, value) => date.setUTCSeconds(value), "utcSeconds"),
131
+ milliseconds: /* @__PURE__ */ __name((date, value) => date.setMilliseconds(value), "milliseconds"),
132
+ utcMilliseconds: /* @__PURE__ */ __name((date, value) => date.setUTCMilliseconds(value), "utcMilliseconds"),
133
+ time: /* @__PURE__ */ __name((date, value) => date.setTime(value), "time")
134
+ };
135
+ _getters = {
136
+ year: /* @__PURE__ */ __name((date) => date.getFullYear(), "year"),
137
+ utcYear: /* @__PURE__ */ __name((date) => date.getUTCFullYear(), "utcYear"),
138
+ month: /* @__PURE__ */ __name((date) => date.getMonth(), "month"),
139
+ utcMonth: /* @__PURE__ */ __name((date) => date.getUTCMonth(), "utcMonth"),
140
+ date: /* @__PURE__ */ __name((date) => date.getDate(), "date"),
141
+ utcDate: /* @__PURE__ */ __name((date) => date.getUTCDate(), "utcDate"),
142
+ hours: /* @__PURE__ */ __name((date) => date.getHours(), "hours"),
143
+ utcHours: /* @__PURE__ */ __name((date) => date.getUTCHours(), "utcHours"),
144
+ minutes: /* @__PURE__ */ __name((date) => date.getMinutes(), "minutes"),
145
+ utcMinutes: /* @__PURE__ */ __name((date) => date.getUTCMinutes(), "utcMinutes"),
146
+ seconds: /* @__PURE__ */ __name((date) => date.getSeconds(), "seconds"),
147
+ utcSeconds: /* @__PURE__ */ __name((date) => date.getUTCSeconds(), "utcSeconds"),
148
+ milliseconds: /* @__PURE__ */ __name((date) => date.getMilliseconds(), "milliseconds"),
149
+ utcMilliseconds: /* @__PURE__ */ __name((date) => date.getUTCMilliseconds(), "utcMilliseconds"),
150
+ time: /* @__PURE__ */ __name((date) => date.getTime(), "time")
151
+ };
152
+ isAsync() {
153
+ return false;
154
+ }
155
+ getIndexes() {
156
+ return dataProperties.values();
157
+ }
158
+ hasValue(context, index) {
159
+ return this.getValue(context, index) !== void 0;
160
+ }
161
+ getResolvedValue(context, index) {
162
+ return this.getValue(context, index);
163
+ }
164
+ getValue(date, index) {
165
+ return this._getters[index]?.(date);
166
+ }
167
+ setValue(date, index, value) {
168
+ this._setter[index]?.(date, value);
169
+ }
170
+ applies(context, index) {
171
+ return context instanceof Date && !!this._getters[index];
172
+ }
173
+ };
174
+ DatePropertyAccessor = _ts_decorate2([
175
+ injectable()
176
+ ], DatePropertyAccessor);
177
+
178
+ // lib/exceptions/unsupported-exception.ts
179
+ var UnsupportedException = class extends Error {
180
+ static {
181
+ __name(this, "UnsupportedException");
182
+ }
183
+ constructor(message) {
184
+ super(message);
185
+ }
186
+ };
187
+
47
188
  // lib/rs-x-core.injection-tokens.ts
48
189
  var RsXCoreInjectionTokens = {
49
190
  IInjectionContainer: Symbol("IInjectionContainer"),
@@ -72,14 +213,14 @@ var RsXCoreInjectionTokens = {
72
213
  DefaultDeepCloneExcept: Symbol("DefaultDeepCloneExcept")
73
214
  };
74
215
 
75
- // lib/deep-clone/deep-clone-except.ts
76
- function _ts_decorate(decorators, target, key, desc) {
216
+ // lib/index-value-accessor/index-value-accessor.ts
217
+ function _ts_decorate3(decorators, target, key, desc) {
77
218
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
78
219
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
79
220
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
80
221
  return c > 3 && r && Object.defineProperty(target, key, r), r;
81
222
  }
82
- __name(_ts_decorate, "_ts_decorate");
223
+ __name(_ts_decorate3, "_ts_decorate");
83
224
  function _ts_metadata(k, v) {
84
225
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
85
226
  }
@@ -90,387 +231,97 @@ function _ts_param(paramIndex, decorator) {
90
231
  };
91
232
  }
92
233
  __name(_ts_param, "_ts_param");
93
- var DeepCloneValueExcept = class {
234
+ var IndexValueAccessor = class {
94
235
  static {
95
- __name(this, "DeepCloneValueExcept");
236
+ __name(this, "IndexValueAccessor");
96
237
  }
97
- _resolvedValueCache;
98
- constructor(_resolvedValueCache) {
99
- this._resolvedValueCache = _resolvedValueCache;
238
+ priority = 0;
239
+ _accessors;
240
+ constructor(accessors) {
241
+ this._accessors = [
242
+ ...accessors
243
+ ].sort((a, b) => b.priority - a.priority);
100
244
  }
101
- except(source) {
102
- if (source instanceof Promise || source instanceof Observable) {
103
- return this._resolvedValueCache.get(source);
104
- }
105
- return void 0;
245
+ getIndexes(context, index) {
246
+ return this.getIndexAccessor(context, index).getIndexes(context, index);
106
247
  }
107
- };
108
- DeepCloneValueExcept = _ts_decorate([
109
- injectable(),
110
- _ts_param(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
111
- _ts_metadata("design:type", Function),
112
- _ts_metadata("design:paramtypes", [
113
- typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
114
- ])
115
- ], DeepCloneValueExcept);
116
-
117
- // lib/deep-clone/default-deep-clone.ts
118
- function _ts_decorate2(decorators, target, key, desc) {
119
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
120
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
121
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
122
- return c > 3 && r && Object.defineProperty(target, key, r), r;
123
- }
124
- __name(_ts_decorate2, "_ts_decorate");
125
- function _ts_metadata2(k, v) {
126
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
127
- }
128
- __name(_ts_metadata2, "_ts_metadata");
129
- function _ts_param2(paramIndex, decorator) {
130
- return function(target, key) {
131
- decorator(target, key, paramIndex);
132
- };
133
- }
134
- __name(_ts_param2, "_ts_param");
135
- var DefaultDeepClone = class {
136
- static {
137
- __name(this, "DefaultDeepClone");
248
+ isAsync(context, index) {
249
+ return this.getIndexAccessor(context, index).isAsync(context, index);
138
250
  }
139
- _deepCloneList;
140
- priority = 0;
141
- constructor(_deepCloneList) {
142
- this._deepCloneList = _deepCloneList;
251
+ hasValue(context, index) {
252
+ return this.getIndexAccessor(context, index).hasValue(context, index);
143
253
  }
144
- clone(source) {
145
- let error = null;
146
- for (let i = 0; i < this._deepCloneList.length; i++) {
147
- try {
148
- return this._deepCloneList[i].clone(source);
149
- } catch (e) {
150
- error = e;
254
+ getResolvedValue(context, index) {
255
+ return this.getIndexAccessor(context, index).getResolvedValue(context, index);
256
+ }
257
+ getValue(context, index) {
258
+ return this.getIndexAccessor(context, index).getValue(context, index);
259
+ }
260
+ setValue(context, index, value) {
261
+ this.getIndexAccessor(context, index).setValue(context, index, value);
262
+ }
263
+ applies(context, index) {
264
+ return this.getIndexAccessor(context, index).applies(context, index);
265
+ }
266
+ getIndexAccessor(context, index) {
267
+ const accessor = this._accessors.find((accessor2) => accessor2.applies(context, index));
268
+ if (!accessor) {
269
+ if (typeof context === "object" && context !== null) {
270
+ throw new UnsupportedException(`No accessor found for ${context.constructor.name}.${String(index)}`);
271
+ } else {
272
+ throw new UnsupportedException(`No accessor found for non-object context: ${String(context)}.${String(index)}`);
151
273
  }
152
274
  }
153
- throw error;
275
+ return accessor;
154
276
  }
155
277
  };
156
- DefaultDeepClone = _ts_decorate2([
278
+ IndexValueAccessor = _ts_decorate3([
157
279
  injectable(),
158
- _ts_param2(0, multiInject(RsXCoreInjectionTokens.IDeepCloneList)),
159
- _ts_metadata2("design:type", Function),
160
- _ts_metadata2("design:paramtypes", [
280
+ _ts_param(0, multiInject(RsXCoreInjectionTokens.IIndexValueAccessorList)),
281
+ _ts_metadata("design:type", Function),
282
+ _ts_metadata("design:paramtypes", [
161
283
  Object
162
284
  ])
163
- ], DefaultDeepClone);
285
+ ], IndexValueAccessor);
164
286
 
165
- // lib/deep-clone/lodash-deep-clone.ts
166
- import cloneDeepWith from "lodash.clonedeepwith";
167
- function _ts_decorate3(decorators, target, key, desc) {
287
+ // lib/index-value-accessor/map-key-accessor.ts
288
+ function _ts_decorate4(decorators, target, key, desc) {
168
289
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
169
290
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
170
291
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
171
292
  return c > 3 && r && Object.defineProperty(target, key, r), r;
172
293
  }
173
- __name(_ts_decorate3, "_ts_decorate");
174
- function _ts_metadata3(k, v) {
175
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
176
- }
177
- __name(_ts_metadata3, "_ts_metadata");
178
- function _ts_param3(paramIndex, decorator) {
179
- return function(target, key) {
180
- decorator(target, key, paramIndex);
181
- };
182
- }
183
- __name(_ts_param3, "_ts_param");
184
- var LodashDeepClone = class {
294
+ __name(_ts_decorate4, "_ts_decorate");
295
+ var MapKeyAccessor = class {
185
296
  static {
186
- __name(this, "LodashDeepClone");
297
+ __name(this, "MapKeyAccessor");
187
298
  }
188
- _deepCloneExcept;
189
- priority = 1;
190
- constructor(_deepCloneExcept) {
191
- this._deepCloneExcept = _deepCloneExcept;
192
- }
193
- clone(source) {
194
- return cloneDeepWith(source, this.cloneExceptPredicate);
195
- }
196
- cloneExceptPredicate = /* @__PURE__ */ __name((value) => {
197
- return this._deepCloneExcept.except(value);
198
- }, "cloneExceptPredicate");
199
- };
200
- LodashDeepClone = _ts_decorate3([
201
- injectable(),
202
- _ts_param3(0, inject(RsXCoreInjectionTokens.DefaultDeepCloneExcept)),
203
- _ts_metadata3("design:type", Function),
204
- _ts_metadata3("design:paramtypes", [
205
- typeof IDeepCloneExcept === "undefined" ? Object : IDeepCloneExcept
206
- ])
207
- ], LodashDeepClone);
208
-
209
- // lib/deep-clone/structured-deep-clone.ts
210
- function _ts_decorate4(decorators, target, key, desc) {
211
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
212
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
213
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
214
- return c > 3 && r && Object.defineProperty(target, key, r), r;
215
- }
216
- __name(_ts_decorate4, "_ts_decorate");
217
- var StructuredDeepClone = class {
218
- static {
219
- __name(this, "StructuredDeepClone");
220
- }
221
- priority = 2;
222
- clone(source) {
223
- return structuredClone(source);
224
- }
225
- };
226
- StructuredDeepClone = _ts_decorate4([
227
- injectable()
228
- ], StructuredDeepClone);
229
-
230
- // lib/equality-service/equality-service.ts
231
- import { createCustomEqual } from "fast-equals";
232
- import { isObservable } from "rxjs";
233
- function _ts_decorate5(decorators, target, key, desc) {
234
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
235
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
236
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
237
- return c > 3 && r && Object.defineProperty(target, key, r), r;
238
- }
239
- __name(_ts_decorate5, "_ts_decorate");
240
- var EqualityService = class {
241
- static {
242
- __name(this, "EqualityService");
243
- }
244
- isEqual = createCustomEqual({
245
- createCustomConfig: /* @__PURE__ */ __name((baseConfig) => ({
246
- ...baseConfig,
247
- areObjectsEqual: /* @__PURE__ */ __name((a, b, equalityCheck) => {
248
- if (isObservable(a) && isObservable(b)) {
249
- return a === b;
250
- }
251
- return baseConfig.areObjectsEqual(a, b, equalityCheck);
252
- }, "areObjectsEqual")
253
- }), "createCustomConfig")
254
- });
255
- };
256
- EqualityService = _ts_decorate5([
257
- injectable()
258
- ], EqualityService);
259
-
260
- // lib/error-log/error-log.ts
261
- import { Subject } from "rxjs";
262
- function _ts_decorate6(decorators, target, key, desc) {
263
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
264
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
265
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
266
- return c > 3 && r && Object.defineProperty(target, key, r), r;
267
- }
268
- __name(_ts_decorate6, "_ts_decorate");
269
- function _ts_metadata4(k, v) {
270
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
271
- }
272
- __name(_ts_metadata4, "_ts_metadata");
273
- var ErrorLog = class {
274
- static {
275
- __name(this, "ErrorLog");
276
- }
277
- _error;
278
- constructor() {
279
- this._error = new Subject();
280
- }
281
- get error() {
282
- return this._error;
283
- }
284
- add(error) {
285
- console.error(error);
286
- this._error.next(error);
287
- }
288
- clear() {
289
- console.clear();
290
- }
291
- };
292
- ErrorLog = _ts_decorate6([
293
- injectable(),
294
- _ts_metadata4("design:type", Function),
295
- _ts_metadata4("design:paramtypes", [])
296
- ], ErrorLog);
297
-
298
- // lib/error-log/pretty-printer.ts
299
- function registerHandler(handler) {
300
- return {
301
- predicate: handler.predicate,
302
- action: /* @__PURE__ */ __name((value, level, quoteStrings) => handler.action(value, level, quoteStrings), "action")
303
- };
304
- }
305
- __name(registerHandler, "registerHandler");
306
- var PrettyPrinter = class {
307
- static {
308
- __name(this, "PrettyPrinter");
309
- }
310
- indent;
311
- handlers;
312
- constructor(indent = 4) {
313
- this.indent = indent;
314
- this.handlers = [
315
- registerHandler({
316
- predicate: /* @__PURE__ */ __name((v) => v === null || [
317
- "string",
318
- "number",
319
- "boolean",
320
- "bigint",
321
- "symbol",
322
- "undefined"
323
- ].includes(typeof v), "predicate"),
324
- action: /* @__PURE__ */ __name((v, level, quoteStrings) => [
325
- this.spaces(level) + this.formatPrimitive(v, quoteStrings ?? false)
326
- ], "action")
327
- }),
328
- registerHandler({
329
- predicate: /* @__PURE__ */ __name((v) => typeof v === "function", "predicate"),
330
- action: /* @__PURE__ */ __name((_, level) => [
331
- this.spaces(level) + "[[function]]"
332
- ], "action")
333
- }),
334
- registerHandler({
335
- predicate: Array.isArray,
336
- action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
337
- if (v.length === 0) {
338
- return [
339
- this.spaces(level) + "[]"
340
- ];
341
- }
342
- const lines = [
343
- this.spaces(level) + "["
344
- ];
345
- for (let i = 0; i < v.length; i++) {
346
- const nested = this.toLines(v[i], level + 1, quoteStrings);
347
- lines.push(...nested);
348
- if (i < v.length - 1) {
349
- lines[lines.length - 1] += ",";
350
- }
351
- }
352
- lines.push(this.spaces(level) + "]");
353
- return lines;
354
- }, "action")
355
- }),
356
- registerHandler({
357
- predicate: /* @__PURE__ */ __name((v) => v instanceof Map, "predicate"),
358
- action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
359
- if (v.size === 0) {
360
- return [
361
- this.spaces(level) + "{}"
362
- ];
363
- }
364
- const lines = [
365
- this.spaces(level) + "{"
366
- ];
367
- const next = this.spaces(level + 1);
368
- for (const [k, val] of v.entries()) {
369
- const nested = this.toLines(val, level + 1, quoteStrings);
370
- lines.push(`${next}${this.formatKey(k)}: ${nested[0].trimStart()}`);
371
- if (nested.length > 1) {
372
- lines.push(...nested.slice(1));
373
- }
374
- }
375
- lines.push(this.spaces(level) + "}");
376
- return lines;
377
- }, "action")
378
- }),
379
- registerHandler({
380
- predicate: /* @__PURE__ */ __name((v) => v instanceof Set, "predicate"),
381
- action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
382
- if (v.size === 0) {
383
- return [
384
- this.spaces(level) + "{}"
385
- ];
386
- }
387
- const lines = [
388
- this.spaces(level) + "{"
389
- ];
390
- for (const item of v) {
391
- lines.push(...this.toLines(item, level + 1, quoteStrings));
392
- }
393
- lines.push(this.spaces(level) + "}");
394
- return lines;
395
- }, "action")
396
- }),
397
- registerHandler({
398
- predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && "toLines" in v, "predicate"),
399
- action: /* @__PURE__ */ __name((v, _level) => v.toLines(this.indent, _level), "action")
400
- }),
401
- registerHandler({
402
- predicate: /* @__PURE__ */ __name((v) => this.isCustomToString(v), "predicate"),
403
- action: /* @__PURE__ */ __name((v, level) => {
404
- const raw = v.toString(this.indent, level);
405
- const lines = Array.isArray(raw) ? raw : String(raw).split("\n");
406
- return lines.map((l) => this.spaces(level) + l);
407
- }, "action")
408
- }),
409
- registerHandler({
410
- predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && !Array.isArray(v), "predicate"),
411
- action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
412
- const keys = Object.keys(v);
413
- if (keys.length === 0) {
414
- return [
415
- this.spaces(level) + "{}"
416
- ];
417
- }
418
- const lines = [
419
- this.spaces(level) + "{"
420
- ];
421
- const next = this.spaces(level + 1);
422
- for (const key of keys) {
423
- const nested = this.toLines(v[key], level + 1, quoteStrings);
424
- lines.push(`${next}${key}: ${nested[0].trimStart()}`);
425
- if (nested.length > 1) {
426
- lines.push(...nested.slice(1));
427
- }
428
- }
429
- lines.push(this.spaces(level) + "}");
430
- return lines;
431
- }, "action")
432
- })
433
- ];
299
+ priority = 4;
300
+ getIndexes(map) {
301
+ return map.keys();
434
302
  }
435
- toString(value, quoteStrings = true) {
436
- return this.toLines(value, 0, quoteStrings).join("\n");
303
+ isAsync() {
304
+ return false;
437
305
  }
438
- toLines(value, level = 0, quoteStrings = true) {
439
- for (const handler of this.handlers) {
440
- if (handler.predicate(value)) {
441
- return handler.action(value, level, quoteStrings);
442
- }
443
- }
444
- return [
445
- this.spaces(level) + String(value)
446
- ];
306
+ hasValue(map, key) {
307
+ return map.has(key);
447
308
  }
448
- formatPrimitive(value, quoteStrings) {
449
- if (typeof value === "string" && quoteStrings) {
450
- return `'${value}'`;
451
- }
452
- return String(value);
309
+ getResolvedValue(map, key) {
310
+ return map.get(key);
453
311
  }
454
- formatKey(key) {
455
- return typeof key === "string" ? key : String(key);
312
+ getValue(map, key) {
313
+ return this.getResolvedValue(map, key);
456
314
  }
457
- spaces(level) {
458
- return " ".repeat(this.indent * level);
315
+ setValue(map, key, value) {
316
+ map.set(key, value);
459
317
  }
460
- isCustomToString(value) {
461
- if (typeof value !== "object" || value === null) return false;
462
- const proto = Object.getPrototypeOf(value);
463
- if (!proto) return false;
464
- const desc = Object.getOwnPropertyDescriptor(proto, "toString");
465
- return !!desc && typeof desc.value === "function" && desc.value !== Object.prototype.toString;
318
+ applies(map) {
319
+ return map instanceof Map;
466
320
  }
467
321
  };
468
-
469
- // lib/error-log/print-value.ts
470
- function printValue(value) {
471
- console.log(new PrettyPrinter().toString(value, false));
472
- }
473
- __name(printValue, "printValue");
322
+ MapKeyAccessor = _ts_decorate4([
323
+ injectable()
324
+ ], MapKeyAccessor);
474
325
 
475
326
  // lib/exceptions/argument-exception.ts
476
327
  var ArgumentException = class extends Error {
@@ -719,229 +570,301 @@ function createMessage(expression, message, position) {
719
570
  }
720
571
  return `Invalid expression ${expression}. ${message}.`;
721
572
  }
722
- __name(createMessage, "createMessage");
573
+ __name(createMessage, "createMessage");
574
+
575
+ // lib/exceptions/unexpected-exception.ts
576
+ var UnexpectedException = class extends Error {
577
+ static {
578
+ __name(this, "UnexpectedException");
579
+ }
580
+ constructor(message) {
581
+ super(message);
582
+ }
583
+ };
584
+
585
+ // lib/index-value-accessor/method-accessor.ts
586
+ function _ts_decorate5(decorators, target, key, desc) {
587
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
588
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
589
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
590
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
591
+ }
592
+ __name(_ts_decorate5, "_ts_decorate");
593
+ function _ts_metadata2(k, v) {
594
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
595
+ }
596
+ __name(_ts_metadata2, "_ts_metadata");
597
+ function _ts_param2(paramIndex, decorator) {
598
+ return function(target, key) {
599
+ decorator(target, key, paramIndex);
600
+ };
601
+ }
602
+ __name(_ts_param2, "_ts_param");
603
+ var MethodAccessor = class {
604
+ static {
605
+ __name(this, "MethodAccessor");
606
+ }
607
+ _functionCallResultCacheFactory;
608
+ priority = 6;
609
+ constructor(_functionCallResultCacheFactory) {
610
+ this._functionCallResultCacheFactory = _functionCallResultCacheFactory;
611
+ }
612
+ getIndexes() {
613
+ return [].values();
614
+ }
615
+ isAsync() {
616
+ return false;
617
+ }
618
+ hasValue(context, index) {
619
+ return this._functionCallResultCacheFactory.has(context, index);
620
+ }
621
+ getResolvedValue(context, index) {
622
+ return this.getValue(context, index);
623
+ }
624
+ getValue(context, index) {
625
+ return this._functionCallResultCacheFactory.get(context, index)?.result;
626
+ }
627
+ setValue(_, index) {
628
+ throw new UnsupportedException(`Cannot set method '${index}'`);
629
+ }
630
+ applies(context, index) {
631
+ if (typeof context !== "object" || context === null) {
632
+ return false;
633
+ }
634
+ const prop = context[index.functionName];
635
+ return Type.isFunction(prop) || Type.isArrowFunction(prop);
636
+ }
637
+ };
638
+ MethodAccessor = _ts_decorate5([
639
+ injectable(),
640
+ _ts_param2(0, inject(RsXCoreInjectionTokens.IFunctionCallResultCacheFactory)),
641
+ _ts_metadata2("design:type", Function),
642
+ _ts_metadata2("design:paramtypes", [
643
+ typeof IFunctionCallResultCacheFactory === "undefined" ? Object : IFunctionCallResultCacheFactory
644
+ ])
645
+ ], MethodAccessor);
646
+
647
+ // lib/index-value-accessor/observable-accessor.ts
648
+ import { BehaviorSubject, isObservable, Subject } from "rxjs";
649
+
650
+ // lib/types/set.ts
651
+ function replaceSetItemAt(set, oldValue, newValue) {
652
+ const values = Array.from(set);
653
+ const index = values.indexOf(oldValue);
654
+ if (index === -1) {
655
+ throw new RangeError("Index out of range");
656
+ }
657
+ values[index] = newValue;
658
+ set.clear();
659
+ values.forEach((value) => set.add(value));
660
+ return set;
661
+ }
662
+ __name(replaceSetItemAt, "replaceSetItemAt");
723
663
 
724
- // lib/exceptions/unexpected-exception.ts
725
- var UnexpectedException = class extends Error {
726
- static {
727
- __name(this, "UnexpectedException");
728
- }
729
- constructor(message) {
730
- super(message);
731
- }
732
- };
664
+ // lib/types/utc-date.ts
665
+ function utCDate(year, month = 0, date = 1, hours = 0, minutes = 0, seconds = 0, millisecond = 0) {
666
+ return new Date(Date.UTC(year, month, date, hours, minutes, seconds, millisecond));
667
+ }
668
+ __name(utCDate, "utCDate");
733
669
 
734
- // lib/exceptions/unsupported-exception.ts
735
- var UnsupportedException = class extends Error {
736
- static {
737
- __name(this, "UnsupportedException");
738
- }
739
- constructor(message) {
740
- super(message);
741
- }
742
- };
670
+ // lib/index-value-accessor/pending.ts
671
+ var PENDING = Symbol("pending");
743
672
 
744
- // lib/singleton-factory/singleton.factory.ts
745
- function _ts_decorate7(decorators, target, key, desc) {
673
+ // lib/index-value-accessor/observable-accessor.ts
674
+ function _ts_decorate6(decorators, target, key, desc) {
746
675
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
747
676
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
748
677
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
749
678
  return c > 3 && r && Object.defineProperty(target, key, r), r;
750
679
  }
751
- __name(_ts_decorate7, "_ts_decorate");
752
- function _ts_metadata5(k, v) {
680
+ __name(_ts_decorate6, "_ts_decorate");
681
+ function _ts_metadata3(k, v) {
753
682
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
754
683
  }
755
- __name(_ts_metadata5, "_ts_metadata");
756
- var SingletonFactory = class {
684
+ __name(_ts_metadata3, "_ts_metadata");
685
+ function _ts_param3(paramIndex, decorator) {
686
+ return function(target, key) {
687
+ decorator(target, key, paramIndex);
688
+ };
689
+ }
690
+ __name(_ts_param3, "_ts_param");
691
+ var ObservableAccessor = class {
757
692
  static {
758
- __name(this, "SingletonFactory");
693
+ __name(this, "ObservableAccessor");
759
694
  }
760
- _instances = /* @__PURE__ */ new Map();
761
- _referenceCounts = /* @__PURE__ */ new Map();
762
- constructor() {
695
+ _resolvedValueCache;
696
+ priority = 2;
697
+ constructor(_resolvedValueCache) {
698
+ this._resolvedValueCache = _resolvedValueCache;
763
699
  }
764
- exists(target) {
765
- for (const instance of this._instances.values()) {
766
- if (target === instance) {
767
- return true;
768
- }
769
- }
770
- return false;
700
+ getIndexes() {
701
+ return [].values();
771
702
  }
772
- toLines(indent = 4, level = 0) {
773
- const lines = [];
774
- const spaces = " ".repeat(indent * level);
775
- const spacesNext = " ".repeat(indent * (level + 1));
776
- const prettyPrinter = new PrettyPrinter();
777
- lines.push(spaces + "___________________________________________________________");
778
- lines.push(spaces + `${this.constructor.name}`);
779
- for (const [key, instance] of this._instances.entries()) {
780
- lines.push(spacesNext + "___________________________________________________________");
781
- lines.push(spacesNext + `key (ref. count = ${this._referenceCounts.get(key)}):`);
782
- const keyLines = prettyPrinter.toLines(key, level + 2, false);
783
- lines.push(...keyLines);
784
- lines.push(spacesNext + "instance:");
785
- const instanceLines = prettyPrinter.toLines(instance, level + 2, false);
786
- lines.push(...instanceLines);
703
+ isAsync() {
704
+ return true;
705
+ }
706
+ getResolvedValue(context, index) {
707
+ if (context instanceof BehaviorSubject) return context.value;
708
+ const val = this.getIndexedValue(context, index);
709
+ if (val && typeof val === "object" || typeof val === "function") {
710
+ return this._resolvedValueCache.get(val) ?? PENDING;
787
711
  }
788
- return lines;
712
+ return PENDING;
789
713
  }
790
- toString(indent = 4, level = 0) {
791
- return this.toLines(indent, level).map((l) => " ".repeat(indent * level) + l).join("\n");
714
+ hasValue(context, index) {
715
+ return this.getResolvedValue(context, index) !== PENDING;
792
716
  }
793
- [Symbol.for("nodejs.util.inspect.custom")]() {
794
- return `${this.constructor.name}`;
717
+ getValue(context, index) {
718
+ return this.getIndexedValue(context, index);
795
719
  }
796
- get isEmpty() {
797
- return this._instances.size === 0;
720
+ setValue(context, index, value) {
721
+ const val = this.getIndexedValue(context, index);
722
+ if (val instanceof Subject) {
723
+ val.next(value);
724
+ return;
725
+ }
726
+ throw new UnsupportedException("Cannot set value for an observable");
798
727
  }
799
- ids() {
800
- return this._instances.keys();
728
+ applies(context, index) {
729
+ const val = this.getIndexedValue(context, index);
730
+ return isObservable(val);
801
731
  }
802
- getFromId(id) {
803
- return this._instances.get(id);
732
+ setLastValue(observable, value) {
733
+ this._resolvedValueCache.set(observable, value);
804
734
  }
805
- has(id) {
806
- return this._instances.has(id);
735
+ clearLastValue(observable) {
736
+ this._resolvedValueCache.delete(observable);
807
737
  }
808
- getFromData(data) {
809
- const id = this.getId(data);
810
- return id !== void 0 ? this.getFromId(id) : void 0;
738
+ getIndexedValue(context, index) {
739
+ return (Type.toObject(context) ?? {})[index];
811
740
  }
812
- dispose() {
813
- for (const id of this._instances.keys()) {
814
- this.release(id, true);
815
- }
816
- this._instances.clear();
817
- this._referenceCounts.clear();
818
- this.onDipose();
741
+ };
742
+ ObservableAccessor = _ts_decorate6([
743
+ injectable(),
744
+ _ts_param3(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
745
+ _ts_metadata3("design:type", Function),
746
+ _ts_metadata3("design:paramtypes", [
747
+ typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
748
+ ])
749
+ ], ObservableAccessor);
750
+
751
+ // lib/index-value-accessor/promise-accessor.ts
752
+ function _ts_decorate7(decorators, target, key, desc) {
753
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
754
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
755
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
756
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
757
+ }
758
+ __name(_ts_decorate7, "_ts_decorate");
759
+ function _ts_metadata4(k, v) {
760
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
761
+ }
762
+ __name(_ts_metadata4, "_ts_metadata");
763
+ function _ts_param4(paramIndex, decorator) {
764
+ return function(target, key) {
765
+ decorator(target, key, paramIndex);
766
+ };
767
+ }
768
+ __name(_ts_param4, "_ts_param");
769
+ var PromiseAccessor = class {
770
+ static {
771
+ __name(this, "PromiseAccessor");
819
772
  }
820
- getOrCreate(data) {
821
- let instance = this.getFromId(this.getOrCreateId(data));
822
- if (instance === void 0) {
823
- instance = this.create(data).instance;
824
- }
825
- return instance;
773
+ _resolvedValueCache;
774
+ priority = 1;
775
+ constructor(_resolvedValueCache) {
776
+ this._resolvedValueCache = _resolvedValueCache;
826
777
  }
827
- create(data) {
828
- const id = this.getOrCreateId(data);
829
- const instance = this.getOrCreateInstance(id, data);
830
- const result = {
831
- id,
832
- instance,
833
- referenceCount: this.updateReferenceCount(id, 1, instance)
834
- };
835
- if (result.referenceCount === 1) {
836
- this.onInstanceCreated(result.instance, data);
837
- }
838
- return result;
778
+ getIndexes() {
779
+ return [].values();
839
780
  }
840
- release(id, force) {
841
- const instance = this._instances.get(id);
842
- if (!instance) {
843
- return {
844
- instance: null,
845
- referenceCount: 0
846
- };
847
- }
848
- return {
849
- referenceCount: this.updateReferenceCount(id, -1, instance, force),
850
- instance
851
- };
781
+ isAsync() {
782
+ return true;
852
783
  }
853
- get keys() {
854
- return Array.from(this._instances.keys());
784
+ hasValue(context, index) {
785
+ const val = this.getIndexedValue(context, index);
786
+ return this.isCacheable(val) && this._resolvedValueCache.get(val) !== PENDING;
855
787
  }
856
- onDisposeInstance = /* @__PURE__ */ __name((id, dispose) => {
857
- const { referenceCount } = this.release(id);
858
- if (referenceCount === 0) {
859
- dispose();
860
- }
861
- return referenceCount === 0;
862
- }, "onDisposeInstance");
863
- onDipose() {
788
+ getResolvedValue(context, index) {
789
+ const val = this.getIndexedValue(context, index);
790
+ return this.isCacheable(val) ? this._resolvedValueCache.get(val) ?? PENDING : PENDING;
864
791
  }
865
- onReleased() {
792
+ getValue(context, index) {
793
+ return this.getIndexedValue(context, index);
866
794
  }
867
- releaseInstance(_instance, _id) {
795
+ setValue() {
796
+ throw new UnsupportedException("Cannot set value for a Promise");
868
797
  }
869
- onInstanceCreated(_instance, _data) {
798
+ applies(context, index) {
799
+ const val = this.getIndexedValue(context, index);
800
+ return val instanceof Promise;
870
801
  }
871
- getOrCreateId(data) {
872
- return this.getId(data) ?? this.createId(data);
802
+ setLastValue(promise, value) {
803
+ this._resolvedValueCache.set(promise, value);
873
804
  }
874
- getReferenceCount(id) {
875
- return this._referenceCounts.get(id) ?? 0;
805
+ clearLastValue(promise) {
806
+ this._resolvedValueCache.delete(promise);
876
807
  }
877
- updateReferenceCount(id, change, instance, forceRelease) {
878
- const referenceCount = this.getReferenceCount(id) + change;
879
- if (change === -1 && (forceRelease || referenceCount === 0)) {
880
- this._instances.delete(id);
881
- this._referenceCounts.delete(id);
882
- this.releaseInstance(instance, id);
883
- this.onReleased();
884
- } else if (referenceCount > 0) {
885
- this._referenceCounts.set(id, referenceCount);
886
- }
887
- return referenceCount;
808
+ getIndexedValue(context, index) {
809
+ return (Type.toObject(context) ?? {})[index];
888
810
  }
889
- getOrCreateInstance(id, data) {
890
- let instance = this._instances.get(id);
891
- if (instance !== void 0) {
892
- return instance;
893
- }
894
- instance = this.createInstance(data, id);
895
- this._instances.set(id, instance);
896
- return instance;
811
+ isCacheable(value) {
812
+ return value !== null && (typeof value === "object" || typeof value === "function");
897
813
  }
898
814
  };
899
- _ts_decorate7([
900
- preDestroy(),
901
- _ts_metadata5("design:type", Function),
902
- _ts_metadata5("design:paramtypes", []),
903
- _ts_metadata5("design:returntype", void 0)
904
- ], SingletonFactory.prototype, "dispose", null);
815
+ PromiseAccessor = _ts_decorate7([
816
+ injectable(),
817
+ _ts_param4(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
818
+ _ts_metadata4("design:type", Function),
819
+ _ts_metadata4("design:paramtypes", [
820
+ typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
821
+ ])
822
+ ], PromiseAccessor);
905
823
 
906
- // lib/function-call-index/function-call-index.ts
907
- var FunctionCallIndex = class {
824
+ // lib/index-value-accessor/property-value-accessor.ts
825
+ import { isObservable as isObservable2 } from "rxjs";
826
+ var PropertyValueAccessor = class {
908
827
  static {
909
- __name(this, "FunctionCallIndex");
828
+ __name(this, "PropertyValueAccessor");
910
829
  }
911
- context;
912
- functionName;
913
- _sequenceWithId;
914
- _owner;
915
- _isDisposed = false;
916
- _id;
917
- constructor(context, functionName, _sequenceWithId, _owner) {
918
- this.context = context;
919
- this.functionName = functionName;
920
- this._sequenceWithId = _sequenceWithId;
921
- this._owner = _owner;
830
+ priority = 7;
831
+ isAsync() {
832
+ return false;
922
833
  }
923
- get id() {
924
- if (!this._id) {
925
- this._id = `${this.functionName}${this._sequenceWithId.id}`;
834
+ getIndexes(context) {
835
+ const obj = Type.toObject(context);
836
+ if (!obj) {
837
+ return [].values();
926
838
  }
927
- return this._id;
839
+ return Object.keys(obj).filter((key) => !Type.isMethod(obj[key])).values();
928
840
  }
929
- get argumentsId() {
930
- return this._sequenceWithId;
841
+ hasValue(context, index) {
842
+ const val = this.getValue(context, index);
843
+ return val !== void 0;
931
844
  }
932
- dispose() {
933
- if (this._isDisposed) {
934
- return;
845
+ getResolvedValue(context, index) {
846
+ return this.getValue(context, index);
847
+ }
848
+ getValue(context, index) {
849
+ const obj = Type.toObject(context);
850
+ return obj ? obj[index] : void 0;
851
+ }
852
+ setValue(context, index, value) {
853
+ const obj = Type.toObject(context);
854
+ if (obj) {
855
+ obj[index] = value;
935
856
  }
936
- if (this._owner.canDispose?.()) {
937
- this._isDisposed = true;
938
- this._sequenceWithId.dispose();
857
+ }
858
+ applies(context, index) {
859
+ const obj = Type.toObject(context);
860
+ if (!obj) {
861
+ return false;
939
862
  }
940
- this._owner.release();
863
+ return Type.hasProperty(obj, index) && !(obj instanceof Date) && !isObservable2(obj[index]) && !(obj[index] instanceof Promise);
941
864
  }
942
865
  };
943
866
 
944
- // lib/function-call-index/function-call-index.factory.ts
867
+ // lib/index-value-accessor/resolved-value-cache.ts
945
868
  function _ts_decorate8(decorators, target, key, desc) {
946
869
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
947
870
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -949,616 +872,729 @@ function _ts_decorate8(decorators, target, key, desc) {
949
872
  return c > 3 && r && Object.defineProperty(target, key, r), r;
950
873
  }
951
874
  __name(_ts_decorate8, "_ts_decorate");
952
- function _ts_metadata6(k, v) {
953
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
954
- }
955
- __name(_ts_metadata6, "_ts_metadata");
956
- function _ts_param4(paramIndex, decorator) {
957
- return function(target, key) {
958
- decorator(target, key, paramIndex);
959
- };
875
+ var ResolvedValueCache = class {
876
+ static {
877
+ __name(this, "ResolvedValueCache");
878
+ }
879
+ _resolvedValues = /* @__PURE__ */ new WeakMap();
880
+ set(source, value) {
881
+ this._resolvedValues.set(source, value);
882
+ }
883
+ get(source) {
884
+ return this._resolvedValues.get(source);
885
+ }
886
+ delete(source) {
887
+ this._resolvedValues.delete(source);
888
+ }
889
+ };
890
+ ResolvedValueCache = _ts_decorate8([
891
+ injectable()
892
+ ], ResolvedValueCache);
893
+
894
+ // lib/index-value-accessor/set-key-accessor.ts
895
+ function _ts_decorate9(decorators, target, key, desc) {
896
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
897
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
898
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
899
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
960
900
  }
961
- __name(_ts_param4, "_ts_param");
962
- var FunctionCallIndexFactory = class extends SingletonFactory {
901
+ __name(_ts_decorate9, "_ts_decorate");
902
+ var SetKeyAccessor = class {
963
903
  static {
964
- __name(this, "FunctionCallIndexFactory");
904
+ __name(this, "SetKeyAccessor");
965
905
  }
966
- _sequenceIdFactory;
967
- constructor(_sequenceIdFactory) {
968
- super(), this._sequenceIdFactory = _sequenceIdFactory;
906
+ priority = 3;
907
+ getIndexes(set) {
908
+ return new Set(set).values();
969
909
  }
970
- getId(data) {
971
- return this._sequenceIdFactory.get(data.context, data.arguments);
910
+ isAsync() {
911
+ return false;
972
912
  }
973
- createInstance(data, id) {
974
- return new FunctionCallIndex(data.context, data.functionName, id, {
975
- canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
976
- release: /* @__PURE__ */ __name(() => this.release(id), "release")
977
- });
913
+ hasValue(set, key) {
914
+ return set.has(key);
978
915
  }
979
- createId(data) {
980
- const context = data.context;
981
- if (!context || typeof context !== "object") {
982
- throw new ArgumentException(`Expected context to be an object, got ${String(context)}`);
983
- }
984
- const fn = context[data.functionName];
985
- return this._sequenceIdFactory.create(fn, data.arguments);
916
+ getResolvedValue(set, key) {
917
+ return set.has(key) ? key : void 0;
986
918
  }
987
- releaseInstance(_, id) {
988
- id.dispose();
919
+ getValue(set, key) {
920
+ return this.getResolvedValue(set, key);
921
+ }
922
+ setValue(set, key, value) {
923
+ replaceSetItemAt(set, key, value);
924
+ }
925
+ applies(map) {
926
+ return map instanceof Set;
989
927
  }
990
928
  };
991
- FunctionCallIndexFactory = _ts_decorate8([
992
- injectable(),
993
- _ts_param4(0, inject(RsXCoreInjectionTokens.ISequenceIdFactory)),
994
- _ts_metadata6("design:type", Function),
995
- _ts_metadata6("design:paramtypes", [
996
- typeof ISequenceIdFactory === "undefined" ? Object : ISequenceIdFactory
997
- ])
998
- ], FunctionCallIndexFactory);
929
+ SetKeyAccessor = _ts_decorate9([
930
+ injectable()
931
+ ], SetKeyAccessor);
999
932
 
1000
- // lib/function-call-result-cache/function-call-result-cache.factory.ts
1001
- function _ts_decorate9(decorators, target, key, desc) {
933
+ // lib/deep-clone/deep-clone-except.ts
934
+ function _ts_decorate10(decorators, target, key, desc) {
1002
935
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1003
936
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1004
937
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1005
938
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1006
939
  }
1007
- __name(_ts_decorate9, "_ts_decorate");
1008
- function _ts_metadata7(k, v) {
940
+ __name(_ts_decorate10, "_ts_decorate");
941
+ function _ts_metadata5(k, v) {
1009
942
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1010
943
  }
1011
- __name(_ts_metadata7, "_ts_metadata");
944
+ __name(_ts_metadata5, "_ts_metadata");
1012
945
  function _ts_param5(paramIndex, decorator) {
1013
946
  return function(target, key) {
1014
947
  decorator(target, key, paramIndex);
1015
948
  };
1016
949
  }
1017
950
  __name(_ts_param5, "_ts_param");
1018
- var FunctionCallResultCache = class FunctionCallResultCache2 {
951
+ var DeepCloneValueExcept = class {
1019
952
  static {
1020
- __name(this, "FunctionCallResultCache");
1021
- }
1022
- _disposeableIndex;
1023
- result;
1024
- _owner;
1025
- _isDisposed = false;
1026
- constructor(_disposeableIndex, result, _owner) {
1027
- this._disposeableIndex = _disposeableIndex;
1028
- this.result = result;
1029
- this._owner = _owner;
953
+ __name(this, "DeepCloneValueExcept");
1030
954
  }
1031
- get index() {
1032
- return this._disposeableIndex;
955
+ _resolvedValueCache;
956
+ constructor(_resolvedValueCache) {
957
+ this._resolvedValueCache = _resolvedValueCache;
1033
958
  }
1034
- dispose() {
1035
- if (this._isDisposed) {
1036
- return;
1037
- }
1038
- if (this._owner.canDispose?.()) {
1039
- this._disposeableIndex.dispose();
1040
- this._isDisposed = true;
959
+ except(source) {
960
+ if (source instanceof Promise || source instanceof Observable) {
961
+ const value = this._resolvedValueCache.get(source);
962
+ return value === void 0 ? PENDING : value;
1041
963
  }
1042
- this._owner.release();
1043
- }
1044
- };
1045
- var FunctionCallResultCacheForContextManager = class FunctionCallResultCacheForContextManager2 extends SingletonFactory {
1046
- static {
1047
- __name(this, "FunctionCallResultCacheForContextManager");
1048
- }
1049
- _context;
1050
- _functionCallIndexFactory;
1051
- releaseContext;
1052
- constructor(_context, _functionCallIndexFactory, releaseContext) {
1053
- super(), this._context = _context, this._functionCallIndexFactory = _functionCallIndexFactory, this.releaseContext = releaseContext;
1054
- }
1055
- getId(data) {
1056
- return this._functionCallIndexFactory.getFromData({
1057
- functionName: data.functionName,
1058
- context: this._context,
1059
- arguments: data.arguments
1060
- });
1061
- }
1062
- createInstance(data, id) {
1063
- return new FunctionCallResultCache(id, data.result, {
1064
- canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
1065
- release: /* @__PURE__ */ __name(() => this.release(id), "release")
1066
- });
1067
- }
1068
- createId(data) {
1069
- return this._functionCallIndexFactory.create({
1070
- functionName: data.functionName,
1071
- context: this._context,
1072
- arguments: data.arguments
1073
- }).instance;
1074
- }
1075
- releaseInstance(_, id) {
1076
- this._functionCallIndexFactory.release(id.argumentsId);
1077
- }
1078
- onReleased() {
1079
- this.releaseContext();
964
+ return void 0;
1080
965
  }
1081
966
  };
1082
- var FunctionCallResultCacheManager = class FunctionCallResultCacheManager2 extends SingletonFactory {
1083
- static {
1084
- __name(this, "FunctionCallResultCacheManager");
1085
- }
1086
- _functionCallIndexFactory;
1087
- constructor(_functionCallIndexFactory) {
1088
- super(), this._functionCallIndexFactory = _functionCallIndexFactory;
1089
- }
1090
- getId(contex) {
1091
- return this.createId(contex);
967
+ DeepCloneValueExcept = _ts_decorate10([
968
+ injectable(),
969
+ _ts_param5(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
970
+ _ts_metadata5("design:type", Function),
971
+ _ts_metadata5("design:paramtypes", [
972
+ typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
973
+ ])
974
+ ], DeepCloneValueExcept);
975
+
976
+ // lib/deep-clone/default-deep-clone.ts
977
+ function _ts_decorate11(decorators, target, key, desc) {
978
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
979
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
980
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
981
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
982
+ }
983
+ __name(_ts_decorate11, "_ts_decorate");
984
+ function _ts_metadata6(k, v) {
985
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
986
+ }
987
+ __name(_ts_metadata6, "_ts_metadata");
988
+ function _ts_param6(paramIndex, decorator) {
989
+ return function(target, key) {
990
+ decorator(target, key, paramIndex);
991
+ };
992
+ }
993
+ __name(_ts_param6, "_ts_param");
994
+ var DefaultDeepClone = class {
995
+ static {
996
+ __name(this, "DefaultDeepClone");
1092
997
  }
1093
- createInstance(context, id) {
1094
- return new FunctionCallResultCacheForContextManager(context, this._functionCallIndexFactory, () => this.release(id));
998
+ _deepCloneList;
999
+ priority = 0;
1000
+ constructor(_deepCloneList) {
1001
+ this._deepCloneList = _deepCloneList;
1095
1002
  }
1096
- createId(contex) {
1097
- return contex;
1003
+ clone(source) {
1004
+ let error = null;
1005
+ for (let i = 0; i < this._deepCloneList.length; i++) {
1006
+ try {
1007
+ return this._deepCloneList[i].clone(source);
1008
+ } catch (e) {
1009
+ error = e;
1010
+ }
1011
+ }
1012
+ throw error;
1098
1013
  }
1099
1014
  };
1100
- var FunctionCallResultCacheFactory = class {
1015
+ DefaultDeepClone = _ts_decorate11([
1016
+ injectable(),
1017
+ _ts_param6(0, multiInject(RsXCoreInjectionTokens.IDeepCloneList)),
1018
+ _ts_metadata6("design:type", Function),
1019
+ _ts_metadata6("design:paramtypes", [
1020
+ Object
1021
+ ])
1022
+ ], DefaultDeepClone);
1023
+
1024
+ // lib/deep-clone/lodash-deep-clone.ts
1025
+ import cloneDeepWith from "lodash.clonedeepwith";
1026
+ function _ts_decorate12(decorators, target, key, desc) {
1027
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1028
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1029
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1030
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1031
+ }
1032
+ __name(_ts_decorate12, "_ts_decorate");
1033
+ function _ts_metadata7(k, v) {
1034
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1035
+ }
1036
+ __name(_ts_metadata7, "_ts_metadata");
1037
+ function _ts_param7(paramIndex, decorator) {
1038
+ return function(target, key) {
1039
+ decorator(target, key, paramIndex);
1040
+ };
1041
+ }
1042
+ __name(_ts_param7, "_ts_param");
1043
+ var LodashDeepClone = class {
1101
1044
  static {
1102
- __name(this, "FunctionCallResultCacheFactory");
1103
- }
1104
- _functionCallResultCacheManager;
1105
- constructor(functionCallIndexFactory) {
1106
- this._functionCallResultCacheManager = new FunctionCallResultCacheManager(functionCallIndexFactory);
1107
- }
1108
- create(context, result) {
1109
- return this._functionCallResultCacheManager.create(context).instance.create(result).instance;
1045
+ __name(this, "LodashDeepClone");
1110
1046
  }
1111
- has(context, index) {
1112
- return this._functionCallResultCacheManager.getFromId(context)?.has(index) ?? false;
1047
+ _deepCloneExcept;
1048
+ priority = 1;
1049
+ constructor(_deepCloneExcept) {
1050
+ this._deepCloneExcept = _deepCloneExcept;
1113
1051
  }
1114
- get(context, index) {
1115
- return this._functionCallResultCacheManager.getFromId(context)?.getFromId(index);
1052
+ clone(source) {
1053
+ return cloneDeepWith(source, this.cloneExceptPredicate);
1116
1054
  }
1055
+ cloneExceptPredicate = /* @__PURE__ */ __name((value) => {
1056
+ return this._deepCloneExcept.except(value);
1057
+ }, "cloneExceptPredicate");
1117
1058
  };
1118
- FunctionCallResultCacheFactory = _ts_decorate9([
1059
+ LodashDeepClone = _ts_decorate12([
1119
1060
  injectable(),
1120
- _ts_param5(0, inject(RsXCoreInjectionTokens.IFunctionCallIndexFactory)),
1061
+ _ts_param7(0, inject(RsXCoreInjectionTokens.DefaultDeepCloneExcept)),
1121
1062
  _ts_metadata7("design:type", Function),
1122
1063
  _ts_metadata7("design:paramtypes", [
1123
- typeof IFunctionCallIndexFactory === "undefined" ? Object : IFunctionCallIndexFactory
1064
+ typeof IDeepCloneExcept === "undefined" ? Object : IDeepCloneExcept
1124
1065
  ])
1125
- ], FunctionCallResultCacheFactory);
1066
+ ], LodashDeepClone);
1126
1067
 
1127
- // lib/guid/guid.factory.ts
1128
- function _ts_decorate10(decorators, target, key, desc) {
1068
+ // lib/deep-clone/structured-deep-clone.ts
1069
+ function _ts_decorate13(decorators, target, key, desc) {
1129
1070
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1130
1071
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1131
1072
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1132
1073
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1133
1074
  }
1134
- __name(_ts_decorate10, "_ts_decorate");
1135
- var GuidFactory = class {
1075
+ __name(_ts_decorate13, "_ts_decorate");
1076
+ var StructuredDeepClone = class {
1136
1077
  static {
1137
- __name(this, "GuidFactory");
1078
+ __name(this, "StructuredDeepClone");
1138
1079
  }
1139
- create() {
1140
- return crypto.randomUUID();
1080
+ priority = 2;
1081
+ clone(source) {
1082
+ return structuredClone(source);
1141
1083
  }
1142
1084
  };
1143
- GuidFactory = _ts_decorate10([
1085
+ StructuredDeepClone = _ts_decorate13([
1144
1086
  injectable()
1145
- ], GuidFactory);
1087
+ ], StructuredDeepClone);
1146
1088
 
1147
- // lib/index-value-accessor/array-index-accessor.ts
1148
- function _ts_decorate11(decorators, target, key, desc) {
1089
+ // lib/equality-service/equality-service.ts
1090
+ import { createCustomEqual } from "fast-equals";
1091
+ import { isObservable as isObservable3 } from "rxjs";
1092
+ function _ts_decorate14(decorators, target, key, desc) {
1149
1093
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1150
1094
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1151
1095
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1152
1096
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1153
1097
  }
1154
- __name(_ts_decorate11, "_ts_decorate");
1155
- var ArrayIndexAccessor = class {
1098
+ __name(_ts_decorate14, "_ts_decorate");
1099
+ var EqualityService = class {
1156
1100
  static {
1157
- __name(this, "ArrayIndexAccessor");
1101
+ __name(this, "EqualityService");
1158
1102
  }
1159
- priority = 5;
1160
- isAsync() {
1161
- return false;
1103
+ isEqual = createCustomEqual({
1104
+ createCustomConfig: /* @__PURE__ */ __name((baseConfig) => ({
1105
+ ...baseConfig,
1106
+ areObjectsEqual: /* @__PURE__ */ __name((a, b, equalityCheck) => {
1107
+ if (isObservable3(a) && isObservable3(b)) {
1108
+ return a === b;
1109
+ }
1110
+ return baseConfig.areObjectsEqual(a, b, equalityCheck);
1111
+ }, "areObjectsEqual")
1112
+ }), "createCustomConfig")
1113
+ });
1114
+ };
1115
+ EqualityService = _ts_decorate14([
1116
+ injectable()
1117
+ ], EqualityService);
1118
+
1119
+ // lib/error-log/error-log.ts
1120
+ import { Subject as Subject2 } from "rxjs";
1121
+ function _ts_decorate15(decorators, target, key, desc) {
1122
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1123
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1124
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1125
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1126
+ }
1127
+ __name(_ts_decorate15, "_ts_decorate");
1128
+ function _ts_metadata8(k, v) {
1129
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1130
+ }
1131
+ __name(_ts_metadata8, "_ts_metadata");
1132
+ var ErrorLog = class {
1133
+ static {
1134
+ __name(this, "ErrorLog");
1135
+ }
1136
+ _error;
1137
+ constructor() {
1138
+ this._error = new Subject2();
1139
+ }
1140
+ get error() {
1141
+ return this._error;
1142
+ }
1143
+ add(error) {
1144
+ console.error(error);
1145
+ this._error.next(error);
1146
+ }
1147
+ clear() {
1148
+ console.clear();
1149
+ }
1150
+ };
1151
+ ErrorLog = _ts_decorate15([
1152
+ injectable(),
1153
+ _ts_metadata8("design:type", Function),
1154
+ _ts_metadata8("design:paramtypes", [])
1155
+ ], ErrorLog);
1156
+
1157
+ // lib/error-log/pretty-printer.ts
1158
+ function registerHandler(handler) {
1159
+ return {
1160
+ predicate: handler.predicate,
1161
+ action: /* @__PURE__ */ __name((value, level, quoteStrings) => handler.action(value, level, quoteStrings), "action")
1162
+ };
1163
+ }
1164
+ __name(registerHandler, "registerHandler");
1165
+ var PrettyPrinter = class {
1166
+ static {
1167
+ __name(this, "PrettyPrinter");
1168
+ }
1169
+ indent;
1170
+ handlers;
1171
+ constructor(indent = 4) {
1172
+ this.indent = indent;
1173
+ this.handlers = [
1174
+ registerHandler({
1175
+ predicate: /* @__PURE__ */ __name((v) => v === null || [
1176
+ "string",
1177
+ "number",
1178
+ "boolean",
1179
+ "bigint",
1180
+ "symbol",
1181
+ "undefined"
1182
+ ].includes(typeof v), "predicate"),
1183
+ action: /* @__PURE__ */ __name((v, level, quoteStrings) => [
1184
+ this.spaces(level) + this.formatPrimitive(v, quoteStrings ?? false)
1185
+ ], "action")
1186
+ }),
1187
+ registerHandler({
1188
+ predicate: /* @__PURE__ */ __name((v) => typeof v === "function", "predicate"),
1189
+ action: /* @__PURE__ */ __name((_, level) => [
1190
+ this.spaces(level) + "[[function]]"
1191
+ ], "action")
1192
+ }),
1193
+ registerHandler({
1194
+ predicate: Array.isArray,
1195
+ action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
1196
+ if (v.length === 0) {
1197
+ return [
1198
+ this.spaces(level) + "[]"
1199
+ ];
1200
+ }
1201
+ const lines = [
1202
+ this.spaces(level) + "["
1203
+ ];
1204
+ for (let i = 0; i < v.length; i++) {
1205
+ const nested = this.toLines(v[i], level + 1, quoteStrings);
1206
+ lines.push(...nested);
1207
+ if (i < v.length - 1) {
1208
+ lines[lines.length - 1] += ",";
1209
+ }
1210
+ }
1211
+ lines.push(this.spaces(level) + "]");
1212
+ return lines;
1213
+ }, "action")
1214
+ }),
1215
+ registerHandler({
1216
+ predicate: /* @__PURE__ */ __name((v) => v instanceof Map, "predicate"),
1217
+ action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
1218
+ if (v.size === 0) {
1219
+ return [
1220
+ this.spaces(level) + "{}"
1221
+ ];
1222
+ }
1223
+ const lines = [
1224
+ this.spaces(level) + "{"
1225
+ ];
1226
+ const next = this.spaces(level + 1);
1227
+ for (const [k, val] of v.entries()) {
1228
+ const nested = this.toLines(val, level + 1, quoteStrings);
1229
+ lines.push(`${next}${this.formatKey(k)}: ${nested[0].trimStart()}`);
1230
+ if (nested.length > 1) {
1231
+ lines.push(...nested.slice(1));
1232
+ }
1233
+ }
1234
+ lines.push(this.spaces(level) + "}");
1235
+ return lines;
1236
+ }, "action")
1237
+ }),
1238
+ registerHandler({
1239
+ predicate: /* @__PURE__ */ __name((v) => v instanceof Set, "predicate"),
1240
+ action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
1241
+ if (v.size === 0) {
1242
+ return [
1243
+ this.spaces(level) + "{}"
1244
+ ];
1245
+ }
1246
+ const lines = [
1247
+ this.spaces(level) + "{"
1248
+ ];
1249
+ for (const item of v) {
1250
+ lines.push(...this.toLines(item, level + 1, quoteStrings));
1251
+ }
1252
+ lines.push(this.spaces(level) + "}");
1253
+ return lines;
1254
+ }, "action")
1255
+ }),
1256
+ registerHandler({
1257
+ predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && "toLines" in v, "predicate"),
1258
+ action: /* @__PURE__ */ __name((v, _level) => v.toLines(this.indent, _level), "action")
1259
+ }),
1260
+ registerHandler({
1261
+ predicate: /* @__PURE__ */ __name((v) => this.isCustomToString(v), "predicate"),
1262
+ action: /* @__PURE__ */ __name((v, level) => {
1263
+ const raw = v.toString(this.indent, level);
1264
+ const lines = Array.isArray(raw) ? raw : String(raw).split("\n");
1265
+ return lines.map((l) => this.spaces(level) + l);
1266
+ }, "action")
1267
+ }),
1268
+ registerHandler({
1269
+ predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && !Array.isArray(v), "predicate"),
1270
+ action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
1271
+ const keys = Object.keys(v);
1272
+ if (keys.length === 0) {
1273
+ return [
1274
+ this.spaces(level) + "{}"
1275
+ ];
1276
+ }
1277
+ const lines = [
1278
+ this.spaces(level) + "{"
1279
+ ];
1280
+ const next = this.spaces(level + 1);
1281
+ for (const key of keys) {
1282
+ const nested = this.toLines(v[key], level + 1, quoteStrings);
1283
+ lines.push(`${next}${key}: ${nested[0].trimStart()}`);
1284
+ if (nested.length > 1) {
1285
+ lines.push(...nested.slice(1));
1286
+ }
1287
+ }
1288
+ lines.push(this.spaces(level) + "}");
1289
+ return lines;
1290
+ }, "action")
1291
+ })
1292
+ ];
1162
1293
  }
1163
- getIndexes(array) {
1164
- return array.keys();
1294
+ toString(value, quoteStrings = true) {
1295
+ return this.toLines(value, 0, quoteStrings).join("\n");
1165
1296
  }
1166
- hasValue(array, index) {
1167
- return this.getValue(array, index) !== void 0;
1297
+ toLines(value, level = 0, quoteStrings = true) {
1298
+ for (const handler of this.handlers) {
1299
+ if (handler.predicate(value)) {
1300
+ return handler.action(value, level, quoteStrings);
1301
+ }
1302
+ }
1303
+ return [
1304
+ this.spaces(level) + String(value)
1305
+ ];
1168
1306
  }
1169
- getResolvedValue(array, index) {
1170
- return array[index];
1307
+ formatPrimitive(value, quoteStrings) {
1308
+ if (typeof value === "string" && quoteStrings) {
1309
+ return `'${value}'`;
1310
+ }
1311
+ return String(value);
1171
1312
  }
1172
- getValue(array, index) {
1173
- return this.getResolvedValue(array, index);
1313
+ formatKey(key) {
1314
+ return typeof key === "string" ? key : String(key);
1174
1315
  }
1175
- setValue(array, index, value) {
1176
- array[index] = value;
1316
+ spaces(level) {
1317
+ return " ".repeat(this.indent * level);
1177
1318
  }
1178
- applies(array) {
1179
- return Array.isArray(array);
1319
+ isCustomToString(value) {
1320
+ if (typeof value !== "object" || value === null) return false;
1321
+ const proto = Object.getPrototypeOf(value);
1322
+ if (!proto) return false;
1323
+ const desc = Object.getOwnPropertyDescriptor(proto, "toString");
1324
+ return !!desc && typeof desc.value === "function" && desc.value !== Object.prototype.toString;
1180
1325
  }
1181
1326
  };
1182
- ArrayIndexAccessor = _ts_decorate11([
1183
- injectable()
1184
- ], ArrayIndexAccessor);
1185
1327
 
1186
- // lib/index-value-accessor/date-property-accessor.interface.ts
1187
- var dataProperties = [
1188
- "year",
1189
- "utcYear",
1190
- "month",
1191
- "utcMonth",
1192
- "date",
1193
- "utcDate",
1194
- "hours",
1195
- "utcHours",
1196
- "minutes",
1197
- "utcMinutes",
1198
- "seconds",
1199
- "utcSeconds",
1200
- "milliseconds",
1201
- "utcMilliseconds",
1202
- "time"
1203
- ];
1328
+ // lib/error-log/print-value.ts
1329
+ function printValue(value) {
1330
+ console.log(new PrettyPrinter().toString(value, false));
1331
+ }
1332
+ __name(printValue, "printValue");
1204
1333
 
1205
- // lib/index-value-accessor/date-property-accessor.ts
1206
- function _ts_decorate12(decorators, target, key, desc) {
1334
+ // lib/singleton-factory/singleton.factory.ts
1335
+ function _ts_decorate16(decorators, target, key, desc) {
1207
1336
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1208
1337
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1209
1338
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1210
1339
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1211
1340
  }
1212
- __name(_ts_decorate12, "_ts_decorate");
1213
- var DatePropertyAccessor = class {
1341
+ __name(_ts_decorate16, "_ts_decorate");
1342
+ function _ts_metadata9(k, v) {
1343
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1344
+ }
1345
+ __name(_ts_metadata9, "_ts_metadata");
1346
+ var SingletonFactory = class {
1214
1347
  static {
1215
- __name(this, "DatePropertyAccessor");
1216
- }
1217
- priority = 0;
1218
- _setter = {
1219
- year: /* @__PURE__ */ __name((date, value) => date.setFullYear(value), "year"),
1220
- utcYear: /* @__PURE__ */ __name((date, value) => date.setUTCFullYear(value), "utcYear"),
1221
- month: /* @__PURE__ */ __name((date, value) => date.setMonth(value), "month"),
1222
- utcMonth: /* @__PURE__ */ __name((date, value) => date.setUTCMonth(value), "utcMonth"),
1223
- date: /* @__PURE__ */ __name((date, value) => date.setDate(value), "date"),
1224
- utcDate: /* @__PURE__ */ __name((date, value) => date.setUTCDate(value), "utcDate"),
1225
- hours: /* @__PURE__ */ __name((date, value) => date.setHours(value), "hours"),
1226
- utcHours: /* @__PURE__ */ __name((date, value) => date.setUTCHours(value), "utcHours"),
1227
- minutes: /* @__PURE__ */ __name((date, value) => date.setMinutes(value), "minutes"),
1228
- utcMinutes: /* @__PURE__ */ __name((date, value) => date.setUTCMinutes(value), "utcMinutes"),
1229
- seconds: /* @__PURE__ */ __name((date, value) => date.setSeconds(value), "seconds"),
1230
- utcSeconds: /* @__PURE__ */ __name((date, value) => date.setUTCSeconds(value), "utcSeconds"),
1231
- milliseconds: /* @__PURE__ */ __name((date, value) => date.setMilliseconds(value), "milliseconds"),
1232
- utcMilliseconds: /* @__PURE__ */ __name((date, value) => date.setUTCMilliseconds(value), "utcMilliseconds"),
1233
- time: /* @__PURE__ */ __name((date, value) => date.setTime(value), "time")
1234
- };
1235
- _getters = {
1236
- year: /* @__PURE__ */ __name((date) => date.getFullYear(), "year"),
1237
- utcYear: /* @__PURE__ */ __name((date) => date.getUTCFullYear(), "utcYear"),
1238
- month: /* @__PURE__ */ __name((date) => date.getMonth(), "month"),
1239
- utcMonth: /* @__PURE__ */ __name((date) => date.getUTCMonth(), "utcMonth"),
1240
- date: /* @__PURE__ */ __name((date) => date.getDate(), "date"),
1241
- utcDate: /* @__PURE__ */ __name((date) => date.getUTCDate(), "utcDate"),
1242
- hours: /* @__PURE__ */ __name((date) => date.getHours(), "hours"),
1243
- utcHours: /* @__PURE__ */ __name((date) => date.getUTCHours(), "utcHours"),
1244
- minutes: /* @__PURE__ */ __name((date) => date.getMinutes(), "minutes"),
1245
- utcMinutes: /* @__PURE__ */ __name((date) => date.getUTCMinutes(), "utcMinutes"),
1246
- seconds: /* @__PURE__ */ __name((date) => date.getSeconds(), "seconds"),
1247
- utcSeconds: /* @__PURE__ */ __name((date) => date.getUTCSeconds(), "utcSeconds"),
1248
- milliseconds: /* @__PURE__ */ __name((date) => date.getMilliseconds(), "milliseconds"),
1249
- utcMilliseconds: /* @__PURE__ */ __name((date) => date.getUTCMilliseconds(), "utcMilliseconds"),
1250
- time: /* @__PURE__ */ __name((date) => date.getTime(), "time")
1251
- };
1252
- isAsync() {
1253
- return false;
1348
+ __name(this, "SingletonFactory");
1254
1349
  }
1255
- getIndexes() {
1256
- return dataProperties.values();
1350
+ _instances = /* @__PURE__ */ new Map();
1351
+ _referenceCounts = /* @__PURE__ */ new Map();
1352
+ constructor() {
1257
1353
  }
1258
- hasValue(context, index) {
1259
- return this.getValue(context, index) !== void 0;
1354
+ exists(target) {
1355
+ for (const instance of this._instances.values()) {
1356
+ if (target === instance) {
1357
+ return true;
1358
+ }
1359
+ }
1360
+ return false;
1260
1361
  }
1261
- getResolvedValue(context, index) {
1262
- return this.getValue(context, index);
1362
+ toLines(indent = 4, level = 0) {
1363
+ const lines = [];
1364
+ const spaces = " ".repeat(indent * level);
1365
+ const spacesNext = " ".repeat(indent * (level + 1));
1366
+ const prettyPrinter = new PrettyPrinter();
1367
+ lines.push(spaces + "___________________________________________________________");
1368
+ lines.push(spaces + `${this.constructor.name}`);
1369
+ for (const [key, instance] of this._instances.entries()) {
1370
+ lines.push(spacesNext + "___________________________________________________________");
1371
+ lines.push(spacesNext + `key (ref. count = ${this._referenceCounts.get(key)}):`);
1372
+ const keyLines = prettyPrinter.toLines(key, level + 2, false);
1373
+ lines.push(...keyLines);
1374
+ lines.push(spacesNext + "instance:");
1375
+ const instanceLines = prettyPrinter.toLines(instance, level + 2, false);
1376
+ lines.push(...instanceLines);
1377
+ }
1378
+ return lines;
1263
1379
  }
1264
- getValue(date, index) {
1265
- return this._getters[index]?.(date);
1380
+ toString(indent = 4, level = 0) {
1381
+ return this.toLines(indent, level).map((l) => " ".repeat(indent * level) + l).join("\n");
1266
1382
  }
1267
- setValue(date, index, value) {
1268
- this._setter[index]?.(date, value);
1383
+ [Symbol.for("nodejs.util.inspect.custom")]() {
1384
+ return `${this.constructor.name}`;
1269
1385
  }
1270
- applies(context, index) {
1271
- return context instanceof Date && !!this._getters[index];
1386
+ get isEmpty() {
1387
+ return this._instances.size === 0;
1272
1388
  }
1273
- };
1274
- DatePropertyAccessor = _ts_decorate12([
1275
- injectable()
1276
- ], DatePropertyAccessor);
1277
-
1278
- // lib/index-value-accessor/index-value-accessor.ts
1279
- function _ts_decorate13(decorators, target, key, desc) {
1280
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1281
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1282
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1283
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1284
- }
1285
- __name(_ts_decorate13, "_ts_decorate");
1286
- function _ts_metadata8(k, v) {
1287
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1288
- }
1289
- __name(_ts_metadata8, "_ts_metadata");
1290
- function _ts_param6(paramIndex, decorator) {
1291
- return function(target, key) {
1292
- decorator(target, key, paramIndex);
1293
- };
1294
- }
1295
- __name(_ts_param6, "_ts_param");
1296
- var IndexValueAccessor = class {
1297
- static {
1298
- __name(this, "IndexValueAccessor");
1389
+ ids() {
1390
+ return this._instances.keys();
1299
1391
  }
1300
- priority = 0;
1301
- _accessors;
1302
- constructor(accessors) {
1303
- this._accessors = [
1304
- ...accessors
1305
- ].sort((a, b) => b.priority - a.priority);
1392
+ getFromId(id) {
1393
+ return this._instances.get(id);
1306
1394
  }
1307
- getIndexes(context, index) {
1308
- return this.getIndexAccessor(context, index).getIndexes(context, index);
1395
+ has(id) {
1396
+ return this._instances.has(id);
1309
1397
  }
1310
- isAsync(context, index) {
1311
- return this.getIndexAccessor(context, index).isAsync(context, index);
1398
+ getFromData(data) {
1399
+ const id = this.getId(data);
1400
+ return id !== void 0 ? this.getFromId(id) : void 0;
1312
1401
  }
1313
- hasValue(context, index) {
1314
- return this.getIndexAccessor(context, index).hasValue(context, index);
1402
+ dispose() {
1403
+ for (const id of this._instances.keys()) {
1404
+ this.release(id, true);
1405
+ }
1406
+ this._instances.clear();
1407
+ this._referenceCounts.clear();
1408
+ this.onDipose();
1315
1409
  }
1316
- getResolvedValue(context, index) {
1317
- return this.getIndexAccessor(context, index).getResolvedValue(context, index);
1410
+ getOrCreate(data) {
1411
+ let instance = this.getFromId(this.getOrCreateId(data));
1412
+ if (instance === void 0) {
1413
+ instance = this.create(data).instance;
1414
+ }
1415
+ return instance;
1318
1416
  }
1319
- getValue(context, index) {
1320
- return this.getIndexAccessor(context, index).getValue(context, index);
1417
+ create(data) {
1418
+ const id = this.getOrCreateId(data);
1419
+ const instance = this.getOrCreateInstance(id, data);
1420
+ const result = {
1421
+ id,
1422
+ instance,
1423
+ referenceCount: this.updateReferenceCount(id, 1, instance)
1424
+ };
1425
+ if (result.referenceCount === 1) {
1426
+ this.onInstanceCreated(result.instance, data);
1427
+ }
1428
+ return result;
1321
1429
  }
1322
- setValue(context, index, value) {
1323
- this.getIndexAccessor(context, index).setValue(context, index, value);
1430
+ release(id, force) {
1431
+ const instance = this._instances.get(id);
1432
+ if (!instance) {
1433
+ return {
1434
+ instance: null,
1435
+ referenceCount: 0
1436
+ };
1437
+ }
1438
+ return {
1439
+ referenceCount: this.updateReferenceCount(id, -1, instance, force),
1440
+ instance
1441
+ };
1324
1442
  }
1325
- applies(context, index) {
1326
- return this.getIndexAccessor(context, index).applies(context, index);
1443
+ get keys() {
1444
+ return Array.from(this._instances.keys());
1327
1445
  }
1328
- getIndexAccessor(context, index) {
1329
- const accessor = this._accessors.find((accessor2) => accessor2.applies(context, index));
1330
- if (!accessor) {
1331
- if (typeof context === "object" && context !== null) {
1332
- throw new UnsupportedException(`No accessor found for ${context.constructor.name}.${String(index)}`);
1333
- } else {
1334
- throw new UnsupportedException(`No accessor found for non-object context: ${String(context)}.${String(index)}`);
1335
- }
1446
+ onDisposeInstance = /* @__PURE__ */ __name((id, dispose) => {
1447
+ const { referenceCount } = this.release(id);
1448
+ if (referenceCount === 0) {
1449
+ dispose();
1336
1450
  }
1337
- return accessor;
1338
- }
1339
- };
1340
- IndexValueAccessor = _ts_decorate13([
1341
- injectable(),
1342
- _ts_param6(0, multiInject(RsXCoreInjectionTokens.IIndexValueAccessorList)),
1343
- _ts_metadata8("design:type", Function),
1344
- _ts_metadata8("design:paramtypes", [
1345
- Object
1346
- ])
1347
- ], IndexValueAccessor);
1348
-
1349
- // lib/index-value-accessor/map-key-accessor.ts
1350
- function _ts_decorate14(decorators, target, key, desc) {
1351
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1352
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1353
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1354
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1355
- }
1356
- __name(_ts_decorate14, "_ts_decorate");
1357
- var MapKeyAccessor = class {
1358
- static {
1359
- __name(this, "MapKeyAccessor");
1451
+ return referenceCount === 0;
1452
+ }, "onDisposeInstance");
1453
+ onDipose() {
1360
1454
  }
1361
- priority = 4;
1362
- getIndexes(map) {
1363
- return map.keys();
1455
+ onReleased() {
1364
1456
  }
1365
- isAsync() {
1366
- return false;
1457
+ releaseInstance(_instance, _id) {
1367
1458
  }
1368
- hasValue(map, key) {
1369
- return map.has(key);
1459
+ onInstanceCreated(_instance, _data) {
1370
1460
  }
1371
- getResolvedValue(map, key) {
1372
- return map.get(key);
1461
+ getOrCreateId(data) {
1462
+ return this.getId(data) ?? this.createId(data);
1373
1463
  }
1374
- getValue(map, key) {
1375
- return this.getResolvedValue(map, key);
1464
+ getReferenceCount(id) {
1465
+ return this._referenceCounts.get(id) ?? 0;
1376
1466
  }
1377
- setValue(map, key, value) {
1378
- map.set(key, value);
1467
+ updateReferenceCount(id, change, instance, forceRelease) {
1468
+ const referenceCount = this.getReferenceCount(id) + change;
1469
+ if (change === -1 && (forceRelease || referenceCount === 0)) {
1470
+ this._instances.delete(id);
1471
+ this._referenceCounts.delete(id);
1472
+ this.releaseInstance(instance, id);
1473
+ this.onReleased();
1474
+ } else if (referenceCount > 0) {
1475
+ this._referenceCounts.set(id, referenceCount);
1476
+ }
1477
+ return referenceCount;
1379
1478
  }
1380
- applies(map) {
1381
- return map instanceof Map;
1479
+ getOrCreateInstance(id, data) {
1480
+ let instance = this._instances.get(id);
1481
+ if (instance !== void 0) {
1482
+ return instance;
1483
+ }
1484
+ instance = this.createInstance(data, id);
1485
+ this._instances.set(id, instance);
1486
+ return instance;
1382
1487
  }
1383
1488
  };
1384
- MapKeyAccessor = _ts_decorate14([
1385
- injectable()
1386
- ], MapKeyAccessor);
1489
+ _ts_decorate16([
1490
+ preDestroy(),
1491
+ _ts_metadata9("design:type", Function),
1492
+ _ts_metadata9("design:paramtypes", []),
1493
+ _ts_metadata9("design:returntype", void 0)
1494
+ ], SingletonFactory.prototype, "dispose", null);
1387
1495
 
1388
- // lib/index-value-accessor/method-accessor.ts
1389
- function _ts_decorate15(decorators, target, key, desc) {
1390
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1391
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1392
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1393
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1394
- }
1395
- __name(_ts_decorate15, "_ts_decorate");
1396
- function _ts_metadata9(k, v) {
1397
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1398
- }
1399
- __name(_ts_metadata9, "_ts_metadata");
1400
- function _ts_param7(paramIndex, decorator) {
1401
- return function(target, key) {
1402
- decorator(target, key, paramIndex);
1403
- };
1404
- }
1405
- __name(_ts_param7, "_ts_param");
1406
- var MethodAccessor = class {
1496
+ // lib/function-call-index/function-call-index.ts
1497
+ var FunctionCallIndex = class {
1407
1498
  static {
1408
- __name(this, "MethodAccessor");
1409
- }
1410
- _functionCallResultCacheFactory;
1411
- priority = 6;
1412
- constructor(_functionCallResultCacheFactory) {
1413
- this._functionCallResultCacheFactory = _functionCallResultCacheFactory;
1414
- }
1415
- getIndexes() {
1416
- return [].values();
1417
- }
1418
- isAsync() {
1419
- return false;
1420
- }
1421
- hasValue(context, index) {
1422
- return this._functionCallResultCacheFactory.has(context, index);
1499
+ __name(this, "FunctionCallIndex");
1423
1500
  }
1424
- getResolvedValue(context, index) {
1425
- return this.getValue(context, index);
1501
+ context;
1502
+ functionName;
1503
+ _sequenceWithId;
1504
+ _owner;
1505
+ _isDisposed = false;
1506
+ _id;
1507
+ constructor(context, functionName, _sequenceWithId, _owner) {
1508
+ this.context = context;
1509
+ this.functionName = functionName;
1510
+ this._sequenceWithId = _sequenceWithId;
1511
+ this._owner = _owner;
1426
1512
  }
1427
- getValue(context, index) {
1428
- return this._functionCallResultCacheFactory.get(context, index)?.result;
1513
+ get id() {
1514
+ if (!this._id) {
1515
+ this._id = `${this.functionName}${this._sequenceWithId.id}`;
1516
+ }
1517
+ return this._id;
1429
1518
  }
1430
- setValue(_, index) {
1431
- throw new UnsupportedException(`Cannot set method '${index}'`);
1519
+ get argumentsId() {
1520
+ return this._sequenceWithId;
1432
1521
  }
1433
- applies(context, index) {
1434
- if (typeof context !== "object" || context === null) {
1435
- return false;
1522
+ dispose() {
1523
+ if (this._isDisposed) {
1524
+ return;
1436
1525
  }
1437
- const prop = context[index.functionName];
1438
- return Type.isFunction(prop) || Type.isArrowFunction(prop);
1526
+ if (this._owner.canDispose?.()) {
1527
+ this._isDisposed = true;
1528
+ this._sequenceWithId.dispose();
1529
+ }
1530
+ this._owner.release();
1439
1531
  }
1440
1532
  };
1441
- MethodAccessor = _ts_decorate15([
1442
- injectable(),
1443
- _ts_param7(0, inject(RsXCoreInjectionTokens.IFunctionCallResultCacheFactory)),
1444
- _ts_metadata9("design:type", Function),
1445
- _ts_metadata9("design:paramtypes", [
1446
- typeof IFunctionCallResultCacheFactory === "undefined" ? Object : IFunctionCallResultCacheFactory
1447
- ])
1448
- ], MethodAccessor);
1449
1533
 
1450
- // lib/index-value-accessor/observable-accessor.ts
1451
- import { BehaviorSubject, isObservable as isObservable2, Subject as Subject2 } from "rxjs";
1452
-
1453
- // lib/types/set.ts
1454
- function replaceSetItemAt(set, oldValue, newValue) {
1455
- const values = Array.from(set);
1456
- const index = values.indexOf(oldValue);
1457
- if (index === -1) {
1458
- throw new RangeError("Index out of range");
1459
- }
1460
- values[index] = newValue;
1461
- set.clear();
1462
- values.forEach((value) => set.add(value));
1463
- return set;
1464
- }
1465
- __name(replaceSetItemAt, "replaceSetItemAt");
1466
-
1467
- // lib/types/utc-date.ts
1468
- function utCDate(year, month = 0, date = 1, hours = 0, minutes = 0, seconds = 0, millisecond = 0) {
1469
- return new Date(Date.UTC(year, month, date, hours, minutes, seconds, millisecond));
1470
- }
1471
- __name(utCDate, "utCDate");
1472
-
1473
- // lib/index-value-accessor/pending.ts
1474
- var PENDING = Symbol("pending");
1475
-
1476
- // lib/index-value-accessor/observable-accessor.ts
1477
- function _ts_decorate16(decorators, target, key, desc) {
1534
+ // lib/function-call-index/function-call-index.factory.ts
1535
+ function _ts_decorate17(decorators, target, key, desc) {
1478
1536
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1479
1537
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1480
1538
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1481
1539
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1482
1540
  }
1483
- __name(_ts_decorate16, "_ts_decorate");
1541
+ __name(_ts_decorate17, "_ts_decorate");
1484
1542
  function _ts_metadata10(k, v) {
1485
1543
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1486
1544
  }
1487
1545
  __name(_ts_metadata10, "_ts_metadata");
1488
1546
  function _ts_param8(paramIndex, decorator) {
1489
- return function(target, key) {
1490
- decorator(target, key, paramIndex);
1491
- };
1492
- }
1493
- __name(_ts_param8, "_ts_param");
1494
- var ObservableAccessor = class {
1495
- static {
1496
- __name(this, "ObservableAccessor");
1497
- }
1498
- _resolvedValueCache;
1499
- priority = 2;
1500
- constructor(_resolvedValueCache) {
1501
- this._resolvedValueCache = _resolvedValueCache;
1502
- }
1503
- getIndexes() {
1504
- return [].values();
1505
- }
1506
- isAsync() {
1507
- return true;
1508
- }
1509
- getResolvedValue(context, index) {
1510
- if (context instanceof BehaviorSubject) return context.value;
1511
- const val = this.getIndexedValue(context, index);
1512
- if (val && typeof val === "object" || typeof val === "function") {
1513
- return this._resolvedValueCache.get(val) ?? PENDING;
1514
- }
1515
- return PENDING;
1516
- }
1517
- hasValue(context, index) {
1518
- return this.getResolvedValue(context, index) !== PENDING;
1519
- }
1520
- getValue(context, index) {
1521
- return this.getIndexedValue(context, index);
1547
+ return function(target, key) {
1548
+ decorator(target, key, paramIndex);
1549
+ };
1550
+ }
1551
+ __name(_ts_param8, "_ts_param");
1552
+ var FunctionCallIndexFactory = class extends SingletonFactory {
1553
+ static {
1554
+ __name(this, "FunctionCallIndexFactory");
1522
1555
  }
1523
- setValue(context, index, value) {
1524
- const val = this.getIndexedValue(context, index);
1525
- if (val instanceof Subject2) {
1526
- val.next(value);
1527
- return;
1528
- }
1529
- throw new UnsupportedException("Cannot set value for an observable");
1556
+ _sequenceIdFactory;
1557
+ constructor(_sequenceIdFactory) {
1558
+ super(), this._sequenceIdFactory = _sequenceIdFactory;
1530
1559
  }
1531
- applies(context, index) {
1532
- const val = this.getIndexedValue(context, index);
1533
- return isObservable2(val);
1560
+ getId(data) {
1561
+ return this._sequenceIdFactory.get(data.context, data.arguments);
1534
1562
  }
1535
- setLastValue(observable, value) {
1536
- this._resolvedValueCache.set(observable, value);
1563
+ createInstance(data, id) {
1564
+ return new FunctionCallIndex(data.context, data.functionName, id, {
1565
+ canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
1566
+ release: /* @__PURE__ */ __name(() => this.release(id), "release")
1567
+ });
1537
1568
  }
1538
- clearLastValue(observable) {
1539
- this._resolvedValueCache.delete(observable);
1569
+ createId(data) {
1570
+ const context = data.context;
1571
+ if (!context || typeof context !== "object") {
1572
+ throw new ArgumentException(`Expected context to be an object, got ${String(context)}`);
1573
+ }
1574
+ const fn = context[data.functionName];
1575
+ return this._sequenceIdFactory.create(fn, data.arguments);
1540
1576
  }
1541
- getIndexedValue(context, index) {
1542
- return (Type.toObject(context) ?? {})[index];
1577
+ releaseInstance(_, id) {
1578
+ id.dispose();
1543
1579
  }
1544
1580
  };
1545
- ObservableAccessor = _ts_decorate16([
1581
+ FunctionCallIndexFactory = _ts_decorate17([
1546
1582
  injectable(),
1547
- _ts_param8(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
1583
+ _ts_param8(0, inject(RsXCoreInjectionTokens.ISequenceIdFactory)),
1548
1584
  _ts_metadata10("design:type", Function),
1549
1585
  _ts_metadata10("design:paramtypes", [
1550
- typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
1586
+ typeof ISequenceIdFactory === "undefined" ? Object : ISequenceIdFactory
1551
1587
  ])
1552
- ], ObservableAccessor);
1588
+ ], FunctionCallIndexFactory);
1553
1589
 
1554
- // lib/index-value-accessor/promise-accessor.ts
1555
- function _ts_decorate17(decorators, target, key, desc) {
1590
+ // lib/function-call-result-cache/function-call-result-cache.factory.ts
1591
+ function _ts_decorate18(decorators, target, key, desc) {
1556
1592
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1557
1593
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1558
1594
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1559
1595
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1560
1596
  }
1561
- __name(_ts_decorate17, "_ts_decorate");
1597
+ __name(_ts_decorate18, "_ts_decorate");
1562
1598
  function _ts_metadata11(k, v) {
1563
1599
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1564
1600
  }
@@ -1569,132 +1605,116 @@ function _ts_param9(paramIndex, decorator) {
1569
1605
  };
1570
1606
  }
1571
1607
  __name(_ts_param9, "_ts_param");
1572
- var PromiseAccessor = class {
1608
+ var FunctionCallResultCache = class FunctionCallResultCache2 {
1573
1609
  static {
1574
- __name(this, "PromiseAccessor");
1575
- }
1576
- _resolvedValueCache;
1577
- priority = 1;
1578
- constructor(_resolvedValueCache) {
1579
- this._resolvedValueCache = _resolvedValueCache;
1580
- }
1581
- getIndexes() {
1582
- return [].values();
1610
+ __name(this, "FunctionCallResultCache");
1583
1611
  }
1584
- isAsync() {
1585
- return true;
1612
+ _disposeableIndex;
1613
+ result;
1614
+ _owner;
1615
+ _isDisposed = false;
1616
+ constructor(_disposeableIndex, result, _owner) {
1617
+ this._disposeableIndex = _disposeableIndex;
1618
+ this.result = result;
1619
+ this._owner = _owner;
1586
1620
  }
1587
- hasValue(context, index) {
1588
- const val = this.getIndexedValue(context, index);
1589
- return this.isCacheable(val) && this._resolvedValueCache.get(val) !== PENDING;
1621
+ get index() {
1622
+ return this._disposeableIndex;
1590
1623
  }
1591
- getResolvedValue(context, index) {
1592
- const val = this.getIndexedValue(context, index);
1593
- return this.isCacheable(val) ? this._resolvedValueCache.get(val) ?? PENDING : PENDING;
1624
+ dispose() {
1625
+ if (this._isDisposed) {
1626
+ return;
1627
+ }
1628
+ if (this._owner.canDispose?.()) {
1629
+ this._disposeableIndex.dispose();
1630
+ this._isDisposed = true;
1631
+ }
1632
+ this._owner.release();
1594
1633
  }
1595
- getValue(context, index) {
1596
- return this.getIndexedValue(context, index);
1634
+ };
1635
+ var FunctionCallResultCacheForContextManager = class FunctionCallResultCacheForContextManager2 extends SingletonFactory {
1636
+ static {
1637
+ __name(this, "FunctionCallResultCacheForContextManager");
1597
1638
  }
1598
- setValue() {
1599
- throw new UnsupportedException("Cannot set value for a Promise");
1639
+ _context;
1640
+ _functionCallIndexFactory;
1641
+ releaseContext;
1642
+ constructor(_context, _functionCallIndexFactory, releaseContext) {
1643
+ super(), this._context = _context, this._functionCallIndexFactory = _functionCallIndexFactory, this.releaseContext = releaseContext;
1600
1644
  }
1601
- applies(context, index) {
1602
- const val = this.getIndexedValue(context, index);
1603
- return val instanceof Promise;
1645
+ getId(data) {
1646
+ return this._functionCallIndexFactory.getFromData({
1647
+ functionName: data.functionName,
1648
+ context: this._context,
1649
+ arguments: data.arguments
1650
+ });
1604
1651
  }
1605
- setLastValue(promise, value) {
1606
- this._resolvedValueCache.set(promise, value);
1652
+ createInstance(data, id) {
1653
+ return new FunctionCallResultCache(id, data.result, {
1654
+ canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
1655
+ release: /* @__PURE__ */ __name(() => this.release(id), "release")
1656
+ });
1607
1657
  }
1608
- clearLastValue(promise) {
1609
- this._resolvedValueCache.delete(promise);
1658
+ createId(data) {
1659
+ return this._functionCallIndexFactory.create({
1660
+ functionName: data.functionName,
1661
+ context: this._context,
1662
+ arguments: data.arguments
1663
+ }).instance;
1610
1664
  }
1611
- getIndexedValue(context, index) {
1612
- return (Type.toObject(context) ?? {})[index];
1665
+ releaseInstance(_, id) {
1666
+ this._functionCallIndexFactory.release(id.argumentsId);
1613
1667
  }
1614
- isCacheable(value) {
1615
- return value !== null && (typeof value === "object" || typeof value === "function");
1668
+ onReleased() {
1669
+ this.releaseContext();
1616
1670
  }
1617
1671
  };
1618
- PromiseAccessor = _ts_decorate17([
1619
- injectable(),
1620
- _ts_param9(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
1621
- _ts_metadata11("design:type", Function),
1622
- _ts_metadata11("design:paramtypes", [
1623
- typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
1624
- ])
1625
- ], PromiseAccessor);
1626
-
1627
- // lib/index-value-accessor/property-value-accessor.ts
1628
- import { isObservable as isObservable3 } from "rxjs";
1629
- var PropertyValueAccessor = class {
1672
+ var FunctionCallResultCacheManager = class FunctionCallResultCacheManager2 extends SingletonFactory {
1630
1673
  static {
1631
- __name(this, "PropertyValueAccessor");
1632
- }
1633
- priority = 7;
1634
- isAsync() {
1635
- return false;
1636
- }
1637
- getIndexes(context) {
1638
- const obj = Type.toObject(context);
1639
- if (!obj) {
1640
- return [].values();
1641
- }
1642
- return Object.keys(obj).filter((key) => !Type.isMethod(obj[key])).values();
1643
- }
1644
- hasValue(context, index) {
1645
- const val = this.getValue(context, index);
1646
- return val !== void 0;
1674
+ __name(this, "FunctionCallResultCacheManager");
1647
1675
  }
1648
- getResolvedValue(context, index) {
1649
- return this.getValue(context, index);
1676
+ _functionCallIndexFactory;
1677
+ constructor(_functionCallIndexFactory) {
1678
+ super(), this._functionCallIndexFactory = _functionCallIndexFactory;
1650
1679
  }
1651
- getValue(context, index) {
1652
- const obj = Type.toObject(context);
1653
- return obj ? obj[index] : void 0;
1680
+ getId(contex) {
1681
+ return this.createId(contex);
1654
1682
  }
1655
- setValue(context, index, value) {
1656
- const obj = Type.toObject(context);
1657
- if (obj) {
1658
- obj[index] = value;
1659
- }
1683
+ createInstance(context, id) {
1684
+ return new FunctionCallResultCacheForContextManager(context, this._functionCallIndexFactory, () => this.release(id));
1660
1685
  }
1661
- applies(context, index) {
1662
- const obj = Type.toObject(context);
1663
- if (!obj) {
1664
- return false;
1665
- }
1666
- return Type.hasProperty(obj, index) && !(obj instanceof Date) && !isObservable3(obj[index]) && !(obj[index] instanceof Promise);
1686
+ createId(contex) {
1687
+ return contex;
1667
1688
  }
1668
1689
  };
1669
-
1670
- // lib/index-value-accessor/resolved-value-cache.ts
1671
- function _ts_decorate18(decorators, target, key, desc) {
1672
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1673
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1674
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1675
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1676
- }
1677
- __name(_ts_decorate18, "_ts_decorate");
1678
- var ResolvedValueCache = class {
1690
+ var FunctionCallResultCacheFactory = class {
1679
1691
  static {
1680
- __name(this, "ResolvedValueCache");
1692
+ __name(this, "FunctionCallResultCacheFactory");
1681
1693
  }
1682
- _resolvedValues = /* @__PURE__ */ new WeakMap();
1683
- set(source, value) {
1684
- this._resolvedValues.set(source, value);
1694
+ _functionCallResultCacheManager;
1695
+ constructor(functionCallIndexFactory) {
1696
+ this._functionCallResultCacheManager = new FunctionCallResultCacheManager(functionCallIndexFactory);
1685
1697
  }
1686
- get(source) {
1687
- return this._resolvedValues.get(source);
1698
+ create(context, result) {
1699
+ return this._functionCallResultCacheManager.create(context).instance.create(result).instance;
1688
1700
  }
1689
- delete(source) {
1690
- this._resolvedValues.delete(source);
1701
+ has(context, index) {
1702
+ return this._functionCallResultCacheManager.getFromId(context)?.has(index) ?? false;
1703
+ }
1704
+ get(context, index) {
1705
+ return this._functionCallResultCacheManager.getFromId(context)?.getFromId(index);
1691
1706
  }
1692
1707
  };
1693
- ResolvedValueCache = _ts_decorate18([
1694
- injectable()
1695
- ], ResolvedValueCache);
1708
+ FunctionCallResultCacheFactory = _ts_decorate18([
1709
+ injectable(),
1710
+ _ts_param9(0, inject(RsXCoreInjectionTokens.IFunctionCallIndexFactory)),
1711
+ _ts_metadata11("design:type", Function),
1712
+ _ts_metadata11("design:paramtypes", [
1713
+ typeof IFunctionCallIndexFactory === "undefined" ? Object : IFunctionCallIndexFactory
1714
+ ])
1715
+ ], FunctionCallResultCacheFactory);
1696
1716
 
1697
- // lib/index-value-accessor/set-key-accessor.ts
1717
+ // lib/guid/guid.factory.ts
1698
1718
  function _ts_decorate19(decorators, target, key, desc) {
1699
1719
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1700
1720
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1702,36 +1722,17 @@ function _ts_decorate19(decorators, target, key, desc) {
1702
1722
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1703
1723
  }
1704
1724
  __name(_ts_decorate19, "_ts_decorate");
1705
- var SetKeyAccessor = class {
1725
+ var GuidFactory = class {
1706
1726
  static {
1707
- __name(this, "SetKeyAccessor");
1708
- }
1709
- priority = 3;
1710
- getIndexes(set) {
1711
- return new Set(set).values();
1712
- }
1713
- isAsync() {
1714
- return false;
1715
- }
1716
- hasValue(set, key) {
1717
- return set.has(key);
1718
- }
1719
- getResolvedValue(set, key) {
1720
- return set.has(key) ? key : void 0;
1721
- }
1722
- getValue(set, key) {
1723
- return this.getResolvedValue(set, key);
1724
- }
1725
- setValue(set, key, value) {
1726
- replaceSetItemAt(set, key, value);
1727
+ __name(this, "GuidFactory");
1727
1728
  }
1728
- applies(map) {
1729
- return map instanceof Set;
1729
+ create() {
1730
+ return crypto.randomUUID();
1730
1731
  }
1731
1732
  };
1732
- SetKeyAccessor = _ts_decorate19([
1733
+ GuidFactory = _ts_decorate19([
1733
1734
  injectable()
1734
- ], SetKeyAccessor);
1735
+ ], GuidFactory);
1735
1736
 
1736
1737
  // lib/singleton-factory/singleton-factory-with-id-generation.ts
1737
1738
  var SingletonFactoryWithIdGeneration = class extends SingletonFactory {