@coveo/atomic 3.32.3-pre.cda62afb59 → 3.32.3-pre.d8395b7e5a

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 (66) hide show
  1. package/dist/atomic/_atomic.esm.js +1 -1
  2. package/dist/atomic/components/analytics-config.js +1 -1
  3. package/dist/atomic/components/atomic-generated-answer.js +4 -2
  4. package/dist/atomic/components/atomic-generated-answer.js.map +1 -1
  5. package/dist/atomic/components/atomic-insight-generated-answer.js +3 -2
  6. package/dist/atomic/components/atomic-insight-generated-answer.js.map +1 -1
  7. package/dist/atomic/components/components/common/facets/facet-value-checkbox/facet-value-checkbox.js +0 -1
  8. package/dist/atomic/components/components/common/facets/facet-value-link/facet-value-link.js +0 -1
  9. package/dist/atomic/components/generated-answer-common.js +23 -0
  10. package/dist/atomic/components/generated-answer-common.js.map +1 -1
  11. package/dist/atomic/components/global/environment.js +1 -1
  12. package/dist/atomic/{p-e2135441.entry.js → p-0dc126bb.entry.js} +2 -2
  13. package/dist/atomic/p-0dc126bb.entry.js.map +1 -0
  14. package/dist/atomic/{p-05567bf3.js → p-320ab8c0.js} +2 -2
  15. package/dist/atomic/{p-75e9af94.entry.js → p-4fb01481.entry.js} +2 -2
  16. package/dist/atomic/{p-4caa8f47.entry.js → p-8ace8433.entry.js} +2 -2
  17. package/dist/atomic/p-c6e1a7ab.entry.js +2 -0
  18. package/dist/atomic/p-c6e1a7ab.entry.js.map +1 -0
  19. package/dist/atomic/p-cf3b7218.js +2 -0
  20. package/dist/atomic/p-cf3b7218.js.map +1 -0
  21. package/dist/atomic/{p-6477520a.entry.js → p-e74a4a8c.entry.js} +2 -2
  22. package/dist/cjs/_loader.cjs.js +1 -1
  23. package/dist/cjs/{analytics-config-c551c8ac.js → analytics-config-879b5a35.js} +2 -2
  24. package/dist/cjs/{analytics-config-c551c8ac.js.map → analytics-config-879b5a35.js.map} +1 -1
  25. package/dist/cjs/atomic-generated-answer.cjs.entry.js +4 -2
  26. package/dist/cjs/atomic-generated-answer.cjs.entry.js.map +1 -1
  27. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js +4 -2
  28. package/dist/cjs/atomic-insight-generated-answer.cjs.entry.js.map +1 -1
  29. package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
  30. package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
  31. package/dist/cjs/atomic-search-interface.cjs.entry.js +1 -1
  32. package/dist/cjs/atomic.cjs.js +1 -1
  33. package/dist/cjs/{generated-answer-common-1f7e3c88.js → generated-answer-common-1f24d687.js} +24 -1
  34. package/dist/cjs/generated-answer-common-1f24d687.js.map +1 -0
  35. package/dist/cjs/version.cjs.js +1 -1
  36. package/dist/esm/_loader.js +1 -1
  37. package/dist/esm/{analytics-config-6747b5fc.js → analytics-config-3175e6f5.js} +2 -2
  38. package/dist/esm/{analytics-config-6747b5fc.js.map → analytics-config-3175e6f5.js.map} +1 -1
  39. package/dist/esm/atomic-generated-answer.entry.js +4 -2
  40. package/dist/esm/atomic-generated-answer.entry.js.map +1 -1
  41. package/dist/esm/atomic-insight-generated-answer.entry.js +4 -2
  42. package/dist/esm/atomic-insight-generated-answer.entry.js.map +1 -1
  43. package/dist/esm/atomic-insight-interface.entry.js +1 -1
  44. package/dist/esm/atomic-recs-interface.entry.js +1 -1
  45. package/dist/esm/atomic-search-interface.entry.js +1 -1
  46. package/dist/esm/atomic.js +1 -1
  47. package/dist/esm/{generated-answer-common-ee9bfc67.js → generated-answer-common-83e389e1.js} +24 -1
  48. package/dist/esm/generated-answer-common-83e389e1.js.map +1 -0
  49. package/dist/esm/version.js +1 -1
  50. package/dist/types/components/common/generated-answer/generated-answer-common.d.ts +1 -0
  51. package/dist/types/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.d.ts +3 -3
  52. package/dist/types/components/search/atomic-generated-answer/atomic-generated-answer.d.ts +3 -3
  53. package/dist/types/components.d.ts +8 -8
  54. package/docs/atomic-docs.json +6 -6
  55. package/package.json +1 -1
  56. package/dist/atomic/p-2857ab2b.js +0 -2
  57. package/dist/atomic/p-2857ab2b.js.map +0 -1
  58. package/dist/atomic/p-50dc4fa2.entry.js +0 -2
  59. package/dist/atomic/p-50dc4fa2.entry.js.map +0 -1
  60. package/dist/atomic/p-e2135441.entry.js.map +0 -1
  61. package/dist/cjs/generated-answer-common-1f7e3c88.js.map +0 -1
  62. package/dist/esm/generated-answer-common-ee9bfc67.js.map +0 -1
  63. /package/dist/atomic/{p-05567bf3.js.map → p-320ab8c0.js.map} +0 -0
  64. /package/dist/atomic/{p-75e9af94.entry.js.map → p-4fb01481.entry.js.map} +0 -0
  65. /package/dist/atomic/{p-4caa8f47.entry.js.map → p-8ace8433.entry.js.map} +0 -0
  66. /package/dist/atomic/{p-6477520a.entry.js.map → p-e74a4a8c.entry.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["atomicInsightGeneratedAnswerCss","AtomicInsightGeneratedAnswerStyle0","AtomicInsightGeneratedAnswer","this","DEFAULT_COLLAPSED_HEIGHT","MAX_COLLAPSED_HEIGHT","MIN_COLLAPSED_HEIGHT","REQUIRED_FIELDS_TO_INCLUDE_IN_CITATIONS","copied","copyError","maxCollapsedHeight","onGeneratedAnswerStateUpdate","generatedAnswerState","isVisible","generatedAnswerCommon","data","writeStoredData","setAriaMessage","getGeneratedAnswerStatus","setCopied","isCopied","setCopyError","message","ariaMessage","initialize","GeneratedAnswerCommon","host","withToggle","collapsible","disableCitationAnchoring","getGeneratedAnswer","generatedAnswer","getGeneratedAnswerState","getSearchStatusState","searchStatusState","getBindings","bindings","getCopied","getCopyError","buildInteractiveCitation","props","buildInsightInteractiveCitation","engine","validateProps","buildInsightGeneratedAnswer","initialState","responseFormat","contentFormat","answerConfigurationId","fieldsToIncludeInCitations","getCitationFields","searchStatus","buildInsightSearchStatus","insertFeedbackModal","window","ResizeObserver","debouncedAdaptAnswerHeight","debounce","adaptAnswerHeight","resizeObserver","observe","updateAnswerCollapsed","newState","oldState","newExpanded","expanded","oldExpanded","undefined","container","getAnswerContainer","toggleClass","disconnectedCallback","disconnect","element","className","condition","classList","toggle","answerHeight","shadowRoot","querySelector","getBoundingClientRect","height","rootFontSize","parseFloat","getComputedStyle","document","documentElement","fontSize","fullAnswerHeight","updateAnswerHeight","getAnswerFooter","split","map","field","trim","filter","length","concat","validateMaxCollapsedHeight","isValid","console","warn","setCSSVariable","variableName","value","style","setProperty","footer","maxHeight","isStreaming","render","__decorate","InitializeBindings","BindStateToController","onUpdateCallbackMethod","AriaLiveRegion"],"sources":["src/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.pcss?tag=atomic-insight-generated-answer&encapsulation=shadow","src/components/insight/atomic-insight-generated-answer/atomic-insight-generated-answer.tsx"],"sourcesContent":["@import '../../common/generated-answer/styles/generated-answer.pcss';\n","import {\n SearchStatus as InsightSearchStatus,\n SearchStatusState as InsightSearchStatusState,\n buildGeneratedAnswer as buildInsightGeneratedAnswer,\n buildInteractiveCitation as buildInsightInteractiveCitation,\n buildSearchStatus as buildInsightSearchStatus,\n GeneratedAnswer as InsightGeneratedAnswer,\n GeneratedAnswerState as InsightGeneratedAnswerState,\n} from '@coveo/headless/insight';\nimport {Component, Element, State, Prop, Watch} from '@stencil/core';\nimport {debounce} from '../../../utils/debounce-utils';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {AriaLiveRegion} from '../../../utils/stencil-accessibility-utils';\nimport {GeneratedAnswerCommon} from '../../common/generated-answer/generated-answer-common';\nimport {InsightBindings} from '../atomic-insight-interface/atomic-insight-interface';\n\n/**\n * @internal\n * The `atomic-insight-generated-answer` component uses Coveo Machine Learning (Coveo ML) models to automatically generate an answer to a query executed by the user.\n * For more information, see [About Relevance Generative Answering (RGA)](https://docs.coveo.com/en/n9de0370/)\n *\n * @slot no-answer-message - Lets you pass a custom sorry message when no answer is generated.\n *\n * @part container - The container displaying the generated answer.\n * @part header-label - The header of the generated answer container.\n * @part feedback-button - The \"like\" and \"dislike\" buttons.\n * @part toggle - The switch to toggle the visibility of the generated answer.\n * @part copy-button - The \"Copy answer\" button.\n * @part retry-container - The container for the \"retry\" section.\n * @part generated-text - The text of the generated answer.\n * @part citations-label - The header of the citations list.\n *\n * @part answer-code-block - The generated answer multi-line code blocks.\n * @part answer-emphasis - The generated answer emphasized text elements.\n * @part answer-inline-code - The generated answer inline code elements.\n * @part answer-heading-1 - The generated answer level 1 heading elements.\n * @part answer-heading-2 - The generated answer level 2 heading elements.\n * @part answer-heading-3 - The generated answer level 3 heading elements.\n * @part answer-heading-4 - The generated answer level 4 heading elements.\n * @part answer-heading-5 - The generated answer level 5 heading elements.\n * @part answer-heading-6 - The generated answer level 6 heading elements.\n * @part answer-list-item - The generated answer list item elements for both ordered and unordered lists.\n * @part answer-ordered-list - The generated answer ordered list elements.\n * @part answer-paragraph - The generated answer paragraph elements.\n * @part answer-quote-block - The generated answer quote block elements.\n * @part answer-unordered-list - The generated answer unordered list elements.\n * @part answer-strong - The generated answer strong text elements.\n * @part answer-table - The generated answer table elements.\n * @part answer-table-container - The generated answer table container elements.\n * @part answer-table-content - The generated answer table content cell elements.\n * @part answer-table-header - The generated answer table header cell elements.\n *\n * @part citation - The link that allows the user to navigate to the item.\n * @part citation-popover - The pop-up that shows an item preview when the user hovers over the citation.\n */\n@Component({\n tag: 'atomic-insight-generated-answer',\n styleUrl: 'atomic-insight-generated-answer.pcss',\n shadow: true,\n})\nexport class AtomicInsightGeneratedAnswer\n implements InitializableComponent<InsightBindings>\n{\n @InitializeBindings() public bindings!: InsightBindings;\n public generatedAnswer!: InsightGeneratedAnswer;\n public searchStatus!: InsightSearchStatus;\n private resizeObserver?: ResizeObserver;\n\n private readonly DEFAULT_COLLAPSED_HEIGHT = 16;\n private readonly MAX_COLLAPSED_HEIGHT = 32;\n private readonly MIN_COLLAPSED_HEIGHT = 9;\n private readonly REQUIRED_FIELDS_TO_INCLUDE_IN_CITATIONS = ['filetype'];\n\n @BindStateToController('generatedAnswer', {\n onUpdateCallbackMethod: 'onGeneratedAnswerStateUpdate',\n })\n @State()\n private generatedAnswerState!: InsightGeneratedAnswerState;\n\n @BindStateToController('searchStatus')\n @State()\n private searchStatusState!: InsightSearchStatusState;\n\n @State()\n public error!: Error;\n\n @Element() private host!: HTMLElement;\n\n @State()\n copied = false;\n\n @State()\n copyError = false;\n\n /**\n * Whether to render a toggle button that lets the user hide or show the answer.\n * @default false\n */\n @Prop() withToggle?: boolean;\n\n /**\n * Whether to allow the answer to be collapsed when the text is taller than 250px.\n * @default false\n */\n @Prop() collapsible?: boolean;\n\n /**\n * The maximum height (in rem units) of the answer when collapsed.\n *\n */\n @Prop() maxCollapsedHeight = this.DEFAULT_COLLAPSED_HEIGHT;\n\n /**\n * @internal\n * The unique identifier of the answer configuration to use to generate the answer.\n */\n @Prop() answerConfigurationId?: string;\n\n /**\n * A list of fields to include with the citations used to generate the answer.\n */\n @Prop() fieldsToIncludeInCitations?: string;\n\n /**\n * Option to disable citation anchoring.\n * @default 'false'\n */\n @Prop() disableCitationAnchoring?: string;\n // disableCitationAnchoring is a boolean, but we use a string to allow defaulting to \"false\" in the HTML template.\n\n @AriaLiveRegion('generated-answer')\n protected ariaMessage!: string;\n\n private generatedAnswerCommon!: GeneratedAnswerCommon;\n private fullAnswerHeight?: number;\n\n public initialize() {\n this.generatedAnswerCommon = new GeneratedAnswerCommon({\n host: this.host,\n withToggle: this.withToggle,\n collapsible: this.collapsible,\n disableCitationAnchoring: this.disableCitationAnchoring === 'true',\n getGeneratedAnswer: () => this.generatedAnswer,\n getGeneratedAnswerState: () => this.generatedAnswerState,\n getSearchStatusState: () => this.searchStatusState,\n getBindings: () => this.bindings,\n getCopied: () => this.copied,\n setCopied: this.setCopied,\n getCopyError: () => this.copyError,\n setCopyError: this.setCopyError,\n setAriaMessage: this.setAriaMessage,\n buildInteractiveCitation: (props) =>\n buildInsightInteractiveCitation(this.bindings.engine, props),\n });\n this.generatedAnswerCommon.validateProps();\n \n this.generatedAnswer = buildInsightGeneratedAnswer(this.bindings.engine, {\n initialState: {\n isVisible: this.generatedAnswerCommon.data.isVisible,\n responseFormat: {\n contentFormat: ['text/markdown', 'text/plain'],\n },\n },\n ...(this.answerConfigurationId && {\n answerConfigurationId: this.answerConfigurationId,\n }),\n fieldsToIncludeInCitations: this.getCitationFields(),\n });\n this.searchStatus = buildInsightSearchStatus(this.bindings.engine);\n this.generatedAnswerCommon.insertFeedbackModal();\n\n if (window.ResizeObserver && this.collapsible) {\n const debouncedAdaptAnswerHeight = debounce(\n () => this.adaptAnswerHeight(),\n 100\n );\n this.resizeObserver = new ResizeObserver(debouncedAdaptAnswerHeight);\n this.resizeObserver.observe(this.host);\n }\n }\n\n @Watch('generatedAnswerState')\n public updateAnswerCollapsed(\n newState: InsightGeneratedAnswerState,\n oldState: InsightGeneratedAnswerState\n ) {\n const newExpanded = newState.expanded;\n const oldExpanded = oldState ? oldState.expanded : undefined;\n\n if (newExpanded !== oldExpanded) {\n const container = this.getAnswerContainer();\n\n if (!container) {\n return;\n }\n\n this.toggleClass(container, 'answer-collapsed', !newExpanded);\n }\n }\n\n public disconnectedCallback() {\n this.resizeObserver?.disconnect();\n }\n\n // @ts-expect-error: This function is used by BindStateToController.\n private onGeneratedAnswerStateUpdate = () => {\n if (\n this.generatedAnswerState.isVisible !==\n this.generatedAnswerCommon?.data?.isVisible\n ) {\n this.generatedAnswerCommon.data = {\n ...this.generatedAnswerCommon.data,\n isVisible: this.generatedAnswerState.isVisible,\n };\n this.generatedAnswerCommon.writeStoredData(\n this.generatedAnswerCommon.data\n );\n }\n\n this.setAriaMessage(this.generatedAnswerCommon.getGeneratedAnswerStatus());\n };\n\n private setCopied = (isCopied: boolean) => {\n this.copied = isCopied;\n };\n\n private setCopyError = (copyError: boolean) => {\n this.copyError = copyError;\n };\n\n private setAriaMessage = (message: string) => {\n this.ariaMessage = message;\n };\n\n private toggleClass(element: Element, className: string, condition: boolean) {\n element.classList.toggle(className, condition);\n }\n\n private adaptAnswerHeight() {\n const answerHeight = this.host?.shadowRoot\n ?.querySelector('[part=\"generated-text\"]')\n ?.getBoundingClientRect().height;\n\n if (answerHeight) {\n const rootFontSize = parseFloat(\n getComputedStyle(document.documentElement).fontSize\n );\n\n this.fullAnswerHeight = answerHeight / rootFontSize;\n\n this.updateAnswerHeight();\n }\n }\n\n private getAnswerContainer() {\n return this.host?.shadowRoot?.querySelector('[part=\"generated-container\"]');\n }\n\n private getAnswerFooter() {\n return this.host?.shadowRoot?.querySelector(\n '[part=\"generated-answer-footer\"]'\n );\n }\n\n public getCitationFields() {\n return (this.fieldsToIncludeInCitations ?? '')\n .split(',')\n .map((field) => field.trim())\n .filter((field) => field.length > 0)\n .concat(this.REQUIRED_FIELDS_TO_INCLUDE_IN_CITATIONS)\n }\n\n private validateMaxCollapsedHeight(): number {\n const isValid =\n this.maxCollapsedHeight >= this.MIN_COLLAPSED_HEIGHT &&\n this.maxCollapsedHeight <= this.MAX_COLLAPSED_HEIGHT;\n\n if (!isValid) {\n console.warn(\n `max-collapsed-height (${this.maxCollapsedHeight}rem) is out of the valid range (${this.MIN_COLLAPSED_HEIGHT}rem - ${this.MAX_COLLAPSED_HEIGHT}rem). Falling back to default value (${this.DEFAULT_COLLAPSED_HEIGHT}rem).`\n );\n }\n\n return isValid ? this.maxCollapsedHeight : this.DEFAULT_COLLAPSED_HEIGHT;\n }\n\n private setCSSVariable(variableName: string, value: string) {\n const container = this.getAnswerContainer();\n if (container) {\n (container as HTMLElement).style.setProperty(variableName, value);\n }\n }\n\n private updateAnswerHeight() {\n const container = this.getAnswerContainer();\n const footer = this.getAnswerFooter();\n const maxHeight = this.validateMaxCollapsedHeight();\n\n if (!container || !footer) {\n return;\n }\n\n if (this.fullAnswerHeight! > maxHeight) {\n this.setCSSVariable('--atomic-crga-collapsed-height', `${maxHeight}rem`);\n this.toggleClass(\n container,\n 'answer-collapsed',\n !this.generatedAnswerState.expanded\n );\n this.toggleClass(footer, 'is-collapsible', true);\n this.toggleClass(\n footer,\n 'generating-label-visible',\n this.generatedAnswerState.isStreaming\n );\n } else {\n this.toggleClass(container, 'answer-collapsed', false);\n this.toggleClass(footer, 'is-collapsible', false);\n this.toggleClass(footer, 'generating-label-visible', false);\n }\n }\n\n public render() {\n return this.generatedAnswerCommon.render();\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import{Schema as t,Value as e,BooleanValue as n}from"@coveo/bueno";import{h as s}from"./p-dc3df5ce.js";import{S as i,a as r}from"./p-946fe85f.js";import{g as o}from"./p-634ca060.js";import{H as a}from"./p-66d48d1a.js";import{B as c}from"./p-28a6dd9b.js";import{D as l}from"./p-f284897c.js";import{c as h}from"./p-0462f723.js";import{A as u}from"./p-b700cfe1.js";import{A as f}from"./p-35fb03be.js";const d=t=>{const e={onClick:()=>t.onToggle?.(!t.checked),"arial-label":t.ariaLabel,"aria-checked":String(!!t.checked),part:t.part,tabIndex:t.tabIndex,title:t.title};const n=["w-12","h-6","p-1","rounded-full",t.checked?"bg-primary":"bg-neutral"].join(" ");const i=["w-4","h-4","rounded-full","bg-white",t.checked?"ml-6":""].join(" ");const r=["rounded-full","btn-outline-neutral",t.withToggle?"flex":"hidden"].join(" ");return s("button",{role:"switch",...e,class:r},s("div",{class:n},s("div",{class:i})))};const p=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect x="1.5" y="1.50024" width="9" height="10" rx="1.5" stroke="currentColor"/>\n<path d="M3.5 8.50024H8.5" stroke="currentColor" stroke-linecap="round"/>\n<path d="M3.5 4.50024L8.5 4.50024" stroke="currentColor" stroke-linecap="round"/>\n<path d="M3.5 6.50024L8.5 6.50024" stroke="currentColor" stroke-linecap="round"/>\n<path d="M4.5 14.5002L11.5 14.5002C12.6046 14.5002 13.5 13.6048 13.5 12.5002L13.5 5.50024" stroke="currentColor" stroke-linecap="round"/>\n</svg>\n`;const g=t=>s(c,{title:t.title,part:"copy-button",style:"text-transparent",class:`rounded-md p-2 ${t.isCopied?"copied":""} ${t.error?"error":""}`,onClick:t.onClick},s("div",{class:"icon-container text-neutral-dark"},s("atomic-icon",{class:"w-5",icon:p})));const w=`<svg\n width="14"\n height="14"\n viewBox="0 0 14 14"\n fill="none"\n version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:svg="http://www.w3.org/2000/svg">\n <path\n class="line"\n d="m 11.00003,8.49978 h 0.5 c 0.55229,0 1,0.44771 1,1 v 0 c 0,0.55228 -0.44771,1 -1,1 L 10,10.49996 h 1 c 0.55228,0 0.99999,0.44771 1,1 v 0 c 0,0.55228 -0.44772,1 -1,1 H 9.5 l -3.52786,-6e-5 c -0.31049,0 -0.61672,-0.07229 -0.89443,-0.21115 L 3.5,11.4999 m 0,-6.5 c 0,-0.2761 -0.2239,-0.5 -0.5,-0.5 H 1 c -0.2761,0 -0.5,0.2239 -0.5,0.5 v 7 c 0,0.27614 0.2239,0.5 0.5,0.5 h 2 c 0.2761,0 0.5,-0.22386 0.5,-0.5 v -0.5 -6.5 h 0.9415 c 0.3471,10e-6 0.6694,-0.18 0.85145,-0.4755 L 6.48493,2.5895 C 6.49482,2.5735 6.50005,2.555 6.50005,2.5361 L 6.50004,1.477 C 6.50004,0.9374 6.93748,0.5 7.47709,0.5 v 0 c 0.32669,0 0.63296,0.165 0.81417,0.4368 v 0 C 8.7432,1.6147 8.91025,2.4487 8.75047,3.2476 L 8.5000098,4.498621 12.5,4.497321 c 0,0 1,-0.07687 1,0.9999998 0,0.983123 -1,1 -1,1 l -2.460584,0.00258 h 2 c 0.55228,0 1,0.44772 1,1 v 0 c 0,0.55228 -0.44772,1 -1,1 h -2"\n stroke="currentColor"\n stroke-linecap="round"\n stroke-linejoin="round"\n id="path1" />\n</svg>\n`;const b=t=>s(c,{title:t.title,style:"text-transparent",part:"feedback-button",class:`feedback-button rounded-md p-2 ${t.variant} ${t.active?"active":""}`,onClick:t.onClick,ariaPressed:`${t.active}`},s("atomic-icon",{class:"w-5",icon:w}));var m={exports:{}};(function(t,e){(function(t,n){n(e)})(h,(function(t){function e(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}t.defaults=e();function n(e){t.defaults=e}const s=/[&<>"']/;const i=new RegExp(s.source,"g");const r=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;const o=new RegExp(r.source,"g");const a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};const c=t=>a[t];function l(t,e){if(e){if(s.test(t)){return t.replace(i,c)}}else{if(r.test(t)){return t.replace(o,c)}}return t}const h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function u(t){return t.replace(h,((t,e)=>{e=e.toLowerCase();if(e==="colon")return":";if(e.charAt(0)==="#"){return e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1))}return""}))}const f=/(^|[^\[])\^/g;function d(t,e){let n=typeof t==="string"?t:t.source;e=e||"";const s={replace:(t,e)=>{let i=typeof e==="string"?e:e.source;i=i.replace(f,"$1");n=n.replace(t,i);return s},getRegex:()=>new RegExp(n,e)};return s}function p(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch(t){return null}return t}const g={exec:()=>null};function w(t,e){const n=t.replace(/\|/g,((t,e,n)=>{let s=false;let i=e;while(--i>=0&&n[i]==="\\")s=!s;if(s){return"|"}else{return" |"}})),s=n.split(/ \|/);let i=0;if(!s[0].trim()){s.shift()}if(s.length>0&&!s[s.length-1].trim()){s.pop()}if(e){if(s.length>e){s.splice(e)}else{while(s.length<e)s.push("")}}for(;i<s.length;i++){s[i]=s[i].trim().replace(/\\\|/g,"|")}return s}function b(t,e,n){const s=t.length;if(s===0){return""}let i=0;while(i<s){const r=t.charAt(s-i-1);if(r===e&&!n){i++}else if(r!==e&&n){i++}else{break}}return t.slice(0,s-i)}function m(t,e){if(t.indexOf(e[1])===-1){return-1}let n=0;for(let s=0;s<t.length;s++){if(t[s]==="\\"){s++}else if(t[s]===e[0]){n++}else if(t[s]===e[1]){n--;if(n<0){return s}}}return-1}function k(t,e,n,s){const i=e.href;const r=e.title?l(e.title):null;const o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){s.state.inLink=true;const t={type:"link",raw:n,href:i,title:r,text:o,tokens:s.inlineTokens(o)};s.state.inLink=false;return t}return{type:"image",raw:n,href:i,title:r,text:l(o)}}function x(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null){return e}const s=n[1];return e.split("\n").map((t=>{const e=t.match(/^\s+/);if(e===null){return t}const[n]=e;if(n.length>=s.length){return t.slice(s.length)}return t})).join("\n")}class ${options;rules;lexer;constructor(e){this.options=e||t.defaults}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0){return{type:"space",raw:e[0]}}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:!this.options.pedantic?b(t,"\n"):t}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0];const n=x(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(/#$/.test(t)){const e=b(t,"#");if(this.options.pedantic){t=e.trim()}else if(!e||/ $/.test(e)){t=e.trim()}}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e){return{type:"hr",raw:e[0]}}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let t=e[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");t=b(t.replace(/^ *>[ \t]?/gm,""),"\n");const n=this.lexer.state.top;this.lexer.state.top=true;const s=this.lexer.blockTokens(t);this.lexer.state.top=n;return{type:"blockquote",raw:e[0],tokens:s,text:t}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const s=n.length>1;const i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:false,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`;if(this.options.pedantic){n=s?n:"[*+-]"}const r=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="";let a="";let c=false;while(t){let n=false;if(!(e=r.exec(t))){break}if(this.rules.block.hr.test(t)){break}o=e[0];t=t.substring(o.length);let s=e[2].split("\n",1)[0].replace(/^\t+/,(t=>" ".repeat(3*t.length)));let l=t.split("\n",1)[0];let h=0;if(this.options.pedantic){h=2;a=s.trimStart()}else{h=e[2].search(/[^ ]/);h=h>4?1:h;a=s.slice(h);h+=e[1].length}let u=false;if(!s&&/^ *$/.test(l)){o+=l+"\n";t=t.substring(l.length+1);n=true}if(!n){const e=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);const n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);const i=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`);const r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);while(t){const c=t.split("\n",1)[0];l=c;if(this.options.pedantic){l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")}if(i.test(l)){break}if(r.test(l)){break}if(e.test(l)){break}if(n.test(t)){break}if(l.search(/[^ ]/)>=h||!l.trim()){a+="\n"+l.slice(h)}else{if(u){break}if(s.search(/[^ ]/)>=4){break}if(i.test(s)){break}if(r.test(s)){break}if(n.test(s)){break}a+="\n"+l}if(!u&&!l.trim()){u=true}o+=c+"\n";t=t.substring(c.length+1);s=l.slice(h)}}if(!i.loose){if(c){i.loose=true}else if(/\n *\n *$/.test(o)){c=true}}let f=null;let d;if(this.options.gfm){f=/^\[[ xX]\] /.exec(a);if(f){d=f[0]!=="[ ] ";a=a.replace(/^\[[ xX]\] +/,"")}}i.items.push({type:"list_item",raw:o,task:!!f,checked:d,loose:false,text:a,tokens:[]});i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd();i.items[i.items.length-1].text=a.trimEnd();i.raw=i.raw.trimEnd();for(let t=0;t<i.items.length;t++){this.lexer.state.top=false;i.items[t].tokens=this.lexer.blockTokens(i.items[t].text,[]);if(!i.loose){const e=i.items[t].tokens.filter((t=>t.type==="space"));const n=e.length>0&&e.some((t=>/\n.*\n/.test(t.raw)));i.loose=n}}if(i.loose){for(let t=0;t<i.items.length;t++){i.items[t].loose=true}}return i}}html(t){const e=this.rules.block.html.exec(t);if(e){const t={type:"html",block:true,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]};return t}}def(t){const e=this.rules.block.def.exec(t);if(e){const t=e[1].toLowerCase().replace(/\s+/g," ");const n=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"";const s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:s}}}table(t){const e=this.rules.block.table.exec(t);if(!e){return}if(!/[:|]/.test(e[2])){return}const n=w(e[1]);const s=e[2].replace(/^\||\| *$/g,"").split("|");const i=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[];const r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length!==s.length){return}for(const t of s){if(/^ *-+: *$/.test(t)){r.align.push("right")}else if(/^ *:-+: *$/.test(t)){r.align.push("center")}else if(/^ *:-+ *$/.test(t)){r.align.push("left")}else{r.align.push(null)}}for(const t of n){r.header.push({text:t,tokens:this.lexer.inline(t)})}for(const t of i){r.rows.push(w(t,r.header.length).map((t=>({text:t,tokens:this.lexer.inline(t)}))))}return r}lheading(t){const e=this.rules.block.lheading.exec(t);if(e){return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const t=e[1].charAt(e[1].length-1)==="\n"?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(t){const e=this.rules.block.text.exec(t);if(e){return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}}escape(t){const e=this.rules.inline.escape.exec(t);if(e){return{type:"escape",raw:e[0],text:l(e[1])}}}tag(t){const e=this.rules.inline.tag.exec(t);if(e){if(!this.lexer.state.inLink&&/^<a /i.test(e[0])){this.lexer.state.inLink=true}else if(this.lexer.state.inLink&&/^<\/a>/i.test(e[0])){this.lexer.state.inLink=false}if(!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])){this.lexer.state.inRawBlock=true}else if(this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])){this.lexer.state.inRawBlock=false}return{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:e[0]}}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t)){return}const e=b(t.slice(0,-1),"\\");if((t.length-e.length)%2===0){return}}else{const t=m(e[2],"()");if(t>-1){const n=e[0].indexOf("!")===0?5:4;const s=n+e[1].length+t;e[2]=e[2].substring(0,t);e[0]=e[0].substring(0,s).trim();e[3]=""}}let n=e[2];let s="";if(this.options.pedantic){const t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);if(t){n=t[1];s=t[3]}}else{s=e[3]?e[3].slice(1,-1):""}n=n.trim();if(/^</.test(n)){if(this.options.pedantic&&!/>$/.test(t)){n=n.slice(1)}else{n=n.slice(1,-1)}}return k(e,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const t=(n[2]||n[1]).replace(/\s+/g," ");const s=e[t.toLowerCase()];if(!s){const t=n[0].charAt(0);return{type:"text",raw:t,text:t}}return k(n,s,n[0],this.lexer)}}emStrong(t,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;const i=s[1]||s[2]||"";if(!i||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let i,r,o=n,a=0;const c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;c.lastIndex=0;e=e.slice(-1*t.length+n);while((s=c.exec(e))!=null){i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];if(!i)continue;r=[...i].length;if(s[3]||s[4]){o+=r;continue}else if(s[5]||s[6]){if(n%3&&!((n+r)%3)){a+=r;continue}}o-=r;if(o>0)continue;r=Math.min(r,r+o+a);const e=[...s[0]][0].length;const c=t.slice(0,n+s.index+e+r);if(Math.min(n,r)%2){const t=c.slice(1,-1);return{type:"em",raw:c,text:t,tokens:this.lexer.inlineTokens(t)}}const l=c.slice(2,-2);return{type:"strong",raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(/\n/g," ");const n=/[^ ]/.test(t);const s=/^ /.test(t)&&/ $/.test(t);if(n&&s){t=t.substring(1,t.length-1)}t=l(t,true);return{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e){return{type:"br",raw:e[0]}}}del(t){const e=this.rules.inline.del.exec(t);if(e){return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let t,n;if(e[2]==="@"){t=l(e[1]);n="mailto:"+t}else{t=l(e[1]);n=t}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let t,n;if(e[2]==="@"){t=l(e[0]);n="mailto:"+t}else{let s;do{s=e[0];e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??""}while(s!==e[0]);t=l(e[0]);if(e[1]==="www."){n="http://"+e[0]}else{n=e[0]}}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){let t;if(this.lexer.state.inRawBlock){t=e[0]}else{t=l(e[0])}return{type:"text",raw:e[0],text:t}}}}const y=/^(?: *(?:\n|$))+/;const v=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;const A=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;const S=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;const _=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;const C=/(?:[*+-]|\d{1,9}[.)])/;const q=d(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,C).replace(/blockCode/g,/ {4}/).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/).getRegex();const z=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;const T=/^[^\n]+/;const E=/(?!\s*\])(?:\\.|[^\[\]\\])+/;const Z=d(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",E).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();const L=d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,C).getRegex();const M="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";const R=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;const I=d("^ {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|$)"+")","i").replace("comment",R).replace("tag",M).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();const B=d(z).replace("hr",S).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",M).getRegex();const j=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",B).getRegex();const G={blockquote:j,code:v,def:Z,fences:A,heading:_,hr:S,html:I,lheading:q,list:L,newline:y,paragraph:B,table:g,text:T};const D=d("^ *([^\\n ].*)\\n"+" {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)"+"(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",S).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",M).getRegex();const P={...G,table:D,paragraph:d(z).replace("hr",S).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",D).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",M).getRegex()};const H={...G,html:d("^ *(?:comment *(?:\\n|\\s*$)"+"|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)"+"|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",R).replace(/tag/g,"(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub"+"|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)"+"\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:g,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(z).replace("hr",S).replace("heading"," *#{1,6} *[^\n]").replace("lheading",q).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};const F=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;const O=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;const N=/^( {2,}|\\)\n(?!\s*$)/;const V=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;const X="\\p{P}\\p{S}";const U=d(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,X).getRegex();const Q=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;const J=d(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,X).getRegex();const K=d("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)"+"|[^*]+(?=[^*])"+"|(?!\\*)[punct](\\*+)(?=[\\s]|$)"+"|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)"+"|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])"+"|[\\s](\\*+)(?!\\*)(?=[punct])"+"|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])"+"|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,X).getRegex();const W=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)"+"|[^_]+(?=[^_])"+"|(?!_)[punct](_+)(?=[\\s]|$)"+"|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)"+"|(?!_)[punct\\s](_+)(?=[^punct\\s])"+"|[\\s](_+)(?!_)(?=[punct])"+"|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,X).getRegex();const Y=d(/\\([punct])/,"gu").replace(/punct/g,X).getRegex();const tt=d(/^<(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();const et=d(R).replace("(?:--\x3e|$)","--\x3e").getRegex();const nt=d("^comment"+"|^</[a-zA-Z][\\w:-]*\\s*>"+"|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>"+"|^<\\?[\\s\\S]*?\\?>"+"|^<![a-zA-Z]+\\s[\\s\\S]*?>"+"|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",et).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();const st=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;const it=d(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",st).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();const rt=d(/^!?\[(label)\]\[(ref)\]/).replace("label",st).replace("ref",E).getRegex();const ot=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",E).getRegex();const at=d("reflink|nolink(?!\\()","g").replace("reflink",rt).replace("nolink",ot).getRegex();const ct={_backpedal:g,anyPunctuation:Y,autolink:tt,blockSkip:Q,br:N,code:O,del:g,emStrongLDelim:J,emStrongRDelimAst:K,emStrongRDelimUnd:W,escape:F,link:it,nolink:ot,punctuation:U,reflink:rt,reflinkSearch:at,tag:nt,text:V,url:g};const lt={...ct,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",st).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",st).getRegex()};const ht={...ct,escape:d(F).replace("])","~|])").getRegex(),url:d(/^((?: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(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/};const ut={...ht,br:d(N).replace("{2,}","*").getRegex(),text:d(ht.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};const ft={normal:G,gfm:P,pedantic:H};const dt={normal:ct,gfm:ht,breaks:ut,pedantic:lt};class pt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[];this.tokens.links=Object.create(null);this.options=e||t.defaults;this.options.tokenizer=this.options.tokenizer||new $;this.tokenizer=this.options.tokenizer;this.tokenizer.options=this.options;this.tokenizer.lexer=this;this.inlineQueue=[];this.state={inLink:false,inRawBlock:false,top:true};const n={block:ft.normal,inline:dt.normal};if(this.options.pedantic){n.block=ft.pedantic;n.inline=dt.pedantic}else if(this.options.gfm){n.block=ft.gfm;if(this.options.breaks){n.inline=dt.breaks}else{n.inline=dt.gfm}}this.tokenizer.rules=n}static get rules(){return{block:ft,inline:dt}}static lex(t,e){const n=new pt(e);return n.lex(t)}static lexInline(t,e){const n=new pt(e);return n.inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,"\n");this.blockTokens(t,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}this.inlineQueue=[];return this.tokens}blockTokens(t,e=[]){if(this.options.pedantic){t=t.replace(/\t/g," ").replace(/^ +$/gm,"")}else{t=t.replace(/^( *)(\t+)/gm,((t,e,n)=>e+" ".repeat(n.length)))}let n;let s;let i;let r;while(t){if(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>{if(n=s.call({lexer:this},t,e)){t=t.substring(n.raw.length);e.push(n);return true}return false}))){continue}if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length);if(n.raw.length===1&&e.length>0){e[e.length-1].raw+="\n"}else{e.push(n)}continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length);s=e[e.length-1];if(s&&(s.type==="paragraph"||s.type==="text")){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{e.push(n)}continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length);s=e[e.length-1];if(s&&(s.type==="paragraph"||s.type==="text")){s.raw+="\n"+n.raw;s.text+="\n"+n.raw;this.inlineQueue[this.inlineQueue.length-1].src=s.text}else if(!this.tokens.links[n.tag]){this.tokens.links[n.tag]={href:n.href,title:n.title}}continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length);e.push(n);continue}i=t;if(this.options.extensions&&this.options.extensions.startBlock){let e=Infinity;const n=t.slice(1);let s;this.options.extensions.startBlock.forEach((t=>{s=t.call({lexer:this},n);if(typeof s==="number"&&s>=0){e=Math.min(e,s)}}));if(e<Infinity&&e>=0){i=t.substring(0,e+1)}}if(this.state.top&&(n=this.tokenizer.paragraph(i))){s=e[e.length-1];if(r&&s.type==="paragraph"){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{e.push(n)}r=i.length!==t.length;t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length);s=e[e.length-1];if(s&&s.type==="text"){s.raw+="\n"+n.raw;s.text+="\n"+n.text;this.inlineQueue.pop();this.inlineQueue[this.inlineQueue.length-1].src=s.text}else{e.push(n)}continue}if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else{throw new Error(e)}}}this.state.top=true;return e}inline(t,e=[]){this.inlineQueue.push({src:t,tokens:e});return e}inlineTokens(t,e=[]){let n,s,i;let r=t;let o;let a,c;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0){while((o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null){if(t.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))){r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}}}while((o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null){r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex)}while((o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null){r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex)}while(t){if(!a){c=""}a=false;if(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>{if(n=s.call({lexer:this},t,e)){t=t.substring(n.raw.length);e.push(n);return true}return false}))){continue}if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length);s=e[e.length-1];if(s&&n.type==="text"&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{e.push(n)}continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length);s=e[e.length-1];if(s&&n.type==="text"&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{e.push(n)}continue}if(n=this.tokenizer.emStrong(t,r,c)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length);e.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length);e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length);e.push(n);continue}i=t;if(this.options.extensions&&this.options.extensions.startInline){let e=Infinity;const n=t.slice(1);let s;this.options.extensions.startInline.forEach((t=>{s=t.call({lexer:this},n);if(typeof s==="number"&&s>=0){e=Math.min(e,s)}}));if(e<Infinity&&e>=0){i=t.substring(0,e+1)}}if(n=this.tokenizer.inlineText(i)){t=t.substring(n.raw.length);if(n.raw.slice(-1)!=="_"){c=n.raw.slice(-1)}a=true;s=e[e.length-1];if(s&&s.type==="text"){s.raw+=n.raw;s.text+=n.text}else{e.push(n)}continue}if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else{throw new Error(e)}}}return e}}class gt{options;constructor(e){this.options=e||t.defaults}code(t,e,n){const s=(e||"").match(/^\S*/)?.[0];t=t.replace(/\n$/,"")+"\n";if(!s){return"<pre><code>"+(n?t:l(t,true))+"</code></pre>\n"}return'<pre><code class="language-'+l(s)+'">'+(n?t:l(t,true))+"</code></pre>\n"}blockquote(t){return`<blockquote>\n${t}</blockquote>\n`}html(t,e){return t}heading(t,e,n){return`<h${e}>${t}</h${e}>\n`}hr(){return"<hr>\n"}list(t,e,n){const s=e?"ol":"ul";const i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+">\n"+t+"</"+s+">\n"}listitem(t,e,n){return`<li>${t}</li>\n`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>\n`}table(t,e){if(e)e=`<tbody>${e}</tbody>`;return"<table>\n"+"<thead>\n"+t+"</thead>\n"+e+"</table>\n"}tablerow(t){return`<tr>\n${t}</tr>\n`}tablecell(t,e){const n=e.header?"th":"td";const s=e.align?`<${n} align="${e.align}">`:`<${n}>`;return s+t+`</${n}>\n`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,e,n){const s=p(t);if(s===null){return n}t=s;let i='<a href="'+t+'"';if(e){i+=' title="'+e+'"'}i+=">"+n+"</a>";return i}image(t,e,n){const s=p(t);if(s===null){return n}t=s;let i=`<img src="${t}" alt="${n}"`;if(e){i+=` title="${e}"`}i+=">";return i}text(t){return t}}class wt{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,n){return""+n}image(t,e,n){return""+n}br(){return""}}class bt{options;renderer;textRenderer;constructor(e){this.options=e||t.defaults;this.options.renderer=this.options.renderer||new gt;this.renderer=this.options.renderer;this.renderer.options=this.options;this.textRenderer=new wt}static parse(t,e){const n=new bt(e);return n.parse(t)}static parseInline(t,e){const n=new bt(e);return n.parseInline(t)}parse(t,e=true){let n="";for(let s=0;s<t.length;s++){const i=t[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const t=i;const e=this.options.extensions.renderers[t.type].call({parser:this},t);if(e!==false||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(t.type)){n+=e||"";continue}}switch(i.type){case"space":{continue}case"hr":{n+=this.renderer.hr();continue}case"heading":{const t=i;n+=this.renderer.heading(this.parseInline(t.tokens),t.depth,u(this.parseInline(t.tokens,this.textRenderer)));continue}case"code":{const t=i;n+=this.renderer.code(t.text,t.lang,!!t.escaped);continue}case"table":{const t=i;let e="";let s="";for(let e=0;e<t.header.length;e++){s+=this.renderer.tablecell(this.parseInline(t.header[e].tokens),{header:true,align:t.align[e]})}e+=this.renderer.tablerow(s);let r="";for(let e=0;e<t.rows.length;e++){const n=t.rows[e];s="";for(let e=0;e<n.length;e++){s+=this.renderer.tablecell(this.parseInline(n[e].tokens),{header:false,align:t.align[e]})}r+=this.renderer.tablerow(s)}n+=this.renderer.table(e,r);continue}case"blockquote":{const t=i;const e=this.parse(t.tokens);n+=this.renderer.blockquote(e);continue}case"list":{const t=i;const e=t.ordered;const s=t.start;const r=t.loose;let o="";for(let e=0;e<t.items.length;e++){const n=t.items[e];const s=n.checked;const i=n.task;let a="";if(n.task){const t=this.renderer.checkbox(!!s);if(r){if(n.tokens.length>0&&n.tokens[0].type==="paragraph"){n.tokens[0].text=t+" "+n.tokens[0].text;if(n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type==="text"){n.tokens[0].tokens[0].text=t+" "+n.tokens[0].tokens[0].text}}else{n.tokens.unshift({type:"text",text:t+" "})}}else{a+=t+" "}}a+=this.parse(n.tokens,r);o+=this.renderer.listitem(a,i,!!s)}n+=this.renderer.list(o,e,s);continue}case"html":{const t=i;n+=this.renderer.html(t.text,t.block);continue}case"paragraph":{const t=i;n+=this.renderer.paragraph(this.parseInline(t.tokens));continue}case"text":{let r=i;let o=r.tokens?this.parseInline(r.tokens):r.text;while(s+1<t.length&&t[s+1].type==="text"){r=t[++s];o+="\n"+(r.tokens?this.parseInline(r.tokens):r.text)}n+=e?this.renderer.paragraph(o):o;continue}default:{const t='Token with "'+i.type+'" type was not found.';if(this.options.silent){console.error(t);return""}else{throw new Error(t)}}}}return n}parseInline(t,e){e=e||this.renderer;let n="";for(let s=0;s<t.length;s++){const i=t[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const t=this.options.extensions.renderers[i.type].call({parser:this},i);if(t!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=t||"";continue}}switch(i.type){case"escape":{const t=i;n+=e.text(t.text);break}case"html":{const t=i;n+=e.html(t.text);break}case"link":{const t=i;n+=e.link(t.href,t.title,this.parseInline(t.tokens,e));break}case"image":{const t=i;n+=e.image(t.href,t.title,t.text);break}case"strong":{const t=i;n+=e.strong(this.parseInline(t.tokens,e));break}case"em":{const t=i;n+=e.em(this.parseInline(t.tokens,e));break}case"codespan":{const t=i;n+=e.codespan(t.text);break}case"br":{n+=e.br();break}case"del":{const t=i;n+=e.del(this.parseInline(t.tokens,e));break}case"text":{const t=i;n+=e.text(t.text);break}default:{const t='Token with "'+i.type+'" type was not found.';if(this.options.silent){console.error(t);return""}else{throw new Error(t)}}}}return n}}class mt{options;constructor(e){this.options=e||t.defaults}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}}class kt{defaults=e();options=this.setOptions;parse=this.#t(pt.lex,bt.parse);parseInline=this.#t(pt.lexInline,bt.parseInline);Parser=bt;Renderer=gt;TextRenderer=wt;Lexer=pt;Tokenizer=$;Hooks=mt;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(const s of t){n=n.concat(e.call(this,s));switch(s.type){case"table":{const t=s;for(const s of t.header){n=n.concat(this.walkTokens(s.tokens,e))}for(const s of t.rows){for(const t of s){n=n.concat(this.walkTokens(t.tokens,e))}}break}case"list":{const t=s;n=n.concat(this.walkTokens(t.items,e));break}default:{const t=s;if(this.defaults.extensions?.childTokens?.[t.type]){this.defaults.extensions.childTokens[t.type].forEach((s=>{const i=t[s].flat(Infinity);n=n.concat(this.walkTokens(i,e))}))}else if(t.tokens){n=n.concat(this.walkTokens(t.tokens,e))}}}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};t.forEach((t=>{const n={...t};n.async=this.defaults.async||n.async||false;if(t.extensions){t.extensions.forEach((t=>{if(!t.name){throw new Error("extension name required")}if("renderer"in t){const n=e.renderers[t.name];if(n){e.renderers[t.name]=function(...e){let s=t.renderer.apply(this,e);if(s===false){s=n.apply(this,e)}return s}}else{e.renderers[t.name]=t.renderer}}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline"){throw new Error("extension level must be 'block' or 'inline'")}const n=e[t.level];if(n){n.unshift(t.tokenizer)}else{e[t.level]=[t.tokenizer]}if(t.start){if(t.level==="block"){if(e.startBlock){e.startBlock.push(t.start)}else{e.startBlock=[t.start]}}else if(t.level==="inline"){if(e.startInline){e.startInline.push(t.start)}else{e.startInline=[t.start]}}}}if("childTokens"in t&&t.childTokens){e.childTokens[t.name]=t.childTokens}}));n.extensions=e}if(t.renderer){const e=this.defaults.renderer||new gt(this.defaults);for(const n in t.renderer){if(!(n in e)){throw new Error(`renderer '${n}' does not exist`)}if(n==="options"){continue}const s=n;const i=t.renderer[s];const r=e[s];e[s]=(...t)=>{let n=i.apply(e,t);if(n===false){n=r.apply(e,t)}return n||""}}n.renderer=e}if(t.tokenizer){const e=this.defaults.tokenizer||new $(this.defaults);for(const n in t.tokenizer){if(!(n in e)){throw new Error(`tokenizer '${n}' does not exist`)}if(["options","rules","lexer"].includes(n)){continue}const s=n;const i=t.tokenizer[s];const r=e[s];e[s]=(...t)=>{let n=i.apply(e,t);if(n===false){n=r.apply(e,t)}return n}}n.tokenizer=e}if(t.hooks){const e=this.defaults.hooks||new mt;for(const n in t.hooks){if(!(n in e)){throw new Error(`hook '${n}' does not exist`)}if(n==="options"){continue}const s=n;const i=t.hooks[s];const r=e[s];if(mt.passThroughHooks.has(n)){e[s]=t=>{if(this.defaults.async){return Promise.resolve(i.call(e,t)).then((t=>r.call(e,t)))}const n=i.call(e,t);return r.call(e,n)}}else{e[s]=(...t)=>{let n=i.apply(e,t);if(n===false){n=r.apply(e,t)}return n}}}n.hooks=e}if(t.walkTokens){const e=this.defaults.walkTokens;const s=t.walkTokens;n.walkTokens=function(t){let n=[];n.push(s.call(this,t));if(e){n=n.concat(e.call(this,t))}return n}}this.defaults={...this.defaults,...n}}));return this}setOptions(t){this.defaults={...this.defaults,...t};return this}lexer(t,e){return pt.lex(t,e??this.defaults)}parser(t,e){return bt.parse(t,e??this.defaults)}#t(t,e){return(n,s)=>{const i={...s};const r={...this.defaults,...i};if(this.defaults.async===true&&i.async===false){if(!r.silent){console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.")}r.async=true}const o=this.#e(!!r.silent,!!r.async);if(typeof n==="undefined"||n===null){return o(new Error("marked(): input parameter is undefined or null"))}if(typeof n!=="string"){return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"))}if(r.hooks){r.hooks.options=r}if(r.async){return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then((e=>t(e,r))).then((t=>r.hooks?r.hooks.processAllTokens(t):t)).then((t=>r.walkTokens?Promise.all(this.walkTokens(t,r.walkTokens)).then((()=>t)):t)).then((t=>e(t,r))).then((t=>r.hooks?r.hooks.postprocess(t):t)).catch(o)}try{if(r.hooks){n=r.hooks.preprocess(n)}let s=t(n,r);if(r.hooks){s=r.hooks.processAllTokens(s)}if(r.walkTokens){this.walkTokens(s,r.walkTokens)}let i=e(s,r);if(r.hooks){i=r.hooks.postprocess(i)}return i}catch(t){return o(t)}}}#e(t,e){return n=>{n.message+="\nPlease report this to https://github.com/markedjs/marked.";if(t){const t="<p>An error occurred:</p><pre>"+l(n.message+"",true)+"</pre>";if(e){return Promise.resolve(t)}return t}if(e){return Promise.reject(n)}throw n}}}const xt=new kt;function $t(t,e){return xt.parse(t,e)}$t.options=$t.setOptions=function(t){xt.setOptions(t);$t.defaults=xt.defaults;n($t.defaults);return $t};$t.getDefaults=e;$t.defaults=t.defaults;$t.use=function(...t){xt.use(...t);$t.defaults=xt.defaults;n($t.defaults);return $t};$t.walkTokens=function(t,e){return xt.walkTokens(t,e)};$t.parseInline=xt.parseInline;$t.Parser=bt;$t.parser=bt.parse;$t.Renderer=gt;$t.TextRenderer=wt;$t.Lexer=pt;$t.lexer=pt.lex;$t.Tokenizer=$;$t.Hooks=mt;$t.parse=$t;const yt=$t.options;const vt=$t.setOptions;const At=$t.use;const St=$t.walkTokens;const _t=$t.parseInline;const Ct=$t;const qt=bt.parse;const zt=pt.lex;t.Hooks=mt;t.Lexer=pt;t.Marked=kt;t.Parser=bt;t.Renderer=gt;t.TextRenderer=wt;t.Tokenizer=$;t.getDefaults=e;t.lexer=zt;t.marked=$t;t.options=yt;t.parse=Ct;t.parseInline=_t;t.parser=qt;t.setOptions=vt;t.use=At;t.walkTokens=St}))})(m,m.exports);const k=t=>{const e=t.replace(/<[^>]*>/g," ");const n=e.replace(/\s{2,}/g," ");return n.trim()};const x=/(\*{1,3}|`)($|\w[\w\s]*$)/;const $=t=>{const e=x.exec(t);if(e){const n=e[1];const s={"***":'<strong part="answer-strong"><em part="answer-emphasis">$2</em></strong>',"**":'<strong part="answer-strong">$2</strong>',"*":'<em part="answer-emphasis">$2</em>',"`":'<code part="answer-inline-code">$2</code>'};return t.replace(x,s[n])}return t};const y=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;");const v={blockquote(t){return`<blockquote part="answer-quote-block">${t}</blockquote>`},code(t){return`<pre part="answer-code-block"><code>${y(t)}</code></pre>`},codespan(t){return`<code part="answer-inline-code">${t}</code>`},em(t){return`<em part="answer-emphasis">${t}</em>`},heading(t,e){const n=k(t);return`<div part="answer-heading-${e}" aria-label="${n}">${t}</div>`},html(t){return y(t)},list(t,e,n){const s=e?"ol":"ul";const i=e?"answer-ordered-list":"answer-unordered-list";const r=e&&n!==1?`<${s} part="${i}" start="${n}">`:`<${s} part="${i}">`;return`${r}${t}</${s}>`},listitem(t){const e=t.replace(/^<p[^>]*>/,"").replace(/<\/p>\n?$/,"");const n=$(e);return`<li part="answer-list-item">${n}</li>`},paragraph(t){return`<p part="answer-paragraph">${t}</p>`},strong(t){return`<strong part="answer-strong">${t}</strong>`},table(t,e){return`<div part="answer-table-container" class="scrollable-table"><table part="answer-table"><thead>${t}</thead><tbody>${e}</tbody></table></div>`},tablecell(t,e){const n=e.header?"th":"td";const s=e.header?"answer-table-header":"answer-table-content";const i=e.align?`<${n} part="${s}" align="${e.align}">`:`<${n} part="${s}">`;return`${i}${t}</${n}>`},text(t){return $(t)}};const A=t=>m.exports.marked.use({renderer:v}).parse(t);const S=t=>{const e=l.sanitize(A(t.answer??""),{ADD_ATTR:["part"]});return s("div",{part:"generated-text",class:`text-on-background mb-0 ${t.isStreaming?"cursor":""}`,innerHTML:e})};const _=t=>s("p",{part:"generated-text",class:`text-on-background mb-0 whitespace-pre-wrap ${t.isStreaming?"cursor":""}`},t.answer);const C=(t,e)=>s("div",{part:"generated-container",class:"mt-6"},t.answerContentFormat==="text/markdown"?s(S,{answer:t.answer,isStreaming:t.isStreaming}):s(_,{answer:t.answer,isStreaming:t.isStreaming}),s("div",{class:"footer mt-6"},e));const q=t=>s("div",{part:"retry-container",class:"mt-4"},s("div",{class:"text-neutral-dark mx-auto text-center"},t.message),s(c,{class:"mx-auto mt-4 block px-4 py-2",style:"outline-primary",onClick:t.onClick},t.buttonLabel));const z=t=>s(c,{style:"text-primary",part:"answer-show-button",class:"hidden items-center hover:bg-transparent",onClick:()=>t.onClick()},s("div",{class:"text-base font-light"},t.isCollapsed?t.i18n.t("show-more"):t.i18n.t("show-less")),s("atomic-icon",{part:"answer-show-icon",class:"ml-2 w-3.5",icon:t.isCollapsed?u:f}));const T=(t,e)=>t.isVisible?s("div",{class:"source-citations"},s("p",{part:"citations-label",class:"text-neutral-dark mb-2 shrink-0"},t.label),s("ol",{class:"citations-container flex list-none flex-wrap items-center gap-2"},e)):null;class E{constructor(t){this.props=t;this.storage=new i;this._data=this.readStoredData()}insertFeedbackModal(){this.modalRef=document.createElement("atomic-generated-answer-feedback-modal");this.modalRef.generatedAnswer=this.props.getGeneratedAnswer();this.props.host.insertAdjacentElement("beforebegin",this.modalRef)}readStoredData(){const{withToggle:t}=this.props;const e=this.storage.getParsedJSON(r.GENERATED_ANSWER_DATA,{isVisible:true});return{isVisible:t&&e.isVisible||!t}}writeStoredData(t){this.storage.setJSON(r.GENERATED_ANSWER_DATA,t)}get data(){return this._data}set data(t){this._data=t}getGeneratedAnswerStatus(){const t=!this.props.getGeneratedAnswerState()?.isVisible;const e=!!this.props.getGeneratedAnswerState()?.isStreaming;const n=!!this.props.getGeneratedAnswerState()?.answer;const s=!!this.props.getGeneratedAnswerState()?.error;if(t){return this.props.getBindings().i18n.t("generated-answer-hidden")}if(e){return this.props.getBindings().i18n.t("generating-answer")}if(s){return this.props.getBindings().i18n.t("answer-could-not-be-generated")}if(n){return this.props.getBindings().i18n.t("answer-generated",{answer:this.props.getGeneratedAnswerState()?.answer})}return""}get hasRetryableError(){return!this.props.getSearchStatusState()?.hasError&&this.props.getGeneratedAnswerState()?.error?.isRetryable}get hasNoAnswerGenerated(){const{answer:t,citations:e}=this.props.getGeneratedAnswerState()??{};return t===undefined&&!e?.length&&!this.hasRetryableError}get isAnswerVisible(){return this.props.getGeneratedAnswerState()?.isVisible}get toggleTooltip(){const t=this.isAnswerVisible?"generated-answer-toggle-on":"generated-answer-toggle-off";return this.props.getBindings().i18n.t(t)}get hasClipboard(){return!!navigator?.clipboard?.writeText}get copyToClipboardTooltip(){if(this.props.getCopyError()){return this.props.getBindings().i18n.t("failed-to-copy-generated-answer")}return!this.props.getCopied()?this.props.getBindings().i18n.t("copy-generated-answer"):this.props.getBindings().i18n.t("generated-answer-copied")}get hasCustomNoAnswerMessage(){const t=o(this.props.host,"no-answer-message");return!!t}async copyToClipboard(t){try{await navigator.clipboard.writeText(t);this.props.setCopied(true);this.props.getGeneratedAnswer()?.logCopyToClipboard()}catch(t){this.props.setCopyError(true);this.props.getBindings().engine.logger.error(`Failed to copy to clipboard: ${t}`)}setTimeout((()=>{this.props.setCopied(false);this.props.setCopyError(false)}),2e3)}clickOnShowButton(){if(this.props.getGeneratedAnswerState()?.expanded){this.props.getGeneratedAnswer()?.collapse()}else{this.props.getGeneratedAnswer()?.expand()}}getCitation(t){const{title:e}=t;const{i18n:n}=this.props.getBindings();return e.trim()!==""?t:{...t,title:n.t("no-title")}}renderCitations(){const{getGeneratedAnswerState:t,buildInteractiveCitation:e,getGeneratedAnswer:n,disableCitationAnchoring:i}=this.props;const{citations:r}=t()??{};const{logCitationHover:o}=n()??{};return r?.map(((t,n)=>{const r=e({options:{citation:t}});return s("li",{key:t.id,class:"max-w-full"},s("atomic-citation",{citation:this.getCitation(t),index:n,sendHoverEndEvent:e=>{o?.(t.id,e)},interactiveCitation:r,disableCitationAnchoring:i,exportparts:"citation,citation-popover"}))}))}renderFeedbackAndCopyButtons(){const{getGeneratedAnswerState:t,getBindings:e,getCopied:n,getCopyError:i}=this.props;const{i18n:r}=e();const{liked:o,disliked:a,answer:c,isStreaming:l}=t()??{};const h=["feedback-buttons","flex","h-9","absolute","top-6","shrink-0","gap-2",this.props.withToggle?"right-20":"right-6"].join(" ");if(l){return null}return s("div",{class:h},s(b,{title:r.t("this-answer-was-helpful"),variant:"like",active:!!o,onClick:()=>this.clickLike()}),s(b,{title:r.t("this-answer-was-not-helpful"),variant:"dislike",active:!!a,onClick:()=>this.clickDislike()}),this.hasClipboard?s(g,{title:this.copyToClipboardTooltip,isCopied:n(),error:i(),onClick:async()=>{if(c){await this.copyToClipboard(c)}}}):null)}setIsAnswerHelpful(t){if(this.modalRef){this.modalRef.helpful=t}}openFeedbackModal(){if(this.modalRef&&!this.props.getGeneratedAnswerState()?.feedbackSubmitted){this.modalRef.isOpen=true}}clickDislike(){this.setIsAnswerHelpful(false);this.props.getGeneratedAnswer()?.dislike();this.openFeedbackModal()}clickLike(){this.setIsAnswerHelpful(true);this.props.getGeneratedAnswer()?.like();this.openFeedbackModal()}renderDisclaimer(){const{getGeneratedAnswerState:t,getBindings:e}=this.props;const{i18n:n}=e();const{isStreaming:i}=t()??{};if(i){return null}return s("div",{class:"text-neutral-dark text-xs/[1rem]"},s("slot",{name:"disclaimer",slot:"disclaimer"},n.t("generated-answer-disclaimer")))}renderShowButton(){const{getGeneratedAnswerState:t,getBindings:e,collapsible:n}=this.props;const{i18n:i}=e();const{expanded:r,isStreaming:o}=t()??{};const a=n&&!o;if(!a){return null}return s(z,{i18n:i,onClick:()=>this.clickOnShowButton(),isCollapsed:!r})}renderGeneratingAnswerLabel(){const{getGeneratedAnswerState:t,getBindings:e,collapsible:n}=this.props;const{i18n:i}=e();const{isStreaming:r}=t()??{};const o=n&&r;if(!o){return null}return s("div",{part:"is-generating",class:"text-primary hidden text-base font-light"},i.t("generating-answer"),"...")}renderContent(){const{getGeneratedAnswerState:t,getBindings:e,getGeneratedAnswer:n}=this.props;const{i18n:i}=e();const{isStreaming:r,answer:o,citations:c,answerContentFormat:l}=t()??{};return s("div",{part:"generated-content"},s("div",{class:"flex items-center"},s(a,{level:0,part:"header-label",class:"text-primary bg-primary-background inline-block rounded-md px-2.5 py-2 font-medium"},i.t("generated-answer-title")),s("div",{class:"ml-auto flex h-9 items-center"},s(d,{part:"toggle",checked:this.isAnswerVisible,onToggle:t=>{t?n()?.show():n()?.hide()},ariaLabel:i.t("generated-answer-title"),title:this.toggleTooltip,withToggle:this.props.withToggle}))),this.hasRetryableError&&this.isAnswerVisible?s(q,{onClick:()=>n()?.retry(),buttonLabel:i.t("retry"),message:i.t("retry-stream-message")}):null,!this.hasRetryableError&&this.isAnswerVisible?s(C,{answer:o,answerContentFormat:l,isStreaming:!!r},this.renderFeedbackAndCopyButtons(),s(T,{label:i.t("citations"),isVisible:!!c?.length},this.renderCitations())):null,!this.hasRetryableError&&this.isAnswerVisible&&s("div",{part:"generated-answer-footer",class:"mt-6 flex justify-end"},this.renderGeneratingAnswerLabel(),this.renderShowButton(),this.renderDisclaimer()))}renderCustomNoAnswerMessage(){const{getBindings:t}=this.props;const{i18n:e}=t();return s("div",{part:"generated-content"},s("div",{class:"flex items-center"},s(a,{level:0,part:"header-label",class:"text-primary bg-primary-background inline-block rounded-md px-2.5 py-2 font-medium"},e.t("generated-answer-title"))),s("div",{part:"generated-container",class:"mt-6 break-words"},s("slot",{name:"no-answer-message"})))}render(){const{getGeneratedAnswerState:t}=this.props;const{cannotAnswer:e}=t()??{};const n="mx-auto mt-0 mb-4 border border-neutral shadow-lg p-6 bg-background rounded-lg p-6 text-on-background";if(this.hasNoAnswerGenerated){return e&&this.hasCustomNoAnswerMessage?s("div",null,s("aside",{class:n,part:"container"},s("article",null,this.renderCustomNoAnswerMessage()))):null}return s("div",null,s("aside",{class:n,part:"container"},s("article",null,this.renderContent())))}validateProps(){const s=new t({host:new e({required:true}),withToggle:new n({required:false,default:true}),collapsible:new n({required:false,default:true}),disableCitationAnchoring:new n({required:false,default:false}),getGeneratedAnswer:new e({required:true}),getGeneratedAnswerState:new e({required:true}),getSearchStatusState:new e({required:true}),getBindings:new e({required:true}),getCopied:new e({required:true}),setCopied:new e({required:true}),getCopyError:new e({required:true}),setCopyError:new e({required:true}),setAriaMessage:new e({required:true}),buildInteractiveCitation:new e({required:true})});s.validate(this.props)}}export{E as G};
2
+ //# sourceMappingURL=p-cf3b7218.js.map