@vscode/markdown-editor 0.0.2-16 → 0.0.2-17
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/_observables/observableInternal/index.d.ts +1 -1
- package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +1 -1
- package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +1 -1
- package/dist/_observables/observableInternal/logging/logging.d.ts +1 -1
- package/dist/_observables/observableInternal/reactions/{autorun.d.ts → createEffect.d.ts} +11 -3
- package/dist/index.js +1 -1
- package/dist/observables.js +45 -43
- package/dist/observables.js.map +1 -1
- package/dist/{runOnChange-C00UIwqQ.js → runOnChange-CkxK2gSn.js} +111 -107
- package/dist/runOnChange-CkxK2gSn.js.map +1 -0
- package/package.json +1 -1
- package/dist/runOnChange-C00UIwqQ.js.map +0 -1
- /package/dist/_observables/observableInternal/reactions/{autorunImpl.d.ts → createEffectImpl.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { observableValueOpts } from './observables/observableValueOpts';
|
|
2
|
-
export { autorun, autorunDelta, autorunHandleChanges, autorunOpts, autorunWithStore, autorunWithStoreHandleChanges, autorunIterableDelta, autorunSelfDisposable } from './reactions/
|
|
2
|
+
export { createEffect, createEffectOpts, autorun, autorunDelta, autorunHandleChanges, autorunOpts, autorunWithStore, autorunWithStoreHandleChanges, autorunIterableDelta, autorunSelfDisposable } from './reactions/createEffect';
|
|
3
3
|
export { type IObservable, type IObservableWithChange, type IObserver, type IReader, type ISettable, type ISettableObservable, type ITransaction } from './base';
|
|
4
4
|
export { disposableObservableValue } from './observables/observableValue';
|
|
5
5
|
export { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore } from './observables/derived';
|
|
@@ -3,7 +3,7 @@ import { TransactionImpl } from '../transaction';
|
|
|
3
3
|
import { IObservableLogger, IChangeInformation } from './logging';
|
|
4
4
|
import { FromEventObservable } from '../observables/observableFromEvent';
|
|
5
5
|
import { Derived } from '../observables/derivedImpl';
|
|
6
|
-
import { AutorunObserver } from '../reactions/
|
|
6
|
+
import { AutorunObserver } from '../reactions/createEffectImpl';
|
|
7
7
|
export declare function logObservableToConsole(obs: IObservable<any>): void;
|
|
8
8
|
export declare class ConsoleObservableLogger implements IObservableLogger {
|
|
9
9
|
private indentation;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutorunObserver } from '../../reactions/
|
|
1
|
+
import { AutorunObserver } from '../../reactions/createEffectImpl';
|
|
2
2
|
import { TransactionImpl } from '../../transaction';
|
|
3
3
|
import { IChangeInformation, IObservableLogger } from '../logging';
|
|
4
4
|
import { IObservable } from '../../base';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutorunObserver } from '../reactions/
|
|
1
|
+
import { AutorunObserver } from '../reactions/createEffectImpl';
|
|
2
2
|
import { IObservable } from '../base';
|
|
3
3
|
import { TransactionImpl } from '../transaction';
|
|
4
4
|
import type { Derived } from '../observables/derivedImpl';
|
|
@@ -5,14 +5,22 @@ import { IDebugNameData } from '../debugName';
|
|
|
5
5
|
import { DebugLocation } from '../debugLocation';
|
|
6
6
|
/**
|
|
7
7
|
* Runs immediately and whenever a transaction ends and an observed observable changed.
|
|
8
|
-
* {@link fn} should start with a JS Doc using `@description` to name the
|
|
8
|
+
* {@link fn} should start with a JS Doc using `@description` to name the effect.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createEffect(fn: (reader: IReaderWithStore) => void, debugLocation?: DebugLocation): IDisposable;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use {@link createEffect} instead.
|
|
9
13
|
*/
|
|
10
|
-
export declare
|
|
14
|
+
export declare const autorun: typeof createEffect;
|
|
11
15
|
/**
|
|
12
16
|
* Runs immediately and whenever a transaction ends and an observed observable changed.
|
|
13
17
|
* {@link fn} should start with a JS Doc using `@description` to name the autorun.
|
|
14
18
|
*/
|
|
15
|
-
export declare function
|
|
19
|
+
export declare function createEffectOpts(options: IDebugNameData & {}, fn: (reader: IReaderWithStore) => void, debugLocation?: DebugLocation): IDisposable;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use {@link createEffectOpts} instead.
|
|
22
|
+
*/
|
|
23
|
+
export declare const autorunOpts: typeof createEffectOpts;
|
|
16
24
|
/**
|
|
17
25
|
* Runs immediately and whenever a transaction ends and an observed observable changed.
|
|
18
26
|
* {@link fn} should start with a JS Doc using `@description` to name the autorun.
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { math as Xn } from "micromark-extension-math";
|
|
|
3
3
|
import { gfmTable as Qn } from "micromark-extension-gfm-table";
|
|
4
4
|
import { gfmTaskListItem as Yn } from "micromark-extension-gfm-task-list-item";
|
|
5
5
|
import { gfmStrikethrough as Jn } from "micromark-extension-gfm-strikethrough";
|
|
6
|
-
import { o as N, d as $, D as W, t as Zn, r as es, a as P, c as ts } from "./runOnChange-
|
|
6
|
+
import { o as N, d as $, D as W, t as Zn, r as es, a as P, c as ts } from "./runOnChange-CkxK2gSn.js";
|
|
7
7
|
import { createDiffComputer as ns } from "@vscode/diff";
|
|
8
8
|
import an from "katex";
|
|
9
9
|
class _ {
|
package/dist/observables.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { D as re,
|
|
3
|
-
class L extends
|
|
1
|
+
import { B as w, T as F, g as C, b as u, s as c, O as T, e as v, o as V, d as _, t as g, f as k, h as S, C as y, i as z, j as f, k as D, l as W, m as N, n as P, p as R, q } from "./runOnChange-CkxK2gSn.js";
|
|
2
|
+
import { D as re, u as ne, a as ie, v as de, w as oe, x as ue, y as he, z as le, A as fe, E as be, c as ce, F as ge, G as ve, H as _e, I as pe, J as me, K as Ce, L as ye, M as Oe, N as we, P as Ve, Q as Se, R as De, S as Ue, U as Ee, V as Fe, r as Te, W as ke, X as ze, Y as We, Z as Ne, _ as Pe } from "./runOnChange-CkxK2gSn.js";
|
|
3
|
+
class L extends w {
|
|
4
4
|
get debugName() {
|
|
5
5
|
return this._debugNameData.getDebugName(this) ?? "LazyObservableValue";
|
|
6
6
|
}
|
|
@@ -50,7 +50,7 @@ class L extends O {
|
|
|
50
50
|
if (s === void 0 && this._equalityComparator(this._value, e))
|
|
51
51
|
return;
|
|
52
52
|
let r;
|
|
53
|
-
t || (t = r = new
|
|
53
|
+
t || (t = r = new F(() => {
|
|
54
54
|
}, () => `Setting ${this.debugName}`));
|
|
55
55
|
try {
|
|
56
56
|
if (this._isUpToDate = !1, this._setValue(e), s !== void 0 && this._deltas.push(s), t.updateObserver({
|
|
@@ -75,7 +75,7 @@ class L extends O {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
function U(a, e, t = v.ofCaller()) {
|
|
78
|
-
return a.lazy ? new L(new u(a.owner, a.debugName, void 0), e, a.equalsFn ?? c, t) : new
|
|
78
|
+
return a.lazy ? new L(new u(a.owner, a.debugName, void 0), e, a.equalsFn ?? c, t) : new T(new u(a.owner, a.debugName, void 0), e, a.equalsFn ?? c, t);
|
|
79
79
|
}
|
|
80
80
|
class H {
|
|
81
81
|
/**
|
|
@@ -107,15 +107,15 @@ class p {
|
|
|
107
107
|
if (s)
|
|
108
108
|
return s.getDataOrThrow();
|
|
109
109
|
}), this.promise = e.then((t) => (g((s) => {
|
|
110
|
-
this._value.set(new
|
|
110
|
+
this._value.set(new O(t, void 0), s);
|
|
111
111
|
}), t), (t) => {
|
|
112
112
|
throw g((s) => {
|
|
113
|
-
this._value.set(new
|
|
113
|
+
this._value.set(new O(void 0, t), s);
|
|
114
114
|
}), t;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class O {
|
|
119
119
|
constructor(e, t) {
|
|
120
120
|
this.data = e, this.error = t;
|
|
121
121
|
}
|
|
@@ -144,8 +144,8 @@ function K(a, e, t, s) {
|
|
|
144
144
|
error: t ? t(o) : !1,
|
|
145
145
|
state: o
|
|
146
146
|
})), h = S((o) => {
|
|
147
|
-
const { isFinished:
|
|
148
|
-
(
|
|
147
|
+
const { isFinished: E, error: l, state: m } = b.read(o);
|
|
148
|
+
(E || l) && (i ? d = !0 : h.dispose(), l ? n(l === !0 ? m : l) : r(m));
|
|
149
149
|
});
|
|
150
150
|
if (s) {
|
|
151
151
|
const o = s.onCancellationRequested(() => {
|
|
@@ -209,7 +209,7 @@ function Q(a) {
|
|
|
209
209
|
function I(a, e, t = v.ofCaller()) {
|
|
210
210
|
return new A(typeof a == "string" ? a : new u(a, void 0, void 0), e, t);
|
|
211
211
|
}
|
|
212
|
-
class A extends
|
|
212
|
+
class A extends w {
|
|
213
213
|
constructor(e, t, s) {
|
|
214
214
|
super(s), this.event = t, this.handleEvent = () => {
|
|
215
215
|
g((r) => {
|
|
@@ -385,55 +385,57 @@ export {
|
|
|
385
385
|
te as ObservableMap,
|
|
386
386
|
p as ObservablePromise,
|
|
387
387
|
ee as ObservableSet,
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
O as PromiseResult,
|
|
389
|
+
F as TransactionImpl,
|
|
390
390
|
M as ValueWithChangeEventFromObservable,
|
|
391
391
|
ne as asyncTransaction,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
392
|
+
ie as autorun,
|
|
393
|
+
de as autorunDelta,
|
|
394
|
+
oe as autorunHandleChanges,
|
|
395
|
+
ue as autorunIterableDelta,
|
|
396
|
+
he as autorunOpts,
|
|
397
|
+
le as autorunSelfDisposable,
|
|
398
|
+
fe as autorunWithStore,
|
|
399
|
+
be as autorunWithStoreHandleChanges,
|
|
400
|
+
ce as constObservable,
|
|
401
|
+
S as createEffect,
|
|
402
|
+
P as createEffectOpts,
|
|
403
|
+
ge as debouncedObservable,
|
|
404
|
+
ve as debouncedObservableDeprecated,
|
|
403
405
|
j as deferUnobserve,
|
|
404
406
|
_ as derived,
|
|
405
407
|
Z as derivedConstOnceDefined,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
+
_e as derivedDisposable,
|
|
409
|
+
pe as derivedHandleChanges,
|
|
408
410
|
W as derivedObservableWithCache,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
+
me as derivedObservableWithWritableCache,
|
|
412
|
+
Ce as derivedOpts,
|
|
411
413
|
G as derivedWithCancellationToken,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
ye as derivedWithSetter,
|
|
415
|
+
Oe as derivedWithStore,
|
|
416
|
+
we as disposableObservableValue,
|
|
417
|
+
Ve as globalTransaction,
|
|
416
418
|
q as keepObserved,
|
|
417
419
|
Y as latestChangedValue,
|
|
418
|
-
|
|
420
|
+
Se as mapObservableArrayCached,
|
|
419
421
|
D as observableFromEvent,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
+
De as observableFromEventOpts,
|
|
423
|
+
Ue as observableFromPromise,
|
|
422
424
|
X as observableFromValueWithChangeEvent,
|
|
423
|
-
|
|
425
|
+
Ee as observableSignal,
|
|
424
426
|
I as observableSignalFromEvent,
|
|
425
427
|
V as observableValue,
|
|
426
428
|
U as observableValueOpts,
|
|
427
|
-
|
|
429
|
+
Fe as recomputeInitiallyAndOnChange,
|
|
428
430
|
J as recordChanges,
|
|
429
431
|
Q as recordChangesLazy,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
Te as runOnChange,
|
|
433
|
+
ke as runOnChangeWithCancellationToken,
|
|
434
|
+
ze as runOnChangeWithStore,
|
|
435
|
+
We as signalFromObservable,
|
|
436
|
+
Ne as subtransaction,
|
|
435
437
|
g as transaction,
|
|
436
438
|
K as waitForState,
|
|
437
|
-
|
|
439
|
+
Pe as wasEventTriggeredRecently
|
|
438
440
|
};
|
|
439
441
|
//# sourceMappingURL=observables.js.map
|
package/dist/observables.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observables.js","sources":["../../../../external/vscode-observables/observables/dist/observableInternal/observables/lazyObservableValue.js","../../../../external/vscode-observables/observables/dist/observableInternal/observables/observableValueOpts.js","../../../../external/vscode-observables/observables/dist/observableInternal/utils/promise.js","../../../../external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js","../../../../external/vscode-observables/observables/dist/observableInternal/changeTracker.js","../../../../external/vscode-observables/observables/dist/observableInternal/observables/observableSignalFromEvent.js","../../../../external/vscode-observables/observables/dist/observableInternal/utils/valueWithChangeEvent.js","../../../../external/vscode-observables/observables/dist/observableInternal/experimental/utils.js","../../../../external/vscode-observables/observables/dist/observableInternal/experimental/deferUnobserve.js","../../../../external/vscode-observables/observables/dist/observableInternal/set.js","../../../../external/vscode-observables/observables/dist/observableInternal/map.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Holds off updating observers until the value is actually read.\n*/\nclass LazyObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'LazyObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._isUpToDate = true;\n this._deltas = [];\n this._updateCounter = 0;\n this._value = initialValue;\n }\n get() {\n this._update();\n return this._value;\n }\n _update() {\n if (this._isUpToDate) {\n return;\n }\n this._isUpToDate = true;\n if (this._deltas.length > 0) {\n for (const change of this._deltas) {\n getLogger()?.handleObservableUpdated(this, { change, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, change);\n }\n }\n this._deltas.length = 0;\n }\n else {\n getLogger()?.handleObservableUpdated(this, { change: undefined, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, undefined);\n }\n }\n }\n _beginUpdate() {\n this._updateCounter++;\n if (this._updateCounter === 1) {\n for (const observer of this._observers) {\n observer.beginUpdate(this);\n }\n }\n }\n _endUpdate() {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n this._update();\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCounter > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n observer.beginUpdate(this);\n }\n }\n removeObserver(observer) {\n const shouldCallEndUpdate = this._observers.has(observer) && this._updateCounter > 0;\n super.removeObserver(observer);\n if (shouldCallEndUpdate) {\n // Calling end update after removing the observer makes sure endUpdate cannot be called twice here.\n observer.endUpdate(this);\n }\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n this._isUpToDate = false;\n this._setValue(value);\n if (change !== undefined) {\n this._deltas.push(change);\n }\n tx.updateObserver({\n beginUpdate: () => this._beginUpdate(),\n endUpdate: () => this._endUpdate(),\n handleChange: (observable, change) => { },\n handlePossibleChange: (observable) => { },\n }, this);\n if (this._updateCounter > 1) {\n // We already started begin/end update, so we need to manually call handlePossibleChange\n for (const observer of this._observers) {\n observer.handlePossibleChange(this);\n }\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n}\n\nexport { LazyObservableValue };\n//# sourceMappingURL=lazyObservableValue.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { ObservableValue } from './observableValue.js';\nimport { LazyObservableValue } from './lazyObservableValue.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValueOpts(options, initialValue, debugLocation = DebugLocation.ofCaller()) {\n if (options.lazy) {\n return new LazyObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n }\n return new ObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n}\n\nexport { observableValueOpts };\n//# sourceMappingURL=observableValueOpts.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { derived } from '../observables/derived.js';\nimport { observableValue } from '../observables/observableValue.js';\n\nclass ObservableLazy {\n /**\n * The cached value.\n * Does not force a computation of the value.\n */\n get cachedValue() { return this._value; }\n constructor(_computeValue) {\n this._computeValue = _computeValue;\n this._value = observableValue(this, undefined);\n }\n /**\n * Returns the cached value.\n * Computes the value if the value has not been cached yet.\n */\n getValue() {\n let v = this._value.get();\n if (!v) {\n v = this._computeValue();\n this._value.set(v, undefined);\n }\n return v;\n }\n}\n/**\n * A promise whose state is observable.\n */\nclass ObservablePromise {\n static fromFn(fn) {\n return new ObservablePromise(fn());\n }\n constructor(promise) {\n this._value = observableValue(this, undefined);\n /**\n * The current state of the promise.\n * Is `undefined` if the promise didn't resolve yet.\n */\n this.promiseResult = this._value;\n this.resolvedValue = derived(this, reader => {\n const result = this.promiseResult.read(reader);\n if (!result) {\n return undefined;\n }\n return result.getDataOrThrow();\n });\n this.promise = promise.then(value => {\n transaction(tx => {\n /** @description onPromiseResolved */\n this._value.set(new PromiseResult(value, undefined), tx);\n });\n return value;\n }, error => {\n transaction(tx => {\n /** @description onPromiseRejected */\n this._value.set(new PromiseResult(undefined, error), tx);\n });\n throw error;\n });\n }\n}\nclass PromiseResult {\n constructor(\n /**\n * The value of the resolved promise.\n * Undefined if the promise rejected.\n */\n data, \n /**\n * The error in case of a rejected promise.\n * Undefined if the promise resolved.\n */\n error) {\n this.data = data;\n this.error = error;\n }\n /**\n * Returns the value if the promise resolved, otherwise throws the error.\n */\n getDataOrThrow() {\n if (this.error) {\n throw this.error;\n }\n return this.data;\n }\n}\n/**\n * A lazy promise whose state is observable.\n */\nclass ObservableLazyPromise {\n constructor(_computePromise) {\n this._computePromise = _computePromise;\n this._lazyValue = new ObservableLazy(() => new ObservablePromise(this._computePromise()));\n /**\n * Does not enforce evaluation of the promise compute function.\n * Is undefined if the promise has not been computed yet.\n */\n this.cachedPromiseResult = derived(this, reader => this._lazyValue.cachedValue.read(reader)?.promiseResult.read(reader));\n }\n getPromise() {\n return this._lazyValue.getValue().promise;\n }\n}\n\nexport { ObservableLazy, ObservableLazyPromise, ObservablePromise, PromiseResult };\n//# sourceMappingURL=promise.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { CancellationError, CancellationTokenSource } from '../commonFacade/cancellation.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { autorun } from '../reactions/autorun.js';\nimport { Derived } from '../observables/derivedImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction waitForState(observable, predicate, isError, cancellationToken) {\n if (!predicate) {\n predicate = state => state !== null && state !== undefined;\n }\n return new Promise((resolve, reject) => {\n let isImmediateRun = true;\n let shouldDispose = false;\n const stateObs = observable.map(state => {\n /** @description waitForState.state */\n return {\n isFinished: predicate(state),\n error: isError ? isError(state) : false,\n state\n };\n });\n const d = autorun(reader => {\n /** @description waitForState */\n const { isFinished, error, state } = stateObs.read(reader);\n if (isFinished || error) {\n if (isImmediateRun) {\n // The variable `d` is not initialized yet\n shouldDispose = true;\n }\n else {\n d.dispose();\n }\n if (error) {\n reject(error === true ? state : error);\n }\n else {\n resolve(state);\n }\n }\n });\n if (cancellationToken) {\n const dc = cancellationToken.onCancellationRequested(() => {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n });\n if (cancellationToken.isCancellationRequested) {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n return;\n }\n }\n isImmediateRun = false;\n if (shouldDispose) {\n d.dispose();\n }\n });\n}\nfunction derivedWithCancellationToken(computeFnOrOwner, computeFnOrUndefined) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n let cancellationTokenSource = undefined;\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (cancellationTokenSource) {\n cancellationTokenSource.dispose();\n }\n cancellationTokenSource = new CancellationTokenSource();\n return computeFn(r, cancellationTokenSource.token);\n }, undefined, () => cancellationTokenSource?.dispose(), strictEquals, DebugLocation.ofCaller());\n}\n\nexport { derivedWithCancellationToken, waitForState };\n//# sourceMappingURL=utilsCancellation.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from './commonFacade/deps.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChanges(obs) {\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChangesLazy(getObs) {\n let obs = undefined;\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n\nexport { recordChanges, recordChangesLazy };\n//# sourceMappingURL=changeTracker.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { DebugNameData } from '../debugName.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableSignalFromEvent(owner, event, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservableSignal(typeof owner === 'string' ? owner : new DebugNameData(owner, undefined, undefined), event, debugLocation);\n}\nclass FromEventObservableSignal extends BaseObservable {\n constructor(debugNameDataOrName, event, debugLocation) {\n super(debugLocation);\n this.event = event;\n this.handleEvent = () => {\n transaction((tx) => {\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => this.debugName);\n };\n this.debugName = typeof debugNameDataOrName === 'string'\n ? debugNameDataOrName\n : debugNameDataOrName.getDebugName(this) ?? 'Observable Signal From Event';\n }\n onFirstObserverAdded() {\n this.subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this.subscription.dispose();\n this.subscription = undefined;\n }\n get() {\n // NO OP\n }\n}\n\nexport { observableSignalFromEvent };\n//# sourceMappingURL=observableSignalFromEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { autorun } from '../reactions/autorun.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an Event from an observable that fires whenever the observable changes.\n */\nfunction eventFromObservable(observable) {\n return (listener) => {\n let isFirst = true;\n return autorun(reader => {\n observable.read(reader);\n if (isFirst) {\n isFirst = false;\n }\n else {\n listener();\n }\n });\n };\n}\nclass ValueWithChangeEventFromObservable {\n constructor(observable) {\n this.observable = observable;\n }\n get onDidChange() {\n return eventFromObservable(this.observable);\n }\n get value() {\n return this.observable.get();\n }\n}\nfunction observableFromValueWithChangeEvent(owner, value) {\n if (value instanceof ValueWithChangeEventFromObservable) {\n return value.observable;\n }\n return observableFromEvent(owner, value.onDidChange, () => value.value);\n}\n\nexport { ValueWithChangeEventFromObservable, observableFromValueWithChangeEvent };\n//# sourceMappingURL=valueWithChangeEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { getDebugName, DebugNameData } from '../debugName.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { autorunOpts } from '../reactions/autorun.js';\nimport { derivedObservableWithCache } from '../utils/utils.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an observable that has the latest changed value of the given observables.\n * Initially (and when not observed), it has the value of the last observable.\n * When observed and any of the observables change, it has the value of the last changed observable.\n * If multiple observables change in the same transaction, the last observable wins.\n*/\nfunction latestChangedValue(owner, observables) {\n if (observables.length === 0) {\n throw new BugIndicatingError();\n }\n let hasLastChangedValue = false;\n let lastChangedValue = undefined;\n const result = observableFromEvent(owner, cb => {\n const store = new DisposableStore();\n for (const o of observables) {\n store.add(autorunOpts({ debugName: () => getDebugName(result, new DebugNameData(owner, undefined, undefined)) + '.updateLastChangedValue' }, reader => {\n hasLastChangedValue = true;\n lastChangedValue = o.read(reader);\n cb();\n }));\n }\n store.add({\n dispose() {\n hasLastChangedValue = false;\n lastChangedValue = undefined;\n },\n });\n return store;\n }, () => {\n if (hasLastChangedValue) {\n return lastChangedValue;\n }\n else {\n return observables[observables.length - 1].get();\n }\n });\n return result;\n}\n/**\n * Works like a derived.\n * However, if the value is not undefined, it is cached and will not be recomputed anymore.\n * In that case, the derived will unsubscribe from its dependencies.\n*/\nfunction derivedConstOnceDefined(owner, fn) {\n return derivedObservableWithCache(owner, (reader, lastValue) => lastValue ?? fn(reader));\n}\n\nexport { derivedConstOnceDefined, latestChangedValue };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { derived } from '../observables/derived.js';\nimport { observableSignalFromEvent } from '../observables/observableSignalFromEvent.js';\nimport { keepObserved } from '../utils/utils.js';\n\n/**\n * Wraps an observable so that its source remains observed for a grace period\n * after the wrapping observable loses all its observers.\n *\n * When the wrapping observable has observers, an autorun keeps `obs` observed\n * and forwards changes. When the last observer is removed, `obs` stays observed\n * via `keepObserved` for `maxIdleTimeMs` before being released. If a new observer\n * arrives during the grace period, the keep-alive is cancelled seamlessly.\n *\n * @param store - Controls the hard lifetime; disposing it cancels any pending grace period.\n * @param obs - The source observable to keep alive longer.\n * @param maxIdleTimeMs - Grace period in milliseconds.\n */\nfunction deferUnobserve(store, obs, maxIdleTimeMs) {\n let keepAliveHandle;\n let timeoutHandle;\n let disposed = false;\n const lifetimeTracker = observableSignalFromEvent('deferUnobserve', _ => {\n if (disposed) {\n throw new BugIndicatingError('deferUnobserve: Cannot add observer after disposal');\n }\n // First observer added to `lifetimeTracker`\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n if (!keepAliveHandle) {\n keepAliveHandle = keepObserved(obs);\n }\n return {\n dispose() {\n // Keep source observed during the grace period\t\n timeoutHandle = setTimeout(() => {\n timeoutHandle = undefined;\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n }, maxIdleTimeMs);\n },\n };\n });\n store.add({\n dispose() {\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n disposed = true;\n },\n });\n return derived(reader => {\n lifetimeTracker.read(reader);\n return obs.read(reader);\n });\n}\n\nexport { deferUnobserve };\n//# sourceMappingURL=deferUnobserve.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableSet {\n constructor() {\n this._data = new Set();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(value) {\n return this._data.has(value);\n }\n add(value, tx) {\n const hadValue = this._data.has(value);\n if (!hadValue) {\n this._data.add(value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(value, tx) {\n const result = this._data.delete(value);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, value2, _set) => {\n callbackfn.call(thisArg, value, value2, this);\n });\n }\n *entries() {\n for (const value of this._data) {\n yield [value, value];\n }\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.values();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableSet';\n }\n}\n\nexport { ObservableSet };\n//# sourceMappingURL=set.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableMap {\n constructor() {\n this._data = new Map();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(key) {\n return this._data.has(key);\n }\n get(key) {\n return this._data.get(key);\n }\n set(key, value, tx) {\n const hadKey = this._data.has(key);\n const oldValue = this._data.get(key);\n if (!hadKey || oldValue !== value) {\n this._data.set(key, value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(key, tx) {\n const result = this._data.delete(key);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, key, _map) => {\n callbackfn.call(thisArg, value, key, this);\n });\n }\n *entries() {\n yield* this._data.entries();\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableMap';\n }\n}\n\nexport { ObservableMap };\n//# sourceMappingURL=map.js.map\n"],"names":["LazyObservableValue","BaseObservable","_debugNameData","initialValue","_equalityComparator","debugLocation","change","getLogger","observer","observers","r","shouldCallBeginUpdate","shouldCallEndUpdate","value","tx","_tx","TransactionImpl","observable","newValue","observableValueOpts","options","DebugLocation","DebugNameData","strictEquals","ObservableValue","ObservableLazy","_computeValue","observableValue","v","ObservablePromise","fn","promise","derived","reader","result","transaction","PromiseResult","error","data","ObservableLazyPromise","_computePromise","waitForState","predicate","isError","cancellationToken","state","resolve","reject","isImmediateRun","shouldDispose","stateObs","d","autorun","isFinished","dc","CancellationError","derivedWithCancellationToken","computeFnOrOwner","computeFnOrUndefined","computeFn","owner","cancellationTokenSource","Derived","CancellationTokenSource","recordChanges","obs","_previousChangeSummary","ctx","changeSummary","key","BugIndicatingError","recordChangesLazy","getObs","observableSignalFromEvent","event","FromEventObservableSignal","debugNameDataOrName","o","eventFromObservable","listener","isFirst","ValueWithChangeEventFromObservable","observableFromValueWithChangeEvent","observableFromEvent","latestChangedValue","observables","hasLastChangedValue","lastChangedValue","cb","store","DisposableStore","autorunOpts","getDebugName","derivedConstOnceDefined","derivedObservableWithCache","lastValue","deferUnobserve","maxIdleTimeMs","keepAliveHandle","timeoutHandle","disposed","lifetimeTracker","_","keepObserved","ObservableSet","callbackfn","thisArg","value2","_set","ObservableMap","hadKey","oldValue","_map"],"mappings":";;AAeA,MAAMA,UAA4BC,EAAe;AAAA,EAC7C,IAAI,YAAY;AACZ,WAAO,KAAK,eAAe,aAAa,IAAI,KAAK;AAAA,EACrD;AAAA,EACA,YAAYC,GAAgBC,GAAcC,GAAqBC,GAAe;AAC1E,UAAMA,CAAa,GACnB,KAAK,iBAAiBH,GACtB,KAAK,sBAAsBE,GAC3B,KAAK,cAAc,IACnB,KAAK,UAAU,CAAA,GACf,KAAK,iBAAiB,GACtB,KAAK,SAASD;AAAA,EAClB;AAAA,EACA,MAAM;AACF,gBAAK,QAAO,GACL,KAAK;AAAA,EAChB;AAAA,EACA,UAAU;AACN,QAAI,MAAK;AAIT,UADA,KAAK,cAAc,IACf,KAAK,QAAQ,SAAS,GAAG;AACzB,mBAAWG,KAAU,KAAK,SAAS;AAC/B,UAAAC,EAAS,GAAI,wBAAwB,MAAM,EAAE,QAAAD,GAAQ,WAAW,IAAM,UAAU,aAAa,UAAU,KAAK,QAAQ,UAAU,GAAI,CAAE;AACpI,qBAAWE,KAAY,KAAK;AACxB,YAAAA,EAAS,aAAa,MAAMF,CAAM;AAAA,QAE1C;AACA,aAAK,QAAQ,SAAS;AAAA,MAC1B,OACK;AACD,QAAAC,EAAS,GAAI,wBAAwB,MAAM,EAAE,QAAQ,QAAW,WAAW,IAAM,UA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K,MAAM,QAAQ,CAAC7F,GAAOwD,GAAK2C,MAAS;AACrC,MAAAP,EAAW,KAAKC,GAAS7F,GAAOwD,GAAK,IAAI;AAAA,IAC7C,CAAC;AAAA,EACL;AAAA,EACA,CAAC,UAAU;AACP,WAAO,KAAK,MAAM,QAAO;AAAA,EAC7B;AAAA,EACA,CAAC,OAAO;AACJ,WAAO,KAAK,MAAM,KAAI;AAAA,EAC1B;AAAA,EACA,CAAC,SAAS;AACN,WAAO,KAAK,MAAM,OAAM;AAAA,EAC5B;AAAA,EACA,CAAC,OAAO,QAAQ,IAAI;AAChB,WAAO,KAAK,QAAO;AAAA,EACvB;AAAA,EACA,KAAK,OAAO,WAAW,IAAI;AACvB,WAAO;AAAA,EACX;AACJ;"}
|
|
1
|
+
{"version":3,"file":"observables.js","sources":["../../../../vscode-observables/observables/dist/observableInternal/observables/lazyObservableValue.js","../../../../vscode-observables/observables/dist/observableInternal/observables/observableValueOpts.js","../../../../vscode-observables/observables/dist/observableInternal/utils/promise.js","../../../../vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js","../../../../vscode-observables/observables/dist/observableInternal/changeTracker.js","../../../../vscode-observables/observables/dist/observableInternal/observables/observableSignalFromEvent.js","../../../../vscode-observables/observables/dist/observableInternal/utils/valueWithChangeEvent.js","../../../../vscode-observables/observables/dist/observableInternal/experimental/utils.js","../../../../vscode-observables/observables/dist/observableInternal/experimental/deferUnobserve.js","../../../../vscode-observables/observables/dist/observableInternal/set.js","../../../../vscode-observables/observables/dist/observableInternal/map.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Holds off updating observers until the value is actually read.\n*/\nclass LazyObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'LazyObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._isUpToDate = true;\n this._deltas = [];\n this._updateCounter = 0;\n this._value = initialValue;\n }\n get() {\n this._update();\n return this._value;\n }\n _update() {\n if (this._isUpToDate) {\n return;\n }\n this._isUpToDate = true;\n if (this._deltas.length > 0) {\n for (const change of this._deltas) {\n getLogger()?.handleObservableUpdated(this, { change, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, change);\n }\n }\n this._deltas.length = 0;\n }\n else {\n getLogger()?.handleObservableUpdated(this, { change: undefined, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, undefined);\n }\n }\n }\n _beginUpdate() {\n this._updateCounter++;\n if (this._updateCounter === 1) {\n for (const observer of this._observers) {\n observer.beginUpdate(this);\n }\n }\n }\n _endUpdate() {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n this._update();\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCounter > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n observer.beginUpdate(this);\n }\n }\n removeObserver(observer) {\n const shouldCallEndUpdate = this._observers.has(observer) && this._updateCounter > 0;\n super.removeObserver(observer);\n if (shouldCallEndUpdate) {\n // Calling end update after removing the observer makes sure endUpdate cannot be called twice here.\n observer.endUpdate(this);\n }\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n this._isUpToDate = false;\n this._setValue(value);\n if (change !== undefined) {\n this._deltas.push(change);\n }\n tx.updateObserver({\n beginUpdate: () => this._beginUpdate(),\n endUpdate: () => this._endUpdate(),\n handleChange: (observable, change) => { },\n handlePossibleChange: (observable) => { },\n }, this);\n if (this._updateCounter > 1) {\n // We already started begin/end update, so we need to manually call handlePossibleChange\n for (const observer of this._observers) {\n observer.handlePossibleChange(this);\n }\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n}\n\nexport { LazyObservableValue };\n//# sourceMappingURL=lazyObservableValue.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { ObservableValue } from './observableValue.js';\nimport { LazyObservableValue } from './lazyObservableValue.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValueOpts(options, initialValue, debugLocation = DebugLocation.ofCaller()) {\n if (options.lazy) {\n return new LazyObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n }\n return new ObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n}\n\nexport { observableValueOpts };\n//# sourceMappingURL=observableValueOpts.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { derived } from '../observables/derived.js';\nimport { observableValue } from '../observables/observableValue.js';\n\nclass ObservableLazy {\n /**\n * The cached value.\n * Does not force a computation of the value.\n */\n get cachedValue() { return this._value; }\n constructor(_computeValue) {\n this._computeValue = _computeValue;\n this._value = observableValue(this, undefined);\n }\n /**\n * Returns the cached value.\n * Computes the value if the value has not been cached yet.\n */\n getValue() {\n let v = this._value.get();\n if (!v) {\n v = this._computeValue();\n this._value.set(v, undefined);\n }\n return v;\n }\n}\n/**\n * A promise whose state is observable.\n */\nclass ObservablePromise {\n static fromFn(fn) {\n return new ObservablePromise(fn());\n }\n constructor(promise) {\n this._value = observableValue(this, undefined);\n /**\n * The current state of the promise.\n * Is `undefined` if the promise didn't resolve yet.\n */\n this.promiseResult = this._value;\n this.resolvedValue = derived(this, reader => {\n const result = this.promiseResult.read(reader);\n if (!result) {\n return undefined;\n }\n return result.getDataOrThrow();\n });\n this.promise = promise.then(value => {\n transaction(tx => {\n /** @description onPromiseResolved */\n this._value.set(new PromiseResult(value, undefined), tx);\n });\n return value;\n }, error => {\n transaction(tx => {\n /** @description onPromiseRejected */\n this._value.set(new PromiseResult(undefined, error), tx);\n });\n throw error;\n });\n }\n}\nclass PromiseResult {\n constructor(\n /**\n * The value of the resolved promise.\n * Undefined if the promise rejected.\n */\n data, \n /**\n * The error in case of a rejected promise.\n * Undefined if the promise resolved.\n */\n error) {\n this.data = data;\n this.error = error;\n }\n /**\n * Returns the value if the promise resolved, otherwise throws the error.\n */\n getDataOrThrow() {\n if (this.error) {\n throw this.error;\n }\n return this.data;\n }\n}\n/**\n * A lazy promise whose state is observable.\n */\nclass ObservableLazyPromise {\n constructor(_computePromise) {\n this._computePromise = _computePromise;\n this._lazyValue = new ObservableLazy(() => new ObservablePromise(this._computePromise()));\n /**\n * Does not enforce evaluation of the promise compute function.\n * Is undefined if the promise has not been computed yet.\n */\n this.cachedPromiseResult = derived(this, reader => this._lazyValue.cachedValue.read(reader)?.promiseResult.read(reader));\n }\n getPromise() {\n return this._lazyValue.getValue().promise;\n }\n}\n\nexport { ObservableLazy, ObservableLazyPromise, ObservablePromise, PromiseResult };\n//# sourceMappingURL=promise.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { CancellationError, CancellationTokenSource } from '../commonFacade/cancellation.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { createEffect } from '../reactions/createEffect.js';\nimport { Derived } from '../observables/derivedImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction waitForState(observable, predicate, isError, cancellationToken) {\n if (!predicate) {\n predicate = state => state !== null && state !== undefined;\n }\n return new Promise((resolve, reject) => {\n let isImmediateRun = true;\n let shouldDispose = false;\n const stateObs = observable.map(state => {\n /** @description waitForState.state */\n return {\n isFinished: predicate(state),\n error: isError ? isError(state) : false,\n state\n };\n });\n const d = createEffect(reader => {\n /** @description waitForState */\n const { isFinished, error, state } = stateObs.read(reader);\n if (isFinished || error) {\n if (isImmediateRun) {\n // The variable `d` is not initialized yet\n shouldDispose = true;\n }\n else {\n d.dispose();\n }\n if (error) {\n reject(error === true ? state : error);\n }\n else {\n resolve(state);\n }\n }\n });\n if (cancellationToken) {\n const dc = cancellationToken.onCancellationRequested(() => {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n });\n if (cancellationToken.isCancellationRequested) {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n return;\n }\n }\n isImmediateRun = false;\n if (shouldDispose) {\n d.dispose();\n }\n });\n}\nfunction derivedWithCancellationToken(computeFnOrOwner, computeFnOrUndefined) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n let cancellationTokenSource = undefined;\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (cancellationTokenSource) {\n cancellationTokenSource.dispose();\n }\n cancellationTokenSource = new CancellationTokenSource();\n return computeFn(r, cancellationTokenSource.token);\n }, undefined, () => cancellationTokenSource?.dispose(), strictEquals, DebugLocation.ofCaller());\n}\n\nexport { derivedWithCancellationToken, waitForState };\n//# sourceMappingURL=utilsCancellation.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from './commonFacade/deps.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChanges(obs) {\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChangesLazy(getObs) {\n let obs = undefined;\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n\nexport { recordChanges, recordChangesLazy };\n//# sourceMappingURL=changeTracker.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { DebugNameData } from '../debugName.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableSignalFromEvent(owner, event, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservableSignal(typeof owner === 'string' ? owner : new DebugNameData(owner, undefined, undefined), event, debugLocation);\n}\nclass FromEventObservableSignal extends BaseObservable {\n constructor(debugNameDataOrName, event, debugLocation) {\n super(debugLocation);\n this.event = event;\n this.handleEvent = () => {\n transaction((tx) => {\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => this.debugName);\n };\n this.debugName = typeof debugNameDataOrName === 'string'\n ? debugNameDataOrName\n : debugNameDataOrName.getDebugName(this) ?? 'Observable Signal From Event';\n }\n onFirstObserverAdded() {\n this.subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this.subscription.dispose();\n this.subscription = undefined;\n }\n get() {\n // NO OP\n }\n}\n\nexport { observableSignalFromEvent };\n//# sourceMappingURL=observableSignalFromEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { createEffect } from '../reactions/createEffect.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an Event from an observable that fires whenever the observable changes.\n */\nfunction eventFromObservable(observable) {\n return (listener) => {\n let isFirst = true;\n return createEffect(reader => {\n observable.read(reader);\n if (isFirst) {\n isFirst = false;\n }\n else {\n listener();\n }\n });\n };\n}\nclass ValueWithChangeEventFromObservable {\n constructor(observable) {\n this.observable = observable;\n }\n get onDidChange() {\n return eventFromObservable(this.observable);\n }\n get value() {\n return this.observable.get();\n }\n}\nfunction observableFromValueWithChangeEvent(owner, value) {\n if (value instanceof ValueWithChangeEventFromObservable) {\n return value.observable;\n }\n return observableFromEvent(owner, value.onDidChange, () => value.value);\n}\n\nexport { ValueWithChangeEventFromObservable, observableFromValueWithChangeEvent };\n//# sourceMappingURL=valueWithChangeEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { getDebugName, DebugNameData } from '../debugName.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { createEffectOpts } from '../reactions/createEffect.js';\nimport { derivedObservableWithCache } from '../utils/utils.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an observable that has the latest changed value of the given observables.\n * Initially (and when not observed), it has the value of the last observable.\n * When observed and any of the observables change, it has the value of the last changed observable.\n * If multiple observables change in the same transaction, the last observable wins.\n*/\nfunction latestChangedValue(owner, observables) {\n if (observables.length === 0) {\n throw new BugIndicatingError();\n }\n let hasLastChangedValue = false;\n let lastChangedValue = undefined;\n const result = observableFromEvent(owner, cb => {\n const store = new DisposableStore();\n for (const o of observables) {\n store.add(createEffectOpts({ debugName: () => getDebugName(result, new DebugNameData(owner, undefined, undefined)) + '.updateLastChangedValue' }, reader => {\n hasLastChangedValue = true;\n lastChangedValue = o.read(reader);\n cb();\n }));\n }\n store.add({\n dispose() {\n hasLastChangedValue = false;\n lastChangedValue = undefined;\n },\n });\n return store;\n }, () => {\n if (hasLastChangedValue) {\n return lastChangedValue;\n }\n else {\n return observables[observables.length - 1].get();\n }\n });\n return result;\n}\n/**\n * Works like a derived.\n * However, if the value is not undefined, it is cached and will not be recomputed anymore.\n * In that case, the derived will unsubscribe from its dependencies.\n*/\nfunction derivedConstOnceDefined(owner, fn) {\n return derivedObservableWithCache(owner, (reader, lastValue) => lastValue ?? fn(reader));\n}\n\nexport { derivedConstOnceDefined, latestChangedValue };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { derived } from '../observables/derived.js';\nimport { observableSignalFromEvent } from '../observables/observableSignalFromEvent.js';\nimport { keepObserved } from '../utils/utils.js';\n\n/**\n * Wraps an observable so that its source remains observed for a grace period\n * after the wrapping observable loses all its observers.\n *\n * When the wrapping observable has observers, an autorun keeps `obs` observed\n * and forwards changes. When the last observer is removed, `obs` stays observed\n * via `keepObserved` for `maxIdleTimeMs` before being released. If a new observer\n * arrives during the grace period, the keep-alive is cancelled seamlessly.\n *\n * @param store - Controls the hard lifetime; disposing it cancels any pending grace period.\n * @param obs - The source observable to keep alive longer.\n * @param maxIdleTimeMs - Grace period in milliseconds.\n */\nfunction deferUnobserve(store, obs, maxIdleTimeMs) {\n let keepAliveHandle;\n let timeoutHandle;\n let disposed = false;\n const lifetimeTracker = observableSignalFromEvent('deferUnobserve', _ => {\n if (disposed) {\n throw new BugIndicatingError('deferUnobserve: Cannot add observer after disposal');\n }\n // First observer added to `lifetimeTracker`\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n if (!keepAliveHandle) {\n keepAliveHandle = keepObserved(obs);\n }\n return {\n dispose() {\n // Keep source observed during the grace period\t\n timeoutHandle = setTimeout(() => {\n timeoutHandle = undefined;\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n }, maxIdleTimeMs);\n },\n };\n });\n store.add({\n dispose() {\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n disposed = true;\n },\n });\n return derived(reader => {\n lifetimeTracker.read(reader);\n return obs.read(reader);\n });\n}\n\nexport { deferUnobserve };\n//# sourceMappingURL=deferUnobserve.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableSet {\n constructor() {\n this._data = new Set();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(value) {\n return this._data.has(value);\n }\n add(value, tx) {\n const hadValue = this._data.has(value);\n if (!hadValue) {\n this._data.add(value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(value, tx) {\n const result = this._data.delete(value);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, value2, _set) => {\n callbackfn.call(thisArg, value, value2, this);\n });\n }\n *entries() {\n for (const value of this._data) {\n yield [value, value];\n }\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.values();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableSet';\n }\n}\n\nexport { ObservableSet };\n//# sourceMappingURL=set.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableMap {\n constructor() {\n this._data = new Map();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(key) {\n return this._data.has(key);\n }\n get(key) {\n return this._data.get(key);\n }\n set(key, value, tx) {\n const hadKey = this._data.has(key);\n const oldValue = this._data.get(key);\n if (!hadKey || oldValue !== value) {\n this._data.set(key, value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(key, tx) {\n const result = this._data.delete(key);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, key, _map) => {\n callbackfn.call(thisArg, value, key, this);\n });\n }\n *entries() {\n yield* this._data.entries();\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableMap';\n }\n}\n\nexport { ObservableMap };\n//# sourceMappingURL=map.js.map\n"],"names":["LazyObservableValue","BaseObservable","_debugNameData","initialValue","_equalityComparator","debugLocation","change","getLogger","observer","observers","r","shouldCallBeginUpdate","shouldCallEndUpdate","value","tx","_tx","TransactionImpl","observable","newValue","observableValueOpts","options","DebugLocation","DebugNameData","strictEquals","ObservableValue","ObservableLazy","_computeValue","observableValue","v","ObservablePromise","fn","promise","derived","reader","result","transaction","PromiseResult","error","data","ObservableLazyPromise","_computePromise","waitForState","predicate","isError","cancellationToken","state","resolve","reject","isImmediateRun","shouldDispose","stateObs","d","createEffect","isFinished","dc","CancellationError","derivedWithCancellationToken","computeFnOrOwner","computeFnOrUndefined","computeFn","owner","cancellationTokenSource","Derived","CancellationTokenSource","recordChanges","obs","_previousChangeSummary","ctx","changeSummary","key","BugIndicatingError","recordChangesLazy","getObs","observableSignalFromEvent","event","FromEventObservableSignal","debugNameDataOrName","o","eventFromObservable","listener","isFirst","ValueWithChangeEventFromObservable","observableFromValueWithChangeEvent","observableFromEvent","latestChangedValue","observables","hasLastChangedValue","lastChangedValue","cb","store","DisposableStore","createEffectOpts","getDebugName","derivedConstOnceDefined","derivedObservableWithCache","lastValue","deferUnobserve","maxIdleTimeMs","keepAliveHandle","timeoutHandle","disposed","lifetimeTracker","_","keepObserved","ObservableSet","callbackfn","thisArg","value2","_set","ObservableMap","hadKey","oldValue","_map"],"mappings":";;AAeA,MAAMA,UAA4BC,EAAe;AAAA,EAC7C,IAAI,YAAY;AACZ,WAAO,KAAK,eAAe,aAAa,IAAI,KAAK;AAAA,EACrD;AAAA,EACA,YAAYC,GAAgBC,GAAcC,GAAqBC,GAAe;AAC1E,UAAMA,CAAa,GACnB,KAAK,iBAAiBH,GACtB,KAAK,sBAAsBE,GAC3B,KAAK,cAAc,IACnB,KAAK,UAAU,CAAA,GACf,KAAK,iBAAiB,GACtB,KAAK,SAASD;AAAA,EAClB;AAAA,EACA,MAAM;AACF,gBAAK,QAAO,GACL,KAAK;AAAA,EAChB;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