cypress 13.11.0 → 13.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/angular/angular/dist/index.d.ts +1 -2
  2. package/angular/angular/dist/index.js +239 -239
  3. package/angular/angular/package.json +1 -1
  4. package/angular/dist/index.d.ts +1 -2
  5. package/angular/dist/index.js +239 -239
  6. package/angular/package.json +1 -1
  7. package/angular-signals/README.md +11 -0
  8. package/angular-signals/angular-signals/README.md +11 -0
  9. package/angular-signals/angular-signals/dist/index.d.ts +136 -0
  10. package/angular-signals/angular-signals/dist/index.js +1861 -0
  11. package/angular-signals/angular-signals/package.json +74 -0
  12. package/angular-signals/dist/index.d.ts +136 -0
  13. package/angular-signals/dist/index.js +1861 -0
  14. package/angular-signals/package.json +74 -0
  15. package/lib/cli.js +0 -1
  16. package/lib/exec/xvfb.js +0 -1
  17. package/lib/logger.js +0 -3
  18. package/mount-utils/dist/index.d.ts +1 -1
  19. package/mount-utils/mount-utils/dist/index.d.ts +1 -1
  20. package/mount-utils/mount-utils/package.json +1 -1
  21. package/mount-utils/package.json +1 -1
  22. package/package.json +11 -5
  23. package/react/dist/cypress-react.cjs.js +237 -237
  24. package/react/dist/cypress-react.esm-bundler.js +237 -237
  25. package/react/dist/index.d.ts +1 -1
  26. package/react/package.json +3 -3
  27. package/react/react/dist/cypress-react.cjs.js +237 -237
  28. package/react/react/dist/cypress-react.esm-bundler.js +237 -237
  29. package/react/react/dist/index.d.ts +1 -1
  30. package/react/react/package.json +3 -3
  31. package/react18/dist/cypress-react.cjs.js +222 -222
  32. package/react18/dist/cypress-react.esm-bundler.js +222 -222
  33. package/react18/dist/index.d.ts +1 -1
  34. package/react18/package.json +1 -1
  35. package/react18/react18/dist/cypress-react.cjs.js +222 -222
  36. package/react18/react18/dist/cypress-react.esm-bundler.js +222 -222
  37. package/react18/react18/dist/index.d.ts +1 -1
  38. package/react18/react18/package.json +1 -1
  39. package/svelte/dist/cypress-svelte.cjs.js +61 -61
  40. package/svelte/dist/cypress-svelte.esm-bundler.js +61 -61
  41. package/svelte/dist/index.d.ts +2 -2
  42. package/svelte/package.json +1 -1
  43. package/svelte/svelte/dist/cypress-svelte.cjs.js +61 -61
  44. package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +61 -61
  45. package/svelte/svelte/dist/index.d.ts +2 -2
  46. package/svelte/svelte/package.json +1 -1
  47. package/vue/dist/cypress-vue.cjs.js +128 -128
  48. package/vue/dist/cypress-vue.esm-bundler.js +128 -128
  49. package/vue/dist/index.d.ts +5 -5
  50. package/vue/package.json +5 -5
  51. package/vue/vue/dist/cypress-vue.cjs.js +128 -128
  52. package/vue/vue/dist/cypress-vue.esm-bundler.js +128 -128
  53. package/vue/vue/dist/index.d.ts +5 -5
  54. package/vue/vue/package.json +5 -5
  55. package/vue2/dist/cypress-vue2.cjs.js +211 -211
  56. package/vue2/dist/cypress-vue2.esm-bundler.js +211 -211
  57. package/vue2/dist/index.d.ts +11 -11
  58. package/vue2/package.json +1 -1
  59. package/vue2/vue2/dist/cypress-vue2.cjs.js +211 -211
  60. package/vue2/vue2/dist/cypress-vue2.esm-bundler.js +211 -211
  61. package/vue2/vue2/dist/index.d.ts +11 -11
  62. package/vue2/vue2/package.json +1 -1
