clean-jsdoc-theme 4.1.4 → 4.1.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.
Files changed (67) hide show
  1. package/.eslintignore +4 -4
  2. package/.eslintrc.js +3 -3
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +43 -43
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +27 -27
  5. package/.github/dependabot.yml +9 -9
  6. package/.github/pull_request_template.md +16 -16
  7. package/.github/workflows/codeql.yml +72 -72
  8. package/.github/workflows/greetings.yml +16 -16
  9. package/.prettierignore +2 -2
  10. package/.prettierrc +5 -5
  11. package/.stylelintignore +3 -3
  12. package/.stylelintrc +23 -23
  13. package/.travis.yml +30 -30
  14. package/CHANGELOG.md +235 -235
  15. package/CODE_OF_CONDUCT.md +76 -76
  16. package/CODE_OF_CONDUCT_HINDI.md +46 -46
  17. package/CONTRIBUTING.md +24 -24
  18. package/LICENSE +21 -21
  19. package/README.md +456 -457
  20. package/SECURITY.md +21 -21
  21. package/helpers/down-arrow.js +9 -9
  22. package/jsdoc-config.json +61 -61
  23. package/minify.js +56 -52
  24. package/package.json +50 -50
  25. package/publish.js +1129 -1129
  26. package/static/scripts/core.js +656 -643
  27. package/static/scripts/core.min.js +23 -23
  28. package/static/scripts/resize.js +90 -90
  29. package/static/scripts/search.js +262 -289
  30. package/static/scripts/search.min.js +6 -11
  31. package/static/scripts/third-party/Apache-License-2.0.txt +202 -202
  32. package/static/scripts/third-party/fuse.js +8 -8
  33. package/static/scripts/third-party/hljs-line-num-original.js +365 -0
  34. package/static/scripts/third-party/hljs-line-num.js +1 -1
  35. package/static/scripts/third-party/hljs-original.js +5162 -5162
  36. package/static/scripts/third-party/popper.js +5 -5
  37. package/static/scripts/third-party/tippy.js +1 -1
  38. package/static/styles/clean-jsdoc-theme-base.css +969 -952
  39. package/static/styles/clean-jsdoc-theme-dark.css +407 -411
  40. package/static/styles/clean-jsdoc-theme-light.css +388 -392
  41. package/static/styles/clean-jsdoc-theme.min.css +1 -1
  42. package/tmpl/augments.tmpl +10 -10
  43. package/tmpl/container.tmpl +190 -190
  44. package/tmpl/details.tmpl +207 -207
  45. package/tmpl/example.tmpl +3 -3
  46. package/tmpl/examples.tmpl +40 -40
  47. package/tmpl/exceptions.tmpl +32 -32
  48. package/tmpl/icons.tmpl +72 -72
  49. package/tmpl/layout.tmpl +157 -155
  50. package/tmpl/mainpage.tmpl +10 -10
  51. package/tmpl/members.tmpl +42 -42
  52. package/tmpl/method.tmpl +139 -139
  53. package/tmpl/mobile-sidebar.tmpl +20 -20
  54. package/tmpl/navbar-actions.tmpl +18 -18
  55. package/tmpl/navbar-menu.tmpl +24 -24
  56. package/tmpl/navbar.tmpl +13 -13
  57. package/tmpl/params.tmpl +124 -124
  58. package/tmpl/properties.tmpl +109 -109
  59. package/tmpl/returns.tmpl +18 -18
  60. package/tmpl/search.tmpl +16 -16
  61. package/tmpl/sidebar-items.tmpl +23 -23
  62. package/tmpl/sidebar-title.tmpl +9 -9
  63. package/tmpl/sidebar.tmpl +8 -8
  64. package/tmpl/source.tmpl +12 -12
  65. package/tmpl/toc.tmpl +3 -3
  66. package/tmpl/tutorial.tmpl +19 -19
  67. package/tmpl/type.tmpl +6 -6
