@nosto/search-js 3.25.5 → 3.25.7
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/AutocompletePageProvider-D48n1GB-.js +37 -0
- package/dist/AutocompletePageProvider-DzjwKsBp.cjs +1 -0
- package/dist/BaseElement-BnP6tQrH.cjs +1 -0
- package/dist/BaseElement-C25wjvSR.js +19 -0
- package/dist/CategoryPageProvider-B6w4FHhB.cjs +1 -0
- package/dist/CategoryPageProvider-BYw7KGoS.js +30 -0
- package/dist/ErrorBoundary-BtAe8lXu.cjs +1 -0
- package/dist/ErrorBoundary-Bxyssvki.js +11 -0
- package/dist/InfiniteScrollWithObserver-8imjYGGz.js +226 -0
- package/dist/InfiniteScrollWithObserver-k7oYk4f9.cjs +1 -0
- package/dist/SerpPageProvider-BgRZJNth.cjs +1 -0
- package/dist/SerpPageProvider-fg14kNV9.js +30 -0
- package/dist/baseConfig-Che6Adb6.js +50 -0
- package/dist/baseConfig-jLd7jchq.cjs +1 -0
- package/dist/cl-CYT5y6Dn.cjs +1 -0
- package/dist/cl-G5KK1qHD.js +6 -0
- package/dist/core/core.cjs.js +1 -1
- package/dist/core/core.es.js +7 -8
- package/dist/currencies/currencies.cjs.js +1 -1
- package/dist/currencies/currencies.es.js +61 -65
- package/dist/disableNativeAutocomplete-CcR_Ek_P.js +26 -0
- package/dist/disableNativeAutocomplete-CjBGhRWW.cjs +1 -0
- package/dist/eventBusDispatch-B6VswTu8.cjs +1 -0
- package/dist/eventBusDispatch-DnFmEqYe.js +15 -0
- package/dist/eventBusSubscribe-C6qT1aOO.js +22 -0
- package/dist/eventBusSubscribe-c9a_PP0j.cjs +1 -0
- package/dist/index.es-Ba4tuzxb.cjs +1 -0
- package/dist/index.es-jSYcbRvi.js +25 -0
- package/dist/{isBot-B05pQGIe.js → isBot-CPesLwHL.js} +18 -17
- package/dist/isBot-CkyQfegP.cjs +1 -0
- package/dist/jsxRuntime.module-BRdvPAre.js +30 -0
- package/dist/jsxRuntime.module-Ba9fccPy.cjs +1 -0
- package/dist/parseNumber-BH_92pM8.cjs +1 -0
- package/dist/parseNumber-DFsrGj64.js +9 -0
- package/dist/pick-0KNFTqKn.cjs +1 -0
- package/dist/pick-B8ymxJme.js +6 -0
- package/dist/preact/autocomplete/autocomplete.cjs.js +1 -1
- package/dist/preact/autocomplete/autocomplete.es.js +43 -42
- package/dist/preact/category/category.cjs.js +1 -1
- package/dist/preact/category/category.es.js +2 -4
- package/dist/preact/common/common.cjs.js +1 -1
- package/dist/preact/common/common.es.js +24 -31
- package/dist/preact/events/events.cjs.js +1 -1
- package/dist/preact/events/events.es.js +3 -8
- package/dist/preact/hooks/hooks.cjs.js +1 -1
- package/dist/preact/hooks/hooks.es.js +494 -508
- package/dist/preact/inject/inject.cjs.js +1 -1
- package/dist/preact/inject/inject.es.js +313 -301
- package/dist/preact/legacy/legacy.cjs.js +1 -1
- package/dist/preact/legacy/legacy.es.js +4 -10
- package/dist/preact/serp/serp.cjs.js +1 -1
- package/dist/preact/serp/serp.es.js +25 -18
- package/dist/search-BeFE0Ezr.cjs +1 -0
- package/dist/search-C2WGFf4C.js +155 -0
- package/dist/storage-B3FIcJQv.cjs +1 -0
- package/dist/storage-DeAo7M3s.js +115 -0
- package/dist/thumbnails/thumbnails.cjs.js +1 -1
- package/dist/thumbnails/thumbnails.es.js +93 -97
- package/dist/unique-BXFI_-3F.cjs +1 -0
- package/dist/unique-DSDxyj90.js +37 -0
- package/dist/useActions-BmWNZAES.js +182 -0
- package/dist/useActions-boQy-Vp0.cjs +1 -0
- package/dist/useHistory-BMkSr69f.js +24 -0
- package/dist/useHistory-GRnuHgQ5.cjs +1 -0
- package/dist/useLoadMore-B9LiuhfV.cjs +1 -0
- package/dist/useLoadMore-BkJV7F21.js +38 -0
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +8 -28
- package/package.json +12 -12
- package/dist/AutocompletePageProvider-CFEbt11-.cjs +0 -1
- package/dist/AutocompletePageProvider-CQePqAhB.js +0 -35
- package/dist/BaseElement-CIHACCWd.cjs +0 -1
- package/dist/BaseElement-DD_4UwDm.js +0 -24
- package/dist/CategoryPageProvider-037sXEh9.cjs +0 -1
- package/dist/CategoryPageProvider-DVL9lsCU.js +0 -26
- package/dist/ErrorBoundary-DFs5vnv-.js +0 -11
- package/dist/ErrorBoundary-DNPL7EwP.cjs +0 -1
- package/dist/InfiniteScrollWithObserver-BliG4dEl.cjs +0 -1
- package/dist/InfiniteScrollWithObserver-DvkEUZUE.js +0 -205
- package/dist/SerpPageProvider-BzrNPc7g.js +0 -26
- package/dist/SerpPageProvider-CxqiX9Zo.cjs +0 -1
- package/dist/baseConfig-BOOw0mWW.cjs +0 -1
- package/dist/baseConfig-Cf28X268.js +0 -48
- package/dist/cl-B00bZ7jc.cjs +0 -1
- package/dist/cl-CcykAxZN.js +0 -6
- package/dist/disableNativeAutocomplete-Bkta_WR2.js +0 -27
- package/dist/disableNativeAutocomplete-DI6zaZII.cjs +0 -1
- package/dist/eventBusDispatch-BKQcSHAB.cjs +0 -1
- package/dist/eventBusDispatch-DPR2Vwd4.js +0 -20
- package/dist/eventBusSubscribe-B5E7dTzk.js +0 -26
- package/dist/eventBusSubscribe-C4H9Nv1Z.cjs +0 -1
- package/dist/index.es-Dp6Iaxz3.cjs +0 -1
- package/dist/index.es-XNBESE3P.js +0 -26
- package/dist/isBot-C-qPIZyF.cjs +0 -1
- package/dist/jsxRuntime.module-B3sGoTIU.cjs +0 -1
- package/dist/jsxRuntime.module-Bzuv3cXw.js +0 -13
- package/dist/parseNumber-FsZ8w61u.cjs +0 -1
- package/dist/parseNumber-QA48nJLp.js +0 -11
- package/dist/pick-DReBictn.js +0 -9
- package/dist/pick-rYi1lc2m.cjs +0 -1
- package/dist/search-BchLEATK.cjs +0 -1
- package/dist/search-D1jQPG6P.js +0 -156
- package/dist/storage-9KuhFI9v.cjs +0 -1
- package/dist/storage-B97DRj5i.js +0 -121
- package/dist/unique-C1G3v2Y8.cjs +0 -1
- package/dist/unique-CCu7ChUL.js +0 -39
- package/dist/useActions-BD6dgsX8.js +0 -260
- package/dist/useActions-DIlSparF.cjs +0 -1
- package/dist/useHistory-DLCyHMo1.cjs +0 -1
- package/dist/useHistory-sjFYeR68.js +0 -27
- package/dist/useLoadMore-BMOT8Dfn.js +0 -33
- package/dist/useLoadMore-vCpwy6JC.cjs +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { t as e } from "./search-C2WGFf4C.js";
|
|
2
|
+
import { c as t, s as n } from "./storage-DeAo7M3s.js";
|
|
3
|
+
import { a as r, i, n as a, r as o, t as s } from "./unique-DSDxyj90.js";
|
|
4
|
+
import { createContext as c } from "preact";
|
|
5
|
+
import { useCallback as l, useContext as u, useMemo as d } from "preact/hooks";
|
|
6
|
+
//#region packages/preact/common/src/config/configContext.tsx
|
|
7
|
+
var f = c(null);
|
|
8
|
+
function p() {
|
|
9
|
+
let e = u(f);
|
|
10
|
+
if (!e) throw Error("useConfig must be used within a ConfigProvider");
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
function m() {
|
|
14
|
+
let e = p();
|
|
15
|
+
if (e.pageType !== "search") throw Error("useSerpConfig must be used within a NostoSearchPageProvider");
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
function h() {
|
|
19
|
+
let e = p();
|
|
20
|
+
if (e.pageType !== "category") throw Error("useCategoryConfig must be used within a NostoCategoryPageProvider");
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function g() {
|
|
24
|
+
let e = p();
|
|
25
|
+
if (e.pageType !== "autocomplete") throw Error("useAutocompleteConfig must be used within a NostoAutocompletePageProvider");
|
|
26
|
+
return e;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region packages/preact/common/src/store/storeExtensions.tsx
|
|
30
|
+
function _(e, n = {}) {
|
|
31
|
+
let i = /* @__PURE__ */ new Map(), a = r(e, n ?? {}), o = r(e, n);
|
|
32
|
+
function s(e) {
|
|
33
|
+
a = e(a);
|
|
34
|
+
for (let e of i.values()) e(a);
|
|
35
|
+
}
|
|
36
|
+
function c(e) {
|
|
37
|
+
s((t) => ({
|
|
38
|
+
...t,
|
|
39
|
+
...e
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
function l() {
|
|
43
|
+
return a;
|
|
44
|
+
}
|
|
45
|
+
function u() {
|
|
46
|
+
return structuredClone(o);
|
|
47
|
+
}
|
|
48
|
+
function d(e, n) {
|
|
49
|
+
let r = e(a);
|
|
50
|
+
i.set(n, (i) => {
|
|
51
|
+
let a = e(i);
|
|
52
|
+
t(a, r) || (r = a, n(a));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function f(e) {
|
|
56
|
+
d((e) => e.initialized, (t) => {
|
|
57
|
+
t && e();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function p(e) {
|
|
61
|
+
i.delete(e);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
updateState: c,
|
|
65
|
+
getState: l,
|
|
66
|
+
getInitialState: u,
|
|
67
|
+
onChange: d,
|
|
68
|
+
onInit: f,
|
|
69
|
+
clearOnChange: p
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region packages/preact/common/src/store/store.tsx
|
|
74
|
+
var v = {
|
|
75
|
+
loading: !0,
|
|
76
|
+
query: {},
|
|
77
|
+
response: {},
|
|
78
|
+
initialized: !1
|
|
79
|
+
};
|
|
80
|
+
function y(e = {}) {
|
|
81
|
+
return _(v, e);
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region packages/preact/common/src/store/storeContext.tsx
|
|
85
|
+
var b = c(y());
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region packages/preact/common/src/actions/withDefaultQuery.ts
|
|
88
|
+
function x(e, t) {
|
|
89
|
+
return {
|
|
90
|
+
...t,
|
|
91
|
+
products: {
|
|
92
|
+
facets: e === "autocomplete" ? void 0 : ["*"],
|
|
93
|
+
fields: S,
|
|
94
|
+
...t.products
|
|
95
|
+
},
|
|
96
|
+
...t.keywords ? { keywords: {
|
|
97
|
+
...t.keywords,
|
|
98
|
+
fields: s([...C, ...t.keywords.fields ?? []]),
|
|
99
|
+
highlight: t.keywords.highlight ?? {
|
|
100
|
+
preTag: "<strong>",
|
|
101
|
+
postTag: "</strong>"
|
|
102
|
+
}
|
|
103
|
+
} } : {}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
var S = /* @__PURE__ */ "productId,url,name,imageUrl,imageHash,thumbUrl,description,brand,variantId,availability,price,priceText,categoryIds,categories,customFields.key,customFields.value,priceCurrencyCode,datePublished,listPrice,unitPricingBaseMeasure,unitPricingUnit,unitPricingMeasure,googleCategory,gtin,ageGroup,gender,condition,alternateImageUrls,ratingValue,reviewCount,inventoryLevel,skus.id,skus.name,skus.price,skus.listPrice,skus.priceText,skus.url,skus.imageUrl,skus.inventoryLevel,skus.customFields.key,skus.customFields.value,skus.availability,pid,onDiscount,extra.key,extra.value,saleable,available,tags1,tags2,tags3".split(","), C = ["keyword", "_redirect"];
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region packages/preact/common/src/actions/newSearch.ts
|
|
109
|
+
async function w(t, r, s) {
|
|
110
|
+
let c = a("newSearch"), l = t.config.pageType, u = l === "search" ? "serp" : l, d = i(t.store.getInitialState().query, r), f = i(t.config.search, s, {
|
|
111
|
+
track: u,
|
|
112
|
+
redirect: l !== "autocomplete",
|
|
113
|
+
isKeyword: !!s?.isKeyword,
|
|
114
|
+
usePersistentCache: t.config.pageType !== "autocomplete" && t.config.persistentSearchCache,
|
|
115
|
+
useMemoryCache: t.config.pageType === "autocomplete" && t.config.memoryCache
|
|
116
|
+
});
|
|
117
|
+
t.config.onBeforeSearch?.(t, f), t.store.updateState({
|
|
118
|
+
query: d,
|
|
119
|
+
loading: !0,
|
|
120
|
+
initialized: !0
|
|
121
|
+
});
|
|
122
|
+
let p = t.config.queryModifications({
|
|
123
|
+
...d,
|
|
124
|
+
products: {
|
|
125
|
+
...d.products,
|
|
126
|
+
filter: o(t.store.getInitialState().query?.products?.filter, r.products?.filter)
|
|
127
|
+
}
|
|
128
|
+
}, l);
|
|
129
|
+
try {
|
|
130
|
+
let n = await e(x(t.config.pageType, p), f);
|
|
131
|
+
t.store.updateState({
|
|
132
|
+
response: n,
|
|
133
|
+
loading: !1
|
|
134
|
+
});
|
|
135
|
+
} catch (e) {
|
|
136
|
+
n.error("Search action failed", e), t.config.onSearchError?.(e, p, f, l);
|
|
137
|
+
}
|
|
138
|
+
c();
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region packages/preact/common/src/actions/updateSearch.ts
|
|
142
|
+
async function T(e, t, n) {
|
|
143
|
+
let r = a("updateSearch");
|
|
144
|
+
await w(e, i(e.store.getState().query, { products: { from: 0 } }, t), n), r();
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region packages/preact/common/src/actions/replaceFilter.ts
|
|
148
|
+
async function E(e, t, n) {
|
|
149
|
+
let r = a("replaceFilter"), i = e.store.getState().query.products?.filter, o = n === void 0 ? [] : [{
|
|
150
|
+
field: t,
|
|
151
|
+
[typeof n == "object" ? "range" : "value"]: [n]
|
|
152
|
+
}];
|
|
153
|
+
await T(e, { products: { filter: [...i?.filter((e) => e.field !== t) ?? [], ...o] } }), r();
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region packages/preact/common/src/actions/toggleProductFilter.ts
|
|
157
|
+
async function D(e, n, r, i) {
|
|
158
|
+
let o = a("toggleProductFilter"), s = e.store.getState().query.products?.filter, c = s?.find((e) => e.value instanceof Array && e.field === n), l = c?.value ? {
|
|
159
|
+
...c,
|
|
160
|
+
value: [...c.value.filter((e) => !t(e, r)), ...i ? [r] : []]
|
|
161
|
+
} : i ? {
|
|
162
|
+
field: n,
|
|
163
|
+
value: [r]
|
|
164
|
+
} : void 0;
|
|
165
|
+
await T(e, { products: { filter: [...s?.filter((e) => e !== c) ?? [], ...l?.value?.length ? [l] : []] } }), o();
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region packages/preact/hooks/src/useActions.ts
|
|
169
|
+
function O() {
|
|
170
|
+
let e = p(), t = u(b), n = d(() => ({
|
|
171
|
+
config: e,
|
|
172
|
+
store: t
|
|
173
|
+
}), [e, t]);
|
|
174
|
+
return {
|
|
175
|
+
newSearch: l((e, t) => w(n, e, t), [n]),
|
|
176
|
+
updateSearch: l((e, t) => T(n, e, t), [n]),
|
|
177
|
+
toggleProductFilter: l((e, t, r) => D(n, e, t, r), [n]),
|
|
178
|
+
replaceFilter: l((e, t) => E(n, e, t), [n])
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { y as a, f as c, p as d, m as f, b as i, g as l, T as n, v as o, w as r, _ as s, O as t, h as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./search-BeFE0Ezr.cjs`),t=require(`./storage-B3FIcJQv.cjs`),n=require(`./unique-BXFI_-3F.cjs`);let r=require(`preact`),i=require(`preact/hooks`);var a=(0,r.createContext)(null);function o(){let e=(0,i.useContext)(a);if(!e)throw Error(`useConfig must be used within a ConfigProvider`);return e}function s(){let e=o();if(e.pageType!==`search`)throw Error(`useSerpConfig must be used within a NostoSearchPageProvider`);return e}function c(){let e=o();if(e.pageType!==`category`)throw Error(`useCategoryConfig must be used within a NostoCategoryPageProvider`);return e}function l(){let e=o();if(e.pageType!==`autocomplete`)throw Error(`useAutocompleteConfig must be used within a NostoAutocompletePageProvider`);return e}function u(e,r={}){let i=new Map,a=n.a(e,r??{}),o=n.a(e,r);function s(e){a=e(a);for(let e of i.values())e(a)}function c(e){s(t=>({...t,...e}))}function l(){return a}function u(){return structuredClone(o)}function d(e,n){let r=e(a);i.set(n,i=>{let a=e(i);t.c(a,r)||(r=a,n(a))})}function f(e){d(e=>e.initialized,t=>{t&&e()})}function p(e){i.delete(e)}return{updateState:c,getState:l,getInitialState:u,onChange:d,onInit:f,clearOnChange:p}}var d={loading:!0,query:{},response:{},initialized:!1};function f(e={}){return u(d,e)}var p=(0,r.createContext)(f());function m(e,t){return{...t,products:{facets:e===`autocomplete`?void 0:[`*`],fields:h,...t.products},...t.keywords?{keywords:{...t.keywords,fields:n.t([...g,...t.keywords.fields??[]]),highlight:t.keywords.highlight??{preTag:`<strong>`,postTag:`</strong>`}}}:{}}}var h=`productId,url,name,imageUrl,imageHash,thumbUrl,description,brand,variantId,availability,price,priceText,categoryIds,categories,customFields.key,customFields.value,priceCurrencyCode,datePublished,listPrice,unitPricingBaseMeasure,unitPricingUnit,unitPricingMeasure,googleCategory,gtin,ageGroup,gender,condition,alternateImageUrls,ratingValue,reviewCount,inventoryLevel,skus.id,skus.name,skus.price,skus.listPrice,skus.priceText,skus.url,skus.imageUrl,skus.inventoryLevel,skus.customFields.key,skus.customFields.value,skus.availability,pid,onDiscount,extra.key,extra.value,saleable,available,tags1,tags2,tags3`.split(`,`),g=[`keyword`,`_redirect`];async function _(r,i,a){let o=n.n(`newSearch`),s=r.config.pageType,c=s===`search`?`serp`:s,l=n.i(r.store.getInitialState().query,i),u=n.i(r.config.search,a,{track:c,redirect:s!==`autocomplete`,isKeyword:!!a?.isKeyword,usePersistentCache:r.config.pageType!==`autocomplete`&&r.config.persistentSearchCache,useMemoryCache:r.config.pageType===`autocomplete`&&r.config.memoryCache});r.config.onBeforeSearch?.(r,u),r.store.updateState({query:l,loading:!0,initialized:!0});let d=r.config.queryModifications({...l,products:{...l.products,filter:n.r(r.store.getInitialState().query?.products?.filter,i.products?.filter)}},s);try{let t=await e.t(m(r.config.pageType,d),u);r.store.updateState({response:t,loading:!1})}catch(e){t.s.error(`Search action failed`,e),r.config.onSearchError?.(e,d,u,s)}o()}async function v(e,t,r){let i=n.n(`updateSearch`);await _(e,n.i(e.store.getState().query,{products:{from:0}},t),r),i()}async function y(e,t,r){let i=n.n(`replaceFilter`),a=e.store.getState().query.products?.filter,o=r===void 0?[]:[{field:t,[typeof r==`object`?`range`:`value`]:[r]}];await v(e,{products:{filter:[...a?.filter(e=>e.field!==t)??[],...o]}}),i()}async function b(e,r,i,a){let o=n.n(`toggleProductFilter`),s=e.store.getState().query.products?.filter,c=s?.find(e=>e.value instanceof Array&&e.field===r),l=c?.value?{...c,value:[...c.value.filter(e=>!t.c(e,i)),...a?[i]:[]]}:a?{field:r,value:[i]}:void 0;await v(e,{products:{filter:[...s?.filter(e=>e!==c)??[],...l?.value?.length?[l]:[]]}}),o()}function x(){let e=o(),t=(0,i.useContext)(p),n=(0,i.useMemo)(()=>({config:e,store:t}),[e,t]);return{newSearch:(0,i.useCallback)((e,t)=>_(n,e,t),[n]),updateSearch:(0,i.useCallback)((e,t)=>v(n,e,t),[n]),toggleProductFilter:(0,i.useCallback)((e,t,r)=>b(n,e,t,r),[n]),replaceFilter:(0,i.useCallback)((e,t)=>y(n,e,t),[n])}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return c}});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { a as e, t } from "./storage-DeAo7M3s.js";
|
|
2
|
+
import { i as n, l as r } from "./useActions-BmWNZAES.js";
|
|
3
|
+
import { useCallback as i, useContext as a } from "preact/hooks";
|
|
4
|
+
//#region packages/preact/hooks/src/useHistory.tsx
|
|
5
|
+
var o = "nosto:search-js:history";
|
|
6
|
+
function s({ value: n, historySize: r, store: i }) {
|
|
7
|
+
let a = (t("nosto:search-js:history") ?? []).filter((e) => e !== n).concat(n), s = r ? a.slice(-r) : [];
|
|
8
|
+
e(o, s), i.updateState({ historyItems: s.reverse() });
|
|
9
|
+
}
|
|
10
|
+
function c() {
|
|
11
|
+
return (t("nosto:search-js:history") ?? []).slice().reverse().filter((e) => !!e);
|
|
12
|
+
}
|
|
13
|
+
function l() {
|
|
14
|
+
let e = a(n), { historySize: t } = r();
|
|
15
|
+
return { addQuery: i((n) => {
|
|
16
|
+
s({
|
|
17
|
+
value: n,
|
|
18
|
+
historySize: t,
|
|
19
|
+
store: e
|
|
20
|
+
});
|
|
21
|
+
}, [t, e]) };
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { c as n, l as r, s as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./storage-B3FIcJQv.cjs`),t=require(`./useActions-boQy-Vp0.cjs`);let n=require(`preact/hooks`);var r=`nosto:search-js:history`;function i({value:t,historySize:n,store:i}){let a=(e.t(`nosto:search-js:history`)??[]).filter(e=>e!==t).concat(t),o=n?a.slice(-n):[];e.a(r,o),i.updateState({historyItems:o.reverse()})}function a(){return(e.t(`nosto:search-js:history`)??[]).slice().reverse().filter(e=>!!e)}function o(){let e=(0,n.useContext)(t.i),{historySize:r}=t.l();return{addQuery:(0,n.useCallback)(t=>{i({value:t,historySize:r,store:e})},[r,e])}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./isBot-CkyQfegP.cjs`),t=require(`./useActions-boQy-Vp0.cjs`);let n=require(`preact/hooks`);function r(e=i){let r=(0,n.useContext)(t.i),[a,o]=(0,n.useState)(e(r.getState()));return r.onChange(e,o),(0,n.useEffect)(()=>()=>r.clearOnChange(o),[r]),a}function i(e){return e}function a({from:t,size:n,pageSize:r}){return e.t()?{products:{from:t+r}}:{products:{size:n+r}}}function o(e=24){let{from:i,size:o}=r(e=>({from:e.query.products?.from??0,size:e.query.products?.size??0})),{updateSearch:s}=t.t();return{loadMore:(0,n.useCallback)(async()=>{await s(a({from:i,size:o,pageSize:e}))},[i,o,e,s])}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as e } from "./isBot-CPesLwHL.js";
|
|
2
|
+
import { i as t, t as n } from "./useActions-BmWNZAES.js";
|
|
3
|
+
import { useCallback as r, useContext as i, useEffect as a, useState as o } from "preact/hooks";
|
|
4
|
+
//#region packages/preact/hooks/src/useNostoAppState.ts
|
|
5
|
+
function s(e = c) {
|
|
6
|
+
let n = i(t), [r, s] = o(e(n.getState()));
|
|
7
|
+
return n.onChange(e, s), a(() => () => n.clearOnChange(s), [n]), r;
|
|
8
|
+
}
|
|
9
|
+
function c(e) {
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region packages/preact/hooks/src/useLoadMore/getNextPageQuery.ts
|
|
14
|
+
function l({ from: t, size: n, pageSize: r }) {
|
|
15
|
+
return e() ? { products: { from: t + r } } : { products: { size: n + r } };
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region packages/preact/hooks/src/useLoadMore/useLoadMore.ts
|
|
19
|
+
function u(e = 24) {
|
|
20
|
+
let { from: t, size: i } = s((e) => ({
|
|
21
|
+
from: e.query.products?.from ?? 0,
|
|
22
|
+
size: e.query.products?.size ?? 0
|
|
23
|
+
})), { updateSearch: a } = n();
|
|
24
|
+
return { loadMore: r(async () => {
|
|
25
|
+
await a(l({
|
|
26
|
+
from: t,
|
|
27
|
+
size: i,
|
|
28
|
+
pageSize: e
|
|
29
|
+
}));
|
|
30
|
+
}, [
|
|
31
|
+
t,
|
|
32
|
+
i,
|
|
33
|
+
e,
|
|
34
|
+
a
|
|
35
|
+
]) };
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { l as n, s as r, u as t };
|
package/dist/utils/utils.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../storage-B3FIcJQv.cjs`),t=require(`../disableNativeAutocomplete-CjBGhRWW.cjs`),n=require(`../cl-CYT5y6Dn.cjs`),r=require(`../unique-BXFI_-3F.cjs`),i=require(`../isBot-CkyQfegP.cjs`),a=require(`../parseNumber-BH_92pM8.cjs`),o=require(`../pick-0KNFTqKn.cjs`);exports.bindInput=t.n,exports.cl=n.t,exports.deepMerge=r.i,exports.disableNativeAutocomplete=t.t,exports.getLocalStorageItem=e.t,exports.getSessionStorageItem=e.n,exports.isBot=i.t,exports.isEqual=e.c,exports.isPlainObject=e.l,exports.logger=e.s,exports.measure=r.n,exports.mergeArrays=r.r,exports.parseNumber=a.t,exports.pick=o.t,exports.removeLocalStorageItem=e.r,exports.removeSessionStorageItem=e.i,exports.setLocalStorageItem=e.a,exports.setSessionStorageItem=e.o,exports.unique=r.t;
|
package/dist/utils/utils.es.js
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
9
|
-
s as bindInput,
|
|
10
|
-
t as cl,
|
|
11
|
-
i as deepMerge,
|
|
12
|
-
o as disableNativeAutocomplete,
|
|
13
|
-
f as getLocalStorageItem,
|
|
14
|
-
n as getSessionStorageItem,
|
|
15
|
-
S as isBot,
|
|
16
|
-
x as isEqual,
|
|
17
|
-
I as isPlainObject,
|
|
18
|
-
b as logger,
|
|
19
|
-
p as measure,
|
|
20
|
-
g as mergeArrays,
|
|
21
|
-
N as parseNumber,
|
|
22
|
-
k as pick,
|
|
23
|
-
d as removeLocalStorageItem,
|
|
24
|
-
v as removeSessionStorageItem,
|
|
25
|
-
L as setLocalStorageItem,
|
|
26
|
-
q as setSessionStorageItem,
|
|
27
|
-
l as unique
|
|
28
|
-
};
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../storage-DeAo7M3s.js";
|
|
2
|
+
import { n as l, t as u } from "../disableNativeAutocomplete-CcR_Ek_P.js";
|
|
3
|
+
import { t as d } from "../cl-G5KK1qHD.js";
|
|
4
|
+
import { i as f, n as p, r as m, t as h } from "../unique-DSDxyj90.js";
|
|
5
|
+
import { t as g } from "../isBot-CPesLwHL.js";
|
|
6
|
+
import { t as _ } from "../parseNumber-DFsrGj64.js";
|
|
7
|
+
import { t as v } from "../pick-B8ymxJme.js";
|
|
8
|
+
export { l as bindInput, d as cl, f as deepMerge, u as disableNativeAutocomplete, c as getLocalStorageItem, i as getSessionStorageItem, g as isBot, t as isEqual, r as isPlainObject, s as logger, p as measure, m as mergeArrays, _ as parseNumber, v as pick, o as removeLocalStorageItem, n as removeSessionStorageItem, e as setLocalStorageItem, a as setSessionStorageItem, h as unique };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosto/search-js",
|
|
3
|
-
"version": "3.25.
|
|
3
|
+
"version": "3.25.7",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -97,14 +97,14 @@
|
|
|
97
97
|
"prepare": "husky"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@commitlint/cli": "^20.
|
|
101
|
-
"@commitlint/config-conventional": "^20.
|
|
102
|
-
"@nosto/nosto-js": "^2.11.
|
|
100
|
+
"@commitlint/cli": "^20.5.0",
|
|
101
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
102
|
+
"@nosto/nosto-js": "^2.11.2",
|
|
103
103
|
"@testing-library/dom": "^10.4.1",
|
|
104
|
-
"@types/dom-speech-recognition": "^0.0.
|
|
104
|
+
"@types/dom-speech-recognition": "^0.0.8",
|
|
105
105
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
106
|
-
"@types/node": "^25.
|
|
107
|
-
"@vitest/coverage-v8": "^4.
|
|
106
|
+
"@types/node": "^25.5.0",
|
|
107
|
+
"@vitest/coverage-v8": "^4.1.1",
|
|
108
108
|
"concurrently": "^9.2.1",
|
|
109
109
|
"copyfiles": "^2.4.1",
|
|
110
110
|
"eslint": "^9.39.2",
|
|
@@ -117,14 +117,14 @@
|
|
|
117
117
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
118
118
|
"husky": "^9.1.7",
|
|
119
119
|
"isbot": "^5.1.36",
|
|
120
|
-
"jsdom": "^29.0.
|
|
120
|
+
"jsdom": "^29.0.1",
|
|
121
121
|
"prettier": "^3.8.1",
|
|
122
|
-
"typedoc": "^0.28.
|
|
122
|
+
"typedoc": "^0.28.18",
|
|
123
123
|
"typescript": "^5.9.3",
|
|
124
|
-
"typescript-eslint": "^8.57.
|
|
125
|
-
"vite": "^
|
|
124
|
+
"typescript-eslint": "^8.57.2",
|
|
125
|
+
"vite": "^8.0.2",
|
|
126
126
|
"vite-plugin-dts": "^4.5.4",
|
|
127
|
-
"vitest": "^4.0
|
|
127
|
+
"vitest": "^4.1.0"
|
|
128
128
|
},
|
|
129
129
|
"overrides": {
|
|
130
130
|
"minimatch": ">=10.2.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./jsxRuntime.module-B3sGoTIU.cjs"),r=require("./useActions-DIlSparF.cjs"),u=require("./baseConfig-BOOw0mWW.cjs"),s=require("./useHistory-DLCyHMo1.cjs"),a=require("preact/hooks"),l={...u.defaultBaseConfig,memoryCache:!1,historyEnabled:!0,historySize:5,debounceDelay:500,minQueryLength:2};function n(e={}){return{pageType:"autocomplete",...l,...e}}function m({config:e,store:i,children:c}){const t=i??r.createStore();return u.useCheckClientScript(),a.useEffect(()=>{t.updateState({historyItems:s.getSavedHistory()})},[t]),o.u(r.ConfigContext,{value:n(e),children:o.u(r.StoreContext,{value:t,children:[o.u(u.StoreActionsListener,{}),c]})})}exports.AutocompletePageProvider=m;exports.makeAutocompleteConfig=n;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { u as o } from "./jsxRuntime.module-Bzuv3cXw.js";
|
|
2
|
-
import { c as i, S as n, C as s } from "./useActions-BD6dgsX8.js";
|
|
3
|
-
import { d as u, u as m, S as c } from "./baseConfig-Cf28X268.js";
|
|
4
|
-
import { g as f } from "./useHistory-sjFYeR68.js";
|
|
5
|
-
import { useEffect as l } from "preact/hooks";
|
|
6
|
-
const p = {
|
|
7
|
-
...u,
|
|
8
|
-
memoryCache: !1,
|
|
9
|
-
historyEnabled: !0,
|
|
10
|
-
historySize: 5,
|
|
11
|
-
debounceDelay: 500,
|
|
12
|
-
minQueryLength: 2
|
|
13
|
-
};
|
|
14
|
-
function d(e = {}) {
|
|
15
|
-
return {
|
|
16
|
-
pageType: "autocomplete",
|
|
17
|
-
...p,
|
|
18
|
-
...e
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function A({ config: e, store: r, children: a }) {
|
|
22
|
-
const t = r ?? i();
|
|
23
|
-
return m(), l(() => {
|
|
24
|
-
t.updateState({
|
|
25
|
-
historyItems: f()
|
|
26
|
-
});
|
|
27
|
-
}, [t]), /* @__PURE__ */ o(s, { value: d(e), children: /* @__PURE__ */ o(n, { value: t, children: [
|
|
28
|
-
/* @__PURE__ */ o(c, {}),
|
|
29
|
-
a
|
|
30
|
-
] }) });
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
A,
|
|
34
|
-
d as m
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("./jsxRuntime.module-B3sGoTIU.cjs"),m=require("./cl-B00bZ7jc.cjs"),C=require("preact/hooks");function k({onClick:a,as:c,children:l,componentProps:s,className:n}){const e={...s,onClick:C.useCallback(i=>{a(),s?.onClick?.(i)},[a,s])},t=m.cl("className"in e&&e.className,n),u=c??(s&&"href"in s?"a":"span");return r.u(u,{...e,className:t,children:l})}exports.BaseElement=k;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { u as f } from "./jsxRuntime.module-Bzuv3cXw.js";
|
|
2
|
-
import { c as n } from "./cl-CcykAxZN.js";
|
|
3
|
-
import { useCallback as o } from "preact/hooks";
|
|
4
|
-
function k({
|
|
5
|
-
onClick: l,
|
|
6
|
-
as: c,
|
|
7
|
-
children: m,
|
|
8
|
-
componentProps: a,
|
|
9
|
-
className: e
|
|
10
|
-
}) {
|
|
11
|
-
const s = {
|
|
12
|
-
...a,
|
|
13
|
-
onClick: o(
|
|
14
|
-
(t) => {
|
|
15
|
-
l(), a?.onClick?.(t);
|
|
16
|
-
},
|
|
17
|
-
[l, a]
|
|
18
|
-
)
|
|
19
|
-
}, i = n("className" in s && s.className, e), r = c ?? (a && "href" in a ? "a" : "span");
|
|
20
|
-
return /* @__PURE__ */ f(r, { ...s, className: i, children: m });
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
k as B
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./jsxRuntime.module-B3sGoTIU.cjs"),r=require("./useActions-DIlSparF.cjs"),o=require("./baseConfig-BOOw0mWW.cjs"),s={...o.defaultBaseConfig,persistentSearchCache:!1,preservePageScroll:!1};function n(e){return{pageType:"category",...s,...e}}function u({config:e,store:a,children:i}){const c=a??r.createStore();return o.useCheckClientScript(),t.u(r.ConfigContext,{value:n(e),children:t.u(r.StoreContext,{value:c,children:[t.u(o.StoreActionsListener,{}),i]})})}exports.CategoryPageProvider=u;exports.makeCategoryConfig=n;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { u as t } from "./jsxRuntime.module-Bzuv3cXw.js";
|
|
2
|
-
import { c as n, S as s, C as i } from "./useActions-BD6dgsX8.js";
|
|
3
|
-
import { d as c, u as C, S as f } from "./baseConfig-Cf28X268.js";
|
|
4
|
-
const l = {
|
|
5
|
-
...c,
|
|
6
|
-
persistentSearchCache: !1,
|
|
7
|
-
preservePageScroll: !1
|
|
8
|
-
};
|
|
9
|
-
function u(e) {
|
|
10
|
-
return {
|
|
11
|
-
pageType: "category",
|
|
12
|
-
...l,
|
|
13
|
-
...e
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function m({ config: e, store: r, children: a }) {
|
|
17
|
-
const o = r ?? n();
|
|
18
|
-
return C(), /* @__PURE__ */ t(i, { value: u(e), children: /* @__PURE__ */ t(s, { value: o, children: [
|
|
19
|
-
/* @__PURE__ */ t(f, {}),
|
|
20
|
-
a
|
|
21
|
-
] }) });
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
m as C,
|
|
25
|
-
u as m
|
|
26
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { u as n } from "./jsxRuntime.module-Bzuv3cXw.js";
|
|
2
|
-
import { l as t } from "./storage-B97DRj5i.js";
|
|
3
|
-
import { Fragment as m } from "preact";
|
|
4
|
-
import { useErrorBoundary as a } from "preact/hooks";
|
|
5
|
-
function p({ children: o }) {
|
|
6
|
-
const [r] = a();
|
|
7
|
-
return r && t.warn("Error caught in ErrorBoundary", r), /* @__PURE__ */ n(m, { children: o });
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
p as E
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./jsxRuntime.module-B3sGoTIU.cjs"),n=require("./storage-9KuhFI9v.cjs"),u=require("preact"),t=require("preact/hooks");function s({children:o}){const[r]=t.useErrorBoundary();return r&&n.logger.warn("Error caught in ErrorBoundary",r),e.u(u.Fragment,{children:o})}exports.ErrorBoundary=s;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("./jsxRuntime.module-B3sGoTIU.cjs"),d=require("./useLoadMore-vCpwy6JC.cjs"),N=require("./storage-9KuhFI9v.cjs"),x=require("./pick-rYi1lc2m.cjs"),u=require("preact"),h=require("preact/hooks");function E(e,r){const t=r.products?.total??0,o=e.products?.from??0,n=e.products?.size??0;return t>0&&t>o+n}function A(){return!!(window.IntersectionObserver&&window.IntersectionObserverEntry&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)}function M(e,r){for(var t in r)e[t]=r[t];return e}function f(e,r){for(var t in e)if(t!=="__source"&&!(t in r))return!0;for(var o in r)if(o!=="__source"&&e[o]!==r[o])return!0;return!1}function m(e,r){this.props=e,this.context=r}function U(e,r){function t(n){var s=this.props.ref,i=s==n.ref;return!i&&s&&(s.call?s(null):s.current=null),r?!r(this.props,n)||!i:f(this.props,n)}function o(n){return this.shouldComponentUpdate=t,u.createElement(e,n)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(m.prototype=new u.Component).isPureReactComponent=!0,m.prototype.shouldComponentUpdate=function(e,r){return f(this.props,e)||f(this.state,r)};var y=u.options.__b;u.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),y&&y(e)};var q=u.options.__e;u.options.__e=function(e,r,t,o){if(e.then){for(var n,s=r;s=s.__;)if((n=s.__c)&&n.__c)return r.__e==null&&(r.__e=t.__e,r.__k=t.__k),n.__c(e,r)}q(e,r,t,o)};var b=u.options.unmount;function P(e,r,t){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=M({},e)).__c!=null&&(e.__c.__P===t&&(e.__c.__P=r),e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return P(o,r,t)})),e}function R(e,r,t){return e&&t&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return R(o,r,t)}),e.__c&&e.__c.__P===r&&(e.__e&&t.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=t)),e}function p(){this.__u=0,this.o=null,this.__b=null}function S(e){var r=e.__.__c;return r&&r.__a&&r.__a(e)}function c(){this.i=null,this.l=null}u.options.unmount=function(e){var r=e.__c;r&&r.__R&&r.__R(),r&&32&e.__u&&(e.type=null),b&&b(e)},(p.prototype=new u.Component).__c=function(e,r){var t=r.__c,o=this;o.o==null&&(o.o=[]),o.o.push(t);var n=S(o.__v),s=!1,i=function(){s||(s=!0,t.__R=null,n?n(_):_())};t.__R=i;var _=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=R(l,l.__c.__P,l.__c.__O)}var a;for(o.setState({__a:o.__b=null});a=o.o.pop();)a.forceUpdate()}};o.__u++||32&r.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(i,i)},p.prototype.componentWillUnmount=function(){this.o=[]},p.prototype.render=function(e,r){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=P(this.__b,t,o.__O=o.__P)}this.__b=null}var n=r.__a&&u.createElement(u.Fragment,null,e.fallback);return n&&(n.__u&=-33),[u.createElement(u.Fragment,null,r.__a?null:e.children),n]};var g=function(e,r,t){if(++t[1]===t[0]&&e.l.delete(r),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(t=e.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;e.i=t=t[2]}};(c.prototype=new u.Component).__a=function(e){var r=this,t=S(r.__v),o=r.l.get(e);return o[0]++,function(n){var s=function(){r.props.revealOrder?(o.push(n),g(r,e,o)):n()};t?t(s):s()}},c.prototype.render=function(e){this.i=null,this.l=new Map;var r=u.toChildArray(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&r.reverse();for(var t=r.length;t--;)this.l.set(r[t],this.i=[1,0,this.i]);return e.children},c.prototype.componentDidUpdate=c.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(r,t){g(e,t,r)})};var I=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,W=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,V=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,j=/[A-Z0-9]/g,F=typeof document<"u",H=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};u.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(u.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(r){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:r})}})});var k=u.options.event;function L(){}function z(){return this.cancelBubble}function B(){return this.defaultPrevented}u.options.event=function(e){return k&&(e=k(e)),e.persist=L,e.isPropagationStopped=z,e.isDefaultPrevented=B,e.nativeEvent=e};var D={enumerable:!1,configurable:!0,get:function(){return this.class}},O=u.options.vnode;u.options.vnode=function(e){typeof e.type=="string"&&(function(r){var t=r.props,o=r.type,n={},s=o.indexOf("-")===-1;for(var i in t){var _=t[i];if(!(i==="value"&&"defaultValue"in t&&_==null||F&&i==="children"&&o==="noscript"||i==="class"||i==="className")){var l=i.toLowerCase();i==="defaultValue"&&"value"in t&&t.value==null?i="value":i==="download"&&_===!0?_="":l==="translate"&&_==="no"?_=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?i="ondblclick":l!=="onchange"||o!=="input"&&o!=="textarea"||H(t.type)?l==="onfocus"?i="onfocusin":l==="onblur"?i="onfocusout":V.test(i)&&(i=l):l=i="oninput":s&&W.test(i)?i=i.replace(j,"-$&").toLowerCase():_===null&&(_=void 0),l==="oninput"&&n[i=l]&&(i="oninputCapture"),n[i]=_}}o=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=u.toChildArray(t.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),o=="select"&&n.defaultValue!=null&&(n.value=u.toChildArray(t.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),t.class&&!t.className?(n.class=t.class,Object.defineProperty(n,"className",D)):(t.className&&!t.class||t.class&&t.className)&&(n.class=n.className=t.className),r.props=n})(e),e.$$typeof=I,O&&O(e)};var C=u.options.__r;u.options.__r=function(e){C&&C(e),e.__c};var w=u.options.diffed;u.options.diffed=function(e){w&&w(e);var r=e.props,t=e.__e;t!=null&&e.type==="textarea"&&"value"in r&&r.value!==t.value&&(t.value=r.value==null?"":r.value)};function T({children:e,pageSize:r,observerOptions:t}){const o=h.useRef(null),{query:n,response:s}=d.useNostoAppState(_=>x.pick(_,"query","response")),{loadMore:i}=d.useLoadMore(r);return h.useEffect(()=>{let _,l;return E(n,s)&&(_=o.current,l=new IntersectionObserver(a=>{a[0]?.isIntersecting&&i()},t),_&&l.observe(_)),()=>{_&&l.unobserve(_)}},[s]),v.u(u.Fragment,{children:[e,v.u("div",{ref:o,style:{height:"1px"}})]})}const $=U(T,N.isEqual);exports.InfiniteScrollWithObserver=$;exports.hasMoreResults=E;exports.intersectionObserverSupported=A;
|