@vscode/markdown-editor 0.0.2-61 → 0.0.2-63

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 (52) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/dist/index.js +1 -1
  3. package/dist/web-editors.d.ts +1 -1
  4. package/package.json +3 -7
  5. package/dist/_observables/assert.d.ts +0 -2
  6. package/dist/_observables/deps.d.ts +0 -28
  7. package/dist/_observables/disposables.d.ts +0 -19
  8. package/dist/_observables/equals.d.ts +0 -32
  9. package/dist/_observables/index.d.ts +0 -2
  10. package/dist/_observables/observableInternal/base.d.ts +0 -172
  11. package/dist/_observables/observableInternal/changeTracker.d.ts +0 -44
  12. package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +0 -24
  13. package/dist/_observables/observableInternal/commonFacade/deps.d.ts +0 -24
  14. package/dist/_observables/observableInternal/debugLocation.d.ts +0 -21
  15. package/dist/_observables/observableInternal/debugName.d.ts +0 -33
  16. package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +0 -16
  17. package/dist/_observables/observableInternal/experimental/reducer.d.ts +0 -37
  18. package/dist/_observables/observableInternal/experimental/utils.d.ts +0 -15
  19. package/dist/_observables/observableInternal/index.d.ts +0 -25
  20. package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +0 -40
  21. package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +0 -4
  22. package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +0 -4
  23. package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +0 -43
  24. package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +0 -41
  25. package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +0 -13
  26. package/dist/_observables/observableInternal/logging/logging.d.ts +0 -30
  27. package/dist/_observables/observableInternal/map.d.ts +0 -18
  28. package/dist/_observables/observableInternal/observables/baseObservable.d.ts +0 -58
  29. package/dist/_observables/observableInternal/observables/constObservable.d.ts +0 -5
  30. package/dist/_observables/observableInternal/observables/derived.d.ts +0 -46
  31. package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +0 -83
  32. package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +0 -27
  33. package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +0 -37
  34. package/dist/_observables/observableInternal/observables/observableSignal.d.ts +0 -11
  35. package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +0 -5
  36. package/dist/_observables/observableInternal/observables/observableValue.d.ts +0 -37
  37. package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +0 -8
  38. package/dist/_observables/observableInternal/reactions/createEffect.d.ts +0 -64
  39. package/dist/_observables/observableInternal/reactions/createEffectImpl.d.ts +0 -53
  40. package/dist/_observables/observableInternal/set.d.ts +0 -17
  41. package/dist/_observables/observableInternal/transaction.d.ts +0 -27
  42. package/dist/_observables/observableInternal/utils/promise.d.ts +0 -75
  43. package/dist/_observables/observableInternal/utils/runOnChange.d.ts +0 -7
  44. package/dist/_observables/observableInternal/utils/utils.d.ts +0 -43
  45. package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +0 -10
  46. package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +0 -10
  47. package/dist/_observables/utils.d.ts +0 -15
  48. package/dist/observables.d.ts +0 -4
  49. package/dist/observables.js +0 -441
  50. package/dist/observables.js.map +0 -1
  51. package/dist/runOnChange-e7FtCqOQ.js +0 -1542
  52. package/dist/runOnChange-e7FtCqOQ.js.map +0 -1
