@qubit-ltd/json 1.2.2 → 1.2.4

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.
Files changed (37) hide show
  1. package/dist/json.cjs +188 -20
  2. package/dist/json.cjs.map +1 -1
  3. package/dist/json.min.cjs +1 -1
  4. package/dist/json.min.cjs.map +1 -1
  5. package/dist/json.min.mjs +1 -1
  6. package/dist/json.min.mjs.map +1 -1
  7. package/dist/json.mjs +188 -20
  8. package/dist/json.mjs.map +1 -1
  9. package/doc/api/Json.html +42 -0
  10. package/doc/api/LosslessNumber.html +3 -3
  11. package/doc/api/data/search.json +1 -1
  12. package/doc/api/global.html +3 -3
  13. package/doc/api/index.html +4 -4
  14. package/doc/api/scripts/core.js +719 -726
  15. package/doc/api/scripts/core.min.js +23 -23
  16. package/doc/api/scripts/resize.js +90 -90
  17. package/doc/api/scripts/search.js +267 -265
  18. package/doc/api/scripts/search.min.js +5 -5
  19. package/doc/api/scripts/third-party/Apache-License-2.0.txt +202 -202
  20. package/doc/api/scripts/third-party/fuse.js +1749 -9
  21. package/doc/api/scripts/third-party/hljs-line-num-original.js +367 -369
  22. package/doc/api/scripts/third-party/hljs-line-num.js +1 -1
  23. package/doc/api/scripts/third-party/hljs-original.js +5260 -5171
  24. package/doc/api/scripts/third-party/hljs.js +1 -1
  25. package/doc/api/scripts/third-party/popper.js +1287 -5
  26. package/doc/api/scripts/third-party/tippy.js +1499 -1
  27. package/doc/api/scripts/third-party/tocbot.js +757 -672
  28. package/doc/api/scripts/third-party/tocbot.min.js +1 -1
  29. package/doc/api/styles/clean-jsdoc-theme-base.css +1257 -1159
  30. package/doc/api/styles/clean-jsdoc-theme-dark.css +412 -412
  31. package/doc/api/styles/clean-jsdoc-theme-light.css +482 -482
  32. package/doc/api/styles/clean-jsdoc-theme-scrollbar.css +29 -29
  33. package/doc/api/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -1
  34. package/doc/api/styles/clean-jsdoc-theme.min.css +1 -1
  35. package/doc/json.min.visualization.html +15 -15
  36. package/doc/json.visualization.html +15 -15
  37. package/package.json +25 -24
