@sledge-app/react-instant-search 0.0.80 → 0.0.82
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/components/ProductFilterWidget/ProductFilterWidget.d.ts +1 -1
- package/dist/components/ProductFilterWidget/ProductFilterWidget.d.ts.map +1 -1
- package/dist/components/ProductFilterWidget/ProductFilterWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetPopup.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts +1 -0
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchWidget/SearchWidget.d.ts.map +1 -1
- package/dist/components/SearchWidget/SearchWidgetInitSelector.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +149 -99
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/vendor-024ba8ae.cjs +2 -0
- package/dist/vendor-024ba8ae.cjs.map +1 -0
- package/dist/{vendor-eeee87f8.js → vendor-90dfd914.js} +18 -637
- package/dist/vendor-90dfd914.js.map +1 -0
- package/package.json +1 -1
- package/dist/vendor-b4f78627.cjs +0 -2
- package/dist/vendor-b4f78627.cjs.map +0 -1
- package/dist/vendor-eeee87f8.js.map +0 -1
|
@@ -939,625 +939,6 @@ if (process.env.NODE_ENV === "production") {
|
|
|
939
939
|
} else {
|
|
940
940
|
m$4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
941
941
|
}
|
|
942
|
-
var useSyncExternalStoreShim_production_min = {};
|
|
943
|
-
/**
|
|
944
|
-
* @license React
|
|
945
|
-
* use-sync-external-store-shim.production.min.js
|
|
946
|
-
*
|
|
947
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
948
|
-
*
|
|
949
|
-
* This source code is licensed under the MIT license found in the
|
|
950
|
-
* LICENSE file in the root directory of this source tree.
|
|
951
|
-
*/
|
|
952
|
-
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
953
|
-
function requireUseSyncExternalStoreShim_production_min() {
|
|
954
|
-
if (hasRequiredUseSyncExternalStoreShim_production_min)
|
|
955
|
-
return useSyncExternalStoreShim_production_min;
|
|
956
|
-
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
957
|
-
var e2 = React__default;
|
|
958
|
-
function h2(a2, b2) {
|
|
959
|
-
return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
|
|
960
|
-
}
|
|
961
|
-
var k2 = "function" === typeof Object.is ? Object.is : h2, l2 = e2.useState, m2 = e2.useEffect, n2 = e2.useLayoutEffect, p2 = e2.useDebugValue;
|
|
962
|
-
function q(a2, b2) {
|
|
963
|
-
var d2 = b2(), f2 = l2({ inst: { value: d2, getSnapshot: b2 } }), c2 = f2[0].inst, g2 = f2[1];
|
|
964
|
-
n2(function() {
|
|
965
|
-
c2.value = d2;
|
|
966
|
-
c2.getSnapshot = b2;
|
|
967
|
-
r2(c2) && g2({ inst: c2 });
|
|
968
|
-
}, [a2, d2, b2]);
|
|
969
|
-
m2(function() {
|
|
970
|
-
r2(c2) && g2({ inst: c2 });
|
|
971
|
-
return a2(function() {
|
|
972
|
-
r2(c2) && g2({ inst: c2 });
|
|
973
|
-
});
|
|
974
|
-
}, [a2]);
|
|
975
|
-
p2(d2);
|
|
976
|
-
return d2;
|
|
977
|
-
}
|
|
978
|
-
function r2(a2) {
|
|
979
|
-
var b2 = a2.getSnapshot;
|
|
980
|
-
a2 = a2.value;
|
|
981
|
-
try {
|
|
982
|
-
var d2 = b2();
|
|
983
|
-
return !k2(a2, d2);
|
|
984
|
-
} catch (f2) {
|
|
985
|
-
return true;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
function t2(a2, b2) {
|
|
989
|
-
return b2();
|
|
990
|
-
}
|
|
991
|
-
var u2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t2 : q;
|
|
992
|
-
useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e2.useSyncExternalStore ? e2.useSyncExternalStore : u2;
|
|
993
|
-
return useSyncExternalStoreShim_production_min;
|
|
994
|
-
}
|
|
995
|
-
var useSyncExternalStoreShim_development = {};
|
|
996
|
-
/**
|
|
997
|
-
* @license React
|
|
998
|
-
* use-sync-external-store-shim.development.js
|
|
999
|
-
*
|
|
1000
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1001
|
-
*
|
|
1002
|
-
* This source code is licensed under the MIT license found in the
|
|
1003
|
-
* LICENSE file in the root directory of this source tree.
|
|
1004
|
-
*/
|
|
1005
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
1006
|
-
function requireUseSyncExternalStoreShim_development() {
|
|
1007
|
-
if (hasRequiredUseSyncExternalStoreShim_development)
|
|
1008
|
-
return useSyncExternalStoreShim_development;
|
|
1009
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
1010
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1011
|
-
(function() {
|
|
1012
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
1013
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1014
|
-
}
|
|
1015
|
-
var React2 = React__default;
|
|
1016
|
-
var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1017
|
-
function error(format) {
|
|
1018
|
-
{
|
|
1019
|
-
{
|
|
1020
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1021
|
-
args[_key2 - 1] = arguments[_key2];
|
|
1022
|
-
}
|
|
1023
|
-
printWarning("error", format, args);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
function printWarning(level, format, args) {
|
|
1028
|
-
{
|
|
1029
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1030
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1031
|
-
if (stack !== "") {
|
|
1032
|
-
format += "%s";
|
|
1033
|
-
args = args.concat([stack]);
|
|
1034
|
-
}
|
|
1035
|
-
var argsWithFormat = args.map(function(item) {
|
|
1036
|
-
return String(item);
|
|
1037
|
-
});
|
|
1038
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
1039
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
function is(x2, y2) {
|
|
1043
|
-
return x2 === y2 && (x2 !== 0 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1044
|
-
}
|
|
1045
|
-
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
1046
|
-
var useState2 = React2.useState, useEffect2 = React2.useEffect, useLayoutEffect2 = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
|
|
1047
|
-
var didWarnOld18Alpha = false;
|
|
1048
|
-
var didWarnUncachedGetSnapshot = false;
|
|
1049
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1050
|
-
{
|
|
1051
|
-
if (!didWarnOld18Alpha) {
|
|
1052
|
-
if (React2.startTransition !== void 0) {
|
|
1053
|
-
didWarnOld18Alpha = true;
|
|
1054
|
-
error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
var value = getSnapshot();
|
|
1059
|
-
{
|
|
1060
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
1061
|
-
var cachedValue = getSnapshot();
|
|
1062
|
-
if (!objectIs(value, cachedValue)) {
|
|
1063
|
-
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
1064
|
-
didWarnUncachedGetSnapshot = true;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
var _useState = useState2({
|
|
1069
|
-
inst: {
|
|
1070
|
-
value,
|
|
1071
|
-
getSnapshot
|
|
1072
|
-
}
|
|
1073
|
-
}), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
1074
|
-
useLayoutEffect2(function() {
|
|
1075
|
-
inst.value = value;
|
|
1076
|
-
inst.getSnapshot = getSnapshot;
|
|
1077
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
1078
|
-
forceUpdate({
|
|
1079
|
-
inst
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
}, [subscribe, value, getSnapshot]);
|
|
1083
|
-
useEffect2(function() {
|
|
1084
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
1085
|
-
forceUpdate({
|
|
1086
|
-
inst
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
var handleStoreChange = function() {
|
|
1090
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
1091
|
-
forceUpdate({
|
|
1092
|
-
inst
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
return subscribe(handleStoreChange);
|
|
1097
|
-
}, [subscribe]);
|
|
1098
|
-
useDebugValue(value);
|
|
1099
|
-
return value;
|
|
1100
|
-
}
|
|
1101
|
-
function checkIfSnapshotChanged(inst) {
|
|
1102
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
1103
|
-
var prevValue = inst.value;
|
|
1104
|
-
try {
|
|
1105
|
-
var nextValue = latestGetSnapshot();
|
|
1106
|
-
return !objectIs(prevValue, nextValue);
|
|
1107
|
-
} catch (error2) {
|
|
1108
|
-
return true;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
1112
|
-
return getSnapshot();
|
|
1113
|
-
}
|
|
1114
|
-
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
1115
|
-
var isServerEnvironment = !canUseDOM;
|
|
1116
|
-
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
1117
|
-
var useSyncExternalStore$2 = React2.useSyncExternalStore !== void 0 ? React2.useSyncExternalStore : shim;
|
|
1118
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
1119
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
1120
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1121
|
-
}
|
|
1122
|
-
})();
|
|
1123
|
-
}
|
|
1124
|
-
return useSyncExternalStoreShim_development;
|
|
1125
|
-
}
|
|
1126
|
-
if (process.env.NODE_ENV === "production") {
|
|
1127
|
-
requireUseSyncExternalStoreShim_production_min();
|
|
1128
|
-
} else {
|
|
1129
|
-
requireUseSyncExternalStoreShim_development();
|
|
1130
|
-
}
|
|
1131
|
-
const noop$1 = () => {
|
|
1132
|
-
};
|
|
1133
|
-
const UNDEFINED = (
|
|
1134
|
-
/*#__NOINLINE__*/
|
|
1135
|
-
noop$1()
|
|
1136
|
-
);
|
|
1137
|
-
const OBJECT = Object;
|
|
1138
|
-
const isUndefined = (v2) => v2 === UNDEFINED;
|
|
1139
|
-
const isFunction = (v2) => typeof v2 == "function";
|
|
1140
|
-
const mergeObjects = (a2, b2) => ({
|
|
1141
|
-
...a2,
|
|
1142
|
-
...b2
|
|
1143
|
-
});
|
|
1144
|
-
const isPromiseLike = (x2) => isFunction(x2.then);
|
|
1145
|
-
const table = /* @__PURE__ */ new WeakMap();
|
|
1146
|
-
let counter = 0;
|
|
1147
|
-
const stableHash = (arg) => {
|
|
1148
|
-
const type = typeof arg;
|
|
1149
|
-
const constructor = arg && arg.constructor;
|
|
1150
|
-
const isDate = constructor == Date;
|
|
1151
|
-
let result;
|
|
1152
|
-
let index2;
|
|
1153
|
-
if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {
|
|
1154
|
-
result = table.get(arg);
|
|
1155
|
-
if (result)
|
|
1156
|
-
return result;
|
|
1157
|
-
result = ++counter + "~";
|
|
1158
|
-
table.set(arg, result);
|
|
1159
|
-
if (constructor == Array) {
|
|
1160
|
-
result = "@";
|
|
1161
|
-
for (index2 = 0; index2 < arg.length; index2++) {
|
|
1162
|
-
result += stableHash(arg[index2]) + ",";
|
|
1163
|
-
}
|
|
1164
|
-
table.set(arg, result);
|
|
1165
|
-
}
|
|
1166
|
-
if (constructor == OBJECT) {
|
|
1167
|
-
result = "#";
|
|
1168
|
-
const keys = OBJECT.keys(arg).sort();
|
|
1169
|
-
while (!isUndefined(index2 = keys.pop())) {
|
|
1170
|
-
if (!isUndefined(arg[index2])) {
|
|
1171
|
-
result += index2 + ":" + stableHash(arg[index2]) + ",";
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
table.set(arg, result);
|
|
1175
|
-
}
|
|
1176
|
-
} else {
|
|
1177
|
-
result = isDate ? arg.toJSON() : type == "symbol" ? arg.toString() : type == "string" ? JSON.stringify(arg) : "" + arg;
|
|
1178
|
-
}
|
|
1179
|
-
return result;
|
|
1180
|
-
};
|
|
1181
|
-
const SWRGlobalState = /* @__PURE__ */ new WeakMap();
|
|
1182
|
-
const EMPTY_CACHE = {};
|
|
1183
|
-
const INITIAL_CACHE = {};
|
|
1184
|
-
const STR_UNDEFINED = "undefined";
|
|
1185
|
-
const isWindowDefined = typeof window != STR_UNDEFINED;
|
|
1186
|
-
const isDocumentDefined = typeof document != STR_UNDEFINED;
|
|
1187
|
-
const createCacheHelper = (cache2, key) => {
|
|
1188
|
-
const state = SWRGlobalState.get(cache2);
|
|
1189
|
-
return [
|
|
1190
|
-
// Getter
|
|
1191
|
-
() => !isUndefined(key) && cache2.get(key) || EMPTY_CACHE,
|
|
1192
|
-
// Setter
|
|
1193
|
-
(info) => {
|
|
1194
|
-
if (!isUndefined(key)) {
|
|
1195
|
-
const prev = cache2.get(key);
|
|
1196
|
-
if (!(key in INITIAL_CACHE)) {
|
|
1197
|
-
INITIAL_CACHE[key] = prev;
|
|
1198
|
-
}
|
|
1199
|
-
state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);
|
|
1200
|
-
}
|
|
1201
|
-
},
|
|
1202
|
-
// Subscriber
|
|
1203
|
-
state[6],
|
|
1204
|
-
// Get server cache snapshot
|
|
1205
|
-
() => {
|
|
1206
|
-
if (!isUndefined(key)) {
|
|
1207
|
-
if (key in INITIAL_CACHE)
|
|
1208
|
-
return INITIAL_CACHE[key];
|
|
1209
|
-
}
|
|
1210
|
-
return !isUndefined(key) && cache2.get(key) || EMPTY_CACHE;
|
|
1211
|
-
}
|
|
1212
|
-
];
|
|
1213
|
-
};
|
|
1214
|
-
let online = true;
|
|
1215
|
-
const isOnline = () => online;
|
|
1216
|
-
const [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [
|
|
1217
|
-
window.addEventListener.bind(window),
|
|
1218
|
-
window.removeEventListener.bind(window)
|
|
1219
|
-
] : [
|
|
1220
|
-
noop$1,
|
|
1221
|
-
noop$1
|
|
1222
|
-
];
|
|
1223
|
-
const isVisible = () => {
|
|
1224
|
-
const visibilityState = isDocumentDefined && document.visibilityState;
|
|
1225
|
-
return isUndefined(visibilityState) || visibilityState !== "hidden";
|
|
1226
|
-
};
|
|
1227
|
-
const initFocus = (callback) => {
|
|
1228
|
-
if (isDocumentDefined) {
|
|
1229
|
-
document.addEventListener("visibilitychange", callback);
|
|
1230
|
-
}
|
|
1231
|
-
onWindowEvent("focus", callback);
|
|
1232
|
-
return () => {
|
|
1233
|
-
if (isDocumentDefined) {
|
|
1234
|
-
document.removeEventListener("visibilitychange", callback);
|
|
1235
|
-
}
|
|
1236
|
-
offWindowEvent("focus", callback);
|
|
1237
|
-
};
|
|
1238
|
-
};
|
|
1239
|
-
const initReconnect = (callback) => {
|
|
1240
|
-
const onOnline = () => {
|
|
1241
|
-
online = true;
|
|
1242
|
-
callback();
|
|
1243
|
-
};
|
|
1244
|
-
const onOffline = () => {
|
|
1245
|
-
online = false;
|
|
1246
|
-
};
|
|
1247
|
-
onWindowEvent("online", onOnline);
|
|
1248
|
-
onWindowEvent("offline", onOffline);
|
|
1249
|
-
return () => {
|
|
1250
|
-
offWindowEvent("online", onOnline);
|
|
1251
|
-
offWindowEvent("offline", onOffline);
|
|
1252
|
-
};
|
|
1253
|
-
};
|
|
1254
|
-
const preset = {
|
|
1255
|
-
isOnline,
|
|
1256
|
-
isVisible
|
|
1257
|
-
};
|
|
1258
|
-
const defaultConfigOptions = {
|
|
1259
|
-
initFocus,
|
|
1260
|
-
initReconnect
|
|
1261
|
-
};
|
|
1262
|
-
!React__default.useId;
|
|
1263
|
-
const IS_SERVER = !isWindowDefined || "Deno" in window;
|
|
1264
|
-
const navigatorConnection = typeof navigator !== "undefined" && navigator.connection;
|
|
1265
|
-
const slowConnection = !IS_SERVER && navigatorConnection && ([
|
|
1266
|
-
"slow-2g",
|
|
1267
|
-
"2g"
|
|
1268
|
-
].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData);
|
|
1269
|
-
const serialize = (key) => {
|
|
1270
|
-
if (isFunction(key)) {
|
|
1271
|
-
try {
|
|
1272
|
-
key = key();
|
|
1273
|
-
} catch (err) {
|
|
1274
|
-
key = "";
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
const args = key;
|
|
1278
|
-
key = typeof key == "string" ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : "";
|
|
1279
|
-
return [
|
|
1280
|
-
key,
|
|
1281
|
-
args
|
|
1282
|
-
];
|
|
1283
|
-
};
|
|
1284
|
-
let __timestamp = 0;
|
|
1285
|
-
const getTimestamp = () => ++__timestamp;
|
|
1286
|
-
const FOCUS_EVENT = 0;
|
|
1287
|
-
const RECONNECT_EVENT = 1;
|
|
1288
|
-
const MUTATE_EVENT = 2;
|
|
1289
|
-
async function internalMutate(...args) {
|
|
1290
|
-
const [cache2, _key, _data, _opts] = args;
|
|
1291
|
-
const options = mergeObjects({
|
|
1292
|
-
populateCache: true,
|
|
1293
|
-
throwOnError: true
|
|
1294
|
-
}, typeof _opts === "boolean" ? {
|
|
1295
|
-
revalidate: _opts
|
|
1296
|
-
} : _opts || {});
|
|
1297
|
-
let populateCache = options.populateCache;
|
|
1298
|
-
const rollbackOnErrorOption = options.rollbackOnError;
|
|
1299
|
-
let optimisticData = options.optimisticData;
|
|
1300
|
-
const revalidate = options.revalidate !== false;
|
|
1301
|
-
const rollbackOnError = (error) => {
|
|
1302
|
-
return typeof rollbackOnErrorOption === "function" ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== false;
|
|
1303
|
-
};
|
|
1304
|
-
const throwOnError = options.throwOnError;
|
|
1305
|
-
if (isFunction(_key)) {
|
|
1306
|
-
const keyFilter = _key;
|
|
1307
|
-
const matchedKeys = [];
|
|
1308
|
-
const it = cache2.keys();
|
|
1309
|
-
for (const key of it) {
|
|
1310
|
-
if (
|
|
1311
|
-
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
1312
|
-
!/^\$(inf|sub)\$/.test(key) && keyFilter(cache2.get(key)._k)
|
|
1313
|
-
) {
|
|
1314
|
-
matchedKeys.push(key);
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
return Promise.all(matchedKeys.map(mutateByKey));
|
|
1318
|
-
}
|
|
1319
|
-
return mutateByKey(_key);
|
|
1320
|
-
async function mutateByKey(_k) {
|
|
1321
|
-
const [key] = serialize(_k);
|
|
1322
|
-
if (!key)
|
|
1323
|
-
return;
|
|
1324
|
-
const [get, set] = createCacheHelper(cache2, key);
|
|
1325
|
-
const [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2);
|
|
1326
|
-
const startRevalidate = () => {
|
|
1327
|
-
const revalidators = EVENT_REVALIDATORS[key];
|
|
1328
|
-
if (revalidate) {
|
|
1329
|
-
delete FETCH[key];
|
|
1330
|
-
delete PRELOAD[key];
|
|
1331
|
-
if (revalidators && revalidators[0]) {
|
|
1332
|
-
return revalidators[0](MUTATE_EVENT).then(() => get().data);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
return get().data;
|
|
1336
|
-
};
|
|
1337
|
-
if (args.length < 3) {
|
|
1338
|
-
return startRevalidate();
|
|
1339
|
-
}
|
|
1340
|
-
let data = _data;
|
|
1341
|
-
let error;
|
|
1342
|
-
const beforeMutationTs = getTimestamp();
|
|
1343
|
-
MUTATION[key] = [
|
|
1344
|
-
beforeMutationTs,
|
|
1345
|
-
0
|
|
1346
|
-
];
|
|
1347
|
-
const hasOptimisticData = !isUndefined(optimisticData);
|
|
1348
|
-
const state = get();
|
|
1349
|
-
const displayedData = state.data;
|
|
1350
|
-
const currentData = state._c;
|
|
1351
|
-
const committedData = isUndefined(currentData) ? displayedData : currentData;
|
|
1352
|
-
if (hasOptimisticData) {
|
|
1353
|
-
optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData;
|
|
1354
|
-
set({
|
|
1355
|
-
data: optimisticData,
|
|
1356
|
-
_c: committedData
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
if (isFunction(data)) {
|
|
1360
|
-
try {
|
|
1361
|
-
data = data(committedData);
|
|
1362
|
-
} catch (err) {
|
|
1363
|
-
error = err;
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
if (data && isPromiseLike(data)) {
|
|
1367
|
-
data = await data.catch((err) => {
|
|
1368
|
-
error = err;
|
|
1369
|
-
});
|
|
1370
|
-
if (beforeMutationTs !== MUTATION[key][0]) {
|
|
1371
|
-
if (error)
|
|
1372
|
-
throw error;
|
|
1373
|
-
return data;
|
|
1374
|
-
} else if (error && hasOptimisticData && rollbackOnError(error)) {
|
|
1375
|
-
populateCache = true;
|
|
1376
|
-
set({
|
|
1377
|
-
data: committedData,
|
|
1378
|
-
_c: UNDEFINED
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
if (populateCache) {
|
|
1383
|
-
if (!error) {
|
|
1384
|
-
if (isFunction(populateCache)) {
|
|
1385
|
-
const populateCachedData = populateCache(data, committedData);
|
|
1386
|
-
set({
|
|
1387
|
-
data: populateCachedData,
|
|
1388
|
-
error: UNDEFINED,
|
|
1389
|
-
_c: UNDEFINED
|
|
1390
|
-
});
|
|
1391
|
-
} else {
|
|
1392
|
-
set({
|
|
1393
|
-
data,
|
|
1394
|
-
error: UNDEFINED,
|
|
1395
|
-
_c: UNDEFINED
|
|
1396
|
-
});
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
MUTATION[key][1] = getTimestamp();
|
|
1401
|
-
Promise.resolve(startRevalidate()).then(() => {
|
|
1402
|
-
set({
|
|
1403
|
-
_c: UNDEFINED
|
|
1404
|
-
});
|
|
1405
|
-
});
|
|
1406
|
-
if (error) {
|
|
1407
|
-
if (throwOnError)
|
|
1408
|
-
throw error;
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
return data;
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
const revalidateAllKeys = (revalidators, type) => {
|
|
1415
|
-
for (const key in revalidators) {
|
|
1416
|
-
if (revalidators[key][0])
|
|
1417
|
-
revalidators[key][0](type);
|
|
1418
|
-
}
|
|
1419
|
-
};
|
|
1420
|
-
const initCache = (provider, options) => {
|
|
1421
|
-
if (!SWRGlobalState.has(provider)) {
|
|
1422
|
-
const opts = mergeObjects(defaultConfigOptions, options);
|
|
1423
|
-
const EVENT_REVALIDATORS = {};
|
|
1424
|
-
const mutate2 = internalMutate.bind(UNDEFINED, provider);
|
|
1425
|
-
let unmount = noop$1;
|
|
1426
|
-
const subscriptions = {};
|
|
1427
|
-
const subscribe = (key, callback) => {
|
|
1428
|
-
const subs = subscriptions[key] || [];
|
|
1429
|
-
subscriptions[key] = subs;
|
|
1430
|
-
subs.push(callback);
|
|
1431
|
-
return () => subs.splice(subs.indexOf(callback), 1);
|
|
1432
|
-
};
|
|
1433
|
-
const setter = (key, value, prev) => {
|
|
1434
|
-
provider.set(key, value);
|
|
1435
|
-
const subs = subscriptions[key];
|
|
1436
|
-
if (subs) {
|
|
1437
|
-
for (const fn of subs) {
|
|
1438
|
-
fn(value, prev);
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
};
|
|
1442
|
-
const initProvider = () => {
|
|
1443
|
-
if (!SWRGlobalState.has(provider)) {
|
|
1444
|
-
SWRGlobalState.set(provider, [
|
|
1445
|
-
EVENT_REVALIDATORS,
|
|
1446
|
-
{},
|
|
1447
|
-
{},
|
|
1448
|
-
{},
|
|
1449
|
-
mutate2,
|
|
1450
|
-
setter,
|
|
1451
|
-
subscribe
|
|
1452
|
-
]);
|
|
1453
|
-
if (!IS_SERVER) {
|
|
1454
|
-
const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));
|
|
1455
|
-
const releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));
|
|
1456
|
-
unmount = () => {
|
|
1457
|
-
releaseFocus && releaseFocus();
|
|
1458
|
-
releaseReconnect && releaseReconnect();
|
|
1459
|
-
SWRGlobalState.delete(provider);
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1464
|
-
initProvider();
|
|
1465
|
-
return [
|
|
1466
|
-
provider,
|
|
1467
|
-
mutate2,
|
|
1468
|
-
initProvider,
|
|
1469
|
-
unmount
|
|
1470
|
-
];
|
|
1471
|
-
}
|
|
1472
|
-
return [
|
|
1473
|
-
provider,
|
|
1474
|
-
SWRGlobalState.get(provider)[4]
|
|
1475
|
-
];
|
|
1476
|
-
};
|
|
1477
|
-
const onErrorRetry = (_, __, config, revalidate, opts) => {
|
|
1478
|
-
const maxRetryCount = config.errorRetryCount;
|
|
1479
|
-
const currentRetryCount = opts.retryCount;
|
|
1480
|
-
const timeout = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
|
|
1481
|
-
if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {
|
|
1482
|
-
return;
|
|
1483
|
-
}
|
|
1484
|
-
setTimeout(revalidate, timeout, opts);
|
|
1485
|
-
};
|
|
1486
|
-
const compare = (currentData, newData) => stableHash(currentData) == stableHash(newData);
|
|
1487
|
-
const [cache, mutate] = initCache(/* @__PURE__ */ new Map());
|
|
1488
|
-
mergeObjects(
|
|
1489
|
-
{
|
|
1490
|
-
// events
|
|
1491
|
-
onLoadingSlow: noop$1,
|
|
1492
|
-
onSuccess: noop$1,
|
|
1493
|
-
onError: noop$1,
|
|
1494
|
-
onErrorRetry,
|
|
1495
|
-
onDiscarded: noop$1,
|
|
1496
|
-
// switches
|
|
1497
|
-
revalidateOnFocus: true,
|
|
1498
|
-
revalidateOnReconnect: true,
|
|
1499
|
-
revalidateIfStale: true,
|
|
1500
|
-
shouldRetryOnError: true,
|
|
1501
|
-
// timeouts
|
|
1502
|
-
errorRetryInterval: slowConnection ? 1e4 : 5e3,
|
|
1503
|
-
focusThrottleInterval: 5 * 1e3,
|
|
1504
|
-
dedupingInterval: 2 * 1e3,
|
|
1505
|
-
loadingTimeout: slowConnection ? 5e3 : 3e3,
|
|
1506
|
-
// providers
|
|
1507
|
-
compare,
|
|
1508
|
-
isPaused: () => false,
|
|
1509
|
-
cache,
|
|
1510
|
-
mutate,
|
|
1511
|
-
fallback: {}
|
|
1512
|
-
},
|
|
1513
|
-
// use web preset by default
|
|
1514
|
-
preset
|
|
1515
|
-
);
|
|
1516
|
-
createContext({});
|
|
1517
|
-
const INFINITE_PREFIX = "$inf$";
|
|
1518
|
-
const enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
|
|
1519
|
-
const use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
|
|
1520
|
-
const setupDevTools = () => {
|
|
1521
|
-
if (enableDevtools) {
|
|
1522
|
-
window.__SWR_DEVTOOLS_REACT__ = React__default;
|
|
1523
|
-
}
|
|
1524
|
-
};
|
|
1525
|
-
const middleware = (useSWRNext) => (key_, fetcher_, config) => {
|
|
1526
|
-
const fetcher = fetcher_ && ((...args) => {
|
|
1527
|
-
const [key] = serialize(key_);
|
|
1528
|
-
const [, , , PRELOAD] = SWRGlobalState.get(cache);
|
|
1529
|
-
if (key.startsWith(INFINITE_PREFIX)) {
|
|
1530
|
-
return fetcher_(...args);
|
|
1531
|
-
}
|
|
1532
|
-
const req = PRELOAD[key];
|
|
1533
|
-
if (isUndefined(req))
|
|
1534
|
-
return fetcher_(...args);
|
|
1535
|
-
delete PRELOAD[key];
|
|
1536
|
-
return req;
|
|
1537
|
-
});
|
|
1538
|
-
return useSWRNext(key_, fetcher, config);
|
|
1539
|
-
};
|
|
1540
|
-
use.concat(middleware);
|
|
1541
|
-
setupDevTools();
|
|
1542
|
-
React__default.use || ((promise) => {
|
|
1543
|
-
if (promise.status === "pending") {
|
|
1544
|
-
throw promise;
|
|
1545
|
-
} else if (promise.status === "fulfilled") {
|
|
1546
|
-
return promise.value;
|
|
1547
|
-
} else if (promise.status === "rejected") {
|
|
1548
|
-
throw promise.reason;
|
|
1549
|
-
} else {
|
|
1550
|
-
promise.status = "pending";
|
|
1551
|
-
promise.then((v2) => {
|
|
1552
|
-
promise.status = "fulfilled";
|
|
1553
|
-
promise.value = v2;
|
|
1554
|
-
}, (e2) => {
|
|
1555
|
-
promise.status = "rejected";
|
|
1556
|
-
promise.reason = e2;
|
|
1557
|
-
});
|
|
1558
|
-
throw promise;
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
942
|
function _extends$1() {
|
|
1562
943
|
_extends$1 = Object.assign ? Object.assign.bind() : function(target) {
|
|
1563
944
|
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
@@ -2555,9 +1936,9 @@ function useMergeRefs(refs, defaultValue) {
|
|
|
2555
1936
|
function ItoI(a2) {
|
|
2556
1937
|
return a2;
|
|
2557
1938
|
}
|
|
2558
|
-
function innerCreateMedium(defaults,
|
|
2559
|
-
if (
|
|
2560
|
-
|
|
1939
|
+
function innerCreateMedium(defaults, middleware) {
|
|
1940
|
+
if (middleware === void 0) {
|
|
1941
|
+
middleware = ItoI;
|
|
2561
1942
|
}
|
|
2562
1943
|
var buffer = [];
|
|
2563
1944
|
var assigned = false;
|
|
@@ -2572,7 +1953,7 @@ function innerCreateMedium(defaults, middleware2) {
|
|
|
2572
1953
|
return defaults;
|
|
2573
1954
|
},
|
|
2574
1955
|
useMedium: function(data) {
|
|
2575
|
-
var item =
|
|
1956
|
+
var item = middleware(data, assigned);
|
|
2576
1957
|
buffer.push(item);
|
|
2577
1958
|
return function() {
|
|
2578
1959
|
buffer = buffer.filter(function(x2) {
|
|
@@ -2716,21 +2097,21 @@ function insertStyleTag(tag) {
|
|
|
2716
2097
|
head.appendChild(tag);
|
|
2717
2098
|
}
|
|
2718
2099
|
var stylesheetSingleton = function() {
|
|
2719
|
-
var
|
|
2100
|
+
var counter = 0;
|
|
2720
2101
|
var stylesheet = null;
|
|
2721
2102
|
return {
|
|
2722
2103
|
add: function(style) {
|
|
2723
|
-
if (
|
|
2104
|
+
if (counter == 0) {
|
|
2724
2105
|
if (stylesheet = makeStyleTag()) {
|
|
2725
2106
|
injectStyles(stylesheet, style);
|
|
2726
2107
|
insertStyleTag(stylesheet);
|
|
2727
2108
|
}
|
|
2728
2109
|
}
|
|
2729
|
-
|
|
2110
|
+
counter++;
|
|
2730
2111
|
},
|
|
2731
2112
|
remove: function() {
|
|
2732
|
-
|
|
2733
|
-
if (!
|
|
2113
|
+
counter--;
|
|
2114
|
+
if (!counter && stylesheet) {
|
|
2734
2115
|
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
2735
2116
|
stylesheet = null;
|
|
2736
2117
|
}
|
|
@@ -3926,7 +3307,7 @@ function useLatestRef$1(value) {
|
|
|
3926
3307
|
}
|
|
3927
3308
|
function useFloating$1(_temp) {
|
|
3928
3309
|
let {
|
|
3929
|
-
middleware
|
|
3310
|
+
middleware,
|
|
3930
3311
|
placement = "bottom",
|
|
3931
3312
|
strategy = "absolute",
|
|
3932
3313
|
whileElementsMounted
|
|
@@ -3944,19 +3325,19 @@ function useFloating$1(_temp) {
|
|
|
3944
3325
|
placement,
|
|
3945
3326
|
middlewareData: {}
|
|
3946
3327
|
});
|
|
3947
|
-
const [latestMiddleware, setLatestMiddleware] = React.useState(
|
|
3328
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
3948
3329
|
if (!deepEqual$1(latestMiddleware == null ? void 0 : latestMiddleware.map((_ref) => {
|
|
3949
3330
|
let {
|
|
3950
3331
|
options
|
|
3951
3332
|
} = _ref;
|
|
3952
3333
|
return options;
|
|
3953
|
-
}),
|
|
3334
|
+
}), middleware == null ? void 0 : middleware.map((_ref2) => {
|
|
3954
3335
|
let {
|
|
3955
3336
|
options
|
|
3956
3337
|
} = _ref2;
|
|
3957
3338
|
return options;
|
|
3958
3339
|
}))) {
|
|
3959
|
-
setLatestMiddleware(
|
|
3340
|
+
setLatestMiddleware(middleware);
|
|
3960
3341
|
}
|
|
3961
3342
|
const update = React.useCallback(() => {
|
|
3962
3343
|
if (!reference.current || !floating.current) {
|
|
@@ -7543,7 +6924,7 @@ function useFloating(options) {
|
|
|
7543
6924
|
const {
|
|
7544
6925
|
placement = "bottom",
|
|
7545
6926
|
strategy = "absolute",
|
|
7546
|
-
middleware
|
|
6927
|
+
middleware = [],
|
|
7547
6928
|
platform,
|
|
7548
6929
|
elements: {
|
|
7549
6930
|
reference: externalReference,
|
|
@@ -7561,9 +6942,9 @@ function useFloating(options) {
|
|
|
7561
6942
|
middlewareData: {},
|
|
7562
6943
|
isPositioned: false
|
|
7563
6944
|
});
|
|
7564
|
-
const [latestMiddleware, setLatestMiddleware] = React.useState(
|
|
7565
|
-
if (!deepEqual(latestMiddleware,
|
|
7566
|
-
setLatestMiddleware(
|
|
6945
|
+
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
|
|
6946
|
+
if (!deepEqual(latestMiddleware, middleware)) {
|
|
6947
|
+
setLatestMiddleware(middleware);
|
|
7567
6948
|
}
|
|
7568
6949
|
const [_reference, _setReference] = React.useState(null);
|
|
7569
6950
|
const [_floating, _setFloating] = React.useState(null);
|
|
@@ -17756,4 +17137,4 @@ export {
|
|
|
17756
17137
|
$cc7e05a45900e73f$export$602eac185826482c as y,
|
|
17757
17138
|
$cc7e05a45900e73f$export$7c6e2c02157bb7d2 as z
|
|
17758
17139
|
};
|
|
17759
|
-
//# sourceMappingURL=vendor-
|
|
17140
|
+
//# sourceMappingURL=vendor-90dfd914.js.map
|