@fncts/observable 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BehaviorSubject.d.ts +2 -2
- package/Notification.d.ts +4 -4
- package/Observable/api/connect.d.ts +2 -2
- package/Observable/api/connectable.d.ts +2 -2
- package/Observable/api/fromEvent.d.ts +4 -0
- package/Observable/api/race.d.ts +2 -1
- package/Observable/api/raceWith.d.ts +2 -2
- package/Observable/api/repeatWhen.d.ts +5 -2
- package/Observable/api/retryWhen.d.ts +2 -3
- package/Observable/api/share.d.ts +5 -4
- package/Observable/api/window.d.ts +2 -2
- package/Observable/api/windowCount.d.ts +2 -2
- package/Observable/api/windowTime.d.ts +5 -5
- package/Observable/api/windowToggle.d.ts +3 -3
- package/Observable/api/windowWhen.d.ts +3 -3
- package/Observable/api.d.ts +189 -195
- package/Observable/definition.d.ts +8 -6
- package/ObservableRef/api.d.ts +63 -0
- package/ObservableRef/atomic.d.ts +32 -0
- package/ObservableRef/definition.d.ts +52 -0
- package/Operator.d.ts +2 -2
- package/_cjs/Action.cjs +0 -7
- package/_cjs/Action.cjs.map +1 -1
- package/_cjs/AnimationFrameAction.cjs +0 -12
- package/_cjs/AnimationFrameAction.cjs.map +1 -1
- package/_cjs/AnimationFrameScheduler.cjs +0 -12
- package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
- package/_cjs/AsyncAction.cjs +0 -25
- package/_cjs/AsyncAction.cjs.map +1 -1
- package/_cjs/AsyncScheduler.cjs +2 -16
- package/_cjs/AsyncScheduler.cjs.map +1 -1
- package/_cjs/BehaviorSubject.cjs +1 -13
- package/_cjs/BehaviorSubject.cjs.map +1 -1
- package/_cjs/Notification.cjs +21 -40
- package/_cjs/Notification.cjs.map +1 -1
- package/_cjs/Observable/api/connect.cjs +12 -17
- package/_cjs/Observable/api/connect.cjs.map +1 -1
- package/_cjs/Observable/api/connectable.cjs +6 -18
- package/_cjs/Observable/api/connectable.cjs.map +1 -1
- package/_cjs/Observable/api/fromCallback.cjs +0 -15
- package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
- package/_cjs/Observable/api/fromEvent.cjs +3 -5
- package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
- package/_cjs/Observable/api/index.cjs +0 -28
- package/_cjs/Observable/api/index.cjs.map +1 -1
- package/_cjs/Observable/api/race.cjs +2 -12
- package/_cjs/Observable/api/race.cjs.map +1 -1
- package/_cjs/Observable/api/raceWith.cjs +8 -11
- package/_cjs/Observable/api/raceWith.cjs.map +1 -1
- package/_cjs/Observable/api/repeatWhen.cjs +44 -55
- package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
- package/_cjs/Observable/api/retryWhen.cjs +29 -45
- package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
- package/_cjs/Observable/api/share.cjs +61 -77
- package/_cjs/Observable/api/share.cjs.map +1 -1
- package/_cjs/Observable/api/window.cjs +33 -39
- package/_cjs/Observable/api/window.cjs.map +1 -1
- package/_cjs/Observable/api/windowCount.cjs +40 -48
- package/_cjs/Observable/api/windowCount.cjs.map +1 -1
- package/_cjs/Observable/api/windowTime.cjs +60 -73
- package/_cjs/Observable/api/windowTime.cjs.map +1 -1
- package/_cjs/Observable/api/windowToggle.cjs +55 -71
- package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
- package/_cjs/Observable/api/windowWhen.cjs +42 -52
- package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
- package/_cjs/Observable/api.cjs +1260 -1485
- package/_cjs/Observable/api.cjs.map +1 -1
- package/_cjs/Observable/definition.cjs +9 -37
- package/_cjs/Observable/definition.cjs.map +1 -1
- package/_cjs/Observable/dom/animationFrames.cjs +0 -12
- package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
- package/_cjs/Observable.cjs +0 -38
- package/_cjs/Observable.cjs.map +1 -1
- package/_cjs/ObservableRef/api.cjs +160 -0
- package/_cjs/ObservableRef/api.cjs.map +1 -0
- package/_cjs/ObservableRef/atomic.cjs +93 -0
- package/_cjs/ObservableRef/atomic.cjs.map +1 -0
- package/_cjs/ObservableRef/definition.cjs +24 -0
- package/_cjs/ObservableRef/definition.cjs.map +1 -0
- package/_cjs/Operator.cjs +11 -21
- package/_cjs/Operator.cjs.map +1 -1
- package/_cjs/Scheduler.cjs +0 -18
- package/_cjs/Scheduler.cjs.map +1 -1
- package/_cjs/Subject.cjs +3 -50
- package/_cjs/Subject.cjs.map +1 -1
- package/_cjs/Subscriber.cjs +0 -32
- package/_cjs/Subscriber.cjs.map +1 -1
- package/_cjs/Subscription.cjs +0 -37
- package/_cjs/Subscription.cjs.map +1 -1
- package/_cjs/index.cjs +0 -28
- package/_cjs/internal/animationFrameProvider.cjs +0 -9
- package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
- package/_cjs/internal/args.cjs +0 -6
- package/_cjs/internal/args.cjs.map +1 -1
- package/_cjs/internal/intervalProvider.cjs +0 -2
- package/_cjs/internal/intervalProvider.cjs.map +1 -1
- package/_cjs/internal/performanceTimestampProvider.cjs +0 -1
- package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
- package/_cjs/internal/timeoutProvider.cjs +0 -2
- package/_cjs/internal/timeoutProvider.cjs.map +1 -1
- package/_cjs/internal/timestampProvider.cjs +0 -1
- package/_cjs/internal/timestampProvider.cjs.map +1 -1
- package/_cjs/internal/util.cjs +2 -21
- package/_cjs/internal/util.cjs.map +1 -1
- package/_mjs/Action.mjs +0 -3
- package/_mjs/Action.mjs.map +1 -1
- package/_mjs/AnimationFrameAction.mjs +0 -6
- package/_mjs/AnimationFrameAction.mjs.map +1 -1
- package/_mjs/AnimationFrameScheduler.mjs +0 -7
- package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
- package/_mjs/AsyncAction.mjs +0 -17
- package/_mjs/AsyncAction.mjs.map +1 -1
- package/_mjs/AsyncScheduler.mjs +2 -10
- package/_mjs/AsyncScheduler.mjs.map +1 -1
- package/_mjs/BehaviorSubject.mjs +1 -8
- package/_mjs/BehaviorSubject.mjs.map +1 -1
- package/_mjs/Notification.mjs +18 -26
- package/_mjs/Notification.mjs.map +1 -1
- package/_mjs/Observable/api/connect.mjs +12 -11
- package/_mjs/Observable/api/connect.mjs.map +1 -1
- package/_mjs/Observable/api/connectable.mjs +6 -9
- package/_mjs/Observable/api/connectable.mjs.map +1 -1
- package/_mjs/Observable/api/fromCallback.mjs +0 -10
- package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
- package/_mjs/Observable/api/fromEvent.mjs +3 -1
- package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
- package/_mjs/Observable/api/index.mjs.map +1 -1
- package/_mjs/Observable/api/race.mjs +2 -6
- package/_mjs/Observable/api/race.mjs.map +1 -1
- package/_mjs/Observable/api/raceWith.mjs +7 -6
- package/_mjs/Observable/api/raceWith.mjs.map +1 -1
- package/_mjs/Observable/api/repeatWhen.mjs +44 -48
- package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
- package/_mjs/Observable/api/retryWhen.mjs +29 -37
- package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
- package/_mjs/Observable/api/share.mjs +60 -70
- package/_mjs/Observable/api/share.mjs.map +1 -1
- package/_mjs/Observable/api/window.mjs +32 -33
- package/_mjs/Observable/api/window.mjs.map +1 -1
- package/_mjs/Observable/api/windowCount.mjs +39 -43
- package/_mjs/Observable/api/windowCount.mjs.map +1 -1
- package/_mjs/Observable/api/windowTime.mjs +59 -63
- package/_mjs/Observable/api/windowTime.mjs.map +1 -1
- package/_mjs/Observable/api/windowToggle.mjs +54 -62
- package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
- package/_mjs/Observable/api/windowWhen.mjs +41 -45
- package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
- package/_mjs/Observable/api.mjs +1186 -1311
- package/_mjs/Observable/api.mjs.map +1 -1
- package/_mjs/Observable/definition.mjs +9 -24
- package/_mjs/Observable/definition.mjs.map +1 -1
- package/_mjs/Observable/dom/animationFrames.mjs +0 -5
- package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
- package/_mjs/Observable.mjs +4 -4
- package/_mjs/Observable.mjs.map +1 -1
- package/_mjs/ObservableRef/api.mjs +141 -0
- package/_mjs/ObservableRef/api.mjs.map +1 -0
- package/_mjs/ObservableRef/atomic.mjs +82 -0
- package/_mjs/ObservableRef/atomic.mjs.map +1 -0
- package/_mjs/ObservableRef/definition.mjs +16 -0
- package/_mjs/ObservableRef/definition.mjs.map +1 -0
- package/_mjs/Operator.mjs +11 -12
- package/_mjs/Operator.mjs.map +1 -1
- package/_mjs/Scheduler.mjs +0 -9
- package/_mjs/Scheduler.mjs.map +1 -1
- package/_mjs/Subject.mjs +3 -37
- package/_mjs/Subject.mjs.map +1 -1
- package/_mjs/Subscriber.mjs +0 -20
- package/_mjs/Subscriber.mjs.map +1 -1
- package/_mjs/Subscription.mjs +0 -26
- package/_mjs/Subscription.mjs.map +1 -1
- package/_mjs/index.mjs.map +1 -1
- package/_mjs/internal/animationFrameProvider.mjs +0 -5
- package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
- package/_mjs/internal/args.mjs +0 -2
- package/_mjs/internal/args.mjs.map +1 -1
- package/_mjs/internal/intervalProvider.mjs +0 -2
- package/_mjs/internal/intervalProvider.mjs.map +1 -1
- package/_mjs/internal/performanceTimestampProvider.mjs +0 -1
- package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
- package/_mjs/internal/timeoutProvider.mjs +0 -2
- package/_mjs/internal/timeoutProvider.mjs.map +1 -1
- package/_mjs/internal/timestampProvider.mjs +0 -1
- package/_mjs/internal/timestampProvider.mjs.map +1 -1
- package/_mjs/internal/util.mjs +2 -7
- package/_mjs/internal/util.mjs.map +1 -1
- package/_src/Action.ts +0 -1
- package/_src/AnimationFrameAction.ts +0 -2
- package/_src/AnimationFrameScheduler.ts +2 -7
- package/_src/BehaviorSubject.ts +3 -3
- package/_src/Notification.ts +21 -23
- package/_src/Observable/api/connect.ts +12 -9
- package/_src/Observable/api/connectable.ts +6 -7
- package/_src/Observable/api/fromCallback.ts +0 -1
- package/_src/Observable/api/fromEvent.ts +3 -0
- package/_src/Observable/api/race.ts +15 -13
- package/_src/Observable/api/raceWith.ts +15 -14
- package/_src/Observable/api/repeatWhen.ts +51 -56
- package/_src/Observable/api/retryWhen.ts +38 -43
- package/_src/Observable/api/share.ts +63 -71
- package/_src/Observable/api/window.ts +36 -41
- package/_src/Observable/api/windowCount.ts +44 -51
- package/_src/Observable/api/windowTime.ts +69 -81
- package/_src/Observable/api/windowToggle.ts +69 -73
- package/_src/Observable/api/windowWhen.ts +49 -55
- package/_src/Observable/api.ts +1493 -1498
- package/_src/Observable/definition.ts +24 -18
- package/_src/Observable/dom/animationFrames.ts +16 -6
- package/_src/Observable/instances.ts +0 -23
- package/_src/Observable.ts +0 -2
- package/_src/ObservableRef/api.ts +169 -0
- package/_src/ObservableRef/atomic.ts +85 -0
- package/_src/ObservableRef/definition.ts +57 -0
- package/_src/Operator.ts +20 -15
- package/_src/Scheduler.ts +0 -6
- package/_src/Subject.ts +1 -1
- package/_src/Subscriber.ts +3 -2
- package/_src/global.ts +5 -1
- package/_src/internal/util.ts +8 -4
- package/global.d.ts +5 -1
- package/package.json +2 -2
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const fileName_1 = "(@fncts/observable) src/ObservableRef/api.ts";
|
|
2
|
+
import * as tsplus_module_1 from "@fncts/io/IO/api";
|
|
3
|
+
import * as tsplus_module_2 from "@fncts/observable/Observable/api";
|
|
4
|
+
export const modify = modify_1;
|
|
5
|
+
import { Atomic } from "@fncts/observable/ObservableRef/atomic";
|
|
6
|
+
import { ObservableRef, ObservableRefDescriptor } from "@fncts/observable/ObservableRef/definition";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus static fncts.observable.ObservableRefOps make
|
|
9
|
+
* @tsplus static fncts.observable.ObservableRefOps __call
|
|
10
|
+
*/
|
|
11
|
+
export function make(initial, /** @fncts id */id) {
|
|
12
|
+
if (id === undefined) {
|
|
13
|
+
throw new Error("ObservableRef.make: the `id` argument must be provided if not using typescript transformers");
|
|
14
|
+
}
|
|
15
|
+
return new Atomic(new ObservableRefDescriptor(Symbol.for(id), initial));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @tsplus pipeable fncts.observable.ObservableRef update
|
|
19
|
+
*/
|
|
20
|
+
export function update(f) {
|
|
21
|
+
return self => modify_1(a => [undefined, f(a)])(self);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus pipeable fncts.observable.ObservableRef getAndUpdate
|
|
25
|
+
*/
|
|
26
|
+
export function getAndUpdate(f) {
|
|
27
|
+
return self => {
|
|
28
|
+
return modify_1(a => {
|
|
29
|
+
const value = f(a);
|
|
30
|
+
return [a, value];
|
|
31
|
+
})(self);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus pipeable fncts.observable.ObservableRef updateAndGet
|
|
36
|
+
*/
|
|
37
|
+
export function updateAndGet(f) {
|
|
38
|
+
return self => {
|
|
39
|
+
return modify_1(a => {
|
|
40
|
+
const value = f(a);
|
|
41
|
+
return [value, value];
|
|
42
|
+
})(self);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @tsplus pipeable fncts.observable.ObservableRef modify
|
|
47
|
+
*/
|
|
48
|
+
function modify_1(f) {
|
|
49
|
+
return self => {
|
|
50
|
+
return tsplus_module_1.flatMap(value => {
|
|
51
|
+
const [b, a] = f(value);
|
|
52
|
+
return tsplus_module_1.zipRight(tsplus_module_1.succeedNow(b, fileName_1 + ":58:41"), fileName_1 + ":58:27")(self.set(a));
|
|
53
|
+
}, fileName_1 + ":56:28")(self.get);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
class Map extends ObservableRef {
|
|
57
|
+
constructor(source, f) {
|
|
58
|
+
super(source.descriptor);
|
|
59
|
+
this.source = source;
|
|
60
|
+
this.f = f;
|
|
61
|
+
this.get = tsplus_module_1.map(this.f, fileName_1 + ":68:40")(this.source.get);
|
|
62
|
+
this.has = this.source.has;
|
|
63
|
+
this.delete = this.source.delete;
|
|
64
|
+
this.observable = tsplus_module_2.map_(this.f)(this.source.observable);
|
|
65
|
+
}
|
|
66
|
+
set(a) {
|
|
67
|
+
return this.source.set(a);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @tsplus pipeable fncts.observable.ObservableRef map
|
|
72
|
+
*/
|
|
73
|
+
export function map(f) {
|
|
74
|
+
return self => {
|
|
75
|
+
return new Map(self, f);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
class ContramapIn extends ObservableRef {
|
|
79
|
+
constructor(source, f) {
|
|
80
|
+
super(source.descriptor);
|
|
81
|
+
this.source = source;
|
|
82
|
+
this.f = f;
|
|
83
|
+
this.get = this.source.get;
|
|
84
|
+
this.has = this.source.has;
|
|
85
|
+
this.delete = this.source.delete;
|
|
86
|
+
this.observable = this.source.observable;
|
|
87
|
+
}
|
|
88
|
+
set(c) {
|
|
89
|
+
return this.source.set(this.f(c));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @tsplus pipeable fncts.observable.ObservableRef contramapIn
|
|
94
|
+
*/
|
|
95
|
+
export function contramapIn(f) {
|
|
96
|
+
return self => {
|
|
97
|
+
return new ContramapIn(self, f);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
class Focus extends ObservableRef {
|
|
101
|
+
constructor(source, lens) {
|
|
102
|
+
super(source.descriptor);
|
|
103
|
+
this.source = source;
|
|
104
|
+
this.lens = lens;
|
|
105
|
+
this.get = tsplus_module_1.map(this.lens.get, fileName_1 + ":122:40")(this.source.get);
|
|
106
|
+
this.has = this.source.has;
|
|
107
|
+
this.delete = this.source.delete;
|
|
108
|
+
this.observable = tsplus_module_2.map_(this.lens.get)(this.source.observable);
|
|
109
|
+
}
|
|
110
|
+
set(b) {
|
|
111
|
+
return tsplus_module_1.flatMap(a => this.source.set(this.lens.set(b)(a)), fileName_1 + ":125:35")(this.source.get);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @tsplus pipeable fncts.observable.ObservableRef focus
|
|
116
|
+
*/
|
|
117
|
+
export function focus(lens) {
|
|
118
|
+
return self => {
|
|
119
|
+
return new Focus(self, lens);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export class ZipWith {
|
|
123
|
+
constructor(sourceA, sourceB, f) {
|
|
124
|
+
this.sourceA = sourceA;
|
|
125
|
+
this.sourceB = sourceB;
|
|
126
|
+
this.f = f;
|
|
127
|
+
this.get = tsplus_module_1.zipWith(this.sourceB.get, this.f, fileName_1 + ":153:50")(this.sourceA.get);
|
|
128
|
+
this.has = tsplus_module_1.zipWith(this.sourceB.has, (a, b) => a && b, fileName_1 + ":155:56")(this.sourceA.has);
|
|
129
|
+
this.delete = tsplus_module_1.zipRight(this.sourceB.delete, fileName_1 + ":157:53")(this.sourceA.delete);
|
|
130
|
+
this.observable = tsplus_module_2.zipWithLatest(this.sourceB.observable, this.f)(this.sourceA.observable);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @tsplus pipeable fncts.observable.ObservableRef.Readable zipWith
|
|
135
|
+
*/
|
|
136
|
+
export function zipWith(that, f) {
|
|
137
|
+
return self => {
|
|
138
|
+
return new ZipWith(self, that, f);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=api.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.mjs","mappings":";;;aAqDgBA,MAAM;AAhDtB,SAASC,MAAM,QAAQ,wCAAwC;AAC/D,SAASC,aAAa,EAAEC,uBAAuB,QAAQ,4CAA4C;AAEnG;;;;AAIA,OAAM,SAAUC,IAAI,CAAIC,OAAU,EAAE,gBAAiBC,EAAW;EAC9D,IAAIA,EAAE,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G,GAA0BH,wBAAyB,IAAI,CAACqB,OAAO,CAACb,GAAG,EAAE,CAACZ,CAAC,EAAEK,CAAC,KAAKL,CAAC,IAAIK,CAAC,0BAA3D,IAAI,CAACmB,OAAO,CAACZ,GAAG,CAA4C;IAEzF,WAAM,4BAA6C,IAAI,CAACa,OAAO,CAACZ,MAAM,0BAAzC,IAAI,CAACW,OAAO,CAACX,MAAM;IAEhD,eAAU,GAAiCC,8BAAsC,IAAI,CAACW,OAAO,CAACV,UAAU,EAAE,IAAI,CAAClB,CAAC,EAArE,IAAI,CAAC2B,OAAO,CAACT,UAAU,CAA+C;EAR9G;;AAWL;;;AAGA,OAAM,SAAUW,OAAO,CAAiBC,IAAmC,EAAE9B,CAAoB;EAC/F,OAAQC,IAAkC,IAAuC;IAC/E,OAAO,IAAIyB,OAAO,CAACzB,IAAI,EAAE6B,IAAI,EAAE9B,CAAC,CAAC;EACnC,CAAC;AACH","names":["modify","Atomic","ObservableRef","ObservableRefDescriptor","make","initial","id","undefined","Error","Symbol","for","update","f","self","modify_1","a","getAndUpdate","value","updateAndGet","tsplus_module_1","b","set","get","Map","constructor","source","descriptor","has","delete","tsplus_module_2","observable","map","ContramapIn","c","contramapIn","Focus","lens","focus","ZipWith","sourceA","sourceB","zipWith","that"],"sourceRoot":"","sources":["../../_src/ObservableRef/api.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const fileName_1 = "(@fncts/observable) src/ObservableRef/atomic.ts";
|
|
2
|
+
import * as tsplus_module_1 from "@fncts/observable/ObservableRef/definition";
|
|
3
|
+
import * as tsplus_module_2 from "@fncts/io/IO/api/environment";
|
|
4
|
+
import * as tsplus_module_3 from "@fncts/observable/Observable";
|
|
5
|
+
import * as tsplus_module_4 from "@fncts/observable/Observable/api";
|
|
6
|
+
import * as tsplus_module_5 from "@fncts/io/IO/api";
|
|
7
|
+
import * as tsplus_module_6 from "@fncts/base/data/Tag/constructors";
|
|
8
|
+
import { BehaviorSubject } from "@fncts/observable/BehaviorSubject";
|
|
9
|
+
export class Atomic extends tsplus_module_1.ObservableRef {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.get = tsplus_module_2.serviceWithIO(reactor => reactor.get(this.descriptor), StoreTag_1, fileName_1 + ":6:41");
|
|
13
|
+
this.has = tsplus_module_2.serviceWithIO(reactor => reactor.has(this.descriptor), StoreTag_1, fileName_1 + ":12:47");
|
|
14
|
+
this.delete = tsplus_module_2.serviceWithIO(reactor => reactor.delete(this.descriptor), StoreTag_1, fileName_1 + ":14:50");
|
|
15
|
+
this.observable = tsplus_module_4.serviceWithObservable(reactor => new tsplus_module_3.Observable(subscriber => {
|
|
16
|
+
return reactor.unsafeSubscribe(this.descriptor, subscriber);
|
|
17
|
+
}), StoreTag_1);
|
|
18
|
+
}
|
|
19
|
+
set(a) {
|
|
20
|
+
return tsplus_module_2.serviceWithIO(reactor => reactor.set(this.descriptor, a), StoreTag_1, fileName_1 + ":9:28");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @tsplus type fncts.observable.Store
|
|
25
|
+
* @tsplus companion fncts.observable.StoreOps
|
|
26
|
+
*/
|
|
27
|
+
export class Store {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.subjectMap = new Map();
|
|
30
|
+
}
|
|
31
|
+
get(ref) {
|
|
32
|
+
return tsplus_module_5.succeed(() => {
|
|
33
|
+
if (this.subjectMap.has(ref.id)) {
|
|
34
|
+
return this.subjectMap.get(ref.id).value;
|
|
35
|
+
} else {
|
|
36
|
+
this.subjectMap.set(ref.id, new BehaviorSubject(ref.initial));
|
|
37
|
+
return ref.initial;
|
|
38
|
+
}
|
|
39
|
+
}, fileName_1 + ":32:14");
|
|
40
|
+
}
|
|
41
|
+
set(ref, value) {
|
|
42
|
+
return tsplus_module_5.succeed(() => {
|
|
43
|
+
if (this.subjectMap.has(ref.id)) {
|
|
44
|
+
this.subjectMap.get(ref.id).next(value);
|
|
45
|
+
} else {
|
|
46
|
+
this.subjectMap.set(ref.id, new BehaviorSubject(value));
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}, fileName_1 + ":43:14");
|
|
50
|
+
}
|
|
51
|
+
has(ref) {
|
|
52
|
+
return tsplus_module_5.succeed(() => this.subjectMap.has(ref.id), fileName_1 + ":54:14");
|
|
53
|
+
}
|
|
54
|
+
delete(ref) {
|
|
55
|
+
return tsplus_module_5.succeed(() => {
|
|
56
|
+
if (this.subjectMap.has(ref.id)) {
|
|
57
|
+
this.subjectMap.delete(ref.id);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}, fileName_1 + ":58:14");
|
|
62
|
+
}
|
|
63
|
+
unsafeSubscribe(ref, subscriber) {
|
|
64
|
+
if (this.subjectMap.has(ref.id)) {
|
|
65
|
+
const subject = this.subjectMap.get(ref.id);
|
|
66
|
+
const subscription = subject.subscribe(subscriber);
|
|
67
|
+
return subscription;
|
|
68
|
+
} else {
|
|
69
|
+
const subject = new BehaviorSubject(ref.initial);
|
|
70
|
+
const subscription = subject.subscribe(subscriber);
|
|
71
|
+
this.subjectMap.set(ref.id, subject);
|
|
72
|
+
return subscription;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @tsplus static fncts.observable.StoreOps Tag
|
|
78
|
+
* @tsplus implicit
|
|
79
|
+
*/
|
|
80
|
+
const StoreTag_1 = /*#__PURE__*/tsplus_module_6.makeTag("fncts.observable.ObservableRef.StoreTag");
|
|
81
|
+
export const StoreTag = StoreTag_1;
|
|
82
|
+
//# sourceMappingURL=atomic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic.mjs","mappings":";;;;;;;AAEA,SAASA,eAAe,QAAQ,mCAAmC;AAEnE,OAAM,MAAOC,MAAU,SAAQC,6BAA0B;EAAzDC;;IACE,QAAG,GAAmBC,8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AAWC,wBAAW,yCAAyC,CAAC;aAAhEC,QAAQ","names":["BehaviorSubject","Atomic","tsplus_module_1","constructor","tsplus_module_2","reactor","get","descriptor","has","delete","tsplus_module_4","Observable","subscriber","unsafeSubscribe","set","a","Store","Map","ref","tsplus_module_5","subjectMap","id","value","initial","next","subject","subscription","subscribe","StoreTag_1","tsplus_module_6","StoreTag"],"sourceRoot":"","sources":["../../_src/ObservableRef/atomic.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class ObservableRefDescriptor {
|
|
2
|
+
constructor(id, initial) {
|
|
3
|
+
this.id = id;
|
|
4
|
+
this.initial = initial;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus type fncts.observable.ObservableRef
|
|
9
|
+
* @tsplus companion fncts.observable.ObservableRefOps
|
|
10
|
+
*/
|
|
11
|
+
export class ObservableRef {
|
|
12
|
+
constructor(descriptor) {
|
|
13
|
+
this.descriptor = descriptor;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=definition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.mjs","mappings":"AAWA,OAAM,MAAOA,uBAAuB;EAClCC,YAAqBC,EAAU,EAAWC,OAAU;IAA/B,OAAE,GAAFD,EAAE;IAAmB,YAAO,GAAPC,OAAO;EAAM;;AA4BzD;;;;AAIA,OAAM,MAAgBC,aAAa;EAKjCH,YAAqBI,UAAwC;IAAxC,eAAU,GAAVA,UAAU;EAAiC","names":["ObservableRefDescriptor","constructor","id","initial","ObservableRef","descriptor"],"sourceRoot":"","sources":["../../_src/ObservableRef/definition.ts"],"sourcesContent":[null]}
|
package/_mjs/Operator.mjs
CHANGED
|
@@ -34,7 +34,6 @@ export class OperatorSubscriber extends tsplus_module_1.Subscriber {
|
|
|
34
34
|
}
|
|
35
35
|
} : super.complete;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
37
|
unsubscribe() {
|
|
39
38
|
const {
|
|
40
39
|
closed
|
|
@@ -42,22 +41,22 @@ export class OperatorSubscriber extends tsplus_module_1.Subscriber {
|
|
|
42
41
|
super.unsubscribe();
|
|
43
42
|
!closed && this.onFinalize?.();
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
}
|
|
47
45
|
export function operatorSubscriber(destination, observer, onFinalize) {
|
|
48
46
|
return new OperatorSubscriber(destination, observer, onFinalize);
|
|
49
47
|
}
|
|
50
48
|
/**
|
|
51
|
-
* @tsplus
|
|
49
|
+
* @tsplus pipeable fncts.observable.Observable operate
|
|
52
50
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
export function operate_(f) {
|
|
52
|
+
return source => {
|
|
53
|
+
return source.lift(function (liftedSource, environment) {
|
|
54
|
+
try {
|
|
55
|
+
f(liftedSource, this, environment);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
this.error(tsplus_module_2.halt(err));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
62
61
|
}
|
|
63
62
|
//# sourceMappingURL=Operator.mjs.map
|
package/_mjs/Operator.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operator.mjs","mappings":";;;
|
|
1
|
+
{"version":3,"file":"Operator.mjs","mappings":";;;AAGA,OAAM,MAAOA,kBAAyB,SAAQC,0BAAgB;EAC5DC,YAAYC,WAAiC,EAAEC,QAAiC,EAAUC,UAAuB;IAC/G,KAAK,CAACF,WAAW,CAAC;IADsE,eAAU,GAAVE,UAAU;IAElG,IAAI,CAACC,IAAI,GAAGF,QAAQ,CAACE,IAAI,GACrB,UAA0CC,KAAQ;MAChD,IAAI;QACFH,QAAQ,CAACE,IAAK,CAACC,KAAK,CAAC;OACtB,CAAC,OAAOC,GAAG,EAAE;QACZL,WAAW,C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AAOb,GAAG,EAAE;QACZ,IAAI,CAACC,KAAK,CAACC,qBAAWF,GAAG,CAAC,CAAC;;IAE/B,CAAC,CAAC;EACJ,CAAC;AACH","names":["OperatorSubscriber","tsplus_module_1","constructor","destination","observer","onFinalize","next","value","err","error","tsplus_module_2","unsubscribe","tsplus_module_3","complete","closed","operatorSubscriber","operate_","f","source","lift","liftedSource","environment"],"sourceRoot":"","sources":["../_src/Operator.ts"],"sourcesContent":[null]}
|
package/_mjs/Scheduler.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
|
|
3
2
|
import * as tsplus_module_1 from "@fncts/base/util/predicates";
|
|
4
3
|
import * as tsplus_module_2 from "@fncts/base/data/Cause/api";
|
|
5
4
|
import { dateTimestampProvider } from "@fncts/observable/internal/timestampProvider";
|
|
6
|
-
/*
|
|
7
|
-
* -------------------------------------------------------------------------------------------------
|
|
8
|
-
* Scheduler
|
|
9
|
-
* -------------------------------------------------------------------------------------------------
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
5
|
export const SchedulerTypeId = /*#__PURE__*/Symbol.for("fncts.observable.Scheduler");
|
|
13
6
|
export class Scheduler {
|
|
14
7
|
constructor(actionConstructor, now = Scheduler.now) {
|
|
@@ -16,11 +9,9 @@ export class Scheduler {
|
|
|
16
9
|
this[_a] = SchedulerTypeId;
|
|
17
10
|
this.now = now;
|
|
18
11
|
}
|
|
19
|
-
|
|
20
12
|
schedule(work, delay, state) {
|
|
21
13
|
return new this.actionConstructor(this, work).schedule(state, delay);
|
|
22
14
|
}
|
|
23
|
-
|
|
24
15
|
}
|
|
25
16
|
_a = SchedulerTypeId;
|
|
26
17
|
Scheduler.now = dateTimestampProvider.now;
|
package/_mjs/Scheduler.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scheduler.mjs","mappings":"
|
|
1
|
+
{"version":3,"file":"Scheduler.mjs","mappings":";;;AAAA,SAASA,qBAAqB,QAAQ,8CAA8C;AAUpF,OAAO,MAAMC,eAAe,gBAAGC,MAAM,CAACC,GAAG,CAAC,4BAA4B,CAAC;AAGvE,OAAM,MAAOC,SAAS;EAIpBC,YAAoBC,iBAAgC,EAAEC,MAAoBH,SAAS,CAACG,GAAG;IAAnE,sBAAiB,GAAjBD,iBAAiB;IAH5B,QAAiB,GAAoBL,eAAe;IAI3D,IAAI,CAACM,GAAG,GAAGA,GAAG;EAChB;EACAC,QAAQ,CAAIC,IAAmD,EAAEC,KAAc,EAAEC,KAAS;IACxF,OAAO,IAAI,IAAI,CAACL,iBAAiB,CAAC,IAAI,EAAEG,IAAI,CAAC,CAACD,QAAQ,CAACG,KAAK,EAAED,KAAK,CAAC;EACtE;;KARUT,eAAe;AASXG,aAAG,GAAiBJ,qBAAqB,CAACO,GAAG;AAG7D,OAAM,SAAUK,WAAW,CAACC,CAAU;EACpC,OAAOC,wBAAQ,CAACD,CAAC,CAAC,IAAIZ,eAAe,IAAIY,CAAC;AAC5C;AAEA,OAAM,SAAUE,cAAc,CAC5BC,UAA4B,EAC5BC,SAAwB,EACxBC,OAA6C,EAC7CR,KAAK,GAAG,CAAC;EAET,MAAMS,YAAY,GAAGF,SAAS,CAACT,QAAQ,CAAC;IACtC,IAAI;MACFU,OAAO,CAACE,IAAI,CAAC,IAAI,CAAC;KACnB,CAAC,OAAOC,GAAG,EAAE;MACZL,UAAU,CAACM,KAAK,CAACC,qBAAWF,GAAG,CAAC,CAAC;;EAErC,CAAC,EAAEX,KAAK,CAAC;EACTM,UAAU,CAACQ,GAAG,CAACL,YAAY,CAAC;EAC5B,OAAOA,YAAY;AACrB","names":["dateTimestampProvider","SchedulerTypeId","Symbol","for","Scheduler","constructor","actionConstructor","now","schedule","work","delay","state","isScheduler","u","tsplus_module_1","caughtSchedule","subscriber","scheduler","execute","subscription","call","err","error","tsplus_module_2","add"],"sourceRoot":"","sources":["../_src/Scheduler.ts"],"sourcesContent":[null]}
|
package/_mjs/Subject.mjs
CHANGED
|
@@ -12,82 +12,66 @@ export class Subject extends tsplus_module_1.Observable {
|
|
|
12
12
|
this.hasError = false;
|
|
13
13
|
this.thrownError = null;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
lift(operator) {
|
|
17
16
|
const subject = new AnonymousSubject(this, this);
|
|
18
17
|
subject.operator = operator;
|
|
19
18
|
return subject;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
next(value) {
|
|
23
21
|
this.throwIfClosed();
|
|
24
|
-
|
|
25
22
|
if (!this.isStopped) {
|
|
26
23
|
const copy = this.observers.slice();
|
|
27
|
-
|
|
28
24
|
for (const observer of copy) {
|
|
29
25
|
observer.next(value);
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
error(err) {
|
|
35
30
|
this.throwIfClosed();
|
|
36
|
-
|
|
37
31
|
if (!this.isStopped) {
|
|
38
32
|
this.hasError = this.isStopped = true;
|
|
39
33
|
this.thrownError = err;
|
|
40
34
|
const {
|
|
41
35
|
observers
|
|
42
36
|
} = this;
|
|
43
|
-
|
|
44
37
|
while (observers.length) {
|
|
45
38
|
observers.shift().error(err);
|
|
46
39
|
}
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
|
-
|
|
50
42
|
complete() {
|
|
51
43
|
this.throwIfClosed();
|
|
52
|
-
|
|
53
44
|
if (!this.isStopped) {
|
|
54
45
|
this.isStopped = true;
|
|
55
46
|
const {
|
|
56
47
|
observers
|
|
57
48
|
} = this;
|
|
58
|
-
|
|
59
49
|
while (observers.length) {
|
|
60
50
|
observers.shift().complete();
|
|
61
51
|
}
|
|
62
52
|
}
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
unsubscribe() {
|
|
66
55
|
this.isStopped = this.closed = true;
|
|
67
56
|
this.observers = null;
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
get observed() {
|
|
71
59
|
return this.observers?.length > 0;
|
|
72
60
|
}
|
|
73
|
-
|
|
74
61
|
throwIfClosed() {
|
|
75
62
|
if (this.closed) {
|
|
76
63
|
throw new Error("Object Unsubscribed");
|
|
77
64
|
}
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
trySubscribe(subscriber, environment) {
|
|
81
67
|
this.throwIfClosed();
|
|
82
68
|
return super.trySubscribe(subscriber, environment);
|
|
83
69
|
}
|
|
84
|
-
|
|
85
70
|
subscribeInternal(subscriber) {
|
|
86
71
|
this.throwIfClosed();
|
|
87
72
|
this.checkFinalizedStatuses(subscriber);
|
|
88
73
|
return this.innerSubscribe(subscriber);
|
|
89
74
|
}
|
|
90
|
-
|
|
91
75
|
innerSubscribe(subscriber) {
|
|
92
76
|
const {
|
|
93
77
|
hasError,
|
|
@@ -96,27 +80,23 @@ export class Subject extends tsplus_module_1.Observable {
|
|
|
96
80
|
} = this;
|
|
97
81
|
return hasError || isStopped ? tsplus_module_2.EMPTY_SUBSCRIPTION : (observers.push(subscriber), new tsplus_module_2.Subscription(() => arrayRemove(observers, subscriber)));
|
|
98
82
|
}
|
|
99
|
-
|
|
100
83
|
checkFinalizedStatuses(subscriber) {
|
|
101
84
|
const {
|
|
102
85
|
hasError,
|
|
103
86
|
thrownError,
|
|
104
87
|
isStopped
|
|
105
88
|
} = this;
|
|
106
|
-
|
|
107
89
|
if (hasError) {
|
|
108
90
|
subscriber.error(thrownError);
|
|
109
91
|
} else if (isStopped) {
|
|
110
92
|
subscriber.complete();
|
|
111
93
|
}
|
|
112
94
|
}
|
|
113
|
-
|
|
114
95
|
asObservable() {
|
|
115
96
|
const observable = new tsplus_module_1.Observable();
|
|
116
97
|
observable.source = this;
|
|
117
98
|
return observable;
|
|
118
99
|
}
|
|
119
|
-
|
|
120
100
|
}
|
|
121
101
|
export class AnonymousSubject extends Subject {
|
|
122
102
|
constructor(destination, source) {
|
|
@@ -124,25 +104,19 @@ export class AnonymousSubject extends Subject {
|
|
|
124
104
|
this.destination = destination;
|
|
125
105
|
this.source = source;
|
|
126
106
|
}
|
|
127
|
-
|
|
128
107
|
next(value) {
|
|
129
108
|
this.destination?.next?.(value);
|
|
130
109
|
}
|
|
131
|
-
|
|
132
110
|
error(err) {
|
|
133
111
|
this.destination?.error?.(err);
|
|
134
112
|
}
|
|
135
|
-
|
|
136
113
|
complete() {
|
|
137
114
|
this.destination?.complete?.();
|
|
138
115
|
}
|
|
139
116
|
/** @internal */
|
|
140
|
-
|
|
141
|
-
|
|
142
117
|
subscribeInternal(subscriber) {
|
|
143
|
-
return this.source?.subscribe(subscriber) ?? tsplus_module_2.EMPTY_SUBSCRIPTION;
|
|
118
|
+
return this.source?.provideEnvironment(this.environment).subscribe(subscriber) ?? tsplus_module_2.EMPTY_SUBSCRIPTION;
|
|
144
119
|
}
|
|
145
|
-
|
|
146
120
|
}
|
|
147
121
|
export class AsyncSubject extends Subject {
|
|
148
122
|
constructor() {
|
|
@@ -152,8 +126,6 @@ export class AsyncSubject extends Subject {
|
|
|
152
126
|
this.isComplete = false;
|
|
153
127
|
}
|
|
154
128
|
/** @internal */
|
|
155
|
-
|
|
156
|
-
|
|
157
129
|
checkFinalizedStatuses(subscriber) {
|
|
158
130
|
const {
|
|
159
131
|
hasError,
|
|
@@ -163,42 +135,36 @@ export class AsyncSubject extends Subject {
|
|
|
163
135
|
isStopped,
|
|
164
136
|
isComplete
|
|
165
137
|
} = this;
|
|
166
|
-
|
|
167
138
|
if (hasError) {
|
|
168
139
|
subscriber.error(thrownError);
|
|
169
140
|
} else if (isStopped || isComplete) {
|
|
170
|
-
hasValue && tsplus_module_3.
|
|
141
|
+
hasValue && tsplus_module_3.match(e => subscriber.error(e), a => subscriber.next(a))(value);
|
|
171
142
|
subscriber.complete();
|
|
172
143
|
}
|
|
173
144
|
}
|
|
174
|
-
|
|
175
145
|
next(value) {
|
|
176
146
|
if (!this.isStopped) {
|
|
177
147
|
this.value = tsplus_module_4.right(value);
|
|
178
148
|
this.hasValue = true;
|
|
179
149
|
}
|
|
180
150
|
}
|
|
181
|
-
|
|
182
151
|
error(err) {
|
|
183
152
|
if (!this.isStopped) {
|
|
184
153
|
this.value = tsplus_module_4.left(err);
|
|
185
154
|
this.hasValue = true;
|
|
186
155
|
}
|
|
187
156
|
}
|
|
188
|
-
|
|
189
157
|
complete() {
|
|
190
158
|
const {
|
|
191
159
|
hasValue,
|
|
192
160
|
value,
|
|
193
161
|
isComplete
|
|
194
162
|
} = this;
|
|
195
|
-
|
|
196
163
|
if (!isComplete) {
|
|
197
164
|
this.isComplete = true;
|
|
198
|
-
hasValue && tsplus_module_3.
|
|
165
|
+
hasValue && tsplus_module_3.match(e => super.error(e), a => super.next(a))(value);
|
|
199
166
|
super.complete();
|
|
200
167
|
}
|
|
201
168
|
}
|
|
202
|
-
|
|
203
169
|
}
|
|
204
170
|
//# sourceMappingURL=Subject.mjs.map
|
package/_mjs/Subject.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subject.mjs","mappings":";;;;AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"Subject.mjs","mappings":";;;;AAAA,SAASA,WAAW,QAAQ,iCAAiC;AAI7D,OAAM,MAAOC,OAAiB,SAAQC,0BAAmB;EAOvDC;IACE,KAAK,EAAE;IAPT,WAAM,GAAG,KAAK;IACJ,cAAS,GAA0B,EAAE;IACrC,cAAS,GAAe,KAAK;IAC7B,aAAQ,GAAgB,KAAK;IAC7B,gBAAW,GAAa,IAAK;EAIvC;EAEAC,IAAI,CAAYC,QAAyB;IACvC,MAAMC,OAAO,GAAM,IAAIC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC;IACnDD,OAAO,CAACD,QAAQ,GAAGA,QAAe;IAClC,OAAOC,OAAc;EACvB;EAEAE,IAAI,CAACC,KAAQ;IACX,IAAI,CAACC,aAAa,EAAE;IACpB,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,MAAMC,IAAI,GAAG,IAAI,CAACC,SAAS,CAACC,KAAK,EAAE;MACnC,KAAK,MAAMC,QAAQ,IAAI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C,EACpBC,CAAC,IAAK,KAAK,CAACxC,IAAI,CAACwC,CAAC,CAAC,EAFtBvC,KAAM,CAGL;MACH,KAAK,CAACa,QAAQ,EAAE;;EAEpB","names":["arrayRemove","Subject","tsplus_module_1","constructor","lift","operator","subject","AnonymousSubject","next","value","throwIfClosed","isStopped","copy","observers","slice","observer","error","err","hasError","thrownError","length","shift","complete","unsubscribe","closed","observed","Error","trySubscribe","subscriber","environment","subscribeInternal","checkFinalizedStatuses","innerSubscribe","tsplus_module_2","push","Subscription","asObservable","observable","Observable","source","destination","provideEnvironment","subscribe","AsyncSubject","hasValue","isComplete","tsplus_module_3","e","a","tsplus_module_4"],"sourceRoot":"","sources":["../_src/Subject.ts"],"sourcesContent":[null]}
|