@searchcraft/javascript-sdk 0.13.3 → 0.15.0
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/defineCustomElements.js +25 -23
- package/dist/components/html.js +1 -1
- package/dist/components/index.d.ts +213 -5
- package/dist/components/index.js +245 -64
- package/dist/components/index.js.map +1 -1
- package/dist/components/marked.esm.js +2163 -0
- package/dist/components/marked.esm.js.map +1 -0
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-ad2.js +4 -4
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-button2.js +2 -2
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-error-message2.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-facet-list2.js +2 -2
- package/dist/components/searchcraft-facet-list2.js.map +1 -1
- package/dist/components/searchcraft-filter-panel.js +18 -9
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-input-form2.js +6 -6
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input-label2.js +2 -2
- package/dist/components/searchcraft-loading.js +1 -1
- package/dist/components/searchcraft-loading2.js +5 -2
- package/dist/components/searchcraft-loading2.js.map +1 -1
- package/dist/components/searchcraft-pagination.js +96 -8
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +6 -4
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-footer2.js +51 -7
- package/dist/components/searchcraft-popover-footer2.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +96 -22
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-item2.js +3 -3
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-popover-list-view2.js +4 -4
- package/dist/components/searchcraft-results-info.js +4 -4
- package/dist/components/searchcraft-results-summary.d.ts +11 -0
- package/dist/components/searchcraft-results-summary.js +9 -0
- package/dist/components/searchcraft-results-summary.js.map +1 -0
- package/dist/components/searchcraft-results-summary2.js +97 -0
- package/dist/components/searchcraft-results-summary2.js.map +1 -0
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-result2.js +3 -3
- package/dist/components/searchcraft-search-results-per-page.js +3 -3
- package/dist/components/searchcraft-search-results.js +5 -5
- package/dist/components/searchcraft-select.js +1 -1
- package/dist/components/searchcraft-select2.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-slider2.js +5 -5
- package/dist/components/searchcraft-summary-box.js +11 -2178
- package/dist/components/searchcraft-summary-box.js.map +1 -1
- package/dist/components/searchcraft-theme.js +3 -3
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/components/searchcraft-toggle-button2.js +5 -5
- package/dist/hydrate/index.js +2294 -1985
- package/dist/hydrate/index.mjs +2294 -1985
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/clients/SummaryClient.d.ts +10 -1
- package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +28 -0
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -1
- package/dist/types/components/searchcraft-popover-footer/searchcraft-popover-footer.d.ts +15 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +24 -0
- package/dist/types/components/searchcraft-results-summary/searchcraft-results-summary.d.ts +65 -0
- package/dist/types/components/searchcraft-summary-box/searchcraft-summary-box.d.ts +5 -5
- package/dist/types/components.d.ts +191 -2
- package/dist/types/store/SearchcraftStore.types.d.ts +1 -0
- package/dist/types/types/core-types/SearchcraftConfig.types.d.ts +2 -2
- package/package.json +19 -2
package/dist/hydrate/index.js
CHANGED
|
@@ -5550,7 +5550,9 @@ class SearchcraftFilterPanel {
|
|
|
5550
5550
|
}
|
|
5551
5551
|
};
|
|
5552
5552
|
const handleToggle = async () => {
|
|
5553
|
-
if (facetListElement &&
|
|
5553
|
+
if (facetListElement &&
|
|
5554
|
+
'handleCollapseToggle' in facetListElement &&
|
|
5555
|
+
'getIsCollapsed' in facetListElement) {
|
|
5554
5556
|
await facetListElement.handleCollapseToggle();
|
|
5555
5557
|
const isCollapsed = await facetListElement.getIsCollapsed();
|
|
5556
5558
|
updateLabelAttributes(isCollapsed);
|
|
@@ -5559,12 +5561,19 @@ class SearchcraftFilterPanel {
|
|
|
5559
5561
|
// return "filters-list"
|
|
5560
5562
|
return (hAsync("div", { class: 'searchcraft-filter-panel-section' }, hAsync("p", { ref: (el) => {
|
|
5561
5563
|
labelElement = el || null;
|
|
5562
|
-
}, class: 'searchcraft-filter-panel-label', "data-toggle-facet-section": true, "data-facet-section-expanded": item.options.initialCollapseState !== 'closed'
|
|
5564
|
+
}, "aria-expanded": item.options.initialCollapseState !== 'closed', class: 'searchcraft-filter-panel-label', "data-toggle-facet-section": true, "data-facet-section-expanded": item.options.initialCollapseState !== 'closed'
|
|
5565
|
+
? ''
|
|
5566
|
+
: undefined, "data-facet-section-collapsed": item.options.initialCollapseState === 'closed'
|
|
5567
|
+
? ''
|
|
5568
|
+
: undefined, onClick: () => void handleToggle(), onKeyDown: (event) => {
|
|
5563
5569
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
5564
5570
|
event.preventDefault();
|
|
5565
|
-
|
|
5571
|
+
void handleToggle();
|
|
5566
5572
|
}
|
|
5567
|
-
},
|
|
5573
|
+
},
|
|
5574
|
+
/* biome-ignore lint/a11y/useSemanticElements: This label is intentionally a <p> for styling/layout; it behaves like a button. */
|
|
5575
|
+
/* biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: This <p> is intentionally used as an interactive control. */
|
|
5576
|
+
role: 'button', tabIndex: 0 }, filterItem.label), hAsync("searchcraft-facet-list", { ref: (el) => {
|
|
5568
5577
|
facetListElement = el || null;
|
|
5569
5578
|
}, fieldName: item.fieldName, exclude: item.options.exclude, initialCollapseState: item.options.initialCollapseState, viewMoreThreshold: item.options.viewMoreThreshold, onFacetSelectionUpdated: (event) => {
|
|
5570
5579
|
this.handleFacetSelectionUpdated(item.fieldName, event.detail.paths);
|
|
@@ -5853,7 +5862,10 @@ class SearchcraftInputLabel {
|
|
|
5853
5862
|
}
|
|
5854
5863
|
label;
|
|
5855
5864
|
render() {
|
|
5856
|
-
|
|
5865
|
+
const accessibleLabel = this.label ?? 'Loading';
|
|
5866
|
+
return (hAsync("div", { key: 'd749250c5f56c703da7f1cba4a226a202ae269c0', class: 'searchcraft-loading',
|
|
5867
|
+
// biome-ignore lint/a11y/useSemanticElements: <output> is semantically incorrect for a loading indicator
|
|
5868
|
+
role: 'status', "aria-live": 'polite', "aria-label": accessibleLabel }, hAsync("div", { key: '0f834793686bcf8dff56769ad65311c1f591e8dd', class: 'searchcraft-loading-dots', "aria-hidden": 'true' }, hAsync("div", { key: '2174c333eecf0630ce984b2dece74675356259d9', class: 'searchcraft-loading-dot-1' }), hAsync("div", { key: '927fee69cd86dbd9ae57776c2a15fa6956707fac', class: 'searchcraft-loading-dot-2' }), hAsync("div", { key: 'cfd37c9a9a12dfc9963aa53c3979fb59dc7a132c', class: 'searchcraft-loading-dot-3' })), this.label ? (hAsync("p", { class: 'searchcraft-loading-label' }, this.label)) : null));
|
|
5857
5869
|
}
|
|
5858
5870
|
static get cmpMeta() { return {
|
|
5859
5871
|
"$flags$": 768,
|
|
@@ -5908,6 +5920,19 @@ class SearchcraftPagination {
|
|
|
5908
5920
|
* @default true
|
|
5909
5921
|
*/
|
|
5910
5922
|
scrollToTop = true;
|
|
5923
|
+
/**
|
|
5924
|
+
* The URL query string parameter name used to track the current page. When a user navigates
|
|
5925
|
+
* to a URL that contains this parameter, the pagination component will automatically navigate
|
|
5926
|
+
* to that page.
|
|
5927
|
+
* @default "p"
|
|
5928
|
+
*/
|
|
5929
|
+
pageQueryParam = 'p';
|
|
5930
|
+
/**
|
|
5931
|
+
* Whether to use a query string parameter to track and restore the current page.
|
|
5932
|
+
* Set to `false` to disable query string synchronisation entirely.
|
|
5933
|
+
* @default true
|
|
5934
|
+
*/
|
|
5935
|
+
usePageQueryParam = true;
|
|
5911
5936
|
// store vars
|
|
5912
5937
|
searchTerm;
|
|
5913
5938
|
searchResultsPerPage;
|
|
@@ -5922,6 +5947,7 @@ class SearchcraftPagination {
|
|
|
5922
5947
|
setSearchResultsPage = () => { };
|
|
5923
5948
|
unsubscribe = () => { };
|
|
5924
5949
|
cleanupCore;
|
|
5950
|
+
_initialPageApplied = false;
|
|
5925
5951
|
onCoreAvailable(core) {
|
|
5926
5952
|
this.unsubscribe = core.store.subscribe((state) => {
|
|
5927
5953
|
// store vars
|
|
@@ -5939,6 +5965,14 @@ class SearchcraftPagination {
|
|
|
5939
5965
|
this.searchResultsPerPage;
|
|
5940
5966
|
// store functions
|
|
5941
5967
|
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
5968
|
+
// Apply initial page from URL query param (only once, on first subscription tick)
|
|
5969
|
+
if (!this._initialPageApplied) {
|
|
5970
|
+
this._initialPageApplied = true;
|
|
5971
|
+
const initialPage = this.getPageFromUrl();
|
|
5972
|
+
if (initialPage !== null && initialPage !== state.searchResultsPage) {
|
|
5973
|
+
state.setSearchResultsPage(initialPage);
|
|
5974
|
+
}
|
|
5975
|
+
}
|
|
5942
5976
|
});
|
|
5943
5977
|
}
|
|
5944
5978
|
connectedCallback() {
|
|
@@ -5951,6 +5985,7 @@ class SearchcraftPagination {
|
|
|
5951
5985
|
/**
|
|
5952
5986
|
* Smooth scroll to the top of the search results component
|
|
5953
5987
|
*/
|
|
5988
|
+
scrollAnimationId;
|
|
5954
5989
|
smoothScrollToSearchResults() {
|
|
5955
5990
|
if (!this.scrollToTop) {
|
|
5956
5991
|
return;
|
|
@@ -5959,14 +5994,17 @@ class SearchcraftPagination {
|
|
|
5959
5994
|
if (!searchResultsElement) {
|
|
5960
5995
|
return;
|
|
5961
5996
|
}
|
|
5997
|
+
// Cancel any in-flight scroll animation
|
|
5998
|
+
if (this.scrollAnimationId) {
|
|
5999
|
+
cancelAnimationFrame(this.scrollAnimationId);
|
|
6000
|
+
}
|
|
5962
6001
|
const elementRect = searchResultsElement.getBoundingClientRect();
|
|
5963
|
-
const scrollOffset = 200;
|
|
6002
|
+
const scrollOffset = 200;
|
|
5964
6003
|
const targetPosition = elementRect.top + window.scrollY - scrollOffset;
|
|
5965
6004
|
const startPosition = window.scrollY;
|
|
5966
6005
|
const distance = targetPosition - startPosition;
|
|
5967
6006
|
const duration = 1500;
|
|
5968
6007
|
let startTime = null;
|
|
5969
|
-
// smooth scrolling
|
|
5970
6008
|
const easeOutExpo = (t) => {
|
|
5971
6009
|
return t === 1 ? 1 : 1 - 2 ** (-10 * t);
|
|
5972
6010
|
};
|
|
@@ -5979,13 +6017,73 @@ class SearchcraftPagination {
|
|
|
5979
6017
|
const ease = easeOutExpo(progress);
|
|
5980
6018
|
window.scrollTo(0, startPosition + distance * ease);
|
|
5981
6019
|
if (progress < 1) {
|
|
5982
|
-
requestAnimationFrame(animation);
|
|
6020
|
+
this.scrollAnimationId = requestAnimationFrame(animation);
|
|
6021
|
+
}
|
|
6022
|
+
else {
|
|
6023
|
+
this.scrollAnimationId = undefined;
|
|
5983
6024
|
}
|
|
5984
6025
|
};
|
|
5985
|
-
requestAnimationFrame(animation);
|
|
6026
|
+
this.scrollAnimationId = requestAnimationFrame(animation);
|
|
6027
|
+
}
|
|
6028
|
+
/**
|
|
6029
|
+
* Returns the page number from the URL query string, or null if not present / disabled.
|
|
6030
|
+
* Reads from the top-level window when inside a same-origin iframe so that the
|
|
6031
|
+
* address-bar URL is the source of truth (consistent with updateUrlPage).
|
|
6032
|
+
*/
|
|
6033
|
+
getPageFromUrl() {
|
|
6034
|
+
if (!this.usePageQueryParam || typeof window === 'undefined') {
|
|
6035
|
+
return null;
|
|
6036
|
+
}
|
|
6037
|
+
let targetWindow = window;
|
|
6038
|
+
try {
|
|
6039
|
+
if (window.top && window.top !== window && window.top.location.href) {
|
|
6040
|
+
targetWindow = window.top;
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
catch {
|
|
6044
|
+
// Cross-origin iframe — stay with the current window
|
|
6045
|
+
}
|
|
6046
|
+
const params = new URLSearchParams(targetWindow.location.search);
|
|
6047
|
+
const raw = params.get(this.pageQueryParam);
|
|
6048
|
+
if (raw === null) {
|
|
6049
|
+
return null;
|
|
6050
|
+
}
|
|
6051
|
+
const page = Number.parseInt(raw, 10);
|
|
6052
|
+
return Number.isNaN(page) || page < 1 ? null : page;
|
|
6053
|
+
}
|
|
6054
|
+
/**
|
|
6055
|
+
* Updates (or removes) the page query string parameter in the browser URL without
|
|
6056
|
+
* triggering a navigation/reload.
|
|
6057
|
+
* When running inside a same-origin iframe (e.g. Storybook), the top-level window's
|
|
6058
|
+
* URL is updated so the change is visible in the address bar.
|
|
6059
|
+
*/
|
|
6060
|
+
updateUrlPage(page) {
|
|
6061
|
+
if (!this.usePageQueryParam || typeof window === 'undefined') {
|
|
6062
|
+
return;
|
|
6063
|
+
}
|
|
6064
|
+
// Prefer the top-level window so the address bar updates even inside iframes
|
|
6065
|
+
// (e.g. Storybook). Falls back to the current window for cross-origin iframes.
|
|
6066
|
+
let targetWindow = window;
|
|
6067
|
+
try {
|
|
6068
|
+
if (window.top && window.top !== window && window.top.location.href) {
|
|
6069
|
+
targetWindow = window.top;
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
catch {
|
|
6073
|
+
// Cross-origin iframe — stay with the current window
|
|
6074
|
+
}
|
|
6075
|
+
const url = new URL(targetWindow.location.href);
|
|
6076
|
+
if (page <= 1) {
|
|
6077
|
+
url.searchParams.delete(this.pageQueryParam);
|
|
6078
|
+
}
|
|
6079
|
+
else {
|
|
6080
|
+
url.searchParams.set(this.pageQueryParam, String(page));
|
|
6081
|
+
}
|
|
6082
|
+
targetWindow.history.replaceState(targetWindow.history.state, '', url.toString());
|
|
5986
6083
|
}
|
|
5987
6084
|
handleGoToPage(page) {
|
|
5988
6085
|
this.setSearchResultsPage(page);
|
|
6086
|
+
this.updateUrlPage(page);
|
|
5989
6087
|
if (this.scrollToTop) {
|
|
5990
6088
|
this.smoothScrollToSearchResults();
|
|
5991
6089
|
}
|
|
@@ -6048,6 +6146,8 @@ class SearchcraftPagination {
|
|
|
6048
6146
|
"$members$": {
|
|
6049
6147
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6050
6148
|
"scrollToTop": [4, "scroll-to-top"],
|
|
6149
|
+
"pageQueryParam": [1, "page-query-param"],
|
|
6150
|
+
"usePageQueryParam": [4, "use-page-query-param"],
|
|
6051
6151
|
"searchTerm": [32],
|
|
6052
6152
|
"searchResultsPerPage": [32],
|
|
6053
6153
|
"searchResultsPage": [32],
|
|
@@ -6209,12 +6309,14 @@ class SearchcraftPopoverButton {
|
|
|
6209
6309
|
switch (this.type) {
|
|
6210
6310
|
case 'skeuomorphic':
|
|
6211
6311
|
return this.renderSkeuomorphicSlot();
|
|
6312
|
+
case 'magnifying-glass':
|
|
6313
|
+
return (hAsync("div", { class: 'searchcraft-popover-button-input' }, hAsync("svg", { class: 'searchcraft-popover-button-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', version: '1.1', "aria-hidden": 'true' }, hAsync("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))));
|
|
6212
6314
|
default:
|
|
6213
6315
|
return (hAsync("div", null, hAsync("slot", null)));
|
|
6214
6316
|
}
|
|
6215
6317
|
}
|
|
6216
6318
|
render() {
|
|
6217
|
-
return (hAsync("button", { key: '
|
|
6319
|
+
return (hAsync("button", { key: '760f4f8d8daddaaadc0367e21b9efe23c4ef7c7d', "aria-label": this.type === 'magnifying-glass' ? 'Search' : undefined, class: `searchcraft-popover-button ${this.type ? ` searchcraft-popover-button-${this.type}` : ''}`, innerHTML: typeof this.template !== 'undefined'
|
|
6218
6320
|
? this.template({ isPopoverVisible: this.isPopoverVisible }, { html: html$1 })
|
|
6219
6321
|
: undefined, onClick: this.handleOnClick.bind(this), type: 'button' }, typeof this.template !== 'undefined'
|
|
6220
6322
|
? undefined
|
|
@@ -6241,6 +6343,8 @@ class SearchcraftPopoverButton {
|
|
|
6241
6343
|
}; }
|
|
6242
6344
|
}
|
|
6243
6345
|
|
|
6346
|
+
const version = "0.15.0";
|
|
6347
|
+
|
|
6244
6348
|
/**
|
|
6245
6349
|
* Renders the footer for the searchcraft-popover-form.
|
|
6246
6350
|
*
|
|
@@ -6254,6 +6358,20 @@ class SearchcraftPopoverFooter {
|
|
|
6254
6358
|
* The id of the Searchcraft instance that this component should use.
|
|
6255
6359
|
*/
|
|
6256
6360
|
searchcraftId;
|
|
6361
|
+
/**
|
|
6362
|
+
* The SDK variant used to render this component. Used for UTM attribution. This isn't exposed for developer consumption, it's set automatically.
|
|
6363
|
+
*
|
|
6364
|
+
* @internal
|
|
6365
|
+
*/
|
|
6366
|
+
sdkVariant = 'js';
|
|
6367
|
+
/**
|
|
6368
|
+
* Optional href for the "View all" button.
|
|
6369
|
+
*/
|
|
6370
|
+
viewAllResultsHref;
|
|
6371
|
+
/**
|
|
6372
|
+
* Optional label for the "View all" button.
|
|
6373
|
+
*/
|
|
6374
|
+
viewAllResultsLabel;
|
|
6257
6375
|
searchResultsCount;
|
|
6258
6376
|
unsubscribe = () => { };
|
|
6259
6377
|
cleanupCore;
|
|
@@ -6270,16 +6388,43 @@ class SearchcraftPopoverFooter {
|
|
|
6270
6388
|
this.unsubscribe?.();
|
|
6271
6389
|
this.cleanupCore?.();
|
|
6272
6390
|
}
|
|
6391
|
+
get safeViewAllHref() {
|
|
6392
|
+
const href = this.viewAllResultsHref;
|
|
6393
|
+
if (!href)
|
|
6394
|
+
return undefined;
|
|
6395
|
+
try {
|
|
6396
|
+
const url = new URL(href, window.location.href);
|
|
6397
|
+
return url.protocol === 'https:' || url.protocol === 'http:'
|
|
6398
|
+
? href
|
|
6399
|
+
: undefined;
|
|
6400
|
+
}
|
|
6401
|
+
catch {
|
|
6402
|
+
return undefined;
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6273
6405
|
render() {
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
:
|
|
6406
|
+
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
|
|
6407
|
+
const utmParams = new URLSearchParams({
|
|
6408
|
+
utm_source: hostname,
|
|
6409
|
+
utm_medium: this.sdkVariant ?? 'js',
|
|
6410
|
+
utm_campaign: 'powered-by',
|
|
6411
|
+
utm_content: 'popover-footer',
|
|
6412
|
+
sc_sdk_version: version,
|
|
6413
|
+
});
|
|
6414
|
+
const href = `https://searchcraft.io/?${utmParams.toString()}`;
|
|
6415
|
+
const hasResults = typeof this.searchResultsCount === 'number' &&
|
|
6416
|
+
this.searchResultsCount > 0;
|
|
6417
|
+
const showViewAll = !!this.safeViewAllHref && hasResults;
|
|
6418
|
+
return (hAsync("footer", { key: '548704335f80a2b4bc7ebd4ea2d0a2eb73376fde', class: 'searchcraft-popover-footer' }, hAsync("a", { key: 'a10cbfd833ef0c6016932fede6ca3195eecdfaea', class: 'searchcraft-popover-footer-link', href: href, target: '_blank', rel: 'noreferrer' }, hAsync("span", { key: '6c6333a61ae282419e32721fc9760d3d237870df', class: 'searchcraft-popover-footer-link-prefix' }, "Powered by\u00A0"), " Searchcraft"), hAsync("div", { key: 'c35f7d6c5b16510fa58301b8fad070e6cd14d72f', class: 'searchcraft-popover-footer-results' }, hAsync("p", { key: 'e1576404d2d23a7b53e761e617720cc4fb45ea8d', class: 'searchcraft-popover-footer-results-info' }, hasResults ? (hAsync("span", null, formatNumberWithCommas(this.searchResultsCount), " Results", hAsync("span", { class: 'searchcraft-popover-footer-results-found' }, ' Found'))) : (' ')), showViewAll && (hAsync("a", { key: '6f5585d1a75ccc44174a22603d13f3604078ca63', class: 'searchcraft-popover-footer-view-all', href: this.safeViewAllHref }, hAsync("span", { key: '12d8202b01d4493700fafd61f81989458d7620c4', class: 'searchcraft-popover-footer-view-all-label' }, this.viewAllResultsLabel), hAsync("span", { key: '3b26ffdc731827612e789fdb38c751062c1077ff', class: 'searchcraft-popover-footer-view-all-shortcut', "aria-hidden": 'true' }, hAsync("kbd", { key: '6999416b99a6b4b5b24702597736846b9168b12d' }, "\u2318"), hAsync("kbd", { key: '8a7f8ee088d037e96102dab463eb93a9d27d85ea' }, "\u21B5")))))));
|
|
6277
6419
|
}
|
|
6278
6420
|
static get cmpMeta() { return {
|
|
6279
6421
|
"$flags$": 768,
|
|
6280
6422
|
"$tagName$": "searchcraft-popover-footer",
|
|
6281
6423
|
"$members$": {
|
|
6282
6424
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6425
|
+
"sdkVariant": [1, "sdk-variant"],
|
|
6426
|
+
"viewAllResultsHref": [1, "view-all-results-href"],
|
|
6427
|
+
"viewAllResultsLabel": [1, "view-all-results-label"],
|
|
6283
6428
|
"searchResultsCount": [32]
|
|
6284
6429
|
},
|
|
6285
6430
|
"$listeners$": undefined,
|
|
@@ -6362,6 +6507,27 @@ class SearchcraftPopoverForm {
|
|
|
6362
6507
|
* 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
|
|
6363
6508
|
*/
|
|
6364
6509
|
placeholderBehavior;
|
|
6510
|
+
/**
|
|
6511
|
+
* Base URL for the "View all" footer link. The current search term will be appended (URL encoded).
|
|
6512
|
+
*
|
|
6513
|
+
* For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.
|
|
6514
|
+
*/
|
|
6515
|
+
viewAllResultsBaseUrl;
|
|
6516
|
+
/**
|
|
6517
|
+
* Optional label for the "View All" footer button. Defaults to "View All".
|
|
6518
|
+
*/
|
|
6519
|
+
viewAllResultsLabel;
|
|
6520
|
+
/**
|
|
6521
|
+
* Whether to display the AI generative summary box before the search results.
|
|
6522
|
+
* NOTE: This requires the usage of a read key that has "SUMMARY" permissions and either a subscription to Searchcraft Cloud with AI features enabled or a self-hosted model connected.
|
|
6523
|
+
*/
|
|
6524
|
+
showSummaryBox = false;
|
|
6525
|
+
/**
|
|
6526
|
+
* The SDK variant used to render this component. Used for UTM attribution on the footer link.
|
|
6527
|
+
*
|
|
6528
|
+
* @internal
|
|
6529
|
+
*/
|
|
6530
|
+
sdkVariant = 'js';
|
|
6365
6531
|
isPopoverVisibleInState = false;
|
|
6366
6532
|
searchClientResponseItems = [];
|
|
6367
6533
|
adClientResponseItems = [];
|
|
@@ -6448,6 +6614,14 @@ class SearchcraftPopoverForm {
|
|
|
6448
6614
|
case 'Escape':
|
|
6449
6615
|
this.core?.store.getState().setPopoverVisibility(false);
|
|
6450
6616
|
break;
|
|
6617
|
+
case 'Enter':
|
|
6618
|
+
if ((event.metaKey || event.ctrlKey) &&
|
|
6619
|
+
this.viewAllResultsHref &&
|
|
6620
|
+
this.hasResultsToShow) {
|
|
6621
|
+
event.preventDefault();
|
|
6622
|
+
this.navigateToViewAllResults();
|
|
6623
|
+
}
|
|
6624
|
+
break;
|
|
6451
6625
|
default:
|
|
6452
6626
|
return;
|
|
6453
6627
|
}
|
|
@@ -6478,6 +6652,12 @@ class SearchcraftPopoverForm {
|
|
|
6478
6652
|
if (this.placeholderBehavior) {
|
|
6479
6653
|
this.modalElement.setAttribute('placeholder-behavior', this.placeholderBehavior);
|
|
6480
6654
|
}
|
|
6655
|
+
if (this.viewAllResultsBaseUrl) {
|
|
6656
|
+
this.modalElement.setAttribute('view-all-results-base-url', this.viewAllResultsBaseUrl);
|
|
6657
|
+
}
|
|
6658
|
+
if (this.viewAllResultsLabel) {
|
|
6659
|
+
this.modalElement.setAttribute('view-all-results-label', this.viewAllResultsLabel);
|
|
6660
|
+
}
|
|
6481
6661
|
document.body.appendChild(this.modalElement);
|
|
6482
6662
|
}
|
|
6483
6663
|
}
|
|
@@ -6541,24 +6721,47 @@ class SearchcraftPopoverForm {
|
|
|
6541
6721
|
this.searchTerm?.trim()?.length > 0 &&
|
|
6542
6722
|
this.searchClientResponseItems.length > 0);
|
|
6543
6723
|
}
|
|
6724
|
+
get viewAllResultsHref() {
|
|
6725
|
+
const baseUrl = this.viewAllResultsBaseUrl;
|
|
6726
|
+
if (!baseUrl) {
|
|
6727
|
+
return undefined;
|
|
6728
|
+
}
|
|
6729
|
+
const term = this.searchTerm?.trim();
|
|
6730
|
+
if (!term) {
|
|
6731
|
+
return baseUrl;
|
|
6732
|
+
}
|
|
6733
|
+
return `${baseUrl}${encodeURIComponent(term).replace(/%20/g, '+')}`;
|
|
6734
|
+
}
|
|
6735
|
+
get resolvedViewAllResultsLabel() {
|
|
6736
|
+
return this.viewAllResultsLabel ?? 'View All';
|
|
6737
|
+
}
|
|
6738
|
+
navigateToViewAllResults() {
|
|
6739
|
+
const href = this.viewAllResultsHref;
|
|
6740
|
+
if (!href || !this.hasResultsToShow) {
|
|
6741
|
+
return;
|
|
6742
|
+
}
|
|
6743
|
+
if (typeof window !== 'undefined') {
|
|
6744
|
+
window.location.href = href;
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6544
6747
|
renderInlinePopover() {
|
|
6545
6748
|
const isListViewVisible = this.hasResultsToShow && this.isFocused;
|
|
6546
6749
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-inline', {
|
|
6547
6750
|
'searchcraft-popover-form-active': isListViewVisible,
|
|
6548
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (hAsync("div", { class: 'searchcraft-popover-form-inline-wrapper' }, hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })))));
|
|
6751
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (hAsync("div", { class: 'searchcraft-popover-form-inline-wrapper' }, this.showSummaryBox && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })))));
|
|
6549
6752
|
}
|
|
6550
6753
|
renderModalPopover() {
|
|
6551
6754
|
if (this.isPopoverVisibleInState) {
|
|
6552
6755
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-modal', {
|
|
6553
6756
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
6554
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), hAsync("div", { class: 'searchcraft-popover-form-modal-wrapper' }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId }))));
|
|
6757
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), hAsync("div", { class: 'searchcraft-popover-form-modal-wrapper' }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel }))));
|
|
6555
6758
|
}
|
|
6556
6759
|
}
|
|
6557
6760
|
renderFullscreenPopover() {
|
|
6558
6761
|
if (this.isPopoverVisibleInState) {
|
|
6559
6762
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-fullscreen', {
|
|
6560
6763
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
6561
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })));
|
|
6764
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })));
|
|
6562
6765
|
}
|
|
6563
6766
|
}
|
|
6564
6767
|
render() {
|
|
@@ -6582,6 +6785,10 @@ class SearchcraftPopoverForm {
|
|
|
6582
6785
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6583
6786
|
"placeholderValue": [1, "placeholder-value"],
|
|
6584
6787
|
"placeholderBehavior": [1, "placeholder-behavior"],
|
|
6788
|
+
"viewAllResultsBaseUrl": [1, "view-all-results-base-url"],
|
|
6789
|
+
"viewAllResultsLabel": [1, "view-all-results-label"],
|
|
6790
|
+
"showSummaryBox": [4, "show-summary-box"],
|
|
6791
|
+
"sdkVariant": [1, "sdk-variant"],
|
|
6585
6792
|
"isPopoverVisibleInState": [32],
|
|
6586
6793
|
"searchClientResponseItems": [32],
|
|
6587
6794
|
"adClientResponseItems": [32],
|
|
@@ -7164,726 +7371,14 @@ class SearchcraftResultsInfo {
|
|
|
7164
7371
|
}
|
|
7165
7372
|
|
|
7166
7373
|
/**
|
|
7167
|
-
*
|
|
7168
|
-
*
|
|
7169
|
-
*
|
|
7374
|
+
* marked v15.0.12 - a markdown parser
|
|
7375
|
+
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
7376
|
+
* https://github.com/markedjs/marked
|
|
7170
7377
|
*/
|
|
7171
|
-
class SearchcraftSearchResult {
|
|
7172
|
-
constructor(hostRef) {
|
|
7173
|
-
registerInstance(this, hostRef);
|
|
7174
|
-
}
|
|
7175
|
-
item;
|
|
7176
|
-
/**
|
|
7177
|
-
* The index.
|
|
7178
|
-
*/
|
|
7179
|
-
index;
|
|
7180
|
-
/**
|
|
7181
|
-
* The position in the document. Used with the "document_clicked" measure event.
|
|
7182
|
-
*/
|
|
7183
|
-
documentPosition = 0;
|
|
7184
|
-
/**
|
|
7185
|
-
* A callback function responsible for rendering a result.
|
|
7186
|
-
*/
|
|
7187
|
-
template;
|
|
7188
|
-
/**
|
|
7189
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7190
|
-
*/
|
|
7191
|
-
searchcraftId;
|
|
7192
|
-
templateHtml;
|
|
7193
|
-
get hostElement() { return getElement(this); }
|
|
7194
|
-
core;
|
|
7195
|
-
cleanupCore;
|
|
7196
|
-
onCoreAvailable(core) {
|
|
7197
|
-
this.core = core;
|
|
7198
|
-
}
|
|
7199
|
-
connectedCallback() {
|
|
7200
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7201
|
-
if (this.item) {
|
|
7202
|
-
try {
|
|
7203
|
-
this.templateHtml = this.template?.(this.item.document, this.index, {
|
|
7204
|
-
html: html$1,
|
|
7205
|
-
source_index: this.item.source_index,
|
|
7206
|
-
});
|
|
7207
|
-
}
|
|
7208
|
-
catch (error) {
|
|
7209
|
-
console.error('Invalid search result template:', error);
|
|
7210
|
-
}
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
disconnectedCallback() {
|
|
7214
|
-
this.cleanupCore?.();
|
|
7215
|
-
}
|
|
7216
|
-
handleResultContainerClick = (event) => {
|
|
7217
|
-
if (!event.target) {
|
|
7218
|
-
return;
|
|
7219
|
-
}
|
|
7220
|
-
const target = event.target;
|
|
7221
|
-
const link = target.closest('a');
|
|
7222
|
-
if (!link ||
|
|
7223
|
-
!this.hostElement?.contains(link) ||
|
|
7224
|
-
!this.core ||
|
|
7225
|
-
!this.core.measureClient) {
|
|
7226
|
-
return;
|
|
7227
|
-
}
|
|
7228
|
-
const document_position = this.documentPosition;
|
|
7229
|
-
const search_term = this.core.store.getState().searchTerm;
|
|
7230
|
-
const number_of_documents = this.core.store.getState().searchClientResponseItems.length || 0;
|
|
7231
|
-
this.core.measureClient.sendMeasureEvent('document_clicked', {
|
|
7232
|
-
document_position,
|
|
7233
|
-
number_of_documents,
|
|
7234
|
-
search_term,
|
|
7235
|
-
});
|
|
7236
|
-
};
|
|
7237
|
-
handleKeyDown = () => { };
|
|
7238
|
-
render() {
|
|
7239
|
-
if (!this.item) {
|
|
7240
|
-
return;
|
|
7241
|
-
}
|
|
7242
|
-
if (typeof this.template === 'undefined') {
|
|
7243
|
-
return (hAsync("div", { class: 'searchcraft-search-result searchcraft-search-result-no-template', onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }, Object.entries(this.item.document).map(([key, value]) => (hAsync("p", { key: key }, hAsync("strong", null, key), ": ", value)))));
|
|
7244
|
-
}
|
|
7245
|
-
return (hAsync("div", { class: 'searchcraft-search-result', innerHTML: this.templateHtml, onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }));
|
|
7246
|
-
}
|
|
7247
|
-
static get cmpMeta() { return {
|
|
7248
|
-
"$flags$": 768,
|
|
7249
|
-
"$tagName$": "searchcraft-search-result",
|
|
7250
|
-
"$members$": {
|
|
7251
|
-
"item": [16],
|
|
7252
|
-
"index": [2],
|
|
7253
|
-
"documentPosition": [2, "document-position"],
|
|
7254
|
-
"template": [16],
|
|
7255
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7256
|
-
"templateHtml": [32]
|
|
7257
|
-
},
|
|
7258
|
-
"$listeners$": undefined,
|
|
7259
|
-
"$lazyBundleId$": "-",
|
|
7260
|
-
"$attrsToReflect$": []
|
|
7261
|
-
}; }
|
|
7262
|
-
}
|
|
7263
7378
|
|
|
7264
7379
|
/**
|
|
7265
|
-
*
|
|
7266
|
-
*
|
|
7267
|
-
*
|
|
7268
|
-
* @react-import
|
|
7269
|
-
* ```jsx
|
|
7270
|
-
* import { SearchcraftSearchResults } from "@searchcraft/react-sdk";
|
|
7271
|
-
* ```
|
|
7272
|
-
*
|
|
7273
|
-
* @vue-import
|
|
7274
|
-
* ```jsx
|
|
7275
|
-
* import { SearchcraftSearchResults } from "@searchcraft/vue-sdk";
|
|
7276
|
-
* ```
|
|
7277
|
-
*
|
|
7278
|
-
* @js-example
|
|
7279
|
-
* ```html
|
|
7280
|
-
* <!-- index.html -->
|
|
7281
|
-
* <searchcraft-search-results
|
|
7282
|
-
* ad-interval="4"
|
|
7283
|
-
* place-ad-at-start="true"
|
|
7284
|
-
* />
|
|
7285
|
-
* ```
|
|
7286
|
-
*
|
|
7287
|
-
* ```js
|
|
7288
|
-
* // index.js
|
|
7289
|
-
* const searchResults = document.querySelector('searchcraft-search-results');
|
|
7290
|
-
*
|
|
7291
|
-
* searchResults.template = (item, index, { html }) => html`
|
|
7292
|
-
* <h2>${item.title}</h2>
|
|
7293
|
-
* `;
|
|
7294
|
-
* ```
|
|
7295
|
-
*
|
|
7296
|
-
* @react-example
|
|
7297
|
-
* ```jsx
|
|
7298
|
-
* <SearchcraftSearchResults
|
|
7299
|
-
* adInterval={4}
|
|
7300
|
-
* placeAdAtState={true}
|
|
7301
|
-
* template={(item, index, { html }) => html`
|
|
7302
|
-
* <h2>${item.title}</h2>
|
|
7303
|
-
* `}
|
|
7304
|
-
* />
|
|
7305
|
-
* ```
|
|
7306
|
-
*
|
|
7307
|
-
* @vue-example
|
|
7308
|
-
* ```jsx
|
|
7309
|
-
* <SearchcraftSearchResults
|
|
7310
|
-
* adInterval={4}
|
|
7311
|
-
* placeAdAtState={true}
|
|
7312
|
-
* :template={(item, index, { html }) => html`
|
|
7313
|
-
* <h2>${item.title}</h2>
|
|
7314
|
-
* `}
|
|
7315
|
-
* />
|
|
7316
|
-
* ```
|
|
7317
|
-
*/
|
|
7318
|
-
class SearchcraftSearchResults {
|
|
7319
|
-
constructor(hostRef) {
|
|
7320
|
-
registerInstance(this, hostRef);
|
|
7321
|
-
}
|
|
7322
|
-
/**
|
|
7323
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7324
|
-
*/
|
|
7325
|
-
searchcraftId;
|
|
7326
|
-
/**
|
|
7327
|
-
* A query that will appears when the component initializes or the search term is ''..
|
|
7328
|
-
*/
|
|
7329
|
-
initialQuery;
|
|
7330
|
-
/**
|
|
7331
|
-
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
7332
|
-
*/
|
|
7333
|
-
template;
|
|
7334
|
-
adClientResponseItems = [];
|
|
7335
|
-
config;
|
|
7336
|
-
isSearchInProgress = true;
|
|
7337
|
-
searchClientResponseItems;
|
|
7338
|
-
searchResultsPage;
|
|
7339
|
-
searchResultsPerPage;
|
|
7340
|
-
searchTerm = '';
|
|
7341
|
-
unsubscribe;
|
|
7342
|
-
cleanupCore;
|
|
7343
|
-
onCoreAvailable(core) {
|
|
7344
|
-
const state = core.store.getState();
|
|
7345
|
-
this.handleStateChange(state);
|
|
7346
|
-
this.searchClientResponseItems = state.searchClientResponseItems;
|
|
7347
|
-
this.searchTerm = state.searchTerm;
|
|
7348
|
-
this.config = state.core?.config;
|
|
7349
|
-
this.unsubscribe = core.store.subscribe((state) => this.handleStateChange(state));
|
|
7350
|
-
}
|
|
7351
|
-
connectedCallback() {
|
|
7352
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7353
|
-
}
|
|
7354
|
-
disconnectedCallback() {
|
|
7355
|
-
this.unsubscribe?.();
|
|
7356
|
-
this.cleanupCore?.();
|
|
7357
|
-
}
|
|
7358
|
-
handleStateChange(state) {
|
|
7359
|
-
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
7360
|
-
this.config = state.core?.config;
|
|
7361
|
-
this.isSearchInProgress = state.isSearchInProgress;
|
|
7362
|
-
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
7363
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
7364
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
7365
|
-
this.searchTerm = state.searchTerm;
|
|
7366
|
-
}
|
|
7367
|
-
renderEmptyState() {
|
|
7368
|
-
return (hAsync("div", { class: 'searchcraft-search-results-empty-state' }, hAsync("slot", { name: 'empty-search' })));
|
|
7369
|
-
}
|
|
7370
|
-
renderNoResultsFoundState() {
|
|
7371
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, hAsync("div", { class: 'searchcraft-search-results-error-message' }, hAsync("searchcraft-error-message", null, "No search results found for \"", this.searchTerm, "\" query."))));
|
|
7372
|
-
}
|
|
7373
|
-
renderWithADMAds() {
|
|
7374
|
-
const items = this.searchClientResponseItems || [];
|
|
7375
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'adMarketplace', adClientResponseItem: item, key: item.id, renderPosition: 'top' }))), items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
7376
|
-
}
|
|
7377
|
-
renderWithCustomAds() {
|
|
7378
|
-
const itemsToRender = [];
|
|
7379
|
-
const interstitialInterval = this.config?.customAdConfig?.adInterstitialInterval || 0;
|
|
7380
|
-
const interstitialQuantity = this.config?.customAdConfig?.adInterstitialQuantity || 1;
|
|
7381
|
-
const adStartQuantity = this.config?.customAdConfig?.adStartQuantity || 0;
|
|
7382
|
-
const adEndQuantity = this.config?.customAdConfig?.adEndQuantity || 0;
|
|
7383
|
-
const items = this.searchClientResponseItems || [];
|
|
7384
|
-
// Renders ads at beginning
|
|
7385
|
-
for (let n = 0; n < adStartQuantity; n++) {
|
|
7386
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7387
|
-
}
|
|
7388
|
-
// Renders search results + interstitial ads
|
|
7389
|
-
items.forEach((item, index) => {
|
|
7390
|
-
if (interstitialInterval &&
|
|
7391
|
-
index % interstitialInterval === 0 &&
|
|
7392
|
-
index + interstitialInterval < items.length &&
|
|
7393
|
-
index >= interstitialInterval) {
|
|
7394
|
-
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7395
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7396
|
-
}
|
|
7397
|
-
}
|
|
7398
|
-
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7399
|
-
});
|
|
7400
|
-
// Renders ads at end
|
|
7401
|
-
for (let n = 0; n < adEndQuantity; n++) {
|
|
7402
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7403
|
-
}
|
|
7404
|
-
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7405
|
-
}
|
|
7406
|
-
renderWithNativoAds() {
|
|
7407
|
-
const itemsToRender = [];
|
|
7408
|
-
const interstitialStartIndex = this.config?.nativoConfig?.adInterstialStartIndex || 0;
|
|
7409
|
-
const interstitialInterval = this.config?.nativoConfig?.adInterstitialInterval || 0;
|
|
7410
|
-
const interstitialQuantity = this.config?.nativoConfig?.adInterstitialQuantity || 1;
|
|
7411
|
-
const adStartQuantity = this.config?.nativoConfig?.adStartQuantity || 0;
|
|
7412
|
-
const adEndQuantity = this.config?.nativoConfig?.adEndQuantity || 0;
|
|
7413
|
-
const items = this.searchClientResponseItems || [];
|
|
7414
|
-
// Renders ads at beginning
|
|
7415
|
-
for (let n = 0; n < adStartQuantity; n++) {
|
|
7416
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7417
|
-
}
|
|
7418
|
-
// Renders search results + interstitial ads
|
|
7419
|
-
items.forEach((item, index) => {
|
|
7420
|
-
if (interstitialInterval &&
|
|
7421
|
-
(index + interstitialStartIndex) % interstitialInterval === 0 &&
|
|
7422
|
-
index + interstitialInterval < items.length &&
|
|
7423
|
-
index >= interstitialInterval) {
|
|
7424
|
-
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7425
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7426
|
-
}
|
|
7427
|
-
}
|
|
7428
|
-
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7429
|
-
});
|
|
7430
|
-
// Renders ads at end
|
|
7431
|
-
for (let n = 0; n < adEndQuantity; n++) {
|
|
7432
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7433
|
-
}
|
|
7434
|
-
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7435
|
-
}
|
|
7436
|
-
renderWithNoAds() {
|
|
7437
|
-
const items = this.searchClientResponseItems || [];
|
|
7438
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
7439
|
-
}
|
|
7440
|
-
render() {
|
|
7441
|
-
const searchClientResponseItems = this.searchClientResponseItems || [];
|
|
7442
|
-
if (searchClientResponseItems.length === 0 && !this.isSearchInProgress) {
|
|
7443
|
-
return this.renderEmptyState();
|
|
7444
|
-
}
|
|
7445
|
-
if (this.searchTerm.length > 0 &&
|
|
7446
|
-
searchClientResponseItems.length === 0 &&
|
|
7447
|
-
!this.isSearchInProgress) {
|
|
7448
|
-
return this.renderNoResultsFoundState();
|
|
7449
|
-
}
|
|
7450
|
-
if (this.config?.customAdConfig) {
|
|
7451
|
-
return this.renderWithCustomAds();
|
|
7452
|
-
}
|
|
7453
|
-
if (this.config?.admAdConfig) {
|
|
7454
|
-
return this.renderWithNativoAds();
|
|
7455
|
-
}
|
|
7456
|
-
if (this.config?.nativoConfig) {
|
|
7457
|
-
return this.renderWithNativoAds();
|
|
7458
|
-
}
|
|
7459
|
-
return this.renderWithNoAds();
|
|
7460
|
-
}
|
|
7461
|
-
static get cmpMeta() { return {
|
|
7462
|
-
"$flags$": 772,
|
|
7463
|
-
"$tagName$": "searchcraft-search-results",
|
|
7464
|
-
"$members$": {
|
|
7465
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7466
|
-
"initialQuery": [1, "initial-query"],
|
|
7467
|
-
"template": [16],
|
|
7468
|
-
"adClientResponseItems": [32],
|
|
7469
|
-
"config": [32],
|
|
7470
|
-
"isSearchInProgress": [32],
|
|
7471
|
-
"searchClientResponseItems": [32],
|
|
7472
|
-
"searchResultsPage": [32],
|
|
7473
|
-
"searchResultsPerPage": [32],
|
|
7474
|
-
"searchTerm": [32]
|
|
7475
|
-
},
|
|
7476
|
-
"$listeners$": undefined,
|
|
7477
|
-
"$lazyBundleId$": "-",
|
|
7478
|
-
"$attrsToReflect$": []
|
|
7479
|
-
}; }
|
|
7480
|
-
}
|
|
7481
|
-
|
|
7482
|
-
/**
|
|
7483
|
-
* This web component is designed to choose the number of search results displayed.
|
|
7484
|
-
*
|
|
7485
|
-
* @react-import
|
|
7486
|
-
* ```jsx
|
|
7487
|
-
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/react-sdk";
|
|
7488
|
-
* ```
|
|
7489
|
-
*
|
|
7490
|
-
* @vue-import
|
|
7491
|
-
* ```jsx
|
|
7492
|
-
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/vue-sdk";
|
|
7493
|
-
* ```
|
|
7494
|
-
*
|
|
7495
|
-
* @js-example
|
|
7496
|
-
* ```html
|
|
7497
|
-
* <!-- index.html -->
|
|
7498
|
-
* <searchcraft-search-results-per-page increment="20" />
|
|
7499
|
-
* ```
|
|
7500
|
-
*
|
|
7501
|
-
* @react-example
|
|
7502
|
-
* ```jsx
|
|
7503
|
-
* <SearchcraftSearchResultsPerPage increment={20} />
|
|
7504
|
-
* ```
|
|
7505
|
-
*
|
|
7506
|
-
* @vue-example
|
|
7507
|
-
* ```jsx
|
|
7508
|
-
* <SearchcraftSearchResultsPerPage increment="20" />
|
|
7509
|
-
* ```
|
|
7510
|
-
*/
|
|
7511
|
-
class SearchcraftSearchResultsPerPage {
|
|
7512
|
-
constructor(hostRef) {
|
|
7513
|
-
registerInstance(this, hostRef);
|
|
7514
|
-
}
|
|
7515
|
-
/**
|
|
7516
|
-
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
|
|
7517
|
-
* The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
7518
|
-
*/
|
|
7519
|
-
increment = 20;
|
|
7520
|
-
/**
|
|
7521
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7522
|
-
*/
|
|
7523
|
-
searchcraftId;
|
|
7524
|
-
// store vars
|
|
7525
|
-
searchTerm;
|
|
7526
|
-
searchResultsPage;
|
|
7527
|
-
searchResultsPerPage;
|
|
7528
|
-
searchResultsCount;
|
|
7529
|
-
searchResultsPagesCount;
|
|
7530
|
-
searchClientRequestProperties;
|
|
7531
|
-
// local vars
|
|
7532
|
-
initialSearchResultsPerPage;
|
|
7533
|
-
// store functions
|
|
7534
|
-
setSearchResultsPerPage = () => { };
|
|
7535
|
-
setSearchResultsPage = () => { };
|
|
7536
|
-
unsubscribe = () => { };
|
|
7537
|
-
cleanupCore;
|
|
7538
|
-
onCoreAvailable(core) {
|
|
7539
|
-
this.unsubscribe = core.store.subscribe((state) => {
|
|
7540
|
-
// store vars
|
|
7541
|
-
this.searchTerm = state.searchTerm;
|
|
7542
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
7543
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
7544
|
-
this.searchResultsCount = state.searchResultsCount;
|
|
7545
|
-
this.searchClientRequestProperties = state.searchClientRequestProperties;
|
|
7546
|
-
// local vars
|
|
7547
|
-
this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
|
|
7548
|
-
// store functions
|
|
7549
|
-
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
7550
|
-
this.setSearchResultsPerPage = state.setSearchResultsPerPage;
|
|
7551
|
-
});
|
|
7552
|
-
this.initialSearchResultsPerPage =
|
|
7553
|
-
core.store.getState().searchResultsPerPage;
|
|
7554
|
-
}
|
|
7555
|
-
connectedCallback() {
|
|
7556
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7557
|
-
}
|
|
7558
|
-
disconnectedCallback() {
|
|
7559
|
-
this.unsubscribe?.();
|
|
7560
|
-
this.cleanupCore?.();
|
|
7561
|
-
}
|
|
7562
|
-
render() {
|
|
7563
|
-
// Check if this is an initialQuery case (string requestProperties with empty searchTerm)
|
|
7564
|
-
const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
|
|
7565
|
-
this.searchTerm.trim() === '';
|
|
7566
|
-
// early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
|
|
7567
|
-
if ((!this.searchTerm && !isInitialQuery) ||
|
|
7568
|
-
this.searchResultsPagesCount <= 1) {
|
|
7569
|
-
return;
|
|
7570
|
-
}
|
|
7571
|
-
return (hAsync("div", { class: 'searchcraft-search-results-per-page' }, hAsync("div", { class: 'searchcraft-search-results-per-page-select' }, hAsync("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), hAsync("div", { class: 'searchcraft-search-results-per-page-select-input' }, hAsync("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
|
|
7572
|
-
const value = this.initialSearchResultsPerPage +
|
|
7573
|
-
Number(this.increment) * index;
|
|
7574
|
-
return {
|
|
7575
|
-
label: `${value}`,
|
|
7576
|
-
value,
|
|
7577
|
-
};
|
|
7578
|
-
}), onSelectChange: (event) => {
|
|
7579
|
-
this.setSearchResultsPerPage(Number(event.detail));
|
|
7580
|
-
this.setSearchResultsPage(1);
|
|
7581
|
-
} })))));
|
|
7582
|
-
}
|
|
7583
|
-
static get cmpMeta() { return {
|
|
7584
|
-
"$flags$": 768,
|
|
7585
|
-
"$tagName$": "searchcraft-search-results-per-page",
|
|
7586
|
-
"$members$": {
|
|
7587
|
-
"increment": [8],
|
|
7588
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7589
|
-
"searchTerm": [32],
|
|
7590
|
-
"searchResultsPage": [32],
|
|
7591
|
-
"searchResultsPerPage": [32],
|
|
7592
|
-
"searchResultsCount": [32],
|
|
7593
|
-
"searchResultsPagesCount": [32],
|
|
7594
|
-
"searchClientRequestProperties": [32],
|
|
7595
|
-
"initialSearchResultsPerPage": [32],
|
|
7596
|
-
"setSearchResultsPerPage": [32],
|
|
7597
|
-
"setSearchResultsPage": [32]
|
|
7598
|
-
},
|
|
7599
|
-
"$listeners$": undefined,
|
|
7600
|
-
"$lazyBundleId$": "-",
|
|
7601
|
-
"$attrsToReflect$": []
|
|
7602
|
-
}; }
|
|
7603
|
-
}
|
|
7604
|
-
|
|
7605
|
-
/**
|
|
7606
|
-
* This web component is designed to allow users to select between a group of options.
|
|
7607
|
-
*
|
|
7608
|
-
* @js-example
|
|
7609
|
-
* ```html
|
|
7610
|
-
* <!-- index.html -->
|
|
7611
|
-
* <searchcraft-select
|
|
7612
|
-
* inputId="searchcraft-select"
|
|
7613
|
-
* name="searchcraft-select"
|
|
7614
|
-
* options="[{ label: 'label', value: 'value' }]"
|
|
7615
|
-
* />
|
|
7616
|
-
* ```
|
|
7617
|
-
*
|
|
7618
|
-
* @internal
|
|
7619
|
-
*/
|
|
7620
|
-
class SearchcraftSelect {
|
|
7621
|
-
constructor(hostRef) {
|
|
7622
|
-
registerInstance(this, hostRef);
|
|
7623
|
-
this.selectChange = createEvent(this, "selectChange");
|
|
7624
|
-
}
|
|
7625
|
-
/**
|
|
7626
|
-
* The caption displayed below the select input.
|
|
7627
|
-
*/
|
|
7628
|
-
caption;
|
|
7629
|
-
/**
|
|
7630
|
-
* Whether the select input is disabled.
|
|
7631
|
-
*/
|
|
7632
|
-
disabled = false;
|
|
7633
|
-
/**
|
|
7634
|
-
* The ID for the select input.
|
|
7635
|
-
*/
|
|
7636
|
-
inputId;
|
|
7637
|
-
/**
|
|
7638
|
-
* The label of the select input.
|
|
7639
|
-
*/
|
|
7640
|
-
label;
|
|
7641
|
-
/**
|
|
7642
|
-
* The ID for the label of the select input.
|
|
7643
|
-
*/
|
|
7644
|
-
labelId;
|
|
7645
|
-
/**
|
|
7646
|
-
* The name of the select input.
|
|
7647
|
-
*/
|
|
7648
|
-
name;
|
|
7649
|
-
/**
|
|
7650
|
-
* The options for the select input.
|
|
7651
|
-
*/
|
|
7652
|
-
options = [];
|
|
7653
|
-
/**
|
|
7654
|
-
* The event fired when the select is changed.
|
|
7655
|
-
*/
|
|
7656
|
-
selectChange;
|
|
7657
|
-
searchResultsPerPage;
|
|
7658
|
-
setSearchResultsPage = () => { };
|
|
7659
|
-
setSearchResultsPerPage = () => { };
|
|
7660
|
-
handleSelectChange = (event) => {
|
|
7661
|
-
this.selectChange.emit(event.target.value);
|
|
7662
|
-
};
|
|
7663
|
-
handleGoToPage(page) {
|
|
7664
|
-
this.setSearchResultsPage(page);
|
|
7665
|
-
}
|
|
7666
|
-
render() {
|
|
7667
|
-
return (hAsync("div", { key: '15ecbf48c824a161cd83bdab99dace8e44f1ab39', class: 'searchcraft-select' }, this.label && (hAsync("label", { key: 'aba433ae9c27c9405099cffcef923c3ad22d7fda', class: 'searchcraft-select-label', id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label)), hAsync("div", { key: '8df8a2ff05924c9c55cdd6e3827cd927cddab82a', class: 'searchcraft-select-input-wrapper' }, hAsync("select", { key: '1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f', "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : undefined, class: 'searchcraft-select-input', disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options === 'string'
|
|
7668
|
-
? JSON.parse(this.options)
|
|
7669
|
-
: this.options).map(({ label, value, selected }) => {
|
|
7670
|
-
return (hAsync("option", { key: value, value: value, selected: selected }, label));
|
|
7671
|
-
})), hAsync("svg", { key: '0ec6892b529f2e70027aadea47208582a65a97b7', class: 'searchcraft-select-input-icon', width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, hAsync("title", { key: 'bced6b62378491d1d1c629b602d7d033d912c761' }, "Select dropdown icon"), hAsync("path", { key: '659f8ebf9129e2e7941da949d29688c41c1472bb', d: 'M5 7.5L10 12.5L15 7.5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), this.caption && (hAsync("p", { key: '51217d926f68f79b6c3514f5fd769b56549fdce9', class: 'searchcraft-select-caption' }, this.caption))));
|
|
7672
|
-
}
|
|
7673
|
-
static get cmpMeta() { return {
|
|
7674
|
-
"$flags$": 768,
|
|
7675
|
-
"$tagName$": "searchcraft-select",
|
|
7676
|
-
"$members$": {
|
|
7677
|
-
"caption": [1],
|
|
7678
|
-
"disabled": [4],
|
|
7679
|
-
"inputId": [1, "input-id"],
|
|
7680
|
-
"label": [1],
|
|
7681
|
-
"labelId": [1, "label-id"],
|
|
7682
|
-
"name": [1],
|
|
7683
|
-
"options": [1],
|
|
7684
|
-
"searchResultsPerPage": [32],
|
|
7685
|
-
"setSearchResultsPage": [32],
|
|
7686
|
-
"setSearchResultsPerPage": [32]
|
|
7687
|
-
},
|
|
7688
|
-
"$listeners$": undefined,
|
|
7689
|
-
"$lazyBundleId$": "-",
|
|
7690
|
-
"$attrsToReflect$": []
|
|
7691
|
-
}; }
|
|
7692
|
-
}
|
|
7693
|
-
|
|
7694
|
-
/**
|
|
7695
|
-
* Creates a throttled version of the given function that only invokes
|
|
7696
|
-
* the original function at most once every specified number of milliseconds.
|
|
7697
|
-
*
|
|
7698
|
-
* The logic is written in a way that the last invocation is always called, after the
|
|
7699
|
-
* throttle cooldown period has ended.
|
|
7700
|
-
*
|
|
7701
|
-
* @template Arguments - The argument types for the function to throttle
|
|
7702
|
-
* @param callback - The function to throttle
|
|
7703
|
-
* @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation
|
|
7704
|
-
* @returns A throttled version of the original function
|
|
7705
|
-
*/
|
|
7706
|
-
function throttle(callback, delayInMilliseconds) {
|
|
7707
|
-
let isThrottleOnCooldown = false;
|
|
7708
|
-
let trailingCallArgs = null;
|
|
7709
|
-
const invokeAction = (args) => {
|
|
7710
|
-
callback(...args);
|
|
7711
|
-
isThrottleOnCooldown = true;
|
|
7712
|
-
setTimeout(() => {
|
|
7713
|
-
isThrottleOnCooldown = false;
|
|
7714
|
-
if (trailingCallArgs) {
|
|
7715
|
-
const nextArgs = trailingCallArgs;
|
|
7716
|
-
trailingCallArgs = null;
|
|
7717
|
-
invokeAction(nextArgs);
|
|
7718
|
-
}
|
|
7719
|
-
}, delayInMilliseconds);
|
|
7720
|
-
};
|
|
7721
|
-
return (...args) => {
|
|
7722
|
-
if (!isThrottleOnCooldown) {
|
|
7723
|
-
invokeAction(args);
|
|
7724
|
-
}
|
|
7725
|
-
else {
|
|
7726
|
-
trailingCallArgs = args;
|
|
7727
|
-
}
|
|
7728
|
-
};
|
|
7729
|
-
}
|
|
7730
|
-
|
|
7731
|
-
/**
|
|
7732
|
-
* This web component is designed to allow users to select a value from a range defined by a minimum and maximum value. The component renders a slider interface, which can be used to visually choose a value between two boundaries.
|
|
7733
|
-
*
|
|
7734
|
-
* @internal
|
|
7735
|
-
*/
|
|
7736
|
-
class SearchcraftSlider {
|
|
7737
|
-
constructor(hostRef) {
|
|
7738
|
-
registerInstance(this, hostRef);
|
|
7739
|
-
this.rangeChanged = createEvent(this, "rangeChanged");
|
|
7740
|
-
}
|
|
7741
|
-
/**
|
|
7742
|
-
* The maximum value allowed.
|
|
7743
|
-
*/
|
|
7744
|
-
max = 100;
|
|
7745
|
-
/**
|
|
7746
|
-
* The minimum value allowed.
|
|
7747
|
-
*/
|
|
7748
|
-
min = 0;
|
|
7749
|
-
/**
|
|
7750
|
-
* The step amount for the slider inputs.
|
|
7751
|
-
*/
|
|
7752
|
-
step = 1;
|
|
7753
|
-
/** The type of data the sliders are using. */
|
|
7754
|
-
dataType = 'number';
|
|
7755
|
-
/** The date granularity to use. Used to format date labels. */
|
|
7756
|
-
dateGranularity;
|
|
7757
|
-
lowerBound = 0;
|
|
7758
|
-
upperBound = 1;
|
|
7759
|
-
endValue = 0;
|
|
7760
|
-
startValue = 0;
|
|
7761
|
-
lastFocusedHandle = 'max';
|
|
7762
|
-
throttledEmitUpdate = () => { };
|
|
7763
|
-
/**
|
|
7764
|
-
* When the range has changed.
|
|
7765
|
-
* */
|
|
7766
|
-
rangeChanged;
|
|
7767
|
-
connectedCallback() {
|
|
7768
|
-
switch (this.dataType) {
|
|
7769
|
-
case 'number':
|
|
7770
|
-
this.startValue = this.min;
|
|
7771
|
-
this.endValue = this.max;
|
|
7772
|
-
this.lowerBound = this.min;
|
|
7773
|
-
this.upperBound = this.max;
|
|
7774
|
-
break;
|
|
7775
|
-
case 'date': {
|
|
7776
|
-
this.startValue = 0;
|
|
7777
|
-
this.endValue = getDifferenceInUnits(this.dateGranularity || 'year', this.min, this.max);
|
|
7778
|
-
this.lowerBound = 0;
|
|
7779
|
-
this.upperBound = this.endValue;
|
|
7780
|
-
break;
|
|
7781
|
-
}
|
|
7782
|
-
}
|
|
7783
|
-
this.throttledEmitUpdate = throttle(this.emitUpdate, 120);
|
|
7784
|
-
}
|
|
7785
|
-
emitUpdate = async () => {
|
|
7786
|
-
switch (this.dataType) {
|
|
7787
|
-
case 'number':
|
|
7788
|
-
this.rangeChanged?.emit({
|
|
7789
|
-
startValue: this.startValue,
|
|
7790
|
-
endValue: this.endValue,
|
|
7791
|
-
});
|
|
7792
|
-
break;
|
|
7793
|
-
case 'date': {
|
|
7794
|
-
const granularity = this.dateGranularity || 'year';
|
|
7795
|
-
const startTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.startValue);
|
|
7796
|
-
const endTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.endValue + 1);
|
|
7797
|
-
this.rangeChanged?.emit({
|
|
7798
|
-
startValue: startTimestamp,
|
|
7799
|
-
endValue: endTimestamp,
|
|
7800
|
-
});
|
|
7801
|
-
break;
|
|
7802
|
-
}
|
|
7803
|
-
}
|
|
7804
|
-
};
|
|
7805
|
-
handleStartValueChange = (event) => {
|
|
7806
|
-
const inputElement = event.target;
|
|
7807
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
7808
|
-
this.lastFocusedHandle = 'min';
|
|
7809
|
-
if (value <= this.endValue) {
|
|
7810
|
-
this.startValue = value;
|
|
7811
|
-
this.throttledEmitUpdate();
|
|
7812
|
-
}
|
|
7813
|
-
else {
|
|
7814
|
-
this.startValue = this.endValue;
|
|
7815
|
-
inputElement.value = `${this.endValue}`;
|
|
7816
|
-
}
|
|
7817
|
-
};
|
|
7818
|
-
handleEndValueChange = (event) => {
|
|
7819
|
-
const inputElement = event.target;
|
|
7820
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
7821
|
-
this.lastFocusedHandle = 'max';
|
|
7822
|
-
if (value >= this.startValue) {
|
|
7823
|
-
this.endValue = value;
|
|
7824
|
-
this.throttledEmitUpdate();
|
|
7825
|
-
}
|
|
7826
|
-
else {
|
|
7827
|
-
this.endValue = this.startValue;
|
|
7828
|
-
inputElement.value = `${this.startValue}`;
|
|
7829
|
-
}
|
|
7830
|
-
};
|
|
7831
|
-
getLabel = (value) => {
|
|
7832
|
-
switch (this.dataType) {
|
|
7833
|
-
case 'number':
|
|
7834
|
-
return `${this.startValue}`;
|
|
7835
|
-
case 'date': {
|
|
7836
|
-
const granularity = this.dateGranularity || 'year';
|
|
7837
|
-
const dateOffset = this.lowerBound + value;
|
|
7838
|
-
const timestamp = getStartOf(this.min, granularity, dateOffset);
|
|
7839
|
-
return getFormattedDateString(this.dateGranularity || 'year', new Date(timestamp));
|
|
7840
|
-
}
|
|
7841
|
-
}
|
|
7842
|
-
};
|
|
7843
|
-
render() {
|
|
7844
|
-
const startPercent = ((this.startValue - this.lowerBound) /
|
|
7845
|
-
(this.upperBound - this.lowerBound)) *
|
|
7846
|
-
100;
|
|
7847
|
-
const endPercent = ((this.endValue - this.lowerBound) /
|
|
7848
|
-
(this.upperBound - this.lowerBound)) *
|
|
7849
|
-
100;
|
|
7850
|
-
const startLabel = this.getLabel(this.startValue);
|
|
7851
|
-
const endLabel = this.getLabel(this.endValue);
|
|
7852
|
-
return (hAsync("div", { key: 'd5035ed8bcbf95c0ef5b2a7a9ef471e318a9dc30', class: 'searchcraft-slider' }, hAsync("div", { key: 'f5f7bc48703250b4f6c75a1f07c921233bd957d5', class: 'searchcraft-slider-range' }, hAsync("div", { key: 'fc2ec9f9786986a7306ffe43b54c47c35a1f086a', class: 'searchcraft-slider-active-range', style: {
|
|
7853
|
-
left: `${startPercent}%`,
|
|
7854
|
-
width: `${endPercent - startPercent}%`,
|
|
7855
|
-
} }), hAsync("input", { key: '716316b5ce507c40db5b7bd408f47b3bece88494', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleStartValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), hAsync("input", { key: 'e2ad0d586136185faccb50d6d7fb113a64ddac42', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleEndValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), hAsync("div", { key: '7e9ab9fa9563cac6a1dfdd11910e04084ae5348d', class: 'searchcraft-slider-label' }, hAsync("span", { key: '0909279f460c4be84c1088c5981a5f5299e8e2a0', class: 'searchcraft-slider-start-label' }, startLabel), hAsync("span", { key: '4b610a68f97fcbc0aa1eda428dfa1e53b00efe43', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
7856
|
-
}
|
|
7857
|
-
static get cmpMeta() { return {
|
|
7858
|
-
"$flags$": 768,
|
|
7859
|
-
"$tagName$": "searchcraft-slider",
|
|
7860
|
-
"$members$": {
|
|
7861
|
-
"max": [2],
|
|
7862
|
-
"min": [2],
|
|
7863
|
-
"step": [2],
|
|
7864
|
-
"dataType": [1, "data-type"],
|
|
7865
|
-
"dateGranularity": [1, "date-granularity"],
|
|
7866
|
-
"lowerBound": [32],
|
|
7867
|
-
"upperBound": [32],
|
|
7868
|
-
"endValue": [32],
|
|
7869
|
-
"startValue": [32],
|
|
7870
|
-
"lastFocusedHandle": [32]
|
|
7871
|
-
},
|
|
7872
|
-
"$listeners$": undefined,
|
|
7873
|
-
"$lazyBundleId$": "-",
|
|
7874
|
-
"$attrsToReflect$": []
|
|
7875
|
-
}; }
|
|
7876
|
-
}
|
|
7877
|
-
|
|
7878
|
-
/**
|
|
7879
|
-
* marked v15.0.12 - a markdown parser
|
|
7880
|
-
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
7881
|
-
* https://github.com/markedjs/marked
|
|
7882
|
-
*/
|
|
7883
|
-
|
|
7884
|
-
/**
|
|
7885
|
-
* DO NOT EDIT THIS FILE
|
|
7886
|
-
* The code in this file is generated from files in ./src/
|
|
7380
|
+
* DO NOT EDIT THIS FILE
|
|
7381
|
+
* The code in this file is generated from files in ./src/
|
|
7887
7382
|
*/
|
|
7888
7383
|
|
|
7889
7384
|
|
|
@@ -8637,1404 +8132,2226 @@ ${currentText}` : currentText;
|
|
|
8637
8132
|
};
|
|
8638
8133
|
}));
|
|
8639
8134
|
}
|
|
8640
|
-
return item;
|
|
8135
|
+
return item;
|
|
8136
|
+
}
|
|
8137
|
+
lheading(src) {
|
|
8138
|
+
const cap = this.rules.block.lheading.exec(src);
|
|
8139
|
+
if (cap) {
|
|
8140
|
+
return {
|
|
8141
|
+
type: "heading",
|
|
8142
|
+
raw: cap[0],
|
|
8143
|
+
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
|
8144
|
+
text: cap[1],
|
|
8145
|
+
tokens: this.lexer.inline(cap[1])
|
|
8146
|
+
};
|
|
8147
|
+
}
|
|
8148
|
+
}
|
|
8149
|
+
paragraph(src) {
|
|
8150
|
+
const cap = this.rules.block.paragraph.exec(src);
|
|
8151
|
+
if (cap) {
|
|
8152
|
+
const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
|
|
8153
|
+
return {
|
|
8154
|
+
type: "paragraph",
|
|
8155
|
+
raw: cap[0],
|
|
8156
|
+
text,
|
|
8157
|
+
tokens: this.lexer.inline(text)
|
|
8158
|
+
};
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
text(src) {
|
|
8162
|
+
const cap = this.rules.block.text.exec(src);
|
|
8163
|
+
if (cap) {
|
|
8164
|
+
return {
|
|
8165
|
+
type: "text",
|
|
8166
|
+
raw: cap[0],
|
|
8167
|
+
text: cap[0],
|
|
8168
|
+
tokens: this.lexer.inline(cap[0])
|
|
8169
|
+
};
|
|
8170
|
+
}
|
|
8171
|
+
}
|
|
8172
|
+
escape(src) {
|
|
8173
|
+
const cap = this.rules.inline.escape.exec(src);
|
|
8174
|
+
if (cap) {
|
|
8175
|
+
return {
|
|
8176
|
+
type: "escape",
|
|
8177
|
+
raw: cap[0],
|
|
8178
|
+
text: cap[1]
|
|
8179
|
+
};
|
|
8180
|
+
}
|
|
8181
|
+
}
|
|
8182
|
+
tag(src) {
|
|
8183
|
+
const cap = this.rules.inline.tag.exec(src);
|
|
8184
|
+
if (cap) {
|
|
8185
|
+
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
8186
|
+
this.lexer.state.inLink = true;
|
|
8187
|
+
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
8188
|
+
this.lexer.state.inLink = false;
|
|
8189
|
+
}
|
|
8190
|
+
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
8191
|
+
this.lexer.state.inRawBlock = true;
|
|
8192
|
+
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
8193
|
+
this.lexer.state.inRawBlock = false;
|
|
8194
|
+
}
|
|
8195
|
+
return {
|
|
8196
|
+
type: "html",
|
|
8197
|
+
raw: cap[0],
|
|
8198
|
+
inLink: this.lexer.state.inLink,
|
|
8199
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
8200
|
+
block: false,
|
|
8201
|
+
text: cap[0]
|
|
8202
|
+
};
|
|
8203
|
+
}
|
|
8204
|
+
}
|
|
8205
|
+
link(src) {
|
|
8206
|
+
const cap = this.rules.inline.link.exec(src);
|
|
8207
|
+
if (cap) {
|
|
8208
|
+
const trimmedUrl = cap[2].trim();
|
|
8209
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
8210
|
+
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
8211
|
+
return;
|
|
8212
|
+
}
|
|
8213
|
+
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
8214
|
+
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
8215
|
+
return;
|
|
8216
|
+
}
|
|
8217
|
+
} else {
|
|
8218
|
+
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
8219
|
+
if (lastParenIndex === -2) {
|
|
8220
|
+
return;
|
|
8221
|
+
}
|
|
8222
|
+
if (lastParenIndex > -1) {
|
|
8223
|
+
const start = cap[0].indexOf("!") === 0 ? 5 : 4;
|
|
8224
|
+
const linkLen = start + cap[1].length + lastParenIndex;
|
|
8225
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
8226
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
8227
|
+
cap[3] = "";
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
let href = cap[2];
|
|
8231
|
+
let title = "";
|
|
8232
|
+
if (this.options.pedantic) {
|
|
8233
|
+
const link2 = this.rules.other.pedanticHrefTitle.exec(href);
|
|
8234
|
+
if (link2) {
|
|
8235
|
+
href = link2[1];
|
|
8236
|
+
title = link2[3];
|
|
8237
|
+
}
|
|
8238
|
+
} else {
|
|
8239
|
+
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
8240
|
+
}
|
|
8241
|
+
href = href.trim();
|
|
8242
|
+
if (this.rules.other.startAngleBracket.test(href)) {
|
|
8243
|
+
if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
8244
|
+
href = href.slice(1);
|
|
8245
|
+
} else {
|
|
8246
|
+
href = href.slice(1, -1);
|
|
8247
|
+
}
|
|
8248
|
+
}
|
|
8249
|
+
return outputLink(cap, {
|
|
8250
|
+
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
8251
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
8252
|
+
}, cap[0], this.lexer, this.rules);
|
|
8253
|
+
}
|
|
8254
|
+
}
|
|
8255
|
+
reflink(src, links) {
|
|
8256
|
+
let cap;
|
|
8257
|
+
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
8258
|
+
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
8259
|
+
const link2 = links[linkString.toLowerCase()];
|
|
8260
|
+
if (!link2) {
|
|
8261
|
+
const text = cap[0].charAt(0);
|
|
8262
|
+
return {
|
|
8263
|
+
type: "text",
|
|
8264
|
+
raw: text,
|
|
8265
|
+
text
|
|
8266
|
+
};
|
|
8267
|
+
}
|
|
8268
|
+
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
emStrong(src, maskedSrc, prevChar = "") {
|
|
8272
|
+
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
8273
|
+
if (!match) return;
|
|
8274
|
+
if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
8275
|
+
const nextChar = match[1] || match[2] || "";
|
|
8276
|
+
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
8277
|
+
const lLength = [...match[0]].length - 1;
|
|
8278
|
+
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
|
8279
|
+
const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
8280
|
+
endReg.lastIndex = 0;
|
|
8281
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
8282
|
+
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
8283
|
+
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
8284
|
+
if (!rDelim) continue;
|
|
8285
|
+
rLength = [...rDelim].length;
|
|
8286
|
+
if (match[3] || match[4]) {
|
|
8287
|
+
delimTotal += rLength;
|
|
8288
|
+
continue;
|
|
8289
|
+
} else if (match[5] || match[6]) {
|
|
8290
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
8291
|
+
midDelimTotal += rLength;
|
|
8292
|
+
continue;
|
|
8293
|
+
}
|
|
8294
|
+
}
|
|
8295
|
+
delimTotal -= rLength;
|
|
8296
|
+
if (delimTotal > 0) continue;
|
|
8297
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
8298
|
+
const lastCharLength = [...match[0]][0].length;
|
|
8299
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
8300
|
+
if (Math.min(lLength, rLength) % 2) {
|
|
8301
|
+
const text2 = raw.slice(1, -1);
|
|
8302
|
+
return {
|
|
8303
|
+
type: "em",
|
|
8304
|
+
raw,
|
|
8305
|
+
text: text2,
|
|
8306
|
+
tokens: this.lexer.inlineTokens(text2)
|
|
8307
|
+
};
|
|
8308
|
+
}
|
|
8309
|
+
const text = raw.slice(2, -2);
|
|
8310
|
+
return {
|
|
8311
|
+
type: "strong",
|
|
8312
|
+
raw,
|
|
8313
|
+
text,
|
|
8314
|
+
tokens: this.lexer.inlineTokens(text)
|
|
8315
|
+
};
|
|
8316
|
+
}
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
codespan(src) {
|
|
8320
|
+
const cap = this.rules.inline.code.exec(src);
|
|
8321
|
+
if (cap) {
|
|
8322
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
8323
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
8324
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
8325
|
+
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
8326
|
+
text = text.substring(1, text.length - 1);
|
|
8327
|
+
}
|
|
8328
|
+
return {
|
|
8329
|
+
type: "codespan",
|
|
8330
|
+
raw: cap[0],
|
|
8331
|
+
text
|
|
8332
|
+
};
|
|
8333
|
+
}
|
|
8641
8334
|
}
|
|
8642
|
-
|
|
8643
|
-
const cap = this.rules.
|
|
8335
|
+
br(src) {
|
|
8336
|
+
const cap = this.rules.inline.br.exec(src);
|
|
8644
8337
|
if (cap) {
|
|
8645
8338
|
return {
|
|
8646
|
-
type: "
|
|
8339
|
+
type: "br",
|
|
8340
|
+
raw: cap[0]
|
|
8341
|
+
};
|
|
8342
|
+
}
|
|
8343
|
+
}
|
|
8344
|
+
del(src) {
|
|
8345
|
+
const cap = this.rules.inline.del.exec(src);
|
|
8346
|
+
if (cap) {
|
|
8347
|
+
return {
|
|
8348
|
+
type: "del",
|
|
8647
8349
|
raw: cap[0],
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
tokens: this.lexer.inline(cap[1])
|
|
8350
|
+
text: cap[2],
|
|
8351
|
+
tokens: this.lexer.inlineTokens(cap[2])
|
|
8651
8352
|
};
|
|
8652
8353
|
}
|
|
8653
8354
|
}
|
|
8654
|
-
|
|
8655
|
-
const cap = this.rules.
|
|
8355
|
+
autolink(src) {
|
|
8356
|
+
const cap = this.rules.inline.autolink.exec(src);
|
|
8656
8357
|
if (cap) {
|
|
8657
|
-
|
|
8358
|
+
let text, href;
|
|
8359
|
+
if (cap[2] === "@") {
|
|
8360
|
+
text = cap[1];
|
|
8361
|
+
href = "mailto:" + text;
|
|
8362
|
+
} else {
|
|
8363
|
+
text = cap[1];
|
|
8364
|
+
href = text;
|
|
8365
|
+
}
|
|
8658
8366
|
return {
|
|
8659
|
-
type: "
|
|
8367
|
+
type: "link",
|
|
8660
8368
|
raw: cap[0],
|
|
8661
8369
|
text,
|
|
8662
|
-
|
|
8370
|
+
href,
|
|
8371
|
+
tokens: [
|
|
8372
|
+
{
|
|
8373
|
+
type: "text",
|
|
8374
|
+
raw: text,
|
|
8375
|
+
text
|
|
8376
|
+
}
|
|
8377
|
+
]
|
|
8663
8378
|
};
|
|
8664
8379
|
}
|
|
8665
8380
|
}
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
if (cap) {
|
|
8381
|
+
url(src) {
|
|
8382
|
+
let cap;
|
|
8383
|
+
if (cap = this.rules.inline.url.exec(src)) {
|
|
8384
|
+
let text, href;
|
|
8385
|
+
if (cap[2] === "@") {
|
|
8386
|
+
text = cap[0];
|
|
8387
|
+
href = "mailto:" + text;
|
|
8388
|
+
} else {
|
|
8389
|
+
let prevCapZero;
|
|
8390
|
+
do {
|
|
8391
|
+
prevCapZero = cap[0];
|
|
8392
|
+
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
8393
|
+
} while (prevCapZero !== cap[0]);
|
|
8394
|
+
text = cap[0];
|
|
8395
|
+
if (cap[1] === "www.") {
|
|
8396
|
+
href = "http://" + cap[0];
|
|
8397
|
+
} else {
|
|
8398
|
+
href = cap[0];
|
|
8399
|
+
}
|
|
8400
|
+
}
|
|
8669
8401
|
return {
|
|
8670
|
-
type: "
|
|
8402
|
+
type: "link",
|
|
8671
8403
|
raw: cap[0],
|
|
8672
|
-
text
|
|
8673
|
-
|
|
8404
|
+
text,
|
|
8405
|
+
href,
|
|
8406
|
+
tokens: [
|
|
8407
|
+
{
|
|
8408
|
+
type: "text",
|
|
8409
|
+
raw: text,
|
|
8410
|
+
text
|
|
8411
|
+
}
|
|
8412
|
+
]
|
|
8674
8413
|
};
|
|
8675
8414
|
}
|
|
8676
8415
|
}
|
|
8677
|
-
|
|
8678
|
-
const cap = this.rules.inline.
|
|
8416
|
+
inlineText(src) {
|
|
8417
|
+
const cap = this.rules.inline.text.exec(src);
|
|
8679
8418
|
if (cap) {
|
|
8419
|
+
const escaped = this.lexer.state.inRawBlock;
|
|
8680
8420
|
return {
|
|
8681
|
-
type: "
|
|
8421
|
+
type: "text",
|
|
8682
8422
|
raw: cap[0],
|
|
8683
|
-
text: cap[
|
|
8423
|
+
text: cap[0],
|
|
8424
|
+
escaped
|
|
8684
8425
|
};
|
|
8685
8426
|
}
|
|
8686
8427
|
}
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8428
|
+
};
|
|
8429
|
+
|
|
8430
|
+
// src/Lexer.ts
|
|
8431
|
+
var _Lexer = class __Lexer {
|
|
8432
|
+
tokens;
|
|
8433
|
+
options;
|
|
8434
|
+
state;
|
|
8435
|
+
tokenizer;
|
|
8436
|
+
inlineQueue;
|
|
8437
|
+
constructor(options2) {
|
|
8438
|
+
this.tokens = [];
|
|
8439
|
+
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
8440
|
+
this.options = options2 || _defaults;
|
|
8441
|
+
this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
|
|
8442
|
+
this.tokenizer = this.options.tokenizer;
|
|
8443
|
+
this.tokenizer.options = this.options;
|
|
8444
|
+
this.tokenizer.lexer = this;
|
|
8445
|
+
this.inlineQueue = [];
|
|
8446
|
+
this.state = {
|
|
8447
|
+
inLink: false,
|
|
8448
|
+
inRawBlock: false,
|
|
8449
|
+
top: true
|
|
8450
|
+
};
|
|
8451
|
+
const rules = {
|
|
8452
|
+
other,
|
|
8453
|
+
block: block.normal,
|
|
8454
|
+
inline: inline.normal
|
|
8455
|
+
};
|
|
8456
|
+
if (this.options.pedantic) {
|
|
8457
|
+
rules.block = block.pedantic;
|
|
8458
|
+
rules.inline = inline.pedantic;
|
|
8459
|
+
} else if (this.options.gfm) {
|
|
8460
|
+
rules.block = block.gfm;
|
|
8461
|
+
if (this.options.breaks) {
|
|
8462
|
+
rules.inline = inline.breaks;
|
|
8463
|
+
} else {
|
|
8464
|
+
rules.inline = inline.gfm;
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
this.tokenizer.rules = rules;
|
|
8468
|
+
}
|
|
8469
|
+
/**
|
|
8470
|
+
* Expose Rules
|
|
8471
|
+
*/
|
|
8472
|
+
static get rules() {
|
|
8473
|
+
return {
|
|
8474
|
+
block,
|
|
8475
|
+
inline
|
|
8476
|
+
};
|
|
8477
|
+
}
|
|
8478
|
+
/**
|
|
8479
|
+
* Static Lex Method
|
|
8480
|
+
*/
|
|
8481
|
+
static lex(src, options2) {
|
|
8482
|
+
const lexer2 = new __Lexer(options2);
|
|
8483
|
+
return lexer2.lex(src);
|
|
8484
|
+
}
|
|
8485
|
+
/**
|
|
8486
|
+
* Static Lex Inline Method
|
|
8487
|
+
*/
|
|
8488
|
+
static lexInline(src, options2) {
|
|
8489
|
+
const lexer2 = new __Lexer(options2);
|
|
8490
|
+
return lexer2.inlineTokens(src);
|
|
8491
|
+
}
|
|
8492
|
+
/**
|
|
8493
|
+
* Preprocessing
|
|
8494
|
+
*/
|
|
8495
|
+
lex(src) {
|
|
8496
|
+
src = src.replace(other.carriageReturn, "\n");
|
|
8497
|
+
this.blockTokens(src, this.tokens);
|
|
8498
|
+
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
8499
|
+
const next = this.inlineQueue[i];
|
|
8500
|
+
this.inlineTokens(next.src, next.tokens);
|
|
8501
|
+
}
|
|
8502
|
+
this.inlineQueue = [];
|
|
8503
|
+
return this.tokens;
|
|
8504
|
+
}
|
|
8505
|
+
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
8506
|
+
if (this.options.pedantic) {
|
|
8507
|
+
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
8508
|
+
}
|
|
8509
|
+
while (src) {
|
|
8510
|
+
let token;
|
|
8511
|
+
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
8512
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
8513
|
+
src = src.substring(token.raw.length);
|
|
8514
|
+
tokens.push(token);
|
|
8515
|
+
return true;
|
|
8516
|
+
}
|
|
8517
|
+
return false;
|
|
8518
|
+
})) {
|
|
8519
|
+
continue;
|
|
8520
|
+
}
|
|
8521
|
+
if (token = this.tokenizer.space(src)) {
|
|
8522
|
+
src = src.substring(token.raw.length);
|
|
8523
|
+
const lastToken = tokens.at(-1);
|
|
8524
|
+
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
8525
|
+
lastToken.raw += "\n";
|
|
8526
|
+
} else {
|
|
8527
|
+
tokens.push(token);
|
|
8528
|
+
}
|
|
8529
|
+
continue;
|
|
8530
|
+
}
|
|
8531
|
+
if (token = this.tokenizer.code(src)) {
|
|
8532
|
+
src = src.substring(token.raw.length);
|
|
8533
|
+
const lastToken = tokens.at(-1);
|
|
8534
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
8535
|
+
lastToken.raw += "\n" + token.raw;
|
|
8536
|
+
lastToken.text += "\n" + token.text;
|
|
8537
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8538
|
+
} else {
|
|
8539
|
+
tokens.push(token);
|
|
8540
|
+
}
|
|
8541
|
+
continue;
|
|
8542
|
+
}
|
|
8543
|
+
if (token = this.tokenizer.fences(src)) {
|
|
8544
|
+
src = src.substring(token.raw.length);
|
|
8545
|
+
tokens.push(token);
|
|
8546
|
+
continue;
|
|
8547
|
+
}
|
|
8548
|
+
if (token = this.tokenizer.heading(src)) {
|
|
8549
|
+
src = src.substring(token.raw.length);
|
|
8550
|
+
tokens.push(token);
|
|
8551
|
+
continue;
|
|
8552
|
+
}
|
|
8553
|
+
if (token = this.tokenizer.hr(src)) {
|
|
8554
|
+
src = src.substring(token.raw.length);
|
|
8555
|
+
tokens.push(token);
|
|
8556
|
+
continue;
|
|
8557
|
+
}
|
|
8558
|
+
if (token = this.tokenizer.blockquote(src)) {
|
|
8559
|
+
src = src.substring(token.raw.length);
|
|
8560
|
+
tokens.push(token);
|
|
8561
|
+
continue;
|
|
8562
|
+
}
|
|
8563
|
+
if (token = this.tokenizer.list(src)) {
|
|
8564
|
+
src = src.substring(token.raw.length);
|
|
8565
|
+
tokens.push(token);
|
|
8566
|
+
continue;
|
|
8567
|
+
}
|
|
8568
|
+
if (token = this.tokenizer.html(src)) {
|
|
8569
|
+
src = src.substring(token.raw.length);
|
|
8570
|
+
tokens.push(token);
|
|
8571
|
+
continue;
|
|
8572
|
+
}
|
|
8573
|
+
if (token = this.tokenizer.def(src)) {
|
|
8574
|
+
src = src.substring(token.raw.length);
|
|
8575
|
+
const lastToken = tokens.at(-1);
|
|
8576
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
8577
|
+
lastToken.raw += "\n" + token.raw;
|
|
8578
|
+
lastToken.text += "\n" + token.raw;
|
|
8579
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8580
|
+
} else if (!this.tokens.links[token.tag]) {
|
|
8581
|
+
this.tokens.links[token.tag] = {
|
|
8582
|
+
href: token.href,
|
|
8583
|
+
title: token.title
|
|
8584
|
+
};
|
|
8585
|
+
}
|
|
8586
|
+
continue;
|
|
8694
8587
|
}
|
|
8695
|
-
if (
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8588
|
+
if (token = this.tokenizer.table(src)) {
|
|
8589
|
+
src = src.substring(token.raw.length);
|
|
8590
|
+
tokens.push(token);
|
|
8591
|
+
continue;
|
|
8699
8592
|
}
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
8719
|
-
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
8720
|
-
return;
|
|
8721
|
-
}
|
|
8722
|
-
} else {
|
|
8723
|
-
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
8724
|
-
if (lastParenIndex === -2) {
|
|
8725
|
-
return;
|
|
8593
|
+
if (token = this.tokenizer.lheading(src)) {
|
|
8594
|
+
src = src.substring(token.raw.length);
|
|
8595
|
+
tokens.push(token);
|
|
8596
|
+
continue;
|
|
8597
|
+
}
|
|
8598
|
+
let cutSrc = src;
|
|
8599
|
+
if (this.options.extensions?.startBlock) {
|
|
8600
|
+
let startIndex = Infinity;
|
|
8601
|
+
const tempSrc = src.slice(1);
|
|
8602
|
+
let tempStart;
|
|
8603
|
+
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
8604
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
8605
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
8606
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
8607
|
+
}
|
|
8608
|
+
});
|
|
8609
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
8610
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
8726
8611
|
}
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8612
|
+
}
|
|
8613
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
8614
|
+
const lastToken = tokens.at(-1);
|
|
8615
|
+
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
8616
|
+
lastToken.raw += "\n" + token.raw;
|
|
8617
|
+
lastToken.text += "\n" + token.text;
|
|
8618
|
+
this.inlineQueue.pop();
|
|
8619
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8620
|
+
} else {
|
|
8621
|
+
tokens.push(token);
|
|
8733
8622
|
}
|
|
8623
|
+
lastParagraphClipped = cutSrc.length !== src.length;
|
|
8624
|
+
src = src.substring(token.raw.length);
|
|
8625
|
+
continue;
|
|
8734
8626
|
}
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8627
|
+
if (token = this.tokenizer.text(src)) {
|
|
8628
|
+
src = src.substring(token.raw.length);
|
|
8629
|
+
const lastToken = tokens.at(-1);
|
|
8630
|
+
if (lastToken?.type === "text") {
|
|
8631
|
+
lastToken.raw += "\n" + token.raw;
|
|
8632
|
+
lastToken.text += "\n" + token.text;
|
|
8633
|
+
this.inlineQueue.pop();
|
|
8634
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8635
|
+
} else {
|
|
8636
|
+
tokens.push(token);
|
|
8742
8637
|
}
|
|
8743
|
-
|
|
8744
|
-
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
8638
|
+
continue;
|
|
8745
8639
|
}
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
if (this.options.
|
|
8749
|
-
|
|
8640
|
+
if (src) {
|
|
8641
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
8642
|
+
if (this.options.silent) {
|
|
8643
|
+
console.error(errMsg);
|
|
8644
|
+
break;
|
|
8750
8645
|
} else {
|
|
8751
|
-
|
|
8646
|
+
throw new Error(errMsg);
|
|
8752
8647
|
}
|
|
8753
8648
|
}
|
|
8754
|
-
return outputLink(cap, {
|
|
8755
|
-
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
8756
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
8757
|
-
}, cap[0], this.lexer, this.rules);
|
|
8758
8649
|
}
|
|
8650
|
+
this.state.top = true;
|
|
8651
|
+
return tokens;
|
|
8759
8652
|
}
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8653
|
+
inline(src, tokens = []) {
|
|
8654
|
+
this.inlineQueue.push({ src, tokens });
|
|
8655
|
+
return tokens;
|
|
8656
|
+
}
|
|
8657
|
+
/**
|
|
8658
|
+
* Lexing/Compiling
|
|
8659
|
+
*/
|
|
8660
|
+
inlineTokens(src, tokens = []) {
|
|
8661
|
+
let maskedSrc = src;
|
|
8662
|
+
let match = null;
|
|
8663
|
+
if (this.tokens.links) {
|
|
8664
|
+
const links = Object.keys(this.tokens.links);
|
|
8665
|
+
if (links.length > 0) {
|
|
8666
|
+
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
8667
|
+
if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
|
|
8668
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
8669
|
+
}
|
|
8670
|
+
}
|
|
8772
8671
|
}
|
|
8773
|
-
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
8774
8672
|
}
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
}
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8673
|
+
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
8674
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
8675
|
+
}
|
|
8676
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
8677
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
8678
|
+
}
|
|
8679
|
+
let keepPrevChar = false;
|
|
8680
|
+
let prevChar = "";
|
|
8681
|
+
while (src) {
|
|
8682
|
+
if (!keepPrevChar) {
|
|
8683
|
+
prevChar = "";
|
|
8684
|
+
}
|
|
8685
|
+
keepPrevChar = false;
|
|
8686
|
+
let token;
|
|
8687
|
+
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
8688
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
8689
|
+
src = src.substring(token.raw.length);
|
|
8690
|
+
tokens.push(token);
|
|
8691
|
+
return true;
|
|
8692
|
+
}
|
|
8693
|
+
return false;
|
|
8694
|
+
})) {
|
|
8695
|
+
continue;
|
|
8696
|
+
}
|
|
8697
|
+
if (token = this.tokenizer.escape(src)) {
|
|
8698
|
+
src = src.substring(token.raw.length);
|
|
8699
|
+
tokens.push(token);
|
|
8700
|
+
continue;
|
|
8701
|
+
}
|
|
8702
|
+
if (token = this.tokenizer.tag(src)) {
|
|
8703
|
+
src = src.substring(token.raw.length);
|
|
8704
|
+
tokens.push(token);
|
|
8705
|
+
continue;
|
|
8706
|
+
}
|
|
8707
|
+
if (token = this.tokenizer.link(src)) {
|
|
8708
|
+
src = src.substring(token.raw.length);
|
|
8709
|
+
tokens.push(token);
|
|
8710
|
+
continue;
|
|
8711
|
+
}
|
|
8712
|
+
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
8713
|
+
src = src.substring(token.raw.length);
|
|
8714
|
+
const lastToken = tokens.at(-1);
|
|
8715
|
+
if (token.type === "text" && lastToken?.type === "text") {
|
|
8716
|
+
lastToken.raw += token.raw;
|
|
8717
|
+
lastToken.text += token.text;
|
|
8718
|
+
} else {
|
|
8719
|
+
tokens.push(token);
|
|
8720
|
+
}
|
|
8721
|
+
continue;
|
|
8722
|
+
}
|
|
8723
|
+
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
8724
|
+
src = src.substring(token.raw.length);
|
|
8725
|
+
tokens.push(token);
|
|
8726
|
+
continue;
|
|
8727
|
+
}
|
|
8728
|
+
if (token = this.tokenizer.codespan(src)) {
|
|
8729
|
+
src = src.substring(token.raw.length);
|
|
8730
|
+
tokens.push(token);
|
|
8731
|
+
continue;
|
|
8732
|
+
}
|
|
8733
|
+
if (token = this.tokenizer.br(src)) {
|
|
8734
|
+
src = src.substring(token.raw.length);
|
|
8735
|
+
tokens.push(token);
|
|
8736
|
+
continue;
|
|
8737
|
+
}
|
|
8738
|
+
if (token = this.tokenizer.del(src)) {
|
|
8739
|
+
src = src.substring(token.raw.length);
|
|
8740
|
+
tokens.push(token);
|
|
8741
|
+
continue;
|
|
8742
|
+
}
|
|
8743
|
+
if (token = this.tokenizer.autolink(src)) {
|
|
8744
|
+
src = src.substring(token.raw.length);
|
|
8745
|
+
tokens.push(token);
|
|
8746
|
+
continue;
|
|
8747
|
+
}
|
|
8748
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
8749
|
+
src = src.substring(token.raw.length);
|
|
8750
|
+
tokens.push(token);
|
|
8751
|
+
continue;
|
|
8752
|
+
}
|
|
8753
|
+
let cutSrc = src;
|
|
8754
|
+
if (this.options.extensions?.startInline) {
|
|
8755
|
+
let startIndex = Infinity;
|
|
8756
|
+
const tempSrc = src.slice(1);
|
|
8757
|
+
let tempStart;
|
|
8758
|
+
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
8759
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
8760
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
8761
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
8798
8762
|
}
|
|
8763
|
+
});
|
|
8764
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
8765
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
8766
|
+
}
|
|
8767
|
+
}
|
|
8768
|
+
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
8769
|
+
src = src.substring(token.raw.length);
|
|
8770
|
+
if (token.raw.slice(-1) !== "_") {
|
|
8771
|
+
prevChar = token.raw.slice(-1);
|
|
8799
8772
|
}
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
return {
|
|
8808
|
-
type: "em",
|
|
8809
|
-
raw,
|
|
8810
|
-
text: text2,
|
|
8811
|
-
tokens: this.lexer.inlineTokens(text2)
|
|
8812
|
-
};
|
|
8773
|
+
keepPrevChar = true;
|
|
8774
|
+
const lastToken = tokens.at(-1);
|
|
8775
|
+
if (lastToken?.type === "text") {
|
|
8776
|
+
lastToken.raw += token.raw;
|
|
8777
|
+
lastToken.text += token.text;
|
|
8778
|
+
} else {
|
|
8779
|
+
tokens.push(token);
|
|
8813
8780
|
}
|
|
8814
|
-
|
|
8815
|
-
return {
|
|
8816
|
-
type: "strong",
|
|
8817
|
-
raw,
|
|
8818
|
-
text,
|
|
8819
|
-
tokens: this.lexer.inlineTokens(text)
|
|
8820
|
-
};
|
|
8781
|
+
continue;
|
|
8821
8782
|
}
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
8831
|
-
text = text.substring(1, text.length - 1);
|
|
8783
|
+
if (src) {
|
|
8784
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
8785
|
+
if (this.options.silent) {
|
|
8786
|
+
console.error(errMsg);
|
|
8787
|
+
break;
|
|
8788
|
+
} else {
|
|
8789
|
+
throw new Error(errMsg);
|
|
8790
|
+
}
|
|
8832
8791
|
}
|
|
8833
|
-
return {
|
|
8834
|
-
type: "codespan",
|
|
8835
|
-
raw: cap[0],
|
|
8836
|
-
text
|
|
8837
|
-
};
|
|
8838
8792
|
}
|
|
8793
|
+
return tokens;
|
|
8839
8794
|
}
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8795
|
+
};
|
|
8796
|
+
|
|
8797
|
+
// src/Renderer.ts
|
|
8798
|
+
var _Renderer = class {
|
|
8799
|
+
options;
|
|
8800
|
+
parser;
|
|
8801
|
+
// set by the parser
|
|
8802
|
+
constructor(options2) {
|
|
8803
|
+
this.options = options2 || _defaults;
|
|
8804
|
+
}
|
|
8805
|
+
space(token) {
|
|
8806
|
+
return "";
|
|
8807
|
+
}
|
|
8808
|
+
code({ text, lang, escaped }) {
|
|
8809
|
+
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
8810
|
+
const code = text.replace(other.endingNewline, "") + "\n";
|
|
8811
|
+
if (!langString) {
|
|
8812
|
+
return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
8847
8813
|
}
|
|
8814
|
+
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
8848
8815
|
}
|
|
8849
|
-
|
|
8850
|
-
const
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8816
|
+
blockquote({ tokens }) {
|
|
8817
|
+
const body = this.parser.parse(tokens);
|
|
8818
|
+
return `<blockquote>
|
|
8819
|
+
${body}</blockquote>
|
|
8820
|
+
`;
|
|
8821
|
+
}
|
|
8822
|
+
html({ text }) {
|
|
8823
|
+
return text;
|
|
8824
|
+
}
|
|
8825
|
+
heading({ tokens, depth }) {
|
|
8826
|
+
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
8827
|
+
`;
|
|
8828
|
+
}
|
|
8829
|
+
hr(token) {
|
|
8830
|
+
return "<hr>\n";
|
|
8831
|
+
}
|
|
8832
|
+
list(token) {
|
|
8833
|
+
const ordered = token.ordered;
|
|
8834
|
+
const start = token.start;
|
|
8835
|
+
let body = "";
|
|
8836
|
+
for (let j = 0; j < token.items.length; j++) {
|
|
8837
|
+
const item = token.items[j];
|
|
8838
|
+
body += this.listitem(item);
|
|
8858
8839
|
}
|
|
8840
|
+
const type = ordered ? "ol" : "ul";
|
|
8841
|
+
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
8842
|
+
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
8859
8843
|
}
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
if (
|
|
8863
|
-
|
|
8864
|
-
if (
|
|
8865
|
-
|
|
8866
|
-
|
|
8844
|
+
listitem(item) {
|
|
8845
|
+
let itemBody = "";
|
|
8846
|
+
if (item.task) {
|
|
8847
|
+
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
8848
|
+
if (item.loose) {
|
|
8849
|
+
if (item.tokens[0]?.type === "paragraph") {
|
|
8850
|
+
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
8851
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
8852
|
+
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
8853
|
+
item.tokens[0].tokens[0].escaped = true;
|
|
8854
|
+
}
|
|
8855
|
+
} else {
|
|
8856
|
+
item.tokens.unshift({
|
|
8857
|
+
type: "text",
|
|
8858
|
+
raw: checkbox + " ",
|
|
8859
|
+
text: checkbox + " ",
|
|
8860
|
+
escaped: true
|
|
8861
|
+
});
|
|
8862
|
+
}
|
|
8867
8863
|
} else {
|
|
8868
|
-
|
|
8869
|
-
href = text;
|
|
8864
|
+
itemBody += checkbox + " ";
|
|
8870
8865
|
}
|
|
8871
|
-
return {
|
|
8872
|
-
type: "link",
|
|
8873
|
-
raw: cap[0],
|
|
8874
|
-
text,
|
|
8875
|
-
href,
|
|
8876
|
-
tokens: [
|
|
8877
|
-
{
|
|
8878
|
-
type: "text",
|
|
8879
|
-
raw: text,
|
|
8880
|
-
text
|
|
8881
|
-
}
|
|
8882
|
-
]
|
|
8883
|
-
};
|
|
8884
8866
|
}
|
|
8867
|
+
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
8868
|
+
return `<li>${itemBody}</li>
|
|
8869
|
+
`;
|
|
8885
8870
|
}
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8871
|
+
checkbox({ checked }) {
|
|
8872
|
+
return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
8873
|
+
}
|
|
8874
|
+
paragraph({ tokens }) {
|
|
8875
|
+
return `<p>${this.parser.parseInline(tokens)}</p>
|
|
8876
|
+
`;
|
|
8877
|
+
}
|
|
8878
|
+
table(token) {
|
|
8879
|
+
let header = "";
|
|
8880
|
+
let cell = "";
|
|
8881
|
+
for (let j = 0; j < token.header.length; j++) {
|
|
8882
|
+
cell += this.tablecell(token.header[j]);
|
|
8883
|
+
}
|
|
8884
|
+
header += this.tablerow({ text: cell });
|
|
8885
|
+
let body = "";
|
|
8886
|
+
for (let j = 0; j < token.rows.length; j++) {
|
|
8887
|
+
const row = token.rows[j];
|
|
8888
|
+
cell = "";
|
|
8889
|
+
for (let k = 0; k < row.length; k++) {
|
|
8890
|
+
cell += this.tablecell(row[k]);
|
|
8905
8891
|
}
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8892
|
+
body += this.tablerow({ text: cell });
|
|
8893
|
+
}
|
|
8894
|
+
if (body) body = `<tbody>${body}</tbody>`;
|
|
8895
|
+
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
8896
|
+
}
|
|
8897
|
+
tablerow({ text }) {
|
|
8898
|
+
return `<tr>
|
|
8899
|
+
${text}</tr>
|
|
8900
|
+
`;
|
|
8901
|
+
}
|
|
8902
|
+
tablecell(token) {
|
|
8903
|
+
const content = this.parser.parseInline(token.tokens);
|
|
8904
|
+
const type = token.header ? "th" : "td";
|
|
8905
|
+
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
8906
|
+
return tag2 + content + `</${type}>
|
|
8907
|
+
`;
|
|
8908
|
+
}
|
|
8909
|
+
/**
|
|
8910
|
+
* span level renderer
|
|
8911
|
+
*/
|
|
8912
|
+
strong({ tokens }) {
|
|
8913
|
+
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
8914
|
+
}
|
|
8915
|
+
em({ tokens }) {
|
|
8916
|
+
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
8917
|
+
}
|
|
8918
|
+
codespan({ text }) {
|
|
8919
|
+
return `<code>${escape2(text, true)}</code>`;
|
|
8920
|
+
}
|
|
8921
|
+
br(token) {
|
|
8922
|
+
return "<br>";
|
|
8923
|
+
}
|
|
8924
|
+
del({ tokens }) {
|
|
8925
|
+
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
8926
|
+
}
|
|
8927
|
+
link({ href, title, tokens }) {
|
|
8928
|
+
const text = this.parser.parseInline(tokens);
|
|
8929
|
+
const cleanHref = cleanUrl(href);
|
|
8930
|
+
if (cleanHref === null) {
|
|
8931
|
+
return text;
|
|
8932
|
+
}
|
|
8933
|
+
href = cleanHref;
|
|
8934
|
+
let out = '<a href="' + href + '"';
|
|
8935
|
+
if (title) {
|
|
8936
|
+
out += ' title="' + escape2(title) + '"';
|
|
8919
8937
|
}
|
|
8938
|
+
out += ">" + text + "</a>";
|
|
8939
|
+
return out;
|
|
8920
8940
|
}
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8941
|
+
image({ href, title, text, tokens }) {
|
|
8942
|
+
if (tokens) {
|
|
8943
|
+
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
8944
|
+
}
|
|
8945
|
+
const cleanHref = cleanUrl(href);
|
|
8946
|
+
if (cleanHref === null) {
|
|
8947
|
+
return escape2(text);
|
|
8948
|
+
}
|
|
8949
|
+
href = cleanHref;
|
|
8950
|
+
let out = `<img src="${href}" alt="${text}"`;
|
|
8951
|
+
if (title) {
|
|
8952
|
+
out += ` title="${escape2(title)}"`;
|
|
8931
8953
|
}
|
|
8954
|
+
out += ">";
|
|
8955
|
+
return out;
|
|
8956
|
+
}
|
|
8957
|
+
text(token) {
|
|
8958
|
+
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
8932
8959
|
}
|
|
8933
8960
|
};
|
|
8934
8961
|
|
|
8935
|
-
// src/
|
|
8936
|
-
var
|
|
8937
|
-
|
|
8962
|
+
// src/TextRenderer.ts
|
|
8963
|
+
var _TextRenderer = class {
|
|
8964
|
+
// no need for block level renderers
|
|
8965
|
+
strong({ text }) {
|
|
8966
|
+
return text;
|
|
8967
|
+
}
|
|
8968
|
+
em({ text }) {
|
|
8969
|
+
return text;
|
|
8970
|
+
}
|
|
8971
|
+
codespan({ text }) {
|
|
8972
|
+
return text;
|
|
8973
|
+
}
|
|
8974
|
+
del({ text }) {
|
|
8975
|
+
return text;
|
|
8976
|
+
}
|
|
8977
|
+
html({ text }) {
|
|
8978
|
+
return text;
|
|
8979
|
+
}
|
|
8980
|
+
text({ text }) {
|
|
8981
|
+
return text;
|
|
8982
|
+
}
|
|
8983
|
+
link({ text }) {
|
|
8984
|
+
return "" + text;
|
|
8985
|
+
}
|
|
8986
|
+
image({ text }) {
|
|
8987
|
+
return "" + text;
|
|
8988
|
+
}
|
|
8989
|
+
br() {
|
|
8990
|
+
return "";
|
|
8991
|
+
}
|
|
8992
|
+
};
|
|
8993
|
+
|
|
8994
|
+
// src/Parser.ts
|
|
8995
|
+
var _Parser = class __Parser {
|
|
8938
8996
|
options;
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
inlineQueue;
|
|
8997
|
+
renderer;
|
|
8998
|
+
textRenderer;
|
|
8942
8999
|
constructor(options2) {
|
|
8943
|
-
this.tokens = [];
|
|
8944
|
-
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
8945
9000
|
this.options = options2 || _defaults;
|
|
8946
|
-
this.options.
|
|
8947
|
-
this.
|
|
8948
|
-
this.
|
|
8949
|
-
this.
|
|
8950
|
-
this.
|
|
8951
|
-
this.state = {
|
|
8952
|
-
inLink: false,
|
|
8953
|
-
inRawBlock: false,
|
|
8954
|
-
top: true
|
|
8955
|
-
};
|
|
8956
|
-
const rules = {
|
|
8957
|
-
other,
|
|
8958
|
-
block: block.normal,
|
|
8959
|
-
inline: inline.normal
|
|
8960
|
-
};
|
|
8961
|
-
if (this.options.pedantic) {
|
|
8962
|
-
rules.block = block.pedantic;
|
|
8963
|
-
rules.inline = inline.pedantic;
|
|
8964
|
-
} else if (this.options.gfm) {
|
|
8965
|
-
rules.block = block.gfm;
|
|
8966
|
-
if (this.options.breaks) {
|
|
8967
|
-
rules.inline = inline.breaks;
|
|
8968
|
-
} else {
|
|
8969
|
-
rules.inline = inline.gfm;
|
|
8970
|
-
}
|
|
8971
|
-
}
|
|
8972
|
-
this.tokenizer.rules = rules;
|
|
8973
|
-
}
|
|
8974
|
-
/**
|
|
8975
|
-
* Expose Rules
|
|
8976
|
-
*/
|
|
8977
|
-
static get rules() {
|
|
8978
|
-
return {
|
|
8979
|
-
block,
|
|
8980
|
-
inline
|
|
8981
|
-
};
|
|
9001
|
+
this.options.renderer = this.options.renderer || new _Renderer();
|
|
9002
|
+
this.renderer = this.options.renderer;
|
|
9003
|
+
this.renderer.options = this.options;
|
|
9004
|
+
this.renderer.parser = this;
|
|
9005
|
+
this.textRenderer = new _TextRenderer();
|
|
8982
9006
|
}
|
|
8983
9007
|
/**
|
|
8984
|
-
* Static
|
|
9008
|
+
* Static Parse Method
|
|
8985
9009
|
*/
|
|
8986
|
-
static
|
|
8987
|
-
const
|
|
8988
|
-
return
|
|
9010
|
+
static parse(tokens, options2) {
|
|
9011
|
+
const parser2 = new __Parser(options2);
|
|
9012
|
+
return parser2.parse(tokens);
|
|
8989
9013
|
}
|
|
8990
9014
|
/**
|
|
8991
|
-
* Static
|
|
9015
|
+
* Static Parse Inline Method
|
|
8992
9016
|
*/
|
|
8993
|
-
static
|
|
8994
|
-
const
|
|
8995
|
-
return
|
|
9017
|
+
static parseInline(tokens, options2) {
|
|
9018
|
+
const parser2 = new __Parser(options2);
|
|
9019
|
+
return parser2.parseInline(tokens);
|
|
8996
9020
|
}
|
|
8997
9021
|
/**
|
|
8998
|
-
*
|
|
9022
|
+
* Parse Loop
|
|
8999
9023
|
*/
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
9011
|
-
if (this.options.pedantic) {
|
|
9012
|
-
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
9013
|
-
}
|
|
9014
|
-
while (src) {
|
|
9015
|
-
let token;
|
|
9016
|
-
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
9017
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
9018
|
-
src = src.substring(token.raw.length);
|
|
9019
|
-
tokens.push(token);
|
|
9020
|
-
return true;
|
|
9024
|
+
parse(tokens, top = true) {
|
|
9025
|
+
let out = "";
|
|
9026
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
9027
|
+
const anyToken = tokens[i];
|
|
9028
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9029
|
+
const genericToken = anyToken;
|
|
9030
|
+
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
9031
|
+
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
9032
|
+
out += ret || "";
|
|
9033
|
+
continue;
|
|
9021
9034
|
}
|
|
9022
|
-
return false;
|
|
9023
|
-
})) {
|
|
9024
|
-
continue;
|
|
9025
9035
|
}
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
} else {
|
|
9032
|
-
tokens.push(token);
|
|
9036
|
+
const token = anyToken;
|
|
9037
|
+
switch (token.type) {
|
|
9038
|
+
case "space": {
|
|
9039
|
+
out += this.renderer.space(token);
|
|
9040
|
+
continue;
|
|
9033
9041
|
}
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
src = src.substring(token.raw.length);
|
|
9038
|
-
const lastToken = tokens.at(-1);
|
|
9039
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
9040
|
-
lastToken.raw += "\n" + token.raw;
|
|
9041
|
-
lastToken.text += "\n" + token.text;
|
|
9042
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9043
|
-
} else {
|
|
9044
|
-
tokens.push(token);
|
|
9042
|
+
case "hr": {
|
|
9043
|
+
out += this.renderer.hr(token);
|
|
9044
|
+
continue;
|
|
9045
9045
|
}
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
tokens.push(token);
|
|
9066
|
-
continue;
|
|
9067
|
-
}
|
|
9068
|
-
if (token = this.tokenizer.list(src)) {
|
|
9069
|
-
src = src.substring(token.raw.length);
|
|
9070
|
-
tokens.push(token);
|
|
9071
|
-
continue;
|
|
9072
|
-
}
|
|
9073
|
-
if (token = this.tokenizer.html(src)) {
|
|
9074
|
-
src = src.substring(token.raw.length);
|
|
9075
|
-
tokens.push(token);
|
|
9076
|
-
continue;
|
|
9077
|
-
}
|
|
9078
|
-
if (token = this.tokenizer.def(src)) {
|
|
9079
|
-
src = src.substring(token.raw.length);
|
|
9080
|
-
const lastToken = tokens.at(-1);
|
|
9081
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
9082
|
-
lastToken.raw += "\n" + token.raw;
|
|
9083
|
-
lastToken.text += "\n" + token.raw;
|
|
9084
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9085
|
-
} else if (!this.tokens.links[token.tag]) {
|
|
9086
|
-
this.tokens.links[token.tag] = {
|
|
9087
|
-
href: token.href,
|
|
9088
|
-
title: token.title
|
|
9089
|
-
};
|
|
9046
|
+
case "heading": {
|
|
9047
|
+
out += this.renderer.heading(token);
|
|
9048
|
+
continue;
|
|
9049
|
+
}
|
|
9050
|
+
case "code": {
|
|
9051
|
+
out += this.renderer.code(token);
|
|
9052
|
+
continue;
|
|
9053
|
+
}
|
|
9054
|
+
case "table": {
|
|
9055
|
+
out += this.renderer.table(token);
|
|
9056
|
+
continue;
|
|
9057
|
+
}
|
|
9058
|
+
case "blockquote": {
|
|
9059
|
+
out += this.renderer.blockquote(token);
|
|
9060
|
+
continue;
|
|
9061
|
+
}
|
|
9062
|
+
case "list": {
|
|
9063
|
+
out += this.renderer.list(token);
|
|
9064
|
+
continue;
|
|
9090
9065
|
}
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
src = src.substring(token.raw.length);
|
|
9095
|
-
tokens.push(token);
|
|
9096
|
-
continue;
|
|
9097
|
-
}
|
|
9098
|
-
if (token = this.tokenizer.lheading(src)) {
|
|
9099
|
-
src = src.substring(token.raw.length);
|
|
9100
|
-
tokens.push(token);
|
|
9101
|
-
continue;
|
|
9102
|
-
}
|
|
9103
|
-
let cutSrc = src;
|
|
9104
|
-
if (this.options.extensions?.startBlock) {
|
|
9105
|
-
let startIndex = Infinity;
|
|
9106
|
-
const tempSrc = src.slice(1);
|
|
9107
|
-
let tempStart;
|
|
9108
|
-
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
9109
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
9110
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
9111
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
9112
|
-
}
|
|
9113
|
-
});
|
|
9114
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
9115
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
9066
|
+
case "html": {
|
|
9067
|
+
out += this.renderer.html(token);
|
|
9068
|
+
continue;
|
|
9116
9069
|
}
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
9121
|
-
lastToken.raw += "\n" + token.raw;
|
|
9122
|
-
lastToken.text += "\n" + token.text;
|
|
9123
|
-
this.inlineQueue.pop();
|
|
9124
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9125
|
-
} else {
|
|
9126
|
-
tokens.push(token);
|
|
9070
|
+
case "paragraph": {
|
|
9071
|
+
out += this.renderer.paragraph(token);
|
|
9072
|
+
continue;
|
|
9127
9073
|
}
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9074
|
+
case "text": {
|
|
9075
|
+
let textToken = token;
|
|
9076
|
+
let body = this.renderer.text(textToken);
|
|
9077
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
9078
|
+
textToken = tokens[++i];
|
|
9079
|
+
body += "\n" + this.renderer.text(textToken);
|
|
9080
|
+
}
|
|
9081
|
+
if (top) {
|
|
9082
|
+
out += this.renderer.paragraph({
|
|
9083
|
+
type: "paragraph",
|
|
9084
|
+
raw: body,
|
|
9085
|
+
text: body,
|
|
9086
|
+
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
9087
|
+
});
|
|
9088
|
+
} else {
|
|
9089
|
+
out += body;
|
|
9090
|
+
}
|
|
9091
|
+
continue;
|
|
9142
9092
|
}
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
throw new Error(errMsg);
|
|
9093
|
+
default: {
|
|
9094
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
9095
|
+
if (this.options.silent) {
|
|
9096
|
+
console.error(errMsg);
|
|
9097
|
+
return "";
|
|
9098
|
+
} else {
|
|
9099
|
+
throw new Error(errMsg);
|
|
9100
|
+
}
|
|
9152
9101
|
}
|
|
9153
9102
|
}
|
|
9154
9103
|
}
|
|
9155
|
-
|
|
9156
|
-
return tokens;
|
|
9157
|
-
}
|
|
9158
|
-
inline(src, tokens = []) {
|
|
9159
|
-
this.inlineQueue.push({ src, tokens });
|
|
9160
|
-
return tokens;
|
|
9104
|
+
return out;
|
|
9161
9105
|
}
|
|
9162
9106
|
/**
|
|
9163
|
-
*
|
|
9107
|
+
* Parse Inline Tokens
|
|
9164
9108
|
*/
|
|
9165
|
-
|
|
9166
|
-
let
|
|
9167
|
-
let
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
}
|
|
9109
|
+
parseInline(tokens, renderer = this.renderer) {
|
|
9110
|
+
let out = "";
|
|
9111
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
9112
|
+
const anyToken = tokens[i];
|
|
9113
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9114
|
+
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
9115
|
+
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
9116
|
+
out += ret || "";
|
|
9117
|
+
continue;
|
|
9175
9118
|
}
|
|
9176
9119
|
}
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
9183
|
-
}
|
|
9184
|
-
let keepPrevChar = false;
|
|
9185
|
-
let prevChar = "";
|
|
9186
|
-
while (src) {
|
|
9187
|
-
if (!keepPrevChar) {
|
|
9188
|
-
prevChar = "";
|
|
9189
|
-
}
|
|
9190
|
-
keepPrevChar = false;
|
|
9191
|
-
let token;
|
|
9192
|
-
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
9193
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
9194
|
-
src = src.substring(token.raw.length);
|
|
9195
|
-
tokens.push(token);
|
|
9196
|
-
return true;
|
|
9120
|
+
const token = anyToken;
|
|
9121
|
+
switch (token.type) {
|
|
9122
|
+
case "escape": {
|
|
9123
|
+
out += renderer.text(token);
|
|
9124
|
+
break;
|
|
9197
9125
|
}
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
}
|
|
9202
|
-
if (token = this.tokenizer.escape(src)) {
|
|
9203
|
-
src = src.substring(token.raw.length);
|
|
9204
|
-
tokens.push(token);
|
|
9205
|
-
continue;
|
|
9206
|
-
}
|
|
9207
|
-
if (token = this.tokenizer.tag(src)) {
|
|
9208
|
-
src = src.substring(token.raw.length);
|
|
9209
|
-
tokens.push(token);
|
|
9210
|
-
continue;
|
|
9211
|
-
}
|
|
9212
|
-
if (token = this.tokenizer.link(src)) {
|
|
9213
|
-
src = src.substring(token.raw.length);
|
|
9214
|
-
tokens.push(token);
|
|
9215
|
-
continue;
|
|
9216
|
-
}
|
|
9217
|
-
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
9218
|
-
src = src.substring(token.raw.length);
|
|
9219
|
-
const lastToken = tokens.at(-1);
|
|
9220
|
-
if (token.type === "text" && lastToken?.type === "text") {
|
|
9221
|
-
lastToken.raw += token.raw;
|
|
9222
|
-
lastToken.text += token.text;
|
|
9223
|
-
} else {
|
|
9224
|
-
tokens.push(token);
|
|
9126
|
+
case "html": {
|
|
9127
|
+
out += renderer.html(token);
|
|
9128
|
+
break;
|
|
9225
9129
|
}
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
src = src.substring(token.raw.length);
|
|
9230
|
-
tokens.push(token);
|
|
9231
|
-
continue;
|
|
9232
|
-
}
|
|
9233
|
-
if (token = this.tokenizer.codespan(src)) {
|
|
9234
|
-
src = src.substring(token.raw.length);
|
|
9235
|
-
tokens.push(token);
|
|
9236
|
-
continue;
|
|
9237
|
-
}
|
|
9238
|
-
if (token = this.tokenizer.br(src)) {
|
|
9239
|
-
src = src.substring(token.raw.length);
|
|
9240
|
-
tokens.push(token);
|
|
9241
|
-
continue;
|
|
9242
|
-
}
|
|
9243
|
-
if (token = this.tokenizer.del(src)) {
|
|
9244
|
-
src = src.substring(token.raw.length);
|
|
9245
|
-
tokens.push(token);
|
|
9246
|
-
continue;
|
|
9247
|
-
}
|
|
9248
|
-
if (token = this.tokenizer.autolink(src)) {
|
|
9249
|
-
src = src.substring(token.raw.length);
|
|
9250
|
-
tokens.push(token);
|
|
9251
|
-
continue;
|
|
9252
|
-
}
|
|
9253
|
-
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
9254
|
-
src = src.substring(token.raw.length);
|
|
9255
|
-
tokens.push(token);
|
|
9256
|
-
continue;
|
|
9257
|
-
}
|
|
9258
|
-
let cutSrc = src;
|
|
9259
|
-
if (this.options.extensions?.startInline) {
|
|
9260
|
-
let startIndex = Infinity;
|
|
9261
|
-
const tempSrc = src.slice(1);
|
|
9262
|
-
let tempStart;
|
|
9263
|
-
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
9264
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
9265
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
9266
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
9267
|
-
}
|
|
9268
|
-
});
|
|
9269
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
9270
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
9130
|
+
case "link": {
|
|
9131
|
+
out += renderer.link(token);
|
|
9132
|
+
break;
|
|
9271
9133
|
}
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
if (token.raw.slice(-1) !== "_") {
|
|
9276
|
-
prevChar = token.raw.slice(-1);
|
|
9134
|
+
case "image": {
|
|
9135
|
+
out += renderer.image(token);
|
|
9136
|
+
break;
|
|
9277
9137
|
}
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9138
|
+
case "strong": {
|
|
9139
|
+
out += renderer.strong(token);
|
|
9140
|
+
break;
|
|
9141
|
+
}
|
|
9142
|
+
case "em": {
|
|
9143
|
+
out += renderer.em(token);
|
|
9144
|
+
break;
|
|
9145
|
+
}
|
|
9146
|
+
case "codespan": {
|
|
9147
|
+
out += renderer.codespan(token);
|
|
9148
|
+
break;
|
|
9149
|
+
}
|
|
9150
|
+
case "br": {
|
|
9151
|
+
out += renderer.br(token);
|
|
9152
|
+
break;
|
|
9153
|
+
}
|
|
9154
|
+
case "del": {
|
|
9155
|
+
out += renderer.del(token);
|
|
9156
|
+
break;
|
|
9285
9157
|
}
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
if (src) {
|
|
9289
|
-
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
9290
|
-
if (this.options.silent) {
|
|
9291
|
-
console.error(errMsg);
|
|
9158
|
+
case "text": {
|
|
9159
|
+
out += renderer.text(token);
|
|
9292
9160
|
break;
|
|
9293
|
-
}
|
|
9294
|
-
|
|
9161
|
+
}
|
|
9162
|
+
default: {
|
|
9163
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
9164
|
+
if (this.options.silent) {
|
|
9165
|
+
console.error(errMsg);
|
|
9166
|
+
return "";
|
|
9167
|
+
} else {
|
|
9168
|
+
throw new Error(errMsg);
|
|
9169
|
+
}
|
|
9295
9170
|
}
|
|
9296
9171
|
}
|
|
9297
9172
|
}
|
|
9298
|
-
return
|
|
9173
|
+
return out;
|
|
9299
9174
|
}
|
|
9300
9175
|
};
|
|
9301
9176
|
|
|
9302
|
-
// src/
|
|
9303
|
-
var
|
|
9177
|
+
// src/Hooks.ts
|
|
9178
|
+
var _Hooks = class {
|
|
9304
9179
|
options;
|
|
9305
|
-
|
|
9306
|
-
// set by the parser
|
|
9180
|
+
block;
|
|
9307
9181
|
constructor(options2) {
|
|
9308
9182
|
this.options = options2 || _defaults;
|
|
9309
9183
|
}
|
|
9310
|
-
|
|
9311
|
-
|
|
9184
|
+
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
9185
|
+
"preprocess",
|
|
9186
|
+
"postprocess",
|
|
9187
|
+
"processAllTokens"
|
|
9188
|
+
]);
|
|
9189
|
+
/**
|
|
9190
|
+
* Process markdown before marked
|
|
9191
|
+
*/
|
|
9192
|
+
preprocess(markdown) {
|
|
9193
|
+
return markdown;
|
|
9312
9194
|
}
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
}
|
|
9319
|
-
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
9195
|
+
/**
|
|
9196
|
+
* Process HTML after marked is finished
|
|
9197
|
+
*/
|
|
9198
|
+
postprocess(html2) {
|
|
9199
|
+
return html2;
|
|
9320
9200
|
}
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9201
|
+
/**
|
|
9202
|
+
* Process all tokens before walk tokens
|
|
9203
|
+
*/
|
|
9204
|
+
processAllTokens(tokens) {
|
|
9205
|
+
return tokens;
|
|
9326
9206
|
}
|
|
9327
|
-
|
|
9328
|
-
|
|
9207
|
+
/**
|
|
9208
|
+
* Provide function to tokenize markdown
|
|
9209
|
+
*/
|
|
9210
|
+
provideLexer() {
|
|
9211
|
+
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
9329
9212
|
}
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9213
|
+
/**
|
|
9214
|
+
* Provide function to parse tokens
|
|
9215
|
+
*/
|
|
9216
|
+
provideParser() {
|
|
9217
|
+
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
9333
9218
|
}
|
|
9334
|
-
|
|
9335
|
-
|
|
9219
|
+
};
|
|
9220
|
+
|
|
9221
|
+
// src/Instance.ts
|
|
9222
|
+
var Marked = class {
|
|
9223
|
+
defaults = _getDefaults();
|
|
9224
|
+
options = this.setOptions;
|
|
9225
|
+
parse = this.parseMarkdown(true);
|
|
9226
|
+
parseInline = this.parseMarkdown(false);
|
|
9227
|
+
Parser = _Parser;
|
|
9228
|
+
Renderer = _Renderer;
|
|
9229
|
+
TextRenderer = _TextRenderer;
|
|
9230
|
+
Lexer = _Lexer;
|
|
9231
|
+
Tokenizer = _Tokenizer;
|
|
9232
|
+
Hooks = _Hooks;
|
|
9233
|
+
constructor(...args) {
|
|
9234
|
+
this.use(...args);
|
|
9336
9235
|
}
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9236
|
+
/**
|
|
9237
|
+
* Run callback for every token
|
|
9238
|
+
*/
|
|
9239
|
+
walkTokens(tokens, callback) {
|
|
9240
|
+
let values = [];
|
|
9241
|
+
for (const token of tokens) {
|
|
9242
|
+
values = values.concat(callback.call(this, token));
|
|
9243
|
+
switch (token.type) {
|
|
9244
|
+
case "table": {
|
|
9245
|
+
const tableToken = token;
|
|
9246
|
+
for (const cell of tableToken.header) {
|
|
9247
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9248
|
+
}
|
|
9249
|
+
for (const row of tableToken.rows) {
|
|
9250
|
+
for (const cell of row) {
|
|
9251
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9252
|
+
}
|
|
9253
|
+
}
|
|
9254
|
+
break;
|
|
9255
|
+
}
|
|
9256
|
+
case "list": {
|
|
9257
|
+
const listToken = token;
|
|
9258
|
+
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
9259
|
+
break;
|
|
9260
|
+
}
|
|
9261
|
+
default: {
|
|
9262
|
+
const genericToken = token;
|
|
9263
|
+
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
9264
|
+
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
9265
|
+
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
9266
|
+
values = values.concat(this.walkTokens(tokens2, callback));
|
|
9267
|
+
});
|
|
9268
|
+
} else if (genericToken.tokens) {
|
|
9269
|
+
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
9270
|
+
}
|
|
9271
|
+
}
|
|
9272
|
+
}
|
|
9344
9273
|
}
|
|
9345
|
-
|
|
9346
|
-
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
9347
|
-
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
9274
|
+
return values;
|
|
9348
9275
|
}
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
const
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
if (
|
|
9357
|
-
|
|
9358
|
-
|
|
9276
|
+
use(...args) {
|
|
9277
|
+
const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
9278
|
+
args.forEach((pack) => {
|
|
9279
|
+
const opts = { ...pack };
|
|
9280
|
+
opts.async = this.defaults.async || opts.async || false;
|
|
9281
|
+
if (pack.extensions) {
|
|
9282
|
+
pack.extensions.forEach((ext) => {
|
|
9283
|
+
if (!ext.name) {
|
|
9284
|
+
throw new Error("extension name required");
|
|
9285
|
+
}
|
|
9286
|
+
if ("renderer" in ext) {
|
|
9287
|
+
const prevRenderer = extensions.renderers[ext.name];
|
|
9288
|
+
if (prevRenderer) {
|
|
9289
|
+
extensions.renderers[ext.name] = function(...args2) {
|
|
9290
|
+
let ret = ext.renderer.apply(this, args2);
|
|
9291
|
+
if (ret === false) {
|
|
9292
|
+
ret = prevRenderer.apply(this, args2);
|
|
9293
|
+
}
|
|
9294
|
+
return ret;
|
|
9295
|
+
};
|
|
9296
|
+
} else {
|
|
9297
|
+
extensions.renderers[ext.name] = ext.renderer;
|
|
9298
|
+
}
|
|
9299
|
+
}
|
|
9300
|
+
if ("tokenizer" in ext) {
|
|
9301
|
+
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
|
|
9302
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
9303
|
+
}
|
|
9304
|
+
const extLevel = extensions[ext.level];
|
|
9305
|
+
if (extLevel) {
|
|
9306
|
+
extLevel.unshift(ext.tokenizer);
|
|
9307
|
+
} else {
|
|
9308
|
+
extensions[ext.level] = [ext.tokenizer];
|
|
9309
|
+
}
|
|
9310
|
+
if (ext.start) {
|
|
9311
|
+
if (ext.level === "block") {
|
|
9312
|
+
if (extensions.startBlock) {
|
|
9313
|
+
extensions.startBlock.push(ext.start);
|
|
9314
|
+
} else {
|
|
9315
|
+
extensions.startBlock = [ext.start];
|
|
9316
|
+
}
|
|
9317
|
+
} else if (ext.level === "inline") {
|
|
9318
|
+
if (extensions.startInline) {
|
|
9319
|
+
extensions.startInline.push(ext.start);
|
|
9320
|
+
} else {
|
|
9321
|
+
extensions.startInline = [ext.start];
|
|
9322
|
+
}
|
|
9323
|
+
}
|
|
9324
|
+
}
|
|
9325
|
+
}
|
|
9326
|
+
if ("childTokens" in ext && ext.childTokens) {
|
|
9327
|
+
extensions.childTokens[ext.name] = ext.childTokens;
|
|
9328
|
+
}
|
|
9329
|
+
});
|
|
9330
|
+
opts.extensions = extensions;
|
|
9331
|
+
}
|
|
9332
|
+
if (pack.renderer) {
|
|
9333
|
+
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
9334
|
+
for (const prop in pack.renderer) {
|
|
9335
|
+
if (!(prop in renderer)) {
|
|
9336
|
+
throw new Error(`renderer '${prop}' does not exist`);
|
|
9337
|
+
}
|
|
9338
|
+
if (["options", "parser"].includes(prop)) {
|
|
9339
|
+
continue;
|
|
9340
|
+
}
|
|
9341
|
+
const rendererProp = prop;
|
|
9342
|
+
const rendererFunc = pack.renderer[rendererProp];
|
|
9343
|
+
const prevRenderer = renderer[rendererProp];
|
|
9344
|
+
renderer[rendererProp] = (...args2) => {
|
|
9345
|
+
let ret = rendererFunc.apply(renderer, args2);
|
|
9346
|
+
if (ret === false) {
|
|
9347
|
+
ret = prevRenderer.apply(renderer, args2);
|
|
9348
|
+
}
|
|
9349
|
+
return ret || "";
|
|
9350
|
+
};
|
|
9351
|
+
}
|
|
9352
|
+
opts.renderer = renderer;
|
|
9353
|
+
}
|
|
9354
|
+
if (pack.tokenizer) {
|
|
9355
|
+
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
9356
|
+
for (const prop in pack.tokenizer) {
|
|
9357
|
+
if (!(prop in tokenizer)) {
|
|
9358
|
+
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
9359
|
+
}
|
|
9360
|
+
if (["options", "rules", "lexer"].includes(prop)) {
|
|
9361
|
+
continue;
|
|
9362
|
+
}
|
|
9363
|
+
const tokenizerProp = prop;
|
|
9364
|
+
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
9365
|
+
const prevTokenizer = tokenizer[tokenizerProp];
|
|
9366
|
+
tokenizer[tokenizerProp] = (...args2) => {
|
|
9367
|
+
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
9368
|
+
if (ret === false) {
|
|
9369
|
+
ret = prevTokenizer.apply(tokenizer, args2);
|
|
9370
|
+
}
|
|
9371
|
+
return ret;
|
|
9372
|
+
};
|
|
9373
|
+
}
|
|
9374
|
+
opts.tokenizer = tokenizer;
|
|
9375
|
+
}
|
|
9376
|
+
if (pack.hooks) {
|
|
9377
|
+
const hooks = this.defaults.hooks || new _Hooks();
|
|
9378
|
+
for (const prop in pack.hooks) {
|
|
9379
|
+
if (!(prop in hooks)) {
|
|
9380
|
+
throw new Error(`hook '${prop}' does not exist`);
|
|
9381
|
+
}
|
|
9382
|
+
if (["options", "block"].includes(prop)) {
|
|
9383
|
+
continue;
|
|
9384
|
+
}
|
|
9385
|
+
const hooksProp = prop;
|
|
9386
|
+
const hooksFunc = pack.hooks[hooksProp];
|
|
9387
|
+
const prevHook = hooks[hooksProp];
|
|
9388
|
+
if (_Hooks.passThroughHooks.has(prop)) {
|
|
9389
|
+
hooks[hooksProp] = (arg) => {
|
|
9390
|
+
if (this.defaults.async) {
|
|
9391
|
+
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
|
9392
|
+
return prevHook.call(hooks, ret2);
|
|
9393
|
+
});
|
|
9394
|
+
}
|
|
9395
|
+
const ret = hooksFunc.call(hooks, arg);
|
|
9396
|
+
return prevHook.call(hooks, ret);
|
|
9397
|
+
};
|
|
9398
|
+
} else {
|
|
9399
|
+
hooks[hooksProp] = (...args2) => {
|
|
9400
|
+
let ret = hooksFunc.apply(hooks, args2);
|
|
9401
|
+
if (ret === false) {
|
|
9402
|
+
ret = prevHook.apply(hooks, args2);
|
|
9403
|
+
}
|
|
9404
|
+
return ret;
|
|
9405
|
+
};
|
|
9359
9406
|
}
|
|
9360
|
-
} else {
|
|
9361
|
-
item.tokens.unshift({
|
|
9362
|
-
type: "text",
|
|
9363
|
-
raw: checkbox + " ",
|
|
9364
|
-
text: checkbox + " ",
|
|
9365
|
-
escaped: true
|
|
9366
|
-
});
|
|
9367
9407
|
}
|
|
9368
|
-
|
|
9369
|
-
itemBody += checkbox + " ";
|
|
9408
|
+
opts.hooks = hooks;
|
|
9370
9409
|
}
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
}
|
|
9383
|
-
table(token) {
|
|
9384
|
-
let header = "";
|
|
9385
|
-
let cell = "";
|
|
9386
|
-
for (let j = 0; j < token.header.length; j++) {
|
|
9387
|
-
cell += this.tablecell(token.header[j]);
|
|
9388
|
-
}
|
|
9389
|
-
header += this.tablerow({ text: cell });
|
|
9390
|
-
let body = "";
|
|
9391
|
-
for (let j = 0; j < token.rows.length; j++) {
|
|
9392
|
-
const row = token.rows[j];
|
|
9393
|
-
cell = "";
|
|
9394
|
-
for (let k = 0; k < row.length; k++) {
|
|
9395
|
-
cell += this.tablecell(row[k]);
|
|
9410
|
+
if (pack.walkTokens) {
|
|
9411
|
+
const walkTokens2 = this.defaults.walkTokens;
|
|
9412
|
+
const packWalktokens = pack.walkTokens;
|
|
9413
|
+
opts.walkTokens = function(token) {
|
|
9414
|
+
let values = [];
|
|
9415
|
+
values.push(packWalktokens.call(this, token));
|
|
9416
|
+
if (walkTokens2) {
|
|
9417
|
+
values = values.concat(walkTokens2.call(this, token));
|
|
9418
|
+
}
|
|
9419
|
+
return values;
|
|
9420
|
+
};
|
|
9396
9421
|
}
|
|
9397
|
-
|
|
9398
|
-
}
|
|
9399
|
-
|
|
9400
|
-
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
9401
|
-
}
|
|
9402
|
-
tablerow({ text }) {
|
|
9403
|
-
return `<tr>
|
|
9404
|
-
${text}</tr>
|
|
9405
|
-
`;
|
|
9406
|
-
}
|
|
9407
|
-
tablecell(token) {
|
|
9408
|
-
const content = this.parser.parseInline(token.tokens);
|
|
9409
|
-
const type = token.header ? "th" : "td";
|
|
9410
|
-
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
9411
|
-
return tag2 + content + `</${type}>
|
|
9412
|
-
`;
|
|
9413
|
-
}
|
|
9414
|
-
/**
|
|
9415
|
-
* span level renderer
|
|
9416
|
-
*/
|
|
9417
|
-
strong({ tokens }) {
|
|
9418
|
-
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
9419
|
-
}
|
|
9420
|
-
em({ tokens }) {
|
|
9421
|
-
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
9422
|
-
}
|
|
9423
|
-
codespan({ text }) {
|
|
9424
|
-
return `<code>${escape2(text, true)}</code>`;
|
|
9425
|
-
}
|
|
9426
|
-
br(token) {
|
|
9427
|
-
return "<br>";
|
|
9428
|
-
}
|
|
9429
|
-
del({ tokens }) {
|
|
9430
|
-
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
9431
|
-
}
|
|
9432
|
-
link({ href, title, tokens }) {
|
|
9433
|
-
const text = this.parser.parseInline(tokens);
|
|
9434
|
-
const cleanHref = cleanUrl(href);
|
|
9435
|
-
if (cleanHref === null) {
|
|
9436
|
-
return text;
|
|
9437
|
-
}
|
|
9438
|
-
href = cleanHref;
|
|
9439
|
-
let out = '<a href="' + href + '"';
|
|
9440
|
-
if (title) {
|
|
9441
|
-
out += ' title="' + escape2(title) + '"';
|
|
9442
|
-
}
|
|
9443
|
-
out += ">" + text + "</a>";
|
|
9444
|
-
return out;
|
|
9445
|
-
}
|
|
9446
|
-
image({ href, title, text, tokens }) {
|
|
9447
|
-
if (tokens) {
|
|
9448
|
-
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
9449
|
-
}
|
|
9450
|
-
const cleanHref = cleanUrl(href);
|
|
9451
|
-
if (cleanHref === null) {
|
|
9452
|
-
return escape2(text);
|
|
9453
|
-
}
|
|
9454
|
-
href = cleanHref;
|
|
9455
|
-
let out = `<img src="${href}" alt="${text}"`;
|
|
9456
|
-
if (title) {
|
|
9457
|
-
out += ` title="${escape2(title)}"`;
|
|
9458
|
-
}
|
|
9459
|
-
out += ">";
|
|
9460
|
-
return out;
|
|
9461
|
-
}
|
|
9462
|
-
text(token) {
|
|
9463
|
-
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
9464
|
-
}
|
|
9465
|
-
};
|
|
9466
|
-
|
|
9467
|
-
// src/TextRenderer.ts
|
|
9468
|
-
var _TextRenderer = class {
|
|
9469
|
-
// no need for block level renderers
|
|
9470
|
-
strong({ text }) {
|
|
9471
|
-
return text;
|
|
9472
|
-
}
|
|
9473
|
-
em({ text }) {
|
|
9474
|
-
return text;
|
|
9475
|
-
}
|
|
9476
|
-
codespan({ text }) {
|
|
9477
|
-
return text;
|
|
9478
|
-
}
|
|
9479
|
-
del({ text }) {
|
|
9480
|
-
return text;
|
|
9481
|
-
}
|
|
9482
|
-
html({ text }) {
|
|
9483
|
-
return text;
|
|
9484
|
-
}
|
|
9485
|
-
text({ text }) {
|
|
9486
|
-
return text;
|
|
9487
|
-
}
|
|
9488
|
-
link({ text }) {
|
|
9489
|
-
return "" + text;
|
|
9490
|
-
}
|
|
9491
|
-
image({ text }) {
|
|
9492
|
-
return "" + text;
|
|
9493
|
-
}
|
|
9494
|
-
br() {
|
|
9495
|
-
return "";
|
|
9422
|
+
this.defaults = { ...this.defaults, ...opts };
|
|
9423
|
+
});
|
|
9424
|
+
return this;
|
|
9496
9425
|
}
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
var _Parser = class __Parser {
|
|
9501
|
-
options;
|
|
9502
|
-
renderer;
|
|
9503
|
-
textRenderer;
|
|
9504
|
-
constructor(options2) {
|
|
9505
|
-
this.options = options2 || _defaults;
|
|
9506
|
-
this.options.renderer = this.options.renderer || new _Renderer();
|
|
9507
|
-
this.renderer = this.options.renderer;
|
|
9508
|
-
this.renderer.options = this.options;
|
|
9509
|
-
this.renderer.parser = this;
|
|
9510
|
-
this.textRenderer = new _TextRenderer();
|
|
9426
|
+
setOptions(opt) {
|
|
9427
|
+
this.defaults = { ...this.defaults, ...opt };
|
|
9428
|
+
return this;
|
|
9511
9429
|
}
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
*/
|
|
9515
|
-
static parse(tokens, options2) {
|
|
9516
|
-
const parser2 = new __Parser(options2);
|
|
9517
|
-
return parser2.parse(tokens);
|
|
9430
|
+
lexer(src, options2) {
|
|
9431
|
+
return _Lexer.lex(src, options2 ?? this.defaults);
|
|
9518
9432
|
}
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
*/
|
|
9522
|
-
static parseInline(tokens, options2) {
|
|
9523
|
-
const parser2 = new __Parser(options2);
|
|
9524
|
-
return parser2.parseInline(tokens);
|
|
9433
|
+
parser(tokens, options2) {
|
|
9434
|
+
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
9525
9435
|
}
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9534
|
-
const genericToken = anyToken;
|
|
9535
|
-
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
9536
|
-
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
9537
|
-
out += ret || "";
|
|
9538
|
-
continue;
|
|
9539
|
-
}
|
|
9436
|
+
parseMarkdown(blockType) {
|
|
9437
|
+
const parse2 = (src, options2) => {
|
|
9438
|
+
const origOpt = { ...options2 };
|
|
9439
|
+
const opt = { ...this.defaults, ...origOpt };
|
|
9440
|
+
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
9441
|
+
if (this.defaults.async === true && origOpt.async === false) {
|
|
9442
|
+
return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
9540
9443
|
}
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9444
|
+
if (typeof src === "undefined" || src === null) {
|
|
9445
|
+
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
9446
|
+
}
|
|
9447
|
+
if (typeof src !== "string") {
|
|
9448
|
+
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
9449
|
+
}
|
|
9450
|
+
if (opt.hooks) {
|
|
9451
|
+
opt.hooks.options = opt;
|
|
9452
|
+
opt.hooks.block = blockType;
|
|
9453
|
+
}
|
|
9454
|
+
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
9455
|
+
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
9456
|
+
if (opt.async) {
|
|
9457
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
9458
|
+
}
|
|
9459
|
+
try {
|
|
9460
|
+
if (opt.hooks) {
|
|
9461
|
+
src = opt.hooks.preprocess(src);
|
|
9550
9462
|
}
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9463
|
+
let tokens = lexer2(src, opt);
|
|
9464
|
+
if (opt.hooks) {
|
|
9465
|
+
tokens = opt.hooks.processAllTokens(tokens);
|
|
9554
9466
|
}
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
continue;
|
|
9467
|
+
if (opt.walkTokens) {
|
|
9468
|
+
this.walkTokens(tokens, opt.walkTokens);
|
|
9558
9469
|
}
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9470
|
+
let html2 = parser2(tokens, opt);
|
|
9471
|
+
if (opt.hooks) {
|
|
9472
|
+
html2 = opt.hooks.postprocess(html2);
|
|
9562
9473
|
}
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9474
|
+
return html2;
|
|
9475
|
+
} catch (e) {
|
|
9476
|
+
return throwError(e);
|
|
9477
|
+
}
|
|
9478
|
+
};
|
|
9479
|
+
return parse2;
|
|
9480
|
+
}
|
|
9481
|
+
onError(silent, async) {
|
|
9482
|
+
return (e) => {
|
|
9483
|
+
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
9484
|
+
if (silent) {
|
|
9485
|
+
const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>";
|
|
9486
|
+
if (async) {
|
|
9487
|
+
return Promise.resolve(msg);
|
|
9566
9488
|
}
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9489
|
+
return msg;
|
|
9490
|
+
}
|
|
9491
|
+
if (async) {
|
|
9492
|
+
return Promise.reject(e);
|
|
9493
|
+
}
|
|
9494
|
+
throw e;
|
|
9495
|
+
};
|
|
9496
|
+
}
|
|
9497
|
+
};
|
|
9498
|
+
|
|
9499
|
+
// src/marked.ts
|
|
9500
|
+
var markedInstance = new Marked();
|
|
9501
|
+
function marked(src, opt) {
|
|
9502
|
+
return markedInstance.parse(src, opt);
|
|
9503
|
+
}
|
|
9504
|
+
marked.options = marked.setOptions = function(options2) {
|
|
9505
|
+
markedInstance.setOptions(options2);
|
|
9506
|
+
marked.defaults = markedInstance.defaults;
|
|
9507
|
+
changeDefaults(marked.defaults);
|
|
9508
|
+
return marked;
|
|
9509
|
+
};
|
|
9510
|
+
marked.getDefaults = _getDefaults;
|
|
9511
|
+
marked.defaults = _defaults;
|
|
9512
|
+
marked.use = function(...args) {
|
|
9513
|
+
markedInstance.use(...args);
|
|
9514
|
+
marked.defaults = markedInstance.defaults;
|
|
9515
|
+
changeDefaults(marked.defaults);
|
|
9516
|
+
return marked;
|
|
9517
|
+
};
|
|
9518
|
+
marked.walkTokens = function(tokens, callback) {
|
|
9519
|
+
return markedInstance.walkTokens(tokens, callback);
|
|
9520
|
+
};
|
|
9521
|
+
marked.parseInline = markedInstance.parseInline;
|
|
9522
|
+
marked.Parser = _Parser;
|
|
9523
|
+
marked.parser = _Parser.parse;
|
|
9524
|
+
marked.Renderer = _Renderer;
|
|
9525
|
+
marked.TextRenderer = _TextRenderer;
|
|
9526
|
+
marked.Lexer = _Lexer;
|
|
9527
|
+
marked.lexer = _Lexer.lex;
|
|
9528
|
+
marked.Tokenizer = _Tokenizer;
|
|
9529
|
+
marked.Hooks = _Hooks;
|
|
9530
|
+
marked.parse = marked;
|
|
9531
|
+
|
|
9532
|
+
/**
|
|
9533
|
+
* This component renders a results summary for RAG search result summaries.
|
|
9534
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
9535
|
+
* rendered in this box.
|
|
9536
|
+
*
|
|
9537
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
9538
|
+
*
|
|
9539
|
+
* @react-import
|
|
9540
|
+
* ```jsx
|
|
9541
|
+
* import { SearchcraftResultsSummary } from "@searchcraft/react-sdk";
|
|
9542
|
+
* ```
|
|
9543
|
+
*
|
|
9544
|
+
* @vue-import
|
|
9545
|
+
* ```ts
|
|
9546
|
+
* import { SearchcraftResultsSummary } from "@searchcraft/vue-sdk";
|
|
9547
|
+
* ```
|
|
9548
|
+
*
|
|
9549
|
+
* @js-example
|
|
9550
|
+
* ```html
|
|
9551
|
+
* <searchcraft-results-summary />
|
|
9552
|
+
* ```
|
|
9553
|
+
*
|
|
9554
|
+
* @react-example
|
|
9555
|
+
* ```jsx
|
|
9556
|
+
* <SearchcraftResultsSummary />
|
|
9557
|
+
* ```
|
|
9558
|
+
*
|
|
9559
|
+
* @vue-example
|
|
9560
|
+
* ```jsx
|
|
9561
|
+
* <SearchcraftResultsSummary />
|
|
9562
|
+
* ```
|
|
9563
|
+
*/
|
|
9564
|
+
class SearchcraftResultsSummary {
|
|
9565
|
+
constructor(hostRef) {
|
|
9566
|
+
registerInstance(this, hostRef);
|
|
9567
|
+
}
|
|
9568
|
+
/**
|
|
9569
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9570
|
+
*/
|
|
9571
|
+
searchcraftId;
|
|
9572
|
+
summary = '';
|
|
9573
|
+
summaryErrorMessage = '';
|
|
9574
|
+
isLoading = false;
|
|
9575
|
+
isSummaryNotEnabled = false;
|
|
9576
|
+
unsubscribe;
|
|
9577
|
+
cleanupCore;
|
|
9578
|
+
/**
|
|
9579
|
+
* Callback invoked when the Searchcraft core instance is available.
|
|
9580
|
+
*/
|
|
9581
|
+
onCoreAvailable(core) {
|
|
9582
|
+
core.store.setState({ hasSummaryBox: true });
|
|
9583
|
+
this.unsubscribe = core.store.subscribe(this.handleStateChange.bind(this));
|
|
9584
|
+
}
|
|
9585
|
+
connectedCallback() {
|
|
9586
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9587
|
+
}
|
|
9588
|
+
disconnectedCallback() {
|
|
9589
|
+
this.unsubscribe?.();
|
|
9590
|
+
this.cleanupCore?.();
|
|
9591
|
+
}
|
|
9592
|
+
/**
|
|
9593
|
+
* Handles state changes from the store and updates component state.
|
|
9594
|
+
*/
|
|
9595
|
+
handleStateChange(state) {
|
|
9596
|
+
this.isLoading = state.isSummaryLoading;
|
|
9597
|
+
this.isSummaryNotEnabled = state.isSummaryNotEnabled;
|
|
9598
|
+
this.summaryErrorMessage = state.summaryErrorMessage;
|
|
9599
|
+
this.summary = this.sanitizeMarkdown(state.summary);
|
|
9600
|
+
}
|
|
9601
|
+
/**
|
|
9602
|
+
* Sanitizes and converts markdown to HTML.
|
|
9603
|
+
*/
|
|
9604
|
+
sanitizeMarkdown(markdown) {
|
|
9605
|
+
return purify.sanitize(marked.parse(markdown));
|
|
9606
|
+
}
|
|
9607
|
+
/**
|
|
9608
|
+
* Renders the appropriate content based on current state.
|
|
9609
|
+
*/
|
|
9610
|
+
renderContent() {
|
|
9611
|
+
if (this.isLoading) {
|
|
9612
|
+
return hAsync("searchcraft-loading", { label: 'LOADING' });
|
|
9570
9613
|
}
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
continue;
|
|
9614
|
+
if (this.isSummaryNotEnabled) {
|
|
9615
|
+
return (hAsync("div", { class: 'searchcraft-results-summary-content' }, this.summaryErrorMessage || 'AI summaries are not enabled'));
|
|
9574
9616
|
}
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9617
|
+
return (hAsync("div", { class: 'searchcraft-results-summary-content', innerHTML: this.summary, "aria-live": "polite" }));
|
|
9618
|
+
}
|
|
9619
|
+
render() {
|
|
9620
|
+
return (hAsync("div", { key: '4fabef16a76b57d737aa47fcf106c7375d19a5bc', class: 'searchcraft-results-summary' }, this.renderContent()));
|
|
9621
|
+
}
|
|
9622
|
+
static get cmpMeta() { return {
|
|
9623
|
+
"$flags$": 768,
|
|
9624
|
+
"$tagName$": "searchcraft-results-summary",
|
|
9625
|
+
"$members$": {
|
|
9626
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9627
|
+
"summary": [32],
|
|
9628
|
+
"summaryErrorMessage": [32],
|
|
9629
|
+
"isLoading": [32],
|
|
9630
|
+
"isSummaryNotEnabled": [32]
|
|
9631
|
+
},
|
|
9632
|
+
"$listeners$": undefined,
|
|
9633
|
+
"$lazyBundleId$": "-",
|
|
9634
|
+
"$attrsToReflect$": []
|
|
9635
|
+
}; }
|
|
9636
|
+
}
|
|
9637
|
+
|
|
9638
|
+
/**
|
|
9639
|
+
* This web component is designed to display detailed information for a single search result. Once a query is submitted, the component formats and presents the result.
|
|
9640
|
+
*
|
|
9641
|
+
* @internal
|
|
9642
|
+
*/
|
|
9643
|
+
class SearchcraftSearchResult {
|
|
9644
|
+
constructor(hostRef) {
|
|
9645
|
+
registerInstance(this, hostRef);
|
|
9646
|
+
}
|
|
9647
|
+
item;
|
|
9648
|
+
/**
|
|
9649
|
+
* The index.
|
|
9650
|
+
*/
|
|
9651
|
+
index;
|
|
9652
|
+
/**
|
|
9653
|
+
* The position in the document. Used with the "document_clicked" measure event.
|
|
9654
|
+
*/
|
|
9655
|
+
documentPosition = 0;
|
|
9656
|
+
/**
|
|
9657
|
+
* A callback function responsible for rendering a result.
|
|
9658
|
+
*/
|
|
9659
|
+
template;
|
|
9660
|
+
/**
|
|
9661
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9662
|
+
*/
|
|
9663
|
+
searchcraftId;
|
|
9664
|
+
templateHtml;
|
|
9665
|
+
get hostElement() { return getElement(this); }
|
|
9666
|
+
core;
|
|
9667
|
+
cleanupCore;
|
|
9668
|
+
onCoreAvailable(core) {
|
|
9669
|
+
this.core = core;
|
|
9670
|
+
}
|
|
9671
|
+
connectedCallback() {
|
|
9672
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9673
|
+
if (this.item) {
|
|
9674
|
+
try {
|
|
9675
|
+
this.templateHtml = this.template?.(this.item.document, this.index, {
|
|
9676
|
+
html: html$1,
|
|
9677
|
+
source_index: this.item.source_index,
|
|
9678
|
+
});
|
|
9679
|
+
}
|
|
9680
|
+
catch (error) {
|
|
9681
|
+
console.error('Invalid search result template:', error);
|
|
9682
|
+
}
|
|
9578
9683
|
}
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
if (top) {
|
|
9587
|
-
out += this.renderer.paragraph({
|
|
9588
|
-
type: "paragraph",
|
|
9589
|
-
raw: body,
|
|
9590
|
-
text: body,
|
|
9591
|
-
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
9592
|
-
});
|
|
9593
|
-
} else {
|
|
9594
|
-
out += body;
|
|
9595
|
-
}
|
|
9596
|
-
continue;
|
|
9684
|
+
}
|
|
9685
|
+
disconnectedCallback() {
|
|
9686
|
+
this.cleanupCore?.();
|
|
9687
|
+
}
|
|
9688
|
+
handleResultContainerClick = (event) => {
|
|
9689
|
+
if (!event.target) {
|
|
9690
|
+
return;
|
|
9597
9691
|
}
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
}
|
|
9692
|
+
const target = event.target;
|
|
9693
|
+
const link = target.closest('a');
|
|
9694
|
+
if (!link ||
|
|
9695
|
+
!this.hostElement?.contains(link) ||
|
|
9696
|
+
!this.core ||
|
|
9697
|
+
!this.core.measureClient) {
|
|
9698
|
+
return;
|
|
9606
9699
|
}
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
9621
|
-
out += ret || "";
|
|
9622
|
-
continue;
|
|
9700
|
+
const document_position = this.documentPosition;
|
|
9701
|
+
const search_term = this.core.store.getState().searchTerm;
|
|
9702
|
+
const number_of_documents = this.core.store.getState().searchClientResponseItems.length || 0;
|
|
9703
|
+
this.core.measureClient.sendMeasureEvent('document_clicked', {
|
|
9704
|
+
document_position,
|
|
9705
|
+
number_of_documents,
|
|
9706
|
+
search_term,
|
|
9707
|
+
});
|
|
9708
|
+
};
|
|
9709
|
+
handleKeyDown = () => { };
|
|
9710
|
+
render() {
|
|
9711
|
+
if (!this.item) {
|
|
9712
|
+
return;
|
|
9623
9713
|
}
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
switch (token.type) {
|
|
9627
|
-
case "escape": {
|
|
9628
|
-
out += renderer.text(token);
|
|
9629
|
-
break;
|
|
9714
|
+
if (typeof this.template === 'undefined') {
|
|
9715
|
+
return (hAsync("div", { class: 'searchcraft-search-result searchcraft-search-result-no-template', onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }, Object.entries(this.item.document).map(([key, value]) => (hAsync("p", { key: key }, hAsync("strong", null, key), ": ", value)))));
|
|
9630
9716
|
}
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9717
|
+
return (hAsync("div", { class: 'searchcraft-search-result', innerHTML: this.templateHtml, onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }));
|
|
9718
|
+
}
|
|
9719
|
+
static get cmpMeta() { return {
|
|
9720
|
+
"$flags$": 768,
|
|
9721
|
+
"$tagName$": "searchcraft-search-result",
|
|
9722
|
+
"$members$": {
|
|
9723
|
+
"item": [16],
|
|
9724
|
+
"index": [2],
|
|
9725
|
+
"documentPosition": [2, "document-position"],
|
|
9726
|
+
"template": [16],
|
|
9727
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9728
|
+
"templateHtml": [32]
|
|
9729
|
+
},
|
|
9730
|
+
"$listeners$": undefined,
|
|
9731
|
+
"$lazyBundleId$": "-",
|
|
9732
|
+
"$attrsToReflect$": []
|
|
9733
|
+
}; }
|
|
9734
|
+
}
|
|
9735
|
+
|
|
9736
|
+
/**
|
|
9737
|
+
* This web component is responsible for displaying the results of a search query. Once a query is submitted, the component formats and presents an ordered list of the results.
|
|
9738
|
+
*
|
|
9739
|
+
*
|
|
9740
|
+
* @react-import
|
|
9741
|
+
* ```jsx
|
|
9742
|
+
* import { SearchcraftSearchResults } from "@searchcraft/react-sdk";
|
|
9743
|
+
* ```
|
|
9744
|
+
*
|
|
9745
|
+
* @vue-import
|
|
9746
|
+
* ```jsx
|
|
9747
|
+
* import { SearchcraftSearchResults } from "@searchcraft/vue-sdk";
|
|
9748
|
+
* ```
|
|
9749
|
+
*
|
|
9750
|
+
* @js-example
|
|
9751
|
+
* ```html
|
|
9752
|
+
* <!-- index.html -->
|
|
9753
|
+
* <searchcraft-search-results
|
|
9754
|
+
* ad-interval="4"
|
|
9755
|
+
* place-ad-at-start="true"
|
|
9756
|
+
* />
|
|
9757
|
+
* ```
|
|
9758
|
+
*
|
|
9759
|
+
* ```js
|
|
9760
|
+
* // index.js
|
|
9761
|
+
* const searchResults = document.querySelector('searchcraft-search-results');
|
|
9762
|
+
*
|
|
9763
|
+
* searchResults.template = (item, index, { html }) => html`
|
|
9764
|
+
* <h2>${item.title}</h2>
|
|
9765
|
+
* `;
|
|
9766
|
+
* ```
|
|
9767
|
+
*
|
|
9768
|
+
* @react-example
|
|
9769
|
+
* ```jsx
|
|
9770
|
+
* <SearchcraftSearchResults
|
|
9771
|
+
* adInterval={4}
|
|
9772
|
+
* placeAdAtState={true}
|
|
9773
|
+
* template={(item, index, { html }) => html`
|
|
9774
|
+
* <h2>${item.title}</h2>
|
|
9775
|
+
* `}
|
|
9776
|
+
* />
|
|
9777
|
+
* ```
|
|
9778
|
+
*
|
|
9779
|
+
* @vue-example
|
|
9780
|
+
* ```jsx
|
|
9781
|
+
* <SearchcraftSearchResults
|
|
9782
|
+
* adInterval={4}
|
|
9783
|
+
* placeAdAtState={true}
|
|
9784
|
+
* :template={(item, index, { html }) => html`
|
|
9785
|
+
* <h2>${item.title}</h2>
|
|
9786
|
+
* `}
|
|
9787
|
+
* />
|
|
9788
|
+
* ```
|
|
9789
|
+
*/
|
|
9790
|
+
class SearchcraftSearchResults {
|
|
9791
|
+
constructor(hostRef) {
|
|
9792
|
+
registerInstance(this, hostRef);
|
|
9793
|
+
}
|
|
9794
|
+
/**
|
|
9795
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9796
|
+
*/
|
|
9797
|
+
searchcraftId;
|
|
9798
|
+
/**
|
|
9799
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
9800
|
+
*/
|
|
9801
|
+
initialQuery;
|
|
9802
|
+
/**
|
|
9803
|
+
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
9804
|
+
*/
|
|
9805
|
+
template;
|
|
9806
|
+
adClientResponseItems = [];
|
|
9807
|
+
config;
|
|
9808
|
+
isSearchInProgress = true;
|
|
9809
|
+
searchClientResponseItems;
|
|
9810
|
+
searchResultsPage;
|
|
9811
|
+
searchResultsPerPage;
|
|
9812
|
+
searchTerm = '';
|
|
9813
|
+
unsubscribe;
|
|
9814
|
+
cleanupCore;
|
|
9815
|
+
onCoreAvailable(core) {
|
|
9816
|
+
const state = core.store.getState();
|
|
9817
|
+
this.handleStateChange(state);
|
|
9818
|
+
this.searchClientResponseItems = state.searchClientResponseItems;
|
|
9819
|
+
this.searchTerm = state.searchTerm;
|
|
9820
|
+
this.config = state.core?.config;
|
|
9821
|
+
this.unsubscribe = core.store.subscribe((state) => this.handleStateChange(state));
|
|
9822
|
+
}
|
|
9823
|
+
connectedCallback() {
|
|
9824
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9825
|
+
}
|
|
9826
|
+
disconnectedCallback() {
|
|
9827
|
+
this.unsubscribe?.();
|
|
9828
|
+
this.cleanupCore?.();
|
|
9829
|
+
}
|
|
9830
|
+
handleStateChange(state) {
|
|
9831
|
+
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
9832
|
+
this.config = state.core?.config;
|
|
9833
|
+
this.isSearchInProgress = state.isSearchInProgress;
|
|
9834
|
+
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
9835
|
+
this.searchResultsPage = state.searchResultsPage;
|
|
9836
|
+
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
9837
|
+
this.searchTerm = state.searchTerm;
|
|
9838
|
+
}
|
|
9839
|
+
renderEmptyState() {
|
|
9840
|
+
return (hAsync("div", { class: 'searchcraft-search-results-empty-state' }, hAsync("slot", { name: 'empty-search' })));
|
|
9841
|
+
}
|
|
9842
|
+
renderNoResultsFoundState() {
|
|
9843
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, hAsync("div", { class: 'searchcraft-search-results-error-message' }, hAsync("searchcraft-error-message", null, "No search results found for \"", this.searchTerm, "\" query."))));
|
|
9844
|
+
}
|
|
9845
|
+
renderWithADMAds() {
|
|
9846
|
+
const items = this.searchClientResponseItems || [];
|
|
9847
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'adMarketplace', adClientResponseItem: item, key: item.id, renderPosition: 'top' }))), items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
9848
|
+
}
|
|
9849
|
+
renderWithCustomAds() {
|
|
9850
|
+
const itemsToRender = [];
|
|
9851
|
+
const interstitialInterval = this.config?.customAdConfig?.adInterstitialInterval || 0;
|
|
9852
|
+
const interstitialQuantity = this.config?.customAdConfig?.adInterstitialQuantity || 1;
|
|
9853
|
+
const adStartQuantity = this.config?.customAdConfig?.adStartQuantity || 0;
|
|
9854
|
+
const adEndQuantity = this.config?.customAdConfig?.adEndQuantity || 0;
|
|
9855
|
+
const items = this.searchClientResponseItems || [];
|
|
9856
|
+
// Renders ads at beginning
|
|
9857
|
+
for (let n = 0; n < adStartQuantity; n++) {
|
|
9858
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
9634
9859
|
}
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9860
|
+
// Renders search results + interstitial ads
|
|
9861
|
+
items.forEach((item, index) => {
|
|
9862
|
+
if (interstitialInterval &&
|
|
9863
|
+
index % interstitialInterval === 0 &&
|
|
9864
|
+
index + interstitialInterval < items.length &&
|
|
9865
|
+
index >= interstitialInterval) {
|
|
9866
|
+
for (let n = 0; n < interstitialQuantity; n++) {
|
|
9867
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
9868
|
+
}
|
|
9869
|
+
}
|
|
9870
|
+
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
9871
|
+
});
|
|
9872
|
+
// Renders ads at end
|
|
9873
|
+
for (let n = 0; n < adEndQuantity; n++) {
|
|
9874
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
9638
9875
|
}
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9876
|
+
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
9877
|
+
}
|
|
9878
|
+
renderWithNativoAds() {
|
|
9879
|
+
const itemsToRender = [];
|
|
9880
|
+
const interstitialStartIndex = this.config?.nativoConfig?.adInterstialStartIndex || 0;
|
|
9881
|
+
const interstitialInterval = this.config?.nativoConfig?.adInterstitialInterval || 0;
|
|
9882
|
+
const interstitialQuantity = this.config?.nativoConfig?.adInterstitialQuantity || 1;
|
|
9883
|
+
const adStartQuantity = this.config?.nativoConfig?.adStartQuantity || 0;
|
|
9884
|
+
const adEndQuantity = this.config?.nativoConfig?.adEndQuantity || 0;
|
|
9885
|
+
const items = this.searchClientResponseItems || [];
|
|
9886
|
+
// Renders ads at beginning
|
|
9887
|
+
for (let n = 0; n < adStartQuantity; n++) {
|
|
9888
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
9642
9889
|
}
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9890
|
+
// Renders search results + interstitial ads
|
|
9891
|
+
items.forEach((item, index) => {
|
|
9892
|
+
if (interstitialInterval &&
|
|
9893
|
+
(index + interstitialStartIndex) % interstitialInterval === 0 &&
|
|
9894
|
+
index + interstitialInterval < items.length &&
|
|
9895
|
+
index >= interstitialInterval) {
|
|
9896
|
+
for (let n = 0; n < interstitialQuantity; n++) {
|
|
9897
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
9898
|
+
}
|
|
9899
|
+
}
|
|
9900
|
+
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
9901
|
+
});
|
|
9902
|
+
// Renders ads at end
|
|
9903
|
+
for (let n = 0; n < adEndQuantity; n++) {
|
|
9904
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
9646
9905
|
}
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9906
|
+
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
9907
|
+
}
|
|
9908
|
+
renderWithNoAds() {
|
|
9909
|
+
const items = this.searchClientResponseItems || [];
|
|
9910
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
9911
|
+
}
|
|
9912
|
+
render() {
|
|
9913
|
+
const searchClientResponseItems = this.searchClientResponseItems || [];
|
|
9914
|
+
if (searchClientResponseItems.length === 0 && !this.isSearchInProgress) {
|
|
9915
|
+
return this.renderEmptyState();
|
|
9650
9916
|
}
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9917
|
+
if (this.searchTerm.length > 0 &&
|
|
9918
|
+
searchClientResponseItems.length === 0 &&
|
|
9919
|
+
!this.isSearchInProgress) {
|
|
9920
|
+
return this.renderNoResultsFoundState();
|
|
9654
9921
|
}
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
break;
|
|
9922
|
+
if (this.config?.customAdConfig) {
|
|
9923
|
+
return this.renderWithCustomAds();
|
|
9658
9924
|
}
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
break;
|
|
9925
|
+
if (this.config?.admAdConfig) {
|
|
9926
|
+
return this.renderWithNativoAds();
|
|
9662
9927
|
}
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
break;
|
|
9928
|
+
if (this.config?.nativoConfig) {
|
|
9929
|
+
return this.renderWithNativoAds();
|
|
9666
9930
|
}
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9931
|
+
return this.renderWithNoAds();
|
|
9932
|
+
}
|
|
9933
|
+
static get cmpMeta() { return {
|
|
9934
|
+
"$flags$": 772,
|
|
9935
|
+
"$tagName$": "searchcraft-search-results",
|
|
9936
|
+
"$members$": {
|
|
9937
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9938
|
+
"initialQuery": [1, "initial-query"],
|
|
9939
|
+
"template": [16],
|
|
9940
|
+
"adClientResponseItems": [32],
|
|
9941
|
+
"config": [32],
|
|
9942
|
+
"isSearchInProgress": [32],
|
|
9943
|
+
"searchClientResponseItems": [32],
|
|
9944
|
+
"searchResultsPage": [32],
|
|
9945
|
+
"searchResultsPerPage": [32],
|
|
9946
|
+
"searchTerm": [32]
|
|
9947
|
+
},
|
|
9948
|
+
"$listeners$": undefined,
|
|
9949
|
+
"$lazyBundleId$": "-",
|
|
9950
|
+
"$attrsToReflect$": []
|
|
9951
|
+
}; }
|
|
9952
|
+
}
|
|
9953
|
+
|
|
9954
|
+
/**
|
|
9955
|
+
* This web component is designed to choose the number of search results displayed.
|
|
9956
|
+
*
|
|
9957
|
+
* @react-import
|
|
9958
|
+
* ```jsx
|
|
9959
|
+
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/react-sdk";
|
|
9960
|
+
* ```
|
|
9961
|
+
*
|
|
9962
|
+
* @vue-import
|
|
9963
|
+
* ```jsx
|
|
9964
|
+
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/vue-sdk";
|
|
9965
|
+
* ```
|
|
9966
|
+
*
|
|
9967
|
+
* @js-example
|
|
9968
|
+
* ```html
|
|
9969
|
+
* <!-- index.html -->
|
|
9970
|
+
* <searchcraft-search-results-per-page increment="20" />
|
|
9971
|
+
* ```
|
|
9972
|
+
*
|
|
9973
|
+
* @react-example
|
|
9974
|
+
* ```jsx
|
|
9975
|
+
* <SearchcraftSearchResultsPerPage increment={20} />
|
|
9976
|
+
* ```
|
|
9977
|
+
*
|
|
9978
|
+
* @vue-example
|
|
9979
|
+
* ```jsx
|
|
9980
|
+
* <SearchcraftSearchResultsPerPage increment="20" />
|
|
9981
|
+
* ```
|
|
9982
|
+
*/
|
|
9983
|
+
class SearchcraftSearchResultsPerPage {
|
|
9984
|
+
constructor(hostRef) {
|
|
9985
|
+
registerInstance(this, hostRef);
|
|
9986
|
+
}
|
|
9987
|
+
/**
|
|
9988
|
+
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
|
|
9989
|
+
* The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
9990
|
+
*/
|
|
9991
|
+
increment = 20;
|
|
9992
|
+
/**
|
|
9993
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9994
|
+
*/
|
|
9995
|
+
searchcraftId;
|
|
9996
|
+
// store vars
|
|
9997
|
+
searchTerm;
|
|
9998
|
+
searchResultsPage;
|
|
9999
|
+
searchResultsPerPage;
|
|
10000
|
+
searchResultsCount;
|
|
10001
|
+
searchResultsPagesCount;
|
|
10002
|
+
searchClientRequestProperties;
|
|
10003
|
+
// local vars
|
|
10004
|
+
initialSearchResultsPerPage;
|
|
10005
|
+
// store functions
|
|
10006
|
+
setSearchResultsPerPage = () => { };
|
|
10007
|
+
setSearchResultsPage = () => { };
|
|
10008
|
+
unsubscribe = () => { };
|
|
10009
|
+
cleanupCore;
|
|
10010
|
+
onCoreAvailable(core) {
|
|
10011
|
+
this.unsubscribe = core.store.subscribe((state) => {
|
|
10012
|
+
// store vars
|
|
10013
|
+
this.searchTerm = state.searchTerm;
|
|
10014
|
+
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
10015
|
+
this.searchResultsPage = state.searchResultsPage;
|
|
10016
|
+
this.searchResultsCount = state.searchResultsCount;
|
|
10017
|
+
this.searchClientRequestProperties = state.searchClientRequestProperties;
|
|
10018
|
+
// local vars
|
|
10019
|
+
this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
|
|
10020
|
+
// store functions
|
|
10021
|
+
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
10022
|
+
this.setSearchResultsPerPage = state.setSearchResultsPerPage;
|
|
10023
|
+
});
|
|
10024
|
+
this.initialSearchResultsPerPage =
|
|
10025
|
+
core.store.getState().searchResultsPerPage;
|
|
10026
|
+
}
|
|
10027
|
+
connectedCallback() {
|
|
10028
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
10029
|
+
}
|
|
10030
|
+
disconnectedCallback() {
|
|
10031
|
+
this.unsubscribe?.();
|
|
10032
|
+
this.cleanupCore?.();
|
|
10033
|
+
}
|
|
10034
|
+
render() {
|
|
10035
|
+
// Check if this is an initialQuery case (string requestProperties with empty searchTerm)
|
|
10036
|
+
const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
|
|
10037
|
+
this.searchTerm.trim() === '';
|
|
10038
|
+
// early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
|
|
10039
|
+
if ((!this.searchTerm && !isInitialQuery) ||
|
|
10040
|
+
this.searchResultsPagesCount <= 1) {
|
|
10041
|
+
return;
|
|
9675
10042
|
}
|
|
9676
|
-
|
|
10043
|
+
return (hAsync("div", { class: 'searchcraft-search-results-per-page' }, hAsync("div", { class: 'searchcraft-search-results-per-page-select' }, hAsync("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), hAsync("div", { class: 'searchcraft-search-results-per-page-select-input' }, hAsync("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
|
|
10044
|
+
const value = this.initialSearchResultsPerPage +
|
|
10045
|
+
Number(this.increment) * index;
|
|
10046
|
+
return {
|
|
10047
|
+
label: `${value}`,
|
|
10048
|
+
value,
|
|
10049
|
+
};
|
|
10050
|
+
}), onSelectChange: (event) => {
|
|
10051
|
+
this.setSearchResultsPerPage(Number(event.detail));
|
|
10052
|
+
this.setSearchResultsPage(1);
|
|
10053
|
+
} })))));
|
|
9677
10054
|
}
|
|
9678
|
-
return
|
|
9679
|
-
|
|
9680
|
-
|
|
10055
|
+
static get cmpMeta() { return {
|
|
10056
|
+
"$flags$": 768,
|
|
10057
|
+
"$tagName$": "searchcraft-search-results-per-page",
|
|
10058
|
+
"$members$": {
|
|
10059
|
+
"increment": [8],
|
|
10060
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
10061
|
+
"searchTerm": [32],
|
|
10062
|
+
"searchResultsPage": [32],
|
|
10063
|
+
"searchResultsPerPage": [32],
|
|
10064
|
+
"searchResultsCount": [32],
|
|
10065
|
+
"searchResultsPagesCount": [32],
|
|
10066
|
+
"searchClientRequestProperties": [32],
|
|
10067
|
+
"initialSearchResultsPerPage": [32],
|
|
10068
|
+
"setSearchResultsPerPage": [32],
|
|
10069
|
+
"setSearchResultsPage": [32]
|
|
10070
|
+
},
|
|
10071
|
+
"$listeners$": undefined,
|
|
10072
|
+
"$lazyBundleId$": "-",
|
|
10073
|
+
"$attrsToReflect$": []
|
|
10074
|
+
}; }
|
|
10075
|
+
}
|
|
9681
10076
|
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
10077
|
+
/**
|
|
10078
|
+
* This web component is designed to allow users to select between a group of options.
|
|
10079
|
+
*
|
|
10080
|
+
* @js-example
|
|
10081
|
+
* ```html
|
|
10082
|
+
* <!-- index.html -->
|
|
10083
|
+
* <searchcraft-select
|
|
10084
|
+
* inputId="searchcraft-select"
|
|
10085
|
+
* name="searchcraft-select"
|
|
10086
|
+
* options="[{ label: 'label', value: 'value' }]"
|
|
10087
|
+
* />
|
|
10088
|
+
* ```
|
|
10089
|
+
*
|
|
10090
|
+
* @internal
|
|
10091
|
+
*/
|
|
10092
|
+
class SearchcraftSelect {
|
|
10093
|
+
constructor(hostRef) {
|
|
10094
|
+
registerInstance(this, hostRef);
|
|
10095
|
+
this.selectChange = createEvent(this, "selectChange");
|
|
10096
|
+
}
|
|
10097
|
+
/**
|
|
10098
|
+
* The caption displayed below the select input.
|
|
10099
|
+
*/
|
|
10100
|
+
caption;
|
|
10101
|
+
/**
|
|
10102
|
+
* Whether the select input is disabled.
|
|
10103
|
+
*/
|
|
10104
|
+
disabled = false;
|
|
10105
|
+
/**
|
|
10106
|
+
* The ID for the select input.
|
|
10107
|
+
*/
|
|
10108
|
+
inputId;
|
|
10109
|
+
/**
|
|
10110
|
+
* The label of the select input.
|
|
10111
|
+
*/
|
|
10112
|
+
label;
|
|
10113
|
+
/**
|
|
10114
|
+
* The ID for the label of the select input.
|
|
10115
|
+
*/
|
|
10116
|
+
labelId;
|
|
10117
|
+
/**
|
|
10118
|
+
* The name of the select input.
|
|
10119
|
+
*/
|
|
10120
|
+
name;
|
|
10121
|
+
/**
|
|
10122
|
+
* The options for the select input.
|
|
10123
|
+
*/
|
|
10124
|
+
options = [];
|
|
10125
|
+
/**
|
|
10126
|
+
* The event fired when the select is changed.
|
|
10127
|
+
*/
|
|
10128
|
+
selectChange;
|
|
10129
|
+
searchResultsPerPage;
|
|
10130
|
+
setSearchResultsPage = () => { };
|
|
10131
|
+
setSearchResultsPerPage = () => { };
|
|
10132
|
+
handleSelectChange = (event) => {
|
|
10133
|
+
this.selectChange.emit(event.target.value);
|
|
10134
|
+
};
|
|
10135
|
+
handleGoToPage(page) {
|
|
10136
|
+
this.setSearchResultsPage(page);
|
|
10137
|
+
}
|
|
10138
|
+
render() {
|
|
10139
|
+
return (hAsync("div", { key: '15ecbf48c824a161cd83bdab99dace8e44f1ab39', class: 'searchcraft-select' }, this.label && (hAsync("label", { key: 'aba433ae9c27c9405099cffcef923c3ad22d7fda', class: 'searchcraft-select-label', id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label)), hAsync("div", { key: '8df8a2ff05924c9c55cdd6e3827cd927cddab82a', class: 'searchcraft-select-input-wrapper' }, hAsync("select", { key: '1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f', "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : undefined, class: 'searchcraft-select-input', disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options === 'string'
|
|
10140
|
+
? JSON.parse(this.options)
|
|
10141
|
+
: this.options).map(({ label, value, selected }) => {
|
|
10142
|
+
return (hAsync("option", { key: value, value: value, selected: selected }, label));
|
|
10143
|
+
})), hAsync("svg", { key: '0ec6892b529f2e70027aadea47208582a65a97b7', class: 'searchcraft-select-input-icon', width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, hAsync("title", { key: 'bced6b62378491d1d1c629b602d7d033d912c761' }, "Select dropdown icon"), hAsync("path", { key: '659f8ebf9129e2e7941da949d29688c41c1472bb', d: 'M5 7.5L10 12.5L15 7.5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), this.caption && (hAsync("p", { key: '51217d926f68f79b6c3514f5fd769b56549fdce9', class: 'searchcraft-select-caption' }, this.caption))));
|
|
10144
|
+
}
|
|
10145
|
+
static get cmpMeta() { return {
|
|
10146
|
+
"$flags$": 768,
|
|
10147
|
+
"$tagName$": "searchcraft-select",
|
|
10148
|
+
"$members$": {
|
|
10149
|
+
"caption": [1],
|
|
10150
|
+
"disabled": [4],
|
|
10151
|
+
"inputId": [1, "input-id"],
|
|
10152
|
+
"label": [1],
|
|
10153
|
+
"labelId": [1, "label-id"],
|
|
10154
|
+
"name": [1],
|
|
10155
|
+
"options": [1],
|
|
10156
|
+
"searchResultsPerPage": [32],
|
|
10157
|
+
"setSearchResultsPage": [32],
|
|
10158
|
+
"setSearchResultsPerPage": [32]
|
|
10159
|
+
},
|
|
10160
|
+
"$listeners$": undefined,
|
|
10161
|
+
"$lazyBundleId$": "-",
|
|
10162
|
+
"$attrsToReflect$": []
|
|
10163
|
+
}; }
|
|
10164
|
+
}
|
|
9725
10165
|
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
const tableToken = token;
|
|
9751
|
-
for (const cell of tableToken.header) {
|
|
9752
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9753
|
-
}
|
|
9754
|
-
for (const row of tableToken.rows) {
|
|
9755
|
-
for (const cell of row) {
|
|
9756
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
10166
|
+
/**
|
|
10167
|
+
* Creates a throttled version of the given function that only invokes
|
|
10168
|
+
* the original function at most once every specified number of milliseconds.
|
|
10169
|
+
*
|
|
10170
|
+
* The logic is written in a way that the last invocation is always called, after the
|
|
10171
|
+
* throttle cooldown period has ended.
|
|
10172
|
+
*
|
|
10173
|
+
* @template Arguments - The argument types for the function to throttle
|
|
10174
|
+
* @param callback - The function to throttle
|
|
10175
|
+
* @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation
|
|
10176
|
+
* @returns A throttled version of the original function
|
|
10177
|
+
*/
|
|
10178
|
+
function throttle(callback, delayInMilliseconds) {
|
|
10179
|
+
let isThrottleOnCooldown = false;
|
|
10180
|
+
let trailingCallArgs = null;
|
|
10181
|
+
const invokeAction = (args) => {
|
|
10182
|
+
callback(...args);
|
|
10183
|
+
isThrottleOnCooldown = true;
|
|
10184
|
+
setTimeout(() => {
|
|
10185
|
+
isThrottleOnCooldown = false;
|
|
10186
|
+
if (trailingCallArgs) {
|
|
10187
|
+
const nextArgs = trailingCallArgs;
|
|
10188
|
+
trailingCallArgs = null;
|
|
10189
|
+
invokeAction(nextArgs);
|
|
9757
10190
|
}
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
9764
|
-
break;
|
|
10191
|
+
}, delayInMilliseconds);
|
|
10192
|
+
};
|
|
10193
|
+
return (...args) => {
|
|
10194
|
+
if (!isThrottleOnCooldown) {
|
|
10195
|
+
invokeAction(args);
|
|
9765
10196
|
}
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
9769
|
-
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
9770
|
-
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
9771
|
-
values = values.concat(this.walkTokens(tokens2, callback));
|
|
9772
|
-
});
|
|
9773
|
-
} else if (genericToken.tokens) {
|
|
9774
|
-
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
9775
|
-
}
|
|
10197
|
+
else {
|
|
10198
|
+
trailingCallArgs = args;
|
|
9776
10199
|
}
|
|
9777
|
-
|
|
10200
|
+
};
|
|
10201
|
+
}
|
|
10202
|
+
|
|
10203
|
+
/**
|
|
10204
|
+
* This web component is designed to allow users to select a value from a range defined by a minimum and maximum value. The component renders a slider interface, which can be used to visually choose a value between two boundaries.
|
|
10205
|
+
*
|
|
10206
|
+
* @internal
|
|
10207
|
+
*/
|
|
10208
|
+
class SearchcraftSlider {
|
|
10209
|
+
constructor(hostRef) {
|
|
10210
|
+
registerInstance(this, hostRef);
|
|
10211
|
+
this.rangeChanged = createEvent(this, "rangeChanged");
|
|
9778
10212
|
}
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
} else {
|
|
9820
|
-
extensions.startBlock = [ext.start];
|
|
9821
|
-
}
|
|
9822
|
-
} else if (ext.level === "inline") {
|
|
9823
|
-
if (extensions.startInline) {
|
|
9824
|
-
extensions.startInline.push(ext.start);
|
|
9825
|
-
} else {
|
|
9826
|
-
extensions.startInline = [ext.start];
|
|
9827
|
-
}
|
|
9828
|
-
}
|
|
9829
|
-
}
|
|
9830
|
-
}
|
|
9831
|
-
if ("childTokens" in ext && ext.childTokens) {
|
|
9832
|
-
extensions.childTokens[ext.name] = ext.childTokens;
|
|
9833
|
-
}
|
|
9834
|
-
});
|
|
9835
|
-
opts.extensions = extensions;
|
|
9836
|
-
}
|
|
9837
|
-
if (pack.renderer) {
|
|
9838
|
-
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
9839
|
-
for (const prop in pack.renderer) {
|
|
9840
|
-
if (!(prop in renderer)) {
|
|
9841
|
-
throw new Error(`renderer '${prop}' does not exist`);
|
|
9842
|
-
}
|
|
9843
|
-
if (["options", "parser"].includes(prop)) {
|
|
9844
|
-
continue;
|
|
9845
|
-
}
|
|
9846
|
-
const rendererProp = prop;
|
|
9847
|
-
const rendererFunc = pack.renderer[rendererProp];
|
|
9848
|
-
const prevRenderer = renderer[rendererProp];
|
|
9849
|
-
renderer[rendererProp] = (...args2) => {
|
|
9850
|
-
let ret = rendererFunc.apply(renderer, args2);
|
|
9851
|
-
if (ret === false) {
|
|
9852
|
-
ret = prevRenderer.apply(renderer, args2);
|
|
9853
|
-
}
|
|
9854
|
-
return ret || "";
|
|
9855
|
-
};
|
|
9856
|
-
}
|
|
9857
|
-
opts.renderer = renderer;
|
|
9858
|
-
}
|
|
9859
|
-
if (pack.tokenizer) {
|
|
9860
|
-
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
9861
|
-
for (const prop in pack.tokenizer) {
|
|
9862
|
-
if (!(prop in tokenizer)) {
|
|
9863
|
-
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
9864
|
-
}
|
|
9865
|
-
if (["options", "rules", "lexer"].includes(prop)) {
|
|
9866
|
-
continue;
|
|
9867
|
-
}
|
|
9868
|
-
const tokenizerProp = prop;
|
|
9869
|
-
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
9870
|
-
const prevTokenizer = tokenizer[tokenizerProp];
|
|
9871
|
-
tokenizer[tokenizerProp] = (...args2) => {
|
|
9872
|
-
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
9873
|
-
if (ret === false) {
|
|
9874
|
-
ret = prevTokenizer.apply(tokenizer, args2);
|
|
10213
|
+
/**
|
|
10214
|
+
* The maximum value allowed.
|
|
10215
|
+
*/
|
|
10216
|
+
max = 100;
|
|
10217
|
+
/**
|
|
10218
|
+
* The minimum value allowed.
|
|
10219
|
+
*/
|
|
10220
|
+
min = 0;
|
|
10221
|
+
/**
|
|
10222
|
+
* The step amount for the slider inputs.
|
|
10223
|
+
*/
|
|
10224
|
+
step = 1;
|
|
10225
|
+
/** The type of data the sliders are using. */
|
|
10226
|
+
dataType = 'number';
|
|
10227
|
+
/** The date granularity to use. Used to format date labels. */
|
|
10228
|
+
dateGranularity;
|
|
10229
|
+
lowerBound = 0;
|
|
10230
|
+
upperBound = 1;
|
|
10231
|
+
endValue = 0;
|
|
10232
|
+
startValue = 0;
|
|
10233
|
+
lastFocusedHandle = 'max';
|
|
10234
|
+
throttledEmitUpdate = () => { };
|
|
10235
|
+
/**
|
|
10236
|
+
* When the range has changed.
|
|
10237
|
+
* */
|
|
10238
|
+
rangeChanged;
|
|
10239
|
+
connectedCallback() {
|
|
10240
|
+
switch (this.dataType) {
|
|
10241
|
+
case 'number':
|
|
10242
|
+
this.startValue = this.min;
|
|
10243
|
+
this.endValue = this.max;
|
|
10244
|
+
this.lowerBound = this.min;
|
|
10245
|
+
this.upperBound = this.max;
|
|
10246
|
+
break;
|
|
10247
|
+
case 'date': {
|
|
10248
|
+
this.startValue = 0;
|
|
10249
|
+
this.endValue = getDifferenceInUnits(this.dateGranularity || 'year', this.min, this.max);
|
|
10250
|
+
this.lowerBound = 0;
|
|
10251
|
+
this.upperBound = this.endValue;
|
|
10252
|
+
break;
|
|
9875
10253
|
}
|
|
9876
|
-
return ret;
|
|
9877
|
-
};
|
|
9878
10254
|
}
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
if (["options", "block"].includes(prop)) {
|
|
9888
|
-
continue;
|
|
9889
|
-
}
|
|
9890
|
-
const hooksProp = prop;
|
|
9891
|
-
const hooksFunc = pack.hooks[hooksProp];
|
|
9892
|
-
const prevHook = hooks[hooksProp];
|
|
9893
|
-
if (_Hooks.passThroughHooks.has(prop)) {
|
|
9894
|
-
hooks[hooksProp] = (arg) => {
|
|
9895
|
-
if (this.defaults.async) {
|
|
9896
|
-
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
|
9897
|
-
return prevHook.call(hooks, ret2);
|
|
10255
|
+
this.throttledEmitUpdate = throttle(this.emitUpdate, 120);
|
|
10256
|
+
}
|
|
10257
|
+
emitUpdate = async () => {
|
|
10258
|
+
switch (this.dataType) {
|
|
10259
|
+
case 'number':
|
|
10260
|
+
this.rangeChanged?.emit({
|
|
10261
|
+
startValue: this.startValue,
|
|
10262
|
+
endValue: this.endValue,
|
|
9898
10263
|
});
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
};
|
|
9911
|
-
}
|
|
10264
|
+
break;
|
|
10265
|
+
case 'date': {
|
|
10266
|
+
const granularity = this.dateGranularity || 'year';
|
|
10267
|
+
const startTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.startValue);
|
|
10268
|
+
const endTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.endValue + 1);
|
|
10269
|
+
this.rangeChanged?.emit({
|
|
10270
|
+
startValue: startTimestamp,
|
|
10271
|
+
endValue: endTimestamp,
|
|
10272
|
+
});
|
|
10273
|
+
break;
|
|
10274
|
+
}
|
|
9912
10275
|
}
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
const
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
if (walkTokens2) {
|
|
9922
|
-
values = values.concat(walkTokens2.call(this, token));
|
|
9923
|
-
}
|
|
9924
|
-
return values;
|
|
9925
|
-
};
|
|
9926
|
-
}
|
|
9927
|
-
this.defaults = { ...this.defaults, ...opts };
|
|
9928
|
-
});
|
|
9929
|
-
return this;
|
|
9930
|
-
}
|
|
9931
|
-
setOptions(opt) {
|
|
9932
|
-
this.defaults = { ...this.defaults, ...opt };
|
|
9933
|
-
return this;
|
|
9934
|
-
}
|
|
9935
|
-
lexer(src, options2) {
|
|
9936
|
-
return _Lexer.lex(src, options2 ?? this.defaults);
|
|
9937
|
-
}
|
|
9938
|
-
parser(tokens, options2) {
|
|
9939
|
-
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
9940
|
-
}
|
|
9941
|
-
parseMarkdown(blockType) {
|
|
9942
|
-
const parse2 = (src, options2) => {
|
|
9943
|
-
const origOpt = { ...options2 };
|
|
9944
|
-
const opt = { ...this.defaults, ...origOpt };
|
|
9945
|
-
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
9946
|
-
if (this.defaults.async === true && origOpt.async === false) {
|
|
9947
|
-
return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
9948
|
-
}
|
|
9949
|
-
if (typeof src === "undefined" || src === null) {
|
|
9950
|
-
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
9951
|
-
}
|
|
9952
|
-
if (typeof src !== "string") {
|
|
9953
|
-
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
9954
|
-
}
|
|
9955
|
-
if (opt.hooks) {
|
|
9956
|
-
opt.hooks.options = opt;
|
|
9957
|
-
opt.hooks.block = blockType;
|
|
9958
|
-
}
|
|
9959
|
-
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
9960
|
-
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
9961
|
-
if (opt.async) {
|
|
9962
|
-
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
9963
|
-
}
|
|
9964
|
-
try {
|
|
9965
|
-
if (opt.hooks) {
|
|
9966
|
-
src = opt.hooks.preprocess(src);
|
|
10276
|
+
};
|
|
10277
|
+
handleStartValueChange = (event) => {
|
|
10278
|
+
const inputElement = event.target;
|
|
10279
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
10280
|
+
this.lastFocusedHandle = 'min';
|
|
10281
|
+
if (value <= this.endValue) {
|
|
10282
|
+
this.startValue = value;
|
|
10283
|
+
this.throttledEmitUpdate();
|
|
9967
10284
|
}
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
10285
|
+
else {
|
|
10286
|
+
this.startValue = this.endValue;
|
|
10287
|
+
inputElement.value = `${this.endValue}`;
|
|
9971
10288
|
}
|
|
9972
|
-
|
|
9973
|
-
|
|
10289
|
+
};
|
|
10290
|
+
handleEndValueChange = (event) => {
|
|
10291
|
+
const inputElement = event.target;
|
|
10292
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
10293
|
+
this.lastFocusedHandle = 'max';
|
|
10294
|
+
if (value >= this.startValue) {
|
|
10295
|
+
this.endValue = value;
|
|
10296
|
+
this.throttledEmitUpdate();
|
|
9974
10297
|
}
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
10298
|
+
else {
|
|
10299
|
+
this.endValue = this.startValue;
|
|
10300
|
+
inputElement.value = `${this.startValue}`;
|
|
9978
10301
|
}
|
|
9979
|
-
return html2;
|
|
9980
|
-
} catch (e) {
|
|
9981
|
-
return throwError(e);
|
|
9982
|
-
}
|
|
9983
10302
|
};
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
10303
|
+
getLabel = (value) => {
|
|
10304
|
+
switch (this.dataType) {
|
|
10305
|
+
case 'number':
|
|
10306
|
+
return `${this.startValue}`;
|
|
10307
|
+
case 'date': {
|
|
10308
|
+
const granularity = this.dateGranularity || 'year';
|
|
10309
|
+
const dateOffset = this.lowerBound + value;
|
|
10310
|
+
const timestamp = getStartOf(this.min, granularity, dateOffset);
|
|
10311
|
+
return getFormattedDateString(this.dateGranularity || 'year', new Date(timestamp));
|
|
10312
|
+
}
|
|
9993
10313
|
}
|
|
9994
|
-
return msg;
|
|
9995
|
-
}
|
|
9996
|
-
if (async) {
|
|
9997
|
-
return Promise.reject(e);
|
|
9998
|
-
}
|
|
9999
|
-
throw e;
|
|
10000
10314
|
};
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10315
|
+
render() {
|
|
10316
|
+
const startPercent = ((this.startValue - this.lowerBound) /
|
|
10317
|
+
(this.upperBound - this.lowerBound)) *
|
|
10318
|
+
100;
|
|
10319
|
+
const endPercent = ((this.endValue - this.lowerBound) /
|
|
10320
|
+
(this.upperBound - this.lowerBound)) *
|
|
10321
|
+
100;
|
|
10322
|
+
const startLabel = this.getLabel(this.startValue);
|
|
10323
|
+
const endLabel = this.getLabel(this.endValue);
|
|
10324
|
+
return (hAsync("div", { key: '2c72254f52151edd2e2fa89c092fc788db0b5562', class: 'searchcraft-slider' }, hAsync("div", { key: '98c25badf2c9386d7173ea552e510dcc168e7fc7', class: 'searchcraft-slider-range' }, hAsync("div", { key: '50774db2253e34b1bce68acc0a40b2706cab542d', class: 'searchcraft-slider-active-range', style: {
|
|
10325
|
+
left: `${startPercent}%`,
|
|
10326
|
+
width: `${endPercent - startPercent}%`,
|
|
10327
|
+
} }), hAsync("input", { key: '229afedc1318a63cbd75806805210cf4f5695e6e', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleStartValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), hAsync("input", { key: '6aa038b01daaba86f501ebbbec30fc6720b549b3', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleEndValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), hAsync("div", { key: 'f70501538635c3b08ad1e6ac101d0b3192ef8e04', class: 'searchcraft-slider-label' }, hAsync("span", { key: 'ddd539b86774f8900771d77d5ef7eb3a67c98d59', class: 'searchcraft-slider-start-label' }, startLabel), hAsync("span", { key: 'b754a9c8d284e0623032cee6b92f9df88873ec04', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
10328
|
+
}
|
|
10329
|
+
static get cmpMeta() { return {
|
|
10330
|
+
"$flags$": 768,
|
|
10331
|
+
"$tagName$": "searchcraft-slider",
|
|
10332
|
+
"$members$": {
|
|
10333
|
+
"max": [2],
|
|
10334
|
+
"min": [2],
|
|
10335
|
+
"step": [2],
|
|
10336
|
+
"dataType": [1, "data-type"],
|
|
10337
|
+
"dateGranularity": [1, "date-granularity"],
|
|
10338
|
+
"lowerBound": [32],
|
|
10339
|
+
"upperBound": [32],
|
|
10340
|
+
"endValue": [32],
|
|
10341
|
+
"startValue": [32],
|
|
10342
|
+
"lastFocusedHandle": [32]
|
|
10343
|
+
},
|
|
10344
|
+
"$listeners$": undefined,
|
|
10345
|
+
"$lazyBundleId$": "-",
|
|
10346
|
+
"$attrsToReflect$": []
|
|
10347
|
+
}; }
|
|
10008
10348
|
}
|
|
10009
|
-
marked.options = marked.setOptions = function(options2) {
|
|
10010
|
-
markedInstance.setOptions(options2);
|
|
10011
|
-
marked.defaults = markedInstance.defaults;
|
|
10012
|
-
changeDefaults(marked.defaults);
|
|
10013
|
-
return marked;
|
|
10014
|
-
};
|
|
10015
|
-
marked.getDefaults = _getDefaults;
|
|
10016
|
-
marked.defaults = _defaults;
|
|
10017
|
-
marked.use = function(...args) {
|
|
10018
|
-
markedInstance.use(...args);
|
|
10019
|
-
marked.defaults = markedInstance.defaults;
|
|
10020
|
-
changeDefaults(marked.defaults);
|
|
10021
|
-
return marked;
|
|
10022
|
-
};
|
|
10023
|
-
marked.walkTokens = function(tokens, callback) {
|
|
10024
|
-
return markedInstance.walkTokens(tokens, callback);
|
|
10025
|
-
};
|
|
10026
|
-
marked.parseInline = markedInstance.parseInline;
|
|
10027
|
-
marked.Parser = _Parser;
|
|
10028
|
-
marked.parser = _Parser.parse;
|
|
10029
|
-
marked.Renderer = _Renderer;
|
|
10030
|
-
marked.TextRenderer = _TextRenderer;
|
|
10031
|
-
marked.Lexer = _Lexer;
|
|
10032
|
-
marked.lexer = _Lexer.lex;
|
|
10033
|
-
marked.Tokenizer = _Tokenizer;
|
|
10034
|
-
marked.Hooks = _Hooks;
|
|
10035
|
-
marked.parse = marked;
|
|
10036
10349
|
|
|
10037
10350
|
/**
|
|
10351
|
+
* @deprecated Use `searchcraft-results-summary` instead.
|
|
10352
|
+
* This component is deprecated and will be removed in a future version.
|
|
10353
|
+
* Please update to use `searchcraft-results-summary` which has the same functionality.
|
|
10354
|
+
*
|
|
10038
10355
|
* This component renders a summary box for RAG search result summaries.
|
|
10039
10356
|
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
10040
10357
|
* rendered in this box.
|
|
@@ -10075,9 +10392,9 @@ class SearchcraftSummaryBox {
|
|
|
10075
10392
|
*/
|
|
10076
10393
|
searchcraftId;
|
|
10077
10394
|
summary = '';
|
|
10395
|
+
summaryErrorMessage = '';
|
|
10078
10396
|
isLoading = false;
|
|
10079
10397
|
isSummaryNotEnabled = false;
|
|
10080
|
-
get hostElement() { return getElement(this); }
|
|
10081
10398
|
unsubscribe;
|
|
10082
10399
|
cleanupCore;
|
|
10083
10400
|
onCoreAvailable(core) {
|
|
@@ -10097,9 +10414,8 @@ class SearchcraftSummaryBox {
|
|
|
10097
10414
|
handleStateChange(state) {
|
|
10098
10415
|
this.isLoading = state.isSummaryLoading;
|
|
10099
10416
|
this.isSummaryNotEnabled = state.isSummaryNotEnabled;
|
|
10417
|
+
this.summaryErrorMessage = state.summaryErrorMessage;
|
|
10100
10418
|
this.summary = this.sanitizeMarkdown(state.summary);
|
|
10101
|
-
// Update DOM directly for performance (avoids re-render)
|
|
10102
|
-
this.updateContentElement(state.summary);
|
|
10103
10419
|
}
|
|
10104
10420
|
/**
|
|
10105
10421
|
* Sanitizes and converts markdown to HTML.
|
|
@@ -10107,15 +10423,6 @@ class SearchcraftSummaryBox {
|
|
|
10107
10423
|
sanitizeMarkdown(markdown) {
|
|
10108
10424
|
return purify.sanitize(marked.parse(markdown));
|
|
10109
10425
|
}
|
|
10110
|
-
/**
|
|
10111
|
-
* Updates the content element directly without triggering a re-render.
|
|
10112
|
-
*/
|
|
10113
|
-
updateContentElement(markdown) {
|
|
10114
|
-
const contentElement = this.hostElement?.querySelector('.searchcraft-summary-box-content');
|
|
10115
|
-
if (contentElement) {
|
|
10116
|
-
contentElement.innerHTML = this.sanitizeMarkdown(markdown);
|
|
10117
|
-
}
|
|
10118
|
-
}
|
|
10119
10426
|
/**
|
|
10120
10427
|
* Renders the appropriate content based on current state.
|
|
10121
10428
|
*/
|
|
@@ -10124,12 +10431,12 @@ class SearchcraftSummaryBox {
|
|
|
10124
10431
|
return hAsync("searchcraft-loading", { label: 'LOADING' });
|
|
10125
10432
|
}
|
|
10126
10433
|
if (this.isSummaryNotEnabled) {
|
|
10127
|
-
return (hAsync("div", { class: 'searchcraft-summary-box-content' },
|
|
10434
|
+
return (hAsync("div", { class: 'searchcraft-summary-box-content' }, this.summaryErrorMessage || 'AI summaries are not enabled'));
|
|
10128
10435
|
}
|
|
10129
|
-
return hAsync("div", { class: 'searchcraft-summary-box-content'
|
|
10436
|
+
return (hAsync("div", { class: 'searchcraft-summary-box-content', innerHTML: this.summary }));
|
|
10130
10437
|
}
|
|
10131
10438
|
render() {
|
|
10132
|
-
return hAsync("div", { key: '
|
|
10439
|
+
return hAsync("div", { key: 'a33091962cfbbcf0399e9e15e8346590511090e1', class: 'searchcraft-summary-box' }, this.renderContent());
|
|
10133
10440
|
}
|
|
10134
10441
|
static get cmpMeta() { return {
|
|
10135
10442
|
"$flags$": 768,
|
|
@@ -10137,6 +10444,7 @@ class SearchcraftSummaryBox {
|
|
|
10137
10444
|
"$members$": {
|
|
10138
10445
|
"searchcraftId": [1, "searchcraft-id"],
|
|
10139
10446
|
"summary": [32],
|
|
10447
|
+
"summaryErrorMessage": [32],
|
|
10140
10448
|
"isLoading": [32],
|
|
10141
10449
|
"isSummaryNotEnabled": [32]
|
|
10142
10450
|
},
|
|
@@ -10146,7 +10454,7 @@ class SearchcraftSummaryBox {
|
|
|
10146
10454
|
}; }
|
|
10147
10455
|
}
|
|
10148
10456
|
|
|
10149
|
-
var styles = `[class*=searchcraft-],[class*=searchcraft-] *,[class*=searchcraft-]::before,[class*=searchcraft-]::after,[class*=searchcraft-] *,::before,[class*=searchcraft-] *,::after{box-sizing:border-box;padding:0;margin:0}:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-xl: calc(var(--sc-border-radius) * 3);--sc-border-radius-2xl: calc(var(--sc-border-radius) * 4);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #fafafa) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, var(--sc-color-background-active-computed, #f7f7f7) );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-color-background-secondary-hover-computed: hsl( from var(--sc-color-background-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #e6e6e6) );--sc-color-background-secondary-active-computed: hsl( from var(--sc-color-background-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active-computed, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var( --sc-color-foreground-secondary, var(--sc-color-foreground-secondary-computed, #404040) );--sc-border-neutral: var(--sc-color-border, rgba(0, 0, 0, 0.1));--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var( --sc-color-brand-hover, var(--sc-color-brand-hover-computed, #2e2e2e) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var( --sc-color-brand-active, var(--sc-color-brand-active-computed, #292929) );--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-color-brand-secondary-hover-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-brand-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #ebebeb) );--sc-color-brand-secondary-active-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active-computed, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30 );--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, var(--sc-color-success-primary-hover-computed, #009900) );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20 );--sc-surface-success-primary-active: var( --sc-color-success-primary-active, var(--sc-color-success-primary-active-computed, #006600) );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90 );--sc-surface-success-secondary: var( --sc-color-success-secondary, var(--sc-color-success-secondary-computed, #ccffcc) );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, var(--sc-color-success-secondary-hover-computed, #e6ffe6) );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, var(--sc-color-success-secondary-active-computed, #b2ffb2) );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30 );--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, var(--sc-color-caution-primary-hover-computed, #e57300) );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20 );--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, var(--sc-color-caution-primary-active-computed, #b25a00) );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90 );--sc-surface-caution-secondary: var( --sc-color-caution-secondary, var(--sc-color-caution-secondary-computed, #ffd9b3) );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, var(--sc-color-caution-secondary-hover-computed, #ffe5cc) );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, var(--sc-color-caution-secondary-active-computed, #ffcc99) );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30 );--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, var(--sc-color-danger-primary-hover-computed, #e50000) );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20 );--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, var(--sc-color-danger-primary-active-computed, #b30000) );--sc-color-danger-secondary-computed: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var( --sc-color-danger-secondary, var(--sc-color-danger-secondary-computed, #ffcccc) );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, var(--sc-color-danger-secondary-hover-computed, #ffe7e7) );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, var(--sc-color-danger-secondary-active-computed, #ffb3b3) );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30% );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90% );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30% );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90% );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30% );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20% );--sc-color-danger-secondary-computed: hsl( from var(--sc-color-danger) h s 90% );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-ad{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-ad-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-ad-no-template>p{margin:0}.searchcraft-adm-ad{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-result{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{display:flex;flex-direction:column;gap:8px;width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);gap:8px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input-wrapper{position:relative}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px;margin:0}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:flex}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:flex}.searchcraft-facet-child-list{display:flex;flex-direction:column;gap:6px}.searchcraft-facet-child-list-checkbox-label{margin-left:24px}.searchcraft-facet-child-list-checkbox-label:first-child{margin-top:6px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:50%;position:absolute;margin-top:2px;top:50%;transform:translate(-50%, -50%);width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-disabled);text-align:center}.searchcraft-facet-list-wrapper{display:flex;flex-direction:column;width:100%;min-height:0}.searchcraft-facet-list-content{display:flex;flex-direction:column;gap:8px;min-height:0;flex-shrink:0}.searchcraft-facet-list-view-more{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:none;color:var(--sc-content-brand);cursor:pointer;padding:8px 0;text-align:left;text-decoration:underline}.searchcraft-facet-list-view-more:hover{color:var(--sc-surface-brand-primary-hover)}.searchcraft-facet-list-view-more:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}[data-toggle-facet-section]{cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;position:relative}[data-toggle-facet-section]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-facet-section][data-facet-section-collapsed]::after{transform:rotate(90deg)}[data-toggle-facet-section][data-facet-section-expanded]::after{transform:rotate(-90deg)}@media(max-width: 767px){[data-toggle-filter-panel]{cursor:pointer;display:flex !important;align-items:center;justify-content:space-between;width:100%}[data-toggle-filter-panel]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-filter-panel][data-filter-panel-collapsed]::after{transform:rotate(90deg)}[data-toggle-filter-panel][data-filter-panel-expanded]::after{transform:rotate(-90deg)}}@media(min-width: 768px){[data-toggle-filter-panel]{cursor:default}[data-toggle-filter-panel]::after{display:none}}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px 44px}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px;outline-offset:-1px}.searchcraft-input-form-input.searchcraft-placeholder-hide-on-focus:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:44px}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:44px}.searchcraft-input-form-clear-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-button-border-radius: var(--sc-border-radius)}@media(min-width: 576px){:root{--sc-popover-button-border-radius: var(--sc-border-radius-lg)}}.searchcraft-popover-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);cursor:pointer}.searchcraft-popover-button-skeuomorphic{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);display:block;width:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-popover-button-border-radius);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;display:flex;gap:24px;height:40px;justify-content:space-between;line-height:1;padding:4px 5px 4px 10px;background:var(--sc-surface-neutral-primary)}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;height:63px;padding:8px 10px 8px 16px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{align-items:center;display:flex;gap:4px}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{color:var(--sc-content-neutral-secondary);display:flex;gap:4px;font-size:20px;font-weight:500}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 3px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 3px);background-color:var(--sc-surface-neutral-primary);box-shadow:0 3px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 6px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 2px);position:relative}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 8px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 8px);box-shadow:0 4px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 6px 1px rgb(from var(--sc-content-neutral-secondary) r g b/20%),0 7px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 9px 4px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 13px 8px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 5px)}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before,.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{content:"";display:block}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 4px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 4px);background:linear-gradient(340deg, rgb(from var(--sc-surface-neutral-secondary) r g b/2%) 0%, var(--sc-surface-neutral-secondary) 100%);inset:2px;position:absolute}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 12px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 12px);inset:4px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{aspect-ratio:1/1;height:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap>span{display:flex;line-height:1;left:50%;margin-top:2%;position:absolute;top:50%;transform:translate(-50%, -50%)}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:60%;width:auto}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:50%}}:root{--sc-popover-list-view-height: 600px;--sc-popover-modal-max-width: 800px}.searchcraft-popover-form{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);display:flex;flex:1;flex-direction:column}.searchcraft-popover-form searchcraft-input-form,.searchcraft-popover-form searchcraft-popover-footer{width:100%}.searchcraft-popover-form.searchcraft-popover-form-active .searchcraft-popover-form-input{padding-bottom:1px}.searchcraft-popover-form searchcraft-popover-list-view{flex-shrink:1;height:100%;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-input{display:flex;flex-direction:row;gap:12px}.searchcraft-popover-form-input .searchcraft-input-form-input{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius-lg);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-primary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset;width:0}.searchcraft-popover-form-cancel-button{background:none;border:none;cursor:pointer;font-size:14px}.searchcraft-popover-form-modal-input,.searchcraft-popover-form-fullscreen-input{padding:24px}.searchcraft-popover-form-modal-popover-list-view,.searchcraft-popover-form-fullscreen-popover-list-view{flex-grow:1;flex-shrink:1;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-inline{background-color:var(--sc-surface-neutral-primary);border:1px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius-xl);padding:12px;position:relative}.searchcraft-popover-form-inline.searchcraft-popover-form-active{border:1px solid var(--sc-border-neutral);border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:1px}.searchcraft-popover-form-inline searchcraft-popover-list-view{padding:0 12px}.searchcraft-popover-form-inline .searchcraft-input-form-input,.searchcraft-popover-form-inline .searchcraft-popover-list-item-link,.searchcraft-popover-form-inline .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-xl - 12px);border-radius:calc(var(--sc-border-radius-xl) - 12px)}.searchcraft-popover-form-inline-wrapper{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-top:none;border-bottom-left-radius:var(--sc-border-radius-xl);border-bottom-right-radius:var(--sc-border-radius-xl);display:flex;flex-direction:column;left:-1px;max-height:var(--sc-popover-list-view-height);overflow:hidden;position:absolute;right:-1px;top:100%}.searchcraft-popover-form-modal{align-items:center;display:flex;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-modal .searchcraft-input-form-input,.searchcraft-popover-form-modal .searchcraft-popover-list-item-link,.searchcraft-popover-form-modal .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px)}.searchcraft-popover-form-modal-backdrop{background-color:rgb(from var(--sc-content-neutral-primary) r g b/50%);display:none;inset:0;position:fixed}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-wrapper{background-color:var(--sc-surface-neutral-primary);box-shadow:1px 2px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 2px 4px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 4px 8px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 8px 16px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 16px 32px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 32px 64px rgb(from var(--sc-content-neutral-primary) r g b/7%);display:flex;flex-direction:column;inset:0;max-width:var(--sc-popover-modal-max-width);overflow:hidden;position:absolute;width:100%;z-index:1001}@media(min-width: 576px){.searchcraft-popover-form-modal-wrapper{border-radius:var(--sc-border-radius-2xl);inset:0;margin-top:100px;max-height:var(--sc-popover-list-view-height);max-width:var(--sc-popover-modal-max-width);position:relative}}.searchcraft-popover-form-modal-cancel-button{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-modal-cancel-button{padding:8px 12px}}.searchcraft-popover-form-fullscreen{background-color:var(--sc-surface-neutral-primary);display:flex;flex-direction:column;justify-content:space-between;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-item-link,.searchcraft-popover-form-fullscreen .searchcraft-adm-ad-link{border-radius:var(--sc-border-radius-lg)}.searchcraft-popover-form-fullscreen-cancel-button{border-radius:var(--sc-border-radius-lg);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-fullscreen-cancel-button{padding:8px 12px}}.searchcraft-popover-footer{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;background-color:var(--sc-surface-neutral-secondary);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-primary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset;display:flex;gap:8px;justify-content:space-between;line-height:1;padding:20px 24px}@media(min-width: 576px){.searchcraft-popover-footer{padding:20px 32px}}.searchcraft-popover-footer-results-info{margin:0}.searchcraft-popover-footer-link{color:var(--sc-content-neutral-primary);display:flex;max-width:160px;width:100%}:root{--sc-popover-list-item-image-fit: contain}.searchcraft-popover-list-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;border-bottom:1px solid var(--sc-border-neutral);padding:12px 0}searchcraft-popover-list-item:last-child .searchcraft-popover-list-item{border-bottom:none}.searchcraft-popover-list-item-link{align-items:flex-start;color:var(--sc-content-neutral-primary);display:flex;gap:24px;padding:12px;text-decoration:none}.searchcraft-popover-list-item-link:focus,.searchcraft-popover-list-item-link:active{background-color:var(--sc-surface-neutral-primary-active)}.searchcraft-popover-list-item-link:hover{background-color:var(--sc-surface-neutral-primary-hover)}.searchcraft-popover-list-item-image-wrapper{align-items:center;aspect-ratio:16/9;display:flex;flex-shrink:0;justify-content:center;width:160px}.searchcraft-popover-list-item-image{height:100%;object-fit:var(--sc-popover-list-item-image-fit);width:100%}.searchcraft-popover-list-item-content{display:flex;flex-direction:column;flex-grow:1;gap:4px;justify-content:center}.searchcraft-popover-list-item-content-title,.searchcraft-popover-list-item-content-subtitle{display:-webkit-box;line-clamp:2;margin:0;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}.searchcraft-popover-list-item-content-title{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-heading-5-font-size);font-weight:var(--sc-font-bold)}.searchcraft-popover-list-item-content-subtitle{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-popover-list-view{display:flex;flex-direction:column}.searchcraft-results-info{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%;margin-top:4px}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px}.searchcraft-slider-range .searchcraft-slider-input:focus::-webkit-slider-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-range .searchcraft-slider-input:focus::-moz-range-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);justify-content:space-between;margin-top:4px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page-select-input{min-width:120px}.searchcraft-summary-box{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-summary-box h1,.searchcraft-summary-box h2,.searchcraft-summary-box h3,.searchcraft-summary-box h4,.searchcraft-summary-box h5{padding-top:10px;padding-bottom:10px}.searchcraft-summary-box p{padding-bottom:10px}.searchcraft-summary-box img{max-width:200px}.searchcraft-summary-box ol,.searchcraft-summary-box ul{padding-left:1em;padding-bottom:10px}.searchcraft-summary-box a{color:var(--sc-content-brand)}.searchcraft-loading-label{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);margin-top:40px;letter-spacing:2px;color:#828282;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-loading-bars{margin:0 auto;width:60px;height:50px;text-align:center;position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);display:flex;gap:2px}.searchcraft-loading-bars>div{height:100%;width:8px;-webkit-animation:delay .8s infinite ease-in-out;animation:delay .8s infinite ease-in-out;opacity:.2}.searchcraft-loading-bars .searchcraft-loading-bar-1{background-color:var(--sc-surface-brand-primary);opacity:.1}.searchcraft-loading-bars .searchcraft-loading-bar-2{background-color:var(--sc-surface-brand-primary);animation-delay:-0.7s;opacity:.2}.searchcraft-loading-bars .searchcraft-loading-bar-3{background-color:var(--sc-surface-brand-primary);animation-delay:-0.6s;opacity:.3}.searchcraft-loading-bars .searchcraft-loading-bar-4{background-color:var(--sc-surface-brand-primary);animation-delay:-0.5s;opacity:.4}.searchcraft-loading-bars .searchcraft-loading-bar-5{background-color:var(--sc-surface-brand-primary);animation-delay:-0.4s;opacity:.5}.searchcraft-loading-bars .searchcraft-loading-bar-6{background-color:var(--sc-surface-brand-primary);animation-delay:-0.3s;opacity:.6}@keyframes delay{0%,40%,100%{transform:scaleY(0.05)}20%{transform:scaleY(1)}}/*# sourceMappingURL=hologram.css.map */
|
|
10457
|
+
var styles = `[class*=searchcraft-],[class*=searchcraft-] *,[class*=searchcraft-]::before,[class*=searchcraft-]::after,[class*=searchcraft-] *,::before,[class*=searchcraft-] *,::after{box-sizing:border-box;padding:0;margin:0}:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-xl: calc(var(--sc-border-radius) * 3);--sc-border-radius-2xl: calc(var(--sc-border-radius) * 4);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #fafafa) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, var(--sc-color-background-active-computed, #f7f7f7) );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-color-background-secondary-hover-computed: hsl( from var(--sc-color-background-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #e6e6e6) );--sc-color-background-secondary-active-computed: hsl( from var(--sc-color-background-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active-computed, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var( --sc-color-foreground-secondary, var(--sc-color-foreground-secondary-computed, #404040) );--sc-border-neutral: var(--sc-color-border, rgba(0, 0, 0, 0.1));--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var( --sc-color-brand-hover, var(--sc-color-brand-hover-computed, #2e2e2e) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var( --sc-color-brand-active, var(--sc-color-brand-active-computed, #292929) );--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-color-brand-secondary-hover-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-brand-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #ebebeb) );--sc-color-brand-secondary-active-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active-computed, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30 );--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, var(--sc-color-success-primary-hover-computed, #009900) );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20 );--sc-surface-success-primary-active: var( --sc-color-success-primary-active, var(--sc-color-success-primary-active-computed, #006600) );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90 );--sc-surface-success-secondary: var( --sc-color-success-secondary, var(--sc-color-success-secondary-computed, #ccffcc) );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, var(--sc-color-success-secondary-hover-computed, #e6ffe6) );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, var(--sc-color-success-secondary-active-computed, #b2ffb2) );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30 );--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, var(--sc-color-caution-primary-hover-computed, #e57300) );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20 );--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, var(--sc-color-caution-primary-active-computed, #b25a00) );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90 );--sc-surface-caution-secondary: var( --sc-color-caution-secondary, var(--sc-color-caution-secondary-computed, #ffd9b3) );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, var(--sc-color-caution-secondary-hover-computed, #ffe5cc) );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, var(--sc-color-caution-secondary-active-computed, #ffcc99) );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30 );--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, var(--sc-color-danger-primary-hover-computed, #e50000) );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20 );--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, var(--sc-color-danger-primary-active-computed, #b30000) );--sc-color-danger-secondary-computed: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var( --sc-color-danger-secondary, var(--sc-color-danger-secondary-computed, #ffcccc) );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, var(--sc-color-danger-secondary-hover-computed, #ffe7e7) );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, var(--sc-color-danger-secondary-active-computed, #ffb3b3) );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30% );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90% );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30% );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90% );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30% );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20% );--sc-color-danger-secondary-computed: hsl( from var(--sc-color-danger) h s 90% );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-ad{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-ad-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-ad-no-template>p{margin:0}.searchcraft-adm-ad{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-result{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{display:flex;flex-direction:column;gap:8px;width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);gap:8px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input-wrapper{position:relative}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px;margin:0}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:flex}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:flex}.searchcraft-facet-child-list{display:flex;flex-direction:column;gap:6px}.searchcraft-facet-child-list-checkbox-label{margin-left:24px}.searchcraft-facet-child-list-checkbox-label:first-child{margin-top:6px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:50%;position:absolute;margin-top:2px;top:50%;transform:translate(-50%, -50%);width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-disabled);text-align:center}.searchcraft-facet-list-wrapper{display:flex;flex-direction:column;width:100%;min-height:0}.searchcraft-facet-list-content{display:flex;flex-direction:column;gap:8px;min-height:0;flex-shrink:0}.searchcraft-facet-list-view-more{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:none;color:var(--sc-content-brand);cursor:pointer;padding:8px 0;text-align:left;text-decoration:underline}.searchcraft-facet-list-view-more:hover{color:var(--sc-surface-brand-primary-hover)}.searchcraft-facet-list-view-more:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}[data-toggle-facet-section]{cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;position:relative}[data-toggle-facet-section]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-facet-section][data-facet-section-collapsed]::after{transform:rotate(90deg)}[data-toggle-facet-section][data-facet-section-expanded]::after{transform:rotate(-90deg)}@media(max-width: 767px){[data-toggle-filter-panel]{cursor:pointer;display:flex !important;align-items:center;justify-content:space-between;width:100%}[data-toggle-filter-panel]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-filter-panel][data-filter-panel-collapsed]::after{transform:rotate(90deg)}[data-toggle-filter-panel][data-filter-panel-expanded]::after{transform:rotate(-90deg)}}@media(min-width: 768px){[data-toggle-filter-panel]{cursor:default}[data-toggle-filter-panel]::after{display:none}}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px 44px}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px;outline-offset:-1px}.searchcraft-input-form-input.searchcraft-placeholder-hide-on-focus:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:44px}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:44px}.searchcraft-input-form-clear-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-button-border-radius: var(--sc-border-radius)}@media(min-width: 576px){:root{--sc-popover-button-border-radius: var(--sc-border-radius-lg)}}.searchcraft-popover-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);cursor:pointer}.searchcraft-popover-button-skeuomorphic{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);display:block;width:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-popover-button-border-radius);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;display:flex;gap:24px;height:40px;justify-content:space-between;line-height:1;padding:4px 5px 4px 10px;background:var(--sc-surface-neutral-primary)}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;height:63px;padding:8px 10px 8px 16px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{align-items:center;display:flex;gap:4px}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{color:var(--sc-content-neutral-secondary);display:flex;gap:4px;font-size:20px;font-weight:500}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 3px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 3px);background-color:var(--sc-surface-neutral-primary);box-shadow:0 3px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 6px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 2px);position:relative}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 8px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 8px);box-shadow:0 4px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 6px 1px rgb(from var(--sc-content-neutral-secondary) r g b/20%),0 7px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 9px 4px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 13px 8px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 5px)}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before,.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{content:"";display:block}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 4px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 4px);background:linear-gradient(340deg, rgb(from var(--sc-surface-neutral-secondary) r g b/2%) 0%, var(--sc-surface-neutral-secondary) 100%);inset:2px;position:absolute}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 12px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 12px);inset:4px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{aspect-ratio:1/1;height:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap>span{display:flex;line-height:1;left:50%;margin-top:2%;position:absolute;top:50%;transform:translate(-50%, -50%)}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:60%;width:auto}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:50%}}:root{--sc-popover-button-magnifying-glass-icon-size: 20px;--sc-popover-button-magnifying-glass-icon-color: var(--sc-content-neutral-secondary);--sc-popover-button-magnifying-glass-icon-color-hover: var(--sc-content-brand);--sc-popover-button-magnifying-glass-padding: 12px}@media(min-width: 576px){:root{--sc-popover-button-magnifying-glass-padding: 16px}}.searchcraft-popover-button-magnifying-glass{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);cursor:pointer;display:flex;align-items:center;justify-content:center}.searchcraft-popover-button-magnifying-glass .searchcraft-popover-button-input{display:flex;align-items:center;justify-content:center;padding:var(--sc-popover-button-magnifying-glass-padding)}.searchcraft-popover-button-magnifying-glass .searchcraft-popover-button-input-search-icon{color:var(--sc-popover-button-magnifying-glass-icon-color);display:block;fill:none;stroke:currentcolor;stroke-width:1.5;width:var(--sc-popover-button-magnifying-glass-icon-size);height:var(--sc-popover-button-magnifying-glass-icon-size);transition:color .2s ease}.searchcraft-popover-button-magnifying-glass:hover .searchcraft-popover-button-input-search-icon{color:var(--sc-popover-button-magnifying-glass-icon-color-hover)}:root{--sc-popover-list-view-height: 600px;--sc-popover-modal-max-width: 800px}.searchcraft-popover-form{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);display:flex;flex:1;flex-direction:column}.searchcraft-popover-form searchcraft-input-form,.searchcraft-popover-form searchcraft-popover-footer{width:100%}.searchcraft-popover-form.searchcraft-popover-form-active .searchcraft-popover-form-input{padding-bottom:1px}.searchcraft-popover-form searchcraft-popover-list-view{flex-shrink:1;height:100%;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form searchcraft-results-summary,.searchcraft-popover-form searchcraft-summary-box{margin-bottom:16px}.searchcraft-popover-form-input{display:flex;flex-direction:row;gap:12px}.searchcraft-popover-form-input .searchcraft-input-form-input{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius-lg);width:0}.searchcraft-popover-form-cancel-button{background:none;border:none;cursor:pointer;font-size:14px}.searchcraft-popover-form-modal-input,.searchcraft-popover-form-fullscreen-input{padding:24px}.searchcraft-popover-form-modal-popover-list-view,.searchcraft-popover-form-fullscreen-popover-list-view{flex-grow:1;flex-shrink:1;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-modal-popover-list-view searchcraft-results-summary,.searchcraft-popover-form-modal-popover-list-view searchcraft-summary-box,.searchcraft-popover-form-fullscreen-popover-list-view searchcraft-results-summary,.searchcraft-popover-form-fullscreen-popover-list-view searchcraft-summary-box{padding:20px 0;margin-bottom:0;border-bottom:1px solid var(--sc-border-neutral-subtle)}.searchcraft-popover-form-inline{background-color:var(--sc-surface-neutral-primary);border:1px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius-xl);padding:12px;position:relative}.searchcraft-popover-form-inline.searchcraft-popover-form-active{border:1px solid var(--sc-border-neutral);border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:1px}.searchcraft-popover-form-inline searchcraft-popover-list-view{padding:0 12px}.searchcraft-popover-form-inline .searchcraft-input-form-input,.searchcraft-popover-form-inline .searchcraft-popover-list-item-link,.searchcraft-popover-form-inline .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-xl - 12px);border-radius:calc(var(--sc-border-radius-xl) - 12px)}.searchcraft-popover-form-inline-wrapper{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-top:none;border-bottom-left-radius:var(--sc-border-radius-xl);border-bottom-right-radius:var(--sc-border-radius-xl);display:flex;flex-direction:column;left:-1px;max-height:var(--sc-popover-list-view-height);overflow:hidden;position:absolute;right:-1px;top:100%}.searchcraft-popover-form-inline-wrapper searchcraft-results-summary,.searchcraft-popover-form-inline-wrapper searchcraft-summary-box{padding:16px 12px;margin-bottom:0;border-bottom:1px solid var(--sc-border-neutral-subtle)}.searchcraft-popover-form-modal{align-items:center;display:flex;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-modal .searchcraft-input-form-input,.searchcraft-popover-form-modal .searchcraft-popover-list-item-link,.searchcraft-popover-form-modal .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px)}.searchcraft-popover-form-modal-backdrop{background-color:rgb(from var(--sc-content-neutral-primary) r g b/50%);display:none;inset:0;position:fixed}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-wrapper{background-color:var(--sc-surface-neutral-primary);box-shadow:1px 2px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 2px 4px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 4px 8px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 8px 16px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 16px 32px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 32px 64px rgb(from var(--sc-content-neutral-primary) r g b/7%);display:flex;flex-direction:column;inset:0;max-width:var(--sc-popover-modal-max-width);overflow:hidden;position:absolute;width:100%;z-index:1001}@media(min-width: 576px){.searchcraft-popover-form-modal-wrapper{border-radius:var(--sc-border-radius-2xl);inset:0;margin-top:100px;max-height:var(--sc-popover-list-view-height);max-width:var(--sc-popover-modal-max-width);position:relative}}.searchcraft-popover-form-modal-cancel-button{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-modal-cancel-button{padding:8px 12px}}.searchcraft-popover-form-fullscreen{background-color:var(--sc-surface-neutral-primary);display:flex;flex-direction:column;justify-content:space-between;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-item-link,.searchcraft-popover-form-fullscreen .searchcraft-adm-ad-link{border-radius:var(--sc-border-radius-lg)}.searchcraft-popover-form-fullscreen-cancel-button{border-radius:var(--sc-border-radius-lg);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-fullscreen-cancel-button{padding:8px 12px}}.searchcraft-popover-footer{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;align-items:center;background-color:var(--sc-surface-neutral-secondary);display:flex;gap:.5rem;justify-content:space-between;line-height:1;padding:1.25rem 1.5rem}@media(min-width: 576px){.searchcraft-popover-footer{padding:1.25rem 2rem}}.searchcraft-popover-footer-results-info{margin:0}.searchcraft-popover-footer-results-found{display:none}@media(min-width: 576px){.searchcraft-popover-footer-results-found{display:inline}}.searchcraft-popover-footer-link{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-weight:var(--sc-font-bold);text-decoration:none;white-space:nowrap}.searchcraft-popover-footer-link-prefix{display:none;font-weight:var(--sc-font-normal)}@media(min-width: 576px){.searchcraft-popover-footer-link-prefix{display:inline}}.searchcraft-popover-footer-results{align-items:center;display:flex;gap:.5rem}.searchcraft-popover-footer-view-all{align-items:center;border-radius:999px;border:.0625rem solid var(--sc-border-neutral-strong);color:var(--sc-content-neutral-primary);display:inline-flex;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-bold);gap:.375rem;line-height:1;padding:.375rem .625rem;text-decoration:none}.searchcraft-popover-footer-view-all-shortcut{display:none}@media(min-width: 576px){.searchcraft-popover-footer-view-all-shortcut{display:inline-flex;gap:.125rem}.searchcraft-popover-footer-view-all-shortcut kbd{align-items:center;border-radius:.25rem;border:1px solid var(--sc-content-neutral-primary);display:flex;font-family:Helvetica,Arial,sans-serif;font-size:.75rem;font-style:normal;font-weight:400;height:1.5rem;justify-content:center;line-height:1rem;width:1.5rem}}:root{--sc-popover-list-item-image-fit: contain}.searchcraft-popover-list-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;border-bottom:1px solid var(--sc-border-neutral);padding:12px 0}searchcraft-popover-list-item:last-child .searchcraft-popover-list-item{border-bottom:none}.searchcraft-popover-list-item-link{align-items:flex-start;color:var(--sc-content-neutral-primary);display:flex;gap:24px;padding:12px;text-decoration:none}.searchcraft-popover-list-item-link:focus,.searchcraft-popover-list-item-link:active{background-color:var(--sc-surface-neutral-primary-active)}.searchcraft-popover-list-item-link:hover{background-color:var(--sc-surface-neutral-primary-hover)}.searchcraft-popover-list-item-image-wrapper{align-items:center;aspect-ratio:16/9;display:flex;flex-shrink:0;justify-content:center;width:160px}.searchcraft-popover-list-item-image{height:100%;object-fit:var(--sc-popover-list-item-image-fit);width:100%}.searchcraft-popover-list-item-content{display:flex;flex-direction:column;flex-grow:1;gap:4px;justify-content:center}.searchcraft-popover-list-item-content-title,.searchcraft-popover-list-item-content-subtitle{display:-webkit-box;line-clamp:2;margin:0;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}.searchcraft-popover-list-item-content-title{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-heading-5-font-size);font-weight:var(--sc-font-bold)}.searchcraft-popover-list-item-content-subtitle{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-popover-list-view{display:flex;flex-direction:column}.searchcraft-results-info{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%;margin-top:4px}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px}.searchcraft-slider-range .searchcraft-slider-input:focus::-webkit-slider-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-range .searchcraft-slider-input:focus::-moz-range-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);justify-content:space-between;margin-top:4px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page-select-input{min-width:120px}.searchcraft-results-summary{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-results-summary h1,.searchcraft-results-summary h2,.searchcraft-results-summary h3,.searchcraft-results-summary h4,.searchcraft-results-summary h5{padding-top:10px;padding-bottom:10px}.searchcraft-results-summary p{padding-bottom:10px}.searchcraft-results-summary img{max-width:200px}.searchcraft-results-summary ol,.searchcraft-results-summary ul{padding-left:1em;padding-bottom:10px}.searchcraft-results-summary a{color:var(--sc-content-brand)}.searchcraft-summary-box{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-summary-box h1,.searchcraft-summary-box h2,.searchcraft-summary-box h3,.searchcraft-summary-box h4,.searchcraft-summary-box h5{padding-top:10px;padding-bottom:10px}.searchcraft-summary-box p{padding-bottom:10px}.searchcraft-summary-box img{max-width:200px}.searchcraft-summary-box ol,.searchcraft-summary-box ul{padding-left:1em;padding-bottom:10px}.searchcraft-summary-box a{color:var(--sc-content-brand)}.searchcraft-loading{display:flex;flex-direction:column;align-items:center;gap:12px;position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}.searchcraft-loading-dots{display:flex;gap:8px;align-items:center;height:40px}.searchcraft-loading-dots>div{width:10px;height:10px;border-radius:50%;background-color:var(--sc-surface-brand-primary);animation:searchcraft-jump .6s ease-in-out infinite}.searchcraft-loading-dots .searchcraft-loading-dot-2{animation-delay:.15s}.searchcraft-loading-dots .searchcraft-loading-dot-3{animation-delay:.3s}.searchcraft-loading-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);letter-spacing:2px;color:#828282;margin:0}@keyframes searchcraft-jump{0%{transform:translateY(0);animation-timing-function:cubic-bezier(0.33, 1, 0.68, 1)}50%{transform:translateY(-20px);animation-timing-function:cubic-bezier(0.32, 0, 0.67, 0)}100%{transform:translateY(0)}}/*# sourceMappingURL=hologram.css.map */
|
|
10150
10458
|
`;
|
|
10151
10459
|
|
|
10152
10460
|
/**
|
|
@@ -10182,7 +10490,7 @@ class SearchcraftTheme {
|
|
|
10182
10490
|
registerInstance(this, hostRef);
|
|
10183
10491
|
}
|
|
10184
10492
|
render() {
|
|
10185
|
-
return hAsync("style", { key: '
|
|
10493
|
+
return hAsync("style", { key: 'ef26626cdfa4fa98d516802d71443c49a9c6ecf9' }, styles);
|
|
10186
10494
|
}
|
|
10187
10495
|
static get cmpMeta() { return {
|
|
10188
10496
|
"$flags$": 256,
|
|
@@ -10246,9 +10554,9 @@ class SearchcraftToggleButton {
|
|
|
10246
10554
|
this.cleanupCore?.();
|
|
10247
10555
|
}
|
|
10248
10556
|
render() {
|
|
10249
|
-
return (hAsync("div", { key: '
|
|
10557
|
+
return (hAsync("div", { key: 'ab1d5ee21c7aaa28af1c405edc986556858366e8', class: classNames('searchcraft-toggle-button', {
|
|
10250
10558
|
'searchcraft-toggle-button-active': this.isActive,
|
|
10251
|
-
}) }, hAsync("div", { key: '
|
|
10559
|
+
}) }, hAsync("div", { key: '44f86a16d796d448bdb2fb3af72d4d8e1484364b' }, hAsync("p", { key: '9fedb38795d6379cae56dc005ab8e4a944b4261b', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (hAsync("p", { key: '44f3d17175184032275fec89a4cfe7f8266b7014', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), hAsync("button", { key: '15fc18906ff2fb21fe646a4e3a8a2ace4a37cae2', class: 'searchcraft-toggle-button-background', onClick: this.handleToggle, type: 'button' }, hAsync("div", { key: '716d29c65a199f63f5fd294dc3e3ad2ea4d53aa3', class: 'searchcraft-toggle-button-handle' }))));
|
|
10252
10560
|
}
|
|
10253
10561
|
static get cmpMeta() { return {
|
|
10254
10562
|
"$flags$": 768,
|
|
@@ -10282,6 +10590,7 @@ registerComponents([
|
|
|
10282
10590
|
SearchcraftPopoverListItemAd,
|
|
10283
10591
|
SearchcraftPopoverListView,
|
|
10284
10592
|
SearchcraftResultsInfo,
|
|
10593
|
+
SearchcraftResultsSummary,
|
|
10285
10594
|
SearchcraftSearchResult,
|
|
10286
10595
|
SearchcraftSearchResults,
|
|
10287
10596
|
SearchcraftSearchResultsPerPage,
|