@@ -1,1542 +0,0 @@
1
- let m;
2
- function de(n) {
3
- m ? m instanceof K ? m.loggers.push(n) : m = new K([m, n]) : m = n;
4
- }
5
- function o() {
6
- return m;
7
- }
8
- let x;
9
- function oe(n) {
10
- x = n;
11
- }
12
- function ue(n) {
13
- x && x(n);
14
- }
15
- class K {
16
- constructor(e) {
17
- this.loggers = e;
18
- }
19
- handleObservableCreated(e, t) {
20
- for (const s of this.loggers)
21
- s.handleObservableCreated(e, t);
22
- }
23
- handleOnListenerCountChanged(e, t) {
24
- for (const s of this.loggers)
25
- s.handleOnListenerCountChanged(e, t);
26
- }
27
- handleObservableUpdated(e, t) {
28
- for (const s of this.loggers)
29
- s.handleObservableUpdated(e, t);
30
- }
31
- handleAutorunCreated(e, t) {
32
- for (const s of this.loggers)
33
- s.handleAutorunCreated(e, t);
34
- }
35
- handleAutorunDisposed(e) {
36
- for (const t of this.loggers)
37
- t.handleAutorunDisposed(e);
38
- }
39
- handleAutorunDependencyChanged(e, t, s) {
40
- for (const r of this.loggers)
41
- r.handleAutorunDependencyChanged(e, t, s);
42
- }
43
- handleAutorunStarted(e) {
44
- for (const t of this.loggers)
45
- t.handleAutorunStarted(e);
46
- }
47
- handleAutorunFinished(e) {
48
- for (const t of this.loggers)
49
- t.handleAutorunFinished(e);
50
- }
51
- handleDerivedDependencyChanged(e, t, s) {
52
- for (const r of this.loggers)
53
- r.handleDerivedDependencyChanged(e, t, s);
54
- }
55
- handleDerivedCleared(e) {
56
- for (const t of this.loggers)
57
- t.handleDerivedCleared(e);
58
- }
59
- handleBeginTransaction(e) {
60
- for (const t of this.loggers)
61
- t.handleBeginTransaction(e);
62
- }
63
- handleEndTransaction(e) {
64
- for (const t of this.loggers)
65
- t.handleEndTransaction(e);
66
- }
67
- }
68
- var u;
69
- (function(n) {
70
- let e = !1;
71
- function t() {
72
- e = !0;
73
- }
74
- n.enable = t;
75
- function s() {
76
- return r(1);
77
- }
78
- n.ofCaller = s;
79
- function r(i) {
80
- if (!e)
81
- return;
82
- const a = Error, d = a.stackTraceLimit;
83
- a.stackTraceLimit = 3;
84
- const h = new Error().stack;
85
- return a.stackTraceLimit = d, L.fromStack(h, i + 1);
86
- }
87
- n.ofNthCaller = r;
88
- })(u || (u = {}));
89
- class L {
90
- static fromStack(e, t) {
91
- const s = e.split(`
92
- `), r = he(s[t + 1]);
93
- if (r)
94
- return new L(r.fileName, r.line, r.column, r.id);
95
- }
96
- constructor(e, t, s, r) {
97
- this.fileName = e, this.line = t, this.column = s, this.id = r;
98
- }
99
- }
100
- function he(n) {
101
- if (!n)
102
- return;
103
- const e = n.match(/\((.*):(\d+):(\d+)\)/);
104
- if (e)
105
- return {
106
- fileName: e[1],
107
- line: parseInt(e[2]),
108
- column: parseInt(e[3]),
109
- id: n
110
- };
111
- const t = n.match(/at ([^\(\)]*):(\d+):(\d+)/);
112
- if (t)
113
- return {
114
- fileName: t[1],
115
- line: parseInt(t[2]),
116
- column: parseInt(t[3]),
117
- id: n
118
- };
119
- }
120
- class l {
121
- constructor(e, t, s) {
122
- this.owner = e, this.debugNameSource = t, this.referenceFn = s;
123
- }
124
- getDebugName(e) {
125
- return le(e, this);
126
- }
127
- }
128
- const P = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap();
129
- function le(n, e) {
130
- const t = I.get(n);
131
- if (t)
132
- return t;
133
- const s = ce(n, e);
134
- if (s) {
135
- let r = P.get(s) ?? 0;
136
- r++, P.set(s, r);
137
- const i = r === 1 ? s : `${s}#${r}`;
138
- return I.set(n, i), i;
139
- }
140
- }
141
- function ce(n, e) {
142
- const t = I.get(n);
143
- if (t)
144
- return t;
145
- const s = e.owner ? ge(e.owner) + "." : "";
146
- let r;
147
- const i = e.debugNameSource;
148
- if (i !== void 0)
149
- if (typeof i == "function") {
150
- if (r = i(), r !== void 0)
151
- return s + r;
152
- } else
153
- return s + i;
154
- const a = e.referenceFn;
155
- if (a !== void 0 && (r = W(a), r !== void 0))
156
- return s + r;
157
- if (e.owner !== void 0) {
158
- const d = fe(e.owner, n);
159
- if (d !== void 0)
160
- return s + d;
161
- }
162
- }
163
- function fe(n, e) {
164
- for (const t in n)
165
- if (n[t] === e)
166
- return t;
167
- }
168
- const Z = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new WeakMap();
169
- function ge(n) {
170
- const e = J.get(n);
171
- if (e)
172
- return e;
173
- const t = ee(n) ?? "Object";
174
- let s = Z.get(t) ?? 0;
175
- s++, Z.set(t, s);
176
- const r = s === 1 ? t : `${t}#${s}`;
177
- return J.set(n, r), r;
178
- }
179
- function ee(n) {
180
- const e = n.constructor;
181
- if (e)
182
- return e.name === "Object" ? void 0 : e.name;
183
- }
184
- function W(n) {
185
- const e = n.toString(), s = /\/\*\*\s*@description\s*([^*]*)\*\//.exec(e);
186
- return (s ? s[1] : void 0)?.trim();
187
- }
188
- let j;
189
- function _e(n) {
190
- j = n;
191
- }
192
- let te;
193
- function be(n) {
194
- te = n;
195
- }
196
- let ne;
197
- function pe(n) {
198
- ne = n;
199
- }
200
- let se;
201
- function me(n) {
202
- se = n;
203
- }
204
- class re {
205
- get TChange() {
206
- return null;
207
- }
208
- reportChanges() {
209
- this.get();
210
- }
211
- /** @sealed */
212
- read(e) {
213
- return e ? e.readObservable(this) : this.get();
214
- }
215
- map(e, t, s = u.ofCaller()) {
216
- const r = t === void 0 ? void 0 : e, i = t === void 0 ? e : t;
217
- return j({
218
- owner: r,
219
- debugName: () => {
220
- const a = W(i);
221
- if (a !== void 0)
222
- return a;
223
- const h = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(i.toString());
224
- if (h)
225
- return `${this.debugName}.${h[2]}`;
226
- if (!r)
227
- return `${this.debugName} (mapped)`;
228
- },
229
- debugReferenceFn: i
230
- }, (a) => i(this.read(a), a), s);
231
- }
232
- /**
233
- * @sealed
234
- * Converts an observable of an observable value into a direct observable of the value.
235
- */
236
- flatten() {
237
- return j({
238
- owner: void 0,
239
- debugName: () => `${this.debugName} (flattened)`
240
- }, (e) => this.read(e).read(e));
241
- }
242
- recomputeInitiallyAndOnChange(e, t) {
243
- return e.add(te(this, t)), this;
244
- }
245
- /**
246
- * Ensures that this observable is observed. This keeps the cache alive.
247
- * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).
248
- * Use `recomputeInitiallyAndOnChange` for eager evaluation.
249
- */
250
- keepObserved(e) {
251
- return e.add(ne(this)), this;
252
- }
253
- get debugValue() {
254
- return this.get();
255
- }
256
- debugGetDependencyGraph() {
257
- return se(this);
258
- }
259
- }
260
- class N extends re {
261
- constructor(e) {
262
- super(), this._observers = /* @__PURE__ */ new Set(), o()?.handleObservableCreated(this, e);
263
- }
264
- addObserver(e) {
265
- const t = this._observers.size;
266
- this._observers.add(e), t === 0 && this.onFirstObserverAdded(), t !== this._observers.size && o()?.handleOnListenerCountChanged(this, this._observers.size);
267
- }
268
- removeObserver(e) {
269
- const t = this._observers.delete(e);
270
- t && this._observers.size === 0 && this.onLastObserverRemoved(), t && o()?.handleOnListenerCountChanged(this, this._observers.size);
271
- }
272
- onFirstObserverAdded() {
273
- }
274
- onLastObserverRemoved() {
275
- }
276
- log() {
277
- const e = !!o();
278
- return ue(this), e || o()?.handleObservableCreated(this, u.ofCaller()), this;
279
- }
280
- debugGetObservers() {
281
- return this._observers;
282
- }
283
- }
284
- function R(n) {
285
- return {
286
- dispose: n
287
- };
288
- }
289
- class v extends Error {
290
- constructor(e) {
291
- super(e || "An unexpected bug occurred."), Object.setPrototypeOf(this, v.prototype);
292
- }
293
- }
294
- function D(n) {
295
- throw n;
296
- }
297
- function ve(n) {
298
- console.error("Unexpected error:", n);
299
- }
300
- const _ = (n, e) => n === e;
301
- class f {
302
- constructor() {
303
- this.disposables = [], this._isDisposed = !1;
304
- }
305
- get isDisposed() {
306
- return this._isDisposed;
307
- }
308
- dispose() {
309
- this.clear(), this._isDisposed = !0;
310
- }
311
- add(e) {
312
- return e && this.disposables.push(e), e;
313
- }
314
- remove(e) {
315
- if (!e)
316
- return e;
317
- const t = this.disposables.indexOf(e);
318
- return t !== -1 && this.disposables.splice(t, 1), e;
319
- }
320
- clear() {
321
- for (const e of this.disposables)
322
- e.dispose();
323
- this.disposables = [];
324
- }
325
- leakItems() {
326
- this.disposables = [];
327
- }
328
- }
329
- class Me {
330
- constructor() {
331
- this._store = new f();
332
- }
333
- dispose() {
334
- this._store.dispose();
335
- }
336
- _register(e) {
337
- return this._store.add(e), e;
338
- }
339
- _registerOrDispose(e) {
340
- return e && (this._store.isDisposed ? e.dispose() : this._store.add(e)), e;
341
- }
342
- }
343
- function Ce(n) {
344
- switch (n) {
345
- case 0:
346
- return "initial";
347
- case 1:
348
- return "dependenciesMightHaveChanged";
349
- case 2:
350
- return "stale";
351
- case 3:
352
- return "upToDate";
353
- default:
354
- return "<unknown>";
355
- }
356
- }
357
- class b extends N {
358
- get debugName() {
359
- return this._debugNameData.getDebugName(this) ?? "(anonymous)";
360
- }
361
- constructor(e, t, s, r = void 0, i, a) {
362
- super(a), this._debugNameData = e, this._computeFn = t, this._changeTracker = s, this._handleLastObserverRemoved = r, this._equalityComparator = i, this._state = 0, this._value = void 0, this._updateCount = 0, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._changeSummary = void 0, this._isUpdating = !1, this._isComputing = !1, this._didReportChange = !1, this._isInBeforeUpdate = !1, this._isReaderValid = !1, this._store = void 0, this._delayedStore = void 0, this._removedObserverToCallEndUpdateOn = null, this._changeSummary = this._changeTracker?.createChangeSummary(void 0);
363
- }
364
- onLastObserverRemoved() {
365
- this._state = 0, this._value = void 0, o()?.handleDerivedCleared(this);
366
- for (const e of this._dependencies)
367
- e.removeObserver(this);
368
- this._dependencies.clear(), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._delayedStore !== void 0 && (this._delayedStore.dispose(), this._delayedStore = void 0), this._handleLastObserverRemoved?.();
369
- }
370
- get() {
371
- if (this._isComputing, this._observers.size === 0) {
372
- let t;
373
- try {
374
- this._isReaderValid = !0;
375
- let s;
376
- this._changeTracker && (s = this._changeTracker.createChangeSummary(void 0), this._changeTracker.beforeUpdate?.(this, s)), t = this._computeFn(this, s);
377
- } finally {
378
- this._isReaderValid = !1;
379
- }
380
- return this.onLastObserverRemoved(), t;
381
- } else {
382
- do {
383
- if (this._state === 1) {
384
- for (const t of this._dependencies)
385
- if (t.reportChanges(), this._state === 2)
386
- break;
387
- }
388
- this._state === 1 && (this._state = 3), this._state !== 3 && this._recompute();
389
- } while (this._state !== 3);
390
- return this._value;
391
- }
392
- }
393
- _recompute() {
394
- let e = !1;
395
- this._isComputing = !0, this._didReportChange = !1;
396
- const t = this._dependenciesToBeRemoved;
397
- this._dependenciesToBeRemoved = this._dependencies, this._dependencies = t;
398
- try {
399
- const s = this._changeSummary;
400
- this._isReaderValid = !0, this._changeTracker && (this._isInBeforeUpdate = !0, this._changeTracker.beforeUpdate?.(this, s), this._isInBeforeUpdate = !1, this._changeSummary = this._changeTracker?.createChangeSummary(s));
401
- const r = this._state !== 0, i = this._value;
402
- this._state = 3;
403
- const a = this._delayedStore;
404
- a !== void 0 && (this._delayedStore = void 0);
405
- try {
406
- this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._value = this._computeFn(this, s);
407
- } finally {
408
- this._isReaderValid = !1;
409
- for (const d of this._dependenciesToBeRemoved)
410
- d.removeObserver(this);
411
- this._dependenciesToBeRemoved.clear(), a !== void 0 && a.dispose();
412
- }
413
- e = this._didReportChange || r && !this._equalityComparator(i, this._value), o()?.handleObservableUpdated(this, {
414
- oldValue: i,
415
- newValue: this._value,
416
- change: void 0,
417
- didChange: e,
418
- hadValue: r
419
- });
420
- } catch (s) {
421
- D(s);
422
- }
423
- if (this._isComputing = !1, !this._didReportChange && e)
424
- for (const s of this._observers)
425
- s.handleChange(this, void 0);
426
- else
427
- this._didReportChange = !1;
428
- }
429
- toString() {
430
- return `LazyDerived<${this.debugName}>`;
431
- }
432
- // IObserver Implementation
433
- beginUpdate(e) {
434
- if (this._isUpdating)
435
- throw new v("Cyclic deriveds are not supported yet!");
436
- this._updateCount++, this._isUpdating = !0;
437
- try {
438
- const t = this._updateCount === 1;
439
- if (this._state === 3 && (this._state = 1, !t))
440
- for (const s of this._observers)
441
- s.handlePossibleChange(this);
442
- if (t)
443
- for (const s of this._observers)
444
- s.beginUpdate(this);
445
- } finally {
446
- this._isUpdating = !1;
447
- }
448
- }
449
- endUpdate(e) {
450
- if (this._updateCount--, this._updateCount === 0) {
451
- const t = [...this._observers];
452
- for (const s of t)
453
- s.endUpdate(this);
454
- if (this._removedObserverToCallEndUpdateOn) {
455
- const s = [...this._removedObserverToCallEndUpdateOn];
456
- this._removedObserverToCallEndUpdateOn = null;
457
- for (const r of s)
458
- r.endUpdate(this);
459
- }
460
- }
461
- }
462
- handlePossibleChange(e) {
463
- if (this._state === 3 && this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e)) {
464
- this._state = 1;
465
- for (const t of this._observers)
466
- t.handlePossibleChange(this);
467
- }
468
- }
469
- handleChange(e, t) {
470
- if (this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e) || this._isInBeforeUpdate) {
471
- o()?.handleDerivedDependencyChanged(this, e, t);
472
- let s = !1;
473
- try {
474
- s = this._changeTracker ? this._changeTracker.handleChange({
475
- changedObservable: e,
476
- change: t,
477
- didChange: (i) => i === e
478
- }, this._changeSummary) : !0;
479
- } catch (i) {
480
- D(i);
481
- }
482
- const r = this._state === 3;
483
- if (s && (this._state === 1 || r) && (this._state = 2, r))
484
- for (const i of this._observers)
485
- i.handlePossibleChange(this);
486
- }
487
- }
488
- // IReader Implementation
489
- _ensureReaderValid() {
490
- if (!this._isReaderValid)
491
- throw new v("The reader object cannot be used outside its compute function!");
492
- }
493
- readObservable(e) {
494
- this._ensureReaderValid(), e.addObserver(this);
495
- const t = e.get();
496
- return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
497
- }
498
- reportChange(e) {
499
- this._ensureReaderValid(), this._didReportChange = !0;
500
- for (const t of this._observers)
501
- t.handleChange(this, e);
502
- }
503
- get store() {
504
- return this._ensureReaderValid(), this._store === void 0 && (this._store = new f()), this._store;
505
- }
506
- get delayedStore() {
507
- return this._ensureReaderValid(), this._delayedStore === void 0 && (this._delayedStore = new f()), this._delayedStore;
508
- }
509
- addObserver(e) {
510
- const t = !this._observers.has(e) && this._updateCount > 0;
511
- super.addObserver(e), t && (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(e) ? this._removedObserverToCallEndUpdateOn.delete(e) : e.beginUpdate(this));
512
- }
513
- removeObserver(e) {
514
- this._observers.has(e) && this._updateCount > 0 && (this._removedObserverToCallEndUpdateOn || (this._removedObserverToCallEndUpdateOn = /* @__PURE__ */ new Set()), this._removedObserverToCallEndUpdateOn.add(e)), super.removeObserver(e);
515
- }
516
- debugGetState() {
517
- return {
518
- state: this._state,
519
- stateStr: Ce(this._state),
520
- updateCount: this._updateCount,
521
- isComputing: this._isComputing,
522
- dependencies: this._dependencies,
523
- value: this._value
524
- };
525
- }
526
- debugSetValue(e) {
527
- this._value = e;
528
- }
529
- debugRecompute() {
530
- this._isComputing ? this._state = 2 : this._recompute();
531
- }
532
- setValue(e, t, s) {
533
- this._value = e;
534
- const r = this._observers;
535
- t.updateObserver(this, this);
536
- for (const i of r)
537
- i.handleChange(this, s);
538
- }
539
- }
540
- class ye extends b {
541
- constructor(e, t, s, r = void 0, i, a, d) {
542
- super(e, t, s, r, i, d), this.set = a;
543
- }
544
- }
545
- function Oe(n, e, t = u.ofCaller()) {
546
- return e !== void 0 ? new b(new l(n, void 0, e), e, void 0, void 0, _, t) : new b(new l(void 0, void 0, n), n, void 0, void 0, _, t);
547
- }
548
- function He(n, e, t, s = u.ofCaller()) {
549
- return new ye(new l(n, void 0, e), e, void 0, void 0, _, t, s);
550
- }
551
- function V(n, e, t = u.ofCaller()) {
552
- return new b(new l(n.owner, n.debugName, n.debugReferenceFn), e, void 0, n.onLastObserverRemoved, n.equalsFn ?? _, t);
553
- }
554
- _e(V);
555
- function Ke(n, e, t = u.ofCaller()) {
556
- return new b(new l(n.owner, n.debugName, void 0), e, n.changeTracker, void 0, n.equalityComparer ?? _, t);
557
- }
558
- function Pe(n, e, t = u.ofCaller()) {
559
- let s, r;
560
- e === void 0 ? (s = n, r = void 0) : (r = n, s = e);
561
- let i = new f();
562
- return new b(new l(r, void 0, s), (a) => (i.isDisposed ? i = new f() : i.clear(), s(a, i)), void 0, () => i.dispose(), _, t);
563
- }
564
- function Ze(n, e, t = u.ofCaller()) {
565
- let s, r;
566
- e === void 0 ? (s = n, r = void 0) : (r = n, s = e);
567
- let i;
568
- return new b(new l(r, void 0, s), (a) => {
569
- i ? i.clear() : i = new f();
570
- const d = s(a);
571
- return d && i.add(d), d;
572
- }, void 0, () => {
573
- i && (i.dispose(), i = void 0);
574
- }, _, t);
575
- }
576
- function we(n) {
577
- switch (n) {
578
- case 1:
579
- return "dependenciesMightHaveChanged";
580
- case 2:
581
- return "stale";
582
- case 3:
583
- return "upToDate";
584
- default:
585
- return "<unknown>";
586
- }
587
- }
588
- class k {
589
- get debugName() {
590
- return this._debugNameData.getDebugName(this) ?? "(anonymous)";
591
- }
592
- constructor(e, t, s, r) {
593
- this._debugNameData = e, this._runFn = t, this._changeTracker = s, this._state = 2, this._updateCount = 0, this._disposed = !1, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._isRunning = !1, this._store = void 0, this._delayedStore = void 0, this._changeSummary = this._changeTracker?.createChangeSummary(void 0), o()?.handleAutorunCreated(this, r), this._run();
594
- }
595
- dispose() {
596
- if (!this._disposed) {
597
- this._disposed = !0;
598
- for (const e of this._dependencies)
599
- e.removeObserver(this);
600
- this._dependencies.clear(), this._store !== void 0 && this._store.dispose(), this._delayedStore !== void 0 && this._delayedStore.dispose(), o()?.handleAutorunDisposed(this);
601
- }
602
- }
603
- _run() {
604
- const e = this._dependenciesToBeRemoved;
605
- this._dependenciesToBeRemoved = this._dependencies, this._dependencies = e, this._state = 3;
606
- try {
607
- if (!this._disposed) {
608
- o()?.handleAutorunStarted(this);
609
- const t = this._changeSummary, s = this._delayedStore;
610
- s !== void 0 && (this._delayedStore = void 0);
611
- try {
612
- this._isRunning = !0, this._changeTracker && (this._changeTracker.beforeUpdate?.(this, t), this._changeSummary = this._changeTracker.createChangeSummary(t)), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._runFn(this, t);
613
- } catch (r) {
614
- D(r);
615
- } finally {
616
- this._isRunning = !1, s !== void 0 && s.dispose();
617
- }
618
- }
619
- } finally {
620
- this._disposed || o()?.handleAutorunFinished(this);
621
- for (const t of this._dependenciesToBeRemoved)
622
- t.removeObserver(this);
623
- this._dependenciesToBeRemoved.clear();
624
- }
625
- }
626
- toString() {
627
- return `Autorun<${this.debugName}>`;
628
- }
629
- // IObserver implementation
630
- beginUpdate(e) {
631
- this._state === 3 && (this._state = 1), this._updateCount++;
632
- }
633
- endUpdate(e) {
634
- try {
635
- if (this._updateCount === 1)
636
- do {
637
- if (this._state === 1) {
638
- this._state = 3;
639
- for (const t of this._dependencies)
640
- if (t.reportChanges(), this._state === 2)
641
- break;
642
- }
643
- this._state !== 3 && this._run();
644
- } while (this._state !== 3);
645
- } finally {
646
- this._updateCount--;
647
- }
648
- }
649
- handlePossibleChange(e) {
650
- this._state === 3 && this._isDependency(e) && (this._state = 1);
651
- }
652
- handleChange(e, t) {
653
- if (this._isDependency(e)) {
654
- o()?.handleAutorunDependencyChanged(this, e, t);
655
- try {
656
- (this._changeTracker ? this._changeTracker.handleChange({
657
- changedObservable: e,
658
- change: t,
659
- didChange: (r) => r === e
660
- }, this._changeSummary) : !0) && (this._state = 2);
661
- } catch (s) {
662
- D(s);
663
- }
664
- }
665
- }
666
- _isDependency(e) {
667
- return this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e);
668
- }
669
- // IReader implementation
670
- _ensureNoRunning() {
671
- if (!this._isRunning)
672
- throw new v("The reader object cannot be used outside its compute function!");
673
- }
674
- readObservable(e) {
675
- if (this._ensureNoRunning(), this._disposed)
676
- return e.get();
677
- e.addObserver(this);
678
- const t = e.get();
679
- return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
680
- }
681
- get store() {
682
- if (this._ensureNoRunning(), this._disposed)
683
- throw new v("Cannot access store after dispose");
684
- return this._store === void 0 && (this._store = new f()), this._store;
685
- }
686
- get delayedStore() {
687
- if (this._ensureNoRunning(), this._disposed)
688
- throw new v("Cannot access store after dispose");
689
- return this._delayedStore === void 0 && (this._delayedStore = new f()), this._delayedStore;
690
- }
691
- debugGetState() {
692
- return {
693
- isRunning: this._isRunning,
694
- updateCount: this._updateCount,
695
- dependencies: this._dependencies,
696
- state: this._state,
697
- stateStr: we(this._state)
698
- };
699
- }
700
- debugRerun() {
701
- this._isRunning ? this._state = 2 : this._run();
702
- }
703
- }
704
- function A(n, e = u.ofCaller()) {
705
- return new k(new l(void 0, void 0, n), n, void 0, e);
706
- }
707
- const Je = A;
708
- function U(n, e, t = u.ofCaller()) {
709
- return new k(new l(n.owner, n.debugName, n.debugReferenceFn ?? e), e, void 0, t);
710
- }
711
- const Qe = U;
712
- function Se(n, e, t = u.ofCaller()) {
713
- return new k(new l(n.owner, n.debugName, n.debugReferenceFn ?? e), e, n.changeTracker, t);
714
- }
715
- function Te(n, e) {
716
- const t = new f(), s = Se({
717
- owner: n.owner,
718
- debugName: n.debugName,
719
- debugReferenceFn: n.debugReferenceFn ?? e,
720
- changeTracker: n.changeTracker
721
- }, (r, i) => {
722
- t.clear(), e(r, i, t);
723
- });
724
- return R(() => {
725
- s.dispose(), t.dispose();
726
- });
727
- }
728
- function Xe(n) {
729
- const e = new f(), t = U({
730
- owner: void 0,
731
- debugName: void 0,
732
- debugReferenceFn: n
733
- }, (s) => {
734
- e.clear(), n(s, e);
735
- });
736
- return R(() => {
737
- t.dispose(), e.dispose();
738
- });
739
- }
740
- function Ye(n, e) {
741
- let t;
742
- return U({ debugReferenceFn: e }, (s) => {
743
- const r = n.read(s), i = t;
744
- t = r, e({ lastValue: i, newValue: r });
745
- });
746
- }
747
- function et(n, e, t = (s) => s) {
748
- const s = /* @__PURE__ */ new Map();
749
- return U({ debugReferenceFn: n }, (r) => {
750
- const i = /* @__PURE__ */ new Map(), a = new Map(s);
751
- for (const d of n(r)) {
752
- const h = t(d);
753
- s.has(h) ? a.delete(h) : (i.set(h, d), s.set(h, d));
754
- }
755
- for (const d of a.keys())
756
- s.delete(d);
757
- (i.size || a.size) && e({ addedValues: [...i.values()], removedValues: [...a.values()] });
758
- });
759
- }
760
- function tt(n, e = u.ofCaller()) {
761
- let t, s = !1;
762
- return t = A((r) => {
763
- n({
764
- delayedStore: r.delayedStore,
765
- store: r.store,
766
- readObservable: r.readObservable.bind(r),
767
- dispose: () => {
768
- t?.dispose(), s = !0;
769
- }
770
- });
771
- }, e), s && t.dispose(), t;
772
- }
773
- function Q(n) {
774
- const e = new Error("BugIndicatingErrorRecovery: " + n);
775
- ve(e), console.error("recovered from an error that indicates a bug", e);
776
- }
777
- function E(n, e) {
778
- const t = new $(n, e);
779
- try {
780
- n(t);
781
- } finally {
782
- t.finish();
783
- }
784
- }
785
- let S;
786
- function nt(n) {
787
- if (S)
788
- n(S);
789
- else {
790
- const e = new $(n, void 0);
791
- S = e;
792
- try {
793
- n(e);
794
- } finally {
795
- e.finish(), S = void 0;
796
- }
797
- }
798
- }
799
- async function st(n, e) {
800
- const t = new $(n, e);
801
- try {
802
- await n(t);
803
- } finally {
804
- t.finish();
805
- }
806
- }
807
- function De(n, e, t) {
808
- n ? e(n) : E(e, t);
809
- }
810
- class $ {
811
- constructor(e, t) {
812
- this._fn = e, this._getDebugName = t, this._updatingObservers = [], o()?.handleBeginTransaction(this);
813
- }
814
- getDebugName() {
815
- return this._getDebugName ? this._getDebugName() : W(this._fn);
816
- }
817
- updateObserver(e, t) {
818
- if (!this._updatingObservers) {
819
- Q("Transaction already finished!"), E((s) => {
820
- s.updateObserver(e, t);
821
- });
822
- return;
823
- }
824
- this._updatingObservers.push({ observer: e, observable: t }), e.beginUpdate(t);
825
- }
826
- finish() {
827
- const e = this._updatingObservers;
828
- if (!e) {
829
- Q("transaction.finish() has already been called!");
830
- return;
831
- }
832
- for (let t = 0; t < e.length; t++) {
833
- const { observer: s, observable: r } = e[t];
834
- s.endUpdate(r);
835
- }
836
- this._updatingObservers = null, o()?.handleEndTransaction(this);
837
- }
838
- debugGetUpdatingObservers() {
839
- return this._updatingObservers;
840
- }
841
- }
842
- function z(n, e, t = u.ofCaller()) {
843
- let s;
844
- return typeof n == "string" ? s = new l(void 0, n, void 0) : s = new l(n, void 0, void 0), new q(s, e, _, t);
845
- }
846
- class q extends N {
847
- get debugName() {
848
- return this._debugNameData.getDebugName(this) ?? "ObservableValue";
849
- }
850
- constructor(e, t, s, r) {
851
- super(r), this._debugNameData = e, this._equalityComparator = s, this._value = t, o()?.handleObservableUpdated(this, { hadValue: !1, newValue: t, change: void 0, didChange: !0, oldValue: void 0 });
852
- }
853
- get() {
854
- return this._value;
855
- }
856
- set(e, t, s) {
857
- if (s === void 0 && this._equalityComparator(this._value, e))
858
- return;
859
- let r;
860
- t || (t = r = new $(() => {
861
- }, () => `Setting ${this.debugName}`));
862
- try {
863
- const i = this._value;
864
- this._setValue(e), o()?.handleObservableUpdated(this, { oldValue: i, newValue: e, change: s, didChange: !0, hadValue: !0 });
865
- for (const a of this._observers)
866
- t.updateObserver(a, this), a.handleChange(this, s);
867
- } finally {
868
- r && r.finish();
869
- }
870
- }
871
- toString() {
872
- return `${this.debugName}: ${this._value}`;
873
- }
874
- _setValue(e) {
875
- this._value = e;
876
- }
877
- debugGetState() {
878
- return {
879
- value: this._value
880
- };
881
- }
882
- debugSetValue(e) {
883
- this._value = e;
884
- }
885
- }
886
- function rt(n, e, t = u.ofCaller()) {
887
- let s;
888
- return typeof n == "string" ? s = new l(void 0, n, void 0) : s = new l(n, void 0, void 0), new Ne(s, e, _, t);
889
- }
890
- class Ne extends q {
891
- _setValue(e) {
892
- this._value !== e && (this._value && this._value.dispose(), this._value = e);
893
- }
894
- dispose() {
895
- this._value?.dispose();
896
- }
897
- }
898
- function G(...n) {
899
- let e, t, s, r;
900
- return n.length === 2 ? [t, s] = n : [e, t, s, r] = n, new p(new l(e, void 0, s), t, s, () => p.globalTransaction, _, r ?? u.ofCaller());
901
- }
902
- function it(n, e, t, s = u.ofCaller()) {
903
- return new p(new l(n.owner, n.debugName, n.debugReferenceFn ?? t), e, t, () => p.globalTransaction, n.equalsFn ?? _, s);
904
- }
905
- class p extends N {
906
- constructor(e, t, s, r, i, a) {
907
- super(a), this._debugNameData = e, this.event = t, this._getValue = s, this._getTransaction = r, this._equalityComparator = i, this._hasValue = !1, this.handleEvent = (d) => {
908
- const h = this._getValue(d), F = this._value, B = !this._hasValue || !this._equalityComparator(F, h);
909
- let M = !1;
910
- B && (this._value = h, this._hasValue && (M = !0, De(this._getTransaction(), (w) => {
911
- o()?.handleObservableUpdated(this, { oldValue: F, newValue: h, change: void 0, didChange: B, hadValue: this._hasValue });
912
- for (const H of this._observers)
913
- w.updateObserver(H, this), H.handleChange(this, void 0);
914
- }, () => {
915
- const w = this.getDebugName();
916
- return "Event fired" + (w ? `: ${w}` : "");
917
- })), this._hasValue = !0), M || o()?.handleObservableUpdated(this, { oldValue: F, newValue: h, change: void 0, didChange: B, hadValue: this._hasValue });
918
- };
919
- }
920
- getDebugName() {
921
- return this._debugNameData.getDebugName(this);
922
- }
923
- get debugName() {
924
- const e = this.getDebugName();
925
- return "From Event" + (e ? `: ${e}` : "");
926
- }
927
- onFirstObserverAdded() {
928
- this._subscription = this.event(this.handleEvent);
929
- }
930
- onLastObserverRemoved() {
931
- this._subscription.dispose(), this._subscription = void 0, this._hasValue = !1, this._value = void 0;
932
- }
933
- get() {
934
- return this._subscription ? (this._hasValue || this.handleEvent(void 0), this._value) : this._getValue(void 0);
935
- }
936
- debugSetValue(e) {
937
- this._value = e;
938
- }
939
- debugGetState() {
940
- return { value: this._value, hasValue: this._hasValue };
941
- }
942
- }
943
- (function(n) {
944
- n.Observer = p;
945
- function e(t, s) {
946
- let r = !1;
947
- p.globalTransaction === void 0 && (p.globalTransaction = t, r = !0);
948
- try {
949
- s();
950
- } finally {
951
- r && (p.globalTransaction = void 0);
952
- }
953
- }
954
- n.batchEventsGlobally = e;
955
- })(G || (G = {}));
956
- function Re(n, e = u.ofCaller()) {
957
- return typeof n == "string" ? new X(n, void 0, e) : new X(void 0, n, e);
958
- }
959
- class X extends N {
960
- get debugName() {
961
- return new l(this._owner, this._debugName, void 0).getDebugName(this) ?? "Observable Signal";
962
- }
963
- toString() {
964
- return this.debugName;
965
- }
966
- constructor(e, t, s) {
967
- super(s), this._debugName = e, this._owner = t;
968
- }
969
- trigger(e, t) {
970
- if (!e) {
971
- E((s) => {
972
- this.trigger(s, t);
973
- }, () => `Trigger signal ${this.debugName}`);
974
- return;
975
- }
976
- for (const s of this._observers)
977
- e.updateObserver(s, this), s.handleChange(this, t);
978
- }
979
- get() {
980
- }
981
- }
982
- function at(n) {
983
- const e = z("promiseValue", {});
984
- return n.then((t) => {
985
- e.set({ value: t }, void 0);
986
- }), e;
987
- }
988
- function dt(n, e) {
989
- return V({
990
- owner: n,
991
- equalsFn: () => !1
992
- }, (t) => {
993
- e.read(t);
994
- });
995
- }
996
- function ot(n, e, t) {
997
- const s = z("debounced", void 0);
998
- let r;
999
- return t.add(A((i) => {
1000
- const a = n.read(i);
1001
- r && clearTimeout(r), r = setTimeout(() => {
1002
- E((d) => {
1003
- s.set(a, d);
1004
- });
1005
- }, e);
1006
- })), s;
1007
- }
1008
- function ut(n, e) {
1009
- let t = !1, s, r;
1010
- return G((i) => {
1011
- const a = A((d) => {
1012
- const h = n.read(d);
1013
- t ? (r && clearTimeout(r), r = setTimeout(() => {
1014
- s = h, i();
1015
- }, e)) : (t = !0, s = h);
1016
- });
1017
- return {
1018
- dispose() {
1019
- a.dispose(), t = !1, s = void 0;
1020
- }
1021
- };
1022
- }, () => t ? s : n.get());
1023
- }
1024
- function ht(n, e, t) {
1025
- const s = z("triggeredRecently", !1);
1026
- let r;
1027
- return t.add(n(() => {
1028
- s.set(!0, void 0), r && clearTimeout(r), r = setTimeout(() => {
1029
- s.set(!1, void 0);
1030
- }, e);
1031
- })), s;
1032
- }
1033
- function Ve(n) {
1034
- const e = new ie(!1, void 0);
1035
- return n.addObserver(e), R(() => {
1036
- n.removeObserver(e);
1037
- });
1038
- }
1039
- pe(Ve);
1040
- function ke(n, e) {
1041
- const t = new ie(!0, e);
1042
- n.addObserver(t);
1043
- try {
1044
- t.beginUpdate(n);
1045
- } finally {
1046
- t.endUpdate(n);
1047
- }
1048
- return R(() => {
1049
- n.removeObserver(t);
1050
- });
1051
- }
1052
- be(ke);
1053
- class ie {
1054
- constructor(e, t) {
1055
- this._forceRecompute = e, this._handleValue = t, this._counter = 0;
1056
- }
1057
- beginUpdate(e) {
1058
- this._counter++;
1059
- }
1060
- endUpdate(e) {
1061
- this._counter === 1 && this._forceRecompute && (this._handleValue ? this._handleValue(e.get()) : e.reportChanges()), this._counter--;
1062
- }
1063
- handlePossibleChange(e) {
1064
- }
1065
- handleChange(e, t) {
1066
- }
1067
- }
1068
- function lt(n, e) {
1069
- let t;
1070
- return V({ owner: n, debugReferenceFn: e }, (r) => (t = e(r, t), t));
1071
- }
1072
- function ct(n, e) {
1073
- let t;
1074
- const s = Re("derivedObservableWithWritableCache"), r = Oe(n, (i) => (s.read(i), t = e(i, t), t));
1075
- return Object.assign(r, {
1076
- clearCache: (i) => {
1077
- t = void 0, s.trigger(i);
1078
- },
1079
- setCache: (i, a) => {
1080
- t = i, s.trigger(a);
1081
- }
1082
- });
1083
- }
1084
- function ft(n, e, t, s) {
1085
- let r = new Y(t, s);
1086
- return V({
1087
- debugReferenceFn: t,
1088
- owner: n,
1089
- onLastObserverRemoved: () => {
1090
- r.dispose(), r = new Y(t);
1091
- }
1092
- }, (a) => (r.setItems(e.read(a)), r.getItems()));
1093
- }
1094
- class Y {
1095
- constructor(e, t) {
1096
- this._map = e, this._keySelector = t, this._cache = /* @__PURE__ */ new Map(), this._items = [];
1097
- }
1098
- dispose() {
1099
- this._cache.forEach((e) => e.store.dispose()), this._cache.clear();
1100
- }
1101
- setItems(e) {
1102
- const t = [], s = new Set(this._cache.keys());
1103
- for (const r of e) {
1104
- const i = this._keySelector ? this._keySelector(r) : r;
1105
- let a = this._cache.get(i);
1106
- if (a)
1107
- s.delete(i);
1108
- else {
1109
- const d = new f();
1110
- a = { out: this._map(r, d), store: d }, this._cache.set(i, a);
1111
- }
1112
- t.push(a.out);
1113
- }
1114
- for (const r of s)
1115
- this._cache.get(r).store.dispose(), this._cache.delete(r);
1116
- this._items = t;
1117
- }
1118
- getItems() {
1119
- return this._items;
1120
- }
1121
- }
1122
- let T;
1123
- function Ae(n) {
1124
- T || (T = new Ue(), de(T)), T.addFilteredObj(n);
1125
- }
1126
- class Ue {
1127
- constructor() {
1128
- this.indentation = 0, this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
1129
- }
1130
- addFilteredObj(e) {
1131
- this._filteredObjects || (this._filteredObjects = /* @__PURE__ */ new Set()), this._filteredObjects.add(e);
1132
- }
1133
- _isIncluded(e) {
1134
- return this._filteredObjects?.has(e) ?? !0;
1135
- }
1136
- textToConsoleArgs(e) {
1137
- return Ee([
1138
- C(xe("| ", this.indentation)),
1139
- e
1140
- ]);
1141
- }
1142
- formatInfo(e) {
1143
- return e.hadValue ? e.didChange ? [
1144
- C(" "),
1145
- c(O(e.oldValue, 70), {
1146
- color: "red",
1147
- strikeThrough: !0
1148
- }),
1149
- C(" "),
1150
- c(O(e.newValue, 60), {
1151
- color: "green"
1152
- })
1153
- ] : [C(" (unchanged)")] : [
1154
- C(" "),
1155
- c(O(e.newValue, 60), {
1156
- color: "green"
1157
- }),
1158
- C(" (initial)")
1159
- ];
1160
- }
1161
- handleObservableCreated(e) {
1162
- if (e instanceof b) {
1163
- const t = e;
1164
- this.changedObservablesSets.set(t, /* @__PURE__ */ new Set());
1165
- }
1166
- }
1167
- handleOnListenerCountChanged(e, t) {
1168
- }
1169
- handleObservableUpdated(e, t) {
1170
- if (this._isIncluded(e)) {
1171
- if (e instanceof b) {
1172
- this._handleDerivedRecomputed(e, t);
1173
- return;
1174
- }
1175
- console.log(...this.textToConsoleArgs([
1176
- y("observable value changed"),
1177
- c(e.debugName, { color: "BlueViolet" }),
1178
- ...this.formatInfo(t)
1179
- ]));
1180
- }
1181
- }
1182
- formatChanges(e) {
1183
- if (e.size !== 0)
1184
- return c(" (changed deps: " + [...e].map((t) => t.debugName).join(", ") + ")", { color: "gray" });
1185
- }
1186
- handleDerivedDependencyChanged(e, t, s) {
1187
- this._isIncluded(e) && this.changedObservablesSets.get(e)?.add(t);
1188
- }
1189
- _handleDerivedRecomputed(e, t) {
1190
- if (!this._isIncluded(e))
1191
- return;
1192
- const s = this.changedObservablesSets.get(e);
1193
- s && (console.log(...this.textToConsoleArgs([
1194
- y("derived recomputed"),
1195
- c(e.debugName, { color: "BlueViolet" }),
1196
- ...this.formatInfo(t),
1197
- this.formatChanges(s),
1198
- { data: [{ fn: e._debugNameData.referenceFn ?? e._computeFn }] }
1199
- ])), s.clear());
1200
- }
1201
- handleDerivedCleared(e) {
1202
- this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1203
- y("derived cleared"),
1204
- c(e.debugName, { color: "BlueViolet" })
1205
- ]));
1206
- }
1207
- handleFromEventObservableTriggered(e, t) {
1208
- this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1209
- y("observable from event triggered"),
1210
- c(e.debugName, { color: "BlueViolet" }),
1211
- ...this.formatInfo(t),
1212
- { data: [{ fn: e._getValue }] }
1213
- ]));
1214
- }
1215
- handleAutorunCreated(e) {
1216
- this._isIncluded(e) && this.changedObservablesSets.set(e, /* @__PURE__ */ new Set());
1217
- }
1218
- handleAutorunDisposed(e) {
1219
- }
1220
- handleAutorunDependencyChanged(e, t, s) {
1221
- this._isIncluded(e) && this.changedObservablesSets.get(e).add(t);
1222
- }
1223
- handleAutorunStarted(e) {
1224
- const t = this.changedObservablesSets.get(e);
1225
- t && (this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1226
- y("autorun"),
1227
- c(e.debugName, { color: "BlueViolet" }),
1228
- this.formatChanges(t),
1229
- { data: [{ fn: e._debugNameData.referenceFn ?? e._runFn }] }
1230
- ])), t.clear(), this.indentation++);
1231
- }
1232
- handleAutorunFinished(e) {
1233
- this.indentation--;
1234
- }
1235
- handleBeginTransaction(e) {
1236
- let t = e.getDebugName();
1237
- t === void 0 && (t = ""), this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1238
- y("transaction"),
1239
- c(t, { color: "BlueViolet" }),
1240
- { data: [{ fn: e._fn }] }
1241
- ])), this.indentation++;
1242
- }
1243
- handleEndTransaction() {
1244
- this.indentation--;
1245
- }
1246
- }
1247
- function Ee(n) {
1248
- const e = new Array(), t = [];
1249
- let s = "";
1250
- function r(a) {
1251
- if ("length" in a)
1252
- for (const d of a)
1253
- d && r(d);
1254
- else "text" in a ? (s += `%c${a.text}`, e.push(a.style), a.data && t.push(...a.data)) : "data" in a && t.push(...a.data);
1255
- }
1256
- r(n);
1257
- const i = [s, ...e];
1258
- return i.push(...t), i;
1259
- }
1260
- function C(n) {
1261
- return c(n, { color: "black" });
1262
- }
1263
- function y(n) {
1264
- return c(Ie(`${n}: `, 10), { color: "black", bold: !0 });
1265
- }
1266
- function c(n, e = {
1267
- color: "black"
1268
- }) {
1269
- function t(r) {
1270
- return Object.entries(r).reduce((i, [a, d]) => `${i}${a}:${d};`, "");
1271
- }
1272
- const s = {
1273
- color: e.color
1274
- };
1275
- return e.strikeThrough && (s["text-decoration"] = "line-through"), e.bold && (s["font-weight"] = "bold"), {
1276
- text: n,
1277
- style: t(s)
1278
- };
1279
- }
1280
- function O(n, e) {
1281
- try {
1282
- return $e(n, e);
1283
- } catch {
1284
- return "[[???]]";
1285
- }
1286
- }
1287
- function $e(n, e) {
1288
- switch (typeof n) {
1289
- case "number":
1290
- return "" + n;
1291
- case "string":
1292
- return n.length + 2 <= e ? `"${n}"` : `"${n.substr(0, e - 7)}"+...`;
1293
- case "boolean":
1294
- return n ? "true" : "false";
1295
- case "undefined":
1296
- return "undefined";
1297
- case "object":
1298
- return n === null ? "null" : Array.isArray(n) ? Fe(n, e) : Be(n, e);
1299
- case "symbol":
1300
- return n.toString();
1301
- case "function":
1302
- return `[[Function${n.name ? " " + n.name : ""}]]`;
1303
- default:
1304
- return "" + n;
1305
- }
1306
- }
1307
- function Fe(n, e) {
1308
- let t = "[ ", s = !0;
1309
- for (const r of n) {
1310
- if (s || (t += ", "), t.length - 5 > e) {
1311
- t += "...";
1312
- break;
1313
- }
1314
- s = !1, t += `${O(r, e - t.length)}`;
1315
- }
1316
- return t += " ]", t;
1317
- }
1318
- function Be(n, e) {
1319
- try {
1320
- if (typeof n.toString == "function" && n.toString !== Object.prototype.toString) {
1321
- const a = n.toString();
1322
- return a.length <= e ? a : a.substring(0, e - 3) + "...";
1323
- }
1324
- } catch {
1325
- return "[[Object]]";
1326
- }
1327
- const t = ee(n);
1328
- let s = t ? t + "(" : "{ ", r = !0, i;
1329
- try {
1330
- i = Object.entries(n);
1331
- } catch {
1332
- return t ? `${t}(...)` : "[[Object]]";
1333
- }
1334
- for (const [a, d] of i) {
1335
- if (r || (s += ", "), s.length - 5 > e) {
1336
- s += "...";
1337
- break;
1338
- }
1339
- r = !1, s += `${a}: ${O(d, e - s.length)}`;
1340
- }
1341
- return s += t ? ")" : " }", s;
1342
- }
1343
- function xe(n, e) {
1344
- let t = "";
1345
- for (let s = 1; s <= e; s++)
1346
- t += n;
1347
- return t;
1348
- }
1349
- function Ie(n, e) {
1350
- for (; n.length < e; )
1351
- n += " ";
1352
- return n;
1353
- }
1354
- function je(n, e) {
1355
- const t = e?.debugNamePostProcessor ?? ((i) => i), s = g.from(n, t);
1356
- return s ? ae(s, 0, /* @__PURE__ */ new Set()).trim() : "";
1357
- }
1358
- function ae(n, e, t) {
1359
- const s = " ".repeat(e), r = [];
1360
- if (t.has(n.sourceObj))
1361
- return r.push(`${s}* ${n.type} ${n.name} (already listed)`), r.join(`
1362
- `);
1363
- if (t.add(n.sourceObj), r.push(`${s}* ${n.type} ${n.name}:`), r.push(`${s} value: ${O(n.value, 50)}`), r.push(`${s} state: ${n.state}`), n.dependencies.length > 0) {
1364
- r.push(`${s} dependencies:`);
1365
- for (const a of n.dependencies)
1366
- r.push(ae(a, e + 1, t));
1367
- }
1368
- return r.join(`
1369
- `);
1370
- }
1371
- class g {
1372
- static from(e, t) {
1373
- if (e instanceof k) {
1374
- const s = e.debugGetState();
1375
- return new g(e, t(e.debugName), "autorun", void 0, s.stateStr, Array.from(s.dependencies).map((r) => g.from(r, t) || g.unknown(r)));
1376
- } else if (e instanceof b) {
1377
- const s = e.debugGetState();
1378
- return new g(e, t(e.debugName), "derived", s.value, s.stateStr, Array.from(s.dependencies).map((r) => g.from(r, t) || g.unknown(r)));
1379
- } else if (e instanceof q) {
1380
- const s = e.debugGetState();
1381
- return new g(e, t(e.debugName), "observableValue", s.value, "upToDate", []);
1382
- } else if (e instanceof p) {
1383
- const s = e.debugGetState();
1384
- return new g(e, t(e.debugName), "fromEvent", s.value, s.hasValue ? "upToDate" : "initial", []);
1385
- }
1386
- }
1387
- static unknown(e) {
1388
- return new g(e, "(unknown)", "unknown", void 0, "unknown", []);
1389
- }
1390
- constructor(e, t, s, r, i, a) {
1391
- this.sourceObj = e, this.name = t, this.type = s, this.value = r, this.state = i, this.dependencies = a;
1392
- }
1393
- }
1394
- me(je);
1395
- oe(Ae);
1396
- class gt extends Error {
1397
- constructor(e = "Operation was cancelled") {
1398
- super(e), this.name = "CancellationError";
1399
- }
1400
- }
1401
- class Ge {
1402
- constructor() {
1403
- this._isCancelled = !1, this._listeners = /* @__PURE__ */ new Set();
1404
- }
1405
- get token() {
1406
- return {
1407
- isCancellationRequested: this._isCancelled,
1408
- onCancellationRequested: (e) => (this._listeners.add(e), this._isCancelled && e(), {
1409
- dispose: () => {
1410
- this._listeners.delete(e);
1411
- }
1412
- })
1413
- };
1414
- }
1415
- cancel() {
1416
- if (!this._isCancelled) {
1417
- this._isCancelled = !0;
1418
- for (const e of this._listeners)
1419
- e();
1420
- }
1421
- }
1422
- dispose() {
1423
- this.cancel(), this._listeners.clear();
1424
- }
1425
- }
1426
- function Le(n) {
1427
- const e = new Ge();
1428
- return n.add(e), e.token;
1429
- }
1430
- function _t(n) {
1431
- return new We(n);
1432
- }
1433
- class We extends re {
1434
- constructor(e) {
1435
- super(), this.value = e;
1436
- }
1437
- get debugName() {
1438
- return this.toString();
1439
- }
1440
- get() {
1441
- return this.value;
1442
- }
1443
- addObserver(e) {
1444
- }
1445
- removeObserver(e) {
1446
- }
1447
- log() {
1448
- return this;
1449
- }
1450
- toString() {
1451
- return `Const: ${this.value}`;
1452
- }
1453
- }
1454
- function ze(n, e) {
1455
- let t, s = !0;
1456
- return Te({
1457
- changeTracker: {
1458
- createChangeSummary: () => ({ deltas: [], didChange: !1 }),
1459
- handleChange: (r, i) => {
1460
- if (r.didChange(n)) {
1461
- const a = r.change;
1462
- a !== void 0 && i.deltas.push(a), i.didChange = !0;
1463
- }
1464
- return !0;
1465
- }
1466
- }
1467
- }, (r, i) => {
1468
- const a = n.read(r), d = t;
1469
- i.didChange && (t = a, e(a, d, i.deltas)), s && (s = !1, t = a);
1470
- });
1471
- }
1472
- function qe(n, e) {
1473
- const t = new f(), s = ze(n, (r, i, a) => {
1474
- t.clear(), e(r, i, a, t);
1475
- });
1476
- return {
1477
- dispose() {
1478
- s.dispose(), t.dispose();
1479
- }
1480
- };
1481
- }
1482
- function bt(n, e) {
1483
- return qe(n, (t, s, r, i) => {
1484
- e(t, s, r, Le(i));
1485
- });
1486
- }
1487
- export {
1488
- _t as A,
1489
- N as B,
1490
- gt as C,
1491
- l as D,
1492
- ut as E,
1493
- ot as F,
1494
- Ze as G,
1495
- Ke as H,
1496
- ct as I,
1497
- V as J,
1498
- He as K,
1499
- Pe as L,
1500
- rt as M,
1501
- nt as N,
1502
- q as O,
1503
- ft as P,
1504
- it as Q,
1505
- at as R,
1506
- Re as S,
1507
- $ as T,
1508
- ke as U,
1509
- ze as V,
1510
- bt as W,
1511
- qe as X,
1512
- dt as Y,
1513
- De as Z,
1514
- ht as _,
1515
- u as a,
1516
- b,
1517
- A as c,
1518
- Oe as d,
1519
- Ge as e,
1520
- v as f,
1521
- o as g,
1522
- G as h,
1523
- lt as i,
1524
- f as j,
1525
- U as k,
1526
- le as l,
1527
- Ve as m,
1528
- Me as n,
1529
- z as o,
1530
- st as p,
1531
- Je as q,
1532
- Ye as r,
1533
- _ as s,
1534
- E as t,
1535
- Se as u,
1536
- et as v,
1537
- Qe as w,
1538
- tt as x,
1539
- Xe as y,
1540
- Te as z
1541
- };
1542
- //# sourceMappingURL=runOnChange-e7FtCqOQ.js.map