@@ -1,265 +1,267 @@
1
- /* global document */
2
-
3
- const searchId = 'LiBfqbJVcV';
4
- const searchHash = '#' + searchId;
5
- const searchContainer = document.querySelector('#PkfLWpAbet');
6
- const searchWrapper = document.querySelector('#iCxFxjkHbP');
7
- const searchCloseButton = document.querySelector('#VjLlGakifb');
8
- const searchInput = document.querySelector('#vpcKVYIppa');
9
- const resultBox = document.querySelector('#fWwVHRuDuN');
10
-
11
- function showResultText(text) {
12
- resultBox.innerHTML = `<span class="search-result-c-text">${text}</span>`;
13
- }
14
-
15
- function hideSearch() {
16
- // eslint-disable-next-line no-undef
17
- if (window.location.hash === searchHash) {
18
- // eslint-disable-next-line no-undef
19
- history.go(-1);
20
- }
21
-
22
- // eslint-disable-next-line no-undef
23
- window.onhashchange = null;
24
-
25
- if (searchContainer) {
26
- searchContainer.style.display = 'none';
27
- }
28
- }
29
-
30
- function listenCloseKey(event) {
31
- if (event.key === 'Escape') {
32
- hideSearch();
33
- // eslint-disable-next-line no-undef
34
- window.removeEventListener('keyup', listenCloseKey);
35
- }
36
- }
37
-
38
- function showSearch() {
39
- try {
40
- // Closing mobile menu before opening
41
- // search box.
42
- // It is defined in core.js
43
- // eslint-disable-next-line no-undef
44
- hideMobileMenu();
45
- } catch (error) {
46
- console.error(error);
47
- }
48
-
49
- // eslint-disable-next-line no-undef
50
- window.onhashchange = hideSearch;
51
-
52
- // eslint-disable-next-line no-undef
53
- if (window.location.hash !== searchHash) {
54
- // eslint-disable-next-line no-undef
55
- history.pushState(null, null, searchHash);
56
- }
57
-
58
- if (searchContainer) {
59
- searchContainer.style.display = 'flex';
60
- // eslint-disable-next-line no-undef
61
- window.addEventListener('keyup', listenCloseKey);
62
- }
63
-
64
- if (searchInput) {
65
- searchInput.focus();
66
- }
67
- }
68
-
69
- async function fetchAllData() {
70
- // eslint-disable-next-line no-undef
71
- const { hostname, protocol, port } = location;
72
-
73
- // eslint-disable-next-line no-undef
74
- const base = protocol + '//' + hostname + (port !== '' ? ':' + port : '') + baseURL;
75
- // eslint-disable-next-line no-undef
76
- const url = new URL('data/search.json', base);
77
- const result = await fetch(url);
78
- const { list } = await result.json();
79
-
80
- return list;
81
- }
82
-
83
- // eslint-disable-next-line no-unused-vars
84
- function onClickSearchItem(event) {
85
- const target = event.currentTarget;
86
-
87
- if (target) {
88
- const href = target.getAttribute('href') || '';
89
- let elementId = href.split('#')[1] || '';
90
- let element = document.getElementById(elementId);
91
-
92
- if (!element) {
93
- elementId = decodeURI(elementId);
94
- element = document.getElementById(elementId);
95
- }
96
-
97
- if (element) {
98
- setTimeout(function() {
99
- // eslint-disable-next-line no-undef
100
- bringElementIntoView(element); // defined in core.js
101
- }, 100);
102
- }
103
- }
104
- }
105
-
106
- function buildSearchResult(result) {
107
- let output = '';
108
- const removeHTMLTagsRegExp = /(<([^>]+)>)/ig;
109
-
110
- for (const res of result) {
111
- const { title = '', description = '' } = res.item;
112
-
113
- const _link = res.item.link.replace('<a href="', '').replace(/">.*/, '');
114
- const _title = title.replace(removeHTMLTagsRegExp, "");
115
- const _description = description.replace(removeHTMLTagsRegExp, "");
116
-
117
- output += `
118
- <a onclick="onClickSearchItem(event)" href="${_link}" class="search-result-item">
119
- <div class="search-result-item-title">${_title}</div>
120
- <div class="search-result-item-p">${_description || 'No description available.'}</div>
121
- </a>
122
- `;
123
- }
124
-
125
- return output;
126
- }
127
-
128
- function getSearchResult(list, keys, searchKey) {
129
- const defaultOptions = {
130
- shouldSort: true,
131
- threshold: 0.4,
132
- location: 0,
133
- distance: 100,
134
- maxPatternLength: 32,
135
- minMatchCharLength: 1,
136
- keys: keys
137
- };
138
-
139
- const options = { ...defaultOptions };
140
-
141
- // eslint-disable-next-line no-undef
142
- const searchIndex = Fuse.createIndex(options.keys, list);
143
-
144
- // eslint-disable-next-line no-undef
145
- const fuse = new Fuse(list, options, searchIndex);
146
-
147
- const result = fuse.search(searchKey);
148
-
149
- if (result.length > 20) {
150
- return result.slice(0, 20);
151
- }
152
-
153
- return result;
154
- }
155
-
156
- function debounce(func, wait, immediate) {
157
- let timeout;
158
-
159
- return function() {
160
- const args = arguments;
161
-
162
- clearTimeout(timeout);
163
- timeout = setTimeout(() => {
164
- timeout = null;
165
- if (!immediate) {
166
- // eslint-disable-next-line consistent-this, no-invalid-this
167
- func.apply(this, args);
168
- }
169
- }, wait);
170
-
171
- if (immediate && !timeout) {
172
- // eslint-disable-next-line consistent-this, no-invalid-this
173
- func.apply(this, args);
174
- }
175
- };
176
- }
177
-
178
- let searchData;
179
-
180
- async function search(event) {
181
- const value = event.target.value;
182
- const keys = ['title', 'description'];
183
-
184
- if (!resultBox) {
185
- console.error('Search result container not found');
186
-
187
- return;
188
- }
189
-
190
- if (!value) {
191
- showResultText('Type anything to view search result');
192
-
193
- return;
194
- }
195
-
196
- if (!searchData) {
197
- showResultText('Loading...');
198
-
199
- try {
200
- // eslint-disable-next-line require-atomic-updates
201
- searchData = await fetchAllData();
202
- } catch (e) {
203
- console.log(e);
204
- showResultText('Failed to load result.');
205
-
206
- return;
207
- }
208
- }
209
-
210
- const result = getSearchResult(searchData, keys, value);
211
-
212
- if (!result.length) {
213
- showResultText('No result found! Try some different combination.');
214
-
215
- return;
216
- }
217
-
218
- // eslint-disable-next-line require-atomic-updates
219
- resultBox.innerHTML = buildSearchResult(result);
220
- }
221
-
222
- function onDomContentLoaded() {
223
- const searchButton = document.querySelectorAll('.search-button');
224
- const debouncedSearch = debounce(search, 300);
225
-
226
- if (searchCloseButton) {
227
- searchCloseButton.addEventListener('click', hideSearch);
228
- }
229
-
230
- if (searchButton) {
231
- searchButton.forEach(function(item) {
232
- item.addEventListener('click', showSearch);
233
- });
234
- }
235
-
236
- if (searchContainer) {
237
- searchContainer.addEventListener('click', hideSearch);
238
- }
239
-
240
- if (searchWrapper) {
241
- searchWrapper.addEventListener('click', function(event) {
242
- event.stopPropagation();
243
- });
244
- }
245
-
246
- if (searchInput) {
247
- searchInput.addEventListener('keyup', debouncedSearch);
248
- }
249
-
250
- // eslint-disable-next-line no-undef
251
- if (window.location.hash === searchHash) {
252
- showSearch();
253
- }
254
- }
255
-
256
- // eslint-disable-next-line no-undef
257
- window.addEventListener('DOMContentLoaded', onDomContentLoaded);
258
-
259
- // eslint-disable-next-line no-undef
260
- window.addEventListener('hashchange', function() {
261
- // eslint-disable-next-line no-undef
262
- if (window.location.hash === searchHash) {
263
- showSearch();
264
- }
265
- });
1
+ /* global document */
2
+
3
+ const searchId = "LiBfqbJVcV";
4
+ const searchHash = "#" + searchId;
5
+ const searchContainer = document.querySelector("#PkfLWpAbet");
6
+ const searchWrapper = document.querySelector("#iCxFxjkHbP");
7
+ const searchCloseButton = document.querySelector("#VjLlGakifb");
8
+ const searchInput = document.querySelector("#vpcKVYIppa");
9
+ const resultBox = document.querySelector("#fWwVHRuDuN");
10
+
11
+ function showResultText(text) {
12
+ resultBox.innerHTML = `<span class="search-result-c-text">${text}</span>`;
13
+ }
14
+
15
+ function hideSearch() {
16
+ // eslint-disable-next-line no-undef
17
+ if (window.location.hash === searchHash) {
18
+ // eslint-disable-next-line no-undef
19
+ history.go(-1);
20
+ }
21
+
22
+ // eslint-disable-next-line no-undef
23
+ window.onhashchange = null;
24
+
25
+ if (searchContainer) {
26
+ searchContainer.style.display = "none";
27
+ }
28
+ }
29
+
30
+ function listenCloseKey(event) {
31
+ if (event.key === "Escape") {
32
+ hideSearch();
33
+ // eslint-disable-next-line no-undef
34
+ window.removeEventListener("keyup", listenCloseKey);
35
+ }
36
+ }
37
+
38
+ function showSearch() {
39
+ try {
40
+ // Closing mobile menu before opening
41
+ // search box.
42
+ // It is defined in core.js
43
+ // eslint-disable-next-line no-undef
44
+ hideMobileMenu();
45
+ } catch (error) {
46
+ console.error(error);
47
+ }
48
+
49
+ // eslint-disable-next-line no-undef
50
+ window.onhashchange = hideSearch;
51
+
52
+ // eslint-disable-next-line no-undef
53
+ if (window.location.hash !== searchHash) {
54
+ // eslint-disable-next-line no-undef
55
+ history.pushState(null, null, searchHash);
56
+ }
57
+
58
+ if (searchContainer) {
59
+ searchContainer.style.display = "flex";
60
+ // eslint-disable-next-line no-undef
61
+ window.addEventListener("keyup", listenCloseKey);
62
+ }
63
+
64
+ if (searchInput) {
65
+ searchInput.focus();
66
+ }
67
+ }
68
+
69
+ async function fetchAllData() {
70
+ // eslint-disable-next-line no-undef
71
+ const { hostname, protocol, port } = location;
72
+
73
+ // eslint-disable-next-line no-undef
74
+ const base =
75
+ // eslint-disable-next-line no-undef
76
+ protocol + "//" + hostname + (port !== "" ? ":" + port : "") + baseURL;
77
+ // eslint-disable-next-line no-undef
78
+ const url = new URL("data/search.json", base);
79
+ const result = await fetch(url);
80
+ const { list } = await result.json();
81
+
82
+ return list;
83
+ }
84
+
85
+ // eslint-disable-next-line no-unused-vars
86
+ function onClickSearchItem(event) {
87
+ const target = event.currentTarget;
88
+
89
+ if (target) {
90
+ const href = target.getAttribute("href") || "";
91
+ let elementId = href.split("#")[1] || "";
92
+ let element = document.getElementById(elementId);
93
+
94
+ if (!element) {
95
+ elementId = decodeURI(elementId);
96
+ element = document.getElementById(elementId);
97
+ }
98
+
99
+ if (element) {
100
+ setTimeout(function () {
101
+ // eslint-disable-next-line no-undef
102
+ bringElementIntoView(element); // defined in core.js
103
+ }, 100);
104
+ }
105
+ }
106
+ }
107
+
108
+ function buildSearchResult(result) {
109
+ let output = "";
110
+ const removeHTMLTagsRegExp = /(<([^>]+)>)/gi;
111
+
112
+ for (const res of result) {
113
+ const { title = "", description = "" } = res.item;
114
+
115
+ const _link = res.item.link.replace('<a href="', "").replace(/">.*/, "");
116
+ const _title = title.replace(removeHTMLTagsRegExp, "");
117
+ const _description = description.replace(removeHTMLTagsRegExp, "");
118
+
119
+ output += `
120
+ <a onclick="onClickSearchItem(event)" href="${_link}" class="search-result-item">
121
+ <div class="search-result-item-title">${_title}</div>
122
+ <div class="search-result-item-p">${
123
+ _description || "No description available."
124
+ }</div>
125
+ </a>
126
+ `;
127
+ }
128
+
129
+ return output;
130
+ }
131
+
132
+ function getSearchResult(list, keys, searchKey) {
133
+ const defaultOptions = {
134
+ shouldSort: true,
135
+ threshold: 0.4,
136
+ location: 0,
137
+ distance: 100,
138
+ maxPatternLength: 32,
139
+ minMatchCharLength: 1,
140
+ keys: keys,
141
+ };
142
+
143
+ const options = { ...defaultOptions };
144
+
145
+ // eslint-disable-next-line no-undef
146
+ const searchIndex = Fuse.createIndex(options.keys, list);
147
+
148
+ // eslint-disable-next-line no-undef
149
+ const fuse = new Fuse(list, options, searchIndex);
150
+
151
+ const result = fuse.search(searchKey);
152
+
153
+ if (result.length > 20) {
154
+ return result.slice(0, 20);
155
+ }
156
+
157
+ return result;
158
+ }
159
+
160
+ function debounce(func, wait, immediate) {
161
+ let timeout;
162
+
163
+ return function () {
164
+ const args = arguments;
165
+
166
+ clearTimeout(timeout);
167
+ timeout = setTimeout(() => {
168
+ timeout = null;
169
+ if (!immediate) {
170
+ // eslint-disable-next-line consistent-this, no-invalid-this
171
+ func.apply(this, args);
172
+ }
173
+ }, wait);
174
+
175
+ if (immediate && !timeout) {
176
+ // eslint-disable-next-line consistent-this, no-invalid-this
177
+ func.apply(this, args);
178
+ }
179
+ };
180
+ }
181
+
182
+ let searchData;
183
+
184
+ async function search(event) {
185
+ const value = event.target.value;
186
+ const keys = ["title", "description"];
187
+
188
+ if (!resultBox) {
189
+ console.error("Search result container not found");
190
+ return;
191
+ }
192
+
193
+ if (!value) {
194
+ showResultText("Type anything to view search result");
195
+
196
+ return;
197
+ }
198
+
199
+ if (!searchData) {
200
+ showResultText("Loading...");
201
+
202
+ try {
203
+ // eslint-disable-next-line require-atomic-updates
204
+ searchData = await fetchAllData();
205
+ } catch (e) {
206
+ console.log(e);
207
+ showResultText("Failed to load result.");
208
+ return;
209
+ }
210
+ }
211
+
212
+ const result = getSearchResult(searchData, keys, value);
213
+
214
+ if (!result.length) {
215
+ showResultText("No result found! Try some different combination.");
216
+
217
+ return;
218
+ }
219
+
220
+ // eslint-disable-next-line require-atomic-updates
221
+ resultBox.innerHTML = buildSearchResult(result);
222
+ }
223
+
224
+ function onDomContentLoaded() {
225
+ const searchButton = document.querySelectorAll(".search-button");
226
+ const debouncedSearch = debounce(search, 300);
227
+
228
+ if (searchCloseButton) {
229
+ searchCloseButton.addEventListener("click", hideSearch);
230
+ }
231
+
232
+ if (searchButton) {
233
+ searchButton.forEach(function (item) {
234
+ item.addEventListener("click", showSearch);
235
+ });
236
+ }
237
+
238
+ if (searchContainer) {
239
+ searchContainer.addEventListener("click", hideSearch);
240
+ }
241
+
242
+ if (searchWrapper) {
243
+ searchWrapper.addEventListener("click", function (event) {
244
+ event.stopPropagation();
245
+ });
246
+ }
247
+
248
+ if (searchInput) {
249
+ searchInput.addEventListener("keyup", debouncedSearch);
250
+ }
251
+
252
+ // eslint-disable-next-line no-undef
253
+ if (window.location.hash === searchHash) {
254
+ showSearch();
255
+ }
256
+ }
257
+
258
+ // eslint-disable-next-line no-undef
259
+ window.addEventListener("DOMContentLoaded", onDomContentLoaded);
260
+
261
+ // eslint-disable-next-line no-undef
262
+ window.addEventListener("hashchange", function () {
263
+ // eslint-disable-next-line no-undef
264
+ if (window.location.hash === searchHash) {
265
+ showSearch();
266
+ }
267
+ });
@@ -1,6 +1,6 @@
1
- const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('<a href="',"").replace(/">.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=`
2
- <a onclick="onClickSearchItem(event)" href="${a}" class="search-result-item">
3
- <div class="search-result-item-title">${o}</div>
4
- <div class="search-result-item-p">${r||"No description available."}</div>
1
+ let searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`<span class="search-result-c-text">${e}</span>`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t),n=(await(await fetch(e)).json()).list;return n}function onClickSearchItem(t){t=t.currentTarget;if(t){t=(t.getAttribute("href")||"").split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n,a=/(<([^>]+)>)/gi;for(n of e){var{title:r="",description:o=""}=n.item,s=n.item.link.replace('<a href="',"").replace(/">.*/,""),r=r.replace(a,""),o=o.replace(a,"");t+=`
2
+ <a onclick="onClickSearchItem(event)" href="${s}" class="search-result-item">
3
+ <div class="search-result-item-title">${r}</div>
4
+ <div class="search-result-item-p">${o||"No description available."}</div>
5
5
  </a>
6
- `}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e);const o=new Fuse(e,t,a),r=o.search(n);return 20<r.length?r.slice(0,20):r}function debounce(t,n,a){let o;return function(){const e=arguments;clearTimeout(o),o=setTimeout(()=>{o=null,a||t.apply(this,e)},n),a&&!o&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){const e=document.querySelectorAll(".search-button");var t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
6
+ `}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e),e=new Fuse(e,t,a).search(n);return 20<e.length?e.slice(0,20):e}function debounce(t,n,a){let r;return function(){let e=arguments;clearTimeout(r),r=setTimeout(()=>{r=null,a||t.apply(this,e)},n),a&&!r&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){var e=document.querySelectorAll(".search-button"),t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});