@prose-reader/core 1.32.0 → 1.33.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.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("rxjs"), require("@prose-reader/shared")) : typeof define === "function" && define.amd ? define(["exports", "rxjs", "@prose-reader/shared"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.prose = {}, global.rxjs, global
|
|
3
|
-
})(this, function(exports2, rxjs, shared) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("rxjs"), require("rxjs/operators"), require("@prose-reader/shared")) : typeof define === "function" && define.amd ? define(["exports", "rxjs", "rxjs/operators", "@prose-reader/shared"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.prose = {}, global.rxjs, global.operators, global.shared));
|
|
3
|
+
})(this, function(exports2, rxjs, operators, shared) {
|
|
4
4
|
"use strict";
|
|
5
5
|
const SHOULD_NOT_LAYOUT$3 = false;
|
|
6
6
|
const chromeEnhancer = (next) => (options) => {
|
|
@@ -20,2081 +20,6 @@
|
|
|
20
20
|
});
|
|
21
21
|
return reader;
|
|
22
22
|
};
|
|
23
|
-
function isFunction(value) {
|
|
24
|
-
return typeof value === "function";
|
|
25
|
-
}
|
|
26
|
-
function hasLift(source) {
|
|
27
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
28
|
-
}
|
|
29
|
-
function operate(init) {
|
|
30
|
-
return function(source) {
|
|
31
|
-
if (hasLift(source)) {
|
|
32
|
-
return source.lift(function(liftedSource) {
|
|
33
|
-
try {
|
|
34
|
-
return init(liftedSource, this);
|
|
35
|
-
} catch (err) {
|
|
36
|
-
this.error(err);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
throw new TypeError("Unable to lift unknown Observable type");
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
var extendStatics = function(d, b) {
|
|
44
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
45
|
-
d2.__proto__ = b2;
|
|
46
|
-
} || function(d2, b2) {
|
|
47
|
-
for (var p in b2)
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
|
49
|
-
d2[p] = b2[p];
|
|
50
|
-
};
|
|
51
|
-
return extendStatics(d, b);
|
|
52
|
-
};
|
|
53
|
-
function __extends(d, b) {
|
|
54
|
-
if (typeof b !== "function" && b !== null)
|
|
55
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
56
|
-
extendStatics(d, b);
|
|
57
|
-
function __() {
|
|
58
|
-
this.constructor = d;
|
|
59
|
-
}
|
|
60
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
61
|
-
}
|
|
62
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
63
|
-
function adopt(value) {
|
|
64
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
65
|
-
resolve(value);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
69
|
-
function fulfilled(value) {
|
|
70
|
-
try {
|
|
71
|
-
step(generator.next(value));
|
|
72
|
-
} catch (e) {
|
|
73
|
-
reject(e);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function rejected(value) {
|
|
77
|
-
try {
|
|
78
|
-
step(generator["throw"](value));
|
|
79
|
-
} catch (e) {
|
|
80
|
-
reject(e);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function step(result) {
|
|
84
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
85
|
-
}
|
|
86
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function __generator(thisArg, body) {
|
|
90
|
-
var _ = { label: 0, sent: function() {
|
|
91
|
-
if (t[0] & 1)
|
|
92
|
-
throw t[1];
|
|
93
|
-
return t[1];
|
|
94
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
95
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
96
|
-
return this;
|
|
97
|
-
}), g;
|
|
98
|
-
function verb(n) {
|
|
99
|
-
return function(v) {
|
|
100
|
-
return step([n, v]);
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function step(op) {
|
|
104
|
-
if (f)
|
|
105
|
-
throw new TypeError("Generator is already executing.");
|
|
106
|
-
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
107
|
-
try {
|
|
108
|
-
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)
|
|
109
|
-
return t;
|
|
110
|
-
if (y = 0, t)
|
|
111
|
-
op = [op[0] & 2, t.value];
|
|
112
|
-
switch (op[0]) {
|
|
113
|
-
case 0:
|
|
114
|
-
case 1:
|
|
115
|
-
t = op;
|
|
116
|
-
break;
|
|
117
|
-
case 4:
|
|
118
|
-
_.label++;
|
|
119
|
-
return { value: op[1], done: false };
|
|
120
|
-
case 5:
|
|
121
|
-
_.label++;
|
|
122
|
-
y = op[1];
|
|
123
|
-
op = [0];
|
|
124
|
-
continue;
|
|
125
|
-
case 7:
|
|
126
|
-
op = _.ops.pop();
|
|
127
|
-
_.trys.pop();
|
|
128
|
-
continue;
|
|
129
|
-
default:
|
|
130
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
131
|
-
_ = 0;
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
135
|
-
_.label = op[1];
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
139
|
-
_.label = t[1];
|
|
140
|
-
t = op;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
if (t && _.label < t[2]) {
|
|
144
|
-
_.label = t[2];
|
|
145
|
-
_.ops.push(op);
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
if (t[2])
|
|
149
|
-
_.ops.pop();
|
|
150
|
-
_.trys.pop();
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
op = body.call(thisArg, _);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
op = [6, e];
|
|
156
|
-
y = 0;
|
|
157
|
-
} finally {
|
|
158
|
-
f = t = 0;
|
|
159
|
-
}
|
|
160
|
-
if (op[0] & 5)
|
|
161
|
-
throw op[1];
|
|
162
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function __values(o) {
|
|
166
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
167
|
-
if (m)
|
|
168
|
-
return m.call(o);
|
|
169
|
-
if (o && typeof o.length === "number")
|
|
170
|
-
return {
|
|
171
|
-
next: function() {
|
|
172
|
-
if (o && i >= o.length)
|
|
173
|
-
o = void 0;
|
|
174
|
-
return { value: o && o[i++], done: !o };
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
178
|
-
}
|
|
179
|
-
function __read(o, n) {
|
|
180
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
181
|
-
if (!m)
|
|
182
|
-
return o;
|
|
183
|
-
var i = m.call(o), r, ar = [], e;
|
|
184
|
-
try {
|
|
185
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
186
|
-
ar.push(r.value);
|
|
187
|
-
} catch (error) {
|
|
188
|
-
e = { error };
|
|
189
|
-
} finally {
|
|
190
|
-
try {
|
|
191
|
-
if (r && !r.done && (m = i["return"]))
|
|
192
|
-
m.call(i);
|
|
193
|
-
} finally {
|
|
194
|
-
if (e)
|
|
195
|
-
throw e.error;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return ar;
|
|
199
|
-
}
|
|
200
|
-
function __spreadArray(to, from2, pack) {
|
|
201
|
-
if (pack || arguments.length === 2)
|
|
202
|
-
for (var i = 0, l = from2.length, ar; i < l; i++) {
|
|
203
|
-
if (ar || !(i in from2)) {
|
|
204
|
-
if (!ar)
|
|
205
|
-
ar = Array.prototype.slice.call(from2, 0, i);
|
|
206
|
-
ar[i] = from2[i];
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return to.concat(ar || Array.prototype.slice.call(from2));
|
|
210
|
-
}
|
|
211
|
-
function __await(v) {
|
|
212
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
213
|
-
}
|
|
214
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
215
|
-
if (!Symbol.asyncIterator)
|
|
216
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
217
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
218
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
219
|
-
return this;
|
|
220
|
-
}, i;
|
|
221
|
-
function verb(n) {
|
|
222
|
-
if (g[n])
|
|
223
|
-
i[n] = function(v) {
|
|
224
|
-
return new Promise(function(a, b) {
|
|
225
|
-
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
function resume(n, v) {
|
|
230
|
-
try {
|
|
231
|
-
step(g[n](v));
|
|
232
|
-
} catch (e) {
|
|
233
|
-
settle(q[0][3], e);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function step(r) {
|
|
237
|
-
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
238
|
-
}
|
|
239
|
-
function fulfill(value) {
|
|
240
|
-
resume("next", value);
|
|
241
|
-
}
|
|
242
|
-
function reject(value) {
|
|
243
|
-
resume("throw", value);
|
|
244
|
-
}
|
|
245
|
-
function settle(f, v) {
|
|
246
|
-
if (f(v), q.shift(), q.length)
|
|
247
|
-
resume(q[0][0], q[0][1]);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function __asyncValues(o) {
|
|
251
|
-
if (!Symbol.asyncIterator)
|
|
252
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
253
|
-
var m = o[Symbol.asyncIterator], i;
|
|
254
|
-
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() {
|
|
255
|
-
return this;
|
|
256
|
-
}, i);
|
|
257
|
-
function verb(n) {
|
|
258
|
-
i[n] = o[n] && function(v) {
|
|
259
|
-
return new Promise(function(resolve, reject) {
|
|
260
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function settle(resolve, reject, d, v) {
|
|
265
|
-
Promise.resolve(v).then(function(v2) {
|
|
266
|
-
resolve({ value: v2, done: d });
|
|
267
|
-
}, reject);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
var isArrayLike = function(x) {
|
|
271
|
-
return x && typeof x.length === "number" && typeof x !== "function";
|
|
272
|
-
};
|
|
273
|
-
function isPromise(value) {
|
|
274
|
-
return isFunction(value === null || value === void 0 ? void 0 : value.then);
|
|
275
|
-
}
|
|
276
|
-
function createErrorClass(createImpl) {
|
|
277
|
-
var _super = function(instance) {
|
|
278
|
-
Error.call(instance);
|
|
279
|
-
instance.stack = new Error().stack;
|
|
280
|
-
};
|
|
281
|
-
var ctorFunc = createImpl(_super);
|
|
282
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
283
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
284
|
-
return ctorFunc;
|
|
285
|
-
}
|
|
286
|
-
var UnsubscriptionError = createErrorClass(function(_super) {
|
|
287
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
288
|
-
_super(this);
|
|
289
|
-
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
|
|
290
|
-
return i + 1 + ") " + err.toString();
|
|
291
|
-
}).join("\n ") : "";
|
|
292
|
-
this.name = "UnsubscriptionError";
|
|
293
|
-
this.errors = errors;
|
|
294
|
-
};
|
|
295
|
-
});
|
|
296
|
-
function arrRemove(arr, item) {
|
|
297
|
-
if (arr) {
|
|
298
|
-
var index = arr.indexOf(item);
|
|
299
|
-
0 <= index && arr.splice(index, 1);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
var Subscription = function() {
|
|
303
|
-
function Subscription2(initialTeardown) {
|
|
304
|
-
this.initialTeardown = initialTeardown;
|
|
305
|
-
this.closed = false;
|
|
306
|
-
this._parentage = null;
|
|
307
|
-
this._finalizers = null;
|
|
308
|
-
}
|
|
309
|
-
Subscription2.prototype.unsubscribe = function() {
|
|
310
|
-
var e_1, _a, e_2, _b;
|
|
311
|
-
var errors;
|
|
312
|
-
if (!this.closed) {
|
|
313
|
-
this.closed = true;
|
|
314
|
-
var _parentage = this._parentage;
|
|
315
|
-
if (_parentage) {
|
|
316
|
-
this._parentage = null;
|
|
317
|
-
if (Array.isArray(_parentage)) {
|
|
318
|
-
try {
|
|
319
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
320
|
-
var parent_1 = _parentage_1_1.value;
|
|
321
|
-
parent_1.remove(this);
|
|
322
|
-
}
|
|
323
|
-
} catch (e_1_1) {
|
|
324
|
-
e_1 = { error: e_1_1 };
|
|
325
|
-
} finally {
|
|
326
|
-
try {
|
|
327
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return))
|
|
328
|
-
_a.call(_parentage_1);
|
|
329
|
-
} finally {
|
|
330
|
-
if (e_1)
|
|
331
|
-
throw e_1.error;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
} else {
|
|
335
|
-
_parentage.remove(this);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
var initialFinalizer = this.initialTeardown;
|
|
339
|
-
if (isFunction(initialFinalizer)) {
|
|
340
|
-
try {
|
|
341
|
-
initialFinalizer();
|
|
342
|
-
} catch (e) {
|
|
343
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
var _finalizers = this._finalizers;
|
|
347
|
-
if (_finalizers) {
|
|
348
|
-
this._finalizers = null;
|
|
349
|
-
try {
|
|
350
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
351
|
-
var finalizer = _finalizers_1_1.value;
|
|
352
|
-
try {
|
|
353
|
-
execFinalizer(finalizer);
|
|
354
|
-
} catch (err) {
|
|
355
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
356
|
-
if (err instanceof UnsubscriptionError) {
|
|
357
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
358
|
-
} else {
|
|
359
|
-
errors.push(err);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
} catch (e_2_1) {
|
|
364
|
-
e_2 = { error: e_2_1 };
|
|
365
|
-
} finally {
|
|
366
|
-
try {
|
|
367
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
|
|
368
|
-
_b.call(_finalizers_1);
|
|
369
|
-
} finally {
|
|
370
|
-
if (e_2)
|
|
371
|
-
throw e_2.error;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (errors) {
|
|
376
|
-
throw new UnsubscriptionError(errors);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
Subscription2.prototype.add = function(teardown) {
|
|
381
|
-
var _a;
|
|
382
|
-
if (teardown && teardown !== this) {
|
|
383
|
-
if (this.closed) {
|
|
384
|
-
execFinalizer(teardown);
|
|
385
|
-
} else {
|
|
386
|
-
if (teardown instanceof Subscription2) {
|
|
387
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
teardown._addParent(this);
|
|
391
|
-
}
|
|
392
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
Subscription2.prototype._hasParent = function(parent) {
|
|
397
|
-
var _parentage = this._parentage;
|
|
398
|
-
return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
|
|
399
|
-
};
|
|
400
|
-
Subscription2.prototype._addParent = function(parent) {
|
|
401
|
-
var _parentage = this._parentage;
|
|
402
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
403
|
-
};
|
|
404
|
-
Subscription2.prototype._removeParent = function(parent) {
|
|
405
|
-
var _parentage = this._parentage;
|
|
406
|
-
if (_parentage === parent) {
|
|
407
|
-
this._parentage = null;
|
|
408
|
-
} else if (Array.isArray(_parentage)) {
|
|
409
|
-
arrRemove(_parentage, parent);
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
Subscription2.prototype.remove = function(teardown) {
|
|
413
|
-
var _finalizers = this._finalizers;
|
|
414
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
415
|
-
if (teardown instanceof Subscription2) {
|
|
416
|
-
teardown._removeParent(this);
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
Subscription2.EMPTY = function() {
|
|
420
|
-
var empty = new Subscription2();
|
|
421
|
-
empty.closed = true;
|
|
422
|
-
return empty;
|
|
423
|
-
}();
|
|
424
|
-
return Subscription2;
|
|
425
|
-
}();
|
|
426
|
-
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
427
|
-
function isSubscription(value) {
|
|
428
|
-
return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
|
|
429
|
-
}
|
|
430
|
-
function execFinalizer(finalizer) {
|
|
431
|
-
if (isFunction(finalizer)) {
|
|
432
|
-
finalizer();
|
|
433
|
-
} else {
|
|
434
|
-
finalizer.unsubscribe();
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
var config = {
|
|
438
|
-
onUnhandledError: null,
|
|
439
|
-
onStoppedNotification: null,
|
|
440
|
-
Promise: void 0,
|
|
441
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
442
|
-
useDeprecatedNextContext: false
|
|
443
|
-
};
|
|
444
|
-
var timeoutProvider = {
|
|
445
|
-
setTimeout: function(handler, timeout) {
|
|
446
|
-
var args = [];
|
|
447
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
448
|
-
args[_i - 2] = arguments[_i];
|
|
449
|
-
}
|
|
450
|
-
var delegate = timeoutProvider.delegate;
|
|
451
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
452
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
453
|
-
}
|
|
454
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
455
|
-
},
|
|
456
|
-
clearTimeout: function(handle) {
|
|
457
|
-
var delegate = timeoutProvider.delegate;
|
|
458
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
459
|
-
},
|
|
460
|
-
delegate: void 0
|
|
461
|
-
};
|
|
462
|
-
function reportUnhandledError(err) {
|
|
463
|
-
timeoutProvider.setTimeout(function() {
|
|
464
|
-
{
|
|
465
|
-
throw err;
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
function noop() {
|
|
470
|
-
}
|
|
471
|
-
function errorContext(cb) {
|
|
472
|
-
{
|
|
473
|
-
cb();
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
var Subscriber = function(_super) {
|
|
477
|
-
__extends(Subscriber2, _super);
|
|
478
|
-
function Subscriber2(destination) {
|
|
479
|
-
var _this = _super.call(this) || this;
|
|
480
|
-
_this.isStopped = false;
|
|
481
|
-
if (destination) {
|
|
482
|
-
_this.destination = destination;
|
|
483
|
-
if (isSubscription(destination)) {
|
|
484
|
-
destination.add(_this);
|
|
485
|
-
}
|
|
486
|
-
} else {
|
|
487
|
-
_this.destination = EMPTY_OBSERVER;
|
|
488
|
-
}
|
|
489
|
-
return _this;
|
|
490
|
-
}
|
|
491
|
-
Subscriber2.create = function(next, error, complete) {
|
|
492
|
-
return new SafeSubscriber(next, error, complete);
|
|
493
|
-
};
|
|
494
|
-
Subscriber2.prototype.next = function(value) {
|
|
495
|
-
if (this.isStopped)
|
|
496
|
-
;
|
|
497
|
-
else {
|
|
498
|
-
this._next(value);
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
Subscriber2.prototype.error = function(err) {
|
|
502
|
-
if (this.isStopped)
|
|
503
|
-
;
|
|
504
|
-
else {
|
|
505
|
-
this.isStopped = true;
|
|
506
|
-
this._error(err);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
Subscriber2.prototype.complete = function() {
|
|
510
|
-
if (this.isStopped)
|
|
511
|
-
;
|
|
512
|
-
else {
|
|
513
|
-
this.isStopped = true;
|
|
514
|
-
this._complete();
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
Subscriber2.prototype.unsubscribe = function() {
|
|
518
|
-
if (!this.closed) {
|
|
519
|
-
this.isStopped = true;
|
|
520
|
-
_super.prototype.unsubscribe.call(this);
|
|
521
|
-
this.destination = null;
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
Subscriber2.prototype._next = function(value) {
|
|
525
|
-
this.destination.next(value);
|
|
526
|
-
};
|
|
527
|
-
Subscriber2.prototype._error = function(err) {
|
|
528
|
-
try {
|
|
529
|
-
this.destination.error(err);
|
|
530
|
-
} finally {
|
|
531
|
-
this.unsubscribe();
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
Subscriber2.prototype._complete = function() {
|
|
535
|
-
try {
|
|
536
|
-
this.destination.complete();
|
|
537
|
-
} finally {
|
|
538
|
-
this.unsubscribe();
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
return Subscriber2;
|
|
542
|
-
}(Subscription);
|
|
543
|
-
var _bind = Function.prototype.bind;
|
|
544
|
-
function bind(fn, thisArg) {
|
|
545
|
-
return _bind.call(fn, thisArg);
|
|
546
|
-
}
|
|
547
|
-
var ConsumerObserver = function() {
|
|
548
|
-
function ConsumerObserver2(partialObserver) {
|
|
549
|
-
this.partialObserver = partialObserver;
|
|
550
|
-
}
|
|
551
|
-
ConsumerObserver2.prototype.next = function(value) {
|
|
552
|
-
var partialObserver = this.partialObserver;
|
|
553
|
-
if (partialObserver.next) {
|
|
554
|
-
try {
|
|
555
|
-
partialObserver.next(value);
|
|
556
|
-
} catch (error) {
|
|
557
|
-
handleUnhandledError(error);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
ConsumerObserver2.prototype.error = function(err) {
|
|
562
|
-
var partialObserver = this.partialObserver;
|
|
563
|
-
if (partialObserver.error) {
|
|
564
|
-
try {
|
|
565
|
-
partialObserver.error(err);
|
|
566
|
-
} catch (error) {
|
|
567
|
-
handleUnhandledError(error);
|
|
568
|
-
}
|
|
569
|
-
} else {
|
|
570
|
-
handleUnhandledError(err);
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
ConsumerObserver2.prototype.complete = function() {
|
|
574
|
-
var partialObserver = this.partialObserver;
|
|
575
|
-
if (partialObserver.complete) {
|
|
576
|
-
try {
|
|
577
|
-
partialObserver.complete();
|
|
578
|
-
} catch (error) {
|
|
579
|
-
handleUnhandledError(error);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
return ConsumerObserver2;
|
|
584
|
-
}();
|
|
585
|
-
var SafeSubscriber = function(_super) {
|
|
586
|
-
__extends(SafeSubscriber2, _super);
|
|
587
|
-
function SafeSubscriber2(observerOrNext, error, complete) {
|
|
588
|
-
var _this = _super.call(this) || this;
|
|
589
|
-
var partialObserver;
|
|
590
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
591
|
-
partialObserver = {
|
|
592
|
-
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
|
|
593
|
-
error: error !== null && error !== void 0 ? error : void 0,
|
|
594
|
-
complete: complete !== null && complete !== void 0 ? complete : void 0
|
|
595
|
-
};
|
|
596
|
-
} else {
|
|
597
|
-
var context_1;
|
|
598
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
599
|
-
context_1 = Object.create(observerOrNext);
|
|
600
|
-
context_1.unsubscribe = function() {
|
|
601
|
-
return _this.unsubscribe();
|
|
602
|
-
};
|
|
603
|
-
partialObserver = {
|
|
604
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
605
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
606
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
|
|
607
|
-
};
|
|
608
|
-
} else {
|
|
609
|
-
partialObserver = observerOrNext;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
613
|
-
return _this;
|
|
614
|
-
}
|
|
615
|
-
return SafeSubscriber2;
|
|
616
|
-
}(Subscriber);
|
|
617
|
-
function handleUnhandledError(error) {
|
|
618
|
-
{
|
|
619
|
-
reportUnhandledError(error);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
function defaultErrorHandler(err) {
|
|
623
|
-
throw err;
|
|
624
|
-
}
|
|
625
|
-
var EMPTY_OBSERVER = {
|
|
626
|
-
closed: true,
|
|
627
|
-
next: noop,
|
|
628
|
-
error: defaultErrorHandler,
|
|
629
|
-
complete: noop
|
|
630
|
-
};
|
|
631
|
-
var observable = function() {
|
|
632
|
-
return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
633
|
-
}();
|
|
634
|
-
function identity(x) {
|
|
635
|
-
return x;
|
|
636
|
-
}
|
|
637
|
-
function pipeFromArray(fns) {
|
|
638
|
-
if (fns.length === 0) {
|
|
639
|
-
return identity;
|
|
640
|
-
}
|
|
641
|
-
if (fns.length === 1) {
|
|
642
|
-
return fns[0];
|
|
643
|
-
}
|
|
644
|
-
return function piped(input) {
|
|
645
|
-
return fns.reduce(function(prev, fn) {
|
|
646
|
-
return fn(prev);
|
|
647
|
-
}, input);
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
var Observable = function() {
|
|
651
|
-
function Observable2(subscribe) {
|
|
652
|
-
if (subscribe) {
|
|
653
|
-
this._subscribe = subscribe;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
Observable2.prototype.lift = function(operator) {
|
|
657
|
-
var observable2 = new Observable2();
|
|
658
|
-
observable2.source = this;
|
|
659
|
-
observable2.operator = operator;
|
|
660
|
-
return observable2;
|
|
661
|
-
};
|
|
662
|
-
Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
|
|
663
|
-
var _this = this;
|
|
664
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
665
|
-
errorContext(function() {
|
|
666
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
667
|
-
subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
|
|
668
|
-
});
|
|
669
|
-
return subscriber;
|
|
670
|
-
};
|
|
671
|
-
Observable2.prototype._trySubscribe = function(sink) {
|
|
672
|
-
try {
|
|
673
|
-
return this._subscribe(sink);
|
|
674
|
-
} catch (err) {
|
|
675
|
-
sink.error(err);
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
679
|
-
var _this = this;
|
|
680
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
681
|
-
return new promiseCtor(function(resolve, reject) {
|
|
682
|
-
var subscriber = new SafeSubscriber({
|
|
683
|
-
next: function(value) {
|
|
684
|
-
try {
|
|
685
|
-
next(value);
|
|
686
|
-
} catch (err) {
|
|
687
|
-
reject(err);
|
|
688
|
-
subscriber.unsubscribe();
|
|
689
|
-
}
|
|
690
|
-
},
|
|
691
|
-
error: reject,
|
|
692
|
-
complete: resolve
|
|
693
|
-
});
|
|
694
|
-
_this.subscribe(subscriber);
|
|
695
|
-
});
|
|
696
|
-
};
|
|
697
|
-
Observable2.prototype._subscribe = function(subscriber) {
|
|
698
|
-
var _a;
|
|
699
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
700
|
-
};
|
|
701
|
-
Observable2.prototype[observable] = function() {
|
|
702
|
-
return this;
|
|
703
|
-
};
|
|
704
|
-
Observable2.prototype.pipe = function() {
|
|
705
|
-
var operations = [];
|
|
706
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
707
|
-
operations[_i] = arguments[_i];
|
|
708
|
-
}
|
|
709
|
-
return pipeFromArray(operations)(this);
|
|
710
|
-
};
|
|
711
|
-
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
712
|
-
var _this = this;
|
|
713
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
714
|
-
return new promiseCtor(function(resolve, reject) {
|
|
715
|
-
var value;
|
|
716
|
-
_this.subscribe(function(x) {
|
|
717
|
-
return value = x;
|
|
718
|
-
}, function(err) {
|
|
719
|
-
return reject(err);
|
|
720
|
-
}, function() {
|
|
721
|
-
return resolve(value);
|
|
722
|
-
});
|
|
723
|
-
});
|
|
724
|
-
};
|
|
725
|
-
Observable2.create = function(subscribe) {
|
|
726
|
-
return new Observable2(subscribe);
|
|
727
|
-
};
|
|
728
|
-
return Observable2;
|
|
729
|
-
}();
|
|
730
|
-
function getPromiseCtor(promiseCtor) {
|
|
731
|
-
var _a;
|
|
732
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
733
|
-
}
|
|
734
|
-
function isObserver(value) {
|
|
735
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
736
|
-
}
|
|
737
|
-
function isSubscriber(value) {
|
|
738
|
-
return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
|
|
739
|
-
}
|
|
740
|
-
function isInteropObservable(input) {
|
|
741
|
-
return isFunction(input[observable]);
|
|
742
|
-
}
|
|
743
|
-
function isAsyncIterable(obj) {
|
|
744
|
-
return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
745
|
-
}
|
|
746
|
-
function createInvalidObservableTypeError(input) {
|
|
747
|
-
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.");
|
|
748
|
-
}
|
|
749
|
-
function getSymbolIterator() {
|
|
750
|
-
if (typeof Symbol !== "function" || !Symbol.iterator) {
|
|
751
|
-
return "@@iterator";
|
|
752
|
-
}
|
|
753
|
-
return Symbol.iterator;
|
|
754
|
-
}
|
|
755
|
-
var iterator = getSymbolIterator();
|
|
756
|
-
function isIterable(input) {
|
|
757
|
-
return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
758
|
-
}
|
|
759
|
-
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
760
|
-
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
761
|
-
var reader, _a, value, done;
|
|
762
|
-
return __generator(this, function(_b) {
|
|
763
|
-
switch (_b.label) {
|
|
764
|
-
case 0:
|
|
765
|
-
reader = readableStream.getReader();
|
|
766
|
-
_b.label = 1;
|
|
767
|
-
case 1:
|
|
768
|
-
_b.trys.push([1, , 9, 10]);
|
|
769
|
-
_b.label = 2;
|
|
770
|
-
case 2:
|
|
771
|
-
return [4, __await(reader.read())];
|
|
772
|
-
case 3:
|
|
773
|
-
_a = _b.sent(), value = _a.value, done = _a.done;
|
|
774
|
-
if (!done)
|
|
775
|
-
return [3, 5];
|
|
776
|
-
return [4, __await(void 0)];
|
|
777
|
-
case 4:
|
|
778
|
-
return [2, _b.sent()];
|
|
779
|
-
case 5:
|
|
780
|
-
return [4, __await(value)];
|
|
781
|
-
case 6:
|
|
782
|
-
return [4, _b.sent()];
|
|
783
|
-
case 7:
|
|
784
|
-
_b.sent();
|
|
785
|
-
return [3, 2];
|
|
786
|
-
case 8:
|
|
787
|
-
return [3, 10];
|
|
788
|
-
case 9:
|
|
789
|
-
reader.releaseLock();
|
|
790
|
-
return [7];
|
|
791
|
-
case 10:
|
|
792
|
-
return [2];
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
function isReadableStreamLike(obj) {
|
|
798
|
-
return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
799
|
-
}
|
|
800
|
-
function innerFrom(input) {
|
|
801
|
-
if (input instanceof Observable) {
|
|
802
|
-
return input;
|
|
803
|
-
}
|
|
804
|
-
if (input != null) {
|
|
805
|
-
if (isInteropObservable(input)) {
|
|
806
|
-
return fromInteropObservable(input);
|
|
807
|
-
}
|
|
808
|
-
if (isArrayLike(input)) {
|
|
809
|
-
return fromArrayLike(input);
|
|
810
|
-
}
|
|
811
|
-
if (isPromise(input)) {
|
|
812
|
-
return fromPromise(input);
|
|
813
|
-
}
|
|
814
|
-
if (isAsyncIterable(input)) {
|
|
815
|
-
return fromAsyncIterable(input);
|
|
816
|
-
}
|
|
817
|
-
if (isIterable(input)) {
|
|
818
|
-
return fromIterable(input);
|
|
819
|
-
}
|
|
820
|
-
if (isReadableStreamLike(input)) {
|
|
821
|
-
return fromReadableStreamLike(input);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
throw createInvalidObservableTypeError(input);
|
|
825
|
-
}
|
|
826
|
-
function fromInteropObservable(obj) {
|
|
827
|
-
return new Observable(function(subscriber) {
|
|
828
|
-
var obs = obj[observable]();
|
|
829
|
-
if (isFunction(obs.subscribe)) {
|
|
830
|
-
return obs.subscribe(subscriber);
|
|
831
|
-
}
|
|
832
|
-
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
function fromArrayLike(array) {
|
|
836
|
-
return new Observable(function(subscriber) {
|
|
837
|
-
for (var i = 0; i < array.length && !subscriber.closed; i++) {
|
|
838
|
-
subscriber.next(array[i]);
|
|
839
|
-
}
|
|
840
|
-
subscriber.complete();
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
function fromPromise(promise) {
|
|
844
|
-
return new Observable(function(subscriber) {
|
|
845
|
-
promise.then(function(value) {
|
|
846
|
-
if (!subscriber.closed) {
|
|
847
|
-
subscriber.next(value);
|
|
848
|
-
subscriber.complete();
|
|
849
|
-
}
|
|
850
|
-
}, function(err) {
|
|
851
|
-
return subscriber.error(err);
|
|
852
|
-
}).then(null, reportUnhandledError);
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
function fromIterable(iterable) {
|
|
856
|
-
return new Observable(function(subscriber) {
|
|
857
|
-
var e_1, _a;
|
|
858
|
-
try {
|
|
859
|
-
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
860
|
-
var value = iterable_1_1.value;
|
|
861
|
-
subscriber.next(value);
|
|
862
|
-
if (subscriber.closed) {
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
} catch (e_1_1) {
|
|
867
|
-
e_1 = { error: e_1_1 };
|
|
868
|
-
} finally {
|
|
869
|
-
try {
|
|
870
|
-
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return))
|
|
871
|
-
_a.call(iterable_1);
|
|
872
|
-
} finally {
|
|
873
|
-
if (e_1)
|
|
874
|
-
throw e_1.error;
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
subscriber.complete();
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
function fromAsyncIterable(asyncIterable) {
|
|
881
|
-
return new Observable(function(subscriber) {
|
|
882
|
-
process(asyncIterable, subscriber).catch(function(err) {
|
|
883
|
-
return subscriber.error(err);
|
|
884
|
-
});
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
function fromReadableStreamLike(readableStream) {
|
|
888
|
-
return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
|
|
889
|
-
}
|
|
890
|
-
function process(asyncIterable, subscriber) {
|
|
891
|
-
var asyncIterable_1, asyncIterable_1_1;
|
|
892
|
-
var e_2, _a;
|
|
893
|
-
return __awaiter(this, void 0, void 0, function() {
|
|
894
|
-
var value, e_2_1;
|
|
895
|
-
return __generator(this, function(_b) {
|
|
896
|
-
switch (_b.label) {
|
|
897
|
-
case 0:
|
|
898
|
-
_b.trys.push([0, 5, 6, 11]);
|
|
899
|
-
asyncIterable_1 = __asyncValues(asyncIterable);
|
|
900
|
-
_b.label = 1;
|
|
901
|
-
case 1:
|
|
902
|
-
return [4, asyncIterable_1.next()];
|
|
903
|
-
case 2:
|
|
904
|
-
if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done))
|
|
905
|
-
return [3, 4];
|
|
906
|
-
value = asyncIterable_1_1.value;
|
|
907
|
-
subscriber.next(value);
|
|
908
|
-
if (subscriber.closed) {
|
|
909
|
-
return [2];
|
|
910
|
-
}
|
|
911
|
-
_b.label = 3;
|
|
912
|
-
case 3:
|
|
913
|
-
return [3, 1];
|
|
914
|
-
case 4:
|
|
915
|
-
return [3, 11];
|
|
916
|
-
case 5:
|
|
917
|
-
e_2_1 = _b.sent();
|
|
918
|
-
e_2 = { error: e_2_1 };
|
|
919
|
-
return [3, 11];
|
|
920
|
-
case 6:
|
|
921
|
-
_b.trys.push([6, , 9, 10]);
|
|
922
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)))
|
|
923
|
-
return [3, 8];
|
|
924
|
-
return [4, _a.call(asyncIterable_1)];
|
|
925
|
-
case 7:
|
|
926
|
-
_b.sent();
|
|
927
|
-
_b.label = 8;
|
|
928
|
-
case 8:
|
|
929
|
-
return [3, 10];
|
|
930
|
-
case 9:
|
|
931
|
-
if (e_2)
|
|
932
|
-
throw e_2.error;
|
|
933
|
-
return [7];
|
|
934
|
-
case 10:
|
|
935
|
-
return [7];
|
|
936
|
-
case 11:
|
|
937
|
-
subscriber.complete();
|
|
938
|
-
return [2];
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
944
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
945
|
-
}
|
|
946
|
-
var OperatorSubscriber = function(_super) {
|
|
947
|
-
__extends(OperatorSubscriber2, _super);
|
|
948
|
-
function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
949
|
-
var _this = _super.call(this, destination) || this;
|
|
950
|
-
_this.onFinalize = onFinalize;
|
|
951
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
952
|
-
_this._next = onNext ? function(value) {
|
|
953
|
-
try {
|
|
954
|
-
onNext(value);
|
|
955
|
-
} catch (err) {
|
|
956
|
-
destination.error(err);
|
|
957
|
-
}
|
|
958
|
-
} : _super.prototype._next;
|
|
959
|
-
_this._error = onError ? function(err) {
|
|
960
|
-
try {
|
|
961
|
-
onError(err);
|
|
962
|
-
} catch (err2) {
|
|
963
|
-
destination.error(err2);
|
|
964
|
-
} finally {
|
|
965
|
-
this.unsubscribe();
|
|
966
|
-
}
|
|
967
|
-
} : _super.prototype._error;
|
|
968
|
-
_this._complete = onComplete ? function() {
|
|
969
|
-
try {
|
|
970
|
-
onComplete();
|
|
971
|
-
} catch (err) {
|
|
972
|
-
destination.error(err);
|
|
973
|
-
} finally {
|
|
974
|
-
this.unsubscribe();
|
|
975
|
-
}
|
|
976
|
-
} : _super.prototype._complete;
|
|
977
|
-
return _this;
|
|
978
|
-
}
|
|
979
|
-
OperatorSubscriber2.prototype.unsubscribe = function() {
|
|
980
|
-
var _a;
|
|
981
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
982
|
-
var closed_1 = this.closed;
|
|
983
|
-
_super.prototype.unsubscribe.call(this);
|
|
984
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
return OperatorSubscriber2;
|
|
988
|
-
}(Subscriber);
|
|
989
|
-
var Action = function(_super) {
|
|
990
|
-
__extends(Action2, _super);
|
|
991
|
-
function Action2(scheduler, work) {
|
|
992
|
-
return _super.call(this) || this;
|
|
993
|
-
}
|
|
994
|
-
Action2.prototype.schedule = function(state, delay2) {
|
|
995
|
-
return this;
|
|
996
|
-
};
|
|
997
|
-
return Action2;
|
|
998
|
-
}(Subscription);
|
|
999
|
-
var intervalProvider = {
|
|
1000
|
-
setInterval: function(handler, timeout) {
|
|
1001
|
-
var args = [];
|
|
1002
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1003
|
-
args[_i - 2] = arguments[_i];
|
|
1004
|
-
}
|
|
1005
|
-
var delegate = intervalProvider.delegate;
|
|
1006
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
|
|
1007
|
-
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
1008
|
-
}
|
|
1009
|
-
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
1010
|
-
},
|
|
1011
|
-
clearInterval: function(handle) {
|
|
1012
|
-
var delegate = intervalProvider.delegate;
|
|
1013
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
|
|
1014
|
-
},
|
|
1015
|
-
delegate: void 0
|
|
1016
|
-
};
|
|
1017
|
-
var AsyncAction = function(_super) {
|
|
1018
|
-
__extends(AsyncAction2, _super);
|
|
1019
|
-
function AsyncAction2(scheduler, work) {
|
|
1020
|
-
var _this = _super.call(this, scheduler, work) || this;
|
|
1021
|
-
_this.scheduler = scheduler;
|
|
1022
|
-
_this.work = work;
|
|
1023
|
-
_this.pending = false;
|
|
1024
|
-
return _this;
|
|
1025
|
-
}
|
|
1026
|
-
AsyncAction2.prototype.schedule = function(state, delay2) {
|
|
1027
|
-
var _a;
|
|
1028
|
-
if (delay2 === void 0) {
|
|
1029
|
-
delay2 = 0;
|
|
1030
|
-
}
|
|
1031
|
-
if (this.closed) {
|
|
1032
|
-
return this;
|
|
1033
|
-
}
|
|
1034
|
-
this.state = state;
|
|
1035
|
-
var id = this.id;
|
|
1036
|
-
var scheduler = this.scheduler;
|
|
1037
|
-
if (id != null) {
|
|
1038
|
-
this.id = this.recycleAsyncId(scheduler, id, delay2);
|
|
1039
|
-
}
|
|
1040
|
-
this.pending = true;
|
|
1041
|
-
this.delay = delay2;
|
|
1042
|
-
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay2);
|
|
1043
|
-
return this;
|
|
1044
|
-
};
|
|
1045
|
-
AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay2) {
|
|
1046
|
-
if (delay2 === void 0) {
|
|
1047
|
-
delay2 = 0;
|
|
1048
|
-
}
|
|
1049
|
-
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay2);
|
|
1050
|
-
};
|
|
1051
|
-
AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay2) {
|
|
1052
|
-
if (delay2 === void 0) {
|
|
1053
|
-
delay2 = 0;
|
|
1054
|
-
}
|
|
1055
|
-
if (delay2 != null && this.delay === delay2 && this.pending === false) {
|
|
1056
|
-
return id;
|
|
1057
|
-
}
|
|
1058
|
-
if (id != null) {
|
|
1059
|
-
intervalProvider.clearInterval(id);
|
|
1060
|
-
}
|
|
1061
|
-
return void 0;
|
|
1062
|
-
};
|
|
1063
|
-
AsyncAction2.prototype.execute = function(state, delay2) {
|
|
1064
|
-
if (this.closed) {
|
|
1065
|
-
return new Error("executing a cancelled action");
|
|
1066
|
-
}
|
|
1067
|
-
this.pending = false;
|
|
1068
|
-
var error = this._execute(state, delay2);
|
|
1069
|
-
if (error) {
|
|
1070
|
-
return error;
|
|
1071
|
-
} else if (this.pending === false && this.id != null) {
|
|
1072
|
-
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
1073
|
-
}
|
|
1074
|
-
};
|
|
1075
|
-
AsyncAction2.prototype._execute = function(state, _delay) {
|
|
1076
|
-
var errored = false;
|
|
1077
|
-
var errorValue;
|
|
1078
|
-
try {
|
|
1079
|
-
this.work(state);
|
|
1080
|
-
} catch (e) {
|
|
1081
|
-
errored = true;
|
|
1082
|
-
errorValue = e ? e : new Error("Scheduled action threw falsy error");
|
|
1083
|
-
}
|
|
1084
|
-
if (errored) {
|
|
1085
|
-
this.unsubscribe();
|
|
1086
|
-
return errorValue;
|
|
1087
|
-
}
|
|
1088
|
-
};
|
|
1089
|
-
AsyncAction2.prototype.unsubscribe = function() {
|
|
1090
|
-
if (!this.closed) {
|
|
1091
|
-
var _a = this, id = _a.id, scheduler = _a.scheduler;
|
|
1092
|
-
var actions = scheduler.actions;
|
|
1093
|
-
this.work = this.state = this.scheduler = null;
|
|
1094
|
-
this.pending = false;
|
|
1095
|
-
arrRemove(actions, this);
|
|
1096
|
-
if (id != null) {
|
|
1097
|
-
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
1098
|
-
}
|
|
1099
|
-
this.delay = null;
|
|
1100
|
-
_super.prototype.unsubscribe.call(this);
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
return AsyncAction2;
|
|
1104
|
-
}(Action);
|
|
1105
|
-
var dateTimestampProvider = {
|
|
1106
|
-
now: function() {
|
|
1107
|
-
return (dateTimestampProvider.delegate || Date).now();
|
|
1108
|
-
},
|
|
1109
|
-
delegate: void 0
|
|
1110
|
-
};
|
|
1111
|
-
var Scheduler = function() {
|
|
1112
|
-
function Scheduler2(schedulerActionCtor, now) {
|
|
1113
|
-
if (now === void 0) {
|
|
1114
|
-
now = Scheduler2.now;
|
|
1115
|
-
}
|
|
1116
|
-
this.schedulerActionCtor = schedulerActionCtor;
|
|
1117
|
-
this.now = now;
|
|
1118
|
-
}
|
|
1119
|
-
Scheduler2.prototype.schedule = function(work, delay2, state) {
|
|
1120
|
-
if (delay2 === void 0) {
|
|
1121
|
-
delay2 = 0;
|
|
1122
|
-
}
|
|
1123
|
-
return new this.schedulerActionCtor(this, work).schedule(state, delay2);
|
|
1124
|
-
};
|
|
1125
|
-
Scheduler2.now = dateTimestampProvider.now;
|
|
1126
|
-
return Scheduler2;
|
|
1127
|
-
}();
|
|
1128
|
-
var AsyncScheduler = function(_super) {
|
|
1129
|
-
__extends(AsyncScheduler2, _super);
|
|
1130
|
-
function AsyncScheduler2(SchedulerAction, now) {
|
|
1131
|
-
if (now === void 0) {
|
|
1132
|
-
now = Scheduler.now;
|
|
1133
|
-
}
|
|
1134
|
-
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
1135
|
-
_this.actions = [];
|
|
1136
|
-
_this._active = false;
|
|
1137
|
-
return _this;
|
|
1138
|
-
}
|
|
1139
|
-
AsyncScheduler2.prototype.flush = function(action) {
|
|
1140
|
-
var actions = this.actions;
|
|
1141
|
-
if (this._active) {
|
|
1142
|
-
actions.push(action);
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
var error;
|
|
1146
|
-
this._active = true;
|
|
1147
|
-
do {
|
|
1148
|
-
if (error = action.execute(action.state, action.delay)) {
|
|
1149
|
-
break;
|
|
1150
|
-
}
|
|
1151
|
-
} while (action = actions.shift());
|
|
1152
|
-
this._active = false;
|
|
1153
|
-
if (error) {
|
|
1154
|
-
while (action = actions.shift()) {
|
|
1155
|
-
action.unsubscribe();
|
|
1156
|
-
}
|
|
1157
|
-
throw error;
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
return AsyncScheduler2;
|
|
1161
|
-
}(Scheduler);
|
|
1162
|
-
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
1163
|
-
var async = asyncScheduler;
|
|
1164
|
-
function isScheduler(value) {
|
|
1165
|
-
return value && isFunction(value.schedule);
|
|
1166
|
-
}
|
|
1167
|
-
function isValidDate(value) {
|
|
1168
|
-
return value instanceof Date && !isNaN(value);
|
|
1169
|
-
}
|
|
1170
|
-
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1171
|
-
if (dueTime === void 0) {
|
|
1172
|
-
dueTime = 0;
|
|
1173
|
-
}
|
|
1174
|
-
if (scheduler === void 0) {
|
|
1175
|
-
scheduler = async;
|
|
1176
|
-
}
|
|
1177
|
-
var intervalDuration = -1;
|
|
1178
|
-
if (intervalOrScheduler != null) {
|
|
1179
|
-
if (isScheduler(intervalOrScheduler)) {
|
|
1180
|
-
scheduler = intervalOrScheduler;
|
|
1181
|
-
} else {
|
|
1182
|
-
intervalDuration = intervalOrScheduler;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
return new Observable(function(subscriber) {
|
|
1186
|
-
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
1187
|
-
if (due < 0) {
|
|
1188
|
-
due = 0;
|
|
1189
|
-
}
|
|
1190
|
-
var n = 0;
|
|
1191
|
-
return scheduler.schedule(function() {
|
|
1192
|
-
if (!subscriber.closed) {
|
|
1193
|
-
subscriber.next(n++);
|
|
1194
|
-
if (0 <= intervalDuration) {
|
|
1195
|
-
this.schedule(void 0, intervalDuration);
|
|
1196
|
-
} else {
|
|
1197
|
-
subscriber.complete();
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}, due);
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
function last(arr) {
|
|
1204
|
-
return arr[arr.length - 1];
|
|
1205
|
-
}
|
|
1206
|
-
function popResultSelector(args) {
|
|
1207
|
-
return isFunction(last(args)) ? args.pop() : void 0;
|
|
1208
|
-
}
|
|
1209
|
-
function popScheduler(args) {
|
|
1210
|
-
return isScheduler(last(args)) ? args.pop() : void 0;
|
|
1211
|
-
}
|
|
1212
|
-
function executeSchedule(parentSubscription, scheduler, work, delay2, repeat) {
|
|
1213
|
-
if (delay2 === void 0) {
|
|
1214
|
-
delay2 = 0;
|
|
1215
|
-
}
|
|
1216
|
-
if (repeat === void 0) {
|
|
1217
|
-
repeat = false;
|
|
1218
|
-
}
|
|
1219
|
-
var scheduleSubscription = scheduler.schedule(function() {
|
|
1220
|
-
work();
|
|
1221
|
-
if (repeat) {
|
|
1222
|
-
parentSubscription.add(this.schedule(null, delay2));
|
|
1223
|
-
} else {
|
|
1224
|
-
this.unsubscribe();
|
|
1225
|
-
}
|
|
1226
|
-
}, delay2);
|
|
1227
|
-
parentSubscription.add(scheduleSubscription);
|
|
1228
|
-
if (!repeat) {
|
|
1229
|
-
return scheduleSubscription;
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
function catchError(selector) {
|
|
1233
|
-
return operate(function(source, subscriber) {
|
|
1234
|
-
var innerSub = null;
|
|
1235
|
-
var syncUnsub = false;
|
|
1236
|
-
var handledResult;
|
|
1237
|
-
innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
|
|
1238
|
-
handledResult = innerFrom(selector(err, catchError(selector)(source)));
|
|
1239
|
-
if (innerSub) {
|
|
1240
|
-
innerSub.unsubscribe();
|
|
1241
|
-
innerSub = null;
|
|
1242
|
-
handledResult.subscribe(subscriber);
|
|
1243
|
-
} else {
|
|
1244
|
-
syncUnsub = true;
|
|
1245
|
-
}
|
|
1246
|
-
}));
|
|
1247
|
-
if (syncUnsub) {
|
|
1248
|
-
innerSub.unsubscribe();
|
|
1249
|
-
innerSub = null;
|
|
1250
|
-
handledResult.subscribe(subscriber);
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
function observeOn(scheduler, delay2) {
|
|
1255
|
-
if (delay2 === void 0) {
|
|
1256
|
-
delay2 = 0;
|
|
1257
|
-
}
|
|
1258
|
-
return operate(function(source, subscriber) {
|
|
1259
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1260
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1261
|
-
return subscriber.next(value);
|
|
1262
|
-
}, delay2);
|
|
1263
|
-
}, function() {
|
|
1264
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1265
|
-
return subscriber.complete();
|
|
1266
|
-
}, delay2);
|
|
1267
|
-
}, function(err) {
|
|
1268
|
-
return executeSchedule(subscriber, scheduler, function() {
|
|
1269
|
-
return subscriber.error(err);
|
|
1270
|
-
}, delay2);
|
|
1271
|
-
}));
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
function subscribeOn(scheduler, delay2) {
|
|
1275
|
-
if (delay2 === void 0) {
|
|
1276
|
-
delay2 = 0;
|
|
1277
|
-
}
|
|
1278
|
-
return operate(function(source, subscriber) {
|
|
1279
|
-
subscriber.add(scheduler.schedule(function() {
|
|
1280
|
-
return source.subscribe(subscriber);
|
|
1281
|
-
}, delay2));
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
function scheduleObservable(input, scheduler) {
|
|
1285
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1286
|
-
}
|
|
1287
|
-
function schedulePromise(input, scheduler) {
|
|
1288
|
-
return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
|
|
1289
|
-
}
|
|
1290
|
-
function scheduleArray(input, scheduler) {
|
|
1291
|
-
return new Observable(function(subscriber) {
|
|
1292
|
-
var i = 0;
|
|
1293
|
-
return scheduler.schedule(function() {
|
|
1294
|
-
if (i === input.length) {
|
|
1295
|
-
subscriber.complete();
|
|
1296
|
-
} else {
|
|
1297
|
-
subscriber.next(input[i++]);
|
|
1298
|
-
if (!subscriber.closed) {
|
|
1299
|
-
this.schedule();
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
});
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
function scheduleIterable(input, scheduler) {
|
|
1306
|
-
return new Observable(function(subscriber) {
|
|
1307
|
-
var iterator$1;
|
|
1308
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1309
|
-
iterator$1 = input[iterator]();
|
|
1310
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1311
|
-
var _a;
|
|
1312
|
-
var value;
|
|
1313
|
-
var done;
|
|
1314
|
-
try {
|
|
1315
|
-
_a = iterator$1.next(), value = _a.value, done = _a.done;
|
|
1316
|
-
} catch (err) {
|
|
1317
|
-
subscriber.error(err);
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
if (done) {
|
|
1321
|
-
subscriber.complete();
|
|
1322
|
-
} else {
|
|
1323
|
-
subscriber.next(value);
|
|
1324
|
-
}
|
|
1325
|
-
}, 0, true);
|
|
1326
|
-
});
|
|
1327
|
-
return function() {
|
|
1328
|
-
return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
|
|
1329
|
-
};
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
function scheduleAsyncIterable(input, scheduler) {
|
|
1333
|
-
if (!input) {
|
|
1334
|
-
throw new Error("Iterable cannot be null");
|
|
1335
|
-
}
|
|
1336
|
-
return new Observable(function(subscriber) {
|
|
1337
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1338
|
-
var iterator2 = input[Symbol.asyncIterator]();
|
|
1339
|
-
executeSchedule(subscriber, scheduler, function() {
|
|
1340
|
-
iterator2.next().then(function(result) {
|
|
1341
|
-
if (result.done) {
|
|
1342
|
-
subscriber.complete();
|
|
1343
|
-
} else {
|
|
1344
|
-
subscriber.next(result.value);
|
|
1345
|
-
}
|
|
1346
|
-
});
|
|
1347
|
-
}, 0, true);
|
|
1348
|
-
});
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
function scheduleReadableStreamLike(input, scheduler) {
|
|
1352
|
-
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
|
1353
|
-
}
|
|
1354
|
-
function scheduled(input, scheduler) {
|
|
1355
|
-
if (input != null) {
|
|
1356
|
-
if (isInteropObservable(input)) {
|
|
1357
|
-
return scheduleObservable(input, scheduler);
|
|
1358
|
-
}
|
|
1359
|
-
if (isArrayLike(input)) {
|
|
1360
|
-
return scheduleArray(input, scheduler);
|
|
1361
|
-
}
|
|
1362
|
-
if (isPromise(input)) {
|
|
1363
|
-
return schedulePromise(input, scheduler);
|
|
1364
|
-
}
|
|
1365
|
-
if (isAsyncIterable(input)) {
|
|
1366
|
-
return scheduleAsyncIterable(input, scheduler);
|
|
1367
|
-
}
|
|
1368
|
-
if (isIterable(input)) {
|
|
1369
|
-
return scheduleIterable(input, scheduler);
|
|
1370
|
-
}
|
|
1371
|
-
if (isReadableStreamLike(input)) {
|
|
1372
|
-
return scheduleReadableStreamLike(input, scheduler);
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
throw createInvalidObservableTypeError(input);
|
|
1376
|
-
}
|
|
1377
|
-
function from(input, scheduler) {
|
|
1378
|
-
return scheduler ? scheduled(input, scheduler) : innerFrom(input);
|
|
1379
|
-
}
|
|
1380
|
-
function map(project, thisArg) {
|
|
1381
|
-
return operate(function(source, subscriber) {
|
|
1382
|
-
var index = 0;
|
|
1383
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1384
|
-
subscriber.next(project.call(thisArg, value, index++));
|
|
1385
|
-
}));
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
|
|
1389
|
-
var buffer = [];
|
|
1390
|
-
var active = 0;
|
|
1391
|
-
var index = 0;
|
|
1392
|
-
var isComplete = false;
|
|
1393
|
-
var checkComplete = function() {
|
|
1394
|
-
if (isComplete && !buffer.length && !active) {
|
|
1395
|
-
subscriber.complete();
|
|
1396
|
-
}
|
|
1397
|
-
};
|
|
1398
|
-
var outerNext = function(value) {
|
|
1399
|
-
return active < concurrent ? doInnerSub(value) : buffer.push(value);
|
|
1400
|
-
};
|
|
1401
|
-
var doInnerSub = function(value) {
|
|
1402
|
-
expand && subscriber.next(value);
|
|
1403
|
-
active++;
|
|
1404
|
-
var innerComplete = false;
|
|
1405
|
-
innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
|
|
1406
|
-
onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
|
|
1407
|
-
if (expand) {
|
|
1408
|
-
outerNext(innerValue);
|
|
1409
|
-
} else {
|
|
1410
|
-
subscriber.next(innerValue);
|
|
1411
|
-
}
|
|
1412
|
-
}, function() {
|
|
1413
|
-
innerComplete = true;
|
|
1414
|
-
}, void 0, function() {
|
|
1415
|
-
if (innerComplete) {
|
|
1416
|
-
try {
|
|
1417
|
-
active--;
|
|
1418
|
-
var _loop_1 = function() {
|
|
1419
|
-
var bufferedValue = buffer.shift();
|
|
1420
|
-
if (innerSubScheduler) {
|
|
1421
|
-
executeSchedule(subscriber, innerSubScheduler, function() {
|
|
1422
|
-
return doInnerSub(bufferedValue);
|
|
1423
|
-
});
|
|
1424
|
-
} else {
|
|
1425
|
-
doInnerSub(bufferedValue);
|
|
1426
|
-
}
|
|
1427
|
-
};
|
|
1428
|
-
while (buffer.length && active < concurrent) {
|
|
1429
|
-
_loop_1();
|
|
1430
|
-
}
|
|
1431
|
-
checkComplete();
|
|
1432
|
-
} catch (err) {
|
|
1433
|
-
subscriber.error(err);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
}));
|
|
1437
|
-
};
|
|
1438
|
-
source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
|
|
1439
|
-
isComplete = true;
|
|
1440
|
-
checkComplete();
|
|
1441
|
-
}));
|
|
1442
|
-
return function() {
|
|
1443
|
-
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
function mergeMap(project, resultSelector, concurrent) {
|
|
1447
|
-
if (concurrent === void 0) {
|
|
1448
|
-
concurrent = Infinity;
|
|
1449
|
-
}
|
|
1450
|
-
if (isFunction(resultSelector)) {
|
|
1451
|
-
return mergeMap(function(a, i) {
|
|
1452
|
-
return map(function(b, ii) {
|
|
1453
|
-
return resultSelector(a, b, i, ii);
|
|
1454
|
-
})(innerFrom(project(a, i)));
|
|
1455
|
-
}, concurrent);
|
|
1456
|
-
} else if (typeof resultSelector === "number") {
|
|
1457
|
-
concurrent = resultSelector;
|
|
1458
|
-
}
|
|
1459
|
-
return operate(function(source, subscriber) {
|
|
1460
|
-
return mergeInternals(source, subscriber, project, concurrent);
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
function mergeAll(concurrent) {
|
|
1464
|
-
if (concurrent === void 0) {
|
|
1465
|
-
concurrent = Infinity;
|
|
1466
|
-
}
|
|
1467
|
-
return mergeMap(identity, concurrent);
|
|
1468
|
-
}
|
|
1469
|
-
function concatAll() {
|
|
1470
|
-
return mergeAll(1);
|
|
1471
|
-
}
|
|
1472
|
-
var ObjectUnsubscribedError = createErrorClass(function(_super) {
|
|
1473
|
-
return function ObjectUnsubscribedErrorImpl() {
|
|
1474
|
-
_super(this);
|
|
1475
|
-
this.name = "ObjectUnsubscribedError";
|
|
1476
|
-
this.message = "object unsubscribed";
|
|
1477
|
-
};
|
|
1478
|
-
});
|
|
1479
|
-
var Subject = function(_super) {
|
|
1480
|
-
__extends(Subject2, _super);
|
|
1481
|
-
function Subject2() {
|
|
1482
|
-
var _this = _super.call(this) || this;
|
|
1483
|
-
_this.closed = false;
|
|
1484
|
-
_this.currentObservers = null;
|
|
1485
|
-
_this.observers = [];
|
|
1486
|
-
_this.isStopped = false;
|
|
1487
|
-
_this.hasError = false;
|
|
1488
|
-
_this.thrownError = null;
|
|
1489
|
-
return _this;
|
|
1490
|
-
}
|
|
1491
|
-
Subject2.prototype.lift = function(operator) {
|
|
1492
|
-
var subject = new AnonymousSubject(this, this);
|
|
1493
|
-
subject.operator = operator;
|
|
1494
|
-
return subject;
|
|
1495
|
-
};
|
|
1496
|
-
Subject2.prototype._throwIfClosed = function() {
|
|
1497
|
-
if (this.closed) {
|
|
1498
|
-
throw new ObjectUnsubscribedError();
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
Subject2.prototype.next = function(value) {
|
|
1502
|
-
var _this = this;
|
|
1503
|
-
errorContext(function() {
|
|
1504
|
-
var e_1, _a;
|
|
1505
|
-
_this._throwIfClosed();
|
|
1506
|
-
if (!_this.isStopped) {
|
|
1507
|
-
if (!_this.currentObservers) {
|
|
1508
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
1509
|
-
}
|
|
1510
|
-
try {
|
|
1511
|
-
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1512
|
-
var observer = _c.value;
|
|
1513
|
-
observer.next(value);
|
|
1514
|
-
}
|
|
1515
|
-
} catch (e_1_1) {
|
|
1516
|
-
e_1 = { error: e_1_1 };
|
|
1517
|
-
} finally {
|
|
1518
|
-
try {
|
|
1519
|
-
if (_c && !_c.done && (_a = _b.return))
|
|
1520
|
-
_a.call(_b);
|
|
1521
|
-
} finally {
|
|
1522
|
-
if (e_1)
|
|
1523
|
-
throw e_1.error;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
});
|
|
1528
|
-
};
|
|
1529
|
-
Subject2.prototype.error = function(err) {
|
|
1530
|
-
var _this = this;
|
|
1531
|
-
errorContext(function() {
|
|
1532
|
-
_this._throwIfClosed();
|
|
1533
|
-
if (!_this.isStopped) {
|
|
1534
|
-
_this.hasError = _this.isStopped = true;
|
|
1535
|
-
_this.thrownError = err;
|
|
1536
|
-
var observers = _this.observers;
|
|
1537
|
-
while (observers.length) {
|
|
1538
|
-
observers.shift().error(err);
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
};
|
|
1543
|
-
Subject2.prototype.complete = function() {
|
|
1544
|
-
var _this = this;
|
|
1545
|
-
errorContext(function() {
|
|
1546
|
-
_this._throwIfClosed();
|
|
1547
|
-
if (!_this.isStopped) {
|
|
1548
|
-
_this.isStopped = true;
|
|
1549
|
-
var observers = _this.observers;
|
|
1550
|
-
while (observers.length) {
|
|
1551
|
-
observers.shift().complete();
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
});
|
|
1555
|
-
};
|
|
1556
|
-
Subject2.prototype.unsubscribe = function() {
|
|
1557
|
-
this.isStopped = this.closed = true;
|
|
1558
|
-
this.observers = this.currentObservers = null;
|
|
1559
|
-
};
|
|
1560
|
-
Object.defineProperty(Subject2.prototype, "observed", {
|
|
1561
|
-
get: function() {
|
|
1562
|
-
var _a;
|
|
1563
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
1564
|
-
},
|
|
1565
|
-
enumerable: false,
|
|
1566
|
-
configurable: true
|
|
1567
|
-
});
|
|
1568
|
-
Subject2.prototype._trySubscribe = function(subscriber) {
|
|
1569
|
-
this._throwIfClosed();
|
|
1570
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1571
|
-
};
|
|
1572
|
-
Subject2.prototype._subscribe = function(subscriber) {
|
|
1573
|
-
this._throwIfClosed();
|
|
1574
|
-
this._checkFinalizedStatuses(subscriber);
|
|
1575
|
-
return this._innerSubscribe(subscriber);
|
|
1576
|
-
};
|
|
1577
|
-
Subject2.prototype._innerSubscribe = function(subscriber) {
|
|
1578
|
-
var _this = this;
|
|
1579
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
1580
|
-
if (hasError || isStopped) {
|
|
1581
|
-
return EMPTY_SUBSCRIPTION;
|
|
1582
|
-
}
|
|
1583
|
-
this.currentObservers = null;
|
|
1584
|
-
observers.push(subscriber);
|
|
1585
|
-
return new Subscription(function() {
|
|
1586
|
-
_this.currentObservers = null;
|
|
1587
|
-
arrRemove(observers, subscriber);
|
|
1588
|
-
});
|
|
1589
|
-
};
|
|
1590
|
-
Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
1591
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
1592
|
-
if (hasError) {
|
|
1593
|
-
subscriber.error(thrownError);
|
|
1594
|
-
} else if (isStopped) {
|
|
1595
|
-
subscriber.complete();
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
Subject2.prototype.asObservable = function() {
|
|
1599
|
-
var observable2 = new Observable();
|
|
1600
|
-
observable2.source = this;
|
|
1601
|
-
return observable2;
|
|
1602
|
-
};
|
|
1603
|
-
Subject2.create = function(destination, source) {
|
|
1604
|
-
return new AnonymousSubject(destination, source);
|
|
1605
|
-
};
|
|
1606
|
-
return Subject2;
|
|
1607
|
-
}(Observable);
|
|
1608
|
-
var AnonymousSubject = function(_super) {
|
|
1609
|
-
__extends(AnonymousSubject2, _super);
|
|
1610
|
-
function AnonymousSubject2(destination, source) {
|
|
1611
|
-
var _this = _super.call(this) || this;
|
|
1612
|
-
_this.destination = destination;
|
|
1613
|
-
_this.source = source;
|
|
1614
|
-
return _this;
|
|
1615
|
-
}
|
|
1616
|
-
AnonymousSubject2.prototype.next = function(value) {
|
|
1617
|
-
var _a, _b;
|
|
1618
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
1619
|
-
};
|
|
1620
|
-
AnonymousSubject2.prototype.error = function(err) {
|
|
1621
|
-
var _a, _b;
|
|
1622
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
1623
|
-
};
|
|
1624
|
-
AnonymousSubject2.prototype.complete = function() {
|
|
1625
|
-
var _a, _b;
|
|
1626
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1627
|
-
};
|
|
1628
|
-
AnonymousSubject2.prototype._subscribe = function(subscriber) {
|
|
1629
|
-
var _a, _b;
|
|
1630
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
1631
|
-
};
|
|
1632
|
-
return AnonymousSubject2;
|
|
1633
|
-
}(Subject);
|
|
1634
|
-
function debounce(durationSelector) {
|
|
1635
|
-
return operate(function(source, subscriber) {
|
|
1636
|
-
var hasValue = false;
|
|
1637
|
-
var lastValue = null;
|
|
1638
|
-
var durationSubscriber = null;
|
|
1639
|
-
var emit = function() {
|
|
1640
|
-
durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
|
|
1641
|
-
durationSubscriber = null;
|
|
1642
|
-
if (hasValue) {
|
|
1643
|
-
hasValue = false;
|
|
1644
|
-
var value = lastValue;
|
|
1645
|
-
lastValue = null;
|
|
1646
|
-
subscriber.next(value);
|
|
1647
|
-
}
|
|
1648
|
-
};
|
|
1649
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1650
|
-
durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();
|
|
1651
|
-
hasValue = true;
|
|
1652
|
-
lastValue = value;
|
|
1653
|
-
durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);
|
|
1654
|
-
innerFrom(durationSelector(value)).subscribe(durationSubscriber);
|
|
1655
|
-
}, function() {
|
|
1656
|
-
emit();
|
|
1657
|
-
subscriber.complete();
|
|
1658
|
-
}, void 0, function() {
|
|
1659
|
-
lastValue = durationSubscriber = null;
|
|
1660
|
-
}));
|
|
1661
|
-
});
|
|
1662
|
-
}
|
|
1663
|
-
function debounceTime(dueTime, scheduler) {
|
|
1664
|
-
if (scheduler === void 0) {
|
|
1665
|
-
scheduler = asyncScheduler;
|
|
1666
|
-
}
|
|
1667
|
-
return operate(function(source, subscriber) {
|
|
1668
|
-
var activeTask = null;
|
|
1669
|
-
var lastValue = null;
|
|
1670
|
-
var lastTime = null;
|
|
1671
|
-
var emit = function() {
|
|
1672
|
-
if (activeTask) {
|
|
1673
|
-
activeTask.unsubscribe();
|
|
1674
|
-
activeTask = null;
|
|
1675
|
-
var value = lastValue;
|
|
1676
|
-
lastValue = null;
|
|
1677
|
-
subscriber.next(value);
|
|
1678
|
-
}
|
|
1679
|
-
};
|
|
1680
|
-
function emitWhenIdle() {
|
|
1681
|
-
var targetTime = lastTime + dueTime;
|
|
1682
|
-
var now = scheduler.now();
|
|
1683
|
-
if (now < targetTime) {
|
|
1684
|
-
activeTask = this.schedule(void 0, targetTime - now);
|
|
1685
|
-
subscriber.add(activeTask);
|
|
1686
|
-
return;
|
|
1687
|
-
}
|
|
1688
|
-
emit();
|
|
1689
|
-
}
|
|
1690
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1691
|
-
lastValue = value;
|
|
1692
|
-
lastTime = scheduler.now();
|
|
1693
|
-
if (!activeTask) {
|
|
1694
|
-
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
|
|
1695
|
-
subscriber.add(activeTask);
|
|
1696
|
-
}
|
|
1697
|
-
}, function() {
|
|
1698
|
-
emit();
|
|
1699
|
-
subscriber.complete();
|
|
1700
|
-
}, void 0, function() {
|
|
1701
|
-
lastValue = activeTask = null;
|
|
1702
|
-
}));
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
function concat() {
|
|
1706
|
-
var args = [];
|
|
1707
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1708
|
-
args[_i] = arguments[_i];
|
|
1709
|
-
}
|
|
1710
|
-
return concatAll()(from(args, popScheduler(args)));
|
|
1711
|
-
}
|
|
1712
|
-
var EMPTY = new Observable(function(subscriber) {
|
|
1713
|
-
return subscriber.complete();
|
|
1714
|
-
});
|
|
1715
|
-
function take(count) {
|
|
1716
|
-
return count <= 0 ? function() {
|
|
1717
|
-
return EMPTY;
|
|
1718
|
-
} : operate(function(source, subscriber) {
|
|
1719
|
-
var seen = 0;
|
|
1720
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1721
|
-
if (++seen <= count) {
|
|
1722
|
-
subscriber.next(value);
|
|
1723
|
-
if (count <= seen) {
|
|
1724
|
-
subscriber.complete();
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}));
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
function ignoreElements() {
|
|
1731
|
-
return operate(function(source, subscriber) {
|
|
1732
|
-
source.subscribe(createOperatorSubscriber(subscriber, noop));
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
function mapTo(value) {
|
|
1736
|
-
return map(function() {
|
|
1737
|
-
return value;
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
1741
|
-
if (subscriptionDelay) {
|
|
1742
|
-
return function(source) {
|
|
1743
|
-
return concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
1744
|
-
};
|
|
1745
|
-
}
|
|
1746
|
-
return mergeMap(function(value, index) {
|
|
1747
|
-
return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value));
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
function delay(due, scheduler) {
|
|
1751
|
-
if (scheduler === void 0) {
|
|
1752
|
-
scheduler = asyncScheduler;
|
|
1753
|
-
}
|
|
1754
|
-
var duration = timer(due, scheduler);
|
|
1755
|
-
return delayWhen(function() {
|
|
1756
|
-
return duration;
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
function distinctUntilChanged(comparator, keySelector) {
|
|
1760
|
-
if (keySelector === void 0) {
|
|
1761
|
-
keySelector = identity;
|
|
1762
|
-
}
|
|
1763
|
-
comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
|
|
1764
|
-
return operate(function(source, subscriber) {
|
|
1765
|
-
var previousKey;
|
|
1766
|
-
var first = true;
|
|
1767
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1768
|
-
var currentKey = keySelector(value);
|
|
1769
|
-
if (first || !comparator(previousKey, currentKey)) {
|
|
1770
|
-
first = false;
|
|
1771
|
-
previousKey = currentKey;
|
|
1772
|
-
subscriber.next(value);
|
|
1773
|
-
}
|
|
1774
|
-
}));
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
function defaultCompare(a, b) {
|
|
1778
|
-
return a === b;
|
|
1779
|
-
}
|
|
1780
|
-
function filter(predicate, thisArg) {
|
|
1781
|
-
return operate(function(source, subscriber) {
|
|
1782
|
-
var index = 0;
|
|
1783
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1784
|
-
return predicate.call(thisArg, value, index++) && subscriber.next(value);
|
|
1785
|
-
}));
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
function exhaustMap(project, resultSelector) {
|
|
1789
|
-
if (resultSelector) {
|
|
1790
|
-
return function(source) {
|
|
1791
|
-
return source.pipe(exhaustMap(function(a, i) {
|
|
1792
|
-
return innerFrom(project(a, i)).pipe(map(function(b, ii) {
|
|
1793
|
-
return resultSelector(a, b, i, ii);
|
|
1794
|
-
}));
|
|
1795
|
-
}));
|
|
1796
|
-
};
|
|
1797
|
-
}
|
|
1798
|
-
return operate(function(source, subscriber) {
|
|
1799
|
-
var index = 0;
|
|
1800
|
-
var innerSub = null;
|
|
1801
|
-
var isComplete = false;
|
|
1802
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(outerValue) {
|
|
1803
|
-
if (!innerSub) {
|
|
1804
|
-
innerSub = createOperatorSubscriber(subscriber, void 0, function() {
|
|
1805
|
-
innerSub = null;
|
|
1806
|
-
isComplete && subscriber.complete();
|
|
1807
|
-
});
|
|
1808
|
-
innerFrom(project(outerValue, index++)).subscribe(innerSub);
|
|
1809
|
-
}
|
|
1810
|
-
}, function() {
|
|
1811
|
-
isComplete = true;
|
|
1812
|
-
!innerSub && subscriber.complete();
|
|
1813
|
-
}));
|
|
1814
|
-
});
|
|
1815
|
-
}
|
|
1816
|
-
function pairwise() {
|
|
1817
|
-
return operate(function(source, subscriber) {
|
|
1818
|
-
var prev;
|
|
1819
|
-
var hasPrev = false;
|
|
1820
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
1821
|
-
var p = prev;
|
|
1822
|
-
prev = value;
|
|
1823
|
-
hasPrev && subscriber.next([p, value]);
|
|
1824
|
-
hasPrev = true;
|
|
1825
|
-
}));
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
var ReplaySubject = function(_super) {
|
|
1829
|
-
__extends(ReplaySubject2, _super);
|
|
1830
|
-
function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
|
|
1831
|
-
if (_bufferSize === void 0) {
|
|
1832
|
-
_bufferSize = Infinity;
|
|
1833
|
-
}
|
|
1834
|
-
if (_windowTime === void 0) {
|
|
1835
|
-
_windowTime = Infinity;
|
|
1836
|
-
}
|
|
1837
|
-
if (_timestampProvider === void 0) {
|
|
1838
|
-
_timestampProvider = dateTimestampProvider;
|
|
1839
|
-
}
|
|
1840
|
-
var _this = _super.call(this) || this;
|
|
1841
|
-
_this._bufferSize = _bufferSize;
|
|
1842
|
-
_this._windowTime = _windowTime;
|
|
1843
|
-
_this._timestampProvider = _timestampProvider;
|
|
1844
|
-
_this._buffer = [];
|
|
1845
|
-
_this._infiniteTimeWindow = true;
|
|
1846
|
-
_this._infiniteTimeWindow = _windowTime === Infinity;
|
|
1847
|
-
_this._bufferSize = Math.max(1, _bufferSize);
|
|
1848
|
-
_this._windowTime = Math.max(1, _windowTime);
|
|
1849
|
-
return _this;
|
|
1850
|
-
}
|
|
1851
|
-
ReplaySubject2.prototype.next = function(value) {
|
|
1852
|
-
var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
|
|
1853
|
-
if (!isStopped) {
|
|
1854
|
-
_buffer.push(value);
|
|
1855
|
-
!_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
|
|
1856
|
-
}
|
|
1857
|
-
this._trimBuffer();
|
|
1858
|
-
_super.prototype.next.call(this, value);
|
|
1859
|
-
};
|
|
1860
|
-
ReplaySubject2.prototype._subscribe = function(subscriber) {
|
|
1861
|
-
this._throwIfClosed();
|
|
1862
|
-
this._trimBuffer();
|
|
1863
|
-
var subscription = this._innerSubscribe(subscriber);
|
|
1864
|
-
var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
|
|
1865
|
-
var copy = _buffer.slice();
|
|
1866
|
-
for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
|
|
1867
|
-
subscriber.next(copy[i]);
|
|
1868
|
-
}
|
|
1869
|
-
this._checkFinalizedStatuses(subscriber);
|
|
1870
|
-
return subscription;
|
|
1871
|
-
};
|
|
1872
|
-
ReplaySubject2.prototype._trimBuffer = function() {
|
|
1873
|
-
var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
|
|
1874
|
-
var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
|
|
1875
|
-
_bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
|
|
1876
|
-
if (!_infiniteTimeWindow) {
|
|
1877
|
-
var now = _timestampProvider.now();
|
|
1878
|
-
var last2 = 0;
|
|
1879
|
-
for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
|
|
1880
|
-
last2 = i;
|
|
1881
|
-
}
|
|
1882
|
-
last2 && _buffer.splice(0, last2 + 1);
|
|
1883
|
-
}
|
|
1884
|
-
};
|
|
1885
|
-
return ReplaySubject2;
|
|
1886
|
-
}(Subject);
|
|
1887
|
-
function share(options) {
|
|
1888
|
-
if (options === void 0) {
|
|
1889
|
-
options = {};
|
|
1890
|
-
}
|
|
1891
|
-
var _a = options.connector, connector = _a === void 0 ? function() {
|
|
1892
|
-
return new Subject();
|
|
1893
|
-
} : _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;
|
|
1894
|
-
return function(wrapperSource) {
|
|
1895
|
-
var connection;
|
|
1896
|
-
var resetConnection;
|
|
1897
|
-
var subject;
|
|
1898
|
-
var refCount = 0;
|
|
1899
|
-
var hasCompleted = false;
|
|
1900
|
-
var hasErrored = false;
|
|
1901
|
-
var cancelReset = function() {
|
|
1902
|
-
resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
|
|
1903
|
-
resetConnection = void 0;
|
|
1904
|
-
};
|
|
1905
|
-
var reset = function() {
|
|
1906
|
-
cancelReset();
|
|
1907
|
-
connection = subject = void 0;
|
|
1908
|
-
hasCompleted = hasErrored = false;
|
|
1909
|
-
};
|
|
1910
|
-
var resetAndUnsubscribe = function() {
|
|
1911
|
-
var conn = connection;
|
|
1912
|
-
reset();
|
|
1913
|
-
conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
|
|
1914
|
-
};
|
|
1915
|
-
return operate(function(source, subscriber) {
|
|
1916
|
-
refCount++;
|
|
1917
|
-
if (!hasErrored && !hasCompleted) {
|
|
1918
|
-
cancelReset();
|
|
1919
|
-
}
|
|
1920
|
-
var dest = subject = subject !== null && subject !== void 0 ? subject : connector();
|
|
1921
|
-
subscriber.add(function() {
|
|
1922
|
-
refCount--;
|
|
1923
|
-
if (refCount === 0 && !hasErrored && !hasCompleted) {
|
|
1924
|
-
resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
|
|
1925
|
-
}
|
|
1926
|
-
});
|
|
1927
|
-
dest.subscribe(subscriber);
|
|
1928
|
-
if (!connection && refCount > 0) {
|
|
1929
|
-
connection = new SafeSubscriber({
|
|
1930
|
-
next: function(value) {
|
|
1931
|
-
return dest.next(value);
|
|
1932
|
-
},
|
|
1933
|
-
error: function(err) {
|
|
1934
|
-
hasErrored = true;
|
|
1935
|
-
cancelReset();
|
|
1936
|
-
resetConnection = handleReset(reset, resetOnError, err);
|
|
1937
|
-
dest.error(err);
|
|
1938
|
-
},
|
|
1939
|
-
complete: function() {
|
|
1940
|
-
hasCompleted = true;
|
|
1941
|
-
cancelReset();
|
|
1942
|
-
resetConnection = handleReset(reset, resetOnComplete);
|
|
1943
|
-
dest.complete();
|
|
1944
|
-
}
|
|
1945
|
-
});
|
|
1946
|
-
innerFrom(source).subscribe(connection);
|
|
1947
|
-
}
|
|
1948
|
-
})(wrapperSource);
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
|
-
function handleReset(reset, on) {
|
|
1952
|
-
var args = [];
|
|
1953
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1954
|
-
args[_i - 2] = arguments[_i];
|
|
1955
|
-
}
|
|
1956
|
-
if (on === true) {
|
|
1957
|
-
reset();
|
|
1958
|
-
return;
|
|
1959
|
-
}
|
|
1960
|
-
if (on === false) {
|
|
1961
|
-
return;
|
|
1962
|
-
}
|
|
1963
|
-
var onSubscriber = new SafeSubscriber({
|
|
1964
|
-
next: function() {
|
|
1965
|
-
onSubscriber.unsubscribe();
|
|
1966
|
-
reset();
|
|
1967
|
-
}
|
|
1968
|
-
});
|
|
1969
|
-
return innerFrom(on.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
|
|
1970
|
-
}
|
|
1971
|
-
function shareReplay(configOrBufferSize, windowTime, scheduler) {
|
|
1972
|
-
var _a, _b, _c;
|
|
1973
|
-
var bufferSize;
|
|
1974
|
-
var refCount = false;
|
|
1975
|
-
if (configOrBufferSize && typeof configOrBufferSize === "object") {
|
|
1976
|
-
_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;
|
|
1977
|
-
} else {
|
|
1978
|
-
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
|
|
1979
|
-
}
|
|
1980
|
-
return share({
|
|
1981
|
-
connector: function() {
|
|
1982
|
-
return new ReplaySubject(bufferSize, windowTime, scheduler);
|
|
1983
|
-
},
|
|
1984
|
-
resetOnError: true,
|
|
1985
|
-
resetOnComplete: false,
|
|
1986
|
-
resetOnRefCountZero: refCount
|
|
1987
|
-
});
|
|
1988
|
-
}
|
|
1989
|
-
function skip(count) {
|
|
1990
|
-
return filter(function(_, index) {
|
|
1991
|
-
return count <= index;
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
function startWith() {
|
|
1995
|
-
var values = [];
|
|
1996
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1997
|
-
values[_i] = arguments[_i];
|
|
1998
|
-
}
|
|
1999
|
-
var scheduler = popScheduler(values);
|
|
2000
|
-
return operate(function(source, subscriber) {
|
|
2001
|
-
(scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
function switchMap(project, resultSelector) {
|
|
2005
|
-
return operate(function(source, subscriber) {
|
|
2006
|
-
var innerSubscriber = null;
|
|
2007
|
-
var index = 0;
|
|
2008
|
-
var isComplete = false;
|
|
2009
|
-
var checkComplete = function() {
|
|
2010
|
-
return isComplete && !innerSubscriber && subscriber.complete();
|
|
2011
|
-
};
|
|
2012
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2013
|
-
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
2014
|
-
var innerIndex = 0;
|
|
2015
|
-
var outerIndex = index++;
|
|
2016
|
-
innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
|
|
2017
|
-
return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
|
|
2018
|
-
}, function() {
|
|
2019
|
-
innerSubscriber = null;
|
|
2020
|
-
checkComplete();
|
|
2021
|
-
}));
|
|
2022
|
-
}, function() {
|
|
2023
|
-
isComplete = true;
|
|
2024
|
-
checkComplete();
|
|
2025
|
-
}));
|
|
2026
|
-
});
|
|
2027
|
-
}
|
|
2028
|
-
function takeUntil(notifier) {
|
|
2029
|
-
return operate(function(source, subscriber) {
|
|
2030
|
-
innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function() {
|
|
2031
|
-
return subscriber.complete();
|
|
2032
|
-
}, noop));
|
|
2033
|
-
!subscriber.closed && source.subscribe(subscriber);
|
|
2034
|
-
});
|
|
2035
|
-
}
|
|
2036
|
-
function tap(observerOrNext, error, complete) {
|
|
2037
|
-
var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
|
|
2038
|
-
return tapObserver ? operate(function(source, subscriber) {
|
|
2039
|
-
var _a;
|
|
2040
|
-
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
2041
|
-
var isUnsub = true;
|
|
2042
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2043
|
-
var _a2;
|
|
2044
|
-
(_a2 = tapObserver.next) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, value);
|
|
2045
|
-
subscriber.next(value);
|
|
2046
|
-
}, function() {
|
|
2047
|
-
var _a2;
|
|
2048
|
-
isUnsub = false;
|
|
2049
|
-
(_a2 = tapObserver.complete) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
|
|
2050
|
-
subscriber.complete();
|
|
2051
|
-
}, function(err) {
|
|
2052
|
-
var _a2;
|
|
2053
|
-
isUnsub = false;
|
|
2054
|
-
(_a2 = tapObserver.error) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver, err);
|
|
2055
|
-
subscriber.error(err);
|
|
2056
|
-
}, function() {
|
|
2057
|
-
var _a2, _b;
|
|
2058
|
-
if (isUnsub) {
|
|
2059
|
-
(_a2 = tapObserver.unsubscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
|
|
2060
|
-
}
|
|
2061
|
-
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
|
2062
|
-
}));
|
|
2063
|
-
}) : identity;
|
|
2064
|
-
}
|
|
2065
|
-
function withLatestFrom() {
|
|
2066
|
-
var inputs = [];
|
|
2067
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2068
|
-
inputs[_i] = arguments[_i];
|
|
2069
|
-
}
|
|
2070
|
-
var project = popResultSelector(inputs);
|
|
2071
|
-
return operate(function(source, subscriber) {
|
|
2072
|
-
var len = inputs.length;
|
|
2073
|
-
var otherValues = new Array(len);
|
|
2074
|
-
var hasValue = inputs.map(function() {
|
|
2075
|
-
return false;
|
|
2076
|
-
});
|
|
2077
|
-
var ready = false;
|
|
2078
|
-
var _loop_1 = function(i2) {
|
|
2079
|
-
innerFrom(inputs[i2]).subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2080
|
-
otherValues[i2] = value;
|
|
2081
|
-
if (!ready && !hasValue[i2]) {
|
|
2082
|
-
hasValue[i2] = true;
|
|
2083
|
-
(ready = hasValue.every(identity)) && (hasValue = null);
|
|
2084
|
-
}
|
|
2085
|
-
}, noop));
|
|
2086
|
-
};
|
|
2087
|
-
for (var i = 0; i < len; i++) {
|
|
2088
|
-
_loop_1(i);
|
|
2089
|
-
}
|
|
2090
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
2091
|
-
if (ready) {
|
|
2092
|
-
var values = __spreadArray([value], __read(otherValues));
|
|
2093
|
-
subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
|
|
2094
|
-
}
|
|
2095
|
-
}));
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
23
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
2099
24
|
const is = (x, y) => {
|
|
2100
25
|
if (x === y) {
|
|
@@ -2190,7 +115,7 @@
|
|
|
2190
115
|
}
|
|
2191
116
|
});
|
|
2192
117
|
const shouldRequireLayout = (source) => source.pipe(
|
|
2193
|
-
pairwise(),
|
|
118
|
+
operators.pairwise(),
|
|
2194
119
|
rxjs.map(([old, latest]) => {
|
|
2195
120
|
if (latest.fontScale !== old.fontScale)
|
|
2196
121
|
return true;
|
|
@@ -2200,18 +125,18 @@
|
|
|
2200
125
|
})
|
|
2201
126
|
);
|
|
2202
127
|
const newSettings$ = changes$.pipe(
|
|
2203
|
-
withLatestFrom(settings$),
|
|
128
|
+
operators.withLatestFrom(settings$),
|
|
2204
129
|
rxjs.map(([changes, settings]) => ({
|
|
2205
130
|
fontJustification: changes.fontJustification ?? settings.fontJustification,
|
|
2206
131
|
fontWeight: changes.fontWeight ?? settings.fontWeight,
|
|
2207
132
|
lineHeight: changes.lineHeight ?? settings.lineHeight,
|
|
2208
133
|
fontScale: Math.max(0.01, changes.fontScale ?? settings.fontScale)
|
|
2209
134
|
})),
|
|
2210
|
-
distinctUntilChanged(isShallowEqual),
|
|
2211
|
-
shareReplay(1)
|
|
135
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
136
|
+
operators.shareReplay(1)
|
|
2212
137
|
);
|
|
2213
138
|
newSettings$.subscribe(settings$);
|
|
2214
|
-
settings$.pipe(shouldRequireLayout, tap(applyChangeToSpineItem), rxjs.takeUntil(reader.$.destroy$)).subscribe();
|
|
139
|
+
settings$.pipe(shouldRequireLayout, operators.tap(applyChangeToSpineItem), rxjs.takeUntil(reader.$.destroy$)).subscribe();
|
|
2215
140
|
const settingsMerge$ = rxjs.combineLatest([reader.settings$, settings$]).pipe(
|
|
2216
141
|
rxjs.map(([innerSettings, settings]) => ({
|
|
2217
142
|
...innerSettings,
|
|
@@ -2288,32 +213,32 @@
|
|
|
2288
213
|
return SHOULD_NOT_LAYOUT$2;
|
|
2289
214
|
});
|
|
2290
215
|
const createResetLock$ = (source) => rxjs.scheduled(source, rxjs.animationFrameScheduler).pipe(
|
|
2291
|
-
tap(() => {
|
|
216
|
+
operators.tap(() => {
|
|
2292
217
|
iframeOverlayForAnimationsElement == null ? void 0 : iframeOverlayForAnimationsElement.style.setProperty(`visibility`, `hidden`);
|
|
2293
218
|
})
|
|
2294
219
|
);
|
|
2295
|
-
const viewportFree$ = reader.$.viewportState$.pipe(filter((data) => data === `free`));
|
|
2296
|
-
const viewportBusy$ = reader.$.viewportState$.pipe(filter((data) => data === `busy`));
|
|
220
|
+
const viewportFree$ = reader.$.viewportState$.pipe(operators.filter((data) => data === `free`));
|
|
221
|
+
const viewportBusy$ = reader.$.viewportState$.pipe(operators.filter((data) => data === `busy`));
|
|
2297
222
|
const lockAfterViewportBusy$ = viewportBusy$.pipe(
|
|
2298
|
-
tap(() => {
|
|
223
|
+
operators.tap(() => {
|
|
2299
224
|
iframeOverlayForAnimationsElement == null ? void 0 : iframeOverlayForAnimationsElement.style.setProperty(`visibility`, `visible`);
|
|
2300
225
|
})
|
|
2301
226
|
);
|
|
2302
|
-
const resetLockViewportFree$ = createResetLock$(viewportFree$).pipe(take(1));
|
|
227
|
+
const resetLockViewportFree$ = createResetLock$(viewportFree$).pipe(operators.take(1));
|
|
2303
228
|
const pageTurnMode$ = reader.context.$.settings$.pipe(
|
|
2304
|
-
map(() => reader.context.getSettings().computedPageTurnMode),
|
|
2305
|
-
distinctUntilChanged()
|
|
229
|
+
operators.map(() => reader.context.getSettings().computedPageTurnMode),
|
|
230
|
+
operators.distinctUntilChanged()
|
|
2306
231
|
);
|
|
2307
232
|
const handleViewportLock$ = pageTurnMode$.pipe(
|
|
2308
|
-
switchMap(
|
|
2309
|
-
(mode) => mode === `controlled` ? lockAfterViewportBusy$.pipe(switchMap(() => resetLockViewportFree$)) : createResetLock$(rxjs.of(void 0))
|
|
233
|
+
operators.switchMap(
|
|
234
|
+
(mode) => mode === `controlled` ? lockAfterViewportBusy$.pipe(operators.switchMap(() => resetLockViewportFree$)) : createResetLock$(rxjs.of(void 0))
|
|
2310
235
|
),
|
|
2311
|
-
takeUntil(reader.$.destroy$)
|
|
236
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2312
237
|
);
|
|
2313
238
|
return handleViewportLock$;
|
|
2314
239
|
};
|
|
2315
240
|
const mapKeysTo = (keys) => {
|
|
2316
|
-
return map((obj) => {
|
|
241
|
+
return operators.map((obj) => {
|
|
2317
242
|
return Object.entries(obj).reduce((acc, [key, entry]) => {
|
|
2318
243
|
if (keys.includes(key)) {
|
|
2319
244
|
return {
|
|
@@ -2412,12 +337,12 @@
|
|
|
2412
337
|
movingSafePan$.subscribe();
|
|
2413
338
|
settingsSubject$.pipe(
|
|
2414
339
|
mapKeysTo([`pageHorizontalMargin`, `pageVerticalMargin`]),
|
|
2415
|
-
distinctUntilChanged(isShallowEqual),
|
|
2416
|
-
skip(1),
|
|
2417
|
-
tap(() => {
|
|
340
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
341
|
+
operators.skip(1),
|
|
342
|
+
operators.tap(() => {
|
|
2418
343
|
reader.layout();
|
|
2419
344
|
}),
|
|
2420
|
-
takeUntil(reader.$.destroy$)
|
|
345
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2421
346
|
).subscribe();
|
|
2422
347
|
return {
|
|
2423
348
|
...reader,
|
|
@@ -2435,7 +360,7 @@
|
|
|
2435
360
|
reader.setSettings(rest);
|
|
2436
361
|
},
|
|
2437
362
|
settings$: rxjs.combineLatest([reader.settings$, settingsSubject$.asObservable()]).pipe(
|
|
2438
|
-
map(([innerSettings, settings]) => ({
|
|
363
|
+
operators.map(([innerSettings, settings]) => ({
|
|
2439
364
|
...innerSettings,
|
|
2440
365
|
...settings
|
|
2441
366
|
}))
|
|
@@ -2758,24 +683,24 @@
|
|
|
2758
683
|
return getSpineItemNumberOfPages(item);
|
|
2759
684
|
}, 0);
|
|
2760
685
|
reader.spineItems$.pipe(
|
|
2761
|
-
tap(
|
|
686
|
+
operators.tap(
|
|
2762
687
|
(items) => items.forEach(({ item }) => {
|
|
2763
688
|
chaptersInfo[item.id] = getChapterInfo2(item);
|
|
2764
689
|
})
|
|
2765
690
|
),
|
|
2766
|
-
takeUntil(reader.$.destroy$)
|
|
691
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2767
692
|
).subscribe();
|
|
2768
693
|
const innerPaginationExtendedInfo$ = reader.pagination$.pipe(
|
|
2769
|
-
map((info) => ({
|
|
694
|
+
operators.map((info) => ({
|
|
2770
695
|
...info,
|
|
2771
696
|
...mapPaginationInfoToExtendedInfo(info)
|
|
2772
697
|
})),
|
|
2773
|
-
distinctUntilChanged(isShallowEqual)
|
|
698
|
+
operators.distinctUntilChanged(isShallowEqual)
|
|
2774
699
|
);
|
|
2775
700
|
const totalPages$ = reader.$.layout$.pipe(
|
|
2776
|
-
debounceTime(10, rxjs.animationFrameScheduler),
|
|
2777
|
-
withLatestFrom(reader.pagination$),
|
|
2778
|
-
map(() => {
|
|
701
|
+
operators.debounceTime(10, rxjs.animationFrameScheduler),
|
|
702
|
+
operators.withLatestFrom(reader.pagination$),
|
|
703
|
+
operators.map(() => {
|
|
2779
704
|
const numberOfPagesPerItems = getNumberOfPagesPerItems();
|
|
2780
705
|
return {
|
|
2781
706
|
numberOfPagesPerItems,
|
|
@@ -2785,21 +710,21 @@
|
|
|
2785
710
|
numberOfTotalPages: numberOfPagesPerItems.reduce((acc, numberOfPagesForItem) => acc + numberOfPagesForItem, 0)
|
|
2786
711
|
};
|
|
2787
712
|
}),
|
|
2788
|
-
distinctUntilChanged(isShallowEqual),
|
|
2789
|
-
startWith({
|
|
713
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
714
|
+
operators.startWith({
|
|
2790
715
|
numberOfPagesPerItems: [],
|
|
2791
716
|
numberOfTotalPages: 0
|
|
2792
717
|
})
|
|
2793
718
|
);
|
|
2794
719
|
const pagination$ = rxjs.combineLatest([innerPaginationExtendedInfo$, totalPages$]).pipe(
|
|
2795
|
-
map(([pageInfo, totalPageInfo]) => ({
|
|
720
|
+
operators.map(([pageInfo, totalPageInfo]) => ({
|
|
2796
721
|
...pageInfo,
|
|
2797
722
|
...totalPageInfo,
|
|
2798
723
|
beginAbsolutePageIndex: totalPageInfo.numberOfPagesPerItems.slice(0, pageInfo.beginSpineItemIndex).reduce((acc, numberOfPagesForItem) => acc + numberOfPagesForItem, pageInfo.beginPageIndexInChapter ?? 0),
|
|
2799
724
|
endAbsolutePageIndex: totalPageInfo.numberOfPagesPerItems.slice(0, pageInfo.endSpineItemIndex).reduce((acc, numberOfPagesForItem) => acc + numberOfPagesForItem, pageInfo.endPageIndexInChapter ?? 0)
|
|
2800
725
|
})),
|
|
2801
|
-
shareReplay(1),
|
|
2802
|
-
takeUntil(reader.$.destroy$)
|
|
726
|
+
operators.shareReplay(1),
|
|
727
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2803
728
|
);
|
|
2804
729
|
return {
|
|
2805
730
|
...reader,
|
|
@@ -2900,14 +825,14 @@
|
|
|
2900
825
|
addStyle(`prose-reader-theme`, getStyle());
|
|
2901
826
|
});
|
|
2902
827
|
reader.spineItems$.pipe(
|
|
2903
|
-
tap((items) => items.map(({ element }) => applyChangeToSpineItemElement({ container: element }))),
|
|
2904
|
-
takeUntil(reader.$.destroy$)
|
|
828
|
+
operators.tap((items) => items.map(({ element }) => applyChangeToSpineItemElement({ container: element }))),
|
|
829
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2905
830
|
).subscribe();
|
|
2906
831
|
currentThemeSubject$.pipe(
|
|
2907
|
-
tap(() => {
|
|
832
|
+
operators.tap(() => {
|
|
2908
833
|
applyChangeToSpineItem();
|
|
2909
834
|
}),
|
|
2910
|
-
takeUntil(reader.$.destroy$)
|
|
835
|
+
operators.takeUntil(reader.$.destroy$)
|
|
2911
836
|
).subscribe();
|
|
2912
837
|
return {
|
|
2913
838
|
...reader,
|
|
@@ -3212,7 +1137,7 @@
|
|
|
3212
1137
|
recompute,
|
|
3213
1138
|
destroy,
|
|
3214
1139
|
$: {
|
|
3215
|
-
settings$: settingsSubject$.asObservable().pipe(distinctUntilChanged(isShallowEqual))
|
|
1140
|
+
settings$: settingsSubject$.asObservable().pipe(operators.distinctUntilChanged(isShallowEqual))
|
|
3216
1141
|
}
|
|
3217
1142
|
};
|
|
3218
1143
|
};
|
|
@@ -3283,12 +1208,12 @@
|
|
|
3283
1208
|
};
|
|
3284
1209
|
const setHasVerticalWriting = () => hasVerticalWritingSubject$.next(true);
|
|
3285
1210
|
hasVerticalWritingSubject$.pipe(
|
|
3286
|
-
skip(1),
|
|
3287
|
-
distinctUntilChanged(),
|
|
3288
|
-
tap(() => {
|
|
1211
|
+
operators.skip(1),
|
|
1212
|
+
operators.distinctUntilChanged(),
|
|
1213
|
+
operators.tap(() => {
|
|
3289
1214
|
settings.recompute({ manifest, hasVerticalWritingSubject: hasVerticalWritingSubject$.value });
|
|
3290
1215
|
}),
|
|
3291
|
-
takeUntil(destroy$)
|
|
1216
|
+
operators.takeUntil(destroy$)
|
|
3292
1217
|
).subscribe();
|
|
3293
1218
|
const destroy = () => {
|
|
3294
1219
|
settings.destroy();
|
|
@@ -3327,7 +1252,7 @@
|
|
|
3327
1252
|
manifest
|
|
3328
1253
|
}),
|
|
3329
1254
|
$: {
|
|
3330
|
-
hasVerticalWriting$: hasVerticalWritingSubject$.asObservable().pipe(distinctUntilChanged()),
|
|
1255
|
+
hasVerticalWriting$: hasVerticalWritingSubject$.asObservable().pipe(operators.distinctUntilChanged()),
|
|
3331
1256
|
destroy$: destroy$.asObservable(),
|
|
3332
1257
|
settings$: settings.$.settings$,
|
|
3333
1258
|
load$: loadSubject$.asObservable()
|
|
@@ -3462,20 +1387,20 @@
|
|
|
3462
1387
|
let onLoadHookReturns = [];
|
|
3463
1388
|
let computedStyleAfterLoad;
|
|
3464
1389
|
const makeItHot = (source$) => {
|
|
3465
|
-
source$.pipe(takeUntil(context.$.destroy$)).subscribe();
|
|
1390
|
+
source$.pipe(operators.takeUntil(context.$.destroy$)).subscribe();
|
|
3466
1391
|
return source$;
|
|
3467
1392
|
};
|
|
3468
1393
|
const getHtmlFromResource = (response) => createHtmlPageFromResource(response, item);
|
|
3469
1394
|
const waitForViewportFree$ = viewportState$.pipe(
|
|
3470
|
-
filter((v) => v === `free`),
|
|
3471
|
-
take(1)
|
|
1395
|
+
operators.filter((v) => v === `free`),
|
|
1396
|
+
operators.take(1)
|
|
3472
1397
|
);
|
|
3473
1398
|
const unload$ = unloadSubject$.asObservable().pipe(
|
|
3474
1399
|
// @todo remove iframe when viewport is free
|
|
3475
1400
|
// @todo use takeUntil(load$) when it's the case to cancel
|
|
3476
|
-
withLatestFrom(frameElementSubject$),
|
|
3477
|
-
filter(([_, frame]) => !!frame),
|
|
3478
|
-
map(([, frame]) => {
|
|
1401
|
+
operators.withLatestFrom(frameElementSubject$),
|
|
1402
|
+
operators.filter(([_, frame]) => !!frame),
|
|
1403
|
+
operators.map(([, frame]) => {
|
|
3479
1404
|
onLoadHookReturns.forEach((fn) => {
|
|
3480
1405
|
if (fn && `unsubscribe` in fn) {
|
|
3481
1406
|
fn.unsubscribe();
|
|
@@ -3487,17 +1412,17 @@
|
|
|
3487
1412
|
frame == null ? void 0 : frame.remove();
|
|
3488
1413
|
frameElementSubject$.next(void 0);
|
|
3489
1414
|
}),
|
|
3490
|
-
share(),
|
|
3491
|
-
takeUntil(destroySubject$)
|
|
1415
|
+
operators.share(),
|
|
1416
|
+
operators.takeUntil(destroySubject$)
|
|
3492
1417
|
);
|
|
3493
1418
|
const load$ = loadSubject$.asObservable().pipe(
|
|
3494
|
-
withLatestFrom(isLoadedSubject$),
|
|
3495
|
-
filter(([_, isLoaded]) => !isLoaded),
|
|
1419
|
+
operators.withLatestFrom(isLoadedSubject$),
|
|
1420
|
+
operators.filter(([_, isLoaded]) => !isLoaded),
|
|
3496
1421
|
// let's ignore later load as long as the first one still runs
|
|
3497
|
-
exhaustMap(() => {
|
|
1422
|
+
operators.exhaustMap(() => {
|
|
3498
1423
|
return createFrame$().pipe(
|
|
3499
|
-
mergeMap((frame) => waitForViewportFree$.pipe(map(() => frame))),
|
|
3500
|
-
mergeMap((frame) => {
|
|
1424
|
+
operators.mergeMap((frame) => waitForViewportFree$.pipe(operators.map(() => frame))),
|
|
1425
|
+
operators.mergeMap((frame) => {
|
|
3501
1426
|
parent.appendChild(frame);
|
|
3502
1427
|
frameElementSubject$.next(frame);
|
|
3503
1428
|
if (!fetchResource && item.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
|
|
@@ -3508,14 +1433,14 @@
|
|
|
3508
1433
|
} else {
|
|
3509
1434
|
const fetchFn = fetchResource || (() => fetch(item.href));
|
|
3510
1435
|
return rxjs.from(fetchFn(item)).pipe(
|
|
3511
|
-
mergeMap((response) => getHtmlFromResource(response)),
|
|
3512
|
-
tap((htmlDoc) => {
|
|
1436
|
+
operators.mergeMap((response) => getHtmlFromResource(response)),
|
|
1437
|
+
operators.tap((htmlDoc) => {
|
|
3513
1438
|
if (htmlDoc) {
|
|
3514
1439
|
frame == null ? void 0 : frame.setAttribute(`srcdoc`, htmlDoc);
|
|
3515
1440
|
}
|
|
3516
1441
|
}),
|
|
3517
|
-
map(() => frame),
|
|
3518
|
-
catchError((e) => {
|
|
1442
|
+
operators.map(() => frame),
|
|
1443
|
+
operators.catchError((e) => {
|
|
3519
1444
|
Report.error(`Error while trying to fetch or load resource for item ${item.id}`);
|
|
3520
1445
|
console.error(e);
|
|
3521
1446
|
return rxjs.of(frame);
|
|
@@ -3523,13 +1448,13 @@
|
|
|
3523
1448
|
);
|
|
3524
1449
|
}
|
|
3525
1450
|
}),
|
|
3526
|
-
mergeMap((frame) => {
|
|
1451
|
+
operators.mergeMap((frame) => {
|
|
3527
1452
|
if (!frame)
|
|
3528
1453
|
return rxjs.EMPTY;
|
|
3529
1454
|
return rxjs.fromEvent(frame, `load`).pipe(
|
|
3530
|
-
take(1),
|
|
3531
|
-
withLatestFrom(hooks$),
|
|
3532
|
-
mergeMap(([_, hooks]) => {
|
|
1455
|
+
operators.take(1),
|
|
1456
|
+
operators.withLatestFrom(hooks$),
|
|
1457
|
+
operators.mergeMap(([_, hooks]) => {
|
|
3533
1458
|
var _a, _b;
|
|
3534
1459
|
const body = (_a = frame.contentDocument) == null ? void 0 : _a.body;
|
|
3535
1460
|
if (!body) {
|
|
@@ -3559,24 +1484,24 @@
|
|
|
3559
1484
|
);
|
|
3560
1485
|
}),
|
|
3561
1486
|
// we stop loading as soon as unload is requested
|
|
3562
|
-
takeUntil(unloadSubject$)
|
|
1487
|
+
operators.takeUntil(unloadSubject$)
|
|
3563
1488
|
);
|
|
3564
1489
|
}),
|
|
3565
|
-
share(),
|
|
1490
|
+
operators.share(),
|
|
3566
1491
|
makeItHot,
|
|
3567
|
-
takeUntil(destroySubject$)
|
|
1492
|
+
operators.takeUntil(destroySubject$)
|
|
3568
1493
|
);
|
|
3569
1494
|
const ready$ = load$.pipe(
|
|
3570
|
-
switchMap((frame) => {
|
|
1495
|
+
operators.switchMap((frame) => {
|
|
3571
1496
|
var _a;
|
|
3572
|
-
return rxjs.from(((_a = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _a.fonts.ready) || rxjs.of(void 0)).pipe(takeUntil(unloadSubject$));
|
|
1497
|
+
return rxjs.from(((_a = frame == null ? void 0 : frame.contentDocument) == null ? void 0 : _a.fonts.ready) || rxjs.of(void 0)).pipe(operators.takeUntil(unloadSubject$));
|
|
3573
1498
|
}),
|
|
3574
|
-
share(),
|
|
1499
|
+
operators.share(),
|
|
3575
1500
|
makeItHot,
|
|
3576
|
-
takeUntil(destroySubject$)
|
|
1501
|
+
operators.takeUntil(destroySubject$)
|
|
3577
1502
|
);
|
|
3578
|
-
rxjs.merge(load$.pipe(map(() => true)), unloadSubject$.pipe(map(() => false))).pipe(distinctUntilChanged(), takeUntil(destroySubject$)).subscribe(isLoadedSubject$);
|
|
3579
|
-
rxjs.merge(ready$.pipe(map(() => true)), unloadSubject$.pipe(map(() => false))).pipe(distinctUntilChanged(), takeUntil(destroySubject$)).subscribe(isReadySubject$);
|
|
1503
|
+
rxjs.merge(load$.pipe(operators.map(() => true)), unloadSubject$.pipe(operators.map(() => false))).pipe(operators.distinctUntilChanged(), operators.takeUntil(destroySubject$)).subscribe(isLoadedSubject$);
|
|
1504
|
+
rxjs.merge(ready$.pipe(operators.map(() => true)), unloadSubject$.pipe(operators.map(() => false))).pipe(operators.distinctUntilChanged(), operators.takeUntil(destroySubject$)).subscribe(isReadySubject$);
|
|
3580
1505
|
unload$.subscribe();
|
|
3581
1506
|
return {
|
|
3582
1507
|
load: () => loadSubject$.next(),
|
|
@@ -3596,7 +1521,7 @@
|
|
|
3596
1521
|
unload$: unloadSubject$.asObservable(),
|
|
3597
1522
|
loaded$: load$,
|
|
3598
1523
|
isLoaded$: isLoadedSubject$.asObservable(),
|
|
3599
|
-
isReady$: isReadySubject$.asObservable().pipe(distinctUntilChanged()),
|
|
1524
|
+
isReady$: isReadySubject$.asObservable().pipe(operators.distinctUntilChanged()),
|
|
3600
1525
|
ready$,
|
|
3601
1526
|
unloaded$: unload$,
|
|
3602
1527
|
frameElement$: frameElementSubject$
|
|
@@ -3672,8 +1597,8 @@
|
|
|
3672
1597
|
return createHtmlPageFromResource(response, item);
|
|
3673
1598
|
};
|
|
3674
1599
|
const contentLayoutChange$ = rxjs.merge(
|
|
3675
|
-
unloaded$.pipe(map(() => ({ isFirstLayout: false }))),
|
|
3676
|
-
ready$.pipe(map(() => ({ isFirstLayout: true })))
|
|
1600
|
+
unloaded$.pipe(operators.map(() => ({ isFirstLayout: false }))),
|
|
1601
|
+
ready$.pipe(operators.map(() => ({ isFirstLayout: true })))
|
|
3677
1602
|
);
|
|
3678
1603
|
const destroy = () => {
|
|
3679
1604
|
unload();
|
|
@@ -4003,7 +1928,7 @@
|
|
|
4003
1928
|
item,
|
|
4004
1929
|
context,
|
|
4005
1930
|
fetchResource: (_a = context.getLoadOptions()) == null ? void 0 : _a.fetchResource,
|
|
4006
|
-
hooks$: hooks$.asObservable().pipe(map((hooks) => [...hooks, ...frameHooks])),
|
|
1931
|
+
hooks$: hooks$.asObservable().pipe(operators.map((hooks) => [...hooks, ...frameHooks])),
|
|
4007
1932
|
viewportState$
|
|
4008
1933
|
});
|
|
4009
1934
|
containerElement.appendChild(overlayElement);
|
|
@@ -4177,8 +2102,8 @@
|
|
|
4177
2102
|
}
|
|
4178
2103
|
});
|
|
4179
2104
|
const contentLayout$ = spineItemFrame.$.contentLayoutChange$.pipe(
|
|
4180
|
-
withLatestFrom(spineItemFrame.$.isReady$),
|
|
4181
|
-
map(([data, isReady]) => ({
|
|
2105
|
+
operators.withLatestFrom(spineItemFrame.$.isReady$),
|
|
2106
|
+
operators.map(([data, isReady]) => ({
|
|
4182
2107
|
isFirstLayout: data.isFirstLayout,
|
|
4183
2108
|
isReady
|
|
4184
2109
|
}))
|
|
@@ -5681,13 +3606,13 @@
|
|
|
5681
3606
|
}
|
|
5682
3607
|
if (opts.range) {
|
|
5683
3608
|
const range = dom.createRange();
|
|
5684
|
-
const
|
|
5685
|
-
if (
|
|
5686
|
-
range.setStartBefore(
|
|
5687
|
-
} else if (
|
|
5688
|
-
range.setStartAfter(
|
|
3609
|
+
const from = this.getFrom();
|
|
3610
|
+
if (from.relativeToNode === `before`) {
|
|
3611
|
+
range.setStartBefore(from.node, from.offset);
|
|
3612
|
+
} else if (from.relativeToNode === `after`) {
|
|
3613
|
+
range.setStartAfter(from.node, from.offset);
|
|
5689
3614
|
} else {
|
|
5690
|
-
range.setStart(
|
|
3615
|
+
range.setStart(from.node, from.offset);
|
|
5691
3616
|
}
|
|
5692
3617
|
const to = this.getTo();
|
|
5693
3618
|
if (to.relativeToNode === `before`) {
|
|
@@ -5794,14 +3719,14 @@
|
|
|
5794
3719
|
var _a;
|
|
5795
3720
|
(_a = spineItemManager.get(id)) == null ? void 0 : _a.manipulateSpineItem(cb);
|
|
5796
3721
|
};
|
|
5797
|
-
context.$.load$.pipe(tap(reload), takeUntil(context.$.destroy$)).subscribe();
|
|
3722
|
+
context.$.load$.pipe(operators.tap(reload), operators.takeUntil(context.$.destroy$)).subscribe();
|
|
5798
3723
|
const waitForViewportFree$ = viewportState$.pipe(
|
|
5799
|
-
filter((v) => v === `free`),
|
|
5800
|
-
take(1)
|
|
3724
|
+
operators.filter((v) => v === `free`),
|
|
3725
|
+
operators.take(1)
|
|
5801
3726
|
);
|
|
5802
3727
|
const adjustPagination = (position) => {
|
|
5803
3728
|
return waitForViewportFree$.pipe(
|
|
5804
|
-
tap(
|
|
3729
|
+
operators.tap(
|
|
5805
3730
|
report.measurePerformance(
|
|
5806
3731
|
`adjustPagination`,
|
|
5807
3732
|
1,
|
|
@@ -5853,15 +3778,15 @@
|
|
|
5853
3778
|
};
|
|
5854
3779
|
rxjs.merge(
|
|
5855
3780
|
spineItemManager.$.focus$.pipe(
|
|
5856
|
-
tap((event) => {
|
|
3781
|
+
operators.tap((event) => {
|
|
5857
3782
|
const spineItem = event.data;
|
|
5858
3783
|
const fingerTracker$ = spineItem.fingerTracker.$;
|
|
5859
3784
|
const selectionTracker$ = spineItem.selectionTracker.$;
|
|
5860
3785
|
selectionSubscription == null ? void 0 : selectionSubscription.unsubscribe();
|
|
5861
3786
|
selectionSubscription = rxjs.merge(
|
|
5862
3787
|
selectionTracker$.pipe(
|
|
5863
|
-
filter((event2) => event2.event === `selectionchange`),
|
|
5864
|
-
tap((event2) => {
|
|
3788
|
+
operators.filter((event2) => event2.event === `selectionchange`),
|
|
3789
|
+
operators.tap((event2) => {
|
|
5865
3790
|
subject.next({
|
|
5866
3791
|
type: `onSelectionChange`,
|
|
5867
3792
|
data: event2.data ? createSelection(event2.data, spineItem.item) : null
|
|
@@ -5869,34 +3794,34 @@
|
|
|
5869
3794
|
})
|
|
5870
3795
|
),
|
|
5871
3796
|
selectionTracker$.pipe(
|
|
5872
|
-
filter(({ event: event2 }) => event2 === `selectstart`),
|
|
5873
|
-
switchMap(
|
|
3797
|
+
operators.filter(({ event: event2 }) => event2 === `selectstart`),
|
|
3798
|
+
operators.switchMap(
|
|
5874
3799
|
(_) => fingerTracker$.pipe(
|
|
5875
|
-
filter(({ event: event2 }) => event2 === `fingermove`),
|
|
5876
|
-
debounce(() => rxjs.interval(1e3)),
|
|
5877
|
-
takeUntil(
|
|
3800
|
+
operators.filter(({ event: event2 }) => event2 === `fingermove`),
|
|
3801
|
+
operators.debounce(() => rxjs.interval(1e3)),
|
|
3802
|
+
operators.takeUntil(
|
|
5878
3803
|
fingerTracker$.pipe(
|
|
5879
|
-
filter(({ event: event2 }) => event2 === `fingerout`),
|
|
5880
|
-
tap(() => {
|
|
3804
|
+
operators.filter(({ event: event2 }) => event2 === `fingerout`),
|
|
3805
|
+
operators.tap(() => {
|
|
5881
3806
|
})
|
|
5882
3807
|
)
|
|
5883
3808
|
),
|
|
5884
|
-
tap(({ data }) => {
|
|
3809
|
+
operators.tap(({ data }) => {
|
|
5885
3810
|
})
|
|
5886
3811
|
)
|
|
5887
3812
|
)
|
|
5888
3813
|
)
|
|
5889
3814
|
).subscribe();
|
|
5890
3815
|
}),
|
|
5891
|
-
catchError((e) => {
|
|
3816
|
+
operators.catchError((e) => {
|
|
5892
3817
|
Report.error(e);
|
|
5893
3818
|
return rxjs.EMPTY;
|
|
5894
3819
|
}),
|
|
5895
|
-
takeUntil(context.$.destroy$)
|
|
3820
|
+
operators.takeUntil(context.$.destroy$)
|
|
5896
3821
|
)
|
|
5897
3822
|
).subscribe();
|
|
5898
3823
|
const itemUpdateOnNavigation$ = navigation$.pipe(
|
|
5899
|
-
tap((data) => {
|
|
3824
|
+
operators.tap((data) => {
|
|
5900
3825
|
const time2 = report.time(`navigation`, 1);
|
|
5901
3826
|
const currentSpineItem = spineItemManager.getFocusedSpineItem();
|
|
5902
3827
|
const spineItemsFromPosition = spineLocator.getSpineItemsFromReadingOrderPosition(data.position);
|
|
@@ -5973,14 +3898,14 @@
|
|
|
5973
3898
|
}
|
|
5974
3899
|
time2();
|
|
5975
3900
|
}),
|
|
5976
|
-
share(),
|
|
5977
|
-
takeUntil(context.$.destroy$)
|
|
3901
|
+
operators.share(),
|
|
3902
|
+
operators.takeUntil(context.$.destroy$)
|
|
5978
3903
|
);
|
|
5979
3904
|
itemUpdateOnNavigation$.pipe(
|
|
5980
|
-
switchMap((data) => {
|
|
5981
|
-
return adjustPagination(data.position).pipe(takeUntil(spineItemManager.$.layout$));
|
|
3905
|
+
operators.switchMap((data) => {
|
|
3906
|
+
return adjustPagination(data.position).pipe(operators.takeUntil(spineItemManager.$.layout$));
|
|
5982
3907
|
}),
|
|
5983
|
-
takeUntil(context.$.destroy$)
|
|
3908
|
+
operators.takeUntil(context.$.destroy$)
|
|
5984
3909
|
).subscribe();
|
|
5985
3910
|
rxjs.merge(
|
|
5986
3911
|
/**
|
|
@@ -5995,10 +3920,10 @@
|
|
|
5995
3920
|
*/
|
|
5996
3921
|
navigationAdjusted$
|
|
5997
3922
|
).pipe(
|
|
5998
|
-
switchMap(() => {
|
|
3923
|
+
operators.switchMap(() => {
|
|
5999
3924
|
return waitForViewportFree$.pipe(
|
|
6000
|
-
withLatestFrom(currentNavigationPosition$),
|
|
6001
|
-
map(([, currentNavigationPosition]) => {
|
|
3925
|
+
operators.withLatestFrom(currentNavigationPosition$),
|
|
3926
|
+
operators.map(([, currentNavigationPosition]) => {
|
|
6002
3927
|
const focusedSpineItemIndex = spineItemManager.getFocusedSpineItemIndex();
|
|
6003
3928
|
report.log(`update contents`, { focusedSpineItemIndex });
|
|
6004
3929
|
if (focusedSpineItemIndex === void 0)
|
|
@@ -6011,10 +3936,10 @@
|
|
|
6011
3936
|
spineItemManager.loadContents([begin, end]);
|
|
6012
3937
|
}
|
|
6013
3938
|
}),
|
|
6014
|
-
take(1)
|
|
3939
|
+
operators.take(1)
|
|
6015
3940
|
);
|
|
6016
3941
|
}),
|
|
6017
|
-
takeUntil(context.$.destroy$)
|
|
3942
|
+
operators.takeUntil(context.$.destroy$)
|
|
6018
3943
|
).subscribe();
|
|
6019
3944
|
return {
|
|
6020
3945
|
element: containerElement,
|
|
@@ -6237,16 +4162,16 @@
|
|
|
6237
4162
|
};
|
|
6238
4163
|
const add = (spineItem) => {
|
|
6239
4164
|
orderedSpineItemsSubject$.value.push(spineItem);
|
|
6240
|
-
spineItem.$.contentLayout$.pipe(takeUntil(context.$.destroy$)).subscribe(() => {
|
|
4165
|
+
spineItem.$.contentLayout$.pipe(operators.takeUntil(context.$.destroy$)).subscribe(() => {
|
|
6241
4166
|
layout();
|
|
6242
4167
|
});
|
|
6243
4168
|
spineItem.$.loaded$.pipe(
|
|
6244
|
-
tap(() => {
|
|
4169
|
+
operators.tap(() => {
|
|
6245
4170
|
if (spineItem.isUsingVerticalWriting()) {
|
|
6246
4171
|
context.setHasVerticalWriting();
|
|
6247
4172
|
}
|
|
6248
4173
|
}),
|
|
6249
|
-
takeUntil(context.$.destroy$)
|
|
4174
|
+
operators.takeUntil(context.$.destroy$)
|
|
6250
4175
|
).subscribe();
|
|
6251
4176
|
spineItem.load();
|
|
6252
4177
|
};
|
|
@@ -6285,8 +4210,8 @@
|
|
|
6285
4210
|
focus$: focus$.asObservable(),
|
|
6286
4211
|
layout$: layout$.asObservable(),
|
|
6287
4212
|
itemIsReady$: orderedSpineItemsSubject$.asObservable().pipe(
|
|
6288
|
-
switchMap((items) => {
|
|
6289
|
-
const itemsIsReady$ = items.map((item) => item.$.isReady$.pipe(map((isReady) => ({ item: item.item, isReady }))));
|
|
4213
|
+
operators.switchMap((items) => {
|
|
4214
|
+
const itemsIsReady$ = items.map((item) => item.$.isReady$.pipe(operators.map((isReady) => ({ item: item.item, isReady }))));
|
|
6290
4215
|
return rxjs.merge(...itemsIsReady$);
|
|
6291
4216
|
})
|
|
6292
4217
|
)
|
|
@@ -6679,12 +4604,12 @@
|
|
|
6679
4604
|
const midScreenPositionSafePosition = wrapPositionWithSafeEdge({ x: triggerXPosition, y: triggerYPosition });
|
|
6680
4605
|
return getNavigationForPosition(midScreenPositionSafePosition);
|
|
6681
4606
|
};
|
|
6682
|
-
const isNavigationGoingForwardFrom = (to,
|
|
4607
|
+
const isNavigationGoingForwardFrom = (to, from) => {
|
|
6683
4608
|
const pageTurnDirection = context.getSettings().computedPageTurnDirection;
|
|
6684
4609
|
if (pageTurnDirection === `vertical`) {
|
|
6685
|
-
return to.y >
|
|
4610
|
+
return to.y > from.y;
|
|
6686
4611
|
}
|
|
6687
|
-
return to.x >
|
|
4612
|
+
return to.x > from.x;
|
|
6688
4613
|
};
|
|
6689
4614
|
return {
|
|
6690
4615
|
getNavigationForCfi,
|
|
@@ -6713,7 +4638,7 @@
|
|
|
6713
4638
|
}) => {
|
|
6714
4639
|
let lastScrollWasProgrammaticallyTriggered = false;
|
|
6715
4640
|
const onlyUserScrollFilter = (source) => source.pipe(
|
|
6716
|
-
filter(() => {
|
|
4641
|
+
operators.filter(() => {
|
|
6717
4642
|
if (lastScrollWasProgrammaticallyTriggered) {
|
|
6718
4643
|
lastScrollWasProgrammaticallyTriggered = false;
|
|
6719
4644
|
return false;
|
|
@@ -6730,14 +4655,14 @@
|
|
|
6730
4655
|
return false;
|
|
6731
4656
|
};
|
|
6732
4657
|
const runOnFreePageTurnModeOnly$ = (source) => context.$.settings$.pipe(
|
|
6733
|
-
map(() => context.getSettings().computedPageTurnMode),
|
|
6734
|
-
distinctUntilChanged(),
|
|
6735
|
-
switchMap((mode) => rxjs.iif(() => mode === `controlled`, rxjs.EMPTY, source))
|
|
4658
|
+
operators.map(() => context.getSettings().computedPageTurnMode),
|
|
4659
|
+
operators.distinctUntilChanged(),
|
|
4660
|
+
operators.switchMap((mode) => rxjs.iif(() => mode === `controlled`, rxjs.EMPTY, source))
|
|
6736
4661
|
);
|
|
6737
4662
|
const userScroll$ = runOnFreePageTurnModeOnly$(rxjs.fromEvent(element, `scroll`)).pipe(
|
|
6738
4663
|
onlyUserScrollFilter,
|
|
6739
|
-
share(),
|
|
6740
|
-
takeUntil(context.$.destroy$)
|
|
4664
|
+
operators.share(),
|
|
4665
|
+
operators.takeUntil(context.$.destroy$)
|
|
6741
4666
|
);
|
|
6742
4667
|
const getScaledDownPosition = ({ x, y }) => {
|
|
6743
4668
|
const spineScaleX = spine.element.getBoundingClientRect().width / spine.element.offsetWidth;
|
|
@@ -6767,26 +4692,26 @@
|
|
|
6767
4692
|
return getScaledDownPosition({ x: element.scrollLeft, y: element.scrollTop });
|
|
6768
4693
|
};
|
|
6769
4694
|
const navigationOnScroll$ = userScroll$.pipe(
|
|
6770
|
-
debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, rxjs.animationFrameScheduler),
|
|
6771
|
-
withLatestFrom(currentNavigationSubject$),
|
|
6772
|
-
switchMap(() => {
|
|
4695
|
+
operators.debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, rxjs.animationFrameScheduler),
|
|
4696
|
+
operators.withLatestFrom(currentNavigationSubject$),
|
|
4697
|
+
operators.switchMap(() => {
|
|
6773
4698
|
const navigation = getNavigationForPosition(getScaledDownPosition({ x: element.scrollLeft, y: element.scrollTop }));
|
|
6774
4699
|
return rxjs.of({ position: navigation, animate: false, lastUserExpectedNavigation: void 0 });
|
|
6775
4700
|
}),
|
|
6776
|
-
share()
|
|
4701
|
+
operators.share()
|
|
6777
4702
|
);
|
|
6778
4703
|
const userScrollEnd$ = userScroll$.pipe(
|
|
6779
|
-
debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, rxjs.animationFrameScheduler),
|
|
6780
|
-
share(),
|
|
6781
|
-
takeUntil(context.$.destroy$)
|
|
4704
|
+
operators.debounceTime(SCROLL_FINISHED_DEBOUNCE_TIMEOUT, rxjs.animationFrameScheduler),
|
|
4705
|
+
operators.share(),
|
|
4706
|
+
operators.takeUntil(context.$.destroy$)
|
|
6782
4707
|
);
|
|
6783
4708
|
const state$ = rxjs.merge(
|
|
6784
4709
|
userScroll$.pipe(
|
|
6785
|
-
map(() => `start`),
|
|
6786
|
-
distinctUntilChanged()
|
|
4710
|
+
operators.map(() => `start`),
|
|
4711
|
+
operators.distinctUntilChanged()
|
|
6787
4712
|
),
|
|
6788
|
-
userScrollEnd$.pipe(map(() => `end`))
|
|
6789
|
-
).pipe(startWith(`end`));
|
|
4713
|
+
userScrollEnd$.pipe(operators.map(() => `end`))
|
|
4714
|
+
).pipe(operators.startWith(`end`));
|
|
6790
4715
|
return {
|
|
6791
4716
|
destroy: () => {
|
|
6792
4717
|
},
|
|
@@ -6821,8 +4746,8 @@
|
|
|
6821
4746
|
navigationTriggerSubject$.next({ type: `spineItem`, data: { indexOrId, ...options } });
|
|
6822
4747
|
};
|
|
6823
4748
|
const urlNavigation$ = navigationTriggerSubject$.pipe(
|
|
6824
|
-
filter((e) => e.type === `url`),
|
|
6825
|
-
switchMap(({ data }) => {
|
|
4749
|
+
operators.filter((e) => e.type === `url`),
|
|
4750
|
+
operators.switchMap(({ data }) => {
|
|
6826
4751
|
const navigation = navigator2.getNavigationForUrl(data);
|
|
6827
4752
|
Report.log(NAMESPACE$2, `urlNavigation`, { data, navigation });
|
|
6828
4753
|
if (navigation) {
|
|
@@ -6836,8 +4761,8 @@
|
|
|
6836
4761
|
})
|
|
6837
4762
|
);
|
|
6838
4763
|
const spineItemNavigation$ = navigationTriggerSubject$.pipe(
|
|
6839
|
-
filter((e) => e.type === `spineItem`),
|
|
6840
|
-
switchMap(({ data: { animate, indexOrId } }) => {
|
|
4764
|
+
operators.filter((e) => e.type === `spineItem`),
|
|
4765
|
+
operators.switchMap(({ data: { animate, indexOrId } }) => {
|
|
6841
4766
|
const navigation = navigator2.getNavigationForSpineIndexOrId(indexOrId);
|
|
6842
4767
|
const lastUserExpectedNavigation = { type: `navigate-from-previous-item` };
|
|
6843
4768
|
Report.log(NAMESPACE$2, `goToSpineItem`, { indexOrId, animate, navigation });
|
|
@@ -6845,8 +4770,8 @@
|
|
|
6845
4770
|
})
|
|
6846
4771
|
);
|
|
6847
4772
|
const cfiNavigation$ = navigationTriggerSubject$.pipe(
|
|
6848
|
-
filter((e) => e.type === `cfi`),
|
|
6849
|
-
map(({ data: { animate, cfi } }) => {
|
|
4773
|
+
operators.filter((e) => e.type === `cfi`),
|
|
4774
|
+
operators.map(({ data: { animate, cfi } }) => {
|
|
6850
4775
|
const navigation = navigator2.getNavigationForCfi(cfi);
|
|
6851
4776
|
Report.log(NAMESPACE$2, `goToCfi`, { cfi, animate, navigation });
|
|
6852
4777
|
return {
|
|
@@ -6857,8 +4782,8 @@
|
|
|
6857
4782
|
})
|
|
6858
4783
|
);
|
|
6859
4784
|
const chapterPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6860
|
-
filter((e) => e.type === `chapterPage`),
|
|
6861
|
-
switchMap(({ data: { pageIndex } }) => {
|
|
4785
|
+
operators.filter((e) => e.type === `chapterPage`),
|
|
4786
|
+
operators.switchMap(({ data: { pageIndex } }) => {
|
|
6862
4787
|
const spineItem = spineItemManager.getFocusedSpineItem();
|
|
6863
4788
|
if (spineItem) {
|
|
6864
4789
|
const navigation = navigator2.getNavigationForPage(pageIndex, spineItem);
|
|
@@ -6868,8 +4793,8 @@
|
|
|
6868
4793
|
})
|
|
6869
4794
|
);
|
|
6870
4795
|
const pageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6871
|
-
filter((e) => e.type === `pageIndex`),
|
|
6872
|
-
filter(() => {
|
|
4796
|
+
operators.filter((e) => e.type === `pageIndex`),
|
|
4797
|
+
operators.filter(() => {
|
|
6873
4798
|
var _a;
|
|
6874
4799
|
if (((_a = context.getManifest()) == null ? void 0 : _a.renditionLayout) === `reflowable`) {
|
|
6875
4800
|
Report.warn(`This method only works for pre-paginated content`);
|
|
@@ -6877,7 +4802,7 @@
|
|
|
6877
4802
|
}
|
|
6878
4803
|
return true;
|
|
6879
4804
|
}),
|
|
6880
|
-
switchMap(({ data: { pageIndex } }) => {
|
|
4805
|
+
operators.switchMap(({ data: { pageIndex } }) => {
|
|
6881
4806
|
return rxjs.of({
|
|
6882
4807
|
...navigator2.getNavigationForPage(pageIndex),
|
|
6883
4808
|
lastUserExpectedNavigation: void 0,
|
|
@@ -6918,9 +4843,9 @@
|
|
|
6918
4843
|
}
|
|
6919
4844
|
);
|
|
6920
4845
|
const leftPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6921
|
-
filter((e) => e.type === `leftPage`),
|
|
6922
|
-
withLatestFrom(currentNavigationSubject$),
|
|
6923
|
-
switchMap(
|
|
4846
|
+
operators.filter((e) => e.type === `leftPage`),
|
|
4847
|
+
operators.withLatestFrom(currentNavigationSubject$),
|
|
4848
|
+
operators.switchMap(
|
|
6924
4849
|
([
|
|
6925
4850
|
{
|
|
6926
4851
|
data: { allowSpineItemChange }
|
|
@@ -6934,9 +4859,9 @@
|
|
|
6934
4859
|
)
|
|
6935
4860
|
);
|
|
6936
4861
|
const rightPageNavigation$ = navigationTriggerSubject$.pipe(
|
|
6937
|
-
filter((e) => e.type === `rightPage`),
|
|
6938
|
-
withLatestFrom(currentNavigationSubject$),
|
|
6939
|
-
switchMap(
|
|
4862
|
+
operators.filter((e) => e.type === `rightPage`),
|
|
4863
|
+
operators.withLatestFrom(currentNavigationSubject$),
|
|
4864
|
+
operators.switchMap(
|
|
6940
4865
|
([
|
|
6941
4866
|
{
|
|
6942
4867
|
data: { allowSpineItemChange }
|
|
@@ -6963,9 +4888,9 @@
|
|
|
6963
4888
|
* This is because manual navigation is not used with scroll where you can move within the same item. A manual
|
|
6964
4889
|
* navigation would theoretically always move to different items.
|
|
6965
4890
|
*/
|
|
6966
|
-
withLatestFrom(currentNavigationSubject$),
|
|
6967
|
-
filter(([navigation, currentNavigation]) => navigator2.areNavigationDifferent(navigation, currentNavigation)),
|
|
6968
|
-
map(([navigation]) => navigation)
|
|
4891
|
+
operators.withLatestFrom(currentNavigationSubject$),
|
|
4892
|
+
operators.filter(([navigation, currentNavigation]) => navigator2.areNavigationDifferent(navigation, currentNavigation)),
|
|
4893
|
+
operators.map(([navigation]) => navigation)
|
|
6969
4894
|
);
|
|
6970
4895
|
return {
|
|
6971
4896
|
destroy: () => {
|
|
@@ -7067,17 +4992,17 @@
|
|
|
7067
4992
|
}
|
|
7068
4993
|
);
|
|
7069
4994
|
const snapNavigation$ = navigationTriggerSubject$.pipe(
|
|
7070
|
-
filter((e) => e.type === `snap`),
|
|
4995
|
+
operators.filter((e) => e.type === `snap`),
|
|
7071
4996
|
rxjs.withLatestFrom(context.$.settings$),
|
|
7072
|
-
switchMap(
|
|
4997
|
+
operators.switchMap(
|
|
7073
4998
|
([
|
|
7074
4999
|
{
|
|
7075
|
-
data: { from
|
|
5000
|
+
data: { from, to }
|
|
7076
5001
|
},
|
|
7077
5002
|
{ navigationSnapThreshold }
|
|
7078
5003
|
]) => {
|
|
7079
5004
|
const pageTurnDirection = context.getSettings().computedPageTurnDirection;
|
|
7080
|
-
const movingForward = navigator2.isNavigationGoingForwardFrom(to,
|
|
5005
|
+
const movingForward = navigator2.isNavigationGoingForwardFrom(to, from);
|
|
7081
5006
|
const triggerPercentage = movingForward ? 1 - navigationSnapThreshold : navigationSnapThreshold;
|
|
7082
5007
|
const triggerXPosition = pageTurnDirection === `horizontal` ? to.x + context.getVisibleAreaRect().width * triggerPercentage : 0;
|
|
7083
5008
|
const triggerYPosition = pageTurnDirection === `horizontal` ? 0 : to.y + context.getVisibleAreaRect().height * triggerPercentage;
|
|
@@ -7181,7 +5106,7 @@
|
|
|
7181
5106
|
const viewportNavigatorsSharedState$ = rxjs.merge(...viewportNavigators.map(({ $: { state$: state$2 } }) => state$2));
|
|
7182
5107
|
let lastUserExpectedNavigation;
|
|
7183
5108
|
const makeItHot = (source$) => {
|
|
7184
|
-
source$.pipe(takeUntil(context.$.destroy$)).subscribe();
|
|
5109
|
+
source$.pipe(operators.takeUntil(context.$.destroy$)).subscribe();
|
|
7185
5110
|
return source$;
|
|
7186
5111
|
};
|
|
7187
5112
|
const adjustReadingOffset = Report.measurePerformance(
|
|
@@ -7254,11 +5179,11 @@
|
|
|
7254
5179
|
});
|
|
7255
5180
|
const layoutChangeSettings$ = context.$.settings$.pipe(
|
|
7256
5181
|
mapKeysTo([`computedPageTurnDirection`, `computedPageTurnMode`, `numberOfAdjacentSpineItemToPreLoad`]),
|
|
7257
|
-
distinctUntilChanged(isShallowEqual),
|
|
7258
|
-
skip(1)
|
|
5182
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
5183
|
+
operators.skip(1)
|
|
7259
5184
|
);
|
|
7260
5185
|
const layout$ = rxjs.merge(layoutSubject$, layoutChangeSettings$).pipe(
|
|
7261
|
-
tap(() => {
|
|
5186
|
+
operators.tap(() => {
|
|
7262
5187
|
if (context.getSettings().computedPageTurnMode === `scrollable`) {
|
|
7263
5188
|
element.style.removeProperty(`transform`);
|
|
7264
5189
|
element.style.removeProperty(`transition`);
|
|
@@ -7273,7 +5198,7 @@
|
|
|
7273
5198
|
layout$.subscribe();
|
|
7274
5199
|
const navigation$ = rxjs.merge(
|
|
7275
5200
|
panViewportNavigator.$.navigation$.pipe(
|
|
7276
|
-
map((event) => ({
|
|
5201
|
+
operators.map((event) => ({
|
|
7277
5202
|
...event,
|
|
7278
5203
|
position: { x: event.x, y: event.y, spineItem: event.spineItem },
|
|
7279
5204
|
animation: `snap`,
|
|
@@ -7281,7 +5206,7 @@
|
|
|
7281
5206
|
}))
|
|
7282
5207
|
),
|
|
7283
5208
|
manualViewportNavigator.$.navigation$.pipe(
|
|
7284
|
-
map((event) => ({
|
|
5209
|
+
operators.map((event) => ({
|
|
7285
5210
|
...event,
|
|
7286
5211
|
position: { x: event.x, y: event.y, spineItem: event.spineItem },
|
|
7287
5212
|
animation: event.animate ? `turn` : false,
|
|
@@ -7289,32 +5214,32 @@
|
|
|
7289
5214
|
}))
|
|
7290
5215
|
),
|
|
7291
5216
|
adjustNavigationSubject$.pipe(
|
|
7292
|
-
map((event) => ({
|
|
5217
|
+
operators.map((event) => ({
|
|
7293
5218
|
...event,
|
|
7294
5219
|
triggeredBy: `adjust`,
|
|
7295
5220
|
animation: event.animate ? `turn` : false
|
|
7296
5221
|
}))
|
|
7297
5222
|
),
|
|
7298
5223
|
scrollViewportNavigator.$.navigation$.pipe(
|
|
7299
|
-
map((event) => ({
|
|
5224
|
+
operators.map((event) => ({
|
|
7300
5225
|
...event,
|
|
7301
5226
|
triggeredBy: `scroll`,
|
|
7302
5227
|
animation: event.animate ? `turn` : false
|
|
7303
5228
|
}))
|
|
7304
5229
|
)
|
|
7305
5230
|
).pipe(
|
|
7306
|
-
map((event) => {
|
|
5231
|
+
operators.map((event) => {
|
|
7307
5232
|
if (`lastUserExpectedNavigation` in event) {
|
|
7308
5233
|
lastUserExpectedNavigation = event.lastUserExpectedNavigation;
|
|
7309
5234
|
}
|
|
7310
5235
|
currentNavigationPositionSubject$.next(event.position);
|
|
7311
5236
|
return { ...event, lastUserExpectedNavigation };
|
|
7312
5237
|
}),
|
|
7313
|
-
share(),
|
|
7314
|
-
takeUntil(context.$.destroy$)
|
|
5238
|
+
operators.share(),
|
|
5239
|
+
operators.takeUntil(context.$.destroy$)
|
|
7315
5240
|
);
|
|
7316
5241
|
const navigationWhichRequireManualAdjust$ = navigation$.pipe(
|
|
7317
|
-
filter(({ triggeredBy }) => {
|
|
5242
|
+
operators.filter(({ triggeredBy }) => {
|
|
7318
5243
|
if (triggeredBy === `scroll` || context.getSettings().computedPageTurnMode === `scrollable` && triggeredBy === `adjust`) {
|
|
7319
5244
|
return false;
|
|
7320
5245
|
} else {
|
|
@@ -7323,10 +5248,10 @@
|
|
|
7323
5248
|
})
|
|
7324
5249
|
);
|
|
7325
5250
|
const manualAdjust$ = rxjs.merge(
|
|
7326
|
-
panViewportNavigator.$.moveToSubject$.asObservable().pipe(map((event) => ({ ...event, animation: false }))),
|
|
5251
|
+
panViewportNavigator.$.moveToSubject$.asObservable().pipe(operators.map((event) => ({ ...event, animation: false }))),
|
|
7327
5252
|
navigationWhichRequireManualAdjust$
|
|
7328
5253
|
).pipe(
|
|
7329
|
-
map(({ animation, position }) => {
|
|
5254
|
+
operators.map(({ animation, position }) => {
|
|
7330
5255
|
const shouldAnimate = !(!animation || animation === `turn` && context.getSettings().computedPageTurnAnimation === `none`);
|
|
7331
5256
|
return {
|
|
7332
5257
|
type: `manualAdjust`,
|
|
@@ -7335,18 +5260,18 @@
|
|
|
7335
5260
|
position
|
|
7336
5261
|
};
|
|
7337
5262
|
}),
|
|
7338
|
-
share()
|
|
5263
|
+
operators.share()
|
|
7339
5264
|
);
|
|
7340
5265
|
const processManualAdjust$ = rxjs.merge(manualAdjust$).pipe(
|
|
7341
|
-
startWith(void 0),
|
|
7342
|
-
pairwise(),
|
|
7343
|
-
tap(([prevEvent, currentEvent]) => {
|
|
5266
|
+
operators.startWith(void 0),
|
|
5267
|
+
operators.pairwise(),
|
|
5268
|
+
operators.tap(([prevEvent, currentEvent]) => {
|
|
7344
5269
|
if ((prevEvent == null ? void 0 : prevEvent.type) === `manualAdjust` && (currentEvent == null ? void 0 : currentEvent.type) !== `manualAdjust`) {
|
|
7345
5270
|
element.style.setProperty(`transition`, `none`);
|
|
7346
5271
|
element.style.setProperty(`opacity`, `1`);
|
|
7347
5272
|
}
|
|
7348
5273
|
}),
|
|
7349
|
-
switchMap(([, currentEvent]) => {
|
|
5274
|
+
operators.switchMap(([, currentEvent]) => {
|
|
7350
5275
|
if ((currentEvent == null ? void 0 : currentEvent.type) !== `manualAdjust`)
|
|
7351
5276
|
return rxjs.EMPTY;
|
|
7352
5277
|
const animationDuration = currentEvent.animation === `snap` ? context.getSettings().computedSnapAnimationDuration : context.getSettings().computedPageTurnAnimationDuration;
|
|
@@ -7360,8 +5285,8 @@
|
|
|
7360
5285
|
* anything for x ms while we effectively adjust. We want it to be immediate.
|
|
7361
5286
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
7362
5287
|
*/
|
|
7363
|
-
currentEvent.shouldAnimate ? delay(1, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
7364
|
-
tap((data) => {
|
|
5288
|
+
currentEvent.shouldAnimate ? operators.delay(1, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
5289
|
+
operators.tap((data) => {
|
|
7365
5290
|
const noAdjustmentNeeded = false;
|
|
7366
5291
|
if (data.shouldAnimate && !noAdjustmentNeeded) {
|
|
7367
5292
|
if (pageTurnAnimation === `fade`) {
|
|
@@ -7384,44 +5309,44 @@
|
|
|
7384
5309
|
* need to adjust to anchor to the payload position. This is because we use viewport computed position,
|
|
7385
5310
|
* not the value set by `setProperty`
|
|
7386
5311
|
*/
|
|
7387
|
-
withLatestFrom(hooks$),
|
|
7388
|
-
tap(([data, hooks]) => {
|
|
5312
|
+
operators.withLatestFrom(hooks$),
|
|
5313
|
+
operators.tap(([data, hooks]) => {
|
|
7389
5314
|
if (pageTurnAnimation !== `fade`) {
|
|
7390
5315
|
adjustReadingOffset(data.position, hooks);
|
|
7391
5316
|
}
|
|
7392
5317
|
}),
|
|
7393
|
-
currentEvent.shouldAnimate ? delay(animationDuration / 2, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
7394
|
-
tap(([data, hooks]) => {
|
|
5318
|
+
currentEvent.shouldAnimate ? operators.delay(animationDuration / 2, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
5319
|
+
operators.tap(([data, hooks]) => {
|
|
7395
5320
|
if (pageTurnAnimation === `fade`) {
|
|
7396
5321
|
adjustReadingOffset(data.position, hooks);
|
|
7397
5322
|
element.style.setProperty(`opacity`, `1`);
|
|
7398
5323
|
}
|
|
7399
5324
|
}),
|
|
7400
|
-
currentEvent.shouldAnimate ? delay(animationDuration / 2, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
7401
|
-
tap(([data, hooks]) => {
|
|
5325
|
+
currentEvent.shouldAnimate ? operators.delay(animationDuration / 2, rxjs.animationFrameScheduler) : rxjs.identity,
|
|
5326
|
+
operators.tap(([data, hooks]) => {
|
|
7402
5327
|
if (pageTurnAnimation === `fade`) {
|
|
7403
5328
|
adjustReadingOffset(data.position, hooks);
|
|
7404
5329
|
}
|
|
7405
5330
|
}),
|
|
7406
|
-
takeUntil(
|
|
5331
|
+
operators.takeUntil(
|
|
7407
5332
|
viewportNavigatorsSharedState$.pipe(
|
|
7408
|
-
filter((state) => state === `start`),
|
|
7409
|
-
skip(1)
|
|
5333
|
+
operators.filter((state) => state === `start`),
|
|
5334
|
+
operators.skip(1)
|
|
7410
5335
|
)
|
|
7411
5336
|
)
|
|
7412
5337
|
);
|
|
7413
5338
|
}),
|
|
7414
|
-
share(),
|
|
7415
|
-
takeUntil(context.$.destroy$)
|
|
5339
|
+
operators.share(),
|
|
5340
|
+
operators.takeUntil(context.$.destroy$)
|
|
7416
5341
|
);
|
|
7417
5342
|
const adjustmentState$ = rxjs.merge(
|
|
7418
|
-
rxjs.merge(manualAdjust$).pipe(map(() => `start`)),
|
|
7419
|
-
rxjs.merge(processManualAdjust$).pipe(map(() => `end`))
|
|
5343
|
+
rxjs.merge(manualAdjust$).pipe(operators.map(() => `start`)),
|
|
5344
|
+
rxjs.merge(processManualAdjust$).pipe(operators.map(() => `end`))
|
|
7420
5345
|
);
|
|
7421
5346
|
const state$ = rxjs.combineLatest([...viewportNavigators.map(({ $: { state$: state$2 } }) => state$2), adjustmentState$]).pipe(
|
|
7422
|
-
map((states) => states.every((state) => state === `end`) ? `free` : `busy`),
|
|
7423
|
-
distinctUntilChanged(),
|
|
7424
|
-
shareReplay(1),
|
|
5347
|
+
operators.map((states) => states.every((state) => state === `end`) ? `free` : `busy`),
|
|
5348
|
+
operators.distinctUntilChanged(),
|
|
5349
|
+
operators.shareReplay(1),
|
|
7425
5350
|
/**
|
|
7426
5351
|
* @important
|
|
7427
5352
|
* Since state$ is being updated from navigation$ and other exported streams we need it to be
|
|
@@ -7431,7 +5356,7 @@
|
|
|
7431
5356
|
makeItHot
|
|
7432
5357
|
);
|
|
7433
5358
|
const waitForViewportFree$ = state$.pipe(
|
|
7434
|
-
filter((v) => v === `free`),
|
|
5359
|
+
operators.filter((v) => v === `free`),
|
|
7435
5360
|
rxjs.take(1)
|
|
7436
5361
|
);
|
|
7437
5362
|
const navigationAdjustedAfterLayout$ = spine.$.layout$.pipe(
|
|
@@ -7453,18 +5378,18 @@
|
|
|
7453
5378
|
* - do not use debounce / throttle and navigate back to the item right on the same tick
|
|
7454
5379
|
*/
|
|
7455
5380
|
// debounceTime(10, animationFrameScheduler),
|
|
7456
|
-
switchMap(
|
|
5381
|
+
operators.switchMap(
|
|
7457
5382
|
() => waitForViewportFree$.pipe(
|
|
7458
|
-
switchMap(() => {
|
|
5383
|
+
operators.switchMap(() => {
|
|
7459
5384
|
const focusedSpineItem = spineItemManager.getFocusedSpineItem();
|
|
7460
5385
|
if (!focusedSpineItem)
|
|
7461
5386
|
return rxjs.EMPTY;
|
|
7462
5387
|
return adjustNavigation(focusedSpineItem);
|
|
7463
5388
|
}),
|
|
7464
|
-
takeUntil(navigation$)
|
|
5389
|
+
operators.takeUntil(navigation$)
|
|
7465
5390
|
)
|
|
7466
5391
|
),
|
|
7467
|
-
share()
|
|
5392
|
+
operators.share()
|
|
7468
5393
|
);
|
|
7469
5394
|
const destroy = () => {
|
|
7470
5395
|
layoutSubject$.complete();
|
|
@@ -7804,23 +5729,23 @@
|
|
|
7804
5729
|
cb(element);
|
|
7805
5730
|
};
|
|
7806
5731
|
spine.$.$.pipe(
|
|
7807
|
-
tap((event) => {
|
|
5732
|
+
operators.tap((event) => {
|
|
7808
5733
|
if (event.type === `onSelectionChange`) {
|
|
7809
5734
|
selectionSubject$.next(event.data);
|
|
7810
5735
|
}
|
|
7811
5736
|
}),
|
|
7812
|
-
takeUntil(destroy$)
|
|
5737
|
+
operators.takeUntil(destroy$)
|
|
7813
5738
|
).subscribe();
|
|
7814
5739
|
viewportNavigator.$.navigationAdjustedAfterLayout$.pipe(
|
|
7815
5740
|
rxjs.switchMap(({ adjustedSpinePosition }) => {
|
|
7816
|
-
return spine.adjustPagination(adjustedSpinePosition).pipe(takeUntil(navigation$));
|
|
5741
|
+
return spine.adjustPagination(adjustedSpinePosition).pipe(operators.takeUntil(navigation$));
|
|
7817
5742
|
}),
|
|
7818
|
-
takeUntil(context.$.destroy$)
|
|
5743
|
+
operators.takeUntil(context.$.destroy$)
|
|
7819
5744
|
).subscribe();
|
|
7820
5745
|
rxjs.merge(context.$.load$, context.$.settings$, context.$.hasVerticalWriting$).pipe(
|
|
7821
|
-
mapTo(void 0),
|
|
7822
|
-
withLatestFrom(context.$.hasVerticalWriting$),
|
|
7823
|
-
map(([, hasVerticalWriting]) => {
|
|
5746
|
+
operators.mapTo(void 0),
|
|
5747
|
+
operators.withLatestFrom(context.$.hasVerticalWriting$),
|
|
5748
|
+
operators.map(([, hasVerticalWriting]) => {
|
|
7824
5749
|
const settings2 = context.getSettings();
|
|
7825
5750
|
const manifest = context.getManifest();
|
|
7826
5751
|
return {
|
|
@@ -7830,8 +5755,8 @@
|
|
|
7830
5755
|
computedPageTurnMode: settings2.computedPageTurnMode
|
|
7831
5756
|
};
|
|
7832
5757
|
}),
|
|
7833
|
-
distinctUntilChanged(isShallowEqual),
|
|
7834
|
-
map(
|
|
5758
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
5759
|
+
operators.map(
|
|
7835
5760
|
({
|
|
7836
5761
|
hasVerticalWriting,
|
|
7837
5762
|
renditionFlow,
|
|
@@ -7844,7 +5769,7 @@
|
|
|
7844
5769
|
supportedPageTurnDirection: computedPageTurnMode === `scrollable` ? [`vertical`] : renditionLayout === `reflowable` ? [`horizontal`] : [`horizontal`, `vertical`]
|
|
7845
5770
|
})
|
|
7846
5771
|
),
|
|
7847
|
-
takeUntil(destroy$)
|
|
5772
|
+
operators.takeUntil(destroy$)
|
|
7848
5773
|
).subscribe(stateSubject$);
|
|
7849
5774
|
const destroy = () => {
|
|
7850
5775
|
hooksSubject$.next([]);
|
|
@@ -8096,47 +6021,47 @@
|
|
|
8096
6021
|
cache$.next({ id: itemIndexOrId, data });
|
|
8097
6022
|
};
|
|
8098
6023
|
cache$.asObservable().pipe(
|
|
8099
|
-
mergeMap(({ id, data }) => {
|
|
6024
|
+
operators.mergeMap(({ id, data }) => {
|
|
8100
6025
|
const item = retrieveItem(id);
|
|
8101
6026
|
if (!item)
|
|
8102
6027
|
return rxjs.EMPTY;
|
|
8103
6028
|
return rxjs.from(rxjs.forkJoin([openDatabase(`prose-reader`), rxjs.from(data.blob())])).pipe(
|
|
8104
|
-
switchMap(([db, blob]) => {
|
|
6029
|
+
operators.switchMap(([db, blob]) => {
|
|
8105
6030
|
return rxjs.from(db.put(`${uniqueID}_${item.id}`, blob));
|
|
8106
6031
|
}),
|
|
8107
|
-
catchError((error) => {
|
|
6032
|
+
operators.catchError((error) => {
|
|
8108
6033
|
Report.error(error);
|
|
8109
6034
|
return rxjs.EMPTY;
|
|
8110
6035
|
})
|
|
8111
6036
|
);
|
|
8112
6037
|
}),
|
|
8113
|
-
takeUntil(context.$.destroy$)
|
|
6038
|
+
operators.takeUntil(context.$.destroy$)
|
|
8114
6039
|
).subscribe();
|
|
8115
6040
|
const onLoad$ = context.$.load$.pipe(
|
|
8116
|
-
tap(() => {
|
|
6041
|
+
operators.tap(() => {
|
|
8117
6042
|
uniqueID = Date.now().toString();
|
|
8118
6043
|
})
|
|
8119
6044
|
);
|
|
8120
6045
|
rxjs.merge(onLoad$).pipe(
|
|
8121
|
-
switchMap(() => {
|
|
6046
|
+
operators.switchMap(() => {
|
|
8122
6047
|
Report.log(`Cleanup up old cache...`);
|
|
8123
6048
|
return rxjs.from(openDatabase(`prose-reader`)).pipe(
|
|
8124
|
-
switchMap(
|
|
6049
|
+
operators.switchMap(
|
|
8125
6050
|
(db) => rxjs.from(db.keys()).pipe(
|
|
8126
|
-
map((keys) => keys.filter((key) => !key.toString().startsWith(uniqueID))),
|
|
8127
|
-
switchMap((keysToRemove) => {
|
|
6051
|
+
operators.map((keys) => keys.filter((key) => !key.toString().startsWith(uniqueID))),
|
|
6052
|
+
operators.switchMap((keysToRemove) => {
|
|
8128
6053
|
const promises = keysToRemove.map((key) => db.remove(key));
|
|
8129
6054
|
return rxjs.from(Promise.all(promises));
|
|
8130
6055
|
})
|
|
8131
6056
|
)
|
|
8132
6057
|
),
|
|
8133
|
-
catchError((error) => {
|
|
6058
|
+
operators.catchError((error) => {
|
|
8134
6059
|
Report.error(error);
|
|
8135
6060
|
return rxjs.EMPTY;
|
|
8136
6061
|
})
|
|
8137
6062
|
);
|
|
8138
6063
|
}),
|
|
8139
|
-
takeUntil(context.$.destroy$)
|
|
6064
|
+
operators.takeUntil(context.$.destroy$)
|
|
8140
6065
|
).subscribe();
|
|
8141
6066
|
const destroy = () => {
|
|
8142
6067
|
cache$.complete();
|
|
@@ -8381,12 +6306,12 @@
|
|
|
8381
6306
|
}, {})
|
|
8382
6307
|
);
|
|
8383
6308
|
const updateEntriesLayout$ = (entries) => rxjs.combineLatest([reader.$.layout$, reader.theme.$.theme$]).pipe(
|
|
8384
|
-
map(([, theme]) => ({
|
|
6309
|
+
operators.map(([, theme]) => ({
|
|
8385
6310
|
width: reader.context.getVisibleAreaRect().width,
|
|
8386
6311
|
theme
|
|
8387
6312
|
})),
|
|
8388
|
-
distinctUntilChanged(isShallowEqual),
|
|
8389
|
-
tap(({ width, theme }) => {
|
|
6313
|
+
operators.distinctUntilChanged(isShallowEqual),
|
|
6314
|
+
operators.tap(({ width, theme }) => {
|
|
8390
6315
|
Object.values(entries).forEach((element) => {
|
|
8391
6316
|
element.style.setProperty(`max-width`, `${width}px`);
|
|
8392
6317
|
element.style.setProperty(`color`, theme === `sepia` ? `#939393` : `rgb(202, 202, 202)`);
|
|
@@ -8394,26 +6319,26 @@
|
|
|
8394
6319
|
})
|
|
8395
6320
|
);
|
|
8396
6321
|
const updateEntriesVisibility$ = (entries) => reader.$.itemIsReady$.pipe(
|
|
8397
|
-
tap(({ item, isReady }) => {
|
|
6322
|
+
operators.tap(({ item, isReady }) => {
|
|
8398
6323
|
var _a;
|
|
8399
6324
|
(_a = entries[item.id]) == null ? void 0 : _a.style.setProperty(`visibility`, isReady ? `hidden` : `visible`);
|
|
8400
6325
|
})
|
|
8401
6326
|
);
|
|
8402
6327
|
const destroyEntries$ = (entries) => reader.$.itemsBeforeDestroy$.pipe(
|
|
8403
|
-
map(() => {
|
|
6328
|
+
operators.map(() => {
|
|
8404
6329
|
Object.values(entries).forEach((element) => element.remove());
|
|
8405
6330
|
return {};
|
|
8406
6331
|
})
|
|
8407
6332
|
);
|
|
8408
6333
|
const items$ = reader.spineItems$.pipe(
|
|
8409
|
-
switchMap((items) => createEntries$(items)),
|
|
8410
|
-
shareReplay(1),
|
|
8411
|
-
takeUntil(reader.context.$.destroy$)
|
|
6334
|
+
operators.switchMap((items) => createEntries$(items)),
|
|
6335
|
+
operators.shareReplay(1),
|
|
6336
|
+
operators.takeUntil(reader.context.$.destroy$)
|
|
8412
6337
|
);
|
|
8413
6338
|
items$.pipe(
|
|
8414
|
-
switchMap((entries) => rxjs.merge(rxjs.of(entries), destroyEntries$(entries))),
|
|
8415
|
-
switchMap((entries) => rxjs.merge(updateEntriesLayout$(entries), updateEntriesVisibility$(entries))),
|
|
8416
|
-
takeUntil(reader.$.destroy$)
|
|
6339
|
+
operators.switchMap((entries) => rxjs.merge(rxjs.of(entries), destroyEntries$(entries))),
|
|
6340
|
+
operators.switchMap((entries) => rxjs.merge(updateEntriesLayout$(entries), updateEntriesVisibility$(entries))),
|
|
6341
|
+
operators.takeUntil(reader.$.destroy$)
|
|
8417
6342
|
).subscribe();
|
|
8418
6343
|
return {
|
|
8419
6344
|
...reader,
|