@@ -1,289 +1,262 @@
1
- /* global document */
2
-
3
- var searchData;
4
- var searchId = 'LiBfqbJVcV';
5
- var searchHash = '#' + searchId;
6
- var searchContainerID = '#PkfLWpAbet';
7
- var searchWrapperID = '#iCxFxjkHbP';
8
- var searchCloseButtonID = '#VjLlGakifb';
9
- var searchInputID = '#vpcKVYIppa';
10
- var searchResultCID = '#fWwVHRuDuN';
11
-
12
- function hideSearch() {
13
- var container = document.querySelector(searchContainerID);
14
-
15
- // eslint-disable-next-line no-undef
16
- if (window.location.hash === searchHash) {
17
- // eslint-disable-next-line no-undef
18
- history.go(-1);
19
- }
20
-
21
- // eslint-disable-next-line no-undef
22
- window.onhashchange = null;
23
-
24
- if (container) {
25
- container.style.display = 'none';
26
- }
27
- }
28
-
29
- function listenKey(event) {
30
- if (event.key === 'Escape') {
31
- hideSearch();
32
- // eslint-disable-next-line no-undef
33
- window.removeEventListener('keyup', listenKey);
34
- }
35
- }
36
-
37
- function showSearch() {
38
- try {
39
- // Closing mobile menu before opening
40
- // search box.
41
- // It is defined in core.js
42
- // eslint-disable-next-line no-undef
43
- hideMobileMenu();
44
- } catch (error) {
45
- console.error(error);
46
- }
47
-
48
- var container = document.querySelector(searchContainerID);
49
- var input = document.querySelector(searchInputID);
50
-
51
- // eslint-disable-next-line no-undef
52
- window.onhashchange = hideSearch;
53
-
54
- // eslint-disable-next-line no-undef
55
- if (window.location.hash !== searchHash) {
56
- // eslint-disable-next-line no-undef
57
- history.pushState(null, null, searchHash);
58
- }
59
-
60
- if (container) {
61
- container.style.display = 'flex';
62
- // eslint-disable-next-line no-undef
63
- window.addEventListener('keyup', listenKey);
64
- }
65
-
66
- if (input) {
67
- input.focus();
68
- }
69
- }
70
-
71
- function fetchAllData(obj = {}) {
72
- // eslint-disable-next-line no-undef
73
- var url = baseURL + 'data/search.json';
74
-
75
- fetch(url)
76
- .then(function(d) {
77
- return d.json();
78
- })
79
- .then(function(d) {
80
- searchData = d.list;
81
- if (typeof obj.onSuccess === 'function') {
82
- obj.onSuccess(d.list);
83
- }
84
- })
85
- .catch(function(error) {
86
- console.error(error);
87
- if (typeof obj.onError === 'function') {
88
- obj.onError();
89
- }
90
- });
91
- }
92
-
93
- // eslint-disable-next-line no-unused-vars
94
- function onClickSearchItem(event) {
95
- var target = event.currentTarget;
96
-
97
- if (target) {
98
- var href = target.getAttribute('href') || '';
99
- var id = href.split('#')[1] || '';
100
- var element = document.getElementById(id);
101
-
102
- if (!element) {
103
- id = decodeURI(id);
104
- element = document.getElementById(id);
105
- }
106
-
107
- if (element) {
108
- setTimeout(function() {
109
- // eslint-disable-next-line no-undef
110
- bringElementIntoView(element); // defined in core.js
111
- }, 100);
112
- }
113
- }
114
- }
115
-
116
- function buildSearchResult(result) {
117
- var output = '';
118
-
119
- for (const res of result) {
120
- var data = res.item;
121
-
122
- var link = res.item.link.replace('<a href="', '').replace(/">.*/, '');
123
-
124
- output += `
125
-
126
- <a onclick="onClickSearchItem(event)" href="${link}" class="search-result-item">
127
- <div class="search-result-item-title">
128
- ${data.title}
129
- </div>
130
- <div class="search-result-item-p">
131
- ${data.description ? data.description : 'No description available.'}
132
- </div>
133
- </a>
134
- `;
135
- }
136
-
137
- return output;
138
- }
139
-
140
- function getSearchResult(list, keys, searchKey) {
141
- var defaultOptions = {
142
- shouldSort: true,
143
- threshold: 0.4,
144
- location: 0,
145
- distance: 100,
146
- maxPatternLength: 32,
147
- minMatchCharLength: 1,
148
- keys: keys
149
- };
150
-
151
- // var op = Object.assign({}, defaultOptions, options);
152
- var op = defaultOptions;
153
-
154
- // eslint-disable-next-line no-undef
155
- var searchIndex = Fuse.createIndex(op.keys, list);
156
-
157
- /* eslint-disable-next-line */
158
- var fuse = new Fuse(list, op, searchIndex);
159
-
160
- var result = fuse.search(searchKey);
161
-
162
- if (result.length > 20) {
163
- result = result.slice(0, 20);
164
- }
165
-
166
- return result;
167
- }
168
-
169
- function debounce(func, wait, immediate) {
170
- var timeout;
171
-
172
- return function() {
173
- // eslint-disable-next-line consistent-this, no-invalid-this
174
- var context = this,
175
- args = arguments;
176
-
177
- clearTimeout(timeout);
178
- timeout = setTimeout(function() {
179
- timeout = null;
180
- if (!immediate) {
181
- func.apply(context, args);
182
- }
183
- }, wait);
184
- if (immediate && !timeout) {
185
- func.apply(context, args);
186
- }
187
- };
188
- }
189
-
190
- function search(event) {
191
- var value = event.target.value;
192
- var resultBox = document.querySelector(searchResultCID);
193
- var keys = ['title', 'description'];
194
-
195
- if (!resultBox) {
196
- console.error('Search result container not found');
197
-
198
- return;
199
- }
200
-
201
- if (!value) {
202
- resultBox.innerHTML = 'Type anything to view search result';
203
-
204
- return;
205
- }
206
-
207
- function onSuccess(res) {
208
- if (res.length === 0) {
209
- resultBox.innerHTML =
210
- 'No result found! Try some different combination.';
211
-
212
- return;
213
- }
214
- var output = buildSearchResult(res);
215
-
216
- resultBox.innerHTML = output;
217
- }
218
-
219
- if (!searchData) {
220
- resultBox.innerHTML = 'Loading...';
221
-
222
- fetchAllData({
223
- onSuccess: function(list) {
224
- var result = getSearchResult(list, keys, value);
225
-
226
- onSuccess(result);
227
- },
228
- onError: function() {
229
- resultBox.innerHTML = 'Failed to load result.';
230
- }
231
- });
232
-
233
- return;
234
- }
235
-
236
- var result = getSearchResult(searchData, keys, value);
237
-
238
- onSuccess(result);
239
- }
240
-
241
- function onDomContentLoaded() {
242
- var input = document.querySelector(searchInputID);
243
- var searchButton = document.querySelectorAll('.search-button');
244
- var searchContainer = document.querySelector(searchContainerID);
245
- var searchWrapper = document.querySelector(searchWrapperID);
246
- var searchCloseButton = document.querySelector(searchCloseButtonID);
247
-
248
- var debouncedSearch = debounce(search, 300);
249
-
250
- if (searchCloseButton) {
251
- searchCloseButton.addEventListener('click', hideSearch);
252
- }
253
-
254
- if (searchButton) {
255
- searchButton.forEach(function(item) {
256
- item.addEventListener('click', showSearch);
257
- });
258
- }
259
-
260
- if (searchContainer) {
261
- searchContainer.addEventListener('click', hideSearch);
262
- }
263
-
264
- if (searchWrapper) {
265
- searchWrapper.addEventListener('click', function(event) {
266
- event.stopPropagation();
267
- });
268
- }
269
-
270
- if (input) {
271
- input.addEventListener('keyup', debouncedSearch);
272
- }
273
-
274
- // eslint-disable-next-line no-undef
275
- if (window.location.hash === searchHash) {
276
- showSearch();
277
- }
278
- }
279
-
280
- // eslint-disable-next-line no-undef
281
- window.addEventListener('DOMContentLoaded', onDomContentLoaded);
282
-
283
- // eslint-disable-next-line no-undef
284
- window.addEventListener('hashchange', function() {
285
- // eslint-disable-next-line no-undef
286
- if (window.location.hash === searchHash) {
287
- showSearch();
288
- }
289
- });
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
+
109
+ for (const res of result) {
110
+ const { title, description } = res.item;
111
+
112
+ const link = res.item.link.replace('<a href="', '').replace(/">.*/, '');
113
+
114
+ output += `
115
+ <a onclick="onClickSearchItem(event)" href="${link}" class="search-result-item">
116
+ <div class="search-result-item-title">${title}</div>
117
+ <div class="search-result-item-p">${description || 'No description available.'}</div>
118
+ </a>
119
+ `;
120
+ }
121
+
122
+ return output;
123
+ }
124
+
125
+ function getSearchResult(list, keys, searchKey) {
126
+ const defaultOptions = {
127
+ shouldSort: true,
128
+ threshold: 0.4,
129
+ location: 0,
130
+ distance: 100,
131
+ maxPatternLength: 32,
132
+ minMatchCharLength: 1,
133
+ keys: keys
134
+ };
135
+
136
+ const options = { ...defaultOptions };
137
+
138
+ // eslint-disable-next-line no-undef
139
+ const searchIndex = Fuse.createIndex(options.keys, list);
140
+
141
+ // eslint-disable-next-line no-undef
142
+ const fuse = new Fuse(list, options, searchIndex);
143
+
144
+ const result = fuse.search(searchKey);
145
+
146
+ if (result.length > 20) {
147
+ return result.slice(0, 20);
148
+ }
149
+
150
+ return result;
151
+ }
152
+
153
+ function debounce(func, wait, immediate) {
154
+ let timeout;
155
+
156
+ return function() {
157
+ const args = arguments;
158
+
159
+ clearTimeout(timeout);
160
+ timeout = setTimeout(() => {
161
+ timeout = null;
162
+ if (!immediate) {
163
+ // eslint-disable-next-line consistent-this, no-invalid-this
164
+ func.apply(this, args);
165
+ }
166
+ }, wait);
167
+
168
+ if (immediate && !timeout) {
169
+ // eslint-disable-next-line consistent-this, no-invalid-this
170
+ func.apply(this, args);
171
+ }
172
+ };
173
+ }
174
+
175
+ let searchData;
176
+
177
+ async function search(event) {
178
+ const value = event.target.value;
179
+ const keys = ['title', 'description'];
180
+
181
+ if (!resultBox) {
182
+ console.error('Search result container not found');
183
+
184
+ return;
185
+ }
186
+
187
+ if (!value) {
188
+ showResultText('Type anything to view search result');
189
+
190
+ return;
191
+ }
192
+
193
+ if (!searchData) {
194
+ showResultText('Loading...');
195
+
196
+ try {
197
+ // eslint-disable-next-line require-atomic-updates
198
+ searchData = await fetchAllData();
199
+ } catch (e) {
200
+ console.log(e);
201
+ showResultText('Failed to load result.');
202
+
203
+ return;
204
+ }
205
+ }
206
+
207
+ const result = getSearchResult(searchData, keys, value);
208
+
209
+ if (!result.length) {
210
+ showResultText('No result found! Try some different combination.');
211
+
212
+ return;
213
+ }
214
+
215
+ // eslint-disable-next-line require-atomic-updates
216
+ resultBox.innerHTML = buildSearchResult(result);
217
+ }
218
+
219
+ function onDomContentLoaded() {
220
+ const searchButton = document.querySelectorAll('.search-button');
221
+ const debouncedSearch = debounce(search, 300);
222
+
223
+ if (searchCloseButton) {
224
+ searchCloseButton.addEventListener('click', hideSearch);
225
+ }
226
+
227
+ if (searchButton) {
228
+ searchButton.forEach(function(item) {
229
+ item.addEventListener('click', showSearch);
230
+ });
231
+ }
232
+
233
+ if (searchContainer) {
234
+ searchContainer.addEventListener('click', hideSearch);
235
+ }
236
+
237
+ if (searchWrapper) {
238
+ searchWrapper.addEventListener('click', function(event) {
239
+ event.stopPropagation();
240
+ });
241
+ }
242
+
243
+ if (searchInput) {
244
+ searchInput.addEventListener('keyup', debouncedSearch);
245
+ }
246
+
247
+ // eslint-disable-next-line no-undef
248
+ if (window.location.hash === searchHash) {
249
+ showSearch();
250
+ }
251
+ }
252
+
253
+ // eslint-disable-next-line no-undef
254
+ window.addEventListener('DOMContentLoaded', onDomContentLoaded);
255
+
256
+ // eslint-disable-next-line no-undef
257
+ window.addEventListener('hashchange', function() {
258
+ // eslint-disable-next-line no-undef
259
+ if (window.location.hash === searchHash) {
260
+ showSearch();
261
+ }
262
+ });
@@ -1,11 +1,6 @@
1
- var searchData,searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainerID="#PkfLWpAbet",searchWrapperID="#iCxFxjkHbP",searchCloseButtonID="#VjLlGakifb",searchInputID="#vpcKVYIppa",searchResultCID="#fWwVHRuDuN";function hideSearch(){var e=document.querySelector(searchContainerID);window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,e&&(e.style.display="none")}function listenKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}var e=document.querySelector(searchContainerID),t=document.querySelector(searchInputID);window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),e&&(e.style.display="flex",window.addEventListener("keyup",listenKey)),t&&t.focus()}function fetchAllData(t={}){var e=baseURL+"data/search.json";fetch(e).then(function(e){return e.json()}).then(function(e){searchData=e.list,"function"==typeof t.onSuccess&&t.onSuccess(e.list)}).catch(function(e){console.error(e),"function"==typeof t.onError&&t.onError()})}function onClickSearchItem(e){var t,e=e.currentTarget;e&&(e=(e.getAttribute("href")||"").split("#")[1]||"",(t=document.getElementById(e))||(e=decodeURI(e),t=document.getElementById(e)),t&&setTimeout(function(){bringElementIntoView(t)},100))}function buildSearchResult(e){var t="";for(const r of e){var n=r.item;t+=`
2
-
3
- <a onclick="onClickSearchItem(event)" href="${r.item.link.replace('<a href="',"").replace(/">.*/,"")}" class="search-result-item">
4
- <div class="search-result-item-title">
5
- ${n.title}
6
- </div>
7
- <div class="search-result-item-p">
8
- ${n.description||"No description available."}
9
- </div>
10
- </a>
11
- `}return t}function getSearchResult(e,t,n){var t={shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t},r=Fuse.createIndex(t.keys,e),e=new Fuse(e,t,r).search(n);return e=20<e.length?e.slice(0,20):e}function debounce(n,r,a){var c;return function(){var e=this,t=arguments;clearTimeout(c),c=setTimeout(function(){c=null,a||n.apply(e,t)},r),a&&!c&&n.apply(e,t)}}function search(e){var t=e.target.value,n=document.querySelector(searchResultCID),r=["title","description"];if(n)if(t){if(!searchData)return n.innerHTML="Loading...",void fetchAllData({onSuccess:function(e){a(getSearchResult(e,r,t))},onError:function(){n.innerHTML="Failed to load result."}});a(getSearchResult(searchData,r,t))}else n.innerHTML="Type anything to view search result";else console.error("Search result container not found");function a(e){0===e.length?n.innerHTML="No result found! Try some different combination.":(e=buildSearchResult(e),n.innerHTML=e)}}function onDomContentLoaded(){var e=document.querySelector(searchInputID),t=document.querySelectorAll(".search-button"),n=document.querySelector(searchContainerID),r=document.querySelector(searchWrapperID),a=document.querySelector(searchCloseButtonID),c=debounce(search,300);a&&a.addEventListener("click",hideSearch),t&&t.forEach(function(e){e.addEventListener("click",showSearch)}),n&&n.addEventListener("click",hideSearch),r&&r.addEventListener("click",function(e){e.stopPropagation()}),e&&e.addEventListener("keyup",c),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()});
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="";for(const s of e){var{title:n,description:a}=s.item,o=s.item.link.replace('<a href="',"").replace(/">.*/,"");t+=`
2
+ <a onclick="onClickSearchItem(event)" href="${o}" class="search-result-item">
3
+ <div class="search-result-item-title">${n}</div>
4
+ <div class="search-result-item-p">${a||"No description available."}</div>
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),s=o.search(n);return 20<s.length?s.slice(0,20):s}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()});