@panneau/core 4.0.78 → 4.1.1

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/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { useRef, useEffect, useCallback, useState, useMemo } from 'react';
2
+ import { useRef, useEffect, useState } from 'react';
3
3
  import { EventsManager, MediasParser } from '@panneau/core';
4
4
  import { createUseEvent, loadPackage } from '@panneau/core/utils';
5
5
  import { getCsrfToken, postJSON, getCSRFHeaders } from '@folklore/fetch';
@@ -8,13 +8,13 @@ import isArray from 'lodash-es/isArray';
8
8
  import isObject from 'lodash-es/isObject';
9
9
  import isString from 'lodash-es/isString';
10
10
  import { useFieldsManager, usePanneauResources, useResource, useUrlGenerator, useRoutes } from '@panneau/core/contexts';
11
- import { isString as isString$1 } from 'lodash';
11
+ import isEqual from 'lodash-es/isEqual';
12
12
  import dayjs from 'dayjs';
13
13
  import { useIntl } from 'react-intl';
14
14
  import { match } from 'css-mediaquery';
15
15
 
16
16
  function useAnimationFrame(onFrame, t0) {
17
- const $ = c(9);
17
+ const $ = c(8);
18
18
  let t1;
19
19
  if ($[0] !== t0) {
20
20
  t1 = t0 === undefined ? {} : t0;
@@ -29,91 +29,159 @@ function useAnimationFrame(onFrame, t0) {
29
29
  const disabled = t2 === undefined ? false : t2;
30
30
  const requestRef = useRef(null);
31
31
  const startTimeRef = useRef(null);
32
- let callback;
32
+ const onFrameRef = useRef(onFrame);
33
+ let t3;
34
+ let t4;
33
35
  if ($[2] !== onFrame) {
34
- callback = time => {
35
- if (!startTimeRef.current) {
36
- startTimeRef.current = time;
37
- }
38
- const progress = time - startTimeRef.current;
39
- onFrame(progress);
40
- requestRef.current = requestAnimationFrame(callback);
36
+ t3 = () => {
37
+ onFrameRef.current = onFrame;
41
38
  };
39
+ t4 = [onFrame];
42
40
  $[2] = onFrame;
43
- $[3] = callback;
41
+ $[3] = t3;
42
+ $[4] = t4;
44
43
  } else {
45
- callback = $[3];
44
+ t3 = $[3];
45
+ t4 = $[4];
46
46
  }
47
- let t3;
48
- if ($[4] !== callback || $[5] !== disabled) {
49
- t3 = () => {
50
- if (!disabled) {
51
- requestRef.current = requestAnimationFrame(callback);
47
+ useEffect(t3, t4);
48
+ let t5;
49
+ let t6;
50
+ if ($[5] !== disabled) {
51
+ t5 = () => {
52
+ if (disabled) {
53
+ return _temp$2;
52
54
  }
55
+ startTimeRef.current = null;
56
+ const callback = time => {
57
+ if (startTimeRef.current === null) {
58
+ startTimeRef.current = time;
59
+ }
60
+ const progress = time - startTimeRef.current;
61
+ onFrameRef.current(progress);
62
+ requestRef.current = requestAnimationFrame(callback);
63
+ };
64
+ requestRef.current = requestAnimationFrame(callback);
53
65
  return () => {
54
66
  if (requestRef.current !== null) {
55
67
  cancelAnimationFrame(requestRef.current);
68
+ requestRef.current = null;
56
69
  }
57
70
  };
58
71
  };
59
- $[4] = callback;
72
+ t6 = [disabled];
60
73
  $[5] = disabled;
61
- $[6] = t3;
62
- } else {
63
- t3 = $[6];
64
- }
65
- let t4;
66
- if ($[7] !== disabled) {
67
- t4 = [disabled];
68
- $[7] = disabled;
69
- $[8] = t4;
74
+ $[6] = t5;
75
+ $[7] = t6;
70
76
  } else {
71
- t4 = $[8];
77
+ t5 = $[6];
78
+ t6 = $[7];
72
79
  }
73
- useEffect(t3, t4);
80
+ useEffect(t5, t6);
74
81
  }
82
+ function _temp$2() {}
75
83
 
76
- function useFormattedDate({
77
- format = null,
78
- showToday = true
79
- } = {}) {
84
+ function useFormattedDate(t0) {
85
+ const $ = c(7);
86
+ let t1;
87
+ if ($[0] !== t0) {
88
+ t1 = t0 === undefined ? {} : t0;
89
+ $[0] = t0;
90
+ $[1] = t1;
91
+ } else {
92
+ t1 = $[1];
93
+ }
94
+ const {
95
+ format: t2,
96
+ showToday: t3
97
+ } = t1;
98
+ const format = t2 === undefined ? null : t2;
99
+ const showToday = t3 === undefined ? true : t3;
80
100
  const intl = useIntl();
81
- const today = dayjs();
82
- return useCallback(date => {
83
- const dateToFormat = isString(date) ? dayjs(date) : date;
84
- if (showToday && dateToFormat.format('YYYY-MM-DD') === today.format('YYYY-MM-DD')) {
85
- return intl.formatMessage({
86
- id: "v4Qtl9"
101
+ let t4;
102
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
103
+ t4 = dayjs();
104
+ $[2] = t4;
105
+ } else {
106
+ t4 = $[2];
107
+ }
108
+ const today = t4;
109
+ let t5;
110
+ if ($[3] !== format || $[4] !== intl || $[5] !== showToday) {
111
+ t5 = date => {
112
+ const dateToFormat = dayjs(date);
113
+ if (showToday && dateToFormat.format("YYYY-MM-DD") === today.format("YYYY-MM-DD")) {
114
+ return intl.formatMessage({
115
+ id: "v4Qtl9"
116
+ });
117
+ }
118
+ return intl.formatDate(dateToFormat.toDate(), {
119
+ year: "numeric",
120
+ month: "long",
121
+ day: "2-digit",
122
+ ...format
87
123
  });
88
- }
89
- return intl.formatDate(dayjs(date).toDate(), {
90
- year: 'numeric',
91
- month: 'long',
92
- day: '2-digit',
93
- ...format
94
- });
95
- }, [today, showToday, format]);
124
+ };
125
+ $[3] = format;
126
+ $[4] = intl;
127
+ $[5] = showToday;
128
+ $[6] = t5;
129
+ } else {
130
+ t5 = $[6];
131
+ }
132
+ return t5;
96
133
  }
97
- function useFormattedTime({
98
- format = null,
99
- showNow = true,
100
- timeGap = 2
101
- } = {}) {
134
+ function useFormattedTime(t0) {
135
+ const $ = c(8);
136
+ let t1;
137
+ if ($[0] !== t0) {
138
+ t1 = t0 === undefined ? {} : t0;
139
+ $[0] = t0;
140
+ $[1] = t1;
141
+ } else {
142
+ t1 = $[1];
143
+ }
144
+ const {
145
+ format: t2,
146
+ showNow: t3,
147
+ timeGap: t4
148
+ } = t1;
149
+ const format = t2 === undefined ? null : t2;
150
+ const showNow = t3 === undefined ? true : t3;
151
+ const timeGap = t4 === undefined ? 2 : t4;
102
152
  const intl = useIntl();
103
- const now = dayjs();
104
- return useCallback(date => {
105
- const dateToFormat = isString(date) ? dayjs(date) : date;
106
- if (showNow && dateToFormat.format('YYYY-MM-DD') === now.format('YYYY-MM-DD') && dateToFormat.hour() === now.hour() && dateToFormat.minute() > now.minute() - timeGap && dateToFormat.minute() < now.minute() + timeGap) {
107
- return intl.formatMessage({
108
- id: "3na7F8"
153
+ let t5;
154
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
155
+ t5 = dayjs();
156
+ $[2] = t5;
157
+ } else {
158
+ t5 = $[2];
159
+ }
160
+ const now = t5;
161
+ let t6;
162
+ if ($[3] !== format || $[4] !== intl || $[5] !== showNow || $[6] !== timeGap) {
163
+ t6 = date => {
164
+ const dateToFormat = dayjs(date);
165
+ if (showNow && dateToFormat.format("YYYY-MM-DD") === now.format("YYYY-MM-DD") && dateToFormat.hour() === now.hour() && dateToFormat.minute() > now.minute() - timeGap && dateToFormat.minute() < now.minute() + timeGap) {
166
+ return intl.formatMessage({
167
+ id: "3na7F8"
168
+ });
169
+ }
170
+ return intl.formatTime(dateToFormat.toDate(), {
171
+ hour: "numeric",
172
+ minute: "numeric",
173
+ ...format
109
174
  });
110
- }
111
- return intl.formatTime(dateToFormat.toDate(), {
112
- hour: 'numeric',
113
- minute: 'numeric',
114
- ...format
115
- });
116
- }, [now, showNow, timeGap, format]);
175
+ };
176
+ $[3] = format;
177
+ $[4] = intl;
178
+ $[5] = showNow;
179
+ $[6] = timeGap;
180
+ $[7] = t6;
181
+ } else {
182
+ t6 = $[7];
183
+ }
184
+ return t6;
117
185
  }
118
186
 
119
187
  const eventsManager$1 = typeof document !== 'undefined' ? new EventsManager(document) : null;
@@ -156,7 +224,7 @@ function getFieldsPropsFromFields(fields, {
156
224
  ...(isObject(field) ? field : null),
157
225
  name,
158
226
  component,
159
- value: value !== null && name !== null ? value[name] || null : null,
227
+ value: value !== null && name !== null ? value[name] ?? null : null,
160
228
  errors: finalErrors.length > 0 ? finalErrors : null,
161
229
  onChange: fieldValue => onChange(name, fieldValue),
162
230
  fields: fieldFields !== null && isArray(fieldFields) ? getFieldsPropsFromFields(fieldFields, {
@@ -168,34 +236,84 @@ function getFieldsPropsFromFields(fields, {
168
236
  }];
169
237
  }, []);
170
238
  }
171
- function useForm(opts = {}) {
239
+ function useForm(t0) {
240
+ const $ = c(51);
241
+ let t1;
242
+ if ($[0] !== t0) {
243
+ t1 = t0 === undefined ? {} : t0;
244
+ $[0] = t0;
245
+ $[1] = t1;
246
+ } else {
247
+ t1 = $[1];
248
+ }
249
+ const opts = t1;
172
250
  const {
173
- fields = [],
174
- action = null,
175
- postForm = null,
176
- initialErrors = null,
177
- errors: providedErrors = null,
178
- setErrors: setProvidedErrors = null,
179
- initialGeneralError = null,
180
- generalError: providedGeneralError = null,
181
- setGeneralError: setProvidedGeneralError = null,
182
- initialValue = null,
183
- value: providedValue = null,
184
- setValue: setProvidedValue = null,
185
- withoutDefault = true,
186
- withoutPropagation = true,
187
- onComplete = null,
188
- onError = null,
189
- locales = []
251
+ fields: t2,
252
+ action: t3,
253
+ postForm: t4,
254
+ initialErrors: t5,
255
+ errors: t6,
256
+ setErrors: t7,
257
+ initialGeneralError: t8,
258
+ generalError: t9,
259
+ setGeneralError: t10,
260
+ initialValue: t11,
261
+ value: t12,
262
+ setValue: t13,
263
+ withoutDefault: t14,
264
+ withoutPropagation: t15,
265
+ onComplete: t16,
266
+ onError: t17,
267
+ locales: t18
190
268
  } = opts;
269
+ let t19;
270
+ if ($[2] !== t2) {
271
+ t19 = t2 === undefined ? [] : t2;
272
+ $[2] = t2;
273
+ $[3] = t19;
274
+ } else {
275
+ t19 = $[3];
276
+ }
277
+ const fields = t19;
278
+ const action = t3 === undefined ? null : t3;
279
+ const postForm = t4 === undefined ? null : t4;
280
+ const initialErrors = t5 === undefined ? null : t5;
281
+ const providedErrors = t6 === undefined ? null : t6;
282
+ const setProvidedErrors = t7 === undefined ? null : t7;
283
+ const initialGeneralError = t8 === undefined ? null : t8;
284
+ const providedGeneralError = t9 === undefined ? null : t9;
285
+ const setProvidedGeneralError = t10 === undefined ? null : t10;
286
+ const initialValue = t11 === undefined ? null : t11;
287
+ const providedValue = t12 === undefined ? null : t12;
288
+ const setProvidedValue = t13 === undefined ? null : t13;
289
+ const withoutDefault = t14 === undefined ? true : t14;
290
+ const withoutPropagation = t15 === undefined ? true : t15;
291
+ const onComplete = t16 === undefined ? null : t16;
292
+ const onError = t17 === undefined ? null : t17;
293
+ let t20;
294
+ if ($[4] !== t18) {
295
+ t20 = t18 === undefined ? [] : t18;
296
+ $[4] = t18;
297
+ $[5] = t20;
298
+ } else {
299
+ t20 = $[5];
300
+ }
301
+ const locales = t20;
191
302
  const [stateValue, setStateValue] = useState(initialValue || providedValue);
192
303
  const [stateErrors, setStateErrors] = useState(initialErrors || providedErrors);
193
304
  const [stateGeneralError, setStateGeneralError] = useState(initialGeneralError || providedGeneralError);
194
- const [requestState, setRequestState] = useState({
195
- success: false,
196
- loading: false,
197
- error: false
198
- });
305
+ let t21;
306
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
307
+ t21 = {
308
+ success: false,
309
+ loading: false,
310
+ error: false
311
+ };
312
+ $[6] = t21;
313
+ } else {
314
+ t21 = $[6];
315
+ }
316
+ const [requestState, setRequestState] = useState(t21);
199
317
  const [response, setResponse] = useState(null);
200
318
  const hasProvidedValue = setProvidedValue !== null;
201
319
  const value = hasProvidedValue ? providedValue : stateValue;
@@ -206,127 +324,244 @@ function useForm(opts = {}) {
206
324
  const hasProvidedGeneralError = setProvidedGeneralError !== null;
207
325
  const generalError = hasProvidedGeneralError ? providedGeneralError : stateGeneralError;
208
326
  const setGeneralError = hasProvidedGeneralError ? setProvidedGeneralError : setStateGeneralError;
209
- const onFieldChange = useCallback((fieldName, fieldValue) => {
210
- const {
211
- loading = false,
212
- success = false,
213
- error: requestError = false
214
- } = requestState || {};
215
- const fieldErrors = errors !== null ? errors[fieldName] || null : null;
216
- if (fieldErrors !== null) {
217
- setErrors({
218
- ...errors,
219
- [fieldName]: null
327
+ let t22;
328
+ if ($[7] !== errors || $[8] !== requestState || $[9] !== setErrors || $[10] !== setValue || $[11] !== value) {
329
+ t22 = (fieldName, fieldValue) => {
330
+ const {
331
+ loading: t23,
332
+ success: t24,
333
+ error: t25
334
+ } = requestState || {};
335
+ const loading = t23 === undefined ? false : t23;
336
+ const success = t24 === undefined ? false : t24;
337
+ const requestError = t25 === undefined ? false : t25;
338
+ const fieldErrors = errors !== null ? errors[fieldName] || null : null;
339
+ if (fieldErrors !== null) {
340
+ setErrors({
341
+ ...errors,
342
+ [fieldName]: null
343
+ });
344
+ }
345
+ if (!loading && (success !== false || requestError !== false)) {
346
+ setRequestState({
347
+ success: false,
348
+ loading: false,
349
+ error: false
350
+ });
351
+ }
352
+ setValue({
353
+ ...(value || {}),
354
+ [fieldName]: fieldValue
220
355
  });
221
- }
222
- if (!loading && (success !== false || requestError !== false)) {
356
+ };
357
+ $[7] = errors;
358
+ $[8] = requestState;
359
+ $[9] = setErrors;
360
+ $[10] = setValue;
361
+ $[11] = value;
362
+ $[12] = t22;
363
+ } else {
364
+ t22 = $[12];
365
+ }
366
+ const onFieldChange = t22;
367
+ let t23;
368
+ if ($[13] !== errors || $[14] !== fields || $[15] !== locales || $[16] !== onFieldChange || $[17] !== value) {
369
+ t23 = getFieldsPropsFromFields(fields, {
370
+ value,
371
+ errors,
372
+ onChange: onFieldChange
373
+ }, locales);
374
+ $[13] = errors;
375
+ $[14] = fields;
376
+ $[15] = locales;
377
+ $[16] = onFieldChange;
378
+ $[17] = value;
379
+ $[18] = t23;
380
+ } else {
381
+ t23 = $[18];
382
+ }
383
+ const fieldsProps = t23;
384
+ let t24;
385
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
386
+ t24 = getCsrfToken();
387
+ $[19] = t24;
388
+ } else {
389
+ t24 = $[19];
390
+ }
391
+ const csrfToken = t24;
392
+ let t25;
393
+ if ($[20] !== onError || $[21] !== setErrors || $[22] !== setGeneralError) {
394
+ t25 = error => {
223
395
  setRequestState({
224
396
  success: false,
225
397
  loading: false,
398
+ error: true
399
+ });
400
+ if (error.name === "ValidationError") {
401
+ const {
402
+ errors: t26
403
+ } = error.getResponseData();
404
+ const validationErrors = t26 === undefined ? null : t26;
405
+ setErrors(validationErrors || null);
406
+ } else {
407
+ setGeneralError(error.message);
408
+ }
409
+ if (onError !== null) {
410
+ onError(error);
411
+ }
412
+ };
413
+ $[20] = onError;
414
+ $[21] = setErrors;
415
+ $[22] = setGeneralError;
416
+ $[23] = t25;
417
+ } else {
418
+ t25 = $[23];
419
+ }
420
+ const onSubmitError = t25;
421
+ let t26;
422
+ if ($[24] !== onComplete) {
423
+ t26 = resp => {
424
+ setRequestState({
425
+ success: true,
426
+ loading: false,
226
427
  error: false
227
428
  });
228
- }
229
- setValue({
230
- ...(value || {}),
231
- [fieldName]: fieldValue
232
- });
233
- }, [value, errors, requestState, setErrors, setValue, ...fields]);
234
- const fieldsProps = useMemo(() => getFieldsPropsFromFields(fields, {
235
- value,
236
- errors,
237
- onChange: onFieldChange
238
- }, locales), [value, errors, locales, fields, onFieldChange, ...fields]);
239
- const csrfToken = useMemo(() => getCsrfToken(), []);
240
- const onSubmitError = error => {
241
- setRequestState({
242
- success: false,
243
- loading: false,
244
- error: true
245
- });
246
- if (error.name === 'ValidationError') {
247
- const {
248
- errors: validationErrors = null
249
- } = error.getResponseData();
250
- setErrors(validationErrors || null);
251
- } else {
252
- setGeneralError(error.message);
253
- }
254
- if (onError !== null) {
255
- onError(error);
256
- }
257
- };
258
- const onSubmitSuccess = resp => {
259
- setRequestState({
260
- success: true,
261
- loading: false,
262
- error: false
263
- });
264
- setResponse(resp);
265
- if (onComplete !== null) {
266
- onComplete(resp);
267
- }
268
- };
269
- const finalPostForm = useCallback((postAction, postData) => postForm !== null ? postForm(postAction, postData) : postJSON(postAction, postData, {
270
- credentials: 'include',
271
- headers: getCSRFHeaders()
272
- }), [postForm]);
273
- const submit = useCallback((submitValue = value) => {
274
- setRequestState({
275
- success: false,
276
- loading: true,
277
- error: false
429
+ setResponse(resp);
430
+ if (onComplete !== null) {
431
+ onComplete(resp);
432
+ }
433
+ };
434
+ $[24] = onComplete;
435
+ $[25] = t26;
436
+ } else {
437
+ t26 = $[25];
438
+ }
439
+ const onSubmitSuccess = t26;
440
+ let t27;
441
+ if ($[26] !== postForm) {
442
+ t27 = (postAction, postData) => postForm !== null ? postForm(postAction, postData) : postJSON(postAction, postData, {
443
+ credentials: "include",
444
+ headers: getCSRFHeaders()
278
445
  });
279
- setGeneralError(null);
280
- setErrors(null);
281
- finalPostForm(action, {
282
- ...(submitValue || {}),
283
- _token: csrfToken
284
- }).then(onSubmitSuccess).catch(onSubmitError);
285
- }, [value, setGeneralError, setErrors, finalPostForm, action, csrfToken, onSubmitSuccess, onSubmitError]);
286
- const onSubmit = useCallback(e => {
287
- if (withoutDefault) {
288
- e.preventDefault();
289
- }
290
- if (withoutPropagation) {
291
- e.stopPropagation();
292
- }
293
- // This one is very important with multiple forms
294
- // Nested forms (even in portals) will bubble the onSubmit event to the parent
295
- submit();
296
- }, [submit, withoutDefault, withoutPropagation]);
446
+ $[26] = postForm;
447
+ $[27] = t27;
448
+ } else {
449
+ t27 = $[27];
450
+ }
451
+ const finalPostForm = t27;
452
+ let t28;
453
+ if ($[28] !== action || $[29] !== finalPostForm || $[30] !== onSubmitError || $[31] !== onSubmitSuccess || $[32] !== setErrors || $[33] !== setGeneralError || $[34] !== value) {
454
+ t28 = t29 => {
455
+ const submitValue = t29 === undefined ? value : t29;
456
+ setRequestState({
457
+ success: false,
458
+ loading: true,
459
+ error: false
460
+ });
461
+ setGeneralError(null);
462
+ setErrors(null);
463
+ finalPostForm(action, {
464
+ ...(submitValue || {}),
465
+ _token: csrfToken
466
+ }).then(onSubmitSuccess).catch(onSubmitError);
467
+ };
468
+ $[28] = action;
469
+ $[29] = finalPostForm;
470
+ $[30] = onSubmitError;
471
+ $[31] = onSubmitSuccess;
472
+ $[32] = setErrors;
473
+ $[33] = setGeneralError;
474
+ $[34] = value;
475
+ $[35] = t28;
476
+ } else {
477
+ t28 = $[35];
478
+ }
479
+ const submit = t28;
480
+ let t29;
481
+ if ($[36] !== submit || $[37] !== withoutDefault || $[38] !== withoutPropagation) {
482
+ t29 = e => {
483
+ if (withoutDefault) {
484
+ e.preventDefault();
485
+ }
486
+ if (withoutPropagation) {
487
+ e.stopPropagation();
488
+ }
489
+ submit();
490
+ };
491
+ $[36] = submit;
492
+ $[37] = withoutDefault;
493
+ $[38] = withoutPropagation;
494
+ $[39] = t29;
495
+ } else {
496
+ t29 = $[39];
497
+ }
498
+ const onSubmit = t29;
297
499
  let status = null;
298
500
  if (requestState.loading) {
299
- status = 'loading';
300
- } else if (requestState.success) {
301
- status = 'success';
302
- } else if (requestState.error) {
303
- status = 'error';
501
+ status = "loading";
502
+ } else {
503
+ if (requestState.success) {
504
+ status = "success";
505
+ } else {
506
+ if (requestState.error) {
507
+ status = "error";
508
+ }
509
+ }
304
510
  }
305
- return {
306
- value,
307
- setValue,
308
- csrfToken,
309
- submit,
310
- onSubmit,
311
- ...requestState,
312
- status,
313
- response,
314
- fields: fieldsProps,
315
- errors,
316
- generalError
317
- };
511
+ let t30;
512
+ if ($[40] !== errors || $[41] !== fieldsProps || $[42] !== generalError || $[43] !== onSubmit || $[44] !== requestState || $[45] !== response || $[46] !== setValue || $[47] !== status || $[48] !== submit || $[49] !== value) {
513
+ t30 = {
514
+ value,
515
+ setValue,
516
+ csrfToken,
517
+ submit,
518
+ onSubmit,
519
+ ...requestState,
520
+ status,
521
+ response,
522
+ fields: fieldsProps,
523
+ errors,
524
+ generalError
525
+ };
526
+ $[40] = errors;
527
+ $[41] = fieldsProps;
528
+ $[42] = generalError;
529
+ $[43] = onSubmit;
530
+ $[44] = requestState;
531
+ $[45] = response;
532
+ $[46] = setValue;
533
+ $[47] = status;
534
+ $[48] = submit;
535
+ $[49] = value;
536
+ $[50] = t30;
537
+ } else {
538
+ t30 = $[50];
539
+ }
540
+ return t30;
318
541
  }
319
542
 
320
543
  function buildThresholdArray() {
321
544
  return [0, 1.0];
322
545
  }
323
546
  const observersCache = new Map();
547
+
548
+ // Give each root element a unique id so observers with different roots are not shared
549
+ const rootIds = new WeakMap();
550
+ let lastRootId = 0;
551
+ function getRootId(root) {
552
+ if (!rootIds.has(root)) {
553
+ lastRootId += 1;
554
+ rootIds.set(root, lastRootId);
555
+ }
556
+ return rootIds.get(root);
557
+ }
324
558
  function getOptionsKey({
325
559
  root = null,
326
560
  rootMargin,
327
561
  threshold = null
328
562
  }) {
329
- return `root_${root}_rootMargin_${rootMargin || null}_threshold_${threshold}`;
563
+ const rootKey = root !== null ? getRootId(root) : null;
564
+ return `root_${rootKey}_rootMargin_${rootMargin || null}_threshold_${threshold}`;
330
565
  }
331
566
  function createObserver(Observer, options = {}) {
332
567
  let subscribers = [];
@@ -404,52 +639,127 @@ function getObserver(Observer, options = {}) {
404
639
  }
405
640
  return observers[observerKey];
406
641
  }
407
- function useObserver(Observer, opts = {}, initialEntry = {}) {
642
+ function useObserver(Observer, t0, t1) {
643
+ const $ = c(14);
644
+ let t2;
645
+ if ($[0] !== t0) {
646
+ t2 = t0 === undefined ? {} : t0;
647
+ $[0] = t0;
648
+ $[1] = t2;
649
+ } else {
650
+ t2 = $[1];
651
+ }
652
+ const opts = t2;
653
+ let t3;
654
+ if ($[2] !== t1) {
655
+ t3 = t1 === undefined ? {} : t1;
656
+ $[2] = t1;
657
+ $[3] = t3;
658
+ } else {
659
+ t3 = $[3];
660
+ }
661
+ const initialEntry = t3;
408
662
  const {
409
- root = null,
410
- rootMargin = null,
411
- threshold = null,
412
- disabled = false
663
+ root: t4,
664
+ rootMargin: t5,
665
+ threshold: t6,
666
+ disabled: t7
413
667
  } = opts;
668
+ const root = t4 === undefined ? null : t4;
669
+ const rootMargin = t5 === undefined ? null : t5;
670
+ const threshold = t6 === undefined ? null : t6;
671
+ const disabled = t7 === undefined ? false : t7;
414
672
  const [entry, setEntry] = useState(initialEntry);
415
673
  const nodeRef = useRef(null);
416
- const currentElement = useRef(null);
417
- const elementChanged = nodeRef.current !== currentElement.current;
418
- useEffect(() => {
419
- const {
420
- current: nodeElement
421
- } = nodeRef;
422
- const callback = newEntry => setEntry(newEntry);
423
- let unsubscribe = null;
424
- if (nodeElement !== null && Observer !== null) {
425
- const newOpts = {};
426
- if (root !== null) {
427
- newOpts.root = root;
674
+ const subscriptionRef = useRef(null);
675
+ let t8;
676
+ if ($[4] !== Observer || $[5] !== disabled || $[6] !== root || $[7] !== rootMargin || $[8] !== threshold) {
677
+ t8 = () => {
678
+ const {
679
+ current: nodeElement
680
+ } = nodeRef;
681
+ const {
682
+ current: currentSubscription
683
+ } = subscriptionRef;
684
+ if (currentSubscription !== null && currentSubscription.element === nodeElement && currentSubscription.Observer === Observer && currentSubscription.disabled === disabled && currentSubscription.root === root && currentSubscription.rootMargin === rootMargin && currentSubscription.threshold === threshold) {
685
+ return;
428
686
  }
429
- if (rootMargin !== null) {
430
- newOpts.rootMargin = rootMargin;
687
+ if (currentSubscription !== null && currentSubscription.unsubscribe !== null && currentSubscription.element !== null) {
688
+ currentSubscription.unsubscribe(currentSubscription.element, currentSubscription.callback);
431
689
  }
432
- if (threshold !== null) {
433
- newOpts.threshold = threshold;
690
+ const callback = newEntry => setEntry(newEntry);
691
+ let unsubscribe = null;
692
+ if (!disabled && nodeElement !== null && Observer !== null) {
693
+ const newOpts = {};
694
+ if (root !== null) {
695
+ newOpts.root = root;
696
+ }
697
+ if (rootMargin !== null) {
698
+ newOpts.rootMargin = rootMargin;
699
+ }
700
+ if (threshold !== null) {
701
+ newOpts.threshold = threshold;
702
+ }
703
+ const {
704
+ subscribe,
705
+ unsubscribe: localUnsubscribe
706
+ } = getObserver(Observer, newOpts);
707
+ unsubscribe = localUnsubscribe;
708
+ subscribe(nodeElement, callback);
434
709
  }
710
+ subscriptionRef.current = {
711
+ element: nodeElement,
712
+ Observer,
713
+ disabled,
714
+ root,
715
+ rootMargin,
716
+ threshold,
717
+ unsubscribe,
718
+ callback
719
+ };
720
+ };
721
+ $[4] = Observer;
722
+ $[5] = disabled;
723
+ $[6] = root;
724
+ $[7] = rootMargin;
725
+ $[8] = threshold;
726
+ $[9] = t8;
727
+ } else {
728
+ t8 = $[9];
729
+ }
730
+ useEffect(t8);
731
+ let t10;
732
+ let t9;
733
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
734
+ t9 = () => () => {
435
735
  const {
436
- subscribe,
437
- unsubscribe: localUnsubscribe
438
- } = getObserver(Observer, newOpts);
439
- unsubscribe = localUnsubscribe;
440
- subscribe(nodeElement, callback);
441
- }
442
- currentElement.current = nodeElement;
443
- return () => {
444
- if (unsubscribe !== null && nodeElement !== null) {
445
- unsubscribe(nodeElement, callback);
736
+ current: currentSubscription_0
737
+ } = subscriptionRef;
738
+ if (currentSubscription_0 !== null && currentSubscription_0.unsubscribe !== null && currentSubscription_0.element !== null) {
739
+ currentSubscription_0.unsubscribe(currentSubscription_0.element, currentSubscription_0.callback);
446
740
  }
741
+ subscriptionRef.current = null;
447
742
  };
448
- }, [Observer, elementChanged, disabled, root, rootMargin, threshold]);
449
- return {
450
- ref: nodeRef,
451
- entry
452
- };
743
+ t10 = [];
744
+ $[10] = t10;
745
+ $[11] = t9;
746
+ } else {
747
+ t10 = $[10];
748
+ t9 = $[11];
749
+ }
750
+ useEffect(t9, t10);
751
+ let t11;
752
+ if ($[12] !== entry) {
753
+ t11 = {
754
+ ref: nodeRef,
755
+ entry
756
+ };
757
+ $[12] = entry;
758
+ $[13] = t11;
759
+ } else {
760
+ t11 = $[13];
761
+ }
762
+ return t11;
453
763
  }
454
764
 
455
765
  /**
@@ -542,29 +852,61 @@ function useResizeObserver(t0) {
542
852
  return useObserver(typeof window !== "undefined" ? ResizeObserver : null, t3, resizeObserverInitialEntry);
543
853
  }
544
854
 
545
- function useIsVisible({
546
- rootMargin,
547
- threshold = 1,
548
- persist = false
549
- } = {}) {
855
+ function useIsVisible(t0) {
856
+ const $ = c(8);
857
+ let t1;
858
+ if ($[0] !== t0) {
859
+ t1 = t0 === undefined ? {} : t0;
860
+ $[0] = t0;
861
+ $[1] = t1;
862
+ } else {
863
+ t1 = $[1];
864
+ }
550
865
  const {
551
- ref,
552
- entry: {
553
- isIntersecting
554
- }
555
- } = useIntersectionObserver({
556
866
  rootMargin,
557
- threshold
558
- });
559
- const wasIntersecting = useRef(isIntersecting);
560
- if (isIntersecting && !wasIntersecting.current) {
561
- wasIntersecting.current = isIntersecting;
867
+ threshold: t2,
868
+ persist: t3
869
+ } = t1;
870
+ const threshold = t2 === undefined ? 1 : t2;
871
+ const persist = t3 === undefined ? false : t3;
872
+ let t4;
873
+ if ($[2] !== rootMargin || $[3] !== threshold) {
874
+ t4 = {
875
+ rootMargin,
876
+ threshold
877
+ };
878
+ $[2] = rootMargin;
879
+ $[3] = threshold;
880
+ $[4] = t4;
881
+ } else {
882
+ t4 = $[4];
562
883
  }
563
- const isVisible = !persist && isIntersecting || persist && wasIntersecting.current;
564
- return {
884
+ const {
565
885
  ref,
566
- visible: isVisible
567
- };
886
+ entry: t5
887
+ } = useIntersectionObserver(t4);
888
+ const {
889
+ isIntersecting
890
+ } = t5;
891
+ const [wasIntersecting, setWasIntersecting] = useState(isIntersecting);
892
+ if (isIntersecting && !wasIntersecting) {
893
+ setWasIntersecting(true);
894
+ }
895
+ const hasIntersected = wasIntersecting || isIntersecting;
896
+ const isVisible = !persist && isIntersecting || persist && hasIntersected;
897
+ let t6;
898
+ if ($[5] !== isVisible || $[6] !== ref) {
899
+ t6 = {
900
+ ref,
901
+ visible: isVisible
902
+ };
903
+ $[5] = isVisible;
904
+ $[6] = ref;
905
+ $[7] = t6;
906
+ } else {
907
+ t6 = $[7];
908
+ }
909
+ return t6;
568
910
  }
569
911
 
570
912
  const KEYCODES = {
@@ -652,6 +994,7 @@ function useKeyboardKeys(t0, t1) {
652
994
  useEffect(t7, t8);
653
995
  }
654
996
 
997
+ const loadWebFontLoader = () => import('webfontloader');
655
998
  const fontsMap = {
656
999
  loading: [],
657
1000
  active: []
@@ -674,50 +1017,84 @@ function addFontActive(name) {
674
1017
  fontsMap.active = [...fontsMap.active, name];
675
1018
  }
676
1019
  function useLoadedFonts(fonts) {
1020
+ const $ = c(5);
677
1021
  const [loaded, setLoaded] = useState(false);
678
- useEffect(() => {
679
- const config = fonts.reduce((newConfig, font) => {
680
- const {
681
- type,
682
- name
683
- } = isObject(font) ? font : {
684
- type: 'system',
685
- name: font
686
- };
687
- if ((type === 'google' || type === 'custom') && !isFontLoading(name) && !isFontActive(name)) {
688
- return {
689
- ...newConfig,
690
- [type]: {
691
- families: [...(newConfig !== null ? (newConfig[type] || {}).families || [] : []), name]
692
- }
693
- };
1022
+ let t0;
1023
+ let t1;
1024
+ if ($[0] !== fonts) {
1025
+ t0 = () => {
1026
+ const config = fonts.reduce(_temp$1, null);
1027
+ const hasConfig = config !== null;
1028
+ if (hasConfig && typeof window !== "undefined") {
1029
+ loadPackage("webfontloader", loadWebFontLoader).then(t2 => {
1030
+ const {
1031
+ default: WebFont
1032
+ } = t2;
1033
+ return WebFont.load({
1034
+ ...config,
1035
+ timeout: 3000,
1036
+ active: () => setLoaded(true),
1037
+ fontloading: _temp2,
1038
+ fontactive: _temp3,
1039
+ fontinactive: _temp4
1040
+ });
1041
+ });
1042
+ } else {
1043
+ setLoaded(true);
694
1044
  }
695
- return newConfig;
696
- }, null);
697
- const hasConfig = config !== null;
698
- if (hasConfig && typeof window !== 'undefined') {
699
- loadPackage('webfontloader', () => import('webfontloader')).then(({
700
- default: WebFont
701
- }) => WebFont.load({
702
- ...config,
703
- timeout: 3000,
704
- active: () => setLoaded(true),
705
- fontloading: name_0 => addFontLoading(name_0),
706
- fontactive: name_1 => addFontActive(name_1),
707
- fontinactive: name_2 => removeFontLoading(name_2)
708
- }));
709
- } else {
710
- setLoaded(true);
711
- }
712
- }, [fonts, setLoaded]);
713
- return {
714
- loaded
1045
+ };
1046
+ t1 = [fonts, setLoaded];
1047
+ $[0] = fonts;
1048
+ $[1] = t0;
1049
+ $[2] = t1;
1050
+ } else {
1051
+ t0 = $[1];
1052
+ t1 = $[2];
1053
+ }
1054
+ useEffect(t0, t1);
1055
+ let t2;
1056
+ if ($[3] !== loaded) {
1057
+ t2 = {
1058
+ loaded
1059
+ };
1060
+ $[3] = loaded;
1061
+ $[4] = t2;
1062
+ } else {
1063
+ t2 = $[4];
1064
+ }
1065
+ return t2;
1066
+ }
1067
+ function _temp4(name_2) {
1068
+ return removeFontLoading(name_2);
1069
+ }
1070
+ function _temp3(name_1) {
1071
+ return addFontActive(name_1);
1072
+ }
1073
+ function _temp2(name_0) {
1074
+ return addFontLoading(name_0);
1075
+ }
1076
+ function _temp$1(newConfig, font) {
1077
+ const {
1078
+ type,
1079
+ name
1080
+ } = isObject(font) ? font : {
1081
+ type: "system",
1082
+ name: font
715
1083
  };
1084
+ if ((type === "google" || type === "custom") && !isFontLoading(name) && !isFontActive(name)) {
1085
+ return {
1086
+ ...newConfig,
1087
+ [type]: {
1088
+ families: [...(newConfig !== null ? (newConfig[type] || {}).families || [] : []), name]
1089
+ }
1090
+ };
1091
+ }
1092
+ return newConfig;
716
1093
  }
717
1094
 
718
1095
  const progressSteps = [0.1, 0.25, 0.5, 0.75, 0.9];
719
1096
  function useMediaApi(t0) {
720
- const $ = c(54);
1097
+ const $ = c(66);
721
1098
  let t1;
722
1099
  if ($[0] !== t0) {
723
1100
  t1 = t0 === undefined ? {} : t0;
@@ -1059,34 +1436,16 @@ function useMediaApi(t0) {
1059
1436
  const onCustomCanPlayThrough = t31;
1060
1437
  let t32;
1061
1438
  if ($[33] !== onCustomCanPlayThrough || $[34] !== onCustomDurationChange || $[35] !== onCustomEnded || $[36] !== onCustomLoadStart || $[37] !== onCustomPause || $[38] !== onCustomPlay || $[39] !== onCustomSeeked || $[40] !== onCustomTimeUpdate || $[41] !== onCustomVolumeChange) {
1062
- t32 = () => {
1063
- const {
1064
- current: media_13
1065
- } = ref;
1066
- if (media_13 !== null) {
1067
- media_13.addEventListener("timeupdate", onCustomTimeUpdate);
1068
- media_13.addEventListener("durationchange", onCustomDurationChange);
1069
- media_13.addEventListener("volumechange", onCustomVolumeChange);
1070
- media_13.addEventListener("play", onCustomPlay);
1071
- media_13.addEventListener("pause", onCustomPause);
1072
- media_13.addEventListener("ended", onCustomEnded);
1073
- media_13.addEventListener("seeked", onCustomSeeked);
1074
- media_13.addEventListener("loadstart", onCustomLoadStart);
1075
- media_13.addEventListener("canplaythrough", onCustomCanPlayThrough);
1076
- }
1077
- return () => {
1078
- if (media_13 !== null) {
1079
- media_13.removeEventListener("timeupdate", onCustomTimeUpdate);
1080
- media_13.removeEventListener("durationchange", onCustomDurationChange);
1081
- media_13.removeEventListener("volumechange", onCustomVolumeChange);
1082
- media_13.removeEventListener("play", onCustomPlay);
1083
- media_13.removeEventListener("pause", onCustomPause);
1084
- media_13.removeEventListener("ended", onCustomEnded);
1085
- media_13.removeEventListener("seeked", onCustomSeeked);
1086
- media_13.removeEventListener("loadstart", onCustomLoadStart);
1087
- media_13.removeEventListener("canplaythrough", onCustomCanPlayThrough);
1088
- }
1089
- };
1439
+ t32 = {
1440
+ timeupdate: onCustomTimeUpdate,
1441
+ durationchange: onCustomDurationChange,
1442
+ volumechange: onCustomVolumeChange,
1443
+ play: onCustomPlay,
1444
+ pause: onCustomPause,
1445
+ ended: onCustomEnded,
1446
+ seeked: onCustomSeeked,
1447
+ loadstart: onCustomLoadStart,
1448
+ canplaythrough: onCustomCanPlayThrough
1090
1449
  };
1091
1450
  $[33] = onCustomCanPlayThrough;
1092
1451
  $[34] = onCustomDurationChange;
@@ -1101,18 +1460,97 @@ function useMediaApi(t0) {
1101
1460
  } else {
1102
1461
  t32 = $[42];
1103
1462
  }
1463
+ const handlersRef = useRef(t32);
1104
1464
  let t33;
1105
- if ($[43] !== url) {
1106
- t33 = [url];
1107
- $[43] = url;
1108
- $[44] = t33;
1465
+ let t34;
1466
+ if ($[43] !== onCustomCanPlayThrough || $[44] !== onCustomDurationChange || $[45] !== onCustomEnded || $[46] !== onCustomLoadStart || $[47] !== onCustomPause || $[48] !== onCustomPlay || $[49] !== onCustomSeeked || $[50] !== onCustomTimeUpdate || $[51] !== onCustomVolumeChange) {
1467
+ t33 = () => {
1468
+ handlersRef.current = {
1469
+ timeupdate: onCustomTimeUpdate,
1470
+ durationchange: onCustomDurationChange,
1471
+ volumechange: onCustomVolumeChange,
1472
+ play: onCustomPlay,
1473
+ pause: onCustomPause,
1474
+ ended: onCustomEnded,
1475
+ seeked: onCustomSeeked,
1476
+ loadstart: onCustomLoadStart,
1477
+ canplaythrough: onCustomCanPlayThrough
1478
+ };
1479
+ };
1480
+ t34 = [onCustomTimeUpdate, onCustomDurationChange, onCustomVolumeChange, onCustomPlay, onCustomPause, onCustomEnded, onCustomSeeked, onCustomLoadStart, onCustomCanPlayThrough];
1481
+ $[43] = onCustomCanPlayThrough;
1482
+ $[44] = onCustomDurationChange;
1483
+ $[45] = onCustomEnded;
1484
+ $[46] = onCustomLoadStart;
1485
+ $[47] = onCustomPause;
1486
+ $[48] = onCustomPlay;
1487
+ $[49] = onCustomSeeked;
1488
+ $[50] = onCustomTimeUpdate;
1489
+ $[51] = onCustomVolumeChange;
1490
+ $[52] = t33;
1491
+ $[53] = t34;
1109
1492
  } else {
1110
- t33 = $[44];
1493
+ t33 = $[52];
1494
+ t34 = $[53];
1111
1495
  }
1112
- useEffect(t32, t33);
1113
- let t34;
1114
- if ($[45] !== currentTime || $[46] !== duration || $[47] !== muted || $[48] !== paused || $[49] !== playing || $[50] !== ready || $[51] !== toggleMute || $[52] !== togglePlay) {
1115
- t34 = {
1496
+ useEffect(t33, t34);
1497
+ let t35;
1498
+ if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
1499
+ t35 = () => {
1500
+ const {
1501
+ current: media_13
1502
+ } = ref;
1503
+ progressStepsReached.current = {};
1504
+ const onMediaTimeUpdate = () => handlersRef.current.timeupdate();
1505
+ const onMediaDurationChange = () => handlersRef.current.durationchange();
1506
+ const onMediaVolumeChange = () => handlersRef.current.volumechange();
1507
+ const onMediaPlay = () => handlersRef.current.play();
1508
+ const onMediaPause = () => handlersRef.current.pause();
1509
+ const onMediaEnded = () => handlersRef.current.ended();
1510
+ const onMediaSeeked = () => handlersRef.current.seeked();
1511
+ const onMediaLoadStart = () => handlersRef.current.loadstart();
1512
+ const onMediaCanPlayThrough = () => handlersRef.current.canplaythrough();
1513
+ if (media_13 !== null) {
1514
+ media_13.addEventListener("timeupdate", onMediaTimeUpdate);
1515
+ media_13.addEventListener("durationchange", onMediaDurationChange);
1516
+ media_13.addEventListener("volumechange", onMediaVolumeChange);
1517
+ media_13.addEventListener("play", onMediaPlay);
1518
+ media_13.addEventListener("pause", onMediaPause);
1519
+ media_13.addEventListener("ended", onMediaEnded);
1520
+ media_13.addEventListener("seeked", onMediaSeeked);
1521
+ media_13.addEventListener("loadstart", onMediaLoadStart);
1522
+ media_13.addEventListener("canplaythrough", onMediaCanPlayThrough);
1523
+ }
1524
+ return () => {
1525
+ if (media_13 !== null) {
1526
+ media_13.removeEventListener("timeupdate", onMediaTimeUpdate);
1527
+ media_13.removeEventListener("durationchange", onMediaDurationChange);
1528
+ media_13.removeEventListener("volumechange", onMediaVolumeChange);
1529
+ media_13.removeEventListener("play", onMediaPlay);
1530
+ media_13.removeEventListener("pause", onMediaPause);
1531
+ media_13.removeEventListener("ended", onMediaEnded);
1532
+ media_13.removeEventListener("seeked", onMediaSeeked);
1533
+ media_13.removeEventListener("loadstart", onMediaLoadStart);
1534
+ media_13.removeEventListener("canplaythrough", onMediaCanPlayThrough);
1535
+ }
1536
+ };
1537
+ };
1538
+ $[54] = t35;
1539
+ } else {
1540
+ t35 = $[54];
1541
+ }
1542
+ let t36;
1543
+ if ($[55] !== url) {
1544
+ t36 = [url];
1545
+ $[55] = url;
1546
+ $[56] = t36;
1547
+ } else {
1548
+ t36 = $[56];
1549
+ }
1550
+ useEffect(t35, t36);
1551
+ let t37;
1552
+ if ($[57] !== currentTime || $[58] !== duration || $[59] !== muted || $[60] !== paused || $[61] !== playing || $[62] !== ready || $[63] !== toggleMute || $[64] !== togglePlay) {
1553
+ t37 = {
1116
1554
  ref,
1117
1555
  play,
1118
1556
  pause,
@@ -1129,19 +1567,19 @@ function useMediaApi(t0) {
1129
1567
  paused,
1130
1568
  ready
1131
1569
  };
1132
- $[45] = currentTime;
1133
- $[46] = duration;
1134
- $[47] = muted;
1135
- $[48] = paused;
1136
- $[49] = playing;
1137
- $[50] = ready;
1138
- $[51] = toggleMute;
1139
- $[52] = togglePlay;
1140
- $[53] = t34;
1141
- } else {
1142
- t34 = $[53];
1143
- }
1144
- return t34;
1570
+ $[57] = currentTime;
1571
+ $[58] = duration;
1572
+ $[59] = muted;
1573
+ $[60] = paused;
1574
+ $[61] = playing;
1575
+ $[62] = ready;
1576
+ $[63] = toggleMute;
1577
+ $[64] = togglePlay;
1578
+ $[65] = t37;
1579
+ } else {
1580
+ t37 = $[65];
1581
+ }
1582
+ return t37;
1145
1583
  }
1146
1584
 
1147
1585
  function useMediasParser() {
@@ -1281,7 +1719,7 @@ function useResourceUrlGenerator(t0) {
1281
1719
  t2 = (routeResourceId, t3, t4) => {
1282
1720
  const routeName = t3 === undefined ? null : t3;
1283
1721
  const params = t4 === undefined ? null : t4;
1284
- const hasResourceId = isString$1(routeName);
1722
+ const hasResourceId = isString(routeName);
1285
1723
  const finalRouteName = hasResourceId ? routeName : routeResourceId;
1286
1724
  const finalParams = hasResourceId ? params : routeName;
1287
1725
  const finalResource = hasResourceId ? getResource(resources, routeResourceId) : resource;
@@ -1313,15 +1751,19 @@ function useQuery(t0, t1) {
1313
1751
  const $ = c(15);
1314
1752
  const initialBaseQuery = t0 === undefined ? null : t0;
1315
1753
  const paginated = t1 === undefined ? true : t1;
1754
+ const [stableBaseQuery, setStableBaseQuery] = useState(initialBaseQuery);
1755
+ if (!isEqual(stableBaseQuery, initialBaseQuery)) {
1756
+ setStableBaseQuery(initialBaseQuery);
1757
+ }
1316
1758
  let t2;
1317
- if ($[0] !== initialBaseQuery || $[1] !== paginated) {
1759
+ if ($[0] !== paginated || $[1] !== stableBaseQuery) {
1318
1760
  t2 = paginated ? {
1319
1761
  page: 1,
1320
1762
  count: 10,
1321
- ...(initialBaseQuery || {})
1322
- } : initialBaseQuery || null;
1323
- $[0] = initialBaseQuery;
1324
- $[1] = paginated;
1763
+ ...(stableBaseQuery || {})
1764
+ } : stableBaseQuery || null;
1765
+ $[0] = paginated;
1766
+ $[1] = stableBaseQuery;
1325
1767
  $[2] = t2;
1326
1768
  } else {
1327
1769
  t2 = $[2];