@netlify/spark-ui 1.10.0 → 1.12.0-alpha.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.
Files changed (21) hide show
  1. package/dist/assets/AskNetlify.css +1 -1
  2. package/dist/components/preact/AskNetlify/AskNetlify.d.ts +3 -2
  3. package/dist/components/preact/AskNetlify/AskNetlify.js +32 -31
  4. package/dist/components/preact/AskNetlify/components/ChatInterface.d.ts +1 -1
  5. package/dist/components/preact/AskNetlify/components/ChatMessages.js +61 -57
  6. package/dist/components/preact/AskNetlify/components/SourcesList.d.ts +3 -0
  7. package/dist/components/preact/AskNetlify/components/SourcesList.js +19 -0
  8. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.d.ts +1 -0
  9. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +56 -43
  10. package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
  11. package/dist/components/preact/SearchModal/components/SearchWindow.js +26 -38
  12. package/dist/components/preact/SearchModal/types/search.types.d.ts +0 -3
  13. package/package.json +2 -2
  14. package/packages/components/preact/AskNetlify/AskNetlify.css +13 -0
  15. package/packages/components/preact/AskNetlify/AskNetlify.tsx +11 -3
  16. package/packages/components/preact/AskNetlify/components/ChatInterface.tsx +1 -1
  17. package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +4 -1
  18. package/packages/components/preact/AskNetlify/components/SourcesList.tsx +25 -0
  19. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +21 -4
  20. package/packages/components/preact/SearchModal/components/SearchWindow.tsx +0 -10
  21. package/packages/components/preact/SearchModal/types/search.types.tsx +0 -1