@@ -0,0 +1,1861 @@
1
+
2
+ /**
3
+ * @cypress/angular-signals v0.0.0-development
4
+ * (c) 2024 Cypress.io
5
+ * Released under the MIT License
6
+ */
7
+
8
+ import 'zone.js';
9
+ import 'zone.js/testing';
10
+ import { CommonModule } from '@angular/common';
11
+ import { assertInInjectionContext, inject, Injector, effect, untracked, DestroyRef, Injectable, Component, EventEmitter, SimpleChange, ErrorHandler, signal } from '@angular/core';
12
+ import { getTestBed, TestComponentRenderer, TestBed } from '@angular/core/testing';
13
+ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
14
+
15
+ /******************************************************************************
16
+ Copyright (c) Microsoft Corporation.
17
+
18
+ Permission to use, copy, modify, and/or distribute this software for any
19
+ purpose with or without fee is hereby granted.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
+ PERFORMANCE OF THIS SOFTWARE.
28
+ ***************************************************************************** */
29
+ /* global Reflect, Promise, SuppressedError, Symbol */
30
+
31
+
32
+ function __rest(s, e) {
33
+ var t = {};
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
35
+ t[p] = s[p];
36
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
37
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
38
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
39
+ t[p[i]] = s[p[i]];
40
+ }
41
+ return t;
42
+ }
43
+
44
+ function __decorate(decorators, target, key, desc) {
45
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
46
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
47
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
48
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
49
+ }
50
+
51
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
52
+ var e = new Error(message);
53
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
54
+ };
55
+
56
+ /*! *****************************************************************************
57
+ Copyright (c) Microsoft Corporation.
58
+
59
+ Permission to use, copy, modify, and/or distribute this software for any
60
+ purpose with or without fee is hereby granted.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
63
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
64
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
65
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
66
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
67
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
68
+ PERFORMANCE OF THIS SOFTWARE.
69
+ ***************************************************************************** */
70
+ /* global Reflect, Promise */
71
+
72
+ var extendStatics = function(d, b) {
73
+ extendStatics = Object.setPrototypeOf ||
74
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
75
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
76
+ return extendStatics(d, b);
77
+ };
78
+
79
+ function __extends(d, b) {
80
+ extendStatics(d, b);
81
+ function __() { this.constructor = d; }
82
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
83
+ }
84
+
85
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
86
+ function isFunction(x) {
87
+ return typeof x === 'function';
88
+ }
89
+
90
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
91
+ var _enable_super_gross_mode_that_will_cause_bad_things = false;
92
+ var config = {
93
+ Promise: undefined,
94
+ set useDeprecatedSynchronousErrorHandling(value) {
95
+ if (value) {
96
+ var error = /*@__PURE__*/ new Error();
97
+ /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
98
+ }
99
+ _enable_super_gross_mode_that_will_cause_bad_things = value;
100
+ },
101
+ get useDeprecatedSynchronousErrorHandling() {
102
+ return _enable_super_gross_mode_that_will_cause_bad_things;
103
+ },
104
+ };
105
+
106
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
107
+ function hostReportError(err) {
108
+ setTimeout(function () { throw err; }, 0);
109
+ }
110
+
111
+ /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
112
+ var empty$1 = {
113
+ closed: true,
114
+ next: function (value) { },
115
+ error: function (err) {
116
+ if (config.useDeprecatedSynchronousErrorHandling) {
117
+ throw err;
118
+ }
119
+ else {
120
+ hostReportError(err);
121
+ }
122
+ },
123
+ complete: function () { }
124
+ };
125
+
126
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
127
+ var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
128
+
129
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
130
+ function isObject(x) {
131
+ return x !== null && typeof x === 'object';
132
+ }
133
+
134
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
135
+ var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {
136
+ function UnsubscriptionErrorImpl(errors) {
137
+ Error.call(this);
138
+ this.message = errors ?
139
+ errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
140
+ this.name = 'UnsubscriptionError';
141
+ this.errors = errors;
142
+ return this;
143
+ }
144
+ UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
145
+ return UnsubscriptionErrorImpl;
146
+ })();
147
+ var UnsubscriptionError = UnsubscriptionErrorImpl;
148
+
149
+ /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
150
+ var Subscription = /*@__PURE__*/ (function () {
151
+ function Subscription(unsubscribe) {
152
+ this.closed = false;
153
+ this._parentOrParents = null;
154
+ this._subscriptions = null;
155
+ if (unsubscribe) {
156
+ this._ctorUnsubscribe = true;
157
+ this._unsubscribe = unsubscribe;
158
+ }
159
+ }
160
+ Subscription.prototype.unsubscribe = function () {
161
+ var errors;
162
+ if (this.closed) {
163
+ return;
164
+ }
165
+ var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
166
+ this.closed = true;
167
+ this._parentOrParents = null;
168
+ this._subscriptions = null;
169
+ if (_parentOrParents instanceof Subscription) {
170
+ _parentOrParents.remove(this);
171
+ }
172
+ else if (_parentOrParents !== null) {
173
+ for (var index = 0; index < _parentOrParents.length; ++index) {
174
+ var parent_1 = _parentOrParents[index];
175
+ parent_1.remove(this);
176
+ }
177
+ }
178
+ if (isFunction(_unsubscribe)) {
179
+ if (_ctorUnsubscribe) {
180
+ this._unsubscribe = undefined;
181
+ }
182
+ try {
183
+ _unsubscribe.call(this);
184
+ }
185
+ catch (e) {
186
+ errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
187
+ }
188
+ }
189
+ if (isArray(_subscriptions)) {
190
+ var index = -1;
191
+ var len = _subscriptions.length;
192
+ while (++index < len) {
193
+ var sub = _subscriptions[index];
194
+ if (isObject(sub)) {
195
+ try {
196
+ sub.unsubscribe();
197
+ }
198
+ catch (e) {
199
+ errors = errors || [];
200
+ if (e instanceof UnsubscriptionError) {
201
+ errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
202
+ }
203
+ else {
204
+ errors.push(e);
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ if (errors) {
211
+ throw new UnsubscriptionError(errors);
212
+ }
213
+ };
214
+ Subscription.prototype.add = function (teardown) {
215
+ var subscription = teardown;
216
+ if (!teardown) {
217
+ return Subscription.EMPTY;
218
+ }
219
+ switch (typeof teardown) {
220
+ case 'function':
221
+ subscription = new Subscription(teardown);
222
+ case 'object':
223
+ if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
224
+ return subscription;
225
+ }
226
+ else if (this.closed) {
227
+ subscription.unsubscribe();
228
+ return subscription;
229
+ }
230
+ else if (!(subscription instanceof Subscription)) {
231
+ var tmp = subscription;
232
+ subscription = new Subscription();
233
+ subscription._subscriptions = [tmp];
234
+ }
235
+ break;
236
+ default: {
237
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
238
+ }
239
+ }
240
+ var _parentOrParents = subscription._parentOrParents;
241
+ if (_parentOrParents === null) {
242
+ subscription._parentOrParents = this;
243
+ }
244
+ else if (_parentOrParents instanceof Subscription) {
245
+ if (_parentOrParents === this) {
246
+ return subscription;
247
+ }
248
+ subscription._parentOrParents = [_parentOrParents, this];
249
+ }
250
+ else if (_parentOrParents.indexOf(this) === -1) {
251
+ _parentOrParents.push(this);
252
+ }
253
+ else {
254
+ return subscription;
255
+ }
256
+ var subscriptions = this._subscriptions;
257
+ if (subscriptions === null) {
258
+ this._subscriptions = [subscription];
259
+ }
260
+ else {
261
+ subscriptions.push(subscription);
262
+ }
263
+ return subscription;
264
+ };
265
+ Subscription.prototype.remove = function (subscription) {
266
+ var subscriptions = this._subscriptions;
267
+ if (subscriptions) {
268
+ var subscriptionIndex = subscriptions.indexOf(subscription);
269
+ if (subscriptionIndex !== -1) {
270
+ subscriptions.splice(subscriptionIndex, 1);
271
+ }
272
+ }
273
+ };
274
+ Subscription.EMPTY = (function (empty) {
275
+ empty.closed = true;
276
+ return empty;
277
+ }(new Subscription()));
278
+ return Subscription;
279
+ }());
280
+ function flattenUnsubscriptionErrors(errors) {
281
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
282
+ }
283
+
284
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
285
+ var rxSubscriber = /*@__PURE__*/ (function () {
286
+ return typeof Symbol === 'function'
287
+ ? /*@__PURE__*/ Symbol('rxSubscriber')
288
+ : '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
289
+ })();
290
+
291
+ /** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
292
+ var Subscriber = /*@__PURE__*/ (function (_super) {
293
+ __extends(Subscriber, _super);
294
+ function Subscriber(destinationOrNext, error, complete) {
295
+ var _this = _super.call(this) || this;
296
+ _this.syncErrorValue = null;
297
+ _this.syncErrorThrown = false;
298
+ _this.syncErrorThrowable = false;
299
+ _this.isStopped = false;
300
+ switch (arguments.length) {
301
+ case 0:
302
+ _this.destination = empty$1;
303
+ break;
304
+ case 1:
305
+ if (!destinationOrNext) {
306
+ _this.destination = empty$1;
307
+ break;
308
+ }
309
+ if (typeof destinationOrNext === 'object') {
310
+ if (destinationOrNext instanceof Subscriber) {
311
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
312
+ _this.destination = destinationOrNext;
313
+ destinationOrNext.add(_this);
314
+ }
315
+ else {
316
+ _this.syncErrorThrowable = true;
317
+ _this.destination = new SafeSubscriber(_this, destinationOrNext);
318
+ }
319
+ break;
320
+ }
321
+ default:
322
+ _this.syncErrorThrowable = true;
323
+ _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
324
+ break;
325
+ }
326
+ return _this;
327
+ }
328
+ Subscriber.prototype[rxSubscriber] = function () { return this; };
329
+ Subscriber.create = function (next, error, complete) {
330
+ var subscriber = new Subscriber(next, error, complete);
331
+ subscriber.syncErrorThrowable = false;
332
+ return subscriber;
333
+ };
334
+ Subscriber.prototype.next = function (value) {
335
+ if (!this.isStopped) {
336
+ this._next(value);
337
+ }
338
+ };
339
+ Subscriber.prototype.error = function (err) {
340
+ if (!this.isStopped) {
341
+ this.isStopped = true;
342
+ this._error(err);
343
+ }
344
+ };
345
+ Subscriber.prototype.complete = function () {
346
+ if (!this.isStopped) {
347
+ this.isStopped = true;
348
+ this._complete();
349
+ }
350
+ };
351
+ Subscriber.prototype.unsubscribe = function () {
352
+ if (this.closed) {
353
+ return;
354
+ }
355
+ this.isStopped = true;
356
+ _super.prototype.unsubscribe.call(this);
357
+ };
358
+ Subscriber.prototype._next = function (value) {
359
+ this.destination.next(value);
360
+ };
361
+ Subscriber.prototype._error = function (err) {
362
+ this.destination.error(err);
363
+ this.unsubscribe();
364
+ };
365
+ Subscriber.prototype._complete = function () {
366
+ this.destination.complete();
367
+ this.unsubscribe();
368
+ };
369
+ Subscriber.prototype._unsubscribeAndRecycle = function () {
370
+ var _parentOrParents = this._parentOrParents;
371
+ this._parentOrParents = null;
372
+ this.unsubscribe();
373
+ this.closed = false;
374
+ this.isStopped = false;
375
+ this._parentOrParents = _parentOrParents;
376
+ return this;
377
+ };
378
+ return Subscriber;
379
+ }(Subscription));
380
+ var SafeSubscriber = /*@__PURE__*/ (function (_super) {
381
+ __extends(SafeSubscriber, _super);
382
+ function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
383
+ var _this = _super.call(this) || this;
384
+ _this._parentSubscriber = _parentSubscriber;
385
+ var next;
386
+ var context = _this;
387
+ if (isFunction(observerOrNext)) {
388
+ next = observerOrNext;
389
+ }
390
+ else if (observerOrNext) {
391
+ next = observerOrNext.next;
392
+ error = observerOrNext.error;
393
+ complete = observerOrNext.complete;
394
+ if (observerOrNext !== empty$1) {
395
+ context = Object.create(observerOrNext);
396
+ if (isFunction(context.unsubscribe)) {
397
+ _this.add(context.unsubscribe.bind(context));
398
+ }
399
+ context.unsubscribe = _this.unsubscribe.bind(_this);
400
+ }
401
+ }
402
+ _this._context = context;
403
+ _this._next = next;
404
+ _this._error = error;
405
+ _this._complete = complete;
406
+ return _this;
407
+ }
408
+ SafeSubscriber.prototype.next = function (value) {
409
+ if (!this.isStopped && this._next) {
410
+ var _parentSubscriber = this._parentSubscriber;
411
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
412
+ this.__tryOrUnsub(this._next, value);
413
+ }
414
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
415
+ this.unsubscribe();
416
+ }
417
+ }
418
+ };
419
+ SafeSubscriber.prototype.error = function (err) {
420
+ if (!this.isStopped) {
421
+ var _parentSubscriber = this._parentSubscriber;
422
+ var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
423
+ if (this._error) {
424
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
425
+ this.__tryOrUnsub(this._error, err);
426
+ this.unsubscribe();
427
+ }
428
+ else {
429
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
430
+ this.unsubscribe();
431
+ }
432
+ }
433
+ else if (!_parentSubscriber.syncErrorThrowable) {
434
+ this.unsubscribe();
435
+ if (useDeprecatedSynchronousErrorHandling) {
436
+ throw err;
437
+ }
438
+ hostReportError(err);
439
+ }
440
+ else {
441
+ if (useDeprecatedSynchronousErrorHandling) {
442
+ _parentSubscriber.syncErrorValue = err;
443
+ _parentSubscriber.syncErrorThrown = true;
444
+ }
445
+ else {
446
+ hostReportError(err);
447
+ }
448
+ this.unsubscribe();
449
+ }
450
+ }
451
+ };
452
+ SafeSubscriber.prototype.complete = function () {
453
+ var _this = this;
454
+ if (!this.isStopped) {
455
+ var _parentSubscriber = this._parentSubscriber;
456
+ if (this._complete) {
457
+ var wrappedComplete = function () { return _this._complete.call(_this._context); };
458
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
459
+ this.__tryOrUnsub(wrappedComplete);
460
+ this.unsubscribe();
461
+ }
462
+ else {
463
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
464
+ this.unsubscribe();
465
+ }
466
+ }
467
+ else {
468
+ this.unsubscribe();
469
+ }
470
+ }
471
+ };
472
+ SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
473
+ try {
474
+ fn.call(this._context, value);
475
+ }
476
+ catch (err) {
477
+ this.unsubscribe();
478
+ if (config.useDeprecatedSynchronousErrorHandling) {
479
+ throw err;
480
+ }
481
+ else {
482
+ hostReportError(err);
483
+ }
484
+ }
485
+ };
486
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
487
+ if (!config.useDeprecatedSynchronousErrorHandling) {
488
+ throw new Error('bad call');
489
+ }
490
+ try {
491
+ fn.call(this._context, value);
492
+ }
493
+ catch (err) {
494
+ if (config.useDeprecatedSynchronousErrorHandling) {
495
+ parent.syncErrorValue = err;
496
+ parent.syncErrorThrown = true;
497
+ return true;
498
+ }
499
+ else {
500
+ hostReportError(err);
501
+ return true;
502
+ }
503
+ }
504
+ return false;
505
+ };
506
+ SafeSubscriber.prototype._unsubscribe = function () {
507
+ var _parentSubscriber = this._parentSubscriber;
508
+ this._context = null;
509
+ this._parentSubscriber = null;
510
+ _parentSubscriber.unsubscribe();
511
+ };
512
+ return SafeSubscriber;
513
+ }(Subscriber));
514
+
515
+ /** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */
516
+ function canReportError(observer) {
517
+ while (observer) {
518
+ var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
519
+ if (closed_1 || isStopped) {
520
+ return false;
521
+ }
522
+ else if (destination && destination instanceof Subscriber) {
523
+ observer = destination;
524
+ }
525
+ else {
526
+ observer = null;
527
+ }
528
+ }
529
+ return true;
530
+ }
531
+
532
+ /** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
533
+ function toSubscriber(nextOrObserver, error, complete) {
534
+ if (nextOrObserver) {
535
+ if (nextOrObserver instanceof Subscriber) {
536
+ return nextOrObserver;
537
+ }
538
+ if (nextOrObserver[rxSubscriber]) {
539
+ return nextOrObserver[rxSubscriber]();
540
+ }
541
+ }
542
+ if (!nextOrObserver && !error && !complete) {
543
+ return new Subscriber(empty$1);
544
+ }
545
+ return new Subscriber(nextOrObserver, error, complete);
546
+ }
547
+
548
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
549
+ var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
550
+
551
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
552
+ function identity(x) {
553
+ return x;
554
+ }
555
+
556
+ /** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
557
+ function pipeFromArray(fns) {
558
+ if (fns.length === 0) {
559
+ return identity;
560
+ }
561
+ if (fns.length === 1) {
562
+ return fns[0];
563
+ }
564
+ return function piped(input) {
565
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
566
+ };
567
+ }
568
+
569
+ /** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
570
+ var Observable = /*@__PURE__*/ (function () {
571
+ function Observable(subscribe) {
572
+ this._isScalar = false;
573
+ if (subscribe) {
574
+ this._subscribe = subscribe;
575
+ }
576
+ }
577
+ Observable.prototype.lift = function (operator) {
578
+ var observable = new Observable();
579
+ observable.source = this;
580
+ observable.operator = operator;
581
+ return observable;
582
+ };
583
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
584
+ var operator = this.operator;
585
+ var sink = toSubscriber(observerOrNext, error, complete);
586
+ if (operator) {
587
+ sink.add(operator.call(sink, this.source));
588
+ }
589
+ else {
590
+ sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
591
+ this._subscribe(sink) :
592
+ this._trySubscribe(sink));
593
+ }
594
+ if (config.useDeprecatedSynchronousErrorHandling) {
595
+ if (sink.syncErrorThrowable) {
596
+ sink.syncErrorThrowable = false;
597
+ if (sink.syncErrorThrown) {
598
+ throw sink.syncErrorValue;
599
+ }
600
+ }
601
+ }
602
+ return sink;
603
+ };
604
+ Observable.prototype._trySubscribe = function (sink) {
605
+ try {
606
+ return this._subscribe(sink);
607
+ }
608
+ catch (err) {
609
+ if (config.useDeprecatedSynchronousErrorHandling) {
610
+ sink.syncErrorThrown = true;
611
+ sink.syncErrorValue = err;
612
+ }
613
+ if (canReportError(sink)) {
614
+ sink.error(err);
615
+ }
616
+ else {
617
+ console.warn(err);
618
+ }
619
+ }
620
+ };
621
+ Observable.prototype.forEach = function (next, promiseCtor) {
622
+ var _this = this;
623
+ promiseCtor = getPromiseCtor(promiseCtor);
624
+ return new promiseCtor(function (resolve, reject) {
625
+ var subscription;
626
+ subscription = _this.subscribe(function (value) {
627
+ try {
628
+ next(value);
629
+ }
630
+ catch (err) {
631
+ reject(err);
632
+ if (subscription) {
633
+ subscription.unsubscribe();
634
+ }
635
+ }
636
+ }, reject, resolve);
637
+ });
638
+ };
639
+ Observable.prototype._subscribe = function (subscriber) {
640
+ var source = this.source;
641
+ return source && source.subscribe(subscriber);
642
+ };
643
+ Observable.prototype[observable] = function () {
644
+ return this;
645
+ };
646
+ Observable.prototype.pipe = function () {
647
+ var operations = [];
648
+ for (var _i = 0; _i < arguments.length; _i++) {
649
+ operations[_i] = arguments[_i];
650
+ }
651
+ if (operations.length === 0) {
652
+ return this;
653
+ }
654
+ return pipeFromArray(operations)(this);
655
+ };
656
+ Observable.prototype.toPromise = function (promiseCtor) {
657
+ var _this = this;
658
+ promiseCtor = getPromiseCtor(promiseCtor);
659
+ return new promiseCtor(function (resolve, reject) {
660
+ var value;
661
+ _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
662
+ });
663
+ };
664
+ Observable.create = function (subscribe) {
665
+ return new Observable(subscribe);
666
+ };
667
+ return Observable;
668
+ }());
669
+ function getPromiseCtor(promiseCtor) {
670
+ if (!promiseCtor) {
671
+ promiseCtor = Promise;
672
+ }
673
+ if (!promiseCtor) {
674
+ throw new Error('no Promise impl found');
675
+ }
676
+ return promiseCtor;
677
+ }
678
+
679
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
680
+ var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {
681
+ function ObjectUnsubscribedErrorImpl() {
682
+ Error.call(this);
683
+ this.message = 'object unsubscribed';
684
+ this.name = 'ObjectUnsubscribedError';
685
+ return this;
686
+ }
687
+ ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
688
+ return ObjectUnsubscribedErrorImpl;
689
+ })();
690
+ var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
691
+
692
+ /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
693
+ var SubjectSubscription = /*@__PURE__*/ (function (_super) {
694
+ __extends(SubjectSubscription, _super);
695
+ function SubjectSubscription(subject, subscriber) {
696
+ var _this = _super.call(this) || this;
697
+ _this.subject = subject;
698
+ _this.subscriber = subscriber;
699
+ _this.closed = false;
700
+ return _this;
701
+ }
702
+ SubjectSubscription.prototype.unsubscribe = function () {
703
+ if (this.closed) {
704
+ return;
705
+ }
706
+ this.closed = true;
707
+ var subject = this.subject;
708
+ var observers = subject.observers;
709
+ this.subject = null;
710
+ if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
711
+ return;
712
+ }
713
+ var subscriberIndex = observers.indexOf(this.subscriber);
714
+ if (subscriberIndex !== -1) {
715
+ observers.splice(subscriberIndex, 1);
716
+ }
717
+ };
718
+ return SubjectSubscription;
719
+ }(Subscription));
720
+
721
+ /** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
722
+ var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
723
+ __extends(SubjectSubscriber, _super);
724
+ function SubjectSubscriber(destination) {
725
+ var _this = _super.call(this, destination) || this;
726
+ _this.destination = destination;
727
+ return _this;
728
+ }
729
+ return SubjectSubscriber;
730
+ }(Subscriber));
731
+ var Subject = /*@__PURE__*/ (function (_super) {
732
+ __extends(Subject, _super);
733
+ function Subject() {
734
+ var _this = _super.call(this) || this;
735
+ _this.observers = [];
736
+ _this.closed = false;
737
+ _this.isStopped = false;
738
+ _this.hasError = false;
739
+ _this.thrownError = null;
740
+ return _this;
741
+ }
742
+ Subject.prototype[rxSubscriber] = function () {
743
+ return new SubjectSubscriber(this);
744
+ };
745
+ Subject.prototype.lift = function (operator) {
746
+ var subject = new AnonymousSubject(this, this);
747
+ subject.operator = operator;
748
+ return subject;
749
+ };
750
+ Subject.prototype.next = function (value) {
751
+ if (this.closed) {
752
+ throw new ObjectUnsubscribedError();
753
+ }
754
+ if (!this.isStopped) {
755
+ var observers = this.observers;
756
+ var len = observers.length;
757
+ var copy = observers.slice();
758
+ for (var i = 0; i < len; i++) {
759
+ copy[i].next(value);
760
+ }
761
+ }
762
+ };
763
+ Subject.prototype.error = function (err) {
764
+ if (this.closed) {
765
+ throw new ObjectUnsubscribedError();
766
+ }
767
+ this.hasError = true;
768
+ this.thrownError = err;
769
+ this.isStopped = true;
770
+ var observers = this.observers;
771
+ var len = observers.length;
772
+ var copy = observers.slice();
773
+ for (var i = 0; i < len; i++) {
774
+ copy[i].error(err);
775
+ }
776
+ this.observers.length = 0;
777
+ };
778
+ Subject.prototype.complete = function () {
779
+ if (this.closed) {
780
+ throw new ObjectUnsubscribedError();
781
+ }
782
+ this.isStopped = true;
783
+ var observers = this.observers;
784
+ var len = observers.length;
785
+ var copy = observers.slice();
786
+ for (var i = 0; i < len; i++) {
787
+ copy[i].complete();
788
+ }
789
+ this.observers.length = 0;
790
+ };
791
+ Subject.prototype.unsubscribe = function () {
792
+ this.isStopped = true;
793
+ this.closed = true;
794
+ this.observers = null;
795
+ };
796
+ Subject.prototype._trySubscribe = function (subscriber) {
797
+ if (this.closed) {
798
+ throw new ObjectUnsubscribedError();
799
+ }
800
+ else {
801
+ return _super.prototype._trySubscribe.call(this, subscriber);
802
+ }
803
+ };
804
+ Subject.prototype._subscribe = function (subscriber) {
805
+ if (this.closed) {
806
+ throw new ObjectUnsubscribedError();
807
+ }
808
+ else if (this.hasError) {
809
+ subscriber.error(this.thrownError);
810
+ return Subscription.EMPTY;
811
+ }
812
+ else if (this.isStopped) {
813
+ subscriber.complete();
814
+ return Subscription.EMPTY;
815
+ }
816
+ else {
817
+ this.observers.push(subscriber);
818
+ return new SubjectSubscription(this, subscriber);
819
+ }
820
+ };
821
+ Subject.prototype.asObservable = function () {
822
+ var observable = new Observable();
823
+ observable.source = this;
824
+ return observable;
825
+ };
826
+ Subject.create = function (destination, source) {
827
+ return new AnonymousSubject(destination, source);
828
+ };
829
+ return Subject;
830
+ }(Observable));
831
+ var AnonymousSubject = /*@__PURE__*/ (function (_super) {
832
+ __extends(AnonymousSubject, _super);
833
+ function AnonymousSubject(destination, source) {
834
+ var _this = _super.call(this) || this;
835
+ _this.destination = destination;
836
+ _this.source = source;
837
+ return _this;
838
+ }
839
+ AnonymousSubject.prototype.next = function (value) {
840
+ var destination = this.destination;
841
+ if (destination && destination.next) {
842
+ destination.next(value);
843
+ }
844
+ };
845
+ AnonymousSubject.prototype.error = function (err) {
846
+ var destination = this.destination;
847
+ if (destination && destination.error) {
848
+ this.destination.error(err);
849
+ }
850
+ };
851
+ AnonymousSubject.prototype.complete = function () {
852
+ var destination = this.destination;
853
+ if (destination && destination.complete) {
854
+ this.destination.complete();
855
+ }
856
+ };
857
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
858
+ var source = this.source;
859
+ if (source) {
860
+ return this.source.subscribe(subscriber);
861
+ }
862
+ else {
863
+ return Subscription.EMPTY;
864
+ }
865
+ };
866
+ return AnonymousSubject;
867
+ }(Subject));
868
+
869
+ /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
870
+ var Action = /*@__PURE__*/ (function (_super) {
871
+ __extends(Action, _super);
872
+ function Action(scheduler, work) {
873
+ return _super.call(this) || this;
874
+ }
875
+ Action.prototype.schedule = function (state, delay) {
876
+ return this;
877
+ };
878
+ return Action;
879
+ }(Subscription));
880
+
881
+ /** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */
882
+ var AsyncAction = /*@__PURE__*/ (function (_super) {
883
+ __extends(AsyncAction, _super);
884
+ function AsyncAction(scheduler, work) {
885
+ var _this = _super.call(this, scheduler, work) || this;
886
+ _this.scheduler = scheduler;
887
+ _this.work = work;
888
+ _this.pending = false;
889
+ return _this;
890
+ }
891
+ AsyncAction.prototype.schedule = function (state, delay) {
892
+ if (delay === void 0) {
893
+ delay = 0;
894
+ }
895
+ if (this.closed) {
896
+ return this;
897
+ }
898
+ this.state = state;
899
+ var id = this.id;
900
+ var scheduler = this.scheduler;
901
+ if (id != null) {
902
+ this.id = this.recycleAsyncId(scheduler, id, delay);
903
+ }
904
+ this.pending = true;
905
+ this.delay = delay;
906
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
907
+ return this;
908
+ };
909
+ AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
910
+ if (delay === void 0) {
911
+ delay = 0;
912
+ }
913
+ return setInterval(scheduler.flush.bind(scheduler, this), delay);
914
+ };
915
+ AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
916
+ if (delay === void 0) {
917
+ delay = 0;
918
+ }
919
+ if (delay !== null && this.delay === delay && this.pending === false) {
920
+ return id;
921
+ }
922
+ clearInterval(id);
923
+ return undefined;
924
+ };
925
+ AsyncAction.prototype.execute = function (state, delay) {
926
+ if (this.closed) {
927
+ return new Error('executing a cancelled action');
928
+ }
929
+ this.pending = false;
930
+ var error = this._execute(state, delay);
931
+ if (error) {
932
+ return error;
933
+ }
934
+ else if (this.pending === false && this.id != null) {
935
+ this.id = this.recycleAsyncId(this.scheduler, this.id, null);
936
+ }
937
+ };
938
+ AsyncAction.prototype._execute = function (state, delay) {
939
+ var errored = false;
940
+ var errorValue = undefined;
941
+ try {
942
+ this.work(state);
943
+ }
944
+ catch (e) {
945
+ errored = true;
946
+ errorValue = !!e && e || new Error(e);
947
+ }
948
+ if (errored) {
949
+ this.unsubscribe();
950
+ return errorValue;
951
+ }
952
+ };
953
+ AsyncAction.prototype._unsubscribe = function () {
954
+ var id = this.id;
955
+ var scheduler = this.scheduler;
956
+ var actions = scheduler.actions;
957
+ var index = actions.indexOf(this);
958
+ this.work = null;
959
+ this.state = null;
960
+ this.pending = false;
961
+ this.scheduler = null;
962
+ if (index !== -1) {
963
+ actions.splice(index, 1);
964
+ }
965
+ if (id != null) {
966
+ this.id = this.recycleAsyncId(scheduler, id, null);
967
+ }
968
+ this.delay = null;
969
+ };
970
+ return AsyncAction;
971
+ }(Action));
972
+
973
+ /** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */
974
+ var QueueAction = /*@__PURE__*/ (function (_super) {
975
+ __extends(QueueAction, _super);
976
+ function QueueAction(scheduler, work) {
977
+ var _this = _super.call(this, scheduler, work) || this;
978
+ _this.scheduler = scheduler;
979
+ _this.work = work;
980
+ return _this;
981
+ }
982
+ QueueAction.prototype.schedule = function (state, delay) {
983
+ if (delay === void 0) {
984
+ delay = 0;
985
+ }
986
+ if (delay > 0) {
987
+ return _super.prototype.schedule.call(this, state, delay);
988
+ }
989
+ this.delay = delay;
990
+ this.state = state;
991
+ this.scheduler.flush(this);
992
+ return this;
993
+ };
994
+ QueueAction.prototype.execute = function (state, delay) {
995
+ return (delay > 0 || this.closed) ?
996
+ _super.prototype.execute.call(this, state, delay) :
997
+ this._execute(state, delay);
998
+ };
999
+ QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
1000
+ if (delay === void 0) {
1001
+ delay = 0;
1002
+ }
1003
+ if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
1004
+ return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
1005
+ }
1006
+ return scheduler.flush(this);
1007
+ };
1008
+ return QueueAction;
1009
+ }(AsyncAction));
1010
+
1011
+ var Scheduler = /*@__PURE__*/ (function () {
1012
+ function Scheduler(SchedulerAction, now) {
1013
+ if (now === void 0) {
1014
+ now = Scheduler.now;
1015
+ }
1016
+ this.SchedulerAction = SchedulerAction;
1017
+ this.now = now;
1018
+ }
1019
+ Scheduler.prototype.schedule = function (work, delay, state) {
1020
+ if (delay === void 0) {
1021
+ delay = 0;
1022
+ }
1023
+ return new this.SchedulerAction(this, work).schedule(state, delay);
1024
+ };
1025
+ Scheduler.now = function () { return Date.now(); };
1026
+ return Scheduler;
1027
+ }());
1028
+
1029
+ /** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */
1030
+ var AsyncScheduler = /*@__PURE__*/ (function (_super) {
1031
+ __extends(AsyncScheduler, _super);
1032
+ function AsyncScheduler(SchedulerAction, now) {
1033
+ if (now === void 0) {
1034
+ now = Scheduler.now;
1035
+ }
1036
+ var _this = _super.call(this, SchedulerAction, function () {
1037
+ if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {
1038
+ return AsyncScheduler.delegate.now();
1039
+ }
1040
+ else {
1041
+ return now();
1042
+ }
1043
+ }) || this;
1044
+ _this.actions = [];
1045
+ _this.active = false;
1046
+ _this.scheduled = undefined;
1047
+ return _this;
1048
+ }
1049
+ AsyncScheduler.prototype.schedule = function (work, delay, state) {
1050
+ if (delay === void 0) {
1051
+ delay = 0;
1052
+ }
1053
+ if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
1054
+ return AsyncScheduler.delegate.schedule(work, delay, state);
1055
+ }
1056
+ else {
1057
+ return _super.prototype.schedule.call(this, work, delay, state);
1058
+ }
1059
+ };
1060
+ AsyncScheduler.prototype.flush = function (action) {
1061
+ var actions = this.actions;
1062
+ if (this.active) {
1063
+ actions.push(action);
1064
+ return;
1065
+ }
1066
+ var error;
1067
+ this.active = true;
1068
+ do {
1069
+ if (error = action.execute(action.state, action.delay)) {
1070
+ break;
1071
+ }
1072
+ } while (action = actions.shift());
1073
+ this.active = false;
1074
+ if (error) {
1075
+ while (action = actions.shift()) {
1076
+ action.unsubscribe();
1077
+ }
1078
+ throw error;
1079
+ }
1080
+ };
1081
+ return AsyncScheduler;
1082
+ }(Scheduler));
1083
+
1084
+ /** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */
1085
+ var QueueScheduler = /*@__PURE__*/ (function (_super) {
1086
+ __extends(QueueScheduler, _super);
1087
+ function QueueScheduler() {
1088
+ return _super !== null && _super.apply(this, arguments) || this;
1089
+ }
1090
+ return QueueScheduler;
1091
+ }(AsyncScheduler));
1092
+
1093
+ /** PURE_IMPORTS_START _QueueAction,_QueueScheduler PURE_IMPORTS_END */
1094
+ var queueScheduler = /*@__PURE__*/ new QueueScheduler(QueueAction);
1095
+ var queue = queueScheduler;
1096
+
1097
+ /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
1098
+ var EMPTY = /*@__PURE__*/ new Observable(function (subscriber) { return subscriber.complete(); });
1099
+ function empty(scheduler) {
1100
+ return scheduler ? emptyScheduled(scheduler) : EMPTY;
1101
+ }
1102
+ function emptyScheduled(scheduler) {
1103
+ return new Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
1104
+ }
1105
+
1106
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
1107
+ function isScheduler(value) {
1108
+ return value && typeof value.schedule === 'function';
1109
+ }
1110
+
1111
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
1112
+ var subscribeToArray = function (array) {
1113
+ return function (subscriber) {
1114
+ for (var i = 0, len = array.length; i < len && !subscriber.closed; i++) {
1115
+ subscriber.next(array[i]);
1116
+ }
1117
+ subscriber.complete();
1118
+ };
1119
+ };
1120
+
1121
+ /** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */
1122
+ function scheduleArray(input, scheduler) {
1123
+ return new Observable(function (subscriber) {
1124
+ var sub = new Subscription();
1125
+ var i = 0;
1126
+ sub.add(scheduler.schedule(function () {
1127
+ if (i === input.length) {
1128
+ subscriber.complete();
1129
+ return;
1130
+ }
1131
+ subscriber.next(input[i++]);
1132
+ if (!subscriber.closed) {
1133
+ sub.add(this.schedule());
1134
+ }
1135
+ }));
1136
+ return sub;
1137
+ });
1138
+ }
1139
+
1140
+ /** PURE_IMPORTS_START _Observable,_util_subscribeToArray,_scheduled_scheduleArray PURE_IMPORTS_END */
1141
+ function fromArray(input, scheduler) {
1142
+ if (!scheduler) {
1143
+ return new Observable(subscribeToArray(input));
1144
+ }
1145
+ else {
1146
+ return scheduleArray(input, scheduler);
1147
+ }
1148
+ }
1149
+
1150
+ /** PURE_IMPORTS_START _util_isScheduler,_fromArray,_scheduled_scheduleArray PURE_IMPORTS_END */
1151
+ function of() {
1152
+ var args = [];
1153
+ for (var _i = 0; _i < arguments.length; _i++) {
1154
+ args[_i] = arguments[_i];
1155
+ }
1156
+ var scheduler = args[args.length - 1];
1157
+ if (isScheduler(scheduler)) {
1158
+ args.pop();
1159
+ return scheduleArray(args, scheduler);
1160
+ }
1161
+ else {
1162
+ return fromArray(args);
1163
+ }
1164
+ }
1165
+
1166
+ /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
1167
+ function throwError(error, scheduler) {
1168
+ if (!scheduler) {
1169
+ return new Observable(function (subscriber) { return subscriber.error(error); });
1170
+ }
1171
+ else {
1172
+ return new Observable(function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); });
1173
+ }
1174
+ }
1175
+ function dispatch(_a) {
1176
+ var error = _a.error, subscriber = _a.subscriber;
1177
+ subscriber.error(error);
1178
+ }
1179
+
1180
+ /** PURE_IMPORTS_START _observable_empty,_observable_of,_observable_throwError PURE_IMPORTS_END */
1181
+ var Notification = /*@__PURE__*/ (function () {
1182
+ function Notification(kind, value, error) {
1183
+ this.kind = kind;
1184
+ this.value = value;
1185
+ this.error = error;
1186
+ this.hasValue = kind === 'N';
1187
+ }
1188
+ Notification.prototype.observe = function (observer) {
1189
+ switch (this.kind) {
1190
+ case 'N':
1191
+ return observer.next && observer.next(this.value);
1192
+ case 'E':
1193
+ return observer.error && observer.error(this.error);
1194
+ case 'C':
1195
+ return observer.complete && observer.complete();
1196
+ }
1197
+ };
1198
+ Notification.prototype.do = function (next, error, complete) {
1199
+ var kind = this.kind;
1200
+ switch (kind) {
1201
+ case 'N':
1202
+ return next && next(this.value);
1203
+ case 'E':
1204
+ return error && error(this.error);
1205
+ case 'C':
1206
+ return complete && complete();
1207
+ }
1208
+ };
1209
+ Notification.prototype.accept = function (nextOrObserver, error, complete) {
1210
+ if (nextOrObserver && typeof nextOrObserver.next === 'function') {
1211
+ return this.observe(nextOrObserver);
1212
+ }
1213
+ else {
1214
+ return this.do(nextOrObserver, error, complete);
1215
+ }
1216
+ };
1217
+ Notification.prototype.toObservable = function () {
1218
+ var kind = this.kind;
1219
+ switch (kind) {
1220
+ case 'N':
1221
+ return of(this.value);
1222
+ case 'E':
1223
+ return throwError(this.error);
1224
+ case 'C':
1225
+ return empty();
1226
+ }
1227
+ throw new Error('unexpected notification kind value');
1228
+ };
1229
+ Notification.createNext = function (value) {
1230
+ if (typeof value !== 'undefined') {
1231
+ return new Notification('N', value);
1232
+ }
1233
+ return Notification.undefinedValueNotification;
1234
+ };
1235
+ Notification.createError = function (err) {
1236
+ return new Notification('E', undefined, err);
1237
+ };
1238
+ Notification.createComplete = function () {
1239
+ return Notification.completeNotification;
1240
+ };
1241
+ Notification.completeNotification = new Notification('C');
1242
+ Notification.undefinedValueNotification = new Notification('N', undefined);
1243
+ return Notification;
1244
+ }());
1245
+
1246
+ /** PURE_IMPORTS_START tslib,_Subscriber,_Notification PURE_IMPORTS_END */
1247
+ var ObserveOnSubscriber = /*@__PURE__*/ (function (_super) {
1248
+ __extends(ObserveOnSubscriber, _super);
1249
+ function ObserveOnSubscriber(destination, scheduler, delay) {
1250
+ if (delay === void 0) {
1251
+ delay = 0;
1252
+ }
1253
+ var _this = _super.call(this, destination) || this;
1254
+ _this.scheduler = scheduler;
1255
+ _this.delay = delay;
1256
+ return _this;
1257
+ }
1258
+ ObserveOnSubscriber.dispatch = function (arg) {
1259
+ var notification = arg.notification, destination = arg.destination;
1260
+ notification.observe(destination);
1261
+ this.unsubscribe();
1262
+ };
1263
+ ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
1264
+ var destination = this.destination;
1265
+ destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
1266
+ };
1267
+ ObserveOnSubscriber.prototype._next = function (value) {
1268
+ this.scheduleMessage(Notification.createNext(value));
1269
+ };
1270
+ ObserveOnSubscriber.prototype._error = function (err) {
1271
+ this.scheduleMessage(Notification.createError(err));
1272
+ this.unsubscribe();
1273
+ };
1274
+ ObserveOnSubscriber.prototype._complete = function () {
1275
+ this.scheduleMessage(Notification.createComplete());
1276
+ this.unsubscribe();
1277
+ };
1278
+ return ObserveOnSubscriber;
1279
+ }(Subscriber));
1280
+ var ObserveOnMessage = /*@__PURE__*/ (function () {
1281
+ function ObserveOnMessage(notification, destination) {
1282
+ this.notification = notification;
1283
+ this.destination = destination;
1284
+ }
1285
+ return ObserveOnMessage;
1286
+ }());
1287
+
1288
+ /** PURE_IMPORTS_START tslib,_Subject,_scheduler_queue,_Subscription,_operators_observeOn,_util_ObjectUnsubscribedError,_SubjectSubscription PURE_IMPORTS_END */
1289
+ var ReplaySubject = /*@__PURE__*/ (function (_super) {
1290
+ __extends(ReplaySubject, _super);
1291
+ function ReplaySubject(bufferSize, windowTime, scheduler) {
1292
+ if (bufferSize === void 0) {
1293
+ bufferSize = Number.POSITIVE_INFINITY;
1294
+ }
1295
+ if (windowTime === void 0) {
1296
+ windowTime = Number.POSITIVE_INFINITY;
1297
+ }
1298
+ var _this = _super.call(this) || this;
1299
+ _this.scheduler = scheduler;
1300
+ _this._events = [];
1301
+ _this._infiniteTimeWindow = false;
1302
+ _this._bufferSize = bufferSize < 1 ? 1 : bufferSize;
1303
+ _this._windowTime = windowTime < 1 ? 1 : windowTime;
1304
+ if (windowTime === Number.POSITIVE_INFINITY) {
1305
+ _this._infiniteTimeWindow = true;
1306
+ _this.next = _this.nextInfiniteTimeWindow;
1307
+ }
1308
+ else {
1309
+ _this.next = _this.nextTimeWindow;
1310
+ }
1311
+ return _this;
1312
+ }
1313
+ ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {
1314
+ if (!this.isStopped) {
1315
+ var _events = this._events;
1316
+ _events.push(value);
1317
+ if (_events.length > this._bufferSize) {
1318
+ _events.shift();
1319
+ }
1320
+ }
1321
+ _super.prototype.next.call(this, value);
1322
+ };
1323
+ ReplaySubject.prototype.nextTimeWindow = function (value) {
1324
+ if (!this.isStopped) {
1325
+ this._events.push(new ReplayEvent(this._getNow(), value));
1326
+ this._trimBufferThenGetEvents();
1327
+ }
1328
+ _super.prototype.next.call(this, value);
1329
+ };
1330
+ ReplaySubject.prototype._subscribe = function (subscriber) {
1331
+ var _infiniteTimeWindow = this._infiniteTimeWindow;
1332
+ var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
1333
+ var scheduler = this.scheduler;
1334
+ var len = _events.length;
1335
+ var subscription;
1336
+ if (this.closed) {
1337
+ throw new ObjectUnsubscribedError();
1338
+ }
1339
+ else if (this.isStopped || this.hasError) {
1340
+ subscription = Subscription.EMPTY;
1341
+ }
1342
+ else {
1343
+ this.observers.push(subscriber);
1344
+ subscription = new SubjectSubscription(this, subscriber);
1345
+ }
1346
+ if (scheduler) {
1347
+ subscriber.add(subscriber = new ObserveOnSubscriber(subscriber, scheduler));
1348
+ }
1349
+ if (_infiniteTimeWindow) {
1350
+ for (var i = 0; i < len && !subscriber.closed; i++) {
1351
+ subscriber.next(_events[i]);
1352
+ }
1353
+ }
1354
+ else {
1355
+ for (var i = 0; i < len && !subscriber.closed; i++) {
1356
+ subscriber.next(_events[i].value);
1357
+ }
1358
+ }
1359
+ if (this.hasError) {
1360
+ subscriber.error(this.thrownError);
1361
+ }
1362
+ else if (this.isStopped) {
1363
+ subscriber.complete();
1364
+ }
1365
+ return subscription;
1366
+ };
1367
+ ReplaySubject.prototype._getNow = function () {
1368
+ return (this.scheduler || queue).now();
1369
+ };
1370
+ ReplaySubject.prototype._trimBufferThenGetEvents = function () {
1371
+ var now = this._getNow();
1372
+ var _bufferSize = this._bufferSize;
1373
+ var _windowTime = this._windowTime;
1374
+ var _events = this._events;
1375
+ var eventsCount = _events.length;
1376
+ var spliceCount = 0;
1377
+ while (spliceCount < eventsCount) {
1378
+ if ((now - _events[spliceCount].time) < _windowTime) {
1379
+ break;
1380
+ }
1381
+ spliceCount++;
1382
+ }
1383
+ if (eventsCount > _bufferSize) {
1384
+ spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);
1385
+ }
1386
+ if (spliceCount > 0) {
1387
+ _events.splice(0, spliceCount);
1388
+ }
1389
+ return _events;
1390
+ };
1391
+ return ReplaySubject;
1392
+ }(Subject));
1393
+ var ReplayEvent = /*@__PURE__*/ (function () {
1394
+ function ReplayEvent(time, value) {
1395
+ this.time = time;
1396
+ this.value = value;
1397
+ }
1398
+ return ReplayEvent;
1399
+ }());
1400
+
1401
+ /**
1402
+ * @license Angular v17.3.10
1403
+ * (c) 2010-2024 Google LLC. https://angular.io/
1404
+ * License: MIT
1405
+ */
1406
+
1407
+
1408
+ /**
1409
+ * Exposes the value of an Angular `Signal` as an RxJS `Observable`.
1410
+ *
1411
+ * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
1412
+ *
1413
+ * `toObservable` must be called in an injection context unless an injector is provided via options.
1414
+ *
1415
+ * @developerPreview
1416
+ */
1417
+ function toObservable(source, options) {
1418
+ !options?.injector && assertInInjectionContext(toObservable);
1419
+ const injector = options?.injector ?? inject(Injector);
1420
+ const subject = new ReplaySubject(1);
1421
+ const watcher = effect(() => {
1422
+ let value;
1423
+ try {
1424
+ value = source();
1425
+ }
1426
+ catch (err) {
1427
+ untracked(() => subject.error(err));
1428
+ return;
1429
+ }
1430
+ untracked(() => subject.next(value));
1431
+ }, { injector, manualCleanup: true });
1432
+ injector.get(DestroyRef).onDestroy(() => {
1433
+ watcher.destroy();
1434
+ subject.complete();
1435
+ });
1436
+ return subject.asObservable();
1437
+ }
1438
+
1439
+ const ROOT_SELECTOR = '[data-cy-root]';
1440
+ /**
1441
+ * Gets the root element used to mount the component.
1442
+ * @returns {HTMLElement} The root element
1443
+ * @throws {Error} If the root element is not found
1444
+ */
1445
+ const getContainerEl = () => {
1446
+ const el = document.querySelector(ROOT_SELECTOR);
1447
+ if (el) {
1448
+ return el;
1449
+ }
1450
+ throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please add a root element with data-cy-root attribute to your "component-index.html" file so that Cypress can attach your component to the DOM.`);
1451
+ };
1452
+ /**
1453
+ * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
1454
+ * @param optionalCallback Callback to be called before the next test runs
1455
+ */
1456
+ function setupHooks(optionalCallback) {
1457
+ // We don't want CT side effects to run when e2e
1458
+ // testing so we early return.
1459
+ // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
1460
+ if (Cypress.testingType !== 'component') {
1461
+ return;
1462
+ }
1463
+ // When running component specs, we cannot allow "cy.visit"
1464
+ // because it will wipe out our preparation work, and does not make much sense
1465
+ // thus we overwrite "cy.visit" to throw an error
1466
+ Cypress.Commands.overwrite('visit', () => {
1467
+ throw new Error('cy.visit from a component spec is not allowed');
1468
+ });
1469
+ Cypress.Commands.overwrite('session', () => {
1470
+ throw new Error('cy.session from a component spec is not allowed');
1471
+ });
1472
+ Cypress.Commands.overwrite('origin', () => {
1473
+ throw new Error('cy.origin from a component spec is not allowed');
1474
+ });
1475
+ // @ts-ignore
1476
+ Cypress.on('test:before:after:run:async', () => {
1477
+ optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
1478
+ });
1479
+ }
1480
+
1481
+ /**
1482
+ * @hack fixes "Mocha has already been patched with Zone" error.
1483
+ */
1484
+ // @ts-ignore
1485
+ window.Mocha['__zone_patch__'] = false;
1486
+ let activeFixture = null;
1487
+ let activeInternalSubscriptions = [];
1488
+ function cleanup() {
1489
+ // Not public, we need to call this to remove the last component from the DOM
1490
+ try {
1491
+ getTestBed().tearDownTestingModule();
1492
+ }
1493
+ catch (e) {
1494
+ const notSupportedError = new Error(`Failed to teardown component. The version of Angular you are using may not be officially supported.`);
1495
+ notSupportedError.docsUrl = 'https://on.cypress.io/component-framework-configuration';
1496
+ throw notSupportedError;
1497
+ }
1498
+ // clean up internal subscriptions if any exist. We use this for two-way data binding for
1499
+ // signal() models
1500
+ activeInternalSubscriptions.forEach((subscription) => {
1501
+ subscription.unsubscribe();
1502
+ });
1503
+ getTestBed().resetTestingModule();
1504
+ activeFixture = null;
1505
+ activeInternalSubscriptions = [];
1506
+ }
1507
+ // 'zone.js/testing' is not properly aliasing `it.skip` but it does provide `xit`/`xspecify`
1508
+ // Written up under https://github.com/angular/angular/issues/46297 but is not seeing movement
1509
+ // so we'll patch here pending a fix in that library
1510
+ // @ts-ignore Ignore so that way we can bypass semantic error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
1511
+ globalThis.it.skip = globalThis.xit;
1512
+ let CypressAngularErrorHandler = class CypressAngularErrorHandler {
1513
+ handleError(error) {
1514
+ throw error;
1515
+ }
1516
+ };
1517
+ CypressAngularErrorHandler = __decorate([
1518
+ Injectable()
1519
+ ], CypressAngularErrorHandler);
1520
+ /**
1521
+ * Bootstraps the TestModuleMetaData passed to the TestBed
1522
+ *
1523
+ * @param {Type<T>} component Angular component being mounted
1524
+ * @param {MountConfig} config TestBed configuration passed into the mount function
1525
+ * @returns {MountConfig} MountConfig
1526
+ */
1527
+ function bootstrapModule(component, config) {
1528
+ var _a;
1529
+ const testModuleMetaData = __rest(config, ["componentProperties"]);
1530
+ if (!testModuleMetaData.declarations) {
1531
+ testModuleMetaData.declarations = [];
1532
+ }
1533
+ if (!testModuleMetaData.imports) {
1534
+ testModuleMetaData.imports = [];
1535
+ }
1536
+ if (!testModuleMetaData.providers) {
1537
+ testModuleMetaData.providers = [];
1538
+ }
1539
+ // Replace default error handler since it will swallow uncaught exceptions.
1540
+ // We want these to be uncaught so Cypress catches it and fails the test
1541
+ testModuleMetaData.providers.push({
1542
+ provide: ErrorHandler,
1543
+ useClass: CypressAngularErrorHandler,
1544
+ });
1545
+ // check if the component is a standalone component
1546
+ if ((_a = component.ɵcmp) === null || _a === void 0 ? void 0 : _a.standalone) {
1547
+ testModuleMetaData.imports.push(component);
1548
+ }
1549
+ else {
1550
+ testModuleMetaData.declarations.push(component);
1551
+ }
1552
+ if (!testModuleMetaData.imports.includes(CommonModule)) {
1553
+ testModuleMetaData.imports.push(CommonModule);
1554
+ }
1555
+ return testModuleMetaData;
1556
+ }
1557
+ let CypressTestComponentRenderer = class CypressTestComponentRenderer extends TestComponentRenderer {
1558
+ insertRootElement(rootElId) {
1559
+ this.removeAllRootElements();
1560
+ const rootElement = getContainerEl();
1561
+ rootElement.setAttribute('id', rootElId);
1562
+ }
1563
+ removeAllRootElements() {
1564
+ getContainerEl().innerHTML = '';
1565
+ }
1566
+ };
1567
+ CypressTestComponentRenderer = __decorate([
1568
+ Injectable()
1569
+ ], CypressTestComponentRenderer);
1570
+ /**
1571
+ * Initializes the TestBed
1572
+ *
1573
+ * @param {Type<T> | string} component Angular component being mounted or its template
1574
+ * @param {MountConfig} config TestBed configuration passed into the mount function
1575
+ * @returns {Type<T>} componentFixture
1576
+ */
1577
+ function initTestBed(component, config) {
1578
+ const componentFixture = createComponentFixture(component);
1579
+ getTestBed().configureTestingModule(Object.assign({}, bootstrapModule(componentFixture, config)));
1580
+ getTestBed().overrideProvider(TestComponentRenderer, { useValue: new CypressTestComponentRenderer() });
1581
+ return componentFixture;
1582
+ }
1583
+ let WrapperComponent = class WrapperComponent {
1584
+ };
1585
+ WrapperComponent = __decorate([
1586
+ Component({ selector: 'cy-wrapper-component', template: '' })
1587
+ ], WrapperComponent);
1588
+ /**
1589
+ * Returns the Component if Type<T> or creates a WrapperComponent
1590
+ *
1591
+ * @param {Type<T> | string} component The component you want to create a fixture of
1592
+ * @returns {Type<T> | WrapperComponent}
1593
+ */
1594
+ function createComponentFixture(component) {
1595
+ if (typeof component === 'string') {
1596
+ // getTestBed().overrideTemplate is available in v14+
1597
+ // The static TestBed.overrideTemplate is available across versions
1598
+ TestBed.overrideTemplate(WrapperComponent, component);
1599
+ return WrapperComponent;
1600
+ }
1601
+ return component;
1602
+ }
1603
+ /**
1604
+ * Creates the ComponentFixture
1605
+ *
1606
+ * @param {Type<T>} component Angular component being mounted
1607
+ * @param {MountConfig<T>} config MountConfig
1608
+
1609
+ * @returns {ComponentFixture<T>} ComponentFixture
1610
+ */
1611
+ function setupFixture(component, config) {
1612
+ const fixture = getTestBed().createComponent(component);
1613
+ setupComponent(config, fixture);
1614
+ fixture.whenStable().then(() => {
1615
+ var _a;
1616
+ fixture.autoDetectChanges((_a = config.autoDetectChanges) !== null && _a !== void 0 ? _a : true);
1617
+ });
1618
+ return fixture;
1619
+ }
1620
+ // Best known way to currently detect whether or not a function is a signal is if the signal symbol exists.
1621
+ // From there, we can take our best guess based on what exists on the object itself.
1622
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1623
+ function isSignal(prop) {
1624
+ try {
1625
+ const symbol = Object.getOwnPropertySymbols(prop).find((symbol) => symbol.toString() === 'Symbol(SIGNAL)');
1626
+ return !!symbol;
1627
+ }
1628
+ catch (e) {
1629
+ // likely a primitive type, object, array, or something else (i.e. not a signal).
1630
+ // We can return false here.
1631
+ return false;
1632
+ }
1633
+ }
1634
+ // currently not a great way to detect if a function is an InputSignal.
1635
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1636
+ function isInputSignal(prop) {
1637
+ return isSignal(prop) && typeof prop === 'function' && prop['name'] === 'inputValueFn';
1638
+ }
1639
+ // currently not a great way to detect if a function is a Model Signal.
1640
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1641
+ function isModelSignal(prop) {
1642
+ return isSignal(prop) && isWritableSignal(prop) && typeof prop.subscribe === 'function';
1643
+ }
1644
+ // currently not a great way to detect if a function is a Writable Signal.
1645
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1646
+ function isWritableSignal(prop) {
1647
+ return isSignal(prop) && typeof prop === 'function' && typeof prop.set === 'function';
1648
+ }
1649
+ function convertPropertyToSignalIfApplicable(propValue, componentValue, injector) {
1650
+ const isComponentValueAnInputSignal = isInputSignal(componentValue);
1651
+ const isComponentValueAModelSignal = isModelSignal(componentValue);
1652
+ let convertedValueIfApplicable = propValue;
1653
+ // If the component has the property defined as an InputSignal, we need to detect whether a non signal value or not was passed into the component as a prop
1654
+ // and attempt to merge the value in correctly.
1655
+ // We don't want to expose the primitive created signal as it should really be one-way binding from within the component.
1656
+ // However, to make CT testing easier, a user can technically pass in a signal to an input component and assert on the signal itself and pass in updates
1657
+ // down to the component as 1 way binding is supported by the test harness
1658
+ if (isComponentValueAnInputSignal) {
1659
+ const isPassedInValueNotASignal = !isSignal(propValue);
1660
+ if (isPassedInValueNotASignal) {
1661
+ // Input signals require an injection context to set initial values.
1662
+ // Because of this, we cannot create them outside the scope of the component.
1663
+ // Options for input signals also don't allow the passing of an injection contexts, so in order to work around this,
1664
+ // we convert the non signal input passed into the input to a writable signal
1665
+ convertedValueIfApplicable = signal(propValue);
1666
+ }
1667
+ // If the component has the property defined as a ModelSignal, we need to detect whether a signal value or not was passed into the component as a prop.
1668
+ // If a non signal property is passed into the component model (primitive, object, array, etc), we need to set the model to that value and propagate changes of that model through the output spy.
1669
+ // Since the non signal type likely lives outside the context of Angular, the non signal type will NOT be updated outside of this context. Instead, the output spy will allow you
1670
+ // to see this change.
1671
+ // If the value passed into the property is in fact a signal, we need to set up two-way binding between the signals to make sure changes from one propagate to the other.
1672
+ }
1673
+ else if (isComponentValueAModelSignal) {
1674
+ const isPassedInValueLikelyARegularSignal = isWritableSignal(propValue);
1675
+ // if the value passed into the component is a signal, set up two-way binding
1676
+ if (isPassedInValueLikelyARegularSignal) {
1677
+ // update the passed in value with the models updates
1678
+ componentValue.subscribe((value) => {
1679
+ propValue.set(value);
1680
+ });
1681
+ // update the model signal with the properties updates
1682
+ const convertedToObservable = toObservable(propValue, {
1683
+ injector,
1684
+ });
1685
+ // push the subscription into an array to be cleaned up at the end of the test
1686
+ // to prevent a memory leak
1687
+ activeInternalSubscriptions.push(convertedToObservable.subscribe((value) => {
1688
+ componentValue.set(value);
1689
+ }));
1690
+ }
1691
+ else {
1692
+ // it's a non signal type, set it as we only need to handle updating the model signal and emit changes on this through the output spy.
1693
+ componentValue.set(propValue);
1694
+ convertedValueIfApplicable = componentValue;
1695
+ }
1696
+ }
1697
+ return convertedValueIfApplicable;
1698
+ }
1699
+ // In the case of signals, if we need to create an output spy, we need to check first whether or not a user has one defined first or has it created through
1700
+ // autoSpyOutputs. If so, we need to subscribe to the writable signal to push updates into the event emitter. We do NOT observe input signals and output spies will not
1701
+ // work for input signals.
1702
+ function detectAndRegisterOutputSpyToSignal(config, component, key, injector) {
1703
+ if (config.componentProperties) {
1704
+ const expectedChangeKey = `${key}Change`;
1705
+ let changeKeyIfExists = !!Object.keys(config.componentProperties).find((componentKey) => componentKey === expectedChangeKey);
1706
+ // since spies do NOT make change handlers by default, similar to the Output() decorator, we need to create the spy and subscribe to the signal
1707
+ if (!changeKeyIfExists && config.autoSpyOutputs) {
1708
+ component[expectedChangeKey] = createOutputSpy(`${expectedChangeKey}Spy`);
1709
+ changeKeyIfExists = true;
1710
+ }
1711
+ if (changeKeyIfExists) {
1712
+ const componentValue = component[key];
1713
+ // if the user passed in a change key or we created one due to config.autoSpyOutputs being set to true for a given signal,
1714
+ // we will create a subscriber that will emit an event every time the value inside the signal changes. We only do this
1715
+ // if the signal is writable and not an input signal.
1716
+ if (isWritableSignal(componentValue) && !isInputSignal(componentValue)) {
1717
+ toObservable(componentValue, {
1718
+ injector,
1719
+ }).subscribe((value) => {
1720
+ var _a;
1721
+ (_a = component[expectedChangeKey]) === null || _a === void 0 ? void 0 : _a.emit(value);
1722
+ });
1723
+ }
1724
+ }
1725
+ }
1726
+ }
1727
+ /**
1728
+ * Gets the componentInstance and Object.assigns any componentProperties() passed in the MountConfig
1729
+ *
1730
+ * @param {MountConfig} config TestBed configuration passed into the mount function
1731
+ * @param {ComponentFixture<T>} fixture Fixture for debugging and testing a component.
1732
+ * @returns {T} Component being mounted
1733
+ */
1734
+ function setupComponent(config, fixture) {
1735
+ let component = fixture.componentInstance;
1736
+ const injector = fixture.componentRef.injector;
1737
+ if (config === null || config === void 0 ? void 0 : config.componentProperties) {
1738
+ // convert primitives to signals if passed in type is a primitive but expected type is signal
1739
+ // a bit of magic. need to move to another function
1740
+ Object.keys(component).forEach((key) => {
1741
+ var _a;
1742
+ // only assign props if they are passed into the component
1743
+ if ((_a = config === null || config === void 0 ? void 0 : config.componentProperties) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(key)) {
1744
+ // @ts-expect-error
1745
+ const passedInValue = config === null || config === void 0 ? void 0 : config.componentProperties[key];
1746
+ const componentValue = component[key];
1747
+ // @ts-expect-error
1748
+ config.componentProperties[key] = convertPropertyToSignalIfApplicable(passedInValue, componentValue, injector);
1749
+ detectAndRegisterOutputSpyToSignal(config, component, key, injector);
1750
+ }
1751
+ });
1752
+ component = Object.assign(component, config.componentProperties);
1753
+ }
1754
+ if (config.autoSpyOutputs) {
1755
+ Object.keys(component).forEach((key) => {
1756
+ const property = component[key];
1757
+ if (property instanceof EventEmitter) {
1758
+ component[key] = createOutputSpy(`${key}Spy`);
1759
+ }
1760
+ });
1761
+ }
1762
+ // Manually call ngOnChanges when mounting components using the class syntax.
1763
+ // This is necessary because we are assigning input values to the class directly
1764
+ // on mount and therefore the ngOnChanges() lifecycle is not triggered.
1765
+ if (component.ngOnChanges && config.componentProperties) {
1766
+ const { componentProperties } = config;
1767
+ const simpleChanges = Object.entries(componentProperties).reduce((acc, [key, value]) => {
1768
+ acc[key] = new SimpleChange(null, value, true);
1769
+ return acc;
1770
+ }, {});
1771
+ if (Object.keys(componentProperties).length > 0) {
1772
+ component.ngOnChanges(simpleChanges);
1773
+ }
1774
+ }
1775
+ }
1776
+ /**
1777
+ * Mounts an Angular component inside Cypress browser
1778
+ *
1779
+ * @param component Angular component being mounted or its template
1780
+ * @param config configuration used to configure the TestBed
1781
+ * @example
1782
+ * import { mount } from '@cypress/angular-signals'
1783
+ * import { StepperComponent } from './stepper.component'
1784
+ * import { MyService } from 'services/my.service'
1785
+ * import { SharedModule } from 'shared/shared.module';
1786
+ * it('mounts', () => {
1787
+ * mount(StepperComponent, {
1788
+ * providers: [MyService],
1789
+ * imports: [SharedModule]
1790
+ * })
1791
+ * cy.get('[data-cy=increment]').click()
1792
+ * cy.get('[data-cy=counter]').should('have.text', '1')
1793
+ * })
1794
+ *
1795
+ * // or
1796
+ *
1797
+ * it('mounts with template', () => {
1798
+ * mount('<app-stepper></app-stepper>', {
1799
+ * declarations: [StepperComponent],
1800
+ * })
1801
+ * })
1802
+ *
1803
+ * @see {@link https://on.cypress.io/mounting-angular} for more details.
1804
+ *
1805
+ * @returns A component and component fixture
1806
+ */
1807
+ function mount(component, config = {}) {
1808
+ // Remove last mounted component if cy.mount is called more than once in a test
1809
+ if (activeFixture) {
1810
+ cleanup();
1811
+ }
1812
+ const componentFixture = initTestBed(component, config);
1813
+ activeFixture = setupFixture(componentFixture, config);
1814
+ const mountResponse = {
1815
+ fixture: activeFixture,
1816
+ component: activeFixture.componentInstance,
1817
+ };
1818
+ const logMessage = typeof component === 'string' ? 'Component' : componentFixture.name;
1819
+ Cypress.log({
1820
+ name: 'mount',
1821
+ message: logMessage,
1822
+ consoleProps: () => ({ result: mountResponse }),
1823
+ });
1824
+ return cy.wrap(mountResponse, { log: false });
1825
+ }
1826
+ /**
1827
+ * Creates a new Event Emitter and then spies on it's `emit` method
1828
+ *
1829
+ * @param {string} alias name you want to use for your cy.spy() alias
1830
+ * @returns EventEmitter<T>
1831
+ * @example
1832
+ * import { StepperComponent } from './stepper.component'
1833
+ * import { mount, createOutputSpy } from '@cypress/angular-signals'
1834
+ *
1835
+ * it('Has spy', () => {
1836
+ * mount(StepperComponent, { componentProperties: { change: createOutputSpy('changeSpy') } })
1837
+ * cy.get('[data-cy=increment]').click()
1838
+ * cy.get('@changeSpy').should('have.been.called')
1839
+ * })
1840
+ *
1841
+ * // Or for use with Angular Signals following the output nomenclature.
1842
+ * // see https://v17.angular.io/guide/model-inputs#differences-between-model-and-input/
1843
+ *
1844
+ * it('Has spy', () => {
1845
+ * mount(StepperComponent, { componentProperties: { count: signal(0), countChange: createOutputSpy('countChange') } })
1846
+ * cy.get('[data-cy=increment]').click()
1847
+ * cy.get('@countChange').should('have.been.called')
1848
+ * })
1849
+ */
1850
+ const createOutputSpy = (alias) => {
1851
+ const emitter = new EventEmitter();
1852
+ cy.spy(emitter, 'emit').as(alias);
1853
+ return emitter;
1854
+ };
1855
+ // Only needs to run once, we reset before each test
1856
+ getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
1857
+ teardown: { destroyAfterEach: false },
1858
+ });
1859
+ setupHooks(cleanup);
1860
+
1861
+ export { CypressTestComponentRenderer, createOutputSpy, mount };