@panneau/core 4.0.37 → 4.0.40-alpha.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/contexts.d.ts +78 -34
- package/dist/contexts.js +1332 -621
- package/dist/hooks.d.ts +41 -0
- package/dist/hooks.js +1395 -847
- package/dist/index.d.ts +26 -9
- package/dist/index.js +485 -609
- package/dist/utils.d.ts +40 -6
- package/dist/utils.js +232 -354
- package/package.json +4 -4
package/dist/hooks.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
1
2
|
import { useRef, useEffect, useCallback, useState, useMemo } from 'react';
|
|
2
3
|
import { EventsManager, MediasParser } from '@panneau/core';
|
|
3
4
|
import { createUseEvent, loadPackage } from '@panneau/core/utils';
|
|
4
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
7
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
8
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
9
5
|
import { getCsrfToken, postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
10
6
|
import get from 'lodash/get';
|
|
11
7
|
import isArray from 'lodash/isArray';
|
|
@@ -16,221 +12,211 @@ import dayjs from 'dayjs';
|
|
|
16
12
|
import { useIntl } from 'react-intl';
|
|
17
13
|
import { match } from 'css-mediaquery';
|
|
18
14
|
|
|
19
|
-
function useAnimationFrame(onFrame) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
15
|
+
function useAnimationFrame(onFrame, t0) {
|
|
16
|
+
const $ = c(9);
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== t0) {
|
|
19
|
+
t1 = t0 === undefined ? {} : t0;
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
$[1] = t1;
|
|
22
|
+
} else {
|
|
23
|
+
t1 = $[1];
|
|
24
|
+
}
|
|
25
|
+
const {
|
|
26
|
+
disabled: t2
|
|
27
|
+
} = t1;
|
|
28
|
+
const disabled = t2 === undefined ? false : t2;
|
|
29
|
+
const requestRef = useRef(null);
|
|
30
|
+
const startTimeRef = useRef(null);
|
|
31
|
+
let callback;
|
|
32
|
+
if ($[2] !== onFrame) {
|
|
33
|
+
callback = time => {
|
|
34
|
+
if (!startTimeRef.current) {
|
|
35
|
+
startTimeRef.current = time;
|
|
36
|
+
}
|
|
37
|
+
const progress = time - startTimeRef.current;
|
|
38
|
+
onFrame(progress);
|
|
39
|
+
requestRef.current = requestAnimationFrame(callback);
|
|
40
|
+
};
|
|
41
|
+
$[2] = onFrame;
|
|
42
|
+
$[3] = callback;
|
|
43
|
+
} else {
|
|
44
|
+
callback = $[3];
|
|
45
|
+
}
|
|
46
|
+
let t3;
|
|
47
|
+
if ($[4] !== callback || $[5] !== disabled) {
|
|
48
|
+
t3 = () => {
|
|
49
|
+
if (!disabled) {
|
|
50
|
+
requestRef.current = requestAnimationFrame(callback);
|
|
40
51
|
}
|
|
52
|
+
return () => {
|
|
53
|
+
if (requestRef.current !== null) {
|
|
54
|
+
cancelAnimationFrame(requestRef.current);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
41
57
|
};
|
|
42
|
-
|
|
58
|
+
$[4] = callback;
|
|
59
|
+
$[5] = disabled;
|
|
60
|
+
$[6] = t3;
|
|
61
|
+
} else {
|
|
62
|
+
t3 = $[6];
|
|
63
|
+
}
|
|
64
|
+
let t4;
|
|
65
|
+
if ($[7] !== disabled) {
|
|
66
|
+
t4 = [disabled];
|
|
67
|
+
$[7] = disabled;
|
|
68
|
+
$[8] = t4;
|
|
69
|
+
} else {
|
|
70
|
+
t4 = $[8];
|
|
71
|
+
}
|
|
72
|
+
useEffect(t3, t4);
|
|
43
73
|
}
|
|
44
74
|
|
|
45
|
-
function useFormattedDate(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return useCallback(function (date) {
|
|
54
|
-
var dateToFormat = isString(date) ? dayjs(date) : date;
|
|
75
|
+
function useFormattedDate({
|
|
76
|
+
format = null,
|
|
77
|
+
showToday = true
|
|
78
|
+
} = {}) {
|
|
79
|
+
const intl = useIntl();
|
|
80
|
+
const today = dayjs();
|
|
81
|
+
return useCallback(date => {
|
|
82
|
+
const dateToFormat = isString(date) ? dayjs(date) : date;
|
|
55
83
|
if (showToday && dateToFormat.format('YYYY-MM-DD') === today.format('YYYY-MM-DD')) {
|
|
56
84
|
return intl.formatMessage({
|
|
57
|
-
|
|
58
|
-
"defaultMessage": [{
|
|
59
|
-
"type": 0,
|
|
60
|
-
"value": "Today"
|
|
61
|
-
}]
|
|
85
|
+
id: "v4Qtl9"
|
|
62
86
|
});
|
|
63
87
|
}
|
|
64
|
-
return intl.formatDate(dayjs(date).toDate(),
|
|
88
|
+
return intl.formatDate(dayjs(date).toDate(), {
|
|
65
89
|
year: 'numeric',
|
|
66
90
|
month: 'long',
|
|
67
|
-
day: '2-digit'
|
|
68
|
-
|
|
91
|
+
day: '2-digit',
|
|
92
|
+
...format
|
|
93
|
+
});
|
|
69
94
|
}, [today, showToday, format]);
|
|
70
95
|
}
|
|
71
|
-
function useFormattedTime(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var now = dayjs();
|
|
81
|
-
return useCallback(function (date) {
|
|
82
|
-
var dateToFormat = isString(date) ? dayjs(date) : date;
|
|
96
|
+
function useFormattedTime({
|
|
97
|
+
format = null,
|
|
98
|
+
showNow = true,
|
|
99
|
+
timeGap = 2
|
|
100
|
+
} = {}) {
|
|
101
|
+
const intl = useIntl();
|
|
102
|
+
const now = dayjs();
|
|
103
|
+
return useCallback(date => {
|
|
104
|
+
const dateToFormat = isString(date) ? dayjs(date) : date;
|
|
83
105
|
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) {
|
|
84
106
|
return intl.formatMessage({
|
|
85
|
-
|
|
86
|
-
"defaultMessage": [{
|
|
87
|
-
"type": 0,
|
|
88
|
-
"value": "Now"
|
|
89
|
-
}]
|
|
107
|
+
id: "3na7F8"
|
|
90
108
|
});
|
|
91
109
|
}
|
|
92
|
-
return intl.formatTime(dateToFormat.toDate(),
|
|
110
|
+
return intl.formatTime(dateToFormat.toDate(), {
|
|
93
111
|
hour: 'numeric',
|
|
94
|
-
minute: 'numeric'
|
|
95
|
-
|
|
112
|
+
minute: 'numeric',
|
|
113
|
+
...format
|
|
114
|
+
});
|
|
96
115
|
}, [now, showNow, timeGap, format]);
|
|
97
116
|
}
|
|
98
117
|
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
const eventsManager$1 = typeof document !== 'undefined' ? new EventsManager(document) : null;
|
|
119
|
+
const useDocumentEvent = createUseEvent(eventsManager$1);
|
|
101
120
|
|
|
102
|
-
var _excluded$1 = ["value", "errors", "onChange"];
|
|
103
121
|
// prettier-ignore
|
|
104
|
-
function getFieldsPropsFromFields(fields,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return (fields || []).reduce(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var finalPrevious = isArray(previousErrors) ? previousErrors : [];
|
|
123
|
-
return [].concat(_toConsumableArray(finalPrevious), _toConsumableArray(finalItems));
|
|
122
|
+
function getFieldsPropsFromFields(fields, {
|
|
123
|
+
value,
|
|
124
|
+
errors,
|
|
125
|
+
onChange,
|
|
126
|
+
...props
|
|
127
|
+
}, locales = []) {
|
|
128
|
+
return (fields || []).reduce((allFields, field) => {
|
|
129
|
+
const {
|
|
130
|
+
name = isString(field) ? field : null,
|
|
131
|
+
fields: fieldFields = null,
|
|
132
|
+
component = null
|
|
133
|
+
} = isObject(field) ? field : {};
|
|
134
|
+
const fieldErrors = errors !== null ? errors[name] || [] : [];
|
|
135
|
+
const finalErrors = component === 'localized' ? (locales || []).reduce((previousErrors, locale) => {
|
|
136
|
+
const items = errors !== null ? get(errors, `${name}.${locale}`, []) || [] : [];
|
|
137
|
+
const finalItems = isArray(items) ? items : [items];
|
|
138
|
+
const finalPrevious = isArray(previousErrors) ? previousErrors : [];
|
|
139
|
+
return [...finalPrevious, ...finalItems];
|
|
124
140
|
}, fieldErrors) : fieldErrors;
|
|
125
|
-
|
|
141
|
+
let subfieldErrors = errors;
|
|
126
142
|
if (errors !== null && name !== null) {
|
|
127
|
-
subfieldErrors = Object.keys(errors).reduce(
|
|
143
|
+
subfieldErrors = Object.keys(errors).reduce((acc, key) => {
|
|
128
144
|
if (key === name) {
|
|
129
145
|
acc[key] = errors[key];
|
|
130
146
|
}
|
|
131
|
-
if (key.startsWith(
|
|
132
|
-
|
|
147
|
+
if (key.startsWith(`${name}.`) || key.startsWith(`${name}[`)) {
|
|
148
|
+
const finalKey = key.substring(name.length + 1);
|
|
133
149
|
acc[finalKey] = errors[key];
|
|
134
150
|
}
|
|
135
151
|
return acc;
|
|
136
152
|
}, {});
|
|
137
153
|
}
|
|
138
|
-
return [
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
return [...allFields, {
|
|
155
|
+
...(isObject(field) ? field : null),
|
|
156
|
+
name,
|
|
157
|
+
component,
|
|
141
158
|
value: value !== null && name !== null ? value[name] || null : null,
|
|
142
159
|
errors: finalErrors.length > 0 ? finalErrors : null,
|
|
143
|
-
onChange:
|
|
144
|
-
return _onChange(name, fieldValue);
|
|
145
|
-
},
|
|
160
|
+
onChange: fieldValue => onChange(name, fieldValue),
|
|
146
161
|
fields: fieldFields !== null && isArray(fieldFields) ? getFieldsPropsFromFields(fieldFields, {
|
|
147
162
|
value: value !== null && name !== null && isObject(value[name]) ? value[name] : null,
|
|
148
163
|
errors: subfieldErrors,
|
|
149
|
-
onChange
|
|
150
|
-
}, locales) : null
|
|
151
|
-
|
|
164
|
+
onChange
|
|
165
|
+
}, locales) : null,
|
|
166
|
+
...props
|
|
167
|
+
}];
|
|
152
168
|
}, []);
|
|
153
169
|
}
|
|
154
|
-
function useForm() {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
200
|
-
stateGeneralError = _useState6[0],
|
|
201
|
-
setStateGeneralError = _useState6[1];
|
|
202
|
-
var _useState7 = useState({
|
|
203
|
-
success: false,
|
|
204
|
-
loading: false,
|
|
205
|
-
error: false
|
|
206
|
-
}),
|
|
207
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
208
|
-
requestState = _useState8[0],
|
|
209
|
-
setRequestState = _useState8[1];
|
|
210
|
-
var _useState9 = useState(null),
|
|
211
|
-
_useState0 = _slicedToArray(_useState9, 2),
|
|
212
|
-
response = _useState0[0],
|
|
213
|
-
setResponse = _useState0[1];
|
|
214
|
-
var hasProvidedValue = setProvidedValue !== null;
|
|
215
|
-
var value = hasProvidedValue ? providedValue : stateValue;
|
|
216
|
-
var setValue = hasProvidedValue ? setProvidedValue : setStateValue;
|
|
217
|
-
var hasProvidedErrors = setProvidedErrors !== null;
|
|
218
|
-
var errors = hasProvidedErrors ? providedErrors : stateErrors;
|
|
219
|
-
var setErrors = hasProvidedErrors ? setProvidedErrors : setStateErrors;
|
|
220
|
-
var hasProvidedGeneralError = setProvidedGeneralError !== null;
|
|
221
|
-
var generalError = hasProvidedGeneralError ? providedGeneralError : stateGeneralError;
|
|
222
|
-
var setGeneralError = hasProvidedGeneralError ? setProvidedGeneralError : setStateGeneralError;
|
|
223
|
-
var onFieldChange = useCallback(function (fieldName, fieldValue) {
|
|
224
|
-
var _ref3 = requestState || {},
|
|
225
|
-
_ref3$loading = _ref3.loading,
|
|
226
|
-
loading = _ref3$loading === void 0 ? false : _ref3$loading,
|
|
227
|
-
_ref3$success = _ref3.success,
|
|
228
|
-
success = _ref3$success === void 0 ? false : _ref3$success,
|
|
229
|
-
_ref3$error = _ref3.error,
|
|
230
|
-
requestError = _ref3$error === void 0 ? false : _ref3$error;
|
|
231
|
-
var fieldErrors = errors !== null ? errors[fieldName] || null : null;
|
|
170
|
+
function useForm(opts = {}) {
|
|
171
|
+
const {
|
|
172
|
+
fields = [],
|
|
173
|
+
action = null,
|
|
174
|
+
postForm = null,
|
|
175
|
+
initialErrors = null,
|
|
176
|
+
errors: providedErrors = null,
|
|
177
|
+
setErrors: setProvidedErrors = null,
|
|
178
|
+
initialGeneralError = null,
|
|
179
|
+
generalError: providedGeneralError = null,
|
|
180
|
+
setGeneralError: setProvidedGeneralError = null,
|
|
181
|
+
initialValue = null,
|
|
182
|
+
value: providedValue = null,
|
|
183
|
+
setValue: setProvidedValue = null,
|
|
184
|
+
withoutDefault = true,
|
|
185
|
+
withoutPropagation = true,
|
|
186
|
+
onComplete = null,
|
|
187
|
+
onError = null,
|
|
188
|
+
locales = []
|
|
189
|
+
} = opts;
|
|
190
|
+
const [stateValue, setStateValue] = useState(initialValue || providedValue);
|
|
191
|
+
const [stateErrors, setStateErrors] = useState(initialErrors || providedErrors);
|
|
192
|
+
const [stateGeneralError, setStateGeneralError] = useState(initialGeneralError || providedGeneralError);
|
|
193
|
+
const [requestState, setRequestState] = useState({
|
|
194
|
+
success: false,
|
|
195
|
+
loading: false,
|
|
196
|
+
error: false
|
|
197
|
+
});
|
|
198
|
+
const [response, setResponse] = useState(null);
|
|
199
|
+
const hasProvidedValue = setProvidedValue !== null;
|
|
200
|
+
const value = hasProvidedValue ? providedValue : stateValue;
|
|
201
|
+
const setValue = hasProvidedValue ? setProvidedValue : setStateValue;
|
|
202
|
+
const hasProvidedErrors = setProvidedErrors !== null;
|
|
203
|
+
const errors = hasProvidedErrors ? providedErrors : stateErrors;
|
|
204
|
+
const setErrors = hasProvidedErrors ? setProvidedErrors : setStateErrors;
|
|
205
|
+
const hasProvidedGeneralError = setProvidedGeneralError !== null;
|
|
206
|
+
const generalError = hasProvidedGeneralError ? providedGeneralError : stateGeneralError;
|
|
207
|
+
const setGeneralError = hasProvidedGeneralError ? setProvidedGeneralError : setStateGeneralError;
|
|
208
|
+
const onFieldChange = useCallback((fieldName, fieldValue) => {
|
|
209
|
+
const {
|
|
210
|
+
loading = false,
|
|
211
|
+
success = false,
|
|
212
|
+
error: requestError = false
|
|
213
|
+
} = requestState || {};
|
|
214
|
+
const fieldErrors = errors !== null ? errors[fieldName] || null : null;
|
|
232
215
|
if (fieldErrors !== null) {
|
|
233
|
-
setErrors(
|
|
216
|
+
setErrors({
|
|
217
|
+
...errors,
|
|
218
|
+
[fieldName]: null
|
|
219
|
+
});
|
|
234
220
|
}
|
|
235
221
|
if (!loading && (success !== false || requestError !== false)) {
|
|
236
222
|
setRequestState({
|
|
@@ -239,28 +225,27 @@ function useForm() {
|
|
|
239
225
|
error: false
|
|
240
226
|
});
|
|
241
227
|
}
|
|
242
|
-
setValue(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
var onSubmitError = function onSubmitError(error) {
|
|
228
|
+
setValue({
|
|
229
|
+
...(value || {}),
|
|
230
|
+
[fieldName]: fieldValue
|
|
231
|
+
});
|
|
232
|
+
}, [value, errors, requestState, setErrors, setValue, ...fields]);
|
|
233
|
+
const fieldsProps = useMemo(() => getFieldsPropsFromFields(fields, {
|
|
234
|
+
value,
|
|
235
|
+
errors,
|
|
236
|
+
onChange: onFieldChange
|
|
237
|
+
}, locales), [value, errors, locales, fields, onFieldChange, ...fields]);
|
|
238
|
+
const csrfToken = useMemo(() => getCsrfToken(), []);
|
|
239
|
+
const onSubmitError = error => {
|
|
255
240
|
setRequestState({
|
|
256
241
|
success: false,
|
|
257
242
|
loading: false,
|
|
258
243
|
error: true
|
|
259
244
|
});
|
|
260
245
|
if (error.name === 'ValidationError') {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
246
|
+
const {
|
|
247
|
+
errors: validationErrors = null
|
|
248
|
+
} = error.getResponseData();
|
|
264
249
|
setErrors(validationErrors || null);
|
|
265
250
|
} else {
|
|
266
251
|
setGeneralError(error.message);
|
|
@@ -269,7 +254,7 @@ function useForm() {
|
|
|
269
254
|
onError(error);
|
|
270
255
|
}
|
|
271
256
|
};
|
|
272
|
-
|
|
257
|
+
const onSubmitSuccess = resp => {
|
|
273
258
|
setRequestState({
|
|
274
259
|
success: true,
|
|
275
260
|
loading: false,
|
|
@@ -280,14 +265,11 @@ function useForm() {
|
|
|
280
265
|
onComplete(resp);
|
|
281
266
|
}
|
|
282
267
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}, [postForm]);
|
|
289
|
-
var submit = useCallback(function () {
|
|
290
|
-
var submitValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value;
|
|
268
|
+
const finalPostForm = useCallback((postAction, postData) => postForm !== null ? postForm(postAction, postData) : postJSON(postAction, postData, {
|
|
269
|
+
credentials: 'include',
|
|
270
|
+
headers: getCSRFHeaders()
|
|
271
|
+
}), [postForm]);
|
|
272
|
+
const submit = useCallback((submitValue = value) => {
|
|
291
273
|
setRequestState({
|
|
292
274
|
success: false,
|
|
293
275
|
loading: true,
|
|
@@ -295,11 +277,12 @@ function useForm() {
|
|
|
295
277
|
});
|
|
296
278
|
setGeneralError(null);
|
|
297
279
|
setErrors(null);
|
|
298
|
-
finalPostForm(action,
|
|
280
|
+
finalPostForm(action, {
|
|
281
|
+
...(submitValue || {}),
|
|
299
282
|
_token: csrfToken
|
|
300
|
-
})
|
|
283
|
+
}).then(onSubmitSuccess).catch(onSubmitError);
|
|
301
284
|
}, [value, setGeneralError, setErrors, finalPostForm, action, csrfToken, onSubmitSuccess, onSubmitError]);
|
|
302
|
-
|
|
285
|
+
const onSubmit = useCallback(e => {
|
|
303
286
|
if (withoutDefault) {
|
|
304
287
|
e.preventDefault();
|
|
305
288
|
}
|
|
@@ -310,7 +293,7 @@ function useForm() {
|
|
|
310
293
|
// Nested forms (even in portals) will bubble the onSubmit event to the parent
|
|
311
294
|
submit();
|
|
312
295
|
}, [submit, withoutDefault, withoutPropagation]);
|
|
313
|
-
|
|
296
|
+
let status = null;
|
|
314
297
|
if (requestState.loading) {
|
|
315
298
|
status = 'loading';
|
|
316
299
|
} else if (requestState.success) {
|
|
@@ -318,153 +301,127 @@ function useForm() {
|
|
|
318
301
|
} else if (requestState.error) {
|
|
319
302
|
status = 'error';
|
|
320
303
|
}
|
|
321
|
-
return
|
|
322
|
-
value
|
|
323
|
-
setValue
|
|
324
|
-
csrfToken
|
|
325
|
-
submit
|
|
326
|
-
onSubmit
|
|
327
|
-
|
|
328
|
-
status
|
|
329
|
-
response
|
|
304
|
+
return {
|
|
305
|
+
value,
|
|
306
|
+
setValue,
|
|
307
|
+
csrfToken,
|
|
308
|
+
submit,
|
|
309
|
+
onSubmit,
|
|
310
|
+
...requestState,
|
|
311
|
+
status,
|
|
312
|
+
response,
|
|
330
313
|
fields: fieldsProps,
|
|
331
|
-
errors
|
|
332
|
-
generalError
|
|
333
|
-
}
|
|
314
|
+
errors,
|
|
315
|
+
generalError
|
|
316
|
+
};
|
|
334
317
|
}
|
|
335
318
|
|
|
336
319
|
function buildThresholdArray() {
|
|
337
320
|
return [0, 1.0];
|
|
338
321
|
}
|
|
339
|
-
|
|
340
|
-
function getOptionsKey(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
return "root_".concat(root, "_rootMargin_").concat(rootMargin || null, "_threshold_").concat(threshold);
|
|
322
|
+
const observersCache = new Map();
|
|
323
|
+
function getOptionsKey({
|
|
324
|
+
root = null,
|
|
325
|
+
rootMargin,
|
|
326
|
+
threshold = null
|
|
327
|
+
}) {
|
|
328
|
+
return `root_${root}_rootMargin_${rootMargin || null}_threshold_${threshold}`;
|
|
347
329
|
}
|
|
348
|
-
function createObserver(Observer) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
var currentSubscriber = subscribers.find(function (it) {
|
|
353
|
-
return it.element === element;
|
|
354
|
-
}) || null;
|
|
330
|
+
function createObserver(Observer, options = {}) {
|
|
331
|
+
let subscribers = [];
|
|
332
|
+
const addSubscriber = (element, callback) => {
|
|
333
|
+
const currentSubscriber = subscribers.find(it => it.element === element) || null;
|
|
355
334
|
if (currentSubscriber !== null) {
|
|
356
|
-
return subscribers.map(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}).filter(function (it) {
|
|
361
|
-
return it.callbacks.length > 0;
|
|
362
|
-
});
|
|
335
|
+
return subscribers.map(it => it.element === element && it.callbacks.indexOf(callback) === -1 ? {
|
|
336
|
+
...it,
|
|
337
|
+
callbacks: [...it.callbacks, callback]
|
|
338
|
+
} : it).filter(it => it.callbacks.length > 0);
|
|
363
339
|
}
|
|
364
|
-
return [
|
|
365
|
-
element
|
|
340
|
+
return [...subscribers, {
|
|
341
|
+
element,
|
|
366
342
|
callbacks: [callback]
|
|
367
|
-
}]
|
|
343
|
+
}];
|
|
368
344
|
};
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
};
|
|
380
|
-
var onUpdate = function onUpdate(entries) {
|
|
381
|
-
entries.forEach(function (entry) {
|
|
382
|
-
subscribers.forEach(function (_ref2) {
|
|
383
|
-
var element = _ref2.element,
|
|
384
|
-
callbacks = _ref2.callbacks;
|
|
345
|
+
const removeSubscriber = (element, callback) => subscribers.map(it => it.element === element ? {
|
|
346
|
+
...it,
|
|
347
|
+
callbacks: it.callbacks.filter(subCallback => subCallback !== callback)
|
|
348
|
+
} : it).filter(it => it.callbacks.length > 0);
|
|
349
|
+
const onUpdate = entries => {
|
|
350
|
+
entries.forEach(entry => {
|
|
351
|
+
subscribers.forEach(({
|
|
352
|
+
element,
|
|
353
|
+
callbacks
|
|
354
|
+
}) => {
|
|
385
355
|
if (element === entry.target) {
|
|
386
|
-
callbacks.forEach(
|
|
356
|
+
callbacks.forEach(callback => {
|
|
387
357
|
callback(entry);
|
|
388
358
|
});
|
|
389
359
|
}
|
|
390
360
|
});
|
|
391
361
|
});
|
|
392
362
|
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
363
|
+
const observer = new Observer(onUpdate, options);
|
|
364
|
+
const unsubscribe = (element, callback = null) => {
|
|
396
365
|
subscribers = removeSubscriber(element, callback);
|
|
397
366
|
if (typeof observer.unobserve === 'undefined') {
|
|
398
367
|
observer.disconnect();
|
|
399
|
-
subscribers.forEach(
|
|
368
|
+
subscribers.forEach(subscriber => {
|
|
400
369
|
observer.observe(subscriber.element);
|
|
401
370
|
});
|
|
402
371
|
return;
|
|
403
372
|
}
|
|
404
|
-
|
|
405
|
-
return it.element === element;
|
|
406
|
-
}) || null;
|
|
373
|
+
const currentSubscriber = subscribers.find(it => it.element === element) || null;
|
|
407
374
|
if (currentSubscriber === null) {
|
|
408
375
|
observer.unobserve(element);
|
|
409
376
|
}
|
|
410
377
|
};
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return it.element === element;
|
|
414
|
-
}) || null;
|
|
378
|
+
const subscribe = (element, callback) => {
|
|
379
|
+
const currentSubscriber = subscribers.find(it => it.element === element) || null;
|
|
415
380
|
subscribers = addSubscriber(element, callback);
|
|
416
381
|
if (currentSubscriber === null) {
|
|
417
382
|
observer.observe(element);
|
|
418
383
|
}
|
|
419
384
|
};
|
|
420
385
|
return {
|
|
421
|
-
subscribe
|
|
422
|
-
unsubscribe
|
|
423
|
-
observer
|
|
386
|
+
subscribe,
|
|
387
|
+
unsubscribe,
|
|
388
|
+
observer
|
|
424
389
|
};
|
|
425
390
|
}
|
|
426
|
-
function getObserver(Observer) {
|
|
427
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
391
|
+
function getObserver(Observer, options = {}) {
|
|
428
392
|
if (Observer === null) {
|
|
429
393
|
throw new Error('Observer constructor is null');
|
|
430
394
|
}
|
|
431
|
-
|
|
395
|
+
const observerKey = getOptionsKey(options);
|
|
432
396
|
if (!observersCache.has(Observer)) {
|
|
433
397
|
observersCache.set(Observer, {});
|
|
434
398
|
}
|
|
435
|
-
|
|
399
|
+
const observers = observersCache.get(Observer);
|
|
436
400
|
if (typeof observers[observerKey] === 'undefined') {
|
|
437
401
|
observers[observerKey] = createObserver(Observer, options);
|
|
438
402
|
observersCache.set(Observer, observers);
|
|
439
403
|
}
|
|
440
404
|
return observers[observerKey];
|
|
441
405
|
}
|
|
442
|
-
function useObserver(Observer) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
var elementChanged = nodeRef.current !== currentElement.current;
|
|
460
|
-
useEffect(function () {
|
|
461
|
-
var nodeElement = nodeRef.current;
|
|
462
|
-
var callback = function callback(newEntry) {
|
|
463
|
-
return setEntry(newEntry);
|
|
464
|
-
};
|
|
465
|
-
var unsubscribe = null;
|
|
406
|
+
function useObserver(Observer, opts = {}, initialEntry = {}) {
|
|
407
|
+
const {
|
|
408
|
+
root = null,
|
|
409
|
+
rootMargin = null,
|
|
410
|
+
threshold = null,
|
|
411
|
+
disabled = false
|
|
412
|
+
} = opts;
|
|
413
|
+
const [entry, setEntry] = useState(initialEntry);
|
|
414
|
+
const nodeRef = useRef(null);
|
|
415
|
+
const currentElement = useRef(null);
|
|
416
|
+
const elementChanged = nodeRef.current !== currentElement.current;
|
|
417
|
+
useEffect(() => {
|
|
418
|
+
const {
|
|
419
|
+
current: nodeElement
|
|
420
|
+
} = nodeRef;
|
|
421
|
+
const callback = newEntry => setEntry(newEntry);
|
|
422
|
+
let unsubscribe = null;
|
|
466
423
|
if (nodeElement !== null && Observer !== null) {
|
|
467
|
-
|
|
424
|
+
const newOpts = {};
|
|
468
425
|
if (root !== null) {
|
|
469
426
|
newOpts.root = root;
|
|
470
427
|
}
|
|
@@ -474,14 +431,15 @@ function useObserver(Observer) {
|
|
|
474
431
|
if (threshold !== null) {
|
|
475
432
|
newOpts.threshold = threshold;
|
|
476
433
|
}
|
|
477
|
-
|
|
478
|
-
subscribe
|
|
479
|
-
localUnsubscribe
|
|
434
|
+
const {
|
|
435
|
+
subscribe,
|
|
436
|
+
unsubscribe: localUnsubscribe
|
|
437
|
+
} = getObserver(Observer, newOpts);
|
|
480
438
|
unsubscribe = localUnsubscribe;
|
|
481
439
|
subscribe(nodeElement, callback);
|
|
482
440
|
}
|
|
483
441
|
currentElement.current = nodeElement;
|
|
484
|
-
return
|
|
442
|
+
return () => {
|
|
485
443
|
if (unsubscribe !== null && nodeElement !== null) {
|
|
486
444
|
unsubscribe(nodeElement, callback);
|
|
487
445
|
}
|
|
@@ -489,15 +447,15 @@ function useObserver(Observer) {
|
|
|
489
447
|
}, [Observer, elementChanged, disabled, root, rootMargin, threshold]);
|
|
490
448
|
return {
|
|
491
449
|
ref: nodeRef,
|
|
492
|
-
entry
|
|
450
|
+
entry
|
|
493
451
|
};
|
|
494
452
|
}
|
|
495
453
|
|
|
496
454
|
/**
|
|
497
455
|
* Intersection Observer
|
|
498
456
|
*/
|
|
499
|
-
|
|
500
|
-
|
|
457
|
+
const thresholdArray = buildThresholdArray();
|
|
458
|
+
const intersectionObserverInitialEntry = {
|
|
501
459
|
target: null,
|
|
502
460
|
time: null,
|
|
503
461
|
isVisible: false,
|
|
@@ -507,68 +465,108 @@ var intersectionObserverInitialEntry = {
|
|
|
507
465
|
boundingClientRect: null,
|
|
508
466
|
rootBounds: null
|
|
509
467
|
};
|
|
510
|
-
function useIntersectionObserver() {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
root:
|
|
522
|
-
rootMargin:
|
|
523
|
-
threshold:
|
|
524
|
-
disabled:
|
|
525
|
-
}
|
|
468
|
+
function useIntersectionObserver(t0) {
|
|
469
|
+
const $ = c(7);
|
|
470
|
+
let t1;
|
|
471
|
+
if ($[0] !== t0) {
|
|
472
|
+
t1 = t0 === undefined ? {} : t0;
|
|
473
|
+
$[0] = t0;
|
|
474
|
+
$[1] = t1;
|
|
475
|
+
} else {
|
|
476
|
+
t1 = $[1];
|
|
477
|
+
}
|
|
478
|
+
const {
|
|
479
|
+
root: t2,
|
|
480
|
+
rootMargin: t3,
|
|
481
|
+
threshold: t4,
|
|
482
|
+
disabled: t5
|
|
483
|
+
} = t1;
|
|
484
|
+
const root = t2 === undefined ? null : t2;
|
|
485
|
+
const rootMargin = t3 === undefined ? "0px" : t3;
|
|
486
|
+
const threshold = t4 === undefined ? thresholdArray : t4;
|
|
487
|
+
const disabled = t5 === undefined ? false : t5;
|
|
488
|
+
let t6;
|
|
489
|
+
if ($[2] !== disabled || $[3] !== root || $[4] !== rootMargin || $[5] !== threshold) {
|
|
490
|
+
t6 = {
|
|
491
|
+
root,
|
|
492
|
+
rootMargin,
|
|
493
|
+
threshold,
|
|
494
|
+
disabled
|
|
495
|
+
};
|
|
496
|
+
$[2] = disabled;
|
|
497
|
+
$[3] = root;
|
|
498
|
+
$[4] = rootMargin;
|
|
499
|
+
$[5] = threshold;
|
|
500
|
+
$[6] = t6;
|
|
501
|
+
} else {
|
|
502
|
+
t6 = $[6];
|
|
503
|
+
}
|
|
504
|
+
return useObserver(typeof window !== "undefined" ? IntersectionObserver : null, t6, intersectionObserverInitialEntry);
|
|
526
505
|
}
|
|
527
506
|
|
|
528
507
|
/**
|
|
529
508
|
* Resize Observer
|
|
530
509
|
*/
|
|
531
510
|
|
|
532
|
-
|
|
511
|
+
const resizeObserverInitialEntry = {
|
|
533
512
|
target: null,
|
|
534
513
|
contentRect: null,
|
|
535
514
|
contentBoxSize: null,
|
|
536
515
|
borderBoxSize: null
|
|
537
516
|
};
|
|
538
|
-
function useResizeObserver() {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
517
|
+
function useResizeObserver(t0) {
|
|
518
|
+
const $ = c(4);
|
|
519
|
+
let t1;
|
|
520
|
+
if ($[0] !== t0) {
|
|
521
|
+
t1 = t0 === undefined ? {} : t0;
|
|
522
|
+
$[0] = t0;
|
|
523
|
+
$[1] = t1;
|
|
524
|
+
} else {
|
|
525
|
+
t1 = $[1];
|
|
526
|
+
}
|
|
527
|
+
const {
|
|
528
|
+
disabled: t2
|
|
529
|
+
} = t1;
|
|
530
|
+
const disabled = t2 === undefined ? false : t2;
|
|
531
|
+
let t3;
|
|
532
|
+
if ($[2] !== disabled) {
|
|
533
|
+
t3 = {
|
|
534
|
+
disabled
|
|
535
|
+
};
|
|
536
|
+
$[2] = disabled;
|
|
537
|
+
$[3] = t3;
|
|
538
|
+
} else {
|
|
539
|
+
t3 = $[3];
|
|
540
|
+
}
|
|
541
|
+
return useObserver(typeof window !== "undefined" ? ResizeObserver : null, t3, resizeObserverInitialEntry);
|
|
545
542
|
}
|
|
546
543
|
|
|
547
|
-
function useIsVisible(
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
544
|
+
function useIsVisible({
|
|
545
|
+
rootMargin,
|
|
546
|
+
threshold = 1,
|
|
547
|
+
persist = false
|
|
548
|
+
} = {}) {
|
|
549
|
+
const {
|
|
550
|
+
ref,
|
|
551
|
+
entry: {
|
|
552
|
+
isIntersecting
|
|
553
|
+
}
|
|
554
|
+
} = useIntersectionObserver({
|
|
555
|
+
rootMargin,
|
|
556
|
+
threshold
|
|
557
|
+
});
|
|
558
|
+
const wasIntersecting = useRef(isIntersecting);
|
|
561
559
|
if (isIntersecting && !wasIntersecting.current) {
|
|
562
560
|
wasIntersecting.current = isIntersecting;
|
|
563
561
|
}
|
|
564
|
-
|
|
562
|
+
const isVisible = !persist && isIntersecting || persist && wasIntersecting.current;
|
|
565
563
|
return {
|
|
566
|
-
ref
|
|
564
|
+
ref,
|
|
567
565
|
visible: isVisible
|
|
568
566
|
};
|
|
569
567
|
}
|
|
570
568
|
|
|
571
|
-
|
|
569
|
+
const KEYCODES = {
|
|
572
570
|
ARROW_LEFT: 37,
|
|
573
571
|
ARROW_UP: 38,
|
|
574
572
|
ARROW_RIGHT: 39,
|
|
@@ -576,30 +574,84 @@ var KEYCODES = {
|
|
|
576
574
|
ESCAPE: 27,
|
|
577
575
|
SPACE: 32
|
|
578
576
|
};
|
|
579
|
-
function useKeyboardKeys() {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
577
|
+
function useKeyboardKeys(t0, t1) {
|
|
578
|
+
const $ = c(16);
|
|
579
|
+
let t2;
|
|
580
|
+
if ($[0] !== t0) {
|
|
581
|
+
t2 = t0 === undefined ? {} : t0;
|
|
582
|
+
$[0] = t0;
|
|
583
|
+
$[1] = t2;
|
|
584
|
+
} else {
|
|
585
|
+
t2 = $[1];
|
|
586
|
+
}
|
|
587
|
+
const keys = t2;
|
|
588
|
+
let t3;
|
|
589
|
+
if ($[2] !== t1) {
|
|
590
|
+
t3 = t1 === undefined ? {} : t1;
|
|
591
|
+
$[2] = t1;
|
|
592
|
+
$[3] = t3;
|
|
593
|
+
} else {
|
|
594
|
+
t3 = $[3];
|
|
595
|
+
}
|
|
596
|
+
const {
|
|
597
|
+
eventName: t4
|
|
598
|
+
} = t3;
|
|
599
|
+
const eventName = t4 === undefined ? "keydown" : t4;
|
|
600
|
+
let t5;
|
|
601
|
+
if ($[4] !== keys) {
|
|
602
|
+
t5 = Object.keys(keys);
|
|
603
|
+
$[4] = keys;
|
|
604
|
+
$[5] = t5;
|
|
605
|
+
} else {
|
|
606
|
+
t5 = $[5];
|
|
607
|
+
}
|
|
608
|
+
const keysNames = t5;
|
|
609
|
+
let t6;
|
|
610
|
+
if ($[6] !== keys || $[7] !== keysNames) {
|
|
611
|
+
t6 = keysNames.map(key => keys[key]);
|
|
612
|
+
$[6] = keys;
|
|
613
|
+
$[7] = keysNames;
|
|
614
|
+
$[8] = t6;
|
|
615
|
+
} else {
|
|
616
|
+
t6 = $[8];
|
|
617
|
+
}
|
|
618
|
+
const keysListeners = t6;
|
|
619
|
+
let t7;
|
|
620
|
+
if ($[9] !== eventName || $[10] !== keys) {
|
|
621
|
+
t7 = () => {
|
|
622
|
+
const onKeyDown = e => {
|
|
623
|
+
const {
|
|
624
|
+
keyCode
|
|
625
|
+
} = e;
|
|
626
|
+
if (typeof keys[keyCode] !== "undefined") {
|
|
627
|
+
keys[keyCode](e);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
document.addEventListener(eventName, onKeyDown);
|
|
631
|
+
return () => {
|
|
632
|
+
document.removeEventListener(eventName, onKeyDown);
|
|
633
|
+
};
|
|
598
634
|
};
|
|
599
|
-
|
|
635
|
+
$[9] = eventName;
|
|
636
|
+
$[10] = keys;
|
|
637
|
+
$[11] = t7;
|
|
638
|
+
} else {
|
|
639
|
+
t7 = $[11];
|
|
640
|
+
}
|
|
641
|
+
let t8;
|
|
642
|
+
if ($[12] !== eventName || $[13] !== keysListeners || $[14] !== keysNames) {
|
|
643
|
+
t8 = [...keysNames, ...keysListeners, eventName];
|
|
644
|
+
$[12] = eventName;
|
|
645
|
+
$[13] = keysListeners;
|
|
646
|
+
$[14] = keysNames;
|
|
647
|
+
$[15] = t8;
|
|
648
|
+
} else {
|
|
649
|
+
t8 = $[15];
|
|
650
|
+
}
|
|
651
|
+
useEffect(t7, t8);
|
|
600
652
|
}
|
|
601
653
|
|
|
602
|
-
|
|
654
|
+
const fontsMap = {
|
|
603
655
|
loading: [],
|
|
604
656
|
active: []
|
|
605
657
|
};
|
|
@@ -610,511 +662,973 @@ function isFontActive(name) {
|
|
|
610
662
|
return fontsMap.active.indexOf(name) !== -1;
|
|
611
663
|
}
|
|
612
664
|
function addFontLoading(name) {
|
|
613
|
-
fontsMap.active = fontsMap.active.filter(
|
|
614
|
-
|
|
615
|
-
});
|
|
616
|
-
fontsMap.loading = [].concat(_toConsumableArray(fontsMap.loading), [name]);
|
|
665
|
+
fontsMap.active = fontsMap.active.filter(it => it !== name);
|
|
666
|
+
fontsMap.loading = [...fontsMap.loading, name];
|
|
617
667
|
}
|
|
618
668
|
function removeFontLoading(name) {
|
|
619
|
-
fontsMap.loading = fontsMap.loading.filter(
|
|
620
|
-
return it !== name;
|
|
621
|
-
});
|
|
669
|
+
fontsMap.loading = fontsMap.loading.filter(it => it !== name);
|
|
622
670
|
}
|
|
623
671
|
function addFontActive(name) {
|
|
624
|
-
fontsMap.loading = fontsMap.loading.filter(
|
|
625
|
-
|
|
626
|
-
});
|
|
627
|
-
fontsMap.active = [].concat(_toConsumableArray(fontsMap.active), [name]);
|
|
672
|
+
fontsMap.loading = fontsMap.loading.filter(it => it !== name);
|
|
673
|
+
fontsMap.active = [...fontsMap.active, name];
|
|
628
674
|
}
|
|
629
675
|
function useLoadedFonts(fonts) {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
type = _ref.type,
|
|
641
|
-
name = _ref.name;
|
|
676
|
+
const [loaded, setLoaded] = useState(false);
|
|
677
|
+
useEffect(() => {
|
|
678
|
+
const config = fonts.reduce((newConfig, font) => {
|
|
679
|
+
const {
|
|
680
|
+
type,
|
|
681
|
+
name
|
|
682
|
+
} = isObject(font) ? font : {
|
|
683
|
+
type: 'system',
|
|
684
|
+
name: font
|
|
685
|
+
};
|
|
642
686
|
if ((type === 'google' || type === 'custom') && !isFontLoading(name) && !isFontActive(name)) {
|
|
643
|
-
return
|
|
644
|
-
|
|
645
|
-
|
|
687
|
+
return {
|
|
688
|
+
...newConfig,
|
|
689
|
+
[type]: {
|
|
690
|
+
families: [...(newConfig !== null ? (newConfig[type] || {}).families || [] : []), name]
|
|
691
|
+
}
|
|
692
|
+
};
|
|
646
693
|
}
|
|
647
694
|
return newConfig;
|
|
648
695
|
}, null);
|
|
649
|
-
|
|
696
|
+
const hasConfig = config !== null;
|
|
650
697
|
if (hasConfig && typeof window !== 'undefined') {
|
|
651
|
-
loadPackage('webfontloader',
|
|
652
|
-
|
|
653
|
-
}).
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
return addFontLoading(name);
|
|
662
|
-
},
|
|
663
|
-
fontactive: function fontactive(name) {
|
|
664
|
-
return addFontActive(name);
|
|
665
|
-
},
|
|
666
|
-
fontinactive: function fontinactive(name) {
|
|
667
|
-
return removeFontLoading(name);
|
|
668
|
-
}
|
|
669
|
-
}));
|
|
670
|
-
});
|
|
698
|
+
loadPackage('webfontloader', () => import('webfontloader')).then(({
|
|
699
|
+
default: WebFont
|
|
700
|
+
}) => WebFont.load({
|
|
701
|
+
...config,
|
|
702
|
+
timeout: 3000,
|
|
703
|
+
active: () => setLoaded(true),
|
|
704
|
+
fontloading: name_0 => addFontLoading(name_0),
|
|
705
|
+
fontactive: name_1 => addFontActive(name_1),
|
|
706
|
+
fontinactive: name_2 => removeFontLoading(name_2)
|
|
707
|
+
}));
|
|
671
708
|
} else {
|
|
672
709
|
setLoaded(true);
|
|
673
710
|
}
|
|
674
711
|
}, [fonts, setLoaded]);
|
|
675
712
|
return {
|
|
676
|
-
loaded
|
|
713
|
+
loaded
|
|
677
714
|
};
|
|
678
715
|
}
|
|
679
716
|
|
|
680
|
-
|
|
681
|
-
function useMediaApi() {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
onEnded
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
media
|
|
740
|
-
}
|
|
741
|
-
}, []);
|
|
742
|
-
var pause = useCallback(function () {
|
|
743
|
-
var media = ref.current;
|
|
744
|
-
if (media !== null) {
|
|
745
|
-
media.pause();
|
|
746
|
-
}
|
|
747
|
-
}, []);
|
|
748
|
-
var togglePlay = useCallback(function () {
|
|
749
|
-
var media = ref.current;
|
|
750
|
-
if (media !== null) {
|
|
751
|
-
if (playing) {
|
|
752
|
-
media.pause();
|
|
753
|
-
} else {
|
|
717
|
+
const progressSteps = [0.1, 0.25, 0.5, 0.75, 0.9];
|
|
718
|
+
function useMediaApi(t0) {
|
|
719
|
+
const $ = c(54);
|
|
720
|
+
let t1;
|
|
721
|
+
if ($[0] !== t0) {
|
|
722
|
+
t1 = t0 === undefined ? {} : t0;
|
|
723
|
+
$[0] = t0;
|
|
724
|
+
$[1] = t1;
|
|
725
|
+
} else {
|
|
726
|
+
t1 = $[1];
|
|
727
|
+
}
|
|
728
|
+
const {
|
|
729
|
+
url: t2,
|
|
730
|
+
initialMuted: t3,
|
|
731
|
+
onTimeUpdate: t4,
|
|
732
|
+
onProgressStep: t5,
|
|
733
|
+
onDurationChanged: t6,
|
|
734
|
+
onVolumeChanged: t7,
|
|
735
|
+
onPlay: t8,
|
|
736
|
+
onPause: t9,
|
|
737
|
+
onEnded: t10,
|
|
738
|
+
onSeeked: t11,
|
|
739
|
+
onLoadStart: t12,
|
|
740
|
+
onCanPlayThough: t13
|
|
741
|
+
} = t1;
|
|
742
|
+
const url = t2 === undefined ? null : t2;
|
|
743
|
+
const initialMuted = t3 === undefined ? false : t3;
|
|
744
|
+
const onTimeUpdate = t4 === undefined ? null : t4;
|
|
745
|
+
const onProgressStep = t5 === undefined ? null : t5;
|
|
746
|
+
const onDurationChanged = t6 === undefined ? null : t6;
|
|
747
|
+
const onVolumeChanged = t7 === undefined ? null : t7;
|
|
748
|
+
const onPlay = t8 === undefined ? null : t8;
|
|
749
|
+
const onPause = t9 === undefined ? null : t9;
|
|
750
|
+
const onEnded = t10 === undefined ? null : t10;
|
|
751
|
+
const onSeeked = t11 === undefined ? null : t11;
|
|
752
|
+
const onLoadStart = t12 === undefined ? null : t12;
|
|
753
|
+
const onCanPlayThough = t13 === undefined ? null : t13;
|
|
754
|
+
const ref = useRef(null);
|
|
755
|
+
const [muted, setMuted] = useState(initialMuted);
|
|
756
|
+
const [currentTime, setCurrentTime] = useState(null);
|
|
757
|
+
const [duration, setDuration] = useState(null);
|
|
758
|
+
const [playing, setPlaying] = useState(false);
|
|
759
|
+
const [ready, setReady] = useState(false);
|
|
760
|
+
const [initialPlay, setInitialPlay] = useState(true);
|
|
761
|
+
let t14;
|
|
762
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
763
|
+
t14 = {};
|
|
764
|
+
$[2] = t14;
|
|
765
|
+
} else {
|
|
766
|
+
t14 = $[2];
|
|
767
|
+
}
|
|
768
|
+
const progressStepsReached = useRef(t14);
|
|
769
|
+
const paused = !playing;
|
|
770
|
+
let t15;
|
|
771
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
772
|
+
t15 = () => {
|
|
773
|
+
const {
|
|
774
|
+
current: media
|
|
775
|
+
} = ref;
|
|
776
|
+
if (media !== null) {
|
|
754
777
|
media.play();
|
|
755
778
|
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
779
|
+
};
|
|
780
|
+
$[3] = t15;
|
|
781
|
+
} else {
|
|
782
|
+
t15 = $[3];
|
|
783
|
+
}
|
|
784
|
+
const play = t15;
|
|
785
|
+
let t16;
|
|
786
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
787
|
+
t16 = () => {
|
|
788
|
+
const {
|
|
789
|
+
current: media_0
|
|
790
|
+
} = ref;
|
|
791
|
+
if (media_0 !== null) {
|
|
792
|
+
media_0.pause();
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
$[4] = t16;
|
|
796
|
+
} else {
|
|
797
|
+
t16 = $[4];
|
|
798
|
+
}
|
|
799
|
+
const pause = t16;
|
|
800
|
+
let t17;
|
|
801
|
+
if ($[5] !== playing) {
|
|
802
|
+
t17 = () => {
|
|
803
|
+
const {
|
|
804
|
+
current: media_1
|
|
805
|
+
} = ref;
|
|
806
|
+
if (media_1 !== null) {
|
|
807
|
+
if (playing) {
|
|
808
|
+
media_1.pause();
|
|
809
|
+
} else {
|
|
810
|
+
media_1.play();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
$[5] = playing;
|
|
815
|
+
$[6] = t17;
|
|
816
|
+
} else {
|
|
817
|
+
t17 = $[6];
|
|
818
|
+
}
|
|
819
|
+
const togglePlay = t17;
|
|
820
|
+
let t18;
|
|
821
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
822
|
+
t18 = () => {
|
|
823
|
+
const {
|
|
824
|
+
current: media_2
|
|
825
|
+
} = ref;
|
|
826
|
+
if (media_2 !== null) {
|
|
827
|
+
media_2.pause();
|
|
828
|
+
media_2.currentTime = 0;
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
$[7] = t18;
|
|
832
|
+
} else {
|
|
833
|
+
t18 = $[7];
|
|
834
|
+
}
|
|
835
|
+
const stop = t18;
|
|
836
|
+
let t19;
|
|
837
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
838
|
+
t19 = time => {
|
|
839
|
+
const {
|
|
840
|
+
current: media_3
|
|
841
|
+
} = ref;
|
|
842
|
+
if (media_3 !== null) {
|
|
843
|
+
media_3.currentTime = time;
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
$[8] = t19;
|
|
847
|
+
} else {
|
|
848
|
+
t19 = $[8];
|
|
849
|
+
}
|
|
850
|
+
const seek = t19;
|
|
851
|
+
let t20;
|
|
852
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
853
|
+
t20 = () => {
|
|
854
|
+
const {
|
|
855
|
+
current: media_4
|
|
856
|
+
} = ref;
|
|
857
|
+
if (media_4 !== null) {
|
|
858
|
+
media_4.muted = true;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
$[9] = t20;
|
|
862
|
+
} else {
|
|
863
|
+
t20 = $[9];
|
|
864
|
+
}
|
|
865
|
+
const mute = t20;
|
|
866
|
+
let t21;
|
|
867
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
868
|
+
t21 = () => {
|
|
869
|
+
const {
|
|
870
|
+
current: media_5
|
|
871
|
+
} = ref;
|
|
872
|
+
if (media_5 !== null) {
|
|
873
|
+
media_5.muted = false;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
$[10] = t21;
|
|
877
|
+
} else {
|
|
878
|
+
t21 = $[10];
|
|
879
|
+
}
|
|
880
|
+
const unMute = t21;
|
|
881
|
+
let t22;
|
|
882
|
+
if ($[11] !== muted) {
|
|
883
|
+
t22 = () => {
|
|
884
|
+
const {
|
|
885
|
+
current: media_6
|
|
886
|
+
} = ref;
|
|
887
|
+
if (media_6 !== null) {
|
|
888
|
+
media_6.muted = !muted;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
$[11] = muted;
|
|
892
|
+
$[12] = t22;
|
|
893
|
+
} else {
|
|
894
|
+
t22 = $[12];
|
|
895
|
+
}
|
|
896
|
+
const toggleMute = t22;
|
|
897
|
+
let t23;
|
|
898
|
+
if ($[13] !== initialPlay || $[14] !== onPlay) {
|
|
899
|
+
t23 = () => {
|
|
900
|
+
if (onPlay !== null) {
|
|
901
|
+
onPlay({
|
|
902
|
+
initial: initialPlay
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
if (initialPlay) {
|
|
906
|
+
setInitialPlay(false);
|
|
907
|
+
}
|
|
908
|
+
setPlaying(true);
|
|
909
|
+
};
|
|
910
|
+
$[13] = initialPlay;
|
|
911
|
+
$[14] = onPlay;
|
|
912
|
+
$[15] = t23;
|
|
913
|
+
} else {
|
|
914
|
+
t23 = $[15];
|
|
915
|
+
}
|
|
916
|
+
const onCustomPlay = t23;
|
|
917
|
+
let t24;
|
|
918
|
+
if ($[16] !== onPause) {
|
|
919
|
+
t24 = () => {
|
|
920
|
+
const {
|
|
921
|
+
current: media_7
|
|
922
|
+
} = ref;
|
|
923
|
+
setPlaying(false);
|
|
924
|
+
if (onPause !== null) {
|
|
925
|
+
onPause({
|
|
926
|
+
midway: media_7.currentTime > 0 && media_7.currentTime < media_7.duration
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
$[16] = onPause;
|
|
931
|
+
$[17] = t24;
|
|
932
|
+
} else {
|
|
933
|
+
t24 = $[17];
|
|
934
|
+
}
|
|
935
|
+
const onCustomPause = t24;
|
|
936
|
+
let t25;
|
|
937
|
+
if ($[18] !== onEnded) {
|
|
938
|
+
t25 = () => {
|
|
939
|
+
const {
|
|
940
|
+
current: media_8
|
|
941
|
+
} = ref;
|
|
942
|
+
media_8.currentTime = 0;
|
|
943
|
+
if (onEnded !== null) {
|
|
944
|
+
onEnded();
|
|
945
|
+
}
|
|
946
|
+
setInitialPlay(true);
|
|
947
|
+
};
|
|
948
|
+
$[18] = onEnded;
|
|
949
|
+
$[19] = t25;
|
|
950
|
+
} else {
|
|
951
|
+
t25 = $[19];
|
|
952
|
+
}
|
|
953
|
+
const onCustomEnded = t25;
|
|
954
|
+
let t26;
|
|
955
|
+
if ($[20] !== onProgressStep || $[21] !== onTimeUpdate) {
|
|
956
|
+
t26 = () => {
|
|
957
|
+
const {
|
|
958
|
+
current: media_9
|
|
959
|
+
} = ref;
|
|
960
|
+
setCurrentTime(media_9.currentTime);
|
|
961
|
+
if (onTimeUpdate !== null) {
|
|
962
|
+
onTimeUpdate(media_9.currentTime);
|
|
963
|
+
}
|
|
964
|
+
const progress = media_9.currentTime / media_9.duration;
|
|
965
|
+
const currentSteps = progressStepsReached.current;
|
|
966
|
+
const stepsToTrack = progressSteps.filter(step => progress > step && typeof currentSteps[step] === "undefined");
|
|
967
|
+
stepsToTrack.forEach(step_0 => {
|
|
968
|
+
if (onProgressStep !== null) {
|
|
969
|
+
onProgressStep(step_0);
|
|
970
|
+
}
|
|
971
|
+
currentSteps[step_0] = true;
|
|
808
972
|
});
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
var currentSteps = progressStepsReached.current;
|
|
827
|
-
var stepsToTrack = progressSteps.filter(function (step) {
|
|
828
|
-
return progress > step && typeof currentSteps[step] === 'undefined';
|
|
829
|
-
});
|
|
830
|
-
stepsToTrack.forEach(function (step) {
|
|
831
|
-
if (onProgressStep !== null) {
|
|
832
|
-
onProgressStep(step);
|
|
973
|
+
};
|
|
974
|
+
$[20] = onProgressStep;
|
|
975
|
+
$[21] = onTimeUpdate;
|
|
976
|
+
$[22] = t26;
|
|
977
|
+
} else {
|
|
978
|
+
t26 = $[22];
|
|
979
|
+
}
|
|
980
|
+
const onCustomTimeUpdate = t26;
|
|
981
|
+
let t27;
|
|
982
|
+
if ($[23] !== onDurationChanged) {
|
|
983
|
+
t27 = () => {
|
|
984
|
+
const {
|
|
985
|
+
current: media_10
|
|
986
|
+
} = ref;
|
|
987
|
+
setDuration(media_10.duration);
|
|
988
|
+
if (onDurationChanged !== null) {
|
|
989
|
+
onDurationChanged(media_10.duration);
|
|
833
990
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
onSeeked
|
|
848
|
-
|
|
849
|
-
}, [onSeeked]);
|
|
850
|
-
var onCustomVolumeChange = useCallback(function () {
|
|
851
|
-
var media = ref.current;
|
|
852
|
-
setMuted(media.muted);
|
|
853
|
-
if (onVolumeChanged !== null) {
|
|
854
|
-
onVolumeChanged(media.muted, media.volume);
|
|
855
|
-
}
|
|
856
|
-
}, [setMuted, onVolumeChanged]);
|
|
857
|
-
var onCustomLoadStart = useCallback(function () {
|
|
858
|
-
setReady(false);
|
|
859
|
-
if (onLoadStart !== null) {
|
|
860
|
-
onLoadStart();
|
|
861
|
-
}
|
|
862
|
-
}, [setReady, onLoadStart]);
|
|
863
|
-
var onCustomCanPlayThrough = useCallback(function () {
|
|
864
|
-
setReady(true);
|
|
865
|
-
if (onCanPlayThough !== null) {
|
|
866
|
-
onCanPlayThough();
|
|
867
|
-
}
|
|
868
|
-
}, [setReady, onCanPlayThough]);
|
|
869
|
-
useEffect(function () {
|
|
870
|
-
var media = ref.current;
|
|
871
|
-
if (media !== null) {
|
|
872
|
-
media.addEventListener('timeupdate', onCustomTimeUpdate);
|
|
873
|
-
media.addEventListener('durationchange', onCustomDurationChange);
|
|
874
|
-
media.addEventListener('volumechange', onCustomVolumeChange);
|
|
875
|
-
media.addEventListener('play', onCustomPlay);
|
|
876
|
-
media.addEventListener('pause', onCustomPause);
|
|
877
|
-
media.addEventListener('ended', onCustomEnded);
|
|
878
|
-
media.addEventListener('seeked', onCustomSeeked);
|
|
879
|
-
media.addEventListener('loadstart', onCustomLoadStart);
|
|
880
|
-
media.addEventListener('canplaythrough', onCustomCanPlayThrough);
|
|
881
|
-
}
|
|
882
|
-
return function () {
|
|
883
|
-
if (media !== null) {
|
|
884
|
-
media.removeEventListener('timeupdate', onCustomTimeUpdate);
|
|
885
|
-
media.removeEventListener('durationchange', onCustomDurationChange);
|
|
886
|
-
media.removeEventListener('volumechange', onCustomVolumeChange);
|
|
887
|
-
media.removeEventListener('play', onCustomPlay);
|
|
888
|
-
media.removeEventListener('pause', onCustomPause);
|
|
889
|
-
media.removeEventListener('ended', onCustomEnded);
|
|
890
|
-
media.removeEventListener('seeked', onCustomSeeked);
|
|
891
|
-
media.removeEventListener('loadstart', onCustomLoadStart);
|
|
892
|
-
media.removeEventListener('canplaythrough', onCustomCanPlayThrough);
|
|
991
|
+
};
|
|
992
|
+
$[23] = onDurationChanged;
|
|
993
|
+
$[24] = t27;
|
|
994
|
+
} else {
|
|
995
|
+
t27 = $[24];
|
|
996
|
+
}
|
|
997
|
+
const onCustomDurationChange = t27;
|
|
998
|
+
let t28;
|
|
999
|
+
if ($[25] !== onSeeked) {
|
|
1000
|
+
t28 = () => {
|
|
1001
|
+
const {
|
|
1002
|
+
current: media_11
|
|
1003
|
+
} = ref;
|
|
1004
|
+
if (onSeeked !== null) {
|
|
1005
|
+
onSeeked(media_11.currentTime);
|
|
893
1006
|
}
|
|
894
1007
|
};
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1008
|
+
$[25] = onSeeked;
|
|
1009
|
+
$[26] = t28;
|
|
1010
|
+
} else {
|
|
1011
|
+
t28 = $[26];
|
|
1012
|
+
}
|
|
1013
|
+
const onCustomSeeked = t28;
|
|
1014
|
+
let t29;
|
|
1015
|
+
if ($[27] !== onVolumeChanged) {
|
|
1016
|
+
t29 = () => {
|
|
1017
|
+
const {
|
|
1018
|
+
current: media_12
|
|
1019
|
+
} = ref;
|
|
1020
|
+
setMuted(media_12.muted);
|
|
1021
|
+
if (onVolumeChanged !== null) {
|
|
1022
|
+
onVolumeChanged(media_12.muted, media_12.volume);
|
|
1023
|
+
}
|
|
1024
|
+
};
|
|
1025
|
+
$[27] = onVolumeChanged;
|
|
1026
|
+
$[28] = t29;
|
|
1027
|
+
} else {
|
|
1028
|
+
t29 = $[28];
|
|
1029
|
+
}
|
|
1030
|
+
const onCustomVolumeChange = t29;
|
|
1031
|
+
let t30;
|
|
1032
|
+
if ($[29] !== onLoadStart) {
|
|
1033
|
+
t30 = () => {
|
|
1034
|
+
setReady(false);
|
|
1035
|
+
if (onLoadStart !== null) {
|
|
1036
|
+
onLoadStart();
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
$[29] = onLoadStart;
|
|
1040
|
+
$[30] = t30;
|
|
1041
|
+
} else {
|
|
1042
|
+
t30 = $[30];
|
|
1043
|
+
}
|
|
1044
|
+
const onCustomLoadStart = t30;
|
|
1045
|
+
let t31;
|
|
1046
|
+
if ($[31] !== onCanPlayThough) {
|
|
1047
|
+
t31 = () => {
|
|
1048
|
+
setReady(true);
|
|
1049
|
+
if (onCanPlayThough !== null) {
|
|
1050
|
+
onCanPlayThough();
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
$[31] = onCanPlayThough;
|
|
1054
|
+
$[32] = t31;
|
|
1055
|
+
} else {
|
|
1056
|
+
t31 = $[32];
|
|
1057
|
+
}
|
|
1058
|
+
const onCustomCanPlayThrough = t31;
|
|
1059
|
+
let t32;
|
|
1060
|
+
if ($[33] !== onCustomCanPlayThrough || $[34] !== onCustomDurationChange || $[35] !== onCustomEnded || $[36] !== onCustomLoadStart || $[37] !== onCustomPause || $[38] !== onCustomPlay || $[39] !== onCustomSeeked || $[40] !== onCustomTimeUpdate || $[41] !== onCustomVolumeChange) {
|
|
1061
|
+
t32 = () => {
|
|
1062
|
+
const {
|
|
1063
|
+
current: media_13
|
|
1064
|
+
} = ref;
|
|
1065
|
+
if (media_13 !== null) {
|
|
1066
|
+
media_13.addEventListener("timeupdate", onCustomTimeUpdate);
|
|
1067
|
+
media_13.addEventListener("durationchange", onCustomDurationChange);
|
|
1068
|
+
media_13.addEventListener("volumechange", onCustomVolumeChange);
|
|
1069
|
+
media_13.addEventListener("play", onCustomPlay);
|
|
1070
|
+
media_13.addEventListener("pause", onCustomPause);
|
|
1071
|
+
media_13.addEventListener("ended", onCustomEnded);
|
|
1072
|
+
media_13.addEventListener("seeked", onCustomSeeked);
|
|
1073
|
+
media_13.addEventListener("loadstart", onCustomLoadStart);
|
|
1074
|
+
media_13.addEventListener("canplaythrough", onCustomCanPlayThrough);
|
|
1075
|
+
}
|
|
1076
|
+
return () => {
|
|
1077
|
+
if (media_13 !== null) {
|
|
1078
|
+
media_13.removeEventListener("timeupdate", onCustomTimeUpdate);
|
|
1079
|
+
media_13.removeEventListener("durationchange", onCustomDurationChange);
|
|
1080
|
+
media_13.removeEventListener("volumechange", onCustomVolumeChange);
|
|
1081
|
+
media_13.removeEventListener("play", onCustomPlay);
|
|
1082
|
+
media_13.removeEventListener("pause", onCustomPause);
|
|
1083
|
+
media_13.removeEventListener("ended", onCustomEnded);
|
|
1084
|
+
media_13.removeEventListener("seeked", onCustomSeeked);
|
|
1085
|
+
media_13.removeEventListener("loadstart", onCustomLoadStart);
|
|
1086
|
+
media_13.removeEventListener("canplaythrough", onCustomCanPlayThrough);
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
$[33] = onCustomCanPlayThrough;
|
|
1091
|
+
$[34] = onCustomDurationChange;
|
|
1092
|
+
$[35] = onCustomEnded;
|
|
1093
|
+
$[36] = onCustomLoadStart;
|
|
1094
|
+
$[37] = onCustomPause;
|
|
1095
|
+
$[38] = onCustomPlay;
|
|
1096
|
+
$[39] = onCustomSeeked;
|
|
1097
|
+
$[40] = onCustomTimeUpdate;
|
|
1098
|
+
$[41] = onCustomVolumeChange;
|
|
1099
|
+
$[42] = t32;
|
|
1100
|
+
} else {
|
|
1101
|
+
t32 = $[42];
|
|
1102
|
+
}
|
|
1103
|
+
let t33;
|
|
1104
|
+
if ($[43] !== url) {
|
|
1105
|
+
t33 = [url];
|
|
1106
|
+
$[43] = url;
|
|
1107
|
+
$[44] = t33;
|
|
1108
|
+
} else {
|
|
1109
|
+
t33 = $[44];
|
|
1110
|
+
}
|
|
1111
|
+
useEffect(t32, t33);
|
|
1112
|
+
let t34;
|
|
1113
|
+
if ($[45] !== currentTime || $[46] !== duration || $[47] !== muted || $[48] !== paused || $[49] !== playing || $[50] !== ready || $[51] !== toggleMute || $[52] !== togglePlay) {
|
|
1114
|
+
t34 = {
|
|
1115
|
+
ref,
|
|
1116
|
+
play,
|
|
1117
|
+
pause,
|
|
1118
|
+
togglePlay,
|
|
1119
|
+
stop,
|
|
1120
|
+
seek,
|
|
1121
|
+
mute,
|
|
1122
|
+
unMute,
|
|
1123
|
+
toggleMute,
|
|
1124
|
+
muted,
|
|
1125
|
+
currentTime,
|
|
1126
|
+
duration,
|
|
1127
|
+
playing,
|
|
1128
|
+
paused,
|
|
1129
|
+
ready
|
|
1130
|
+
};
|
|
1131
|
+
$[45] = currentTime;
|
|
1132
|
+
$[46] = duration;
|
|
1133
|
+
$[47] = muted;
|
|
1134
|
+
$[48] = paused;
|
|
1135
|
+
$[49] = playing;
|
|
1136
|
+
$[50] = ready;
|
|
1137
|
+
$[51] = toggleMute;
|
|
1138
|
+
$[52] = togglePlay;
|
|
1139
|
+
$[53] = t34;
|
|
1140
|
+
} else {
|
|
1141
|
+
t34 = $[53];
|
|
1142
|
+
}
|
|
1143
|
+
return t34;
|
|
913
1144
|
}
|
|
914
1145
|
|
|
915
1146
|
function useMediasParser() {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
// screensManager,
|
|
923
|
-
fieldsManager: fieldsManager
|
|
1147
|
+
const $ = c(10);
|
|
1148
|
+
const fieldsManager = useFieldsManager();
|
|
1149
|
+
let t0;
|
|
1150
|
+
if ($[0] !== fieldsManager) {
|
|
1151
|
+
t0 = new MediasParser({
|
|
1152
|
+
fieldsManager
|
|
924
1153
|
});
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
1154
|
+
$[0] = fieldsManager;
|
|
1155
|
+
$[1] = t0;
|
|
1156
|
+
} else {
|
|
1157
|
+
t0 = $[1];
|
|
1158
|
+
}
|
|
1159
|
+
const parser = t0;
|
|
1160
|
+
let t1;
|
|
1161
|
+
if ($[2] !== parser) {
|
|
1162
|
+
t1 = story => parser.toPath(story);
|
|
1163
|
+
$[2] = parser;
|
|
1164
|
+
$[3] = t1;
|
|
1165
|
+
} else {
|
|
1166
|
+
t1 = $[3];
|
|
1167
|
+
}
|
|
1168
|
+
const toPath = t1;
|
|
1169
|
+
let t2;
|
|
1170
|
+
if ($[4] !== parser) {
|
|
1171
|
+
t2 = story_0 => parser.fromPath(story_0);
|
|
1172
|
+
$[4] = parser;
|
|
1173
|
+
$[5] = t2;
|
|
1174
|
+
} else {
|
|
1175
|
+
t2 = $[5];
|
|
1176
|
+
}
|
|
1177
|
+
const fromPath = t2;
|
|
1178
|
+
let t3;
|
|
1179
|
+
if ($[6] !== fromPath || $[7] !== parser || $[8] !== toPath) {
|
|
1180
|
+
t3 = {
|
|
1181
|
+
toPath,
|
|
1182
|
+
fromPath,
|
|
1183
|
+
parser
|
|
1184
|
+
};
|
|
1185
|
+
$[6] = fromPath;
|
|
1186
|
+
$[7] = parser;
|
|
1187
|
+
$[8] = toPath;
|
|
1188
|
+
$[9] = t3;
|
|
1189
|
+
} else {
|
|
1190
|
+
t3 = $[9];
|
|
1191
|
+
}
|
|
1192
|
+
return t3;
|
|
937
1193
|
}
|
|
938
1194
|
|
|
939
|
-
function useResourceTypeName(resource) {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1195
|
+
function useResourceTypeName(resource, t0) {
|
|
1196
|
+
const $ = c(7);
|
|
1197
|
+
const type = t0 === undefined ? null : t0;
|
|
1198
|
+
let t1;
|
|
1199
|
+
bb0: {
|
|
1200
|
+
let t2;
|
|
1201
|
+
if ($[0] !== resource) {
|
|
1202
|
+
t2 = resource || {};
|
|
1203
|
+
$[0] = resource;
|
|
1204
|
+
$[1] = t2;
|
|
1205
|
+
} else {
|
|
1206
|
+
t2 = $[1];
|
|
1207
|
+
}
|
|
1208
|
+
const {
|
|
1209
|
+
name: t3,
|
|
1210
|
+
types: t4,
|
|
1211
|
+
settings: t5
|
|
1212
|
+
} = t2;
|
|
1213
|
+
const resourceName = t3 === undefined ? null : t3;
|
|
1214
|
+
let t6;
|
|
1215
|
+
if ($[2] !== t4) {
|
|
1216
|
+
t6 = t4 === undefined ? [] : t4;
|
|
1217
|
+
$[2] = t4;
|
|
1218
|
+
$[3] = t6;
|
|
1219
|
+
} else {
|
|
1220
|
+
t6 = $[3];
|
|
1221
|
+
}
|
|
1222
|
+
const types = t6;
|
|
1223
|
+
const settings = t5 === undefined ? {} : t5;
|
|
1224
|
+
const {
|
|
1225
|
+
hideTypeNames: t7
|
|
1226
|
+
} = settings || {};
|
|
1227
|
+
const hideTypeNames = t7 === undefined ? false : t7;
|
|
952
1228
|
if (hideTypeNames) {
|
|
953
|
-
|
|
1229
|
+
t1 = null;
|
|
1230
|
+
break bb0;
|
|
954
1231
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1232
|
+
let t8;
|
|
1233
|
+
if ($[4] !== type || $[5] !== types) {
|
|
1234
|
+
t8 = type !== null && types !== null && types.length > 1 ? (types || []).find(t9 => {
|
|
1235
|
+
const {
|
|
1236
|
+
id: t10
|
|
1237
|
+
} = t9;
|
|
1238
|
+
const id = t10 === undefined ? null : t10;
|
|
958
1239
|
return id === type;
|
|
959
|
-
}) || {} : {}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1240
|
+
}) || {} : {};
|
|
1241
|
+
$[4] = type;
|
|
1242
|
+
$[5] = types;
|
|
1243
|
+
$[6] = t8;
|
|
1244
|
+
} else {
|
|
1245
|
+
t8 = $[6];
|
|
1246
|
+
}
|
|
1247
|
+
const {
|
|
1248
|
+
name: t9
|
|
1249
|
+
} = t8;
|
|
1250
|
+
const name = t9 === undefined ? null : t9;
|
|
1251
|
+
t1 = name === resourceName ? null : name;
|
|
1252
|
+
}
|
|
1253
|
+
const typeName = t1;
|
|
964
1254
|
return typeName;
|
|
965
1255
|
}
|
|
966
1256
|
|
|
967
1257
|
function getResource(resources, resourceId) {
|
|
968
|
-
return resourceId !== null && !isObject(resourceId) ? resources.find(
|
|
969
|
-
return it.id === resourceId;
|
|
970
|
-
}) || null : resourceId;
|
|
1258
|
+
return resourceId !== null && !isObject(resourceId) ? resources.find(it => it.id === resourceId) || null : resourceId;
|
|
971
1259
|
}
|
|
972
|
-
function useResourceUrlGenerator() {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1260
|
+
function useResourceUrlGenerator(t0) {
|
|
1261
|
+
const $ = c(9);
|
|
1262
|
+
const resourceId = t0 === undefined ? null : t0;
|
|
1263
|
+
const resources = usePanneauResources();
|
|
1264
|
+
const contextResource = useResource();
|
|
1265
|
+
let t1;
|
|
1266
|
+
if ($[0] !== contextResource || $[1] !== resourceId || $[2] !== resources) {
|
|
1267
|
+
t1 = getResource(resources, resourceId) || contextResource;
|
|
1268
|
+
$[0] = contextResource;
|
|
1269
|
+
$[1] = resourceId;
|
|
1270
|
+
$[2] = resources;
|
|
1271
|
+
$[3] = t1;
|
|
1272
|
+
} else {
|
|
1273
|
+
t1 = $[3];
|
|
1274
|
+
}
|
|
1275
|
+
const resource = t1;
|
|
1276
|
+
const route = useUrlGenerator();
|
|
1277
|
+
let t2;
|
|
1278
|
+
if ($[4] !== resource || $[5] !== resourceId || $[6] !== resources || $[7] !== route) {
|
|
1279
|
+
t2 = (routeResourceId, t3, t4) => {
|
|
1280
|
+
const routeName = t3 === undefined ? null : t3;
|
|
1281
|
+
const params = t4 === undefined ? null : t4;
|
|
1282
|
+
const finalRouteName = resourceId !== null ? routeResourceId : routeName;
|
|
1283
|
+
const finalParams = resourceId !== null ? routeName : params;
|
|
1284
|
+
const finalResource = getResource(resources, routeResourceId) || resource;
|
|
1285
|
+
const {
|
|
1286
|
+
id: t5
|
|
1287
|
+
} = finalResource || {};
|
|
1288
|
+
const id = t5 === undefined ? null : t5;
|
|
1289
|
+
const finalRoute = id !== null ? route(`resources.${finalRouteName}`, {
|
|
1290
|
+
...finalParams,
|
|
1291
|
+
resource: id
|
|
1292
|
+
}) : null;
|
|
1293
|
+
return finalRoute;
|
|
1294
|
+
};
|
|
1295
|
+
$[4] = resource;
|
|
1296
|
+
$[5] = resourceId;
|
|
1297
|
+
$[6] = resources;
|
|
1298
|
+
$[7] = route;
|
|
1299
|
+
$[8] = t2;
|
|
1300
|
+
} else {
|
|
1301
|
+
t2 = $[8];
|
|
1302
|
+
}
|
|
1303
|
+
return t2;
|
|
992
1304
|
}
|
|
993
1305
|
|
|
994
|
-
function useQuery() {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1306
|
+
function useQuery(t0, t1) {
|
|
1307
|
+
const $ = c(15);
|
|
1308
|
+
const initialBaseQuery = t0 === undefined ? null : t0;
|
|
1309
|
+
const paginated = t1 === undefined ? true : t1;
|
|
1310
|
+
let t2;
|
|
1311
|
+
if ($[0] !== initialBaseQuery || $[1] !== paginated) {
|
|
1312
|
+
t2 = paginated ? {
|
|
999
1313
|
page: 1,
|
|
1000
|
-
count: 10
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1314
|
+
count: 10,
|
|
1315
|
+
...(initialBaseQuery || {})
|
|
1316
|
+
} : initialBaseQuery || null;
|
|
1317
|
+
$[0] = initialBaseQuery;
|
|
1318
|
+
$[1] = paginated;
|
|
1319
|
+
$[2] = t2;
|
|
1320
|
+
} else {
|
|
1321
|
+
t2 = $[2];
|
|
1322
|
+
}
|
|
1323
|
+
const initialQuery = t2;
|
|
1324
|
+
const [query, setQuery] = useState(initialQuery);
|
|
1325
|
+
let t3;
|
|
1326
|
+
let t4;
|
|
1327
|
+
if ($[3] !== initialQuery) {
|
|
1328
|
+
t3 = () => {
|
|
1329
|
+
setQuery(initialQuery);
|
|
1330
|
+
};
|
|
1331
|
+
t4 = [initialQuery, setQuery];
|
|
1332
|
+
$[3] = initialQuery;
|
|
1333
|
+
$[4] = t3;
|
|
1334
|
+
$[5] = t4;
|
|
1335
|
+
} else {
|
|
1336
|
+
t3 = $[4];
|
|
1337
|
+
t4 = $[5];
|
|
1338
|
+
}
|
|
1339
|
+
useEffect(t3, t4);
|
|
1340
|
+
let t5;
|
|
1341
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1342
|
+
t5 = newPage => {
|
|
1343
|
+
if (newPage !== null) {
|
|
1344
|
+
setQuery(prev => ({
|
|
1345
|
+
...(prev || {}),
|
|
1014
1346
|
page: newPage || 1
|
|
1015
|
-
});
|
|
1347
|
+
}));
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
$[6] = t5;
|
|
1351
|
+
} else {
|
|
1352
|
+
t5 = $[6];
|
|
1353
|
+
}
|
|
1354
|
+
const onPageChange = t5;
|
|
1355
|
+
let t6;
|
|
1356
|
+
if ($[7] !== initialQuery) {
|
|
1357
|
+
t6 = newQuery => {
|
|
1358
|
+
const finalQuery = newQuery !== null ? Object.keys(newQuery).reduce((currentQuery, key) => {
|
|
1359
|
+
const val = newQuery[key];
|
|
1360
|
+
return val !== null ? {
|
|
1361
|
+
...(currentQuery || {}),
|
|
1362
|
+
[key]: val
|
|
1363
|
+
} : currentQuery;
|
|
1364
|
+
}, null) : null;
|
|
1365
|
+
setQuery({
|
|
1366
|
+
...(initialQuery || {}),
|
|
1367
|
+
...(finalQuery || {})
|
|
1016
1368
|
});
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1369
|
+
};
|
|
1370
|
+
$[7] = initialQuery;
|
|
1371
|
+
$[8] = t6;
|
|
1372
|
+
} else {
|
|
1373
|
+
t6 = $[8];
|
|
1374
|
+
}
|
|
1375
|
+
const onQueryChange = t6;
|
|
1376
|
+
let t7;
|
|
1377
|
+
if ($[9] !== initialQuery) {
|
|
1378
|
+
t7 = () => {
|
|
1379
|
+
setQuery(initialQuery);
|
|
1380
|
+
};
|
|
1381
|
+
$[9] = initialQuery;
|
|
1382
|
+
$[10] = t7;
|
|
1383
|
+
} else {
|
|
1384
|
+
t7 = $[10];
|
|
1385
|
+
}
|
|
1386
|
+
const onQueryReset = t7;
|
|
1387
|
+
let t8;
|
|
1388
|
+
if ($[11] !== onQueryChange || $[12] !== onQueryReset || $[13] !== query) {
|
|
1389
|
+
t8 = {
|
|
1390
|
+
query,
|
|
1391
|
+
onPageChange,
|
|
1392
|
+
onQueryChange,
|
|
1393
|
+
onQueryReset
|
|
1394
|
+
};
|
|
1395
|
+
$[11] = onQueryChange;
|
|
1396
|
+
$[12] = onQueryReset;
|
|
1397
|
+
$[13] = query;
|
|
1398
|
+
$[14] = t8;
|
|
1399
|
+
} else {
|
|
1400
|
+
t8 = $[14];
|
|
1401
|
+
}
|
|
1402
|
+
return t8;
|
|
1035
1403
|
}
|
|
1036
1404
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1405
|
+
function useScreenSize(t0) {
|
|
1406
|
+
const $ = c(20);
|
|
1407
|
+
const {
|
|
1408
|
+
width: t1,
|
|
1409
|
+
height: t2,
|
|
1410
|
+
landscape: t3,
|
|
1411
|
+
screens: t4,
|
|
1412
|
+
mediaType: t5,
|
|
1413
|
+
media: t6
|
|
1414
|
+
} = t0;
|
|
1415
|
+
const width = t1 === undefined ? null : t1;
|
|
1416
|
+
const height = t2 === undefined ? null : t2;
|
|
1417
|
+
const landscape = t3 === undefined ? false : t3;
|
|
1418
|
+
let t7;
|
|
1419
|
+
if ($[0] !== t4) {
|
|
1420
|
+
t7 = t4 === undefined ? [] : t4;
|
|
1421
|
+
$[0] = t4;
|
|
1422
|
+
$[1] = t7;
|
|
1423
|
+
} else {
|
|
1424
|
+
t7 = $[1];
|
|
1425
|
+
}
|
|
1426
|
+
const screens = t7;
|
|
1427
|
+
const mediaType = t5 === undefined ? "screen" : t5;
|
|
1428
|
+
const providedMedia = t6 === undefined ? null : t6;
|
|
1429
|
+
let t8;
|
|
1430
|
+
if ($[2] !== height || $[3] !== mediaType || $[4] !== providedMedia || $[5] !== width) {
|
|
1431
|
+
t8 = providedMedia !== null ? providedMedia : {
|
|
1055
1432
|
type: mediaType,
|
|
1056
|
-
width:
|
|
1057
|
-
height:
|
|
1433
|
+
width: `${width}px`,
|
|
1434
|
+
height: `${height}px`
|
|
1058
1435
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1436
|
+
$[2] = height;
|
|
1437
|
+
$[3] = mediaType;
|
|
1438
|
+
$[4] = providedMedia;
|
|
1439
|
+
$[5] = width;
|
|
1440
|
+
$[6] = t8;
|
|
1441
|
+
} else {
|
|
1442
|
+
t8 = $[6];
|
|
1443
|
+
}
|
|
1444
|
+
const media = t8;
|
|
1445
|
+
let t9;
|
|
1446
|
+
if ($[7] !== media || $[8] !== screens) {
|
|
1447
|
+
let t10;
|
|
1448
|
+
if ($[10] !== media) {
|
|
1449
|
+
t10 = t11 => {
|
|
1450
|
+
const {
|
|
1451
|
+
mediaQuery: t12
|
|
1452
|
+
} = t11;
|
|
1453
|
+
const mediaQuery = t12 === undefined ? null : t12;
|
|
1454
|
+
return mediaQuery === null || match(mediaQuery, media);
|
|
1455
|
+
};
|
|
1456
|
+
$[10] = media;
|
|
1457
|
+
$[11] = t10;
|
|
1458
|
+
} else {
|
|
1459
|
+
t10 = $[11];
|
|
1460
|
+
}
|
|
1461
|
+
t9 = [...screens].reverse().filter(t10);
|
|
1462
|
+
$[7] = media;
|
|
1463
|
+
$[8] = screens;
|
|
1464
|
+
$[9] = t9;
|
|
1465
|
+
} else {
|
|
1466
|
+
t9 = $[9];
|
|
1467
|
+
}
|
|
1468
|
+
const matchingScreens = t9;
|
|
1469
|
+
const t10 = matchingScreens.length > 0 ? matchingScreens[0].name : null;
|
|
1470
|
+
let t11;
|
|
1471
|
+
if ($[12] !== matchingScreens) {
|
|
1472
|
+
t11 = [...matchingScreens].reverse().map(_temp);
|
|
1473
|
+
$[12] = matchingScreens;
|
|
1474
|
+
$[13] = t11;
|
|
1475
|
+
} else {
|
|
1476
|
+
t11 = $[13];
|
|
1477
|
+
}
|
|
1478
|
+
let t12;
|
|
1479
|
+
if ($[14] !== height || $[15] !== landscape || $[16] !== t10 || $[17] !== t11 || $[18] !== width) {
|
|
1480
|
+
t12 = {
|
|
1481
|
+
screen: t10,
|
|
1482
|
+
screens: t11,
|
|
1483
|
+
width,
|
|
1484
|
+
height,
|
|
1485
|
+
landscape
|
|
1486
|
+
};
|
|
1487
|
+
$[14] = height;
|
|
1488
|
+
$[15] = landscape;
|
|
1489
|
+
$[16] = t10;
|
|
1490
|
+
$[17] = t11;
|
|
1491
|
+
$[18] = width;
|
|
1492
|
+
$[19] = t12;
|
|
1493
|
+
} else {
|
|
1494
|
+
t12 = $[19];
|
|
1495
|
+
}
|
|
1496
|
+
return t12;
|
|
1497
|
+
}
|
|
1498
|
+
function _temp(t0) {
|
|
1499
|
+
const {
|
|
1500
|
+
name
|
|
1501
|
+
} = t0;
|
|
1502
|
+
return name;
|
|
1079
1503
|
}
|
|
1080
|
-
function useScreenSizeFromElement() {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1504
|
+
function useScreenSizeFromElement(t0) {
|
|
1505
|
+
const $ = c(28);
|
|
1506
|
+
let t1;
|
|
1507
|
+
if ($[0] !== t0) {
|
|
1508
|
+
t1 = t0 === undefined ? {} : t0;
|
|
1509
|
+
$[0] = t0;
|
|
1510
|
+
$[1] = t1;
|
|
1511
|
+
} else {
|
|
1512
|
+
t1 = $[1];
|
|
1513
|
+
}
|
|
1514
|
+
let opts;
|
|
1515
|
+
let t2;
|
|
1516
|
+
let t3;
|
|
1517
|
+
if ($[2] !== t1) {
|
|
1518
|
+
({
|
|
1519
|
+
width: t2,
|
|
1520
|
+
height: t3,
|
|
1521
|
+
...opts
|
|
1522
|
+
} = t1);
|
|
1523
|
+
$[2] = t1;
|
|
1524
|
+
$[3] = opts;
|
|
1525
|
+
$[4] = t2;
|
|
1526
|
+
$[5] = t3;
|
|
1527
|
+
} else {
|
|
1528
|
+
opts = $[3];
|
|
1529
|
+
t2 = $[4];
|
|
1530
|
+
t3 = $[5];
|
|
1531
|
+
}
|
|
1532
|
+
const width = t2 === undefined ? null : t2;
|
|
1533
|
+
const height = t3 === undefined ? null : t3;
|
|
1534
|
+
const {
|
|
1535
|
+
ref,
|
|
1536
|
+
entry: t4
|
|
1537
|
+
} = useResizeObserver();
|
|
1538
|
+
const {
|
|
1539
|
+
contentRect
|
|
1540
|
+
} = t4;
|
|
1541
|
+
let t5;
|
|
1542
|
+
if ($[6] !== contentRect) {
|
|
1543
|
+
t5 = contentRect || {};
|
|
1544
|
+
$[6] = contentRect;
|
|
1545
|
+
$[7] = t5;
|
|
1546
|
+
} else {
|
|
1547
|
+
t5 = $[7];
|
|
1548
|
+
}
|
|
1549
|
+
const {
|
|
1550
|
+
width: t6,
|
|
1551
|
+
height: t7
|
|
1552
|
+
} = t5;
|
|
1553
|
+
const calculatedWidth = t6 === undefined ? 0 : t6;
|
|
1554
|
+
const calculatedHeight = t7 === undefined ? 0 : t7;
|
|
1555
|
+
const semiFinalWidth = width !== null ? width : calculatedWidth;
|
|
1556
|
+
const semiFinalHeight = height !== null ? height : calculatedHeight;
|
|
1557
|
+
const landscape = semiFinalHeight > 0 && semiFinalWidth > semiFinalHeight;
|
|
1558
|
+
let restOpts;
|
|
1559
|
+
let t8;
|
|
1560
|
+
if ($[8] !== opts) {
|
|
1561
|
+
({
|
|
1562
|
+
withoutMaxSize: t8,
|
|
1563
|
+
...restOpts
|
|
1564
|
+
} = opts);
|
|
1565
|
+
$[8] = opts;
|
|
1566
|
+
$[9] = restOpts;
|
|
1567
|
+
$[10] = t8;
|
|
1568
|
+
} else {
|
|
1569
|
+
restOpts = $[9];
|
|
1570
|
+
t8 = $[10];
|
|
1571
|
+
}
|
|
1572
|
+
const withoutMaxSize = t8 === undefined ? false : t8;
|
|
1573
|
+
let t9;
|
|
1574
|
+
if ($[11] !== landscape || $[12] !== semiFinalHeight || $[13] !== semiFinalWidth || $[14] !== withoutMaxSize) {
|
|
1575
|
+
t9 = landscape && !withoutMaxSize ? Math.round(Math.max(320, 0.45 * semiFinalHeight)) : semiFinalWidth;
|
|
1576
|
+
$[11] = landscape;
|
|
1577
|
+
$[12] = semiFinalHeight;
|
|
1578
|
+
$[13] = semiFinalWidth;
|
|
1579
|
+
$[14] = withoutMaxSize;
|
|
1580
|
+
$[15] = t9;
|
|
1581
|
+
} else {
|
|
1582
|
+
t9 = $[15];
|
|
1583
|
+
}
|
|
1584
|
+
let finalWidth = t9;
|
|
1585
|
+
let t10;
|
|
1586
|
+
if ($[16] !== landscape || $[17] !== semiFinalHeight || $[18] !== withoutMaxSize) {
|
|
1587
|
+
t10 = landscape && !withoutMaxSize ? Math.round(Math.max(533, 0.75 * semiFinalHeight)) : semiFinalHeight;
|
|
1588
|
+
$[16] = landscape;
|
|
1589
|
+
$[17] = semiFinalHeight;
|
|
1590
|
+
$[18] = withoutMaxSize;
|
|
1591
|
+
$[19] = t10;
|
|
1592
|
+
} else {
|
|
1593
|
+
t10 = $[19];
|
|
1594
|
+
}
|
|
1595
|
+
let finalHeight = t10;
|
|
1103
1596
|
if (finalWidth % 2 === 1) {
|
|
1104
|
-
finalWidth
|
|
1597
|
+
finalWidth = finalWidth - 1;
|
|
1105
1598
|
}
|
|
1106
1599
|
if (finalHeight % 2 === 1) {
|
|
1107
|
-
finalHeight
|
|
1600
|
+
finalHeight = finalHeight - 1;
|
|
1108
1601
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1602
|
+
let t11;
|
|
1603
|
+
if ($[20] !== finalHeight || $[21] !== finalWidth || $[22] !== landscape || $[23] !== restOpts) {
|
|
1604
|
+
t11 = {
|
|
1605
|
+
width: finalWidth,
|
|
1606
|
+
height: finalHeight,
|
|
1607
|
+
landscape,
|
|
1608
|
+
...restOpts
|
|
1609
|
+
};
|
|
1610
|
+
$[20] = finalHeight;
|
|
1611
|
+
$[21] = finalWidth;
|
|
1612
|
+
$[22] = landscape;
|
|
1613
|
+
$[23] = restOpts;
|
|
1614
|
+
$[24] = t11;
|
|
1615
|
+
} else {
|
|
1616
|
+
t11 = $[24];
|
|
1617
|
+
}
|
|
1618
|
+
const screenSize = useScreenSize(t11);
|
|
1619
|
+
let t12;
|
|
1620
|
+
if ($[25] !== ref || $[26] !== screenSize) {
|
|
1621
|
+
t12 = {
|
|
1622
|
+
ref,
|
|
1623
|
+
screenSize
|
|
1624
|
+
};
|
|
1625
|
+
$[25] = ref;
|
|
1626
|
+
$[26] = screenSize;
|
|
1627
|
+
$[27] = t12;
|
|
1628
|
+
} else {
|
|
1629
|
+
t12 = $[27];
|
|
1630
|
+
}
|
|
1631
|
+
return t12;
|
|
1118
1632
|
}
|
|
1119
1633
|
function getWindowSize() {
|
|
1120
1634
|
return {
|
|
@@ -1122,29 +1636,63 @@ function getWindowSize() {
|
|
|
1122
1636
|
height: typeof window !== 'undefined' ? window.innerHeight : null
|
|
1123
1637
|
};
|
|
1124
1638
|
}
|
|
1125
|
-
function useScreenSizeFromWindow() {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1639
|
+
function useScreenSizeFromWindow(t0) {
|
|
1640
|
+
const $ = c(8);
|
|
1641
|
+
let t1;
|
|
1642
|
+
if ($[0] !== t0) {
|
|
1643
|
+
t1 = t0 === undefined ? {} : t0;
|
|
1644
|
+
$[0] = t0;
|
|
1645
|
+
$[1] = t1;
|
|
1646
|
+
} else {
|
|
1647
|
+
t1 = $[1];
|
|
1648
|
+
}
|
|
1649
|
+
const opts = t1;
|
|
1650
|
+
let t2;
|
|
1651
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1652
|
+
t2 = getWindowSize();
|
|
1653
|
+
$[2] = t2;
|
|
1654
|
+
} else {
|
|
1655
|
+
t2 = $[2];
|
|
1656
|
+
}
|
|
1657
|
+
const [windowSize, setWindowSize] = useState(t2);
|
|
1658
|
+
let t3;
|
|
1659
|
+
let t4;
|
|
1660
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1661
|
+
t3 = () => {
|
|
1662
|
+
const onResize = () => setWindowSize(getWindowSize());
|
|
1663
|
+
if (typeof window !== "undefined") {
|
|
1664
|
+
window.addEventListener("resize", onResize);
|
|
1141
1665
|
}
|
|
1666
|
+
return () => {
|
|
1667
|
+
if (typeof window !== "undefined") {
|
|
1668
|
+
window.removeEventListener("resize", onResize);
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1142
1671
|
};
|
|
1143
|
-
|
|
1144
|
-
|
|
1672
|
+
t4 = [setWindowSize];
|
|
1673
|
+
$[3] = t3;
|
|
1674
|
+
$[4] = t4;
|
|
1675
|
+
} else {
|
|
1676
|
+
t3 = $[3];
|
|
1677
|
+
t4 = $[4];
|
|
1678
|
+
}
|
|
1679
|
+
useEffect(t3, t4);
|
|
1680
|
+
let t5;
|
|
1681
|
+
if ($[5] !== opts || $[6] !== windowSize) {
|
|
1682
|
+
t5 = {
|
|
1683
|
+
...opts,
|
|
1684
|
+
...windowSize
|
|
1685
|
+
};
|
|
1686
|
+
$[5] = opts;
|
|
1687
|
+
$[6] = windowSize;
|
|
1688
|
+
$[7] = t5;
|
|
1689
|
+
} else {
|
|
1690
|
+
t5 = $[7];
|
|
1691
|
+
}
|
|
1692
|
+
return useScreenSize(t5);
|
|
1145
1693
|
}
|
|
1146
1694
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1695
|
+
const eventsManager = typeof window !== 'undefined' ? new EventsManager(window) : null;
|
|
1696
|
+
const useWindowEvent = createUseEvent(eventsManager);
|
|
1149
1697
|
|
|
1150
1698
|
export { KEYCODES, getObserver, useAnimationFrame, useDocumentEvent, useForm, useFormattedDate, useFormattedTime, useIntersectionObserver, useIsVisible, useKeyboardKeys, useLoadedFonts, useMediaApi, useMediasParser, useObserver, useQuery, useResizeObserver, useResourceTypeName, useResourceUrlGenerator, useScreenSizeFromElement, useScreenSizeFromWindow, useWindowEvent };
|