@vscode/markdown-editor 0.0.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cursorCommands.d.ts +13 -0
- package/dist/commands/editCommands.d.ts +14 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/selectionCommands.d.ts +6 -0
- package/dist/commands/types.d.ts +26 -0
- package/dist/core/geometry.d.ts +37 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/lengthEdit.d.ts +38 -0
- package/dist/core/offsetRange.d.ts +26 -0
- package/dist/core/selection.d.ts +13 -0
- package/dist/core/sourceOffset.d.ts +1 -0
- package/dist/core/stringEdit.d.ts +27 -0
- package/dist/core/stringValue.d.ts +8 -0
- package/dist/core/wordUtils.d.ts +6 -0
- package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +20 -0
- package/dist/highlighter/index.d.ts +3 -0
- package/dist/highlighter/monacoSyntaxHighlighter.d.ts +38 -0
- package/dist/highlighter/syntaxHighlighter.d.ts +67 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4274 -0
- package/dist/index.js.map +1 -0
- package/dist/model/cursorNavigation.d.ts +7 -0
- package/dist/model/editorModel.d.ts +54 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/measuredLayoutModel.d.ts +50 -0
- package/dist/observables.d.ts +1 -0
- package/dist/observables.js +463 -0
- package/dist/observables.js.map +1 -0
- package/dist/parser/_micromarkAdapter.d.ts +7 -0
- package/dist/parser/ast.d.ts +274 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/parse.d.ts +2 -0
- package/dist/parser/parser.d.ts +14 -0
- package/dist/parser/reconcile.d.ts +33 -0
- package/dist/parser/test/getAnnotatedSource.d.ts +2 -0
- package/dist/parser/test/snapshot.d.ts +9 -0
- package/dist/parser/visualizeAst.d.ts +33 -0
- package/dist/runOnChange-owE1SMC0.js +1514 -0
- package/dist/runOnChange-owE1SMC0.js.map +1 -0
- package/dist/test/random.d.ts +16 -0
- package/dist/view/content/blockView.d.ts +179 -0
- package/dist/view/content/documentView.d.ts +41 -0
- package/dist/view/content/dom.d.ts +16 -0
- package/dist/view/content/katexEditableIdentifiers.d.ts +36 -0
- package/dist/view/content/viewNode.d.ts +93 -0
- package/dist/view/editorController.d.ts +34 -0
- package/dist/view/editorView.d.ts +100 -0
- package/dist/view/fixture/astViewerView.d.ts +27 -0
- package/dist/view/fixture/cyclingTsHighlighter.d.ts +17 -0
- package/dist/view/fixture/debugColors.d.ts +26 -0
- package/dist/view/fixture/monacoDebugPanel.d.ts +7 -0
- package/dist/view/index.d.ts +9 -0
- package/dist/view/measuredLayoutDebugView.d.ts +70 -0
- package/dist/view/parts/cursorView.d.ts +29 -0
- package/dist/view/parts/selectionView.d.ts +57 -0
- package/dist/view/viewData.d.ts +251 -0
- package/dist/view/visualLineMap.d.ts +157 -0
- package/dist/view/visualizeViewTree.d.ts +5 -0
- package/package.json +68 -0
- package/src/view/editor.css +517 -0
- package/src/view/themes/default.css +235 -0
- package/src/view/themes/github.css +308 -0
|
@@ -0,0 +1,1514 @@
|
|
|
1
|
+
let m;
|
|
2
|
+
function ae(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 F;
|
|
9
|
+
function de(n) {
|
|
10
|
+
F = n;
|
|
11
|
+
}
|
|
12
|
+
function oe(n) {
|
|
13
|
+
F && F(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, j.fromStack(h, i + 1);
|
|
86
|
+
}
|
|
87
|
+
n.ofNthCaller = r;
|
|
88
|
+
})(u || (u = {}));
|
|
89
|
+
class j {
|
|
90
|
+
static fromStack(e, t) {
|
|
91
|
+
const s = e.split(`
|
|
92
|
+
`), r = ue(s[t + 1]);
|
|
93
|
+
if (r)
|
|
94
|
+
return new j(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 ue(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 he(e, this);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const P = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new WeakMap();
|
|
129
|
+
function he(n, e) {
|
|
130
|
+
const t = B.get(n);
|
|
131
|
+
if (t)
|
|
132
|
+
return t;
|
|
133
|
+
const s = le(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 B.set(n, i), i;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function le(n, e) {
|
|
142
|
+
const t = B.get(n);
|
|
143
|
+
if (t)
|
|
144
|
+
return t;
|
|
145
|
+
const s = e.owner ? fe(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 = G(a), r !== void 0))
|
|
156
|
+
return s + r;
|
|
157
|
+
if (e.owner !== void 0) {
|
|
158
|
+
const d = ce(e.owner, n);
|
|
159
|
+
if (d !== void 0)
|
|
160
|
+
return s + d;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function ce(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 fe(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 G(n) {
|
|
185
|
+
const e = n.toString(), s = /\/\*\*\s*@description\s*([^*]*)\*\//.exec(e);
|
|
186
|
+
return (s ? s[1] : void 0)?.trim();
|
|
187
|
+
}
|
|
188
|
+
let x;
|
|
189
|
+
function ge(n) {
|
|
190
|
+
x = n;
|
|
191
|
+
}
|
|
192
|
+
let te;
|
|
193
|
+
function _e(n) {
|
|
194
|
+
te = n;
|
|
195
|
+
}
|
|
196
|
+
let ne;
|
|
197
|
+
function be(n) {
|
|
198
|
+
ne = n;
|
|
199
|
+
}
|
|
200
|
+
let se;
|
|
201
|
+
function pe(n) {
|
|
202
|
+
se = n;
|
|
203
|
+
}
|
|
204
|
+
class me {
|
|
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 x({
|
|
218
|
+
owner: r,
|
|
219
|
+
debugName: () => {
|
|
220
|
+
const a = G(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 x({
|
|
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 R extends me {
|
|
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 oe(this), e || o()?.handleObservableCreated(this, u.ofCaller()), this;
|
|
279
|
+
}
|
|
280
|
+
debugGetObservers() {
|
|
281
|
+
return this._observers;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function N(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 qe {
|
|
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 R {
|
|
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 Me(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
|
+
ge(V);
|
|
555
|
+
function He(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 Ke(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 Pe(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 L(n, e = u.ofCaller()) {
|
|
705
|
+
return new k(new l(void 0, void 0, n), n, void 0, e);
|
|
706
|
+
}
|
|
707
|
+
function W(n, e, t = u.ofCaller()) {
|
|
708
|
+
return new k(new l(n.owner, n.debugName, n.debugReferenceFn ?? e), e, void 0, t);
|
|
709
|
+
}
|
|
710
|
+
function Se(n, e, t = u.ofCaller()) {
|
|
711
|
+
return new k(new l(n.owner, n.debugName, n.debugReferenceFn ?? e), e, n.changeTracker, t);
|
|
712
|
+
}
|
|
713
|
+
function Te(n, e) {
|
|
714
|
+
const t = new f(), s = Se({
|
|
715
|
+
owner: n.owner,
|
|
716
|
+
debugName: n.debugName,
|
|
717
|
+
debugReferenceFn: n.debugReferenceFn ?? e,
|
|
718
|
+
changeTracker: n.changeTracker
|
|
719
|
+
}, (r, i) => {
|
|
720
|
+
t.clear(), e(r, i, t);
|
|
721
|
+
});
|
|
722
|
+
return N(() => {
|
|
723
|
+
s.dispose(), t.dispose();
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
function Ze(n) {
|
|
727
|
+
const e = new f(), t = W({
|
|
728
|
+
owner: void 0,
|
|
729
|
+
debugName: void 0,
|
|
730
|
+
debugReferenceFn: n
|
|
731
|
+
}, (s) => {
|
|
732
|
+
e.clear(), n(s, e);
|
|
733
|
+
});
|
|
734
|
+
return N(() => {
|
|
735
|
+
t.dispose(), e.dispose();
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function Je(n, e) {
|
|
739
|
+
let t;
|
|
740
|
+
return W({ debugReferenceFn: e }, (s) => {
|
|
741
|
+
const r = n.read(s), i = t;
|
|
742
|
+
t = r, e({ lastValue: i, newValue: r });
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function Qe(n, e, t = (s) => s) {
|
|
746
|
+
const s = /* @__PURE__ */ new Map();
|
|
747
|
+
return W({ debugReferenceFn: n }, (r) => {
|
|
748
|
+
const i = /* @__PURE__ */ new Map(), a = new Map(s);
|
|
749
|
+
for (const d of n(r)) {
|
|
750
|
+
const h = t(d);
|
|
751
|
+
s.has(h) ? a.delete(h) : (i.set(h, d), s.set(h, d));
|
|
752
|
+
}
|
|
753
|
+
for (const d of a.keys())
|
|
754
|
+
s.delete(d);
|
|
755
|
+
(i.size || a.size) && e({ addedValues: [...i.values()], removedValues: [...a.values()] });
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
function Xe(n, e = u.ofCaller()) {
|
|
759
|
+
let t, s = !1;
|
|
760
|
+
return t = L((r) => {
|
|
761
|
+
n({
|
|
762
|
+
delayedStore: r.delayedStore,
|
|
763
|
+
store: r.store,
|
|
764
|
+
readObservable: r.readObservable.bind(r),
|
|
765
|
+
dispose: () => {
|
|
766
|
+
t?.dispose(), s = !0;
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
}, e), s && t.dispose(), t;
|
|
770
|
+
}
|
|
771
|
+
function Q(n) {
|
|
772
|
+
const e = new Error("BugIndicatingErrorRecovery: " + n);
|
|
773
|
+
ve(e), console.error("recovered from an error that indicates a bug", e);
|
|
774
|
+
}
|
|
775
|
+
function A(n, e) {
|
|
776
|
+
const t = new U(n, e);
|
|
777
|
+
try {
|
|
778
|
+
n(t);
|
|
779
|
+
} finally {
|
|
780
|
+
t.finish();
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
let S;
|
|
784
|
+
function Ye(n) {
|
|
785
|
+
if (S)
|
|
786
|
+
n(S);
|
|
787
|
+
else {
|
|
788
|
+
const e = new U(n, void 0);
|
|
789
|
+
S = e;
|
|
790
|
+
try {
|
|
791
|
+
n(e);
|
|
792
|
+
} finally {
|
|
793
|
+
e.finish(), S = void 0;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
async function et(n, e) {
|
|
798
|
+
const t = new U(n, e);
|
|
799
|
+
try {
|
|
800
|
+
await n(t);
|
|
801
|
+
} finally {
|
|
802
|
+
t.finish();
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function De(n, e, t) {
|
|
806
|
+
n ? e(n) : A(e, t);
|
|
807
|
+
}
|
|
808
|
+
class U {
|
|
809
|
+
constructor(e, t) {
|
|
810
|
+
this._fn = e, this._getDebugName = t, this._updatingObservers = [], o()?.handleBeginTransaction(this);
|
|
811
|
+
}
|
|
812
|
+
getDebugName() {
|
|
813
|
+
return this._getDebugName ? this._getDebugName() : G(this._fn);
|
|
814
|
+
}
|
|
815
|
+
updateObserver(e, t) {
|
|
816
|
+
if (!this._updatingObservers) {
|
|
817
|
+
Q("Transaction already finished!"), A((s) => {
|
|
818
|
+
s.updateObserver(e, t);
|
|
819
|
+
});
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
this._updatingObservers.push({ observer: e, observable: t }), e.beginUpdate(t);
|
|
823
|
+
}
|
|
824
|
+
finish() {
|
|
825
|
+
const e = this._updatingObservers;
|
|
826
|
+
if (!e) {
|
|
827
|
+
Q("transaction.finish() has already been called!");
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
for (let t = 0; t < e.length; t++) {
|
|
831
|
+
const { observer: s, observable: r } = e[t];
|
|
832
|
+
s.endUpdate(r);
|
|
833
|
+
}
|
|
834
|
+
this._updatingObservers = null, o()?.handleEndTransaction(this);
|
|
835
|
+
}
|
|
836
|
+
debugGetUpdatingObservers() {
|
|
837
|
+
return this._updatingObservers;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
function z(n, e, t = u.ofCaller()) {
|
|
841
|
+
let s;
|
|
842
|
+
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);
|
|
843
|
+
}
|
|
844
|
+
class q extends R {
|
|
845
|
+
get debugName() {
|
|
846
|
+
return this._debugNameData.getDebugName(this) ?? "ObservableValue";
|
|
847
|
+
}
|
|
848
|
+
constructor(e, t, s, r) {
|
|
849
|
+
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 });
|
|
850
|
+
}
|
|
851
|
+
get() {
|
|
852
|
+
return this._value;
|
|
853
|
+
}
|
|
854
|
+
set(e, t, s) {
|
|
855
|
+
if (s === void 0 && this._equalityComparator(this._value, e))
|
|
856
|
+
return;
|
|
857
|
+
let r;
|
|
858
|
+
t || (t = r = new U(() => {
|
|
859
|
+
}, () => `Setting ${this.debugName}`));
|
|
860
|
+
try {
|
|
861
|
+
const i = this._value;
|
|
862
|
+
this._setValue(e), o()?.handleObservableUpdated(this, { oldValue: i, newValue: e, change: s, didChange: !0, hadValue: !0 });
|
|
863
|
+
for (const a of this._observers)
|
|
864
|
+
t.updateObserver(a, this), a.handleChange(this, s);
|
|
865
|
+
} finally {
|
|
866
|
+
r && r.finish();
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
toString() {
|
|
870
|
+
return `${this.debugName}: ${this._value}`;
|
|
871
|
+
}
|
|
872
|
+
_setValue(e) {
|
|
873
|
+
this._value = e;
|
|
874
|
+
}
|
|
875
|
+
debugGetState() {
|
|
876
|
+
return {
|
|
877
|
+
value: this._value
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
debugSetValue(e) {
|
|
881
|
+
this._value = e;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function tt(n, e, t = u.ofCaller()) {
|
|
885
|
+
let s;
|
|
886
|
+
return typeof n == "string" ? s = new l(void 0, n, void 0) : s = new l(n, void 0, void 0), new Re(s, e, _, t);
|
|
887
|
+
}
|
|
888
|
+
class Re extends q {
|
|
889
|
+
_setValue(e) {
|
|
890
|
+
this._value !== e && (this._value && this._value.dispose(), this._value = e);
|
|
891
|
+
}
|
|
892
|
+
dispose() {
|
|
893
|
+
this._value?.dispose();
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function I(...n) {
|
|
897
|
+
let e, t, s, r;
|
|
898
|
+
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());
|
|
899
|
+
}
|
|
900
|
+
function nt(n, e, t, s = u.ofCaller()) {
|
|
901
|
+
return new p(new l(n.owner, n.debugName, n.debugReferenceFn ?? t), e, t, () => p.globalTransaction, n.equalsFn ?? _, s);
|
|
902
|
+
}
|
|
903
|
+
class p extends R {
|
|
904
|
+
constructor(e, t, s, r, i, a) {
|
|
905
|
+
super(a), this._debugNameData = e, this.event = t, this._getValue = s, this._getTransaction = r, this._equalityComparator = i, this._hasValue = !1, this.handleEvent = (d) => {
|
|
906
|
+
const h = this._getValue(d), $ = this._value, E = !this._hasValue || !this._equalityComparator($, h);
|
|
907
|
+
let M = !1;
|
|
908
|
+
E && (this._value = h, this._hasValue && (M = !0, De(this._getTransaction(), (w) => {
|
|
909
|
+
o()?.handleObservableUpdated(this, { oldValue: $, newValue: h, change: void 0, didChange: E, hadValue: this._hasValue });
|
|
910
|
+
for (const H of this._observers)
|
|
911
|
+
w.updateObserver(H, this), H.handleChange(this, void 0);
|
|
912
|
+
}, () => {
|
|
913
|
+
const w = this.getDebugName();
|
|
914
|
+
return "Event fired" + (w ? `: ${w}` : "");
|
|
915
|
+
})), this._hasValue = !0), M || o()?.handleObservableUpdated(this, { oldValue: $, newValue: h, change: void 0, didChange: E, hadValue: this._hasValue });
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
getDebugName() {
|
|
919
|
+
return this._debugNameData.getDebugName(this);
|
|
920
|
+
}
|
|
921
|
+
get debugName() {
|
|
922
|
+
const e = this.getDebugName();
|
|
923
|
+
return "From Event" + (e ? `: ${e}` : "");
|
|
924
|
+
}
|
|
925
|
+
onFirstObserverAdded() {
|
|
926
|
+
this._subscription = this.event(this.handleEvent);
|
|
927
|
+
}
|
|
928
|
+
onLastObserverRemoved() {
|
|
929
|
+
this._subscription.dispose(), this._subscription = void 0, this._hasValue = !1, this._value = void 0;
|
|
930
|
+
}
|
|
931
|
+
get() {
|
|
932
|
+
return this._subscription ? (this._hasValue || this.handleEvent(void 0), this._value) : this._getValue(void 0);
|
|
933
|
+
}
|
|
934
|
+
debugSetValue(e) {
|
|
935
|
+
this._value = e;
|
|
936
|
+
}
|
|
937
|
+
debugGetState() {
|
|
938
|
+
return { value: this._value, hasValue: this._hasValue };
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
(function(n) {
|
|
942
|
+
n.Observer = p;
|
|
943
|
+
function e(t, s) {
|
|
944
|
+
let r = !1;
|
|
945
|
+
p.globalTransaction === void 0 && (p.globalTransaction = t, r = !0);
|
|
946
|
+
try {
|
|
947
|
+
s();
|
|
948
|
+
} finally {
|
|
949
|
+
r && (p.globalTransaction = void 0);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
n.batchEventsGlobally = e;
|
|
953
|
+
})(I || (I = {}));
|
|
954
|
+
function Ne(n, e = u.ofCaller()) {
|
|
955
|
+
return typeof n == "string" ? new X(n, void 0, e) : new X(void 0, n, e);
|
|
956
|
+
}
|
|
957
|
+
class X extends R {
|
|
958
|
+
get debugName() {
|
|
959
|
+
return new l(this._owner, this._debugName, void 0).getDebugName(this) ?? "Observable Signal";
|
|
960
|
+
}
|
|
961
|
+
toString() {
|
|
962
|
+
return this.debugName;
|
|
963
|
+
}
|
|
964
|
+
constructor(e, t, s) {
|
|
965
|
+
super(s), this._debugName = e, this._owner = t;
|
|
966
|
+
}
|
|
967
|
+
trigger(e, t) {
|
|
968
|
+
if (!e) {
|
|
969
|
+
A((s) => {
|
|
970
|
+
this.trigger(s, t);
|
|
971
|
+
}, () => `Trigger signal ${this.debugName}`);
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
for (const s of this._observers)
|
|
975
|
+
e.updateObserver(s, this), s.handleChange(this, t);
|
|
976
|
+
}
|
|
977
|
+
get() {
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
function st(n) {
|
|
981
|
+
const e = z("promiseValue", {});
|
|
982
|
+
return n.then((t) => {
|
|
983
|
+
e.set({ value: t }, void 0);
|
|
984
|
+
}), e;
|
|
985
|
+
}
|
|
986
|
+
function rt(n, e) {
|
|
987
|
+
return V({
|
|
988
|
+
owner: n,
|
|
989
|
+
equalsFn: () => !1
|
|
990
|
+
}, (t) => {
|
|
991
|
+
e.read(t);
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function it(n, e, t) {
|
|
995
|
+
const s = z("debounced", void 0);
|
|
996
|
+
let r;
|
|
997
|
+
return t.add(L((i) => {
|
|
998
|
+
const a = n.read(i);
|
|
999
|
+
r && clearTimeout(r), r = setTimeout(() => {
|
|
1000
|
+
A((d) => {
|
|
1001
|
+
s.set(a, d);
|
|
1002
|
+
});
|
|
1003
|
+
}, e);
|
|
1004
|
+
})), s;
|
|
1005
|
+
}
|
|
1006
|
+
function at(n, e) {
|
|
1007
|
+
let t = !1, s, r;
|
|
1008
|
+
return I((i) => {
|
|
1009
|
+
const a = L((d) => {
|
|
1010
|
+
const h = n.read(d);
|
|
1011
|
+
t ? (r && clearTimeout(r), r = setTimeout(() => {
|
|
1012
|
+
s = h, i();
|
|
1013
|
+
}, e)) : (t = !0, s = h);
|
|
1014
|
+
});
|
|
1015
|
+
return {
|
|
1016
|
+
dispose() {
|
|
1017
|
+
a.dispose(), t = !1, s = void 0;
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
}, () => t ? s : n.get());
|
|
1021
|
+
}
|
|
1022
|
+
function dt(n, e, t) {
|
|
1023
|
+
const s = z("triggeredRecently", !1);
|
|
1024
|
+
let r;
|
|
1025
|
+
return t.add(n(() => {
|
|
1026
|
+
s.set(!0, void 0), r && clearTimeout(r), r = setTimeout(() => {
|
|
1027
|
+
s.set(!1, void 0);
|
|
1028
|
+
}, e);
|
|
1029
|
+
})), s;
|
|
1030
|
+
}
|
|
1031
|
+
function Ve(n) {
|
|
1032
|
+
const e = new re(!1, void 0);
|
|
1033
|
+
return n.addObserver(e), N(() => {
|
|
1034
|
+
n.removeObserver(e);
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
be(Ve);
|
|
1038
|
+
function ke(n, e) {
|
|
1039
|
+
const t = new re(!0, e);
|
|
1040
|
+
n.addObserver(t);
|
|
1041
|
+
try {
|
|
1042
|
+
t.beginUpdate(n);
|
|
1043
|
+
} finally {
|
|
1044
|
+
t.endUpdate(n);
|
|
1045
|
+
}
|
|
1046
|
+
return N(() => {
|
|
1047
|
+
n.removeObserver(t);
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
_e(ke);
|
|
1051
|
+
class re {
|
|
1052
|
+
constructor(e, t) {
|
|
1053
|
+
this._forceRecompute = e, this._handleValue = t, this._counter = 0;
|
|
1054
|
+
}
|
|
1055
|
+
beginUpdate(e) {
|
|
1056
|
+
this._counter++;
|
|
1057
|
+
}
|
|
1058
|
+
endUpdate(e) {
|
|
1059
|
+
this._counter === 1 && this._forceRecompute && (this._handleValue ? this._handleValue(e.get()) : e.reportChanges()), this._counter--;
|
|
1060
|
+
}
|
|
1061
|
+
handlePossibleChange(e) {
|
|
1062
|
+
}
|
|
1063
|
+
handleChange(e, t) {
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function ot(n, e) {
|
|
1067
|
+
let t;
|
|
1068
|
+
return V({ owner: n, debugReferenceFn: e }, (r) => (t = e(r, t), t));
|
|
1069
|
+
}
|
|
1070
|
+
function ut(n, e) {
|
|
1071
|
+
let t;
|
|
1072
|
+
const s = Ne("derivedObservableWithWritableCache"), r = Oe(n, (i) => (s.read(i), t = e(i, t), t));
|
|
1073
|
+
return Object.assign(r, {
|
|
1074
|
+
clearCache: (i) => {
|
|
1075
|
+
t = void 0, s.trigger(i);
|
|
1076
|
+
},
|
|
1077
|
+
setCache: (i, a) => {
|
|
1078
|
+
t = i, s.trigger(a);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
function ht(n, e, t, s) {
|
|
1083
|
+
let r = new Y(t, s);
|
|
1084
|
+
return V({
|
|
1085
|
+
debugReferenceFn: t,
|
|
1086
|
+
owner: n,
|
|
1087
|
+
onLastObserverRemoved: () => {
|
|
1088
|
+
r.dispose(), r = new Y(t);
|
|
1089
|
+
}
|
|
1090
|
+
}, (a) => (r.setItems(e.read(a)), r.getItems()));
|
|
1091
|
+
}
|
|
1092
|
+
class Y {
|
|
1093
|
+
constructor(e, t) {
|
|
1094
|
+
this._map = e, this._keySelector = t, this._cache = /* @__PURE__ */ new Map(), this._items = [];
|
|
1095
|
+
}
|
|
1096
|
+
dispose() {
|
|
1097
|
+
this._cache.forEach((e) => e.store.dispose()), this._cache.clear();
|
|
1098
|
+
}
|
|
1099
|
+
setItems(e) {
|
|
1100
|
+
const t = [], s = new Set(this._cache.keys());
|
|
1101
|
+
for (const r of e) {
|
|
1102
|
+
const i = this._keySelector ? this._keySelector(r) : r;
|
|
1103
|
+
let a = this._cache.get(i);
|
|
1104
|
+
if (a)
|
|
1105
|
+
s.delete(i);
|
|
1106
|
+
else {
|
|
1107
|
+
const d = new f();
|
|
1108
|
+
a = { out: this._map(r, d), store: d }, this._cache.set(i, a);
|
|
1109
|
+
}
|
|
1110
|
+
t.push(a.out);
|
|
1111
|
+
}
|
|
1112
|
+
for (const r of s)
|
|
1113
|
+
this._cache.get(r).store.dispose(), this._cache.delete(r);
|
|
1114
|
+
this._items = t;
|
|
1115
|
+
}
|
|
1116
|
+
getItems() {
|
|
1117
|
+
return this._items;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
let T;
|
|
1121
|
+
function Ae(n) {
|
|
1122
|
+
T || (T = new Ue(), ae(T)), T.addFilteredObj(n);
|
|
1123
|
+
}
|
|
1124
|
+
class Ue {
|
|
1125
|
+
constructor() {
|
|
1126
|
+
this.indentation = 0, this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
|
|
1127
|
+
}
|
|
1128
|
+
addFilteredObj(e) {
|
|
1129
|
+
this._filteredObjects || (this._filteredObjects = /* @__PURE__ */ new Set()), this._filteredObjects.add(e);
|
|
1130
|
+
}
|
|
1131
|
+
_isIncluded(e) {
|
|
1132
|
+
return this._filteredObjects?.has(e) ?? !0;
|
|
1133
|
+
}
|
|
1134
|
+
textToConsoleArgs(e) {
|
|
1135
|
+
return $e([
|
|
1136
|
+
C(xe("| ", this.indentation)),
|
|
1137
|
+
e
|
|
1138
|
+
]);
|
|
1139
|
+
}
|
|
1140
|
+
formatInfo(e) {
|
|
1141
|
+
return e.hadValue ? e.didChange ? [
|
|
1142
|
+
C(" "),
|
|
1143
|
+
c(O(e.oldValue, 70), {
|
|
1144
|
+
color: "red",
|
|
1145
|
+
strikeThrough: !0
|
|
1146
|
+
}),
|
|
1147
|
+
C(" "),
|
|
1148
|
+
c(O(e.newValue, 60), {
|
|
1149
|
+
color: "green"
|
|
1150
|
+
})
|
|
1151
|
+
] : [C(" (unchanged)")] : [
|
|
1152
|
+
C(" "),
|
|
1153
|
+
c(O(e.newValue, 60), {
|
|
1154
|
+
color: "green"
|
|
1155
|
+
}),
|
|
1156
|
+
C(" (initial)")
|
|
1157
|
+
];
|
|
1158
|
+
}
|
|
1159
|
+
handleObservableCreated(e) {
|
|
1160
|
+
if (e instanceof b) {
|
|
1161
|
+
const t = e;
|
|
1162
|
+
this.changedObservablesSets.set(t, /* @__PURE__ */ new Set());
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
handleOnListenerCountChanged(e, t) {
|
|
1166
|
+
}
|
|
1167
|
+
handleObservableUpdated(e, t) {
|
|
1168
|
+
if (this._isIncluded(e)) {
|
|
1169
|
+
if (e instanceof b) {
|
|
1170
|
+
this._handleDerivedRecomputed(e, t);
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
console.log(...this.textToConsoleArgs([
|
|
1174
|
+
y("observable value changed"),
|
|
1175
|
+
c(e.debugName, { color: "BlueViolet" }),
|
|
1176
|
+
...this.formatInfo(t)
|
|
1177
|
+
]));
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
formatChanges(e) {
|
|
1181
|
+
if (e.size !== 0)
|
|
1182
|
+
return c(" (changed deps: " + [...e].map((t) => t.debugName).join(", ") + ")", { color: "gray" });
|
|
1183
|
+
}
|
|
1184
|
+
handleDerivedDependencyChanged(e, t, s) {
|
|
1185
|
+
this._isIncluded(e) && this.changedObservablesSets.get(e)?.add(t);
|
|
1186
|
+
}
|
|
1187
|
+
_handleDerivedRecomputed(e, t) {
|
|
1188
|
+
if (!this._isIncluded(e))
|
|
1189
|
+
return;
|
|
1190
|
+
const s = this.changedObservablesSets.get(e);
|
|
1191
|
+
s && (console.log(...this.textToConsoleArgs([
|
|
1192
|
+
y("derived recomputed"),
|
|
1193
|
+
c(e.debugName, { color: "BlueViolet" }),
|
|
1194
|
+
...this.formatInfo(t),
|
|
1195
|
+
this.formatChanges(s),
|
|
1196
|
+
{ data: [{ fn: e._debugNameData.referenceFn ?? e._computeFn }] }
|
|
1197
|
+
])), s.clear());
|
|
1198
|
+
}
|
|
1199
|
+
handleDerivedCleared(e) {
|
|
1200
|
+
this._isIncluded(e) && console.log(...this.textToConsoleArgs([
|
|
1201
|
+
y("derived cleared"),
|
|
1202
|
+
c(e.debugName, { color: "BlueViolet" })
|
|
1203
|
+
]));
|
|
1204
|
+
}
|
|
1205
|
+
handleFromEventObservableTriggered(e, t) {
|
|
1206
|
+
this._isIncluded(e) && console.log(...this.textToConsoleArgs([
|
|
1207
|
+
y("observable from event triggered"),
|
|
1208
|
+
c(e.debugName, { color: "BlueViolet" }),
|
|
1209
|
+
...this.formatInfo(t),
|
|
1210
|
+
{ data: [{ fn: e._getValue }] }
|
|
1211
|
+
]));
|
|
1212
|
+
}
|
|
1213
|
+
handleAutorunCreated(e) {
|
|
1214
|
+
this._isIncluded(e) && this.changedObservablesSets.set(e, /* @__PURE__ */ new Set());
|
|
1215
|
+
}
|
|
1216
|
+
handleAutorunDisposed(e) {
|
|
1217
|
+
}
|
|
1218
|
+
handleAutorunDependencyChanged(e, t, s) {
|
|
1219
|
+
this._isIncluded(e) && this.changedObservablesSets.get(e).add(t);
|
|
1220
|
+
}
|
|
1221
|
+
handleAutorunStarted(e) {
|
|
1222
|
+
const t = this.changedObservablesSets.get(e);
|
|
1223
|
+
t && (this._isIncluded(e) && console.log(...this.textToConsoleArgs([
|
|
1224
|
+
y("autorun"),
|
|
1225
|
+
c(e.debugName, { color: "BlueViolet" }),
|
|
1226
|
+
this.formatChanges(t),
|
|
1227
|
+
{ data: [{ fn: e._debugNameData.referenceFn ?? e._runFn }] }
|
|
1228
|
+
])), t.clear(), this.indentation++);
|
|
1229
|
+
}
|
|
1230
|
+
handleAutorunFinished(e) {
|
|
1231
|
+
this.indentation--;
|
|
1232
|
+
}
|
|
1233
|
+
handleBeginTransaction(e) {
|
|
1234
|
+
let t = e.getDebugName();
|
|
1235
|
+
t === void 0 && (t = ""), this._isIncluded(e) && console.log(...this.textToConsoleArgs([
|
|
1236
|
+
y("transaction"),
|
|
1237
|
+
c(t, { color: "BlueViolet" }),
|
|
1238
|
+
{ data: [{ fn: e._fn }] }
|
|
1239
|
+
])), this.indentation++;
|
|
1240
|
+
}
|
|
1241
|
+
handleEndTransaction() {
|
|
1242
|
+
this.indentation--;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
function $e(n) {
|
|
1246
|
+
const e = new Array(), t = [];
|
|
1247
|
+
let s = "";
|
|
1248
|
+
function r(a) {
|
|
1249
|
+
if ("length" in a)
|
|
1250
|
+
for (const d of a)
|
|
1251
|
+
d && r(d);
|
|
1252
|
+
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);
|
|
1253
|
+
}
|
|
1254
|
+
r(n);
|
|
1255
|
+
const i = [s, ...e];
|
|
1256
|
+
return i.push(...t), i;
|
|
1257
|
+
}
|
|
1258
|
+
function C(n) {
|
|
1259
|
+
return c(n, { color: "black" });
|
|
1260
|
+
}
|
|
1261
|
+
function y(n) {
|
|
1262
|
+
return c(Ie(`${n}: `, 10), { color: "black", bold: !0 });
|
|
1263
|
+
}
|
|
1264
|
+
function c(n, e = {
|
|
1265
|
+
color: "black"
|
|
1266
|
+
}) {
|
|
1267
|
+
function t(r) {
|
|
1268
|
+
return Object.entries(r).reduce((i, [a, d]) => `${i}${a}:${d};`, "");
|
|
1269
|
+
}
|
|
1270
|
+
const s = {
|
|
1271
|
+
color: e.color
|
|
1272
|
+
};
|
|
1273
|
+
return e.strikeThrough && (s["text-decoration"] = "line-through"), e.bold && (s["font-weight"] = "bold"), {
|
|
1274
|
+
text: n,
|
|
1275
|
+
style: t(s)
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
function O(n, e) {
|
|
1279
|
+
try {
|
|
1280
|
+
return Ee(n, e);
|
|
1281
|
+
} catch {
|
|
1282
|
+
return "[[???]]";
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
function Ee(n, e) {
|
|
1286
|
+
switch (typeof n) {
|
|
1287
|
+
case "number":
|
|
1288
|
+
return "" + n;
|
|
1289
|
+
case "string":
|
|
1290
|
+
return n.length + 2 <= e ? `"${n}"` : `"${n.substr(0, e - 7)}"+...`;
|
|
1291
|
+
case "boolean":
|
|
1292
|
+
return n ? "true" : "false";
|
|
1293
|
+
case "undefined":
|
|
1294
|
+
return "undefined";
|
|
1295
|
+
case "object":
|
|
1296
|
+
return n === null ? "null" : Array.isArray(n) ? Fe(n, e) : Be(n, e);
|
|
1297
|
+
case "symbol":
|
|
1298
|
+
return n.toString();
|
|
1299
|
+
case "function":
|
|
1300
|
+
return `[[Function${n.name ? " " + n.name : ""}]]`;
|
|
1301
|
+
default:
|
|
1302
|
+
return "" + n;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function Fe(n, e) {
|
|
1306
|
+
let t = "[ ", s = !0;
|
|
1307
|
+
for (const r of n) {
|
|
1308
|
+
if (s || (t += ", "), t.length - 5 > e) {
|
|
1309
|
+
t += "...";
|
|
1310
|
+
break;
|
|
1311
|
+
}
|
|
1312
|
+
s = !1, t += `${O(r, e - t.length)}`;
|
|
1313
|
+
}
|
|
1314
|
+
return t += " ]", t;
|
|
1315
|
+
}
|
|
1316
|
+
function Be(n, e) {
|
|
1317
|
+
try {
|
|
1318
|
+
if (typeof n.toString == "function" && n.toString !== Object.prototype.toString) {
|
|
1319
|
+
const a = n.toString();
|
|
1320
|
+
return a.length <= e ? a : a.substring(0, e - 3) + "...";
|
|
1321
|
+
}
|
|
1322
|
+
} catch {
|
|
1323
|
+
return "[[Object]]";
|
|
1324
|
+
}
|
|
1325
|
+
const t = ee(n);
|
|
1326
|
+
let s = t ? t + "(" : "{ ", r = !0, i;
|
|
1327
|
+
try {
|
|
1328
|
+
i = Object.entries(n);
|
|
1329
|
+
} catch {
|
|
1330
|
+
return t ? `${t}(...)` : "[[Object]]";
|
|
1331
|
+
}
|
|
1332
|
+
for (const [a, d] of i) {
|
|
1333
|
+
if (r || (s += ", "), s.length - 5 > e) {
|
|
1334
|
+
s += "...";
|
|
1335
|
+
break;
|
|
1336
|
+
}
|
|
1337
|
+
r = !1, s += `${a}: ${O(d, e - s.length)}`;
|
|
1338
|
+
}
|
|
1339
|
+
return s += t ? ")" : " }", s;
|
|
1340
|
+
}
|
|
1341
|
+
function xe(n, e) {
|
|
1342
|
+
let t = "";
|
|
1343
|
+
for (let s = 1; s <= e; s++)
|
|
1344
|
+
t += n;
|
|
1345
|
+
return t;
|
|
1346
|
+
}
|
|
1347
|
+
function Ie(n, e) {
|
|
1348
|
+
for (; n.length < e; )
|
|
1349
|
+
n += " ";
|
|
1350
|
+
return n;
|
|
1351
|
+
}
|
|
1352
|
+
function je(n, e) {
|
|
1353
|
+
const t = e?.debugNamePostProcessor ?? ((i) => i), s = g.from(n, t);
|
|
1354
|
+
return s ? ie(s, 0, /* @__PURE__ */ new Set()).trim() : "";
|
|
1355
|
+
}
|
|
1356
|
+
function ie(n, e, t) {
|
|
1357
|
+
const s = " ".repeat(e), r = [];
|
|
1358
|
+
if (t.has(n.sourceObj))
|
|
1359
|
+
return r.push(`${s}* ${n.type} ${n.name} (already listed)`), r.join(`
|
|
1360
|
+
`);
|
|
1361
|
+
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) {
|
|
1362
|
+
r.push(`${s} dependencies:`);
|
|
1363
|
+
for (const a of n.dependencies)
|
|
1364
|
+
r.push(ie(a, e + 1, t));
|
|
1365
|
+
}
|
|
1366
|
+
return r.join(`
|
|
1367
|
+
`);
|
|
1368
|
+
}
|
|
1369
|
+
class g {
|
|
1370
|
+
static from(e, t) {
|
|
1371
|
+
if (e instanceof k) {
|
|
1372
|
+
const s = e.debugGetState();
|
|
1373
|
+
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)));
|
|
1374
|
+
} else if (e instanceof b) {
|
|
1375
|
+
const s = e.debugGetState();
|
|
1376
|
+
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)));
|
|
1377
|
+
} else if (e instanceof q) {
|
|
1378
|
+
const s = e.debugGetState();
|
|
1379
|
+
return new g(e, t(e.debugName), "observableValue", s.value, "upToDate", []);
|
|
1380
|
+
} else if (e instanceof p) {
|
|
1381
|
+
const s = e.debugGetState();
|
|
1382
|
+
return new g(e, t(e.debugName), "fromEvent", s.value, s.hasValue ? "upToDate" : "initial", []);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
static unknown(e) {
|
|
1386
|
+
return new g(e, "(unknown)", "unknown", void 0, "unknown", []);
|
|
1387
|
+
}
|
|
1388
|
+
constructor(e, t, s, r, i, a) {
|
|
1389
|
+
this.sourceObj = e, this.name = t, this.type = s, this.value = r, this.state = i, this.dependencies = a;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
pe(je);
|
|
1393
|
+
de(Ae);
|
|
1394
|
+
class lt extends Error {
|
|
1395
|
+
constructor(e = "Operation was cancelled") {
|
|
1396
|
+
super(e), this.name = "CancellationError";
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
class Ge {
|
|
1400
|
+
constructor() {
|
|
1401
|
+
this._isCancelled = !1, this._listeners = /* @__PURE__ */ new Set();
|
|
1402
|
+
}
|
|
1403
|
+
get token() {
|
|
1404
|
+
return {
|
|
1405
|
+
isCancellationRequested: this._isCancelled,
|
|
1406
|
+
onCancellationRequested: (e) => (this._listeners.add(e), this._isCancelled && e(), {
|
|
1407
|
+
dispose: () => {
|
|
1408
|
+
this._listeners.delete(e);
|
|
1409
|
+
}
|
|
1410
|
+
})
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
cancel() {
|
|
1414
|
+
if (!this._isCancelled) {
|
|
1415
|
+
this._isCancelled = !0;
|
|
1416
|
+
for (const e of this._listeners)
|
|
1417
|
+
e();
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
dispose() {
|
|
1421
|
+
this.cancel(), this._listeners.clear();
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function Le(n) {
|
|
1425
|
+
const e = new Ge();
|
|
1426
|
+
return n.add(e), e.token;
|
|
1427
|
+
}
|
|
1428
|
+
function We(n, e) {
|
|
1429
|
+
let t, s = !0;
|
|
1430
|
+
return Te({
|
|
1431
|
+
changeTracker: {
|
|
1432
|
+
createChangeSummary: () => ({ deltas: [], didChange: !1 }),
|
|
1433
|
+
handleChange: (r, i) => {
|
|
1434
|
+
if (r.didChange(n)) {
|
|
1435
|
+
const a = r.change;
|
|
1436
|
+
a !== void 0 && i.deltas.push(a), i.didChange = !0;
|
|
1437
|
+
}
|
|
1438
|
+
return !0;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}, (r, i) => {
|
|
1442
|
+
const a = n.read(r), d = t;
|
|
1443
|
+
i.didChange && (t = a, e(a, d, i.deltas)), s && (s = !1, t = a);
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
function ze(n, e) {
|
|
1447
|
+
const t = new f(), s = We(n, (r, i, a) => {
|
|
1448
|
+
t.clear(), e(r, i, a, t);
|
|
1449
|
+
});
|
|
1450
|
+
return {
|
|
1451
|
+
dispose() {
|
|
1452
|
+
s.dispose(), t.dispose();
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
function ct(n, e) {
|
|
1457
|
+
return ze(n, (t, s, r, i) => {
|
|
1458
|
+
e(t, s, r, Le(i));
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
export {
|
|
1462
|
+
at as A,
|
|
1463
|
+
R as B,
|
|
1464
|
+
lt as C,
|
|
1465
|
+
qe as D,
|
|
1466
|
+
it as E,
|
|
1467
|
+
Pe as F,
|
|
1468
|
+
He as G,
|
|
1469
|
+
ut as H,
|
|
1470
|
+
V as I,
|
|
1471
|
+
Me as J,
|
|
1472
|
+
Ke as K,
|
|
1473
|
+
tt as L,
|
|
1474
|
+
Ye as M,
|
|
1475
|
+
ht as N,
|
|
1476
|
+
q as O,
|
|
1477
|
+
nt as P,
|
|
1478
|
+
st as Q,
|
|
1479
|
+
Ne as R,
|
|
1480
|
+
ke as S,
|
|
1481
|
+
U as T,
|
|
1482
|
+
ct as U,
|
|
1483
|
+
ze as V,
|
|
1484
|
+
rt as W,
|
|
1485
|
+
De as X,
|
|
1486
|
+
dt as Y,
|
|
1487
|
+
L as a,
|
|
1488
|
+
l as b,
|
|
1489
|
+
u as c,
|
|
1490
|
+
Oe as d,
|
|
1491
|
+
b as e,
|
|
1492
|
+
Ge as f,
|
|
1493
|
+
o as g,
|
|
1494
|
+
v as h,
|
|
1495
|
+
me as i,
|
|
1496
|
+
I as j,
|
|
1497
|
+
ot as k,
|
|
1498
|
+
f as l,
|
|
1499
|
+
W as m,
|
|
1500
|
+
he as n,
|
|
1501
|
+
z as o,
|
|
1502
|
+
Ve as p,
|
|
1503
|
+
et as q,
|
|
1504
|
+
We as r,
|
|
1505
|
+
_ as s,
|
|
1506
|
+
A as t,
|
|
1507
|
+
Je as u,
|
|
1508
|
+
Se as v,
|
|
1509
|
+
Qe as w,
|
|
1510
|
+
Xe as x,
|
|
1511
|
+
Ze as y,
|
|
1512
|
+
Te as z
|
|
1513
|
+
};
|
|
1514
|
+
//# sourceMappingURL=runOnChange-owE1SMC0.js.map
|