@@ -1 +1 @@
1
- .n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;gap:var(--space-s)}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);font-size:var(--step--1);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding:.5rem 1rem;background:var(--search-back-btn-bg-color);border:.5px solid var(--color-bg-3);border-radius:var(--radius-pill);font-size:var(--step--1);color:var(--color-text-1);cursor:pointer}.n-ask-button-back [data-icon=caretRight]{color:var(--color-text-weaker);transform:rotate(180deg)}.n-ask-prose{font-size:var(--step--0)}.n-ask-prose>*+*{margin-top:var(--flow-space, var(--space-s))}.n-ask-prose :where(ol,ul,li)>*+*{margin-top:var(--flow-space, var(--space-3xs))}.n-ask-prose h1,.n-ask-prose h2,.n-ask-prose h3{font-size:var(--step-1);font-weight:var(--font-weight-bold)}.n-ask-prose h4,.n-ask-prose h5,.n-ask-prose h6{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-prose pre{max-width:100%;padding:var(--space-s);background:var(--neutral-light-700);border-radius:var(--radius-m);box-sizing:border-box;color:var(--neutral-100);overflow-x:auto}.n-ask-prose code{overflow-x:auto}.n-ask-prose code[class*=language-],.n-ask-prose pre[class*=language-]{display:block;font-size:var(--font-size-text-xs)}.n-ask-message-loader{width:2.5rem;height:auto;display:block;color:var(--search-loading-color)}.n-ask-message-loader :where(#ask-netlify-tick-1,#ask-netlify-tick-2,#ask-netlify-tick-3){opacity:0;animation:fadeIn .8s ease-in-out infinite}.n-ask-message-loader #ask-netlify-tick-1{animation-delay:.1s}.n-ask-message-loader #ask-netlify-tick-2{animation-delay:.2s}.n-ask-message-loader #ask-netlify-tick-3{animation-delay:.3s}.n-ask-message-loader :where(#ask-netlify-eyelid-left,#ask-netlify-eyelid-right){transform-origin:top center;transform:scaleY(1.035);animation:askEyeBlink 4s infinite;animation-delay:1s}@keyframes askEyeBlink{0%,5%{transform:scaleY(1.035)}6%,10%{transform:scaleY(1.3)}11%,15%{transform:scaleY(1.035)}16%,20%{transform:scaleY(1.3)}21%,to{transform:scaleY(1.035)}}
1
+ .n-fadeIn{opacity:0;animation:fadeIn var(--animation-duration, .3s) ease-out forwards}.n-fadeInUp{opacity:0;transform:translateY(var(--animation-transformY, 5px));animation:fadeInUp var(--animation-duration, .3s) ease-out forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.n-ask-chat-container{opacity:0;animation:appearContainer .12s ease-in-out forwards;animation-delay:.14s}.n-ask-conversation{display:grid;align-items:flex-end;height:calc(var(--n-search-container-height) + var(--n-search-footer-height));padding:var(--n-search-padding-inline);overflow-y:auto;scroll-behavior:smooth;gap:var(--space-s)}.n-ask-form{display:flex;align-items:center;position:relative;height:var(--n-search-input-height);background-color:var(--search-input-bg-color)}.n-ask-form:after{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:1px;background:var(--color-bg-3)}.n-ask-question{border:none;border-radius:var(--radius-pill);transform:translate(-.75rem);color:var(--color-text-1);font-size:var(--step--1);font-weight:var(--font-weight-regular);text-align:left;text-wrap:pretty;display:flex;align-items:center;gap:var(--space-2xs);transition:background-color .2s ease-out}.n-ask-question [data-icon=caretRight]{opacity:0;color:var(--color-text-weaker);transform:translate(-3px);transition:transform .2s ease-out}.n-ask-question:hover{background-color:var(--n-search-color-bg-2)}.n-ask-question:hover [data-icon=caretRight]{opacity:1;transform:translate(0)}.n-ask-question-list .n-ask-question-list-item{position:relative;width:fit-content;opacity:0;transform:translateY(10px);animation:fadeInUp .5s forwards}.n-ask-message{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-s);margin-block-start:var(--space-2xl)}.n-ask-message-bubble{width:fit-content;max-width:85%;padding:var(--space-xs) var(--space-s);background:var(--search-answer-message-color);border-radius:var(--radius-l);font-size:var(--step-0)}.n-ask-user-message{margin-inline-start:auto;background:var(--search-user-message-color)}.n-ask-sources{margin-block-start:var(--space-m)}.n-ask-sources-title{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-sources a{font-size:var(--step--1)}.n-ask-input{border:none;outline:none;padding-inline:var(--n-search-padding-inline)}.n-ask-form-submit{padding:.7rem;margin-inline-end:var(--space-2xs);border:none;border-radius:var(--radius-pill);background:var(--search-submit-btn-bg-color);color:var(--neutral-000);transition:background-color .15s ease-out}.n-ask-form-submit>svg{width:1rem;height:auto;aspect-ratio:1 / 1;border-radius:1.5px;transition:opacity .15s ease-out}.n-ask-form-submit[disabled]{background:var(--neutral-500)}.n-ask-form-submit[disabled]>*{opacity:.5}.n-ask-button-back{position:absolute;z-index:1;width:fit-content;margin:1rem;padding:.5rem 1rem;background:var(--search-back-btn-bg-color);border:.5px solid var(--color-bg-3);border-radius:var(--radius-pill);font-size:var(--step--1);color:var(--color-text-1);cursor:pointer}.n-ask-button-back [data-icon=caretRight]{color:var(--color-text-weaker);transform:rotate(180deg)}.n-ask-prose{font-size:var(--step--0)}.n-ask-prose>*+*{margin-top:var(--flow-space, var(--space-s))}.n-ask-prose :where(ol,ul,li)>*+*{margin-top:var(--flow-space, var(--space-3xs))}.n-ask-prose h1,.n-ask-prose h2,.n-ask-prose h3{font-size:var(--step-1);font-weight:var(--font-weight-bold)}.n-ask-prose h4,.n-ask-prose h5,.n-ask-prose h6{font-size:var(--step-0);font-weight:var(--font-weight-bold)}.n-ask-prose pre{max-width:100%;padding:var(--space-s);background:var(--neutral-light-700);border-radius:var(--radius-m);box-sizing:border-box;color:var(--neutral-100);overflow-x:auto}.n-ask-prose code{overflow-x:auto}.n-ask-prose code[class*=language-],.n-ask-prose pre[class*=language-]{display:block;font-size:var(--font-size-text-xs)}.n-ask-message-loader{width:2.5rem;height:auto;display:block;color:var(--search-loading-color)}.n-ask-message-loader :where(#ask-netlify-tick-1,#ask-netlify-tick-2,#ask-netlify-tick-3){opacity:0;animation:fadeIn .8s ease-in-out infinite}.n-ask-message-loader #ask-netlify-tick-1{animation-delay:.1s}.n-ask-message-loader #ask-netlify-tick-2{animation-delay:.2s}.n-ask-message-loader #ask-netlify-tick-3{animation-delay:.3s}.n-ask-message-loader :where(#ask-netlify-eyelid-left,#ask-netlify-eyelid-right){transform-origin:top center;transform:scaleY(1.035);animation:askEyeBlink 4s infinite;animation-delay:1s}@keyframes askEyeBlink{0%,5%{transform:scaleY(1.035)}6%,10%{transform:scaleY(1.3)}11%,15%{transform:scaleY(1.035)}16%,20%{transform:scaleY(1.3)}21%,to{transform:scaleY(1.035)}}
@@ -1,7 +1,8 @@
1
1
  interface AskNetlifyProps {
2
- setModalState?: (state?: {
2
+ kapaIntegrationId?: string;
3
+ setModalState?: (e: {
3
4
  current: string;
4
5
  }) => void;
5
6
  }
6
- export default function AskNetlify(props: AskNetlifyProps): import("preact").JSX.Element;
7
+ export default function AskNetlify(props: AskNetlifyProps): import("preact").JSX.Element | undefined;
7
8
  export {};
@@ -1,35 +1,36 @@
1
- import { u as t } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { A as a } from "../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { C as s, K as i } from "../../../chunks/ChatInterface.EQAPs01R.js";
4
- import { A as c } from "../../../chunks/analytics.Ch1vuuOl.js";
5
- import '../../../assets/AskNetlify.css';function k(o) {
6
- const e = a(new c());
7
- return /* @__PURE__ */ t(
8
- i,
9
- {
10
- integrationId: "3c0789a6-c6a8-4fbc-b0cc-235f9e4a6351",
11
- callbacks: {
12
- askAI: {
13
- onQuerySubmit: (r) => {
14
- var n;
15
- (n = e == null ? void 0 : e.current) == null || n.track("ask:new_query", {
16
- question: r.question,
17
- thread_id: r.threadId
18
- });
19
- },
20
- onAnswerGenerationCompleted: (r) => {
21
- var n;
22
- (n = e == null ? void 0 : e.current) == null || n.track("ask:answer_generated", {
23
- question_id: r.questionAnswerId,
24
- answer_length: r.answer.length
25
- });
1
+ import { u as o } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import { A as i } from "../../../chunks/hooks.module.DGkdD5n9.js";
3
+ import { C as s, K as a } from "../../../chunks/ChatInterface.EQAPs01R.js";
4
+ import { A as u } from "../../../chunks/analytics.Ch1vuuOl.js";
5
+ import '../../../assets/AskNetlify.css';function w(n) {
6
+ const r = i(new u());
7
+ if (n.kapaIntegrationId)
8
+ return /* @__PURE__ */ o(
9
+ a,
10
+ {
11
+ integrationId: n.kapaIntegrationId,
12
+ callbacks: {
13
+ askAI: {
14
+ onQuerySubmit: (e) => {
15
+ var t;
16
+ !e.question || !e.threadId || (t = r == null ? void 0 : r.current) == null || t.track("ask:new_query", {
17
+ question: e.question,
18
+ thread_id: e.threadId
19
+ });
20
+ },
21
+ onAnswerGenerationCompleted: (e) => {
22
+ var t;
23
+ !e.questionAnswerId || !e.answer || (t = r == null ? void 0 : r.current) == null || t.track("ask:answer_generated", {
24
+ question_id: e.questionAnswerId,
25
+ answer_length: e.answer.length
26
+ });
27
+ }
26
28
  }
27
- }
28
- },
29
- children: /* @__PURE__ */ t(s, { ...o })
30
- }
31
- );
29
+ },
30
+ children: /* @__PURE__ */ o(s, { setModalState: n.setModalState })
31
+ }
32
+ );
32
33
  }
33
34
  export {
34
- k as default
35
+ w as default
35
36
  };
@@ -1,5 +1,5 @@
1
1
  interface Props {
2
- setModalState?: (state?: {
2
+ setModalState?: (e: {
3
3
  current: string;
4
4
  }) => void;
5
5
  }
@@ -3,7 +3,8 @@ var ye = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writ
3
3
  var d = (n, e, t) => ye(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { u as w } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
5
5
  import Se from "../../Icon/index.js";
6
- import { Fragment as $e } from "preact";
6
+ import { SourcesList as $e } from "./SourcesList.js";
7
+ import { Fragment as Re } from "preact";
7
8
  function H() {
8
9
  return {
9
10
  async: !1,
@@ -91,31 +92,31 @@ var x = {
91
92
  fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`),
92
93
  headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`),
93
94
  htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i")
94
- }, Re = /^(?:[ \t]*(?:\n|$))+/, ve = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ze = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), _e = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ae = /^[^\n]+/, U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Le = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ie = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ce = u(
95
+ }, ve = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, _e = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ae = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Le = /^[^\n]+/, U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ie = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ce = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Pe = u(
95
96
  "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
96
97
  "i"
97
- ).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Pe = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), W = {
98
- blockquote: Pe,
99
- code: ve,
100
- def: Le,
101
- fences: Te,
102
- heading: ze,
98
+ ).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Be = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), W = {
99
+ blockquote: Be,
100
+ code: Te,
101
+ def: Ie,
102
+ fences: ze,
103
+ heading: _e,
103
104
  hr: L,
104
- html: Ce,
105
+ html: Pe,
105
106
  lheading: he,
106
- list: Ie,
107
- newline: Re,
107
+ list: Ce,
108
+ newline: ve,
108
109
  paragraph: pe,
109
110
  table: A,
110
- text: Ae
111
+ text: Le
111
112
  }, re = u(
112
113
  "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
113
- ).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Be = {
114
+ ).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Ee = {
114
115
  ...W,
115
- lheading: _e,
116
+ lheading: Ae,
116
117
  table: re,
117
118
  paragraph: u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex()
118
- }, Ee = {
119
+ }, qe = {
119
120
  ...W,
120
121
  html: u(
121
122
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
@@ -127,64 +128,64 @@ var x = {
127
128
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
128
129
  paragraph: u(F).replace("hr", L).replace("heading", ` *#{1,6} *[^
129
130
  ]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
130
- }, qe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, De = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Z = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Me = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), fe = /(?!~)[\p{P}\p{S}]/u, Ge = /(?!~)[\s\p{P}\p{S}]/u, Ne = /(?:[^\s\p{P}\p{S}]|~)/u, Oe = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, je = u(de, "u").replace(/punct/g, Z).getRegex(), He = u(de, "u").replace(/punct/g, fe).getRegex(), ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qe = u(ke, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Fe = u(ke, "gu").replace(/notPunctSpace/g, Ne).replace(/punctSpace/g, Ge).replace(/punct/g, fe).getRegex(), Ue = u(
131
+ }, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Me = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Z = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Ge = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), fe = /(?!~)[\p{P}\p{S}]/u, Ne = /(?!~)[\s\p{P}\p{S}]/u, Oe = /(?:[^\s\p{P}\p{S}]|~)/u, je = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, He = u(de, "u").replace(/punct/g, Z).getRegex(), Qe = u(de, "u").replace(/punct/g, fe).getRegex(), ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Fe = u(ke, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Ue = u(ke, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ne).replace(/punct/g, fe).getRegex(), Xe = u(
131
132
  "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
132
133
  "gu"
133
- ).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Xe = u(/\\(punct)/, "gu").replace(/punct/g, Z).getRegex(), We = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Je = u(X).replace("(?:-->|$)", "-->").getRegex(), Ke = u(
134
+ ).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), We = u(/\\(punct)/, "gu").replace(/punct/g, Z).getRegex(), Je = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ke = u(X).replace("(?:-->|$)", "-->").getRegex(), Ve = u(
134
135
  "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
135
- ).replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ve = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", U).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), Ye = u("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", xe).getRegex(), K = {
136
+ ).replace("comment", Ke).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ye = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", U).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = u("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", xe).getRegex(), K = {
136
137
  _backpedal: A,
137
138
  // only used for GFM url
138
- anyPunctuation: Xe,
139
- autolink: We,
140
- blockSkip: Oe,
139
+ anyPunctuation: We,
140
+ autolink: Je,
141
+ blockSkip: je,
141
142
  br: ue,
142
- code: Ze,
143
+ code: De,
143
144
  del: A,
144
- emStrongLDelim: je,
145
- emStrongRDelimAst: Qe,
146
- emStrongRDelimUnd: Ue,
147
- escape: qe,
148
- link: Ve,
145
+ emStrongLDelim: He,
146
+ emStrongRDelimAst: Fe,
147
+ emStrongRDelimUnd: Xe,
148
+ escape: Ze,
149
+ link: Ye,
149
150
  nolink: xe,
150
- punctuation: Me,
151
+ punctuation: Ge,
151
152
  reflink: be,
152
- reflinkSearch: Ye,
153
- tag: Ke,
154
- text: De,
153
+ reflinkSearch: et,
154
+ tag: Ve,
155
+ text: Me,
155
156
  url: A
156
- }, et = {
157
+ }, tt = {
157
158
  ...K,
158
159
  link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", P).getRegex(),
159
160
  reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", P).getRegex()
160
161
  }, N = {
161
162
  ...K,
162
- emStrongRDelimAst: Fe,
163
- emStrongLDelim: He,
163
+ emStrongRDelimAst: Ue,
164
+ emStrongLDelim: Qe,
164
165
  url: u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
165
166
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
166
167
  del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
167
168
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
168
- }, tt = {
169
+ }, nt = {
169
170
  ...N,
170
171
  br: u(ue).replace("{2,}", "*").getRegex(),
171
172
  text: u(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
172
173
  }, I = {
173
174
  normal: W,
174
- gfm: Be,
175
- pedantic: Ee
175
+ gfm: Ee,
176
+ pedantic: qe
176
177
  }, z = {
177
178
  normal: K,
178
179
  gfm: N,
179
- breaks: tt,
180
- pedantic: et
181
- }, nt = {
180
+ breaks: nt,
181
+ pedantic: tt
182
+ }, rt = {
182
183
  "&": "&amp;",
183
184
  "<": "&lt;",
184
185
  ">": "&gt;",
185
186
  '"': "&quot;",
186
187
  "'": "&#39;"
187
- }, se = (n) => nt[n];
188
+ }, se = (n) => rt[n];
188
189
  function y(n, e) {
189
190
  if (e) {
190
191
  if (x.escapeTest.test(n))
@@ -227,7 +228,7 @@ function _(n, e, t) {
227
228
  s++;
228
229
  return n.slice(0, r - s);
229
230
  }
230
- function rt(n, e) {
231
+ function st(n, e) {
231
232
  if (n.indexOf(e[1]) === -1)
232
233
  return -1;
233
234
  let t = 0;
@@ -253,7 +254,7 @@ function ae(n, e, t, r, s) {
253
254
  };
254
255
  return r.state.inLink = !1, h;
255
256
  }
256
- function st(n, e, t) {
257
+ function it(n, e, t) {
257
258
  const r = n.match(t.other.indentCodeCompensation);
258
259
  if (r === null)
259
260
  return e;
@@ -301,7 +302,7 @@ var B = class {
301
302
  fences(n) {
302
303
  const e = this.rules.block.fences.exec(n);
303
304
  if (e) {
304
- const t = e[0], r = st(t, e[3] || "", this.rules);
305
+ const t = e[0], r = it(t, e[3] || "", this.rules);
305
306
  return {
306
307
  type: "code",
307
308
  raw: t,
@@ -587,7 +588,7 @@ ${o}` : o;
587
588
  if ((t.length - i.length) % 2 === 0)
588
589
  return;
589
590
  } else {
590
- const i = rt(e[2], "()");
591
+ const i = st(e[2], "()");
591
592
  if (i === -2)
592
593
  return;
593
594
  if (i > -1) {
@@ -1360,7 +1361,7 @@ ${n}</tr>
1360
1361
  "preprocess",
1361
1362
  "postprocess",
1362
1363
  "processAllTokens"
1363
- ])), G), it = class {
1364
+ ])), G), lt = class {
1364
1365
  constructor(...n) {
1365
1366
  d(this, "defaults", H());
1366
1367
  d(this, "options", this.setOptions);
@@ -1532,7 +1533,7 @@ Please report this to https://github.com/markedjs/marked.`, n) {
1532
1533
  throw t;
1533
1534
  };
1534
1535
  }
1535
- }, R = new it();
1536
+ }, R = new lt();
1536
1537
  function f(n, e) {
1537
1538
  return R.parse(n, e);
1538
1539
  }
@@ -1564,11 +1565,11 @@ f.walkTokens;
1564
1565
  f.parseInline;
1565
1566
  $.parse;
1566
1567
  S.lex;
1567
- function ht({
1568
+ function ut({
1568
1569
  conversation: n,
1569
1570
  lastMessageRef: e
1570
1571
  }) {
1571
- return /* @__PURE__ */ w($e, { children: n.map((t, r) => {
1572
+ return /* @__PURE__ */ w(Re, { children: n.map((t, r) => {
1572
1573
  const s = r === n.length - 1;
1573
1574
  return /* @__PURE__ */ w("div", { class: "n-ask-message", children: [
1574
1575
  /* @__PURE__ */ w("div", { class: "n-ask-message-right", children: /* @__PURE__ */ w(
@@ -1579,16 +1580,19 @@ function ht({
1579
1580
  children: /* @__PURE__ */ w("p", { children: t.question })
1580
1581
  }
1581
1582
  ) }),
1582
- /* @__PURE__ */ w("div", { class: "n-ask-message-left", children: t.answer ? /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children: /* @__PURE__ */ w(
1583
- "div",
1584
- {
1585
- class: "n-ask-message-answer n-ask-prose prose flow",
1586
- dangerouslySetInnerHTML: { __html: f.parse(t.answer) }
1587
- }
1588
- ) }) : /* @__PURE__ */ w("div", { class: "n-ask-message-loader", children: /* @__PURE__ */ w(Se, { name: "askNetlify" }) }) })
1583
+ /* @__PURE__ */ w("div", { class: "n-ask-message-left", children: t.answer ? /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children: [
1584
+ /* @__PURE__ */ w(
1585
+ "div",
1586
+ {
1587
+ class: "n-ask-message-answer n-ask-prose prose flow",
1588
+ dangerouslySetInnerHTML: { __html: f.parse(t.answer) }
1589
+ }
1590
+ ),
1591
+ t.id && /* @__PURE__ */ w($e, { sources: t.sources })
1592
+ ] }) : /* @__PURE__ */ w("div", { class: "n-ask-message-loader", children: /* @__PURE__ */ w(Se, { name: "askNetlify" }) }) })
1589
1593
  ] }, t.id || `qa-${r}`);
1590
1594
  }) });
1591
1595
  }
1592
1596
  export {
1593
- ht as ChatMessages
1597
+ ut as ChatMessages
1594
1598
  };
@@ -0,0 +1,3 @@
1
+ export declare function SourcesList({ sources }: {
2
+ sources: any;
3
+ }): import("preact").JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ import { u as l } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ function r({ sources: e }) {
3
+ return e != null && e.length ? /* @__PURE__ */ l("div", { className: "n-ask-sources", children: [
4
+ /* @__PURE__ */ l("h4", { class: "n-ask-sources-title", children: "Sources:" }),
5
+ /* @__PURE__ */ l("ul", { children: e.map((t, n) => {
6
+ if (t.title)
7
+ return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("a", { href: t.source_url, target: "_blank", rel: "noopener noreferrer", children: [
8
+ t.title,
9
+ t.subtitle && t.subtitle !== t.title && /* @__PURE__ */ l("span", { children: [
10
+ " - ",
11
+ t.subtitle
12
+ ] })
13
+ ] }) }, n);
14
+ }) })
15
+ ] }) : null;
16
+ }
17
+ export {
18
+ r as SourcesList
19
+ };
@@ -3,6 +3,7 @@ interface Props {
3
3
  children: ComponentChildren;
4
4
  className?: string;
5
5
  debug?: boolean;
6
+ kapaIntegrationId?: string;
6
7
  }
7
8
  declare function SearchModal(props?: Props): import("preact").JSX.Element;
8
9
  export default SearchModal;
@@ -1,67 +1,80 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { A as N, y as l, d as h } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import w from "../../../Modal/Modal.js";
2
+ import { A as v, y as m, d as h } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
+ import b from "../../../Modal/Modal.js";
4
4
  import p from "../../../KeyboardKey/KeyboardKey.js";
5
- import I from "../SearchWindow.js";
6
- import b from "../SearchInput.js";
7
- import { useSearch as M } from "../../hooks/useSearch.js";
8
- import { useSearchLogger as O } from "../../hooks/useSearchLogger.js";
9
- import { useKeyboardNav as P } from "../../hooks/useKeyboardNav.js";
5
+ import w from "../SearchWindow.js";
6
+ import A from "../SearchInput.js";
7
+ import M from "../SearchLink/SearchLink.js";
8
+ import { useSearch as O } from "../../hooks/useSearch.js";
9
+ import { useSearchLogger as P } from "../../hooks/useSearchLogger.js";
10
+ import { useKeyboardNav as C } from "../../hooks/useKeyboardNav.js";
10
11
  import { useSearchHotkeys as E } from "../../hooks/useSearchHotkeys.js";
11
12
  import { useSearchParams as K } from "../../hooks/useSearchParams.js";
12
- import { useSearchToggles as A } from "../../hooks/useSearchToggles.js";
13
- import C from "../../../AskNetlify/AskNetlify.js";
14
- import { Fragment as F } from "preact";
15
- import '../../../../../assets/SearchModal.css';function R(c) {
16
- const r = N(null);
17
- return l(() => {
13
+ import { useSearchToggles as F } from "../../hooks/useSearchToggles.js";
14
+ import R from "../../../AskNetlify/AskNetlify.js";
15
+ import { Fragment as I } from "preact";
16
+ import '../../../../../assets/SearchModal.css';function q(s) {
17
+ const r = v(null);
18
+ return m(() => {
18
19
  function i(t) {
19
- r.current && !r.current.contains(t.target) && c();
20
+ r.current && !r.current.contains(t.target) && s();
20
21
  }
21
22
  return document.addEventListener("mousedown", i), () => {
22
23
  document.removeEventListener("mousedown", i);
23
24
  };
24
- }, [c]), r;
25
+ }, [s]), r;
25
26
  }
26
- function X(c = { className: "", children: null, debug: !1 }) {
27
- const [r, i] = h(!1), [t, u] = h({ current: "search" });
28
- l(() => {
29
- let s;
30
- const o = () => {
31
- window.pagefind && (i(!0), s && clearInterval(s));
27
+ function Z(s = { className: "", children: void 0, debug: !1, kapaIntegrationId: void 0 }) {
28
+ const [r, i] = h(!1), [t, d] = h({ current: "search" });
29
+ m(() => {
30
+ let n;
31
+ const c = () => {
32
+ window.pagefind && (i(!0), n && clearInterval(n));
32
33
  };
33
- return o(), s = setInterval(o, 100), () => clearInterval(s);
34
+ return c(), n = setInterval(c, 100), () => clearInterval(n);
34
35
  }, []);
35
- const { children: k, className: S, debug: y, ...T } = c, { state: n, actions: g } = M(), [m, v] = h(!1), d = () => v(!0), f = () => v(!1), a = N(null), L = R(f);
36
- return O(n, y), A(r, d, u), K(r, g.setSearchTerm, d), E(r, m, d, f), P(r, a, m, f), l(() => {
37
- a.current && (m ? a.current.showModal() : a.current.close());
38
- }, [m]), l(() => {
39
- var o;
40
- const s = (o = a.current) == null ? void 0 : o.querySelector("input");
41
- s && s.focus(), t.current === "ask" ? setTimeout(() => {
36
+ const { children: N, className: k, debug: y, ...L } = s, { state: o, actions: g } = O(), [l, S] = h(!1), u = () => S(!0), f = () => S(!1), a = v(null), T = q(f);
37
+ return P(o, y), F(r, u, d), K(r, g.setSearchTerm, u), E(r, l, u, f), C(r, a, l, f), m(() => {
38
+ a.current && (l ? a.current.showModal() : a.current.close());
39
+ }, [l]), m(() => {
40
+ var c;
41
+ const n = (c = a.current) == null ? void 0 : c.querySelector("input");
42
+ n && n.focus(), t.current === "ask" ? setTimeout(() => {
42
43
  a.current.classList.add("n-search-modal-ask");
43
44
  }, 150) : t.current === "search" && setTimeout(() => {
44
45
  a.current.classList.remove("n-search-modal-ask");
45
46
  }, 150);
46
47
  }, [t.current]), /* @__PURE__ */ e(
47
- w,
48
+ b,
48
49
  {
49
50
  ref: a,
50
- className: `n-search-modal ${S || ""}`,
51
+ className: `n-search-modal ${k || ""}`,
51
52
  "data-state": t.current,
52
- ...T,
53
- children: /* @__PURE__ */ e("div", { ref: L, className: "n-search-container", children: [
54
- t.current === "ask" && /* @__PURE__ */ e(C, { setModalState: u }),
55
- t.current === "search" && /* @__PURE__ */ e(F, { children: [
56
- /* @__PURE__ */ e(b, { setSearchTerm: g.setSearchTerm, initialValue: n.searchTerm }),
53
+ ...L,
54
+ children: /* @__PURE__ */ e("div", { ref: T, className: "n-search-container", children: [
55
+ t.current === "ask" && /* @__PURE__ */ e(R, { setModalState: d, kapaIntegrationId: s.kapaIntegrationId }),
56
+ t.current === "search" && /* @__PURE__ */ e(I, { children: [
57
+ /* @__PURE__ */ e(A, { setSearchTerm: g.setSearchTerm, initialValue: o.searchTerm }),
57
58
  /* @__PURE__ */ e(
58
- I,
59
+ w,
59
60
  {
60
- setModalState: u,
61
- searchLoading: n.isLoading,
62
- searchTerm: n.searchTerm,
63
- results: n.results,
64
- children: k
61
+ searchLoading: o.isLoading,
62
+ searchTerm: o.searchTerm,
63
+ results: o.results,
64
+ children: /* @__PURE__ */ e(I, { children: [
65
+ s.kapaIntegrationId && /* @__PURE__ */ e(
66
+ M,
67
+ {
68
+ as: "button",
69
+ icon: "askNetlify",
70
+ label: "Ask Netlify AI",
71
+ onClick: () => {
72
+ d({ current: "ask" });
73
+ }
74
+ }
75
+ ),
76
+ N
77
+ ] })
65
78
  }
66
79
  ),
67
80
  /* @__PURE__ */ e("div", { className: "n-search-footer", children: [
@@ -82,5 +95,5 @@ function X(c = { className: "", children: null, debug: !1 }) {
82
95
  );
83
96
  }
84
97
  export {
85
- X as default
98
+ Z as default
86
99
  };
@@ -1,2 +1,2 @@
1
1
  import { SearchWindowProps } from '../types/search.types';
2
- export default function SearchWindow({ setModalState, searchLoading, searchTerm, results, children: DefaultWindow, }: SearchWindowProps): import("preact").JSX.Element;
2
+ export default function SearchWindow({ searchLoading, searchTerm, results, children: DefaultWindow, }: SearchWindowProps): import("preact").JSX.Element;
@@ -1,54 +1,42 @@
1
1
  import { u as e } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { T as h } from "../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import s from "./SearchHeading/SearchHeading.js";
2
+ import { T as o } from "../../../../chunks/hooks.module.DGkdD5n9.js";
3
+ import m from "./SearchHeading/SearchHeading.js";
4
4
  import a from "./SearchLink/SearchLink.js";
5
- import { Fragment as d } from "preact";
6
- const u = {
5
+ import { Fragment as h } from "preact";
6
+ const d = {
7
7
  light: "dark",
8
8
  dark: "light"
9
- }, g = (n) => {
10
- const r = document.getElementById("site-theme-select");
11
- r && (r.value = n), document.documentElement.setAttribute("data-theme", n), localStorage.setItem("theme", n);
12
- }, f = ({
9
+ }, u = (n) => {
10
+ const t = document.getElementById("site-theme-select");
11
+ t && (t.value = n), document.documentElement.setAttribute("data-theme", n), localStorage.setItem("theme", n);
12
+ }, g = ({
13
13
  searchLoading: n,
14
- searchTerm: r,
15
- results: t
14
+ searchTerm: t,
15
+ results: r
16
16
  }) => {
17
17
  if (n)
18
- return /* @__PURE__ */ e(s, { children: [
18
+ return /* @__PURE__ */ e(m, { children: [
19
19
  "Searching for ",
20
- /* @__PURE__ */ e("span", { className: "n-search-term", children: r }),
20
+ /* @__PURE__ */ e("span", { className: "n-search-term", children: t }),
21
21
  " ..."
22
22
  ] });
23
- if (!t || t.length === 0)
24
- return /* @__PURE__ */ e(s, { children: [
23
+ if (!r || r.length === 0)
24
+ return /* @__PURE__ */ e(m, { children: [
25
25
  "0 results for ",
26
- /* @__PURE__ */ e("span", { className: "n-search-term", children: r })
26
+ /* @__PURE__ */ e("span", { className: "n-search-term", children: t })
27
27
  ] });
28
- const c = h(() => t.map((l, i) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...l }) }, i)), [t]);
28
+ const c = o(() => r.map((i, l) => /* @__PURE__ */ e("li", { className: "n-results-list-item", children: /* @__PURE__ */ e(a, { ...i }) }, l)), [r]);
29
29
  return /* @__PURE__ */ e("ul", { className: "n-results-list", role: "list", children: c });
30
30
  };
31
- function A({
32
- setModalState: n,
33
- searchLoading: r,
31
+ function N({
32
+ searchLoading: n,
34
33
  searchTerm: t,
35
- results: c,
36
- children: l
34
+ results: r,
35
+ children: c
37
36
  }) {
38
- return /* @__PURE__ */ e("div", { className: "n-search-window", children: /* @__PURE__ */ e("div", { className: "n-search-links", children: t && t.length > 1 ? /* @__PURE__ */ e(f, { searchLoading: r, searchTerm: t, results: c }) : l ? /* @__PURE__ */ e(d, { children: [
39
- /* @__PURE__ */ e(
40
- a,
41
- {
42
- as: "button",
43
- icon: "askNetlify",
44
- label: "Ask Netlify AI",
45
- onClick: () => {
46
- n({ current: "ask" });
47
- }
48
- }
49
- ),
50
- l,
51
- /* @__PURE__ */ e(s, { children: "Actions" }),
37
+ return /* @__PURE__ */ e("div", { className: "n-search-window", children: /* @__PURE__ */ e("div", { className: "n-search-links", children: t && t.length > 1 ? /* @__PURE__ */ e(g, { searchLoading: n, searchTerm: t, results: r }) : c ? /* @__PURE__ */ e(h, { children: [
38
+ c,
39
+ /* @__PURE__ */ e(m, { children: "Actions" }),
52
40
  /* @__PURE__ */ e(
53
41
  a,
54
42
  {
@@ -56,13 +44,13 @@ function A({
56
44
  icon: "lightbulb",
57
45
  label: "Toggle theme",
58
46
  onClick: () => {
59
- const i = window.matchMedia("(prefers-color-scheme: dark)").matches, m = document.documentElement.getAttribute("data-theme"), o = i ? "dark" : m || "light";
60
- o && g(u[o]);
47
+ const i = window.matchMedia("(prefers-color-scheme: dark)").matches, l = document.documentElement.getAttribute("data-theme"), s = i ? "dark" : l || "light";
48
+ s && u(d[s]);
61
49
  }
62
50
  }
63
51
  )
64
52
  ] }) : null }) });
65
53
  }
66
54
  export {
67
- A as default
55
+ N as default
68
56
  };
@@ -10,9 +10,6 @@ export interface SearchLinkProps {
10
10
  onClick?: () => void;
11
11
  }
12
12
  export interface SearchWindowProps {
13
- setModalState: (e: {
14
- current: string;
15
- }) => void;
16
13
  searchLoading: boolean;
17
14
  searchTerm?: string;
18
15
  results?: SearchLinkProps[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.10.0",
4
+ "version": "1.12.0-alpha.0",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -68,4 +68,4 @@
68
68
  "prettier": "^3.5.3",
69
69
  "prettier-plugin-astro": "^0.14.1"
70
70
  }
71
- }
71
+ }
@@ -101,6 +101,19 @@
101
101
  background: var(--search-user-message-color);
102
102
  }
103
103
 
104
+ .n-ask-sources {
105
+ margin-block-start: var(--space-m);
106
+ }
107
+
108
+ .n-ask-sources-title {
109
+ font-size: var(--step-0);
110
+ font-weight: var(--font-weight-bold);
111
+ }
112
+
113
+ .n-ask-sources a {
114
+ font-size: var(--step--1);
115
+ }
116
+
104
117
  /* ----------------------------- */
105
118
  /* Form UI */
106
119
  /* ----------------------------- */
@@ -5,23 +5,31 @@ import ChatInterface from './components/ChatInterface';
5
5
  import './AskNetlify.css';
6
6
 
7
7
  interface AskNetlifyProps {
8
- setModalState?: (state?: { current: string }) => void;
8
+ kapaIntegrationId?: string;
9
+ setModalState?: (e: { current: string }) => void;
9
10
  }
10
11
 
11
12
  export default function AskNetlify(props: AskNetlifyProps) {
12
13
  const analyticsRef = useRef<Analytics>(new Analytics());
14
+
15
+ if (!props.kapaIntegrationId) return;
16
+
13
17
  return (
14
18
  <KapaProvider
15
- integrationId="3c0789a6-c6a8-4fbc-b0cc-235f9e4a6351"
19
+ integrationId={props.kapaIntegrationId}
16
20
  callbacks={{
17
21
  askAI: {
18
22
  onQuerySubmit: data => {
23
+ if (!data.question || !data.threadId) return;
24
+
19
25
  analyticsRef?.current?.track('ask:new_query', {
20
26
  question: data.question,
21
27
  thread_id: data.threadId,
22
28
  });
23
29
  },
24
30
  onAnswerGenerationCompleted: data => {
31
+ if (!data.questionAnswerId || !data.answer) return;
32
+
25
33
  analyticsRef?.current?.track('ask:answer_generated', {
26
34
  question_id: data.questionAnswerId,
27
35
  answer_length: data.answer.length,
@@ -30,7 +38,7 @@ export default function AskNetlify(props: AskNetlifyProps) {
30
38
  },
31
39
  }}
32
40
  >
33
- <ChatInterface {...props} />
41
+ <ChatInterface setModalState={props.setModalState} />
34
42
  </KapaProvider>
35
43
  );
36
44
  }
@@ -6,7 +6,7 @@ import { BackButton } from './BackButton';
6
6
  import { ChatMessages } from './ChatMessages';
7
7
 
8
8
  interface Props {
9
- setModalState?: (state?: { current: string }) => void;
9
+ setModalState?: (e: { current: string }) => void;
10
10
  }
11
11
 
12
12
  export default function ChatInterface({ setModalState }: Props) {
@@ -1,6 +1,8 @@
1
+ import type { Ref } from 'preact';
1
2
  import { marked } from 'marked';
3
+
2
4
  import Icon from '../../Icon';
3
- import { Ref } from 'preact';
5
+ import { SourcesList } from './SourcesList';
4
6
 
5
7
  export function ChatMessages({
6
8
  conversation,
@@ -31,6 +33,7 @@ export function ChatMessages({
31
33
  class="n-ask-message-answer n-ask-prose prose flow"
32
34
  dangerouslySetInnerHTML={{ __html: marked.parse(qa.answer) }}
33
35
  />
36
+ {qa.id && <SourcesList sources={qa.sources} />}
34
37
  </div>
35
38
  ) : (
36
39
  <div class="n-ask-message-loader">
@@ -0,0 +1,25 @@
1
+ export function SourcesList({ sources }) {
2
+ if (!sources?.length) return null;
3
+
4
+ return (
5
+ <div className="n-ask-sources">
6
+ <h4 class="n-ask-sources-title">Sources:</h4>
7
+ <ul>
8
+ {sources.map((source, index) => {
9
+ if (!source.title) return;
10
+
11
+ return (
12
+ <li key={index}>
13
+ <a href={source.source_url} target="_blank" rel="noopener noreferrer">
14
+ {source.title}
15
+ {source.subtitle && source.subtitle !== source.title && (
16
+ <span> - {source.subtitle}</span>
17
+ )}
18
+ </a>
19
+ </li>
20
+ );
21
+ })}
22
+ </ul>
23
+ </div>
24
+ );
25
+ }
@@ -5,6 +5,7 @@ import Modal from '../../../../preact/Modal/Modal';
5
5
  import KeyboardKey from '../../../../preact/KeyboardKey/KeyboardKey';
6
6
  import SearchWindow from '../../components/SearchWindow';
7
7
  import SearchInput from '../../components/SearchInput';
8
+ import SearchLink from '../../components/SearchLink/SearchLink';
8
9
  import { useClickOutside } from '../../../../../utils/useClickOutside';
9
10
  import {
10
11
  useSearch,
@@ -23,9 +24,12 @@ interface Props {
23
24
  children: ComponentChildren;
24
25
  className?: string;
25
26
  debug?: boolean;
27
+ kapaIntegrationId?: string;
26
28
  }
27
29
 
28
- function SearchModal(props: Props = { className: '', children: null, debug: false }) {
30
+ function SearchModal(
31
+ props: Props = { className: '', children: undefined, debug: false, kapaIntegrationId: undefined }
32
+ ) {
29
33
  const [isPagefindLoaded, setIsPagefindLoaded] = useState(false);
30
34
  const [modalState, setModalState] = useState({ current: 'search' });
31
35
 
@@ -93,18 +97,31 @@ function SearchModal(props: Props = { className: '', children: null, debug: fals
93
97
  {...rest}
94
98
  >
95
99
  <div ref={containerRef} className="n-search-container">
96
- {modalState.current === 'ask' && <AskNetlify setModalState={setModalState} />}
100
+ {modalState.current === 'ask' && (
101
+ <AskNetlify setModalState={setModalState} kapaIntegrationId={props.kapaIntegrationId} />
102
+ )}
97
103
  {modalState.current === 'search' && (
98
104
  <>
99
105
  <SearchInput setSearchTerm={actions.setSearchTerm} initialValue={state.searchTerm} />
100
106
 
101
107
  <SearchWindow
102
- setModalState={setModalState}
103
108
  searchLoading={state.isLoading}
104
109
  searchTerm={state.searchTerm}
105
110
  results={state.results}
106
111
  >
107
- {children}
112
+ <>
113
+ {props.kapaIntegrationId && (
114
+ <SearchLink
115
+ as="button"
116
+ icon="askNetlify"
117
+ label="Ask Netlify AI"
118
+ onClick={() => {
119
+ setModalState({ current: 'ask' });
120
+ }}
121
+ />
122
+ )}
123
+ {children}
124
+ </>
108
125
  </SearchWindow>
109
126
 
110
127
  <div className="n-search-footer">
@@ -45,7 +45,6 @@ const SearchResults: FunctionComponent<SearchResultsProps> = ({
45
45
 
46
46
  /* --- Main Search Results Component --- */
47
47
  export default function SearchWindow({
48
- setModalState,
49
48
  searchLoading,
50
49
  searchTerm,
51
50
  results,
@@ -58,15 +57,6 @@ export default function SearchWindow({
58
57
  <SearchResults searchLoading={searchLoading} searchTerm={searchTerm} results={results} />
59
58
  ) : DefaultWindow ? (
60
59
  <>
61
- <SearchLink
62
- as="button"
63
- icon="askNetlify"
64
- label="Ask Netlify AI"
65
- onClick={() => {
66
- setModalState({ current: 'ask' });
67
- }}
68
- />
69
-
70
60
  {DefaultWindow}
71
61
 
72
62
  <SearchHeading>Actions</SearchHeading>
@@ -12,7 +12,6 @@ export interface SearchLinkProps {
12
12
  }
13
13
 
14
14
  export interface SearchWindowProps {
15
- setModalState: (e: { current: string }) => void;
16
15
  searchLoading: boolean;
17
16
  searchTerm?: string;
18
17
  results?: SearchLinkProps[];