1import { y as e } from "./esmDc86wdRn.js"; 2import { a as t, i as n, n as r, o as i, r as a, u as o } from "./decoratorsDgvFPsqQ.js"; 3import { t as s } from "./error-guardDZkUaSL0.js"; 4import { u as c } from "./utilsCdZ5ESYt.js"; 5import { n as l, t as u } from "./local-storage-utilsB2WZQS-n.js"; 6import { t as d } from "./suggestions-eventsDrxC_N55.js"; 7import { i as f, n as p, r as m, t as h } from "./recent-queriesBB8OhR-M.js"; 8//#region node_modules/@coveo/atomic/dist/atomic/components/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.js 9var g = function(e, t, n, r) { 10 var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o; 11 if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r); 12 else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a); 13 return i > 3 && a && Object.defineProperty(t, n, a), a; 14}, _ = "<svg fill=\"none\" stroke=\"currentColor\" stroke-linejoin=\"round\" stroke-linecap=\"round\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"8\" cy=\"8\" r=\"7.5\"/><path d=\"m8.5 4.5v4\"/><path d=\"m10.3066 10.1387-1.80932-1.5768\"/></svg>", v = class extends t { 15 constructor() { 16 super(...arguments), this.maxWithQuery = 3, this.warnUser = c(() => this.bindings.engine.logger.warn("The recent queries feature is deactivated because analytics are disabled.")); 17 } 18 connectedCallback() { 19 super.connectedCallback(); 20 try { 21 d((e) => (this.bindings = e, this.initialize()), this, ["atomic-search-box"]); 22 } catch (e) { 23 this.error = e; 24 } 25 } 26 initialize() { 27 return this.storage = new u(), this.recentQueriesList = e(this.bindings.engine, { 28 initialState: { queries: this.retrieveLocalStorage() }, 29 options: { 30 maxLength: 1e3, 31 clearFilters: this.bindings.clearFilters 32 } 33 }), this.recentQueriesList.subscribe(() => this.updateLocalStorage()), { 34 position: Array.from(this.parentNode.children).indexOf(this), 35 renderItems: () => this.renderItems() 36 }; 37 } 38 retrieveLocalStorage() { 39 return this.storage.getParsedJSON(l.RECENT_QUERIES, []); 40 } 41 updateLocalStorage() { 42 return this.recentQueriesList.state.analyticsEnabled ? this.storage.setJSON(l.RECENT_QUERIES, this.recentQueriesList.state.queries) : this.disableFeature(); 43 } 44 disableFeature() { 45 this.warnUser(), this.storage.removeItem(l.RECENT_QUERIES); 46 } 47 renderItems() { 48 if (!this.recentQueriesList.state.analyticsEnabled) return []; 49 let e = this.bindings.searchBoxController.state.value, t = e === "" ? this.maxWithoutQuery : this.maxWithQuery, n = this.recentQueriesList.state.queries.filter((t) => t.toLowerCase().startsWith(e.toLowerCase())).slice(0, t).map((e) => this.renderItem(e)); 50 return n.length && n.unshift(this.renderClear()), n; 51 } 52 renderClear() { 53 return { 54 ...h(this.bindings.i18n), 55 content: f({ i18n: this.bindings.i18n }), 56 onSelect: () => { 57 this.recentQueriesList.clear(), this.bindings.triggerSuggestions(); 58 } 59 }; 60 } 61 renderItem(e) { 62 let t = this.bindings.searchBoxController.state.value; 63 return { 64 ...p(e, this.bindings.i18n), 65 content: m({ 66 icon: this.icon || _, 67 query: t, 68 value: e 69 }), 70 onSelect: () => { 71 if (this.bindings.isStandalone) { 72 this.bindings.searchBoxController.updateText(e), this.bindings.searchBoxController.submit(); 73 return; 74 } 75 this.recentQueriesList.executeRecentQuery(this.recentQueriesList.state.queries.indexOf(e)); 76 } 77 }; 78 } 79 render() { 80 return o`${i}`; 81 } 82}; 83g([r()], v.prototype, "error", void 0), g([a()], v.prototype, "icon", void 0), g([a({ 84 type: Number, 85 attribute: "max-with-query", 86 reflect: !0 87})], v.prototype, "maxWithQuery", void 0), g([a({ 88 type: Number, 89 attribute: "max-without-query", 90 reflect: !0 91})], v.prototype, "maxWithoutQuery", void 0), g([s()], v.prototype, "render", null), v = g([n("atomic-search-box-recent-queries")], v); 92//#endregion 93export { v as AtomicSearchBoxRecentQueries };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.