@prose-reader/core 1.32.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prose.js +162 -2236
- package/dist/prose.js.map +1 -1
- package/dist/prose.umd.cjs +238 -2313
- package/dist/prose.umd.cjs.map +1 -1
- package/package.json +3 -3
package/dist/prose.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Subject
|
|
1
|
+
import { Subject, BehaviorSubject, map, takeUntil, combineLatest, switchMap, merge, EMPTY, fromEvent, withLatestFrom as withLatestFrom$1, of, scheduled, animationFrameScheduler, distinctUntilChanged as distinctUntilChanged$1, from, interval, iif, identity, take as take$1, forkJoin } from "rxjs";
|
|
2
|
+
import { withLatestFrom, distinctUntilChanged, shareReplay, tap, pairwise, filter, take, map as map$1, switchMap as switchMap$1, takeUntil as takeUntil$1, skip, debounceTime, startWith, share, exhaustMap, mergeMap, catchError, debounce, delay, mapTo } from "rxjs/operators";
|
|
2
3
|
import { parseContentType, detectMimeTypeFromName } from "@prose-reader/shared";
|
|
3
4
|
const SHOULD_NOT_LAYOUT$3 = false;
|
|
4
5
|
const chromeEnhancer = (next) => (options) => {
|
|
@@ -18,2081 +19,6 @@ const chromeEnhancer = (next) => (options) => {
|
|
|
18
19
|
});
|
|
19
20
|
return reader;
|
|
20
21
|
};
|
|
21
|
-
function isFunction(value) {
|
|
22
|
-
return typeof value === "function";
|
|
23
|
-
}
|
|
24
|
-
function hasLift(source) {
|
|
25
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
26
|
-
}
|
|
27
|
-
function operate(init) {
|
|
28
|
-
return function(source) {
|
|
29
|
-
if (hasLift(source)) {
|
|
30
|
-
return source.lift(function(liftedSource) {
|
|
31
|
-
try {
|
|
32
|
-
return init(liftedSource, this);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
this.error(err);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
throw new TypeError("Unable to lift unknown Observable type");
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var extendStatics = function(d, b) {
|
|
42
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
43
|
-
d2.__proto__ = b2;
|
|
44
|
-
} || function(d2, b2) {
|
|
45
|
-
for (var p in b2)
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
47
|
-
d2[p] = b2[p];
|
|
48
|
-
};
|
|
49
|
-
return extendStatics(d, b);
|
|
50
|
-
};
|
|
51
|
-
function __extends(d, b) {
|
|
52
|
-
if (typeof b !== "function" && b !== null)
|
|
53
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
54
|
-
extendStatics(d, b);
|
|
55
|
-
function __() {
|
|
56
|
-
this.constructor = d;
|
|
57
|
-
}
|
|
58
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
59
|
-
}
|
|
60
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
61
|
-
function adopt(value) {
|
|
62
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
63
|
-
resolve(value);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
67
|
-
function fulfilled(value) {
|
|
68
|
-
try {
|
|
69
|
-
step(generator.next(value));
|
|
70
|
-
} catch (e) {
|
|
71
|
-
reject(e);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function rejected(value) {
|
|
75
|
-
try {
|
|
76
|
-
step(generator["throw"](value));
|
|
77
|
-
} catch (e) {
|
|
78
|
-
reject(e);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function step(result) {
|
|
82
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
83
|
-
}
|
|
84
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function __generator(thisArg, body) {
|
|
88
|
-
var _ = { label: 0, sent: function() {
|
|
89
|
-
if (t[0] & 1)
|
|
90
|
-
throw t[1];
|
|
91
|
-
return t[1];
|
|
92
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
93
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
94
|
-
return this;
|
|
95
|
-
}), g;
|
|
96
|
-
function verb(n) {
|
|
97
|
-
return function(v) {
|
|
98
|
-
return step([n, v]);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function step(op) {
|
|
102
|
-
if (f)
|
|
103
|
-
throw new TypeError("Generator is already executing.");
|
|
104
|
-
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
105
|
-
try {
|
|
106
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
107
|
-
return t;
|
|
108
|
-
if (y = 0, t)
|
|
109
|
-
op = [op[0] & 2, t.value];
|
|
110
|
-
switch (op[0]) {
|
|
111
|
-
case 0:
|
|
112
|
-
case 1:
|
|
113
|
-
t = op;
|
|
114
|
-
break;
|
|
115
|
-
case 4:
|
|
116
|
-
_.label++;
|
|
117
|
-
return { value: op[1], done: false };
|
|
118
|
-
case 5:
|
|
119
|
-
_.label++;
|
|
120
|
-
y = op[1];
|
|
121
|
-
op = [0];
|
|
122
|
-
continue;
|
|
123
|
-
case 7:
|
|
124
|
-
op = _.ops.pop();
|
|
125
|
-
_.trys.pop();
|
|
126
|
-
continue;
|
|
127
|
-
default:
|
|
128
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
129
|
-
_ = 0;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
133
|
-
_.label = op[1];
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
137
|
-
_.label = t[1];
|
|
138
|
-
t = op;
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
if (t && _.label < t[2]) {
|
|
142
|
-
_.label = t[2];
|
|
143
|
-
_.ops.push(op);
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
if (t[2])
|
|
147
|
-
_.ops.pop();
|
|
148
|
-
_.trys.pop();
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
op = body.call(thisArg, _);
|
|
152
|
-
} catch (e) {
|
|
153
|
-
op = [6, e];
|
|
154
|
-
y = 0;
|
|
155
|
-
} finally {
|
|
156
|
-
f = t = 0;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] & 5)
|
|
159
|
-
throw op[1];
|
|
160
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function __values(o) {
|
|
164
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
165
|
-
if (m)
|
|
166
|
-
return m.call(o);
|
|
167
|
-
if (o && typeof o.length === "number")
|
|
168
|
-
return {
|
|
169
|
-
next: function() {
|
|
170
|
-
if (o && i >= o.length)
|
|
171
|
-
o = void 0;
|
|
172
|
-
return { value: o && o[i++], done: !o };
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
176
|
-
}
|
|
177
|
-
function __read(o, n) {
|
|
178
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
179
|
-
if (!m)
|
|
180
|
-
return o;
|
|
181
|
-
var i = m.call(o), r, ar = [], e;
|
|
182
|
-
try {
|
|
183
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
184
|
-
ar.push(r.value);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
e = { error };
|
|
187
|
-
} finally {
|
|
188
|
-
try {
|
|
189
|
-
if (r && !r.done && (m = i["return"]))
|
|
190
|
-
m.call(i);
|
|
191
|
-
} finally {
|
|
192
|
-
if (e)
|
|
193
|
-
throw e.error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return ar;
|
|
197
|
-
}
|
|
198
|
-
function __spreadArray(to, from2, pack) {
|
|
199
|
-
if (pack || arguments.length === 2)
|
|
200
|
-
for (var i = 0, l = from2.length, ar; i < l; i++) {
|
|
201
|
-
if (ar || !(i in from2)) {
|
|
202
|
-
if (!ar)
|
|
203
|
-
ar = Array.prototype.slice.call(from2, 0, i);
|
|
204
|
-
ar[i] = from2[i];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return to.concat(ar || Array.prototype.slice.call(from2));
|
|
208
|
-
}
|
|
209
|
-
function __await(v) {
|
|
210
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
211
|
-
}
|
|
212
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
213
|
-
if (!Symbol.asyncIterator)
|
|
214
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
215
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
216
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
217
|
-
return this;
|
|
218
|
-
}, i;
|
|
219
|
-
function verb(n) {
|
|
220
|
-
if (g[n])
|
|
221
|
-
i[n] = function(v) {
|
|
222
|
-
return new Promise(function(a, b) {
|
|
223
|
-
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function resume(n, v) {
|
|
228
|
-
try {
|
|
229
|
-
step(g[n](v));
|
|
230
|
-
} catch (e) {
|
|
231
|
-
settle(q[0][3], e);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
function step(r) {
|
|
235
|
-
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
236
|
-
}
|
|
237
|
-
function fulfill(value) {
|
|
238
|
-
resume("next", value);
|
|
239
|
-
}
|
|
240
|
-
function reject(value) {
|
|
241
|
-
resume("throw", value);
|
|
242
|
-
}
|
|
243
|
-
function settle(f, v) {
|
|
244
|
-
if (f(v), q.shift(), q.length)
|
|
245
|
-
resume(q[0][0], q[0][1]);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
function __asyncValues(o) {
|
|
249
|
-
if (!Symbol.asyncIterator)
|
|
250
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
251
|
-
var m = o[Symbol.asyncIterator], i;
|
|
252
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
253
|
-
return this;
|
|
254
|
-
}, i);
|
|
255
|
-
function verb(n) {
|
|
256
|
-
i[n] = o[n] && function(v) {
|
|
257
|
-
return new Promise(function(resolve, reject) {
|
|
258
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function settle(resolve, reject, d, v) {
|
|
263
|
-
Promise.resolve(v).then(function(v2) {
|
|
264
|
-
resolve({ value: v2, done: d });
|
|
265
|
-
}, reject);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
var isArrayLike = function(x) {
|
|
269
|
-
return x && typeof x.length === "number" && typeof x !== "function";
|
|
270
|
-
};
|
|
271
|
-
function isPromise(value) {
|
|
272
|
-
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
273
|
-
}
|
|
274
|
-
function createErrorClass(createImpl) {
|
|
275
|
-
var _super = function(instance) {
|
|
276
|
-
Error.call(instance);
|
|
277
|
-
instance.stack = new Error().stack;
|
|
278
|
-
};
|
|
279
|
-
var ctorFunc = createImpl(_super);
|
|
280
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
281
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
282
|
-
return ctorFunc;
|
|
283
|
-
}
|
|
284
|
-
var UnsubscriptionError = createErrorClass(function(_super) {
|
|
285
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
286
|
-
_super(this);
|
|
287
|
-
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
|
|
288
|
-
return i + 1 + ") " + err.toString();
|
|
289
|
-
}).join("\n ") : "";
|
|
290
|
-
this.name = "UnsubscriptionError";
|
|
291
|
-
this.errors = errors;
|
|
292
|
-
};
|
|
293
|
-
});
|
|
294
|
-
function arrRemove(arr, item) {
|
|
295
|
-
if (arr) {
|
|
296
|
-
var index = arr.indexOf(item);
|
|
297
|
-
0 <= index && arr.splice(index, 1);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
var Subscription = function() {
|
|
301
|
-
function Subscription2(initialTeardown) {
|
|
302
|
-
this.initialTeardown = initialTeardown;
|
|
303
|
-
this.closed = false;
|
|
304
|
-
this._parentage = null;
|
|
305
|
-
this._finalizers = null;
|
|
306
|
-
}
|
|
307
|
-
Subscription2.prototype.unsubscribe = function() {
|
|
308
|
-
var e_1, _a, e_2, _b;
|
|
309
|
-
var errors;
|
|
310
|
-
if (!this.closed) {
|
|
311
|
-
this.closed = true;
|
|
312
|
-
var _parentage = this._parentage;
|
|
313
|
-
if (_parentage) {
|
|
314
|
-
this._parentage = null;
|
|
315
|
-
if (Array.isArray(_parentage)) {
|
|
316
|
-
try {
|
|
317
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
318
|
-
var parent_1 = _parentage_1_1.value;
|
|
319
|
-
parent_1.remove(this);
|
|
320
|
-
}
|
|
321
|
-
} catch (e_1_1) {
|
|
322
|
-
e_1 = { error: e_1_1 };
|
|
323
|
-
} finally {
|
|
324
|
-
try {
|
|
325
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return))
|
|
326
|
-
_a.call(_parentage_1);
|
|
327
|
-
} finally {
|
|
328
|
-
if (e_1)
|
|
329
|
-
throw e_1.error;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
} else {
|
|
333
|
-
_parentage.remove(this);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
var initialFinalizer = this.initialTeardown;
|
|
337
|
-
if (isFunction(initialFinalizer)) {
|
|
338
|
-
try {
|
|
339
|
-
initialFinalizer();
|
|
340
|
-
} catch (e) {
|
|
341
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
var _finalizers = this._finalizers;
|
|
345
|
-
if (_finalizers) {
|
|
346
|
-
this._finalizers = null;
|
|
347
|
-
try {
|
|
348
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
349
|
-
var finalizer = _finalizers_1_1.value;
|
|
350
|
-
try {
|
|
351
|
-
execFinalizer(finalizer);
|
|
352
|
-
} catch (err) {
|
|
353
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
354
|
-
if (err instanceof UnsubscriptionError) {
|
|
355
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
356
|
-
} else {
|
|
357
|
-
errors.push(err);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
} catch (e_2_1) {
|
|
362
|
-
e_2 = { error: e_2_1 };
|
|
363
|
-
} finally {
|
|
364
|
-
try {
|
|
365
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
|
|
366
|
-
_b.call(_finalizers_1);
|
|
367
|
-
} finally {
|
|
368
|
-
if (e_2)
|
|
369
|
-
throw e_2.error;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
if (errors) {
|
|
374
|
-
throw new UnsubscriptionError(errors);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
Subscription2.prototype.add = function(teardown) {
|
|
379
|
-
var _a;
|
|
380
|
-
if (teardown && teardown !== this) {
|
|
381
|
-
if (this.closed) {
|
|
382
|
-
execFinalizer(teardown);
|
|
383
|
-
} else {
|
|
384
|
-
if (teardown instanceof Subscription2) {
|
|
385
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
teardown._addParent(this);
|
|
389
|
-
}
|
|
390
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
Subscription2.prototype._hasParent = function(parent) {
|
|
395
|
-
var _parentage = this._parentage;
|
|
396
|
-
return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
|
|
397
|
-
};
|
|
398
|
-
Subscription2.prototype._addParent = function(parent) {
|
|
399
|
-
var _parentage = this._parentage;
|
|
400
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
401
|
-
};
|
|
402
|
-
Subscription2.prototype._removeParent = function(parent) {
|
|
403
|
-
var _parentage = this._parentage;
|
|
404
|
-
if (_parentage === parent) {
|
|
405
|
-
this._parentage = null;
|
|
406
|
-
} else if (Array.isArray(_parentage)) {
|
|
407
|
-
arrRemove(_parentage, parent);
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
Subscription2.prototype.remove = function(teardown) {
|
|
411
|
-
var _finalizers = this._finalizers;
|
|
412
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
413
|
-
if (teardown instanceof Subscription2) {
|
|
414
|
-
teardown._removeParent(this);
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
Subscription2.EMPTY = function() {
|
|
418
|
-
var empty = new Subscription2();
|
|
419
|
-
empty.closed = true;
|
|
420
|
-
return empty;
|
|
421
|
-
}();
|
|
422
|
-
return Subscription2;
|
|
423
|
-
}();
|
|
424
|
-
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
425
|
-
function isSubscription(value) {
|
|
426
|
-
return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
|
|
427
|
-
}
|
|
428
|
-
function execFinalizer(finalizer) {
|
|
429
|
-
if (isFunction(finalizer)) {
|
|
430
|
-
finalizer();
|
|
431
|
-
} else {
|
|
432
|
-
finalizer.unsubscribe();
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
var config = {
|
|
436
|
-
onUnhandledError: null,
|
|
437
|
-
onStoppedNotification: null,
|
|
438
|
-
Promise: void 0,
|
|
439
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
440
|
-
useDeprecatedNextContext: false
|
|
441
|
-
};
|
|
442
|
-
var timeoutProvider = {
|
|
443
|
-
setTimeout: function(handler, timeout) {
|
|
444
|
-
var args = [];
|
|
445
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
446
|
-
args[_i - 2] = arguments[_i];
|
|
447
|
-
}
|
|
448
|
-
var delegate = timeoutProvider.delegate;
|
|
449
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
450
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
451
|
-
}
|
|
452
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
453
|
-
},
|
|
454
|
-
clearTimeout: function(handle) {
|
|
455
|
-
var delegate = timeoutProvider.delegate;
|
|
456
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
457
|
-
},
|
|
458
|
-
delegate: void 0
|
|
459
|
-
};
|
|
460
|
-
function reportUnhandledError(err) {
|
|
461
|
-
timeoutProvider.setTimeout(function() {
|
|
462
|
-
{
|
|
463
|
-
throw err;
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
function noop() {
|
|
468
|
-
}
|
|
469
|
-
function errorContext(cb) {
|
|
470
|
-
{
|
|
471
|
-
cb();
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
var Subscriber = function(_super) {
|
|
475
|
-
__extends(Subscriber2, _super);
|
|
476
|
-
function Subscriber2(destination) {
|
|
477
|
-
var _this = _super.call(this) || this;
|
|
478
|
-
_this.isStopped = false;
|
|
479
|
-
if (destination) {
|
|
480
|
-
_this.destination = destination;
|
|
481
|
-
if (isSubscription(destination)) {
|
|
482
|
-
destination.add(_this);
|
|
483
|
-
}
|
|
484
|
-
} else {
|
|
485
|
-
_this.destination = EMPTY_OBSERVER;
|
|
486
|
-
}
|
|
487
|
-
return _this;
|
|
488
|
-
}
|
|
489
|
-
Subscriber2.create = function(next, error, complete) {
|
|
490
|
-
return new SafeSubscriber(next, error, complete);
|
|
491
|
-
};
|
|
492
|
-
Subscriber2.prototype.next = function(value) {
|
|
493
|
-
if (this.isStopped)
|
|
494
|
-
;
|
|
495
|
-
else {
|
|
496
|
-
this._next(value);
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
Subscriber2.prototype.error = function(err) {
|
|
500
|
-
if (this.isStopped)
|
|
501
|
-
;
|
|
502
|
-
else {
|
|
503
|
-
this.isStopped = true;
|
|
504
|
-
this._error(err);
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
Subscriber2.prototype.complete = function() {
|
|
508
|
-
if (this.isStopped)
|
|
509
|
-
;
|
|
510
|
-
else {
|
|
511
|
-
this.isStopped = true;
|
|
512
|
-
this._complete();
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
Subscriber2.prototype.unsubscribe = function() {
|
|
516
|
-
if (!this.closed) {
|
|
517
|
-
this.isStopped = true;
|
|
518
|
-
_super.prototype.unsubscribe.call(this);
|
|
519
|
-
this.destination = null;
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
Subscriber2.prototype._next = function(value) {
|
|
523
|
-
this.destination.next(value);
|
|
524
|
-
};
|
|
525
|
-
Subscriber2.prototype._error = function(err) {
|
|
526
|
-
try {
|
|
527
|
-
this.destination.error(err);
|
|
528
|
-
} finally {
|
|
529
|
-
this.unsubscribe();
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
Subscriber2.prototype._complete = function() {
|
|
533
|
-
try {
|
|
534
|
-
this.destination.complete();
|
|
535
|
-
} finally {
|
|
536
|
-
this.unsubscribe();
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
return Subscriber2;
|
|
540
|
-
}(Subscription);
|
|
541
|
-
var _bind = Function.prototype.bind;
|
|
542
|
-
function bind(fn, thisArg) {
|
|
543
|
-
return _bind.call(fn, thisArg);
|
|
544
|
-
}
|
|
545
|
-
var ConsumerObserver = function() {
|
|
546
|
-
function ConsumerObserver2(partialObserver) {
|
|
547
|
-
this.partialObserver = partialObserver;
|
|
548
|
-
}
|
|
549
|
-
ConsumerObserver2.prototype.next = function(value) {
|
|
550
|
-
var partialObserver = this.partialObserver;
|
|
551
|
-
if (partialObserver.next) {
|
|
552
|
-
try {
|
|
553
|
-
partialObserver.next(value);
|
|
554
|
-
} catch (error) {
|
|
555
|
-
handleUnhandledError(error);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
ConsumerObserver2.prototype.error = function(err) {
|
|
560
|
-
var partialObserver = this.partialObserver;
|
|
561
|
-
if (partialObserver.error) {
|
|
562
|
-
try {
|
|
563
|
-
partialObserver.error(err);
|
|
564
|
-
} catch (error) {
|
|
565
|
-
handleUnhandledError(error);
|
|
566
|
-
}
|
|
567
|
-
} else {
|
|
568
|
-
handleUnhandledError(err);
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
ConsumerObserver2.prototype.complete = function() {
|
|
572
|
-
var partialObserver = this.partialObserver;
|
|
573
|
-
if (partialObserver.complete) {
|
|
574
|
-
try {
|
|
575
|
-
partialObserver.complete();
|
|
576
|
-
} catch (error) {
|
|
577
|
-
handleUnhandledError(error);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
return ConsumerObserver2;
|
|
582
|
-
}();
|
|
583
|
-
var SafeSubscriber = function(_super) {
|
|
584
|
-
__extends(SafeSubscriber2, _super);
|
|
585
|
-
function SafeSubscriber2(observerOrNext, error, complete) {
|
|
586
|
-
var _this = _super.call(this) || this;
|
|
587
|
-
var partialObserver;
|
|
588
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
589
|
-
partialObserver = {
|
|
590
|
-
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
|
|
591
|
-
error: error !== null && error !== void 0 ? error : void 0,
|
|
592
|
-
complete: complete !== null && complete !== void 0 ? complete : void 0
|
|
593
|
-
};
|
|
594
|
-
} else {
|
|
595
|
-
var context_1;
|
|
596
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
597
|
-
context_1 = Object.create(observerOrNext);
|
|
598
|
-
context_1.unsubscribe = function() {
|
|
599
|
-
return _this.unsubscribe();
|
|
600
|
-
};
|
|
601
|
-
partialObserver = {
|
|
602
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
603
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
604
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
|
|
605
|
-
};
|
|
606
|
-
} else {
|
|
607
|
-
partialObserver = observerOrNext;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
611
|
-
return _this;
|
|
612
|
-
}
|
|
613
|
-
return SafeSubscriber2;
|
|
614
|
-
}(Subscriber);
|
|
615
|
-
function handleUnhandledError(error) {
|
|
616
|
-
{
|
|
617
|
-
reportUnhandledError(error);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
function defaultErrorHandler(err) {
|
|
621
|
-
throw err;
|
|
622
|
-
}
|
|
623
|
-
var EMPTY_OBSERVER = {
|
|
624
|
-
closed: true,
|
|
625
|
-
next: noop,
|
|
626
|
-
error: defaultErrorHandler,
|
|
627
|
-
complete: noop
|
|
628
|
-
};
|
|
629
|
-
var observable = function() {
|
|
630
|
-
return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
631
|
-
}();
|
|
632
|
-
function identity(x) {
|
|
633
|
-
return x;
|
|
634
|
-
}
|
|
635
|
-
function pipeFromArray(fns) {
|
|
636
|
-
if (fns.length === 0) {
|
|
637
|
-
return identity;
|
|
638
|
-
}
|
|
639
|
-
if (fns.length === 1) {
|
|
640
|
-
return fns[0];
|
|
641
|
-
}
|
|
642
|
-
return function piped(input) {
|
|
643
|
-
return fns.reduce(function(prev, fn) {
|
|
644
|
-
return fn(prev);
|
|
645
|
-
}, input);
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
var Observable = function() {
|
|
649
|
-
function Observable2(subscribe) {
|
|
650
|
-
if (subscribe) {
|
|
651
|
-
this._subscribe = subscribe;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
Observable2.prototype.lift = function(operator) {
|
|
655
|
-
var observable2 = new Observable2();
|
|
656
|
-
observable2.source = this;
|
|
657
|
-
observable2.operator = operator;
|
|
658
|
-
return observable2;
|
|
659
|
-
};
|
|
660
|
-
Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
|
|
661
|
-
var _this = this;
|
|
662
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
663
|
-
errorContext(function() {
|
|
664
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
665
|
-
subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
|
|
666
|
-
});
|
|
667
|
-
return subscriber;
|
|
668
|
-
};
|
|
669
|
-
Observable2.prototype._trySubscribe = function(sink) {
|
|
670
|
-
try {
|
|
671
|
-
return this._subscribe(sink);
|
|
672
|
-
} catch (err) {
|
|
673
|
-
sink.error(err);
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
677
|
-
var _this = this;
|
|
678
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
679
|
-
return new promiseCtor(function(resolve, reject) {
|
|
680
|
-
var subscriber = new SafeSubscriber({
|
|
681
|
-
next: function(value) {
|
|
682
|
-
try {
|
|
683
|
-
next(value);
|
|
684
|
-
} catch (err) {
|
|
685
|
-
reject(err);
|
|
686
|
-
subscriber.unsubscribe();
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
error: reject,
|
|
690
|
-
complete: resolve
|
|
691
|
-
});
|
|
692
|
-
_this.subscribe(subscriber);
|
|
693
|
-
});
|
|
694
|
-
};
|
|
695
|
-
Observable2.prototype._subscribe = function(subscriber) {
|
|
696
|
-
var _a;
|
|
697
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
698
|
-
};
|
|
699
|
-
Observable2.prototype[observable] = function() {
|
|
700
|
-
return this;
|
|
701
|
-
};
|
|
702
|
-
Observable2.prototype.pipe = function() {
|
|
703
|
-
var operations = [];
|
|
704
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
705
|
-
operations[_i] = arguments[_i];
|
|
706
|
-
}
|
|
707
|
-
return pipeFromArray(operations)(this);
|
|
708
|
-
};
|
|
709
|
-
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
710
|
-
var _this = this;
|
|
711
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
712
|
-
return new promiseCtor(function(resolve, reject) {
|
|
713
|
-
var value;
|
|
714
|
-
_this.subscribe(function(x) {
|
|
715
|
-
return value = x;
|
|
716
|
-
}, function(err) {
|
|
717
|
-
return reject(err);
|
|
718
|
-
}, function() {
|
|
719
|
-
return resolve(value);
|
|
720
|
-
});
|
|
721
|
-
});
|
|
722
|
-
};
|
|
723
|
-
Observable2.create = function(subscribe) {
|
|
724
|
-
return new Observable2(subscribe);
|
|
725
|
-
};
|
|
726
|
-
return Observable2;
|
|
727
|
-
}();
|
|
728
|
-
function getPromiseCtor(promiseCtor) {
|
|
729
|
-
var _a;
|
|
730
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
731
|
-
}
|
|
732
|
-
function isObserver(value) {
|
|
733
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
734
|
-
}
|
|
735
|
-
function isSubscriber(value) {
|
|
736
|
-
return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
|
|
737
|
-
}
|
|
738
|
-
function isInteropObservable(input) {
|
|
739
|
-
return isFunction(input[observable]);
|
|
740
|
-
}
|
|
741
|
-
function isAsyncIterable(obj) {
|
|
742
|
-
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
743
|
-
}
|
|
744
|
-
function createInvalidObservableTypeError(input) {
|
|
745
|
-
return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
746
|
-
}
|
|
747
|
-
function getSymbolIterator() {
|
|
748
|
-
if (typeof Symbol !== "function" || !Symbol.iterator) {
|
|
749
|
-
return "@@iterator";
|
|
750
|
-
}
|
|
751
|
-
return Symbol.iterator;
|
|
752
|
-
}
|
|
753
|
-
var iterator = getSymbolIterator();
|
|
754
|
-
function isIterable(input) {
|
|
755
|
-
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
756
|
-
}
|
|
757
|
-
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
758
|
-
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
759
|
-
var reader, _a, value, done;
|
|
760
|
-
return __generator(this, function(_b) {
|
|
761
|
-
switch (_b.label) {
|
|
762
|
-
case 0:
|
|
763
|
-
reader = readableStream.getReader();
|
|
764
|
-
_b.label = 1;
|
|
765
|
-
case 1:
|
|
766
|
-
_b.trys.push([1, , 9, 10]);
|
|
767
|
-
_b.label = 2;
|
|
768
|
-
case 2:
|
|
769
|
-
return [4, __await(reader.read())];
|
|
770
|
-
case 3:
|
|
771
|
-
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
772
|
-
if (!done)
|
|
773
|
-
return [3, 5];
|
|
774
|
-
return [4, __await(void 0)];
|
|
775
|
-
case 4:
|
|
776
|
-
return [2, _b.sent()];
|
|
777
|
-
case 5:
|
|
778
|
-
return [4, __await(value)];
|
|
779
|
-
case 6:
|
|
780
|
-
return [4, _b.sent()];
|
|
781
|
-
case 7:
|
|
782
|
-
_b.sent();
|
|
783
|
-
return [3, 2];
|
|
784
|
-
case 8:
|
|
785
|
-
return [3, 10];
|
|
786
|
-
case 9:
|
|
787
|
-
reader.releaseLock();
|
|
788
|
-
return [7];
|
|
789
|
-
case 10:
|
|
790
|
-
return [2];
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
function isReadableStreamLike(obj) {
|
|
796
|
-
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
797
|
-
}
|
|
798
|
-
function innerFrom(input) {
|
|
799
|
-
if (input instanceof Observable) {
|
|
800
|
-
return input;
|
|
801
|
-
}
|
|
802
|
-
if (input != null) {
|
|
803
|
-
if (isInteropObservable(input)) {
|
|
804
|
-
return fromInteropObservable(input);
|
|
805
|
-
}
|
|
806
|
-
if (isArrayLike(input)) {
|
|
807
|
-
return fromArrayLike(input);
|
|
808
|
-
}
|
|
809
|
-
if (isPromise(input)) {
|
|
810
|
-
return fromPromise(input);
|
|
811
|
-
}
|
|
812
|
-
if (isAsyncIterable(input)) {
|
|
813
|
-
return fromAsyncIterable(input);
|
|
814
|
-
}
|
|
815
|
-
if (isIterable(input)) {
|
|
816
|
-
return fromIterable(input);
|
|
817
|
-
}
|
|
818
|
-
if (isReadableStreamLike(input)) {
|
|
819
|
-
return fromReadableStreamLike(input);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
throw createInvalidObservableTypeError(input);
|
|
823
|
-
}
|
|
824
|
-
function fromInteropObservable(obj) {
|
|
825
|
-
return new Observable(function(subscriber) {
|
|
826
|
-
var obs = obj[observable]();
|
|
827
|
-
if (isFunction(obs.subscribe)) {
|
|
828
|
-
return obs.subscribe(subscriber);
|
|
829
|
-
}
|
|
830
|
-
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
function fromArrayLike(array) {
|
|
834
|
-
return new Observable(function(subscriber) {
|
|
835
|
-
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
836
|
-
subscriber.next(array[i]);
|
|
837
|
-
}
|
|
838
|
-
subscriber.complete();
|
|
839
|
-
});
|
|
840
|
-
}
|
|
841
|
-
function fromPromise(promise) {
|
|
842
|
-
return new Observable(function(subscriber) {
|
|
843
|
-
promise.then(function(value) {
|
|
844
|
-
if (!subscriber.closed) {
|
|
845
|
-
subscriber.next(value);
|
|
846
|
-
subscriber.complete();
|
|
847
|
-
}
|
|
848
|
-
}, function(err) {
|
|
849
|
-
return subscriber.error(err);
|
|
850
|
-
}).then(null, reportUnhandledError);
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
function fromIterable(iterable) {
|
|
854
|
-
return new Observable(function(subscriber) {
|
|
855
|
-
var e_1, _a;
|
|
856
|
-
try {
|
|
857
|
-
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
858
|
-
var value = iterable_1_1.value;
|
|
859
|
-
subscriber.next(value);
|
|
860
|
-
if (subscriber.closed) {
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
} catch (e_1_1) {
|
|
865
|
-
e_1 = { error: e_1_1 };
|
|
866
|
-
} finally {
|
|
867
|
-
try {
|
|
868
|
-
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return))
|
|
869
|
-
_a.call(iterable_1);
|
|
870
|
-
} finally {
|
|
871
|
-
if (e_1)
|
|
872
|
-
throw e_1.error;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
subscriber.complete();
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
function fromAsyncIterable(asyncIterable) {
|
|
879
|
-
return new Observable(function(subscriber) {
|
|
880
|
-
process(asyncIterable, subscriber).catch(function(err) {
|
|
881
|
-
return subscriber.error(err);
|
|
882
|
-
});
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
function fromReadableStreamLike(readableStream) {
|
|
886
|
-
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
887
|
-
}
|
|
888
|
-
function process(asyncIterable, subscriber) {
|
|
889
|
-
var asyncIterable_1, asyncIterable_1_1;
|
|
890
|
-
var e_2, _a;
|
|
891
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
892
|
-
var value, e_2_1;
|
|
893
|
-
return __generator(this, function(_b) {
|
|
894
|
-
switch (_b.label) {
|
|
895
|
-
case 0:
|
|
896
|
-
_b.trys.push([0, 5, 6, 11]);
|
|
897
|
-
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
898
|
-
_b.label = 1;
|
|
899
|
-
case 1:
|
|
900
|
-
return [4, asyncIterable_1.next()];
|
|
901
|
-
case 2:
|
|
902
|
-
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done))
|
|
903
|
-
return [3, 4];
|
|
904
|
-
value = asyncIterable_1_1.value;
|
|
905
|
-
subscriber.next(value);
|
|
906
|
-
if (subscriber.closed) {
|
|
907
|
-
return [2];
|
|
908
|
-
}
|
|
909
|
-
_b.label = 3;
|
|
910
|
-
case 3:
|
|
911
|
-
return [3, 1];
|
|
912
|
-
case 4:
|
|
913
|
-
return [3, 11];
|
|
914
|
-
case 5:
|
|
915
|
-
e_2_1 = _b.sent();
|
|
916
|
-
e_2 = { error: e_2_1 };
|
|
917
|
-
return [3, 11];
|
|
918
|
-
case 6:
|
|
919
|
-
_b.trys.push([6, , 9, 10]);
|
|
920
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)))
|
|
921
|
-
return [3, 8];
|
|
922
|
-
return [4, _a.call(asyncIterable_1)];
|
|
923
|
-
case 7:
|
|
924
|
-
_b.sent();
|
|
925
|
-
_b.label = 8;
|
|
926
|
-
case 8:
|
|
927
|
-
return [3, 10];
|
|
928
|
-
case 9:
|
|
929
|
-
if (e_2)
|
|
930
|
-
throw e_2.error;
|
|
931
|
-
return [7];
|
|
932
|
-
case 10:
|
|
933
|
-
return [7];
|
|
934
|
-
case 11:
|
|
935
|
-
subscriber.complete();
|
|
936
|
-
return [2];
|
|
937
|
-
}
|
|
938
|
-
});
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
942
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
943
|
-
}
|
|
944
|
-
var OperatorSubscriber = function(_super) {
|
|
945
|
-
__extends(OperatorSubscriber2, _super);
|
|
946
|
-
function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
947
|
-
var _this = _super.call(this, destination) || this;
|
|
948
|
-
_this.onFinalize = onFinalize;
|
|
949
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
950
|
-
_this._next = onNext ? function(value) {
|
|
951
|
-
try {
|
|
952
|
-
onNext(value);
|
|
953
|
-
} catch (err) {
|
|
954
|
-
destination.error(err);
|
|
955
|
-
}
|
|
956
|
-
} : _super.prototype._next;
|
|
957
|
-
_this._error = onError ? function(err) {
|
|
958
|
-
try {
|
|
959
|
-
onError(err);
|
|
960
|
-
} catch (err2) {
|
|
961
|
-
destination.error(err2);
|
|
962
|
-
} finally {
|
|
963
|
-
this.unsubscribe();
|
|
964
|
-
}
|
|
965
|
-
} : _super.prototype._error;
|
|
966
|
-
_this._complete = onComplete ? function() {
|
|
967
|
-
try {
|
|
968
|
-
onComplete();
|
|
969
|
-
} catch (err) {
|
|
970
|
-
destination.error(err);
|
|
971
|
-
} finally {
|
|
972
|
-
this.unsubscribe();
|
|
973
|
-
}
|
|
974
|
-
} : _super.prototype._complete;
|
|
975
|
-
return _this;
|
|
976
|
-
}
|
|
977
|
-
OperatorSubscriber2.prototype.unsubscribe = function() {
|
|
978
|
-
var _a;
|
|
979
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
980
|
-
var closed_1 = this.closed;
|
|
981
|
-
_super.prototype.unsubscribe.call(this);
|
|
982
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
return OperatorSubscriber2;
|
|
986
|
-
}(Subscriber);
|
|
987
|
-
var Action = function(_super) {
|
|
988
|
-
__extends(Action2, _super);
|
|
989
|
-
function Action2(scheduler, work) {
|
|
990
|
-
return _super.call(this) || this;
|
|
991
|
-
}
|
|
992
|
-
Action2.prototype.schedule = function(state, delay2) {
|
|
993
|
-
return this;
|
|
994
|
-
};
|
|
995
|
-
return Action2;
|
|
996
|
-
}(Subscription);
|
|
997
|
-
var intervalProvider = {
|
|
998
|
-
setInterval: function(handler, timeout) {
|
|
999
|
-
var args = [];
|
|
1000
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1001
|
-
args[_i - 2] = arguments[_i];
|
|
1002
|
-
}
|
|
1003
|
-
var delegate = intervalProvider.delegate;
|
|
1004
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
1005
|
-
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
1006
|
-
}
|
|
1007
|
-
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
1008
|
-
},
|
|
1009
|
-
clearInterval: function(handle) {
|
|
1010
|
-
var delegate = intervalProvider.delegate;
|
|
1011
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
|
|
1012
|
-
},
|
|
1013
|
-
delegate: void 0
|
|
1014
|
-
};
|
|
1015
|
-
var AsyncAction = function(_super) {
|
|
1016
|
-
__extends(AsyncAction2, _super);
|
|
1017
|
-
function AsyncAction2(scheduler, work) {
|
|
1018
|
-
var _this = _super.call(this, scheduler, work) || this;
|
|
1019
|
-
_this.scheduler = scheduler;
|
|
1020
|
-
_this.work = work;
|
|
1021
|
-
_this.pending = false;
|
|
1022
|
-
return _this;
|
|
1023
|
-
}
|
|
1024
|
-
AsyncAction2.prototype.schedule = function(state, delay2) {
|
|
1025
|
-
var _a;
|
|
1026
|
-
if (delay2 === void 0) {
|
|
1027
|
-
delay2 = 0;
|
|
1028
|
-
}
|
|
1029
|
-
if (this.closed) {
|
|
1030
|
-
return this;
|
|
1031
|
-
}
|
|
1032
|
-
this.state = state;
|
|
1033
|
-
var id = this.id;
|
|
1034
|
-
var scheduler = this.scheduler;
|
|
1035
|
-
if (id != null) {
|
|
1036
|
-
this.id = this.recycleAsyncId(scheduler, id, delay2);
|
|
1037
|
-
}
|
|
1038
|
-
this.pending = true;
|
|
1039
|
-
this.delay = delay2;
|
|
1040
|
-
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay2);
|
|
1041
|
-
return this;
|
|
1042
|
-
};
|
|
1043
|
-
AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay2) {
|
|
1044
|
-
if (delay2 === void 0) {
|
|
1045
|
-
delay2 = 0;
|
|
1046
|
-
}
|
|
1047
|
-
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay2);
|
|
1048
|
-
};
|
|
1049
|
-
AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay2) {
|
|
1050
|
-
if (delay2 === void 0) {
|
|
1051
|
-
delay2 = 0;
|
|
1052
|
-
}
|
|
1053
|
-
if (delay2 != null && this.delay === delay2 && this.pending === false) {
|
|
1054
|
-
return id;
|
|
1055
|
-
}
|
|
1056
|
-
if (id != null) {
|
|
1057
|
-
intervalProvider.clearInterval(id);
|
|
1058
|
-
}
|
|
1059
|
-
return void 0;
|
|
1060
|
-
};
|
|
1061
|
-
AsyncAction2.prototype.execute = function(state, delay2) {
|
|
1062
|
-
if (this.closed) {
|
|
1063
|
-
return new Error("executing a cancelled action");
|
|
1064
|
-
}
|
|
1065
|
-
this.pending = false;
|
|
1066
|
-
var error = this._execute(state, delay2);
|
|
1067
|
-
if (error) {
|
|
1068
|
-
return error;
|
|
1069
|
-
} else if (this.pending === false && this.id != null) {
|
|
1070
|
-
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
AsyncAction2.prototype._execute = function(state, _delay) {
|
|
1074
|
-
var errored = false;
|
|
1075
|
-
var errorValue;
|
|
1076
|
-
try {
|
|
1077
|
-
this.work(state);
|
|
1078
|
-
} catch (e) {
|
|
1079
|
-
errored = true;
|
|
1080
|
-
errorValue = e ? e : new Error("Scheduled action threw falsy error");
|
|
1081
|
-
}
|
|
1082
|
-
if (errored) {
|
|
1083
|
-
this.unsubscribe();
|
|
1084
|
-
return errorValue;
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
AsyncAction2.prototype.unsubscribe = function() {
|
|
1088
|
-
if (!this.closed) {
|
|
1089
|
-
var _a = this, id = _a.id, scheduler = _a.scheduler;
|
|
1090
|
-
var actions = scheduler.actions;
|
|
1091
|
-
this.work = this.state = this.scheduler = null;
|
|
1092
|
-
this.pending = false;
|
|
1093
|
-
arrRemove(actions, this);
|
|
1094
|
-
if (id != null) {
|
|
1095
|
-
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
1096
|
-
}
|
|
1097
|
-
this.delay = null;
|
|
1098
|
-
_super.prototype.unsubscribe.call(this);
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
return AsyncAction2;
|
|
1102
|
-
}(Action);
|
|
1103
|
-
var dateTimestampProvider = {
|
|
1104
|
-
now: function() {
|
|
1105
|
-
return (dateTimestampProvider.delegate || Date).now();
|
|
1106
|
-
},
|
|
1107
|
-
delegate: void 0
|
|
1108
|
-
};
|
|
1109
|
-
var Scheduler = function() {
|
|
1110
|
-
function Scheduler2(schedulerActionCtor, now) {
|
|
1111
|
-
if (now === void 0) {
|
|
1112
|
-
now = Scheduler2.now;
|
|
1113
|
-
}
|
|
1114
|
-
this.schedulerActionCtor = schedulerActionCtor;
|
|
1115
|
-
this.now = now;
|
|
1116
|
-
}
|
|
1117
|
-
Scheduler2.prototype.schedule = function(work, delay2, state) {
|
|
1118
|
-
if (delay2 === void 0) {
|
|
1119
|
-
delay2 = 0;
|
|
1120
|
-
}
|
|
1121
|
-
return new this.schedulerActionCtor(this, work).schedule(state, delay2);
|
|
1122
|
-
};
|
|
1123
|
-
Scheduler2.now = dateTimestampProvider.now;
|
|
1124
|
-
return Scheduler2;
|
|
1125
|
-
}();
|
|
1126
|
-
var AsyncScheduler = function(_super) {
|
|
1127
|
-
__extends(AsyncScheduler2, _super);
|
|
1128
|
-
function AsyncScheduler2(SchedulerAction, now) {
|
|
1129
|
-
if (now === void 0) {
|
|
1130
|
-
now = Scheduler.now;
|
|
1131
|
-
}
|
|
1132
|
-
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1133
|
-
_this.actions = [];
|
|
1134
|
-
_this._active = false;
|
|
1135
|
-
return _this;
|
|
1136
|
-
}
|
|
1137
|
-
AsyncScheduler2.prototype.flush = function(action) {
|
|
1138
|
-
var actions = this.actions;
|
|
1139
|
-
if (this._active) {
|
|
1140
|
-
actions.push(action);
|
|
1141
|
-
return;
|
|
1142
|
-
}
|
|
1143
|
-
var error;
|
|
1144
|
-
this._active = true;
|
|
1145
|
-
do {
|
|
1146
|
-
if (error = action.execute(action.state, action.delay)) {
|
|
1147
|
-
break;
|
|
1148
|
-
}
|
|
1149
|
-
} while (action = actions.shift());
|
|
1150
|
-
this._active = false;
|
|
1151
|
-
if (error) {
|
|
1152
|
-
while (action = actions.shift()) {
|
|
1153
|
-
action.unsubscribe();
|
|
1154
|
-
}
|
|
1155
|
-
throw error;
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1158
|
-
return AsyncScheduler2;
|
|
1159
|
-
}(Scheduler);
|
|
1160
|
-
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
1161
|
-
var async = asyncScheduler;
|
|
1162
|
-
function isScheduler(value) {
|
|
1163
|
-
return value && isFunction(value.schedule);
|
|
1164
|
-
}
|
|
1165
|
-
function isValidDate(value) {
|
|
1166
|
-
return value instanceof Date && !isNaN(value);
|
|
1167
|
-
}
|
|
1168
|
-
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1169
|
-
if (dueTime === void 0) {
|
|
1170
|
-
dueTime = 0;
|
|
1171
|
-
}
|
|
1172
|
-
if (scheduler === void 0) {
|
|
1173
|
-
scheduler = async;
|
|
1174
|
-
}
|
|
1175
|
-
var intervalDuration = -1;
|
|
1176
|
-
if (intervalOrScheduler != null) {
|
|
1177
|
-
if (isScheduler(intervalOrScheduler)) {
|
|
1178
|
-
scheduler = intervalOrScheduler;
|
|
1179
|
-
} else {
|
|
1180
|
-
intervalDuration = intervalOrScheduler;
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
return new Observable(function(subscriber) {
|
|
1184
|
-
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
1185
|
-
if (due < 0) {
|
|
1186
|
-
due = 0;
|
|
1187
|
-
}
|
|
1188
|
-
var n = 0;
|
|
1189
|
-
return scheduler.schedule(function() {
|
|
1190
|
-
if (!subscriber.closed) {
|
|
1191
|
-
subscriber.next(n++);
|
|
1192
|
-
if (0 <= intervalDuration) {
|
|
1193
|
-
this.schedule(void 0, intervalDuration);
|
|
1194
|
-
} else {
|
|
1195
|
-
subscriber.complete();
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}, due);
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
function last(arr) {
|
|
1202
|
-
return arr[arr.length - 1];
|
|
1203
|
-
}
|
|
1204
|
-
function popResultSelector(args) {
|
|
1205
|
-
return isFunction(last(args)) ? args.pop() : void 0;
|
|
1206
|
-
}
|
|
1207
|
-
function popScheduler(args) {
|
|
1208
|
-
return isScheduler(last(args)) ? args.pop() : void 0;
|
|
1209
|
-
}
|
|
1210
|
-
function executeSchedule(parentSubscription, scheduler, work, delay2, repeat) {
|
|
1211
|
-
if (delay2 === void 0) {
|
|
1212
|
-
delay2 = 0;
|
|
1213
|
-
}
|
|
1214
|
-
if (repeat === void 0) {
|
|
1215
|
-
repeat = false;
|
|
1216
|
-
}
|
|
1217
|
-
var scheduleSubscription = scheduler.schedule(function() {
|
|
1218
|
-
work();
|
|
1219
|
-
if (repeat) {
|
|
1220
|
-
parentSubscription.add(this.schedule(null, delay2));
|
|
1221
|
-
} else {
|
|
1222
|
-
this.unsubscribe();
|
|
1223
|
-
}
|
|
1224
|
-
}, delay2);
|
|
1225
|
-
parentSubscription.add(scheduleSubscription);
|
|
1226
|
-
if (!repeat) {
|
|
1227
|
-
return scheduleSubscription;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
function catchError(selector) {
|
|
1231
|
-
return operate(function(source, subscriber) {
|
|
1232
|
-
var innerSub = null;
|
|
1233
|
-
var syncUnsub = false;
|
|
1234
|
-
var handledResult;
|
|
1235
|
-
innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
|
|
1236
|
-
handledResult = innerFrom(selector(err, catchError(selector)(source)));
|
|
1237
|
-
if (innerSub) {
|
|
1238
|
-
innerSub.unsubscribe();
|
|
1239
|
-
innerSub = null;
|
|
1240
|
-
handledResult.subscribe(subscriber);
|
|
1241
|
-
} else {
|
|
1242
|
-
syncUnsub = true;
|
|
1243
|
-
}
|
|
1244
|
-
}));
|
|
1245
|
-
if (syncUnsub) {
|
|
1246
|
-
innerSub.unsubscribe();
|
|
1247
|
-
innerSub = null;
|
|
1248
|
-
handledResult.subscribe(subscriber);
|
|
1249
|
-
}
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
function observeOn(scheduler, delay2) {
|
|
1253
|
-
if (delay2 === void 0) {
|
|
1254
|
-
delay2 = 0;
|
|
1255
|
-
}
|
|
1256
|
-
return operate(function(source, subscriber) {
|
|
1257
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1258
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1259
|
-
return subscriber.next(value);
|
|
1260
|
-
}, delay2);
|
|
1261
|
-
}, function() {
|
|
1262
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1263
|
-
return subscriber.complete();
|
|
1264
|
-
}, delay2);
|
|
1265
|
-
}, function(err) {
|
|
1266
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1267
|
-
return subscriber.error(err);
|
|
1268
|
-
}, delay2);
|
|
1269
|
-
}));
|
|
1270
|
-
});
|
|
1271
|
-
}
|
|
1272
|
-
function subscribeOn(scheduler, delay2) {
|
|
1273
|
-
if (delay2 === void 0) {
|
|
1274
|
-
delay2 = 0;
|
|
1275
|
-
}
|
|
1276
|
-
return operate(function(source, subscriber) {
|
|
1277
|
-
subscriber.add(scheduler.schedule(function() {
|
|
1278
|
-
return source.subscribe(subscriber);
|
|
1279
|
-
}, delay2));
|
|
1280
|
-
});
|
|
1281
|
-
}
|
|
1282
|
-
function scheduleObservable(input, scheduler) {
|
|
1283
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1284
|
-
}
|
|
1285
|
-
function schedulePromise(input, scheduler) {
|
|
1286
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1287
|
-
}
|
|
1288
|
-
function scheduleArray(input, scheduler) {
|
|
1289
|
-
return new Observable(function(subscriber) {
|
|
1290
|
-
var i = 0;
|
|
1291
|
-
return scheduler.schedule(function() {
|
|
1292
|
-
if (i === input.length) {
|
|
1293
|
-
subscriber.complete();
|
|
1294
|
-
} else {
|
|
1295
|
-
subscriber.next(input[i++]);
|
|
1296
|
-
if (!subscriber.closed) {
|
|
1297
|
-
this.schedule();
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
});
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
function scheduleIterable(input, scheduler) {
|
|
1304
|
-
return new Observable(function(subscriber) {
|
|
1305
|
-
var iterator$1;
|
|
1306
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1307
|
-
iterator$1 = input[iterator]();
|
|
1308
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1309
|
-
var _a;
|
|
1310
|
-
var value;
|
|
1311
|
-
var done;
|
|
1312
|
-
try {
|
|
1313
|
-
_a = iterator$1.next(), value = _a.value, done = _a.done;
|
|
1314
|
-
} catch (err) {
|
|
1315
|
-
subscriber.error(err);
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
if (done) {
|
|
1319
|
-
subscriber.complete();
|
|
1320
|
-
} else {
|
|
1321
|
-
subscriber.next(value);
|
|
1322
|
-
}
|
|
1323
|
-
}, 0, true);
|
|
1324
|
-
});
|
|
1325
|
-
return function() {
|
|
1326
|
-
return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
|
|
1327
|
-
};
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
|
-
function scheduleAsyncIterable(input, scheduler) {
|
|
1331
|
-
if (!input) {
|
|
1332
|
-
throw new Error("Iterable cannot be null");
|
|
1333
|
-
}
|
|
1334
|
-
return new Observable(function(subscriber) {
|
|
1335
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1336
|
-
var iterator2 = input[Symbol.asyncIterator]();
|
|
1337
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1338
|
-
iterator2.next().then(function(result) {
|
|
1339
|
-
if (result.done) {
|
|
1340
|
-
subscriber.complete();
|
|
1341
|
-
} else {
|
|
1342
|
-
subscriber.next(result.value);
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
}, 0, true);
|
|
1346
|
-
});
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
function scheduleReadableStreamLike(input, scheduler) {
|
|
1350
|
-
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
1351
|
-
}
|
|
1352
|
-
function scheduled(input, scheduler) {
|
|
1353
|
-
if (input != null) {
|
|
1354
|
-
if (isInteropObservable(input)) {
|
|
1355
|
-
return scheduleObservable(input, scheduler);
|
|
1356
|
-
}
|
|
1357
|
-
if (isArrayLike(input)) {
|
|
1358
|
-
return scheduleArray(input, scheduler);
|
|
1359
|
-
}
|
|
1360
|
-
if (isPromise(input)) {
|
|
1361
|
-
return schedulePromise(input, scheduler);
|
|
1362
|
-
}
|
|
1363
|
-
if (isAsyncIterable(input)) {
|
|
1364
|
-
return scheduleAsyncIterable(input, scheduler);
|
|
1365
|
-
}
|
|
1366
|
-
if (isIterable(input)) {
|
|
1367
|
-
return scheduleIterable(input, scheduler);
|
|
1368
|
-
}
|
|
1369
|
-
if (isReadableStreamLike(input)) {
|
|
1370
|
-
return scheduleReadableStreamLike(input, scheduler);
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
throw createInvalidObservableTypeError(input);
|
|
1374
|
-
}
|
|
1375
|
-
function from(input, scheduler) {
|
|
1376
|
-
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
1377
|
-
}
|
|
1378
|
-
function map(project, thisArg) {
|
|
1379
|
-
return operate(function(source, subscriber) {
|
|
1380
|
-
var index = 0;
|
|
1381
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1382
|
-
subscriber.next(project.call(thisArg, value, index++));
|
|
1383
|
-
}));
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
1387
|
-
var buffer = [];
|
|
1388
|
-
var active = 0;
|
|
1389
|
-
var index = 0;
|
|
1390
|
-
var isComplete = false;
|
|
1391
|
-
var checkComplete = function() {
|
|
1392
|
-
if (isComplete && !buffer.length && !active) {
|
|
1393
|
-
subscriber.complete();
|
|
1394
|
-
}
|
|
1395
|
-
};
|
|
1396
|
-
var outerNext = function(value) {
|
|
1397
|
-
return active < concurrent ? doInnerSub(value) : buffer.push(value);
|
|
1398
|
-
};
|
|
1399
|
-
var doInnerSub = function(value) {
|
|
1400
|
-
expand && subscriber.next(value);
|
|
1401
|
-
active++;
|
|
1402
|
-
var innerComplete = false;
|
|
1403
|
-
innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
|
|
1404
|
-
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
1405
|
-
if (expand) {
|
|
1406
|
-
outerNext(innerValue);
|
|
1407
|
-
} else {
|
|
1408
|
-
subscriber.next(innerValue);
|
|
1409
|
-
}
|
|
1410
|
-
}, function() {
|
|
1411
|
-
innerComplete = true;
|
|
1412
|
-
}, void 0, function() {
|
|
1413
|
-
if (innerComplete) {
|
|
1414
|
-
try {
|
|
1415
|
-
active--;
|
|
1416
|
-
var _loop_1 = function() {
|
|
1417
|
-
var bufferedValue = buffer.shift();
|
|
1418
|
-
if (innerSubScheduler) {
|
|
1419
|
-
executeSchedule(subscriber, innerSubScheduler, function() {
|
|
1420
|
-
return doInnerSub(bufferedValue);
|
|
1421
|
-
});
|
|
1422
|
-
} else {
|
|
1423
|
-
doInnerSub(bufferedValue);
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
1426
|
-
while (buffer.length && active < concurrent) {
|
|
1427
|
-
_loop_1();
|
|
1428
|
-
}
|
|
1429
|
-
checkComplete();
|
|
1430
|
-
} catch (err) {
|
|
1431
|
-
subscriber.error(err);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}));
|
|
1435
|
-
};
|
|
1436
|
-
source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
|
|
1437
|
-
isComplete = true;
|
|
1438
|
-
checkComplete();
|
|
1439
|
-
}));
|
|
1440
|
-
return function() {
|
|
1441
|
-
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
function mergeMap(project, resultSelector, concurrent) {
|
|
1445
|
-
if (concurrent === void 0) {
|
|
1446
|
-
concurrent = Infinity;
|
|
1447
|
-
}
|
|
1448
|
-
if (isFunction(resultSelector)) {
|
|
1449
|
-
return mergeMap(function(a, i) {
|
|
1450
|
-
return map(function(b, ii) {
|
|
1451
|
-
return resultSelector(a, b, i, ii);
|
|
1452
|
-
})(innerFrom(project(a, i)));
|
|
1453
|
-
}, concurrent);
|
|
1454
|
-
} else if (typeof resultSelector === "number") {
|
|
1455
|
-
concurrent = resultSelector;
|
|
1456
|
-
}
|
|
1457
|
-
return operate(function(source, subscriber) {
|
|
1458
|
-
return mergeInternals(source, subscriber, project, concurrent);
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
function mergeAll(concurrent) {
|
|
1462
|
-
if (concurrent === void 0) {
|
|
1463
|
-
concurrent = Infinity;
|
|
1464
|
-
}
|
|
1465
|
-
return mergeMap(identity, concurrent);
|
|
1466
|
-
}
|
|
1467
|
-
function concatAll() {
|
|
1468
|
-
return mergeAll(1);
|
|
1469
|
-
}
|
|
1470
|
-
var ObjectUnsubscribedError = createErrorClass(function(_super) {
|
|
1471
|
-
return function ObjectUnsubscribedErrorImpl() {
|
|
1472
|
-
_super(this);
|
|
1473
|
-
this.name = "ObjectUnsubscribedError";
|
|
1474
|
-
this.message = "object unsubscribed";
|
|
1475
|
-
};
|
|
1476
|
-
});
|
|
1477
|
-
var Subject = function(_super) {
|
|
1478
|
-
__extends(Subject2, _super);
|
|
1479
|
-
function Subject2() {
|
|
1480
|
-
var _this = _super.call(this) || this;
|
|
1481
|
-
_this.closed = false;
|
|
1482
|
-
_this.currentObservers = null;
|
|
1483
|
-
_this.observers = [];
|
|
1484
|
-
_this.isStopped = false;
|
|
1485
|
-
_this.hasError = false;
|
|
1486
|
-
_this.thrownError = null;
|
|
1487
|
-
return _this;
|
|
1488
|
-
}
|
|
1489
|
-
Subject2.prototype.lift = function(operator) {
|
|
1490
|
-
var subject = new AnonymousSubject(this, this);
|
|
1491
|
-
subject.operator = operator;
|
|
1492
|
-
return subject;
|
|
1493
|
-
};
|
|
1494
|
-
Subject2.prototype._throwIfClosed = function() {
|
|
1495
|
-
if (this.closed) {
|
|
1496
|
-
throw new ObjectUnsubscribedError();
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
Subject2.prototype.next = function(value) {
|
|
1500
|
-
var _this = this;
|
|
1501
|
-
errorContext(function() {
|
|
1502
|
-
var e_1, _a;
|
|
1503
|
-
_this._throwIfClosed();
|
|
1504
|
-
if (!_this.isStopped) {
|
|
1505
|
-
if (!_this.currentObservers) {
|
|
1506
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
1507
|
-
}
|
|
1508
|
-
try {
|
|
1509
|
-
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1510
|
-
var observer = _c.value;
|
|
1511
|
-
observer.next(value);
|
|
1512
|
-
}
|
|
1513
|
-
} catch (e_1_1) {
|
|
1514
|
-
e_1 = { error: e_1_1 };
|
|
1515
|
-
} finally {
|
|
1516
|
-
try {
|
|
1517
|
-
if (_c && !_c.done && (_a = _b.return))
|
|
1518
|
-
_a.call(_b);
|
|
1519
|
-
} finally {
|
|
1520
|
-
if (e_1)
|
|
1521
|
-
throw e_1.error;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
});
|
|
1526
|
-
};
|
|
1527
|
-
Subject2.prototype.error = function(err) {
|
|
1528
|
-
var _this = this;
|
|
1529
|
-
errorContext(function() {
|
|
1530
|
-
_this._throwIfClosed();
|
|
1531
|
-
if (!_this.isStopped) {
|
|
1532
|
-
_this.hasError = _this.isStopped = true;
|
|
1533
|
-
_this.thrownError = err;
|
|
1534
|
-
var observers = _this.observers;
|
|
1535
|
-
while (observers.length) {
|
|
1536
|
-
observers.shift().error(err);
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
});
|
|
1540
|
-
};
|
|
1541
|
-
Subject2.prototype.complete = function() {
|
|
1542
|
-
var _this = this;
|
|
1543
|
-
errorContext(function() {
|
|
1544
|
-
_this._throwIfClosed();
|
|
1545
|
-
if (!_this.isStopped) {
|
|
1546
|
-
_this.isStopped = true;
|
|
1547
|
-
var observers = _this.observers;
|
|
1548
|
-
while (observers.length) {
|
|
1549
|
-
observers.shift().complete();
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
});
|
|
1553
|
-
};
|
|
1554
|
-
Subject2.prototype.unsubscribe = function() {
|
|
1555
|
-
this.isStopped = this.closed = true;
|
|
1556
|
-
this.observers = this.currentObservers = null;
|
|
1557
|
-
};
|
|
1558
|
-
Object.defineProperty(Subject2.prototype, "observed", {
|
|
1559
|
-
get: function() {
|
|
1560
|
-
var _a;
|
|
1561
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
1562
|
-
},
|
|
1563
|
-
enumerable: false,
|
|
1564
|
-
configurable: true
|
|
1565
|
-
});
|
|
1566
|
-
Subject2.prototype._trySubscribe = function(subscriber) {
|
|
1567
|
-
this._throwIfClosed();
|
|
1568
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1569
|
-
};
|
|
1570
|
-
Subject2.prototype._subscribe = function(subscriber) {
|
|
1571
|
-
this._throwIfClosed();
|
|
1572
|
-
this._checkFinalizedStatuses(subscriber);
|
|
1573
|
-
return this._innerSubscribe(subscriber);
|
|
1574
|
-
};
|
|
1575
|
-
Subject2.prototype._innerSubscribe = function(subscriber) {
|
|
1576
|
-
var _this = this;
|
|
1577
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
1578
|
-
if (hasError || isStopped) {
|
|
1579
|
-
return EMPTY_SUBSCRIPTION;
|
|
1580
|
-
}
|
|
1581
|
-
this.currentObservers = null;
|
|
1582
|
-
observers.push(subscriber);
|
|
1583
|
-
return new Subscription(function() {
|
|
1584
|
-
_this.currentObservers = null;
|
|
1585
|
-
arrRemove(observers, subscriber);
|
|
1586
|
-
});
|
|
1587
|
-
};
|
|
1588
|
-
Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
1589
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
1590
|
-
if (hasError) {
|
|
1591
|
-
subscriber.error(thrownError);
|
|
1592
|
-
} else if (isStopped) {
|
|
1593
|
-
subscriber.complete();
|
|
1594
|
-
}
|
|
1595
|
-
};
|
|
1596
|
-
Subject2.prototype.asObservable = function() {
|
|
1597
|
-
var observable2 = new Observable();
|
|
1598
|
-
observable2.source = this;
|
|
1599
|
-
return observable2;
|
|
1600
|
-
};
|
|
1601
|
-
Subject2.create = function(destination, source) {
|
|
1602
|
-
return new AnonymousSubject(destination, source);
|
|
1603
|
-
};
|
|
1604
|
-
return Subject2;
|
|
1605
|
-
}(Observable);
|
|
1606
|
-
var AnonymousSubject = function(_super) {
|
|
1607
|
-
__extends(AnonymousSubject2, _super);
|
|
1608
|
-
function AnonymousSubject2(destination, source) {
|
|
1609
|
-
var _this = _super.call(this) || this;
|
|
1610
|
-
_this.destination = destination;
|
|
1611
|
-
_this.source = source;
|
|
1612
|
-
return _this;
|
|
1613
|
-
}
|
|
1614
|
-
AnonymousSubject2.prototype.next = function(value) {
|
|
1615
|
-
var _a, _b;
|
|
1616
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
1617
|
-
};
|
|
1618
|
-
AnonymousSubject2.prototype.error = function(err) {
|
|
1619
|
-
var _a, _b;
|
|
1620
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
1621
|
-
};
|
|
1622
|
-
AnonymousSubject2.prototype.complete = function() {
|
|
1623
|
-
var _a, _b;
|
|
1624
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1625
|
-
};
|
|
1626
|
-
AnonymousSubject2.prototype._subscribe = function(subscriber) {
|
|
1627
|
-
var _a, _b;
|
|
1628
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
1629
|
-
};
|
|
1630
|
-
return AnonymousSubject2;
|
|
1631
|
-
}(Subject);
|
|
1632
|
-
function debounce(durationSelector) {
|
|
1633
|
-
return operate(function(source, subscriber) {
|
|
1634
|
-
var hasValue = false;
|
|
1635
|
-
var lastValue = null;
|
|
1636
|
-
var durationSubscriber = null;
|
|
1637
|
-
var emit = function() {
|
|
1638
|
-
durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
|
|
1639
|
-
durationSubscriber = null;
|
|
1640
|
-
if (hasValue) {
|
|
1641
|
-
hasValue = false;
|
|
1642
|
-
var value = lastValue;
|
|
1643
|
-
lastValue = null;
|
|
1644
|
-
subscriber.next(value);
|
|
1645
|
-
}
|
|
1646
|
-
};
|
|
1647
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1648
|
-
durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
|
|
1649
|
-
hasValue = true;
|
|
1650
|
-
lastValue = value;
|
|
1651
|
-
durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);
|
|
1652
|
-
innerFrom(durationSelector(value)).subscribe(durationSubscriber);
|
|
1653
|
-
}, function() {
|
|
1654
|
-
emit();
|
|
1655
|
-
subscriber.complete();
|
|
1656
|
-
}, void 0, function() {
|
|
1657
|
-
lastValue = durationSubscriber = null;
|
|
1658
|
-
}));
|
|
1659
|
-
});
|
|
1660
|
-
}
|
|
1661
|
-
function debounceTime(dueTime, scheduler) {
|
|
1662
|
-
if (scheduler === void 0) {
|
|
1663
|
-
scheduler = asyncScheduler;
|
|
1664
|
-
}
|
|
1665
|
-
return operate(function(source, subscriber) {
|
|
1666
|
-
var activeTask = null;
|
|
1667
|
-
var lastValue = null;
|
|
1668
|
-
var lastTime = null;
|
|
1669
|
-
var emit = function() {
|
|
1670
|
-
if (activeTask) {
|
|
1671
|
-
activeTask.unsubscribe();
|
|
1672
|
-
activeTask = null;
|
|
1673
|
-
var value = lastValue;
|
|
1674
|
-
lastValue = null;
|
|
1675
|
-
subscriber.next(value);
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
function emitWhenIdle() {
|
|
1679
|
-
var targetTime = lastTime + dueTime;
|
|
1680
|
-
var now = scheduler.now();
|
|
1681
|
-
if (now < targetTime) {
|
|
1682
|
-
activeTask = this.schedule(void 0, targetTime - now);
|
|
1683
|
-
subscriber.add(activeTask);
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
emit();
|
|
1687
|
-
}
|
|
1688
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1689
|
-
lastValue = value;
|
|
1690
|
-
lastTime = scheduler.now();
|
|
1691
|
-
if (!activeTask) {
|
|
1692
|
-
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1693
|
-
subscriber.add(activeTask);
|
|
1694
|
-
}
|
|
1695
|
-
}, function() {
|
|
1696
|
-
emit();
|
|
1697
|
-
subscriber.complete();
|
|
1698
|
-
}, void 0, function() {
|
|
1699
|
-
lastValue = activeTask = null;
|
|
1700
|
-
}));
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
function concat() {
|
|
1704
|
-
var args = [];
|
|
1705
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1706
|
-
args[_i] = arguments[_i];
|
|
1707
|
-
}
|
|
1708
|
-
return concatAll()(from(args, popScheduler(args)));
|
|
1709
|
-
}
|
|
1710
|
-
var EMPTY = new Observable(function(subscriber) {
|
|
1711
|
-
return subscriber.complete();
|
|
1712
|
-
});
|
|
1713
|
-
function take(count) {
|
|
1714
|
-
return count <= 0 ? function() {
|
|
1715
|
-
return EMPTY;
|
|
1716
|
-
} : operate(function(source, subscriber) {
|
|
1717
|
-
var seen = 0;
|
|
1718
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1719
|
-
if (++seen <= count) {
|
|
1720
|
-
subscriber.next(value);
|
|
1721
|
-
if (count <= seen) {
|
|
1722
|
-
subscriber.complete();
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
}));
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
function ignoreElements() {
|
|
1729
|
-
return operate(function(source, subscriber) {
|
|
1730
|
-
source.subscribe(createOperatorSubscriber(subscriber, noop));
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
function mapTo(value) {
|
|
1734
|
-
return map(function() {
|
|
1735
|
-
return value;
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
|
-
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
1739
|
-
if (subscriptionDelay) {
|
|
1740
|
-
return function(source) {
|
|
1741
|
-
return concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
1742
|
-
};
|
|
1743
|
-
}
|
|
1744
|
-
return mergeMap(function(value, index) {
|
|
1745
|
-
return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value));
|
|
1746
|
-
});
|
|
1747
|
-
}
|
|
1748
|
-
function delay(due, scheduler) {
|
|
1749
|
-
if (scheduler === void 0) {
|
|
1750
|
-
scheduler = asyncScheduler;
|
|
1751
|
-
}
|
|
1752
|
-
var duration = timer(due, scheduler);
|
|
1753
|
-
return delayWhen(function() {
|
|
1754
|
-
return duration;
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
function distinctUntilChanged(comparator, keySelector) {
|
|
1758
|
-
if (keySelector === void 0) {
|
|
1759
|
-
keySelector = identity;
|
|
1760
|
-
}
|
|
1761
|
-
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
1762
|
-
return operate(function(source, subscriber) {
|
|
1763
|
-
var previousKey;
|
|
1764
|
-
var first = true;
|
|
1765
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1766
|
-
var currentKey = keySelector(value);
|
|
1767
|
-
if (first || !comparator(previousKey, currentKey)) {
|
|
1768
|
-
first = false;
|
|
1769
|
-
previousKey = currentKey;
|
|
1770
|
-
subscriber.next(value);
|
|
1771
|
-
}
|
|
1772
|
-
}));
|
|
1773
|
-
});
|
|
1774
|
-
}
|
|
1775
|
-
function defaultCompare(a, b) {
|
|
1776
|
-
return a === b;
|
|
1777
|
-
}
|
|
1778
|
-
function filter(predicate, thisArg) {
|
|
1779
|
-
return operate(function(source, subscriber) {
|
|
1780
|
-
var index = 0;
|
|
1781
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1782
|
-
return predicate.call(thisArg, value, index++) && subscriber.next(value);
|
|
1783
|
-
}));
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
function exhaustMap(project, resultSelector) {
|
|
1787
|
-
if (resultSelector) {
|
|
1788
|
-
return function(source) {
|
|
1789
|
-
return source.pipe(exhaustMap(function(a, i) {
|
|
1790
|
-
return innerFrom(project(a, i)).pipe(map(function(b, ii) {
|
|
1791
|
-
return resultSelector(a, b, i, ii);
|
|
1792
|
-
}));
|
|
1793
|
-
}));
|
|
1794
|
-
};
|
|
1795
|
-
}
|
|
1796
|
-
return operate(function(source, subscriber) {
|
|
1797
|
-
var index = 0;
|
|
1798
|
-
var innerSub = null;
|
|
1799
|
-
var isComplete = false;
|
|
1800
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(outerValue) {
|
|
1801
|
-
if (!innerSub) {
|
|
1802
|
-
innerSub = createOperatorSubscriber(subscriber, void 0, function() {
|
|
1803
|
-
innerSub = null;
|
|
1804
|
-
isComplete && subscriber.complete();
|
|
1805
|
-
});
|
|
1806
|
-
innerFrom(project(outerValue, index++)).subscribe(innerSub);
|
|
1807
|
-
}
|
|
1808
|
-
}, function() {
|
|
1809
|
-
isComplete = true;
|
|
1810
|
-
!innerSub && subscriber.complete();
|
|
1811
|
-
}));
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
function pairwise() {
|
|
1815
|
-
return operate(function(source, subscriber) {
|
|
1816
|
-
var prev;
|
|
1817
|
-
var hasPrev = false;
|
|
1818
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1819
|
-
var p = prev;
|
|
1820
|
-
prev = value;
|
|
1821
|
-
hasPrev && subscriber.next([p, value]);
|
|
1822
|
-
hasPrev = true;
|
|
1823
|
-
}));
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
|
-
var ReplaySubject = function(_super) {
|
|
1827
|
-
__extends(ReplaySubject2, _super);
|
|
1828
|
-
function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
|
|
1829
|
-
if (_bufferSize === void 0) {
|
|
1830
|
-
_bufferSize = Infinity;
|
|
1831
|
-
}
|
|
1832
|
-
if (_windowTime === void 0) {
|
|
1833
|
-
_windowTime = Infinity;
|
|
1834
|
-
}
|
|
1835
|
-
if (_timestampProvider === void 0) {
|
|
1836
|
-
_timestampProvider = dateTimestampProvider;
|
|
1837
|
-
}
|
|
1838
|
-
var _this = _super.call(this) || this;
|
|
1839
|
-
_this._bufferSize = _bufferSize;
|
|
1840
|
-
_this._windowTime = _windowTime;
|
|
1841
|
-
_this._timestampProvider = _timestampProvider;
|
|
1842
|
-
_this._buffer = [];
|
|
1843
|
-
_this._infiniteTimeWindow = true;
|
|
1844
|
-
_this._infiniteTimeWindow = _windowTime === Infinity;
|
|
1845
|
-
_this._bufferSize = Math.max(1, _bufferSize);
|
|
1846
|
-
_this._windowTime = Math.max(1, _windowTime);
|
|
1847
|
-
return _this;
|
|
1848
|
-
}
|
|
1849
|
-
ReplaySubject2.prototype.next = function(value) {
|
|
1850
|
-
var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
|
|
1851
|
-
if (!isStopped) {
|
|
1852
|
-
_buffer.push(value);
|
|
1853
|
-
!_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
|
|
1854
|
-
}
|
|
1855
|
-
this._trimBuffer();
|
|
1856
|
-
_super.prototype.next.call(this, value);
|
|
1857
|
-
};
|
|
1858
|
-
ReplaySubject2.prototype._subscribe = function(subscriber) {
|
|
1859
|
-
this._throwIfClosed();
|
|
1860
|
-
this._trimBuffer();
|
|
1861
|
-
var subscription = this._innerSubscribe(subscriber);
|
|
1862
|
-
var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
|
|
1863
|
-
var copy = _buffer.slice();
|
|
1864
|
-
for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
|
|
1865
|
-
subscriber.next(copy[i]);
|
|
1866
|
-
}
|
|
1867
|
-
this._checkFinalizedStatuses(subscriber);
|
|
1868
|
-
return subscription;
|
|
1869
|
-
};
|
|
1870
|
-
ReplaySubject2.prototype._trimBuffer = function() {
|
|
1871
|
-
var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
|
|
1872
|
-
var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
|
|
1873
|
-
_bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
|
|
1874
|
-
if (!_infiniteTimeWindow) {
|
|
1875
|
-
var now = _timestampProvider.now();
|
|
1876
|
-
var last2 = 0;
|
|
1877
|
-
for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
|
|
1878
|
-
last2 = i;
|
|
1879
|
-
}
|
|
1880
|
-
last2 && _buffer.splice(0, last2 + 1);
|
|
1881
|
-
}
|
|
1882
|
-
};
|
|
1883
|
-
return ReplaySubject2;
|
|
1884
|
-
}(Subject);
|
|
1885
|
-
function share(options) {
|
|
1886
|
-
if (options === void 0) {
|
|
1887
|
-
options = {};
|
|
1888
|
-
}
|
|
1889
|
-
var _a = options.connector, connector = _a === void 0 ? function() {
|
|
1890
|
-
return new Subject();
|
|
1891
|
-
} : _a, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === void 0 ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === void 0 ? true : _d;
|
|
1892
|
-
return function(wrapperSource) {
|
|
1893
|
-
var connection;
|
|
1894
|
-
var resetConnection;
|
|
1895
|
-
var subject;
|
|
1896
|
-
var refCount = 0;
|
|
1897
|
-
var hasCompleted = false;
|
|
1898
|
-
var hasErrored = false;
|
|
1899
|
-
var cancelReset = function() {
|
|
1900
|
-
resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
|
|
1901
|
-
resetConnection = void 0;
|
|
1902
|
-
};
|
|
1903
|
-
var reset = function() {
|
|
1904
|
-
cancelReset();
|
|
1905
|
-
connection = subject = void 0;
|
|
1906
|
-
hasCompleted = hasErrored = false;
|
|
1907
|
-
};
|
|
1908
|
-
var resetAndUnsubscribe = function() {
|
|
1909
|
-
var conn = connection;
|
|
1910
|
-
reset();
|
|
1911
|
-
conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
|
|
1912
|
-
};
|
|
1913
|
-
return operate(function(source, subscriber) {
|
|
1914
|
-
refCount++;
|
|
1915
|
-
if (!hasErrored && !hasCompleted) {
|
|
1916
|
-
cancelReset();
|
|
1917
|
-
}
|
|
1918
|
-
var dest = subject = subject !== null && subject !== void 0 ? subject : connector();
|
|
1919
|
-
subscriber.add(function() {
|
|
1920
|
-
refCount--;
|
|
1921
|
-
if (refCount === 0 && !hasErrored && !hasCompleted) {
|
|
1922
|
-
resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
|
-
dest.subscribe(subscriber);
|
|
1926
|
-
if (!connection && refCount > 0) {
|
|
1927
|
-
connection = new SafeSubscriber({
|
|
1928
|
-
next: function(value) {
|
|
1929
|
-
return dest.next(value);
|
|
1930
|
-
},
|
|
1931
|
-
error: function(err) {
|
|
1932
|
-
hasErrored = true;
|
|
1933
|
-
cancelReset();
|
|
1934
|
-
resetConnection = handleReset(reset, resetOnError, err);
|
|
1935
|
-
dest.error(err);
|
|
1936
|
-
},
|
|
1937
|
-
complete: function() {
|
|
1938
|
-
hasCompleted = true;
|
|
1939
|
-
cancelReset();
|
|
1940
|
-
resetConnection = handleReset(reset, resetOnComplete);
|
|
1941
|
-
dest.complete();
|
|
1942
|
-
}
|
|
1943
|
-
});
|
|
1944
|
-
innerFrom(source).subscribe(connection);
|
|
1945
|
-
}
|
|
1946
|
-
})(wrapperSource);
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
function handleReset(reset, on) {
|
|
1950
|
-
var args = [];
|
|
1951
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1952
|
-
args[_i - 2] = arguments[_i];
|
|
1953
|
-
}
|
|
1954
|
-
if (on === true) {
|
|
1955
|
-
reset();
|
|
1956
|
-
return;
|
|
1957
|
-
}
|
|
1958
|
-
if (on === false) {
|
|
1959
|
-
return;
|
|
1960
|
-
}
|
|
1961
|
-
var onSubscriber = new SafeSubscriber({
|
|
1962
|
-
next: function() {
|
|
1963
|
-
onSubscriber.unsubscribe();
|
|
1964
|
-
reset();
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
|
|
1968
|
-
}
|
|
1969
|
-
function shareReplay(configOrBufferSize, windowTime, scheduler) {
|
|
1970
|
-
var _a, _b, _c;
|
|
1971
|
-
var bufferSize;
|
|
1972
|
-
var refCount = false;
|
|
1973
|
-
if (configOrBufferSize && typeof configOrBufferSize === "object") {
|
|
1974
|
-
_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler;
|
|
1975
|
-
} else {
|
|
1976
|
-
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
|
|
1977
|
-
}
|
|
1978
|
-
return share({
|
|
1979
|
-
connector: function() {
|
|
1980
|
-
return new ReplaySubject(bufferSize, windowTime, scheduler);
|
|
1981
|
-
},
|
|
1982
|
-
resetOnError: true,
|
|
1983
|
-
resetOnComplete: false,
|
|
1984
|
-
resetOnRefCountZero: refCount
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
|
-
function skip(count) {
|
|
1988
|
-
return filter(function(_, index) {
|
|
1989
|
-
return count <= index;
|
|
1990
|
-
});
|
|
1991
|
-
}
|
|
1992
|
-
function startWith() {
|
|
1993
|
-
var values = [];
|
|
1994
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1995
|
-
values[_i] = arguments[_i];
|
|
1996
|
-
}
|
|
1997
|
-
var scheduler = popScheduler(values);
|
|
1998
|
-
return operate(function(source, subscriber) {
|
|
1999
|
-
(scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
function switchMap(project, resultSelector) {
|
|
2003
|
-
return operate(function(source, subscriber) {
|
|
2004
|
-
var innerSubscriber = null;
|
|
2005
|
-
var index = 0;
|
|
2006
|
-
var isComplete = false;
|
|
2007
|
-
var checkComplete = function() {
|
|
2008
|
-
return isComplete && !innerSubscriber && subscriber.complete();
|
|
2009
|
-
};
|
|
2010
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2011
|
-
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
2012
|
-
var innerIndex = 0;
|
|
2013
|
-
var outerIndex = index++;
|
|
2014
|
-
innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
|
|
2015
|
-
return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
|
|
2016
|
-
}, function() {
|
|
2017
|
-
innerSubscriber = null;
|
|
2018
|
-
checkComplete();
|
|
2019
|
-
}));
|
|
2020
|
-
}, function() {
|
|
2021
|
-
isComplete = true;
|
|
2022
|
-
checkComplete();
|
|
2023
|
-
}));
|
|
2024
|
-
});
|
|
2025
|
-
}
|
|
2026
|
-
function takeUntil(notifier) {
|
|
2027
|
-
return operate(function(source, subscriber) {
|
|
2028
|
-
innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function() {
|
|
2029
|
-
return subscriber.complete();
|
|
2030
|
-
}, noop));
|
|
2031
|
-
!subscriber.closed && source.subscribe(subscriber);
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
function tap(observerOrNext, error, complete) {
|
|
2035
|
-
var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
|
|
2036
|
-
return tapObserver ? operate(function(source, subscriber) {
|
|
2037
|
-
var _a;
|
|
2038
|
-
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
2039
|
-
var isUnsub = true;
|
|
2040
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2041
|
-
var _a2;
|
|
2042
|
-
(_a2 = tapObserver.next) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, value);
|
|
2043
|
-
subscriber.next(value);
|
|
2044
|
-
}, function() {
|
|
2045
|
-
var _a2;
|
|
2046
|
-
isUnsub = false;
|
|
2047
|
-
(_a2 = tapObserver.complete) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
|
|
2048
|
-
subscriber.complete();
|
|
2049
|
-
}, function(err) {
|
|
2050
|
-
var _a2;
|
|
2051
|
-
isUnsub = false;
|
|
2052
|
-
(_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, err);
|
|
2053
|
-
subscriber.error(err);
|
|
2054
|
-
}, function() {
|
|
2055
|
-
var _a2, _b;
|
|
2056
|
-
if (isUnsub) {
|
|
2057
|
-
(_a2 = tapObserver.unsubscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
|
|
2058
|
-
}
|
|
2059
|
-
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
|
2060
|
-
}));
|
|
2061
|
-
}) : identity;
|
|
2062
|
-
}
|
|
2063
|
-
function withLatestFrom() {
|
|
2064
|
-
var inputs = [];
|
|
2065
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2066
|
-
inputs[_i] = arguments[_i];
|
|
2067
|
-
}
|
|
2068
|
-
var project = popResultSelector(inputs);
|
|
2069
|
-
return operate(function(source, subscriber) {
|
|
2070
|
-
var len = inputs.length;
|
|
2071
|
-
var otherValues = new Array(len);
|
|
2072
|
-
var hasValue = inputs.map(function() {
|
|
2073
|
-
return false;
|
|
2074
|
-
});
|
|
2075
|
-
var ready = false;
|
|
2076
|
-
var _loop_1 = function(i2) {
|
|
2077
|
-
innerFrom(inputs[i2]).subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2078
|
-
otherValues[i2] = value;
|
|
2079
|
-
if (!ready && !hasValue[i2]) {
|
|
2080
|
-
hasValue[i2] = true;
|
|
2081
|
-
(ready = hasValue.every(identity)) && (hasValue = null);
|
|
2082
|
-
}
|
|
2083
|
-
}, noop));
|
|
2084
|
-
};
|
|
2085
|
-
for (var i = 0; i < len; i++) {
|
|
2086
|
-
_loop_1(i);
|
|
2087
|
-
}
|
|
2088
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2089
|
-
if (ready) {
|
|
2090
|
-
var values = __spreadArray([value], __read(otherValues));
|
|
2091
|
-
subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
|
|
2092
|
-
}
|
|
2093
|
-
}));
|
|
2094
|
-
});
|
|
2095
|
-
}
|
|
2096
22
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
2097
23
|
const is = (x, y) => {
|
|
2098
24
|
if (x === y) {
|
|
@@ -2147,7 +73,7 @@ const getBase64FromBlob = (data) => {
|
|
|
2147
73
|
};
|
|
2148
74
|
const fontsEnhancer = (next) => (options) => {
|
|
2149
75
|
const { fontScale = 1, lineHeight = `publisher`, fontWeight = `publisher`, fontJustification = `publisher` } = options;
|
|
2150
|
-
const changes$ = new Subject
|
|
76
|
+
const changes$ = new Subject();
|
|
2151
77
|
const settings$ = new BehaviorSubject({
|
|
2152
78
|
fontScale,
|
|
2153
79
|
lineHeight,
|
|
@@ -2189,7 +115,7 @@ const fontsEnhancer = (next) => (options) => {
|
|
|
2189
115
|
});
|
|
2190
116
|
const shouldRequireLayout = (source) => source.pipe(
|
|
2191
117
|
pairwise(),
|
|
2192
|
-
map
|
|
118
|
+
map(([old, latest]) => {
|
|
2193
119
|
if (latest.fontScale !== old.fontScale)
|
|
2194
120
|
return true;
|
|
2195
121
|
if (latest.lineHeight !== old.lineHeight)
|
|
@@ -2199,7 +125,7 @@ const fontsEnhancer = (next) => (options) => {
|
|
|
2199
125
|
);
|
|
2200
126
|
const newSettings$ = changes$.pipe(
|
|
2201
127
|
withLatestFrom(settings$),
|
|
2202
|
-
map
|
|
128
|
+
map(([changes, settings]) => ({
|
|
2203
129
|
fontJustification: changes.fontJustification ?? settings.fontJustification,
|
|
2204
130
|
fontWeight: changes.fontWeight ?? settings.fontWeight,
|
|
2205
131
|
lineHeight: changes.lineHeight ?? settings.lineHeight,
|
|
@@ -2209,9 +135,9 @@ const fontsEnhancer = (next) => (options) => {
|
|
|
2209
135
|
shareReplay(1)
|
|
2210
136
|
);
|
|
2211
137
|
newSettings$.subscribe(settings$);
|
|
2212
|
-
settings$.pipe(shouldRequireLayout, tap(applyChangeToSpineItem), takeUntil
|
|
138
|
+
settings$.pipe(shouldRequireLayout, tap(applyChangeToSpineItem), takeUntil(reader.$.destroy$)).subscribe();
|
|
2213
139
|
const settingsMerge$ = combineLatest([reader.settings$, settings$]).pipe(
|
|
2214
|
-
map
|
|
140
|
+
map(([innerSettings, settings]) => ({
|
|
2215
141
|
...innerSettings,
|
|
2216
142
|
...settings
|
|
2217
143
|
}))
|
|
@@ -2234,7 +160,7 @@ const hotkeysEnhancer = (next) => (options) => {
|
|
|
2234
160
|
const reader = next(options);
|
|
2235
161
|
const navigateOnKey = (document2) => fromEvent(document2, "keyup").pipe(
|
|
2236
162
|
withLatestFrom$1(reader.settings$),
|
|
2237
|
-
map
|
|
163
|
+
map(([e, { pageTurnDirection }]) => {
|
|
2238
164
|
if (pageTurnDirection === "horizontal") {
|
|
2239
165
|
if (e.key === `ArrowRight`) {
|
|
2240
166
|
reader.turnRight();
|
|
@@ -2254,18 +180,18 @@ const hotkeysEnhancer = (next) => (options) => {
|
|
|
2254
180
|
return e;
|
|
2255
181
|
})
|
|
2256
182
|
);
|
|
2257
|
-
navigateOnKey(document).pipe(takeUntil
|
|
183
|
+
navigateOnKey(document).pipe(takeUntil(reader.$.destroy$)).subscribe();
|
|
2258
184
|
reader.spineItems$.pipe(
|
|
2259
|
-
switchMap
|
|
185
|
+
switchMap(
|
|
2260
186
|
(spineItems) => merge(
|
|
2261
187
|
...spineItems.map(
|
|
2262
188
|
(item) => item.$.loaded$.pipe(
|
|
2263
|
-
switchMap
|
|
189
|
+
switchMap((iframe) => (iframe == null ? void 0 : iframe.contentDocument) ? navigateOnKey(iframe.contentDocument) : EMPTY)
|
|
2264
190
|
)
|
|
2265
191
|
)
|
|
2266
192
|
)
|
|
2267
193
|
),
|
|
2268
|
-
takeUntil
|
|
194
|
+
takeUntil(reader.$.destroy$)
|
|
2269
195
|
).subscribe();
|
|
2270
196
|
return reader;
|
|
2271
197
|
};
|
|
@@ -2285,7 +211,7 @@ const createMovingSafePan$ = (reader) => {
|
|
|
2285
211
|
container.appendChild(iframeOverlayForAnimationsElement);
|
|
2286
212
|
return SHOULD_NOT_LAYOUT$2;
|
|
2287
213
|
});
|
|
2288
|
-
const createResetLock$ = (source) => scheduled
|
|
214
|
+
const createResetLock$ = (source) => scheduled(source, animationFrameScheduler).pipe(
|
|
2289
215
|
tap(() => {
|
|
2290
216
|
iframeOverlayForAnimationsElement == null ? void 0 : iframeOverlayForAnimationsElement.style.setProperty(`visibility`, `hidden`);
|
|
2291
217
|
})
|
|
@@ -2299,19 +225,19 @@ const createMovingSafePan$ = (reader) => {
|
|
|
2299
225
|
);
|
|
2300
226
|
const resetLockViewportFree$ = createResetLock$(viewportFree$).pipe(take(1));
|
|
2301
227
|
const pageTurnMode$ = reader.context.$.settings$.pipe(
|
|
2302
|
-
map(() => reader.context.getSettings().computedPageTurnMode),
|
|
228
|
+
map$1(() => reader.context.getSettings().computedPageTurnMode),
|
|
2303
229
|
distinctUntilChanged()
|
|
2304
230
|
);
|
|
2305
231
|
const handleViewportLock$ = pageTurnMode$.pipe(
|
|
2306
|
-
switchMap(
|
|
2307
|
-
(mode) => mode === `controlled` ? lockAfterViewportBusy$.pipe(switchMap(() => resetLockViewportFree$)) : createResetLock$(of(void 0))
|
|
232
|
+
switchMap$1(
|
|
233
|
+
(mode) => mode === `controlled` ? lockAfterViewportBusy$.pipe(switchMap$1(() => resetLockViewportFree$)) : createResetLock$(of(void 0))
|
|
2308
234
|
),
|
|
2309
|
-
takeUntil(reader.$.destroy$)
|
|
235
|
+
takeUntil$1(reader.$.destroy$)
|
|
2310
236
|
);
|
|
2311
237
|
return handleViewportLock$;
|
|
2312
238
|
};
|
|
2313
239
|
const mapKeysTo = (keys) => {
|
|
2314
|
-
return map((obj) => {
|
|
240
|
+
return map$1((obj) => {
|
|
2315
241
|
return Object.entries(obj).reduce((acc, [key, entry]) => {
|
|
2316
242
|
if (keys.includes(key)) {
|
|
2317
243
|
return {
|
|
@@ -2415,7 +341,7 @@ const layoutEnhancer = (next) => (options) => {
|
|
|
2415
341
|
tap(() => {
|
|
2416
342
|
reader.layout();
|
|
2417
343
|
}),
|
|
2418
|
-
takeUntil(reader.$.destroy$)
|
|
344
|
+
takeUntil$1(reader.$.destroy$)
|
|
2419
345
|
).subscribe();
|
|
2420
346
|
return {
|
|
2421
347
|
...reader,
|
|
@@ -2433,7 +359,7 @@ const layoutEnhancer = (next) => (options) => {
|
|
|
2433
359
|
reader.setSettings(rest);
|
|
2434
360
|
},
|
|
2435
361
|
settings$: combineLatest([reader.settings$, settingsSubject$.asObservable()]).pipe(
|
|
2436
|
-
map(([innerSettings, settings]) => ({
|
|
362
|
+
map$1(([innerSettings, settings]) => ({
|
|
2437
363
|
...innerSettings,
|
|
2438
364
|
...settings
|
|
2439
365
|
}))
|
|
@@ -2525,7 +451,7 @@ const Report = {
|
|
|
2525
451
|
};
|
|
2526
452
|
const linksEnhancer = (next) => (options) => {
|
|
2527
453
|
const reader = next(options);
|
|
2528
|
-
const subject = new Subject
|
|
454
|
+
const subject = new Subject();
|
|
2529
455
|
const handleNavigationForClick = (element) => {
|
|
2530
456
|
var _a;
|
|
2531
457
|
if (!element.href)
|
|
@@ -2761,10 +687,10 @@ const paginationEnhancer = (next) => (options) => {
|
|
|
2761
687
|
chaptersInfo[item.id] = getChapterInfo2(item);
|
|
2762
688
|
})
|
|
2763
689
|
),
|
|
2764
|
-
takeUntil(reader.$.destroy$)
|
|
690
|
+
takeUntil$1(reader.$.destroy$)
|
|
2765
691
|
).subscribe();
|
|
2766
692
|
const innerPaginationExtendedInfo$ = reader.pagination$.pipe(
|
|
2767
|
-
map((info) => ({
|
|
693
|
+
map$1((info) => ({
|
|
2768
694
|
...info,
|
|
2769
695
|
...mapPaginationInfoToExtendedInfo(info)
|
|
2770
696
|
})),
|
|
@@ -2773,7 +699,7 @@ const paginationEnhancer = (next) => (options) => {
|
|
|
2773
699
|
const totalPages$ = reader.$.layout$.pipe(
|
|
2774
700
|
debounceTime(10, animationFrameScheduler),
|
|
2775
701
|
withLatestFrom(reader.pagination$),
|
|
2776
|
-
map(() => {
|
|
702
|
+
map$1(() => {
|
|
2777
703
|
const numberOfPagesPerItems = getNumberOfPagesPerItems();
|
|
2778
704
|
return {
|
|
2779
705
|
numberOfPagesPerItems,
|
|
@@ -2790,14 +716,14 @@ const paginationEnhancer = (next) => (options) => {
|
|
|
2790
716
|
})
|
|
2791
717
|
);
|
|
2792
718
|
const pagination$ = combineLatest([innerPaginationExtendedInfo$, totalPages$]).pipe(
|
|
2793
|
-
map(([pageInfo, totalPageInfo]) => ({
|
|
719
|
+
map$1(([pageInfo, totalPageInfo]) => ({
|
|
2794
720
|
...pageInfo,
|
|
2795
721
|
...totalPageInfo,
|
|
2796
722
|
beginAbsolutePageIndex: totalPageInfo.numberOfPagesPerItems.slice(0, pageInfo.beginSpineItemIndex).reduce((acc, numberOfPagesForItem) => acc + numberOfPagesForItem, pageInfo.beginPageIndexInChapter ?? 0),
|
|
2797
723
|
endAbsolutePageIndex: totalPageInfo.numberOfPagesPerItems.slice(0, pageInfo.endSpineItemIndex).reduce((acc, numberOfPagesForItem) => acc + numberOfPagesForItem, pageInfo.endPageIndexInChapter ?? 0)
|
|
2798
724
|
})),
|
|
2799
725
|
shareReplay(1),
|
|
2800
|
-
takeUntil(reader.$.destroy$)
|
|
726
|
+
takeUntil$1(reader.$.destroy$)
|
|
2801
727
|
);
|
|
2802
728
|
return {
|
|
2803
729
|
...reader,
|
|
@@ -2899,13 +825,13 @@ const themeEnhancer = (next) => (options) => {
|
|
|
2899
825
|
});
|
|
2900
826
|
reader.spineItems$.pipe(
|
|
2901
827
|
tap((items) => items.map(({ element }) => applyChangeToSpineItemElement({ container: element }))),
|
|
2902
|
-
takeUntil(reader.$.destroy$)
|
|
828
|
+
takeUntil$1(reader.$.destroy$)
|
|
2903
829
|
).subscribe();
|
|
2904
830
|
currentThemeSubject$.pipe(
|
|
2905
831
|
tap(() => {
|
|
2906
832
|
applyChangeToSpineItem();
|
|
2907
833
|
}),
|
|
2908
|
-
takeUntil(reader.$.destroy$)
|
|
834
|
+
takeUntil$1(reader.$.destroy$)
|
|
2909
835
|
).subscribe();
|
|
2910
836
|
return {
|
|
2911
837
|
...reader,
|
|
@@ -3166,7 +1092,7 @@ const zoomEnhancer = (next) => (options) => {
|
|
|
3166
1092
|
isUsingScrollableZoom: isUsingScrollableViewport,
|
|
3167
1093
|
setCurrentScaleAsBase,
|
|
3168
1094
|
$: {
|
|
3169
|
-
isZooming$: currentZoomerSubject$.pipe(switchMap
|
|
1095
|
+
isZooming$: currentZoomerSubject$.pipe(switchMap((zoomer) => (zoomer == null ? void 0 : zoomer.isZooming$) || of(false)))
|
|
3170
1096
|
}
|
|
3171
1097
|
}
|
|
3172
1098
|
};
|
|
@@ -3247,7 +1173,7 @@ const createContext = (initialSettings) => {
|
|
|
3247
1173
|
let manifest;
|
|
3248
1174
|
let loadOptions;
|
|
3249
1175
|
const hasVerticalWritingSubject$ = new BehaviorSubject(false);
|
|
3250
|
-
const loadSubject$ = new Subject
|
|
1176
|
+
const loadSubject$ = new Subject();
|
|
3251
1177
|
const visibleAreaRect = {
|
|
3252
1178
|
width: 0,
|
|
3253
1179
|
height: 0,
|
|
@@ -3256,7 +1182,7 @@ const createContext = (initialSettings) => {
|
|
|
3256
1182
|
};
|
|
3257
1183
|
const marginTop = 0;
|
|
3258
1184
|
const marginBottom = 0;
|
|
3259
|
-
const destroy$ = new Subject
|
|
1185
|
+
const destroy$ = new Subject();
|
|
3260
1186
|
const settings = createSettings(initialSettings);
|
|
3261
1187
|
const shouldDisplaySpread = () => {
|
|
3262
1188
|
const { height, width } = visibleAreaRect;
|
|
@@ -3286,7 +1212,7 @@ const createContext = (initialSettings) => {
|
|
|
3286
1212
|
tap(() => {
|
|
3287
1213
|
settings.recompute({ manifest, hasVerticalWritingSubject: hasVerticalWritingSubject$.value });
|
|
3288
1214
|
}),
|
|
3289
|
-
takeUntil(destroy$)
|
|
1215
|
+
takeUntil$1(destroy$)
|
|
3290
1216
|
).subscribe();
|
|
3291
1217
|
const destroy = () => {
|
|
3292
1218
|
settings.destroy();
|
|
@@ -3451,16 +1377,16 @@ const createLoader = ({
|
|
|
3451
1377
|
context,
|
|
3452
1378
|
viewportState$
|
|
3453
1379
|
}) => {
|
|
3454
|
-
const destroySubject$ = new Subject
|
|
3455
|
-
const loadSubject$ = new Subject
|
|
3456
|
-
const unloadSubject$ = new Subject
|
|
1380
|
+
const destroySubject$ = new Subject();
|
|
1381
|
+
const loadSubject$ = new Subject();
|
|
1382
|
+
const unloadSubject$ = new Subject();
|
|
3457
1383
|
const frameElementSubject$ = new BehaviorSubject(void 0);
|
|
3458
1384
|
const isLoadedSubject$ = new BehaviorSubject(false);
|
|
3459
1385
|
const isReadySubject$ = new BehaviorSubject(false);
|
|
3460
1386
|
let onLoadHookReturns = [];
|
|
3461
1387
|
let computedStyleAfterLoad;
|
|
3462
1388
|
const makeItHot = (source$) => {
|
|
3463
|
-
source$.pipe(takeUntil(context.$.destroy$)).subscribe();
|
|
1389
|
+
source$.pipe(takeUntil$1(context.$.destroy$)).subscribe();
|
|
3464
1390
|
return source$;
|
|
3465
1391
|
};
|
|
3466
1392
|
const getHtmlFromResource = (response) => createHtmlPageFromResource(response, item);
|
|
@@ -3473,7 +1399,7 @@ const createLoader = ({
|
|
|
3473
1399
|
// @todo use takeUntil(load$) when it's the case to cancel
|
|
3474
1400
|
withLatestFrom(frameElementSubject$),
|
|
3475
1401
|
filter(([_, frame]) => !!frame),
|
|
3476
|
-
map(([, frame]) => {
|
|
1402
|
+
map$1(([, frame]) => {
|
|
3477
1403
|
onLoadHookReturns.forEach((fn) => {
|
|
3478
1404
|
if (fn && `unsubscribe` in fn) {
|
|
3479
1405
|
fn.unsubscribe();
|
|
@@ -3486,7 +1412,7 @@ const createLoader = ({
|
|
|
3486
1412
|
frameElementSubject$.next(void 0);
|
|
3487
1413
|
}),
|
|
3488
1414
|
share(),
|
|
3489
|
-
takeUntil(destroySubject$)
|
|
1415
|
+
takeUntil$1(destroySubject$)
|
|
3490
1416
|
);
|
|
3491
1417
|
const load$ = loadSubject$.asObservable().pipe(
|
|
3492
1418
|
withLatestFrom(isLoadedSubject$),
|
|
@@ -3494,7 +1420,7 @@ const createLoader = ({
|
|
|
3494
1420
|
// let's ignore later load as long as the first one still runs
|
|
3495
1421
|
exhaustMap(() => {
|
|
3496
1422
|
return createFrame$().pipe(
|
|
3497
|
-
mergeMap((frame) => waitForViewportFree$.pipe(map(() => frame))),
|
|
1423
|
+
mergeMap((frame) => waitForViewportFree$.pipe(map$1(() => frame))),
|
|
3498
1424
|
mergeMap((frame) => {
|
|
3499
1425
|
parent.appendChild(frame);
|
|
3500
1426
|
frameElementSubject$.next(frame);
|
|
@@ -3505,14 +1431,14 @@ const createLoader = ({
|
|
|
3505
1431
|
return of(frame);
|
|
3506
1432
|
} else {
|
|
3507
1433
|
const fetchFn = fetchResource || (() => fetch(item.href));
|
|
3508
|
-
return from
|
|
1434
|
+
return from(fetchFn(item)).pipe(
|
|
3509
1435
|
mergeMap((response) => getHtmlFromResource(response)),
|
|
3510
1436
|
tap((htmlDoc) => {
|
|
3511
1437
|
if (htmlDoc) {
|
|
3512
1438
|
frame == null ? void 0 : frame.setAttribute(`srcdoc`, htmlDoc);
|
|
3513
1439
|
}
|
|
3514
1440
|
}),
|
|
3515
|
-
map(() => frame),
|
|
1441
|
+
map$1(() => frame),
|
|
3516
1442
|
catchError((e) => {
|
|
3517
1443
|
Report.error(`Error while trying to fetch or load resource for item ${item.id}`);
|
|
3518
1444
|
console.error(e);
|
|
@@ -3523,7 +1449,7 @@ const createLoader = ({
|
|
|
3523
1449
|
}),
|
|
3524
1450
|
mergeMap((frame) => {
|
|
3525
1451
|
if (!frame)
|
|
3526
|
-
return EMPTY
|
|
1452
|
+
return EMPTY;
|
|
3527
1453
|
return fromEvent(frame, `load`).pipe(
|
|
3528
1454
|
take(1),
|
|
3529
1455
|
withLatestFrom(hooks$),
|
|
@@ -3532,7 +1458,7 @@ const createLoader = ({
|
|
|
3532
1458
|
const body = (_a = frame.contentDocument) == null ? void 0 : _a.body;
|
|
3533
1459
|
if (!body) {
|
|
3534
1460
|
Report.error(`Something went wrong on iframe load ${item.id}`);
|
|
3535
|
-
return EMPTY
|
|
1461
|
+
return EMPTY;
|
|
3536
1462
|
}
|
|
3537
1463
|
frame.setAttribute(`role`, `main`);
|
|
3538
1464
|
if ((frame == null ? void 0 : frame.contentDocument) && body) {
|
|
@@ -3557,24 +1483,24 @@ const createLoader = ({
|
|
|
3557
1483
|
);
|
|
3558
1484
|
}),
|
|
3559
1485
|
// we stop loading as soon as unload is requested
|
|
3560
|
-
takeUntil(unloadSubject$)
|
|
1486
|
+
takeUntil$1(unloadSubject$)
|
|
3561
1487
|
);
|
|
3562
1488
|
}),
|
|
3563
1489
|
share(),
|
|
3564
1490
|
makeItHot,
|
|
3565
|
-
takeUntil(destroySubject$)
|
|
1491
|
+
takeUntil$1(destroySubject$)
|
|
3566
1492
|
);
|
|
3567
1493
|
const ready$ = load$.pipe(
|
|
3568
|
-
switchMap((frame) => {
|
|
1494
|
+
switchMap$1((frame) => {
|
|
3569
1495
|
var _a;
|
|
3570
|
-
return from
|
|
1496
|
+
return from(((_a = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _a.fonts.ready) || of(void 0)).pipe(takeUntil$1(unloadSubject$));
|
|
3571
1497
|
}),
|
|
3572
1498
|
share(),
|
|
3573
1499
|
makeItHot,
|
|
3574
|
-
takeUntil(destroySubject$)
|
|
1500
|
+
takeUntil$1(destroySubject$)
|
|
3575
1501
|
);
|
|
3576
|
-
merge(load$.pipe(map(() => true)), unloadSubject$.pipe(map(() => false))).pipe(distinctUntilChanged(), takeUntil(destroySubject$)).subscribe(isLoadedSubject$);
|
|
3577
|
-
merge(ready$.pipe(map(() => true)), unloadSubject$.pipe(map(() => false))).pipe(distinctUntilChanged(), takeUntil(destroySubject$)).subscribe(isReadySubject$);
|
|
1502
|
+
merge(load$.pipe(map$1(() => true)), unloadSubject$.pipe(map$1(() => false))).pipe(distinctUntilChanged(), takeUntil$1(destroySubject$)).subscribe(isLoadedSubject$);
|
|
1503
|
+
merge(ready$.pipe(map$1(() => true)), unloadSubject$.pipe(map$1(() => false))).pipe(distinctUntilChanged(), takeUntil$1(destroySubject$)).subscribe(isReadySubject$);
|
|
3578
1504
|
unload$.subscribe();
|
|
3579
1505
|
return {
|
|
3580
1506
|
load: () => loadSubject$.next(),
|
|
@@ -3609,7 +1535,7 @@ const createFrameItem = ({
|
|
|
3609
1535
|
hooks$,
|
|
3610
1536
|
viewportState$
|
|
3611
1537
|
}) => {
|
|
3612
|
-
const destroySubject$ = new Subject
|
|
1538
|
+
const destroySubject$ = new Subject();
|
|
3613
1539
|
const {
|
|
3614
1540
|
$: { unload$, loaded$, isLoaded$, isReady$, unloaded$, frameElement$, ready$ },
|
|
3615
1541
|
load,
|
|
@@ -3670,8 +1596,8 @@ const createFrameItem = ({
|
|
|
3670
1596
|
return createHtmlPageFromResource(response, item);
|
|
3671
1597
|
};
|
|
3672
1598
|
const contentLayoutChange$ = merge(
|
|
3673
|
-
unloaded$.pipe(map(() => ({ isFirstLayout: false }))),
|
|
3674
|
-
ready$.pipe(map(() => ({ isFirstLayout: true })))
|
|
1599
|
+
unloaded$.pipe(map$1(() => ({ isFirstLayout: false }))),
|
|
1600
|
+
ready$.pipe(map$1(() => ({ isFirstLayout: true })))
|
|
3675
1601
|
);
|
|
3676
1602
|
const destroy = () => {
|
|
3677
1603
|
unload();
|
|
@@ -3742,7 +1668,7 @@ const createFrameItem = ({
|
|
|
3742
1668
|
};
|
|
3743
1669
|
const createFingerTracker = () => {
|
|
3744
1670
|
const fingerPositionInIframe = { x: void 0, y: void 0 };
|
|
3745
|
-
const subject = new Subject
|
|
1671
|
+
const subject = new Subject();
|
|
3746
1672
|
let isMouseDown = false;
|
|
3747
1673
|
const track = (frame) => {
|
|
3748
1674
|
var _a, _b, _c;
|
|
@@ -3779,7 +1705,7 @@ const createFingerTracker = () => {
|
|
|
3779
1705
|
const createSelectionTracker = () => {
|
|
3780
1706
|
let isSelecting = false;
|
|
3781
1707
|
let frame;
|
|
3782
|
-
const subject = new Subject
|
|
1708
|
+
const subject = new Subject();
|
|
3783
1709
|
const mouseUpEvents = [`mouseup`, `pointerup`];
|
|
3784
1710
|
const track = (frameToTrack) => {
|
|
3785
1711
|
var _a, _b;
|
|
@@ -3990,7 +1916,7 @@ const createCommonSpineItem = ({
|
|
|
3990
1916
|
viewportState$
|
|
3991
1917
|
}) => {
|
|
3992
1918
|
var _a;
|
|
3993
|
-
const destroySubject$ = new Subject
|
|
1919
|
+
const destroySubject$ = new Subject();
|
|
3994
1920
|
const containerElement = createContainerElement$1(parentElement, item, hooks$);
|
|
3995
1921
|
const overlayElement = createOverlayElement(parentElement, item);
|
|
3996
1922
|
const fingerTracker = createFingerTracker();
|
|
@@ -4001,7 +1927,7 @@ const createCommonSpineItem = ({
|
|
|
4001
1927
|
item,
|
|
4002
1928
|
context,
|
|
4003
1929
|
fetchResource: (_a = context.getLoadOptions()) == null ? void 0 : _a.fetchResource,
|
|
4004
|
-
hooks$: hooks$.asObservable().pipe(map((hooks) => [...hooks, ...frameHooks])),
|
|
1930
|
+
hooks$: hooks$.asObservable().pipe(map$1((hooks) => [...hooks, ...frameHooks])),
|
|
4005
1931
|
viewportState$
|
|
4006
1932
|
});
|
|
4007
1933
|
containerElement.appendChild(overlayElement);
|
|
@@ -4176,7 +2102,7 @@ const createCommonSpineItem = ({
|
|
|
4176
2102
|
});
|
|
4177
2103
|
const contentLayout$ = spineItemFrame.$.contentLayoutChange$.pipe(
|
|
4178
2104
|
withLatestFrom(spineItemFrame.$.isReady$),
|
|
4179
|
-
map(([data, isReady]) => ({
|
|
2105
|
+
map$1(([data, isReady]) => ({
|
|
4180
2106
|
isFirstLayout: data.isFirstLayout,
|
|
4181
2107
|
isReady
|
|
4182
2108
|
}))
|
|
@@ -5751,9 +3677,9 @@ const createSpine = ({
|
|
|
5751
3677
|
currentNavigationPosition$,
|
|
5752
3678
|
viewportState$
|
|
5753
3679
|
}) => {
|
|
5754
|
-
const spineItems$ = new Subject
|
|
5755
|
-
const itemsBeforeDestroySubject$ = new Subject
|
|
5756
|
-
const subject = new Subject
|
|
3680
|
+
const spineItems$ = new Subject();
|
|
3681
|
+
const itemsBeforeDestroySubject$ = new Subject();
|
|
3682
|
+
const subject = new Subject();
|
|
5757
3683
|
const containerElement = createContainerElement(ownerDocument, hooks$);
|
|
5758
3684
|
const eventsHelper = createEventsHelper({
|
|
5759
3685
|
context,
|
|
@@ -5792,7 +3718,7 @@ const createSpine = ({
|
|
|
5792
3718
|
var _a;
|
|
5793
3719
|
(_a = spineItemManager.get(id)) == null ? void 0 : _a.manipulateSpineItem(cb);
|
|
5794
3720
|
};
|
|
5795
|
-
context.$.load$.pipe(tap(reload), takeUntil(context.$.destroy$)).subscribe();
|
|
3721
|
+
context.$.load$.pipe(tap(reload), takeUntil$1(context.$.destroy$)).subscribe();
|
|
5796
3722
|
const waitForViewportFree$ = viewportState$.pipe(
|
|
5797
3723
|
filter((v) => v === `free`),
|
|
5798
3724
|
take(1)
|
|
@@ -5868,11 +3794,11 @@ const createSpine = ({
|
|
|
5868
3794
|
),
|
|
5869
3795
|
selectionTracker$.pipe(
|
|
5870
3796
|
filter(({ event: event2 }) => event2 === `selectstart`),
|
|
5871
|
-
switchMap(
|
|
3797
|
+
switchMap$1(
|
|
5872
3798
|
(_) => fingerTracker$.pipe(
|
|
5873
3799
|
filter(({ event: event2 }) => event2 === `fingermove`),
|
|
5874
3800
|
debounce(() => interval(1e3)),
|
|
5875
|
-
takeUntil(
|
|
3801
|
+
takeUntil$1(
|
|
5876
3802
|
fingerTracker$.pipe(
|
|
5877
3803
|
filter(({ event: event2 }) => event2 === `fingerout`),
|
|
5878
3804
|
tap(() => {
|
|
@@ -5888,9 +3814,9 @@ const createSpine = ({
|
|
|
5888
3814
|
}),
|
|
5889
3815
|
catchError((e) => {
|
|
5890
3816
|
Report.error(e);
|
|
5891
|
-
return EMPTY
|
|
3817
|
+
return EMPTY;
|
|
5892
3818
|
}),
|
|
5893
|
-
takeUntil(context.$.destroy$)
|
|
3819
|
+
takeUntil$1(context.$.destroy$)
|
|
5894
3820
|
)
|
|
5895
3821
|
).subscribe();
|
|
5896
3822
|
const itemUpdateOnNavigation$ = navigation$.pipe(
|
|
@@ -5972,13 +3898,13 @@ const createSpine = ({
|
|
|
5972
3898
|
time2();
|
|
5973
3899
|
}),
|
|
5974
3900
|
share(),
|
|
5975
|
-
takeUntil(context.$.destroy$)
|
|
3901
|
+
takeUntil$1(context.$.destroy$)
|
|
5976
3902
|
);
|
|
5977
3903
|
itemUpdateOnNavigation$.pipe(
|
|
5978
|
-
switchMap((data) => {
|
|
5979
|
-
return adjustPagination(data.position).pipe(takeUntil(spineItemManager.$.layout$));
|
|
3904
|
+
switchMap$1((data) => {
|
|
3905
|
+
return adjustPagination(data.position).pipe(takeUntil$1(spineItemManager.$.layout$));
|
|
5980
3906
|
}),
|
|
5981
|
-
takeUntil(context.$.destroy$)
|
|
3907
|
+
takeUntil$1(context.$.destroy$)
|
|
5982
3908
|
).subscribe();
|
|
5983
3909
|
merge(
|
|
5984
3910
|
/**
|
|
@@ -5993,10 +3919,10 @@ const createSpine = ({
|
|
|
5993
3919
|
*/
|
|
5994
3920
|
navigationAdjusted$
|
|
5995
3921
|
).pipe(
|
|
5996
|
-
switchMap(() => {
|
|
3922
|
+
switchMap$1(() => {
|
|
5997
3923
|
return waitForViewportFree$.pipe(
|
|
5998
3924
|
withLatestFrom(currentNavigationPosition$),
|
|
5999
|
-
map(([, currentNavigationPosition]) => {
|
|
3925
|
+
map$1(([, currentNavigationPosition]) => {
|
|
6000
3926
|
const focusedSpineItemIndex = spineItemManager.getFocusedSpineItemIndex();
|
|
6001
3927
|
report.log(`update contents`, { focusedSpineItemIndex });
|
|
6002
3928
|
if (focusedSpineItemIndex === void 0)
|
|
@@ -6012,7 +3938,7 @@ const createSpine = ({
|
|
|
6012
3938
|
take(1)
|
|
6013
3939
|
);
|
|
6014
3940
|
}),
|
|
6015
|
-
takeUntil(context.$.destroy$)
|
|
3941
|
+
takeUntil$1(context.$.destroy$)
|
|
6016
3942
|
).subscribe();
|
|
6017
3943
|
return {
|
|
6018
3944
|
element: containerElement,
|
|
@@ -6073,8 +3999,8 @@ const getCoverItem = (manifest) => {
|
|
|
6073
3999
|
};
|
|
6074
4000
|
const NAMESPACE$4 = `spineItemManager`;
|
|
6075
4001
|
const createSpineItemManager = ({ context }) => {
|
|
6076
|
-
const focus$ = new Subject
|
|
6077
|
-
const layout$ = new Subject
|
|
4002
|
+
const focus$ = new Subject();
|
|
4003
|
+
const layout$ = new Subject();
|
|
6078
4004
|
let itemLayoutInformation = [];
|
|
6079
4005
|
const orderedSpineItemsSubject$ = new BehaviorSubject([]);
|
|
6080
4006
|
let focusedSpineItemIndex;
|
|
@@ -6235,7 +4161,7 @@ const createSpineItemManager = ({ context }) => {
|
|
|
6235
4161
|
};
|
|
6236
4162
|
const add = (spineItem) => {
|
|
6237
4163
|
orderedSpineItemsSubject$.value.push(spineItem);
|
|
6238
|
-
spineItem.$.contentLayout$.pipe(takeUntil(context.$.destroy$)).subscribe(() => {
|
|
4164
|
+
spineItem.$.contentLayout$.pipe(takeUntil$1(context.$.destroy$)).subscribe(() => {
|
|
6239
4165
|
layout();
|
|
6240
4166
|
});
|
|
6241
4167
|
spineItem.$.loaded$.pipe(
|
|
@@ -6244,7 +4170,7 @@ const createSpineItemManager = ({ context }) => {
|
|
|
6244
4170
|
context.setHasVerticalWriting();
|
|
6245
4171
|
}
|
|
6246
4172
|
}),
|
|
6247
|
-
takeUntil(context.$.destroy$)
|
|
4173
|
+
takeUntil$1(context.$.destroy$)
|
|
6248
4174
|
).subscribe();
|
|
6249
4175
|
spineItem.load();
|
|
6250
4176
|
};
|
|
@@ -6283,8 +4209,8 @@ const createSpineItemManager = ({ context }) => {
|
|
|
6283
4209
|
focus$: focus$.asObservable(),
|
|
6284
4210
|
layout$: layout$.asObservable(),
|
|
6285
4211
|
itemIsReady$: orderedSpineItemsSubject$.asObservable().pipe(
|
|
6286
|
-
switchMap((items) => {
|
|
6287
|
-
const itemsIsReady$ = items.map((item) => item.$.isReady$.pipe(map((isReady) => ({ item: item.item, isReady }))));
|
|
4212
|
+
switchMap$1((items) => {
|
|
4213
|
+
const itemsIsReady$ = items.map((item) => item.$.isReady$.pipe(map$1((isReady) => ({ item: item.item, isReady }))));
|
|
6288
4214
|
return merge(...itemsIsReady$);
|
|
6289
4215
|
})
|
|
6290
4216
|
)
|
|
@@ -6728,14 +4654,14 @@ const createScrollViewportNavigator = ({
|
|
|
6728
4654
|
return false;
|
|
6729
4655
|
};
|
|
6730
4656
|
const runOnFreePageTurnModeOnly$ = (source) => context.$.settings$.pipe(
|
|
6731
|
-
map(() => context.getSettings().computedPageTurnMode),
|
|
4657
|
+
map$1(() => context.getSettings().computedPageTurnMode),
|
|
6732
4658
|
distinctUntilChanged(),
|
|
6733
|
-
switchMap((mode) => iif(() => mode === `controlled`, EMPTY
|
|
4659
|
+
switchMap$1((mode) => iif(() => mode === `controlled`, EMPTY, source))
|
|
6734
4660
|
);
|
|
6735
4661
|
const userScroll$ = runOnFreePageTurnModeOnly$(fromEvent(element, `scroll`)).pipe(
|
|
6736
4662
|
onlyUserScrollFilter,
|
|
6737
4663
|
share(),
|
|
6738
|
-
takeUntil(context.$.destroy$)
|
|
4664
|
+
takeUntil$1(context.$.destroy$)
|
|
6739
4665
|
);
|
|
6740
4666
|
const getScaledDownPosition = ({ x, y }) => {
|
|
6741
4667
|
const spineScaleX = spine.element.getBoundingClientRect().width / spine.element.offsetWidth;
|
|
@@ -6767,7 +4693,7 @@ const createScrollViewportNavigator = ({
|
|
|
6767
4693
|
const navigationOnScroll$ = userScroll$.pipe(
|
|
6768
4694
|
debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, animationFrameScheduler),
|
|
6769
4695
|
withLatestFrom(currentNavigationSubject$),
|
|
6770
|
-
switchMap(() => {
|
|
4696
|
+
switchMap$1(() => {
|
|
6771
4697
|
const navigation = getNavigationForPosition(getScaledDownPosition({ x: element.scrollLeft, y: element.scrollTop }));
|
|
6772
4698
|
return of({ position: navigation, animate: false, lastUserExpectedNavigation: void 0 });
|
|
6773
4699
|
}),
|
|
@@ -6776,14 +4702,14 @@ const createScrollViewportNavigator = ({
|
|
|
6776
4702
|
const userScrollEnd$ = userScroll$.pipe(
|
|
6777
4703
|
debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, animationFrameScheduler),
|
|
6778
4704
|
share(),
|
|
6779
|
-
takeUntil(context.$.destroy$)
|
|
4705
|
+
takeUntil$1(context.$.destroy$)
|
|
6780
4706
|
);
|
|
6781
4707
|
const state$ = merge(
|
|
6782
4708
|
userScroll$.pipe(
|
|
6783
|
-
map(() => `start`),
|
|
4709
|
+
map$1(() => `start`),
|
|
6784
4710
|
distinctUntilChanged()
|
|
6785
4711
|
),
|
|
6786
|
-
userScrollEnd$.pipe(map(() => `end`))
|
|
4712
|
+
userScrollEnd$.pipe(map$1(() => `end`))
|
|
6787
4713
|
).pipe(startWith(`end`));
|
|
6788
4714
|
return {
|
|
6789
4715
|
destroy: () => {
|
|
@@ -6806,7 +4732,7 @@ const createManualViewportNavigator = ({
|
|
|
6806
4732
|
context
|
|
6807
4733
|
}) => {
|
|
6808
4734
|
const stateSubject$ = new BehaviorSubject(`end`);
|
|
6809
|
-
const navigationTriggerSubject$ = new Subject
|
|
4735
|
+
const navigationTriggerSubject$ = new Subject();
|
|
6810
4736
|
const turnLeft = ({ allowSpineItemChange = true } = {}) => navigationTriggerSubject$.next({ type: `leftPage`, data: { allowSpineItemChange } });
|
|
6811
4737
|
const turnRight = ({ allowSpineItemChange = true } = {}) => {
|
|
6812
4738
|
navigationTriggerSubject$.next({ type: `rightPage`, data: { allowSpineItemChange } });
|
|
@@ -6820,7 +4746,7 @@ const createManualViewportNavigator = ({
|
|
|
6820
4746
|
};
|
|
6821
4747
|
const urlNavigation$ = navigationTriggerSubject$.pipe(
|
|
6822
4748
|
filter((e) => e.type === `url`),
|
|
6823
|
-
switchMap(({ data }) => {
|
|
4749
|
+
switchMap$1(({ data }) => {
|
|
6824
4750
|
const navigation = navigator2.getNavigationForUrl(data);
|
|
6825
4751
|
Report.log(NAMESPACE$2, `urlNavigation`, { data, navigation });
|
|
6826
4752
|
if (navigation) {
|
|
@@ -6830,12 +4756,12 @@ const createManualViewportNavigator = ({
|
|
|
6830
4756
|
lastUserExpectedNavigation: { type: `navigate-from-anchor`, data: navigation.url.hash }
|
|
6831
4757
|
});
|
|
6832
4758
|
}
|
|
6833
|
-
return EMPTY
|
|
4759
|
+
return EMPTY;
|
|
6834
4760
|
})
|
|
6835
4761
|
);
|
|
6836
4762
|
const spineItemNavigation$ = navigationTriggerSubject$.pipe(
|
|
6837
4763
|
filter((e) => e.type === `spineItem`),
|
|
6838
|
-
switchMap(({ data: { animate, indexOrId } }) => {
|
|
4764
|
+
switchMap$1(({ data: { animate, indexOrId } }) => {
|
|
6839
4765
|
const navigation = navigator2.getNavigationForSpineIndexOrId(indexOrId);
|
|
6840
4766
|
const lastUserExpectedNavigation = { type: `navigate-from-previous-item` };
|
|
6841
4767
|
Report.log(NAMESPACE$2, `goToSpineItem`, { indexOrId, animate, navigation });
|
|
@@ -6844,7 +4770,7 @@ const createManualViewportNavigator = ({
|
|
|
6844
4770
|
);
|
|
6845
4771
|
const cfiNavigation$ = navigationTriggerSubject$.pipe(
|
|
6846
4772
|
filter((e) => e.type === `cfi`),
|
|
6847
|
-
map(({ data: { animate, cfi } }) => {
|
|
4773
|
+
map$1(({ data: { animate, cfi } }) => {
|
|
6848
4774
|
const navigation = navigator2.getNavigationForCfi(cfi);
|
|
6849
4775
|
Report.log(NAMESPACE$2, `goToCfi`, { cfi, animate, navigation });
|
|
6850
4776
|
return {
|
|
@@ -6856,13 +4782,13 @@ const createManualViewportNavigator = ({
|
|
|
6856
4782
|
);
|
|
6857
4783
|
const chapterPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6858
4784
|
filter((e) => e.type === `chapterPage`),
|
|
6859
|
-
switchMap(({ data: { pageIndex } }) => {
|
|
4785
|
+
switchMap$1(({ data: { pageIndex } }) => {
|
|
6860
4786
|
const spineItem = spineItemManager.getFocusedSpineItem();
|
|
6861
4787
|
if (spineItem) {
|
|
6862
4788
|
const navigation = navigator2.getNavigationForPage(pageIndex, spineItem);
|
|
6863
4789
|
return of({ ...navigation, lastUserExpectedNavigation: void 0, animate: true });
|
|
6864
4790
|
}
|
|
6865
|
-
return EMPTY
|
|
4791
|
+
return EMPTY;
|
|
6866
4792
|
})
|
|
6867
4793
|
);
|
|
6868
4794
|
const pageNavigation$ = navigationTriggerSubject$.pipe(
|
|
@@ -6875,7 +4801,7 @@ const createManualViewportNavigator = ({
|
|
|
6875
4801
|
}
|
|
6876
4802
|
return true;
|
|
6877
4803
|
}),
|
|
6878
|
-
switchMap(({ data: { pageIndex } }) => {
|
|
4804
|
+
switchMap$1(({ data: { pageIndex } }) => {
|
|
6879
4805
|
return of({
|
|
6880
4806
|
...navigator2.getNavigationForPage(pageIndex),
|
|
6881
4807
|
lastUserExpectedNavigation: void 0,
|
|
@@ -6889,7 +4815,7 @@ const createManualViewportNavigator = ({
|
|
|
6889
4815
|
(navigation, { allowSpineItemChange = true } = {}) => {
|
|
6890
4816
|
const currentSpineItem = spineItemManager.getFocusedSpineItem();
|
|
6891
4817
|
if (!currentSpineItem)
|
|
6892
|
-
return EMPTY
|
|
4818
|
+
return EMPTY;
|
|
6893
4819
|
const newSpineItem = locator.getSpineItemFromPosition(navigation) || currentSpineItem;
|
|
6894
4820
|
const spineItemHasChanged = newSpineItem !== currentSpineItem;
|
|
6895
4821
|
if (spineItemHasChanged) {
|
|
@@ -6912,13 +4838,13 @@ const createManualViewportNavigator = ({
|
|
|
6912
4838
|
} else {
|
|
6913
4839
|
return of({ ...navigation, lastUserExpectedNavigation: void 0, animate: true });
|
|
6914
4840
|
}
|
|
6915
|
-
return EMPTY
|
|
4841
|
+
return EMPTY;
|
|
6916
4842
|
}
|
|
6917
4843
|
);
|
|
6918
4844
|
const leftPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6919
4845
|
filter((e) => e.type === `leftPage`),
|
|
6920
4846
|
withLatestFrom(currentNavigationSubject$),
|
|
6921
|
-
switchMap(
|
|
4847
|
+
switchMap$1(
|
|
6922
4848
|
([
|
|
6923
4849
|
{
|
|
6924
4850
|
data: { allowSpineItemChange }
|
|
@@ -6934,7 +4860,7 @@ const createManualViewportNavigator = ({
|
|
|
6934
4860
|
const rightPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6935
4861
|
filter((e) => e.type === `rightPage`),
|
|
6936
4862
|
withLatestFrom(currentNavigationSubject$),
|
|
6937
|
-
switchMap(
|
|
4863
|
+
switchMap$1(
|
|
6938
4864
|
([
|
|
6939
4865
|
{
|
|
6940
4866
|
data: { allowSpineItemChange }
|
|
@@ -6963,7 +4889,7 @@ const createManualViewportNavigator = ({
|
|
|
6963
4889
|
*/
|
|
6964
4890
|
withLatestFrom(currentNavigationSubject$),
|
|
6965
4891
|
filter(([navigation, currentNavigation]) => navigator2.areNavigationDifferent(navigation, currentNavigation)),
|
|
6966
|
-
map(([navigation]) => navigation)
|
|
4892
|
+
map$1(([navigation]) => navigation)
|
|
6967
4893
|
);
|
|
6968
4894
|
return {
|
|
6969
4895
|
destroy: () => {
|
|
@@ -6993,11 +4919,11 @@ const createPanViewportNavigator = ({
|
|
|
6993
4919
|
context,
|
|
6994
4920
|
currentNavigationSubject$
|
|
6995
4921
|
}) => {
|
|
6996
|
-
const navigationTriggerSubject$ = new Subject
|
|
4922
|
+
const navigationTriggerSubject$ = new Subject();
|
|
6997
4923
|
const stateSubject$ = new BehaviorSubject(`end`);
|
|
6998
4924
|
let movingLastDelta = { x: 0, y: 0 };
|
|
6999
4925
|
let movingLastPosition = { x: 0, y: 0 };
|
|
7000
|
-
const moveToSubject$ = new Subject
|
|
4926
|
+
const moveToSubject$ = new Subject();
|
|
7001
4927
|
const moveTo = Report.measurePerformance(
|
|
7002
4928
|
`${NAMESPACE$1} moveTo`,
|
|
7003
4929
|
5,
|
|
@@ -7067,7 +4993,7 @@ const createPanViewportNavigator = ({
|
|
|
7067
4993
|
const snapNavigation$ = navigationTriggerSubject$.pipe(
|
|
7068
4994
|
filter((e) => e.type === `snap`),
|
|
7069
4995
|
withLatestFrom$1(context.$.settings$),
|
|
7070
|
-
switchMap(
|
|
4996
|
+
switchMap$1(
|
|
7071
4997
|
([
|
|
7072
4998
|
{
|
|
7073
4999
|
data: { from: from2, to }
|
|
@@ -7119,7 +5045,7 @@ const createViewportNavigator = ({
|
|
|
7119
5045
|
}) => {
|
|
7120
5046
|
const element = createElement(parentElement.ownerDocument, hooks$);
|
|
7121
5047
|
element.appendChild(spine.element);
|
|
7122
|
-
const layoutSubject$ = new Subject
|
|
5048
|
+
const layoutSubject$ = new Subject();
|
|
7123
5049
|
let currentViewportPositionMemoUnused;
|
|
7124
5050
|
const currentNavigationPositionSubject$ = new BehaviorSubject({
|
|
7125
5051
|
x: -1,
|
|
@@ -7132,7 +5058,7 @@ const createViewportNavigator = ({
|
|
|
7132
5058
|
cfiLocator,
|
|
7133
5059
|
locator: spineLocator
|
|
7134
5060
|
});
|
|
7135
|
-
const adjustNavigationSubject$ = new Subject
|
|
5061
|
+
const adjustNavigationSubject$ = new Subject();
|
|
7136
5062
|
parentElement.appendChild(element);
|
|
7137
5063
|
const getCurrentViewportPosition = Report.measurePerformance(`${NAMESPACE} getCurrentViewportPosition`, 1, () => {
|
|
7138
5064
|
if (context.getSettings().computedPageTurnMode === `scrollable`) {
|
|
@@ -7179,7 +5105,7 @@ const createViewportNavigator = ({
|
|
|
7179
5105
|
const viewportNavigatorsSharedState$ = merge(...viewportNavigators.map(({ $: { state$: state$2 } }) => state$2));
|
|
7180
5106
|
let lastUserExpectedNavigation;
|
|
7181
5107
|
const makeItHot = (source$) => {
|
|
7182
|
-
source$.pipe(takeUntil(context.$.destroy$)).subscribe();
|
|
5108
|
+
source$.pipe(takeUntil$1(context.$.destroy$)).subscribe();
|
|
7183
5109
|
return source$;
|
|
7184
5110
|
};
|
|
7185
5111
|
const adjustReadingOffset = Report.measurePerformance(
|
|
@@ -7271,7 +5197,7 @@ const createViewportNavigator = ({
|
|
|
7271
5197
|
layout$.subscribe();
|
|
7272
5198
|
const navigation$ = merge(
|
|
7273
5199
|
panViewportNavigator.$.navigation$.pipe(
|
|
7274
|
-
map((event) => ({
|
|
5200
|
+
map$1((event) => ({
|
|
7275
5201
|
...event,
|
|
7276
5202
|
position: { x: event.x, y: event.y, spineItem: event.spineItem },
|
|
7277
5203
|
animation: `snap`,
|
|
@@ -7279,7 +5205,7 @@ const createViewportNavigator = ({
|
|
|
7279
5205
|
}))
|
|
7280
5206
|
),
|
|
7281
5207
|
manualViewportNavigator.$.navigation$.pipe(
|
|
7282
|
-
map((event) => ({
|
|
5208
|
+
map$1((event) => ({
|
|
7283
5209
|
...event,
|
|
7284
5210
|
position: { x: event.x, y: event.y, spineItem: event.spineItem },
|
|
7285
5211
|
animation: event.animate ? `turn` : false,
|
|
@@ -7287,21 +5213,21 @@ const createViewportNavigator = ({
|
|
|
7287
5213
|
}))
|
|
7288
5214
|
),
|
|
7289
5215
|
adjustNavigationSubject$.pipe(
|
|
7290
|
-
map((event) => ({
|
|
5216
|
+
map$1((event) => ({
|
|
7291
5217
|
...event,
|
|
7292
5218
|
triggeredBy: `adjust`,
|
|
7293
5219
|
animation: event.animate ? `turn` : false
|
|
7294
5220
|
}))
|
|
7295
5221
|
),
|
|
7296
5222
|
scrollViewportNavigator.$.navigation$.pipe(
|
|
7297
|
-
map((event) => ({
|
|
5223
|
+
map$1((event) => ({
|
|
7298
5224
|
...event,
|
|
7299
5225
|
triggeredBy: `scroll`,
|
|
7300
5226
|
animation: event.animate ? `turn` : false
|
|
7301
5227
|
}))
|
|
7302
5228
|
)
|
|
7303
5229
|
).pipe(
|
|
7304
|
-
map((event) => {
|
|
5230
|
+
map$1((event) => {
|
|
7305
5231
|
if (`lastUserExpectedNavigation` in event) {
|
|
7306
5232
|
lastUserExpectedNavigation = event.lastUserExpectedNavigation;
|
|
7307
5233
|
}
|
|
@@ -7309,7 +5235,7 @@ const createViewportNavigator = ({
|
|
|
7309
5235
|
return { ...event, lastUserExpectedNavigation };
|
|
7310
5236
|
}),
|
|
7311
5237
|
share(),
|
|
7312
|
-
takeUntil(context.$.destroy$)
|
|
5238
|
+
takeUntil$1(context.$.destroy$)
|
|
7313
5239
|
);
|
|
7314
5240
|
const navigationWhichRequireManualAdjust$ = navigation$.pipe(
|
|
7315
5241
|
filter(({ triggeredBy }) => {
|
|
@@ -7321,10 +5247,10 @@ const createViewportNavigator = ({
|
|
|
7321
5247
|
})
|
|
7322
5248
|
);
|
|
7323
5249
|
const manualAdjust$ = merge(
|
|
7324
|
-
panViewportNavigator.$.moveToSubject$.asObservable().pipe(map((event) => ({ ...event, animation: false }))),
|
|
5250
|
+
panViewportNavigator.$.moveToSubject$.asObservable().pipe(map$1((event) => ({ ...event, animation: false }))),
|
|
7325
5251
|
navigationWhichRequireManualAdjust$
|
|
7326
5252
|
).pipe(
|
|
7327
|
-
map(({ animation, position }) => {
|
|
5253
|
+
map$1(({ animation, position }) => {
|
|
7328
5254
|
const shouldAnimate = !(!animation || animation === `turn` && context.getSettings().computedPageTurnAnimation === `none`);
|
|
7329
5255
|
return {
|
|
7330
5256
|
type: `manualAdjust`,
|
|
@@ -7344,9 +5270,9 @@ const createViewportNavigator = ({
|
|
|
7344
5270
|
element.style.setProperty(`opacity`, `1`);
|
|
7345
5271
|
}
|
|
7346
5272
|
}),
|
|
7347
|
-
switchMap(([, currentEvent]) => {
|
|
5273
|
+
switchMap$1(([, currentEvent]) => {
|
|
7348
5274
|
if ((currentEvent == null ? void 0 : currentEvent.type) !== `manualAdjust`)
|
|
7349
|
-
return EMPTY
|
|
5275
|
+
return EMPTY;
|
|
7350
5276
|
const animationDuration = currentEvent.animation === `snap` ? context.getSettings().computedSnapAnimationDuration : context.getSettings().computedPageTurnAnimationDuration;
|
|
7351
5277
|
const pageTurnAnimation = currentEvent.animation === `snap` ? `slide` : context.getSettings().computedPageTurnAnimation;
|
|
7352
5278
|
return of(currentEvent).pipe(
|
|
@@ -7358,7 +5284,7 @@ const createViewportNavigator = ({
|
|
|
7358
5284
|
* anything for x ms while we effectively adjust. We want it to be immediate.
|
|
7359
5285
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
7360
5286
|
*/
|
|
7361
|
-
currentEvent.shouldAnimate ? delay(1, animationFrameScheduler) : identity
|
|
5287
|
+
currentEvent.shouldAnimate ? delay(1, animationFrameScheduler) : identity,
|
|
7362
5288
|
tap((data) => {
|
|
7363
5289
|
const noAdjustmentNeeded = false;
|
|
7364
5290
|
if (data.shouldAnimate && !noAdjustmentNeeded) {
|
|
@@ -7388,20 +5314,20 @@ const createViewportNavigator = ({
|
|
|
7388
5314
|
adjustReadingOffset(data.position, hooks);
|
|
7389
5315
|
}
|
|
7390
5316
|
}),
|
|
7391
|
-
currentEvent.shouldAnimate ? delay(animationDuration / 2, animationFrameScheduler) : identity
|
|
5317
|
+
currentEvent.shouldAnimate ? delay(animationDuration / 2, animationFrameScheduler) : identity,
|
|
7392
5318
|
tap(([data, hooks]) => {
|
|
7393
5319
|
if (pageTurnAnimation === `fade`) {
|
|
7394
5320
|
adjustReadingOffset(data.position, hooks);
|
|
7395
5321
|
element.style.setProperty(`opacity`, `1`);
|
|
7396
5322
|
}
|
|
7397
5323
|
}),
|
|
7398
|
-
currentEvent.shouldAnimate ? delay(animationDuration / 2, animationFrameScheduler) : identity
|
|
5324
|
+
currentEvent.shouldAnimate ? delay(animationDuration / 2, animationFrameScheduler) : identity,
|
|
7399
5325
|
tap(([data, hooks]) => {
|
|
7400
5326
|
if (pageTurnAnimation === `fade`) {
|
|
7401
5327
|
adjustReadingOffset(data.position, hooks);
|
|
7402
5328
|
}
|
|
7403
5329
|
}),
|
|
7404
|
-
takeUntil(
|
|
5330
|
+
takeUntil$1(
|
|
7405
5331
|
viewportNavigatorsSharedState$.pipe(
|
|
7406
5332
|
filter((state) => state === `start`),
|
|
7407
5333
|
skip(1)
|
|
@@ -7410,14 +5336,14 @@ const createViewportNavigator = ({
|
|
|
7410
5336
|
);
|
|
7411
5337
|
}),
|
|
7412
5338
|
share(),
|
|
7413
|
-
takeUntil(context.$.destroy$)
|
|
5339
|
+
takeUntil$1(context.$.destroy$)
|
|
7414
5340
|
);
|
|
7415
5341
|
const adjustmentState$ = merge(
|
|
7416
|
-
merge(manualAdjust$).pipe(map(() => `start`)),
|
|
7417
|
-
merge(processManualAdjust$).pipe(map(() => `end`))
|
|
5342
|
+
merge(manualAdjust$).pipe(map$1(() => `start`)),
|
|
5343
|
+
merge(processManualAdjust$).pipe(map$1(() => `end`))
|
|
7418
5344
|
);
|
|
7419
5345
|
const state$ = combineLatest([...viewportNavigators.map(({ $: { state$: state$2 } }) => state$2), adjustmentState$]).pipe(
|
|
7420
|
-
map((states) => states.every((state) => state === `end`) ? `free` : `busy`),
|
|
5346
|
+
map$1((states) => states.every((state) => state === `end`) ? `free` : `busy`),
|
|
7421
5347
|
distinctUntilChanged(),
|
|
7422
5348
|
shareReplay(1),
|
|
7423
5349
|
/**
|
|
@@ -7451,15 +5377,15 @@ const createViewportNavigator = ({
|
|
|
7451
5377
|
* - do not use debounce / throttle and navigate back to the item right on the same tick
|
|
7452
5378
|
*/
|
|
7453
5379
|
// debounceTime(10, animationFrameScheduler),
|
|
7454
|
-
switchMap(
|
|
5380
|
+
switchMap$1(
|
|
7455
5381
|
() => waitForViewportFree$.pipe(
|
|
7456
|
-
switchMap(() => {
|
|
5382
|
+
switchMap$1(() => {
|
|
7457
5383
|
const focusedSpineItem = spineItemManager.getFocusedSpineItem();
|
|
7458
5384
|
if (!focusedSpineItem)
|
|
7459
|
-
return EMPTY
|
|
5385
|
+
return EMPTY;
|
|
7460
5386
|
return adjustNavigation(focusedSpineItem);
|
|
7461
5387
|
}),
|
|
7462
|
-
takeUntil(navigation$)
|
|
5388
|
+
takeUntil$1(navigation$)
|
|
7463
5389
|
)
|
|
7464
5390
|
),
|
|
7465
5391
|
share()
|
|
@@ -7701,12 +5627,12 @@ const createReader = ({ containerElement, hooks: initialHooks, ...settings }) =>
|
|
|
7701
5627
|
supportedPageTurnDirection: [`horizontal`, `vertical`],
|
|
7702
5628
|
supportedComputedPageTurnDirection: [`horizontal`, `vertical`]
|
|
7703
5629
|
});
|
|
7704
|
-
const readySubject$ = new Subject
|
|
7705
|
-
const destroy$ = new Subject
|
|
7706
|
-
const selectionSubject$ = new Subject
|
|
5630
|
+
const readySubject$ = new Subject();
|
|
5631
|
+
const destroy$ = new Subject();
|
|
5632
|
+
const selectionSubject$ = new Subject();
|
|
7707
5633
|
const hooksSubject$ = new BehaviorSubject(initialHooks || []);
|
|
7708
|
-
const navigationSubject = new Subject
|
|
7709
|
-
const navigationAdjustedSubject = new Subject
|
|
5634
|
+
const navigationSubject = new Subject();
|
|
5635
|
+
const navigationAdjustedSubject = new Subject();
|
|
7710
5636
|
const currentNavigationPositionSubject$ = new BehaviorSubject({ x: 0, y: 0 });
|
|
7711
5637
|
const viewportStateSubject = new BehaviorSubject(`free`);
|
|
7712
5638
|
const context = createContext(settings);
|
|
@@ -7807,18 +5733,18 @@ const createReader = ({ containerElement, hooks: initialHooks, ...settings }) =>
|
|
|
7807
5733
|
selectionSubject$.next(event.data);
|
|
7808
5734
|
}
|
|
7809
5735
|
}),
|
|
7810
|
-
takeUntil(destroy$)
|
|
5736
|
+
takeUntil$1(destroy$)
|
|
7811
5737
|
).subscribe();
|
|
7812
5738
|
viewportNavigator.$.navigationAdjustedAfterLayout$.pipe(
|
|
7813
|
-
switchMap
|
|
7814
|
-
return spine.adjustPagination(adjustedSpinePosition).pipe(takeUntil(navigation$));
|
|
5739
|
+
switchMap(({ adjustedSpinePosition }) => {
|
|
5740
|
+
return spine.adjustPagination(adjustedSpinePosition).pipe(takeUntil$1(navigation$));
|
|
7815
5741
|
}),
|
|
7816
|
-
takeUntil(context.$.destroy$)
|
|
5742
|
+
takeUntil$1(context.$.destroy$)
|
|
7817
5743
|
).subscribe();
|
|
7818
5744
|
merge(context.$.load$, context.$.settings$, context.$.hasVerticalWriting$).pipe(
|
|
7819
5745
|
mapTo(void 0),
|
|
7820
5746
|
withLatestFrom(context.$.hasVerticalWriting$),
|
|
7821
|
-
map(([, hasVerticalWriting]) => {
|
|
5747
|
+
map$1(([, hasVerticalWriting]) => {
|
|
7822
5748
|
const settings2 = context.getSettings();
|
|
7823
5749
|
const manifest = context.getManifest();
|
|
7824
5750
|
return {
|
|
@@ -7829,7 +5755,7 @@ const createReader = ({ containerElement, hooks: initialHooks, ...settings }) =>
|
|
|
7829
5755
|
};
|
|
7830
5756
|
}),
|
|
7831
5757
|
distinctUntilChanged(isShallowEqual),
|
|
7832
|
-
map(
|
|
5758
|
+
map$1(
|
|
7833
5759
|
({
|
|
7834
5760
|
hasVerticalWriting,
|
|
7835
5761
|
renditionFlow,
|
|
@@ -7842,7 +5768,7 @@ const createReader = ({ containerElement, hooks: initialHooks, ...settings }) =>
|
|
|
7842
5768
|
supportedPageTurnDirection: computedPageTurnMode === `scrollable` ? [`vertical`] : renditionLayout === `reflowable` ? [`horizontal`] : [`horizontal`, `vertical`]
|
|
7843
5769
|
})
|
|
7844
5770
|
),
|
|
7845
|
-
takeUntil(destroy$)
|
|
5771
|
+
takeUntil$1(destroy$)
|
|
7846
5772
|
).subscribe(stateSubject$);
|
|
7847
5773
|
const destroy = () => {
|
|
7848
5774
|
hooksSubject$.next([]);
|
|
@@ -8067,7 +5993,7 @@ const openDatabase = async (name) => {
|
|
|
8067
5993
|
};
|
|
8068
5994
|
const createResourcesManager = (context) => {
|
|
8069
5995
|
let uniqueID = Date.now().toString();
|
|
8070
|
-
const cache$ = new Subject
|
|
5996
|
+
const cache$ = new Subject();
|
|
8071
5997
|
const retrieveItem = (itemIndexOrId) => {
|
|
8072
5998
|
var _a, _b;
|
|
8073
5999
|
if (typeof itemIndexOrId === `string` || typeof itemIndexOrId === `object`) {
|
|
@@ -8097,18 +6023,18 @@ const createResourcesManager = (context) => {
|
|
|
8097
6023
|
mergeMap(({ id, data }) => {
|
|
8098
6024
|
const item = retrieveItem(id);
|
|
8099
6025
|
if (!item)
|
|
8100
|
-
return EMPTY
|
|
8101
|
-
return from
|
|
8102
|
-
switchMap(([db, blob]) => {
|
|
8103
|
-
return from
|
|
6026
|
+
return EMPTY;
|
|
6027
|
+
return from(forkJoin([openDatabase(`prose-reader`), from(data.blob())])).pipe(
|
|
6028
|
+
switchMap$1(([db, blob]) => {
|
|
6029
|
+
return from(db.put(`${uniqueID}_${item.id}`, blob));
|
|
8104
6030
|
}),
|
|
8105
6031
|
catchError((error) => {
|
|
8106
6032
|
Report.error(error);
|
|
8107
|
-
return EMPTY
|
|
6033
|
+
return EMPTY;
|
|
8108
6034
|
})
|
|
8109
6035
|
);
|
|
8110
6036
|
}),
|
|
8111
|
-
takeUntil(context.$.destroy$)
|
|
6037
|
+
takeUntil$1(context.$.destroy$)
|
|
8112
6038
|
).subscribe();
|
|
8113
6039
|
const onLoad$ = context.$.load$.pipe(
|
|
8114
6040
|
tap(() => {
|
|
@@ -8116,25 +6042,25 @@ const createResourcesManager = (context) => {
|
|
|
8116
6042
|
})
|
|
8117
6043
|
);
|
|
8118
6044
|
merge(onLoad$).pipe(
|
|
8119
|
-
switchMap(() => {
|
|
6045
|
+
switchMap$1(() => {
|
|
8120
6046
|
Report.log(`Cleanup up old cache...`);
|
|
8121
|
-
return from
|
|
8122
|
-
switchMap(
|
|
8123
|
-
(db) => from
|
|
8124
|
-
map((keys) => keys.filter((key) => !key.toString().startsWith(uniqueID))),
|
|
8125
|
-
switchMap((keysToRemove) => {
|
|
6047
|
+
return from(openDatabase(`prose-reader`)).pipe(
|
|
6048
|
+
switchMap$1(
|
|
6049
|
+
(db) => from(db.keys()).pipe(
|
|
6050
|
+
map$1((keys) => keys.filter((key) => !key.toString().startsWith(uniqueID))),
|
|
6051
|
+
switchMap$1((keysToRemove) => {
|
|
8126
6052
|
const promises = keysToRemove.map((key) => db.remove(key));
|
|
8127
|
-
return from
|
|
6053
|
+
return from(Promise.all(promises));
|
|
8128
6054
|
})
|
|
8129
6055
|
)
|
|
8130
6056
|
),
|
|
8131
6057
|
catchError((error) => {
|
|
8132
6058
|
Report.error(error);
|
|
8133
|
-
return EMPTY
|
|
6059
|
+
return EMPTY;
|
|
8134
6060
|
})
|
|
8135
6061
|
);
|
|
8136
6062
|
}),
|
|
8137
|
-
takeUntil(context.$.destroy$)
|
|
6063
|
+
takeUntil$1(context.$.destroy$)
|
|
8138
6064
|
).subscribe();
|
|
8139
6065
|
const destroy = () => {
|
|
8140
6066
|
cache$.complete();
|
|
@@ -8379,7 +6305,7 @@ const loadingEnhancer = (next) => (options) => {
|
|
|
8379
6305
|
}, {})
|
|
8380
6306
|
);
|
|
8381
6307
|
const updateEntriesLayout$ = (entries) => combineLatest([reader.$.layout$, reader.theme.$.theme$]).pipe(
|
|
8382
|
-
map(([, theme]) => ({
|
|
6308
|
+
map$1(([, theme]) => ({
|
|
8383
6309
|
width: reader.context.getVisibleAreaRect().width,
|
|
8384
6310
|
theme
|
|
8385
6311
|
})),
|
|
@@ -8398,20 +6324,20 @@ const loadingEnhancer = (next) => (options) => {
|
|
|
8398
6324
|
})
|
|
8399
6325
|
);
|
|
8400
6326
|
const destroyEntries$ = (entries) => reader.$.itemsBeforeDestroy$.pipe(
|
|
8401
|
-
map(() => {
|
|
6327
|
+
map$1(() => {
|
|
8402
6328
|
Object.values(entries).forEach((element) => element.remove());
|
|
8403
6329
|
return {};
|
|
8404
6330
|
})
|
|
8405
6331
|
);
|
|
8406
6332
|
const items$ = reader.spineItems$.pipe(
|
|
8407
|
-
switchMap((items) => createEntries$(items)),
|
|
6333
|
+
switchMap$1((items) => createEntries$(items)),
|
|
8408
6334
|
shareReplay(1),
|
|
8409
|
-
takeUntil(reader.context.$.destroy$)
|
|
6335
|
+
takeUntil$1(reader.context.$.destroy$)
|
|
8410
6336
|
);
|
|
8411
6337
|
items$.pipe(
|
|
8412
|
-
switchMap((entries) => merge(of(entries), destroyEntries$(entries))),
|
|
8413
|
-
switchMap((entries) => merge(updateEntriesLayout$(entries), updateEntriesVisibility$(entries))),
|
|
8414
|
-
takeUntil(reader.$.destroy$)
|
|
6338
|
+
switchMap$1((entries) => merge(of(entries), destroyEntries$(entries))),
|
|
6339
|
+
switchMap$1((entries) => merge(updateEntriesLayout$(entries), updateEntriesVisibility$(entries))),
|
|
6340
|
+
takeUntil$1(reader.$.destroy$)
|
|
8415
6341
|
).subscribe();
|
|
8416
6342
|
return {
|
|
8417
6343
|
...reader,
|