PageSourceSearch

https://www.principal.com/profiles/contrib/houston/modules/pfg_cov…coveo-smart-snippet-suggestions.BoIuJUJ9.js

js principal.com collected 2026-09-24 08:41:29 UTC 10,824 bytes, 182 lines download raw bytes

1import { f as e, n as t, r as n } from "./pdscoveo-breadbox.9Y03e-5b.js";
2import { o as r } from "./headless.D8NBuANw.js";
3import { _ as i, d as a, f as o, h as s, p as c, u as l } from "./lit.BIXSeZ-E.js";
4import { c as u, l as d } from "./pdscoveo-notifications.CdZO0xYK.js";
5import "./pdscoveo-refine-modal.CFMmEh3N.js";
6//#region packages/pdscoveo/src/components/pdscoveo-smart-snippet-suggestions/pdscoveo-smart-snippet-suggestions.css?inline
7var f = ":host{display:block}.suggestion-container{padding:0 calc(3 * var(--pds-base-unit,8px))}.suggestion-heading{margin-bottom:calc(3 * var(--pds-base-unit,8px))}pds-accordion [slot=accordion-content] .suggestion-source-title{font-family:var(--pds-semantic-type-body-bold-default-font-family);margin-top:0;margin-bottom:0}pds-accordion [slot=accordion-content] div>:first-child{margin-top:0}.suggestion-source pds-hr{margin:calc(2 * var(--pds-base-unit,8px)) 0;padding-right:25%}", p = "*,::slotted(*),*:before,*:after{box-sizing:border-box}:host{display:block}.pds-c-band{padding-top:calc(var(--pds-base-unit) * 4);padding-bottom:calc(var(--pds-base-unit) * 4);background-color:var(--pds-semantic-background-default)}@media all and (min-width:768px){.pds-c-band{padding-top:calc(var(--pds-base-unit) * 8);padding-bottom:calc(var(--pds-base-unit) * 8)}}.pds-c-band--spacing-none{padding-top:0;padding-bottom:0}@media all and (min-width:768px){.pds-c-band--spacing-none{padding-top:0;padding-bottom:0}}.pds-c-band--spacing-sm{padding-top:calc(var(--pds-base-unit) * 2);padding-bottom:calc(var(--pds-base-unit) * 2)}@media all and (min-width:768px){.pds-c-band--spacing-sm{padding-top:calc(var(--pds-base-unit) * 4);padding-bottom:calc(var(--pds-base-unit) * 4)}}.pds-c-band--spacing-lg{padding-top:calc(var(--pds-base-unit) * 8);padding-bottom:calc(var(--pds-base-unit) * 8)}@media all and (min-width:768px){.pds-c-band--spacing-lg{padding-top:calc(var(--pds-base-unit) * 16);padding-bottom:calc(var(--pds-base-unit) * 16)}}.pds-c-band--rounded{border-radius:calc(var(--pds-base-unit) * .5)}.pds-c-band--subtle{background-color:var(--pds-semantic-background-subtle)}.pds-c-band--strong{background-color:var(--pds-semantic-background-strong)}.pds-c-band--brand-default{background-color:var(--pds-semantic-background-brand-default)}.pds-c-band--brand-strong{background-color:var(--pds-semantic-background-brand-strong)}.pds-c-band--brand-xstrong{background-color:var(--pds-semantic-background-brand-xstrong)}.pds-c-band--alt-brand-default{background-color:var(--pds-semantic-background-alt-brand-default)}.pds-c-band--alt-brand-xstrong{background-color:var(--pds-semantic-background-alt-brand-xstrong)}.pds-c-band--brand-gradient-subtle-2stop{background-image:var(--pds-semantic-background-brand-gradient-subtle-2stop)}.pds-c-band--brand-gradient-subtle-3stop{background-image:var(--pds-semantic-background-brand-gradient-subtle-3stop)}.pds-c-band--brand-gradient-strong-2stop{background-image:var(--pds-semantic-background-brand-gradient-strong-2stop)}.pds-c-band--brand-gradient-strong-3stop{background-image:var(--pds-semantic-background-brand-gradient-strong-3stop)}.pds-c-band--brand-gradient-xstrong-2stop{background-image:var(--pds-semantic-background-brand-gradient-xstrong-2stop)}.pds-c-band--brand-gradient-xstrong-3stop{background-image:var(--pds-semantic-background-brand-gradient-xstrong-3stop)}.pds-c-band--brand-gradient-strong{background-image:var(--pds-semantic-background-brand-gradient-strong-2stop)}.pds-c-band--brand-gradient-xstrong{background-image:var(--pds-semantic-background-brand-gradient-xstrong-2stop)}", m = Object.defineProperty, h = Object.getOwnPropertyDescriptor, g = (e, t, n, r) => {
8	for (var i = r > 1 ? void 0 : r ? h(t, n) : t, a = e.length - 1, o; a >= 0; a--) (o = e[a]) && (i = (r ? o(t, n, i) : o(i)) || i);
9	return r && i && m(t, n, i), i;
10}, _ = class extends u {
11	constructor() {
12		super(...arguments), this.variant = "default", this.rounded = !1, this.spacing = "default";
13	}
14	get classNames() {
15		return {
16			[`${this.variant}`]: !!this.variant,
17			[`spacing-${this.spacing}`]: !!this.spacing,
18			rounded: !!this.rounded
19		};
20	}
21	updated(e) {
22		super.updated(e), e.has("variant") && (this.variant === "brand-gradient-strong" ? console.warn("PDS v5 Deprecation Warning: The 'brand-gradient-strong' variant on <pds-band> is deprecated and will be removed in v6. Use 'brand-gradient-strong-2stop' instead.") : this.variant === "brand-gradient-xstrong" && console.warn("PDS v5 Deprecation Warning: The 'brand-gradient-xstrong' variant on <pds-band> is deprecated and will be removed in v6. Use 'brand-gradient-xstrong-2stop' instead."));
23	}
24	render() {
25		return s`<div class=${this.getClass()}>
26      <slot></slot>
27    </div>`;
28	}
29};
30g([a()], _.prototype, "variant", 2), g([a({ type: Boolean })], _.prototype, "rounded", 2), g([a()], _.prototype, "spacing", 2), _ = g([d("pds-band", {
31	category: "component",
32	type: "component",
33	state: "stable",
34	styles: p
35})], _);
36//#endregion
37//#region node_modules/@principal/design-system/es/hr.js
38var v = "*,::slotted(*),*:before,*:after{box-sizing:border-box}:host{display:block}.pds-c-hr{margin:0;border:none;background-color:var(--pds-semantic-border-default);color:var(--pds-semantic-border-default);height:1px}", y = Object.getOwnPropertyDescriptor, b = (e, t, n, r) => {
39	for (var i = r > 1 ? void 0 : r ? y(t, n) : t, a = e.length - 1, o; a >= 0; a--) (o = e[a]) && (i = o(i) || i);
40	return i;
41}, x = class extends u {
42	get classNames() {
43		return {};
44	}
45	render() {
46		return s`<hr class=${this.getClass()} />`;
47	}
48};
49x = b([d("pds-hr", {
50	category: "component",
51	type: "component",
52	state: "stable",
53	styles: v
54})], x);
55//#endregion
56//#region packages/pdscoveo/src/components/pdscoveo-smart-snippet-suggestions/pdscoveo-smart-snippet-suggestions.ts
57var S = class extends c {
58	constructor(...e) {
59		super(...e), this.smartSnippetQuestionsListUnsubscribe = () => {}, this.headerText = "People also ask", this.headingTag = "h2", this.headingVariant = "title-default", this.rounded = !0, this.spacing = "sm", this.variant = "subtle";
60	}
61	static {
62		this.styles = i(f);
63	}
64	get relatedQuestions() {
65		return this.suggestionsState?.questions || [];
66	}
67	logLinkClick(e) {
68		let t = e.composedPath()[0];
69		if (t.tagName !== "A" && t.tagName !== "PDS-LINK") return;
70		let n = t.closest("pds-accordion").dataset.questionAnswerId;
71		if (t.classList.contains("suggestion-source-link")) this.smartSnippetQuestionsList.selectSource(n);
72		else {
73			let e = {
74				linkText: t.innerText,
75				linkURL: t.href
76			};
77			this.smartSnippetQuestionsList.selectInlineLink(n, e);
78		}
79	}
80	logAccordionOpen(e) {
81		let t = e.composedPath()[0];
82		this.smartSnippetQuestionsList.expand(t.dataset.questionAnswerId);
83	}
84	logAccordionClose(e) {
85		let t = e.composedPath()[0];
86		this.smartSnippetQuestionsList.collapse(t.dataset.questionAnswerId);
87	}
88	async connectedCallback() {
89		super.connectedCallback(), this.addEventListener("pds-link-click", this.logLinkClick), this.addEventListener("click", this.logLinkClick), this.addEventListener("pds-accordion-open", this.logAccordionOpen), this.addEventListener("pds-accordion-close", this.logAccordionClose);
90		try {
91			this.bindings = await e(this), this.smartSnippetQuestionsList = r(this.bindings.engine), this.smartSnippetQuestionsListUnsubscribe = this.smartSnippetQuestionsList.subscribe(() => {
92				this.suggestionsState = this.smartSnippetQuestionsList.state;
93			});
94		} catch (e) {
95			console.error(e), this.error = e;
96		}
97	}
98	disconnectedCallback() {
99		this.removeEventListener("pds-link-click", this.logLinkClick), this.removeEventListener("click", this.logLinkClick), this.removeEventListener("pds-accordion-open", this.logAccordionOpen), this.removeEventListener("pds-accordion-close", this.logAccordionClose), this.smartSnippetQuestionsListUnsubscribe(), super.disconnectedCallback();
100	}
101	render() {
102		if (this.error) return s`
103        <p>
104          Error when initializing smart snippet suggestions, please view the
105          console for more information.
106        </p>
107      `;
108		if (this.relatedQuestions.length) return s`
109      <pds-band
110        ?rounded=${this.rounded ? "true" : null}
111        spacing=${this.spacing}
112        variant=${this.variant}
113      >
114        <div class="suggestion-container">
115          <pds-heading
116            class="suggestion-heading"
117            headingTag=${this.headingTag}
118            ?inverted=${this.variant.match(/strong/g) ? !0 : null}
119            variant=${this.headingVariant}
120          >
121            ${this.headerText}
122          </pds-heading>
123          ${this.relatedQuestions.map((e) => s`
124                <pds-accordion
125                  data-question-answer-id=${e.questionAnswerId}
126                  key=${e.questionAnswerId}
127                  variant=${this.variant.match(/strong/g) ? "inverted" : "default"}
128                >
129                  <span slot="summary-title">
130                    ${e.question}
131                  </span>
132                  <div slot="accordion-content">
133                    <div>
134                      ${e.answer}
135                    </div>
136                    ${e.source && s`
137                      <div class="suggestion-source">
138                        <pds-hr></pds-hr>
139                        <pds-link
140                          class="suggestion-source-link"
141                          href=${e.source?.clickUri}
142                          size="sm"
143                          variant=${this.variant.match(/strong/g) ? "inverted" : "default"}
144                        >
145                          ${e.source?.clickUri}
146                        </pds-link>
147                        <p class="suggestion-source-title">
148                          ${e.source?.title}
149                        </p>
150                      </div>
151                    `}
152                  </div>
153                </pds-accordion>
154              `)}
155        </div>
156      </pds-band>
157    `;
158	}
159};
160t([l(), n("design:type", Object)], S.prototype, "suggestionsState", void 0), t([a({
161	attribute: "header-text",
162	type: String
163}), n("design:type", Object)], S.prototype, "headerText", void 0), t([a({
164	attribute: "heading-tag",
165	type: String
166}), n("design:type", Object)], S.prototype, "headingTag", void 0), t([a({
167	attribute: "heading-variant",
168	type: String
169}), n("design:type", Object)], S.prototype, "headingVariant", void 0), t([a({
170	attribute: "rounded",
171	type: Boolean
172}), n("design:type", Object)], S.prototype, "rounded", void 0), t([a({
173	attribute: "spacing",
174	type: String
175}), n("design:type", Object)], S.prototype, "spacing", void 0), t([a({
176	attribute: "variant",
177	type: String
178}), n("design:type", Object)], S.prototype, "variant", void 0), S = t([o("pdscoveo-smart-snippet-suggestions")], S);
179//#endregion
180export { S as t };
181
182//# sourceMappingURL=pdscoveo-smart-snippet-suggestions.BoIuJUJ9.js.map

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.