diff --git a/css/NotificationsApp-Byl_E3vQ.chunk.css b/css/NotificationsApp-NIbJ1ief.chunk.css similarity index 97% rename from css/NotificationsApp-Byl_E3vQ.chunk.css rename to css/NotificationsApp-NIbJ1ief.chunk.css index 7535d3450..200517ec1 100644 --- a/css/NotificationsApp-Byl_E3vQ.chunk.css +++ b/css/NotificationsApp-NIbJ1ief.chunk.css @@ -4,4 +4,4 @@ */.header-menu[data-v-d45c5788]{position:relative;width:var(--header-height);height:var(--header-height)}.header-menu .header-menu__trigger[data-v-d45c5788]{--button-size: var(--header-height) !important;height:var(--header-height);opacity:.85;filter:none!important;color:var(--color-background-plain-text, var(--color-primary-text))!important}.header-menu .header-menu__trigger[data-v-d45c5788]:focus-visible{outline:none!important;box-shadow:none!important}.header-menu .header-menu__trigger[data-v-d45c5788] .button-vue__icon svg,.header-menu .header-menu__trigger[data-v-d45c5788] .button-vue__icon:not(:has(svg)){mask:var(--header-menu-icon-mask, none)}.header-menu--opened .header-menu__trigger[data-v-d45c5788],.header-menu__trigger[data-v-d45c5788]:hover,.header-menu__trigger[data-v-d45c5788]:focus,.header-menu__trigger[data-v-d45c5788]:active{opacity:1}@media only screen and (max-width: 512px){.header-menu[data-v-d45c5788]{width:var(--default-clickable-area)}.header-menu .header-menu__trigger[data-v-d45c5788]{--button-size: var(--default-clickable-area) !important}}.header-menu__wrapper[data-v-d45c5788]{position:fixed;z-index:2000;top:var(--header-height);inset-inline-end:0;box-sizing:border-box;margin:0 8px;border-radius:var(--border-radius-element);background-color:var(--color-main-background);filter:drop-shadow(0 1px 5px var(--color-box-shadow))}.header-menu__caret[data-v-d45c5788]{position:absolute;z-index:2001;bottom:0;inset-inline-start:calc(50% - 10px);width:0;height:0;content:" ";pointer-events:none;border:10px solid transparent;border-bottom-color:var(--color-main-background)}.header-menu__content[data-v-d45c5788]{overflow:auto;width:350px;max-width:calc(100vw - 16px);min-height:calc(var(--default-clickable-area) * 1.5);max-height:calc(100vh - var(--header-height) * 2)}.header-menu__content[data-v-d45c5788] .empty-content{margin:12vh 10px}.material-design-icon[data-v-cd116174]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.widgets--list[data-v-cd116174]{width:100%;min-height:var(--default-clickable-area)}.material-design-icon[data-v-a47e4ba7]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.rich-text--wrapper[data-v-a47e4ba7]{overflow-wrap:break-word;line-height:1.5}.rich-text--wrapper .rich-text--fallback[data-v-a47e4ba7],.rich-text--wrapper .rich-text-component[data-v-a47e4ba7]{display:inline}.rich-text--wrapper .rich-text--external-link[data-v-a47e4ba7]{text-decoration:underline}.rich-text--wrapper .rich-text--external-link[data-v-a47e4ba7]:after{content:" ↗"}.rich-text--wrapper-markdown[data-v-a47e4ba7]{tab-size:4}.rich-text--wrapper-markdown[data-v-a47e4ba7]>:first-child,.rich-text--wrapper-markdown div[data-v-a47e4ba7]>:first-child,.rich-text--wrapper-markdown blockquote[data-v-a47e4ba7]>:first-child{margin-top:0!important}.rich-text--wrapper-markdown[data-v-a47e4ba7]>:last-child,.rich-text--wrapper-markdown[data-v-a47e4ba7]>*:has(+.rich-text--reference-widget),.rich-text--wrapper-markdown div[data-v-a47e4ba7]>:last-child,.rich-text--wrapper-markdown blockquote[data-v-a47e4ba7]>:last-child{margin-block-end:0!important}.rich-text--wrapper-markdown blockquote[data-v-a47e4ba7]{padding-inline-start:13px;border-inline-start:2px solid var(--color-border-dark);color:var(--color-text-maxcontrast)}.rich-text--wrapper-markdown h1[data-v-a47e4ba7],.rich-text--wrapper-markdown h2[data-v-a47e4ba7],.rich-text--wrapper-markdown h3[data-v-a47e4ba7],.rich-text--wrapper-markdown h4[data-v-a47e4ba7],.rich-text--wrapper-markdown h5[data-v-a47e4ba7],.rich-text--wrapper-markdown h6[data-v-a47e4ba7],.rich-text--wrapper-markdown p[data-v-a47e4ba7],.rich-text--wrapper-markdown ul[data-v-a47e4ba7],.rich-text--wrapper-markdown ol[data-v-a47e4ba7],.rich-text--wrapper-markdown blockquote[data-v-a47e4ba7],.rich-text--wrapper-markdown pre[data-v-a47e4ba7]{margin-top:0;margin-block-end:1em}.rich-text--wrapper-markdown h1[data-v-a47e4ba7],.rich-text--wrapper-markdown h2[data-v-a47e4ba7],.rich-text--wrapper-markdown h3[data-v-a47e4ba7],.rich-text--wrapper-markdown h4[data-v-a47e4ba7],.rich-text--wrapper-markdown h5[data-v-a47e4ba7],.rich-text--wrapper-markdown h6[data-v-a47e4ba7]{font-weight:700}.rich-text--wrapper-markdown h4[data-v-a47e4ba7]{font-size:20px}.rich-text--wrapper-markdown h5[data-v-a47e4ba7]{font-size:18px}.rich-text--wrapper-markdown h6[data-v-a47e4ba7]{font-size:15px}.rich-text--wrapper-markdown ul[data-v-a47e4ba7],.rich-text--wrapper-markdown ol[data-v-a47e4ba7]{padding-inline-start:4ch}.rich-text--wrapper-markdown ul[data-v-a47e4ba7]{list-style-type:disc}.rich-text--wrapper-markdown ul.contains-task-list[data-v-a47e4ba7]{list-style-type:none;padding:0}.rich-text--wrapper-markdown li.task-list-item>ul[data-v-a47e4ba7],.rich-text--wrapper-markdown li.task-list-item>ol[data-v-a47e4ba7],.rich-text--wrapper-markdown li.task-list-item>li[data-v-a47e4ba7],.rich-text--wrapper-markdown li.task-list-item>blockquote[data-v-a47e4ba7],.rich-text--wrapper-markdown li.task-list-item>pre[data-v-a47e4ba7]{margin-inline-start:15px;margin-block-end:0}.rich-text--wrapper-markdown pre[data-v-a47e4ba7]{direction:ltr}.rich-text--wrapper-markdown table[data-v-a47e4ba7]{border-collapse:collapse;border:2px solid var(--color-border-maxcontrast)}.rich-text--wrapper-markdown table th[data-v-a47e4ba7],.rich-text--wrapper-markdown table td[data-v-a47e4ba7]{padding:var(--default-grid-baseline);border:1px solid var(--color-border-maxcontrast)}.rich-text--wrapper-markdown table th[data-v-a47e4ba7]:first-child,.rich-text--wrapper-markdown table td[data-v-a47e4ba7]:first-child{border-inline-start:0}.rich-text--wrapper-markdown table th[data-v-a47e4ba7]:last-child,.rich-text--wrapper-markdown table td[data-v-a47e4ba7]:last-child{border-inline-end:0}.rich-text--wrapper-markdown table tr:first-child th[data-v-a47e4ba7]{border-top:0}.rich-text--wrapper-markdown table tr:last-child td[data-v-a47e4ba7]{border-block-end:0}.rich-text--wrapper-markdown .rich-text__code-block[data-v-a47e4ba7]:has(.hljs){color:var(--hljs-color);background:var(--hljs-background-color)}.rich-text--wrapper-markdown .hljs-doctag[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-keyword[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-meta .hljs-keyword[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-template-tag[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-template-variable[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-type[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-variable.language_[data-v-a47e4ba7]{color:var(--hljs-syntax-keyword-color)}.rich-text--wrapper-markdown .hljs-title[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-title.class_[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-title.class_.inherited__[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-title.function_[data-v-a47e4ba7]{color:var(--hljs-syntax-entity-color)}.rich-text--wrapper-markdown .hljs-attr[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-attribute[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-literal[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-meta[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-number[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-operator[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-variable[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-selector-attr[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-selector-class[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-selector-id[data-v-a47e4ba7]{color:var(--hljs-syntax-constant-color)}.rich-text--wrapper-markdown .hljs-regexp[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-string[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-meta .hljs-string[data-v-a47e4ba7]{color:var(--hljs-syntax-string-color)}.rich-text--wrapper-markdown .hljs-built_in[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-symbol[data-v-a47e4ba7]{color:var(--hljs-syntax-variable-color)}.rich-text--wrapper-markdown .hljs-comment[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-code[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-formula[data-v-a47e4ba7]{color:var(--hljs-syntax-comment-color)}.rich-text--wrapper-markdown .hljs-name[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-quote[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-selector-tag[data-v-a47e4ba7],.rich-text--wrapper-markdown .hljs-selector-pseudo[data-v-a47e4ba7]{color:var(--hljs-syntax-entity-tag-color)}.rich-text--wrapper-markdown .hljs-subst[data-v-a47e4ba7]{color:var(--hljs-syntax-storage-modifier-import-color)}.rich-text--wrapper-markdown .hljs-section[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-heading-color);font-weight:700}.rich-text--wrapper-markdown .hljs-bullet[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-list-color)}.rich-text--wrapper-markdown .hljs-emphasis[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-italic-color);font-style:italic}.rich-text--wrapper-markdown .hljs-strong[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-bold-color);font-weight:700}.rich-text--wrapper-markdown .hljs-addition[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-inserted-color);background-color:var(--hljs-syntax-markup-inserted-background-color)}.rich-text--wrapper-markdown .hljs-deletion[data-v-a47e4ba7]{color:var(--hljs-syntax-markup-deleted-color);background-color:var(--hljs-syntax-markup-deleted-background-color)}a[data-v-a47e4ba7]:not(.rich-text--component){text-decoration:underline}@media (prefers-color-scheme: light){.rich-text--wrapper-markdown[data-v-a47e4ba7]{--hljs-color: var(--color-main-text, #24292e);--hljs-background-color: var(--color-background-dark, #ffffff);--hljs-syntax-keyword-color: #d73a49;--hljs-syntax-entity-color: #6f42c1;--hljs-syntax-constant-color: #005cc5;--hljs-syntax-string-color: #032f62;--hljs-syntax-variable-color: #e36209;--hljs-syntax-comment-color: #6a737d;--hljs-syntax-entity-tag-color: #22863a;--hljs-syntax-storage-modifier-import-color: #24292e;--hljs-syntax-markup-heading-color: #005cc5;--hljs-syntax-markup-list-color: #735c0f;--hljs-syntax-markup-italic-color: #24292e;--hljs-syntax-markup-bold-color: #24292e;--hljs-syntax-markup-inserted-color: #22863a;--hljs-syntax-markup-inserted-background-color: #f0fff4;--hljs-syntax-markup-deleted-color: #b31d28;--hljs-syntax-markup-deleted-background-color: #ffeef0}[data-theme-dark] .rich-text--wrapper-markdown[data-v-a47e4ba7]{--hljs-color: var(--color-main-text, #c9d1d9);--hljs-background-color: var(--color-background-dark, #0d1117);--hljs-syntax-keyword-color: #ff7b72;--hljs-syntax-entity-color: #d2a8ff;--hljs-syntax-constant-color: #79c0ff;--hljs-syntax-string-color: #a5d6ff;--hljs-syntax-variable-color: #ffa657;--hljs-syntax-comment-color: #8b949e;--hljs-syntax-entity-tag-color: #7ee787;--hljs-syntax-storage-modifier-import-color: #c9d1d9;--hljs-syntax-markup-heading-color: #1f6feb;--hljs-syntax-markup-list-color: #f2cc60;--hljs-syntax-markup-italic-color: #c9d1d9;--hljs-syntax-markup-bold-color: #c9d1d9;--hljs-syntax-markup-inserted-color: #aff5b4;--hljs-syntax-markup-inserted-background-color: #033a16;--hljs-syntax-markup-deleted-color: #ffdcd7;--hljs-syntax-markup-deleted-background-color: #67060c}}@media (prefers-color-scheme: dark){.rich-text--wrapper-markdown[data-v-a47e4ba7]{--hljs-color: var(--color-main-text, #c9d1d9);--hljs-background-color: var(--color-background-dark, #0d1117);--hljs-syntax-keyword-color: #ff7b72;--hljs-syntax-entity-color: #d2a8ff;--hljs-syntax-constant-color: #79c0ff;--hljs-syntax-string-color: #a5d6ff;--hljs-syntax-variable-color: #ffa657;--hljs-syntax-comment-color: #8b949e;--hljs-syntax-entity-tag-color: #7ee787;--hljs-syntax-storage-modifier-import-color: #c9d1d9;--hljs-syntax-markup-heading-color: #1f6feb;--hljs-syntax-markup-list-color: #f2cc60;--hljs-syntax-markup-italic-color: #c9d1d9;--hljs-syntax-markup-bold-color: #c9d1d9;--hljs-syntax-markup-inserted-color: #aff5b4;--hljs-syntax-markup-inserted-background-color: #033a16;--hljs-syntax-markup-deleted-color: #ffdcd7;--hljs-syntax-markup-deleted-background-color: #67060c}[data-theme-light] .rich-text--wrapper-markdown[data-v-a47e4ba7]{--hljs-color: var(--color-main-text, #24292e);--hljs-background-color: var(--color-background-dark, #ffffff);--hljs-syntax-keyword-color: #d73a49;--hljs-syntax-entity-color: #6f42c1;--hljs-syntax-constant-color: #005cc5;--hljs-syntax-string-color: #032f62;--hljs-syntax-variable-color: #e36209;--hljs-syntax-comment-color: #6a737d;--hljs-syntax-entity-tag-color: #22863a;--hljs-syntax-storage-modifier-import-color: #24292e;--hljs-syntax-markup-heading-color: #005cc5;--hljs-syntax-markup-list-color: #735c0f;--hljs-syntax-markup-italic-color: #24292e;--hljs-syntax-markup-bold-color: #24292e;--hljs-syntax-markup-inserted-color: #22863a;--hljs-syntax-markup-inserted-background-color: #f0fff4;--hljs-syntax-markup-deleted-color: #b31d28;--hljs-syntax-markup-deleted-background-color: #ffeef0}}.rich-text__code-block[data-v-a47e4ba7]{position:relative;padding-inline-end:calc(var(--clickable-area-small) + var(--default-grid-baseline))}.rich-text__code-block pre[data-v-a47e4ba7]{width:100%;overflow-x:auto}.rich-text__code-block .rich-text__code-block-button[data-v-a47e4ba7]{position:absolute;top:var(--default-grid-baseline);inset-inline-end:var(--default-grid-baseline);opacity:0}.rich-text__code-block:hover .rich-text__code-block-button[data-v-a47e4ba7],.rich-text__code-block:focus-within .rich-text__code-block-button[data-v-a47e4ba7],.rich-text__code-block .rich-text__code-block-button[data-v-a47e4ba7]:focus{opacity:1}.material-design-icon[data-v-e408867a],.material-design-icon[data-v-90c6aa3b]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.provider-list[data-v-90c6aa3b]{width:100%;min-height:400px;padding:0 16px 16px;display:flex;flex-direction:column}.provider-list--select[data-v-90c6aa3b]{width:100%}.provider-list--select .provider[data-v-90c6aa3b]{display:flex;align-items:center;height:28px;overflow:hidden}.provider-list--select .provider .link-icon[data-v-90c6aa3b]{margin-inline-end:8px}.provider-list--select .provider .provider-icon[data-v-90c6aa3b]{width:20px;height:20px;object-fit:contain;margin-inline-end:8px;filter:var(--background-invert-if-dark)}.provider-list--select .provider .option-text[data-v-90c6aa3b]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.material-design-icon[data-v-8ce33442]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.widget-custom[data-v-8ce33442]{width:100%;margin:auto;margin-bottom:calc(var(--default-grid-baseline, 4px) * 3);margin-top:calc(var(--default-grid-baseline, 4px) * 3);overflow:hidden;border:2px solid var(--color-border);border-radius:var(--border-radius-container);background-color:transparent;display:flex}.widget-custom.full-width[data-v-8ce33442]{width:var(--widget-full-width, 100%)!important;inset-inline-start:calc((var(--widget-full-width, 100%) - 100%) / 2 * -1);position:relative}.widget-access[data-v-8ce33442]{width:100%;margin:auto;margin-bottom:calc(var(--default-grid-baseline, 4px) * 3);margin-top:calc(var(--default-grid-baseline, 4px) * 3);overflow:hidden;border:2px solid var(--color-border);border-radius:var(--border-radius-container);background-color:transparent;display:flex;padding:calc(var(--default-grid-baseline, 4px) * 3)}.widget-default[data-v-8ce33442]{width:100%;margin:auto;margin-bottom:calc(var(--default-grid-baseline, 4px) * 3);margin-top:calc(var(--default-grid-baseline, 4px) * 3);overflow:hidden;border:2px solid var(--color-border);border-radius:var(--border-radius-container);background-color:transparent;display:flex}.widget-default--compact[data-v-8ce33442]{flex-direction:column}.widget-default--compact .widget-default--image[data-v-8ce33442]{width:100%;height:150px}.widget-default--compact .widget-default--details[data-v-8ce33442]{width:100%;padding-top:calc(var(--default-grid-baseline, 4px) * 2);padding-bottom:calc(var(--default-grid-baseline, 4px) * 2)}.widget-default--compact .widget-default--description[data-v-8ce33442]{display:none}.widget-default--image[data-v-8ce33442]{width:40%;background-position:center;background-size:cover;background-repeat:no-repeat}.widget-default--name[data-v-8ce33442]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}.widget-default--details[data-v-8ce33442]{padding:calc(var(--default-grid-baseline, 4px) * 3);width:60%}.widget-default--details p[data-v-8ce33442]{margin:0;padding:0}.widget-default--description[data-v-8ce33442]{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical}.widget-default--link[data-v-8ce33442]{color:var(--color-text-maxcontrast);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toggle-interactive[data-v-8ce33442]{position:relative}.toggle-interactive .toggle-interactive--button[data-v-8ce33442]{position:absolute;bottom:var(--default-grid-baseline);inset-inline-end:var(--default-grid-baseline);z-index:10000}.material-design-icon[data-v-a0658f2a]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.raw-link[data-v-a0658f2a]{width:100%;min-height:350px;display:flex;flex-direction:column;overflow-y:auto;padding:0 16px 16px}.raw-link .input-wrapper[data-v-a0658f2a]{width:100%}.raw-link .reference-widget[data-v-a0658f2a]{display:flex}.raw-link--empty-content .provider-icon[data-v-a0658f2a]{width:150px;height:150px;object-fit:contain;filter:var(--background-invert-if-dark)}.raw-link--input[data-v-a0658f2a]{width:99%}.material-design-icon[data-v-059edcfb]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.result[data-v-059edcfb]{display:flex;align-items:center;height:var(--default-clickable-area);overflow:hidden}.result--icon-class[data-v-059edcfb],.result--image[data-v-059edcfb]{width:40px;min-width:40px;height:40px;object-fit:contain}.result--icon-class.rounded[data-v-059edcfb],.result--image.rounded[data-v-059edcfb]{border-radius:50%}.result--content[data-v-059edcfb]{display:flex;flex-direction:column;padding-inline-start:10px;overflow:hidden}.result--content--name[data-v-059edcfb],.result--content--subline[data-v-059edcfb]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.material-design-icon[data-v-e8abf1d4]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.smart-picker-search[data-v-e8abf1d4]{width:100%;display:flex;flex-direction:column;padding:0 16px 16px}.smart-picker-search.with-empty-content[data-v-e8abf1d4]{min-height:400px}.smart-picker-search .provider-icon[data-v-e8abf1d4]{width:150px;height:150px;object-fit:contain;filter:var(--background-invert-if-dark)}.smart-picker-search--select[data-v-e8abf1d4],.smart-picker-search--select .search-result[data-v-e8abf1d4]{width:100%}.smart-picker-search--select .group-name-icon[data-v-e8abf1d4],.smart-picker-search--select .option-simple-icon[data-v-e8abf1d4]{width:20px;height:20px;margin:0 20px 0 10px}.smart-picker-search--select .custom-option[data-v-e8abf1d4]{height:var(--default-clickable-area);display:flex;align-items:center;overflow:hidden}.smart-picker-search--select .option-text[data-v-e8abf1d4]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.material-design-icon[data-v-b193005a]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.reference-picker[data-v-b193005a],.reference-picker .custom-element-wrapper[data-v-b193005a],.reference-picker .custom-element-wrapper .custom-element[data-v-b193005a]{display:flex;overflow-y:auto;width:100%}.material-design-icon[data-v-15018516]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.reference-picker-modal[data-v-15018516] .modal-container{display:flex!important}.reference-picker-modal--content[data-v-15018516]{width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;overflow-y:auto}.reference-picker-modal--content .close-button[data-v-15018516],.reference-picker-modal--content .back-button[data-v-15018516]{position:absolute;top:4px}.reference-picker-modal--content .back-button[data-v-15018516]{inset-inline-start:4px}.reference-picker-modal--content .close-button[data-v-15018516]{inset-inline-end:4px}.reference-picker-modal--content>h2[data-v-15018516]{display:flex;margin:12px 0 20px}.reference-picker-modal--content>h2 .icon[data-v-15018516]{margin-inline-end:8px}.material-design-icon[data-v-a0e80f48]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}/*! * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later - */.input-field[data-v-a0e80f48]{--input-border-color: var(--color-border-maxcontrast);--input-border-radius: var(--border-radius-element);--input-padding-start: var(--border-radius-element);--input-padding-end: var(--border-radius-element);position:relative;width:100%;margin-block-start:6px}.input-field--disabled[data-v-a0e80f48]{opacity:.4;filter:saturate(.4)}.input-field--label-outside[data-v-a0e80f48]{margin-block-start:0}.input-field--leading-icon[data-v-a0e80f48]{--input-padding-start: calc(var(--default-clickable-area) - var(--default-grid-baseline))}.input-field--trailing-icon[data-v-a0e80f48]{--input-padding-end: calc(var(--default-clickable-area) - var(--default-grid-baseline))}.input-field--pill[data-v-a0e80f48]{--input-border-radius: var(--border-radius-pill)}.input-field__main-wrapper[data-v-a0e80f48]{height:var(--default-clickable-area);padding:var(--border-width-input-focused, 2px);position:relative}.input-field__input[data-v-a0e80f48]{--input-border-box-shadow-light: 0 -1px var(--input-border-color), 0 0 0 1px color-mix(in srgb, var(--input-border-color), 65% transparent);--input-border-box-shadow-dark: 0 1px var(--input-border-color), 0 0 0 1px color-mix(in srgb, var(--input-border-color), 65% transparent);--input-border-box-shadow: var(--input-border-box-shadow-light);border:none;border-radius:var(--border-radius-element);box-shadow:var(--input-border-box-shadow)}.input-field__input[data-v-a0e80f48]:hover:not([disabled]){box-shadow:0 0 0 1px var(--input-border-color)}@media (prefers-color-scheme: dark){.input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-dark)}}[data-theme-dark] .input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-dark)}[data-theme-light] .input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-light)}.input-field--legacy .input-field__input[data-v-a0e80f48]{box-shadow:0 0 0 1px var(--input-border-color)}.input-field--legacy .input-field__input[data-v-a0e80f48]:hover:not([disabled]){box-shadow:0 0 0 2px var(--input-border-color)}.input-field__input[data-v-a0e80f48]:focus-within:not([disabled]),.input-field__input[data-v-a0e80f48]:active:not([disabled]){box-shadow:0 0 0 2px var(--input-border-color),0 0 0 4px var(--color-main-background)!important}.input-field__input[data-v-a0e80f48]{background-color:var(--color-main-background);color:var(--color-main-text);border-radius:var(--input-border-radius);cursor:pointer;-webkit-appearance:textfield!important;-moz-appearance:textfield!important;appearance:textfield!important;font-size:var(--default-font-size);text-overflow:ellipsis;padding-block:0;padding-inline:var(--input-padding-start) var(--input-padding-end);height:100%!important;min-height:unset;width:100%}.input-field__input[data-v-a0e80f48]::placeholder{color:var(--color-text-maxcontrast)}.input-field__input[data-v-a0e80f48]::-webkit-search-cancel-button{display:none}.input-field__input[data-v-a0e80f48]::-webkit-search-decoration,.input-field__input[data-v-a0e80f48]::-webkit-search-results-button,.input-field__input[data-v-a0e80f48]::-webkit-search-results-decoration,.input-field__input[data-v-a0e80f48]::-ms-clear{display:none}.input-field__input[data-v-a0e80f48]:active:not([disabled]),.input-field__input[data-v-a0e80f48]:focus:not([disabled]){--input-border-color: var(--color-main-text)}.input-field__input:focus+.input-field__label[data-v-a0e80f48],.input-field__input:hover:not(:placeholder-shown)+.input-field__label[data-v-a0e80f48]{color:var(--color-main-text)}.input-field__input[data-v-a0e80f48]:focus{cursor:text}.input-field__input[data-v-a0e80f48]:disabled{cursor:default}.input-field__input[data-v-a0e80f48]:focus-visible{box-shadow:unset!important}.input-field:not(.input-field--label-outside) .input-field__input[data-v-a0e80f48]:not(:focus)::placeholder{opacity:0}.input-field__label[data-v-a0e80f48]{--input-label-font-size: var(--default-font-size);font-size:var(--input-label-font-size);position:absolute;margin-inline:var(--input-padding-start) var(--input-padding-end);max-width:fit-content;inset-block-start:calc((var(--default-clickable-area) - 1lh) / 2);inset-inline:var(--border-width-input-focused, 2px);color:var(--color-text-maxcontrast);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;transition:height var(--animation-quick),inset-block-start var(--animation-quick),font-size var(--animation-quick),color var(--animation-quick),background-color var(--animation-quick) var(--animation-slow)}.input-field__input:focus+.input-field__label[data-v-a0e80f48],.input-field__input:not(:placeholder-shown)+.input-field__label[data-v-a0e80f48]{--input-label-font-size: 13px;line-height:1.5;inset-block-start:calc(-1.5 * var(--input-label-font-size) / 2);font-weight:500;border-radius:var(--default-grid-baseline) var(--default-grid-baseline) 0 0;background-color:var(--color-main-background);padding-inline:var(--default-grid-baseline);margin-inline:calc(var(--input-padding-start) - var(--default-grid-baseline)) calc(var(--input-padding-end) - var(--default-grid-baseline));transition:height var(--animation-quick),inset-block-start var(--animation-quick),font-size var(--animation-quick),color var(--animation-quick)}.input-field__icon[data-v-a0e80f48]{position:absolute;height:var(--default-clickable-area);width:var(--default-clickable-area);display:flex;align-items:center;justify-content:center;opacity:.7;inset-block-end:0}.input-field__icon--leading[data-v-a0e80f48]{inset-inline-start:0px}.input-field__icon--trailing[data-v-a0e80f48]{inset-inline-end:0px}.input-field__trailing-button[data-v-a0e80f48]{--button-size: calc(var(--default-clickable-area) - 2 * var(--border-width-input-focused, 2px)) !important;--button-radius: calc(var(--input-border-radius) - var(--border-width-input-focused, 2px))}.input-field__trailing-button.button-vue[data-v-a0e80f48]{position:absolute;top:var(--border-width-input-focused, 2px);inset-inline-end:var(--border-width-input-focused, 2px)}.input-field__trailing-button.button-vue[data-v-a0e80f48]:focus-visible{box-shadow:none!important}.input-field__helper-text-message[data-v-a0e80f48]{padding-block:4px;padding-inline:var(--border-radius-element);display:flex;align-items:center;color:var(--color-text-maxcontrast)}.input-field__helper-text-message__icon[data-v-a0e80f48]{margin-inline-end:8px}.input-field--error .input-field__helper-text-message[data-v-a0e80f48],.input-field--error .input-field__icon--trailing[data-v-a0e80f48]{color:var(--color-text-error, var(--color-error))}.input-field--error .input-field__input[data-v-a0e80f48],.input-field__input[data-v-a0e80f48]:user-invalid{--input-border-color: var(--color-border-error, var(--color-error)) !important}.input-field--error .input-field__input[data-v-a0e80f48]:focus-visible,.input-field__input[data-v-a0e80f48]:user-invalid:focus-visible{box-shadow:#f8fafc 0 0 0 2px,var(--color-primary-element) 0 0 0 4px,#0000000d 0 1px 2px}.input-field--success .input-field__input[data-v-a0e80f48]{--input-border-color: var(--color-border-success, var(--color-success)) !important}.input-field--success .input-field__input[data-v-a0e80f48]:focus-visible{box-shadow:#f8fafc 0 0 0 2px,var(--color-primary-element) 0 0 0 4px,#0000000d 0 1px 2px}.input-field--success .input-field__helper-text-message__icon[data-v-a0e80f48]{color:var(--color-border-success, var(--color-success))}.external[data-v-9803ab31]:after{content:" ↗"}.material-design-icon[data-v-ad356e41]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.user-bubble__wrapper[data-v-ad356e41]{display:inline-block;vertical-align:middle;min-width:0;max-width:100%}.user-bubble__content[data-v-ad356e41]{display:inline-flex;max-width:100%;background-color:var(--color-background-dark)}.user-bubble__content--primary[data-v-ad356e41]{color:var(--color-primary-element-text);background-color:var(--color-primary-element)}.user-bubble__content[data-v-ad356e41]>:last-child{padding-inline-end:8px}.user-bubble__avatar[data-v-ad356e41]{align-self:center}.user-bubble__name[data-v-ad356e41]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.user-bubble__name[data-v-ad356e41],.user-bubble__secondary[data-v-ad356e41]{padding-block:0;padding-inline:4px 0}.material-design-icon[data-v-d7dc2a1f]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.avatardiv[data-v-d7dc2a1f]{position:relative;display:inline-block;width:var(--avatar-size);height:var(--avatar-size)}.avatardiv--unknown[data-v-d7dc2a1f]{position:relative;background-color:var(--color-main-background);white-space:normal}.avatardiv[data-v-d7dc2a1f]:not(.avatardiv--unknown){background-color:var(--color-main-background)!important;box-shadow:0 0 5px #0000000d inset}.avatardiv--with-menu[data-v-d7dc2a1f]{cursor:pointer}.avatardiv--with-menu .action-item[data-v-d7dc2a1f]{position:absolute;top:0;inset-inline-start:0}.avatardiv--with-menu[data-v-d7dc2a1f] .action-item__menutoggle{cursor:pointer;opacity:0}.avatardiv--with-menu[data-v-d7dc2a1f]:focus-within .action-item__menutoggle,.avatardiv--with-menu[data-v-d7dc2a1f]:hover .action-item__menutoggle,.avatardiv--with-menu.avatardiv--with-menu-loading[data-v-d7dc2a1f] .action-item__menutoggle{opacity:1}.avatardiv--with-menu:focus-within img[data-v-d7dc2a1f],.avatardiv--with-menu:hover img[data-v-d7dc2a1f],.avatardiv--with-menu.avatardiv--with-menu-loading img[data-v-d7dc2a1f]{opacity:.3}.avatardiv--with-menu[data-v-d7dc2a1f] .action-item__menutoggle,.avatardiv--with-menu img[data-v-d7dc2a1f]{transition:opacity var(--animation-quick)}.avatardiv--with-menu[data-v-d7dc2a1f] .button-vue,.avatardiv--with-menu[data-v-d7dc2a1f] .button-vue__icon{height:var(--avatar-size);min-height:var(--avatar-size);width:var(--avatar-size)!important;min-width:var(--avatar-size)}.avatardiv--with-menu[data-v-d7dc2a1f]>.button-vue,.avatardiv--with-menu[data-v-d7dc2a1f]>.action-item .button-vue{--button-radius: calc(var(--avatar-size) / 2)}.avatardiv .avatardiv__initials-wrapper[data-v-d7dc2a1f]{display:block;height:var(--avatar-size);width:var(--avatar-size);background-color:var(--color-main-background);border-radius:calc(var(--avatar-size) / 2)}.avatardiv .avatardiv__initials-wrapper .avatardiv__initials[data-v-d7dc2a1f]{position:absolute;top:0;inset-inline-start:0;display:block;width:100%;text-align:center;font-weight:400}.avatardiv img[data-v-d7dc2a1f]{width:100%;height:100%;object-fit:cover}.avatardiv .material-design-icon[data-v-d7dc2a1f]{width:var(--avatar-size);height:var(--avatar-size)}.avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{--avatar-status-size-orbital: calc(var(--avatar-size) * (1 - 1 / sqrt(2)));--avatar-status-size-min: var(--font-size-small);--avatar-status-size: max(var(--avatar-status-size-orbital), var(--avatar-status-size-min));box-sizing:border-box;position:absolute;inset-inline-end:0;inset-block-end:0;height:var(--avatar-status-size);width:var(--avatar-status-size);line-height:1;font-size:calc(var(--avatar-status-size) / 1.2);background-color:var(--color-main-background);background-repeat:no-repeat;background-size:var(--avatar-status-size);background-position:center;border-radius:50%;display:flex;align-items:center;justify-content:center}.acli:hover .avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{border-color:var(--color-background-hover);background-color:var(--color-background-hover)}.acli.active .avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{border-color:var(--color-primary-element-light);background-color:var(--color-primary-element-light)}.avatardiv .avatardiv__user-status--icon[data-v-d7dc2a1f]{border:none;background-color:transparent}.avatardiv .popovermenu-wrapper[data-v-d7dc2a1f]{position:relative;display:inline-block}.avatar-class-icon[data-v-d7dc2a1f]{display:block;border-radius:calc(var(--avatar-size) / 2);background-color:var(--color-background-darker);height:100%}.material-design-icon[data-v-45238efd]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.mention-bubble--primary .mention-bubble__content[data-v-45238efd]{color:var(--color-primary-element-text);background-color:var(--color-primary-element)}.mention-bubble__wrapper[data-v-45238efd]{position:relative;max-width:150px;height:18px;vertical-align:text-bottom;display:inline-flex;align-items:center}.mention-bubble__content[data-v-45238efd]{display:inline-flex;overflow:hidden;align-items:center;max-width:100%;height:20px;-webkit-user-select:none;user-select:none;padding-inline:2px 6px;border-radius:10px;background-color:var(--color-background-dark)}.mention-bubble__icon[data-v-45238efd]{position:relative;width:16px;height:16px;border-radius:8px;background-color:var(--color-background-darker);background-repeat:no-repeat;background-position:center;background-size:12px}.mention-bubble__icon--with-avatar[data-v-45238efd]{color:inherit;background-size:cover}.mention-bubble__title[data-v-45238efd]{overflow:hidden;margin-inline-start:2px;white-space:nowrap;text-overflow:ellipsis}.mention-bubble__title[data-v-45238efd]:before{content:attr(title)}.mention-bubble__select[data-v-45238efd]{position:absolute;z-index:-1;inset-inline-start:-100vw;width:1px;height:1px;overflow:hidden}.material-design-icon[data-v-881a79fb]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.user-status-icon[data-v-881a79fb]{--user-status-color-online: #2D7B41;--user-status-color-busy: #DB0606;--user-status-color-away: #C88800;--user-status-color-offline: #6B6B6B;display:flex;justify-content:center;align-items:center}.user-status-icon--invisible[data-v-881a79fb]{filter:var(--background-invert-if-dark)}.user-status-icon[data-v-881a79fb] svg{width:100%;height:100%}.material-design-icon[data-v-6c2daf4e]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-6c2daf4e]:hover,li.action.active[data-v-6c2daf4e]{border-radius:6px;padding:0}li.action[data-v-6c2daf4e]:hover{background-color:var(--color-background-hover)}.action--disabled[data-v-6c2daf4e]{pointer-events:none;opacity:.5}.action--disabled[data-v-6c2daf4e]:hover,.action--disabled[data-v-6c2daf4e]:focus{cursor:default;opacity:.5}.action--disabled[data-v-6c2daf4e] *{opacity:1!important}.action-button[data-v-6c2daf4e]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-button>span[data-v-6c2daf4e]{cursor:pointer;white-space:nowrap}.action-button__icon[data-v-6c2daf4e]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-button[data-v-6c2daf4e] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-button[data-v-6c2daf4e] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-button__longtext-wrapper[data-v-6c2daf4e],.action-button__longtext[data-v-6c2daf4e]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-button__longtext[data-v-6c2daf4e]{cursor:pointer;white-space:pre-wrap!important}.action-button__name[data-v-6c2daf4e]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-button__description[data-v-6c2daf4e]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-button__menu-icon[data-v-6c2daf4e],.action-button__pressed-icon[data-v-6c2daf4e]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action-button[data-v-6c2daf4e] *{cursor:pointer}.material-design-icon[data-v-32f01b7a]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-32f01b7a]:hover,li.action.active[data-v-32f01b7a]{border-radius:6px;padding:0}li.action[data-v-32f01b7a]:hover{background-color:var(--color-background-hover)}.action-link[data-v-32f01b7a]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-link>span[data-v-32f01b7a]{cursor:pointer;white-space:nowrap}.action-link__icon[data-v-32f01b7a]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-link[data-v-32f01b7a] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-link[data-v-32f01b7a] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-link__longtext-wrapper[data-v-32f01b7a],.action-link__longtext[data-v-32f01b7a]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-link__longtext[data-v-32f01b7a]{cursor:pointer;white-space:pre-wrap!important}.action-link__name[data-v-32f01b7a]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-link__description[data-v-32f01b7a]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-link__menu-icon[data-v-32f01b7a]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.material-design-icon[data-v-87267750]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-87267750]:hover,li.action.active[data-v-87267750]{border-radius:6px;padding:0}li.action[data-v-87267750]:hover{background-color:var(--color-background-hover)}.action-router[data-v-87267750]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-router>span[data-v-87267750]{cursor:pointer;white-space:nowrap}.action-router__icon[data-v-87267750]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-router[data-v-87267750] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-router[data-v-87267750] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-router__longtext-wrapper[data-v-87267750],.action-router__longtext[data-v-87267750]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-router__longtext[data-v-87267750]{cursor:pointer;white-space:pre-wrap!important}.action-router__name[data-v-87267750]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-router__description[data-v-87267750]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-router__menu-icon[data-v-87267750]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action--disabled[data-v-87267750]{pointer-events:none;opacity:.5}.action--disabled[data-v-87267750]:hover,.action--disabled[data-v-87267750]:focus{cursor:default;opacity:.5}.action--disabled[data-v-87267750] *{opacity:1!important}.material-design-icon[data-v-fa684b48]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-fa684b48]:hover,li.action.active[data-v-fa684b48]{border-radius:6px;padding:0}li.action[data-v-fa684b48]:hover{background-color:var(--color-background-hover)}.action-text[data-v-fa684b48]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-text>span[data-v-fa684b48]{cursor:pointer;white-space:nowrap}.action-text__icon[data-v-fa684b48]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-text[data-v-fa684b48] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-text[data-v-fa684b48] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-text__longtext-wrapper[data-v-fa684b48],.action-text__longtext[data-v-fa684b48]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-text__longtext[data-v-fa684b48]{cursor:pointer;white-space:pre-wrap!important}.action-text__name[data-v-fa684b48]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-text__description[data-v-fa684b48]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-text__menu-icon[data-v-fa684b48]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action--disabled[data-v-fa684b48]{pointer-events:none;opacity:.5}.action--disabled[data-v-fa684b48]:hover,.action--disabled[data-v-fa684b48]:focus{cursor:default;opacity:.5}.action--disabled[data-v-fa684b48] *{opacity:1!important}.action-text[data-v-fa684b48],.action-text span[data-v-fa684b48]{cursor:default}.mention[data-v-85edf4b2]{display:contents;white-space:nowrap}.notification[data-v-58882784] img.notification-icon{display:flex;width:32px;height:32px;filter:var(--background-invert-if-dark)}.notification[data-v-58882784] .rich-text--wrapper{white-space:pre-wrap;overflow-wrap:break-word}.notification .notification-subject[data-v-58882784]{padding:4px}.notification a.notification-subject[data-v-58882784]:focus-visible{box-shadow:inset 0 0 0 2px var(--color-main-text)!important}.notification-container[data-v-57714b57]{overflow:hidden}.notification-container[data-v-57714b57],.notification-container[data-v-57714b57] *,.notification-container[data-v-57714b57] *:before,.notification-container[data-v-57714b57] *:after{box-sizing:border-box}.notification-container .notification-wrapper[data-v-57714b57]{display:flex;flex-direction:column;max-height:calc(100vh - 250px);overflow:auto}.notification-container .dismiss-all[data-v-57714b57]{padding:calc(2 * var(--default-grid-baseline));border-top:1px solid var(--color-border)}.icon-alert-outline[data-v-57714b57]{background-size:64px;width:64px;height:64px}.fade-enter-active[data-v-57714b57],.fade-leave-active[data-v-57714b57]{transition:opacity var(--animation-quick) ease}.fade-enter-from[data-v-57714b57],.fade-leave-to[data-v-57714b57]{opacity:0}.list-move[data-v-57714b57],.list-enter-active[data-v-57714b57],.list-leave-active[data-v-57714b57]{transition:all var(--animation-quick) ease}.list-enter-from[data-v-57714b57],.list-leave-to[data-v-57714b57]{opacity:0;transform:translate(30px)}.list-leave-active[data-v-57714b57]{width:100%} + */.input-field[data-v-a0e80f48]{--input-border-color: var(--color-border-maxcontrast);--input-border-radius: var(--border-radius-element);--input-padding-start: var(--border-radius-element);--input-padding-end: var(--border-radius-element);position:relative;width:100%;margin-block-start:6px}.input-field--disabled[data-v-a0e80f48]{opacity:.4;filter:saturate(.4)}.input-field--label-outside[data-v-a0e80f48]{margin-block-start:0}.input-field--leading-icon[data-v-a0e80f48]{--input-padding-start: calc(var(--default-clickable-area) - var(--default-grid-baseline))}.input-field--trailing-icon[data-v-a0e80f48]{--input-padding-end: calc(var(--default-clickable-area) - var(--default-grid-baseline))}.input-field--pill[data-v-a0e80f48]{--input-border-radius: var(--border-radius-pill)}.input-field__main-wrapper[data-v-a0e80f48]{height:var(--default-clickable-area);padding:var(--border-width-input-focused, 2px);position:relative}.input-field__input[data-v-a0e80f48]{--input-border-box-shadow-light: 0 -1px var(--input-border-color), 0 0 0 1px color-mix(in srgb, var(--input-border-color), 65% transparent);--input-border-box-shadow-dark: 0 1px var(--input-border-color), 0 0 0 1px color-mix(in srgb, var(--input-border-color), 65% transparent);--input-border-box-shadow: var(--input-border-box-shadow-light);border:none;border-radius:var(--border-radius-element);box-shadow:var(--input-border-box-shadow)}.input-field__input[data-v-a0e80f48]:hover:not([disabled]){box-shadow:0 0 0 1px var(--input-border-color)}@media (prefers-color-scheme: dark){.input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-dark)}}[data-theme-dark] .input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-dark)}[data-theme-light] .input-field__input[data-v-a0e80f48]{--input-border-box-shadow: var(--input-border-box-shadow-light)}.input-field--legacy .input-field__input[data-v-a0e80f48]{box-shadow:0 0 0 1px var(--input-border-color)}.input-field--legacy .input-field__input[data-v-a0e80f48]:hover:not([disabled]){box-shadow:0 0 0 2px var(--input-border-color)}.input-field__input[data-v-a0e80f48]:focus-within:not([disabled]),.input-field__input[data-v-a0e80f48]:active:not([disabled]){box-shadow:0 0 0 2px var(--input-border-color),0 0 0 4px var(--color-main-background)!important}.input-field__input[data-v-a0e80f48]{background-color:var(--color-main-background);color:var(--color-main-text);border-radius:var(--input-border-radius);cursor:pointer;-webkit-appearance:textfield!important;-moz-appearance:textfield!important;appearance:textfield!important;font-size:var(--default-font-size);text-overflow:ellipsis;padding-block:0;padding-inline:var(--input-padding-start) var(--input-padding-end);height:100%!important;min-height:unset;width:100%}.input-field__input[data-v-a0e80f48]::placeholder{color:var(--color-text-maxcontrast)}.input-field__input[data-v-a0e80f48]::-webkit-search-cancel-button{display:none}.input-field__input[data-v-a0e80f48]::-webkit-search-decoration,.input-field__input[data-v-a0e80f48]::-webkit-search-results-button,.input-field__input[data-v-a0e80f48]::-webkit-search-results-decoration,.input-field__input[data-v-a0e80f48]::-ms-clear{display:none}.input-field__input[data-v-a0e80f48]:active:not([disabled]),.input-field__input[data-v-a0e80f48]:focus:not([disabled]){--input-border-color: var(--color-main-text)}.input-field__input:focus+.input-field__label[data-v-a0e80f48],.input-field__input:hover:not(:placeholder-shown)+.input-field__label[data-v-a0e80f48]{color:var(--color-main-text)}.input-field__input[data-v-a0e80f48]:focus{cursor:text}.input-field__input[data-v-a0e80f48]:disabled{cursor:default}.input-field__input[data-v-a0e80f48]:focus-visible{box-shadow:unset!important}.input-field:not(.input-field--label-outside) .input-field__input[data-v-a0e80f48]:not(:focus)::placeholder{opacity:0}.input-field__label[data-v-a0e80f48]{--input-label-font-size: var(--default-font-size);font-size:var(--input-label-font-size);position:absolute;margin-inline:var(--input-padding-start) var(--input-padding-end);max-width:fit-content;inset-block-start:calc((var(--default-clickable-area) - 1lh) / 2);inset-inline:var(--border-width-input-focused, 2px);color:var(--color-text-maxcontrast);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;transition:height var(--animation-quick),inset-block-start var(--animation-quick),font-size var(--animation-quick),color var(--animation-quick),background-color var(--animation-quick) var(--animation-slow)}.input-field__input:focus+.input-field__label[data-v-a0e80f48],.input-field__input:not(:placeholder-shown)+.input-field__label[data-v-a0e80f48]{--input-label-font-size: 13px;line-height:1.5;inset-block-start:calc(-1.5 * var(--input-label-font-size) / 2);font-weight:500;border-radius:var(--default-grid-baseline) var(--default-grid-baseline) 0 0;background-color:var(--color-main-background);padding-inline:var(--default-grid-baseline);margin-inline:calc(var(--input-padding-start) - var(--default-grid-baseline)) calc(var(--input-padding-end) - var(--default-grid-baseline));transition:height var(--animation-quick),inset-block-start var(--animation-quick),font-size var(--animation-quick),color var(--animation-quick)}.input-field__icon[data-v-a0e80f48]{position:absolute;height:var(--default-clickable-area);width:var(--default-clickable-area);display:flex;align-items:center;justify-content:center;opacity:.7;inset-block-end:0}.input-field__icon--leading[data-v-a0e80f48]{inset-inline-start:0px}.input-field__icon--trailing[data-v-a0e80f48]{inset-inline-end:0px}.input-field__trailing-button[data-v-a0e80f48]{--button-size: calc(var(--default-clickable-area) - 2 * var(--border-width-input-focused, 2px)) !important;--button-radius: calc(var(--input-border-radius) - var(--border-width-input-focused, 2px))}.input-field__trailing-button.button-vue[data-v-a0e80f48]{position:absolute;top:var(--border-width-input-focused, 2px);inset-inline-end:var(--border-width-input-focused, 2px)}.input-field__trailing-button.button-vue[data-v-a0e80f48]:focus-visible{box-shadow:none!important}.input-field__helper-text-message[data-v-a0e80f48]{padding-block:4px;padding-inline:var(--border-radius-element);display:flex;align-items:center;color:var(--color-text-maxcontrast)}.input-field__helper-text-message__icon[data-v-a0e80f48]{margin-inline-end:8px}.input-field--error .input-field__helper-text-message[data-v-a0e80f48],.input-field--error .input-field__icon--trailing[data-v-a0e80f48]{color:var(--color-text-error, var(--color-error))}.input-field--error .input-field__input[data-v-a0e80f48],.input-field__input[data-v-a0e80f48]:user-invalid{--input-border-color: var(--color-border-error, var(--color-error)) !important}.input-field--error .input-field__input[data-v-a0e80f48]:focus-visible,.input-field__input[data-v-a0e80f48]:user-invalid:focus-visible{box-shadow:#f8fafc 0 0 0 2px,var(--color-primary-element) 0 0 0 4px,#0000000d 0 1px 2px}.input-field--success .input-field__input[data-v-a0e80f48]{--input-border-color: var(--color-border-success, var(--color-success)) !important}.input-field--success .input-field__input[data-v-a0e80f48]:focus-visible{box-shadow:#f8fafc 0 0 0 2px,var(--color-primary-element) 0 0 0 4px,#0000000d 0 1px 2px}.input-field--success .input-field__helper-text-message__icon[data-v-a0e80f48]{color:var(--color-border-success, var(--color-success))}.external[data-v-9803ab31]:after{content:" ↗"}.material-design-icon[data-v-ad356e41]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.user-bubble__wrapper[data-v-ad356e41]{display:inline-block;vertical-align:middle;min-width:0;max-width:100%}.user-bubble__content[data-v-ad356e41]{display:inline-flex;max-width:100%;background-color:var(--color-background-dark)}.user-bubble__content--primary[data-v-ad356e41]{color:var(--color-primary-element-text);background-color:var(--color-primary-element)}.user-bubble__content[data-v-ad356e41]>:last-child{padding-inline-end:8px}.user-bubble__avatar[data-v-ad356e41]{align-self:center}.user-bubble__name[data-v-ad356e41]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.user-bubble__name[data-v-ad356e41],.user-bubble__secondary[data-v-ad356e41]{padding-block:0;padding-inline:4px 0}.material-design-icon[data-v-d7dc2a1f]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.avatardiv[data-v-d7dc2a1f]{position:relative;display:inline-block;width:var(--avatar-size);height:var(--avatar-size)}.avatardiv--unknown[data-v-d7dc2a1f]{position:relative;background-color:var(--color-main-background);white-space:normal}.avatardiv[data-v-d7dc2a1f]:not(.avatardiv--unknown){background-color:var(--color-main-background)!important;box-shadow:0 0 5px #0000000d inset}.avatardiv--with-menu[data-v-d7dc2a1f]{cursor:pointer}.avatardiv--with-menu .action-item[data-v-d7dc2a1f]{position:absolute;top:0;inset-inline-start:0}.avatardiv--with-menu[data-v-d7dc2a1f] .action-item__menutoggle{cursor:pointer;opacity:0}.avatardiv--with-menu[data-v-d7dc2a1f]:focus-within .action-item__menutoggle,.avatardiv--with-menu[data-v-d7dc2a1f]:hover .action-item__menutoggle,.avatardiv--with-menu.avatardiv--with-menu-loading[data-v-d7dc2a1f] .action-item__menutoggle{opacity:1}.avatardiv--with-menu:focus-within img[data-v-d7dc2a1f],.avatardiv--with-menu:hover img[data-v-d7dc2a1f],.avatardiv--with-menu.avatardiv--with-menu-loading img[data-v-d7dc2a1f]{opacity:.3}.avatardiv--with-menu[data-v-d7dc2a1f] .action-item__menutoggle,.avatardiv--with-menu img[data-v-d7dc2a1f]{transition:opacity var(--animation-quick)}.avatardiv--with-menu[data-v-d7dc2a1f] .button-vue,.avatardiv--with-menu[data-v-d7dc2a1f] .button-vue__icon{height:var(--avatar-size);min-height:var(--avatar-size);width:var(--avatar-size)!important;min-width:var(--avatar-size)}.avatardiv--with-menu[data-v-d7dc2a1f]>.button-vue,.avatardiv--with-menu[data-v-d7dc2a1f]>.action-item .button-vue{--button-radius: calc(var(--avatar-size) / 2)}.avatardiv .avatardiv__initials-wrapper[data-v-d7dc2a1f]{display:block;height:var(--avatar-size);width:var(--avatar-size);background-color:var(--color-main-background);border-radius:calc(var(--avatar-size) / 2)}.avatardiv .avatardiv__initials-wrapper .avatardiv__initials[data-v-d7dc2a1f]{position:absolute;top:0;inset-inline-start:0;display:block;width:100%;text-align:center;font-weight:400}.avatardiv img[data-v-d7dc2a1f]{width:100%;height:100%;object-fit:cover}.avatardiv .material-design-icon[data-v-d7dc2a1f]{width:var(--avatar-size);height:var(--avatar-size)}.avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{--avatar-status-size-orbital: calc(var(--avatar-size) * (1 - 1 / sqrt(2)));--avatar-status-size-min: var(--font-size-small);--avatar-status-size: max(var(--avatar-status-size-orbital), var(--avatar-status-size-min));box-sizing:border-box;position:absolute;inset-inline-end:0;inset-block-end:0;height:var(--avatar-status-size);width:var(--avatar-status-size);line-height:1;font-size:calc(var(--avatar-status-size) / 1.2);background-color:var(--color-main-background);background-repeat:no-repeat;background-size:var(--avatar-status-size);background-position:center;border-radius:50%;display:flex;align-items:center;justify-content:center}.acli:hover .avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{border-color:var(--color-background-hover);background-color:var(--color-background-hover)}.acli.active .avatardiv .avatardiv__user-status[data-v-d7dc2a1f]{border-color:var(--color-primary-element-light);background-color:var(--color-primary-element-light)}.avatardiv .avatardiv__user-status--icon[data-v-d7dc2a1f]{border:none;background-color:transparent}.avatardiv .popovermenu-wrapper[data-v-d7dc2a1f]{position:relative;display:inline-block}.avatar-class-icon[data-v-d7dc2a1f]{display:block;border-radius:calc(var(--avatar-size) / 2);background-color:var(--color-background-darker);height:100%}.material-design-icon[data-v-45238efd]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.mention-bubble--primary .mention-bubble__content[data-v-45238efd]{color:var(--color-primary-element-text);background-color:var(--color-primary-element)}.mention-bubble__wrapper[data-v-45238efd]{position:relative;max-width:150px;height:18px;vertical-align:text-bottom;display:inline-flex;align-items:center}.mention-bubble__content[data-v-45238efd]{display:inline-flex;overflow:hidden;align-items:center;max-width:100%;height:20px;-webkit-user-select:none;user-select:none;padding-inline:2px 6px;border-radius:10px;background-color:var(--color-background-dark)}.mention-bubble__icon[data-v-45238efd]{position:relative;width:16px;height:16px;border-radius:8px;background-color:var(--color-background-darker);background-repeat:no-repeat;background-position:center;background-size:12px}.mention-bubble__icon--with-avatar[data-v-45238efd]{color:inherit;background-size:cover}.mention-bubble__title[data-v-45238efd]{overflow:hidden;margin-inline-start:2px;white-space:nowrap;text-overflow:ellipsis}.mention-bubble__title[data-v-45238efd]:before{content:attr(title)}.mention-bubble__select[data-v-45238efd]{position:absolute;z-index:-1;inset-inline-start:-100vw;width:1px;height:1px;overflow:hidden}.material-design-icon[data-v-881a79fb]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}.user-status-icon[data-v-881a79fb]{--user-status-color-online: #2D7B41;--user-status-color-busy: #DB0606;--user-status-color-away: #C88800;--user-status-color-offline: #6B6B6B;display:flex;justify-content:center;align-items:center}.user-status-icon--invisible[data-v-881a79fb]{filter:var(--background-invert-if-dark)}.user-status-icon[data-v-881a79fb] svg{width:100%;height:100%}.material-design-icon[data-v-6c2daf4e]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-6c2daf4e]:hover,li.action.active[data-v-6c2daf4e]{border-radius:6px;padding:0}li.action[data-v-6c2daf4e]:hover{background-color:var(--color-background-hover)}.action--disabled[data-v-6c2daf4e]{pointer-events:none;opacity:.5}.action--disabled[data-v-6c2daf4e]:hover,.action--disabled[data-v-6c2daf4e]:focus{cursor:default;opacity:.5}.action--disabled[data-v-6c2daf4e] *{opacity:1!important}.action-button[data-v-6c2daf4e]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-button>span[data-v-6c2daf4e]{cursor:pointer;white-space:nowrap}.action-button__icon[data-v-6c2daf4e]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-button[data-v-6c2daf4e] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-button[data-v-6c2daf4e] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-button__longtext-wrapper[data-v-6c2daf4e],.action-button__longtext[data-v-6c2daf4e]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-button__longtext[data-v-6c2daf4e]{cursor:pointer;white-space:pre-wrap!important}.action-button__name[data-v-6c2daf4e]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-button__description[data-v-6c2daf4e]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-button__menu-icon[data-v-6c2daf4e],.action-button__pressed-icon[data-v-6c2daf4e]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action-button[data-v-6c2daf4e] *{cursor:pointer}.material-design-icon[data-v-32f01b7a]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-32f01b7a]:hover,li.action.active[data-v-32f01b7a]{border-radius:6px;padding:0}li.action[data-v-32f01b7a]:hover{background-color:var(--color-background-hover)}.action-link[data-v-32f01b7a]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-link>span[data-v-32f01b7a]{cursor:pointer;white-space:nowrap}.action-link__icon[data-v-32f01b7a]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-link[data-v-32f01b7a] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-link[data-v-32f01b7a] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-link__longtext-wrapper[data-v-32f01b7a],.action-link__longtext[data-v-32f01b7a]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-link__longtext[data-v-32f01b7a]{cursor:pointer;white-space:pre-wrap!important}.action-link__name[data-v-32f01b7a]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-link__description[data-v-32f01b7a]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-link__menu-icon[data-v-32f01b7a]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.material-design-icon[data-v-87267750]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-87267750]:hover,li.action.active[data-v-87267750]{border-radius:6px;padding:0}li.action[data-v-87267750]:hover{background-color:var(--color-background-hover)}.action-router[data-v-87267750]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-router>span[data-v-87267750]{cursor:pointer;white-space:nowrap}.action-router__icon[data-v-87267750]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-router[data-v-87267750] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-router[data-v-87267750] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-router__longtext-wrapper[data-v-87267750],.action-router__longtext[data-v-87267750]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-router__longtext[data-v-87267750]{cursor:pointer;white-space:pre-wrap!important}.action-router__name[data-v-87267750]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-router__description[data-v-87267750]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-router__menu-icon[data-v-87267750]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action--disabled[data-v-87267750]{pointer-events:none;opacity:.5}.action--disabled[data-v-87267750]:hover,.action--disabled[data-v-87267750]:focus{cursor:default;opacity:.5}.action--disabled[data-v-87267750] *{opacity:1!important}.material-design-icon[data-v-fa684b48]{display:flex;align-self:center;justify-self:center;align-items:center;justify-content:center}li.action[data-v-fa684b48]:hover,li.action.active[data-v-fa684b48]{border-radius:6px;padding:0}li.action[data-v-fa684b48]:hover{background-color:var(--color-background-hover)}.action-text[data-v-fa684b48]{display:flex;align-items:flex-start;width:100%;height:auto;margin:0;padding:0;padding-inline-end:calc((var(--default-clickable-area) - 16px) / 2);box-sizing:border-box;cursor:pointer;white-space:nowrap;color:var(--color-main-text);border:0;border-radius:0;background-color:transparent;box-shadow:none;font-weight:400;font-size:var(--default-font-size);line-height:var(--default-clickable-area)}.action-text>span[data-v-fa684b48]{cursor:pointer;white-space:nowrap}.action-text__icon[data-v-fa684b48]{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1;background-position:calc((var(--default-clickable-area) - 16px) / 2) center;background-size:16px;background-repeat:no-repeat}.action-text[data-v-fa684b48] .material-design-icon{width:var(--default-clickable-area);height:var(--default-clickable-area);opacity:1}.action-text[data-v-fa684b48] .material-design-icon .material-design-icon__svg{vertical-align:middle}.action-text__longtext-wrapper[data-v-fa684b48],.action-text__longtext[data-v-fa684b48]{max-width:220px;line-height:1.6em;padding:calc((var(--default-clickable-area) - 1.6em) / 2) 0;cursor:pointer;text-align:start;overflow:hidden;text-overflow:ellipsis}.action-text__longtext[data-v-fa684b48]{cursor:pointer;white-space:pre-wrap!important}.action-text__name[data-v-fa684b48]{font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:block}.action-text__description[data-v-fa684b48]{display:block;white-space:pre-wrap;font-size:var(--font-size-small);line-height:var(--default-line-height);color:var(--color-text-maxcontrast);cursor:pointer}.action-text__menu-icon[data-v-fa684b48]{margin-inline:auto calc((var(--default-clickable-area) - 16px) / 2 * -1)}.action--disabled[data-v-fa684b48]{pointer-events:none;opacity:.5}.action--disabled[data-v-fa684b48]:hover,.action--disabled[data-v-fa684b48]:focus{cursor:default;opacity:.5}.action--disabled[data-v-fa684b48] *{opacity:1!important}.action-text[data-v-fa684b48],.action-text span[data-v-fa684b48]{cursor:default}.mention[data-v-fd1bec4b]{display:contents;white-space:nowrap}.notification[data-v-a0c97239] img.notification-icon{display:flex;width:32px;height:32px;filter:var(--background-invert-if-dark)}.notification[data-v-a0c97239] .rich-text--wrapper{white-space:pre-wrap;overflow-wrap:break-word}.notification .notification-subject[data-v-a0c97239]{padding:4px}.notification a.notification-subject[data-v-a0c97239]:focus-visible{box-shadow:inset 0 0 0 2px var(--color-main-text)!important}.notification-container[data-v-bd685ff9]{overflow:hidden}.notification-container[data-v-bd685ff9],.notification-container[data-v-bd685ff9] *,.notification-container[data-v-bd685ff9] *:before,.notification-container[data-v-bd685ff9] *:after{box-sizing:border-box}.notification-container .notification-wrapper[data-v-bd685ff9]{display:flex;flex-direction:column;max-height:calc(100vh - 250px);overflow:auto}.notification-container .dismiss-all[data-v-bd685ff9]{padding:calc(2 * var(--default-grid-baseline));border-top:1px solid var(--color-border)}.icon-alert-outline[data-v-bd685ff9]{background-size:64px;width:64px;height:64px}.fade-enter-active[data-v-bd685ff9],.fade-leave-active[data-v-bd685ff9]{transition:opacity var(--animation-quick) ease}.fade-enter-from[data-v-bd685ff9],.fade-leave-to[data-v-bd685ff9]{opacity:0}.list-move[data-v-bd685ff9],.list-enter-active[data-v-bd685ff9],.list-leave-active[data-v-bd685ff9]{transition:all var(--animation-quick) ease}.list-enter-from[data-v-bd685ff9],.list-leave-to[data-v-bd685ff9]{opacity:0;transform:translate(30px)}.list-leave-active[data-v-bd685ff9]{width:100%} diff --git a/css/admin-settings-65wjlg4S.chunk.css b/css/admin-settings-65wjlg4S.chunk.css new file mode 100644 index 000000000..55ea92a30 --- /dev/null +++ b/css/admin-settings-65wjlg4S.chunk.css @@ -0,0 +1 @@ +.notification-frequency__wrapper[data-v-bd271168]{display:flex;flex-direction:column;gap:var(--default-grid-baseline)}.notification-frequency__wrapper .notification-frequency__select[data-v-bd271168]{margin-inline-start:calc(2 * var(--default-grid-baseline));width:fit-content} diff --git a/css/admin-settings-BlQ1Yve2.chunk.css b/css/admin-settings-BlQ1Yve2.chunk.css deleted file mode 100644 index e21b3c644..000000000 --- a/css/admin-settings-BlQ1Yve2.chunk.css +++ /dev/null @@ -1 +0,0 @@ -.notification-frequency__wrapper[data-v-d470d351]{display:flex;flex-direction:column;gap:var(--default-grid-baseline)}.notification-frequency__wrapper .notification-frequency__select[data-v-d470d351]{margin-inline-start:calc(2 * var(--default-grid-baseline));width:fit-content} diff --git a/css/notifications-admin-settings.css b/css/notifications-admin-settings.css index 335d2734e..3ee3fdd08 100644 --- a/css/notifications-admin-settings.css +++ b/css/notifications-admin-settings.css @@ -1,5 +1,5 @@ /* extracted by css-entry-points-plugin */ -@import './admin-settings-BlQ1Yve2.chunk.css'; +@import './admin-settings-65wjlg4S.chunk.css'; @import './style-OAP_8hhg.chunk.css'; @import './_plugin-vue_export-helper-B3f4nTyL.chunk.css'; @import './NcSettingsSection-BcLE6UnZ-D7mIRwIy.chunk.css'; \ No newline at end of file diff --git a/css/notifications-settings.css b/css/notifications-settings.css index bb8c822fe..54c507524 100644 --- a/css/notifications-settings.css +++ b/css/notifications-settings.css @@ -1,5 +1,5 @@ /* extracted by css-entry-points-plugin */ -@import './settings-CC01JR-3.chunk.css'; +@import './settings-CYLqN0O_.chunk.css'; @import './style-OAP_8hhg.chunk.css'; @import './_plugin-vue_export-helper-B3f4nTyL.chunk.css'; @import './NcSettingsSection-BcLE6UnZ-D7mIRwIy.chunk.css'; \ No newline at end of file diff --git a/css/settings-CC01JR-3.chunk.css b/css/settings-CC01JR-3.chunk.css deleted file mode 100644 index 6220b9c5b..000000000 --- a/css/settings-CC01JR-3.chunk.css +++ /dev/null @@ -1 +0,0 @@ -.additional-margin-top[data-v-490e4c78]{margin-top:12px}.notification-frequency__wrapper[data-v-490e4c78]{display:flex;flex-direction:column;gap:var(--default-grid-baseline)}.notification-frequency__wrapper .notification-frequency__select[data-v-490e4c78]{margin-inline-start:calc(2 * var(--default-grid-baseline));width:fit-content} diff --git a/css/settings-CYLqN0O_.chunk.css b/css/settings-CYLqN0O_.chunk.css new file mode 100644 index 000000000..1d893b109 --- /dev/null +++ b/css/settings-CYLqN0O_.chunk.css @@ -0,0 +1 @@ +.additional-margin-top[data-v-13fb3c25]{margin-top:12px}.notification-frequency__wrapper[data-v-13fb3c25]{display:flex;flex-direction:column;gap:var(--default-grid-baseline)}.notification-frequency__wrapper .notification-frequency__select[data-v-13fb3c25]{margin-inline-start:calc(2 * var(--default-grid-baseline));width:fit-content} diff --git a/js/NotificationsApp-BTV11WO4.chunk.mjs b/js/NotificationsApp-MIqOvaGm.chunk.mjs similarity index 83% rename from js/NotificationsApp-BTV11WO4.chunk.mjs rename to js/NotificationsApp-MIqOvaGm.chunk.mjs index df1c5e602..0c79b2787 100644 --- a/js/NotificationsApp-BTV11WO4.chunk.mjs +++ b/js/NotificationsApp-MIqOvaGm.chunk.mjs @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/index-D7sxjegV.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-9hympnnl.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-Cs_h5sE5.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-OAP_8hhg.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-B3f4nTyL.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage--zViSDSX.chunk.mjs')])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/index-B6qrHl3T.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-9hympnnl.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-Cs_h5sE5.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-OAP_8hhg.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-B3f4nTyL.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage--zViSDSX.chunk.mjs')])))=>i.map(i=>d[i]); import{h as ki,i as sc,n as ac,j as lc,k as Ao,m as cc,o as uc,p as ni,u as fc,q as dc,v as Qs,w as pc,x as hc,y as mc,z as gc,A as To,B as Jt,C as yc,e as Ge,D as tn,E as ri,F as _c,G as vc,H as bc,I as wc,J as Vt,_ as xt,l as Nt,K as xc,L as kc,M as ea,O as bt,P as Eo,Q as Sc,r as Je,R as Cc,S as Ic,T as Ac,U as Tc,f as de,V as Ec,W as ta,X as Oc,Y as na,Z as Pc,$ as Nc,a0 as Mc,a1 as Rc,a2 as Lc,a3 as Dc,a4 as Fc,a as jc,a5 as Si,a6 as xn,c as tt,g as _t,t as ft,a7 as Uc,a8 as ra,a9 as zc,aa as Bc,ab as Hc,ac as sr,ad as qc,ae as Vc,af as $c,ag as nn,ah as rn,ai as Wc,aj as Gc,ak as Xc,s as ii,al as nr,am as Zc,an as Oo,ao as Kc}from"./_plugin-vue_export-helper-9hympnnl.chunk.mjs";import{l as kt,i as Jc,p as kn,q as ve,k as oe,u as Ne,j as Pt,s as an,v as Yc,x as ia,f as z,o as M,g as ae,m as je,h as Mt,t as ne,y as yn,z as oi,a as ce,w as pe,e as Le,A as si,B as Qc,b as se,C as Po,D as ze,E as Sn,n as Rt,G as No,H as eu,I as vt,r as ge,F as Tn,J as ar,K as ai,L as oa,M as tu,N as li,O as nu,T as ru,P as iu}from"./style-Cs_h5sE5.chunk.mjs";import{_ as ou}from"./vite-preload-helper-DxYC2qmj.chunk.mjs";import{B as Ae}from"./BrowserStorage--zViSDSX.chunk.mjs";function Mo(e){const n=kn(ki),t=kn(sc),r=oe(()=>{const c=Ne(e.to);return n.resolve(c)}),i=oe(()=>{const{matched:c}=r.value,{length:d}=c,m=c[d-1],s=t.matched;if(!m||!s.length)return-1;const l=s.findIndex(Ao.bind(null,m));if(l>-1)return l;const u=Ro(c[d-2]);return d>1&&Ro(m)===u&&s[s.length-1].path!==u?s.findIndex(Ao.bind(null,c[d-2])):l}),o=oe(()=>i.value>-1&&cu(t.params,r.value.params)),a=oe(()=>i.value>-1&&i.value===t.matched.length-1&&lc(t.params,r.value.params));function f(c={}){if(lu(c)){const d=n[Ne(e.replace)?"replace":"push"](Ne(e.to)).catch(ac);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:oe(()=>r.value.href),isActive:o,isExactActive:a,navigate:f}}function su(e){return e.length===1?e[0]:e}const au=kt({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Mo,setup(e,{slots:n}){const t=Jc(Mo(e)),{options:r}=kn(ki),i=oe(()=>({[Lo(e.activeClass,r.linkActiveClass,"router-link-active")]:t.isActive,[Lo(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=n.default&&su(n.default(t));return e.custom?o:ve("a",{"aria-current":t.isExactActive?e.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:i.value},o)}}}),Ci=au;function lu(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const n=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(n))return}return e.preventDefault&&e.preventDefault(),!0}}function cu(e,n){for(const t in n){const r=n[t],i=e[t];if(typeof r=="string"){if(r!==i)return!1}else if(!cc(i)||i.length!==r.length||r.some((o,a)=>o.valueOf()!==i[a].valueOf()))return!1}return!0}function Ro(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Lo=(e,n,t)=>e??n??t;var sa="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",uu="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",fu="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z";const du=Symbol.for("nc:theme:enforced");function pu(e){const n=oe(()=>ia(e)??document.body),t=Pt(ni(n.value)),r=dc();function i(){t.value=ni(n.value)}return fc(n,i,{attributes:!0}),an(n,i),an(r,i,{immediate:!0}),Yc(t)}const hu=uc(()=>pu());function mu(){const e=hu(),n=kn(du,void 0);return oe(()=>n?.value?n.value==="dark":e.value)}var zt={},Do={};const gu=Qs(pc);var Fo;function yu(){return Fo||(Fo=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=gu;function t(){try{return n.loadState("core","capabilities")}catch{return console.debug("Could not find capabilities initial state fall back to _oc_capabilities"),"_oc_capabilities"in window?window._oc_capabilities:{}}}e.getCapabilities=t}(Do)),Do}var jo={},Uo={},zo={},Bo;function aa(){return Bo||(Bo=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=hc(),t=mc(),r=u=>u&&u.__esModule?u:{default:u},i=r(n),o=r(t);class a{bus;constructor(h){typeof h.getVersion!="function"||!o.default(h.getVersion())?console.warn("Proxying an event bus with an unknown or invalid version"):i.default(h.getVersion())!==i.default(this.getVersion())&&console.warn("Proxying an event bus of version "+h.getVersion()+" with "+this.getVersion()),this.bus=h}getVersion(){return"3.3.3"}subscribe(h,y){this.bus.subscribe(h,y)}unsubscribe(h,y){this.bus.unsubscribe(h,y)}emit(h,...y){this.bus.emit(h,...y)}}class f{handlers=new Map;getVersion(){return"3.3.3"}subscribe(h,y){this.handlers.set(h,(this.handlers.get(h)||[]).concat(y))}unsubscribe(h,y){this.handlers.set(h,(this.handlers.get(h)||[]).filter(w=>w!==y))}emit(h,...y){(this.handlers.get(h)||[]).forEach(w=>{try{w(y[0])}catch(_){console.error("could not invoke event listener",_)}})}}let c=null;function d(){return c!==null?c:typeof window>"u"?new Proxy({},{get:()=>()=>console.error("Window not available, EventBus can not be established!")}):(window.OC?._eventBus&&typeof window._nc_event_bus>"u"&&(console.warn("found old event bus instance at OC._eventBus. Update your version!"),window._nc_event_bus=window.OC._eventBus),typeof window?._nc_event_bus<"u"?c=new a(window._nc_event_bus):c=window._nc_event_bus=new f,c)}function m(u,h){d().subscribe(u,h)}function s(u,h){d().unsubscribe(u,h)}function l(u,...h){d().emit(u,...h)}e.ProxyBus=a,e.SimpleBus=f,e.emit=l,e.subscribe=m,e.unsubscribe=s}(zo)),zo}const _u=Qs(gc);var Ho;function vu(){return Ho||(Ho=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=aa(),t=_u;let r;const i=[];function o(){return r===void 0&&(r=document.head.dataset.requesttoken??null),r}function a(k){i.push(k)}n.subscribe("csrf-token-update",k=>{r=k.token,i.forEach(T=>{try{T(r)}catch(R){console.error("Error updating CSRF token observer",R)}})});function f(){const k=document?.querySelector('meta[name="csp-nonce"]');if(!k){const T=o();return T?btoa(T):void 0}return k.nonce}const c=t.getBuilder("public").persist().build();class d{_displayName;uid;isAdmin;constructor(){c.getItem("guestUid")||c.setItem("guestUid",h()),this._displayName=c.getItem("guestNickname")||"",this.uid=c.getItem("guestUid")||h(),this.isAdmin=!1,n.subscribe("user:info:changed",T=>{this._displayName=T.displayName,c.setItem("guestNickname",T.displayName||"")})}get displayName(){return this._displayName}set displayName(T){this._displayName=T,c.setItem("guestNickname",T),n.emit("user:info:changed",this)}}let m;function s(){return m||(m=new d),m}function l(){return s()?.displayName||null}function u(k){if(!k||k.trim().length===0)throw new Error("Nickname cannot be empty");s().displayName=k}function h(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,k=>{const T=Math.random()*16|0;return(k==="x"?T:T&3|8).toString(16)})}let y;function w(k,T){return k?k.getAttribute(T):null}function _(){if(y!==void 0)return y;const k=document?.getElementsByTagName("head")[0];if(!k)return null;const T=w(k,"data-user");return T===null?(y=null,y):(y={uid:T,displayName:w(k,"data-user-displayname"),isAdmin:!!window._oc_isadmin},y)}e.getCSPNonce=f,e.getCurrentUser=_,e.getGuestNickname=l,e.getGuestUser=s,e.getRequestToken=o,e.onRequestTokenUpdate=a,e.setGuestNickname=u}(Uo)),Uo}var Rr,qo;function bu(){if(qo)return Rr;qo=1;function e(p,g){return function(){return p.apply(g,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:t}=Object,{iterator:r,toStringTag:i}=Symbol,o=(p=>g=>{const v=n.call(g);return p[v]||(p[v]=v.slice(8,-1).toLowerCase())})(Object.create(null)),a=p=>(p=p.toLowerCase(),g=>o(g)===p),f=p=>g=>typeof g===p,{isArray:c}=Array,d=f("undefined");function m(p){return p!==null&&!d(p)&&p.constructor!==null&&!d(p.constructor)&&h(p.constructor.isBuffer)&&p.constructor.isBuffer(p)}const s=a("ArrayBuffer");function l(p){let g;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?g=ArrayBuffer.isView(p):g=p&&p.buffer&&s(p.buffer),g}const u=f("string"),h=f("function"),y=f("number"),w=p=>p!==null&&typeof p=="object",_=p=>p===!0||p===!1,k=p=>{if(o(p)!=="object")return!1;const g=t(p);return(g===null||g===Object.prototype||Object.getPrototypeOf(g)===null)&&!(i in p)&&!(r in p)},T=p=>{if(!w(p)||m(p))return!1;try{return Object.keys(p).length===0&&Object.getPrototypeOf(p)===Object.prototype}catch{return!1}},R=a("Date"),$=a("File"),N=a("Blob"),J=a("FileList"),G=p=>w(p)&&h(p.pipe),H=p=>{let g;return p&&(typeof FormData=="function"&&p instanceof FormData||h(p.append)&&((g=o(p))==="formdata"||g==="object"&&h(p.toString)&&p.toString()==="[object FormData]"))},P=a("URLSearchParams"),[X,Z,K,q]=["ReadableStream","Request","Response","Headers"].map(a),Y=p=>p.trim?p.trim():p.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _e(p,g,{allOwnKeys:v=!1}={}){if(p===null||typeof p>"u")return;let b,S;if(typeof p!="object"&&(p=[p]),c(p))for(b=0,S=p.length;b0;)if(S=v[b],g===S.toLowerCase())return S;return null}const Se=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Jt,Xe=p=>!d(p)&&p!==Se;function x(){const{caseless:p,skipUndefined:g}=Xe(this)&&this||{},v={},b=(S,I)=>{const A=p&&be(v,I)||I;k(v[A])&&k(S)?v[A]=x(v[A],S):k(S)?v[A]=x({},S):c(S)?v[A]=S.slice():(!g||!d(S))&&(v[A]=S)};for(let S=0,I=arguments.length;S(_e(g,(S,I)=>{v&&h(S)?p[I]=e(S,v):p[I]=S},{allOwnKeys:b}),p),Ye=p=>(p.charCodeAt(0)===65279&&(p=p.slice(1)),p),C=(p,g,v,b)=>{p.prototype=Object.create(g.prototype,b),p.prototype.constructor=p,Object.defineProperty(p,"super",{value:g.prototype}),v&&Object.assign(p.prototype,v)},qe=(p,g,v,b)=>{let S,I,A;const L={};if(g=g||{},p==null)return g;do{for(S=Object.getOwnPropertyNames(p),I=S.length;I-- >0;)A=S[I],(!b||b(A,p,g))&&!L[A]&&(g[A]=p[A],L[A]=!0);p=v!==!1&&t(p)}while(p&&(!v||v(p,g))&&p!==Object.prototype);return g},pt=(p,g,v)=>{p=String(p),(v===void 0||v>p.length)&&(v=p.length),v-=g.length;const b=p.indexOf(g,v);return b!==-1&&b===v},Ce=p=>{if(!p)return null;if(c(p))return p;let g=p.length;if(!y(g))return null;const v=new Array(g);for(;g-- >0;)v[g]=p[g];return v},Dt=(p=>g=>p&&g instanceof p)(typeof Uint8Array<"u"&&t(Uint8Array)),nt=(p,g)=>{const v=(p&&p[r]).call(p);let b;for(;(b=v.next())&&!b.done;){const S=b.value;g.call(p,S[0],S[1])}},St=(p,g)=>{let v;const b=[];for(;(v=p.exec(g))!==null;)b.push(v);return b},Ct=a("HTMLFormElement"),Wt=p=>p.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(g,v,b){return v.toUpperCase()+b}),Pn=(({hasOwnProperty:p})=>(g,v)=>p.call(g,v))(Object.prototype),gr=a("RegExp"),Nn=(p,g)=>{const v=Object.getOwnPropertyDescriptors(p),b={};_e(v,(S,I)=>{let A;(A=g(S,I,p))!==!1&&(b[I]=A||S)}),Object.defineProperties(p,b)},Mn=p=>{Nn(p,(g,v)=>{if(h(p)&&["arguments","caller","callee"].indexOf(v)!==-1)return!1;const b=p[v];if(h(b)){if(g.enumerable=!1,"writable"in g){g.writable=!1;return}g.set||(g.set=()=>{throw Error("Can not rewrite read-only method '"+v+"'")})}})},Rn=(p,g)=>{const v={},b=S=>{S.forEach(I=>{v[I]=!0})};return c(p)?b(p):b(String(p).split(g)),v},Ln=()=>{},yr=(p,g)=>p!=null&&Number.isFinite(p=+p)?p:g;function Dn(p){return!!(p&&h(p.append)&&p[i]==="FormData"&&p[r])}const Fn=p=>{const g=new Array(10),v=(b,S)=>{if(w(b)){if(g.indexOf(b)>=0)return;if(m(b))return b;if(!("toJSON"in b)){g[S]=b;const I=c(b)?[]:{};return _e(b,(A,L)=>{const V=v(A,S+1);!d(V)&&(I[L]=V)}),g[S]=void 0,I}}return b};return v(p,0)},_r=a("AsyncFunction"),vr=p=>p&&(w(p)||h(p))&&h(p.then)&&h(p.catch),jn=((p,g)=>p?setImmediate:g?((v,b)=>(Se.addEventListener("message",({source:S,data:I})=>{S===Se&&I===v&&b.length&&b.shift()()},!1),S=>{b.push(S),Se.postMessage(v,"*")}))(`axios@${Math.random()}`,[]):v=>setTimeout(v))(typeof setImmediate=="function",h(Se.postMessage)),br=typeof queueMicrotask<"u"?queueMicrotask.bind(Se):typeof To<"u"&&To.nextTick||jn;var O={isArray:c,isArrayBuffer:s,isBuffer:m,isFormData:H,isArrayBufferView:l,isString:u,isNumber:y,isBoolean:_,isObject:w,isPlainObject:k,isEmptyObject:T,isReadableStream:X,isRequest:Z,isResponse:K,isHeaders:q,isUndefined:d,isDate:R,isFile:$,isBlob:N,isRegExp:gr,isFunction:h,isStream:G,isURLSearchParams:P,isTypedArray:Dt,isFileList:J,forEach:_e,merge:x,extend:He,trim:Y,stripBOM:Ye,inherits:C,toFlatObject:qe,kindOf:o,kindOfTest:a,endsWith:pt,toArray:Ce,forEachEntry:nt,matchAll:St,isHTMLForm:Ct,hasOwnProperty:Pn,hasOwnProp:Pn,reduceDescriptors:Nn,freezeMethods:Mn,toObjectSet:Rn,toCamelCase:Wt,noop:Ln,toFiniteNumber:yr,findKey:be,global:Se,isContextDefined:Xe,isSpecCompliantForm:Dn,toJSONObject:Fn,isAsyncFn:_r,isThenable:vr,setImmediate:jn,asap:br,isIterable:p=>p!=null&&h(p[r])};function E(p,g,v,b,S){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=p,this.name="AxiosError",g&&(this.code=g),v&&(this.config=v),b&&(this.request=b),S&&(this.response=S,this.status=S.status?S.status:null)}O.inherits(E,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.status}}});const F=E.prototype,Q={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(p=>{Q[p]={value:p}}),Object.defineProperties(E,Q),Object.defineProperty(F,"isAxiosError",{value:!0}),E.from=(p,g,v,b,S,I)=>{const A=Object.create(F);O.toFlatObject(p,A,function(j){return j!==Error.prototype},j=>j!=="isAxiosError");const L=p&&p.message?p.message:"Error",V=g==null&&p?p.code:g;return E.call(A,L,V,v,b,S),p&&A.cause==null&&Object.defineProperty(A,"cause",{value:p,configurable:!0}),A.name=p&&p.name||"Error",I&&Object.assign(A,I),A};var ue=null;function fe(p){return O.isPlainObject(p)||O.isArray(p)}function Ve(p){return O.endsWith(p,"[]")?p.slice(0,-2):p}function ht(p,g,v){return p?p.concat(g).map(function(b,S){return b=Ve(b),!v&&S?"["+b+"]":b}).join(v?".":""):g}function Qe(p){return O.isArray(p)&&!p.some(fe)}const Ft=O.toFlatObject(O,{},null,function(p){return/^is[A-Z]/.test(p)});function rt(p,g,v){if(!O.isObject(p))throw new TypeError("target must be an object");g=g||new FormData,v=O.toFlatObject(v,{metaTokens:!0,dots:!1,indexes:!1},!1,function(ie,U){return!O.isUndefined(U[ie])});const b=v.metaTokens,S=v.visitor||j,I=v.dots,A=v.indexes,L=(v.Blob||typeof Blob<"u"&&Blob)&&O.isSpecCompliantForm(g);if(!O.isFunction(S))throw new TypeError("visitor must be a function");function V(ie){if(ie===null)return"";if(O.isDate(ie))return ie.toISOString();if(O.isBoolean(ie))return ie.toString();if(!L&&O.isBlob(ie))throw new E("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(ie)||O.isTypedArray(ie)?L&&typeof Blob=="function"?new Blob([ie]):yc.from(ie):ie}function j(ie,U,W){let xe=ie;if(ie&&!W&&typeof ie=="object"){if(O.endsWith(U,"{}"))U=b?U:U.slice(0,-2),ie=JSON.stringify(ie);else if(O.isArray(ie)&&Qe(ie)||(O.isFileList(ie)||O.endsWith(U,"[]"))&&(xe=O.toArray(ie)))return U=Ve(U),xe.forEach(function(Oe,Ie){!(O.isUndefined(Oe)||Oe===null)&&g.append(A===!0?ht([U],Ie,I):A===null?U:U+"[]",V(Oe))}),!1}return fe(ie)?!0:(g.append(ht(W,U,I),V(ie)),!1)}const B=[],te=Object.assign(Ft,{defaultVisitor:j,convertValue:V,isVisitable:fe});function he(ie,U){if(!O.isUndefined(ie)){if(B.indexOf(ie)!==-1)throw Error("Circular reference detected in "+U.join("."));B.push(ie),O.forEach(ie,function(W,xe){(!(O.isUndefined(W)||W===null)&&S.call(g,W,O.isString(xe)?xe.trim():xe,U,te))===!0&&he(W,U?U.concat(xe):[xe])}),B.pop()}}if(!O.isObject(p))throw new TypeError("data must be an object");return he(p),g}function Te(p){const g={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(p).replace(/[!'()~]|%20|%00/g,function(v){return g[v]})}function it(p,g){this._pairs=[],p&&rt(p,this,g)}const Ze=it.prototype;Ze.append=function(p,g){this._pairs.push([p,g])},Ze.toString=function(p){const g=p?function(v){return p.call(this,v,Te)}:Te;return this._pairs.map(function(v){return g(v[0])+"="+g(v[1])},"").join("&")};function _l(p){return encodeURIComponent(p).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Zi(p,g,v){if(!g)return p;const b=v&&v.encode||_l;O.isFunction(v)&&(v={serialize:v});const S=v&&v.serialize;let I;if(S?I=S(g,v):I=O.isURLSearchParams(g)?g.toString():new it(g,v).toString(b),I){const A=p.indexOf("#");A!==-1&&(p=p.slice(0,A)),p+=(p.indexOf("?")===-1?"?":"&")+I}return p}class vl{constructor(){this.handlers=[]}use(g,v,b){return this.handlers.push({fulfilled:g,rejected:v,synchronous:b?b.synchronous:!1,runWhen:b?b.runWhen:null}),this.handlers.length-1}eject(g){this.handlers[g]&&(this.handlers[g]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(g){O.forEach(this.handlers,function(v){v!==null&&g(v)})}}var Ki=vl,Ji={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bl=typeof URLSearchParams<"u"?URLSearchParams:it,wl=typeof FormData<"u"?FormData:null,xl=typeof Blob<"u"?Blob:null,kl={isBrowser:!0,classes:{URLSearchParams:bl,FormData:wl,Blob:xl},protocols:["http","https","file","blob","url","data"]};const wr=typeof window<"u"&&typeof document<"u",xr=typeof navigator=="object"&&navigator||void 0,Sl=wr&&(!xr||["ReactNative","NativeScript","NS"].indexOf(xr.product)<0),Cl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Il=wr&&window.location.href||"http://localhost";var Al=Object.freeze({__proto__:null,hasBrowserEnv:wr,hasStandardBrowserWebWorkerEnv:Cl,hasStandardBrowserEnv:Sl,navigator:xr,origin:Il}),Ee={...Al,...kl};function Tl(p,g){return rt(p,new Ee.classes.URLSearchParams,{visitor:function(v,b,S,I){return Ee.isNode&&O.isBuffer(v)?(this.append(b,v.toString("base64")),!1):I.defaultVisitor.apply(this,arguments)},...g})}function El(p){return O.matchAll(/\w+|\[(\w*)]/g,p).map(g=>g[0]==="[]"?"":g[1]||g[0])}function Ol(p){const g={},v=Object.keys(p);let b;const S=v.length;let I;for(b=0;b=v.length;return A=!A&&O.isArray(S)?S.length:A,V?(O.hasOwnProp(S,A)?S[A]=[S[A],b]:S[A]=b,!L):((!S[A]||!O.isObject(S[A]))&&(S[A]=[]),g(v,b,S[A],I)&&O.isArray(S[A])&&(S[A]=Ol(S[A])),!L)}if(O.isFormData(p)&&O.isFunction(p.entries)){const v={};return O.forEachEntry(p,(b,S)=>{g(El(b),S,v,0)}),v}return null}function Pl(p,g,v){if(O.isString(p))try{return(g||JSON.parse)(p),O.trim(p)}catch(b){if(b.name!=="SyntaxError")throw b}return(v||JSON.stringify)(p)}const kr={transitional:Ji,adapter:["xhr","http","fetch"],transformRequest:[function(p,g){const v=g.getContentType()||"",b=v.indexOf("application/json")>-1,S=O.isObject(p);if(S&&O.isHTMLForm(p)&&(p=new FormData(p)),O.isFormData(p))return b?JSON.stringify(Yi(p)):p;if(O.isArrayBuffer(p)||O.isBuffer(p)||O.isStream(p)||O.isFile(p)||O.isBlob(p)||O.isReadableStream(p))return p;if(O.isArrayBufferView(p))return p.buffer;if(O.isURLSearchParams(p))return g.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let I;if(S){if(v.indexOf("application/x-www-form-urlencoded")>-1)return Tl(p,this.formSerializer).toString();if((I=O.isFileList(p))||v.indexOf("multipart/form-data")>-1){const A=this.env&&this.env.FormData;return rt(I?{"files[]":p}:p,A&&new A,this.formSerializer)}}return S||b?(g.setContentType("application/json",!1),Pl(p)):p}],transformResponse:[function(p){const g=this.transitional||kr.transitional,v=g&&g.forcedJSONParsing,b=this.responseType==="json";if(O.isResponse(p)||O.isReadableStream(p))return p;if(p&&O.isString(p)&&(v&&!this.responseType||b)){const S=!(g&&g.silentJSONParsing)&&b;try{return JSON.parse(p,this.parseReviver)}catch(I){if(S)throw I.name==="SyntaxError"?E.from(I,E.ERR_BAD_RESPONSE,this,null,this.response):I}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ee.classes.FormData,Blob:Ee.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch"],p=>{kr.headers[p]={}});var Sr=kr;const Nl=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var Ml=p=>{const g={};let v,b,S;return p&&p.split(` `).forEach(function(I){S=I.indexOf(":"),v=I.substring(0,S).trim().toLowerCase(),b=I.substring(S+1).trim(),!(!v||g[v]&&Nl[v])&&(v==="set-cookie"?g[v]?g[v].push(b):g[v]=[b]:g[v]=g[v]?g[v]+", "+b:b)}),g};const Qi=Symbol("internals");function un(p){return p&&String(p).trim().toLowerCase()}function Un(p){return p===!1||p==null?p:O.isArray(p)?p.map(Un):String(p)}function Rl(p){const g=Object.create(null),v=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let b;for(;b=v.exec(p);)g[b[1]]=b[2];return g}const Ll=p=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(p.trim());function Cr(p,g,v,b,S){if(O.isFunction(b))return b.call(this,g,v);if(S&&(g=v),!!O.isString(g)){if(O.isString(b))return g.indexOf(b)!==-1;if(O.isRegExp(b))return b.test(g)}}function Dl(p){return p.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(g,v,b)=>v.toUpperCase()+b)}function Fl(p,g){const v=O.toCamelCase(" "+g);["get","set","has"].forEach(b=>{Object.defineProperty(p,b+v,{value:function(S,I,A){return this[b].call(this,g,S,I,A)},configurable:!0})})}class zn{constructor(g){g&&this.set(g)}set(g,v,b){const S=this;function I(L,V,j){const B=un(V);if(!B)throw new Error("header name must be a non-empty string");const te=O.findKey(S,B);(!te||S[te]===void 0||j===!0||j===void 0&&S[te]!==!1)&&(S[te||V]=Un(L))}const A=(L,V)=>O.forEach(L,(j,B)=>I(j,B,V));if(O.isPlainObject(g)||g instanceof this.constructor)A(g,v);else if(O.isString(g)&&(g=g.trim())&&!Ll(g))A(Ml(g),v);else if(O.isObject(g)&&O.isIterable(g)){let L={},V,j;for(const B of g){if(!O.isArray(B))throw TypeError("Object iterator must return a key-value pair");L[j=B[0]]=(V=L[j])?O.isArray(V)?[...V,B[1]]:[V,B[1]]:B[1]}A(L,v)}else g!=null&&I(v,g,b);return this}get(g,v){if(g=un(g),g){const b=O.findKey(this,g);if(b){const S=this[b];if(!v)return S;if(v===!0)return Rl(S);if(O.isFunction(v))return v.call(this,S,b);if(O.isRegExp(v))return v.exec(S);throw new TypeError("parser must be boolean|regexp|function")}}}has(g,v){if(g=un(g),g){const b=O.findKey(this,g);return!!(b&&this[b]!==void 0&&(!v||Cr(this,this[b],b,v)))}return!1}delete(g,v){const b=this;let S=!1;function I(A){if(A=un(A),A){const L=O.findKey(b,A);L&&(!v||Cr(b,b[L],L,v))&&(delete b[L],S=!0)}}return O.isArray(g)?g.forEach(I):I(g),S}clear(g){const v=Object.keys(this);let b=v.length,S=!1;for(;b--;){const I=v[b];(!g||Cr(this,this[I],I,g,!0))&&(delete this[I],S=!0)}return S}normalize(g){const v=this,b={};return O.forEach(this,(S,I)=>{const A=O.findKey(b,I);if(A){v[A]=Un(S),delete v[I];return}const L=g?Dl(I):String(I).trim();L!==I&&delete v[I],v[L]=Un(S),b[L]=!0}),this}concat(...g){return this.constructor.concat(this,...g)}toJSON(g){const v=Object.create(null);return O.forEach(this,(b,S)=>{b!=null&&b!==!1&&(v[S]=g&&O.isArray(b)?b.join(", "):b)}),v}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([g,v])=>g+": "+v).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(g){return g instanceof this?g:new this(g)}static concat(g,...v){const b=new this(g);return v.forEach(S=>b.set(S)),b}static accessor(g){const v=(this[Qi]=this[Qi]={accessors:{}}).accessors,b=this.prototype;function S(I){const A=un(I);v[A]||(Fl(b,I),v[A]=!0)}return O.isArray(g)?g.forEach(S):S(g),this}}zn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),O.reduceDescriptors(zn.prototype,({value:p},g)=>{let v=g[0].toUpperCase()+g.slice(1);return{get:()=>p,set(b){this[v]=b}}}),O.freezeMethods(zn);var et=zn;function Ir(p,g){const v=this||Sr,b=g||v,S=et.from(b.headers);let I=b.data;return O.forEach(p,function(A){I=A.call(v,I,S.normalize(),g?g.status:void 0)}),S.normalize(),I}function eo(p){return!!(p&&p.__CANCEL__)}function Gt(p,g,v){E.call(this,p??"canceled",E.ERR_CANCELED,g,v),this.name="CanceledError"}O.inherits(Gt,E,{__CANCEL__:!0});function to(p,g,v){const b=v.config.validateStatus;!v.status||!b||b(v.status)?p(v):g(new E("Request failed with status code "+v.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(v.status/100)-4],v.config,v.request,v))}function jl(p){const g=/^([-+\w]{1,25})(:?\/\/|:)/.exec(p);return g&&g[1]||""}function Ul(p,g){p=p||10;const v=new Array(p),b=new Array(p);let S=0,I=0,A;return g=g!==void 0?g:1e3,function(L){const V=Date.now(),j=b[I];A||(A=V),v[S]=L,b[S]=V;let B=I,te=0;for(;B!==S;)te+=v[B++],B=B%p;if(S=(S+1)%p,S===I&&(I=(I+1)%p),V-A{v=V,S=null,I&&(clearTimeout(I),I=null),p(...L)};return[(...L)=>{const V=Date.now(),j=V-v;j>=b?A(L,V):(S=L,I||(I=setTimeout(()=>{I=null,A(S)},b-j)))},()=>S&&A(S)]}const Bn=(p,g,v=3)=>{let b=0;const S=Ul(50,250);return zl(I=>{const A=I.loaded,L=I.lengthComputable?I.total:void 0,V=A-b,j=S(V),B=A<=L;b=A;const te={loaded:A,total:L,progress:L?A/L:void 0,bytes:V,rate:j||void 0,estimated:j&&L&&B?(L-A)/j:void 0,event:I,lengthComputable:L!=null,[g?"download":"upload"]:!0};p(te)},v)},no=(p,g)=>{const v=p!=null;return[b=>g[0]({lengthComputable:v,total:p,loaded:b}),g[1]]},ro=p=>(...g)=>O.asap(()=>p(...g));var Bl=Ee.hasStandardBrowserEnv?((p,g)=>v=>(v=new URL(v,Ee.origin),p.protocol===v.protocol&&p.host===v.host&&(g||p.port===v.port)))(new URL(Ee.origin),Ee.navigator&&/(msie|trident)/i.test(Ee.navigator.userAgent)):()=>!0,Hl=Ee.hasStandardBrowserEnv?{write(p,g,v,b,S,I){const A=[p+"="+encodeURIComponent(g)];O.isNumber(v)&&A.push("expires="+new Date(v).toGMTString()),O.isString(b)&&A.push("path="+b),O.isString(S)&&A.push("domain="+S),I===!0&&A.push("secure"),document.cookie=A.join("; ")},read(p){const g=document.cookie.match(new RegExp("(^|;\\s*)("+p+")=([^;]*)"));return g?decodeURIComponent(g[3]):null},remove(p){this.write(p,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ql(p){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(p)}function Vl(p,g){return g?p.replace(/\/?\/$/,"")+"/"+g.replace(/^\/+/,""):p}function io(p,g,v){let b=!ql(g);return p&&(b||v==!1)?Vl(p,g):g}const oo=p=>p instanceof et?{...p}:p;function jt(p,g){g=g||{};const v={};function b(j,B,te,he){return O.isPlainObject(j)&&O.isPlainObject(B)?O.merge.call({caseless:he},j,B):O.isPlainObject(B)?O.merge({},B):O.isArray(B)?B.slice():B}function S(j,B,te,he){if(O.isUndefined(B)){if(!O.isUndefined(j))return b(void 0,j,te,he)}else return b(j,B,te,he)}function I(j,B){if(!O.isUndefined(B))return b(void 0,B)}function A(j,B){if(O.isUndefined(B)){if(!O.isUndefined(j))return b(void 0,j)}else return b(void 0,B)}function L(j,B,te){if(te in g)return b(j,B);if(te in p)return b(void 0,j)}const V={url:I,method:I,data:I,baseURL:A,transformRequest:A,transformResponse:A,paramsSerializer:A,timeout:A,timeoutMessage:A,withCredentials:A,withXSRFToken:A,adapter:A,responseType:A,xsrfCookieName:A,xsrfHeaderName:A,onUploadProgress:A,onDownloadProgress:A,decompress:A,maxContentLength:A,maxBodyLength:A,beforeRedirect:A,transport:A,httpAgent:A,httpsAgent:A,cancelToken:A,socketPath:A,responseEncoding:A,validateStatus:L,headers:(j,B,te)=>S(oo(j),oo(B),te,!0)};return O.forEach(Object.keys({...p,...g}),function(j){const B=V[j]||S,te=B(p[j],g[j],j);O.isUndefined(te)&&B!==L||(v[j]=te)}),v}var so=p=>{const g=jt({},p);let{data:v,withXSRFToken:b,xsrfHeaderName:S,xsrfCookieName:I,headers:A,auth:L}=g;if(g.headers=A=et.from(A),g.url=Zi(io(g.baseURL,g.url,g.allowAbsoluteUrls),p.params,p.paramsSerializer),L&&A.set("Authorization","Basic "+btoa((L.username||"")+":"+(L.password?unescape(encodeURIComponent(L.password)):""))),O.isFormData(v)){if(Ee.hasStandardBrowserEnv||Ee.hasStandardBrowserWebWorkerEnv)A.setContentType(void 0);else if(O.isFunction(v.getHeaders)){const V=v.getHeaders(),j=["content-type","content-length"];Object.entries(V).forEach(([B,te])=>{j.includes(B.toLowerCase())&&A.set(B,te)})}}if(Ee.hasStandardBrowserEnv&&(b&&O.isFunction(b)&&(b=b(g)),b||b!==!1&&Bl(g.url))){const V=S&&I&&Hl.read(I);V&&A.set(S,V)}return g},$l=typeof XMLHttpRequest<"u"&&function(p){return new Promise(function(g,v){const b=so(p);let S=b.data;const I=et.from(b.headers).normalize();let{responseType:A,onUploadProgress:L,onDownloadProgress:V}=b,j,B,te,he,ie;function U(){he&&he(),ie&&ie(),b.cancelToken&&b.cancelToken.unsubscribe(j),b.signal&&b.signal.removeEventListener("abort",j)}let W=new XMLHttpRequest;W.open(b.method.toUpperCase(),b.url,!0),W.timeout=b.timeout;function xe(){if(!W)return;const Ie=et.from("getAllResponseHeaders"in W&&W.getAllResponseHeaders()),st={data:!A||A==="text"||A==="json"?W.responseText:W.response,status:W.status,statusText:W.statusText,headers:Ie,config:p,request:W};to(function(It){g(It),U()},function(It){v(It),U()},st),W=null}"onloadend"in W?W.onloadend=xe:W.onreadystatechange=function(){!W||W.readyState!==4||W.status===0&&!(W.responseURL&&W.responseURL.indexOf("file:")===0)||setTimeout(xe)},W.onabort=function(){W&&(v(new E("Request aborted",E.ECONNABORTED,p,W)),W=null)},W.onerror=function(Ie){const st=Ie&&Ie.message?Ie.message:"Network Error",It=new E(st,E.ERR_NETWORK,p,W);It.event=Ie||null,v(It),W=null},W.ontimeout=function(){let Ie=b.timeout?"timeout of "+b.timeout+"ms exceeded":"timeout exceeded";const st=b.transitional||Ji;b.timeoutErrorMessage&&(Ie=b.timeoutErrorMessage),v(new E(Ie,st.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,p,W)),W=null},S===void 0&&I.setContentType(null),"setRequestHeader"in W&&O.forEach(I.toJSON(),function(Ie,st){W.setRequestHeader(st,Ie)}),O.isUndefined(b.withCredentials)||(W.withCredentials=!!b.withCredentials),A&&A!=="json"&&(W.responseType=b.responseType),V&&([te,ie]=Bn(V,!0),W.addEventListener("progress",te)),L&&W.upload&&([B,he]=Bn(L),W.upload.addEventListener("progress",B),W.upload.addEventListener("loadend",he)),(b.cancelToken||b.signal)&&(j=Ie=>{W&&(v(!Ie||Ie.type?new Gt(null,p,W):Ie),W.abort(),W=null)},b.cancelToken&&b.cancelToken.subscribe(j),b.signal&&(b.signal.aborted?j():b.signal.addEventListener("abort",j)));const Oe=jl(b.url);if(Oe&&Ee.protocols.indexOf(Oe)===-1){v(new E("Unsupported protocol "+Oe+":",E.ERR_BAD_REQUEST,p));return}W.send(S||null)})},Wl=(p,g)=>{const{length:v}=p=p?p.filter(Boolean):[];if(g||v){let b=new AbortController,S;const I=function(j){if(!S){S=!0,L();const B=j instanceof Error?j:this.reason;b.abort(B instanceof E?B:new Gt(B instanceof Error?B.message:B))}};let A=g&&setTimeout(()=>{A=null,I(new E(`timeout ${g} of ms exceeded`,E.ETIMEDOUT))},g);const L=()=>{p&&(A&&clearTimeout(A),A=null,p.forEach(j=>{j.unsubscribe?j.unsubscribe(I):j.removeEventListener("abort",I)}),p=null)};p.forEach(j=>j.addEventListener("abort",I));const{signal:V}=b;return V.unsubscribe=()=>O.asap(L),V}};const Gl=function*(p,g){let v=p.byteLength;if(v{const S=Xl(p,g);let I=0,A,L=V=>{A||(A=!0,b&&b(V))};return new ReadableStream({async pull(V){try{const{done:j,value:B}=await S.next();if(j){L(),V.close();return}let te=B.byteLength;if(v){let he=I+=te;v(he)}V.enqueue(new Uint8Array(B))}catch(j){throw L(j),j}},cancel(V){return L(V),S.return()}},{highWaterMark:2})},lo=64*1024,{isFunction:Hn}=O,Kl=(({Request:p,Response:g})=>({Request:p,Response:g}))(O.global),{ReadableStream:co,TextEncoder:uo}=O.global,fo=(p,...g)=>{try{return!!p(...g)}catch{return!1}},Jl=p=>{p=O.merge.call({skipUndefined:!0},Kl,p);const{fetch:g,Request:v,Response:b}=p,S=g?Hn(g):typeof fetch=="function",I=Hn(v),A=Hn(b);if(!S)return!1;const L=S&&Hn(co),V=S&&(typeof uo=="function"?(U=>W=>U.encode(W))(new uo):async U=>new Uint8Array(await new v(U).arrayBuffer())),j=I&&L&&fo(()=>{let U=!1;const W=new v(Ee.origin,{body:new co,method:"POST",get duplex(){return U=!0,"half"}}).headers.has("Content-Type");return U&&!W}),B=A&&L&&fo(()=>O.isReadableStream(new b("").body)),te={stream:B&&(U=>U.body)};S&&["text","arrayBuffer","blob","formData","stream"].forEach(U=>{!te[U]&&(te[U]=(W,xe)=>{let Oe=W&&W[U];if(Oe)return Oe.call(W);throw new E(`Response type '${U}' is not supported`,E.ERR_NOT_SUPPORT,xe)})});const he=async U=>{if(U==null)return 0;if(O.isBlob(U))return U.size;if(O.isSpecCompliantForm(U))return(await new v(Ee.origin,{method:"POST",body:U}).arrayBuffer()).byteLength;if(O.isArrayBufferView(U)||O.isArrayBuffer(U))return U.byteLength;if(O.isURLSearchParams(U)&&(U=U+""),O.isString(U))return(await V(U)).byteLength},ie=async(U,W)=>O.toFiniteNumber(U.getContentLength())??he(W);return async U=>{let{url:W,method:xe,data:Oe,signal:Ie,cancelToken:st,timeout:It,onDownloadProgress:Pr,onUploadProgress:bo,responseType:At,headers:Nr,withCredentials:Gn="same-origin",fetchOptions:wo}=so(U),xo=g||fetch;At=At?(At+"").toLowerCase():"text";let Xn=Wl([Ie,st&&st.toAbortSignal()],It),fn=null;const Ut=Xn&&Xn.unsubscribe&&(()=>{Xn.unsubscribe()});let ko;try{if(bo&&j&&xe!=="get"&&xe!=="head"&&(ko=await ie(Nr,Oe))!==0){let Et=new v(W,{method:"POST",body:Oe,duplex:"half"}),Xt;if(O.isFormData(Oe)&&(Xt=Et.headers.get("content-type"))&&Nr.setContentType(Xt),Et.body){const[Mr,Zn]=no(ko,Bn(ro(bo)));Oe=ao(Et.body,lo,Mr,Zn)}}O.isString(Gn)||(Gn=Gn?"include":"omit");const at=I&&"credentials"in v.prototype,So={...wo,signal:Xn,method:xe.toUpperCase(),headers:Nr.normalize().toJSON(),body:Oe,duplex:"half",credentials:at?Gn:void 0};fn=I&&new v(W,So);let Tt=await(I?xo(fn,wo):xo(W,So));const Co=B&&(At==="stream"||At==="response");if(B&&(Pr||Co&&Ut)){const Et={};["status","statusText","headers"].forEach(Io=>{Et[Io]=Tt[Io]});const Xt=O.toFiniteNumber(Tt.headers.get("content-length")),[Mr,Zn]=Pr&&no(Xt,Bn(ro(Pr),!0))||[];Tt=new b(ao(Tt.body,lo,Mr,()=>{Zn&&Zn(),Ut&&Ut()}),Et)}At=At||"text";let oc=await te[O.findKey(te,At)||"text"](Tt,U);return!Co&&Ut&&Ut(),await new Promise((Et,Xt)=>{to(Et,Xt,{data:oc,headers:et.from(Tt.headers),status:Tt.status,statusText:Tt.statusText,config:U,request:fn})})}catch(at){throw Ut&&Ut(),at&&at.name==="TypeError"&&/Load failed|fetch/i.test(at.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,U,fn),{cause:at.cause||at}):E.from(at,at&&at.code,U,fn)}}},Yl=new Map,po=p=>{let g=p?p.env:{};const{fetch:v,Request:b,Response:S}=g,I=[b,S,v];let A=I.length,L=A,V,j,B=Yl;for(;L--;)V=I[L],j=B.get(V),j===void 0&&B.set(V,j=L?new Map:Jl(g)),B=j;return j};po();const Ar={http:ue,xhr:$l,fetch:{get:po}};O.forEach(Ar,(p,g)=>{if(p){try{Object.defineProperty(p,"name",{value:g})}catch{}Object.defineProperty(p,"adapterName",{value:g})}});const ho=p=>`- ${p}`,Ql=p=>O.isFunction(p)||p===null||p===!1;var mo={getAdapter:(p,g)=>{p=O.isArray(p)?p:[p];const{length:v}=p;let b,S;const I={};for(let A=0;A`adapter ${V} `+(j===!1?"is not supported by the environment":"is not available in the build"));let L=v?A.length>1?`since : @@ -32,7 +32,7 @@ import{h as ki,i as sc,n as ac,j as lc,k as Ao,m as cc,o as uc,p as ni,u as fc,q `))+1))}const a="#".repeat(i),f=t.enter("headingAtx"),c=t.enter("phrasing");o.move(a+" ");let d=t.containerPhrasing(e,{before:"# ",after:` `,...o.current()});return/^[\t ]/.test(d)&&(d=An(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,t.options.closeAtx&&(d+=" "+a),c(),f(),d}Qa.peek=Cy;function Qa(e){return e.value||""}function Cy(){return"<"}el.peek=Iy;function el(e,n,t,r){const i=Wi(t),o=i==='"'?"Quote":"Apostrophe",a=t.enter("image");let f=t.enter("label");const c=t.createTracker(r);let d=c.move("![");return d+=c.move(t.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=t.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(t.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(f=t.enter("destinationRaw"),d+=c.move(t.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),f(),e.title&&(f=t.enter(`title${o}`),d+=c.move(" "+i),d+=c.move(t.safe(e.title,{before:d,after:i,...c.current()})),d+=c.move(i),f()),d+=c.move(")"),a(),d}function Iy(){return"!"}tl.peek=Ay;function tl(e,n,t,r){const i=e.referenceType,o=t.enter("imageReference");let a=t.enter("label");const f=t.createTracker(r);let c=f.move("![");const d=t.safe(e.alt,{before:c,after:"]",...f.current()});c+=f.move(d+"]["),a();const m=t.stack;t.stack=[],a=t.enter("reference");const s=t.safe(t.associationId(e),{before:c,after:"]",...f.current()});return a(),t.stack=m,o(),i==="full"||!d||d!==s?c+=f.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=f.move("]"),c}function Ay(){return"!"}nl.peek=Ty;function nl(e,n,t){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o\u007F]/.test(e.url))}il.peek=Ey;function il(e,n,t,r){const i=Wi(t),o=i==='"'?"Quote":"Apostrophe",a=t.createTracker(r);let f,c;if(rl(e,t)){const m=t.stack;t.stack=[],f=t.enter("autolink");let s=a.move("<");return s+=a.move(t.containerPhrasing(e,{before:s,after:">",...a.current()})),s+=a.move(">"),f(),t.stack=m,s}f=t.enter("link"),c=t.enter("label");let d=a.move("[");return d+=a.move(t.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=t.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(t.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=t.enter("destinationRaw"),d+=a.move(t.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=t.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(t.safe(e.title,{before:d,after:i,...a.current()})),d+=a.move(i),c()),d+=a.move(")"),f(),d}function Ey(e,n,t){return rl(e,t)?"<":"["}ol.peek=Oy;function ol(e,n,t,r){const i=e.referenceType,o=t.enter("linkReference");let a=t.enter("label");const f=t.createTracker(r);let c=f.move("[");const d=t.containerPhrasing(e,{before:c,after:"]",...f.current()});c+=f.move(d+"]["),a();const m=t.stack;t.stack=[],a=t.enter("reference");const s=t.safe(t.associationId(e),{before:c,after:"]",...f.current()});return a(),t.stack=m,o(),i==="full"||!d||d!==s?c+=f.move(s+"]"):i==="shortcut"?c=c.slice(0,-1):c+=f.move("]"),c}function Oy(){return"["}function Gi(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Py(e){const n=Gi(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function Ny(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function sl(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function My(e,n,t,r){const i=t.enter("list"),o=t.bulletCurrent;let a=e.ordered?Ny(t):Gi(t);const f=e.ordered?a==="."?")":".":Py(t);let c=n&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&m&&(!m.children||!m.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(c=!0),sl(t)===a&&m){let s=-1;for(;++s-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(a=Math.ceil(a/4)*4);const f=t.createTracker(r);f.move(o+" ".repeat(a-o.length)),f.shift(a);const c=t.enter("listItem"),d=t.indentLines(t.containerFlow(e,f.current()),m);return c(),d;function m(s,l,u){return l?(u?"":" ".repeat(a))+s:(u?o:o+" ".repeat(a-o.length))+s}}function Dy(e,n,t,r){const i=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(e,r);return o(),i(),a}const Fy=pr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function jy(e,n,t,r){return(e.children.some(function(i){return Fy(i)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function Uy(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}al.peek=zy;function al(e,n,t,r){const i=Uy(t),o=t.enter("strong"),a=t.createTracker(r),f=a.move(i+i);let c=a.move(t.containerPhrasing(e,{after:i,before:f,...a.current()}));const d=c.charCodeAt(0),m=or(r.before.charCodeAt(r.before.length-1),d,i);m.inside&&(c=An(d)+c.slice(1));const s=c.charCodeAt(c.length-1),l=or(r.after.charCodeAt(0),s,i);l.inside&&(c=c.slice(0,-1)+An(s));const u=a.move(i+i);return o(),t.attentionEncodeSurroundingInfo={after:l.outside,before:m.outside},f+c+u}function zy(e,n,t){return t.options.strong||"*"}function By(e,n,t,r){return t.safe(e.value,r)}function Hy(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function qy(e,n,t){const r=(sl(t)+(t.options.ruleSpaces?" ":"")).repeat(Hy(t));return t.options.ruleSpaces?r.slice(0,-1):r}const ll={blockquote:uy,break:Ds,code:gy,definition:_y,emphasis:Ka,hardBreak:Ds,heading:Sy,html:Qa,image:el,imageReference:tl,inlineCode:nl,link:il,linkReference:ol,list:My,listItem:Ly,paragraph:Dy,root:jy,strong:al,text:By,thematicBreak:qy};function Vy(){return{enter:{table:$y,tableData:js,tableHeader:js,tableRow:Gy},exit:{codeText:Xy,table:Wy,tableData:Jr,tableHeader:Jr,tableRow:Jr}}}function $y(e){const n=e._align;this.enter({type:"table",align:n.map(function(t){return t==="none"?null:t}),children:[]},e),this.data.inTable=!0}function Wy(e){this.exit(e),this.data.inTable=void 0}function Gy(e){this.enter({type:"tableRow",children:[]},e)}function Jr(e){this.exit(e)}function js(e){this.enter({type:"tableCell",children:[]},e)}function Xy(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Zy));const t=this.stack[this.stack.length-1];t.type,t.value=n,this.exit(e)}function Zy(e,n){return n==="|"?n:e}function Ky(e){const n=e||{},t=n.tableCellPadding,r=n.tablePipeAlign,i=n.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:l,table:a,tableCell:c,tableRow:f}};function a(u,h,y,w){return d(m(u,y,w),u.align)}function f(u,h,y,w){const _=s(u,y,w),k=d([_]);return k.slice(0,k.indexOf(` -`))}function c(u,h,y,w){const _=y.enter("tableCell"),k=y.enter("phrasing"),T=y.containerPhrasing(u,{...w,before:o,after:o});return k(),_(),T}function d(u,h){return ly(u,{align:h,alignDelimiters:r,padding:t,stringLength:i})}function m(u,h,y){const w=u.children;let _=-1;const k=[],T=h.enter("table");for(;++_i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function y0(e,n,t){const r=[];let i=-1;for(;++i999||s===93&&!a||s===null||s===91||Be(s))return t(s);if(s===93){e.exit("chunkString");const l=e.exit("gfmFootnoteCallString");return i.includes(On(r.sliceSerialize(l)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(s)}return Be(s)||(a=!0),o++,e.consume(s),s===92?m:d}function m(s){return s===91||s===92||s===93?(e.consume(s),o++,d):d(s)}}function C0(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,f;return c;function c(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):t(h)}function m(h){if(a>999||h===93&&!f||h===null||h===91||Be(h))return t(h);if(h===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return o=On(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),l}return Be(h)||(f=!0),a++,e.consume(h),h===92?s:m}function s(h){return h===91||h===92||h===93?(e.consume(h),a++,m):m(h)}function l(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),yt(e,u,"gfmFootnoteDefinitionWhitespace")):t(h)}function u(h){return n(h)}}function I0(e,n,t){return e.check(_0,n,e.attempt(b0,n,t))}function A0(e){e.exit("gfmFootnoteDefinition")}function T0(e,n,t){const r=this;return yt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(o):t(o)}}function E0(e){let n=(e||{}).singleTilde;const t={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:t},insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(o,a){let f=-1;for(;++f1?f(u):(o.consume(u),m++,l);if(m<2&&!n)return f(u);const y=o.exit("strikethroughSequenceTemporary"),w=ir(u);return y._open=!w||w===2&&!!h,y._close=!h||h===2&&!!w,a(u)}}}class O0{constructor(){this.map=[]}add(n,t,r){P0(this,n,t,r)}consume(n){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function P0(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i-1;){const q=r.events[X][1].type;if(q==="lineEnding"||q==="linePrefix")X--;else break}const Z=X>-1?r.events[X][1].type:null,K=Z==="tableHead"||Z==="tableRow"?N:c;return K===N&&r.parser.lazy[r.now().line]?t(P):K(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(a=!0,o+=1),m(P)}function m(P){return P===null?t(P):en(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),u):t(P):gt(P)?yt(e,m,"whitespace")(P):(o+=1,a&&(a=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),a=!0,m):(e.enter("data"),s(P)))}function s(P){return P===null||P===124||Be(P)?(e.exit("data"),m(P)):(e.consume(P),P===92?l:s)}function l(P){return P===92||P===124?(e.consume(P),s):s(P)}function u(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(P):(e.enter("tableDelimiterRow"),a=!1,gt(P)?yt(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):h(P))}function h(P){return P===45||P===58?w(P):P===124?(a=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),y):$(P)}function y(P){return gt(P)?yt(e,w,"whitespace")(P):w(P)}function w(P){return P===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):P===45?(o+=1,_(P)):P===null||en(P)?R(P):$(P)}function _(P){return P===45?(e.enter("tableDelimiterFiller"),k(P)):$(P)}function k(P){return P===45?(e.consume(P),k):P===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(P))}function T(P){return gt(P)?yt(e,R,"whitespace")(P):R(P)}function R(P){return P===124?h(P):P===null||en(P)?!a||i!==o?$(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(P)):$(P)}function $(P){return t(P)}function N(P){return e.enter("tableRow"),J(P)}function J(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),J):P===null||en(P)?(e.exit("tableRow"),n(P)):gt(P)?yt(e,J,"whitespace")(P):(e.enter("data"),G(P))}function G(P){return P===null||P===124||Be(P)?(e.exit("data"),J(P)):(e.consume(P),P===92?H:G)}function H(P){return P===92||P===124?(e.consume(P),G):G(P)}}function L0(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],f=!1,c=0,d,m,s;const l=new O0;for(;++tt[2]+1){const h=t[2]+1,y=t[3]-t[2]-1;e.add(h,y,[])}}e.add(t[3]+1,0,[["exit",s,n]])}return i!==void 0&&(o.end=Object.assign({},Yt(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function qs(e,n,t,r,i){const o=[],a=Yt(n.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,n])),r.end=Object.assign({},a),o.push(["exit",r,n]),e.add(t+1,0,o)}function Yt(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const D0={name:"tasklistCheck",tokenize:j0};function F0(){return{text:{91:D0}}}function j0(e,n,t){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return Be(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):t(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):t(c)}function f(c){return en(c)?n(c):gt(c)?e.check({tokenize:U0},n,t)(c):t(c)}}function U0(e,n,t){return yt(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function z0(e){return r0([l0(),w0(),E0(e),M0(),F0()])}const B0={};function H0(e){const n=this,t=e||B0,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(z0(t)),o.push(t0()),a.push(n0(t))}const q0=kt({__name:"NcRichTextCopyButton",props:{contentId:{}},setup(e){const{copy:n,icon:t,altText:r}=pg(()=>document.getElementById(e.contentId).textContent);return(i,o)=>(M(),ce(Vt,{variant:"tertiary",size:"small","aria-label":Ne(r),title:Ne(r),onClick:Ne(n)},{icon:pe(()=>[Le(Si,{path:Ne(t),inline:""},null,8,["path"])]),_:1},8,["aria-label","title","onClick"]))}});function V0(e){return e.type==="text"}const $0=function(e){wt(e,V0,n);function n(t,r,i){const o=t.value.split(/(\{[a-z\-_.0-9]+\})/ig).map(a=>{const f=a.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!f)return Qt("text",a);const[,c]=f;return Qt("element",{tagName:`#${c}`,children:[]})});i.children.splice(r,1,...o)}},W0=()=>$0;function G0(e){return["text","code","inlineCode"].includes(e.type)}const X0=function(){return function(e){wt(e,G0,(n,t,r)=>(r.children.splice(t,1,{...n,value:n.value.replace(/</gmi,"<").replace(/>/gmi,">")}),[Mi,t+1]))}},Z0=["http","https","mailto","tel"],wi=Pt(null);async function K0(){const e=await ou(()=>import("./index-D7sxjegV.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);wi.value=e.default}const J0={name:"NcRichText",components:{NcReferenceList:Gr},props:{text:{type:String,default:""},arguments:{type:Object,default:()=>({})},referenceLimit:{type:Number,default:0},referenceInteractive:{type:Boolean,default:!0},referenceInteractiveOptIn:{type:Boolean,default:!1},references:{type:Array,default:null},useMarkdown:{type:Boolean,default:!1},useExtendedMarkdown:{type:Boolean,default:!1},interactive:{type:Boolean,default:!1},autolink:{type:Boolean,default:!0}},emits:["interactTodo"],data(){return{parentId:tn()}},methods:{renderPlaintext(){const e=this.text.split(/(\{[a-z\-_.0-9]+\})/ig).map(n=>{const t=n.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!t)return this.prepareTextNode(n);const r=t[1],i=this.arguments[r];if(typeof i=="object"){const{component:o,props:a}=i;return ve(typeof o=="string"?ge(o):o,{...a,class:"rich-text--component"})}return i?ve("span",{class:"rich-text--fallback"},i):n});return ve("div",{class:"rich-text--wrapper"},[ve("div",{},e.flat()),this.referenceLimit>0?ve("div",{class:"rich-text--reference-widget"},[ve(Gr,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},renderMarkdown(){const e=Wm().use(qh).use(ig,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(X0).use(this.useExtendedMarkdown?H0:void 0).use(Fd).use(Am,{except:Z0}).use(Cm,{handlers:{component(n,t){return n(t,t.component,{value:t.value})}}}).use(this.useExtendedMarkdown?wi.value:void 0).use(W0).use(Uf,{target:"_blank",rel:["noopener noreferrer"]}).use(Ed,{Fragment:Tn,jsx:this.createElement,jsxs:this.createElement,elementAttributeNameCase:"html",prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,n=>n.replace(/")).result;return ve("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[e,this.referenceLimit>0?ve("div",{class:"rich-text--reference-widget"},[ve(Gr,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},prepareTextNode(e){return this.autolink&&(e=Va(e)),Array.isArray(e)?e.map(n=>{if(typeof n=="string")return n;const{component:t,props:r}=n,i=t.name==="NcLink"?void 0:"rich-text--component";return ve(t,{...r,class:i})}):e},createElement(e,n,t){t&&(n.key=t);const r=n.children??[];if(delete n.children,!String(e).startsWith("#")){["h1","h2","h3","h4","h5","h6"].includes(String(e))&&(e=`h${Math.min(+String(e)[1]+3,6)}`);let o=null;if(this.useExtendedMarkdown){if(String(e)==="code"&&!wi.value&&n?.class?.includes("language")&&K0(),String(e)==="pre"&&r&&String(r.type)==="code"){const a=this.parentId+"-code-block-"+tn();return ve("p",{class:"rich-text__code-block"},[ve(e,{...n,id:a},r),ve(q0,{class:"rich-text__code-block-button",contentId:a})])}if(String(e)==="li"&&Array.isArray(r)&&r.length!==0&&r[0].type==="input"&&r[0].props.type==="checkbox"){const[a,,...f]=r,c=f.findIndex(l=>["ul","ol","li","blockquote","pre"].includes(l.type));c!==-1&&(o=f[c],f.splice(c));const d=this.parentId+"-markdown-input-"+tn(),m={...a.props};delete m.checked;const s=ve(jc,{...m,modelValue:a.props.checked,id:d,disabled:!this.interactive,"onUpdate:modelValue":()=>{this.$emit("interactTodo",d)}},{default:()=>f});return ve(e,n,[s,o])}}if(String(e)==="a"){const a=Vi(this.$router,n.href);if(a)return delete n.href,delete n.target,ve(Ci,{...n,to:a},{default:()=>r})}return ve(e,n,r)}const i=this.arguments[e.slice(1)];return i?i.component?ve(typeof i.component=="string"?ge(i.component):i.component,{...n,...i.props,class:"rich-text--component"},{default:()=>r}):ve("span",{...n},[i]):ve("span",{...n,class:"rich-text--fallback"},[`{${e.slice(1)}}`])}},render(){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown():this.renderPlaintext()}},Y0=Ge(J0,[["__scopeId","data-v-a47e4ba7"]]),Q0={__name:"ActionButton",props:{action:{type:Object,required:!0}},emits:["click"],setup(e,{emit:n}){const t=e,r=n,i=oe(()=>t.action.type==="WEB");function o(a){const f={url:t.action.link,type:t.action.type||"GET"};r("click",{event:a,action:f})}return(a,f)=>(M(),ce(Ne(Vt),{variant:i.value||e.action.primary?"primary":"secondary",href:i.value?e.action.link:void 0,class:"action-button pull-right",onClick:o},{default:pe(()=>[Mt(ne(e.action.label),1)]),_:1},8,["variant","href"]))}},e1={name:"DefaultParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},link:{type:String,default:""}},computed:{hasInternalLink(){return this.link&&(this.type==="deck-board"||this.type==="deck-card")}}},t1=["href"],n1=["href"],r1={key:2};function i1(e,n,t,r,i,o){return o.hasInternalLink?(M(),z("a",{key:0,href:t.link},[se("strong",null,ne(t.name),1)],8,t1)):t.link?(M(),z("a",{key:1,href:t.link,class:"external",target:"_blank",rel:"noopener noreferrer"},[se("strong",null,ne(t.name),1)],8,n1)):(M(),z("strong",r1,ne(t.name),1))}const o1=xt(e1,[["render",i1],["__scopeId","data-v-9803ab31"]]),s1={name:"FileParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},path:{type:String,default:""},link:{type:String,default:""}},computed:{title(){const e=this.path.lastIndexOf("/"),n=this.path.indexOf("/"),t=this.path.substring(n===0?1:0,e);return t.length===0?"":ft("notifications","in {path}",{path:t})}}},a1=["title","href"];function l1(e,n,t,r,i,o){return M(),z("a",{title:o.title,class:"filename",href:t.link},ne(t.name),9,a1)}const c1=xt(s1,[["render",l1]]),Yr=new WeakMap,u1={mounted(e,n){const t=!n.modifiers.bubble;let r;if(typeof n.value=="function")r=ri(e,n.value,{capture:t});else{const[i,o]=n.value;r=ri(e,i,Object.assign({capture:t},o))}Yr.set(e,r)},unmounted(e){const n=Yr.get(e);n&&typeof n=="function"?n():n?.stop(),Yr.delete(e)}};function f1(e){return window._nc_contacts_menu_hooks?Object.values(window._nc_contacts_menu_hooks).filter(n=>n.enabled(e)):[]}const d1=new Int32Array(4);class Me{static hashStr(n,t=!1){return this.onePassHasher.start().appendStr(n).end(t)}static hashAsciiStr(n,t=!1){return this.onePassHasher.start().appendAsciiStr(n).end(t)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new Me;static _hex(n){const t=Me.hexChars,r=Me.hexOut;let i,o,a,f;for(f=0;f<4;f+=1)for(o=f*8,i=n[f],a=0;a<8;a+=2)r[o+1+a]=t.charAt(i&15),i>>>=4,r[o+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(n,t){let r=n[0],i=n[1],o=n[2],a=n[3];r+=(i&o|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+o|0,n[0]=r+n[0]|0,n[1]=i+n[1]|0,n[2]=o+n[2]|0,n[3]=a+n[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Me.stateIdentity),this}appendStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a;for(a=0;a>>6)+192,t[i++]=o&63|128;else if(o<55296||o>56319)t[i++]=(o>>>12)+224,t[i++]=o>>>6&63|128,t[i++]=o&63|128;else{if(o=(o-55296)*1024+(n.charCodeAt(++a)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(o>>>18)+240,t[i++]=o>>>12&63|128,t[i++]=o>>>6&63|128,t[i++]=o&63|128}i>=64&&(this._dataLength+=64,Me._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n.charCodeAt(a++);if(i<64)break;this._dataLength+=64,Me._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n[a++];if(i<64)break;this._dataLength+=64,Me._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const n=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(n){const t=n.buffer,r=n.state,i=this._state;let o;for(this._dataLength=n.length,this._bufferLength=n.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o>2)+1;this._dataLength+=t;const a=this._dataLength*8;if(r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(Me.buffer32Identity.subarray(o),o),t>55&&(Me._md5cycle(this._state,i),i.set(Me.buffer32Identity)),a<=4294967295)i[14]=a;else{const f=a.toString(16).match(/(.*?)(.{0,8})$/);if(f===null)return n?d1:"";const c=parseInt(f[2],16),d=parseInt(f[1],16)||0;i[14]=c,i[15]=d}return Me._md5cycle(this._state,i),n?this._state:Me._hex(this._state)}}if(Me.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");Je(Uc);class Re{constructor(n,t,r,i){this.r=n,this.g=t,this.b=r,this.name=i,this.r=Math.min(n,255),this.g=Math.min(t,255),this.b=Math.min(r,255),this.name=i}get color(){const n=t=>`00${t.toString(16)}`.slice(-2);return`#${n(this.r)}${n(this.g)}${n(this.b)}`}}function p1(e,n,t){return{r:(t.r-n.r)/e,g:(t.g-n.g)/e,b:(t.b-n.b)/e}}function Qr(e,n,t){const r=[];r.push(n);const i=p1(e,n,t);for(let o=1;o/g,f=/<\/?([^\s\/>]+)/;function c(h,y,w){h=h||"",y=y||[],w=w||"";let _=m(y,w);return s(h,_)}function d(h,y){h=h||[],y=y||"";let w=m(h,y);return function(_){return s(_||"",w)}}c.init_streaming_mode=d;function m(h,y){return h=l(h),{allowable_tags:h,tag_replacement:y,state:r,tag_buffer:"",depth:0,in_quote_char:""}}function s(h,y){if(typeof h!="string")throw new TypeError("'html' parameter must be a string");let w=y.allowable_tags,_=y.tag_replacement,k=y.state,T=y.tag_buffer,R=y.depth,$=y.in_quote_char,N="";for(let J=0,G=h.length;J":if($)break;if(R){R--;break}$="",k=r,T+=">",w.has(u(T))?N+=T:N+=_,T="";break;case'"':case"'":H===$?$="":$=$||H,T+=H;break;case"-":T==="i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);o0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}function y0(e,n,t){const r=[];let i=-1;for(;++i999||s===93&&!a||s===null||s===91||Be(s))return t(s);if(s===93){e.exit("chunkString");const l=e.exit("gfmFootnoteCallString");return i.includes(On(r.sliceSerialize(l)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(s)}return Be(s)||(a=!0),o++,e.consume(s),s===92?m:d}function m(s){return s===91||s===92||s===93?(e.consume(s),o++,d):d(s)}}function C0(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,f;return c;function c(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):t(h)}function m(h){if(a>999||h===93&&!f||h===null||h===91||Be(h))return t(h);if(h===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return o=On(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),l}return Be(h)||(f=!0),a++,e.consume(h),h===92?s:m}function s(h){return h===91||h===92||h===93?(e.consume(h),a++,m):m(h)}function l(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(o)||i.push(o),yt(e,u,"gfmFootnoteDefinitionWhitespace")):t(h)}function u(h){return n(h)}}function I0(e,n,t){return e.check(_0,n,e.attempt(b0,n,t))}function A0(e){e.exit("gfmFootnoteDefinition")}function T0(e,n,t){const r=this;return yt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(o):t(o)}}function E0(e){let n=(e||{}).singleTilde;const t={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:t},insideSpan:{null:[t]},attentionMarkers:{null:[126]}};function r(o,a){let f=-1;for(;++f1?f(u):(o.consume(u),m++,l);if(m<2&&!n)return f(u);const y=o.exit("strikethroughSequenceTemporary"),w=ir(u);return y._open=!w||w===2&&!!h,y._close=!h||h===2&&!!w,a(u)}}}class O0{constructor(){this.map=[]}add(n,t,r){P0(this,n,t,r)}consume(n){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function P0(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i-1;){const q=r.events[X][1].type;if(q==="lineEnding"||q==="linePrefix")X--;else break}const Z=X>-1?r.events[X][1].type:null,K=Z==="tableHead"||Z==="tableRow"?N:c;return K===N&&r.parser.lazy[r.now().line]?t(P):K(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(a=!0,o+=1),m(P)}function m(P){return P===null?t(P):en(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),u):t(P):gt(P)?yt(e,m,"whitespace")(P):(o+=1,a&&(a=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),a=!0,m):(e.enter("data"),s(P)))}function s(P){return P===null||P===124||Be(P)?(e.exit("data"),m(P)):(e.consume(P),P===92?l:s)}function l(P){return P===92||P===124?(e.consume(P),s):s(P)}function u(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(P):(e.enter("tableDelimiterRow"),a=!1,gt(P)?yt(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):h(P))}function h(P){return P===45||P===58?w(P):P===124?(a=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),y):$(P)}function y(P){return gt(P)?yt(e,w,"whitespace")(P):w(P)}function w(P){return P===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),_):P===45?(o+=1,_(P)):P===null||en(P)?R(P):$(P)}function _(P){return P===45?(e.enter("tableDelimiterFiller"),k(P)):$(P)}function k(P){return P===45?(e.consume(P),k):P===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(P))}function T(P){return gt(P)?yt(e,R,"whitespace")(P):R(P)}function R(P){return P===124?h(P):P===null||en(P)?!a||i!==o?$(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(P)):$(P)}function $(P){return t(P)}function N(P){return e.enter("tableRow"),J(P)}function J(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),J):P===null||en(P)?(e.exit("tableRow"),n(P)):gt(P)?yt(e,J,"whitespace")(P):(e.enter("data"),G(P))}function G(P){return P===null||P===124||Be(P)?(e.exit("data"),J(P)):(e.consume(P),P===92?H:G)}function H(P){return P===92||P===124?(e.consume(P),G):G(P)}}function L0(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],f=!1,c=0,d,m,s;const l=new O0;for(;++tt[2]+1){const h=t[2]+1,y=t[3]-t[2]-1;e.add(h,y,[])}}e.add(t[3]+1,0,[["exit",s,n]])}return i!==void 0&&(o.end=Object.assign({},Yt(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function qs(e,n,t,r,i){const o=[],a=Yt(n.events,t);i&&(i.end=Object.assign({},a),o.push(["exit",i,n])),r.end=Object.assign({},a),o.push(["exit",r,n]),e.add(t+1,0,o)}function Yt(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const D0={name:"tasklistCheck",tokenize:j0};function F0(){return{text:{91:D0}}}function j0(e,n,t){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return Be(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):t(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):t(c)}function f(c){return en(c)?n(c):gt(c)?e.check({tokenize:U0},n,t)(c):t(c)}}function U0(e,n,t){return yt(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function z0(e){return r0([l0(),w0(),E0(e),M0(),F0()])}const B0={};function H0(e){const n=this,t=e||B0,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(z0(t)),o.push(t0()),a.push(n0(t))}const q0=kt({__name:"NcRichTextCopyButton",props:{contentId:{}},setup(e){const{copy:n,icon:t,altText:r}=pg(()=>document.getElementById(e.contentId).textContent);return(i,o)=>(M(),ce(Vt,{variant:"tertiary",size:"small","aria-label":Ne(r),title:Ne(r),onClick:Ne(n)},{icon:pe(()=>[Le(Si,{path:Ne(t),inline:""},null,8,["path"])]),_:1},8,["aria-label","title","onClick"]))}});function V0(e){return e.type==="text"}const $0=function(e){wt(e,V0,n);function n(t,r,i){const o=t.value.split(/(\{[a-z\-_.0-9]+\})/ig).map(a=>{const f=a.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!f)return Qt("text",a);const[,c]=f;return Qt("element",{tagName:`#${c}`,children:[]})});i.children.splice(r,1,...o)}},W0=()=>$0;function G0(e){return["text","code","inlineCode"].includes(e.type)}const X0=function(){return function(e){wt(e,G0,(n,t,r)=>(r.children.splice(t,1,{...n,value:n.value.replace(/</gmi,"<").replace(/>/gmi,">")}),[Mi,t+1]))}},Z0=["http","https","mailto","tel"],wi=Pt(null);async function K0(){const e=await ou(()=>import("./index-B6qrHl3T.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);wi.value=e.default}const J0={name:"NcRichText",components:{NcReferenceList:Gr},props:{text:{type:String,default:""},arguments:{type:Object,default:()=>({})},referenceLimit:{type:Number,default:0},referenceInteractive:{type:Boolean,default:!0},referenceInteractiveOptIn:{type:Boolean,default:!1},references:{type:Array,default:null},useMarkdown:{type:Boolean,default:!1},useExtendedMarkdown:{type:Boolean,default:!1},interactive:{type:Boolean,default:!1},autolink:{type:Boolean,default:!0}},emits:["interactTodo"],data(){return{parentId:tn()}},methods:{renderPlaintext(){const e=this.text.split(/(\{[a-z\-_.0-9]+\})/ig).map(n=>{const t=n.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!t)return this.prepareTextNode(n);const r=t[1],i=this.arguments[r];if(typeof i=="object"){const{component:o,props:a}=i;return ve(typeof o=="string"?ge(o):o,{...a,class:"rich-text--component"})}return i?ve("span",{class:"rich-text--fallback"},i):n});return ve("div",{class:"rich-text--wrapper"},[ve("div",{},e.flat()),this.referenceLimit>0?ve("div",{class:"rich-text--reference-widget"},[ve(Gr,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},renderMarkdown(){const e=Wm().use(qh).use(ig,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(X0).use(this.useExtendedMarkdown?H0:void 0).use(Fd).use(Am,{except:Z0}).use(Cm,{handlers:{component(n,t){return n(t,t.component,{value:t.value})}}}).use(this.useExtendedMarkdown?wi.value:void 0).use(W0).use(Uf,{target:"_blank",rel:["noopener noreferrer"]}).use(Ed,{Fragment:Tn,jsx:this.createElement,jsxs:this.createElement,elementAttributeNameCase:"html",prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,n=>n.replace(/")).result;return ve("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[e,this.referenceLimit>0?ve("div",{class:"rich-text--reference-widget"},[ve(Gr,{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn})]):null])},prepareTextNode(e){return this.autolink&&(e=Va(e)),Array.isArray(e)?e.map(n=>{if(typeof n=="string")return n;const{component:t,props:r}=n,i=t.name==="NcLink"?void 0:"rich-text--component";return ve(t,{...r,class:i})}):e},createElement(e,n,t){t&&(n.key=t);const r=n.children??[];if(delete n.children,!String(e).startsWith("#")){["h1","h2","h3","h4","h5","h6"].includes(String(e))&&(e=`h${Math.min(+String(e)[1]+3,6)}`);let o=null;if(this.useExtendedMarkdown){if(String(e)==="code"&&!wi.value&&n?.class?.includes("language")&&K0(),String(e)==="pre"&&r&&String(r.type)==="code"){const a=this.parentId+"-code-block-"+tn();return ve("p",{class:"rich-text__code-block"},[ve(e,{...n,id:a},r),ve(q0,{class:"rich-text__code-block-button",contentId:a})])}if(String(e)==="li"&&Array.isArray(r)&&r.length!==0&&r[0].type==="input"&&r[0].props.type==="checkbox"){const[a,,...f]=r,c=f.findIndex(l=>["ul","ol","li","blockquote","pre"].includes(l.type));c!==-1&&(o=f[c],f.splice(c));const d=this.parentId+"-markdown-input-"+tn(),m={...a.props};delete m.checked;const s=ve(jc,{...m,modelValue:a.props.checked,id:d,disabled:!this.interactive,"onUpdate:modelValue":()=>{this.$emit("interactTodo",d)}},{default:()=>f});return ve(e,n,[s,o])}}if(String(e)==="a"){const a=Vi(this.$router,n.href);if(a)return delete n.href,delete n.target,ve(Ci,{...n,to:a},{default:()=>r})}return ve(e,n,r)}const i=this.arguments[e.slice(1)];return i?i.component?ve(typeof i.component=="string"?ge(i.component):i.component,{...n,...i.props,class:"rich-text--component"},{default:()=>r}):ve("span",{...n},[i]):ve("span",{...n,class:"rich-text--fallback"},[`{${e.slice(1)}}`])}},render(){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown():this.renderPlaintext()}},Y0=Ge(J0,[["__scopeId","data-v-a47e4ba7"]]),Q0={__name:"ActionButton",props:{action:{type:Object,required:!0}},emits:["click"],setup(e,{emit:n}){const t=e,r=n,i=oe(()=>t.action.type==="WEB");function o(a){const f={url:t.action.link,type:t.action.type||"GET"};r("click",{event:a,action:f})}return(a,f)=>(M(),ce(Ne(Vt),{variant:i.value||e.action.primary?"primary":"secondary",href:i.value?e.action.link:void 0,class:"action-button pull-right",onClick:o},{default:pe(()=>[Mt(ne(e.action.label),1)]),_:1},8,["variant","href"]))}},e1={name:"DefaultParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},link:{type:String,default:""}},computed:{hasInternalLink(){return this.link&&(this.type==="deck-board"||this.type==="deck-card")}}},t1=["href"],n1=["href"],r1={key:2};function i1(e,n,t,r,i,o){return o.hasInternalLink?(M(),z("a",{key:0,href:t.link},[se("strong",null,ne(t.name),1)],8,t1)):t.link?(M(),z("a",{key:1,href:t.link,class:"external",target:"_blank",rel:"noopener noreferrer"},[se("strong",null,ne(t.name),1)],8,n1)):(M(),z("strong",r1,ne(t.name),1))}const o1=xt(e1,[["render",i1],["__scopeId","data-v-9803ab31"]]),s1={name:"FileParameter",props:{type:{type:String,required:!0},id:{type:[Number,String],required:!0},name:{type:String,required:!0},path:{type:String,default:""},link:{type:String,default:""}},computed:{title(){const e=this.path.lastIndexOf("/"),n=this.path.indexOf("/"),t=this.path.substring(n===0?1:0,e);return t.length===0?"":ft("notifications","in {path}",{path:t})}}},a1=["title","href"];function l1(e,n,t,r,i,o){return M(),z("a",{title:o.title,class:"filename",href:t.link},ne(t.name),9,a1)}const c1=xt(s1,[["render",l1]]),Yr=new WeakMap,u1={mounted(e,n){const t=!n.modifiers.bubble;let r;if(typeof n.value=="function")r=ri(e,n.value,{capture:t});else{const[i,o]=n.value;r=ri(e,i,Object.assign({capture:t},o))}Yr.set(e,r)},unmounted(e){const n=Yr.get(e);n&&typeof n=="function"?n():n?.stop(),Yr.delete(e)}};function f1(e){return window._nc_contacts_menu_hooks?Object.values(window._nc_contacts_menu_hooks).filter(n=>n.enabled(e)):[]}const d1=new Int32Array(4);class Me{static hashStr(n,t=!1){return this.onePassHasher.start().appendStr(n).end(t)}static hashAsciiStr(n,t=!1){return this.onePassHasher.start().appendAsciiStr(n).end(t)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new Me;static _hex(n){const t=Me.hexChars,r=Me.hexOut;let i,o,a,f;for(f=0;f<4;f+=1)for(o=f*8,i=n[f],a=0;a<8;a+=2)r[o+1+a]=t.charAt(i&15),i>>>=4,r[o+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(n,t){let r=n[0],i=n[1],o=n[2],a=n[3];r+=(i&o|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[2]+606105819|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[6]-1473231341|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[10]-42063|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&o)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,o+=(a&r|~a&i)+t[14]-1502002290|0,o=(o<<17|o>>>15)+a|0,i+=(o&a|~o&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&a|o&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[11]+643717713|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[15]-660478335|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[3]-187363961|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&a|o&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&o|i&~o)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,o+=(a&i|r&~i)+t[7]+1735328473|0,o=(o<<14|o>>>18)+a|0,i+=(o&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[11]+1839030562|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[7]-155497632|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[3]-722521979|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^o)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,o+=(a^r^i)+t[15]+530742520|0,o=(o<<16|o>>>16)+a|0,i+=(o^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[14]-1416354905|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[10]-1051523|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[6]-1560198380|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~o))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,o+=(r^(a|~i))+t[2]+718787259|0,o=(o<<15|o>>>17)+a|0,i+=(a^(o|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+o|0,n[0]=r+n[0]|0,n[1]=i+n[1]|0,n[2]=o+n[2]|0,n[3]=a+n[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(Me.stateIdentity),this}appendStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a;for(a=0;a>>6)+192,t[i++]=o&63|128;else if(o<55296||o>56319)t[i++]=(o>>>12)+224,t[i++]=o>>>6&63|128,t[i++]=o&63|128;else{if(o=(o-55296)*1024+(n.charCodeAt(++a)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(o>>>18)+240,t[i++]=o>>>12&63|128,t[i++]=o>>>6&63|128,t[i++]=o&63|128}i>=64&&(this._dataLength+=64,Me._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n.charCodeAt(a++);if(i<64)break;this._dataLength+=64,Me._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(n){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,a=0;for(;;){for(o=Math.min(n.length-a,64-i);o--;)t[i++]=n[a++];if(i<64)break;this._dataLength+=64,Me._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const n=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[n[0],n[1],n[2],n[3]]}}setState(n){const t=n.buffer,r=n.state,i=this._state;let o;for(this._dataLength=n.length,this._bufferLength=n.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o>2)+1;this._dataLength+=t;const a=this._dataLength*8;if(r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(Me.buffer32Identity.subarray(o),o),t>55&&(Me._md5cycle(this._state,i),i.set(Me.buffer32Identity)),a<=4294967295)i[14]=a;else{const f=a.toString(16).match(/(.*?)(.{0,8})$/);if(f===null)return n?d1:"";const c=parseInt(f[2],16),d=parseInt(f[1],16)||0;i[14]=c,i[15]=d}return Me._md5cycle(this._state,i),n?this._state:Me._hex(this._state)}}if(Me.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");Je(Uc);class Re{constructor(n,t,r,i){this.r=n,this.g=t,this.b=r,this.name=i,this.r=Math.min(n,255),this.g=Math.min(t,255),this.b=Math.min(r,255),this.name=i}get color(){const n=t=>`00${t.toString(16)}`.slice(-2);return`#${n(this.r)}${n(this.g)}${n(this.b)}`}}function p1(e,n,t){return{r:(t.r-n.r)/e,g:(t.g-n.g)/e,b:(t.b-n.b)/e}}function Qr(e,n,t){const r=[];r.push(n);const i=p1(e,n,t);for(let o=1;o/g,f=/<\/?([^\s\/>]+)/;function c(h,y,w){h=h||"",y=y||[],w=w||"";let _=m(y,w);return s(h,_)}function d(h,y){h=h||[],y=y||"";let w=m(h,y);return function(_){return s(_||"",w)}}c.init_streaming_mode=d;function m(h,y){return h=l(h),{allowable_tags:h,tag_replacement:y,state:r,tag_buffer:"",depth:0,in_quote_char:""}}function s(h,y){if(typeof h!="string")throw new TypeError("'html' parameter must be a string");let w=y.allowable_tags,_=y.tag_replacement,k=y.state,T=y.tag_buffer,R=y.depth,$=y.in_quote_char,N="";for(let J=0,G=h.length;J":if($)break;if(R){R--;break}$="",k=r,T+=">",w.has(u(T))?N+=T:N+=_,T="";break;case'"':case"'":H===$?$="":$=$||H,T+=H;break;case"-":T==="":T.slice(-2)=="--"&&(k=r),T="";break;default:T+=H;break}}return y.state=k,y.tag_buffer=T,y.depth=R,y.in_quote_char=$,N}function l(h){let y=new Set;if(typeof h=="string"){let w;for(;w=a.exec(h);)y.add(w[1])}else!t.nonNative&&typeof h[t.iterator]=="function"?y=new Set(h):typeof h.forEach=="function"&&h.forEach(y.add,y);return y}function u(h){let y=f.exec(h);return y?y[1].toLowerCase():null}e.exports?e.exports=c:n.striptags=c})(g1)}(xi)),xi.exports}y1();function _1(e,n){const t=(n?.size||64)<=64?64:512,r=n?.isGuest?"/guest":"",i=n?.isDarkTheme??ni(document.body)?"/dark":"";return ra(`/avatar${r}/{user}/{size}${i}`,{user:e,size:t})}const v1=`\n\n\n\n\n","import { defineComponent, computed, toRef, createElementBlock, openBlock, toDisplayString, unref } from \"vue\";\nimport { useFormatTime, useFormatRelativeTime } from \"../composables/useFormatDateTime/index.mjs\";\nconst _hoisted_1 = [\"data-timestamp\", \"title\", \"textContent\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcDateTime\",\n props: {\n timestamp: {},\n format: { default: () => ({ timeStyle: \"medium\", dateStyle: \"short\" }) },\n relativeTime: { type: [Boolean, String], default: \"long\" },\n ignoreSeconds: { type: Boolean }\n },\n setup(__props) {\n const props = __props;\n const timeOptions = computed(() => ({ format: props.format }));\n const relativeTimeOptions = computed(() => ({\n ignoreSeconds: props.ignoreSeconds,\n relativeTime: props.relativeTime || \"long\",\n update: props.relativeTime !== false\n }));\n const title = useFormatTime(toRef(() => props.timestamp), timeOptions);\n const relativeTime = useFormatRelativeTime(toRef(() => props.timestamp), relativeTimeOptions);\n const formattedTime = computed(() => props.relativeTime ? relativeTime.value : title.value);\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"span\", {\n class: \"nc-datetime\",\n dir: \"auto\",\n \"data-timestamp\": _ctx.timestamp,\n title: unref(title),\n textContent: toDisplayString(formattedTime.value)\n }, null, 8, _hoisted_1);\n };\n }\n});\nexport {\n _sfc_main as _\n};\n//# sourceMappingURL=NcDateTime.vue_vue_type_script_setup_true_lang-BhB8yA4U.mjs.map\n","export const VOID = -1;\nexport const PRIMITIVE = 0;\nexport const ARRAY = 1;\nexport const OBJECT = 2;\nexport const DATE = 3;\nexport const REGEXP = 4;\nexport const MAP = 5;\nexport const SET = 6;\nexport const ERROR = 7;\nexport const BIGINT = 8;\n// export const SYMBOL = 9;\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst env = typeof self === 'object' ? self : globalThis;\n\nconst deserializer = ($, _) => {\n const as = (out, index) => {\n $.set(index, out);\n return out;\n };\n\n const unpair = index => {\n if ($.has(index))\n return $.get(index);\n\n const [type, value] = _[index];\n switch (type) {\n case PRIMITIVE:\n case VOID:\n return as(value, index);\n case ARRAY: {\n const arr = as([], index);\n for (const index of value)\n arr.push(unpair(index));\n return arr;\n }\n case OBJECT: {\n const object = as({}, index);\n for (const [key, index] of value)\n object[unpair(key)] = unpair(index);\n return object;\n }\n case DATE:\n return as(new Date(value), index);\n case REGEXP: {\n const {source, flags} = value;\n return as(new RegExp(source, flags), index);\n }\n case MAP: {\n const map = as(new Map, index);\n for (const [key, index] of value)\n map.set(unpair(key), unpair(index));\n return map;\n }\n case SET: {\n const set = as(new Set, index);\n for (const index of value)\n set.add(unpair(index));\n return set;\n }\n case ERROR: {\n const {name, message} = value;\n return as(new env[name](message), index);\n }\n case BIGINT:\n return as(BigInt(value), index);\n case 'BigInt':\n return as(Object(BigInt(value)), index);\n case 'ArrayBuffer':\n return as(new Uint8Array(value).buffer, value);\n case 'DataView': {\n const { buffer } = new Uint8Array(value);\n return as(new DataView(buffer), value);\n }\n }\n return as(new env[type](value), index);\n };\n\n return unpair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns a deserialized value from a serialized array of Records.\n * @param {Record[]} serialized a previously serialized value.\n * @returns {any}\n */\nexport const deserialize = serialized => deserializer(new Map, serialized)(0);\n","import {\n VOID, PRIMITIVE,\n ARRAY, OBJECT,\n DATE, REGEXP, MAP, SET,\n ERROR, BIGINT\n} from './types.js';\n\nconst EMPTY = '';\n\nconst {toString} = {};\nconst {keys} = Object;\n\nconst typeOf = value => {\n const type = typeof value;\n if (type !== 'object' || !value)\n return [PRIMITIVE, type];\n\n const asString = toString.call(value).slice(8, -1);\n switch (asString) {\n case 'Array':\n return [ARRAY, EMPTY];\n case 'Object':\n return [OBJECT, EMPTY];\n case 'Date':\n return [DATE, EMPTY];\n case 'RegExp':\n return [REGEXP, EMPTY];\n case 'Map':\n return [MAP, EMPTY];\n case 'Set':\n return [SET, EMPTY];\n case 'DataView':\n return [ARRAY, asString];\n }\n\n if (asString.includes('Array'))\n return [ARRAY, asString];\n\n if (asString.includes('Error'))\n return [ERROR, asString];\n\n return [OBJECT, asString];\n};\n\nconst shouldSkip = ([TYPE, type]) => (\n TYPE === PRIMITIVE &&\n (type === 'function' || type === 'symbol')\n);\n\nconst serializer = (strict, json, $, _) => {\n\n const as = (out, value) => {\n const index = _.push(out) - 1;\n $.set(value, index);\n return index;\n };\n\n const pair = value => {\n if ($.has(value))\n return $.get(value);\n\n let [TYPE, type] = typeOf(value);\n switch (TYPE) {\n case PRIMITIVE: {\n let entry = value;\n switch (type) {\n case 'bigint':\n TYPE = BIGINT;\n entry = value.toString();\n break;\n case 'function':\n case 'symbol':\n if (strict)\n throw new TypeError('unable to serialize ' + type);\n entry = null;\n break;\n case 'undefined':\n return as([VOID], value);\n }\n return as([TYPE, entry], value);\n }\n case ARRAY: {\n if (type) {\n let spread = value;\n if (type === 'DataView') {\n spread = new Uint8Array(value.buffer);\n }\n else if (type === 'ArrayBuffer') {\n spread = new Uint8Array(value);\n }\n return as([type, [...spread]], value);\n }\n\n const arr = [];\n const index = as([TYPE, arr], value);\n for (const entry of value)\n arr.push(pair(entry));\n return index;\n }\n case OBJECT: {\n if (type) {\n switch (type) {\n case 'BigInt':\n return as([type, value.toString()], value);\n case 'Boolean':\n case 'Number':\n case 'String':\n return as([type, value.valueOf()], value);\n }\n }\n\n if (json && ('toJSON' in value))\n return pair(value.toJSON());\n\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const key of keys(value)) {\n if (strict || !shouldSkip(typeOf(value[key])))\n entries.push([pair(key), pair(value[key])]);\n }\n return index;\n }\n case DATE:\n return as([TYPE, value.toISOString()], value);\n case REGEXP: {\n const {source, flags} = value;\n return as([TYPE, {source, flags}], value);\n }\n case MAP: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const [key, entry] of value) {\n if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))\n entries.push([pair(key), pair(entry)]);\n }\n return index;\n }\n case SET: {\n const entries = [];\n const index = as([TYPE, entries], value);\n for (const entry of value) {\n if (strict || !shouldSkip(typeOf(entry)))\n entries.push(pair(entry));\n }\n return index;\n }\n }\n\n const {message} = value;\n return as([TYPE, {name: type, message}], value);\n };\n\n return pair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} value a serializable value.\n * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,\n * if `true`, will not throw errors on incompatible types, and behave more\n * like JSON stringify would behave. Symbol and Function will be discarded.\n * @returns {Record[]}\n */\n export const serialize = (value, {json, lossy} = {}) => {\n const _ = [];\n return serializer(!(json || lossy), !!json, new Map, _)(value), _;\n};\n","import {deserialize} from './deserialize.js';\nimport {serialize} from './serialize.js';\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} any a serializable value.\n * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with\n * a transfer option (ignored when polyfilled) and/or non standard fields that\n * fallback to the polyfill if present.\n * @returns {Record[]}\n */\nexport default typeof structuredClone === \"function\" ?\n /* c8 ignore start */\n (any, options) => (\n options && ('json' in options || 'lossy' in options) ?\n deserialize(serialize(any, options)) : structuredClone(any)\n ) :\n (any, options) => deserialize(serialize(any, options));\n /* c8 ignore stop */\n\nexport {deserialize, serialize};\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Parents} Parents\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is an element.\n * @param {unknown} this\n * Context object (`this`) to call `test` with\n * @param {unknown} [element]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | null | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean}\n * Whether this is an element and passes a test.\n *\n * @typedef {Array | TestFunction | string | null | undefined} Test\n * Check for an arbitrary element.\n *\n * * when `string`, checks that the element has that tag name\n * * when `function`, see `TestFunction`\n * * when `Array`, checks if one of the subtests pass\n *\n * @callback TestFunction\n * Check if an element passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Element} element\n * An element.\n * @param {number | undefined} [index]\n * Position of `element` in its parent.\n * @param {Parents | undefined} [parent]\n * Parent of `element`.\n * @returns {boolean | undefined | void}\n * Whether this element passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `element` is an `Element` and whether it passes the given test.\n *\n * @param element\n * Thing to check, typically `element`.\n * @param test\n * Check for a specific element.\n * @param index\n * Position of `element` in its parent.\n * @param parent\n * Parent of `element`.\n * @param context\n * Context object (`this`) to call `test` with.\n * @returns\n * Whether `element` is an `Element` and passes a test.\n * @throws\n * When an incorrect `test`, `index`, or `parent` is given; there is no error\n * thrown when `element` is not a node or not an element.\n */\nexport const isElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate) &\n * ((element: unknown, test: Condition, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((element?: null | undefined) => false) &\n * ((element: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((element: unknown, test?: Test, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [element]\n * @param {Test | undefined} [test]\n * @param {number | null | undefined} [index]\n * @param {Parents | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (element, test, index, parent, context) {\n const check = convertElement(test)\n\n if (\n index !== null &&\n index !== undefined &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite `index`')\n }\n\n if (\n parent !== null &&\n parent !== undefined &&\n (!parent.type || !parent.children)\n ) {\n throw new Error('Expected valid `parent`')\n }\n\n if (\n (index === null || index === undefined) !==\n (parent === null || parent === undefined)\n ) {\n throw new Error('Expected both `index` and `parent`')\n }\n\n return looksLikeAnElement(element)\n ? check.call(context, element, index, parent)\n : false\n }\n )\n\n/**\n * Generate a check from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * an `element`, `index`, and `parent`.\n *\n * @param test\n * A test for a specific element.\n * @returns\n * A check.\n */\nexport const convertElement =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate) &\n * ((test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) &\n * ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test | null | undefined} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return element\n }\n\n if (typeof test === 'string') {\n return tagNameFactory(test)\n }\n\n // Assume array.\n if (typeof test === 'object') {\n return anyFactory(test)\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n throw new Error('Expected function, string, or array as `test`')\n }\n )\n\n/**\n * Handle multiple tests.\n *\n * @param {Array} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convertElement(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn a string into a test for an element with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction tagNameFactory(check) {\n return castFactory(tagName)\n\n /**\n * @param {Element} element\n * @returns {boolean}\n */\n function tagName(element) {\n return element.tagName === check\n }\n}\n\n/**\n * Turn a custom test into a test for an element that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeAnElement(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\n/**\n * Make sure something is an element.\n *\n * @param {unknown} element\n * @returns {element is Element}\n */\nfunction element(element) {\n return Boolean(\n element &&\n typeof element === 'object' &&\n 'type' in element &&\n element.type === 'element' &&\n 'tagName' in element &&\n typeof element.tagName === 'string'\n )\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Element}\n */\nfunction looksLikeAnElement(value) {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'type' in value &&\n 'tagName' in value\n )\n}\n","// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/;\n\n// Windows paths like `c:\\`\nconst WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\\\/;\n\nexport default function isAbsoluteUrl(url) {\n\tif (typeof url !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof url}\\``);\n\t}\n\n\tif (WINDOWS_PATH_REGEX.test(url)) {\n\t\treturn false;\n\t}\n\n\treturn ABSOLUTE_URL_REGEX.test(url);\n}\n","/**\n * Parse space-separated tokens to an array of strings.\n *\n * @param {string} value\n * Space-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nexport function parse(value) {\n const input = String(value || '').trim()\n return input ? input.split(/[ \\t\\n\\r\\f]+/g) : []\n}\n\n/**\n * Serialize an array of strings as space separated-tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @returns {string}\n * Space-separated tokens.\n */\nexport function stringify(values) {\n return values.join(' ').trim()\n}\n","/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propsFactory(check) {\n const checkAsRecord = /** @type {Record} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor, Check>, Ancestor, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly} */\n let result = empty\n /** @type {Readonly} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate extends Value\n * ? Predicate\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array\n * ? MatchesOne\n * : MatchesOne\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent\n * | InternalAncestor, Max, Increment>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform `parent`.\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of `parent` still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n * Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n * Parent of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor>} BuildVisitorFromMatch\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n * Node type.\n * @template {UnistParent} Ancestor\n * Parent type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromMatch<\n * Matches,\n * Extract\n * >\n * )} BuildVisitorFromDescendants\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n * Node type.\n * @template {Test} Check\n * Test type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromDescendants<\n * InclusiveDescendant,\n * Check\n * >\n * )} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n * Node type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n * `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n * Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n /** @type {boolean | null | undefined} */\n let reverse\n /** @type {Test} */\n let test\n /** @type {Visitor} */\n let visitor\n\n if (\n typeof testOrVisitor === 'function' &&\n typeof visitorOrReverse !== 'function'\n ) {\n test = undefined\n visitor = testOrVisitor\n reverse = visitorOrReverse\n } else {\n // @ts-expect-error: assume the overload with test was given.\n test = testOrVisitor\n // @ts-expect-error: assume the overload with test was given.\n visitor = visitorOrReverse\n reverse = maybeReverse\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {UnistNode} node\n * @param {Array} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n const index = parent ? parent.children.indexOf(node) : undefined\n return visitor(node, index, parent)\n }\n}\n","/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Root} Root\n * @typedef {import('hast-util-is-element').Test} Test\n */\n\n/**\n * @callback CreateContent\n * Create a target for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Array | ElementContent | null | undefined}\n * Content to add.\n *\n * @callback CreateProperties\n * Create properties for an element.\n * @param {Element} element\n * Element to check.\n * @returns {Properties | null | undefined}\n * Properties to add.\n *\n * @callback CreateRel\n * Create a `rel` for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Array | string | null | undefined}\n * `rel` to use.\n *\n * @callback CreateTarget\n * Create a `target` for the element.\n * @param {Element} element\n * Element to check.\n * @returns {Target | null | undefined}\n * `target` to use.\n *\n * @typedef Options\n * Configuration.\n * @property {Array | CreateContent | ElementContent | null | undefined} [content]\n * Content to insert at the end of external links (optional); will be\n * inserted in a `` element; useful for improving accessibility by\n * giving users advanced warning when opening a new window.\n * @property {CreateProperties | Properties | null | undefined} [contentProperties]\n * Properties to add to the `span` wrapping `content` (optional).\n * @property {CreateProperties | Properties | null | undefined} [properties]\n * Properties to add to the link itself (optional).\n * @property {Array | null | undefined} [protocols=['http', 'https']]\n * Protocols to check, such as `mailto` or `tel` (default: `['http',\n * 'https']`).\n * @property {Array | CreateRel | string | null | undefined} [rel=['nofollow']]\n * Link types to hint about the referenced documents (default:\n * `['nofollow']`); pass an empty array (`[]`) to not set `rel`s on links;\n * when using a `target`, add `noopener` and `noreferrer` to avoid\n * exploitation of the `window.opener` API.\n * @property {CreateTarget | Target | null | undefined} [target]\n * How to display referenced documents; the default (nothing) is to not set\n * `target`s on links.\n * @property {Test | null | undefined} [test]\n * Extra test to define which external link elements are modified (optional);\n * any test that can be given to `hast-util-is-element` is supported.\n *\n * @typedef {'_blank' | '_parent' | '_self' | '_top'} Target\n * Target.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {convertElement} from 'hast-util-is-element'\nimport isAbsoluteUrl from 'is-absolute-url'\nimport {parse} from 'space-separated-tokens'\nimport {visit} from 'unist-util-visit'\n\nconst defaultProtocols = ['http', 'https']\nconst defaultRel = ['nofollow']\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Automatically add `rel` (and `target`?) to external links.\n *\n * ###### Notes\n *\n * You should [likely not configure `target`][css-tricks].\n *\n * You should at least set `rel` to `['nofollow']`.\n * When using a `target`, add `noopener` and `noreferrer` to avoid exploitation\n * of the `window.opener` API.\n *\n * When using a `target`, you should set `content` to adhere to accessibility\n * guidelines by giving users advanced warning when opening a new window.\n *\n * [css-tricks]: https://css-tricks.com/use-target_blank/\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns\n * Transform.\n */\nexport default function rehypeExternalLinks(options) {\n const settings = options || emptyOptions\n const protocols = settings.protocols || defaultProtocols\n const is = convertElement(settings.test)\n\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n visit(tree, 'element', function (node, index, parent) {\n if (\n node.tagName === 'a' &&\n typeof node.properties.href === 'string' &&\n is(node, index, parent)\n ) {\n const url = node.properties.href\n\n if (\n isAbsoluteUrl(url)\n ? protocols.includes(url.slice(0, url.indexOf(':')))\n : url.startsWith('//')\n ) {\n const contentRaw = createIfNeeded(settings.content, node)\n const content =\n contentRaw && !Array.isArray(contentRaw) ? [contentRaw] : contentRaw\n const relRaw = createIfNeeded(settings.rel, node) || defaultRel\n const rel = typeof relRaw === 'string' ? parse(relRaw) : relRaw\n const target = createIfNeeded(settings.target, node)\n\n const properties = createIfNeeded(settings.properties, node)\n\n if (properties) {\n Object.assign(node.properties, structuredClone(properties))\n }\n\n if (rel.length > 0) {\n node.properties.rel = [...rel]\n }\n\n if (target) {\n node.properties.target = target\n }\n\n if (content) {\n const properties =\n createIfNeeded(settings.contentProperties, node) || {}\n\n node.children.push({\n type: 'element',\n tagName: 'span',\n properties: structuredClone(properties),\n children: structuredClone(content)\n })\n }\n }\n }\n })\n }\n}\n\n/**\n * Call a function to get a return value or use the value.\n *\n * @template T\n * Type of value.\n * @param {T} value\n * Value.\n * @param {Element} element\n * Element.\n * @returns {T extends Function ? ReturnType : T}\n * Result.\n */\nfunction createIfNeeded(value, element) {\n return typeof value === 'function' ? value(element) : value\n}\n","/**\n * @typedef Options\n * Configuration for `stringify`.\n * @property {boolean} [padLeft=true]\n * Whether to pad a space before a token.\n * @property {boolean} [padRight=false]\n * Whether to pad a space after a token.\n */\n\n/**\n * @typedef {Options} StringifyOptions\n * Please use `StringifyOptions` instead.\n */\n\n/**\n * Parse comma-separated tokens to an array.\n *\n * @param {string} value\n * Comma-separated tokens.\n * @returns {Array}\n * List of tokens.\n */\nexport function parse(value) {\n /** @type {Array} */\n const tokens = []\n const input = String(value || '')\n let index = input.indexOf(',')\n let start = 0\n /** @type {boolean} */\n let end = false\n\n while (!end) {\n if (index === -1) {\n index = input.length\n end = true\n }\n\n const token = input.slice(start, index).trim()\n\n if (token || !end) {\n tokens.push(token)\n }\n\n start = index + 1\n index = input.indexOf(',', start)\n }\n\n return tokens\n}\n\n/**\n * Serialize an array of strings or numbers to comma-separated tokens.\n *\n * @param {Array} values\n * List of tokens.\n * @param {Options} [options]\n * Configuration for `stringify` (optional).\n * @returns {string}\n * Comma-separated tokens.\n */\nexport function stringify(values, options) {\n const settings = options || {}\n\n // Ensure the last empty entry is seen.\n const input = values[values.length - 1] === '' ? [...values, ''] : values\n\n return input\n .join(\n (settings.padRight ? ' ' : '') +\n ',' +\n (settings.padLeft === false ? '' : ' ')\n )\n .trim()\n}\n","/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [jsx=false]\n * Support JSX identifiers (default: `false`).\n */\n\nconst startRe = /[$_\\p{ID_Start}]/u\nconst contRe = /[$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst contReJsx = /[-$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst nameRe = /^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\nconst nameReJsx = /^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Checks if the given code point can start an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @returns {boolean}\n * Whether `code` can start an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function start(code) {\n return code ? startRe.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given code point can continue an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `code` can continue an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function cont(code, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? contReJsx : contRe\n return code ? re.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given value is a valid identifier name.\n *\n * @param {string} name\n * Identifier to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `name` can be an identifier.\n */\nexport function name(name, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? nameReJsx : nameRe\n return re.test(name)\n}\n","/**\n * @typedef {import('hast').Nodes} Nodes\n */\n\n// HTML whitespace expression.\n// See .\nconst re = /[ \\t\\n\\f\\r]/g\n\n/**\n * Check if the given value is *inter-element whitespace*.\n *\n * @param {Nodes | string} thing\n * Thing to check (`Node` or `string`).\n * @returns {boolean}\n * Whether the `value` is inter-element whitespace (`boolean`): consisting of\n * zero or more of space, tab (`\\t`), line feed (`\\n`), carriage return\n * (`\\r`), or form feed (`\\f`); if a node is passed it must be a `Text` node,\n * whose `value` field is checked.\n */\nexport function whitespace(thing) {\n return typeof thing === 'object'\n ? thing.type === 'text'\n ? empty(thing.value)\n : false\n : empty(thing)\n}\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nfunction empty(value) {\n return value.replace(re, '') === ''\n}\n","/**\n * @import {Schema as SchemaType, Space} from 'property-information'\n */\n\n/** @type {SchemaType} */\nexport class Schema {\n /**\n * @param {SchemaType['property']} property\n * Property.\n * @param {SchemaType['normal']} normal\n * Normal.\n * @param {Space | undefined} [space]\n * Space.\n * @returns\n * Schema.\n */\n constructor(property, normal, space) {\n this.normal = normal\n this.property = property\n\n if (space) {\n this.space = space\n }\n }\n}\n\nSchema.prototype.normal = {}\nSchema.prototype.property = {}\nSchema.prototype.space = undefined\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {ReadonlyArray} definitions\n * Definitions.\n * @param {Space | undefined} [space]\n * Space.\n * @returns {Schema}\n * Schema.\n */\nexport function merge(definitions, space) {\n /** @type {Record} */\n const property = {}\n /** @type {Record} */\n const normal = {}\n\n for (const definition of definitions) {\n Object.assign(property, definition.property)\n Object.assign(normal, definition.normal)\n }\n\n return new Schema(property, normal, space)\n}\n","/**\n * Get the cleaned case insensitive form of an attribute or property.\n *\n * @param {string} value\n * An attribute-like or property-like name.\n * @returns {string}\n * Value that can be used to look up the properly cased property on a\n * `Schema`.\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n","/**\n * @import {Info as InfoType} from 'property-information'\n */\n\n/** @type {InfoType} */\nexport class Info {\n /**\n * @param {string} property\n * Property.\n * @param {string} attribute\n * Attribute.\n * @returns\n * Info.\n */\n constructor(property, attribute) {\n this.attribute = attribute\n this.property = property\n }\n}\n\nInfo.prototype.attribute = ''\nInfo.prototype.booleanish = false\nInfo.prototype.boolean = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.defined = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.number = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.property = ''\nInfo.prototype.spaceSeparated = false\nInfo.prototype.space = undefined\n","let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n","/**\n * @import {Space} from 'property-information'\n */\n\nimport {Info} from './info.js'\nimport * as types from './types.js'\n\nconst checks = /** @type {ReadonlyArray} */ (\n Object.keys(types)\n)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * Property.\n * @param {string} attribute\n * Attribute.\n * @param {number | null | undefined} [mask]\n * Mask.\n * @param {Space | undefined} [space]\n * Space.\n * @returns\n * Info.\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @template {keyof DefinedInfo} Key\n * Key type.\n * @param {DefinedInfo} values\n * Info.\n * @param {Key} key\n * Key.\n * @param {DefinedInfo[Key]} value\n * Value.\n * @returns {undefined}\n * Nothing.\n */\nfunction mark(values, key, value) {\n if (value) {\n values[key] = value\n }\n}\n","/**\n * @import {Info, Space} from 'property-information'\n */\n\n/**\n * @typedef Definition\n * Definition of a schema.\n * @property {Record | undefined} [attributes]\n * Normalzed names to special attribute case.\n * @property {ReadonlyArray | undefined} [mustUseProperty]\n * Normalized names that must be set as properties.\n * @property {Record} properties\n * Property names to their types.\n * @property {Space | undefined} [space]\n * Space.\n * @property {Transform} transform\n * Transform a property name.\n */\n\n/**\n * @callback Transform\n * Transform.\n * @param {Record} attributes\n * Attributes.\n * @param {string} property\n * Property.\n * @returns {string}\n * Attribute.\n */\n\nimport {normalize} from '../normalize.js'\nimport {DefinedInfo} from './defined-info.js'\nimport {Schema} from './schema.js'\n\n/**\n * @param {Definition} definition\n * Definition.\n * @returns {Schema}\n * Schema.\n */\nexport function create(definition) {\n /** @type {Record} */\n const properties = {}\n /** @type {Record} */\n const normals = {}\n\n for (const [property, value] of Object.entries(definition.properties)) {\n const info = new DefinedInfo(\n property,\n definition.transform(definition.attributes || {}, property),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(property)\n ) {\n info.mustUseProperty = true\n }\n\n properties[property] = info\n\n normals[normalize(property)] = property\n normals[normalize(info.attribute)] = property\n }\n\n return new Schema(properties, normals, definition.space)\n}\n","import {create} from './util/create.js'\nimport {booleanish, number, spaceSeparated} from './util/types.js'\n\nexport const aria = create({\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n },\n transform(_, property) {\n return property === 'role'\n ? property\n : 'aria-' + property.slice(4).toLowerCase()\n }\n})\n","/**\n * @param {Record} attributes\n * Attributes.\n * @param {string} attribute\n * Attribute.\n * @returns {string}\n * Transformed attribute.\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n","import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * Attributes.\n * @param {string} property\n * Property.\n * @returns {string}\n * Transformed property.\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n","import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\nimport {create} from './util/create.js'\nimport {\n booleanish,\n boolean,\n commaSeparated,\n number,\n overloadedBoolean,\n spaceSeparated\n} from './util/types.js'\n\nexport const html = create({\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n blocking: spaceSeparated,\n capture: null,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n fetchPriority: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: overloadedBoolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inert: boolean,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeToggle: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n popover: null,\n popoverTarget: null,\n popoverTargetAction: null,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shadowRootClonable: boolean,\n shadowRootDelegatesFocus: boolean,\n shadowRootMode: null,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n writingSuggestions: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code);\n buffer = '';\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === 62) {\n const name = buffer.toLowerCase();\n if (htmlRawNames.includes(name)) {\n effects.consume(code);\n return continuationClose;\n }\n return continuation(code);\n }\n if (asciiAlpha(code) && buffer.length < 8) {\n // Always the case.\n effects.consume(code);\n buffer += String.fromCharCode(code);\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === 93) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code);\n return continuationClose;\n }\n\n // More dashes.\n if (code === 45 && marker === 2) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"htmlFlowData\");\n return continuationAfter(code);\n }\n effects.consume(code);\n return continuationClose;\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(\"htmlFlow\");\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start;\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return effects.attempt(blankLine, ok, nok);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable | undefined} */\n let marker;\n /** @type {number} */\n let index;\n /** @type {State} */\n let returnState;\n return start;\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"htmlText\");\n effects.enter(\"htmlTextData\");\n effects.consume(code);\n return open;\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 33) {\n effects.consume(code);\n return declarationOpen;\n }\n if (code === 47) {\n effects.consume(code);\n return tagCloseStart;\n }\n if (code === 63) {\n effects.consume(code);\n return instruction;\n }\n\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagOpen;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code);\n return commentOpenInside;\n }\n if (code === 91) {\n effects.consume(code);\n index = 0;\n return cdataOpenInside;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return declaration;\n }\n return nok(code);\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return nok(code);\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 45) {\n effects.consume(code);\n return commentClose;\n }\n if (markdownLineEnding(code)) {\n returnState = comment;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return comment;\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return comment(code);\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = \"CDATA[\";\n if (code === value.charCodeAt(index++)) {\n effects.consume(code);\n return index === value.length ? cdata : cdataOpenInside;\n }\n return nok(code);\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataClose;\n }\n if (markdownLineEnding(code)) {\n returnState = cdata;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return cdata;\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === 62) {\n return end(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code);\n }\n if (markdownLineEnding(code)) {\n returnState = declaration;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return declaration;\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 63) {\n effects.consume(code);\n return instructionClose;\n }\n if (markdownLineEnding(code)) {\n returnState = instruction;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return instruction;\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagClose;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagClose;\n }\n return tagCloseBetween(code);\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagCloseBetween;\n }\n return end(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpen;\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code);\n return end;\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenBetween;\n }\n return end(code);\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n return tagOpenAttributeNameAfter(code);\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeNameAfter;\n }\n return tagOpenBetween(code);\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n return nok(code);\n }\n if (code === 34 || code === 39) {\n effects.consume(code);\n marker = code;\n return tagOpenAttributeValueQuoted;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code);\n marker = undefined;\n return tagOpenAttributeValueQuotedAfter;\n }\n if (code === null) {\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueQuoted;\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n return nok(code);\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === 62) {\n effects.consume(code);\n effects.exit(\"htmlTextData\");\n effects.exit(\"htmlText\");\n return ok;\n }\n return nok(code);\n }\n\n /**\n * At eol.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n effects.exit(\"htmlTextData\");\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return lineEndingAfter;\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n\n return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(\"htmlTextData\");\n return returnState(code);\n }\n}","/**\n * @import {\n * Construct,\n * Event,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer,\n * Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n resolveAll: resolveAllLabelEnd,\n resolveTo: resolveToLabelEnd,\n tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1;\n /** @type {Array} */\n const newEvents = [];\n while (++index < events.length) {\n const token = events[index][1];\n newEvents.push(events[index]);\n if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n // Remove the marker.\n const offset = token.type === \"labelImage\" ? 4 : 2;\n token.type = \"data\";\n index += offset;\n }\n }\n\n // If the events are equal, we don't have to copy newEvents to events\n if (events.length !== newEvents.length) {\n splice(events, 0, events.length, newEvents);\n }\n return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length;\n let offset = 0;\n /** @type {Token} */\n let token;\n /** @type {number | undefined} */\n let open;\n /** @type {number | undefined} */\n let close;\n /** @type {Array} */\n let media;\n\n // Find an opening.\n while (index--) {\n token = events[index][1];\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n break;\n }\n\n // Mark other link openings as inactive, as we can’t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n token._inactive = true;\n }\n } else if (close) {\n if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n open = index;\n if (token.type !== \"labelLink\") {\n offset = 2;\n break;\n }\n }\n } else if (token.type === \"labelEnd\") {\n close = index;\n }\n }\n const group = {\n type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n const label = {\n type: \"label\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[close][1].end\n }\n };\n const text = {\n type: \"labelText\",\n start: {\n ...events[open + offset + 2][1].end\n },\n end: {\n ...events[close - 2][1].start\n }\n };\n media = [['enter', group, context], ['enter', label, context]];\n\n // Opening marker.\n media = push(media, events.slice(open + 1, open + offset + 3));\n\n // Text open.\n media = push(media, [['enter', text, context]]);\n\n // Always populated by defaults.\n\n // Between.\n media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n // Text close, marker close, label close.\n media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n // Reference, resource, or so.\n media = push(media, events.slice(close + 1));\n\n // Media close.\n media = push(media, [['exit', group, context]]);\n splice(events, open, events.length, media);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n /** @type {Token} */\n let labelStart;\n /** @type {boolean} */\n let defined;\n\n // Find an opening.\n while (index--) {\n if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n labelStart = self.events[index][1];\n break;\n }\n }\n return start;\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code);\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we’d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can’t have that, so it’s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code);\n }\n defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })));\n effects.enter(\"labelEnd\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelEnd\");\n return after;\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === 40) {\n return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code);\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code);\n }\n\n /**\n * Done, it’s nothing.\n *\n * There was an okay opening, but we didn’t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true;\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart;\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n effects.enter(\"resource\");\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n return resourceBefore;\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === 41) {\n return resourceEnd(code);\n }\n return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code);\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n }\n return resourceEnd(code);\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === 41) {\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n effects.exit(\"resource\");\n return ok;\n }\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this;\n return referenceFull;\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart;\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there’s a `[`.\n\n effects.enter(\"reference\");\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n return referenceCollapsedOpen;\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === 93) {\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n effects.exit(\"reference\");\n return ok;\n }\n return nok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelImage\");\n effects.enter(\"labelImageMarker\");\n effects.consume(code);\n effects.exit(\"labelImageMarker\");\n return open;\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 91) {\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelImage\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn’t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelLink\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelLink\");\n return after;\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start;\n\n /** @type {State} */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return factorySpace(effects, ok, \"linePrefix\");\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"thematicBreak\");\n // To do: parse indent like `markdown-rs`.\n return before(code);\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n marker = code;\n return atBreak(code);\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(\"thematicBreakSequence\");\n return sequence(code);\n }\n if (size >= 3 && (code === null || markdownLineEnding(code))) {\n effects.exit(\"thematicBreak\");\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code);\n size++;\n return sequence;\n }\n effects.exit(\"thematicBreakSequence\");\n return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Exiter,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd,\n name: 'list',\n tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n partial: true,\n tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n partial: true,\n tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this;\n const tail = self.events[self.events.length - 1];\n let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n if (!self.containerState.type) {\n self.containerState.type = kind;\n effects.enter(kind, {\n _container: true\n });\n }\n if (kind === \"listUnordered\") {\n effects.enter(\"listItemPrefix\");\n return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n }\n if (!self.interrupt || code === 49) {\n effects.enter(\"listItemPrefix\");\n effects.enter(\"listItemValue\");\n return inside(code);\n }\n }\n return nok(code);\n }\n\n /** @type {State} */\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code);\n return inside;\n }\n if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n effects.exit(\"listItemValue\");\n return atMarker(code);\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n effects.enter(\"listItemMarker\");\n effects.consume(code);\n effects.exit(\"listItemMarker\");\n self.containerState.marker = self.containerState.marker || code;\n return effects.check(blankLine,\n // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n }\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.initialBlankLine = true;\n initialSize++;\n return endOfPrefix(code);\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter(\"listItemPrefixWhitespace\");\n effects.consume(code);\n effects.exit(\"listItemPrefixWhitespace\");\n return endOfPrefix;\n }\n return nok(code);\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this;\n self.containerState._closeFlow = undefined;\n return effects.check(blankLine, onBlank, notBlank);\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n }\n\n /** @type {State} */\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return notInCurrentItem(code);\n }\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true;\n // As we’re closing flow, we’re no longer interrupting.\n self.interrupt = undefined;\n // Always populated by defaults.\n\n return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this;\n\n // Always populated by defaults.\n\n return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n resolveTo: resolveToSetextUnderline,\n tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length;\n /** @type {number | undefined} */\n let content;\n /** @type {number | undefined} */\n let text;\n /** @type {number | undefined} */\n let definition;\n\n // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === \"content\") {\n content = index;\n break;\n }\n if (events[index][1].type === \"paragraph\") {\n text = index;\n }\n }\n // Exit\n else {\n if (events[index][1].type === \"content\") {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1);\n }\n if (!definition && events[index][1].type === \"definition\") {\n definition = index;\n }\n }\n }\n const heading = {\n type: \"setextHeading\",\n start: {\n ...events[content][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n\n // Change the paragraph to setext heading text.\n events[text][1].type = \"setextHeadingText\";\n\n // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context]);\n events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n events[content][1].end = {\n ...events[definition][1].end\n };\n } else {\n events[content][1] = heading;\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context]);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length;\n /** @type {boolean | undefined} */\n let paragraph;\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n paragraph = self.events[index][1].type === \"paragraph\";\n break;\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(\"setextHeadingLine\");\n marker = code;\n return before(code);\n }\n return nok(code);\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(\"setextHeadingLineSequence\");\n return inside(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code);\n return inside;\n }\n effects.exit(\"setextHeadingLineSequence\");\n return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"setextHeadingLine\");\n return ok(code);\n }\n return nok(code);\n }\n}","/**\n * @import {\n * InitialConstruct,\n * Initializer,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n * Self.\n * @type {Initializer}\n * Initializer.\n */\nfunction initializeFlow(effects) {\n const self = this;\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine, atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n return initial;\n\n /** @type {State} */\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEndingBlank\");\n effects.consume(code);\n effects.exit(\"lineEndingBlank\");\n self.currentConstruct = undefined;\n return initial;\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n self.currentConstruct = undefined;\n return initial;\n }\n}","/**\n * @import {\n * Code,\n * InitialConstruct,\n * Initializer,\n * Resolver,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n * Field.\n * @returns {InitialConstruct}\n * Construct.\n */\nfunction initializeFactory(field) {\n return {\n resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n tokenize: initializeText\n };\n\n /**\n * @this {TokenizeContext}\n * Context.\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this;\n const constructs = this.parser.constructs[field];\n const text = effects.attempt(constructs, start, notText);\n return start;\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code);\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"data\");\n effects.consume(code);\n return data;\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(\"data\");\n return text(code);\n }\n\n // Data.\n effects.consume(code);\n return data;\n }\n\n /**\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether the code is a break.\n */\n function atBreak(code) {\n if (code === null) {\n return true;\n }\n const list = constructs[code];\n let index = -1;\n if (list) {\n // Always populated by defaults.\n\n while (++index < list.length) {\n const item = list[index];\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * Resolver.\n * @returns {Resolver}\n * Resolver.\n */\nfunction createResolver(extraResolver) {\n return resolveAllText;\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1;\n /** @type {number | undefined} */\n let enter;\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === \"data\") {\n enter = index;\n index++;\n }\n } else if (!events[index] || events[index][1].type !== \"data\") {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end;\n events.splice(enter + 2, index - enter - 2);\n index = enter + 2;\n }\n enter = undefined;\n }\n }\n return extraResolver ? extraResolver(events, context) : events;\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0; // Skip first.\n\n while (++eventIndex <= events.length) {\n if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n const data = events[eventIndex - 1][1];\n const chunks = context.sliceStream(data);\n let index = chunks.length;\n let bufferIndex = -1;\n let size = 0;\n /** @type {boolean | undefined} */\n let tabs;\n while (index--) {\n const chunk = chunks[index];\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length;\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++;\n bufferIndex--;\n }\n if (bufferIndex) break;\n bufferIndex = -1;\n }\n // Number\n else if (chunk === -2) {\n tabs = true;\n size++;\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++;\n break;\n }\n }\n\n // Allow final trailing whitespace.\n if (context._contentTypeTextTrailing && eventIndex === events.length) {\n size = 0;\n }\n if (size) {\n const token = {\n type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n start: {\n _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n _index: data.start._index + index,\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size\n },\n end: {\n ...data.end\n }\n };\n data.end = {\n ...token.start\n };\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token);\n } else {\n events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n eventIndex += 2;\n }\n }\n eventIndex++;\n }\n }\n return events;\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n null: []\n};","/**\n * @import {\n * Chunk,\n * Code,\n * ConstructRecord,\n * Construct,\n * Effects,\n * InitialConstruct,\n * ParseContext,\n * Point,\n * State,\n * TokenizeContext,\n * Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n * Restore the state.\n * @returns {undefined}\n * Nothing.\n *\n * @typedef Info\n * Info.\n * @property {Restore} restore\n * Restore.\n * @property {number} from\n * From.\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * Construct.\n * @param {Info} info\n * Info.\n * @returns {undefined}\n * Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * Parser.\n * @param {InitialConstruct} initialize\n * Construct.\n * @param {Omit | undefined} [from]\n * Point (optional).\n * @returns {TokenizeContext}\n * Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = {\n _bufferIndex: -1,\n _index: 0,\n line: from && from.line || 1,\n column: from && from.column || 1,\n offset: from && from.offset || 0\n };\n /** @type {Record} */\n const columnStart = {};\n /** @type {Array} */\n const resolveAllConstructs = [];\n /** @type {Array} */\n let chunks = [];\n /** @type {Array} */\n let stack = [];\n /** @type {boolean | undefined} */\n let consumed = true;\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n consume,\n enter,\n exit,\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n };\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n code: null,\n containerState: {},\n defineSkip,\n events: [],\n now,\n parser,\n previous: null,\n sliceSerialize,\n sliceStream,\n write\n };\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects);\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode;\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize);\n }\n return context;\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = push(chunks, slice);\n main();\n\n // Exit if we’re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== null) {\n return [];\n }\n addResult(initialize, 0);\n\n // Otherwise, resolve, and exit.\n context.events = resolveAll(resolveAllConstructs, context.events, context);\n return context.events;\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs);\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token);\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n } = point;\n return {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n };\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column;\n accountForPotentialSkip();\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n * Nothing.\n */\n function main() {\n /** @type {number} */\n let chunkIndex;\n while (point._index < chunks.length) {\n const chunk = chunks[point._index];\n\n // If we’re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index;\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0;\n }\n while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n go(chunk.charCodeAt(point._bufferIndex));\n }\n } else {\n go(chunk);\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * Code.\n * @returns {undefined}\n * Nothing.\n */\n function go(code) {\n consumed = undefined;\n expectedCode = code;\n state = state(code);\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++;\n point.column = 1;\n point.offset += code === -3 ? 2 : 1;\n accountForPotentialSkip();\n } else if (code !== -1) {\n point.column++;\n point.offset++;\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++;\n } else {\n point._bufferIndex++;\n\n // At end of string chunk.\n if (point._bufferIndex ===\n // Points w/ non-negative `_bufferIndex` reference\n // strings.\n /** @type {string} */\n chunks[point._index].length) {\n point._bufferIndex = -1;\n point._index++;\n }\n }\n\n // Expose the previous character.\n context.previous = code;\n\n // Mark as consumed.\n consumed = true;\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {};\n token.type = type;\n token.start = now();\n context.events.push(['enter', token, context]);\n stack.push(token);\n return token;\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n const token = stack.pop();\n token.end = now();\n context.events.push(['exit', token, context]);\n return token;\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from);\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore();\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * Callback.\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n * Fields.\n */\n function constructFactory(onreturn, fields) {\n return hook;\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | ConstructRecord | Construct} constructs\n * Constructs.\n * @param {State} returnState\n * State.\n * @param {State | undefined} [bogusState]\n * State.\n * @returns {State}\n * State.\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {ReadonlyArray} */\n let listOfConstructs;\n /** @type {number} */\n let constructIndex;\n /** @type {Construct} */\n let currentConstruct;\n /** @type {Info} */\n let info;\n return Array.isArray(constructs) ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n // Looks like a construct.\n handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleMapOfConstructs(map) {\n return start;\n\n /** @type {State} */\n function start(code) {\n const left = code !== null && map[code];\n const all = code !== null && map.null;\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n return handleListOfConstructs(list)(code);\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {ReadonlyArray} list\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list;\n constructIndex = 0;\n if (list.length === 0) {\n return bogusState;\n }\n return handleConstruct(list[constructIndex]);\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * Construct.\n * @returns {State}\n * State.\n */\n function handleConstruct(construct) {\n return start;\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store();\n currentConstruct = construct;\n if (!construct.partial) {\n context.currentConstruct = construct;\n }\n\n // Always populated by defaults.\n\n if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n return nok(code);\n }\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n }\n }\n\n /** @type {State} */\n function ok(code) {\n consumed = true;\n onreturn(currentConstruct, info);\n return returnState;\n }\n\n /** @type {State} */\n function nok(code) {\n consumed = true;\n info.restore();\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex]);\n }\n return bogusState;\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * Construct.\n * @param {number} from\n * From.\n * @returns {undefined}\n * Nothing.\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct);\n }\n if (construct.resolve) {\n splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n }\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context);\n }\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n * Info.\n */\n function store() {\n const startPoint = now();\n const startPrevious = context.previous;\n const startCurrentConstruct = context.currentConstruct;\n const startEventsIndex = context.events.length;\n const startStack = Array.from(stack);\n return {\n from: startEventsIndex,\n restore\n };\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n * Nothing.\n */\n function restore() {\n point = startPoint;\n context.previous = startPrevious;\n context.currentConstruct = startCurrentConstruct;\n context.events.length = startEventsIndex;\n stack = startStack;\n accountForPotentialSkip();\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {undefined}\n * Nothing.\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line];\n point.offset += columnStart[point.line] - 1;\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {Pick} token\n * Token.\n * @returns {Array}\n * Chunks.\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index;\n const startBufferIndex = token.start._bufferIndex;\n const endIndex = token.end._index;\n const endBufferIndex = token.end._bufferIndex;\n /** @type {Array} */\n let view;\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n } else {\n view = chunks.slice(startIndex, endIndex);\n if (startBufferIndex > -1) {\n const head = view[0];\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex);\n /* c8 ignore next 4 -- used to be used, no longer */\n } else {\n view.shift();\n }\n }\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex));\n }\n }\n return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n * Whether to expand tabs (default: `false`).\n * @returns {string}\n * Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1;\n /** @type {Array} */\n const result = [];\n /** @type {boolean | undefined} */\n let atTab;\n while (++index < chunks.length) {\n const chunk = chunks[index];\n /** @type {string} */\n let value;\n if (typeof chunk === 'string') {\n value = chunk;\n } else switch (chunk) {\n case -5:\n {\n value = \"\\r\";\n break;\n }\n case -4:\n {\n value = \"\\n\";\n break;\n }\n case -3:\n {\n value = \"\\r\" + \"\\n\";\n break;\n }\n case -2:\n {\n value = expandTabs ? \" \" : \"\\t\";\n break;\n }\n case -1:\n {\n if (!expandTabs && atTab) continue;\n value = \" \";\n break;\n }\n default:\n {\n // Currently only replacement character.\n value = String.fromCharCode(chunk);\n }\n }\n atTab = chunk === -2;\n result.push(value);\n }\n return result.join('');\n}","/**\n * @import {\n * Create,\n * FullNormalizedExtension,\n * InitialConstruct,\n * ParseContext,\n * ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ParseContext}\n * Parser.\n */\nexport function parse(options) {\n const settings = options || {};\n const constructs = /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n /** @type {ParseContext} */\n const parser = {\n constructs,\n content: create(content),\n defined: [],\n document: create(document),\n flow: create(flow),\n lazy: {},\n string: create(string),\n text: create(text)\n };\n return parser;\n\n /**\n * @param {InitialConstruct} initial\n * Construct to start with.\n * @returns {Create}\n * Create a tokenizer.\n */\n function create(initial) {\n return creator;\n /** @type {Create} */\n function creator(from) {\n return createTokenizer(parser, initial, from);\n }\n }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array} events\n * Events.\n * @returns {Array}\n * Events.\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events;\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n * Preprocess a value.\n * @param {Value} value\n * Value.\n * @param {Encoding | null | undefined} [encoding]\n * Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n * Whether this is the last chunk (default: `false`).\n * @returns {Array}\n * Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n * Preprocess a value.\n */\nexport function preprocess() {\n let column = 1;\n let buffer = '';\n /** @type {boolean | undefined} */\n let start = true;\n /** @type {boolean | undefined} */\n let atCarriageReturn;\n return preprocessor;\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = [];\n /** @type {RegExpMatchArray | null} */\n let match;\n /** @type {number} */\n let next;\n /** @type {number} */\n let startPosition;\n /** @type {number} */\n let endPosition;\n /** @type {Code} */\n let code;\n value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n startPosition = 0;\n buffer = '';\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === 65279) {\n startPosition++;\n }\n start = undefined;\n }\n while (startPosition < value.length) {\n search.lastIndex = startPosition;\n match = search.exec(value);\n endPosition = match && match.index !== undefined ? match.index : value.length;\n code = value.charCodeAt(endPosition);\n if (!match) {\n buffer = value.slice(startPosition);\n break;\n }\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3);\n atCarriageReturn = undefined;\n } else {\n if (atCarriageReturn) {\n chunks.push(-5);\n atCarriageReturn = undefined;\n }\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition));\n column += endPosition - startPosition;\n }\n switch (code) {\n case 0:\n {\n chunks.push(65533);\n column++;\n break;\n }\n case 9:\n {\n next = Math.ceil(column / 4) * 4;\n chunks.push(-2);\n while (column++ < next) chunks.push(-1);\n break;\n }\n case 10:\n {\n chunks.push(-4);\n column = 1;\n break;\n }\n default:\n {\n atCarriageReturn = true;\n column = 1;\n }\n }\n }\n startPosition = endPosition + 1;\n }\n if (end) {\n if (atCarriageReturn) chunks.push(-5);\n if (buffer) chunks.push(buffer);\n chunks.push(null);\n }\n return chunks;\n }\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {\n * Break,\n * Blockquote,\n * Code,\n * Definition,\n * Emphasis,\n * Heading,\n * Html,\n * Image,\n * InlineCode,\n * Link,\n * ListItem,\n * List,\n * Nodes,\n * Paragraph,\n * PhrasingContent,\n * ReferenceType,\n * Root,\n * Strong,\n * Text,\n * ThematicBreak\n * } from 'mdast'\n * @import {\n * Encoding,\n * Event,\n * Token,\n * Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n * CompileContext,\n * CompileData,\n * Config,\n * Extension,\n * Handle,\n * OnEnterError,\n * Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n * Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n * Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {Root}\n * mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding;\n encoding = undefined;\n }\n return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n /** @type {Config} */\n const config = {\n transforms: [],\n canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n characterReference: onexitcharacterreference,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n };\n configure(config, (options || {}).mdastExtensions || []);\n\n /** @type {CompileData} */\n const data = {};\n return compile;\n\n /**\n * Turn micromark events into an mdast tree.\n *\n * @param {Array} events\n * Events.\n * @returns {Root}\n * mdast tree.\n */\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n };\n /** @type {Omit} */\n const context = {\n stack: [tree],\n tokenStack: [],\n config,\n enter,\n exit,\n buffer,\n resume,\n data\n };\n /** @type {Array} */\n const listStack = [];\n let index = -1;\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n if (events[index][0] === 'enter') {\n listStack.push(index);\n } else {\n const tail = listStack.pop();\n index = prepareList(events, tail, index);\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n const handler = config[events[index][0]];\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(Object.assign({\n sliceSerialize: events[index][2].sliceSerialize\n }, context), events[index][1]);\n }\n }\n\n // Handle tokens still being open.\n if (context.tokenStack.length > 0) {\n const tail = context.tokenStack[context.tokenStack.length - 1];\n const handler = tail[1] || defaultOnError;\n handler.call(context, undefined, tail[0]);\n }\n\n // Figure out `root` position.\n tree.position = {\n start: point(events.length > 0 ? events[0][1].start : {\n line: 1,\n column: 1,\n offset: 0\n }),\n end: point(events.length > 0 ? events[events.length - 2][1].end : {\n line: 1,\n column: 1,\n offset: 0\n })\n };\n\n // Call transforms.\n index = -1;\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree;\n }\n return tree;\n }\n\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n function prepareList(events, start, length) {\n let index = start - 1;\n let containerBalance = -1;\n let listSpread = false;\n /** @type {Token | undefined} */\n let listItem;\n /** @type {number | undefined} */\n let lineIndex;\n /** @type {number | undefined} */\n let firstBlankLineIndex;\n /** @type {boolean | undefined} */\n let atMarker;\n while (++index <= length) {\n const event = events[index];\n switch (event[1].type) {\n case \"listUnordered\":\n case \"listOrdered\":\n case \"blockQuote\":\n {\n if (event[0] === 'enter') {\n containerBalance++;\n } else {\n containerBalance--;\n }\n atMarker = undefined;\n break;\n }\n case \"lineEndingBlank\":\n {\n if (event[0] === 'enter') {\n if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n firstBlankLineIndex = index;\n }\n atMarker = undefined;\n }\n break;\n }\n case \"linePrefix\":\n case \"listItemValue\":\n case \"listItemMarker\":\n case \"listItemPrefix\":\n case \"listItemPrefixWhitespace\":\n {\n // Empty.\n\n break;\n }\n default:\n {\n atMarker = undefined;\n }\n }\n if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n if (listItem) {\n let tailIndex = index;\n lineIndex = undefined;\n while (tailIndex--) {\n const tailEvent = events[tailIndex];\n if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n if (tailEvent[0] === 'exit') continue;\n if (lineIndex) {\n events[lineIndex][1].type = \"lineEndingBlank\";\n listSpread = true;\n }\n tailEvent[1].type = \"lineEnding\";\n lineIndex = tailIndex;\n } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n // Empty\n } else {\n break;\n }\n }\n if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n listItem._spread = true;\n }\n\n // Fix position.\n listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n index++;\n length++;\n }\n\n // Create a new list item.\n if (event[1].type === \"listItemPrefix\") {\n /** @type {Token} */\n const item = {\n type: 'listItem',\n _spread: false,\n start: Object.assign({}, event[1].start),\n // @ts-expect-error: we’ll add `end` in a second.\n end: undefined\n };\n listItem = item;\n events.splice(index, 0, ['enter', item, event[2]]);\n index++;\n length++;\n firstBlankLineIndex = undefined;\n atMarker = true;\n }\n }\n }\n events[start][1]._spread = listSpread;\n return length;\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Nodes} create\n * Create a node.\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function opener(create, and) {\n return open;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function open(token) {\n enter.call(this, create(token), token);\n if (and) and.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['buffer']}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n });\n }\n\n /**\n * @type {CompileContext['enter']}\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = parent.children;\n siblings.push(node);\n this.stack.push(node);\n this.tokenStack.push([token, errorHandler || undefined]);\n node.position = {\n start: point(token.start),\n // @ts-expect-error: `end` will be patched later.\n end: undefined\n };\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function closer(and) {\n return close;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function close(token) {\n if (and) and.call(this, token);\n exit.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['exit']}\n */\n function exit(token, onExitError) {\n const node = this.stack.pop();\n const open = this.tokenStack.pop();\n if (!open) {\n throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n start: token.start,\n end: token.end\n }) + '): it’s not open');\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0]);\n } else {\n const handler = open[1] || defaultOnError;\n handler.call(this, token, open[0]);\n }\n }\n node.position.end = point(token.end);\n }\n\n /**\n * @type {CompileContext['resume']}\n */\n function resume() {\n return toString(this.stack.pop());\n }\n\n //\n // Handlers.\n //\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistordered() {\n this.data.expectingFirstListItemValue = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (this.data.expectingFirstListItemValue) {\n const ancestor = this.stack[this.stack.length - 2];\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n this.data.expectingFirstListItemValue = undefined;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfenceinfo() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.lang = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfencemeta() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.meta = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (this.data.flowCodeInside) return;\n this.buffer();\n this.data.flowCodeInside = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefenced() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n this.data.flowCodeInside = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodeindented() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitionlabelstring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.label = label;\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiontitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiondestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitatxheadingsequence(token) {\n const node = this.stack[this.stack.length - 1];\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length;\n node.depth = depth;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadingtext() {\n this.data.setextHeadingSlurpLineEnding = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadinglinesequence(token) {\n const node = this.stack[this.stack.length - 1];\n node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n this.data.setextHeadingSlurpLineEnding = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterdata(token) {\n const node = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = node.children;\n let tail = siblings[siblings.length - 1];\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text();\n tail.position = {\n start: point(token.start),\n // @ts-expect-error: we’ll add `end` later.\n end: undefined\n };\n siblings.push(tail);\n }\n this.stack.push(tail);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitdata(token) {\n const tail = this.stack.pop();\n tail.value += this.sliceSerialize(token);\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1];\n // If we’re at a hard break, include the line ending in there.\n if (this.data.atHardBreak) {\n const tail = context.children[context.children.length - 1];\n tail.position.end = point(token.end);\n this.data.atHardBreak = undefined;\n return;\n }\n if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n onenterdata.call(this, token);\n onexitdata.call(this, token);\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithardbreak() {\n this.data.atHardBreak = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmlflow() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmltext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcodetext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlink() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitimage() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabeltext(token) {\n const string = this.sliceSerialize(token);\n const ancestor = this.stack[this.stack.length - 2];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n ancestor.label = decodeString(string);\n // @ts-expect-error: same as above.\n ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabel() {\n const fragment = this.stack[this.stack.length - 1];\n const value = this.resume();\n const node = this.stack[this.stack.length - 1];\n // Assume a reference.\n this.data.inReference = true;\n if (node.type === 'link') {\n /** @type {Array} */\n const children = fragment.children;\n node.children = children;\n } else {\n node.alt = value;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcedestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcetitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresource() {\n this.data.inReference = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n this.data.referenceType = 'collapsed';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitreferencestring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n node.label = label;\n // @ts-expect-error: same as above.\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n this.data.referenceType = 'full';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n this.data.characterReferenceType = token.type;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token);\n const type = this.data.characterReferenceType;\n /** @type {string} */\n let value;\n if (type) {\n value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n this.data.characterReferenceType = undefined;\n } else {\n const result = decodeNamedCharacterReference(data);\n value = result;\n }\n const tail = this.stack[this.stack.length - 1];\n tail.value += value;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreference(token) {\n const tail = this.stack.pop();\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = this.sliceSerialize(token);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkemail(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = 'mailto:' + this.sliceSerialize(token);\n }\n\n //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n };\n }\n\n /** @returns {Code} */\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n };\n }\n\n /** @returns {InlineCode} */\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n };\n }\n\n /** @returns {Definition} */\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n };\n }\n\n /** @returns {Emphasis} */\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n };\n }\n\n /** @returns {Heading} */\n function heading() {\n return {\n type: 'heading',\n // @ts-expect-error `depth` will be set later.\n depth: 0,\n children: []\n };\n }\n\n /** @returns {Break} */\n function hardBreak() {\n return {\n type: 'break'\n };\n }\n\n /** @returns {Html} */\n function html() {\n return {\n type: 'html',\n value: ''\n };\n }\n\n /** @returns {Image} */\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n };\n }\n\n /** @returns {Link} */\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {List}\n */\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n spread: token._spread,\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n function listItem(token) {\n return {\n type: 'listItem',\n spread: token._spread,\n checked: null,\n children: []\n };\n }\n\n /** @returns {Paragraph} */\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n };\n }\n\n /** @returns {Strong} */\n function strong() {\n return {\n type: 'strong',\n children: []\n };\n }\n\n /** @returns {Text} */\n function text() {\n return {\n type: 'text',\n value: ''\n };\n }\n\n /** @returns {ThematicBreak} */\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n };\n }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n * Point-like value.\n * @returns {Point}\n * unist point.\n */\nfunction point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n };\n}\n\n/**\n * @param {Config} combined\n * @param {Array | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n let index = -1;\n while (++index < extensions.length) {\n const value = extensions[index];\n if (Array.isArray(value)) {\n configure(combined, value);\n } else {\n extension(combined, value);\n }\n }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key;\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'canContainEols':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'transforms':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'enter':\n case 'exit':\n {\n const right = extension[key];\n if (right) {\n Object.assign(combined[key], right);\n }\n break;\n }\n // No default\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n start: left.start,\n end: left.end\n }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is open');\n } else {\n throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is still open');\n }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser} Parser\n * @typedef {import('unified').Processor} Processor\n */\n\n/**\n * @typedef {Omit} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkParse(options) {\n /** @type {Processor} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n\n self.parser = parser\n\n /**\n * @type {Parser}\n */\n function parser(doc) {\n return fromMarkdown(doc, {\n ...self.data('settings'),\n ...options,\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: self.data('micromarkExtensions') || [],\n mdastExtensions: self.data('fromMarkdownExtensions') || []\n })\n }\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Blockquote} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function blockquote(state, node) {\n /** @type {Element} */\n const result = {\n type: 'element',\n tagName: 'blockquote',\n properties: {},\n children: state.wrap(state.all(node), true)\n }\n state.patch(node, result)\n return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Break} node\n * mdast node.\n * @returns {Array}\n * hast element content.\n */\nexport function hardBreak(state, node) {\n /** @type {Element} */\n const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n state.patch(node, result)\n return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Code} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function code(state, node) {\n const value = node.value ? node.value + '\\n' : ''\n /** @type {Properties} */\n const properties = {}\n // Someone can write `js python ruby`.\n const language = node.lang ? node.lang.split(/\\s+/) : []\n\n // GH/CM still drop the non-first languages.\n if (language.length > 0) {\n properties.className = ['language-' + language[0]]\n }\n\n // Create ``.\n /** @type {Element} */\n let result = {\n type: 'element',\n tagName: 'code',\n properties,\n children: [{type: 'text', value}]\n }\n\n if (node.meta) {\n result.data = {meta: node.meta}\n }\n\n state.patch(node, result)\n result = state.applyData(node, result)\n\n // Create `
`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n","/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract} node\n *   Reference node (image, link).\n * @returns {Array}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: .\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n","/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array} */\n  const result = [{type: 'text', value: '↩'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n","/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n * Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '↩'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `↩`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `↩` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node’s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nexport function createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {...defaultHandlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n visit(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = structuredClone(shallow)\n // @ts-expect-error: TS doesn’t understand…\n result.children = state.all(node)\n // @ts-expect-error: TS doesn’t understand…\n return result\n }\n\n // @ts-expect-error: it’s custom.\n return structuredClone(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, structuredClone(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n","/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don’t:\n *\n * * `hast-util-to-html` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful\n * if you completely trust authors\n * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc).\n * This is a heavy task as it needs a full HTML parser, but it is the only\n * way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, undefined)\n const foot = footer(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there’s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n assert('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit} Options\n *\n * @callback TransformBridge\n * Bridge-mode.\n *\n * Runs the destination with the new hast tree.\n * Discards result.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {Promise}\n * Nothing.\n *\n * @callback TransformMutate\n * Mutate-mode.\n *\n * Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {HastRoot}\n * Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n * runs the (rehype) plugins used on it with a hast tree,\n * then discards the result (*bridge mode*)\n * * otherwise,\n * returns a hast tree,\n * the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > 👉 **Note**:\n * > It’s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don’t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful if\n * you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc);\n * this is a heavy task as it needs a full HTML parser,\n * but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n * (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n * see later),\n * create a hast `text` node\n * * otherwise,\n * create a `
` element (which could be changed with `data.hName`),\n * with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly | Processor | null | undefined} [destination]\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given,\n * configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nexport default function remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ (\n toHast(tree, {file, ...options})\n )\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree, file) {\n // Cast because root in -> root out.\n // To do: in the future, disallow ` || options` fallback.\n // With `unified-engine`, `destination` can be `undefined` but\n // `options` will be the file set.\n // We should not pass that as `options`.\n return /** @type {HastRoot} */ (\n toHast(tree, {file, ...(destination || options)})\n )\n }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n */\n\nimport {visit} from 'unist-util-visit'\n\n/**\n * Remove empty paragraphs in `tree`.\n *\n * @param {Nodes} tree\n * Tree to change.\n * @returns {undefined}\n * Nothing.\n */\nexport function squeezeParagraphs(tree) {\n visit(tree, function (node, index, parent) {\n if (\n index !== undefined &&\n parent &&\n node.type === 'paragraph' &&\n node.children.every(function (child) {\n return child.type === 'text' && /^\\s*$/.test(child.value)\n })\n ) {\n parent.children.splice(index, 1)\n return index\n }\n })\n}\n","/**\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Root} Root\n */\n\nimport {squeezeParagraphs} from 'mdast-squeeze-paragraphs'\nimport {visit} from 'unist-util-visit'\n\n/**\n * Only keep links with the given protocols.\n *\n * @param {object} options Options\n * @param {string[]} options.except - Protocols to exclude. Defauls to `['http', 'https']`.\n * @returns\n * Transform.\n */\nexport default function remarkUnlinkProtocols(\n options = {except: ['http', 'https']}\n) {\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n /** @type {Map} */\n const definitions = new Map()\n\n // Find definitions to look up linkReferences.\n visit(tree, 'definition', function (node, index, parent) {\n definitions.set(node.identifier, node.url)\n if (parent && typeof index === 'number') {\n const url = node.url\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1)\n return index\n }\n }\n })\n\n visit(tree, function (node, index, parent) {\n if (\n parent &&\n typeof index === 'number' &&\n (node.type === 'link' || node.type === 'linkReference')\n ) {\n const url =\n node.type === 'link' ? node.url : definitions.get(node.identifier)\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1, ...node.children)\n return index\n }\n }\n })\n\n squeezeParagraphs(tree)\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | null | undefined} [extname]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, extname) {\n if (extname !== undefined && typeof extname !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (\n extname === undefined ||\n extname.length === 0 ||\n extname.length > path.length\n ) {\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (extname === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extnameIndex = extname.length - 1\n\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extnameIndex > -1) {\n // Try to match the explicit extension.\n if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n if (extnameIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extnameIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.codePointAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.codePointAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.codePointAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.codePointAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.codePointAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n result.codePointAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: \nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {URL | string} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.codePointAt(index) === 37 /* `%` */ &&\n pathname.codePointAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.codePointAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > .\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin, any, any> |\n * PluginTuple, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// .\n/**\n * @template {Array} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback} next\n * Callback.\n * @returns {(\n * Promise |\n * Promise | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : // Unknown.\n * Processor\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback> | undefined} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor}\n *\n * @overload\n * @param {Plugin} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n/**\n * @module public\n */\nimport { loadState } from '@nextcloud/initial-state';\n/**\n * Check if the current page is on a public share\n */\nexport function isPublicShare() {\n // check both the new initial state version and fallback to legacy input\n return (loadState('files_sharing', 'isPublic', null)\n ?? document.querySelector('input#isPublic[type=\"hidden\"][name=\"isPublic\"][value=\"1\"]') !== null);\n}\n/**\n * Get the sharing token for the current public share\n */\nexport function getSharingToken() {\n return (loadState('files_sharing', 'sharingToken', null)\n ?? document.querySelector('input#sharingToken[type=\"hidden\"]')?.value\n ?? null);\n}\n","import { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nwindow._vue_richtext_widgets ??= {};\nwindow._registerWidget ??= (id, callback, onDestroy, props) => {\n registerWidget(id, callback, onDestroy, props);\n};\nfunction registerWidget(id, callback, onDestroy = () => {\n}, props) {\n const propsWithDefaults = {\n hasInteractiveView: true,\n fullWidth: false,\n ...props\n };\n if (window._vue_richtext_widgets[id]) {\n logger.error(`[ReferencePicker]: Widget for id ${id} already registered`);\n return;\n }\n window._vue_richtext_widgets[id] = {\n id,\n callback,\n onDestroy,\n ...propsWithDefaults\n };\n}\nfunction renderWidget(el, options) {\n const { richObjectType, richObject, accessible, interactive } = options;\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n logger.error(\"Widget for rich object type \" + richObjectType + \" not registered\");\n return;\n }\n window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible, interactive });\n}\nfunction destroyWidget(richObjectType, el) {\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n return;\n }\n window._vue_richtext_widgets[richObjectType].onDestroy(el);\n}\nfunction isWidgetRegistered(id) {\n return !!window._vue_richtext_widgets[id];\n}\nfunction hasInteractiveView(id) {\n return !!window._vue_richtext_widgets[id]?.hasInteractiveView;\n}\nfunction hasFullWidth(id) {\n return !!window._vue_richtext_widgets[id]?.fullWidth;\n}\nwindow._vue_richtext_custom_picker_elements ??= {};\nwindow._registerCustomPickerElement ??= registerCustomPickerElement;\nclass NcCustomPickerRenderResult {\n element;\n object;\n /**\n * @param element - The HTML element\n * @param object - The object\n */\n constructor(element, object) {\n this.element = element;\n this.object = object;\n }\n}\nfunction isCustomPickerElementRegistered(id) {\n return !!window._vue_richtext_custom_picker_elements[id];\n}\nfunction getCustomPickerElementSize(id) {\n const size = window._vue_richtext_custom_picker_elements[id]?.size;\n if (size && [\"small\", \"normal\", \"large\", \"full\"].includes(size)) {\n return size;\n }\n return null;\n}\nfunction registerCustomPickerElement(id, callback, onDestroy = () => {\n}, size = \"large\") {\n if (window._vue_richtext_custom_picker_elements[id]) {\n logger.error(`Custom reference picker element for id ${id} already registered`);\n return;\n }\n window._vue_richtext_custom_picker_elements[id] = {\n id,\n callback,\n onDestroy,\n size\n };\n}\nfunction renderCustomPickerElement(el, options) {\n const { providerId, accessible } = options;\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n logger.error(`Custom reference picker element for reference provider ID ${providerId} not registered`);\n return;\n }\n return window._vue_richtext_custom_picker_elements[providerId].callback(el, { providerId, accessible });\n}\nfunction destroyCustomPickerElement(providerId, el, renderResult) {\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n return;\n }\n window._vue_richtext_custom_picker_elements[providerId].onDestroy(el, renderResult);\n}\nexport {\n NcCustomPickerRenderResult as N,\n renderWidget as a,\n destroyCustomPickerElement as b,\n isCustomPickerElementRegistered as c,\n destroyWidget as d,\n registerCustomPickerElement as e,\n renderCustomPickerElement as f,\n getCustomPickerElementSize as g,\n hasInteractiveView as h,\n isWidgetRegistered as i,\n hasFullWidth as j,\n registerWidget as r\n};\n//# sourceMappingURL=customPickerElements-4pQTZUnk.mjs.map\n","/**\n * @typedef {import('unist').Node} Node\n */\n\n/**\n * @typedef {Array | string} ChildrenOrValue\n * List to use as `children` or value to use as `value`.\n *\n * @typedef {Record} Props\n * Other fields to add to the node.\n */\n\n/**\n * Build a node.\n *\n * @template {string} T\n * @template {Props} P\n * @template {Array} C\n *\n * @overload\n * @param {T} type\n * @returns {{type: T}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @returns {{type: T} & P}\n *\n * @overload\n * @param {T} type\n * @param {string} value\n * @returns {{type: T, value: string}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {string} value\n * @returns {{type: T, value: string} & P}\n *\n * @overload\n * @param {T} type\n * @param {C} children\n * @returns {{type: T, children: C}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {C} children\n * @returns {{type: T, children: C} & P}\n *\n * @param {string} type\n * Node type.\n * @param {ChildrenOrValue | Props | null | undefined} [props]\n * Fields assigned to node (default: `undefined`).\n * @param {ChildrenOrValue | null | undefined} [value]\n * Children of node or value of `node` (cast to string).\n * @returns {Node}\n * Built node.\n */\nexport function u(type, props, value) {\n /** @type {Node} */\n const node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n // @ts-expect-error: create a parent.\n node.children = value\n } else if (value !== undefined && value !== null) {\n // @ts-expect-error: create a literal.\n node.value = String(value)\n }\n\n return node\n}\n","import { getBaseUrl, getRootUrl } from \"@nextcloud/router\";\nimport { u } from \"unist-builder\";\nimport { visit, SKIP } from \"unist-util-visit\";\nimport { defineComponent, h } from \"vue\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\n/*!\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst URL_PATTERN = /(\\s|^)(https?:\\/\\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\\s|$)/ig;\nconst URL_PATTERN_AUTOLINK = /(\\s|\\(|^)((https?:\\/\\/)([-A-Z0-9+_.]+[-A-Z0-9]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*))(?=\\s|\\)|$)/ig;\nconst NcLink = defineComponent({\n name: \"NcLink\",\n props: {\n href: {\n type: String,\n required: true\n }\n },\n render() {\n return h(\"a\", {\n href: this.href,\n rel: \"noopener noreferrer\",\n target: \"_blank\",\n class: \"rich-text--external-link\"\n }, [this.href.trim()]);\n }\n});\nfunction remarkAutolink({ autolink, useMarkdown, useExtendedMarkdown }) {\n return function(tree) {\n if (useExtendedMarkdown || !useMarkdown || !autolink) {\n return;\n }\n visit(tree, (node) => node.type === \"text\", (node, index, parent) => {\n let parsed = parseUrl(node.value);\n if (typeof parsed === \"string\") {\n parsed = [u(\"text\", parsed)];\n } else {\n parsed = parsed.map((n) => {\n if (typeof n === \"string\") {\n return u(\"text\", n);\n }\n return u(\"link\", {\n url: n.props.href\n }, [u(\"text\", n.props.href)]);\n }).filter((x) => x).flat();\n }\n parent.children.splice(index, 1, ...parsed);\n return [SKIP, (index ?? 0) + parsed.length];\n });\n };\n}\nfunction parseUrl(text) {\n let match = URL_PATTERN_AUTOLINK.exec(text);\n const list = [];\n let start = 0;\n while (match !== null) {\n let href = match[2];\n let textAfter;\n let textBefore = text.substring(start, match.index + match[1].length);\n if (href[0] === \" \") {\n textBefore += href[0];\n href = href.substring(1).trim();\n }\n const lastChar = href[href.length - 1];\n if (lastChar === \".\" || lastChar === \",\" || lastChar === \";\" || match[0][0] === \"(\" && lastChar === \")\") {\n href = href.substring(0, href.length - 1);\n textAfter = lastChar;\n }\n list.push(textBefore);\n list.push({ component: NcLink, props: { href } });\n if (textAfter) {\n list.push(textAfter);\n }\n start = match.index + match[0].length;\n match = URL_PATTERN_AUTOLINK.exec(text);\n }\n list.push(text.substring(start));\n const joinedText = list.map((item) => typeof item === \"string\" ? item : item.props.href).join(\"\");\n if (text === joinedText) {\n return list;\n }\n logger.error(\"[NcRichText] Failed to reassemble the chunked text: \" + text);\n return text;\n}\nfunction getRoute(router, url) {\n const removePrefix = (str, prefix) => str.startsWith(prefix) ? str.slice(prefix.length) : str;\n const removePrefixes = (str, ...prefixes) => prefixes.reduce((acc, prefix) => removePrefix(acc, prefix), str);\n if (!router) {\n return null;\n }\n const isAbsoluteURL = /^https?:\\/\\//.test(url);\n const isNonHttpLink = /^[a-z][a-z0-9+.-]*:.+/.test(url);\n if (!isAbsoluteURL && isNonHttpLink) {\n return null;\n }\n if (isAbsoluteURL && !url.startsWith(getBaseUrl())) {\n return null;\n }\n if (!isAbsoluteURL && !url.startsWith(\"/\")) {\n return null;\n }\n const relativeUrl = isAbsoluteURL ? removePrefixes(url, getBaseUrl(), \"/index.php\") : url;\n const relativeRouterBase = removePrefixes(router.options.history.base, getRootUrl(), \"/index.php\");\n const potentialRouterPath = removePrefixes(relativeUrl, relativeRouterBase) || \"/\";\n const route = router.resolve(potentialRouterPath);\n if (!route.matched.length) {\n return null;\n }\n return route.fullPath;\n}\nexport {\n URL_PATTERN as U,\n getRoute as g,\n parseUrl as p,\n remarkAutolink as r\n};\n//# sourceMappingURL=autolink-U5pBzLgI.mjs.map\n","import { defineComponent, mergeModels, useModel, useTemplateRef, computed, createBlock, openBlock, unref, mergeProps, createSlots, withCtx, renderSlot } from \"vue\";\nimport { m as mdiArrowRight, a as mdiUndo, b as mdiClose } from \"./mdi-CpchYUUV.mjs\";\nimport { r as register, b as t50, c as t18, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { N as NcInputField } from \"./NcInputField-Clm9jOGJ.mjs\";\nregister(t18, t50);\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcTextField\",\n props: /* @__PURE__ */ mergeModels({\n class: {},\n inputClass: {},\n id: {},\n label: {},\n labelOutside: { type: Boolean },\n type: {},\n placeholder: {},\n showTrailingButton: { type: Boolean },\n trailingButtonLabel: { default: void 0 },\n success: { type: Boolean },\n error: { type: Boolean },\n helperText: {},\n disabled: { type: Boolean },\n pill: { type: Boolean },\n trailingButtonIcon: { default: \"close\" }\n }, {\n \"modelValue\": { default: \"\" },\n \"modelModifiers\": {}\n }),\n emits: [\"update:modelValue\"],\n setup(__props, { expose: __expose }) {\n const modelValue = useModel(__props, \"modelValue\");\n const props = __props;\n __expose({\n focus,\n select\n });\n const inputFieldInstance = useTemplateRef(\"inputField\");\n const defaultTrailingButtonLabels = {\n arrowEnd: t(\"Save changes\"),\n close: t(\"Clear text\"),\n undo: t(\"Undo changes\")\n };\n const NcInputFieldPropNames = new Set(Object.keys(NcInputField.props));\n const propsToForward = computed(() => {\n const sharedProps = Object.fromEntries(Object.entries(props).filter(([key]) => NcInputFieldPropNames.has(key)));\n sharedProps.trailingButtonLabel ??= defaultTrailingButtonLabels[props.trailingButtonIcon];\n return sharedProps;\n });\n function focus(options) {\n inputFieldInstance.value.focus(options);\n }\n function select() {\n inputFieldInstance.value.select();\n }\n return (_ctx, _cache) => {\n return openBlock(), createBlock(unref(NcInputField), mergeProps(propsToForward.value, {\n ref: \"inputField\",\n modelValue: modelValue.value,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)\n }), createSlots({ _: 2 }, [\n !!_ctx.$slots.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n renderSlot(_ctx.$slots, \"icon\")\n ]),\n key: \"0\"\n } : void 0,\n _ctx.type !== \"search\" ? {\n name: \"trailing-button-icon\",\n fn: withCtx(() => [\n _ctx.trailingButtonIcon === \"arrowEnd\" ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n directional: \"\",\n path: unref(mdiArrowRight)\n }, null, 8, [\"path\"])) : (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 1,\n path: _ctx.trailingButtonIcon === \"undo\" ? unref(mdiUndo) : unref(mdiClose)\n }, null, 8, [\"path\"]))\n ]),\n key: \"1\"\n } : void 0\n ]), 1040, [\"modelValue\"]);\n };\n }\n});\nexport {\n _sfc_main as _\n};\n//# sourceMappingURL=NcTextField.vue_vue_type_script_setup_true_lang-CCsZqnkM.mjs.map\n","import '../assets/referencePickerModal-DWMAMaU3.css';\nimport { createElementBlock, openBlock, mergeProps, createElementVNode, createCommentVNode, toDisplayString, resolveComponent, createVNode, withCtx, defineComponent, inject, ref, useTemplateRef, nextTick, computed, watch, onBeforeUnmount, normalizeClass, createBlock, resolveDynamicComponent, normalizeStyle, createTextVNode, unref, withKeys, withModifiers, createApp } from \"vue\";\nimport { emit } from \"@nextcloud/event-bus\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nimport { I as IconClose } from \"./Close-D6ngJ4t9.mjs\";\nimport { f as renderCustomPickerElement, b as destroyCustomPickerElement, c as isCustomPickerElementRegistered, j as hasFullWidth, i as isWidgetRegistered, h as hasInteractiveView, a as renderWidget, d as destroyWidget, g as getCustomPickerElementSize } from \"./customPickerElements-4pQTZUnk.mjs\";\nimport axios from \"@nextcloud/axios\";\nimport { loadState } from \"@nextcloud/initial-state\";\nimport { imagePath, generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, W as t8, a as t, X as t45, Y as t40, Z as t24, _ as t25, q as t42, $ as t32, A as t19, a0 as t12 } from \"./_l10n-CgsPi8nC.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent-B8-90BSI.mjs\";\nimport { _ as _sfc_main$a } from \"./NcHighlight.vue_vue_type_script_lang-DnWQDM_2.mjs\";\nimport { N as NcSelect } from \"./NcSelect-Cc9_a8nG.mjs\";\nimport debounce from \"debounce\";\nimport { useElementSize, useIntersectionObserver } from \"@vueuse/core\";\nimport { routerKey, RouterLink } from \"vue-router\";\nimport { N as NcButton } from \"./NcButton-CzpKEx4V.mjs\";\nimport { g as getRoute } from \"./autolink-U5pBzLgI.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon-b_ajZ_nQ.mjs\";\nimport { _ as _sfc_main$b } from \"./NcTextField.vue_vue_type_script_setup_true_lang-CCsZqnkM.mjs\";\nimport { I as IconDotsHorizontal } from \"./NcActions-4R7icatI.mjs\";\nimport { N as NcModal } from \"./NcModal-D00OJZV2.mjs\";\nconst _sfc_main$9 = {\n name: \"ArrowLeftIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$9 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$7 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$6 = { d: \"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z\" };\nconst _hoisted_4$5 = { key: 0 };\nfunction _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon arrow-left-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$6, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$5, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$7))\n ], 16, _hoisted_1$9);\n}\nconst ArrowLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [[\"render\", _sfc_render$8]]);\nconst _sfc_main$8 = {\n name: \"NcCustomPickerElement\",\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"cancel\",\n \"submit\"\n ],\n data() {\n return {\n isRegistered: isCustomPickerElementRegistered(this.provider.id),\n renderResult: null\n };\n },\n mounted() {\n if (this.isRegistered) {\n this.renderElement();\n }\n },\n beforeUnmount() {\n if (this.isRegistered) {\n destroyCustomPickerElement(this.provider.id, this.$el, this.renderResult);\n }\n },\n methods: {\n renderElement() {\n if (this.$refs.domElement) {\n this.$refs.domElement.innerHTML = \"\";\n }\n const renderFunctionResult = renderCustomPickerElement(this.$refs.domElement, { providerId: this.provider.id, accessible: false });\n Promise.resolve(renderFunctionResult).then((result) => {\n this.renderResult = result;\n if (this.renderResult.object?._isVue && this.renderResult.object?.$on) {\n this.renderResult.object.$on(\"submit\", this.onSubmit);\n this.renderResult.object.$on(\"cancel\", this.onCancel);\n }\n this.renderResult.element.addEventListener(\"submit\", (e) => {\n this.onSubmit(e.detail);\n });\n this.renderResult.element.addEventListener(\"cancel\", this.onCancel);\n });\n },\n onSubmit(value) {\n this.$emit(\"submit\", value);\n },\n onCancel() {\n this.$emit(\"cancel\");\n }\n }\n};\nconst _hoisted_1$8 = { ref: \"domElement\" };\nfunction _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", _hoisted_1$8, null, 512);\n}\nconst NcCustomPickerElement = /* @__PURE__ */ _export_sfc(_sfc_main$8, [[\"render\", _sfc_render$7], [\"__scopeId\", \"data-v-e408867a\"]]);\nconst _sfc_main$7 = {\n name: \"LinkVariantIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$7 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$6 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon link-variant-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$6))\n ], 16, _hoisted_1$7);\n}\nconst LinkVariantIcon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [[\"render\", _sfc_render$6]]);\nregister(t8);\nconst anyLinkProviderId = \"any-link\";\nconst anyLinkProvider = {\n id: anyLinkProviderId,\n title: t(\"Any link\"),\n order: 0,\n icon_url: imagePath(\"core\", \"filetypes/link.svg\")\n};\nwindow._vue_richtext_reference_providers ??= loadState(\"core\", \"reference-provider-list\", []);\nwindow._vue_richtext_reference_provider_timestamps ??= loadState(\"core\", \"reference-provider-timestamps\", {});\nfunction getProvider(providerId) {\n if (providerId === anyLinkProviderId) {\n return anyLinkProvider;\n }\n return getProviders().find((p) => p.id === providerId);\n}\nfunction getProviders() {\n return window._vue_richtext_reference_providers.filter((p) => {\n const keep = !!p.search_providers_ids && p.search_providers_ids.length > 0 || isCustomPickerElementRegistered(p.id);\n if (!keep) {\n logger.debug(`[smart picker] ${p.id} reference provider is discoverable but does not have any related search provider or custom picker component registered`);\n }\n return keep;\n });\n}\nfunction sortProviders(providerList) {\n const timestamps = window._vue_richtext_reference_provider_timestamps;\n return providerList.sort((a, b) => {\n return a.order === b.order ? 0 : a.order > b.order ? 1 : -1;\n }).sort((a, b) => {\n const ta = timestamps[a.id];\n const tb = timestamps[b.id];\n return ta === tb ? 0 : tb === void 0 ? -1 : ta === void 0 ? 1 : ta > tb ? -1 : 1;\n });\n}\nfunction searchProvider(query, limit) {\n const providers = getProviders();\n const escapedQuery = query.replace(/[/\\-\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const regexp = new RegExp(escapedQuery, \"i\");\n const sortedProviders = sortProviders(providers);\n const filteredSortedProviders = sortedProviders.filter((p) => {\n return p.title.match(regexp);\n });\n const searchResult = limit ? filteredSortedProviders.slice(0, limit) : filteredSortedProviders;\n if (query === \"\" || searchResult.length === 0) {\n searchResult.push(anyLinkProvider);\n }\n return searchResult;\n}\nasync function touchProvider(providerId) {\n const timestamp = Math.floor(Date.now() / 1e3);\n const url = generateOcsUrl(\"references/provider/{providerId}\", { providerId });\n await axios.put(url, { timestamp });\n window._vue_richtext_reference_provider_timestamps[providerId] = timestamp;\n}\nregister(t40, t45);\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isUrl(str) {\n try {\n return Boolean(new URL(str));\n } catch {\n return false;\n }\n}\nconst _sfc_main$6 = {\n name: \"NcProviderList\",\n components: {\n NcSelect,\n NcHighlight: _sfc_main$a,\n NcEmptyContent,\n LinkVariantIcon\n },\n emits: [\n \"selectProvider\",\n \"submit\"\n ],\n data() {\n return {\n selectedProvider: null,\n query: \"\",\n multiselectPlaceholder: t(\"Select provider\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n options() {\n const result = [];\n if (this.query !== \"\" && isUrl(this.query)) {\n result.push({\n id: this.query,\n title: this.query,\n isLink: true\n });\n }\n result.push(...searchProvider(this.query));\n return result;\n }\n },\n methods: {\n focus() {\n setTimeout(() => {\n this.$refs[\"provider-select\"]?.$el?.querySelector(\"#provider-select-input\")?.focus();\n }, 300);\n },\n onProviderSelected(p) {\n if (p !== null) {\n if (p.isLink) {\n this.$emit(\"submit\", p.title);\n } else {\n this.$emit(\"selectProvider\", p);\n }\n this.selectedProvider = null;\n }\n },\n onSearch(query) {\n this.query = query;\n }\n }\n};\nconst _hoisted_1$6 = { class: \"provider-list\" };\nconst _hoisted_2$5 = {\n key: 0,\n class: \"provider\"\n};\nconst _hoisted_3$4 = {\n key: 1,\n class: \"provider\"\n};\nconst _hoisted_4$3 = [\"src\", \"alt\"];\nfunction _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$6, [\n createVNode(_component_NcSelect, {\n ref: \"provider-select\",\n modelValue: $data.selectedProvider,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedProvider = $event),\n $options.onProviderSelected\n ],\n class: \"provider-list--select\",\n \"input-id\": \"provider-select-input\",\n label: \"title\",\n placeholder: $data.multiselectPlaceholder,\n options: $options.options,\n \"append-to-body\": false,\n \"clear-search-on-select\": true,\n \"clear-search-on-blur\": () => false,\n filterable: false,\n onSearch: $options.onSearch\n }, {\n option: withCtx((option) => [\n option.isLink ? (openBlock(), createElementBlock(\"div\", _hoisted_2$5, [\n createVNode(_component_LinkVariantIcon, {\n class: \"link-icon\",\n size: 20\n }),\n createElementVNode(\"span\", null, toDisplayString(option.title), 1)\n ])) : (openBlock(), createElementBlock(\"div\", _hoisted_3$4, [\n createElementVNode(\"img\", {\n class: \"provider-icon\",\n src: option.icon_url,\n alt: $data.providerIconAlt\n }, null, 8, _hoisted_4$3),\n createVNode(_component_NcHighlight, {\n class: \"option-text\",\n search: $data.query,\n text: option.title\n }, null, 8, [\"search\", \"text\"])\n ]))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"onSearch\", \"onUpdate:modelValue\"]),\n createVNode(_component_NcEmptyContent, { class: \"provider-list--empty-content\" }, {\n icon: withCtx(() => [\n createVNode(_component_LinkVariantIcon)\n ]),\n _: 1\n })\n ]);\n}\nconst NcProviderList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [[\"render\", _sfc_render$5], [\"__scopeId\", \"data-v-90c6aa3b\"]]);\nregister(t24);\nconst _hoisted_1$5 = [\"src\"];\nconst _hoisted_2$4 = { class: \"widget-default--details\" };\nconst _hoisted_3$3 = { class: \"widget-default--name\" };\nconst _hoisted_4$2 = { class: \"widget-default--link\" };\nconst IDLE_TIMEOUT = 3 * 60 * 1e3;\nconst _sfc_main$5 = /* @__PURE__ */ defineComponent({\n __name: \"NcReferenceWidget\",\n props: {\n reference: {},\n interactive: { type: Boolean, default: true },\n interactiveOptIn: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const router = inject(routerKey, null);\n const isVisible = ref(false);\n const customWidget = useTemplateRef(\"customWidget\");\n const widgetRoot = useTemplateRef(\"widgetRoot\");\n const { width } = useElementSize(widgetRoot);\n useIntersectionObserver(widgetRoot, ([entry]) => {\n nextTick(() => {\n isVisible.value = entry.isIntersecting;\n });\n });\n const showInteractive = ref(false);\n const rendered = ref(false);\n let idleTimeout = null;\n const isInteractive = computed(() => {\n return !props.interactiveOptIn && props.interactive || showInteractive.value;\n });\n const referenceHasFullWidth = computed(() => {\n return hasFullWidth(props.reference.richObjectType);\n });\n const hasCustomWidget = computed(() => {\n return isWidgetRegistered(props.reference.richObjectType);\n });\n const referenceHasInteractiveView = computed(() => {\n return hasCustomWidget.value && hasInteractiveView(props.reference.richObjectType);\n });\n const noAccess = computed(() => {\n return !props.reference.accessible;\n });\n const numberOfLines = computed(() => {\n const lineCountOffsets = [450, 550, 650, Infinity];\n return lineCountOffsets.findIndex((max) => width.value < max);\n });\n const descriptionStyle = computed(() => {\n if (numberOfLines.value === 0) {\n return {\n display: \"none\"\n };\n }\n const lineClamp = numberOfLines.value;\n return {\n lineClamp,\n webkitLineClamp: lineClamp\n };\n });\n const compactLink = computed(() => {\n const link = props.reference.openGraphObject.link;\n if (!link) {\n return \"\";\n }\n if (link.startsWith(\"https://\")) {\n return link.substring(8);\n }\n if (link.startsWith(\"http://\")) {\n return link.substring(7);\n }\n return link;\n });\n const route = computed(() => {\n return getRoute(router, props.reference.openGraphObject.link);\n });\n const referenceWidgetLinkComponent = computed(() => {\n return route.value ? RouterLink : \"a\";\n });\n const referenceWidgetLinkProps = computed(() => {\n return route.value ? { to: route.value } : { href: props.reference.openGraphObject.link, target: \"_blank\" };\n });\n watch(isVisible, (val) => {\n if (!val) {\n idleTimeout = setTimeout(() => {\n if (!isVisible.value) {\n destroyReferenceWidget();\n }\n }, IDLE_TIMEOUT);\n return;\n }\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n if (!rendered.value) {\n renderReferenceWidget();\n }\n }, { immediate: true });\n onBeforeUnmount(() => {\n destroyReferenceWidget();\n });\n function enableInteractive() {\n showInteractive.value = true;\n renderReferenceWidget();\n }\n function renderReferenceWidget() {\n if (!customWidget.value) {\n return;\n }\n if (props.reference.richObjectType === \"open-graph\") {\n return;\n }\n customWidget.value.innerHTML = \"\";\n const widget = document.createElement(\"div\");\n widget.style.width = \"100%\";\n customWidget.value.appendChild(widget);\n nextTick(() => {\n renderWidget(widget, {\n ...props.reference,\n interactive: isInteractive.value\n });\n rendered.value = true;\n });\n }\n function destroyReferenceWidget() {\n if (rendered.value && widgetRoot.value) {\n destroyWidget(props.reference.richObjectType, widgetRoot.value);\n rendered.value = false;\n }\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n ref_key: \"widgetRoot\",\n ref: widgetRoot,\n class: normalizeClass({ \"toggle-interactive\": referenceHasInteractiveView.value && !isInteractive.value })\n }, [\n _ctx.reference && hasCustomWidget.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n ref_key: \"customWidget\",\n ref: customWidget,\n class: normalizeClass([\"widget-custom\", { \"full-width\": referenceHasFullWidth.value }])\n }, null, 2)) : !noAccess.value && _ctx.reference && _ctx.reference.openGraphObject && !hasCustomWidget.value ? (openBlock(), createBlock(resolveDynamicComponent(referenceWidgetLinkComponent.value), mergeProps({ key: 1 }, referenceWidgetLinkProps.value, {\n rel: \"noopener noreferrer\",\n class: \"widget-default\"\n }), {\n default: withCtx(() => [\n _ctx.reference.openGraphObject.thumb ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"widget-default--image\",\n src: _ctx.reference.openGraphObject.thumb\n }, null, 8, _hoisted_1$5)) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_2$4, [\n createElementVNode(\"p\", _hoisted_3$3, toDisplayString(_ctx.reference.openGraphObject.name), 1),\n createElementVNode(\"p\", {\n class: \"widget-default--description\",\n style: normalizeStyle(descriptionStyle.value)\n }, toDisplayString(_ctx.reference.openGraphObject.description), 5),\n createElementVNode(\"p\", _hoisted_4$2, toDisplayString(compactLink.value), 1)\n ])\n ]),\n _: 1\n }, 16)) : createCommentVNode(\"\", true),\n _ctx.interactiveOptIn && referenceHasInteractiveView.value && !isInteractive.value ? (openBlock(), createBlock(NcButton, {\n key: 2,\n class: \"toggle-interactive--button\",\n onClick: enableInteractive\n }, {\n default: withCtx(() => [\n createTextVNode(toDisplayString(unref(t)(\"Enable interactive view\")), 1)\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n };\n }\n});\nconst NcReferenceWidget = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"__scopeId\", \"data-v-8ce33442\"]]);\nregister(t25);\nconst _sfc_main$4 = {\n name: \"NcRawLinkInput\",\n components: {\n LinkVariantIcon,\n NcEmptyContent,\n NcLoadingIcon,\n NcReferenceWidget,\n NcTextField: _sfc_main$b\n },\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"submit\"\n ],\n data() {\n return {\n inputValue: \"\",\n loading: false,\n reference: null,\n abortController: null,\n inputPlaceholder: t(\"Enter link\")\n };\n },\n computed: {\n isLinkValid() {\n return isUrl(this.inputValue);\n },\n debouncedUpdateReference() {\n return debounce(this.updateReference, 500);\n }\n },\n methods: {\n focus() {\n this.$refs[\"url-input\"].$el.getElementsByTagName(\"input\")[0]?.focus();\n },\n onSubmit(e) {\n const value = e.target.value;\n if (this.isLinkValid) {\n this.$emit(\"submit\", value);\n }\n },\n onClear() {\n this.inputValue = \"\";\n this.reference = null;\n },\n onInput() {\n this.reference = null;\n if (this.abortController) {\n this.abortController.abort();\n }\n if (this.isLinkValid) {\n this.debouncedUpdateReference();\n }\n },\n updateReference() {\n this.loading = true;\n this.abortController = new AbortController();\n axios.get(generateOcsUrl(\"references/resolve\", 2) + \"?reference=\" + encodeURIComponent(this.inputValue), {\n signal: this.abortController.signal\n }).then((response) => {\n this.reference = response.data.ocs.data.references[this.inputValue];\n }).catch((error) => {\n logger.error(\"[NcRawLinkInput] Failed to update reference\", { error });\n }).then(() => {\n this.loading = false;\n });\n }\n }\n};\nconst _hoisted_1$4 = { class: \"raw-link\" };\nconst _hoisted_2$3 = { class: \"input-wrapper\" };\nconst _hoisted_3$2 = [\"src\"];\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcLoadingIcon = resolveComponent(\"NcLoadingIcon\");\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcTextField = resolveComponent(\"NcTextField\");\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$4, [\n createElementVNode(\"div\", _hoisted_2$3, [\n createVNode(_component_NcTextField, {\n ref: \"url-input\",\n modelValue: $data.inputValue,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event),\n $options.onInput\n ],\n \"show-trailing-button\": $data.inputValue !== \"\",\n label: $data.inputPlaceholder,\n onTrailingButtonClick: $options.onClear,\n onKeyup: withKeys($options.onSubmit, [\"enter\"])\n }, {\n default: withCtx(() => [\n $data.loading ? (openBlock(), createBlock(_component_NcLoadingIcon, {\n key: 0,\n size: 16\n })) : (openBlock(), createBlock(_component_LinkVariantIcon, {\n key: 1,\n size: 16\n }))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"show-trailing-button\", \"label\", \"onTrailingButtonClick\", \"onUpdate:modelValue\", \"onKeyup\"])\n ]),\n $data.reference !== null ? (openBlock(), createBlock(_component_NcReferenceWidget, {\n key: 0,\n class: \"reference-widget\",\n reference: $data.reference\n }, null, 8, [\"reference\"])) : (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 1,\n class: \"raw-link--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_3$2)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n }))\n ]);\n}\nconst NcRawLinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$4], [\"__scopeId\", \"data-v-a0658f2a\"]]);\nconst _sfc_main$3 = {\n name: \"NcSearchResult\",\n components: {\n NcHighlight: _sfc_main$a\n },\n props: {\n /**\n * Unified search result entry\n */\n entry: {\n type: Object,\n required: true\n },\n /**\n * The query that led to getting this result\n * Used to highlight the entry text\n */\n query: {\n type: String,\n required: true\n }\n }\n};\nconst _hoisted_1$3 = { class: \"result\" };\nconst _hoisted_2$2 = [\"src\"];\nconst _hoisted_3$1 = { class: \"result--content\" };\nconst _hoisted_4$1 = { class: \"result--content--name\" };\nconst _hoisted_5$1 = { class: \"result--content--subline\" };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$3, [\n $props.entry.icon ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([{ [$props.entry.icon]: true, rounded: $props.entry.rounded }, \"result--icon-class\"])\n }, null, 2)) : (openBlock(), createElementBlock(\"img\", {\n key: 1,\n class: normalizeClass([\"result--image\", { rounded: $props.entry.rounded }]),\n src: $props.entry.thumbnailUrl\n }, null, 10, _hoisted_2$2)),\n createElementVNode(\"div\", _hoisted_3$1, [\n createElementVNode(\"span\", _hoisted_4$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.title\n }, null, 8, [\"search\", \"text\"])\n ]),\n createElementVNode(\"span\", _hoisted_5$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.subline\n }, null, 8, [\"search\", \"text\"])\n ])\n ])\n ]);\n}\nconst NcSearchResult = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$3], [\"__scopeId\", \"data-v-059edcfb\"]]);\nregister(t32, t40, t42);\nconst LIMIT = 5;\nconst _sfc_main$2 = {\n name: \"NcSearch\",\n components: {\n LinkVariantIcon,\n DotsHorizontalIcon: IconDotsHorizontal,\n NcEmptyContent,\n NcSelect,\n NcSearchResult\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The selected reference provider\n */\n provider: {\n type: Object,\n required: true\n },\n showEmptyContent: {\n type: Boolean,\n default: true\n },\n /**\n * Placeholder of the search\n */\n searchPlaceholder: {\n type: String,\n default: null\n }\n },\n emits: [\n \"submit\"\n ],\n data() {\n return {\n searchQuery: \"\",\n selectedResult: null,\n resultsBySearchProvider: {},\n searching: false,\n searchingMoreOf: null,\n abortController: null,\n noOptionsText: t(\"Start typing to search\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n mySearchPlaceholder() {\n return this.searchPlaceholder || t(\"Search\");\n },\n searchProviderIds() {\n return this.provider.search_providers_ids;\n },\n options() {\n if (this.searchQuery === \"\") {\n return [];\n }\n const options = [];\n if (isUrl(this.searchQuery)) {\n options.push(this.rawLinkEntry);\n }\n options.push(...this.formattedSearchResults);\n return options;\n },\n rawLinkEntry() {\n return {\n id: \"rawLinkEntry\",\n resourceUrl: this.searchQuery,\n isRawLink: true\n };\n },\n formattedSearchResults() {\n const results = [];\n this.searchProviderIds.forEach((pid) => {\n if (this.resultsBySearchProvider[pid].entries.length > 0) {\n if (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[pid].entries.length > 1) {\n results.push({\n id: \"groupTitle-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isCustomGroupTitle: true,\n providerId: pid\n });\n }\n const providerEntriesWithId = this.resultsBySearchProvider[pid].entries.map((entry, index) => {\n return {\n id: \"provider-\" + pid + \"-entry-\" + index,\n ...entry\n };\n });\n results.push(...providerEntriesWithId);\n if (this.resultsBySearchProvider[pid].isPaginated) {\n results.push({\n id: \"moreOf-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isMore: true,\n providerId: pid,\n isLoading: this.searchingMoreOf === pid\n });\n }\n }\n });\n return results;\n },\n debouncedUpdateSearch() {\n return debounce(this.updateSearch, 500);\n }\n },\n mounted() {\n this.resetResults();\n },\n beforeUnmount() {\n this.cancelSearchRequests();\n },\n methods: {\n t,\n resetResults() {\n const resultsBySearchProvider = {};\n this.searchProviderIds.forEach((pid) => {\n resultsBySearchProvider[pid] = {\n entries: []\n };\n });\n this.resultsBySearchProvider = resultsBySearchProvider;\n },\n focus() {\n setTimeout(() => {\n this.$refs[\"search-select\"]?.$el?.querySelector(\"#search-select-input\")?.focus();\n }, 300);\n },\n cancelSearchRequests() {\n if (this.abortController) {\n this.abortController.abort();\n }\n },\n onSearchInput(query) {\n this.searchQuery = query;\n this.debouncedUpdateSearch();\n },\n onSelectResultSelected(item) {\n if (item !== null) {\n if (item.resourceUrl) {\n this.cancelSearchRequests();\n this.$emit(\"submit\", item.resourceUrl);\n } else if (item.isMore) {\n this.searchMoreOf(item.providerId).then(() => {\n this.selectedResult = null;\n });\n }\n }\n },\n searchMoreOf(searchProviderId) {\n this.searchingMoreOf = searchProviderId;\n this.cancelSearchRequests();\n return this.searchProviders(searchProviderId);\n },\n updateSearch() {\n this.cancelSearchRequests();\n this.resetResults();\n if (this.searchQuery === \"\") {\n this.searching = false;\n return;\n }\n return this.searchProviders();\n },\n searchProviders(searchProviderId = null) {\n this.abortController = new AbortController();\n this.searching = true;\n const searchPromises = searchProviderId === null ? [...this.searchProviderIds].map((pid) => {\n return this.searchOneProvider(pid);\n }) : [this.searchOneProvider(searchProviderId, this.resultsBySearchProvider[searchProviderId]?.cursor ?? null)];\n return Promise.allSettled(searchPromises).then((promises) => {\n const isOneCanceled = !!promises.find((p) => {\n return p.status === \"rejected\" && (p.reason.name === \"CanceledError\" || p.reason.code === \"ERR_CANCELED\");\n });\n if (!isOneCanceled) {\n this.searching = false;\n this.searchingMoreOf = null;\n }\n });\n },\n searchOneProvider(providerId, cursor = null) {\n const url = cursor === null ? generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}\", { providerId, term: this.searchQuery, limit: LIMIT }) : generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}\", { providerId, term: this.searchQuery, limit: LIMIT, cursor });\n return axios.get(url, {\n signal: this.abortController.signal\n }).then((response) => {\n const data = response.data.ocs.data;\n this.resultsBySearchProvider[providerId].name = data.name;\n this.resultsBySearchProvider[providerId].cursor = data.cursor;\n this.resultsBySearchProvider[providerId].isPaginated = data.isPaginated;\n this.resultsBySearchProvider[providerId].entries.push(...data.entries);\n });\n }\n }\n};\nconst _hoisted_1$2 = {\n key: 0,\n class: \"custom-option\"\n};\nconst _hoisted_2$1 = { class: \"option-text\" };\nconst _hoisted_3 = {\n key: 2,\n class: \"custom-option group-name\"\n};\nconst _hoisted_4 = [\"src\"];\nconst _hoisted_5 = { class: \"option-text\" };\nconst _hoisted_6 = {\n key: 3,\n class: \"custom-option\"\n};\nconst _hoisted_7 = {\n key: 0,\n class: \"option-simple-icon icon-loading-small\"\n};\nconst _hoisted_8 = { class: \"option-text\" };\nconst _hoisted_9 = [\"alt\", \"src\"];\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcSearchResult = resolveComponent(\"NcSearchResult\");\n const _component_DotsHorizontalIcon = resolveComponent(\"DotsHorizontalIcon\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", {\n class: normalizeClass([\"smart-picker-search\", { \"with-empty-content\": $props.showEmptyContent }])\n }, [\n createVNode(_component_NcSelect, {\n ref: \"search-select\",\n modelValue: $data.selectedResult,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedResult = $event),\n $options.onSelectResultSelected\n ],\n class: \"smart-picker-search--select\",\n \"input-id\": \"search-select-input\",\n label: \"name\",\n placeholder: $options.mySearchPlaceholder,\n options: $options.options,\n \"append-to-body\": false,\n \"close-on-select\": false,\n \"clear-search-on-select\": false,\n \"clear-search-on-blur\": () => false,\n \"reset-focus-on-options-change\": false,\n filterable: false,\n autoscroll: true,\n \"reset-on-options-change\": false,\n loading: $data.searching,\n onSearch: $options.onSearchInput\n }, {\n option: withCtx((option) => [\n option.isRawLink ? (openBlock(), createElementBlock(\"div\", _hoisted_1$2, [\n createVNode(_component_LinkVariantIcon, {\n class: \"option-simple-icon\",\n size: 20\n }),\n createElementVNode(\"span\", _hoisted_2$1, toDisplayString($options.t(\"Raw link {options}\", { options: option.resourceUrl })), 1)\n ])) : option.resourceUrl ? (openBlock(), createBlock(_component_NcSearchResult, {\n key: 1,\n class: \"search-result\",\n entry: option,\n query: $data.searchQuery\n }, null, 8, [\"entry\", \"query\"])) : option.isCustomGroupTitle ? (openBlock(), createElementBlock(\"span\", _hoisted_3, [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon group-name-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_4)) : createCommentVNode(\"\", true),\n createElementVNode(\"span\", _hoisted_5, [\n createElementVNode(\"strong\", null, toDisplayString(option.name), 1)\n ])\n ])) : option.isMore ? (openBlock(), createElementBlock(\"span\", _hoisted_6, [\n option.isLoading ? (openBlock(), createElementBlock(\"span\", _hoisted_7)) : (openBlock(), createBlock(_component_DotsHorizontalIcon, {\n key: 1,\n class: \"option-simple-icon\",\n size: 20\n })),\n createElementVNode(\"span\", _hoisted_8, toDisplayString($options.t('Load more \"{options}\"', { options: option.name })), 1)\n ])) : createCommentVNode(\"\", true)\n ]),\n \"no-options\": withCtx(() => [\n createTextVNode(toDisplayString($data.noOptionsText), 1)\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"loading\", \"onSearch\", \"onUpdate:modelValue\"]),\n $props.showEmptyContent ? (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 0,\n class: \"smart-picker-search--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n alt: $data.providerIconAlt,\n src: $props.provider.icon_url\n }, null, 8, _hoisted_9)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n}\nconst NcSearch = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$2], [\"__scopeId\", \"data-v-e8abf1d4\"]]);\nconst MODES = {\n providerList: 1,\n standardLinkInput: 2,\n searchInput: 3,\n customElement: 4\n};\nconst _sfc_main$1 = {\n name: \"NcReferencePicker\",\n components: {\n NcCustomPickerElement,\n NcProviderList,\n NcRawLinkInput,\n NcSearch\n },\n props: {\n /**\n * Provider to select on creation\n * Default: null. Show the provider list\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Optional width in pixels\n * Default: 100%\n */\n width: {\n type: Number,\n default: null\n },\n /**\n * Focus on the provider list select input on creation\n * Default: true\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"cancel\",\n \"cancelRawLink\",\n \"cancelSearch\",\n \"providerSelected\",\n \"submit\"\n ],\n data() {\n return {\n MODES,\n selectedProvider: this.initialProvider\n };\n },\n computed: {\n mode() {\n return this.selectedProvider === null ? MODES.providerList : isCustomPickerElementRegistered(this.selectedProvider.id) ? MODES.customElement : this.selectedProvider.search_providers_ids ? MODES.searchInput : MODES.standardLinkInput;\n },\n pickerWrapperStyle() {\n return {\n width: this.width ? this.width + \"px\" : void 0\n };\n }\n },\n mounted() {\n if (this.focusOnCreate) {\n if (this.initialProvider) {\n setTimeout(() => {\n this.$refs[\"url-input\"]?.focus();\n }, 300);\n } else {\n this.$nextTick(() => {\n this.$refs[\"provider-list\"]?.focus();\n });\n }\n }\n },\n methods: {\n onEscapePressed() {\n if (this.selectedProvider !== null) {\n this.deselectProvider();\n } else {\n this.cancelProviderSelection();\n }\n },\n onProviderSelected(provider) {\n this.selectedProvider = provider;\n this.$emit(\"providerSelected\", provider);\n this.$nextTick(() => {\n this.$refs[\"url-input\"]?.focus();\n });\n },\n cancelCustomElement() {\n this.deselectProvider();\n },\n cancelSearch() {\n this.$emit(\"cancelSearch\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelRawLinkInput() {\n this.$emit(\"cancelRawLink\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelProviderSelection() {\n this.$emit(\"cancel\");\n },\n submitLink(link) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"submit\", link);\n this.deselectProvider();\n },\n deselectProvider() {\n this.selectedProvider = null;\n this.$emit(\"providerSelected\", null);\n setTimeout(() => {\n this.$refs[\"provider-list\"]?.focus();\n }, 300);\n }\n }\n};\nconst _hoisted_1$1 = {\n key: 3,\n class: \"custom-element-wrapper\"\n};\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcProviderList = resolveComponent(\"NcProviderList\");\n const _component_NcRawLinkInput = resolveComponent(\"NcRawLinkInput\");\n const _component_NcSearch = resolveComponent(\"NcSearch\");\n const _component_NcCustomPickerElement = resolveComponent(\"NcCustomPickerElement\");\n return openBlock(), createElementBlock(\"div\", {\n class: \"reference-picker\",\n style: normalizeStyle($options.pickerWrapperStyle),\n tabindex: \"-1\",\n onKeydown: _cache[0] || (_cache[0] = withKeys(withModifiers((...args) => $options.onEscapePressed && $options.onEscapePressed(...args), [\"stop\", \"prevent\"]), [\"esc\"]))\n }, [\n $options.mode === $data.MODES.providerList ? (openBlock(), createBlock(_component_NcProviderList, {\n key: 0,\n ref: \"provider-list\",\n onSelectProvider: $options.onProviderSelected,\n onSubmit: $options.submitLink,\n onCancel: $options.cancelProviderSelection\n }, null, 8, [\"onSelectProvider\", \"onSubmit\", \"onCancel\"])) : $options.mode === $data.MODES.standardLinkInput ? (openBlock(), createBlock(_component_NcRawLinkInput, {\n key: 1,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onCancel: $options.cancelRawLinkInput\n }, null, 8, [\"provider\", \"onSubmit\", \"onCancel\"])) : $options.mode === $data.MODES.searchInput ? (openBlock(), createBlock(_component_NcSearch, {\n key: 2,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onCancel: $options.cancelSearch,\n onSubmit: $options.submitLink\n }, null, 8, [\"provider\", \"onCancel\", \"onSubmit\"])) : $options.mode === $data.MODES.customElement ? (openBlock(), createElementBlock(\"div\", _hoisted_1$1, [\n createVNode(_component_NcCustomPickerElement, {\n provider: $data.selectedProvider,\n class: \"custom-element\",\n onSubmit: $options.submitLink,\n onCancel: $options.cancelCustomElement\n }, null, 8, [\"provider\", \"onSubmit\", \"onCancel\"])\n ])) : createCommentVNode(\"\", true)\n ], 36);\n}\nconst NcReferencePicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render$1], [\"__scopeId\", \"data-v-b193005a\"]]);\nregister(t12, t19);\nconst _sfc_main = {\n name: \"NcReferencePickerModal\",\n components: {\n NcReferencePicker,\n NcModal,\n NcButton,\n ArrowLeftIcon,\n CloseIcon: IconClose\n },\n props: {\n /**\n * Provider to select on creation\n * Show the provider list if no initial one is provided\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Focus on the input item on create\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n },\n /**\n * If true, add the modal content to the Viewer trap elements via the event-bus\n */\n isInsideViewer: {\n type: Boolean,\n default: false\n }\n },\n emits: [\n \"cancel\",\n \"submit\"\n ],\n data() {\n return {\n show: true,\n selectedProvider: this.initialProvider,\n backButtonTitle: t(\"Back to provider selection\"),\n closeButtonTitle: t(\"Close\"),\n closeButtonLabel: t(\"Close Smart Picker\")\n };\n },\n computed: {\n isProviderSelected() {\n return this.selectedProvider !== null;\n },\n showBackButton() {\n return this.initialProvider === null && this.isProviderSelected;\n },\n modalSize() {\n return this.isProviderSelected && isCustomPickerElementRegistered(this.selectedProvider.id) ? getCustomPickerElementSize(this.selectedProvider.id) ?? \"large\" : \"normal\";\n },\n showModalName() {\n return !this.isProviderSelected || !isCustomPickerElementRegistered(this.selectedProvider.id);\n },\n modalName() {\n return this.isProviderSelected ? this.selectedProvider.title : t(\"Smart Picker\");\n }\n },\n mounted() {\n if (this.isInsideViewer) {\n const elem = this.$refs.modal_content;\n emit(\"viewer:trapElements:changed\", elem);\n }\n },\n methods: {\n onCancel() {\n this.show = false;\n this.$emit(\"cancel\");\n },\n onSubmit(value) {\n this.show = false;\n this.$emit(\"submit\", value);\n },\n onProviderSelect(provider) {\n this.selectedProvider = provider;\n if (provider === null && this.initialProvider !== null) {\n this.onCancel();\n }\n },\n onBackClicked() {\n this.$refs.referencePicker.deselectProvider();\n }\n }\n};\nconst _hoisted_1 = {\n ref: \"modal_content\",\n class: \"reference-picker-modal--content\"\n};\nconst _hoisted_2 = { key: 1 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_ArrowLeftIcon = resolveComponent(\"ArrowLeftIcon\");\n const _component_NcButton = resolveComponent(\"NcButton\");\n const _component_CloseIcon = resolveComponent(\"CloseIcon\");\n const _component_NcReferencePicker = resolveComponent(\"NcReferencePicker\");\n const _component_NcModal = resolveComponent(\"NcModal\");\n return $data.show ? (openBlock(), createBlock(_component_NcModal, {\n key: 0,\n size: $options.modalSize,\n class: \"reference-picker-modal\",\n onClose: $options.onCancel\n }, {\n default: withCtx(() => [\n createElementVNode(\"div\", _hoisted_1, [\n $options.showBackButton ? (openBlock(), createBlock(_component_NcButton, {\n key: 0,\n \"aria-label\": $data.backButtonTitle,\n title: $data.backButtonTitle,\n class: \"back-button\",\n onClick: $options.onBackClicked\n }, {\n icon: withCtx(() => [\n createVNode(_component_ArrowLeftIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"])) : createCommentVNode(\"\", true),\n createVNode(_component_NcButton, {\n class: \"close-button\",\n \"aria-label\": $data.closeButtonLabel,\n title: $data.closeButtonTitle,\n variant: \"tertiary\",\n onClick: $options.onCancel\n }, {\n icon: withCtx(() => [\n createVNode(_component_CloseIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]),\n $options.showModalName ? (openBlock(), createElementBlock(\"h2\", _hoisted_2, toDisplayString($options.modalName), 1)) : createCommentVNode(\"\", true),\n createVNode(_component_NcReferencePicker, {\n ref: \"referencePicker\",\n \"initial-provider\": $props.initialProvider,\n \"focus-on-create\": $props.focusOnCreate,\n onProviderSelected: $options.onProviderSelect,\n onSubmit: $options.onSubmit,\n onCancel: $options.onCancel\n }, null, 8, [\"initial-provider\", \"focus-on-create\", \"onProviderSelected\", \"onSubmit\", \"onCancel\"])\n ], 512)\n ]),\n _: 1\n }, 8, [\"size\", \"onClose\"])) : createCommentVNode(\"\", true);\n}\nconst NcReferencePickerModal = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-15018516\"]]);\nasync function getLinkWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onSubmit(link) {\n view.unmount();\n resolve(link);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nexport {\n NcReferencePicker as N,\n anyLinkProviderId as a,\n getProvider as b,\n getProviders as c,\n sortProviders as d,\n NcReferencePickerModal as e,\n NcReferenceWidget as f,\n getLinkWithPicker as g,\n NcSearch as h,\n searchProvider as s\n};\n//# sourceMappingURL=referencePickerModal-CXAtbcPd.mjs.map\n","import { d as mdiCheck, e as mdiContentCopy } from \"./mdi-CpchYUUV.mjs\";\nimport { ref, computed, toValue } from \"vue\";\nimport { r as register, e as t22, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nregister(t22);\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst DELAY = 2e3;\nfunction useCopy(content) {\n const isCopied = ref(false);\n const icon = computed(() => isCopied.value ? mdiCheck : mdiContentCopy);\n const altText = computed(() => isCopied.value ? t(\"Copied\") : t(\"Copy to clipboard\"));\n async function copy() {\n if (isCopied.value) {\n return;\n }\n const value = toValue(content);\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n prompt(\"\", value);\n }\n isCopied.value = true;\n setTimeout(() => {\n isCopied.value = false;\n }, DELAY);\n }\n return {\n isCopied,\n copy,\n icon,\n altText\n };\n}\nexport {\n useCopy as u\n};\n//# sourceMappingURL=useCopy-D4CcMqlA.mjs.map\n","import '../assets/NcRichText-RvICaxkO.css';\nimport rehypeExternalLinks from \"rehype-external-links\";\nimport rehype2react from \"rehype-react\";\nimport breaks from \"remark-breaks\";\nimport remarkParse from \"remark-parse\";\nimport remark2rehype from \"remark-rehype\";\nimport remarkUnlinkProtocols from \"remark-unlink-protocols\";\nimport { unified } from \"unified\";\nimport { resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, Fragment, renderList, createBlock, defineComponent, unref, withCtx, createVNode, ref, h } from \"vue\";\nimport { RouterLink } from \"vue-router\";\nimport { N as NcCheckboxRadioSwitch } from \"./NcCheckboxRadioSwitch-DisCqPZK.mjs\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { getSharingToken } from \"@nextcloud/sharing/public\";\nimport { f as NcReferenceWidget } from \"./referencePickerModal-CXAtbcPd.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { U as URL_PATTERN, g as getRoute, p as parseUrl, r as remarkAutolink } from \"./autolink-U5pBzLgI.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nimport { N as NcButton } from \"./NcButton-CzpKEx4V.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { u as useCopy } from \"./useCopy-D4CcMqlA.mjs\";\nimport { c as createElementId } from \"./createElementId-DhjFt1I9.mjs\";\nimport { u } from \"unist-builder\";\nimport { visit, EXIT as EXIT$1, SKIP as SKIP$1 } from \"unist-util-visit\";\nconst _sfc_main$2 = {\n name: \"NcReferenceList\",\n components: {\n NcReferenceWidget\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n text: {\n type: String,\n default: \"\"\n },\n referenceData: {\n type: Array,\n default: null\n },\n limit: {\n type: Number,\n default: 1\n },\n displayFallback: {\n type: Boolean,\n default: false\n },\n interactive: {\n type: Boolean,\n default: true\n },\n interactiveOptIn: {\n type: Boolean,\n default: false\n }\n },\n emits: [\"loaded\"],\n data() {\n return {\n references: null,\n loading: true\n };\n },\n computed: {\n isVisible() {\n return this.loading || this.displayedReferences.length !== 0;\n },\n values() {\n if (this.referenceData) {\n return this.referenceData;\n }\n if (this.displayFallback && !this.loading && !this.references) {\n return [this.fallbackReference];\n }\n return this.references ? Object.values(this.references) : [];\n },\n firstReference() {\n return this.values[0] ?? null;\n },\n displayedReferences() {\n return this.values.filter(Boolean).slice(0, this.limit);\n },\n fallbackReference() {\n return {\n accessible: true,\n openGraphObject: {\n id: this.text,\n link: this.text,\n name: this.text\n },\n richObjectType: \"open-graph\"\n };\n }\n },\n watch: {\n text: \"fetch\"\n },\n mounted() {\n this.fetch();\n },\n methods: {\n fetch() {\n this.loading = true;\n if (this.referenceData) {\n this.references = null;\n this.loading = false;\n return;\n }\n if (!new RegExp(URL_PATTERN).exec(this.text)) {\n this.references = null;\n this.loading = false;\n return;\n }\n this.resolve().then((response) => {\n this.references = response.data.ocs.data.references;\n this.loading = false;\n this.$emit(\"loaded\");\n }).catch((error) => {\n logger.error(\"[NcReferenceList] Failed to extract references\", { error });\n this.loading = false;\n this.$emit(\"loaded\");\n });\n },\n resolve() {\n const match = new RegExp(URL_PATTERN).exec(this.text.trim());\n const isPublic = getCurrentUser() === null;\n if (this.limit === 1 && match) {\n return isPublic ? axios.get(generateOcsUrl(\"references/resolvePublic\") + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`) : axios.get(generateOcsUrl(\"references/resolve\") + `?reference=${encodeURIComponent(match[0])}`);\n }\n return isPublic ? axios.post(generateOcsUrl(\"references/extractPublic\"), {\n text: this.text,\n resolve: true,\n limit: this.limit,\n sharingToken: getSharingToken()\n }) : axios.post(generateOcsUrl(\"references/extract\"), {\n text: this.text,\n resolve: true,\n limit: this.limit\n });\n }\n }\n};\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n return $options.isVisible ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([\"widgets--list\", { \"icon-loading\": $data.loading }])\n }, [\n (openBlock(true), createElementBlock(Fragment, null, renderList($options.displayedReferences, (reference) => {\n return openBlock(), createBlock(_component_NcReferenceWidget, {\n key: reference.openGraphObject?.id,\n reference,\n interactive: $props.interactive,\n \"interactive-opt-in\": $props.interactiveOptIn\n }, null, 8, [\"reference\", \"interactive\", \"interactive-opt-in\"]);\n }), 128))\n ], 2)) : createCommentVNode(\"\", true);\n}\nconst NcReferenceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-cd116174\"]]);\nfunction ccount(value, character) {\n const source = String(value);\n if (typeof character !== \"string\") {\n throw new TypeError(\"Expected character\");\n }\n let count = 0;\n let index = source.indexOf(character);\n while (index !== -1) {\n count++;\n index = source.indexOf(character, index + character.length);\n }\n return count;\n}\nfunction ok$1() {\n}\nconst asciiAlpha = regexCheck(/[A-Za-z]/);\nconst asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\nfunction asciiControl(code2) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code2 !== null && (code2 < 32 || code2 === 127)\n );\n}\nfunction markdownLineEnding(code2) {\n return code2 !== null && code2 < -2;\n}\nfunction markdownLineEndingOrSpace(code2) {\n return code2 !== null && (code2 < 0 || code2 === 32);\n}\nfunction markdownSpace(code2) {\n return code2 === -2 || code2 === -1 || code2 === 32;\n}\nconst unicodePunctuation = regexCheck(new RegExp(\"\\\\p{P}|\\\\p{S}\", \"u\"));\nconst unicodeWhitespace = regexCheck(/\\s/);\nfunction regexCheck(regex) {\n return check;\n function check(code2) {\n return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));\n }\n}\nfunction escapeStringRegexp(string) {\n if (typeof string !== \"string\") {\n throw new TypeError(\"Expected a string\");\n }\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n}\nconst convert = (\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n (function(test) {\n if (test === null || test === void 0) {\n return ok;\n }\n if (typeof test === \"function\") {\n return castFactory(test);\n }\n if (typeof test === \"object\") {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test);\n }\n if (typeof test === \"string\") {\n return typeFactory(test);\n }\n throw new Error(\"Expected function, string, or object as test\");\n })\n);\nfunction anyFactory(tests) {\n const checks = [];\n let index = -1;\n while (++index < tests.length) {\n checks[index] = convert(tests[index]);\n }\n return castFactory(any);\n function any(...parameters) {\n let index2 = -1;\n while (++index2 < checks.length) {\n if (checks[index2].apply(this, parameters)) return true;\n }\n return false;\n }\n}\nfunction propsFactory(check) {\n const checkAsRecord = (\n /** @type {Record} */\n check\n );\n return castFactory(all2);\n function all2(node2) {\n const nodeAsRecord = (\n /** @type {Record} */\n /** @type {unknown} */\n node2\n );\n let key;\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false;\n }\n return true;\n }\n}\nfunction typeFactory(check) {\n return castFactory(type);\n function type(node2) {\n return node2 && node2.type === check;\n }\n}\nfunction castFactory(testFunction) {\n return check;\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) && testFunction.call(\n this,\n value,\n typeof index === \"number\" ? index : void 0,\n parent || void 0\n )\n );\n }\n}\nfunction ok() {\n return true;\n}\nfunction looksLikeANode(value) {\n return value !== null && typeof value === \"object\" && \"type\" in value;\n}\nfunction color(d) {\n return d;\n}\nconst empty = [];\nconst CONTINUE = true;\nconst EXIT = false;\nconst SKIP = \"skip\";\nfunction visitParents(tree, test, visitor, reverse) {\n let check;\n {\n check = test;\n }\n const is = convert(check);\n const step = 1;\n factory(tree, void 0, [])();\n function factory(node2, index, parents) {\n const value = (\n /** @type {Record} */\n node2 && typeof node2 === \"object\" ? node2 : {}\n );\n if (typeof value.type === \"string\") {\n const name = (\n // `hast`\n typeof value.tagName === \"string\" ? value.tagName : (\n // `xast`\n typeof value.name === \"string\" ? value.name : void 0\n )\n );\n Object.defineProperty(visit2, \"name\", {\n value: \"node (\" + color(node2.type + (name ? \"<\" + name + \">\" : \"\")) + \")\"\n });\n }\n return visit2;\n function visit2() {\n let result = empty;\n let subresult;\n let offset;\n let grandparents;\n if (is(node2, index, parents[parents.length - 1] || void 0)) {\n result = toResult(visitor(node2, parents));\n if (result[0] === EXIT) {\n return result;\n }\n }\n if (\"children\" in node2 && node2.children) {\n const nodeAsParent = (\n /** @type {UnistParent} */\n node2\n );\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = -1 + step;\n grandparents = parents.concat(nodeAsParent);\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset];\n subresult = factory(child, offset, grandparents)();\n if (subresult[0] === EXIT) {\n return subresult;\n }\n offset = typeof subresult[1] === \"number\" ? subresult[1] : offset + step;\n }\n }\n }\n return result;\n }\n }\n}\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === \"number\") {\n return [CONTINUE, value];\n }\n return value === null || value === void 0 ? empty : [value];\n}\nfunction findAndReplace(tree, list2, options) {\n const settings = options || {};\n const ignored = convert(settings.ignore || []);\n const pairs = toPairs(list2);\n let pairIndex = -1;\n while (++pairIndex < pairs.length) {\n visitParents(tree, \"text\", visitor);\n }\n function visitor(node2, parents) {\n let index = -1;\n let grandparent;\n while (++index < parents.length) {\n const parent = parents[index];\n const siblings = grandparent ? grandparent.children : void 0;\n if (ignored(\n parent,\n siblings ? siblings.indexOf(parent) : void 0,\n grandparent\n )) {\n return;\n }\n grandparent = parent;\n }\n if (grandparent) {\n return handler(node2, parents);\n }\n }\n function handler(node2, parents) {\n const parent = parents[parents.length - 1];\n const find = pairs[pairIndex][0];\n const replace2 = pairs[pairIndex][1];\n let start = 0;\n const siblings = parent.children;\n const index = siblings.indexOf(node2);\n let change = false;\n let nodes = [];\n find.lastIndex = 0;\n let match = find.exec(node2.value);\n while (match) {\n const position = match.index;\n const matchObject = {\n index: match.index,\n input: match.input,\n stack: [...parents, node2]\n };\n let value = replace2(...match, matchObject);\n if (typeof value === \"string\") {\n value = value.length > 0 ? { type: \"text\", value } : void 0;\n }\n if (value === false) {\n find.lastIndex = position + 1;\n } else {\n if (start !== position) {\n nodes.push({\n type: \"text\",\n value: node2.value.slice(start, position)\n });\n }\n if (Array.isArray(value)) {\n nodes.push(...value);\n } else if (value) {\n nodes.push(value);\n }\n start = position + match[0].length;\n change = true;\n }\n if (!find.global) {\n break;\n }\n match = find.exec(node2.value);\n }\n if (change) {\n if (start < node2.value.length) {\n nodes.push({ type: \"text\", value: node2.value.slice(start) });\n }\n parent.children.splice(index, 1, ...nodes);\n } else {\n nodes = [node2];\n }\n return index + nodes.length;\n }\n}\nfunction toPairs(tupleOrList) {\n const result = [];\n if (!Array.isArray(tupleOrList)) {\n throw new TypeError(\"Expected find and replace tuple or list of tuples\");\n }\n const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];\n let index = -1;\n while (++index < list2.length) {\n const tuple = list2[index];\n result.push([toExpression(tuple[0]), toFunction(tuple[1])]);\n }\n return result;\n}\nfunction toExpression(find) {\n return typeof find === \"string\" ? new RegExp(escapeStringRegexp(find), \"g\") : find;\n}\nfunction toFunction(replace2) {\n return typeof replace2 === \"function\" ? replace2 : function() {\n return replace2;\n };\n}\nconst inConstruct = \"phrasing\";\nconst notInConstruct = [\"autolink\", \"link\", \"image\", \"label\"];\nfunction gfmAutolinkLiteralFromMarkdown() {\n return {\n transforms: [transformGfmAutolinkLiterals],\n enter: {\n literalAutolink: enterLiteralAutolink,\n literalAutolinkEmail: enterLiteralAutolinkValue,\n literalAutolinkHttp: enterLiteralAutolinkValue,\n literalAutolinkWww: enterLiteralAutolinkValue\n },\n exit: {\n literalAutolink: exitLiteralAutolink,\n literalAutolinkEmail: exitLiteralAutolinkEmail,\n literalAutolinkHttp: exitLiteralAutolinkHttp,\n literalAutolinkWww: exitLiteralAutolinkWww\n }\n };\n}\nfunction gfmAutolinkLiteralToMarkdown() {\n return {\n unsafe: [\n {\n character: \"@\",\n before: \"[+\\\\-.\\\\w]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \".\",\n before: \"[Ww]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \":\",\n before: \"[ps]\",\n after: \"\\\\/\",\n inConstruct,\n notInConstruct\n }\n ]\n };\n}\nfunction enterLiteralAutolink(token) {\n this.enter({ type: \"link\", title: null, url: \"\", children: [] }, token);\n}\nfunction enterLiteralAutolinkValue(token) {\n this.config.enter.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkHttp(token) {\n this.config.exit.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkWww(token) {\n this.config.exit.data.call(this, token);\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"link\");\n node2.url = \"http://\" + this.sliceSerialize(token);\n}\nfunction exitLiteralAutolinkEmail(token) {\n this.config.exit.autolinkEmail.call(this, token);\n}\nfunction exitLiteralAutolink(token) {\n this.exit(token);\n}\nfunction transformGfmAutolinkLiterals(tree) {\n findAndReplace(\n tree,\n [\n [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n [/([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/g, findEmail]\n ],\n { ignore: [\"link\", \"linkReference\"] }\n );\n}\nfunction findUrl(_, protocol, domain2, path2, match) {\n let prefix = \"\";\n if (!previous(match)) {\n return false;\n }\n if (/^w/i.test(protocol)) {\n domain2 = protocol + domain2;\n protocol = \"\";\n prefix = \"http://\";\n }\n if (!isCorrectDomain(domain2)) {\n return false;\n }\n const parts = splitUrl(domain2 + path2);\n if (!parts[0]) return false;\n const result = {\n type: \"link\",\n title: null,\n url: prefix + protocol + parts[0],\n children: [{ type: \"text\", value: protocol + parts[0] }]\n };\n if (parts[1]) {\n return [result, { type: \"text\", value: parts[1] }];\n }\n return result;\n}\nfunction findEmail(_, atext, label, match) {\n if (\n // Not an expected previous character.\n !previous(match, true) || // Label ends in not allowed character.\n /[-\\d_]$/.test(label)\n ) {\n return false;\n }\n return {\n type: \"link\",\n title: null,\n url: \"mailto:\" + atext + \"@\" + label,\n children: [{ type: \"text\", value: atext + \"@\" + label }]\n };\n}\nfunction isCorrectDomain(domain2) {\n const parts = domain2.split(\".\");\n if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 2]))) {\n return false;\n }\n return true;\n}\nfunction splitUrl(url) {\n const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url);\n if (!trailExec) {\n return [url, void 0];\n }\n url = url.slice(0, trailExec.index);\n let trail2 = trailExec[0];\n let closingParenIndex = trail2.indexOf(\")\");\n const openingParens = ccount(url, \"(\");\n let closingParens = ccount(url, \")\");\n while (closingParenIndex !== -1 && openingParens > closingParens) {\n url += trail2.slice(0, closingParenIndex + 1);\n trail2 = trail2.slice(closingParenIndex + 1);\n closingParenIndex = trail2.indexOf(\")\");\n closingParens++;\n }\n return [url, trail2];\n}\nfunction previous(match, email) {\n const code2 = match.input.charCodeAt(match.index - 1);\n return (match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2)) && (!email || code2 !== 47);\n}\nfunction normalizeIdentifier(value) {\n return value.replace(/[\\t\\n\\r ]+/g, \" \").replace(/^ | $/g, \"\").toLowerCase().toUpperCase();\n}\nfootnoteReference.peek = footnoteReferencePeek;\nfunction enterFootnoteCallString() {\n this.buffer();\n}\nfunction enterFootnoteCall(token) {\n this.enter({ type: \"footnoteReference\", identifier: \"\", label: \"\" }, token);\n}\nfunction enterFootnoteDefinitionLabelString() {\n this.buffer();\n}\nfunction enterFootnoteDefinition(token) {\n this.enter(\n { type: \"footnoteDefinition\", identifier: \"\", label: \"\", children: [] },\n token\n );\n}\nfunction exitFootnoteCallString(token) {\n const label = this.resume();\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"footnoteReference\");\n node2.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node2.label = label;\n}\nfunction exitFootnoteCall(token) {\n this.exit(token);\n}\nfunction exitFootnoteDefinitionLabelString(token) {\n const label = this.resume();\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"footnoteDefinition\");\n node2.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node2.label = label;\n}\nfunction exitFootnoteDefinition(token) {\n this.exit(token);\n}\nfunction footnoteReferencePeek() {\n return \"[\";\n}\nfunction footnoteReference(node2, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteReference\");\n const subexit = state.enter(\"reference\");\n value += tracker.move(\n state.safe(state.associationId(node2), { after: \"]\", before: value })\n );\n subexit();\n exit2();\n value += tracker.move(\"]\");\n return value;\n}\nfunction gfmFootnoteFromMarkdown() {\n return {\n enter: {\n gfmFootnoteCallString: enterFootnoteCallString,\n gfmFootnoteCall: enterFootnoteCall,\n gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: enterFootnoteDefinition\n },\n exit: {\n gfmFootnoteCallString: exitFootnoteCallString,\n gfmFootnoteCall: exitFootnoteCall,\n gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: exitFootnoteDefinition\n }\n };\n}\nfunction gfmFootnoteToMarkdown(options) {\n let firstLineBlank = false;\n if (options && options.firstLineBlank) {\n firstLineBlank = true;\n }\n return {\n handlers: { footnoteDefinition, footnoteReference },\n // This is on by default already.\n unsafe: [{ character: \"[\", inConstruct: [\"label\", \"phrasing\", \"reference\"] }]\n };\n function footnoteDefinition(node2, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteDefinition\");\n const subexit = state.enter(\"label\");\n value += tracker.move(\n state.safe(state.associationId(node2), { before: value, after: \"]\" })\n );\n subexit();\n value += tracker.move(\"]:\");\n if (node2.children && node2.children.length > 0) {\n tracker.shift(4);\n value += tracker.move(\n (firstLineBlank ? \"\\n\" : \" \") + state.indentLines(\n state.containerFlow(node2, tracker.current()),\n firstLineBlank ? mapAll : mapExceptFirst\n )\n );\n }\n exit2();\n return value;\n }\n}\nfunction mapExceptFirst(line, index, blank) {\n return index === 0 ? line : mapAll(line, index, blank);\n}\nfunction mapAll(line, index, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nconst constructsWithoutStrikethrough = [\n \"autolink\",\n \"destinationLiteral\",\n \"destinationRaw\",\n \"reference\",\n \"titleQuote\",\n \"titleApostrophe\"\n];\nhandleDelete.peek = peekDelete;\nfunction gfmStrikethroughFromMarkdown() {\n return {\n canContainEols: [\"delete\"],\n enter: { strikethrough: enterStrikethrough },\n exit: { strikethrough: exitStrikethrough }\n };\n}\nfunction gfmStrikethroughToMarkdown() {\n return {\n unsafe: [\n {\n character: \"~\",\n inConstruct: \"phrasing\",\n notInConstruct: constructsWithoutStrikethrough\n }\n ],\n handlers: { delete: handleDelete }\n };\n}\nfunction enterStrikethrough(token) {\n this.enter({ type: \"delete\", children: [] }, token);\n}\nfunction exitStrikethrough(token) {\n this.exit(token);\n}\nfunction handleDelete(node2, _, state, info) {\n const tracker = state.createTracker(info);\n const exit2 = state.enter(\"strikethrough\");\n let value = tracker.move(\"~~\");\n value += state.containerPhrasing(node2, {\n ...tracker.current(),\n before: value,\n after: \"~\"\n });\n value += tracker.move(\"~~\");\n exit2();\n return value;\n}\nfunction peekDelete() {\n return \"~\";\n}\nfunction defaultStringLength(value) {\n return value.length;\n}\nfunction markdownTable(table, options) {\n const settings = options || {};\n const align = (settings.align || []).concat();\n const stringLength = settings.stringLength || defaultStringLength;\n const alignments = [];\n const cellMatrix = [];\n const sizeMatrix = [];\n const longestCellByColumn = [];\n let mostCellsPerRow = 0;\n let rowIndex = -1;\n while (++rowIndex < table.length) {\n const row2 = [];\n const sizes2 = [];\n let columnIndex2 = -1;\n if (table[rowIndex].length > mostCellsPerRow) {\n mostCellsPerRow = table[rowIndex].length;\n }\n while (++columnIndex2 < table[rowIndex].length) {\n const cell = serialize(table[rowIndex][columnIndex2]);\n if (settings.alignDelimiters !== false) {\n const size = stringLength(cell);\n sizes2[columnIndex2] = size;\n if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {\n longestCellByColumn[columnIndex2] = size;\n }\n }\n row2.push(cell);\n }\n cellMatrix[rowIndex] = row2;\n sizeMatrix[rowIndex] = sizes2;\n }\n let columnIndex = -1;\n if (typeof align === \"object\" && \"length\" in align) {\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = toAlignment(align[columnIndex]);\n }\n } else {\n const code2 = toAlignment(align);\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = code2;\n }\n }\n columnIndex = -1;\n const row = [];\n const sizes = [];\n while (++columnIndex < mostCellsPerRow) {\n const code2 = alignments[columnIndex];\n let before = \"\";\n let after = \"\";\n if (code2 === 99) {\n before = \":\";\n after = \":\";\n } else if (code2 === 108) {\n before = \":\";\n } else if (code2 === 114) {\n after = \":\";\n }\n let size = settings.alignDelimiters === false ? 1 : Math.max(\n 1,\n longestCellByColumn[columnIndex] - before.length - after.length\n );\n const cell = before + \"-\".repeat(size) + after;\n if (settings.alignDelimiters !== false) {\n size = before.length + size + after.length;\n if (size > longestCellByColumn[columnIndex]) {\n longestCellByColumn[columnIndex] = size;\n }\n sizes[columnIndex] = size;\n }\n row[columnIndex] = cell;\n }\n cellMatrix.splice(1, 0, row);\n sizeMatrix.splice(1, 0, sizes);\n rowIndex = -1;\n const lines = [];\n while (++rowIndex < cellMatrix.length) {\n const row2 = cellMatrix[rowIndex];\n const sizes2 = sizeMatrix[rowIndex];\n columnIndex = -1;\n const line = [];\n while (++columnIndex < mostCellsPerRow) {\n const cell = row2[columnIndex] || \"\";\n let before = \"\";\n let after = \"\";\n if (settings.alignDelimiters !== false) {\n const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);\n const code2 = alignments[columnIndex];\n if (code2 === 114) {\n before = \" \".repeat(size);\n } else if (code2 === 99) {\n if (size % 2) {\n before = \" \".repeat(size / 2 + 0.5);\n after = \" \".repeat(size / 2 - 0.5);\n } else {\n before = \" \".repeat(size / 2);\n after = before;\n }\n } else {\n after = \" \".repeat(size);\n }\n }\n if (settings.delimiterStart !== false && !columnIndex) {\n line.push(\"|\");\n }\n if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is\n // empty: there will be a closing space.\n !(settings.alignDelimiters === false && cell === \"\") && (settings.delimiterStart !== false || columnIndex)) {\n line.push(\" \");\n }\n if (settings.alignDelimiters !== false) {\n line.push(before);\n }\n line.push(cell);\n if (settings.alignDelimiters !== false) {\n line.push(after);\n }\n if (settings.padding !== false) {\n line.push(\" \");\n }\n if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {\n line.push(\"|\");\n }\n }\n lines.push(\n settings.delimiterEnd === false ? line.join(\"\").replace(/ +$/, \"\") : line.join(\"\")\n );\n }\n return lines.join(\"\\n\");\n}\nfunction serialize(value) {\n return value === null || value === void 0 ? \"\" : String(value);\n}\nfunction toAlignment(value) {\n const code2 = typeof value === \"string\" ? value.codePointAt(0) : 0;\n return code2 === 67 || code2 === 99 ? 99 : code2 === 76 || code2 === 108 ? 108 : code2 === 82 || code2 === 114 ? 114 : 0;\n}\nfunction blockquote(node2, _, state, info) {\n const exit2 = state.enter(\"blockquote\");\n const tracker = state.createTracker(info);\n tracker.move(\"> \");\n tracker.shift(2);\n const value = state.indentLines(\n state.containerFlow(node2, tracker.current()),\n map$1\n );\n exit2();\n return value;\n}\nfunction map$1(line, _, blank) {\n return \">\" + (blank ? \"\" : \" \") + line;\n}\nfunction patternInScope(stack, pattern) {\n return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);\n}\nfunction listInScope(stack, list2, none) {\n if (typeof list2 === \"string\") {\n list2 = [list2];\n }\n if (!list2 || list2.length === 0) {\n return none;\n }\n let index = -1;\n while (++index < list2.length) {\n if (stack.includes(list2[index])) {\n return true;\n }\n }\n return false;\n}\nfunction hardBreak(_, _1, state, info) {\n let index = -1;\n while (++index < state.unsafe.length) {\n if (state.unsafe[index].character === \"\\n\" && patternInScope(state.stack, state.unsafe[index])) {\n return /[ \\t]/.test(info.before) ? \"\" : \" \";\n }\n }\n return \"\\\\\\n\";\n}\nfunction longestStreak(value, substring) {\n const source = String(value);\n let index = source.indexOf(substring);\n let expected = index;\n let count = 0;\n let max = 0;\n if (typeof substring !== \"string\") {\n throw new TypeError(\"Expected substring\");\n }\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count;\n }\n } else {\n count = 1;\n }\n expected = index + substring.length;\n index = source.indexOf(substring, expected);\n }\n return max;\n}\nfunction formatCodeAsIndented(node2, state) {\n return Boolean(\n state.options.fences === false && node2.value && // If there’s no info…\n !node2.lang && // And there’s a non-whitespace character…\n /[^ \\r\\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node2.value)\n );\n}\nfunction checkFence(state) {\n const marker = state.options.fence || \"`\";\n if (marker !== \"`\" && marker !== \"~\") {\n throw new Error(\n \"Cannot serialize code with `\" + marker + \"` for `options.fence`, expected `` ` `` or `~`\"\n );\n }\n return marker;\n}\nfunction code$1(node2, _, state, info) {\n const marker = checkFence(state);\n const raw = node2.value || \"\";\n const suffix = marker === \"`\" ? \"GraveAccent\" : \"Tilde\";\n if (formatCodeAsIndented(node2, state)) {\n const exit3 = state.enter(\"codeIndented\");\n const value2 = state.indentLines(raw, map);\n exit3();\n return value2;\n }\n const tracker = state.createTracker(info);\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));\n const exit2 = state.enter(\"codeFenced\");\n let value = tracker.move(sequence);\n if (node2.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`);\n value += tracker.move(\n state.safe(node2.lang, {\n before: value,\n after: \" \",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n if (node2.lang && node2.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`);\n value += tracker.move(\" \");\n value += tracker.move(\n state.safe(node2.meta, {\n before: value,\n after: \"\\n\",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n value += tracker.move(\"\\n\");\n if (raw) {\n value += tracker.move(raw + \"\\n\");\n }\n value += tracker.move(sequence);\n exit2();\n return value;\n}\nfunction map(line, _, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nfunction checkQuote(state) {\n const marker = state.options.quote || '\"';\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n \"Cannot serialize title with `\" + marker + \"` for `options.quote`, expected `\\\"`, or `'`\"\n );\n }\n return marker;\n}\nfunction definition(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"definition\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"]: \");\n subexit();\n if (\n // If there’s no url, or…\n !node2.url || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \"\\n\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n exit2();\n return value;\n}\nfunction checkEmphasis(state) {\n const marker = state.options.emphasis || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize emphasis with `\" + marker + \"` for `options.emphasis`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nfunction encodeCharacterReference(code2) {\n return \"&#x\" + code2.toString(16).toUpperCase() + \";\";\n}\nfunction classifyCharacter(code2) {\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return 1;\n }\n if (unicodePunctuation(code2)) {\n return 2;\n }\n}\nfunction encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside);\n const insideKind = classifyCharacter(inside);\n if (outsideKind === void 0) {\n return insideKind === void 0 ? (\n // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === \"_\" ? { inside: true, outside: true } : { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (letter, whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: encode outer (letter)\n { inside: false, outside: true }\n );\n }\n if (outsideKind === 1) {\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n }\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode inner (whitespace).\n { inside: true, outside: false }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n}\nemphasis.peek = emphasisPeek;\nfunction emphasis(node2, _, state, info) {\n const marker = checkEmphasis(state);\n const exit2 = state.enter(\"emphasis\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker);\n let between = tracker.move(\n state.containerPhrasing(node2, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || \"*\";\n}\nconst emptyOptions$1 = {};\nfunction toString(value, options) {\n const settings = emptyOptions$1;\n const includeImageAlt = typeof settings.includeImageAlt === \"boolean\" ? settings.includeImageAlt : true;\n const includeHtml = typeof settings.includeHtml === \"boolean\" ? settings.includeHtml : true;\n return one(value, includeImageAlt, includeHtml);\n}\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if (\"value\" in value) {\n return value.type === \"html\" && !includeHtml ? \"\" : value.value;\n }\n if (includeImageAlt && \"alt\" in value && value.alt) {\n return value.alt;\n }\n if (\"children\" in value) {\n return all(value.children, includeImageAlt, includeHtml);\n }\n }\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml);\n }\n return \"\";\n}\nfunction all(values, includeImageAlt, includeHtml) {\n const result = [];\n let index = -1;\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml);\n }\n return result.join(\"\");\n}\nfunction node(value) {\n return Boolean(value && typeof value === \"object\");\n}\nfunction formatHeadingAsSetext(node2, state) {\n let literalWithBreak = false;\n visit(node2, function(node3) {\n if (\"value\" in node3 && /\\r?\\n|\\r/.test(node3.value) || node3.type === \"break\") {\n literalWithBreak = true;\n return EXIT$1;\n }\n });\n return Boolean(\n (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)\n );\n}\nfunction heading(node2, _, state, info) {\n const rank = Math.max(Math.min(6, node2.depth || 1), 1);\n const tracker = state.createTracker(info);\n if (formatHeadingAsSetext(node2, state)) {\n const exit3 = state.enter(\"headingSetext\");\n const subexit2 = state.enter(\"phrasing\");\n const value2 = state.containerPhrasing(node2, {\n ...tracker.current(),\n before: \"\\n\",\n after: \"\\n\"\n });\n subexit2();\n exit3();\n return value2 + \"\\n\" + (rank === 1 ? \"=\" : \"-\").repeat(\n // The whole size…\n value2.length - // Minus the position of the character after the last EOL (or\n // 0 if there is none)…\n (Math.max(value2.lastIndexOf(\"\\r\"), value2.lastIndexOf(\"\\n\")) + 1)\n );\n }\n const sequence = \"#\".repeat(rank);\n const exit2 = state.enter(\"headingAtx\");\n const subexit = state.enter(\"phrasing\");\n tracker.move(sequence + \" \");\n let value = state.containerPhrasing(node2, {\n before: \"# \",\n after: \"\\n\",\n ...tracker.current()\n });\n if (/^[\\t ]/.test(value)) {\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);\n }\n value = value ? sequence + \" \" + value : sequence;\n if (state.options.closeAtx) {\n value += \" \" + sequence;\n }\n subexit();\n exit2();\n return value;\n}\nhtml.peek = htmlPeek;\nfunction html(node2) {\n return node2.value || \"\";\n}\nfunction htmlPeek() {\n return \"<\";\n}\nimage.peek = imagePeek;\nfunction image(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"image\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n value += tracker.move(\n state.safe(node2.alt, { before: value, after: \"]\", ...tracker.current() })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node2.url && node2.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction imagePeek() {\n return \"!\";\n}\nimageReference.peek = imageReferencePeek;\nfunction imageReference(node2, _, state, info) {\n const type = node2.referenceType;\n const exit2 = state.enter(\"imageReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n const alt = state.safe(node2.alt, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(alt + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !alt || alt !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction imageReferencePeek() {\n return \"!\";\n}\ninlineCode.peek = inlineCodePeek;\nfunction inlineCode(node2, _, state) {\n let value = node2.value || \"\";\n let sequence = \"`\";\n let index = -1;\n while (new RegExp(\"(^|[^`])\" + sequence + \"([^`]|$)\").test(value)) {\n sequence += \"`\";\n }\n if (/[^ \\r\\n]/.test(value) && (/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value) || /^`|`$/.test(value))) {\n value = \" \" + value + \" \";\n }\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index];\n const expression = state.compilePattern(pattern);\n let match;\n if (!pattern.atBreak) continue;\n while (match = expression.exec(value)) {\n let position = match.index;\n if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {\n position--;\n }\n value = value.slice(0, position) + \" \" + value.slice(match.index + 1);\n }\n }\n return sequence + value + sequence;\n}\nfunction inlineCodePeek() {\n return \"`\";\n}\nfunction formatLinkAsAutolink(node2, state) {\n const raw = toString(node2);\n return Boolean(\n !state.options.resourceLink && // If there’s a url…\n node2.url && // And there’s a no title…\n !node2.title && // And the content of `node` is a single text node…\n node2.children && node2.children.length === 1 && node2.children[0].type === \"text\" && // And if the url is the same as the content…\n (raw === node2.url || \"mailto:\" + raw === node2.url) && // And that starts w/ a protocol…\n /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and\n // references don’t work), space, or angle brackets…\n !/[\\0- <>\\u007F]/.test(node2.url)\n );\n}\nlink.peek = linkPeek;\nfunction link(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const tracker = state.createTracker(info);\n let exit2;\n let subexit;\n if (formatLinkAsAutolink(node2, state)) {\n const stack = state.stack;\n state.stack = [];\n exit2 = state.enter(\"autolink\");\n let value2 = tracker.move(\"<\");\n value2 += tracker.move(\n state.containerPhrasing(node2, {\n before: value2,\n after: \">\",\n ...tracker.current()\n })\n );\n value2 += tracker.move(\">\");\n exit2();\n state.stack = stack;\n return value2;\n }\n exit2 = state.enter(\"link\");\n subexit = state.enter(\"label\");\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.containerPhrasing(node2, {\n before: value,\n after: \"](\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node2.url && node2.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction linkPeek(node2, _, state) {\n return formatLinkAsAutolink(node2, state) ? \"<\" : \"[\";\n}\nlinkReference.peek = linkReferencePeek;\nfunction linkReference(node2, _, state, info) {\n const type = node2.referenceType;\n const exit2 = state.enter(\"linkReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n const text2 = state.containerPhrasing(node2, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(text2 + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !text2 || text2 !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction linkReferencePeek() {\n return \"[\";\n}\nfunction checkBullet(state) {\n const marker = state.options.bullet || \"*\";\n if (marker !== \"*\" && marker !== \"+\" && marker !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bullet`, expected `*`, `+`, or `-`\"\n );\n }\n return marker;\n}\nfunction checkBulletOther(state) {\n const bullet = checkBullet(state);\n const bulletOther = state.options.bulletOther;\n if (!bulletOther) {\n return bullet === \"*\" ? \"-\" : \"*\";\n }\n if (bulletOther !== \"*\" && bulletOther !== \"+\" && bulletOther !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + bulletOther + \"` for `options.bulletOther`, expected `*`, `+`, or `-`\"\n );\n }\n if (bulletOther === bullet) {\n throw new Error(\n \"Expected `bullet` (`\" + bullet + \"`) and `bulletOther` (`\" + bulletOther + \"`) to be different\"\n );\n }\n return bulletOther;\n}\nfunction checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || \".\";\n if (marker !== \".\" && marker !== \")\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bulletOrdered`, expected `.` or `)`\"\n );\n }\n return marker;\n}\nfunction checkRule(state) {\n const marker = state.options.rule || \"*\";\n if (marker !== \"*\" && marker !== \"-\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize rules with `\" + marker + \"` for `options.rule`, expected `*`, `-`, or `_`\"\n );\n }\n return marker;\n}\nfunction list(node2, parent, state, info) {\n const exit2 = state.enter(\"list\");\n const bulletCurrent = state.bulletCurrent;\n let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);\n const bulletOther = node2.ordered ? bullet === \".\" ? \")\" : \".\" : checkBulletOther(state);\n let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;\n if (!node2.ordered) {\n const firstListItem = node2.children ? node2.children[0] : void 0;\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === \"*\" || bullet === \"-\") && // Empty first list item:\n firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:\n state.stack[state.stack.length - 1] === \"list\" && state.stack[state.stack.length - 2] === \"listItem\" && state.stack[state.stack.length - 3] === \"list\" && state.stack[state.stack.length - 4] === \"listItem\" && // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true;\n }\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1;\n while (++index < node2.children.length) {\n const item = node2.children[index];\n if (item && item.type === \"listItem\" && item.children && item.children[0] && item.children[0].type === \"thematicBreak\") {\n useDifferentMarker = true;\n break;\n }\n }\n }\n }\n if (useDifferentMarker) {\n bullet = bulletOther;\n }\n state.bulletCurrent = bullet;\n const value = state.containerFlow(node2, info);\n state.bulletLastUsed = bullet;\n state.bulletCurrent = bulletCurrent;\n exit2();\n return value;\n}\nfunction checkListItemIndent(state) {\n const style = state.options.listItemIndent || \"one\";\n if (style !== \"tab\" && style !== \"one\" && style !== \"mixed\") {\n throw new Error(\n \"Cannot serialize items with `\" + style + \"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`\"\n );\n }\n return style;\n}\nfunction listItem(node2, parent, state, info) {\n const listItemIndent = checkListItemIndent(state);\n let bullet = state.bulletCurrent || checkBullet(state);\n if (parent && parent.type === \"list\" && parent.ordered) {\n bullet = (typeof parent.start === \"number\" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;\n }\n let size = bullet.length + 1;\n if (listItemIndent === \"tab\" || listItemIndent === \"mixed\" && (parent && parent.type === \"list\" && parent.spread || node2.spread)) {\n size = Math.ceil(size / 4) * 4;\n }\n const tracker = state.createTracker(info);\n tracker.move(bullet + \" \".repeat(size - bullet.length));\n tracker.shift(size);\n const exit2 = state.enter(\"listItem\");\n const value = state.indentLines(\n state.containerFlow(node2, tracker.current()),\n map2\n );\n exit2();\n return value;\n function map2(line, index, blank) {\n if (index) {\n return (blank ? \"\" : \" \".repeat(size)) + line;\n }\n return (blank ? bullet : bullet + \" \".repeat(size - bullet.length)) + line;\n }\n}\nfunction paragraph(node2, _, state, info) {\n const exit2 = state.enter(\"paragraph\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node2, info);\n subexit();\n exit2();\n return value;\n}\nconst phrasing = (\n /** @type {(node?: unknown) => node is Exclude} */\n convert([\n \"break\",\n \"delete\",\n \"emphasis\",\n // To do: next major: removed since footnotes were added to GFM.\n \"footnote\",\n \"footnoteReference\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n // Enabled by `mdast-util-math`:\n \"inlineMath\",\n \"link\",\n \"linkReference\",\n // Enabled by `mdast-util-mdx`:\n \"mdxJsxTextElement\",\n // Enabled by `mdast-util-mdx`:\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n // Enabled by `mdast-util-directive`:\n \"textDirective\"\n ])\n);\nfunction root(node2, _, state, info) {\n const hasPhrasing = node2.children.some(function(d) {\n return phrasing(d);\n });\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;\n return container.call(state, node2, info);\n}\nfunction checkStrong(state) {\n const marker = state.options.strong || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize strong with `\" + marker + \"` for `options.strong`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nstrong.peek = strongPeek;\nfunction strong(node2, _, state, info) {\n const marker = checkStrong(state);\n const exit2 = state.enter(\"strong\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker + marker);\n let between = tracker.move(\n state.containerPhrasing(node2, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker + marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction strongPeek(_, _1, state) {\n return state.options.strong || \"*\";\n}\nfunction text$1(node2, _, state, info) {\n return state.safe(node2.value, info);\n}\nfunction checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3;\n if (repetition < 3) {\n throw new Error(\n \"Cannot serialize rules with repetition `\" + repetition + \"` for `options.ruleRepetition`, expected `3` or more\"\n );\n }\n return repetition;\n}\nfunction thematicBreak(_, _1, state) {\n const value = (checkRule(state) + (state.options.ruleSpaces ? \" \" : \"\")).repeat(checkRuleRepetition(state));\n return state.options.ruleSpaces ? value.slice(0, -1) : value;\n}\nconst handle = {\n blockquote,\n break: hardBreak,\n code: code$1,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text: text$1,\n thematicBreak\n};\nfunction gfmTableFromMarkdown() {\n return {\n enter: {\n table: enterTable,\n tableData: enterCell,\n tableHeader: enterCell,\n tableRow: enterRow\n },\n exit: {\n codeText: exitCodeText,\n table: exitTable,\n tableData: exit,\n tableHeader: exit,\n tableRow: exit\n }\n };\n}\nfunction enterTable(token) {\n const align = token._align;\n this.enter(\n {\n type: \"table\",\n align: align.map(function(d) {\n return d === \"none\" ? null : d;\n }),\n children: []\n },\n token\n );\n this.data.inTable = true;\n}\nfunction exitTable(token) {\n this.exit(token);\n this.data.inTable = void 0;\n}\nfunction enterRow(token) {\n this.enter({ type: \"tableRow\", children: [] }, token);\n}\nfunction exit(token) {\n this.exit(token);\n}\nfunction enterCell(token) {\n this.enter({ type: \"tableCell\", children: [] }, token);\n}\nfunction exitCodeText(token) {\n let value = this.resume();\n if (this.data.inTable) {\n value = value.replace(/\\\\([\\\\|])/g, replace);\n }\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"inlineCode\");\n node2.value = value;\n this.exit(token);\n}\nfunction replace($0, $1) {\n return $1 === \"|\" ? $1 : $0;\n}\nfunction gfmTableToMarkdown(options) {\n const settings = options || {};\n const padding = settings.tableCellPadding;\n const alignDelimiters = settings.tablePipeAlign;\n const stringLength = settings.stringLength;\n const around = padding ? \" \" : \"|\";\n return {\n unsafe: [\n { character: \"\\r\", inConstruct: \"tableCell\" },\n { character: \"\\n\", inConstruct: \"tableCell\" },\n // A pipe, when followed by a tab or space (padding), or a dash or colon\n // (unpadded delimiter row), could result in a table.\n { atBreak: true, character: \"|\", after: \"[\t :-]\" },\n // A pipe in a cell must be encoded.\n { character: \"|\", inConstruct: \"tableCell\" },\n // A colon must be followed by a dash, in which case it could start a\n // delimiter row.\n { atBreak: true, character: \":\", after: \"-\" },\n // A delimiter row can also start with a dash, when followed by more\n // dashes, a colon, or a pipe.\n // This is a stricter version than the built in check for lists, thematic\n // breaks, and setex heading underlines though:\n // \n { atBreak: true, character: \"-\", after: \"[:|-]\" }\n ],\n handlers: {\n inlineCode: inlineCodeWithTable,\n table: handleTable,\n tableCell: handleTableCell,\n tableRow: handleTableRow\n }\n };\n function handleTable(node2, _, state, info) {\n return serializeData(handleTableAsData(node2, state, info), node2.align);\n }\n function handleTableRow(node2, _, state, info) {\n const row = handleTableRowAsData(node2, state, info);\n const value = serializeData([row]);\n return value.slice(0, value.indexOf(\"\\n\"));\n }\n function handleTableCell(node2, _, state, info) {\n const exit2 = state.enter(\"tableCell\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node2, {\n ...info,\n before: around,\n after: around\n });\n subexit();\n exit2();\n return value;\n }\n function serializeData(matrix, align) {\n return markdownTable(matrix, {\n align,\n // @ts-expect-error: `markdown-table` types should support `null`.\n alignDelimiters,\n // @ts-expect-error: `markdown-table` types should support `null`.\n padding,\n // @ts-expect-error: `markdown-table` types should support `null`.\n stringLength\n });\n }\n function handleTableAsData(node2, state, info) {\n const children = node2.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"table\");\n while (++index < children.length) {\n result[index] = handleTableRowAsData(children[index], state, info);\n }\n subexit();\n return result;\n }\n function handleTableRowAsData(node2, state, info) {\n const children = node2.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"tableRow\");\n while (++index < children.length) {\n result[index] = handleTableCell(children[index], node2, state, info);\n }\n subexit();\n return result;\n }\n function inlineCodeWithTable(node2, parent, state) {\n let value = handle.inlineCode(node2, parent, state);\n if (state.stack.includes(\"tableCell\")) {\n value = value.replace(/\\|/g, \"\\\\$&\");\n }\n return value;\n }\n}\nfunction gfmTaskListItemFromMarkdown() {\n return {\n exit: {\n taskListCheckValueChecked: exitCheck,\n taskListCheckValueUnchecked: exitCheck,\n paragraph: exitParagraphWithTaskListItem\n }\n };\n}\nfunction gfmTaskListItemToMarkdown() {\n return {\n unsafe: [{ atBreak: true, character: \"-\", after: \"[:|-]\" }],\n handlers: { listItem: listItemWithTaskListItem }\n };\n}\nfunction exitCheck(token) {\n const node2 = this.stack[this.stack.length - 2];\n ok$1(node2.type === \"listItem\");\n node2.checked = token.type === \"taskListCheckValueChecked\";\n}\nfunction exitParagraphWithTaskListItem(token) {\n const parent = this.stack[this.stack.length - 2];\n if (parent && parent.type === \"listItem\" && typeof parent.checked === \"boolean\") {\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"paragraph\");\n const head = node2.children[0];\n if (head && head.type === \"text\") {\n const siblings = parent.children;\n let index = -1;\n let firstParaghraph;\n while (++index < siblings.length) {\n const sibling = siblings[index];\n if (sibling.type === \"paragraph\") {\n firstParaghraph = sibling;\n break;\n }\n }\n if (firstParaghraph === node2) {\n head.value = head.value.slice(1);\n if (head.value.length === 0) {\n node2.children.shift();\n } else if (node2.position && head.position && typeof head.position.start.offset === \"number\") {\n head.position.start.column++;\n head.position.start.offset++;\n node2.position.start = Object.assign({}, head.position.start);\n }\n }\n }\n }\n this.exit(token);\n}\nfunction listItemWithTaskListItem(node2, parent, state, info) {\n const head = node2.children[0];\n const checkable = typeof node2.checked === \"boolean\" && head && head.type === \"paragraph\";\n const checkbox = \"[\" + (node2.checked ? \"x\" : \" \") + \"] \";\n const tracker = state.createTracker(info);\n if (checkable) {\n tracker.move(checkbox);\n }\n let value = handle.listItem(node2, parent, state, {\n ...info,\n ...tracker.current()\n });\n if (checkable) {\n value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check);\n }\n return value;\n function check($0) {\n return $0 + checkbox;\n }\n}\nfunction gfmFromMarkdown() {\n return [\n gfmAutolinkLiteralFromMarkdown(),\n gfmFootnoteFromMarkdown(),\n gfmStrikethroughFromMarkdown(),\n gfmTableFromMarkdown(),\n gfmTaskListItemFromMarkdown()\n ];\n}\nfunction gfmToMarkdown(options) {\n return {\n extensions: [\n gfmAutolinkLiteralToMarkdown(),\n gfmFootnoteToMarkdown(options),\n gfmStrikethroughToMarkdown(),\n gfmTableToMarkdown(options),\n gfmTaskListItemToMarkdown()\n ]\n };\n}\nfunction splice(list2, start, remove, items) {\n const end = list2.length;\n let chunkStart = 0;\n let parameters;\n if (start < 0) {\n start = -start > end ? 0 : end + start;\n } else {\n start = start > end ? end : start;\n }\n remove = remove > 0 ? remove : 0;\n if (items.length < 1e4) {\n parameters = Array.from(items);\n parameters.unshift(start, remove);\n list2.splice(...parameters);\n } else {\n if (remove) list2.splice(start, remove);\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 1e4);\n parameters.unshift(start, 0);\n list2.splice(...parameters);\n chunkStart += 1e4;\n start += 1e4;\n }\n }\n}\nconst hasOwnProperty = {}.hasOwnProperty;\nfunction combineExtensions(extensions) {\n const all2 = {};\n let index = -1;\n while (++index < extensions.length) {\n syntaxExtension(all2, extensions[index]);\n }\n return all2;\n}\nfunction syntaxExtension(all2, extension) {\n let hook;\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;\n const left = maybe || (all2[hook] = {});\n const right = extension[hook];\n let code2;\n if (right) {\n for (code2 in right) {\n if (!hasOwnProperty.call(left, code2)) left[code2] = [];\n const value = right[code2];\n constructs(\n // @ts-expect-error Looks like a list.\n left[code2],\n Array.isArray(value) ? value : value ? [value] : []\n );\n }\n }\n }\n}\nfunction constructs(existing, list2) {\n let index = -1;\n const before = [];\n while (++index < list2.length) {\n (list2[index].add === \"after\" ? existing : before).push(list2[index]);\n }\n splice(existing, 0, 0, before);\n}\nconst wwwPrefix = {\n tokenize: tokenizeWwwPrefix,\n partial: true\n};\nconst domain = {\n tokenize: tokenizeDomain,\n partial: true\n};\nconst path = {\n tokenize: tokenizePath,\n partial: true\n};\nconst trail = {\n tokenize: tokenizeTrail,\n partial: true\n};\nconst emailDomainDotTrail = {\n tokenize: tokenizeEmailDomainDotTrail,\n partial: true\n};\nconst wwwAutolink = {\n name: \"wwwAutolink\",\n tokenize: tokenizeWwwAutolink,\n previous: previousWww\n};\nconst protocolAutolink = {\n name: \"protocolAutolink\",\n tokenize: tokenizeProtocolAutolink,\n previous: previousProtocol\n};\nconst emailAutolink = {\n name: \"emailAutolink\",\n tokenize: tokenizeEmailAutolink,\n previous: previousEmail\n};\nconst text = {};\nfunction gfmAutolinkLiteral() {\n return {\n text\n };\n}\nlet code = 48;\nwhile (code < 123) {\n text[code] = emailAutolink;\n code++;\n if (code === 58) code = 65;\n else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\nfunction tokenizeEmailAutolink(effects, ok2, nok) {\n const self = this;\n let dot;\n let data;\n return start;\n function start(code2) {\n if (!gfmAtext(code2) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkEmail\");\n return atext(code2);\n }\n function atext(code2) {\n if (gfmAtext(code2)) {\n effects.consume(code2);\n return atext;\n }\n if (code2 === 64) {\n effects.consume(code2);\n return emailDomain;\n }\n return nok(code2);\n }\n function emailDomain(code2) {\n if (code2 === 46) {\n return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code2);\n }\n if (code2 === 45 || code2 === 95 || asciiAlphanumeric(code2)) {\n data = true;\n effects.consume(code2);\n return emailDomain;\n }\n return emailDomainAfter(code2);\n }\n function emailDomainDot(code2) {\n effects.consume(code2);\n dot = true;\n return emailDomain;\n }\n function emailDomainAfter(code2) {\n if (data && dot && asciiAlpha(self.previous)) {\n effects.exit(\"literalAutolinkEmail\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n return nok(code2);\n }\n}\nfunction tokenizeWwwAutolink(effects, ok2, nok) {\n const self = this;\n return wwwStart;\n function wwwStart(code2) {\n if (code2 !== 87 && code2 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkWww\");\n return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code2);\n }\n function wwwAfter(code2) {\n effects.exit(\"literalAutolinkWww\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeProtocolAutolink(effects, ok2, nok) {\n const self = this;\n let buffer = \"\";\n let seen = false;\n return protocolStart;\n function protocolStart(code2) {\n if ((code2 === 72 || code2 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkHttp\");\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n return nok(code2);\n }\n function protocolPrefixInside(code2) {\n if (asciiAlpha(code2) && buffer.length < 5) {\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n if (code2 === 58) {\n const protocol = buffer.toLowerCase();\n if (protocol === \"http\" || protocol === \"https\") {\n effects.consume(code2);\n return protocolSlashesInside;\n }\n }\n return nok(code2);\n }\n function protocolSlashesInside(code2) {\n if (code2 === 47) {\n effects.consume(code2);\n if (seen) {\n return afterProtocol;\n }\n seen = true;\n return protocolSlashesInside;\n }\n return nok(code2);\n }\n function afterProtocol(code2) {\n return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code2);\n }\n function protocolAfter(code2) {\n effects.exit(\"literalAutolinkHttp\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeWwwPrefix(effects, ok2, nok) {\n let size = 0;\n return wwwPrefixInside;\n function wwwPrefixInside(code2) {\n if ((code2 === 87 || code2 === 119) && size < 3) {\n size++;\n effects.consume(code2);\n return wwwPrefixInside;\n }\n if (code2 === 46 && size === 3) {\n effects.consume(code2);\n return wwwPrefixAfter;\n }\n return nok(code2);\n }\n function wwwPrefixAfter(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction tokenizeDomain(effects, ok2, nok) {\n let underscoreInLastSegment;\n let underscoreInLastLastSegment;\n let seen;\n return domainInside;\n function domainInside(code2) {\n if (code2 === 46 || code2 === 95) {\n return effects.check(trail, domainAfter, domainAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {\n return domainAfter(code2);\n }\n seen = true;\n effects.consume(code2);\n return domainInside;\n }\n function domainAtPunctuation(code2) {\n if (code2 === 95) {\n underscoreInLastSegment = true;\n } else {\n underscoreInLastLastSegment = underscoreInLastSegment;\n underscoreInLastSegment = void 0;\n }\n effects.consume(code2);\n return domainInside;\n }\n function domainAfter(code2) {\n if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n return nok(code2);\n }\n return ok2(code2);\n }\n}\nfunction tokenizePath(effects, ok2) {\n let sizeOpen = 0;\n let sizeClose = 0;\n return pathInside;\n function pathInside(code2) {\n if (code2 === 40) {\n sizeOpen++;\n effects.consume(code2);\n return pathInside;\n }\n if (code2 === 41 && sizeClose < sizeOpen) {\n return pathAtPunctuation(code2);\n }\n if (code2 === 33 || code2 === 34 || code2 === 38 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 93 || code2 === 95 || code2 === 126) {\n return effects.check(trail, ok2, pathAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n effects.consume(code2);\n return pathInside;\n }\n function pathAtPunctuation(code2) {\n if (code2 === 41) {\n sizeClose++;\n }\n effects.consume(code2);\n return pathInside;\n }\n}\nfunction tokenizeTrail(effects, ok2, nok) {\n return trail2;\n function trail2(code2) {\n if (code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 63 || code2 === 95 || code2 === 126) {\n effects.consume(code2);\n return trail2;\n }\n if (code2 === 38) {\n effects.consume(code2);\n return trailCharacterReferenceStart;\n }\n if (code2 === 93) {\n effects.consume(code2);\n return trailBracketAfter;\n }\n if (\n // `<` is an end.\n code2 === 60 || // So is whitespace.\n code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)\n ) {\n return ok2(code2);\n }\n return nok(code2);\n }\n function trailBracketAfter(code2) {\n if (code2 === null || code2 === 40 || code2 === 91 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n return trail2(code2);\n }\n function trailCharacterReferenceStart(code2) {\n return asciiAlpha(code2) ? trailCharacterReferenceInside(code2) : nok(code2);\n }\n function trailCharacterReferenceInside(code2) {\n if (code2 === 59) {\n effects.consume(code2);\n return trail2;\n }\n if (asciiAlpha(code2)) {\n effects.consume(code2);\n return trailCharacterReferenceInside;\n }\n return nok(code2);\n }\n}\nfunction tokenizeEmailDomainDotTrail(effects, ok2, nok) {\n return start;\n function start(code2) {\n effects.consume(code2);\n return after;\n }\n function after(code2) {\n return asciiAlphanumeric(code2) ? nok(code2) : ok2(code2);\n }\n}\nfunction previousWww(code2) {\n return code2 === null || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 91 || code2 === 93 || code2 === 126 || markdownLineEndingOrSpace(code2);\n}\nfunction previousProtocol(code2) {\n return !asciiAlpha(code2);\n}\nfunction previousEmail(code2) {\n return !(code2 === 47 || gfmAtext(code2));\n}\nfunction gfmAtext(code2) {\n return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);\n}\nfunction previousUnbalanced(events) {\n let index = events.length;\n let result = false;\n while (index--) {\n const token = events[index][1];\n if ((token.type === \"labelLink\" || token.type === \"labelImage\") && !token._balanced) {\n result = true;\n break;\n }\n if (token._gfmAutolinkLiteralWalkedInto) {\n result = false;\n break;\n }\n }\n if (events.length > 0 && !result) {\n events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n }\n return result;\n}\nfunction resolveAll(constructs2, events, context) {\n const called = [];\n let index = -1;\n while (++index < constructs2.length) {\n const resolve = constructs2[index].resolveAll;\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context);\n called.push(resolve);\n }\n }\n return events;\n}\nfunction factorySpace(effects, ok2, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n let size = 0;\n return start;\n function start(code2) {\n if (markdownSpace(code2)) {\n effects.enter(type);\n return prefix(code2);\n }\n return ok2(code2);\n }\n function prefix(code2) {\n if (markdownSpace(code2) && size++ < limit) {\n effects.consume(code2);\n return prefix;\n }\n effects.exit(type);\n return ok2(code2);\n }\n}\nconst blankLine = {\n partial: true,\n tokenize: tokenizeBlankLine\n};\nfunction tokenizeBlankLine(effects, ok2, nok) {\n return start;\n function start(code2) {\n return markdownSpace(code2) ? factorySpace(effects, after, \"linePrefix\")(code2) : after(code2);\n }\n function after(code2) {\n return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);\n }\n}\nconst indent = {\n tokenize: tokenizeIndent,\n partial: true\n};\nfunction gfmFootnote() {\n return {\n document: {\n [91]: {\n name: \"gfmFootnoteDefinition\",\n tokenize: tokenizeDefinitionStart,\n continuation: {\n tokenize: tokenizeDefinitionContinuation\n },\n exit: gfmFootnoteDefinitionEnd\n }\n },\n text: {\n [91]: {\n name: \"gfmFootnoteCall\",\n tokenize: tokenizeGfmFootnoteCall\n },\n [93]: {\n name: \"gfmPotentialFootnoteCall\",\n add: \"after\",\n tokenize: tokenizePotentialGfmFootnoteCall,\n resolveTo: resolveToPotentialGfmFootnoteCall\n }\n }\n };\n}\nfunction tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n let index = self.events.length;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let labelStart;\n while (index--) {\n const token = self.events[index][1];\n if (token.type === \"labelImage\") {\n labelStart = token;\n break;\n }\n if (token.type === \"gfmFootnoteCall\" || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n break;\n }\n }\n return start;\n function start(code2) {\n if (!labelStart || !labelStart._balanced) {\n return nok(code2);\n }\n const id = normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n }));\n if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return ok2(code2);\n }\n}\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n let index = events.length;\n while (index--) {\n if (events[index][1].type === \"labelImage\" && events[index][0] === \"enter\") {\n events[index][1];\n break;\n }\n }\n events[index + 1][1].type = \"data\";\n events[index + 3][1].type = \"gfmFootnoteCallLabelMarker\";\n const call = {\n type: \"gfmFootnoteCall\",\n start: Object.assign({}, events[index + 3][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n };\n const marker = {\n type: \"gfmFootnoteCallMarker\",\n start: Object.assign({}, events[index + 3][1].end),\n end: Object.assign({}, events[index + 3][1].end)\n };\n marker.end.column++;\n marker.end.offset++;\n marker.end._bufferIndex++;\n const string = {\n type: \"gfmFootnoteCallString\",\n start: Object.assign({}, marker.end),\n end: Object.assign({}, events[events.length - 1][1].start)\n };\n const chunk = {\n type: \"chunkString\",\n contentType: \"string\",\n start: Object.assign({}, string.start),\n end: Object.assign({}, string.end)\n };\n const replacement = [\n // Take the `labelImageMarker` (now `data`, the `!`)\n events[index + 1],\n events[index + 2],\n [\"enter\", call, context],\n // The `[`\n events[index + 3],\n events[index + 4],\n // The `^`.\n [\"enter\", marker, context],\n [\"exit\", marker, context],\n // Everything in between.\n [\"enter\", string, context],\n [\"enter\", chunk, context],\n [\"exit\", chunk, context],\n [\"exit\", string, context],\n // The ending (`]`, properly parsed and labelled).\n events[events.length - 2],\n events[events.length - 1],\n [\"exit\", call, context]\n ];\n events.splice(index, events.length - index + 1, ...replacement);\n return events;\n}\nfunction tokenizeGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteCall\");\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return callStart;\n }\n function callStart(code2) {\n if (code2 !== 94) return nok(code2);\n effects.enter(\"gfmFootnoteCallMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallMarker\");\n effects.enter(\"gfmFootnoteCallString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return callData;\n }\n function callData(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteCallString\");\n if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n effects.exit(\"gfmFootnoteCall\");\n return ok2;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? callEscape : callData;\n }\n function callEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return callData;\n }\n return callData(code2);\n }\n}\nfunction tokenizeDefinitionStart(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let identifier;\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteDefinition\")._container = true;\n effects.enter(\"gfmFootnoteDefinitionLabel\");\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n return labelAtMarker;\n }\n function labelAtMarker(code2) {\n if (code2 === 94) {\n effects.enter(\"gfmFootnoteDefinitionMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionMarker\");\n effects.enter(\"gfmFootnoteDefinitionLabelString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return labelInside;\n }\n return nok(code2);\n }\n function labelInside(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteDefinitionLabelString\");\n identifier = normalizeIdentifier(self.sliceSerialize(token));\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n effects.exit(\"gfmFootnoteDefinitionLabel\");\n return labelAfter;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? labelEscape : labelInside;\n }\n function labelEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return labelInside;\n }\n return labelInside(code2);\n }\n function labelAfter(code2) {\n if (code2 === 58) {\n effects.enter(\"definitionMarker\");\n effects.consume(code2);\n effects.exit(\"definitionMarker\");\n if (!defined.includes(identifier)) {\n defined.push(identifier);\n }\n return factorySpace(effects, whitespaceAfter, \"gfmFootnoteDefinitionWhitespace\");\n }\n return nok(code2);\n }\n function whitespaceAfter(code2) {\n return ok2(code2);\n }\n}\nfunction tokenizeDefinitionContinuation(effects, ok2, nok) {\n return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));\n}\nfunction gfmFootnoteDefinitionEnd(effects) {\n effects.exit(\"gfmFootnoteDefinition\");\n}\nfunction tokenizeIndent(effects, ok2, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"gfmFootnoteDefinitionIndent\", 4 + 1);\n function afterPrefix(code2) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"gfmFootnoteDefinitionIndent\" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code2) : nok(code2);\n }\n}\nfunction gfmStrikethrough(options) {\n const options_ = options || {};\n let single = options_.singleTilde;\n const tokenizer = {\n name: \"strikethrough\",\n tokenize: tokenizeStrikethrough,\n resolveAll: resolveAllStrikethrough\n };\n if (single === null || single === void 0) {\n single = true;\n }\n return {\n text: {\n [126]: tokenizer\n },\n insideSpan: {\n null: [tokenizer]\n },\n attentionMarkers: {\n null: [126]\n }\n };\n function resolveAllStrikethrough(events, context) {\n let index = -1;\n while (++index < events.length) {\n if (events[index][0] === \"enter\" && events[index][1].type === \"strikethroughSequenceTemporary\" && events[index][1]._close) {\n let open = index;\n while (open--) {\n if (events[open][0] === \"exit\" && events[open][1].type === \"strikethroughSequenceTemporary\" && events[open][1]._open && // If the sizes are the same:\n events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n events[index][1].type = \"strikethroughSequence\";\n events[open][1].type = \"strikethroughSequence\";\n const strikethrough = {\n type: \"strikethrough\",\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[index][1].end)\n };\n const text2 = {\n type: \"strikethroughText\",\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n };\n const nextEvents = [[\"enter\", strikethrough, context], [\"enter\", events[open][1], context], [\"exit\", events[open][1], context], [\"enter\", text2, context]];\n const insideSpan = context.parser.constructs.insideSpan.null;\n if (insideSpan) {\n splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n }\n splice(nextEvents, nextEvents.length, 0, [[\"exit\", text2, context], [\"enter\", events[index][1], context], [\"exit\", events[index][1], context], [\"exit\", strikethrough, context]]);\n splice(events, open - 1, index - open + 3, nextEvents);\n index = open + nextEvents.length - 2;\n break;\n }\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n if (events[index][1].type === \"strikethroughSequenceTemporary\") {\n events[index][1].type = \"data\";\n }\n }\n return events;\n }\n function tokenizeStrikethrough(effects, ok2, nok) {\n const previous2 = this.previous;\n const events = this.events;\n let size = 0;\n return start;\n function start(code2) {\n if (previous2 === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n return nok(code2);\n }\n effects.enter(\"strikethroughSequenceTemporary\");\n return more(code2);\n }\n function more(code2) {\n const before = classifyCharacter(previous2);\n if (code2 === 126) {\n if (size > 1) return nok(code2);\n effects.consume(code2);\n size++;\n return more;\n }\n if (size < 2 && !single) return nok(code2);\n const token = effects.exit(\"strikethroughSequenceTemporary\");\n const after = classifyCharacter(code2);\n token._open = !after || after === 2 && Boolean(before);\n token._close = !before || before === 2 && Boolean(after);\n return ok2(code2);\n }\n }\n}\nclass EditMap {\n /**\n * Create a new edit map.\n */\n constructor() {\n this.map = [];\n }\n /**\n * Create an edit: a remove and/or add at a certain place.\n *\n * @param {number} index\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\n add(index, remove, add) {\n addImplementation(this, index, remove, add);\n }\n // To do: add this when moving to `micromark`.\n // /**\n // * Create an edit: but insert `add` before existing additions.\n // *\n // * @param {number} index\n // * @param {number} remove\n // * @param {Array} add\n // * @returns {undefined}\n // */\n // addBefore(index, remove, add) {\n // addImplementation(this, index, remove, add, true)\n // }\n /**\n * Done, change the events.\n *\n * @param {Array} events\n * @returns {undefined}\n */\n consume(events) {\n this.map.sort(function(a, b) {\n return a[0] - b[0];\n });\n if (this.map.length === 0) {\n return;\n }\n let index = this.map.length;\n const vecs = [];\n while (index > 0) {\n index -= 1;\n vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n events.length = this.map[index][0];\n }\n vecs.push(events.slice());\n events.length = 0;\n let slice = vecs.pop();\n while (slice) {\n for (const element of slice) {\n events.push(element);\n }\n slice = vecs.pop();\n }\n this.map.length = 0;\n }\n}\nfunction addImplementation(editMap, at, remove, add) {\n let index = 0;\n if (remove === 0 && add.length === 0) {\n return;\n }\n while (index < editMap.map.length) {\n if (editMap.map[index][0] === at) {\n editMap.map[index][1] += remove;\n editMap.map[index][2].push(...add);\n return;\n }\n index += 1;\n }\n editMap.map.push([at, remove, add]);\n}\nfunction gfmTableAlign(events, index) {\n let inDelimiterRow = false;\n const align = [];\n while (index < events.length) {\n const event = events[index];\n if (inDelimiterRow) {\n if (event[0] === \"enter\") {\n if (event[1].type === \"tableContent\") {\n align.push(events[index + 1][1].type === \"tableDelimiterMarker\" ? \"left\" : \"none\");\n }\n } else if (event[1].type === \"tableContent\") {\n if (events[index - 1][1].type === \"tableDelimiterMarker\") {\n const alignIndex = align.length - 1;\n align[alignIndex] = align[alignIndex] === \"left\" ? \"center\" : \"right\";\n }\n } else if (event[1].type === \"tableDelimiterRow\") {\n break;\n }\n } else if (event[0] === \"enter\" && event[1].type === \"tableDelimiterRow\") {\n inDelimiterRow = true;\n }\n index += 1;\n }\n return align;\n}\nfunction gfmTable() {\n return {\n flow: {\n null: {\n name: \"table\",\n tokenize: tokenizeTable,\n resolveAll: resolveTable\n }\n }\n };\n}\nfunction tokenizeTable(effects, ok2, nok) {\n const self = this;\n let size = 0;\n let sizeB = 0;\n let seen;\n return start;\n function start(code2) {\n let index = self.events.length - 1;\n while (index > -1) {\n const type = self.events[index][1].type;\n if (type === \"lineEnding\" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n type === \"linePrefix\") index--;\n else break;\n }\n const tail = index > -1 ? self.events[index][1].type : null;\n const next = tail === \"tableHead\" || tail === \"tableRow\" ? bodyRowStart : headRowBefore;\n if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n return next(code2);\n }\n function headRowBefore(code2) {\n effects.enter(\"tableHead\");\n effects.enter(\"tableRow\");\n return headRowStart(code2);\n }\n function headRowStart(code2) {\n if (code2 === 124) {\n return headRowBreak(code2);\n }\n seen = true;\n sizeB += 1;\n return headRowBreak(code2);\n }\n function headRowBreak(code2) {\n if (code2 === null) {\n return nok(code2);\n }\n if (markdownLineEnding(code2)) {\n if (sizeB > 1) {\n sizeB = 0;\n self.interrupt = true;\n effects.exit(\"tableRow\");\n effects.enter(\"lineEnding\");\n effects.consume(code2);\n effects.exit(\"lineEnding\");\n return headDelimiterStart;\n }\n return nok(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, headRowBreak, \"whitespace\")(code2);\n }\n sizeB += 1;\n if (seen) {\n seen = false;\n size += 1;\n }\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n seen = true;\n return headRowBreak;\n }\n effects.enter(\"data\");\n return headRowData(code2);\n }\n function headRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return headRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? headRowEscape : headRowData;\n }\n function headRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return headRowData;\n }\n return headRowData(code2);\n }\n function headDelimiterStart(code2) {\n self.interrupt = false;\n if (self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n effects.enter(\"tableDelimiterRow\");\n seen = false;\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes(\"codeIndented\") ? void 0 : 4)(code2);\n }\n return headDelimiterBefore(code2);\n }\n function headDelimiterBefore(code2) {\n if (code2 === 45 || code2 === 58) {\n return headDelimiterValueBefore(code2);\n }\n if (code2 === 124) {\n seen = true;\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return headDelimiterCellBefore;\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterCellBefore(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code2);\n }\n return headDelimiterValueBefore(code2);\n }\n function headDelimiterValueBefore(code2) {\n if (code2 === 58) {\n sizeB += 1;\n seen = true;\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterLeftAlignmentAfter;\n }\n if (code2 === 45) {\n sizeB += 1;\n return headDelimiterLeftAlignmentAfter(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n return headDelimiterCellAfter(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterLeftAlignmentAfter(code2) {\n if (code2 === 45) {\n effects.enter(\"tableDelimiterFiller\");\n return headDelimiterFiller(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterFiller(code2) {\n if (code2 === 45) {\n effects.consume(code2);\n return headDelimiterFiller;\n }\n if (code2 === 58) {\n seen = true;\n effects.exit(\"tableDelimiterFiller\");\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterRightAlignmentAfter;\n }\n effects.exit(\"tableDelimiterFiller\");\n return headDelimiterRightAlignmentAfter(code2);\n }\n function headDelimiterRightAlignmentAfter(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code2);\n }\n return headDelimiterCellAfter(code2);\n }\n function headDelimiterCellAfter(code2) {\n if (code2 === 124) {\n return headDelimiterBefore(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n if (!seen || size !== sizeB) {\n return headDelimiterNok(code2);\n }\n effects.exit(\"tableDelimiterRow\");\n effects.exit(\"tableHead\");\n return ok2(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterNok(code2) {\n return nok(code2);\n }\n function bodyRowStart(code2) {\n effects.enter(\"tableRow\");\n return bodyRowBreak(code2);\n }\n function bodyRowBreak(code2) {\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return bodyRowBreak;\n }\n if (code2 === null || markdownLineEnding(code2)) {\n effects.exit(\"tableRow\");\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, bodyRowBreak, \"whitespace\")(code2);\n }\n effects.enter(\"data\");\n return bodyRowData(code2);\n }\n function bodyRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return bodyRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? bodyRowEscape : bodyRowData;\n }\n function bodyRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return bodyRowData;\n }\n return bodyRowData(code2);\n }\n}\nfunction resolveTable(events, context) {\n let index = -1;\n let inFirstCellAwaitingPipe = true;\n let rowKind = 0;\n let lastCell = [0, 0, 0, 0];\n let cell = [0, 0, 0, 0];\n let afterHeadAwaitingFirstBodyRow = false;\n let lastTableEnd = 0;\n let currentTable;\n let currentBody;\n let currentCell;\n const map2 = new EditMap();\n while (++index < events.length) {\n const event = events[index];\n const token = event[1];\n if (event[0] === \"enter\") {\n if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = false;\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n currentBody = void 0;\n lastTableEnd = 0;\n }\n currentTable = {\n type: \"table\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentTable, context]]);\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n inFirstCellAwaitingPipe = true;\n currentCell = void 0;\n lastCell = [0, 0, 0, 0];\n cell = [0, index + 1, 0, 0];\n if (afterHeadAwaitingFirstBodyRow) {\n afterHeadAwaitingFirstBodyRow = false;\n currentBody = {\n type: \"tableBody\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentBody, context]]);\n }\n rowKind = token.type === \"tableDelimiterRow\" ? 2 : currentBody ? 3 : 1;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n inFirstCellAwaitingPipe = false;\n if (cell[2] === 0) {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n lastCell = [0, 0, 0, 0];\n }\n cell[2] = index;\n }\n } else if (token.type === \"tableCellDivider\") {\n if (inFirstCellAwaitingPipe) {\n inFirstCellAwaitingPipe = false;\n } else {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n }\n lastCell = cell;\n cell = [lastCell[1], index, 0, 0];\n }\n }\n } else if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = true;\n lastTableEnd = index;\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n lastTableEnd = index;\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, index, currentCell);\n } else if (cell[1] !== 0) {\n currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);\n }\n rowKind = 0;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n cell[3] = index;\n }\n }\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n }\n map2.consume(context.events);\n index = -1;\n while (++index < context.events.length) {\n const event = context.events[index];\n if (event[0] === \"enter\" && event[1].type === \"table\") {\n event[1]._align = gfmTableAlign(context.events, index);\n }\n }\n return events;\n}\nfunction flushCell(map2, context, range, rowKind, rowEnd, previousCell) {\n const groupName = rowKind === 1 ? \"tableHeader\" : rowKind === 2 ? \"tableDelimiter\" : \"tableData\";\n const valueName = \"tableContent\";\n if (range[0] !== 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n map2.add(range[0], 0, [[\"exit\", previousCell, context]]);\n }\n const now = getPoint(context.events, range[1]);\n previousCell = {\n type: groupName,\n start: Object.assign({}, now),\n // Note: correct end is set later.\n end: Object.assign({}, now)\n };\n map2.add(range[1], 0, [[\"enter\", previousCell, context]]);\n if (range[2] !== 0) {\n const relatedStart = getPoint(context.events, range[2]);\n const relatedEnd = getPoint(context.events, range[3]);\n const valueToken = {\n type: valueName,\n start: Object.assign({}, relatedStart),\n end: Object.assign({}, relatedEnd)\n };\n map2.add(range[2], 0, [[\"enter\", valueToken, context]]);\n if (rowKind !== 2) {\n const start = context.events[range[2]];\n const end = context.events[range[3]];\n start[1].end = Object.assign({}, end[1].end);\n start[1].type = \"chunkText\";\n start[1].contentType = \"text\";\n if (range[3] > range[2] + 1) {\n const a = range[2] + 1;\n const b = range[3] - range[2] - 1;\n map2.add(a, b, []);\n }\n }\n map2.add(range[3] + 1, 0, [[\"exit\", valueToken, context]]);\n }\n if (rowEnd !== void 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n map2.add(rowEnd, 0, [[\"exit\", previousCell, context]]);\n previousCell = void 0;\n }\n return previousCell;\n}\nfunction flushTableEnd(map2, context, index, table, tableBody) {\n const exits = [];\n const related = getPoint(context.events, index);\n if (tableBody) {\n tableBody.end = Object.assign({}, related);\n exits.push([\"exit\", tableBody, context]);\n }\n table.end = Object.assign({}, related);\n exits.push([\"exit\", table, context]);\n map2.add(index + 1, 0, exits);\n}\nfunction getPoint(events, index) {\n const event = events[index];\n const side = event[0] === \"enter\" ? \"start\" : \"end\";\n return event[1][side];\n}\nconst tasklistCheck = {\n name: \"tasklistCheck\",\n tokenize: tokenizeTasklistCheck\n};\nfunction gfmTaskListItem() {\n return {\n text: {\n [91]: tasklistCheck\n }\n };\n}\nfunction tokenizeTasklistCheck(effects, ok2, nok) {\n const self = this;\n return open;\n function open(code2) {\n if (\n // Exit if there’s stuff before.\n self.previous !== null || // Exit if not in the first content that is the first child of a list\n // item.\n !self._gfmTasklistFirstContentOfListItem\n ) {\n return nok(code2);\n }\n effects.enter(\"taskListCheck\");\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n return inside;\n }\n function inside(code2) {\n if (markdownLineEndingOrSpace(code2)) {\n effects.enter(\"taskListCheckValueUnchecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueUnchecked\");\n return close;\n }\n if (code2 === 88 || code2 === 120) {\n effects.enter(\"taskListCheckValueChecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueChecked\");\n return close;\n }\n return nok(code2);\n }\n function close(code2) {\n if (code2 === 93) {\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n effects.exit(\"taskListCheck\");\n return after;\n }\n return nok(code2);\n }\n function after(code2) {\n if (markdownLineEnding(code2)) {\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return effects.check({\n tokenize: spaceThenNonSpace\n }, ok2, nok)(code2);\n }\n return nok(code2);\n }\n}\nfunction spaceThenNonSpace(effects, ok2, nok) {\n return factorySpace(effects, after, \"whitespace\");\n function after(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction gfm(options) {\n return combineExtensions([\n gfmAutolinkLiteral(),\n gfmFootnote(),\n gfmStrikethrough(options),\n gfmTable(),\n gfmTaskListItem()\n ]);\n}\nconst emptyOptions = {};\nfunction remarkGfm(options) {\n const self = (\n /** @type {Processor} */\n this\n );\n const settings = options || emptyOptions;\n const data = self.data();\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);\n micromarkExtensions.push(gfm(settings));\n fromMarkdownExtensions.push(gfmFromMarkdown());\n toMarkdownExtensions.push(gfmToMarkdown(settings));\n}\nconst _sfc_main$1 = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextCopyButton\",\n props: {\n contentId: {}\n },\n setup(__props) {\n const { copy, icon, altText } = useCopy(() => document.getElementById(__props.contentId).textContent);\n return (_ctx, _cache) => {\n return openBlock(), createBlock(NcButton, {\n variant: \"tertiary\",\n size: \"small\",\n \"aria-label\": unref(altText),\n title: unref(altText),\n onClick: unref(copy)\n }, {\n icon: withCtx(() => [\n createVNode(NcIconSvgWrapper, {\n path: unref(icon),\n inline: \"\"\n }, null, 8, [\"path\"])\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]);\n };\n }\n});\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode$1(node2) {\n return node2.type === \"text\";\n}\nconst transformPlaceholders = function(ast) {\n visit(ast, isTextNode$1, visitor);\n function visitor(node2, index, parent) {\n const placeholders = node2.value.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return u(\"text\", entry);\n }\n const [, component] = matches;\n return u(\"element\", {\n tagName: `#${component}`,\n children: []\n });\n });\n parent.children.splice(index, 1, ...placeholders);\n }\n};\nconst remarkPlaceholder = () => transformPlaceholders;\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode(node2) {\n return [\"text\", \"code\", \"inlineCode\"].includes(node2.type);\n}\nconst remarkUnescape = function() {\n return function(tree) {\n visit(tree, isTextNode, (node2, index, parent) => {\n parent.children.splice(index, 1, {\n ...node2,\n value: node2.value.replace(/</gmi, \"<\").replace(/>/gmi, \">\")\n });\n return [SKIP$1, index + 1];\n });\n };\n};\nconst LINK_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"];\nconst rehypeHighlight = ref(null);\nasync function importRehypeHighlightLibrary() {\n const module = await import(\"rehype-highlight\");\n rehypeHighlight.value = module.default;\n}\nconst _sfc_main = {\n name: \"NcRichText\",\n components: {\n NcReferenceList\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The main text\n */\n text: {\n type: String,\n default: \"\"\n },\n arguments: {\n type: Object,\n default: () => {\n return {};\n }\n },\n referenceLimit: {\n type: Number,\n default: 0\n },\n referenceInteractive: {\n type: Boolean,\n default: true\n },\n referenceInteractiveOptIn: {\n type: Boolean,\n default: false\n },\n /** Provide data upfront to avoid extra http request */\n references: {\n type: Array,\n default: null\n },\n /** Provide basic Markdown syntax */\n useMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide GitHub Flavored Markdown syntax */\n useExtendedMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide event from rendered markdown inputs */\n interactive: {\n type: Boolean,\n default: false\n },\n /**\n * Automatically convert link-like text to markdown links\n */\n autolink: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"interactTodo\"\n ],\n data() {\n return {\n parentId: createElementId()\n };\n },\n methods: {\n renderPlaintext() {\n const placeholders = this.text.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return this.prepareTextNode(entry);\n }\n const argumentId = matches[1];\n const argument = this.arguments[argumentId];\n if (typeof argument === \"object\") {\n const { component, props } = argument;\n return h(typeof component === \"string\" ? resolveComponent(component) : component, {\n ...props,\n class: \"rich-text--component\"\n });\n }\n if (argument) {\n return h(\"span\", { class: \"rich-text--fallback\" }, argument);\n }\n return entry;\n });\n return h(\"div\", { class: \"rich-text--wrapper\" }, [\n h(\"div\", {}, placeholders.flat()),\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n renderMarkdown() {\n const renderedMarkdown = unified().use(remarkParse).use(remarkAutolink, {\n autolink: this.autolink,\n useMarkdown: this.useMarkdown,\n useExtendedMarkdown: this.useExtendedMarkdown\n }).use(remarkUnescape).use(this.useExtendedMarkdown ? remarkGfm : void 0).use(breaks).use(remarkUnlinkProtocols, { except: LINK_PROTOCOLS }).use(remark2rehype, {\n handlers: {\n component(toHast, node2) {\n return toHast(node2, node2.component, { value: node2.value });\n }\n }\n }).use(this.useExtendedMarkdown ? rehypeHighlight.value : void 0).use(remarkPlaceholder).use(rehypeExternalLinks, {\n target: \"_blank\",\n rel: [\"noopener noreferrer\"]\n }).use(rehype2react, {\n Fragment,\n jsx: this.createElement,\n jsxs: this.createElement,\n elementAttributeNameCase: \"html\",\n prefix: false\n }).processSync(this.text.replace(/<[^>]+>/g, (match) => match.replace(/\")).result;\n return h(\"div\", { class: \"rich-text--wrapper rich-text--wrapper-markdown\" }, [\n renderedMarkdown,\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n /**\n * Render plain text nodes\n *\n * @param {string} text - Content of the node\n */\n prepareTextNode(text2) {\n if (this.autolink) {\n text2 = parseUrl(text2);\n }\n if (Array.isArray(text2)) {\n return text2.map((entry) => {\n if (typeof entry === \"string\") {\n return entry;\n }\n const { component, props } = entry;\n const componentClass = component.name === \"NcLink\" ? void 0 : \"rich-text--component\";\n return h(component, {\n ...props,\n class: componentClass\n });\n });\n }\n return text2;\n },\n createElement(type, props, key) {\n if (key) {\n props.key = key;\n }\n const children = props.children ?? [];\n delete props.children;\n if (!String(type).startsWith(\"#\")) {\n if ([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(String(type))) {\n type = `h${Math.min(+String(type)[1] + 3, 6)}`;\n }\n let nestedNode = null;\n if (this.useExtendedMarkdown) {\n if (String(type) === \"code\" && !rehypeHighlight.value && props?.class?.includes(\"language\")) {\n importRehypeHighlightLibrary();\n }\n if (String(type) === \"pre\" && children && String(children.type) === \"code\") {\n const id = this.parentId + \"-code-block-\" + createElementId();\n return h(\"p\", { class: \"rich-text__code-block\" }, [\n h(type, { ...props, id }, children),\n h(_sfc_main$1, { class: \"rich-text__code-block-button\", contentId: id })\n ]);\n }\n if (String(type) === \"li\" && Array.isArray(children) && children.length !== 0 && children[0].type === \"input\" && children[0].props.type === \"checkbox\") {\n const [inputNode, , ...labelParts] = children;\n const nestedNodeIndex = labelParts.findIndex((child) => [\"ul\", \"ol\", \"li\", \"blockquote\", \"pre\"].includes(child.type));\n if (nestedNodeIndex !== -1) {\n nestedNode = labelParts[nestedNodeIndex];\n labelParts.splice(nestedNodeIndex);\n }\n const id = this.parentId + \"-markdown-input-\" + createElementId();\n const propsToForward = { ...inputNode.props };\n delete propsToForward.checked;\n const inputComponent = h(NcCheckboxRadioSwitch, {\n ...propsToForward,\n modelValue: inputNode.props.checked,\n id,\n disabled: !this.interactive,\n \"onUpdate:modelValue\": () => {\n this.$emit(\"interactTodo\", id);\n }\n }, { default: () => labelParts });\n return h(type, props, [inputComponent, nestedNode]);\n }\n }\n if (String(type) === \"a\") {\n const route = getRoute(this.$router, props.href);\n if (route) {\n delete props.href;\n delete props.target;\n return h(RouterLink, {\n ...props,\n to: route\n }, { default: () => children });\n }\n }\n return h(type, props, children);\n }\n const placeholder = this.arguments[type.slice(1)];\n if (!placeholder) {\n return h(\"span\", { ...props, class: \"rich-text--fallback\" }, [`{${type.slice(1)}}`]);\n }\n if (!placeholder.component) {\n return h(\"span\", { ...props }, [placeholder]);\n }\n return h(\n typeof placeholder.component === \"string\" ? resolveComponent(placeholder.component) : placeholder.component,\n {\n ...props,\n ...placeholder.props,\n class: \"rich-text--component\"\n },\n { default: () => children }\n );\n }\n },\n render() {\n return this.useMarkdown || this.useExtendedMarkdown ? this.renderMarkdown() : this.renderPlaintext();\n }\n};\nconst NcRichText = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-a47e4ba7\"]]);\nexport {\n NcRichText as N,\n NcReferenceList as a\n};\n//# sourceMappingURL=NcRichText-1U5RXjPL.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n\n\n","\n\n\n\n\n","import { defaultWindow, isClient, onClickOutside, onKeyStroke, onLongPress, useActiveElement, useBattery, useBrowserLocation, useClipboard, useColorMode, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useDraggable, useElementBounding, useElementHover, useElementSize, useElementVisibility, useEyeDropper, useFullscreen, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, useResizeObserver, useScreenSafeArea, useScroll, useScrollLock, useStorage, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from \"@vueuse/core\";\nimport { computed, defineComponent, h, reactive, shallowRef, toRefs, toValue, watch } from \"vue\";\nimport { reactiveOmit, toRefs as toRefs$1, useToggle } from \"@vueuse/shared\";\n\n//#region ../core/onClickOutside/component.ts\nconst OnClickOutside = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tonClickOutside(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default());\n\t};\n}, {\n\tname: \"OnClickOutside\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n\n//#endregion\n//#region ../core/onClickOutside/directive.ts\nconst stopClickOutsideMap = /* @__PURE__ */ new WeakMap();\nconst vOnClickOutside = {\n\tmounted(el, binding) {\n\t\tconst capture = !binding.modifiers.bubble;\n\t\tlet stop;\n\t\tif (typeof binding.value === \"function\") stop = onClickOutside(el, binding.value, { capture });\n\t\telse {\n\t\t\tconst [handler, options] = binding.value;\n\t\t\tstop = onClickOutside(el, handler, Object.assign({ capture }, options));\n\t\t}\n\t\tstopClickOutsideMap.set(el, stop);\n\t},\n\tunmounted(el) {\n\t\tconst stop = stopClickOutsideMap.get(el);\n\t\tif (stop && typeof stop === \"function\") stop();\n\t\telse stop === null || stop === void 0 || stop.stop();\n\t\tstopClickOutsideMap.delete(el);\n\t}\n};\n/** @deprecated use `vOnClickOutside` instead */\nconst VOnClickOutside = vOnClickOutside;\n\n//#endregion\n//#region ../core/onKeyStroke/directive.ts\nconst vOnKeyStroke = { mounted(el, binding) {\n\tvar _binding$arg$split, _binding$arg;\n\tconst keys = (_binding$arg$split = (_binding$arg = binding.arg) === null || _binding$arg === void 0 ? void 0 : _binding$arg.split(\",\")) !== null && _binding$arg$split !== void 0 ? _binding$arg$split : true;\n\tif (typeof binding.value === \"function\") onKeyStroke(keys, binding.value, { target: el });\n\telse {\n\t\tconst [handler, options] = binding.value;\n\t\tonKeyStroke(keys, handler, {\n\t\t\ttarget: el,\n\t\t\t...options\n\t\t});\n\t}\n} };\n\n//#endregion\n//#region ../core/onLongPress/component.ts\nconst OnLongPress = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tconst data = onLongPress(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"OnLongPress\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n\n//#endregion\n//#region ../core/onLongPress/directive.ts\nconst vOnLongPress = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") onLongPress(el, binding.value, { modifiers: binding.modifiers });\n\telse onLongPress(el, ...binding.value);\n} };\n/** @deprecated use `vOnLongPress` instead */\nconst VOnLongPress = vOnLongPress;\n\n//#endregion\n//#region ../core/useActiveElement/component.ts\nconst UseActiveElement = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ element: useActiveElement(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseActiveElement\",\n\tprops: [\n\t\t\"deep\",\n\t\t\"triggerOnRemoval\",\n\t\t\"window\",\n\t\t\"document\"\n\t]\n});\n\n//#endregion\n//#region ../core/useBattery/component.ts\nconst UseBattery = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBattery(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBattery\",\n\tprops: [\"navigator\"]\n});\n\n//#endregion\n//#region ../core/useBrowserLocation/component.ts\nconst UseBrowserLocation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBrowserLocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBrowserLocation\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useClipboard/component.ts\nconst UseClipboard = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useClipboard(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseClipboard\",\n\tprops: [\n\t\t\"source\",\n\t\t\"read\",\n\t\t\"navigator\",\n\t\t\"copiedDuring\",\n\t\t\"legacy\"\n\t]\n});\n\n//#endregion\n//#region ../core/useColorMode/component.ts\nconst UseColorMode = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst mode = useColorMode(props);\n\tconst data = reactive({\n\t\tmode,\n\t\tsystem: mode.system,\n\t\tstore: mode.store\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseColorMode\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"modes\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDark/component.ts\nconst UseDark = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst isDark = useDark(props);\n\tconst data = reactive({\n\t\tisDark,\n\t\ttoggleDark: useToggle(isDark)\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDark\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"valueDark\",\n\t\t\"valueLight\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDeviceMotion/component.ts\nconst UseDeviceMotion = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = useDeviceMotion(props);\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceMotion\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"requestPermissions\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDeviceOrientation/component.ts\nconst UseDeviceOrientation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDeviceOrientation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceOrientation\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useDevicePixelRatio/component.ts\nconst UseDevicePixelRatio = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicePixelRatio(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicePixelRatio\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useDevicesList/component.ts\nconst UseDevicesList = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicesList(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicesList\",\n\tprops: [\n\t\t\"constraints\",\n\t\t\"navigator\",\n\t\t\"onUpdated\",\n\t\t\"requestPermissions\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDocumentVisibility/component.ts\nconst UseDocumentVisibility = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ visibility: useDocumentVisibility(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDocumentVisibility\",\n\tprops: [\"document\"]\n});\n\n//#endregion\n//#region ../core/useDraggable/component.ts\nconst UseDraggable = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst handle = computed(() => {\n\t\tvar _toValue;\n\t\treturn (_toValue = toValue(props.handle)) !== null && _toValue !== void 0 ? _toValue : target.value;\n\t});\n\tconst containerElement = computed(() => {\n\t\tvar _ref;\n\t\treturn (_ref = props.containerElement) !== null && _ref !== void 0 ? _ref : void 0;\n\t});\n\tconst disabled = computed(() => !!props.disabled);\n\tconst storageValue = props.storageKey && useStorage(props.storageKey, toValue(props.initialValue) || {\n\t\tx: 0,\n\t\ty: 0\n\t}, isClient ? props.storageType === \"session\" ? sessionStorage : localStorage : void 0);\n\tconst initialValue = storageValue || props.initialValue || {\n\t\tx: 0,\n\t\ty: 0\n\t};\n\tconst onEnd = (position, event) => {\n\t\tvar _props$onEnd;\n\t\t(_props$onEnd = props.onEnd) === null || _props$onEnd === void 0 || _props$onEnd.call(props, position, event);\n\t\tif (!storageValue) return;\n\t\tstorageValue.value.x = position.x;\n\t\tstorageValue.value.y = position.y;\n\t};\n\tconst data = reactive(useDraggable(target, {\n\t\t...props,\n\t\thandle,\n\t\tinitialValue,\n\t\tonEnd,\n\t\tdisabled,\n\t\tcontainerElement\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\tref: target,\n\t\t\tstyle: `touch-action:none;${data.style}`\n\t\t}, slots.default(data));\n\t};\n}, {\n\tname: \"UseDraggable\",\n\tprops: [\n\t\t\"storageKey\",\n\t\t\"storageType\",\n\t\t\"initialValue\",\n\t\t\"exact\",\n\t\t\"preventDefault\",\n\t\t\"stopPropagation\",\n\t\t\"pointerTypes\",\n\t\t\"as\",\n\t\t\"handle\",\n\t\t\"axis\",\n\t\t\"onStart\",\n\t\t\"onMove\",\n\t\t\"onEnd\",\n\t\t\"disabled\",\n\t\t\"buttons\",\n\t\t\"containerElement\",\n\t\t\"capture\",\n\t\t\"draggingElement\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementBounding/component.ts\nconst UseElementBounding = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementBounding(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementBounding\",\n\tprops: [\n\t\t\"as\",\n\t\t\"immediate\",\n\t\t\"reset\",\n\t\t\"updateTiming\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementBounding/directive.ts\nconst vElementBounding = { mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\tconst { height, bottom, left, right, top, width, x, y } = useElementBounding(el, options);\n\twatch([\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t], () => handler({\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t}));\n} };\n\n//#endregion\n//#region ../core/useElementHover/directive.ts\nconst vElementHover = { mounted(el, binding) {\n\tconst value = binding.value;\n\tif (typeof value === \"function\") watch(useElementHover(el), (v) => value(v));\n\telse {\n\t\tconst [handler, options] = value;\n\t\twatch(useElementHover(el, options), (v) => handler(v));\n\t}\n} };\n\n//#endregion\n//#region ../core/useElementSize/component.ts\nconst UseElementSize = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tvar _toValue, _toValue2;\n\tconst target = shallowRef();\n\tconst { width, height } = toRefs(props);\n\tconst data = reactive(useElementSize(target, {\n\t\twidth: (_toValue = toValue(width)) !== null && _toValue !== void 0 ? _toValue : 0,\n\t\theight: (_toValue2 = toValue(height)) !== null && _toValue2 !== void 0 ? _toValue2 : 0\n\t}, {\n\t\tbox: props.box,\n\t\twindow: props.window\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementSize\",\n\tprops: [\n\t\t\"as\",\n\t\t\"box\",\n\t\t\"height\",\n\t\t\"width\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementSize/directive.ts\nconst vElementSize = { mounted(el, binding) {\n\tvar _binding$value;\n\tconst handler = typeof binding.value === \"function\" ? binding.value : (_binding$value = binding.value) === null || _binding$value === void 0 ? void 0 : _binding$value[0];\n\tconst { width, height } = useElementSize(el, ...typeof binding.value === \"function\" ? [] : binding.value.slice(1));\n\twatch([width, height], ([width$1, height$1]) => handler({\n\t\twidth: width$1,\n\t\theight: height$1\n\t}));\n} };\n\n//#endregion\n//#region ../core/useElementVisibility/component.ts\nconst UseElementVisibility = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive({ isVisible: useElementVisibility(target, props) });\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementVisibility\",\n\tprops: [\n\t\t\"as\",\n\t\t\"once\",\n\t\t\"rootMargin\",\n\t\t\"scrollTarget\",\n\t\t\"threshold\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementVisibility/directive.ts\nconst vElementVisibility = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\twatch(useElementVisibility(el), (v) => handler(v), { immediate: true });\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\twatch(useElementVisibility(el, options), (v) => handler(v), { immediate: true });\n\t}\n} };\n\n//#endregion\n//#region ../core/useEyeDropper/component.ts\nconst UseEyeDropper = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useEyeDropper(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseEyeDropper\",\n\tprops: [\"initialValue\"]\n});\n\n//#endregion\n//#region ../core/useFullscreen/component.ts\nconst UseFullscreen = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useFullscreen(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseFullscreen\",\n\tprops: [\n\t\t\"as\",\n\t\t\"autoExit\",\n\t\t\"document\"\n\t]\n});\n\n//#endregion\n//#region ../core/useGeolocation/component.ts\nconst UseGeolocation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useGeolocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseGeolocation\",\n\tprops: [\n\t\t\"enableHighAccuracy\",\n\t\t\"immediate\",\n\t\t\"maximumAge\",\n\t\t\"navigator\",\n\t\t\"timeout\"\n\t]\n});\n\n//#endregion\n//#region ../core/useIdle/component.ts\nconst UseIdle = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useIdle(props.timeout, props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseIdle\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"events\",\n\t\t\"initialState\",\n\t\t\"listenForVisibilityChange\",\n\t\t\"timeout\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useImage/component.ts\nconst UseImage = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useImage(props));\n\treturn () => {\n\t\tif (data.isLoading && slots.loading) return slots.loading(data);\n\t\telse if (data.error && slots.error) return slots.error(data.error);\n\t\tif (slots.default) return slots.default(data);\n\t\treturn h(props.as || \"img\", props);\n\t};\n}, {\n\tname: \"UseImage\",\n\tprops: [\n\t\t\"alt\",\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"crossorigin\",\n\t\t\"decoding\",\n\t\t\"fetchPriority\",\n\t\t\"height\",\n\t\t\"ismap\",\n\t\t\"loading\",\n\t\t\"referrerPolicy\",\n\t\t\"sizes\",\n\t\t\"src\",\n\t\t\"srcset\",\n\t\t\"usemap\",\n\t\t\"width\"\n\t]\n});\n\n//#endregion\n//#region ../core/useInfiniteScroll/directive.ts\nconst vInfiniteScroll = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useInfiniteScroll(el, binding.value);\n\telse useInfiniteScroll(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useIntersectionObserver/directive.ts\nconst vIntersectionObserver = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useIntersectionObserver(el, binding.value);\n\telse useIntersectionObserver(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useMouse/component.ts\nconst UseMouse = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useMouse(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseMouse\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useMouseInElement/component.ts\nconst UseMouseInElement = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMouseInElement(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMouseInElement\",\n\tprops: [\n\t\t\"as\",\n\t\t\"eventFilter\",\n\t\t\"handleOutside\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n\n//#endregion\n//#region ../core/useMouseInElement/directive.ts\nconst vMouseInElement = { mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\twatch(reactiveOmit(reactive(useMouseInElement(el, options)), \"stop\"), (val) => handler(val));\n} };\n\n//#endregion\n//#region ../core/useMousePressed/component.ts\nconst UseMousePressed = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMousePressed({\n\t\t...props,\n\t\ttarget\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMousePressed\",\n\tprops: [\n\t\t\"as\",\n\t\t\"capture\",\n\t\t\"drag\",\n\t\t\"initialValue\",\n\t\t\"onPressed\",\n\t\t\"onReleased\",\n\t\t\"touch\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useNetwork/component.ts\nconst UseNetwork = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNetwork(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNetwork\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useNow/component.ts\nconst UseNow = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNow({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNow\",\n\tprops: [\"immediate\", \"interval\"]\n});\n\n//#endregion\n//#region ../core/useObjectUrl/component.ts\nconst UseObjectUrl = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst { object } = toRefs$1(props);\n\tconst url = useObjectUrl(object);\n\treturn () => {\n\t\tif (slots.default && url.value) return slots.default(url.value);\n\t};\n}, {\n\tname: \"UseObjectUrl\",\n\tprops: [\"object\"]\n});\n\n//#endregion\n//#region ../core/useOffsetPagination/component.ts\nconst UseOffsetPagination = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst data = reactive(useOffsetPagination({\n\t\t...props,\n\t\ttotal: toValue(props.total) || void 0,\n\t\tonPageChange(...args) {\n\t\t\tvar _props$onPageChange;\n\t\t\t(_props$onPageChange = props.onPageChange) === null || _props$onPageChange === void 0 || _props$onPageChange.call(props, ...args);\n\t\t\temit(\"page-change\", ...args);\n\t\t},\n\t\tonPageSizeChange(...args) {\n\t\t\tvar _props$onPageSizeChan;\n\t\t\t(_props$onPageSizeChan = props.onPageSizeChange) === null || _props$onPageSizeChan === void 0 || _props$onPageSizeChan.call(props, ...args);\n\t\t\temit(\"page-size-change\", ...args);\n\t\t},\n\t\tonPageCountChange(...args) {\n\t\t\tvar _props$onPageCountCha;\n\t\t\t(_props$onPageCountCha = props.onPageCountChange) === null || _props$onPageCountCha === void 0 || _props$onPageCountCha.call(props, ...args);\n\t\t\temit(\"page-count-change\", ...args);\n\t\t}\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOffsetPagination\",\n\tprops: [\n\t\t\"onPageChange\",\n\t\t\"onPageCountChange\",\n\t\t\"onPageSizeChange\",\n\t\t\"page\",\n\t\t\"pageSize\",\n\t\t\"total\"\n\t]\n});\n\n//#endregion\n//#region ../core/useOnline/component.ts\nconst UseOnline = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isOnline: useOnline(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOnline\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePageLeave/component.ts\nconst UsePageLeave = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isLeft: usePageLeave(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePageLeave\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePointer/component.ts\nconst UsePointer = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst el = shallowRef(null);\n\tconst data = reactive(usePointer({\n\t\t...props,\n\t\ttarget: props.target === \"self\" ? el : defaultWindow\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePointer\",\n\tprops: [\n\t\t\"initialValue\",\n\t\t\"pointerTypes\",\n\t\t\"target\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/usePointerLock/component.ts\nconst UsePointerLock = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(usePointerLock(target));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UsePointerLock\",\n\tprops: [\"as\", \"document\"]\n});\n\n//#endregion\n//#region ../core/usePreferredColorScheme/component.ts\nconst UsePreferredColorScheme = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ colorScheme: usePreferredColorScheme(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredColorScheme\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredContrast/component.ts\nconst UsePreferredContrast = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ contrast: usePreferredContrast(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredContrast\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredDark/component.ts\nconst UsePreferredDark = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ prefersDark: usePreferredDark(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredDark\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredLanguages/component.ts\nconst UsePreferredLanguages = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ languages: usePreferredLanguages(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredLanguages\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredReducedMotion/component.ts\nconst UsePreferredReducedMotion = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ motion: usePreferredReducedMotion(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredReducedMotion\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredReducedTransparency/component.ts\nconst UsePreferredReducedTransparency = /* @__PURE__ */ defineComponent({\n\tname: \"UsePreferredReducedTransparency\",\n\tsetup(props, { slots }) {\n\t\tconst data = reactive({ transparency: usePreferredReducedTransparency() });\n\t\treturn () => {\n\t\t\tif (slots.default) return slots.default(data);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region ../core/useResizeObserver/directive.ts\nconst vResizeObserver = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useResizeObserver(el, binding.value);\n\telse useResizeObserver(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useScreenSafeArea/component.ts\nconst UseScreenSafeArea = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useScreenSafeArea());\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { style: {\n\t\t\tpaddingTop: props.top ? data.top : \"\",\n\t\t\tpaddingRight: props.right ? data.right : \"\",\n\t\t\tpaddingBottom: props.bottom ? data.bottom : \"\",\n\t\t\tpaddingLeft: props.left ? data.left : \"\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tmaxHeight: \"100vh\",\n\t\t\tmaxWidth: \"100vw\",\n\t\t\toverflow: \"auto\"\n\t\t} }, slots.default(data));\n\t};\n}, {\n\tname: \"UseScreenSafeArea\",\n\tprops: [\n\t\t\"top\",\n\t\t\"right\",\n\t\t\"bottom\",\n\t\t\"left\"\n\t]\n});\n\n//#endregion\n//#region ../core/useScroll/directive.ts\nconst vScroll = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\tonScroll() {\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop() {\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\t...options,\n\t\t\tonScroll(e) {\n\t\t\t\tvar _options$onScroll;\n\t\t\t\t(_options$onScroll = options.onScroll) === null || _options$onScroll === void 0 || _options$onScroll.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop(e) {\n\t\t\t\tvar _options$onStop;\n\t\t\t\t(_options$onStop = options.onStop) === null || _options$onStop === void 0 || _options$onStop.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t}\n} };\n\n//#endregion\n//#region ../core/useScrollLock/directive.ts\nfunction onScrollLock() {\n\tlet isMounted = false;\n\tconst state = shallowRef(false);\n\treturn (el, binding) => {\n\t\tstate.value = binding.value;\n\t\tif (isMounted) return;\n\t\tisMounted = true;\n\t\tconst isLocked = useScrollLock(el, binding.value);\n\t\twatch(state, (v) => isLocked.value = v);\n\t};\n}\nconst vScrollLock = onScrollLock();\n\n//#endregion\n//#region ../core/useTimeAgo/component.ts\nconst UseTimeAgo = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimeAgo(() => props.time, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimeAgo\",\n\tprops: [\n\t\t\"fullDateFormatter\",\n\t\t\"max\",\n\t\t\"messages\",\n\t\t\"rounding\",\n\t\t\"showSecond\",\n\t\t\"time\",\n\t\t\"units\",\n\t\t\"updateInterval\"\n\t]\n});\n\n//#endregion\n//#region ../core/useTimestamp/component.ts\nconst UseTimestamp = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimestamp({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimestamp\",\n\tprops: [\n\t\t\"callback\",\n\t\t\"immediate\",\n\t\t\"interval\",\n\t\t\"offset\"\n\t]\n});\n\n//#endregion\n//#region ../core/useVirtualList/component.ts\nconst UseVirtualList = /* @__PURE__ */ defineComponent((props, { slots, expose }) => {\n\tconst { list: listRef } = toRefs(props);\n\tconst { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);\n\texpose({ scrollTo });\n\tif (containerProps.style && typeof containerProps.style === \"object\" && !Array.isArray(containerProps.style)) containerProps.style.height = props.height || \"300px\";\n\treturn () => h(\"div\", { ...containerProps }, [h(\"div\", { ...wrapperProps.value }, list.value.map((item) => h(\"div\", { style: {\n\t\toverflow: \"hidden\",\n\t\theight: item.height\n\t} }, slots.default ? slots.default(item) : \"Please set content!\")))]);\n}, {\n\tname: \"UseVirtualList\",\n\tprops: [\n\t\t\"height\",\n\t\t\"list\",\n\t\t\"options\"\n\t]\n});\n\n//#endregion\n//#region ../core/useWindowFocus/component.ts\nconst UseWindowFocus = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ focused: useWindowFocus(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowFocus\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useWindowSize/component.ts\nconst UseWindowSize = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useWindowSize(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowSize\",\n\tprops: [\n\t\t\"includeScrollbar\",\n\t\t\"initialHeight\",\n\t\t\"initialWidth\",\n\t\t\"listenOrientation\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\nexport { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, VOnClickOutside, VOnLongPress, vElementBounding, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };","import { l as logger } from \"../../chunks/logger-D3RVzcfQ.mjs\";\nfunction registerContactsMenuAction(action) {\n window._nc_contacts_menu_hooks ??= {};\n if (window._nc_contacts_menu_hooks[action.id]) {\n logger.error(`ContactsMenu action for id ${action.id} has already been registered`, {\n action\n });\n return;\n }\n window._nc_contacts_menu_hooks[action.id] = action;\n}\nfunction getEnabledContactsMenuActions(entry) {\n if (!window._nc_contacts_menu_hooks) {\n return [];\n }\n return Object.values(window._nc_contacts_menu_hooks).filter((action) => action.enabled(entry));\n}\nexport {\n getEnabledContactsMenuActions,\n registerContactsMenuAction\n};\n//# sourceMappingURL=index.mjs.map\n","const c = new Int32Array(4);\nclass h {\n static hashStr(i, a = !1) {\n return this.onePassHasher.start().appendStr(i).end(a);\n }\n static hashAsciiStr(i, a = !1) {\n return this.onePassHasher.start().appendAsciiStr(i).end(a);\n }\n // Private Static Variables\n static stateIdentity = new Int32Array([\n 1732584193,\n -271733879,\n -1732584194,\n 271733878\n ]);\n static buffer32Identity = new Int32Array([\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]);\n static hexChars = \"0123456789abcdef\";\n static hexOut = [];\n // Permanent instance is to use for one-call hashing\n static onePassHasher = new h();\n static _hex(i) {\n const a = h.hexChars, t = h.hexOut;\n let e, s, r, n;\n for (n = 0; n < 4; n += 1)\n for (s = n * 8, e = i[n], r = 0; r < 8; r += 2)\n t[s + 1 + r] = a.charAt(e & 15), e >>>= 4, t[s + 0 + r] = a.charAt(e & 15), e >>>= 4;\n return t.join(\"\");\n }\n static _md5cycle(i, a) {\n let t = i[0], e = i[1], s = i[2], r = i[3];\n t += (e & s | ~e & r) + a[0] - 680876936 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[2] + 606105819 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[3] - 1044525330 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[4] - 176418897 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[6] - 1473231341 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[7] - 45705983 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[8] + 1770035416 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[10] - 42063 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[11] - 1990404162 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[12] + 1804603682 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[14] - 1502002290 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[15] + 1236535329 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & r | s & ~r) + a[1] - 165796510 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[11] + 643717713 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[0] - 373897302 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[5] - 701558691 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[15] - 660478335 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[4] - 405537848 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[9] + 568446438 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[3] - 187363961 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[8] + 1163531501 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[13] - 1444681467 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[7] + 1735328473 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[12] - 1926607734 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e ^ s ^ r) + a[5] - 378558 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[11] + 1839030562 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[14] - 35309556 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[1] - 1530992060 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[7] - 155497632 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[10] - 1094730640 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[13] + 681279174 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[3] - 722521979 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[6] + 76029189 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[9] - 640364487 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[15] + 530742520 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[2] - 995338651 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (s ^ (e | ~r)) + a[0] - 198630844 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[14] - 1416354905 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[5] - 57434055 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[12] + 1700485571 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[10] - 1051523 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[1] - 2054922799 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[8] + 1873313359 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[6] - 1560198380 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[13] + 1309151649 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[4] - 145523070 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[2] + 718787259 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[9] - 343485551 | 0, e = (e << 21 | e >>> 11) + s | 0, i[0] = t + i[0] | 0, i[1] = e + i[1] | 0, i[2] = s + i[2] | 0, i[3] = r + i[3] | 0;\n }\n _dataLength = 0;\n _bufferLength = 0;\n _state = new Int32Array(4);\n _buffer = new ArrayBuffer(68);\n _buffer8;\n _buffer32;\n constructor() {\n this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();\n }\n /**\n * Initialise buffer to be hashed\n */\n start() {\n return this._dataLength = 0, this._bufferLength = 0, this._state.set(h.stateIdentity), this;\n }\n // Char to code point to to array conversion:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt\n // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown\n /**\n * Append a UTF-8 string to the hash buffer\n * @param str String to append\n */\n appendStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r;\n for (r = 0; r < i.length; r += 1) {\n if (s = i.charCodeAt(r), s < 128)\n a[e++] = s;\n else if (s < 2048)\n a[e++] = (s >>> 6) + 192, a[e++] = s & 63 | 128;\n else if (s < 55296 || s > 56319)\n a[e++] = (s >>> 12) + 224, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n else {\n if (s = (s - 55296) * 1024 + (i.charCodeAt(++r) - 56320) + 65536, s > 1114111)\n throw new Error(\n \"Unicode standard supports code points up to U+10FFFF\"\n );\n a[e++] = (s >>> 18) + 240, a[e++] = s >>> 12 & 63 | 128, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n }\n e >= 64 && (this._dataLength += 64, h._md5cycle(this._state, t), e -= 64, t[0] = t[16]);\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append an ASCII string to the hash buffer\n * @param str String to append\n */\n appendAsciiStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i.charCodeAt(r++);\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append a byte array to the hash buffer\n * @param input array to append\n */\n appendByteArray(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i[r++];\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Get the state of the hash buffer\n */\n getState() {\n const i = this._state;\n return {\n buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),\n buflen: this._bufferLength,\n length: this._dataLength,\n state: [i[0], i[1], i[2], i[3]]\n };\n }\n /**\n * Override the current state of the hash buffer\n * @param state New hash buffer state\n */\n setState(i) {\n const a = i.buffer, t = i.state, e = this._state;\n let s;\n for (this._dataLength = i.length, this._bufferLength = i.buflen, e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], s = 0; s < a.length; s += 1)\n this._buffer8[s] = a.charCodeAt(s);\n }\n /**\n * Hash the current state of the hash buffer and return the result\n * @param raw Whether to return the value as an `Int32Array`\n */\n end(i = !1) {\n const a = this._bufferLength, t = this._buffer8, e = this._buffer32, s = (a >> 2) + 1;\n this._dataLength += a;\n const r = this._dataLength * 8;\n if (t[a] = 128, t[a + 1] = t[a + 2] = t[a + 3] = 0, e.set(h.buffer32Identity.subarray(s), s), a > 55 && (h._md5cycle(this._state, e), e.set(h.buffer32Identity)), r <= 4294967295)\n e[14] = r;\n else {\n const n = r.toString(16).match(/(.*?)(.{0,8})$/);\n if (n === null) return i ? c : \"\";\n const o = parseInt(n[2], 16), _ = parseInt(n[1], 16) || 0;\n e[14] = o, e[15] = _;\n }\n return h._md5cycle(this._state, e), i ? this._state : h._hex(this._state);\n }\n}\nif (h.hashStr(\"hello\") !== \"5d41402abc4b2a76b9719d911017c592\")\n throw new Error(\"Md5 self test failed.\");\nclass l {\n constructor(i, a = !0, t = 1048576) {\n this._callback = i, this._async = a, this._partSize = t, this._configureReader();\n }\n _reader;\n _md5;\n _part;\n // private _length!: number;\n _blob;\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n */\n hash(i) {\n const a = this;\n a._blob = i, a._part = 0, a._md5 = new h(), a._processPart();\n }\n _fail() {\n this._callback({\n success: !1,\n result: \"data read failed\"\n });\n }\n _hashData(i) {\n let a = this;\n a._md5.appendByteArray(new Uint8Array(i.target.result)), a._part * a._partSize >= a._blob.size ? a._callback({\n success: !0,\n result: a._md5.end()\n }) : a._processPart();\n }\n _processPart() {\n const i = this;\n let a = 0, t;\n i._part += 1, i._blob.size > i._partSize ? (a = i._part * i._partSize, a > i._blob.size && (a = i._blob.size), t = i._blob.slice(\n (i._part - 1) * i._partSize,\n a\n )) : t = i._blob, i._async ? i._reader.readAsArrayBuffer(t) : setTimeout(() => {\n try {\n i._hashData({\n target: {\n result: i._reader.readAsArrayBuffer(\n t\n )\n }\n });\n } catch {\n i._fail();\n }\n }, 0);\n }\n _configureReader() {\n const i = this;\n i._async ? (i._reader = new FileReader(), i._reader.onload = i._hashData.bind(i), i._reader.onerror = i._fail.bind(i), i._reader.onabort = i._fail.bind(i)) : i._reader = new FileReaderSync();\n }\n}\nclass u {\n _queue = [];\n _hashWorker;\n _processing;\n _ready = !0;\n constructor(i, a) {\n const t = this;\n Worker ? (t._hashWorker = new Worker(i, a), t._hashWorker.onmessage = t._recievedMessage.bind(t), t._hashWorker.onerror = (e) => {\n t._ready = !1, console.error(\"Hash worker failure\", e);\n }) : (t._ready = !1, console.error(\"Web Workers are not supported in this browser\"));\n }\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n * @returns Promise of the Hashed result\n */\n hash(i) {\n const a = this;\n let t;\n return t = new Promise((e, s) => {\n a._queue.push({\n blob: i,\n resolve: e,\n reject: s\n }), a._processNext();\n }), t;\n }\n /** Terminate any existing hash requests */\n terminate() {\n this._ready = !1, this._hashWorker.terminate();\n }\n // Processes the next item in the queue\n _processNext() {\n this._ready && !this._processing && this._queue.length > 0 && (this._processing = this._queue.pop(), this._hashWorker.postMessage(this._processing.blob));\n }\n // Hash result is returned from the worker\n _recievedMessage(i) {\n const a = i.data;\n a.success ? this._processing?.resolve(a.result) : this._processing?.reject(a.result), this._processing = void 0, this._processNext();\n }\n}\nexport {\n h as Md5,\n l as Md5FileHasher,\n u as ParallelHasher\n};\n//# sourceMappingURL=index.es.js.map\n","import { r as register, t as t3, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nregister(t3);\nclass Color {\n /**\n * @param r - The red value\n * @param g - The green value\n * @param b - The blue value\n * @param name - The name of the color\n */\n constructor(r, g, b, name) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.name = name;\n this.r = Math.min(r, 255);\n this.g = Math.min(g, 255);\n this.b = Math.min(b, 255);\n this.name = name;\n }\n /**\n * The hexadecimal color string.\n */\n get color() {\n const toHex = (int) => `00${int.toString(16)}`.slice(-2);\n return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;\n }\n}\nfunction calculateStepIncrement(steps, color1, color2) {\n return {\n r: (color2.r - color1.r) / steps,\n g: (color2.g - color1.g) / steps,\n b: (color2.b - color1.b) / steps\n };\n}\nfunction mixPalette(steps, color1, color2) {\n const palette = [];\n palette.push(color1);\n const increment = calculateStepIncrement(steps, color1, color2);\n for (let i = 1; i < steps; i++) {\n const r = Math.floor(color1.r + increment.r * i);\n const g = Math.floor(color1.g + increment.g * i);\n const b = Math.floor(color1.b + increment.b * i);\n palette.push(new Color(r, g, b));\n }\n return palette;\n}\nconst COLOR_RED = new Color(182, 70, 157, t(\"Purple\"));\nconst COLOR_YELLOW = new Color(221, 203, 85, t(\"Gold\"));\nconst COLOR_BLUE = new Color(0, 130, 201, t(\"Nextcloud blue\"));\nconst COLOR_BLACK = new Color(0, 0, 0, t(\"Black\"));\nconst COLOR_WHITE = new Color(255, 255, 255, t(\"White\"));\nconst defaultPalette = [\n /* eslint-disable @stylistic/function-call-argument-newline -- Allow to put translators comments */\n COLOR_RED,\n new Color(\n 191,\n 103,\n 139,\n t(\"Rosy brown\")\n // TRANSLATORS: A color name for RGB(191, 103, 139)\n ),\n new Color(\n 201,\n 136,\n 121,\n t(\"Feldspar\")\n // TRANSLATORS: A color name for RGB(201, 136, 121)\n ),\n new Color(\n 211,\n 169,\n 103,\n t(\"Whiskey\")\n // TRANSLATORS: A color name for RGB(211, 169, 103)\n ),\n COLOR_YELLOW,\n new Color(\n 165,\n 184,\n 114,\n t(\"Olivine\")\n // TRANSLATORS: A color name for RGB(165, 184, 114)\n ),\n new Color(\n 110,\n 166,\n 143,\n t(\"Acapulco\")\n // TRANSLATORS: A color name for RGB(110, 166, 143)\n ),\n new Color(\n 55,\n 148,\n 172,\n t(\"Boston Blue\")\n // TRANSLATORS: A color name for RGB(55, 148, 172)\n ),\n COLOR_BLUE,\n new Color(\n 45,\n 115,\n 190,\n t(\"Mariner\")\n // TRANSLATORS: A color name for RGB(45, 115, 190)\n ),\n new Color(\n 91,\n 100,\n 179,\n t(\"Blue Violet\")\n // TRANSLATORS: A color name for RGB(91, 100, 179)\n ),\n new Color(\n 136,\n 85,\n 168,\n t(\"Deluge\")\n // TRANSLATORS: A color name for RGB(136, 85, 168)\n )\n /* eslint-enable @stylistic/function-call-argument-newline */\n];\nfunction generatePalette(steps) {\n const palette1 = mixPalette(steps, COLOR_RED, COLOR_YELLOW);\n const palette2 = mixPalette(steps, COLOR_YELLOW, COLOR_BLUE);\n const palette3 = mixPalette(steps, COLOR_BLUE, COLOR_RED);\n return palette1.concat(palette2).concat(palette3);\n}\nexport {\n Color as C,\n COLOR_BLACK as a,\n COLOR_WHITE as b,\n defaultPalette as d,\n generatePalette as g\n};\n//# sourceMappingURL=colors-CL_wvNtd.mjs.map\n","import { Md5 } from \"ts-md5\";\nimport { g as generatePalette } from \"../../chunks/colors-CL_wvNtd.mjs\";\nfunction hashCode(str) {\n let hash = str;\n if (str.match(/^([0-9a-f]{4}-?){8}$/) === null) {\n hash = Md5.hashStr(str);\n }\n hash = hash.replace(/[^0-9a-f]/g, \"\");\n let finalInt = 0;\n for (let i = 0; i < hash.length; i++) {\n finalInt += parseInt(hash.charAt(i), 16);\n }\n return finalInt;\n}\nfunction usernameToColor(username) {\n const steps = 6;\n const finalPalette = generatePalette(steps);\n const hash = hashCode(username.toLocaleLowerCase());\n return finalPalette[hash % finalPalette.length];\n}\nexport {\n usernameToColor\n};\n//# sourceMappingURL=index.mjs.map\n","'use strict';\n\n(function (global) {\n\n // minimal symbol polyfill for IE11 and others\n if (typeof Symbol !== 'function') {\n var Symbol = function(name) {\n return name;\n }\n\n Symbol.nonNative = true;\n }\n\n const STATE_PLAINTEXT = Symbol('plaintext');\n const STATE_HTML = Symbol('html');\n const STATE_COMMENT = Symbol('comment');\n\n const ALLOWED_TAGS_REGEX = /<(\\w*)>/g;\n const NORMALIZE_TAG_REGEX = /<\\/?([^\\s\\/>]+)/;\n\n function striptags(html, allowable_tags, tag_replacement) {\n html = html || '';\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return striptags_internal(html, context);\n }\n\n function init_striptags_stream(allowable_tags, tag_replacement) {\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return function striptags_stream(html) {\n return striptags_internal(html || '', context);\n };\n }\n\n striptags.init_streaming_mode = init_striptags_stream;\n\n function init_context(allowable_tags, tag_replacement) {\n allowable_tags = parse_allowable_tags(allowable_tags);\n\n return {\n allowable_tags : allowable_tags,\n tag_replacement: tag_replacement,\n\n state : STATE_PLAINTEXT,\n tag_buffer : '',\n depth : 0,\n in_quote_char : ''\n };\n }\n\n function striptags_internal(html, context) {\n if (typeof html != \"string\") {\n throw new TypeError(\"'html' parameter must be a string\");\n }\n\n let allowable_tags = context.allowable_tags;\n let tag_replacement = context.tag_replacement;\n\n let state = context.state;\n let tag_buffer = context.tag_buffer;\n let depth = context.depth;\n let in_quote_char = context.in_quote_char;\n let output = '';\n\n for (let idx = 0, length = html.length; idx < length; idx++) {\n let char = html[idx];\n\n if (state === STATE_PLAINTEXT) {\n switch (char) {\n case '<':\n state = STATE_HTML;\n tag_buffer += char;\n break;\n\n default:\n output += char;\n break;\n }\n }\n\n else if (state === STATE_HTML) {\n switch (char) {\n case '<':\n // ignore '<' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // we're seeing a nested '<'\n depth++;\n break;\n\n case '>':\n // ignore '>' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // something like this is happening: '<<>>'\n if (depth) {\n depth--;\n\n break;\n }\n\n // this is closing the tag in tag_buffer\n in_quote_char = '';\n state = STATE_PLAINTEXT;\n tag_buffer += '>';\n\n if (allowable_tags.has(normalize_tag(tag_buffer))) {\n output += tag_buffer;\n } else {\n output += tag_replacement;\n }\n\n tag_buffer = '';\n break;\n\n case '\"':\n case '\\'':\n // catch both single and double quotes\n\n if (char === in_quote_char) {\n in_quote_char = '';\n } else {\n in_quote_char = in_quote_char || char;\n }\n\n tag_buffer += char;\n break;\n\n case '-':\n if (tag_buffer === '':\n if (tag_buffer.slice(-2) == '--') {\n // close the comment\n state = STATE_PLAINTEXT;\n }\n\n tag_buffer = '';\n break;\n\n default:\n tag_buffer += char;\n break;\n }\n }\n }\n\n // save the context for future iterations\n context.state = state;\n context.tag_buffer = tag_buffer;\n context.depth = depth;\n context.in_quote_char = in_quote_char;\n\n return output;\n }\n\n function parse_allowable_tags(allowable_tags) {\n let tag_set = new Set();\n\n if (typeof allowable_tags === 'string') {\n let match;\n\n while ((match = ALLOWED_TAGS_REGEX.exec(allowable_tags))) {\n tag_set.add(match[1]);\n }\n }\n\n else if (!Symbol.nonNative &&\n typeof allowable_tags[Symbol.iterator] === 'function') {\n\n tag_set = new Set(allowable_tags);\n }\n\n else if (typeof allowable_tags.forEach === 'function') {\n // IE11 compatible\n allowable_tags.forEach(tag_set.add, tag_set);\n }\n\n return tag_set;\n }\n\n function normalize_tag(tag_buffer) {\n let match = NORMALIZE_TAG_REGEX.exec(tag_buffer);\n\n return match ? match[1].toLowerCase() : null;\n }\n\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(function module_factory() { return striptags; });\n }\n\n else if (typeof module === 'object' && module.exports) {\n // Node\n module.exports = striptags;\n }\n\n else {\n // Browser\n global.striptags = striptags;\n }\n}(this));\n","import '../assets/NcMentionBubble-ptHUq68a.css';\nimport { generateUrl } from \"@nextcloud/router\";\nimport { checkIfDarkTheme } from \"../functions/isDarkTheme/index.mjs\";\nfunction getAvatarUrl(user, options) {\n const size = (options?.size || 64) <= 64 ? 64 : 512;\n const guestUrl = options?.isGuest ? \"/guest\" : \"\";\n const themeUrl = options?.isDarkTheme ?? checkIfDarkTheme(document.body) ? \"/dark\" : \"\";\n return generateUrl(`/avatar${guestUrl}/{user}/{size}${themeUrl}`, {\n user,\n size\n });\n}\nexport {\n getAvatarUrl as g\n};\n//# sourceMappingURL=NcMentionBubble.vue_vue_type_style_index_0_scoped_45238efd_lang-D6LzDiYf.mjs.map\n","import '../assets/NcUserStatusIcon-B3aHoBAd.css';\nimport { defineComponent, mergeModels, useModel, computed, watch, createElementBlock, createCommentVNode, openBlock, normalizeClass } from \"vue\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, Q as t51, R as t11, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nconst awaySvg = '\\n\\n\t\\n\\n';\nconst busySvg = '\\n\\n\t\\n\\n';\nconst dndSvg = '\\n\\n\t\\n\\n';\nconst invisibleSvg = '\\n\\n\t\\n\\n';\nconst onlineSvg = '\\n\\n\t\\n\\n';\nregister(t51);\nregister(t11);\nfunction getUserStatusText(status) {\n switch (status) {\n case \"away\":\n return t(\"away\");\n // TRANSLATORS: User status if the user is currently away from keyboard\n case \"busy\":\n return t(\"busy\");\n case \"dnd\":\n return t(\"do not disturb\");\n case \"online\":\n return t(\"online\");\n case \"invisible\":\n return t(\"invisible\");\n case \"offline\":\n return t(\"offline\");\n default:\n return status;\n }\n}\nconst _hoisted_1 = [\"aria-hidden\", \"aria-label\", \"innerHTML\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcUserStatusIcon\",\n props: /* @__PURE__ */ mergeModels({\n user: { default: void 0 },\n ariaHidden: { type: [Boolean, String], default: false }\n }, {\n \"status\": {},\n \"statusModifiers\": {}\n }),\n emits: [\"update:status\"],\n setup(__props) {\n const status = useModel(__props, \"status\");\n const props = __props;\n const isInvisible = computed(() => status.value && [\"invisible\", \"offline\"].includes(status.value));\n const ariaLabel = computed(() => status.value && (!props.ariaHidden || props.ariaHidden === \"false\") ? t(\"User status: {status}\", { status: getUserStatusText(status.value) }) : void 0);\n watch(() => props.user, async (user) => {\n if (!status.value && user && getCapabilities()?.user_status?.enabled) {\n try {\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{user}\", { user }));\n status.value = data.ocs?.data?.status;\n } catch (error) {\n logger.debug(\"Error while fetching user status\", { error });\n }\n }\n }, { immediate: true });\n const matchSvg = {\n online: onlineSvg,\n away: awaySvg,\n busy: busySvg,\n dnd: dndSvg,\n invisible: invisibleSvg,\n offline: invisibleSvg\n };\n const activeSvg = computed(() => status.value && matchSvg[status.value]);\n return (_ctx, _cache) => {\n return status.value ? (openBlock(), createElementBlock(\"span\", {\n key: 0,\n class: normalizeClass([\"user-status-icon\", {\n \"user-status-icon--invisible\": isInvisible.value\n }]),\n \"aria-hidden\": !ariaLabel.value || void 0,\n \"aria-label\": ariaLabel.value,\n role: \"img\",\n innerHTML: activeSvg.value\n }, null, 10, _hoisted_1)) : createCommentVNode(\"\", true);\n };\n }\n});\nconst NcUserStatusIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-881a79fb\"]]);\nexport {\n NcUserStatusIcon as N,\n getUserStatusText as g\n};\n//# sourceMappingURL=NcUserStatusIcon-BgElapLh.mjs.map\n","const ActionGlobalMixin = {\n beforeUpdate() {\n this.text = this.getText();\n },\n data() {\n return {\n // $slots are not reactive.\n // We need to update the content manually\n text: this.getText()\n };\n },\n computed: {\n isLongText() {\n return this.text && this.text.trim().length > 20;\n }\n },\n methods: {\n getText() {\n return this.$slots.default?.()[0].children?.trim?.() || \"\";\n }\n }\n};\nexport {\n ActionGlobalMixin as A\n};\n//# sourceMappingURL=actionGlobal-BZFdtdJL.mjs.map\n","import { warn } from \"vue\";\nimport { N as NC_ACTIONS_CLOSE_MENU } from \"./useNcActions-BzPO2c4h.mjs\";\nimport { A as ActionGlobalMixin } from \"./actionGlobal-BZFdtdJL.mjs\";\nconst ActionTextMixin = {\n mixins: [ActionGlobalMixin],\n props: {\n /**\n * Icon to show with the action, can be either a CSS class or an URL\n */\n icon: {\n type: String,\n default: \"\"\n },\n /**\n * The main text content of the entry.\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * The title attribute of the element.\n */\n title: {\n type: String,\n default: \"\"\n },\n /**\n * Whether we close the Actions menu after the click\n */\n closeAfterClick: {\n type: Boolean,\n default: false\n },\n /**\n * Aria label for the button. Not needed if the button has text.\n */\n ariaLabel: {\n type: String,\n default: null\n }\n },\n inject: {\n closeMenu: {\n from: NC_ACTIONS_CLOSE_MENU\n }\n },\n emits: [\n \"click\"\n ],\n created() {\n if (\"ariaHidden\" in this.$attrs) {\n warn(\"[NcAction*]: Do not set the ariaHidden attribute as the root element will inherit the incorrect aria-hidden.\");\n }\n },\n computed: {\n /**\n * Check if icon prop is an URL\n *\n * @return {boolean} Whether the icon prop is an URL\n */\n isIconUrl() {\n try {\n return !!new URL(this.icon, this.icon.startsWith(\"/\") ? window.location.origin : void 0);\n } catch {\n return false;\n }\n }\n },\n methods: {\n onClick(event) {\n this.$emit(\"click\", event);\n if (this.closeAfterClick) {\n this.closeMenu(false);\n }\n }\n }\n};\nexport {\n ActionTextMixin as A\n};\n//# sourceMappingURL=actionText-BXR0sWNu.mjs.map\n","import '../assets/NcActionButton-Bb0ihLdt.css';\nimport { c as mdiChevronRight, d as mdiCheck } from \"./mdi-CpchYUUV.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { A as ActionTextMixin } from \"./actionText-BXR0sWNu.mjs\";\nimport { a as NC_ACTIONS_IS_SEMANTIC_MENU } from \"./useNcActions-BzPO2c4h.mjs\";\nimport { resolveComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, mergeProps, renderSlot, createBlock, createCommentVNode, normalizeStyle, toDisplayString } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nconst _sfc_main = {\n name: \"NcActionButton\",\n components: {\n NcIconSvgWrapper\n },\n mixins: [ActionTextMixin],\n inject: {\n isInSemanticMenu: {\n from: NC_ACTIONS_IS_SEMANTIC_MENU,\n default: false\n }\n },\n props: {\n /**\n * disabled state of the action button\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * If this is a menu, a chevron icon will\n * be added at the end of the line\n */\n isMenu: {\n type: Boolean,\n default: false\n },\n /**\n * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n * This extends the native HTML button type attribute.\n */\n type: {\n type: String,\n default: \"button\",\n validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n },\n /**\n * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n * For checkbox and toggle button behavior - boolean value.\n * For radio button behavior - could be a boolean checked or a string with the value of the button.\n * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n *\n * **This is not availabe for `type='submit'` or `type='reset'`**\n *\n * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n * For `type='radio'` `null` is equal to `false`\n */\n modelValue: {\n type: [Boolean, String],\n default: null\n },\n /**\n * The value used for the `modelValue` when this component is used with radio behavior\n * Similar to the `value` attribute of ``\n */\n value: {\n type: String,\n default: null\n },\n /**\n * Small underlying text content of the entry\n */\n description: {\n type: String,\n default: \"\"\n }\n },\n emits: [\"update:modelValue\"],\n setup() {\n return {\n mdiCheck,\n mdiChevronRight\n };\n },\n computed: {\n /**\n * determines if the action is focusable\n *\n * @return {boolean} is the action focusable ?\n */\n isFocusable() {\n return !this.disabled;\n },\n /**\n * The current \"checked\" or \"pressed\" state for the model behavior\n */\n isChecked() {\n if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n return this.modelValue === this.value;\n }\n return this.modelValue;\n },\n /**\n * The native HTML type to set on the button\n */\n nativeType() {\n if (this.type === \"submit\" || this.type === \"reset\") {\n return this.type;\n }\n return \"button\";\n },\n /**\n * HTML attributes to bind to the
` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code);\n buffer = '';\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === 62) {\n const name = buffer.toLowerCase();\n if (htmlRawNames.includes(name)) {\n effects.consume(code);\n return continuationClose;\n }\n return continuation(code);\n }\n if (asciiAlpha(code) && buffer.length < 8) {\n // Always the case.\n effects.consume(code);\n buffer += String.fromCharCode(code);\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === 93) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code);\n return continuationClose;\n }\n\n // More dashes.\n if (code === 45 && marker === 2) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"htmlFlowData\");\n return continuationAfter(code);\n }\n effects.consume(code);\n return continuationClose;\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(\"htmlFlow\");\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start;\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return effects.attempt(blankLine, ok, nok);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable | undefined} */\n let marker;\n /** @type {number} */\n let index;\n /** @type {State} */\n let returnState;\n return start;\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"htmlText\");\n effects.enter(\"htmlTextData\");\n effects.consume(code);\n return open;\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 33) {\n effects.consume(code);\n return declarationOpen;\n }\n if (code === 47) {\n effects.consume(code);\n return tagCloseStart;\n }\n if (code === 63) {\n effects.consume(code);\n return instruction;\n }\n\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagOpen;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code);\n return commentOpenInside;\n }\n if (code === 91) {\n effects.consume(code);\n index = 0;\n return cdataOpenInside;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return declaration;\n }\n return nok(code);\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return nok(code);\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 45) {\n effects.consume(code);\n return commentClose;\n }\n if (markdownLineEnding(code)) {\n returnState = comment;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return comment;\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return comment(code);\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = \"CDATA[\";\n if (code === value.charCodeAt(index++)) {\n effects.consume(code);\n return index === value.length ? cdata : cdataOpenInside;\n }\n return nok(code);\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataClose;\n }\n if (markdownLineEnding(code)) {\n returnState = cdata;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return cdata;\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === 62) {\n return end(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code);\n }\n if (markdownLineEnding(code)) {\n returnState = declaration;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return declaration;\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 63) {\n effects.consume(code);\n return instructionClose;\n }\n if (markdownLineEnding(code)) {\n returnState = instruction;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return instruction;\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagClose;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagClose;\n }\n return tagCloseBetween(code);\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagCloseBetween;\n }\n return end(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpen;\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code);\n return end;\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenBetween;\n }\n return end(code);\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n return tagOpenAttributeNameAfter(code);\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeNameAfter;\n }\n return tagOpenBetween(code);\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n return nok(code);\n }\n if (code === 34 || code === 39) {\n effects.consume(code);\n marker = code;\n return tagOpenAttributeValueQuoted;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code);\n marker = undefined;\n return tagOpenAttributeValueQuotedAfter;\n }\n if (code === null) {\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueQuoted;\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n return nok(code);\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === 62) {\n effects.consume(code);\n effects.exit(\"htmlTextData\");\n effects.exit(\"htmlText\");\n return ok;\n }\n return nok(code);\n }\n\n /**\n * At eol.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n effects.exit(\"htmlTextData\");\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return lineEndingAfter;\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n\n return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(\"htmlTextData\");\n return returnState(code);\n }\n}","/**\n * @import {\n * Construct,\n * Event,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer,\n * Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n resolveAll: resolveAllLabelEnd,\n resolveTo: resolveToLabelEnd,\n tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1;\n /** @type {Array} */\n const newEvents = [];\n while (++index < events.length) {\n const token = events[index][1];\n newEvents.push(events[index]);\n if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n // Remove the marker.\n const offset = token.type === \"labelImage\" ? 4 : 2;\n token.type = \"data\";\n index += offset;\n }\n }\n\n // If the events are equal, we don't have to copy newEvents to events\n if (events.length !== newEvents.length) {\n splice(events, 0, events.length, newEvents);\n }\n return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length;\n let offset = 0;\n /** @type {Token} */\n let token;\n /** @type {number | undefined} */\n let open;\n /** @type {number | undefined} */\n let close;\n /** @type {Array} */\n let media;\n\n // Find an opening.\n while (index--) {\n token = events[index][1];\n if (open) {\n // If we see another link, or inactive link label, we’ve been here before.\n if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n break;\n }\n\n // Mark other link openings as inactive, as we can’t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n token._inactive = true;\n }\n } else if (close) {\n if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n open = index;\n if (token.type !== \"labelLink\") {\n offset = 2;\n break;\n }\n }\n } else if (token.type === \"labelEnd\") {\n close = index;\n }\n }\n const group = {\n type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n const label = {\n type: \"label\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[close][1].end\n }\n };\n const text = {\n type: \"labelText\",\n start: {\n ...events[open + offset + 2][1].end\n },\n end: {\n ...events[close - 2][1].start\n }\n };\n media = [['enter', group, context], ['enter', label, context]];\n\n // Opening marker.\n media = push(media, events.slice(open + 1, open + offset + 3));\n\n // Text open.\n media = push(media, [['enter', text, context]]);\n\n // Always populated by defaults.\n\n // Between.\n media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n // Text close, marker close, label close.\n media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n // Reference, resource, or so.\n media = push(media, events.slice(close + 1));\n\n // Media close.\n media = push(media, [['exit', group, context]]);\n splice(events, open, events.length, media);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n /** @type {Token} */\n let labelStart;\n /** @type {boolean} */\n let defined;\n\n // Find an opening.\n while (index--) {\n if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n labelStart = self.events[index][1];\n break;\n }\n }\n return start;\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code);\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we’d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can’t have that, so it’s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code);\n }\n defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })));\n effects.enter(\"labelEnd\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelEnd\");\n return after;\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === 40) {\n return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code);\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code);\n }\n\n /**\n * Done, it’s nothing.\n *\n * There was an okay opening, but we didn’t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true;\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart;\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n effects.enter(\"resource\");\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n return resourceBefore;\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === 41) {\n return resourceEnd(code);\n }\n return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code);\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n }\n return resourceEnd(code);\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === 41) {\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n effects.exit(\"resource\");\n return ok;\n }\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this;\n return referenceFull;\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart;\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there’s a `[`.\n\n effects.enter(\"reference\");\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n return referenceCollapsedOpen;\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > 👉 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === 93) {\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n effects.exit(\"reference\");\n return ok;\n }\n return nok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelImage\");\n effects.enter(\"labelImageMarker\");\n effects.consume(code);\n effects.exit(\"labelImageMarker\");\n return open;\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 91) {\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelImage\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn’t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelLink\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelLink\");\n return after;\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn’t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}","/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start;\n\n /** @type {State} */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return factorySpace(effects, ok, \"linePrefix\");\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"thematicBreak\");\n // To do: parse indent like `markdown-rs`.\n return before(code);\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n marker = code;\n return atBreak(code);\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(\"thematicBreakSequence\");\n return sequence(code);\n }\n if (size >= 3 && (code === null || markdownLineEnding(code))) {\n effects.exit(\"thematicBreak\");\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code);\n size++;\n return sequence;\n }\n effects.exit(\"thematicBreakSequence\");\n return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Exiter,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd,\n name: 'list',\n tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n partial: true,\n tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n partial: true,\n tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this;\n const tail = self.events[self.events.length - 1];\n let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n if (!self.containerState.type) {\n self.containerState.type = kind;\n effects.enter(kind, {\n _container: true\n });\n }\n if (kind === \"listUnordered\") {\n effects.enter(\"listItemPrefix\");\n return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n }\n if (!self.interrupt || code === 49) {\n effects.enter(\"listItemPrefix\");\n effects.enter(\"listItemValue\");\n return inside(code);\n }\n }\n return nok(code);\n }\n\n /** @type {State} */\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code);\n return inside;\n }\n if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n effects.exit(\"listItemValue\");\n return atMarker(code);\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n effects.enter(\"listItemMarker\");\n effects.consume(code);\n effects.exit(\"listItemMarker\");\n self.containerState.marker = self.containerState.marker || code;\n return effects.check(blankLine,\n // Can’t be empty when interrupting.\n self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n }\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.initialBlankLine = true;\n initialSize++;\n return endOfPrefix(code);\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter(\"listItemPrefixWhitespace\");\n effects.consume(code);\n effects.exit(\"listItemPrefixWhitespace\");\n return endOfPrefix;\n }\n return nok(code);\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this;\n self.containerState._closeFlow = undefined;\n return effects.check(blankLine, onBlank, notBlank);\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n }\n\n /** @type {State} */\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return notInCurrentItem(code);\n }\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true;\n // As we’re closing flow, we’re no longer interrupting.\n self.interrupt = undefined;\n // Always populated by defaults.\n\n return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this;\n\n // Always populated by defaults.\n\n return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n }\n}","/**\n * @import {\n * Code,\n * Construct,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n resolveTo: resolveToSetextUnderline,\n tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length;\n /** @type {number | undefined} */\n let content;\n /** @type {number | undefined} */\n let text;\n /** @type {number | undefined} */\n let definition;\n\n // Find the opening of the content.\n // It’ll always exist: we don’t tokenize if it isn’t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === \"content\") {\n content = index;\n break;\n }\n if (events[index][1].type === \"paragraph\") {\n text = index;\n }\n }\n // Exit\n else {\n if (events[index][1].type === \"content\") {\n // Remove the content end (if needed we’ll add it later)\n events.splice(index, 1);\n }\n if (!definition && events[index][1].type === \"definition\") {\n definition = index;\n }\n }\n }\n const heading = {\n type: \"setextHeading\",\n start: {\n ...events[content][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n\n // Change the paragraph to setext heading text.\n events[text][1].type = \"setextHeadingText\";\n\n // If we have definitions in the content, we’ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context]);\n events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n events[content][1].end = {\n ...events[definition][1].end\n };\n } else {\n events[content][1] = heading;\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context]);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length;\n /** @type {boolean | undefined} */\n let paragraph;\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n paragraph = self.events[index][1].type === \"paragraph\";\n break;\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(\"setextHeadingLine\");\n marker = code;\n return before(code);\n }\n return nok(code);\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(\"setextHeadingLineSequence\");\n return inside(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code);\n return inside;\n }\n effects.exit(\"setextHeadingLineSequence\");\n return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"setextHeadingLine\");\n return ok(code);\n }\n return nok(code);\n }\n}","/**\n * @import {\n * InitialConstruct,\n * Initializer,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n * Self.\n * @type {Initializer}\n * Initializer.\n */\nfunction initializeFlow(effects) {\n const self = this;\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine, atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n return initial;\n\n /** @type {State} */\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEndingBlank\");\n effects.consume(code);\n effects.exit(\"lineEndingBlank\");\n self.currentConstruct = undefined;\n return initial;\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n self.currentConstruct = undefined;\n return initial;\n }\n}","/**\n * @import {\n * Code,\n * InitialConstruct,\n * Initializer,\n * Resolver,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n * Field.\n * @returns {InitialConstruct}\n * Construct.\n */\nfunction initializeFactory(field) {\n return {\n resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n tokenize: initializeText\n };\n\n /**\n * @this {TokenizeContext}\n * Context.\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this;\n const constructs = this.parser.constructs[field];\n const text = effects.attempt(constructs, start, notText);\n return start;\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code);\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"data\");\n effects.consume(code);\n return data;\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(\"data\");\n return text(code);\n }\n\n // Data.\n effects.consume(code);\n return data;\n }\n\n /**\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether the code is a break.\n */\n function atBreak(code) {\n if (code === null) {\n return true;\n }\n const list = constructs[code];\n let index = -1;\n if (list) {\n // Always populated by defaults.\n\n while (++index < list.length) {\n const item = list[index];\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * Resolver.\n * @returns {Resolver}\n * Resolver.\n */\nfunction createResolver(extraResolver) {\n return resolveAllText;\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1;\n /** @type {number | undefined} */\n let enter;\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === \"data\") {\n enter = index;\n index++;\n }\n } else if (!events[index] || events[index][1].type !== \"data\") {\n // Don’t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end;\n events.splice(enter + 2, index - enter - 2);\n index = enter + 2;\n }\n enter = undefined;\n }\n }\n return extraResolver ? extraResolver(events, context) : events;\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can’t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0; // Skip first.\n\n while (++eventIndex <= events.length) {\n if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n const data = events[eventIndex - 1][1];\n const chunks = context.sliceStream(data);\n let index = chunks.length;\n let bufferIndex = -1;\n let size = 0;\n /** @type {boolean | undefined} */\n let tabs;\n while (index--) {\n const chunk = chunks[index];\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length;\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++;\n bufferIndex--;\n }\n if (bufferIndex) break;\n bufferIndex = -1;\n }\n // Number\n else if (chunk === -2) {\n tabs = true;\n size++;\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++;\n break;\n }\n }\n\n // Allow final trailing whitespace.\n if (context._contentTypeTextTrailing && eventIndex === events.length) {\n size = 0;\n }\n if (size) {\n const token = {\n type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n start: {\n _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n _index: data.start._index + index,\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size\n },\n end: {\n ...data.end\n }\n };\n data.end = {\n ...token.start\n };\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token);\n } else {\n events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n eventIndex += 2;\n }\n }\n eventIndex++;\n }\n }\n return events;\n}","/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n null: []\n};","/**\n * @import {\n * Chunk,\n * Code,\n * ConstructRecord,\n * Construct,\n * Effects,\n * InitialConstruct,\n * ParseContext,\n * Point,\n * State,\n * TokenizeContext,\n * Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n * Restore the state.\n * @returns {undefined}\n * Nothing.\n *\n * @typedef Info\n * Info.\n * @property {Restore} restore\n * Restore.\n * @property {number} from\n * From.\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * Construct.\n * @param {Info} info\n * Info.\n * @returns {undefined}\n * Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn’t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * Parser.\n * @param {InitialConstruct} initialize\n * Construct.\n * @param {Omit | undefined} [from]\n * Point (optional).\n * @returns {TokenizeContext}\n * Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = {\n _bufferIndex: -1,\n _index: 0,\n line: from && from.line || 1,\n column: from && from.column || 1,\n offset: from && from.offset || 0\n };\n /** @type {Record} */\n const columnStart = {};\n /** @type {Array} */\n const resolveAllConstructs = [];\n /** @type {Array} */\n let chunks = [];\n /** @type {Array} */\n let stack = [];\n /** @type {boolean | undefined} */\n let consumed = true;\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n consume,\n enter,\n exit,\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n };\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n code: null,\n containerState: {},\n defineSkip,\n events: [],\n now,\n parser,\n previous: null,\n sliceSerialize,\n sliceStream,\n write\n };\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects);\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode;\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize);\n }\n return context;\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = push(chunks, slice);\n main();\n\n // Exit if we’re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== null) {\n return [];\n }\n addResult(initialize, 0);\n\n // Otherwise, resolve, and exit.\n context.events = resolveAll(resolveAllConstructs, context.events, context);\n return context.events;\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs);\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token);\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n } = point;\n return {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n };\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column;\n accountForPotentialSkip();\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n * Nothing.\n */\n function main() {\n /** @type {number} */\n let chunkIndex;\n while (point._index < chunks.length) {\n const chunk = chunks[point._index];\n\n // If we’re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index;\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0;\n }\n while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n go(chunk.charCodeAt(point._bufferIndex));\n }\n } else {\n go(chunk);\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * Code.\n * @returns {undefined}\n * Nothing.\n */\n function go(code) {\n consumed = undefined;\n expectedCode = code;\n state = state(code);\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++;\n point.column = 1;\n point.offset += code === -3 ? 2 : 1;\n accountForPotentialSkip();\n } else if (code !== -1) {\n point.column++;\n point.offset++;\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++;\n } else {\n point._bufferIndex++;\n\n // At end of string chunk.\n if (point._bufferIndex ===\n // Points w/ non-negative `_bufferIndex` reference\n // strings.\n /** @type {string} */\n chunks[point._index].length) {\n point._bufferIndex = -1;\n point._index++;\n }\n }\n\n // Expose the previous character.\n context.previous = code;\n\n // Mark as consumed.\n consumed = true;\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {};\n token.type = type;\n token.start = now();\n context.events.push(['enter', token, context]);\n stack.push(token);\n return token;\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n const token = stack.pop();\n token.end = now();\n context.events.push(['exit', token, context]);\n return token;\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from);\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore();\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * Callback.\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n * Fields.\n */\n function constructFactory(onreturn, fields) {\n return hook;\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | ConstructRecord | Construct} constructs\n * Constructs.\n * @param {State} returnState\n * State.\n * @param {State | undefined} [bogusState]\n * State.\n * @returns {State}\n * State.\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {ReadonlyArray} */\n let listOfConstructs;\n /** @type {number} */\n let constructIndex;\n /** @type {Construct} */\n let currentConstruct;\n /** @type {Info} */\n let info;\n return Array.isArray(constructs) ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n // Looks like a construct.\n handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleMapOfConstructs(map) {\n return start;\n\n /** @type {State} */\n function start(code) {\n const left = code !== null && map[code];\n const all = code !== null && map.null;\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n return handleListOfConstructs(list)(code);\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {ReadonlyArray} list\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list;\n constructIndex = 0;\n if (list.length === 0) {\n return bogusState;\n }\n return handleConstruct(list[constructIndex]);\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * Construct.\n * @returns {State}\n * State.\n */\n function handleConstruct(construct) {\n return start;\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn’t work because `inspect` in document does a check\n // w/o a bogus, which doesn’t make sense. But it does seem to help perf\n // by not storing.\n info = store();\n currentConstruct = construct;\n if (!construct.partial) {\n context.currentConstruct = construct;\n }\n\n // Always populated by defaults.\n\n if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n return nok(code);\n }\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a “live binding”, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n }\n }\n\n /** @type {State} */\n function ok(code) {\n consumed = true;\n onreturn(currentConstruct, info);\n return returnState;\n }\n\n /** @type {State} */\n function nok(code) {\n consumed = true;\n info.restore();\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex]);\n }\n return bogusState;\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * Construct.\n * @param {number} from\n * From.\n * @returns {undefined}\n * Nothing.\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct);\n }\n if (construct.resolve) {\n splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n }\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context);\n }\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n * Info.\n */\n function store() {\n const startPoint = now();\n const startPrevious = context.previous;\n const startCurrentConstruct = context.currentConstruct;\n const startEventsIndex = context.events.length;\n const startStack = Array.from(stack);\n return {\n from: startEventsIndex,\n restore\n };\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n * Nothing.\n */\n function restore() {\n point = startPoint;\n context.previous = startPrevious;\n context.currentConstruct = startCurrentConstruct;\n context.events.length = startEventsIndex;\n stack = startStack;\n accountForPotentialSkip();\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it’s on a column\n * skip.\n *\n * @returns {undefined}\n * Nothing.\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line];\n point.offset += columnStart[point.line] - 1;\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {Pick} token\n * Token.\n * @returns {Array}\n * Chunks.\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index;\n const startBufferIndex = token.start._bufferIndex;\n const endIndex = token.end._index;\n const endBufferIndex = token.end._bufferIndex;\n /** @type {Array} */\n let view;\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n } else {\n view = chunks.slice(startIndex, endIndex);\n if (startBufferIndex > -1) {\n const head = view[0];\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex);\n /* c8 ignore next 4 -- used to be used, no longer */\n } else {\n view.shift();\n }\n }\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex));\n }\n }\n return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n * Whether to expand tabs (default: `false`).\n * @returns {string}\n * Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1;\n /** @type {Array} */\n const result = [];\n /** @type {boolean | undefined} */\n let atTab;\n while (++index < chunks.length) {\n const chunk = chunks[index];\n /** @type {string} */\n let value;\n if (typeof chunk === 'string') {\n value = chunk;\n } else switch (chunk) {\n case -5:\n {\n value = \"\\r\";\n break;\n }\n case -4:\n {\n value = \"\\n\";\n break;\n }\n case -3:\n {\n value = \"\\r\" + \"\\n\";\n break;\n }\n case -2:\n {\n value = expandTabs ? \" \" : \"\\t\";\n break;\n }\n case -1:\n {\n if (!expandTabs && atTab) continue;\n value = \" \";\n break;\n }\n default:\n {\n // Currently only replacement character.\n value = String.fromCharCode(chunk);\n }\n }\n atTab = chunk === -2;\n result.push(value);\n }\n return result.join('');\n}","/**\n * @import {\n * Create,\n * FullNormalizedExtension,\n * InitialConstruct,\n * ParseContext,\n * ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ParseContext}\n * Parser.\n */\nexport function parse(options) {\n const settings = options || {};\n const constructs = /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n /** @type {ParseContext} */\n const parser = {\n constructs,\n content: create(content),\n defined: [],\n document: create(document),\n flow: create(flow),\n lazy: {},\n string: create(string),\n text: create(text)\n };\n return parser;\n\n /**\n * @param {InitialConstruct} initial\n * Construct to start with.\n * @returns {Create}\n * Create a tokenizer.\n */\n function create(initial) {\n return creator;\n /** @type {Create} */\n function creator(from) {\n return createTokenizer(parser, initial, from);\n }\n }\n}","/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array} events\n * Events.\n * @returns {Array}\n * Events.\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events;\n}","/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n * Preprocess a value.\n * @param {Value} value\n * Value.\n * @param {Encoding | null | undefined} [encoding]\n * Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n * Whether this is the last chunk (default: `false`).\n * @returns {Array}\n * Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n * Preprocess a value.\n */\nexport function preprocess() {\n let column = 1;\n let buffer = '';\n /** @type {boolean | undefined} */\n let start = true;\n /** @type {boolean | undefined} */\n let atCarriageReturn;\n return preprocessor;\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = [];\n /** @type {RegExpMatchArray | null} */\n let match;\n /** @type {number} */\n let next;\n /** @type {number} */\n let startPosition;\n /** @type {number} */\n let endPosition;\n /** @type {Code} */\n let code;\n value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n startPosition = 0;\n buffer = '';\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === 65279) {\n startPosition++;\n }\n start = undefined;\n }\n while (startPosition < value.length) {\n search.lastIndex = startPosition;\n match = search.exec(value);\n endPosition = match && match.index !== undefined ? match.index : value.length;\n code = value.charCodeAt(endPosition);\n if (!match) {\n buffer = value.slice(startPosition);\n break;\n }\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3);\n atCarriageReturn = undefined;\n } else {\n if (atCarriageReturn) {\n chunks.push(-5);\n atCarriageReturn = undefined;\n }\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition));\n column += endPosition - startPosition;\n }\n switch (code) {\n case 0:\n {\n chunks.push(65533);\n column++;\n break;\n }\n case 9:\n {\n next = Math.ceil(column / 4) * 4;\n chunks.push(-2);\n while (column++ < next) chunks.push(-1);\n break;\n }\n case 10:\n {\n chunks.push(-4);\n column = 1;\n break;\n }\n default:\n {\n atCarriageReturn = true;\n column = 1;\n }\n }\n }\n startPosition = endPosition + 1;\n }\n if (end) {\n if (atCarriageReturn) chunks.push(-5);\n if (buffer) chunks.push(buffer);\n chunks.push(null);\n }\n return chunks;\n }\n}","import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The “string” content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}","/**\n * @import {\n * Break,\n * Blockquote,\n * Code,\n * Definition,\n * Emphasis,\n * Heading,\n * Html,\n * Image,\n * InlineCode,\n * Link,\n * ListItem,\n * List,\n * Nodes,\n * Paragraph,\n * PhrasingContent,\n * ReferenceType,\n * Root,\n * Strong,\n * Text,\n * ThematicBreak\n * } from 'mdast'\n * @import {\n * Encoding,\n * Event,\n * Token,\n * Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n * CompileContext,\n * CompileData,\n * Config,\n * Extension,\n * Handle,\n * OnEnterError,\n * Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n * Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n * Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {Root}\n * mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding;\n encoding = undefined;\n }\n return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n /** @type {Config} */\n const config = {\n transforms: [],\n canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n characterReference: onexitcharacterreference,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n };\n configure(config, (options || {}).mdastExtensions || []);\n\n /** @type {CompileData} */\n const data = {};\n return compile;\n\n /**\n * Turn micromark events into an mdast tree.\n *\n * @param {Array} events\n * Events.\n * @returns {Root}\n * mdast tree.\n */\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n };\n /** @type {Omit} */\n const context = {\n stack: [tree],\n tokenStack: [],\n config,\n enter,\n exit,\n buffer,\n resume,\n data\n };\n /** @type {Array} */\n const listStack = [];\n let index = -1;\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n if (events[index][0] === 'enter') {\n listStack.push(index);\n } else {\n const tail = listStack.pop();\n index = prepareList(events, tail, index);\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n const handler = config[events[index][0]];\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(Object.assign({\n sliceSerialize: events[index][2].sliceSerialize\n }, context), events[index][1]);\n }\n }\n\n // Handle tokens still being open.\n if (context.tokenStack.length > 0) {\n const tail = context.tokenStack[context.tokenStack.length - 1];\n const handler = tail[1] || defaultOnError;\n handler.call(context, undefined, tail[0]);\n }\n\n // Figure out `root` position.\n tree.position = {\n start: point(events.length > 0 ? events[0][1].start : {\n line: 1,\n column: 1,\n offset: 0\n }),\n end: point(events.length > 0 ? events[events.length - 2][1].end : {\n line: 1,\n column: 1,\n offset: 0\n })\n };\n\n // Call transforms.\n index = -1;\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree;\n }\n return tree;\n }\n\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n function prepareList(events, start, length) {\n let index = start - 1;\n let containerBalance = -1;\n let listSpread = false;\n /** @type {Token | undefined} */\n let listItem;\n /** @type {number | undefined} */\n let lineIndex;\n /** @type {number | undefined} */\n let firstBlankLineIndex;\n /** @type {boolean | undefined} */\n let atMarker;\n while (++index <= length) {\n const event = events[index];\n switch (event[1].type) {\n case \"listUnordered\":\n case \"listOrdered\":\n case \"blockQuote\":\n {\n if (event[0] === 'enter') {\n containerBalance++;\n } else {\n containerBalance--;\n }\n atMarker = undefined;\n break;\n }\n case \"lineEndingBlank\":\n {\n if (event[0] === 'enter') {\n if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n firstBlankLineIndex = index;\n }\n atMarker = undefined;\n }\n break;\n }\n case \"linePrefix\":\n case \"listItemValue\":\n case \"listItemMarker\":\n case \"listItemPrefix\":\n case \"listItemPrefixWhitespace\":\n {\n // Empty.\n\n break;\n }\n default:\n {\n atMarker = undefined;\n }\n }\n if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n if (listItem) {\n let tailIndex = index;\n lineIndex = undefined;\n while (tailIndex--) {\n const tailEvent = events[tailIndex];\n if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n if (tailEvent[0] === 'exit') continue;\n if (lineIndex) {\n events[lineIndex][1].type = \"lineEndingBlank\";\n listSpread = true;\n }\n tailEvent[1].type = \"lineEnding\";\n lineIndex = tailIndex;\n } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n // Empty\n } else {\n break;\n }\n }\n if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n listItem._spread = true;\n }\n\n // Fix position.\n listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n index++;\n length++;\n }\n\n // Create a new list item.\n if (event[1].type === \"listItemPrefix\") {\n /** @type {Token} */\n const item = {\n type: 'listItem',\n _spread: false,\n start: Object.assign({}, event[1].start),\n // @ts-expect-error: we’ll add `end` in a second.\n end: undefined\n };\n listItem = item;\n events.splice(index, 0, ['enter', item, event[2]]);\n index++;\n length++;\n firstBlankLineIndex = undefined;\n atMarker = true;\n }\n }\n }\n events[start][1]._spread = listSpread;\n return length;\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Nodes} create\n * Create a node.\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function opener(create, and) {\n return open;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function open(token) {\n enter.call(this, create(token), token);\n if (and) and.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['buffer']}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n });\n }\n\n /**\n * @type {CompileContext['enter']}\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = parent.children;\n siblings.push(node);\n this.stack.push(node);\n this.tokenStack.push([token, errorHandler || undefined]);\n node.position = {\n start: point(token.start),\n // @ts-expect-error: `end` will be patched later.\n end: undefined\n };\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function closer(and) {\n return close;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function close(token) {\n if (and) and.call(this, token);\n exit.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['exit']}\n */\n function exit(token, onExitError) {\n const node = this.stack.pop();\n const open = this.tokenStack.pop();\n if (!open) {\n throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n start: token.start,\n end: token.end\n }) + '): it’s not open');\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0]);\n } else {\n const handler = open[1] || defaultOnError;\n handler.call(this, token, open[0]);\n }\n }\n node.position.end = point(token.end);\n }\n\n /**\n * @type {CompileContext['resume']}\n */\n function resume() {\n return toString(this.stack.pop());\n }\n\n //\n // Handlers.\n //\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistordered() {\n this.data.expectingFirstListItemValue = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (this.data.expectingFirstListItemValue) {\n const ancestor = this.stack[this.stack.length - 2];\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n this.data.expectingFirstListItemValue = undefined;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfenceinfo() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.lang = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfencemeta() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.meta = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (this.data.flowCodeInside) return;\n this.buffer();\n this.data.flowCodeInside = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefenced() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n this.data.flowCodeInside = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodeindented() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitionlabelstring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.label = label;\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiontitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiondestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitatxheadingsequence(token) {\n const node = this.stack[this.stack.length - 1];\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length;\n node.depth = depth;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadingtext() {\n this.data.setextHeadingSlurpLineEnding = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadinglinesequence(token) {\n const node = this.stack[this.stack.length - 1];\n node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n this.data.setextHeadingSlurpLineEnding = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterdata(token) {\n const node = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = node.children;\n let tail = siblings[siblings.length - 1];\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text();\n tail.position = {\n start: point(token.start),\n // @ts-expect-error: we’ll add `end` later.\n end: undefined\n };\n siblings.push(tail);\n }\n this.stack.push(tail);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitdata(token) {\n const tail = this.stack.pop();\n tail.value += this.sliceSerialize(token);\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1];\n // If we’re at a hard break, include the line ending in there.\n if (this.data.atHardBreak) {\n const tail = context.children[context.children.length - 1];\n tail.position.end = point(token.end);\n this.data.atHardBreak = undefined;\n return;\n }\n if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n onenterdata.call(this, token);\n onexitdata.call(this, token);\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithardbreak() {\n this.data.atHardBreak = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmlflow() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmltext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcodetext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlink() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitimage() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabeltext(token) {\n const string = this.sliceSerialize(token);\n const ancestor = this.stack[this.stack.length - 2];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n ancestor.label = decodeString(string);\n // @ts-expect-error: same as above.\n ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabel() {\n const fragment = this.stack[this.stack.length - 1];\n const value = this.resume();\n const node = this.stack[this.stack.length - 1];\n // Assume a reference.\n this.data.inReference = true;\n if (node.type === 'link') {\n /** @type {Array} */\n const children = fragment.children;\n node.children = children;\n } else {\n node.alt = value;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcedestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcetitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresource() {\n this.data.inReference = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n this.data.referenceType = 'collapsed';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitreferencestring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n node.label = label;\n // @ts-expect-error: same as above.\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n this.data.referenceType = 'full';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n this.data.characterReferenceType = token.type;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token);\n const type = this.data.characterReferenceType;\n /** @type {string} */\n let value;\n if (type) {\n value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n this.data.characterReferenceType = undefined;\n } else {\n const result = decodeNamedCharacterReference(data);\n value = result;\n }\n const tail = this.stack[this.stack.length - 1];\n tail.value += value;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreference(token) {\n const tail = this.stack.pop();\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = this.sliceSerialize(token);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkemail(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = 'mailto:' + this.sliceSerialize(token);\n }\n\n //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n };\n }\n\n /** @returns {Code} */\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n };\n }\n\n /** @returns {InlineCode} */\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n };\n }\n\n /** @returns {Definition} */\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n };\n }\n\n /** @returns {Emphasis} */\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n };\n }\n\n /** @returns {Heading} */\n function heading() {\n return {\n type: 'heading',\n // @ts-expect-error `depth` will be set later.\n depth: 0,\n children: []\n };\n }\n\n /** @returns {Break} */\n function hardBreak() {\n return {\n type: 'break'\n };\n }\n\n /** @returns {Html} */\n function html() {\n return {\n type: 'html',\n value: ''\n };\n }\n\n /** @returns {Image} */\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n };\n }\n\n /** @returns {Link} */\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {List}\n */\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n spread: token._spread,\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n function listItem(token) {\n return {\n type: 'listItem',\n spread: token._spread,\n checked: null,\n children: []\n };\n }\n\n /** @returns {Paragraph} */\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n };\n }\n\n /** @returns {Strong} */\n function strong() {\n return {\n type: 'strong',\n children: []\n };\n }\n\n /** @returns {Text} */\n function text() {\n return {\n type: 'text',\n value: ''\n };\n }\n\n /** @returns {ThematicBreak} */\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n };\n }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n * Point-like value.\n * @returns {Point}\n * unist point.\n */\nfunction point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n };\n}\n\n/**\n * @param {Config} combined\n * @param {Array | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n let index = -1;\n while (++index < extensions.length) {\n const value = extensions[index];\n if (Array.isArray(value)) {\n configure(combined, value);\n } else {\n extension(combined, value);\n }\n }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key;\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'canContainEols':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'transforms':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'enter':\n case 'exit':\n {\n const right = extension[key];\n if (right) {\n Object.assign(combined[key], right);\n }\n break;\n }\n // No default\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n start: left.start,\n end: left.end\n }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is open');\n } else {\n throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is still open');\n }\n}","/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser} Parser\n * @typedef {import('unified').Processor} Processor\n */\n\n/**\n * @typedef {Omit} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkParse(options) {\n /** @type {Processor} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n\n self.parser = parser\n\n /**\n * @type {Parser}\n */\n function parser(doc) {\n return fromMarkdown(doc, {\n ...self.data('settings'),\n ...options,\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: self.data('micromarkExtensions') || [],\n mdastExtensions: self.data('fromMarkdownExtensions') || []\n })\n }\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Blockquote} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function blockquote(state, node) {\n /** @type {Element} */\n const result = {\n type: 'element',\n tagName: 'blockquote',\n properties: {},\n children: state.wrap(state.all(node), true)\n }\n state.patch(node, result)\n return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Break} node\n * mdast node.\n * @returns {Array}\n * hast element content.\n */\nexport function hardBreak(state, node) {\n /** @type {Element} */\n const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n state.patch(node, result)\n return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Code} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function code(state, node) {\n const value = node.value ? node.value + '\\n' : ''\n /** @type {Properties} */\n const properties = {}\n // Someone can write `js python ruby`.\n const language = node.lang ? node.lang.split(/\\s+/) : []\n\n // GH/CM still drop the non-first languages.\n if (language.length > 0) {\n properties.className = ['language-' + language[0]]\n }\n\n // Create ``.\n /** @type {Element} */\n let result = {\n type: 'element',\n tagName: 'code',\n properties,\n children: [{type: 'text', value}]\n }\n\n if (node.meta) {\n result.data = {meta: node.meta}\n }\n\n state.patch(node, result)\n result = state.applyData(node, result)\n\n // Create `
`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n","/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract} node\n *   Reference node (image, link).\n * @returns {Array}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: .\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n","/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n","/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n","/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n","/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array} */\n  const result = [{type: 'text', value: '↩'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n","/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n * Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '↩'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `↩`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `↩` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node’s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nexport function createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {...defaultHandlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n visit(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = structuredClone(shallow)\n // @ts-expect-error: TS doesn’t understand…\n result.children = state.all(node)\n // @ts-expect-error: TS doesn’t understand…\n return result\n }\n\n // @ts-expect-error: it’s custom.\n return structuredClone(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node’s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, structuredClone(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n","/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don’t:\n *\n * * `hast-util-to-html` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful\n * if you completely trust authors\n * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc).\n * This is a heavy task as it needs a full HTML parser, but it is the only\n * way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn’t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, undefined)\n const foot = footer(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there’s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n assert('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n","/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit} Options\n *\n * @callback TransformBridge\n * Bridge-mode.\n *\n * Runs the destination with the new hast tree.\n * Discards result.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {Promise}\n * Nothing.\n *\n * @callback TransformMutate\n * Mutate-mode.\n *\n * Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {HastRoot}\n * Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n * runs the (rehype) plugins used on it with a hast tree,\n * then discards the result (*bridge mode*)\n * * otherwise,\n * returns a hast tree,\n * the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > 👉 **Note**:\n * > It’s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don’t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful if\n * you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc);\n * this is a heavy task as it needs a full HTML parser,\n * but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n * (and doesn’t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n * see later),\n * create a hast `text` node\n * * otherwise,\n * create a `
` element (which could be changed with `data.hName`),\n * with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly | Processor | null | undefined} [destination]\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given,\n * configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nexport default function remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ (\n toHast(tree, {file, ...options})\n )\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree, file) {\n // Cast because root in -> root out.\n // To do: in the future, disallow ` || options` fallback.\n // With `unified-engine`, `destination` can be `undefined` but\n // `options` will be the file set.\n // We should not pass that as `options`.\n return /** @type {HastRoot} */ (\n toHast(tree, {file, ...(destination || options)})\n )\n }\n}\n","/**\n * @typedef {import('mdast').Nodes} Nodes\n */\n\nimport {visit} from 'unist-util-visit'\n\n/**\n * Remove empty paragraphs in `tree`.\n *\n * @param {Nodes} tree\n * Tree to change.\n * @returns {undefined}\n * Nothing.\n */\nexport function squeezeParagraphs(tree) {\n visit(tree, function (node, index, parent) {\n if (\n index !== undefined &&\n parent &&\n node.type === 'paragraph' &&\n node.children.every(function (child) {\n return child.type === 'text' && /^\\s*$/.test(child.value)\n })\n ) {\n parent.children.splice(index, 1)\n return index\n }\n })\n}\n","/**\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').Root} Root\n */\n\nimport {squeezeParagraphs} from 'mdast-squeeze-paragraphs'\nimport {visit} from 'unist-util-visit'\n\n/**\n * Only keep links with the given protocols.\n *\n * @param {object} options Options\n * @param {string[]} options.except - Protocols to exclude. Defauls to `['http', 'https']`.\n * @returns\n * Transform.\n */\nexport default function remarkUnlinkProtocols(\n options = {except: ['http', 'https']}\n) {\n /**\n * Transform.\n *\n * @param {Root} tree\n * Tree.\n * @returns {undefined}\n * Nothing.\n */\n return function (tree) {\n /** @type {Map} */\n const definitions = new Map()\n\n // Find definitions to look up linkReferences.\n visit(tree, 'definition', function (node, index, parent) {\n definitions.set(node.identifier, node.url)\n if (parent && typeof index === 'number') {\n const url = node.url\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1)\n return index\n }\n }\n })\n\n visit(tree, function (node, index, parent) {\n if (\n parent &&\n typeof index === 'number' &&\n (node.type === 'link' || node.type === 'linkReference')\n ) {\n const url =\n node.type === 'link' ? node.url : definitions.get(node.identifier)\n if (\n url &&\n url.includes(':') &&\n !options.except.some((proto) => url.startsWith(`${proto}:`))\n ) {\n parent.children.splice(index, 1, ...node.children)\n return index\n }\n }\n })\n\n squeezeParagraphs(tree)\n }\n}\n","/**\n * Throw a given error.\n *\n * @param {Error|null|undefined} [error]\n * Maybe error.\n * @returns {asserts error is null|undefined}\n */\nexport function bail(error) {\n if (error) {\n throw error\n }\n}\n","'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","// To do: remove `void`s\n// To do: remove `null` from output of our APIs, allow it as user APIs.\n\n/**\n * @typedef {(error?: Error | null | undefined, ...output: Array) => void} Callback\n * Callback.\n *\n * @typedef {(...input: Array) => any} Middleware\n * Ware.\n *\n * @typedef Pipeline\n * Pipeline.\n * @property {Run} run\n * Run the pipeline.\n * @property {Use} use\n * Add middleware.\n *\n * @typedef {(...input: Array) => void} Run\n * Call all middleware.\n *\n * Calls `done` on completion with either an error or the output of the\n * last middleware.\n *\n * > 👉 **Note**: as the length of input defines whether async functions get a\n * > `next` function,\n * > it’s recommended to keep `input` at one value normally.\n\n *\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add middleware.\n */\n\n/**\n * Create new middleware.\n *\n * @returns {Pipeline}\n * Pipeline.\n */\nexport function trough() {\n /** @type {Array} */\n const fns = []\n /** @type {Pipeline} */\n const pipeline = {run, use}\n\n return pipeline\n\n /** @type {Run} */\n function run(...values) {\n let middlewareIndex = -1\n /** @type {Callback} */\n const callback = values.pop()\n\n if (typeof callback !== 'function') {\n throw new TypeError('Expected function as last argument, not ' + callback)\n }\n\n next(null, ...values)\n\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error | null | undefined} error\n * @param {Array} output\n */\n function next(error, ...output) {\n const fn = fns[++middlewareIndex]\n let index = -1\n\n if (error) {\n callback(error)\n return\n }\n\n // Copy non-nullish input into values.\n while (++index < values.length) {\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index]\n }\n }\n\n // Save the newly created `output` for the next call.\n values = output\n\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output)\n } else {\n callback(null, ...output)\n }\n }\n }\n\n /** @type {Use} */\n function use(middelware) {\n if (typeof middelware !== 'function') {\n throw new TypeError(\n 'Expected `middelware` to be a function, not ' + middelware\n )\n }\n\n fns.push(middelware)\n return pipeline\n }\n}\n\n/**\n * Wrap `middleware` into a uniform interface.\n *\n * You can pass all input to the resulting function.\n * `callback` is then called with the output of `middleware`.\n *\n * If `middleware` accepts more arguments than the later given in input,\n * an extra `done` function is passed to it after that input,\n * which must be called by `middleware`.\n *\n * The first value in `input` is the main input value.\n * All other input values are the rest input values.\n * The values given to `callback` are the input values,\n * merged with every non-nullish output value.\n *\n * * if `middleware` throws an error,\n * returns a promise that is rejected,\n * or calls the given `done` function with an error,\n * `callback` is called with that error\n * * if `middleware` returns a value or returns a promise that is resolved,\n * that value is the main output value\n * * if `middleware` calls `done`,\n * all non-nullish values except for the first one (the error) overwrite the\n * output values\n *\n * @param {Middleware} middleware\n * Function to wrap.\n * @param {Callback} callback\n * Callback called with the output of `middleware`.\n * @returns {Run}\n * Wrapped middleware.\n */\nexport function wrap(middleware, callback) {\n /** @type {boolean} */\n let called\n\n return wrapped\n\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array} parameters\n * @returns {void}\n */\n function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length\n /** @type {any} */\n let result\n\n if (fnExpectsCallback) {\n parameters.push(done)\n }\n\n try {\n result = middleware.apply(this, parameters)\n } catch (error) {\n const exception = /** @type {Error} */ (error)\n\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception\n }\n\n return done(exception)\n }\n\n if (!fnExpectsCallback) {\n if (result && result.then && typeof result.then === 'function') {\n result.then(then, done)\n } else if (result instanceof Error) {\n done(result)\n } else {\n then(result)\n }\n }\n }\n\n /**\n * Call `callback`, only once.\n *\n * @type {Callback}\n */\n function done(error, ...output) {\n if (!called) {\n called = true\n callback(error, ...output)\n }\n }\n\n /**\n * Call `done` with one value.\n *\n * @param {any} [value]\n */\n function then(value) {\n done(null, value)\n }\n}\n","// A derivative work based on:\n// .\n// Which is licensed:\n//\n// MIT License\n//\n// Copyright (c) 2013 James Halliday\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A derivative work based on:\n//\n// Parts of that are extracted from Node’s internal `path` module:\n// .\n// Which is licensed:\n//\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nexport const minpath = {basename, dirname, extname, join, sep: '/'}\n\n/* eslint-disable max-depth, complexity */\n\n/**\n * Get the basename from a path.\n *\n * @param {string} path\n * File path.\n * @param {string | null | undefined} [extname]\n * Extension to strip.\n * @returns {string}\n * Stem or basename.\n */\nfunction basename(path, extname) {\n if (extname !== undefined && typeof extname !== 'string') {\n throw new TypeError('\"ext\" argument must be a string')\n }\n\n assertPath(path)\n let start = 0\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let seenNonSlash\n\n if (\n extname === undefined ||\n extname.length === 0 ||\n extname.length > path.length\n ) {\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // path component.\n seenNonSlash = true\n end = index + 1\n }\n }\n\n return end < 0 ? '' : path.slice(start, end)\n }\n\n if (extname === path) {\n return ''\n }\n\n let firstNonSlashEnd = -1\n let extnameIndex = extname.length - 1\n\n while (index--) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (seenNonSlash) {\n start = index + 1\n break\n }\n } else {\n if (firstNonSlashEnd < 0) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching.\n seenNonSlash = true\n firstNonSlashEnd = index + 1\n }\n\n if (extnameIndex > -1) {\n // Try to match the explicit extension.\n if (path.codePointAt(index) === extname.codePointAt(extnameIndex--)) {\n if (extnameIndex < 0) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = index\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extnameIndex = -1\n end = firstNonSlashEnd\n }\n }\n }\n }\n\n if (start === end) {\n end = firstNonSlashEnd\n } else if (end < 0) {\n end = path.length\n }\n\n return path.slice(start, end)\n}\n\n/**\n * Get the dirname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\nfunction dirname(path) {\n assertPath(path)\n\n if (path.length === 0) {\n return '.'\n }\n\n let end = -1\n let index = path.length\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n // Prefix `--` is important to not run on `0`.\n while (--index) {\n if (path.codePointAt(index) === 47 /* `/` */) {\n if (unmatchedSlash) {\n end = index\n break\n }\n } else if (!unmatchedSlash) {\n // We saw the first non-path separator\n unmatchedSlash = true\n }\n }\n\n return end < 0\n ? path.codePointAt(0) === 47 /* `/` */\n ? '/'\n : '.'\n : end === 1 && path.codePointAt(0) === 47 /* `/` */\n ? '//'\n : path.slice(0, end)\n}\n\n/**\n * Get an extname from a path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * Extname.\n */\nfunction extname(path) {\n assertPath(path)\n\n let index = path.length\n\n let end = -1\n let startPart = 0\n let startDot = -1\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find.\n let preDotState = 0\n /** @type {boolean | undefined} */\n let unmatchedSlash\n\n while (index--) {\n const code = path.codePointAt(index)\n\n if (code === 47 /* `/` */) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now.\n if (unmatchedSlash) {\n startPart = index + 1\n break\n }\n\n continue\n }\n\n if (end < 0) {\n // We saw the first non-path separator, mark this as the end of our\n // extension.\n unmatchedSlash = true\n end = index + 1\n }\n\n if (code === 46 /* `.` */) {\n // If this is our first dot, mark it as the start of our extension.\n if (startDot < 0) {\n startDot = index\n } else if (preDotState !== 1) {\n preDotState = 1\n }\n } else if (startDot > -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension.\n preDotState = -1\n }\n }\n\n if (\n startDot < 0 ||\n end < 0 ||\n // We saw a non-dot character immediately before the dot.\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly `..`.\n (preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)\n ) {\n return ''\n }\n\n return path.slice(startDot, end)\n}\n\n/**\n * Join segments from a path.\n *\n * @param {Array} segments\n * Path segments.\n * @returns {string}\n * File path.\n */\nfunction join(...segments) {\n let index = -1\n /** @type {string | undefined} */\n let joined\n\n while (++index < segments.length) {\n assertPath(segments[index])\n\n if (segments[index]) {\n joined =\n joined === undefined ? segments[index] : joined + '/' + segments[index]\n }\n }\n\n return joined === undefined ? '.' : normalize(joined)\n}\n\n/**\n * Normalize a basic file path.\n *\n * @param {string} path\n * File path.\n * @returns {string}\n * File path.\n */\n// Note: `normalize` is not exposed as `path.normalize`, so some code is\n// manually removed from it.\nfunction normalize(path) {\n assertPath(path)\n\n const absolute = path.codePointAt(0) === 47 /* `/` */\n\n // Normalize the path according to POSIX rules.\n let value = normalizeString(path, !absolute)\n\n if (value.length === 0 && !absolute) {\n value = '.'\n }\n\n if (value.length > 0 && path.codePointAt(path.length - 1) === 47 /* / */) {\n value += '/'\n }\n\n return absolute ? '/' + value : value\n}\n\n/**\n * Resolve `.` and `..` elements in a path with directory names.\n *\n * @param {string} path\n * File path.\n * @param {boolean} allowAboveRoot\n * Whether `..` can move above root.\n * @returns {string}\n * File path.\n */\nfunction normalizeString(path, allowAboveRoot) {\n let result = ''\n let lastSegmentLength = 0\n let lastSlash = -1\n let dots = 0\n let index = -1\n /** @type {number | undefined} */\n let code\n /** @type {number} */\n let lastSlashIndex\n\n while (++index <= path.length) {\n if (index < path.length) {\n code = path.codePointAt(index)\n } else if (code === 47 /* `/` */) {\n break\n } else {\n code = 47 /* `/` */\n }\n\n if (code === 47 /* `/` */) {\n if (lastSlash === index - 1 || dots === 1) {\n // Empty.\n } else if (lastSlash !== index - 1 && dots === 2) {\n if (\n result.length < 2 ||\n lastSegmentLength !== 2 ||\n result.codePointAt(result.length - 1) !== 46 /* `.` */ ||\n result.codePointAt(result.length - 2) !== 46 /* `.` */\n ) {\n if (result.length > 2) {\n lastSlashIndex = result.lastIndexOf('/')\n\n if (lastSlashIndex !== result.length - 1) {\n if (lastSlashIndex < 0) {\n result = ''\n lastSegmentLength = 0\n } else {\n result = result.slice(0, lastSlashIndex)\n lastSegmentLength = result.length - 1 - result.lastIndexOf('/')\n }\n\n lastSlash = index\n dots = 0\n continue\n }\n } else if (result.length > 0) {\n result = ''\n lastSegmentLength = 0\n lastSlash = index\n dots = 0\n continue\n }\n }\n\n if (allowAboveRoot) {\n result = result.length > 0 ? result + '/..' : '..'\n lastSegmentLength = 2\n }\n } else {\n if (result.length > 0) {\n result += '/' + path.slice(lastSlash + 1, index)\n } else {\n result = path.slice(lastSlash + 1, index)\n }\n\n lastSegmentLength = index - lastSlash - 1\n }\n\n lastSlash = index\n dots = 0\n } else if (code === 46 /* `.` */ && dots > -1) {\n dots++\n } else {\n dots = -1\n }\n }\n\n return result\n}\n\n/**\n * Make sure `path` is a string.\n *\n * @param {string} path\n * File path.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError(\n 'Path must be a string. Received ' + JSON.stringify(path)\n )\n }\n}\n\n/* eslint-enable max-depth, complexity */\n","// Somewhat based on:\n// .\n// But I don’t think one tiny line of code can be copyrighted. 😅\nexport const minproc = {cwd}\n\nfunction cwd() {\n return '/'\n}\n","/**\n * Checks if a value has the shape of a WHATWG URL object.\n *\n * Using a symbol or instanceof would not be able to recognize URL objects\n * coming from other implementations (e.g. in Electron), so instead we are\n * checking some well known properties for a lack of a better test.\n *\n * We use `href` and `protocol` as they are the only properties that are\n * easy to retrieve and calculate due to the lazy nature of the getters.\n *\n * We check for auth attribute to distinguish legacy url instance with\n * WHATWG URL instance.\n *\n * @param {unknown} fileUrlOrPath\n * File path or URL.\n * @returns {fileUrlOrPath is URL}\n * Whether it’s a URL.\n */\n// From: \nexport function isUrl(fileUrlOrPath) {\n return Boolean(\n fileUrlOrPath !== null &&\n typeof fileUrlOrPath === 'object' &&\n 'href' in fileUrlOrPath &&\n fileUrlOrPath.href &&\n 'protocol' in fileUrlOrPath &&\n fileUrlOrPath.protocol &&\n // @ts-expect-error: indexing is fine.\n fileUrlOrPath.auth === undefined\n )\n}\n","import {isUrl} from './minurl.shared.js'\n\nexport {isUrl} from './minurl.shared.js'\n\n// See: \n\n/**\n * @param {URL | string} path\n * File URL.\n * @returns {string}\n * File URL.\n */\nexport function urlToPath(path) {\n if (typeof path === 'string') {\n path = new URL(path)\n } else if (!isUrl(path)) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'The \"path\" argument must be of type string or an instance of URL. Received `' +\n path +\n '`'\n )\n error.code = 'ERR_INVALID_ARG_TYPE'\n throw error\n }\n\n if (path.protocol !== 'file:') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError('The URL must be of scheme file')\n error.code = 'ERR_INVALID_URL_SCHEME'\n throw error\n }\n\n return getPathFromURLPosix(path)\n}\n\n/**\n * Get a path from a POSIX URL.\n *\n * @param {URL} url\n * URL.\n * @returns {string}\n * File path.\n */\nfunction getPathFromURLPosix(url) {\n if (url.hostname !== '') {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL host must be \"localhost\" or empty on darwin'\n )\n error.code = 'ERR_INVALID_FILE_URL_HOST'\n throw error\n }\n\n const pathname = url.pathname\n let index = -1\n\n while (++index < pathname.length) {\n if (\n pathname.codePointAt(index) === 37 /* `%` */ &&\n pathname.codePointAt(index + 1) === 50 /* `2` */\n ) {\n const third = pathname.codePointAt(index + 2)\n if (third === 70 /* `F` */ || third === 102 /* `f` */) {\n /** @type {NodeJS.ErrnoException} */\n const error = new TypeError(\n 'File URL path must not include encoded / characters'\n )\n error.code = 'ERR_INVALID_FILE_URL_PATH'\n throw error\n }\n }\n }\n\n return decodeURIComponent(pathname)\n}\n","/**\n * @import {Node, Point, Position} from 'unist'\n * @import {Options as MessageOptions} from 'vfile-message'\n * @import {Compatible, Data, Map, Options, Value} from 'vfile'\n */\n\n/**\n * @typedef {object & {type: string, position?: Position | undefined}} NodeLike\n */\n\nimport {VFileMessage} from 'vfile-message'\nimport {minpath} from '#minpath'\nimport {minproc} from '#minproc'\nimport {urlToPath, isUrl} from '#minurl'\n\n/**\n * Order of setting (least specific to most), we need this because otherwise\n * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a\n * stem can be set.\n */\nconst order = /** @type {const} */ ([\n 'history',\n 'path',\n 'basename',\n 'stem',\n 'extname',\n 'dirname'\n])\n\nexport class VFile {\n /**\n * Create a new virtual file.\n *\n * `options` is treated as:\n *\n * * `string` or `Uint8Array` — `{value: options}`\n * * `URL` — `{path: options}`\n * * `VFile` — shallow copies its data over to the new file\n * * `object` — all fields are shallow copied over to the new file\n *\n * Path related fields are set in the following order (least specific to\n * most specific): `history`, `path`, `basename`, `stem`, `extname`,\n * `dirname`.\n *\n * You cannot set `dirname` or `extname` without setting either `history`,\n * `path`, `basename`, or `stem` too.\n *\n * @param {Compatible | null | undefined} [value]\n * File value.\n * @returns\n * New instance.\n */\n constructor(value) {\n /** @type {Options | VFile} */\n let options\n\n if (!value) {\n options = {}\n } else if (isUrl(value)) {\n options = {path: value}\n } else if (typeof value === 'string' || isUint8Array(value)) {\n options = {value}\n } else {\n options = value\n }\n\n /* eslint-disable no-unused-expressions */\n\n /**\n * Base of `path` (default: `process.cwd()` or `'/'` in browsers).\n *\n * @type {string}\n */\n // Prevent calling `cwd` (which could be expensive) if it’s not needed;\n // the empty string will be overridden in the next block.\n this.cwd = 'cwd' in options ? '' : minproc.cwd()\n\n /**\n * Place to store custom info (default: `{}`).\n *\n * It’s OK to store custom data directly on the file but moving it to\n * `data` is recommended.\n *\n * @type {Data}\n */\n this.data = {}\n\n /**\n * List of file paths the file moved between.\n *\n * The first is the original path and the last is the current path.\n *\n * @type {Array}\n */\n this.history = []\n\n /**\n * List of messages associated with the file.\n *\n * @type {Array}\n */\n this.messages = []\n\n /**\n * Raw value.\n *\n * @type {Value}\n */\n this.value\n\n // The below are non-standard, they are “well-known”.\n // As in, used in several tools.\n /**\n * Source map.\n *\n * This type is equivalent to the `RawSourceMap` type from the `source-map`\n * module.\n *\n * @type {Map | null | undefined}\n */\n this.map\n\n /**\n * Custom, non-string, compiled, representation.\n *\n * This is used by unified to store non-string results.\n * One example is when turning markdown into React nodes.\n *\n * @type {unknown}\n */\n this.result\n\n /**\n * Whether a file was saved to disk.\n *\n * This is used by vfile reporters.\n *\n * @type {boolean}\n */\n this.stored\n /* eslint-enable no-unused-expressions */\n\n // Set path related properties in the correct order.\n let index = -1\n\n while (++index < order.length) {\n const field = order[index]\n\n // Note: we specifically use `in` instead of `hasOwnProperty` to accept\n // `vfile`s too.\n if (\n field in options &&\n options[field] !== undefined &&\n options[field] !== null\n ) {\n // @ts-expect-error: TS doesn’t understand basic reality.\n this[field] = field === 'history' ? [...options[field]] : options[field]\n }\n }\n\n /** @type {string} */\n let field\n\n // Set non-path related properties.\n for (field in options) {\n // @ts-expect-error: fine to set other things.\n if (!order.includes(field)) {\n // @ts-expect-error: fine to set other things.\n this[field] = options[field]\n }\n }\n }\n\n /**\n * Get the basename (including extname) (example: `'index.min.js'`).\n *\n * @returns {string | undefined}\n * Basename.\n */\n get basename() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path)\n : undefined\n }\n\n /**\n * Set basename (including extname) (`'index.min.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} basename\n * Basename.\n * @returns {undefined}\n * Nothing.\n */\n set basename(basename) {\n assertNonEmpty(basename, 'basename')\n assertPart(basename, 'basename')\n this.path = minpath.join(this.dirname || '', basename)\n }\n\n /**\n * Get the parent path (example: `'~'`).\n *\n * @returns {string | undefined}\n * Dirname.\n */\n get dirname() {\n return typeof this.path === 'string'\n ? minpath.dirname(this.path)\n : undefined\n }\n\n /**\n * Set the parent path (example: `'~'`).\n *\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} dirname\n * Dirname.\n * @returns {undefined}\n * Nothing.\n */\n set dirname(dirname) {\n assertPath(this.basename, 'dirname')\n this.path = minpath.join(dirname || '', this.basename)\n }\n\n /**\n * Get the extname (including dot) (example: `'.js'`).\n *\n * @returns {string | undefined}\n * Extname.\n */\n get extname() {\n return typeof this.path === 'string'\n ? minpath.extname(this.path)\n : undefined\n }\n\n /**\n * Set the extname (including dot) (example: `'.js'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be set if there’s no `path` yet.\n *\n * @param {string | undefined} extname\n * Extname.\n * @returns {undefined}\n * Nothing.\n */\n set extname(extname) {\n assertPart(extname, 'extname')\n assertPath(this.dirname, 'extname')\n\n if (extname) {\n if (extname.codePointAt(0) !== 46 /* `.` */) {\n throw new Error('`extname` must start with `.`')\n }\n\n if (extname.includes('.', 1)) {\n throw new Error('`extname` cannot contain multiple dots')\n }\n }\n\n this.path = minpath.join(this.dirname, this.stem + (extname || ''))\n }\n\n /**\n * Get the full path (example: `'~/index.min.js'`).\n *\n * @returns {string}\n * Path.\n */\n get path() {\n return this.history[this.history.length - 1]\n }\n\n /**\n * Set the full path (example: `'~/index.min.js'`).\n *\n * Cannot be nullified.\n * You can set a file URL (a `URL` object with a `file:` protocol) which will\n * be turned into a path with `url.fileURLToPath`.\n *\n * @param {URL | string} path\n * Path.\n * @returns {undefined}\n * Nothing.\n */\n set path(path) {\n if (isUrl(path)) {\n path = urlToPath(path)\n }\n\n assertNonEmpty(path, 'path')\n\n if (this.path !== path) {\n this.history.push(path)\n }\n }\n\n /**\n * Get the stem (basename w/o extname) (example: `'index.min'`).\n *\n * @returns {string | undefined}\n * Stem.\n */\n get stem() {\n return typeof this.path === 'string'\n ? minpath.basename(this.path, this.extname)\n : undefined\n }\n\n /**\n * Set the stem (basename w/o extname) (example: `'index.min'`).\n *\n * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\\'`\n * on windows).\n * Cannot be nullified (use `file.path = file.dirname` instead).\n *\n * @param {string} stem\n * Stem.\n * @returns {undefined}\n * Nothing.\n */\n set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = minpath.join(this.dirname || '', stem + (this.extname || ''))\n }\n\n // Normal prototypal methods.\n /**\n * Create a fatal message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `true` (error; file not usable)\n * and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {never}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {never}\n * Never.\n * @throws {VFileMessage}\n * Message.\n */\n fail(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = true\n\n throw message\n }\n\n /**\n * Create an info message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `undefined` (info; change\n * likely not needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n info(causeOrReason, optionsOrParentOrPlace, origin) {\n // @ts-expect-error: the overloads are fine.\n const message = this.message(causeOrReason, optionsOrParentOrPlace, origin)\n\n message.fatal = undefined\n\n return message\n }\n\n /**\n * Create a message for `reason` associated with the file.\n *\n * The `fatal` field of the message is set to `false` (warning; change may be\n * needed) and the `file` field is set to the current file path.\n * The message is added to the `messages` field on `file`.\n *\n * > 🪦 **Note**: also has obsolete signatures.\n *\n * @overload\n * @param {string} reason\n * @param {MessageOptions | null | undefined} [options]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {string} reason\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Node | NodeLike | null | undefined} parent\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {Point | Position | null | undefined} place\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @overload\n * @param {Error | VFileMessage} cause\n * @param {string | null | undefined} [origin]\n * @returns {VFileMessage}\n *\n * @param {Error | VFileMessage | string} causeOrReason\n * Reason for message, should use markdown.\n * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]\n * Configuration (optional).\n * @param {string | null | undefined} [origin]\n * Place in code where the message originates (example:\n * `'my-package:my-rule'` or `'my-rule'`).\n * @returns {VFileMessage}\n * Message.\n */\n message(causeOrReason, optionsOrParentOrPlace, origin) {\n const message = new VFileMessage(\n // @ts-expect-error: the overloads are fine.\n causeOrReason,\n optionsOrParentOrPlace,\n origin\n )\n\n if (this.path) {\n message.name = this.path + ':' + message.name\n message.file = this.path\n }\n\n message.fatal = false\n\n this.messages.push(message)\n\n return message\n }\n\n /**\n * Serialize the file.\n *\n * > **Note**: which encodings are supported depends on the engine.\n * > For info on Node.js, see:\n * > .\n *\n * @param {string | null | undefined} [encoding='utf8']\n * Character encoding to understand `value` as when it’s a `Uint8Array`\n * (default: `'utf-8'`).\n * @returns {string}\n * Serialized file.\n */\n toString(encoding) {\n if (this.value === undefined) {\n return ''\n }\n\n if (typeof this.value === 'string') {\n return this.value\n }\n\n const decoder = new TextDecoder(encoding || undefined)\n return decoder.decode(this.value)\n }\n}\n\n/**\n * Assert that `part` is not a path (as in, does not contain `path.sep`).\n *\n * @param {string | null | undefined} part\n * File path part.\n * @param {string} name\n * Part name.\n * @returns {undefined}\n * Nothing.\n */\nfunction assertPart(part, name) {\n if (part && part.includes(minpath.sep)) {\n throw new Error(\n '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`'\n )\n }\n}\n\n/**\n * Assert that `part` is not empty.\n *\n * @param {string | undefined} part\n * Thing.\n * @param {string} name\n * Part name.\n * @returns {asserts part is string}\n * Nothing.\n */\nfunction assertNonEmpty(part, name) {\n if (!part) {\n throw new Error('`' + name + '` cannot be empty')\n }\n}\n\n/**\n * Assert `path` exists.\n *\n * @param {string | undefined} path\n * Path.\n * @param {string} name\n * Dependency name.\n * @returns {asserts path is string}\n * Nothing.\n */\nfunction assertPath(path, name) {\n if (!path) {\n throw new Error('Setting `' + name + '` requires `path` to be set too')\n }\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","export const CallableInstance =\n /**\n * @type {new , Result>(property: string | symbol) => (...parameters: Parameters) => Result}\n */\n (\n /** @type {unknown} */\n (\n /**\n * @this {Function}\n * @param {string | symbol} property\n * @returns {(...parameters: Array) => unknown}\n */\n function (property) {\n const self = this\n const constr = self.constructor\n const proto = /** @type {Record} */ (\n // Prototypes do exist.\n // type-coverage:ignore-next-line\n constr.prototype\n )\n const value = proto[property]\n /** @type {(...parameters: Array) => unknown} */\n const apply = function () {\n return value.apply(apply, arguments)\n }\n\n Object.setPrototypeOf(apply, proto)\n\n // Not needed for us in `unified`: we only call this on the `copy`\n // function,\n // and we don't need to add its fields (`length`, `name`)\n // over.\n // See also: GH-246.\n // const names = Object.getOwnPropertyNames(value)\n //\n // for (const p of names) {\n // const descriptor = Object.getOwnPropertyDescriptor(value, p)\n // if (descriptor) Object.defineProperty(apply, p, descriptor)\n // }\n\n return apply\n }\n )\n )\n","/**\n * @typedef {import('trough').Pipeline} Pipeline\n *\n * @typedef {import('unist').Node} Node\n *\n * @typedef {import('vfile').Compatible} Compatible\n * @typedef {import('vfile').Value} Value\n *\n * @typedef {import('../index.js').CompileResultMap} CompileResultMap\n * @typedef {import('../index.js').Data} Data\n * @typedef {import('../index.js').Settings} Settings\n */\n\n/**\n * @typedef {CompileResultMap[keyof CompileResultMap]} CompileResults\n * Acceptable results from compilers.\n *\n * To register custom results, add them to\n * {@linkcode CompileResultMap}.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the compiler receives (default: `Node`).\n * @template {CompileResults} [Result=CompileResults]\n * The thing that the compiler yields (default: `CompileResults`).\n * @callback Compiler\n * A **compiler** handles the compiling of a syntax tree to something else\n * (in most cases, text) (TypeScript type).\n *\n * It is used in the stringify phase and called with a {@linkcode Node}\n * and {@linkcode VFile} representation of the document to compile.\n * It should return the textual representation of the given tree (typically\n * `string`).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n * @param {Tree} tree\n * Tree to compile.\n * @param {VFile} file\n * File associated with `tree`.\n * @returns {Result}\n * New content: compiled text (`string` or `Uint8Array`, for `file.value`) or\n * something else (for `file.result`).\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The node that the parser yields (default: `Node`)\n * @callback Parser\n * A **parser** handles the parsing of text to a syntax tree.\n *\n * It is used in the parse phase and is called with a `string` and\n * {@linkcode VFile} of the document to parse.\n * It must return the syntax tree representation of the given file\n * ({@linkcode Node}).\n * @param {string} document\n * Document to parse.\n * @param {VFile} file\n * File associated with `document`.\n * @returns {Tree}\n * Node representing the given file.\n */\n\n/**\n * @typedef {(\n * Plugin, any, any> |\n * PluginTuple, any, any> |\n * Preset\n * )} Pluggable\n * Union of the different ways to add plugins and settings.\n */\n\n/**\n * @typedef {Array} PluggableList\n * List of plugins and presets.\n */\n\n// Note: we can’t use `callback` yet as it messes up `this`:\n// .\n/**\n * @template {Array} [PluginParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=Node]\n * Value that is expected as input (default: `Node`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=Input]\n * Value that is yielded as output (default: `Input`).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * (this: Processor, ...parameters: PluginParameters) =>\n * Input extends string ? // Parser.\n * Output extends Node | undefined ? undefined | void : never :\n * Output extends CompileResults ? // Compiler.\n * Input extends Node | undefined ? undefined | void : never :\n * Transformer<\n * Input extends Node ? Input : Node,\n * Output extends Node ? Output : Node\n * > | undefined | void\n * )} Plugin\n * Single plugin.\n *\n * Plugins configure the processors they are applied on in the following\n * ways:\n *\n * * they change the processor, such as the parser, the compiler, or by\n * configuring data\n * * they specify how to handle trees and files\n *\n * In practice, they are functions that can receive options and configure the\n * processor (`this`).\n *\n * > **Note**: plugins are called when the processor is *frozen*, not when\n * > they are applied.\n */\n\n/**\n * Tuple of a plugin and its configuration.\n *\n * The first item is a plugin, the rest are its parameters.\n *\n * @template {Array} [TupleParameters=[]]\n * Arguments passed to the plugin (default: `[]`, the empty tuple).\n * @template {Node | string | undefined} [Input=undefined]\n * Value that is expected as input (optional).\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node it expects.\n * * If the plugin sets a {@linkcode Parser}, this should be\n * `string`.\n * * If the plugin sets a {@linkcode Compiler}, this should be the\n * node it expects.\n * @template [Output=undefined] (optional).\n * Value that is yielded as output.\n *\n * * If the plugin returns a {@linkcode Transformer}, this\n * should be the node that that yields.\n * * If the plugin sets a {@linkcode Parser}, this should be the\n * node that it yields.\n * * If the plugin sets a {@linkcode Compiler}, this should be\n * result it yields.\n * @typedef {(\n * [\n * plugin: Plugin,\n * ...parameters: TupleParameters\n * ]\n * )} PluginTuple\n */\n\n/**\n * @typedef Preset\n * Sharable configuration.\n *\n * They can contain plugins and settings.\n * @property {PluggableList | undefined} [plugins]\n * List of plugins and presets (optional).\n * @property {Settings | undefined} [settings]\n * Shared settings for parsers and compilers (optional).\n */\n\n/**\n * @template {VFile} [File=VFile]\n * The file that the callback receives (default: `VFile`).\n * @callback ProcessCallback\n * Callback called when the process is done.\n *\n * Called with either an error or a result.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {File | undefined} [file]\n * Processed file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Tree=Node]\n * The tree that the callback receives (default: `Node`).\n * @callback RunCallback\n * Callback called when transformers are done.\n *\n * Called with either an error or results.\n * @param {Error | undefined} [error]\n * Fatal error (optional).\n * @param {Tree | undefined} [tree]\n * Transformed tree (optional).\n * @param {VFile | undefined} [file]\n * File (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Output=Node]\n * Node type that the transformer yields (default: `Node`).\n * @callback TransformCallback\n * Callback passed to transforms.\n *\n * If the signature of a `transformer` accepts a third argument, the\n * transformer may perform asynchronous operations, and must call it.\n * @param {Error | undefined} [error]\n * Fatal error to stop the process (optional).\n * @param {Output | undefined} [tree]\n * New, changed, tree (optional).\n * @param {VFile | undefined} [file]\n * New, changed, file (optional).\n * @returns {undefined}\n * Nothing.\n */\n\n/**\n * @template {Node} [Input=Node]\n * Node type that the transformer expects (default: `Node`).\n * @template {Node} [Output=Input]\n * Node type that the transformer yields (default: `Input`).\n * @callback Transformer\n * Transformers handle syntax trees and files.\n *\n * They are functions that are called each time a syntax tree and file are\n * passed through the run phase.\n * When an error occurs in them (either because it’s thrown, returned,\n * rejected, or passed to `next`), the process stops.\n *\n * The run phase is handled by [`trough`][trough], see its documentation for\n * the exact semantics of these functions.\n *\n * > **Note**: you should likely ignore `next`: don’t accept it.\n * > it supports callback-style async work.\n * > But promises are likely easier to reason about.\n *\n * [trough]: https://github.com/wooorm/trough#function-fninput-next\n * @param {Input} tree\n * Tree to handle.\n * @param {VFile} file\n * File to handle.\n * @param {TransformCallback} next\n * Callback.\n * @returns {(\n * Promise |\n * Promise | // For some reason this is needed separately.\n * Output |\n * Error |\n * undefined |\n * void\n * )}\n * If you accept `next`, nothing.\n * Otherwise:\n *\n * * `Error` — fatal error to stop the process\n * * `Promise` or `undefined` — the next transformer keeps using\n * same tree\n * * `Promise` or `Node` — new, changed, tree\n */\n\n/**\n * @template {Node | undefined} ParseTree\n * Output of `parse`.\n * @template {Node | undefined} HeadTree\n * Input for `run`.\n * @template {Node | undefined} TailTree\n * Output for `run`.\n * @template {Node | undefined} CompileTree\n * Input of `stringify`.\n * @template {CompileResults | undefined} CompileResult\n * Output of `stringify`.\n * @template {Node | string | undefined} Input\n * Input of plugin.\n * @template Output\n * Output of plugin (optional).\n * @typedef {(\n * Input extends string\n * ? Output extends Node | undefined\n * ? // Parser.\n * Processor<\n * Output extends undefined ? ParseTree : Output,\n * HeadTree,\n * TailTree,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : Output extends CompileResults\n * ? Input extends Node | undefined\n * ? // Compiler.\n * Processor<\n * ParseTree,\n * HeadTree,\n * TailTree,\n * Input extends undefined ? CompileTree : Input,\n * Output extends undefined ? CompileResult : Output\n * >\n * : // Unknown.\n * Processor\n * : Input extends Node | undefined\n * ? Output extends Node | undefined\n * ? // Transform.\n * Processor<\n * ParseTree,\n * HeadTree extends undefined ? Input : HeadTree,\n * Output extends undefined ? TailTree : Output,\n * CompileTree,\n * CompileResult\n * >\n * : // Unknown.\n * Processor\n * : // Unknown.\n * Processor\n * )} UsePlugin\n * Create a processor based on the input/output of a {@link Plugin plugin}.\n */\n\n/**\n * @template {CompileResults | undefined} Result\n * Node type that the transformer yields.\n * @typedef {(\n * Result extends Value | undefined ?\n * VFile :\n * VFile & {result: Result}\n * )} VFileWithOutput\n * Type to generate a {@linkcode VFile} corresponding to a compiler result.\n *\n * If a result that is not acceptable on a `VFile` is used, that will\n * be stored on the `result` field of {@linkcode VFile}.\n */\n\nimport {bail} from 'bail'\nimport extend from 'extend'\nimport {ok as assert} from 'devlop'\nimport isPlainObj from 'is-plain-obj'\nimport {trough} from 'trough'\nimport {VFile} from 'vfile'\nimport {CallableInstance} from './callable-instance.js'\n\n// To do: next major: drop `Compiler`, `Parser`: prefer lowercase.\n\n// To do: we could start yielding `never` in TS when a parser is missing and\n// `parse` is called.\n// Currently, we allow directly setting `processor.parser`, which is untyped.\n\nconst own = {}.hasOwnProperty\n\n/**\n * @template {Node | undefined} [ParseTree=undefined]\n * Output of `parse` (optional).\n * @template {Node | undefined} [HeadTree=undefined]\n * Input for `run` (optional).\n * @template {Node | undefined} [TailTree=undefined]\n * Output for `run` (optional).\n * @template {Node | undefined} [CompileTree=undefined]\n * Input of `stringify` (optional).\n * @template {CompileResults | undefined} [CompileResult=undefined]\n * Output of `stringify` (optional).\n * @extends {CallableInstance<[], Processor>}\n */\nexport class Processor extends CallableInstance {\n /**\n * Create a processor.\n */\n constructor() {\n // If `Processor()` is called (w/o new), `copy` is called instead.\n super('copy')\n\n /**\n * Compiler to use (deprecated).\n *\n * @deprecated\n * Use `compiler` instead.\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.Compiler = undefined\n\n /**\n * Parser to use (deprecated).\n *\n * @deprecated\n * Use `parser` instead.\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.Parser = undefined\n\n // Note: the following fields are considered private.\n // However, they are needed for tests, and TSC generates an untyped\n // `private freezeIndex` field for, which trips `type-coverage` up.\n // Instead, we use `@deprecated` to visualize that they shouldn’t be used.\n /**\n * Internal list of configured plugins.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Array>>}\n */\n this.attachers = []\n\n /**\n * Compiler to use.\n *\n * @type {(\n * Compiler<\n * CompileTree extends undefined ? Node : CompileTree,\n * CompileResult extends undefined ? CompileResults : CompileResult\n * > |\n * undefined\n * )}\n */\n this.compiler = undefined\n\n /**\n * Internal state to track where we are while freezing.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {number}\n */\n this.freezeIndex = -1\n\n /**\n * Internal state to track whether we’re frozen.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {boolean | undefined}\n */\n this.frozen = undefined\n\n /**\n * Internal state.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Data}\n */\n this.namespace = {}\n\n /**\n * Parser to use.\n *\n * @type {(\n * Parser |\n * undefined\n * )}\n */\n this.parser = undefined\n\n /**\n * Internal list of configured transformers.\n *\n * @deprecated\n * This is a private internal property and should not be used.\n * @type {Pipeline}\n */\n this.transformers = trough()\n }\n\n /**\n * Copy a processor.\n *\n * @deprecated\n * This is a private internal method and should not be used.\n * @returns {Processor}\n * New *unfrozen* processor ({@linkcode Processor}) that is\n * configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\n copy() {\n // Cast as the type parameters will be the same after attaching.\n const destination =\n /** @type {Processor} */ (\n new Processor()\n )\n let index = -1\n\n while (++index < this.attachers.length) {\n const attacher = this.attachers[index]\n destination.use(...attacher)\n }\n\n destination.data(extend(true, {}, this.namespace))\n\n return destination\n }\n\n /**\n * Configure the processor with info available to all plugins.\n * Information is stored in an object.\n *\n * Typically, options can be given to a specific plugin, but sometimes it\n * makes sense to have information shared with several plugins.\n * For example, a list of HTML elements that are self-closing, which is\n * needed during all phases.\n *\n * > **Note**: setting information cannot occur on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * > **Note**: to register custom data in TypeScript, augment the\n * > {@linkcode Data} interface.\n *\n * @example\n * This example show how to get and set info:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * const processor = unified().data('alpha', 'bravo')\n *\n * processor.data('alpha') // => 'bravo'\n *\n * processor.data() // => {alpha: 'bravo'}\n *\n * processor.data({charlie: 'delta'})\n *\n * processor.data() // => {charlie: 'delta'}\n * ```\n *\n * @template {keyof Data} Key\n *\n * @overload\n * @returns {Data}\n *\n * @overload\n * @param {Data} dataset\n * @returns {Processor}\n *\n * @overload\n * @param {Key} key\n * @returns {Data[Key]}\n *\n * @overload\n * @param {Key} key\n * @param {Data[Key]} value\n * @returns {Processor}\n *\n * @param {Data | Key} [key]\n * Key to get or set, or entire dataset to set, or nothing to get the\n * entire dataset (optional).\n * @param {Data[Key]} [value]\n * Value to set (optional).\n * @returns {unknown}\n * The current processor when setting, the value at `key` when getting, or\n * the entire dataset when getting without key.\n */\n data(key, value) {\n if (typeof key === 'string') {\n // Set `key`.\n if (arguments.length === 2) {\n assertUnfrozen('data', this.frozen)\n this.namespace[key] = value\n return this\n }\n\n // Get `key`.\n return (own.call(this.namespace, key) && this.namespace[key]) || undefined\n }\n\n // Set space.\n if (key) {\n assertUnfrozen('data', this.frozen)\n this.namespace = key\n return this\n }\n\n // Get space.\n return this.namespace\n }\n\n /**\n * Freeze a processor.\n *\n * Frozen processors are meant to be extended and not to be configured\n * directly.\n *\n * When a processor is frozen it cannot be unfrozen.\n * New processors working the same way can be created by calling the\n * processor.\n *\n * It’s possible to freeze processors explicitly by calling `.freeze()`.\n * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,\n * `.stringify()`, `.process()`, or `.processSync()` are called.\n *\n * @returns {Processor}\n * The current processor.\n */\n freeze() {\n if (this.frozen) {\n return this\n }\n\n // Cast so that we can type plugins easier.\n // Plugins are supposed to be usable on different processors, not just on\n // this exact processor.\n const self = /** @type {Processor} */ (/** @type {unknown} */ (this))\n\n while (++this.freezeIndex < this.attachers.length) {\n const [attacher, ...options] = this.attachers[this.freezeIndex]\n\n if (options[0] === false) {\n continue\n }\n\n if (options[0] === true) {\n options[0] = undefined\n }\n\n const transformer = attacher.call(self, ...options)\n\n if (typeof transformer === 'function') {\n this.transformers.use(transformer)\n }\n }\n\n this.frozen = true\n this.freezeIndex = Number.POSITIVE_INFINITY\n\n return this\n }\n\n /**\n * Parse text to a syntax tree.\n *\n * > **Note**: `parse` freezes the processor if not already *frozen*.\n *\n * > **Note**: `parse` performs the parse phase, not the run phase or other\n * > phases.\n *\n * @param {Compatible | undefined} [file]\n * file to parse (optional); typically `string` or `VFile`; any value\n * accepted as `x` in `new VFile(x)`.\n * @returns {ParseTree extends undefined ? Node : ParseTree}\n * Syntax tree representing `file`.\n */\n parse(file) {\n this.freeze()\n const realFile = vfile(file)\n const parser = this.parser || this.Parser\n assertParser('parse', parser)\n return parser(String(realFile), realFile)\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * > **Note**: `process` freezes the processor if not already *frozen*.\n *\n * > **Note**: `process` performs the parse, run, and stringify phases.\n *\n * @overload\n * @param {Compatible | undefined} file\n * @param {ProcessCallback>} done\n * @returns {undefined}\n *\n * @overload\n * @param {Compatible | undefined} [file]\n * @returns {Promise>}\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`]; any value accepted as\n * `x` in `new VFile(x)`.\n * @param {ProcessCallback> | undefined} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise a promise, rejected with a fatal error or resolved with the\n * processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n process(file, done) {\n const self = this\n\n this.freeze()\n assertParser('process', this.parser || this.Parser)\n assertCompiler('process', this.compiler || this.Compiler)\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {((file: VFileWithOutput) => undefined | void) | undefined} resolve\n * @param {(error: Error | undefined) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n const realFile = vfile(file)\n // Assume `ParseTree` (the result of the parser) matches `HeadTree` (the\n // input of the first transform).\n const parseTree =\n /** @type {HeadTree extends undefined ? Node : HeadTree} */ (\n /** @type {unknown} */ (self.parse(realFile))\n )\n\n self.run(parseTree, realFile, function (error, tree, file) {\n if (error || !tree || !file) {\n return realDone(error)\n }\n\n // Assume `TailTree` (the output of the last transform) matches\n // `CompileTree` (the input of the compiler).\n const compileTree =\n /** @type {CompileTree extends undefined ? Node : CompileTree} */ (\n /** @type {unknown} */ (tree)\n )\n\n const compileResult = self.stringify(compileTree, file)\n\n if (looksLikeAValue(compileResult)) {\n file.value = compileResult\n } else {\n file.result = compileResult\n }\n\n realDone(error, /** @type {VFileWithOutput} */ (file))\n })\n\n /**\n * @param {Error | undefined} error\n * @param {VFileWithOutput | undefined} [file]\n * @returns {undefined}\n */\n function realDone(error, file) {\n if (error || !file) {\n reject(error)\n } else if (resolve) {\n resolve(file)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, file)\n }\n }\n }\n }\n\n /**\n * Process the given file as configured on the processor.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `processSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `processSync` performs the parse, run, and stringify phases.\n *\n * @param {Compatible | undefined} [file]\n * File (optional); typically `string` or `VFile`; any value accepted as\n * `x` in `new VFile(x)`.\n * @returns {VFileWithOutput}\n * The processed file.\n *\n * The parsed, transformed, and compiled value is available at\n * `file.value` (see note).\n *\n * > **Note**: unified typically compiles by serializing: most\n * > compilers return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n processSync(file) {\n /** @type {boolean} */\n let complete = false\n /** @type {VFileWithOutput | undefined} */\n let result\n\n this.freeze()\n assertParser('processSync', this.parser || this.Parser)\n assertCompiler('processSync', this.compiler || this.Compiler)\n\n this.process(file, realDone)\n assertDone('processSync', 'process', complete)\n assert(result, 'we either bailed on an error or have a tree')\n\n return result\n\n /**\n * @type {ProcessCallback>}\n */\n function realDone(error, file) {\n complete = true\n bail(error)\n result = file\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * > **Note**: `run` freezes the processor if not already *frozen*.\n *\n * > **Note**: `run` performs the run phase, not other phases.\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} file\n * @param {RunCallback} done\n * @returns {undefined}\n *\n * @overload\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * @param {Compatible | undefined} [file]\n * @returns {Promise}\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {(\n * RunCallback |\n * Compatible\n * )} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @param {RunCallback} [done]\n * Callback (optional).\n * @returns {Promise | undefined}\n * Nothing if `done` is given.\n * Otherwise, a promise rejected with a fatal error or resolved with the\n * transformed tree.\n */\n run(tree, file, done) {\n assertNode(tree)\n this.freeze()\n\n const transformers = this.transformers\n\n if (!done && typeof file === 'function') {\n done = file\n file = undefined\n }\n\n return done ? executor(undefined, done) : new Promise(executor)\n\n // Note: `void`s needed for TS.\n /**\n * @param {(\n * ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |\n * undefined\n * )} resolve\n * @param {(error: Error) => undefined | void} reject\n * @returns {undefined}\n */\n function executor(resolve, reject) {\n assert(\n typeof file !== 'function',\n '`file` can’t be a `done` anymore, we checked'\n )\n const realFile = vfile(file)\n transformers.run(tree, realFile, realDone)\n\n /**\n * @param {Error | undefined} error\n * @param {Node} outputTree\n * @param {VFile} file\n * @returns {undefined}\n */\n function realDone(error, outputTree, file) {\n const resultingTree =\n /** @type {TailTree extends undefined ? Node : TailTree} */ (\n outputTree || tree\n )\n\n if (error) {\n reject(error)\n } else if (resolve) {\n resolve(resultingTree)\n } else {\n assert(done, '`done` is defined if `resolve` is not')\n done(undefined, resultingTree, file)\n }\n }\n }\n }\n\n /**\n * Run *transformers* on a syntax tree.\n *\n * An error is thrown if asynchronous transforms are configured.\n *\n * > **Note**: `runSync` freezes the processor if not already *frozen*.\n *\n * > **Note**: `runSync` performs the run phase, not other phases.\n *\n * @param {HeadTree extends undefined ? Node : HeadTree} tree\n * Tree to transform and inspect.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {TailTree extends undefined ? Node : TailTree}\n * Transformed tree.\n */\n runSync(tree, file) {\n /** @type {boolean} */\n let complete = false\n /** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */\n let result\n\n this.run(tree, file, realDone)\n\n assertDone('runSync', 'run', complete)\n assert(result, 'we either bailed on an error or have a tree')\n return result\n\n /**\n * @type {RunCallback}\n */\n function realDone(error, tree) {\n bail(error)\n result = tree\n complete = true\n }\n }\n\n /**\n * Compile a syntax tree.\n *\n * > **Note**: `stringify` freezes the processor if not already *frozen*.\n *\n * > **Note**: `stringify` performs the stringify phase, not the run phase\n * > or other phases.\n *\n * @param {CompileTree extends undefined ? Node : CompileTree} tree\n * Tree to compile.\n * @param {Compatible | undefined} [file]\n * File associated with `node` (optional); any value accepted as `x` in\n * `new VFile(x)`.\n * @returns {CompileResult extends undefined ? Value : CompileResult}\n * Textual representation of the tree (see note).\n *\n * > **Note**: unified typically compiles by serializing: most compilers\n * > return `string` (or `Uint8Array`).\n * > Some compilers, such as the one configured with\n * > [`rehype-react`][rehype-react], return other values (in this case, a\n * > React tree).\n * > If you’re using a compiler that doesn’t serialize, expect different\n * > result values.\n * >\n * > To register custom results in TypeScript, add them to\n * > {@linkcode CompileResultMap}.\n *\n * [rehype-react]: https://github.com/rehypejs/rehype-react\n */\n stringify(tree, file) {\n this.freeze()\n const realFile = vfile(file)\n const compiler = this.compiler || this.Compiler\n assertCompiler('stringify', compiler)\n assertNode(tree)\n\n return compiler(tree, realFile)\n }\n\n /**\n * Configure the processor to use a plugin, a list of usable values, or a\n * preset.\n *\n * If the processor is already using a plugin, the previous plugin\n * configuration is changed based on the options that are passed in.\n * In other words, the plugin is not added a second time.\n *\n * > **Note**: `use` cannot be called on *frozen* processors.\n * > Call the processor first to create a new unfrozen processor.\n *\n * @example\n * There are many ways to pass plugins to `.use()`.\n * This example gives an overview:\n *\n * ```js\n * import {unified} from 'unified'\n *\n * unified()\n * // Plugin with options:\n * .use(pluginA, {x: true, y: true})\n * // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):\n * .use(pluginA, {y: false, z: true})\n * // Plugins:\n * .use([pluginB, pluginC])\n * // Two plugins, the second with options:\n * .use([pluginD, [pluginE, {}]])\n * // Preset with plugins and settings:\n * .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})\n * // Settings only:\n * .use({settings: {position: false}})\n * ```\n *\n * @template {Array} [Parameters=[]]\n * @template {Node | string | undefined} [Input=undefined]\n * @template [Output=Input]\n *\n * @overload\n * @param {Preset | null | undefined} [preset]\n * @returns {Processor}\n *\n * @overload\n * @param {PluggableList} list\n * @returns {Processor}\n *\n * @overload\n * @param {Plugin} plugin\n * @param {...(Parameters | [boolean])} parameters\n * @returns {UsePlugin}\n *\n * @param {PluggableList | Plugin | Preset | null | undefined} value\n * Usable value.\n * @param {...unknown} parameters\n * Parameters, when a plugin is given as a usable value.\n * @returns {Processor}\n * Current processor.\n */\n use(value, ...parameters) {\n const attachers = this.attachers\n const namespace = this.namespace\n\n assertUnfrozen('use', this.frozen)\n\n if (value === null || value === undefined) {\n // Empty.\n } else if (typeof value === 'function') {\n addPlugin(value, parameters)\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n addList(value)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n\n return this\n\n /**\n * @param {Pluggable} value\n * @returns {undefined}\n */\n function add(value) {\n if (typeof value === 'function') {\n addPlugin(value, [])\n } else if (typeof value === 'object') {\n if (Array.isArray(value)) {\n const [plugin, ...parameters] =\n /** @type {PluginTuple>} */ (value)\n addPlugin(plugin, parameters)\n } else {\n addPreset(value)\n }\n } else {\n throw new TypeError('Expected usable value, not `' + value + '`')\n }\n }\n\n /**\n * @param {Preset} result\n * @returns {undefined}\n */\n function addPreset(result) {\n if (!('plugins' in result) && !('settings' in result)) {\n throw new Error(\n 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'\n )\n }\n\n addList(result.plugins)\n\n if (result.settings) {\n namespace.settings = extend(true, namespace.settings, result.settings)\n }\n }\n\n /**\n * @param {PluggableList | null | undefined} plugins\n * @returns {undefined}\n */\n function addList(plugins) {\n let index = -1\n\n if (plugins === null || plugins === undefined) {\n // Empty.\n } else if (Array.isArray(plugins)) {\n while (++index < plugins.length) {\n const thing = plugins[index]\n add(thing)\n }\n } else {\n throw new TypeError('Expected a list of plugins, not `' + plugins + '`')\n }\n }\n\n /**\n * @param {Plugin} plugin\n * @param {Array} parameters\n * @returns {undefined}\n */\n function addPlugin(plugin, parameters) {\n let index = -1\n let entryIndex = -1\n\n while (++index < attachers.length) {\n if (attachers[index][0] === plugin) {\n entryIndex = index\n break\n }\n }\n\n if (entryIndex === -1) {\n attachers.push([plugin, ...parameters])\n }\n // Only set if there was at least a `primary` value, otherwise we’d change\n // `arguments.length`.\n else if (parameters.length > 0) {\n let [primary, ...rest] = parameters\n const currentPrimary = attachers[entryIndex][1]\n if (isPlainObj(currentPrimary) && isPlainObj(primary)) {\n primary = extend(true, currentPrimary, primary)\n }\n\n attachers[entryIndex] = [plugin, primary, ...rest]\n }\n }\n }\n}\n\n// Note: this returns a *callable* instance.\n// That’s why it’s documented as a function.\n/**\n * Create a new processor.\n *\n * @example\n * This example shows how a new processor can be created (from `remark`) and linked\n * to **stdin**(4) and **stdout**(4).\n *\n * ```js\n * import process from 'node:process'\n * import concatStream from 'concat-stream'\n * import {remark} from 'remark'\n *\n * process.stdin.pipe(\n * concatStream(function (buf) {\n * process.stdout.write(String(remark().processSync(buf)))\n * })\n * )\n * ```\n *\n * @returns\n * New *unfrozen* processor (`processor`).\n *\n * This processor is configured to work the same as its ancestor.\n * When the descendant processor is configured in the future it does not\n * affect the ancestral processor.\n */\nexport const unified = new Processor().freeze()\n\n/**\n * Assert a parser is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Parser}\n */\nfunction assertParser(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `parser`')\n }\n}\n\n/**\n * Assert a compiler is available.\n *\n * @param {string} name\n * @param {unknown} value\n * @returns {asserts value is Compiler}\n */\nfunction assertCompiler(name, value) {\n if (typeof value !== 'function') {\n throw new TypeError('Cannot `' + name + '` without `compiler`')\n }\n}\n\n/**\n * Assert the processor is not frozen.\n *\n * @param {string} name\n * @param {unknown} frozen\n * @returns {asserts frozen is false}\n */\nfunction assertUnfrozen(name, frozen) {\n if (frozen) {\n throw new Error(\n 'Cannot call `' +\n name +\n '` on a frozen processor.\\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'\n )\n }\n}\n\n/**\n * Assert `node` is a unist node.\n *\n * @param {unknown} node\n * @returns {asserts node is Node}\n */\nfunction assertNode(node) {\n // `isPlainObj` unfortunately uses `any` instead of `unknown`.\n // type-coverage:ignore-next-line\n if (!isPlainObj(node) || typeof node.type !== 'string') {\n throw new TypeError('Expected node, got `' + node + '`')\n // Fine.\n }\n}\n\n/**\n * Assert that `complete` is `true`.\n *\n * @param {string} name\n * @param {string} asyncName\n * @param {unknown} complete\n * @returns {asserts complete is true}\n */\nfunction assertDone(name, asyncName, complete) {\n if (!complete) {\n throw new Error(\n '`' + name + '` finished async. Use `' + asyncName + '` instead'\n )\n }\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {VFile}\n */\nfunction vfile(value) {\n return looksLikeAVFile(value) ? value : new VFile(value)\n}\n\n/**\n * @param {Compatible | undefined} [value]\n * @returns {value is VFile}\n */\nfunction looksLikeAVFile(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'message' in value &&\n 'messages' in value\n )\n}\n\n/**\n * @param {unknown} [value]\n * @returns {value is Value}\n */\nfunction looksLikeAValue(value) {\n return typeof value === 'string' || isUint8Array(value)\n}\n\n/**\n * Assert `value` is an `Uint8Array`.\n *\n * @param {unknown} value\n * thing.\n * @returns {value is Uint8Array}\n * Whether `value` is an `Uint8Array`.\n */\nfunction isUint8Array(value) {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'byteLength' in value &&\n 'byteOffset' in value\n )\n}\n","/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n/**\n * @module public\n */\nimport { loadState } from '@nextcloud/initial-state';\n/**\n * Check if the current page is on a public share\n */\nexport function isPublicShare() {\n // check both the new initial state version and fallback to legacy input\n return (loadState('files_sharing', 'isPublic', null)\n ?? document.querySelector('input#isPublic[type=\"hidden\"][name=\"isPublic\"][value=\"1\"]') !== null);\n}\n/**\n * Get the sharing token for the current public share\n */\nexport function getSharingToken() {\n return (loadState('files_sharing', 'sharingToken', null)\n ?? document.querySelector('input#sharingToken[type=\"hidden\"]')?.value\n ?? null);\n}\n","import { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nwindow._vue_richtext_widgets ??= {};\nwindow._registerWidget ??= (id, callback, onDestroy, props) => {\n registerWidget(id, callback, onDestroy, props);\n};\nfunction registerWidget(id, callback, onDestroy = () => {\n}, props) {\n const propsWithDefaults = {\n hasInteractiveView: true,\n fullWidth: false,\n ...props\n };\n if (window._vue_richtext_widgets[id]) {\n logger.error(`[ReferencePicker]: Widget for id ${id} already registered`);\n return;\n }\n window._vue_richtext_widgets[id] = {\n id,\n callback,\n onDestroy,\n ...propsWithDefaults\n };\n}\nfunction renderWidget(el, options) {\n const { richObjectType, richObject, accessible, interactive } = options;\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n logger.error(\"Widget for rich object type \" + richObjectType + \" not registered\");\n return;\n }\n window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible, interactive });\n}\nfunction destroyWidget(richObjectType, el) {\n if (richObjectType === \"open-graph\") {\n return;\n }\n if (!window._vue_richtext_widgets[richObjectType]) {\n return;\n }\n window._vue_richtext_widgets[richObjectType].onDestroy(el);\n}\nfunction isWidgetRegistered(id) {\n return !!window._vue_richtext_widgets[id];\n}\nfunction hasInteractiveView(id) {\n return !!window._vue_richtext_widgets[id]?.hasInteractiveView;\n}\nfunction hasFullWidth(id) {\n return !!window._vue_richtext_widgets[id]?.fullWidth;\n}\nwindow._vue_richtext_custom_picker_elements ??= {};\nwindow._registerCustomPickerElement ??= registerCustomPickerElement;\nclass NcCustomPickerRenderResult {\n element;\n object;\n /**\n * @param element - The HTML element\n * @param object - The object\n */\n constructor(element, object) {\n this.element = element;\n this.object = object;\n }\n}\nfunction isCustomPickerElementRegistered(id) {\n return !!window._vue_richtext_custom_picker_elements[id];\n}\nfunction getCustomPickerElementSize(id) {\n const size = window._vue_richtext_custom_picker_elements[id]?.size;\n if (size && [\"small\", \"normal\", \"large\", \"full\"].includes(size)) {\n return size;\n }\n return null;\n}\nfunction registerCustomPickerElement(id, callback, onDestroy = () => {\n}, size = \"large\") {\n if (window._vue_richtext_custom_picker_elements[id]) {\n logger.error(`Custom reference picker element for id ${id} already registered`);\n return;\n }\n window._vue_richtext_custom_picker_elements[id] = {\n id,\n callback,\n onDestroy,\n size\n };\n}\nfunction renderCustomPickerElement(el, options) {\n const { providerId, accessible } = options;\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n logger.error(`Custom reference picker element for reference provider ID ${providerId} not registered`);\n return;\n }\n return window._vue_richtext_custom_picker_elements[providerId].callback(el, { providerId, accessible });\n}\nfunction destroyCustomPickerElement(providerId, el, renderResult) {\n if (!window._vue_richtext_custom_picker_elements[providerId]) {\n return;\n }\n window._vue_richtext_custom_picker_elements[providerId].onDestroy(el, renderResult);\n}\nexport {\n NcCustomPickerRenderResult as N,\n renderWidget as a,\n destroyCustomPickerElement as b,\n isCustomPickerElementRegistered as c,\n destroyWidget as d,\n registerCustomPickerElement as e,\n renderCustomPickerElement as f,\n getCustomPickerElementSize as g,\n hasInteractiveView as h,\n isWidgetRegistered as i,\n hasFullWidth as j,\n registerWidget as r\n};\n//# sourceMappingURL=customPickerElements-4pQTZUnk.mjs.map\n","/**\n * @typedef {import('unist').Node} Node\n */\n\n/**\n * @typedef {Array | string} ChildrenOrValue\n * List to use as `children` or value to use as `value`.\n *\n * @typedef {Record} Props\n * Other fields to add to the node.\n */\n\n/**\n * Build a node.\n *\n * @template {string} T\n * @template {Props} P\n * @template {Array} C\n *\n * @overload\n * @param {T} type\n * @returns {{type: T}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @returns {{type: T} & P}\n *\n * @overload\n * @param {T} type\n * @param {string} value\n * @returns {{type: T, value: string}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {string} value\n * @returns {{type: T, value: string} & P}\n *\n * @overload\n * @param {T} type\n * @param {C} children\n * @returns {{type: T, children: C}}\n *\n * @overload\n * @param {T} type\n * @param {P} props\n * @param {C} children\n * @returns {{type: T, children: C} & P}\n *\n * @param {string} type\n * Node type.\n * @param {ChildrenOrValue | Props | null | undefined} [props]\n * Fields assigned to node (default: `undefined`).\n * @param {ChildrenOrValue | null | undefined} [value]\n * Children of node or value of `node` (cast to string).\n * @returns {Node}\n * Built node.\n */\nexport function u(type, props, value) {\n /** @type {Node} */\n const node = {type: String(type)}\n\n if (\n (value === undefined || value === null) &&\n (typeof props === 'string' || Array.isArray(props))\n ) {\n value = props\n } else {\n Object.assign(node, props)\n }\n\n if (Array.isArray(value)) {\n // @ts-expect-error: create a parent.\n node.children = value\n } else if (value !== undefined && value !== null) {\n // @ts-expect-error: create a literal.\n node.value = String(value)\n }\n\n return node\n}\n","import { getBaseUrl, getRootUrl } from \"@nextcloud/router\";\nimport { u } from \"unist-builder\";\nimport { visit, SKIP } from \"unist-util-visit\";\nimport { defineComponent, h } from \"vue\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\n/*!\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst URL_PATTERN = /(\\s|^)(https?:\\/\\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\\s|$)/ig;\nconst URL_PATTERN_AUTOLINK = /(\\s|\\(|^)((https?:\\/\\/)([-A-Z0-9+_.]+[-A-Z0-9]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*))(?=\\s|\\)|$)/ig;\nconst NcLink = defineComponent({\n name: \"NcLink\",\n props: {\n href: {\n type: String,\n required: true\n }\n },\n render() {\n return h(\"a\", {\n href: this.href,\n rel: \"noopener noreferrer\",\n target: \"_blank\",\n class: \"rich-text--external-link\"\n }, [this.href.trim()]);\n }\n});\nfunction remarkAutolink({ autolink, useMarkdown, useExtendedMarkdown }) {\n return function(tree) {\n if (useExtendedMarkdown || !useMarkdown || !autolink) {\n return;\n }\n visit(tree, (node) => node.type === \"text\", (node, index, parent) => {\n let parsed = parseUrl(node.value);\n if (typeof parsed === \"string\") {\n parsed = [u(\"text\", parsed)];\n } else {\n parsed = parsed.map((n) => {\n if (typeof n === \"string\") {\n return u(\"text\", n);\n }\n return u(\"link\", {\n url: n.props.href\n }, [u(\"text\", n.props.href)]);\n }).filter((x) => x).flat();\n }\n parent.children.splice(index, 1, ...parsed);\n return [SKIP, (index ?? 0) + parsed.length];\n });\n };\n}\nfunction parseUrl(text) {\n let match = URL_PATTERN_AUTOLINK.exec(text);\n const list = [];\n let start = 0;\n while (match !== null) {\n let href = match[2];\n let textAfter;\n let textBefore = text.substring(start, match.index + match[1].length);\n if (href[0] === \" \") {\n textBefore += href[0];\n href = href.substring(1).trim();\n }\n const lastChar = href[href.length - 1];\n if (lastChar === \".\" || lastChar === \",\" || lastChar === \";\" || match[0][0] === \"(\" && lastChar === \")\") {\n href = href.substring(0, href.length - 1);\n textAfter = lastChar;\n }\n list.push(textBefore);\n list.push({ component: NcLink, props: { href } });\n if (textAfter) {\n list.push(textAfter);\n }\n start = match.index + match[0].length;\n match = URL_PATTERN_AUTOLINK.exec(text);\n }\n list.push(text.substring(start));\n const joinedText = list.map((item) => typeof item === \"string\" ? item : item.props.href).join(\"\");\n if (text === joinedText) {\n return list;\n }\n logger.error(\"[NcRichText] Failed to reassemble the chunked text: \" + text);\n return text;\n}\nfunction getRoute(router, url) {\n const removePrefix = (str, prefix) => str.startsWith(prefix) ? str.slice(prefix.length) : str;\n const removePrefixes = (str, ...prefixes) => prefixes.reduce((acc, prefix) => removePrefix(acc, prefix), str);\n if (!router) {\n return null;\n }\n const isAbsoluteURL = /^https?:\\/\\//.test(url);\n const isNonHttpLink = /^[a-z][a-z0-9+.-]*:.+/.test(url);\n if (!isAbsoluteURL && isNonHttpLink) {\n return null;\n }\n if (isAbsoluteURL && !url.startsWith(getBaseUrl())) {\n return null;\n }\n if (!isAbsoluteURL && !url.startsWith(\"/\")) {\n return null;\n }\n const relativeUrl = isAbsoluteURL ? removePrefixes(url, getBaseUrl(), \"/index.php\") : url;\n const relativeRouterBase = removePrefixes(router.options.history.base, getRootUrl(), \"/index.php\");\n const potentialRouterPath = removePrefixes(relativeUrl, relativeRouterBase) || \"/\";\n const route = router.resolve(potentialRouterPath);\n if (!route.matched.length) {\n return null;\n }\n return route.fullPath;\n}\nexport {\n URL_PATTERN as U,\n getRoute as g,\n parseUrl as p,\n remarkAutolink as r\n};\n//# sourceMappingURL=autolink-U5pBzLgI.mjs.map\n","import { defineComponent, mergeModels, useModel, useTemplateRef, computed, createBlock, openBlock, unref, mergeProps, createSlots, withCtx, renderSlot } from \"vue\";\nimport { m as mdiArrowRight, a as mdiUndo, b as mdiClose } from \"./mdi-CpchYUUV.mjs\";\nimport { r as register, b as t50, c as t18, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { N as NcInputField } from \"./NcInputField-Clm9jOGJ.mjs\";\nregister(t18, t50);\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcTextField\",\n props: /* @__PURE__ */ mergeModels({\n class: {},\n inputClass: {},\n id: {},\n label: {},\n labelOutside: { type: Boolean },\n type: {},\n placeholder: {},\n showTrailingButton: { type: Boolean },\n trailingButtonLabel: { default: void 0 },\n success: { type: Boolean },\n error: { type: Boolean },\n helperText: {},\n disabled: { type: Boolean },\n pill: { type: Boolean },\n trailingButtonIcon: { default: \"close\" }\n }, {\n \"modelValue\": { default: \"\" },\n \"modelModifiers\": {}\n }),\n emits: [\"update:modelValue\"],\n setup(__props, { expose: __expose }) {\n const modelValue = useModel(__props, \"modelValue\");\n const props = __props;\n __expose({\n focus,\n select\n });\n const inputFieldInstance = useTemplateRef(\"inputField\");\n const defaultTrailingButtonLabels = {\n arrowEnd: t(\"Save changes\"),\n close: t(\"Clear text\"),\n undo: t(\"Undo changes\")\n };\n const NcInputFieldPropNames = new Set(Object.keys(NcInputField.props));\n const propsToForward = computed(() => {\n const sharedProps = Object.fromEntries(Object.entries(props).filter(([key]) => NcInputFieldPropNames.has(key)));\n sharedProps.trailingButtonLabel ??= defaultTrailingButtonLabels[props.trailingButtonIcon];\n return sharedProps;\n });\n function focus(options) {\n inputFieldInstance.value.focus(options);\n }\n function select() {\n inputFieldInstance.value.select();\n }\n return (_ctx, _cache) => {\n return openBlock(), createBlock(unref(NcInputField), mergeProps(propsToForward.value, {\n ref: \"inputField\",\n modelValue: modelValue.value,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)\n }), createSlots({ _: 2 }, [\n !!_ctx.$slots.icon ? {\n name: \"icon\",\n fn: withCtx(() => [\n renderSlot(_ctx.$slots, \"icon\")\n ]),\n key: \"0\"\n } : void 0,\n _ctx.type !== \"search\" ? {\n name: \"trailing-button-icon\",\n fn: withCtx(() => [\n _ctx.trailingButtonIcon === \"arrowEnd\" ? (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 0,\n directional: \"\",\n path: unref(mdiArrowRight)\n }, null, 8, [\"path\"])) : (openBlock(), createBlock(unref(NcIconSvgWrapper), {\n key: 1,\n path: _ctx.trailingButtonIcon === \"undo\" ? unref(mdiUndo) : unref(mdiClose)\n }, null, 8, [\"path\"]))\n ]),\n key: \"1\"\n } : void 0\n ]), 1040, [\"modelValue\"]);\n };\n }\n});\nexport {\n _sfc_main as _\n};\n//# sourceMappingURL=NcTextField.vue_vue_type_script_setup_true_lang-CCsZqnkM.mjs.map\n","import '../assets/referencePickerModal-DWMAMaU3.css';\nimport { createElementBlock, openBlock, mergeProps, createElementVNode, createCommentVNode, toDisplayString, resolveComponent, createVNode, withCtx, defineComponent, inject, ref, useTemplateRef, nextTick, computed, watch, onBeforeUnmount, normalizeClass, createBlock, resolveDynamicComponent, normalizeStyle, createTextVNode, unref, withKeys, withModifiers, createApp } from \"vue\";\nimport { emit } from \"@nextcloud/event-bus\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nimport { I as IconClose } from \"./Close-D6ngJ4t9.mjs\";\nimport { f as renderCustomPickerElement, b as destroyCustomPickerElement, c as isCustomPickerElementRegistered, j as hasFullWidth, i as isWidgetRegistered, h as hasInteractiveView, a as renderWidget, d as destroyWidget, g as getCustomPickerElementSize } from \"./customPickerElements-4pQTZUnk.mjs\";\nimport axios from \"@nextcloud/axios\";\nimport { loadState } from \"@nextcloud/initial-state\";\nimport { imagePath, generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, W as t8, a as t, X as t45, Y as t40, Z as t24, _ as t25, q as t42, $ as t32, A as t19, a0 as t12 } from \"./_l10n-CgsPi8nC.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { N as NcEmptyContent } from \"./NcEmptyContent-B8-90BSI.mjs\";\nimport { _ as _sfc_main$a } from \"./NcHighlight.vue_vue_type_script_lang-DnWQDM_2.mjs\";\nimport { N as NcSelect } from \"./NcSelect-Cc9_a8nG.mjs\";\nimport debounce from \"debounce\";\nimport { useElementSize, useIntersectionObserver } from \"@vueuse/core\";\nimport { routerKey, RouterLink } from \"vue-router\";\nimport { N as NcButton } from \"./NcButton-CzpKEx4V.mjs\";\nimport { g as getRoute } from \"./autolink-U5pBzLgI.mjs\";\nimport { N as NcLoadingIcon } from \"./NcLoadingIcon-b_ajZ_nQ.mjs\";\nimport { _ as _sfc_main$b } from \"./NcTextField.vue_vue_type_script_setup_true_lang-CCsZqnkM.mjs\";\nimport { I as IconDotsHorizontal } from \"./NcActions-4R7icatI.mjs\";\nimport { N as NcModal } from \"./NcModal-D00OJZV2.mjs\";\nconst _sfc_main$9 = {\n name: \"ArrowLeftIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$9 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$7 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$6 = { d: \"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z\" };\nconst _hoisted_4$5 = { key: 0 };\nfunction _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon arrow-left-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$6, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$5, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$7))\n ], 16, _hoisted_1$9);\n}\nconst ArrowLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$9, [[\"render\", _sfc_render$8]]);\nconst _sfc_main$8 = {\n name: \"NcCustomPickerElement\",\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"cancel\",\n \"submit\"\n ],\n data() {\n return {\n isRegistered: isCustomPickerElementRegistered(this.provider.id),\n renderResult: null\n };\n },\n mounted() {\n if (this.isRegistered) {\n this.renderElement();\n }\n },\n beforeUnmount() {\n if (this.isRegistered) {\n destroyCustomPickerElement(this.provider.id, this.$el, this.renderResult);\n }\n },\n methods: {\n renderElement() {\n if (this.$refs.domElement) {\n this.$refs.domElement.innerHTML = \"\";\n }\n const renderFunctionResult = renderCustomPickerElement(this.$refs.domElement, { providerId: this.provider.id, accessible: false });\n Promise.resolve(renderFunctionResult).then((result) => {\n this.renderResult = result;\n if (this.renderResult.object?._isVue && this.renderResult.object?.$on) {\n this.renderResult.object.$on(\"submit\", this.onSubmit);\n this.renderResult.object.$on(\"cancel\", this.onCancel);\n }\n this.renderResult.element.addEventListener(\"submit\", (e) => {\n this.onSubmit(e.detail);\n });\n this.renderResult.element.addEventListener(\"cancel\", this.onCancel);\n });\n },\n onSubmit(value) {\n this.$emit(\"submit\", value);\n },\n onCancel() {\n this.$emit(\"cancel\");\n }\n }\n};\nconst _hoisted_1$8 = { ref: \"domElement\" };\nfunction _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", _hoisted_1$8, null, 512);\n}\nconst NcCustomPickerElement = /* @__PURE__ */ _export_sfc(_sfc_main$8, [[\"render\", _sfc_render$7], [\"__scopeId\", \"data-v-e408867a\"]]);\nconst _sfc_main$7 = {\n name: \"LinkVariantIcon\",\n emits: [\"click\"],\n props: {\n title: {\n type: String\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n};\nconst _hoisted_1$7 = [\"aria-hidden\", \"aria-label\"];\nconst _hoisted_2$6 = [\"fill\", \"width\", \"height\"];\nconst _hoisted_3$5 = { d: \"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\" };\nconst _hoisted_4$4 = { key: 0 };\nfunction _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps(_ctx.$attrs, {\n \"aria-hidden\": $props.title ? null : \"true\",\n \"aria-label\": $props.title,\n class: \"material-design-icon link-variant-icon\",\n role: \"img\",\n onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit(\"click\", $event))\n }), [\n (openBlock(), createElementBlock(\"svg\", {\n fill: $props.fillColor,\n class: \"material-design-icon__svg\",\n width: $props.size,\n height: $props.size,\n viewBox: \"0 0 24 24\"\n }, [\n createElementVNode(\"path\", _hoisted_3$5, [\n $props.title ? (openBlock(), createElementBlock(\"title\", _hoisted_4$4, toDisplayString($props.title), 1)) : createCommentVNode(\"\", true)\n ])\n ], 8, _hoisted_2$6))\n ], 16, _hoisted_1$7);\n}\nconst LinkVariantIcon = /* @__PURE__ */ _export_sfc(_sfc_main$7, [[\"render\", _sfc_render$6]]);\nregister(t8);\nconst anyLinkProviderId = \"any-link\";\nconst anyLinkProvider = {\n id: anyLinkProviderId,\n title: t(\"Any link\"),\n order: 0,\n icon_url: imagePath(\"core\", \"filetypes/link.svg\")\n};\nwindow._vue_richtext_reference_providers ??= loadState(\"core\", \"reference-provider-list\", []);\nwindow._vue_richtext_reference_provider_timestamps ??= loadState(\"core\", \"reference-provider-timestamps\", {});\nfunction getProvider(providerId) {\n if (providerId === anyLinkProviderId) {\n return anyLinkProvider;\n }\n return getProviders().find((p) => p.id === providerId);\n}\nfunction getProviders() {\n return window._vue_richtext_reference_providers.filter((p) => {\n const keep = !!p.search_providers_ids && p.search_providers_ids.length > 0 || isCustomPickerElementRegistered(p.id);\n if (!keep) {\n logger.debug(`[smart picker] ${p.id} reference provider is discoverable but does not have any related search provider or custom picker component registered`);\n }\n return keep;\n });\n}\nfunction sortProviders(providerList) {\n const timestamps = window._vue_richtext_reference_provider_timestamps;\n return providerList.sort((a, b) => {\n return a.order === b.order ? 0 : a.order > b.order ? 1 : -1;\n }).sort((a, b) => {\n const ta = timestamps[a.id];\n const tb = timestamps[b.id];\n return ta === tb ? 0 : tb === void 0 ? -1 : ta === void 0 ? 1 : ta > tb ? -1 : 1;\n });\n}\nfunction searchProvider(query, limit) {\n const providers = getProviders();\n const escapedQuery = query.replace(/[/\\-\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n const regexp = new RegExp(escapedQuery, \"i\");\n const sortedProviders = sortProviders(providers);\n const filteredSortedProviders = sortedProviders.filter((p) => {\n return p.title.match(regexp);\n });\n const searchResult = limit ? filteredSortedProviders.slice(0, limit) : filteredSortedProviders;\n if (query === \"\" || searchResult.length === 0) {\n searchResult.push(anyLinkProvider);\n }\n return searchResult;\n}\nasync function touchProvider(providerId) {\n const timestamp = Math.floor(Date.now() / 1e3);\n const url = generateOcsUrl(\"references/provider/{providerId}\", { providerId });\n await axios.put(url, { timestamp });\n window._vue_richtext_reference_provider_timestamps[providerId] = timestamp;\n}\nregister(t40, t45);\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isUrl(str) {\n try {\n return Boolean(new URL(str));\n } catch {\n return false;\n }\n}\nconst _sfc_main$6 = {\n name: \"NcProviderList\",\n components: {\n NcSelect,\n NcHighlight: _sfc_main$a,\n NcEmptyContent,\n LinkVariantIcon\n },\n emits: [\n \"selectProvider\",\n \"submit\"\n ],\n data() {\n return {\n selectedProvider: null,\n query: \"\",\n multiselectPlaceholder: t(\"Select provider\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n options() {\n const result = [];\n if (this.query !== \"\" && isUrl(this.query)) {\n result.push({\n id: this.query,\n title: this.query,\n isLink: true\n });\n }\n result.push(...searchProvider(this.query));\n return result;\n }\n },\n methods: {\n focus() {\n setTimeout(() => {\n this.$refs[\"provider-select\"]?.$el?.querySelector(\"#provider-select-input\")?.focus();\n }, 300);\n },\n onProviderSelected(p) {\n if (p !== null) {\n if (p.isLink) {\n this.$emit(\"submit\", p.title);\n } else {\n this.$emit(\"selectProvider\", p);\n }\n this.selectedProvider = null;\n }\n },\n onSearch(query) {\n this.query = query;\n }\n }\n};\nconst _hoisted_1$6 = { class: \"provider-list\" };\nconst _hoisted_2$5 = {\n key: 0,\n class: \"provider\"\n};\nconst _hoisted_3$4 = {\n key: 1,\n class: \"provider\"\n};\nconst _hoisted_4$3 = [\"src\", \"alt\"];\nfunction _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$6, [\n createVNode(_component_NcSelect, {\n ref: \"provider-select\",\n modelValue: $data.selectedProvider,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedProvider = $event),\n $options.onProviderSelected\n ],\n class: \"provider-list--select\",\n \"input-id\": \"provider-select-input\",\n label: \"title\",\n placeholder: $data.multiselectPlaceholder,\n options: $options.options,\n \"append-to-body\": false,\n \"clear-search-on-select\": true,\n \"clear-search-on-blur\": () => false,\n filterable: false,\n onSearch: $options.onSearch\n }, {\n option: withCtx((option) => [\n option.isLink ? (openBlock(), createElementBlock(\"div\", _hoisted_2$5, [\n createVNode(_component_LinkVariantIcon, {\n class: \"link-icon\",\n size: 20\n }),\n createElementVNode(\"span\", null, toDisplayString(option.title), 1)\n ])) : (openBlock(), createElementBlock(\"div\", _hoisted_3$4, [\n createElementVNode(\"img\", {\n class: \"provider-icon\",\n src: option.icon_url,\n alt: $data.providerIconAlt\n }, null, 8, _hoisted_4$3),\n createVNode(_component_NcHighlight, {\n class: \"option-text\",\n search: $data.query,\n text: option.title\n }, null, 8, [\"search\", \"text\"])\n ]))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"onSearch\", \"onUpdate:modelValue\"]),\n createVNode(_component_NcEmptyContent, { class: \"provider-list--empty-content\" }, {\n icon: withCtx(() => [\n createVNode(_component_LinkVariantIcon)\n ]),\n _: 1\n })\n ]);\n}\nconst NcProviderList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [[\"render\", _sfc_render$5], [\"__scopeId\", \"data-v-90c6aa3b\"]]);\nregister(t24);\nconst _hoisted_1$5 = [\"src\"];\nconst _hoisted_2$4 = { class: \"widget-default--details\" };\nconst _hoisted_3$3 = { class: \"widget-default--name\" };\nconst _hoisted_4$2 = { class: \"widget-default--link\" };\nconst IDLE_TIMEOUT = 3 * 60 * 1e3;\nconst _sfc_main$5 = /* @__PURE__ */ defineComponent({\n __name: \"NcReferenceWidget\",\n props: {\n reference: {},\n interactive: { type: Boolean, default: true },\n interactiveOptIn: { type: Boolean, default: false }\n },\n setup(__props) {\n const props = __props;\n const router = inject(routerKey, null);\n const isVisible = ref(false);\n const customWidget = useTemplateRef(\"customWidget\");\n const widgetRoot = useTemplateRef(\"widgetRoot\");\n const { width } = useElementSize(widgetRoot);\n useIntersectionObserver(widgetRoot, ([entry]) => {\n nextTick(() => {\n isVisible.value = entry.isIntersecting;\n });\n });\n const showInteractive = ref(false);\n const rendered = ref(false);\n let idleTimeout = null;\n const isInteractive = computed(() => {\n return !props.interactiveOptIn && props.interactive || showInteractive.value;\n });\n const referenceHasFullWidth = computed(() => {\n return hasFullWidth(props.reference.richObjectType);\n });\n const hasCustomWidget = computed(() => {\n return isWidgetRegistered(props.reference.richObjectType);\n });\n const referenceHasInteractiveView = computed(() => {\n return hasCustomWidget.value && hasInteractiveView(props.reference.richObjectType);\n });\n const noAccess = computed(() => {\n return !props.reference.accessible;\n });\n const numberOfLines = computed(() => {\n const lineCountOffsets = [450, 550, 650, Infinity];\n return lineCountOffsets.findIndex((max) => width.value < max);\n });\n const descriptionStyle = computed(() => {\n if (numberOfLines.value === 0) {\n return {\n display: \"none\"\n };\n }\n const lineClamp = numberOfLines.value;\n return {\n lineClamp,\n webkitLineClamp: lineClamp\n };\n });\n const compactLink = computed(() => {\n const link = props.reference.openGraphObject.link;\n if (!link) {\n return \"\";\n }\n if (link.startsWith(\"https://\")) {\n return link.substring(8);\n }\n if (link.startsWith(\"http://\")) {\n return link.substring(7);\n }\n return link;\n });\n const route = computed(() => {\n return getRoute(router, props.reference.openGraphObject.link);\n });\n const referenceWidgetLinkComponent = computed(() => {\n return route.value ? RouterLink : \"a\";\n });\n const referenceWidgetLinkProps = computed(() => {\n return route.value ? { to: route.value } : { href: props.reference.openGraphObject.link, target: \"_blank\" };\n });\n watch(isVisible, (val) => {\n if (!val) {\n idleTimeout = setTimeout(() => {\n if (!isVisible.value) {\n destroyReferenceWidget();\n }\n }, IDLE_TIMEOUT);\n return;\n }\n if (idleTimeout) {\n clearTimeout(idleTimeout);\n idleTimeout = null;\n }\n if (!rendered.value) {\n renderReferenceWidget();\n }\n }, { immediate: true });\n onBeforeUnmount(() => {\n destroyReferenceWidget();\n });\n function enableInteractive() {\n showInteractive.value = true;\n renderReferenceWidget();\n }\n function renderReferenceWidget() {\n if (!customWidget.value) {\n return;\n }\n if (props.reference.richObjectType === \"open-graph\") {\n return;\n }\n customWidget.value.innerHTML = \"\";\n const widget = document.createElement(\"div\");\n widget.style.width = \"100%\";\n customWidget.value.appendChild(widget);\n nextTick(() => {\n renderWidget(widget, {\n ...props.reference,\n interactive: isInteractive.value\n });\n rendered.value = true;\n });\n }\n function destroyReferenceWidget() {\n if (rendered.value && widgetRoot.value) {\n destroyWidget(props.reference.richObjectType, widgetRoot.value);\n rendered.value = false;\n }\n }\n return (_ctx, _cache) => {\n return openBlock(), createElementBlock(\"div\", {\n ref_key: \"widgetRoot\",\n ref: widgetRoot,\n class: normalizeClass({ \"toggle-interactive\": referenceHasInteractiveView.value && !isInteractive.value })\n }, [\n _ctx.reference && hasCustomWidget.value ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n ref_key: \"customWidget\",\n ref: customWidget,\n class: normalizeClass([\"widget-custom\", { \"full-width\": referenceHasFullWidth.value }])\n }, null, 2)) : !noAccess.value && _ctx.reference && _ctx.reference.openGraphObject && !hasCustomWidget.value ? (openBlock(), createBlock(resolveDynamicComponent(referenceWidgetLinkComponent.value), mergeProps({ key: 1 }, referenceWidgetLinkProps.value, {\n rel: \"noopener noreferrer\",\n class: \"widget-default\"\n }), {\n default: withCtx(() => [\n _ctx.reference.openGraphObject.thumb ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"widget-default--image\",\n src: _ctx.reference.openGraphObject.thumb\n }, null, 8, _hoisted_1$5)) : createCommentVNode(\"\", true),\n createElementVNode(\"div\", _hoisted_2$4, [\n createElementVNode(\"p\", _hoisted_3$3, toDisplayString(_ctx.reference.openGraphObject.name), 1),\n createElementVNode(\"p\", {\n class: \"widget-default--description\",\n style: normalizeStyle(descriptionStyle.value)\n }, toDisplayString(_ctx.reference.openGraphObject.description), 5),\n createElementVNode(\"p\", _hoisted_4$2, toDisplayString(compactLink.value), 1)\n ])\n ]),\n _: 1\n }, 16)) : createCommentVNode(\"\", true),\n _ctx.interactiveOptIn && referenceHasInteractiveView.value && !isInteractive.value ? (openBlock(), createBlock(NcButton, {\n key: 2,\n class: \"toggle-interactive--button\",\n onClick: enableInteractive\n }, {\n default: withCtx(() => [\n createTextVNode(toDisplayString(unref(t)(\"Enable interactive view\")), 1)\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n };\n }\n});\nconst NcReferenceWidget = /* @__PURE__ */ _export_sfc(_sfc_main$5, [[\"__scopeId\", \"data-v-8ce33442\"]]);\nregister(t25);\nconst _sfc_main$4 = {\n name: \"NcRawLinkInput\",\n components: {\n LinkVariantIcon,\n NcEmptyContent,\n NcLoadingIcon,\n NcReferenceWidget,\n NcTextField: _sfc_main$b\n },\n props: {\n /**\n * The reference provider\n */\n provider: {\n type: Object,\n required: true\n }\n },\n emits: [\n \"submit\"\n ],\n data() {\n return {\n inputValue: \"\",\n loading: false,\n reference: null,\n abortController: null,\n inputPlaceholder: t(\"Enter link\")\n };\n },\n computed: {\n isLinkValid() {\n return isUrl(this.inputValue);\n },\n debouncedUpdateReference() {\n return debounce(this.updateReference, 500);\n }\n },\n methods: {\n focus() {\n this.$refs[\"url-input\"].$el.getElementsByTagName(\"input\")[0]?.focus();\n },\n onSubmit(e) {\n const value = e.target.value;\n if (this.isLinkValid) {\n this.$emit(\"submit\", value);\n }\n },\n onClear() {\n this.inputValue = \"\";\n this.reference = null;\n },\n onInput() {\n this.reference = null;\n if (this.abortController) {\n this.abortController.abort();\n }\n if (this.isLinkValid) {\n this.debouncedUpdateReference();\n }\n },\n updateReference() {\n this.loading = true;\n this.abortController = new AbortController();\n axios.get(generateOcsUrl(\"references/resolve\", 2) + \"?reference=\" + encodeURIComponent(this.inputValue), {\n signal: this.abortController.signal\n }).then((response) => {\n this.reference = response.data.ocs.data.references[this.inputValue];\n }).catch((error) => {\n logger.error(\"[NcRawLinkInput] Failed to update reference\", { error });\n }).then(() => {\n this.loading = false;\n });\n }\n }\n};\nconst _hoisted_1$4 = { class: \"raw-link\" };\nconst _hoisted_2$3 = { class: \"input-wrapper\" };\nconst _hoisted_3$2 = [\"src\"];\nfunction _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcLoadingIcon = resolveComponent(\"NcLoadingIcon\");\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcTextField = resolveComponent(\"NcTextField\");\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$4, [\n createElementVNode(\"div\", _hoisted_2$3, [\n createVNode(_component_NcTextField, {\n ref: \"url-input\",\n modelValue: $data.inputValue,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event),\n $options.onInput\n ],\n \"show-trailing-button\": $data.inputValue !== \"\",\n label: $data.inputPlaceholder,\n onTrailingButtonClick: $options.onClear,\n onKeyup: withKeys($options.onSubmit, [\"enter\"])\n }, {\n default: withCtx(() => [\n $data.loading ? (openBlock(), createBlock(_component_NcLoadingIcon, {\n key: 0,\n size: 16\n })) : (openBlock(), createBlock(_component_LinkVariantIcon, {\n key: 1,\n size: 16\n }))\n ]),\n _: 1\n }, 8, [\"modelValue\", \"show-trailing-button\", \"label\", \"onTrailingButtonClick\", \"onUpdate:modelValue\", \"onKeyup\"])\n ]),\n $data.reference !== null ? (openBlock(), createBlock(_component_NcReferenceWidget, {\n key: 0,\n class: \"reference-widget\",\n reference: $data.reference\n }, null, 8, [\"reference\"])) : (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 1,\n class: \"raw-link--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_3$2)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n }))\n ]);\n}\nconst NcRawLinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$4, [[\"render\", _sfc_render$4], [\"__scopeId\", \"data-v-a0658f2a\"]]);\nconst _sfc_main$3 = {\n name: \"NcSearchResult\",\n components: {\n NcHighlight: _sfc_main$a\n },\n props: {\n /**\n * Unified search result entry\n */\n entry: {\n type: Object,\n required: true\n },\n /**\n * The query that led to getting this result\n * Used to highlight the entry text\n */\n query: {\n type: String,\n required: true\n }\n }\n};\nconst _hoisted_1$3 = { class: \"result\" };\nconst _hoisted_2$2 = [\"src\"];\nconst _hoisted_3$1 = { class: \"result--content\" };\nconst _hoisted_4$1 = { class: \"result--content--name\" };\nconst _hoisted_5$1 = { class: \"result--content--subline\" };\nfunction _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcHighlight = resolveComponent(\"NcHighlight\");\n return openBlock(), createElementBlock(\"div\", _hoisted_1$3, [\n $props.entry.icon ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([{ [$props.entry.icon]: true, rounded: $props.entry.rounded }, \"result--icon-class\"])\n }, null, 2)) : (openBlock(), createElementBlock(\"img\", {\n key: 1,\n class: normalizeClass([\"result--image\", { rounded: $props.entry.rounded }]),\n src: $props.entry.thumbnailUrl\n }, null, 10, _hoisted_2$2)),\n createElementVNode(\"div\", _hoisted_3$1, [\n createElementVNode(\"span\", _hoisted_4$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.title\n }, null, 8, [\"search\", \"text\"])\n ]),\n createElementVNode(\"span\", _hoisted_5$1, [\n createVNode(_component_NcHighlight, {\n search: $props.query,\n text: $props.entry.subline\n }, null, 8, [\"search\", \"text\"])\n ])\n ])\n ]);\n}\nconst NcSearchResult = /* @__PURE__ */ _export_sfc(_sfc_main$3, [[\"render\", _sfc_render$3], [\"__scopeId\", \"data-v-059edcfb\"]]);\nregister(t32, t40, t42);\nconst LIMIT = 5;\nconst _sfc_main$2 = {\n name: \"NcSearch\",\n components: {\n LinkVariantIcon,\n DotsHorizontalIcon: IconDotsHorizontal,\n NcEmptyContent,\n NcSelect,\n NcSearchResult\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The selected reference provider\n */\n provider: {\n type: Object,\n required: true\n },\n showEmptyContent: {\n type: Boolean,\n default: true\n },\n /**\n * Placeholder of the search\n */\n searchPlaceholder: {\n type: String,\n default: null\n }\n },\n emits: [\n \"submit\"\n ],\n data() {\n return {\n searchQuery: \"\",\n selectedResult: null,\n resultsBySearchProvider: {},\n searching: false,\n searchingMoreOf: null,\n abortController: null,\n noOptionsText: t(\"Start typing to search\"),\n providerIconAlt: t(\"Provider icon\")\n };\n },\n computed: {\n mySearchPlaceholder() {\n return this.searchPlaceholder || t(\"Search\");\n },\n searchProviderIds() {\n return this.provider.search_providers_ids;\n },\n options() {\n if (this.searchQuery === \"\") {\n return [];\n }\n const options = [];\n if (isUrl(this.searchQuery)) {\n options.push(this.rawLinkEntry);\n }\n options.push(...this.formattedSearchResults);\n return options;\n },\n rawLinkEntry() {\n return {\n id: \"rawLinkEntry\",\n resourceUrl: this.searchQuery,\n isRawLink: true\n };\n },\n formattedSearchResults() {\n const results = [];\n this.searchProviderIds.forEach((pid) => {\n if (this.resultsBySearchProvider[pid].entries.length > 0) {\n if (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[pid].entries.length > 1) {\n results.push({\n id: \"groupTitle-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isCustomGroupTitle: true,\n providerId: pid\n });\n }\n const providerEntriesWithId = this.resultsBySearchProvider[pid].entries.map((entry, index) => {\n return {\n id: \"provider-\" + pid + \"-entry-\" + index,\n ...entry\n };\n });\n results.push(...providerEntriesWithId);\n if (this.resultsBySearchProvider[pid].isPaginated) {\n results.push({\n id: \"moreOf-\" + pid,\n name: this.resultsBySearchProvider[pid].name,\n isMore: true,\n providerId: pid,\n isLoading: this.searchingMoreOf === pid\n });\n }\n }\n });\n return results;\n },\n debouncedUpdateSearch() {\n return debounce(this.updateSearch, 500);\n }\n },\n mounted() {\n this.resetResults();\n },\n beforeUnmount() {\n this.cancelSearchRequests();\n },\n methods: {\n t,\n resetResults() {\n const resultsBySearchProvider = {};\n this.searchProviderIds.forEach((pid) => {\n resultsBySearchProvider[pid] = {\n entries: []\n };\n });\n this.resultsBySearchProvider = resultsBySearchProvider;\n },\n focus() {\n setTimeout(() => {\n this.$refs[\"search-select\"]?.$el?.querySelector(\"#search-select-input\")?.focus();\n }, 300);\n },\n cancelSearchRequests() {\n if (this.abortController) {\n this.abortController.abort();\n }\n },\n onSearchInput(query) {\n this.searchQuery = query;\n this.debouncedUpdateSearch();\n },\n onSelectResultSelected(item) {\n if (item !== null) {\n if (item.resourceUrl) {\n this.cancelSearchRequests();\n this.$emit(\"submit\", item.resourceUrl);\n } else if (item.isMore) {\n this.searchMoreOf(item.providerId).then(() => {\n this.selectedResult = null;\n });\n }\n }\n },\n searchMoreOf(searchProviderId) {\n this.searchingMoreOf = searchProviderId;\n this.cancelSearchRequests();\n return this.searchProviders(searchProviderId);\n },\n updateSearch() {\n this.cancelSearchRequests();\n this.resetResults();\n if (this.searchQuery === \"\") {\n this.searching = false;\n return;\n }\n return this.searchProviders();\n },\n searchProviders(searchProviderId = null) {\n this.abortController = new AbortController();\n this.searching = true;\n const searchPromises = searchProviderId === null ? [...this.searchProviderIds].map((pid) => {\n return this.searchOneProvider(pid);\n }) : [this.searchOneProvider(searchProviderId, this.resultsBySearchProvider[searchProviderId]?.cursor ?? null)];\n return Promise.allSettled(searchPromises).then((promises) => {\n const isOneCanceled = !!promises.find((p) => {\n return p.status === \"rejected\" && (p.reason.name === \"CanceledError\" || p.reason.code === \"ERR_CANCELED\");\n });\n if (!isOneCanceled) {\n this.searching = false;\n this.searchingMoreOf = null;\n }\n });\n },\n searchOneProvider(providerId, cursor = null) {\n const url = cursor === null ? generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}\", { providerId, term: this.searchQuery, limit: LIMIT }) : generateOcsUrl(\"search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}\", { providerId, term: this.searchQuery, limit: LIMIT, cursor });\n return axios.get(url, {\n signal: this.abortController.signal\n }).then((response) => {\n const data = response.data.ocs.data;\n this.resultsBySearchProvider[providerId].name = data.name;\n this.resultsBySearchProvider[providerId].cursor = data.cursor;\n this.resultsBySearchProvider[providerId].isPaginated = data.isPaginated;\n this.resultsBySearchProvider[providerId].entries.push(...data.entries);\n });\n }\n }\n};\nconst _hoisted_1$2 = {\n key: 0,\n class: \"custom-option\"\n};\nconst _hoisted_2$1 = { class: \"option-text\" };\nconst _hoisted_3 = {\n key: 2,\n class: \"custom-option group-name\"\n};\nconst _hoisted_4 = [\"src\"];\nconst _hoisted_5 = { class: \"option-text\" };\nconst _hoisted_6 = {\n key: 3,\n class: \"custom-option\"\n};\nconst _hoisted_7 = {\n key: 0,\n class: \"option-simple-icon icon-loading-small\"\n};\nconst _hoisted_8 = { class: \"option-text\" };\nconst _hoisted_9 = [\"alt\", \"src\"];\nfunction _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_LinkVariantIcon = resolveComponent(\"LinkVariantIcon\");\n const _component_NcSearchResult = resolveComponent(\"NcSearchResult\");\n const _component_DotsHorizontalIcon = resolveComponent(\"DotsHorizontalIcon\");\n const _component_NcSelect = resolveComponent(\"NcSelect\");\n const _component_NcEmptyContent = resolveComponent(\"NcEmptyContent\");\n return openBlock(), createElementBlock(\"div\", {\n class: normalizeClass([\"smart-picker-search\", { \"with-empty-content\": $props.showEmptyContent }])\n }, [\n createVNode(_component_NcSelect, {\n ref: \"search-select\",\n modelValue: $data.selectedResult,\n \"onUpdate:modelValue\": [\n _cache[0] || (_cache[0] = ($event) => $data.selectedResult = $event),\n $options.onSelectResultSelected\n ],\n class: \"smart-picker-search--select\",\n \"input-id\": \"search-select-input\",\n label: \"name\",\n placeholder: $options.mySearchPlaceholder,\n options: $options.options,\n \"append-to-body\": false,\n \"close-on-select\": false,\n \"clear-search-on-select\": false,\n \"clear-search-on-blur\": () => false,\n \"reset-focus-on-options-change\": false,\n filterable: false,\n autoscroll: true,\n \"reset-on-options-change\": false,\n loading: $data.searching,\n onSearch: $options.onSearchInput\n }, {\n option: withCtx((option) => [\n option.isRawLink ? (openBlock(), createElementBlock(\"div\", _hoisted_1$2, [\n createVNode(_component_LinkVariantIcon, {\n class: \"option-simple-icon\",\n size: 20\n }),\n createElementVNode(\"span\", _hoisted_2$1, toDisplayString($options.t(\"Raw link {options}\", { options: option.resourceUrl })), 1)\n ])) : option.resourceUrl ? (openBlock(), createBlock(_component_NcSearchResult, {\n key: 1,\n class: \"search-result\",\n entry: option,\n query: $data.searchQuery\n }, null, 8, [\"entry\", \"query\"])) : option.isCustomGroupTitle ? (openBlock(), createElementBlock(\"span\", _hoisted_3, [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon group-name-icon\",\n src: $props.provider.icon_url\n }, null, 8, _hoisted_4)) : createCommentVNode(\"\", true),\n createElementVNode(\"span\", _hoisted_5, [\n createElementVNode(\"strong\", null, toDisplayString(option.name), 1)\n ])\n ])) : option.isMore ? (openBlock(), createElementBlock(\"span\", _hoisted_6, [\n option.isLoading ? (openBlock(), createElementBlock(\"span\", _hoisted_7)) : (openBlock(), createBlock(_component_DotsHorizontalIcon, {\n key: 1,\n class: \"option-simple-icon\",\n size: 20\n })),\n createElementVNode(\"span\", _hoisted_8, toDisplayString($options.t('Load more \"{options}\"', { options: option.name })), 1)\n ])) : createCommentVNode(\"\", true)\n ]),\n \"no-options\": withCtx(() => [\n createTextVNode(toDisplayString($data.noOptionsText), 1)\n ]),\n _: 1\n }, 8, [\"modelValue\", \"placeholder\", \"options\", \"loading\", \"onSearch\", \"onUpdate:modelValue\"]),\n $props.showEmptyContent ? (openBlock(), createBlock(_component_NcEmptyContent, {\n key: 0,\n class: \"smart-picker-search--empty-content\"\n }, {\n icon: withCtx(() => [\n $props.provider.icon_url ? (openBlock(), createElementBlock(\"img\", {\n key: 0,\n class: \"provider-icon\",\n alt: $data.providerIconAlt,\n src: $props.provider.icon_url\n }, null, 8, _hoisted_9)) : (openBlock(), createBlock(_component_LinkVariantIcon, { key: 1 }))\n ]),\n _: 1\n })) : createCommentVNode(\"\", true)\n ], 2);\n}\nconst NcSearch = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render$2], [\"__scopeId\", \"data-v-e8abf1d4\"]]);\nconst MODES = {\n providerList: 1,\n standardLinkInput: 2,\n searchInput: 3,\n customElement: 4\n};\nconst _sfc_main$1 = {\n name: \"NcReferencePicker\",\n components: {\n NcCustomPickerElement,\n NcProviderList,\n NcRawLinkInput,\n NcSearch\n },\n props: {\n /**\n * Provider to select on creation\n * Default: null. Show the provider list\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Optional width in pixels\n * Default: 100%\n */\n width: {\n type: Number,\n default: null\n },\n /**\n * Focus on the provider list select input on creation\n * Default: true\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"cancel\",\n \"cancelRawLink\",\n \"cancelSearch\",\n \"providerSelected\",\n \"submit\"\n ],\n data() {\n return {\n MODES,\n selectedProvider: this.initialProvider\n };\n },\n computed: {\n mode() {\n return this.selectedProvider === null ? MODES.providerList : isCustomPickerElementRegistered(this.selectedProvider.id) ? MODES.customElement : this.selectedProvider.search_providers_ids ? MODES.searchInput : MODES.standardLinkInput;\n },\n pickerWrapperStyle() {\n return {\n width: this.width ? this.width + \"px\" : void 0\n };\n }\n },\n mounted() {\n if (this.focusOnCreate) {\n if (this.initialProvider) {\n setTimeout(() => {\n this.$refs[\"url-input\"]?.focus();\n }, 300);\n } else {\n this.$nextTick(() => {\n this.$refs[\"provider-list\"]?.focus();\n });\n }\n }\n },\n methods: {\n onEscapePressed() {\n if (this.selectedProvider !== null) {\n this.deselectProvider();\n } else {\n this.cancelProviderSelection();\n }\n },\n onProviderSelected(provider) {\n this.selectedProvider = provider;\n this.$emit(\"providerSelected\", provider);\n this.$nextTick(() => {\n this.$refs[\"url-input\"]?.focus();\n });\n },\n cancelCustomElement() {\n this.deselectProvider();\n },\n cancelSearch() {\n this.$emit(\"cancelSearch\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelRawLinkInput() {\n this.$emit(\"cancelRawLink\", this.selectedProvider?.title);\n this.deselectProvider();\n },\n cancelProviderSelection() {\n this.$emit(\"cancel\");\n },\n submitLink(link) {\n if (this.selectedProvider !== null) {\n touchProvider(this.selectedProvider.id);\n }\n this.$emit(\"submit\", link);\n this.deselectProvider();\n },\n deselectProvider() {\n this.selectedProvider = null;\n this.$emit(\"providerSelected\", null);\n setTimeout(() => {\n this.$refs[\"provider-list\"]?.focus();\n }, 300);\n }\n }\n};\nconst _hoisted_1$1 = {\n key: 3,\n class: \"custom-element-wrapper\"\n};\nfunction _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcProviderList = resolveComponent(\"NcProviderList\");\n const _component_NcRawLinkInput = resolveComponent(\"NcRawLinkInput\");\n const _component_NcSearch = resolveComponent(\"NcSearch\");\n const _component_NcCustomPickerElement = resolveComponent(\"NcCustomPickerElement\");\n return openBlock(), createElementBlock(\"div\", {\n class: \"reference-picker\",\n style: normalizeStyle($options.pickerWrapperStyle),\n tabindex: \"-1\",\n onKeydown: _cache[0] || (_cache[0] = withKeys(withModifiers((...args) => $options.onEscapePressed && $options.onEscapePressed(...args), [\"stop\", \"prevent\"]), [\"esc\"]))\n }, [\n $options.mode === $data.MODES.providerList ? (openBlock(), createBlock(_component_NcProviderList, {\n key: 0,\n ref: \"provider-list\",\n onSelectProvider: $options.onProviderSelected,\n onSubmit: $options.submitLink,\n onCancel: $options.cancelProviderSelection\n }, null, 8, [\"onSelectProvider\", \"onSubmit\", \"onCancel\"])) : $options.mode === $data.MODES.standardLinkInput ? (openBlock(), createBlock(_component_NcRawLinkInput, {\n key: 1,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onSubmit: $options.submitLink,\n onCancel: $options.cancelRawLinkInput\n }, null, 8, [\"provider\", \"onSubmit\", \"onCancel\"])) : $options.mode === $data.MODES.searchInput ? (openBlock(), createBlock(_component_NcSearch, {\n key: 2,\n ref: \"url-input\",\n provider: $data.selectedProvider,\n onCancel: $options.cancelSearch,\n onSubmit: $options.submitLink\n }, null, 8, [\"provider\", \"onCancel\", \"onSubmit\"])) : $options.mode === $data.MODES.customElement ? (openBlock(), createElementBlock(\"div\", _hoisted_1$1, [\n createVNode(_component_NcCustomPickerElement, {\n provider: $data.selectedProvider,\n class: \"custom-element\",\n onSubmit: $options.submitLink,\n onCancel: $options.cancelCustomElement\n }, null, 8, [\"provider\", \"onSubmit\", \"onCancel\"])\n ])) : createCommentVNode(\"\", true)\n ], 36);\n}\nconst NcReferencePicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [[\"render\", _sfc_render$1], [\"__scopeId\", \"data-v-b193005a\"]]);\nregister(t12, t19);\nconst _sfc_main = {\n name: \"NcReferencePickerModal\",\n components: {\n NcReferencePicker,\n NcModal,\n NcButton,\n ArrowLeftIcon,\n CloseIcon: IconClose\n },\n props: {\n /**\n * Provider to select on creation\n * Show the provider list if no initial one is provided\n */\n initialProvider: {\n type: Object,\n default: () => null\n },\n /**\n * Focus on the input item on create\n */\n focusOnCreate: {\n type: Boolean,\n default: true\n },\n /**\n * If true, add the modal content to the Viewer trap elements via the event-bus\n */\n isInsideViewer: {\n type: Boolean,\n default: false\n }\n },\n emits: [\n \"cancel\",\n \"submit\"\n ],\n data() {\n return {\n show: true,\n selectedProvider: this.initialProvider,\n backButtonTitle: t(\"Back to provider selection\"),\n closeButtonTitle: t(\"Close\"),\n closeButtonLabel: t(\"Close Smart Picker\")\n };\n },\n computed: {\n isProviderSelected() {\n return this.selectedProvider !== null;\n },\n showBackButton() {\n return this.initialProvider === null && this.isProviderSelected;\n },\n modalSize() {\n return this.isProviderSelected && isCustomPickerElementRegistered(this.selectedProvider.id) ? getCustomPickerElementSize(this.selectedProvider.id) ?? \"large\" : \"normal\";\n },\n showModalName() {\n return !this.isProviderSelected || !isCustomPickerElementRegistered(this.selectedProvider.id);\n },\n modalName() {\n return this.isProviderSelected ? this.selectedProvider.title : t(\"Smart Picker\");\n }\n },\n mounted() {\n if (this.isInsideViewer) {\n const elem = this.$refs.modal_content;\n emit(\"viewer:trapElements:changed\", elem);\n }\n },\n methods: {\n onCancel() {\n this.show = false;\n this.$emit(\"cancel\");\n },\n onSubmit(value) {\n this.show = false;\n this.$emit(\"submit\", value);\n },\n onProviderSelect(provider) {\n this.selectedProvider = provider;\n if (provider === null && this.initialProvider !== null) {\n this.onCancel();\n }\n },\n onBackClicked() {\n this.$refs.referencePicker.deselectProvider();\n }\n }\n};\nconst _hoisted_1 = {\n ref: \"modal_content\",\n class: \"reference-picker-modal--content\"\n};\nconst _hoisted_2 = { key: 1 };\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_ArrowLeftIcon = resolveComponent(\"ArrowLeftIcon\");\n const _component_NcButton = resolveComponent(\"NcButton\");\n const _component_CloseIcon = resolveComponent(\"CloseIcon\");\n const _component_NcReferencePicker = resolveComponent(\"NcReferencePicker\");\n const _component_NcModal = resolveComponent(\"NcModal\");\n return $data.show ? (openBlock(), createBlock(_component_NcModal, {\n key: 0,\n size: $options.modalSize,\n class: \"reference-picker-modal\",\n onClose: $options.onCancel\n }, {\n default: withCtx(() => [\n createElementVNode(\"div\", _hoisted_1, [\n $options.showBackButton ? (openBlock(), createBlock(_component_NcButton, {\n key: 0,\n \"aria-label\": $data.backButtonTitle,\n title: $data.backButtonTitle,\n class: \"back-button\",\n onClick: $options.onBackClicked\n }, {\n icon: withCtx(() => [\n createVNode(_component_ArrowLeftIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"])) : createCommentVNode(\"\", true),\n createVNode(_component_NcButton, {\n class: \"close-button\",\n \"aria-label\": $data.closeButtonLabel,\n title: $data.closeButtonTitle,\n variant: \"tertiary\",\n onClick: $options.onCancel\n }, {\n icon: withCtx(() => [\n createVNode(_component_CloseIcon)\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]),\n $options.showModalName ? (openBlock(), createElementBlock(\"h2\", _hoisted_2, toDisplayString($options.modalName), 1)) : createCommentVNode(\"\", true),\n createVNode(_component_NcReferencePicker, {\n ref: \"referencePicker\",\n \"initial-provider\": $props.initialProvider,\n \"focus-on-create\": $props.focusOnCreate,\n onProviderSelected: $options.onProviderSelect,\n onSubmit: $options.onSubmit,\n onCancel: $options.onCancel\n }, null, 8, [\"initial-provider\", \"focus-on-create\", \"onProviderSelected\", \"onSubmit\", \"onCancel\"])\n ], 512)\n ]),\n _: 1\n }, 8, [\"size\", \"onClose\"])) : createCommentVNode(\"\", true);\n}\nconst NcReferencePickerModal = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-15018516\"]]);\nasync function getLinkWithPicker(providerId, isInsideViewer) {\n const modalId = \"referencePickerModal\";\n const modalElement = document.createElement(\"div\");\n modalElement.id = modalId;\n document.body.append(modalElement);\n const { promise, reject, resolve } = Promise.withResolvers();\n const initialProvider = providerId && getProvider(providerId) || null;\n const view = createApp(NcReferencePickerModal, {\n initialProvider,\n isInsideViewer,\n onCancel() {\n view.unmount();\n reject(new Error(\"User cancellation\"));\n },\n onSubmit(link) {\n view.unmount();\n resolve(link);\n }\n });\n view.mount(modalElement);\n return promise;\n}\nexport {\n NcReferencePicker as N,\n anyLinkProviderId as a,\n getProvider as b,\n getProviders as c,\n sortProviders as d,\n NcReferencePickerModal as e,\n NcReferenceWidget as f,\n getLinkWithPicker as g,\n NcSearch as h,\n searchProvider as s\n};\n//# sourceMappingURL=referencePickerModal-CXAtbcPd.mjs.map\n","import { d as mdiCheck, e as mdiContentCopy } from \"./mdi-CpchYUUV.mjs\";\nimport { ref, computed, toValue } from \"vue\";\nimport { r as register, e as t22, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nregister(t22);\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nconst DELAY = 2e3;\nfunction useCopy(content) {\n const isCopied = ref(false);\n const icon = computed(() => isCopied.value ? mdiCheck : mdiContentCopy);\n const altText = computed(() => isCopied.value ? t(\"Copied\") : t(\"Copy to clipboard\"));\n async function copy() {\n if (isCopied.value) {\n return;\n }\n const value = toValue(content);\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n prompt(\"\", value);\n }\n isCopied.value = true;\n setTimeout(() => {\n isCopied.value = false;\n }, DELAY);\n }\n return {\n isCopied,\n copy,\n icon,\n altText\n };\n}\nexport {\n useCopy as u\n};\n//# sourceMappingURL=useCopy-D4CcMqlA.mjs.map\n","import '../assets/NcRichText-RvICaxkO.css';\nimport rehypeExternalLinks from \"rehype-external-links\";\nimport rehype2react from \"rehype-react\";\nimport breaks from \"remark-breaks\";\nimport remarkParse from \"remark-parse\";\nimport remark2rehype from \"remark-rehype\";\nimport remarkUnlinkProtocols from \"remark-unlink-protocols\";\nimport { unified } from \"unified\";\nimport { resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, Fragment, renderList, createBlock, defineComponent, unref, withCtx, createVNode, ref, h } from \"vue\";\nimport { RouterLink } from \"vue-router\";\nimport { N as NcCheckboxRadioSwitch } from \"./NcCheckboxRadioSwitch-DisCqPZK.mjs\";\nimport { getCurrentUser } from \"@nextcloud/auth\";\nimport axios from \"@nextcloud/axios\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { getSharingToken } from \"@nextcloud/sharing/public\";\nimport { f as NcReferenceWidget } from \"./referencePickerModal-CXAtbcPd.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { U as URL_PATTERN, g as getRoute, p as parseUrl, r as remarkAutolink } from \"./autolink-U5pBzLgI.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nimport { N as NcButton } from \"./NcButton-CzpKEx4V.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { u as useCopy } from \"./useCopy-D4CcMqlA.mjs\";\nimport { c as createElementId } from \"./createElementId-DhjFt1I9.mjs\";\nimport { u } from \"unist-builder\";\nimport { visit, EXIT as EXIT$1, SKIP as SKIP$1 } from \"unist-util-visit\";\nconst _sfc_main$2 = {\n name: \"NcReferenceList\",\n components: {\n NcReferenceWidget\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n text: {\n type: String,\n default: \"\"\n },\n referenceData: {\n type: Array,\n default: null\n },\n limit: {\n type: Number,\n default: 1\n },\n displayFallback: {\n type: Boolean,\n default: false\n },\n interactive: {\n type: Boolean,\n default: true\n },\n interactiveOptIn: {\n type: Boolean,\n default: false\n }\n },\n emits: [\"loaded\"],\n data() {\n return {\n references: null,\n loading: true\n };\n },\n computed: {\n isVisible() {\n return this.loading || this.displayedReferences.length !== 0;\n },\n values() {\n if (this.referenceData) {\n return this.referenceData;\n }\n if (this.displayFallback && !this.loading && !this.references) {\n return [this.fallbackReference];\n }\n return this.references ? Object.values(this.references) : [];\n },\n firstReference() {\n return this.values[0] ?? null;\n },\n displayedReferences() {\n return this.values.filter(Boolean).slice(0, this.limit);\n },\n fallbackReference() {\n return {\n accessible: true,\n openGraphObject: {\n id: this.text,\n link: this.text,\n name: this.text\n },\n richObjectType: \"open-graph\"\n };\n }\n },\n watch: {\n text: \"fetch\"\n },\n mounted() {\n this.fetch();\n },\n methods: {\n fetch() {\n this.loading = true;\n if (this.referenceData) {\n this.references = null;\n this.loading = false;\n return;\n }\n if (!new RegExp(URL_PATTERN).exec(this.text)) {\n this.references = null;\n this.loading = false;\n return;\n }\n this.resolve().then((response) => {\n this.references = response.data.ocs.data.references;\n this.loading = false;\n this.$emit(\"loaded\");\n }).catch((error) => {\n logger.error(\"[NcReferenceList] Failed to extract references\", { error });\n this.loading = false;\n this.$emit(\"loaded\");\n });\n },\n resolve() {\n const match = new RegExp(URL_PATTERN).exec(this.text.trim());\n const isPublic = getCurrentUser() === null;\n if (this.limit === 1 && match) {\n return isPublic ? axios.get(generateOcsUrl(\"references/resolvePublic\") + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`) : axios.get(generateOcsUrl(\"references/resolve\") + `?reference=${encodeURIComponent(match[0])}`);\n }\n return isPublic ? axios.post(generateOcsUrl(\"references/extractPublic\"), {\n text: this.text,\n resolve: true,\n limit: this.limit,\n sharingToken: getSharingToken()\n }) : axios.post(generateOcsUrl(\"references/extract\"), {\n text: this.text,\n resolve: true,\n limit: this.limit\n });\n }\n }\n};\nfunction _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_NcReferenceWidget = resolveComponent(\"NcReferenceWidget\");\n return $options.isVisible ? (openBlock(), createElementBlock(\"div\", {\n key: 0,\n class: normalizeClass([\"widgets--list\", { \"icon-loading\": $data.loading }])\n }, [\n (openBlock(true), createElementBlock(Fragment, null, renderList($options.displayedReferences, (reference) => {\n return openBlock(), createBlock(_component_NcReferenceWidget, {\n key: reference.openGraphObject?.id,\n reference,\n interactive: $props.interactive,\n \"interactive-opt-in\": $props.interactiveOptIn\n }, null, 8, [\"reference\", \"interactive\", \"interactive-opt-in\"]);\n }), 128))\n ], 2)) : createCommentVNode(\"\", true);\n}\nconst NcReferenceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [[\"render\", _sfc_render], [\"__scopeId\", \"data-v-cd116174\"]]);\nfunction ccount(value, character) {\n const source = String(value);\n if (typeof character !== \"string\") {\n throw new TypeError(\"Expected character\");\n }\n let count = 0;\n let index = source.indexOf(character);\n while (index !== -1) {\n count++;\n index = source.indexOf(character, index + character.length);\n }\n return count;\n}\nfunction ok$1() {\n}\nconst asciiAlpha = regexCheck(/[A-Za-z]/);\nconst asciiAlphanumeric = regexCheck(/[\\dA-Za-z]/);\nfunction asciiControl(code2) {\n return (\n // Special whitespace codes (which have negative values), C0 and Control\n // character DEL\n code2 !== null && (code2 < 32 || code2 === 127)\n );\n}\nfunction markdownLineEnding(code2) {\n return code2 !== null && code2 < -2;\n}\nfunction markdownLineEndingOrSpace(code2) {\n return code2 !== null && (code2 < 0 || code2 === 32);\n}\nfunction markdownSpace(code2) {\n return code2 === -2 || code2 === -1 || code2 === 32;\n}\nconst unicodePunctuation = regexCheck(new RegExp(\"\\\\p{P}|\\\\p{S}\", \"u\"));\nconst unicodeWhitespace = regexCheck(/\\s/);\nfunction regexCheck(regex) {\n return check;\n function check(code2) {\n return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));\n }\n}\nfunction escapeStringRegexp(string) {\n if (typeof string !== \"string\") {\n throw new TypeError(\"Expected a string\");\n }\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n}\nconst convert = (\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n (function(test) {\n if (test === null || test === void 0) {\n return ok;\n }\n if (typeof test === \"function\") {\n return castFactory(test);\n }\n if (typeof test === \"object\") {\n return Array.isArray(test) ? anyFactory(test) : propsFactory(test);\n }\n if (typeof test === \"string\") {\n return typeFactory(test);\n }\n throw new Error(\"Expected function, string, or object as test\");\n })\n);\nfunction anyFactory(tests) {\n const checks = [];\n let index = -1;\n while (++index < tests.length) {\n checks[index] = convert(tests[index]);\n }\n return castFactory(any);\n function any(...parameters) {\n let index2 = -1;\n while (++index2 < checks.length) {\n if (checks[index2].apply(this, parameters)) return true;\n }\n return false;\n }\n}\nfunction propsFactory(check) {\n const checkAsRecord = (\n /** @type {Record} */\n check\n );\n return castFactory(all2);\n function all2(node2) {\n const nodeAsRecord = (\n /** @type {Record} */\n /** @type {unknown} */\n node2\n );\n let key;\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false;\n }\n return true;\n }\n}\nfunction typeFactory(check) {\n return castFactory(type);\n function type(node2) {\n return node2 && node2.type === check;\n }\n}\nfunction castFactory(testFunction) {\n return check;\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) && testFunction.call(\n this,\n value,\n typeof index === \"number\" ? index : void 0,\n parent || void 0\n )\n );\n }\n}\nfunction ok() {\n return true;\n}\nfunction looksLikeANode(value) {\n return value !== null && typeof value === \"object\" && \"type\" in value;\n}\nfunction color(d) {\n return d;\n}\nconst empty = [];\nconst CONTINUE = true;\nconst EXIT = false;\nconst SKIP = \"skip\";\nfunction visitParents(tree, test, visitor, reverse) {\n let check;\n {\n check = test;\n }\n const is = convert(check);\n const step = 1;\n factory(tree, void 0, [])();\n function factory(node2, index, parents) {\n const value = (\n /** @type {Record} */\n node2 && typeof node2 === \"object\" ? node2 : {}\n );\n if (typeof value.type === \"string\") {\n const name = (\n // `hast`\n typeof value.tagName === \"string\" ? value.tagName : (\n // `xast`\n typeof value.name === \"string\" ? value.name : void 0\n )\n );\n Object.defineProperty(visit2, \"name\", {\n value: \"node (\" + color(node2.type + (name ? \"<\" + name + \">\" : \"\")) + \")\"\n });\n }\n return visit2;\n function visit2() {\n let result = empty;\n let subresult;\n let offset;\n let grandparents;\n if (is(node2, index, parents[parents.length - 1] || void 0)) {\n result = toResult(visitor(node2, parents));\n if (result[0] === EXIT) {\n return result;\n }\n }\n if (\"children\" in node2 && node2.children) {\n const nodeAsParent = (\n /** @type {UnistParent} */\n node2\n );\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = -1 + step;\n grandparents = parents.concat(nodeAsParent);\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset];\n subresult = factory(child, offset, grandparents)();\n if (subresult[0] === EXIT) {\n return subresult;\n }\n offset = typeof subresult[1] === \"number\" ? subresult[1] : offset + step;\n }\n }\n }\n return result;\n }\n }\n}\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === \"number\") {\n return [CONTINUE, value];\n }\n return value === null || value === void 0 ? empty : [value];\n}\nfunction findAndReplace(tree, list2, options) {\n const settings = options || {};\n const ignored = convert(settings.ignore || []);\n const pairs = toPairs(list2);\n let pairIndex = -1;\n while (++pairIndex < pairs.length) {\n visitParents(tree, \"text\", visitor);\n }\n function visitor(node2, parents) {\n let index = -1;\n let grandparent;\n while (++index < parents.length) {\n const parent = parents[index];\n const siblings = grandparent ? grandparent.children : void 0;\n if (ignored(\n parent,\n siblings ? siblings.indexOf(parent) : void 0,\n grandparent\n )) {\n return;\n }\n grandparent = parent;\n }\n if (grandparent) {\n return handler(node2, parents);\n }\n }\n function handler(node2, parents) {\n const parent = parents[parents.length - 1];\n const find = pairs[pairIndex][0];\n const replace2 = pairs[pairIndex][1];\n let start = 0;\n const siblings = parent.children;\n const index = siblings.indexOf(node2);\n let change = false;\n let nodes = [];\n find.lastIndex = 0;\n let match = find.exec(node2.value);\n while (match) {\n const position = match.index;\n const matchObject = {\n index: match.index,\n input: match.input,\n stack: [...parents, node2]\n };\n let value = replace2(...match, matchObject);\n if (typeof value === \"string\") {\n value = value.length > 0 ? { type: \"text\", value } : void 0;\n }\n if (value === false) {\n find.lastIndex = position + 1;\n } else {\n if (start !== position) {\n nodes.push({\n type: \"text\",\n value: node2.value.slice(start, position)\n });\n }\n if (Array.isArray(value)) {\n nodes.push(...value);\n } else if (value) {\n nodes.push(value);\n }\n start = position + match[0].length;\n change = true;\n }\n if (!find.global) {\n break;\n }\n match = find.exec(node2.value);\n }\n if (change) {\n if (start < node2.value.length) {\n nodes.push({ type: \"text\", value: node2.value.slice(start) });\n }\n parent.children.splice(index, 1, ...nodes);\n } else {\n nodes = [node2];\n }\n return index + nodes.length;\n }\n}\nfunction toPairs(tupleOrList) {\n const result = [];\n if (!Array.isArray(tupleOrList)) {\n throw new TypeError(\"Expected find and replace tuple or list of tuples\");\n }\n const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];\n let index = -1;\n while (++index < list2.length) {\n const tuple = list2[index];\n result.push([toExpression(tuple[0]), toFunction(tuple[1])]);\n }\n return result;\n}\nfunction toExpression(find) {\n return typeof find === \"string\" ? new RegExp(escapeStringRegexp(find), \"g\") : find;\n}\nfunction toFunction(replace2) {\n return typeof replace2 === \"function\" ? replace2 : function() {\n return replace2;\n };\n}\nconst inConstruct = \"phrasing\";\nconst notInConstruct = [\"autolink\", \"link\", \"image\", \"label\"];\nfunction gfmAutolinkLiteralFromMarkdown() {\n return {\n transforms: [transformGfmAutolinkLiterals],\n enter: {\n literalAutolink: enterLiteralAutolink,\n literalAutolinkEmail: enterLiteralAutolinkValue,\n literalAutolinkHttp: enterLiteralAutolinkValue,\n literalAutolinkWww: enterLiteralAutolinkValue\n },\n exit: {\n literalAutolink: exitLiteralAutolink,\n literalAutolinkEmail: exitLiteralAutolinkEmail,\n literalAutolinkHttp: exitLiteralAutolinkHttp,\n literalAutolinkWww: exitLiteralAutolinkWww\n }\n };\n}\nfunction gfmAutolinkLiteralToMarkdown() {\n return {\n unsafe: [\n {\n character: \"@\",\n before: \"[+\\\\-.\\\\w]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \".\",\n before: \"[Ww]\",\n after: \"[\\\\-.\\\\w]\",\n inConstruct,\n notInConstruct\n },\n {\n character: \":\",\n before: \"[ps]\",\n after: \"\\\\/\",\n inConstruct,\n notInConstruct\n }\n ]\n };\n}\nfunction enterLiteralAutolink(token) {\n this.enter({ type: \"link\", title: null, url: \"\", children: [] }, token);\n}\nfunction enterLiteralAutolinkValue(token) {\n this.config.enter.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkHttp(token) {\n this.config.exit.autolinkProtocol.call(this, token);\n}\nfunction exitLiteralAutolinkWww(token) {\n this.config.exit.data.call(this, token);\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"link\");\n node2.url = \"http://\" + this.sliceSerialize(token);\n}\nfunction exitLiteralAutolinkEmail(token) {\n this.config.exit.autolinkEmail.call(this, token);\n}\nfunction exitLiteralAutolink(token) {\n this.exit(token);\n}\nfunction transformGfmAutolinkLiterals(tree) {\n findAndReplace(\n tree,\n [\n [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n [/([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/g, findEmail]\n ],\n { ignore: [\"link\", \"linkReference\"] }\n );\n}\nfunction findUrl(_, protocol, domain2, path2, match) {\n let prefix = \"\";\n if (!previous(match)) {\n return false;\n }\n if (/^w/i.test(protocol)) {\n domain2 = protocol + domain2;\n protocol = \"\";\n prefix = \"http://\";\n }\n if (!isCorrectDomain(domain2)) {\n return false;\n }\n const parts = splitUrl(domain2 + path2);\n if (!parts[0]) return false;\n const result = {\n type: \"link\",\n title: null,\n url: prefix + protocol + parts[0],\n children: [{ type: \"text\", value: protocol + parts[0] }]\n };\n if (parts[1]) {\n return [result, { type: \"text\", value: parts[1] }];\n }\n return result;\n}\nfunction findEmail(_, atext, label, match) {\n if (\n // Not an expected previous character.\n !previous(match, true) || // Label ends in not allowed character.\n /[-\\d_]$/.test(label)\n ) {\n return false;\n }\n return {\n type: \"link\",\n title: null,\n url: \"mailto:\" + atext + \"@\" + label,\n children: [{ type: \"text\", value: atext + \"@\" + label }]\n };\n}\nfunction isCorrectDomain(domain2) {\n const parts = domain2.split(\".\");\n if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\\d]/.test(parts[parts.length - 2]))) {\n return false;\n }\n return true;\n}\nfunction splitUrl(url) {\n const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url);\n if (!trailExec) {\n return [url, void 0];\n }\n url = url.slice(0, trailExec.index);\n let trail2 = trailExec[0];\n let closingParenIndex = trail2.indexOf(\")\");\n const openingParens = ccount(url, \"(\");\n let closingParens = ccount(url, \")\");\n while (closingParenIndex !== -1 && openingParens > closingParens) {\n url += trail2.slice(0, closingParenIndex + 1);\n trail2 = trail2.slice(closingParenIndex + 1);\n closingParenIndex = trail2.indexOf(\")\");\n closingParens++;\n }\n return [url, trail2];\n}\nfunction previous(match, email) {\n const code2 = match.input.charCodeAt(match.index - 1);\n return (match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2)) && (!email || code2 !== 47);\n}\nfunction normalizeIdentifier(value) {\n return value.replace(/[\\t\\n\\r ]+/g, \" \").replace(/^ | $/g, \"\").toLowerCase().toUpperCase();\n}\nfootnoteReference.peek = footnoteReferencePeek;\nfunction enterFootnoteCallString() {\n this.buffer();\n}\nfunction enterFootnoteCall(token) {\n this.enter({ type: \"footnoteReference\", identifier: \"\", label: \"\" }, token);\n}\nfunction enterFootnoteDefinitionLabelString() {\n this.buffer();\n}\nfunction enterFootnoteDefinition(token) {\n this.enter(\n { type: \"footnoteDefinition\", identifier: \"\", label: \"\", children: [] },\n token\n );\n}\nfunction exitFootnoteCallString(token) {\n const label = this.resume();\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"footnoteReference\");\n node2.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node2.label = label;\n}\nfunction exitFootnoteCall(token) {\n this.exit(token);\n}\nfunction exitFootnoteDefinitionLabelString(token) {\n const label = this.resume();\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"footnoteDefinition\");\n node2.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase();\n node2.label = label;\n}\nfunction exitFootnoteDefinition(token) {\n this.exit(token);\n}\nfunction footnoteReferencePeek() {\n return \"[\";\n}\nfunction footnoteReference(node2, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteReference\");\n const subexit = state.enter(\"reference\");\n value += tracker.move(\n state.safe(state.associationId(node2), { after: \"]\", before: value })\n );\n subexit();\n exit2();\n value += tracker.move(\"]\");\n return value;\n}\nfunction gfmFootnoteFromMarkdown() {\n return {\n enter: {\n gfmFootnoteCallString: enterFootnoteCallString,\n gfmFootnoteCall: enterFootnoteCall,\n gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: enterFootnoteDefinition\n },\n exit: {\n gfmFootnoteCallString: exitFootnoteCallString,\n gfmFootnoteCall: exitFootnoteCall,\n gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: exitFootnoteDefinition\n }\n };\n}\nfunction gfmFootnoteToMarkdown(options) {\n let firstLineBlank = false;\n if (options && options.firstLineBlank) {\n firstLineBlank = true;\n }\n return {\n handlers: { footnoteDefinition, footnoteReference },\n // This is on by default already.\n unsafe: [{ character: \"[\", inConstruct: [\"label\", \"phrasing\", \"reference\"] }]\n };\n function footnoteDefinition(node2, _, state, info) {\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[^\");\n const exit2 = state.enter(\"footnoteDefinition\");\n const subexit = state.enter(\"label\");\n value += tracker.move(\n state.safe(state.associationId(node2), { before: value, after: \"]\" })\n );\n subexit();\n value += tracker.move(\"]:\");\n if (node2.children && node2.children.length > 0) {\n tracker.shift(4);\n value += tracker.move(\n (firstLineBlank ? \"\\n\" : \" \") + state.indentLines(\n state.containerFlow(node2, tracker.current()),\n firstLineBlank ? mapAll : mapExceptFirst\n )\n );\n }\n exit2();\n return value;\n }\n}\nfunction mapExceptFirst(line, index, blank) {\n return index === 0 ? line : mapAll(line, index, blank);\n}\nfunction mapAll(line, index, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nconst constructsWithoutStrikethrough = [\n \"autolink\",\n \"destinationLiteral\",\n \"destinationRaw\",\n \"reference\",\n \"titleQuote\",\n \"titleApostrophe\"\n];\nhandleDelete.peek = peekDelete;\nfunction gfmStrikethroughFromMarkdown() {\n return {\n canContainEols: [\"delete\"],\n enter: { strikethrough: enterStrikethrough },\n exit: { strikethrough: exitStrikethrough }\n };\n}\nfunction gfmStrikethroughToMarkdown() {\n return {\n unsafe: [\n {\n character: \"~\",\n inConstruct: \"phrasing\",\n notInConstruct: constructsWithoutStrikethrough\n }\n ],\n handlers: { delete: handleDelete }\n };\n}\nfunction enterStrikethrough(token) {\n this.enter({ type: \"delete\", children: [] }, token);\n}\nfunction exitStrikethrough(token) {\n this.exit(token);\n}\nfunction handleDelete(node2, _, state, info) {\n const tracker = state.createTracker(info);\n const exit2 = state.enter(\"strikethrough\");\n let value = tracker.move(\"~~\");\n value += state.containerPhrasing(node2, {\n ...tracker.current(),\n before: value,\n after: \"~\"\n });\n value += tracker.move(\"~~\");\n exit2();\n return value;\n}\nfunction peekDelete() {\n return \"~\";\n}\nfunction defaultStringLength(value) {\n return value.length;\n}\nfunction markdownTable(table, options) {\n const settings = options || {};\n const align = (settings.align || []).concat();\n const stringLength = settings.stringLength || defaultStringLength;\n const alignments = [];\n const cellMatrix = [];\n const sizeMatrix = [];\n const longestCellByColumn = [];\n let mostCellsPerRow = 0;\n let rowIndex = -1;\n while (++rowIndex < table.length) {\n const row2 = [];\n const sizes2 = [];\n let columnIndex2 = -1;\n if (table[rowIndex].length > mostCellsPerRow) {\n mostCellsPerRow = table[rowIndex].length;\n }\n while (++columnIndex2 < table[rowIndex].length) {\n const cell = serialize(table[rowIndex][columnIndex2]);\n if (settings.alignDelimiters !== false) {\n const size = stringLength(cell);\n sizes2[columnIndex2] = size;\n if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {\n longestCellByColumn[columnIndex2] = size;\n }\n }\n row2.push(cell);\n }\n cellMatrix[rowIndex] = row2;\n sizeMatrix[rowIndex] = sizes2;\n }\n let columnIndex = -1;\n if (typeof align === \"object\" && \"length\" in align) {\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = toAlignment(align[columnIndex]);\n }\n } else {\n const code2 = toAlignment(align);\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = code2;\n }\n }\n columnIndex = -1;\n const row = [];\n const sizes = [];\n while (++columnIndex < mostCellsPerRow) {\n const code2 = alignments[columnIndex];\n let before = \"\";\n let after = \"\";\n if (code2 === 99) {\n before = \":\";\n after = \":\";\n } else if (code2 === 108) {\n before = \":\";\n } else if (code2 === 114) {\n after = \":\";\n }\n let size = settings.alignDelimiters === false ? 1 : Math.max(\n 1,\n longestCellByColumn[columnIndex] - before.length - after.length\n );\n const cell = before + \"-\".repeat(size) + after;\n if (settings.alignDelimiters !== false) {\n size = before.length + size + after.length;\n if (size > longestCellByColumn[columnIndex]) {\n longestCellByColumn[columnIndex] = size;\n }\n sizes[columnIndex] = size;\n }\n row[columnIndex] = cell;\n }\n cellMatrix.splice(1, 0, row);\n sizeMatrix.splice(1, 0, sizes);\n rowIndex = -1;\n const lines = [];\n while (++rowIndex < cellMatrix.length) {\n const row2 = cellMatrix[rowIndex];\n const sizes2 = sizeMatrix[rowIndex];\n columnIndex = -1;\n const line = [];\n while (++columnIndex < mostCellsPerRow) {\n const cell = row2[columnIndex] || \"\";\n let before = \"\";\n let after = \"\";\n if (settings.alignDelimiters !== false) {\n const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);\n const code2 = alignments[columnIndex];\n if (code2 === 114) {\n before = \" \".repeat(size);\n } else if (code2 === 99) {\n if (size % 2) {\n before = \" \".repeat(size / 2 + 0.5);\n after = \" \".repeat(size / 2 - 0.5);\n } else {\n before = \" \".repeat(size / 2);\n after = before;\n }\n } else {\n after = \" \".repeat(size);\n }\n }\n if (settings.delimiterStart !== false && !columnIndex) {\n line.push(\"|\");\n }\n if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is\n // empty: there will be a closing space.\n !(settings.alignDelimiters === false && cell === \"\") && (settings.delimiterStart !== false || columnIndex)) {\n line.push(\" \");\n }\n if (settings.alignDelimiters !== false) {\n line.push(before);\n }\n line.push(cell);\n if (settings.alignDelimiters !== false) {\n line.push(after);\n }\n if (settings.padding !== false) {\n line.push(\" \");\n }\n if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {\n line.push(\"|\");\n }\n }\n lines.push(\n settings.delimiterEnd === false ? line.join(\"\").replace(/ +$/, \"\") : line.join(\"\")\n );\n }\n return lines.join(\"\\n\");\n}\nfunction serialize(value) {\n return value === null || value === void 0 ? \"\" : String(value);\n}\nfunction toAlignment(value) {\n const code2 = typeof value === \"string\" ? value.codePointAt(0) : 0;\n return code2 === 67 || code2 === 99 ? 99 : code2 === 76 || code2 === 108 ? 108 : code2 === 82 || code2 === 114 ? 114 : 0;\n}\nfunction blockquote(node2, _, state, info) {\n const exit2 = state.enter(\"blockquote\");\n const tracker = state.createTracker(info);\n tracker.move(\"> \");\n tracker.shift(2);\n const value = state.indentLines(\n state.containerFlow(node2, tracker.current()),\n map$1\n );\n exit2();\n return value;\n}\nfunction map$1(line, _, blank) {\n return \">\" + (blank ? \"\" : \" \") + line;\n}\nfunction patternInScope(stack, pattern) {\n return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);\n}\nfunction listInScope(stack, list2, none) {\n if (typeof list2 === \"string\") {\n list2 = [list2];\n }\n if (!list2 || list2.length === 0) {\n return none;\n }\n let index = -1;\n while (++index < list2.length) {\n if (stack.includes(list2[index])) {\n return true;\n }\n }\n return false;\n}\nfunction hardBreak(_, _1, state, info) {\n let index = -1;\n while (++index < state.unsafe.length) {\n if (state.unsafe[index].character === \"\\n\" && patternInScope(state.stack, state.unsafe[index])) {\n return /[ \\t]/.test(info.before) ? \"\" : \" \";\n }\n }\n return \"\\\\\\n\";\n}\nfunction longestStreak(value, substring) {\n const source = String(value);\n let index = source.indexOf(substring);\n let expected = index;\n let count = 0;\n let max = 0;\n if (typeof substring !== \"string\") {\n throw new TypeError(\"Expected substring\");\n }\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count;\n }\n } else {\n count = 1;\n }\n expected = index + substring.length;\n index = source.indexOf(substring, expected);\n }\n return max;\n}\nfunction formatCodeAsIndented(node2, state) {\n return Boolean(\n state.options.fences === false && node2.value && // If there’s no info…\n !node2.lang && // And there’s a non-whitespace character…\n /[^ \\r\\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node2.value)\n );\n}\nfunction checkFence(state) {\n const marker = state.options.fence || \"`\";\n if (marker !== \"`\" && marker !== \"~\") {\n throw new Error(\n \"Cannot serialize code with `\" + marker + \"` for `options.fence`, expected `` ` `` or `~`\"\n );\n }\n return marker;\n}\nfunction code$1(node2, _, state, info) {\n const marker = checkFence(state);\n const raw = node2.value || \"\";\n const suffix = marker === \"`\" ? \"GraveAccent\" : \"Tilde\";\n if (formatCodeAsIndented(node2, state)) {\n const exit3 = state.enter(\"codeIndented\");\n const value2 = state.indentLines(raw, map);\n exit3();\n return value2;\n }\n const tracker = state.createTracker(info);\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));\n const exit2 = state.enter(\"codeFenced\");\n let value = tracker.move(sequence);\n if (node2.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`);\n value += tracker.move(\n state.safe(node2.lang, {\n before: value,\n after: \" \",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n if (node2.lang && node2.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`);\n value += tracker.move(\" \");\n value += tracker.move(\n state.safe(node2.meta, {\n before: value,\n after: \"\\n\",\n encode: [\"`\"],\n ...tracker.current()\n })\n );\n subexit();\n }\n value += tracker.move(\"\\n\");\n if (raw) {\n value += tracker.move(raw + \"\\n\");\n }\n value += tracker.move(sequence);\n exit2();\n return value;\n}\nfunction map(line, _, blank) {\n return (blank ? \"\" : \" \") + line;\n}\nfunction checkQuote(state) {\n const marker = state.options.quote || '\"';\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n \"Cannot serialize title with `\" + marker + \"` for `options.quote`, expected `\\\"`, or `'`\"\n );\n }\n return marker;\n}\nfunction definition(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"definition\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"]: \");\n subexit();\n if (\n // If there’s no url, or…\n !node2.url || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \"\\n\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n exit2();\n return value;\n}\nfunction checkEmphasis(state) {\n const marker = state.options.emphasis || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize emphasis with `\" + marker + \"` for `options.emphasis`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nfunction encodeCharacterReference(code2) {\n return \"&#x\" + code2.toString(16).toUpperCase() + \";\";\n}\nfunction classifyCharacter(code2) {\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return 1;\n }\n if (unicodePunctuation(code2)) {\n return 2;\n }\n}\nfunction encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside);\n const insideKind = classifyCharacter(inside);\n if (outsideKind === void 0) {\n return insideKind === void 0 ? (\n // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === \"_\" ? { inside: true, outside: true } : { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (letter, whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: encode outer (letter)\n { inside: false, outside: true }\n );\n }\n if (outsideKind === 1) {\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode both (whitespace).\n { inside: true, outside: true }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n }\n return insideKind === void 0 ? (\n // Letter inside: already forms.\n { inside: false, outside: false }\n ) : insideKind === 1 ? (\n // Whitespace inside: encode inner (whitespace).\n { inside: true, outside: false }\n ) : (\n // Punctuation inside: already forms.\n { inside: false, outside: false }\n );\n}\nemphasis.peek = emphasisPeek;\nfunction emphasis(node2, _, state, info) {\n const marker = checkEmphasis(state);\n const exit2 = state.enter(\"emphasis\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker);\n let between = tracker.move(\n state.containerPhrasing(node2, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || \"*\";\n}\nconst emptyOptions$1 = {};\nfunction toString(value, options) {\n const settings = emptyOptions$1;\n const includeImageAlt = typeof settings.includeImageAlt === \"boolean\" ? settings.includeImageAlt : true;\n const includeHtml = typeof settings.includeHtml === \"boolean\" ? settings.includeHtml : true;\n return one(value, includeImageAlt, includeHtml);\n}\nfunction one(value, includeImageAlt, includeHtml) {\n if (node(value)) {\n if (\"value\" in value) {\n return value.type === \"html\" && !includeHtml ? \"\" : value.value;\n }\n if (includeImageAlt && \"alt\" in value && value.alt) {\n return value.alt;\n }\n if (\"children\" in value) {\n return all(value.children, includeImageAlt, includeHtml);\n }\n }\n if (Array.isArray(value)) {\n return all(value, includeImageAlt, includeHtml);\n }\n return \"\";\n}\nfunction all(values, includeImageAlt, includeHtml) {\n const result = [];\n let index = -1;\n while (++index < values.length) {\n result[index] = one(values[index], includeImageAlt, includeHtml);\n }\n return result.join(\"\");\n}\nfunction node(value) {\n return Boolean(value && typeof value === \"object\");\n}\nfunction formatHeadingAsSetext(node2, state) {\n let literalWithBreak = false;\n visit(node2, function(node3) {\n if (\"value\" in node3 && /\\r?\\n|\\r/.test(node3.value) || node3.type === \"break\") {\n literalWithBreak = true;\n return EXIT$1;\n }\n });\n return Boolean(\n (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)\n );\n}\nfunction heading(node2, _, state, info) {\n const rank = Math.max(Math.min(6, node2.depth || 1), 1);\n const tracker = state.createTracker(info);\n if (formatHeadingAsSetext(node2, state)) {\n const exit3 = state.enter(\"headingSetext\");\n const subexit2 = state.enter(\"phrasing\");\n const value2 = state.containerPhrasing(node2, {\n ...tracker.current(),\n before: \"\\n\",\n after: \"\\n\"\n });\n subexit2();\n exit3();\n return value2 + \"\\n\" + (rank === 1 ? \"=\" : \"-\").repeat(\n // The whole size…\n value2.length - // Minus the position of the character after the last EOL (or\n // 0 if there is none)…\n (Math.max(value2.lastIndexOf(\"\\r\"), value2.lastIndexOf(\"\\n\")) + 1)\n );\n }\n const sequence = \"#\".repeat(rank);\n const exit2 = state.enter(\"headingAtx\");\n const subexit = state.enter(\"phrasing\");\n tracker.move(sequence + \" \");\n let value = state.containerPhrasing(node2, {\n before: \"# \",\n after: \"\\n\",\n ...tracker.current()\n });\n if (/^[\\t ]/.test(value)) {\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);\n }\n value = value ? sequence + \" \" + value : sequence;\n if (state.options.closeAtx) {\n value += \" \" + sequence;\n }\n subexit();\n exit2();\n return value;\n}\nhtml.peek = htmlPeek;\nfunction html(node2) {\n return node2.value || \"\";\n}\nfunction htmlPeek() {\n return \"<\";\n}\nimage.peek = imagePeek;\nfunction image(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const exit2 = state.enter(\"image\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n value += tracker.move(\n state.safe(node2.alt, { before: value, after: \"]\", ...tracker.current() })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node2.url && node2.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction imagePeek() {\n return \"!\";\n}\nimageReference.peek = imageReferencePeek;\nfunction imageReference(node2, _, state, info) {\n const type = node2.referenceType;\n const exit2 = state.enter(\"imageReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"![\");\n const alt = state.safe(node2.alt, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(alt + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !alt || alt !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction imageReferencePeek() {\n return \"!\";\n}\ninlineCode.peek = inlineCodePeek;\nfunction inlineCode(node2, _, state) {\n let value = node2.value || \"\";\n let sequence = \"`\";\n let index = -1;\n while (new RegExp(\"(^|[^`])\" + sequence + \"([^`]|$)\").test(value)) {\n sequence += \"`\";\n }\n if (/[^ \\r\\n]/.test(value) && (/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value) || /^`|`$/.test(value))) {\n value = \" \" + value + \" \";\n }\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index];\n const expression = state.compilePattern(pattern);\n let match;\n if (!pattern.atBreak) continue;\n while (match = expression.exec(value)) {\n let position = match.index;\n if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {\n position--;\n }\n value = value.slice(0, position) + \" \" + value.slice(match.index + 1);\n }\n }\n return sequence + value + sequence;\n}\nfunction inlineCodePeek() {\n return \"`\";\n}\nfunction formatLinkAsAutolink(node2, state) {\n const raw = toString(node2);\n return Boolean(\n !state.options.resourceLink && // If there’s a url…\n node2.url && // And there’s a no title…\n !node2.title && // And the content of `node` is a single text node…\n node2.children && node2.children.length === 1 && node2.children[0].type === \"text\" && // And if the url is the same as the content…\n (raw === node2.url || \"mailto:\" + raw === node2.url) && // And that starts w/ a protocol…\n /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and\n // references don’t work), space, or angle brackets…\n !/[\\0- <>\\u007F]/.test(node2.url)\n );\n}\nlink.peek = linkPeek;\nfunction link(node2, _, state, info) {\n const quote = checkQuote(state);\n const suffix = quote === '\"' ? \"Quote\" : \"Apostrophe\";\n const tracker = state.createTracker(info);\n let exit2;\n let subexit;\n if (formatLinkAsAutolink(node2, state)) {\n const stack = state.stack;\n state.stack = [];\n exit2 = state.enter(\"autolink\");\n let value2 = tracker.move(\"<\");\n value2 += tracker.move(\n state.containerPhrasing(node2, {\n before: value2,\n after: \">\",\n ...tracker.current()\n })\n );\n value2 += tracker.move(\">\");\n exit2();\n state.stack = stack;\n return value2;\n }\n exit2 = state.enter(\"link\");\n subexit = state.enter(\"label\");\n let value = tracker.move(\"[\");\n value += tracker.move(\n state.containerPhrasing(node2, {\n before: value,\n after: \"](\",\n ...tracker.current()\n })\n );\n value += tracker.move(\"](\");\n subexit();\n if (\n // If there’s no url but there is a title…\n !node2.url && node2.title || // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node2.url)\n ) {\n subexit = state.enter(\"destinationLiteral\");\n value += tracker.move(\"<\");\n value += tracker.move(\n state.safe(node2.url, { before: value, after: \">\", ...tracker.current() })\n );\n value += tracker.move(\">\");\n } else {\n subexit = state.enter(\"destinationRaw\");\n value += tracker.move(\n state.safe(node2.url, {\n before: value,\n after: node2.title ? \" \" : \")\",\n ...tracker.current()\n })\n );\n }\n subexit();\n if (node2.title) {\n subexit = state.enter(`title${suffix}`);\n value += tracker.move(\" \" + quote);\n value += tracker.move(\n state.safe(node2.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n );\n value += tracker.move(quote);\n subexit();\n }\n value += tracker.move(\")\");\n exit2();\n return value;\n}\nfunction linkPeek(node2, _, state) {\n return formatLinkAsAutolink(node2, state) ? \"<\" : \"[\";\n}\nlinkReference.peek = linkReferencePeek;\nfunction linkReference(node2, _, state, info) {\n const type = node2.referenceType;\n const exit2 = state.enter(\"linkReference\");\n let subexit = state.enter(\"label\");\n const tracker = state.createTracker(info);\n let value = tracker.move(\"[\");\n const text2 = state.containerPhrasing(node2, {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n value += tracker.move(text2 + \"][\");\n subexit();\n const stack = state.stack;\n state.stack = [];\n subexit = state.enter(\"reference\");\n const reference = state.safe(state.associationId(node2), {\n before: value,\n after: \"]\",\n ...tracker.current()\n });\n subexit();\n state.stack = stack;\n exit2();\n if (type === \"full\" || !text2 || text2 !== reference) {\n value += tracker.move(reference + \"]\");\n } else if (type === \"shortcut\") {\n value = value.slice(0, -1);\n } else {\n value += tracker.move(\"]\");\n }\n return value;\n}\nfunction linkReferencePeek() {\n return \"[\";\n}\nfunction checkBullet(state) {\n const marker = state.options.bullet || \"*\";\n if (marker !== \"*\" && marker !== \"+\" && marker !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bullet`, expected `*`, `+`, or `-`\"\n );\n }\n return marker;\n}\nfunction checkBulletOther(state) {\n const bullet = checkBullet(state);\n const bulletOther = state.options.bulletOther;\n if (!bulletOther) {\n return bullet === \"*\" ? \"-\" : \"*\";\n }\n if (bulletOther !== \"*\" && bulletOther !== \"+\" && bulletOther !== \"-\") {\n throw new Error(\n \"Cannot serialize items with `\" + bulletOther + \"` for `options.bulletOther`, expected `*`, `+`, or `-`\"\n );\n }\n if (bulletOther === bullet) {\n throw new Error(\n \"Expected `bullet` (`\" + bullet + \"`) and `bulletOther` (`\" + bulletOther + \"`) to be different\"\n );\n }\n return bulletOther;\n}\nfunction checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || \".\";\n if (marker !== \".\" && marker !== \")\") {\n throw new Error(\n \"Cannot serialize items with `\" + marker + \"` for `options.bulletOrdered`, expected `.` or `)`\"\n );\n }\n return marker;\n}\nfunction checkRule(state) {\n const marker = state.options.rule || \"*\";\n if (marker !== \"*\" && marker !== \"-\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize rules with `\" + marker + \"` for `options.rule`, expected `*`, `-`, or `_`\"\n );\n }\n return marker;\n}\nfunction list(node2, parent, state, info) {\n const exit2 = state.enter(\"list\");\n const bulletCurrent = state.bulletCurrent;\n let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);\n const bulletOther = node2.ordered ? bullet === \".\" ? \")\" : \".\" : checkBulletOther(state);\n let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;\n if (!node2.ordered) {\n const firstListItem = node2.children ? node2.children[0] : void 0;\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === \"*\" || bullet === \"-\") && // Empty first list item:\n firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:\n state.stack[state.stack.length - 1] === \"list\" && state.stack[state.stack.length - 2] === \"listItem\" && state.stack[state.stack.length - 3] === \"list\" && state.stack[state.stack.length - 4] === \"listItem\" && // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true;\n }\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1;\n while (++index < node2.children.length) {\n const item = node2.children[index];\n if (item && item.type === \"listItem\" && item.children && item.children[0] && item.children[0].type === \"thematicBreak\") {\n useDifferentMarker = true;\n break;\n }\n }\n }\n }\n if (useDifferentMarker) {\n bullet = bulletOther;\n }\n state.bulletCurrent = bullet;\n const value = state.containerFlow(node2, info);\n state.bulletLastUsed = bullet;\n state.bulletCurrent = bulletCurrent;\n exit2();\n return value;\n}\nfunction checkListItemIndent(state) {\n const style = state.options.listItemIndent || \"one\";\n if (style !== \"tab\" && style !== \"one\" && style !== \"mixed\") {\n throw new Error(\n \"Cannot serialize items with `\" + style + \"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`\"\n );\n }\n return style;\n}\nfunction listItem(node2, parent, state, info) {\n const listItemIndent = checkListItemIndent(state);\n let bullet = state.bulletCurrent || checkBullet(state);\n if (parent && parent.type === \"list\" && parent.ordered) {\n bullet = (typeof parent.start === \"number\" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;\n }\n let size = bullet.length + 1;\n if (listItemIndent === \"tab\" || listItemIndent === \"mixed\" && (parent && parent.type === \"list\" && parent.spread || node2.spread)) {\n size = Math.ceil(size / 4) * 4;\n }\n const tracker = state.createTracker(info);\n tracker.move(bullet + \" \".repeat(size - bullet.length));\n tracker.shift(size);\n const exit2 = state.enter(\"listItem\");\n const value = state.indentLines(\n state.containerFlow(node2, tracker.current()),\n map2\n );\n exit2();\n return value;\n function map2(line, index, blank) {\n if (index) {\n return (blank ? \"\" : \" \".repeat(size)) + line;\n }\n return (blank ? bullet : bullet + \" \".repeat(size - bullet.length)) + line;\n }\n}\nfunction paragraph(node2, _, state, info) {\n const exit2 = state.enter(\"paragraph\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node2, info);\n subexit();\n exit2();\n return value;\n}\nconst phrasing = (\n /** @type {(node?: unknown) => node is Exclude} */\n convert([\n \"break\",\n \"delete\",\n \"emphasis\",\n // To do: next major: removed since footnotes were added to GFM.\n \"footnote\",\n \"footnoteReference\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n // Enabled by `mdast-util-math`:\n \"inlineMath\",\n \"link\",\n \"linkReference\",\n // Enabled by `mdast-util-mdx`:\n \"mdxJsxTextElement\",\n // Enabled by `mdast-util-mdx`:\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n // Enabled by `mdast-util-directive`:\n \"textDirective\"\n ])\n);\nfunction root(node2, _, state, info) {\n const hasPhrasing = node2.children.some(function(d) {\n return phrasing(d);\n });\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;\n return container.call(state, node2, info);\n}\nfunction checkStrong(state) {\n const marker = state.options.strong || \"*\";\n if (marker !== \"*\" && marker !== \"_\") {\n throw new Error(\n \"Cannot serialize strong with `\" + marker + \"` for `options.strong`, expected `*`, or `_`\"\n );\n }\n return marker;\n}\nstrong.peek = strongPeek;\nfunction strong(node2, _, state, info) {\n const marker = checkStrong(state);\n const exit2 = state.enter(\"strong\");\n const tracker = state.createTracker(info);\n const before = tracker.move(marker + marker);\n let between = tracker.move(\n state.containerPhrasing(node2, {\n after: marker,\n before,\n ...tracker.current()\n })\n );\n const betweenHead = between.charCodeAt(0);\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n );\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1);\n }\n const betweenTail = between.charCodeAt(between.length - 1);\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail);\n }\n const after = tracker.move(marker + marker);\n exit2();\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n };\n return before + between + after;\n}\nfunction strongPeek(_, _1, state) {\n return state.options.strong || \"*\";\n}\nfunction text$1(node2, _, state, info) {\n return state.safe(node2.value, info);\n}\nfunction checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3;\n if (repetition < 3) {\n throw new Error(\n \"Cannot serialize rules with repetition `\" + repetition + \"` for `options.ruleRepetition`, expected `3` or more\"\n );\n }\n return repetition;\n}\nfunction thematicBreak(_, _1, state) {\n const value = (checkRule(state) + (state.options.ruleSpaces ? \" \" : \"\")).repeat(checkRuleRepetition(state));\n return state.options.ruleSpaces ? value.slice(0, -1) : value;\n}\nconst handle = {\n blockquote,\n break: hardBreak,\n code: code$1,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text: text$1,\n thematicBreak\n};\nfunction gfmTableFromMarkdown() {\n return {\n enter: {\n table: enterTable,\n tableData: enterCell,\n tableHeader: enterCell,\n tableRow: enterRow\n },\n exit: {\n codeText: exitCodeText,\n table: exitTable,\n tableData: exit,\n tableHeader: exit,\n tableRow: exit\n }\n };\n}\nfunction enterTable(token) {\n const align = token._align;\n this.enter(\n {\n type: \"table\",\n align: align.map(function(d) {\n return d === \"none\" ? null : d;\n }),\n children: []\n },\n token\n );\n this.data.inTable = true;\n}\nfunction exitTable(token) {\n this.exit(token);\n this.data.inTable = void 0;\n}\nfunction enterRow(token) {\n this.enter({ type: \"tableRow\", children: [] }, token);\n}\nfunction exit(token) {\n this.exit(token);\n}\nfunction enterCell(token) {\n this.enter({ type: \"tableCell\", children: [] }, token);\n}\nfunction exitCodeText(token) {\n let value = this.resume();\n if (this.data.inTable) {\n value = value.replace(/\\\\([\\\\|])/g, replace);\n }\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"inlineCode\");\n node2.value = value;\n this.exit(token);\n}\nfunction replace($0, $1) {\n return $1 === \"|\" ? $1 : $0;\n}\nfunction gfmTableToMarkdown(options) {\n const settings = options || {};\n const padding = settings.tableCellPadding;\n const alignDelimiters = settings.tablePipeAlign;\n const stringLength = settings.stringLength;\n const around = padding ? \" \" : \"|\";\n return {\n unsafe: [\n { character: \"\\r\", inConstruct: \"tableCell\" },\n { character: \"\\n\", inConstruct: \"tableCell\" },\n // A pipe, when followed by a tab or space (padding), or a dash or colon\n // (unpadded delimiter row), could result in a table.\n { atBreak: true, character: \"|\", after: \"[\t :-]\" },\n // A pipe in a cell must be encoded.\n { character: \"|\", inConstruct: \"tableCell\" },\n // A colon must be followed by a dash, in which case it could start a\n // delimiter row.\n { atBreak: true, character: \":\", after: \"-\" },\n // A delimiter row can also start with a dash, when followed by more\n // dashes, a colon, or a pipe.\n // This is a stricter version than the built in check for lists, thematic\n // breaks, and setex heading underlines though:\n // \n { atBreak: true, character: \"-\", after: \"[:|-]\" }\n ],\n handlers: {\n inlineCode: inlineCodeWithTable,\n table: handleTable,\n tableCell: handleTableCell,\n tableRow: handleTableRow\n }\n };\n function handleTable(node2, _, state, info) {\n return serializeData(handleTableAsData(node2, state, info), node2.align);\n }\n function handleTableRow(node2, _, state, info) {\n const row = handleTableRowAsData(node2, state, info);\n const value = serializeData([row]);\n return value.slice(0, value.indexOf(\"\\n\"));\n }\n function handleTableCell(node2, _, state, info) {\n const exit2 = state.enter(\"tableCell\");\n const subexit = state.enter(\"phrasing\");\n const value = state.containerPhrasing(node2, {\n ...info,\n before: around,\n after: around\n });\n subexit();\n exit2();\n return value;\n }\n function serializeData(matrix, align) {\n return markdownTable(matrix, {\n align,\n // @ts-expect-error: `markdown-table` types should support `null`.\n alignDelimiters,\n // @ts-expect-error: `markdown-table` types should support `null`.\n padding,\n // @ts-expect-error: `markdown-table` types should support `null`.\n stringLength\n });\n }\n function handleTableAsData(node2, state, info) {\n const children = node2.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"table\");\n while (++index < children.length) {\n result[index] = handleTableRowAsData(children[index], state, info);\n }\n subexit();\n return result;\n }\n function handleTableRowAsData(node2, state, info) {\n const children = node2.children;\n let index = -1;\n const result = [];\n const subexit = state.enter(\"tableRow\");\n while (++index < children.length) {\n result[index] = handleTableCell(children[index], node2, state, info);\n }\n subexit();\n return result;\n }\n function inlineCodeWithTable(node2, parent, state) {\n let value = handle.inlineCode(node2, parent, state);\n if (state.stack.includes(\"tableCell\")) {\n value = value.replace(/\\|/g, \"\\\\$&\");\n }\n return value;\n }\n}\nfunction gfmTaskListItemFromMarkdown() {\n return {\n exit: {\n taskListCheckValueChecked: exitCheck,\n taskListCheckValueUnchecked: exitCheck,\n paragraph: exitParagraphWithTaskListItem\n }\n };\n}\nfunction gfmTaskListItemToMarkdown() {\n return {\n unsafe: [{ atBreak: true, character: \"-\", after: \"[:|-]\" }],\n handlers: { listItem: listItemWithTaskListItem }\n };\n}\nfunction exitCheck(token) {\n const node2 = this.stack[this.stack.length - 2];\n ok$1(node2.type === \"listItem\");\n node2.checked = token.type === \"taskListCheckValueChecked\";\n}\nfunction exitParagraphWithTaskListItem(token) {\n const parent = this.stack[this.stack.length - 2];\n if (parent && parent.type === \"listItem\" && typeof parent.checked === \"boolean\") {\n const node2 = this.stack[this.stack.length - 1];\n ok$1(node2.type === \"paragraph\");\n const head = node2.children[0];\n if (head && head.type === \"text\") {\n const siblings = parent.children;\n let index = -1;\n let firstParaghraph;\n while (++index < siblings.length) {\n const sibling = siblings[index];\n if (sibling.type === \"paragraph\") {\n firstParaghraph = sibling;\n break;\n }\n }\n if (firstParaghraph === node2) {\n head.value = head.value.slice(1);\n if (head.value.length === 0) {\n node2.children.shift();\n } else if (node2.position && head.position && typeof head.position.start.offset === \"number\") {\n head.position.start.column++;\n head.position.start.offset++;\n node2.position.start = Object.assign({}, head.position.start);\n }\n }\n }\n }\n this.exit(token);\n}\nfunction listItemWithTaskListItem(node2, parent, state, info) {\n const head = node2.children[0];\n const checkable = typeof node2.checked === \"boolean\" && head && head.type === \"paragraph\";\n const checkbox = \"[\" + (node2.checked ? \"x\" : \" \") + \"] \";\n const tracker = state.createTracker(info);\n if (checkable) {\n tracker.move(checkbox);\n }\n let value = handle.listItem(node2, parent, state, {\n ...info,\n ...tracker.current()\n });\n if (checkable) {\n value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check);\n }\n return value;\n function check($0) {\n return $0 + checkbox;\n }\n}\nfunction gfmFromMarkdown() {\n return [\n gfmAutolinkLiteralFromMarkdown(),\n gfmFootnoteFromMarkdown(),\n gfmStrikethroughFromMarkdown(),\n gfmTableFromMarkdown(),\n gfmTaskListItemFromMarkdown()\n ];\n}\nfunction gfmToMarkdown(options) {\n return {\n extensions: [\n gfmAutolinkLiteralToMarkdown(),\n gfmFootnoteToMarkdown(options),\n gfmStrikethroughToMarkdown(),\n gfmTableToMarkdown(options),\n gfmTaskListItemToMarkdown()\n ]\n };\n}\nfunction splice(list2, start, remove, items) {\n const end = list2.length;\n let chunkStart = 0;\n let parameters;\n if (start < 0) {\n start = -start > end ? 0 : end + start;\n } else {\n start = start > end ? end : start;\n }\n remove = remove > 0 ? remove : 0;\n if (items.length < 1e4) {\n parameters = Array.from(items);\n parameters.unshift(start, remove);\n list2.splice(...parameters);\n } else {\n if (remove) list2.splice(start, remove);\n while (chunkStart < items.length) {\n parameters = items.slice(chunkStart, chunkStart + 1e4);\n parameters.unshift(start, 0);\n list2.splice(...parameters);\n chunkStart += 1e4;\n start += 1e4;\n }\n }\n}\nconst hasOwnProperty = {}.hasOwnProperty;\nfunction combineExtensions(extensions) {\n const all2 = {};\n let index = -1;\n while (++index < extensions.length) {\n syntaxExtension(all2, extensions[index]);\n }\n return all2;\n}\nfunction syntaxExtension(all2, extension) {\n let hook;\n for (hook in extension) {\n const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;\n const left = maybe || (all2[hook] = {});\n const right = extension[hook];\n let code2;\n if (right) {\n for (code2 in right) {\n if (!hasOwnProperty.call(left, code2)) left[code2] = [];\n const value = right[code2];\n constructs(\n // @ts-expect-error Looks like a list.\n left[code2],\n Array.isArray(value) ? value : value ? [value] : []\n );\n }\n }\n }\n}\nfunction constructs(existing, list2) {\n let index = -1;\n const before = [];\n while (++index < list2.length) {\n (list2[index].add === \"after\" ? existing : before).push(list2[index]);\n }\n splice(existing, 0, 0, before);\n}\nconst wwwPrefix = {\n tokenize: tokenizeWwwPrefix,\n partial: true\n};\nconst domain = {\n tokenize: tokenizeDomain,\n partial: true\n};\nconst path = {\n tokenize: tokenizePath,\n partial: true\n};\nconst trail = {\n tokenize: tokenizeTrail,\n partial: true\n};\nconst emailDomainDotTrail = {\n tokenize: tokenizeEmailDomainDotTrail,\n partial: true\n};\nconst wwwAutolink = {\n name: \"wwwAutolink\",\n tokenize: tokenizeWwwAutolink,\n previous: previousWww\n};\nconst protocolAutolink = {\n name: \"protocolAutolink\",\n tokenize: tokenizeProtocolAutolink,\n previous: previousProtocol\n};\nconst emailAutolink = {\n name: \"emailAutolink\",\n tokenize: tokenizeEmailAutolink,\n previous: previousEmail\n};\nconst text = {};\nfunction gfmAutolinkLiteral() {\n return {\n text\n };\n}\nlet code = 48;\nwhile (code < 123) {\n text[code] = emailAutolink;\n code++;\n if (code === 58) code = 65;\n else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\nfunction tokenizeEmailAutolink(effects, ok2, nok) {\n const self = this;\n let dot;\n let data;\n return start;\n function start(code2) {\n if (!gfmAtext(code2) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkEmail\");\n return atext(code2);\n }\n function atext(code2) {\n if (gfmAtext(code2)) {\n effects.consume(code2);\n return atext;\n }\n if (code2 === 64) {\n effects.consume(code2);\n return emailDomain;\n }\n return nok(code2);\n }\n function emailDomain(code2) {\n if (code2 === 46) {\n return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code2);\n }\n if (code2 === 45 || code2 === 95 || asciiAlphanumeric(code2)) {\n data = true;\n effects.consume(code2);\n return emailDomain;\n }\n return emailDomainAfter(code2);\n }\n function emailDomainDot(code2) {\n effects.consume(code2);\n dot = true;\n return emailDomain;\n }\n function emailDomainAfter(code2) {\n if (data && dot && asciiAlpha(self.previous)) {\n effects.exit(\"literalAutolinkEmail\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n return nok(code2);\n }\n}\nfunction tokenizeWwwAutolink(effects, ok2, nok) {\n const self = this;\n return wwwStart;\n function wwwStart(code2) {\n if (code2 !== 87 && code2 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code2);\n }\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkWww\");\n return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code2);\n }\n function wwwAfter(code2) {\n effects.exit(\"literalAutolinkWww\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeProtocolAutolink(effects, ok2, nok) {\n const self = this;\n let buffer = \"\";\n let seen = false;\n return protocolStart;\n function protocolStart(code2) {\n if ((code2 === 72 || code2 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n effects.enter(\"literalAutolink\");\n effects.enter(\"literalAutolinkHttp\");\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n return nok(code2);\n }\n function protocolPrefixInside(code2) {\n if (asciiAlpha(code2) && buffer.length < 5) {\n buffer += String.fromCodePoint(code2);\n effects.consume(code2);\n return protocolPrefixInside;\n }\n if (code2 === 58) {\n const protocol = buffer.toLowerCase();\n if (protocol === \"http\" || protocol === \"https\") {\n effects.consume(code2);\n return protocolSlashesInside;\n }\n }\n return nok(code2);\n }\n function protocolSlashesInside(code2) {\n if (code2 === 47) {\n effects.consume(code2);\n if (seen) {\n return afterProtocol;\n }\n seen = true;\n return protocolSlashesInside;\n }\n return nok(code2);\n }\n function afterProtocol(code2) {\n return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code2);\n }\n function protocolAfter(code2) {\n effects.exit(\"literalAutolinkHttp\");\n effects.exit(\"literalAutolink\");\n return ok2(code2);\n }\n}\nfunction tokenizeWwwPrefix(effects, ok2, nok) {\n let size = 0;\n return wwwPrefixInside;\n function wwwPrefixInside(code2) {\n if ((code2 === 87 || code2 === 119) && size < 3) {\n size++;\n effects.consume(code2);\n return wwwPrefixInside;\n }\n if (code2 === 46 && size === 3) {\n effects.consume(code2);\n return wwwPrefixAfter;\n }\n return nok(code2);\n }\n function wwwPrefixAfter(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction tokenizeDomain(effects, ok2, nok) {\n let underscoreInLastSegment;\n let underscoreInLastLastSegment;\n let seen;\n return domainInside;\n function domainInside(code2) {\n if (code2 === 46 || code2 === 95) {\n return effects.check(trail, domainAfter, domainAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {\n return domainAfter(code2);\n }\n seen = true;\n effects.consume(code2);\n return domainInside;\n }\n function domainAtPunctuation(code2) {\n if (code2 === 95) {\n underscoreInLastSegment = true;\n } else {\n underscoreInLastLastSegment = underscoreInLastSegment;\n underscoreInLastSegment = void 0;\n }\n effects.consume(code2);\n return domainInside;\n }\n function domainAfter(code2) {\n if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n return nok(code2);\n }\n return ok2(code2);\n }\n}\nfunction tokenizePath(effects, ok2) {\n let sizeOpen = 0;\n let sizeClose = 0;\n return pathInside;\n function pathInside(code2) {\n if (code2 === 40) {\n sizeOpen++;\n effects.consume(code2);\n return pathInside;\n }\n if (code2 === 41 && sizeClose < sizeOpen) {\n return pathAtPunctuation(code2);\n }\n if (code2 === 33 || code2 === 34 || code2 === 38 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 93 || code2 === 95 || code2 === 126) {\n return effects.check(trail, ok2, pathAtPunctuation)(code2);\n }\n if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n effects.consume(code2);\n return pathInside;\n }\n function pathAtPunctuation(code2) {\n if (code2 === 41) {\n sizeClose++;\n }\n effects.consume(code2);\n return pathInside;\n }\n}\nfunction tokenizeTrail(effects, ok2, nok) {\n return trail2;\n function trail2(code2) {\n if (code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 63 || code2 === 95 || code2 === 126) {\n effects.consume(code2);\n return trail2;\n }\n if (code2 === 38) {\n effects.consume(code2);\n return trailCharacterReferenceStart;\n }\n if (code2 === 93) {\n effects.consume(code2);\n return trailBracketAfter;\n }\n if (\n // `<` is an end.\n code2 === 60 || // So is whitespace.\n code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)\n ) {\n return ok2(code2);\n }\n return nok(code2);\n }\n function trailBracketAfter(code2) {\n if (code2 === null || code2 === 40 || code2 === 91 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {\n return ok2(code2);\n }\n return trail2(code2);\n }\n function trailCharacterReferenceStart(code2) {\n return asciiAlpha(code2) ? trailCharacterReferenceInside(code2) : nok(code2);\n }\n function trailCharacterReferenceInside(code2) {\n if (code2 === 59) {\n effects.consume(code2);\n return trail2;\n }\n if (asciiAlpha(code2)) {\n effects.consume(code2);\n return trailCharacterReferenceInside;\n }\n return nok(code2);\n }\n}\nfunction tokenizeEmailDomainDotTrail(effects, ok2, nok) {\n return start;\n function start(code2) {\n effects.consume(code2);\n return after;\n }\n function after(code2) {\n return asciiAlphanumeric(code2) ? nok(code2) : ok2(code2);\n }\n}\nfunction previousWww(code2) {\n return code2 === null || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 91 || code2 === 93 || code2 === 126 || markdownLineEndingOrSpace(code2);\n}\nfunction previousProtocol(code2) {\n return !asciiAlpha(code2);\n}\nfunction previousEmail(code2) {\n return !(code2 === 47 || gfmAtext(code2));\n}\nfunction gfmAtext(code2) {\n return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);\n}\nfunction previousUnbalanced(events) {\n let index = events.length;\n let result = false;\n while (index--) {\n const token = events[index][1];\n if ((token.type === \"labelLink\" || token.type === \"labelImage\") && !token._balanced) {\n result = true;\n break;\n }\n if (token._gfmAutolinkLiteralWalkedInto) {\n result = false;\n break;\n }\n }\n if (events.length > 0 && !result) {\n events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n }\n return result;\n}\nfunction resolveAll(constructs2, events, context) {\n const called = [];\n let index = -1;\n while (++index < constructs2.length) {\n const resolve = constructs2[index].resolveAll;\n if (resolve && !called.includes(resolve)) {\n events = resolve(events, context);\n called.push(resolve);\n }\n }\n return events;\n}\nfunction factorySpace(effects, ok2, type, max) {\n const limit = max ? max - 1 : Number.POSITIVE_INFINITY;\n let size = 0;\n return start;\n function start(code2) {\n if (markdownSpace(code2)) {\n effects.enter(type);\n return prefix(code2);\n }\n return ok2(code2);\n }\n function prefix(code2) {\n if (markdownSpace(code2) && size++ < limit) {\n effects.consume(code2);\n return prefix;\n }\n effects.exit(type);\n return ok2(code2);\n }\n}\nconst blankLine = {\n partial: true,\n tokenize: tokenizeBlankLine\n};\nfunction tokenizeBlankLine(effects, ok2, nok) {\n return start;\n function start(code2) {\n return markdownSpace(code2) ? factorySpace(effects, after, \"linePrefix\")(code2) : after(code2);\n }\n function after(code2) {\n return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);\n }\n}\nconst indent = {\n tokenize: tokenizeIndent,\n partial: true\n};\nfunction gfmFootnote() {\n return {\n document: {\n [91]: {\n name: \"gfmFootnoteDefinition\",\n tokenize: tokenizeDefinitionStart,\n continuation: {\n tokenize: tokenizeDefinitionContinuation\n },\n exit: gfmFootnoteDefinitionEnd\n }\n },\n text: {\n [91]: {\n name: \"gfmFootnoteCall\",\n tokenize: tokenizeGfmFootnoteCall\n },\n [93]: {\n name: \"gfmPotentialFootnoteCall\",\n add: \"after\",\n tokenize: tokenizePotentialGfmFootnoteCall,\n resolveTo: resolveToPotentialGfmFootnoteCall\n }\n }\n };\n}\nfunction tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n let index = self.events.length;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let labelStart;\n while (index--) {\n const token = self.events[index][1];\n if (token.type === \"labelImage\") {\n labelStart = token;\n break;\n }\n if (token.type === \"gfmFootnoteCall\" || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n break;\n }\n }\n return start;\n function start(code2) {\n if (!labelStart || !labelStart._balanced) {\n return nok(code2);\n }\n const id = normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n }));\n if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return ok2(code2);\n }\n}\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n let index = events.length;\n while (index--) {\n if (events[index][1].type === \"labelImage\" && events[index][0] === \"enter\") {\n events[index][1];\n break;\n }\n }\n events[index + 1][1].type = \"data\";\n events[index + 3][1].type = \"gfmFootnoteCallLabelMarker\";\n const call = {\n type: \"gfmFootnoteCall\",\n start: Object.assign({}, events[index + 3][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n };\n const marker = {\n type: \"gfmFootnoteCallMarker\",\n start: Object.assign({}, events[index + 3][1].end),\n end: Object.assign({}, events[index + 3][1].end)\n };\n marker.end.column++;\n marker.end.offset++;\n marker.end._bufferIndex++;\n const string = {\n type: \"gfmFootnoteCallString\",\n start: Object.assign({}, marker.end),\n end: Object.assign({}, events[events.length - 1][1].start)\n };\n const chunk = {\n type: \"chunkString\",\n contentType: \"string\",\n start: Object.assign({}, string.start),\n end: Object.assign({}, string.end)\n };\n const replacement = [\n // Take the `labelImageMarker` (now `data`, the `!`)\n events[index + 1],\n events[index + 2],\n [\"enter\", call, context],\n // The `[`\n events[index + 3],\n events[index + 4],\n // The `^`.\n [\"enter\", marker, context],\n [\"exit\", marker, context],\n // Everything in between.\n [\"enter\", string, context],\n [\"enter\", chunk, context],\n [\"exit\", chunk, context],\n [\"exit\", string, context],\n // The ending (`]`, properly parsed and labelled).\n events[events.length - 2],\n events[events.length - 1],\n [\"exit\", call, context]\n ];\n events.splice(index, events.length - index + 1, ...replacement);\n return events;\n}\nfunction tokenizeGfmFootnoteCall(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteCall\");\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n return callStart;\n }\n function callStart(code2) {\n if (code2 !== 94) return nok(code2);\n effects.enter(\"gfmFootnoteCallMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallMarker\");\n effects.enter(\"gfmFootnoteCallString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return callData;\n }\n function callData(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteCallString\");\n if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n return nok(code2);\n }\n effects.enter(\"gfmFootnoteCallLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteCallLabelMarker\");\n effects.exit(\"gfmFootnoteCall\");\n return ok2;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? callEscape : callData;\n }\n function callEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return callData;\n }\n return callData(code2);\n }\n}\nfunction tokenizeDefinitionStart(effects, ok2, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let identifier;\n let size = 0;\n let data;\n return start;\n function start(code2) {\n effects.enter(\"gfmFootnoteDefinition\")._container = true;\n effects.enter(\"gfmFootnoteDefinitionLabel\");\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n return labelAtMarker;\n }\n function labelAtMarker(code2) {\n if (code2 === 94) {\n effects.enter(\"gfmFootnoteDefinitionMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionMarker\");\n effects.enter(\"gfmFootnoteDefinitionLabelString\");\n effects.enter(\"chunkString\").contentType = \"string\";\n return labelInside;\n }\n return nok(code2);\n }\n function labelInside(code2) {\n if (\n // Too long.\n size > 999 || // Closing brace with nothing.\n code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)\n ) {\n return nok(code2);\n }\n if (code2 === 93) {\n effects.exit(\"chunkString\");\n const token = effects.exit(\"gfmFootnoteDefinitionLabelString\");\n identifier = normalizeIdentifier(self.sliceSerialize(token));\n effects.enter(\"gfmFootnoteDefinitionLabelMarker\");\n effects.consume(code2);\n effects.exit(\"gfmFootnoteDefinitionLabelMarker\");\n effects.exit(\"gfmFootnoteDefinitionLabel\");\n return labelAfter;\n }\n if (!markdownLineEndingOrSpace(code2)) {\n data = true;\n }\n size++;\n effects.consume(code2);\n return code2 === 92 ? labelEscape : labelInside;\n }\n function labelEscape(code2) {\n if (code2 === 91 || code2 === 92 || code2 === 93) {\n effects.consume(code2);\n size++;\n return labelInside;\n }\n return labelInside(code2);\n }\n function labelAfter(code2) {\n if (code2 === 58) {\n effects.enter(\"definitionMarker\");\n effects.consume(code2);\n effects.exit(\"definitionMarker\");\n if (!defined.includes(identifier)) {\n defined.push(identifier);\n }\n return factorySpace(effects, whitespaceAfter, \"gfmFootnoteDefinitionWhitespace\");\n }\n return nok(code2);\n }\n function whitespaceAfter(code2) {\n return ok2(code2);\n }\n}\nfunction tokenizeDefinitionContinuation(effects, ok2, nok) {\n return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));\n}\nfunction gfmFootnoteDefinitionEnd(effects) {\n effects.exit(\"gfmFootnoteDefinition\");\n}\nfunction tokenizeIndent(effects, ok2, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"gfmFootnoteDefinitionIndent\", 4 + 1);\n function afterPrefix(code2) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"gfmFootnoteDefinitionIndent\" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code2) : nok(code2);\n }\n}\nfunction gfmStrikethrough(options) {\n const options_ = options || {};\n let single = options_.singleTilde;\n const tokenizer = {\n name: \"strikethrough\",\n tokenize: tokenizeStrikethrough,\n resolveAll: resolveAllStrikethrough\n };\n if (single === null || single === void 0) {\n single = true;\n }\n return {\n text: {\n [126]: tokenizer\n },\n insideSpan: {\n null: [tokenizer]\n },\n attentionMarkers: {\n null: [126]\n }\n };\n function resolveAllStrikethrough(events, context) {\n let index = -1;\n while (++index < events.length) {\n if (events[index][0] === \"enter\" && events[index][1].type === \"strikethroughSequenceTemporary\" && events[index][1]._close) {\n let open = index;\n while (open--) {\n if (events[open][0] === \"exit\" && events[open][1].type === \"strikethroughSequenceTemporary\" && events[open][1]._open && // If the sizes are the same:\n events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n events[index][1].type = \"strikethroughSequence\";\n events[open][1].type = \"strikethroughSequence\";\n const strikethrough = {\n type: \"strikethrough\",\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[index][1].end)\n };\n const text2 = {\n type: \"strikethroughText\",\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n };\n const nextEvents = [[\"enter\", strikethrough, context], [\"enter\", events[open][1], context], [\"exit\", events[open][1], context], [\"enter\", text2, context]];\n const insideSpan = context.parser.constructs.insideSpan.null;\n if (insideSpan) {\n splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n }\n splice(nextEvents, nextEvents.length, 0, [[\"exit\", text2, context], [\"enter\", events[index][1], context], [\"exit\", events[index][1], context], [\"exit\", strikethrough, context]]);\n splice(events, open - 1, index - open + 3, nextEvents);\n index = open + nextEvents.length - 2;\n break;\n }\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n if (events[index][1].type === \"strikethroughSequenceTemporary\") {\n events[index][1].type = \"data\";\n }\n }\n return events;\n }\n function tokenizeStrikethrough(effects, ok2, nok) {\n const previous2 = this.previous;\n const events = this.events;\n let size = 0;\n return start;\n function start(code2) {\n if (previous2 === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n return nok(code2);\n }\n effects.enter(\"strikethroughSequenceTemporary\");\n return more(code2);\n }\n function more(code2) {\n const before = classifyCharacter(previous2);\n if (code2 === 126) {\n if (size > 1) return nok(code2);\n effects.consume(code2);\n size++;\n return more;\n }\n if (size < 2 && !single) return nok(code2);\n const token = effects.exit(\"strikethroughSequenceTemporary\");\n const after = classifyCharacter(code2);\n token._open = !after || after === 2 && Boolean(before);\n token._close = !before || before === 2 && Boolean(after);\n return ok2(code2);\n }\n }\n}\nclass EditMap {\n /**\n * Create a new edit map.\n */\n constructor() {\n this.map = [];\n }\n /**\n * Create an edit: a remove and/or add at a certain place.\n *\n * @param {number} index\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\n add(index, remove, add) {\n addImplementation(this, index, remove, add);\n }\n // To do: add this when moving to `micromark`.\n // /**\n // * Create an edit: but insert `add` before existing additions.\n // *\n // * @param {number} index\n // * @param {number} remove\n // * @param {Array} add\n // * @returns {undefined}\n // */\n // addBefore(index, remove, add) {\n // addImplementation(this, index, remove, add, true)\n // }\n /**\n * Done, change the events.\n *\n * @param {Array} events\n * @returns {undefined}\n */\n consume(events) {\n this.map.sort(function(a, b) {\n return a[0] - b[0];\n });\n if (this.map.length === 0) {\n return;\n }\n let index = this.map.length;\n const vecs = [];\n while (index > 0) {\n index -= 1;\n vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n events.length = this.map[index][0];\n }\n vecs.push(events.slice());\n events.length = 0;\n let slice = vecs.pop();\n while (slice) {\n for (const element of slice) {\n events.push(element);\n }\n slice = vecs.pop();\n }\n this.map.length = 0;\n }\n}\nfunction addImplementation(editMap, at, remove, add) {\n let index = 0;\n if (remove === 0 && add.length === 0) {\n return;\n }\n while (index < editMap.map.length) {\n if (editMap.map[index][0] === at) {\n editMap.map[index][1] += remove;\n editMap.map[index][2].push(...add);\n return;\n }\n index += 1;\n }\n editMap.map.push([at, remove, add]);\n}\nfunction gfmTableAlign(events, index) {\n let inDelimiterRow = false;\n const align = [];\n while (index < events.length) {\n const event = events[index];\n if (inDelimiterRow) {\n if (event[0] === \"enter\") {\n if (event[1].type === \"tableContent\") {\n align.push(events[index + 1][1].type === \"tableDelimiterMarker\" ? \"left\" : \"none\");\n }\n } else if (event[1].type === \"tableContent\") {\n if (events[index - 1][1].type === \"tableDelimiterMarker\") {\n const alignIndex = align.length - 1;\n align[alignIndex] = align[alignIndex] === \"left\" ? \"center\" : \"right\";\n }\n } else if (event[1].type === \"tableDelimiterRow\") {\n break;\n }\n } else if (event[0] === \"enter\" && event[1].type === \"tableDelimiterRow\") {\n inDelimiterRow = true;\n }\n index += 1;\n }\n return align;\n}\nfunction gfmTable() {\n return {\n flow: {\n null: {\n name: \"table\",\n tokenize: tokenizeTable,\n resolveAll: resolveTable\n }\n }\n };\n}\nfunction tokenizeTable(effects, ok2, nok) {\n const self = this;\n let size = 0;\n let sizeB = 0;\n let seen;\n return start;\n function start(code2) {\n let index = self.events.length - 1;\n while (index > -1) {\n const type = self.events[index][1].type;\n if (type === \"lineEnding\" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n type === \"linePrefix\") index--;\n else break;\n }\n const tail = index > -1 ? self.events[index][1].type : null;\n const next = tail === \"tableHead\" || tail === \"tableRow\" ? bodyRowStart : headRowBefore;\n if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n return next(code2);\n }\n function headRowBefore(code2) {\n effects.enter(\"tableHead\");\n effects.enter(\"tableRow\");\n return headRowStart(code2);\n }\n function headRowStart(code2) {\n if (code2 === 124) {\n return headRowBreak(code2);\n }\n seen = true;\n sizeB += 1;\n return headRowBreak(code2);\n }\n function headRowBreak(code2) {\n if (code2 === null) {\n return nok(code2);\n }\n if (markdownLineEnding(code2)) {\n if (sizeB > 1) {\n sizeB = 0;\n self.interrupt = true;\n effects.exit(\"tableRow\");\n effects.enter(\"lineEnding\");\n effects.consume(code2);\n effects.exit(\"lineEnding\");\n return headDelimiterStart;\n }\n return nok(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, headRowBreak, \"whitespace\")(code2);\n }\n sizeB += 1;\n if (seen) {\n seen = false;\n size += 1;\n }\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n seen = true;\n return headRowBreak;\n }\n effects.enter(\"data\");\n return headRowData(code2);\n }\n function headRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return headRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? headRowEscape : headRowData;\n }\n function headRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return headRowData;\n }\n return headRowData(code2);\n }\n function headDelimiterStart(code2) {\n self.interrupt = false;\n if (self.parser.lazy[self.now().line]) {\n return nok(code2);\n }\n effects.enter(\"tableDelimiterRow\");\n seen = false;\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes(\"codeIndented\") ? void 0 : 4)(code2);\n }\n return headDelimiterBefore(code2);\n }\n function headDelimiterBefore(code2) {\n if (code2 === 45 || code2 === 58) {\n return headDelimiterValueBefore(code2);\n }\n if (code2 === 124) {\n seen = true;\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return headDelimiterCellBefore;\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterCellBefore(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code2);\n }\n return headDelimiterValueBefore(code2);\n }\n function headDelimiterValueBefore(code2) {\n if (code2 === 58) {\n sizeB += 1;\n seen = true;\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterLeftAlignmentAfter;\n }\n if (code2 === 45) {\n sizeB += 1;\n return headDelimiterLeftAlignmentAfter(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n return headDelimiterCellAfter(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterLeftAlignmentAfter(code2) {\n if (code2 === 45) {\n effects.enter(\"tableDelimiterFiller\");\n return headDelimiterFiller(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterFiller(code2) {\n if (code2 === 45) {\n effects.consume(code2);\n return headDelimiterFiller;\n }\n if (code2 === 58) {\n seen = true;\n effects.exit(\"tableDelimiterFiller\");\n effects.enter(\"tableDelimiterMarker\");\n effects.consume(code2);\n effects.exit(\"tableDelimiterMarker\");\n return headDelimiterRightAlignmentAfter;\n }\n effects.exit(\"tableDelimiterFiller\");\n return headDelimiterRightAlignmentAfter(code2);\n }\n function headDelimiterRightAlignmentAfter(code2) {\n if (markdownSpace(code2)) {\n return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code2);\n }\n return headDelimiterCellAfter(code2);\n }\n function headDelimiterCellAfter(code2) {\n if (code2 === 124) {\n return headDelimiterBefore(code2);\n }\n if (code2 === null || markdownLineEnding(code2)) {\n if (!seen || size !== sizeB) {\n return headDelimiterNok(code2);\n }\n effects.exit(\"tableDelimiterRow\");\n effects.exit(\"tableHead\");\n return ok2(code2);\n }\n return headDelimiterNok(code2);\n }\n function headDelimiterNok(code2) {\n return nok(code2);\n }\n function bodyRowStart(code2) {\n effects.enter(\"tableRow\");\n return bodyRowBreak(code2);\n }\n function bodyRowBreak(code2) {\n if (code2 === 124) {\n effects.enter(\"tableCellDivider\");\n effects.consume(code2);\n effects.exit(\"tableCellDivider\");\n return bodyRowBreak;\n }\n if (code2 === null || markdownLineEnding(code2)) {\n effects.exit(\"tableRow\");\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return factorySpace(effects, bodyRowBreak, \"whitespace\")(code2);\n }\n effects.enter(\"data\");\n return bodyRowData(code2);\n }\n function bodyRowData(code2) {\n if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {\n effects.exit(\"data\");\n return bodyRowBreak(code2);\n }\n effects.consume(code2);\n return code2 === 92 ? bodyRowEscape : bodyRowData;\n }\n function bodyRowEscape(code2) {\n if (code2 === 92 || code2 === 124) {\n effects.consume(code2);\n return bodyRowData;\n }\n return bodyRowData(code2);\n }\n}\nfunction resolveTable(events, context) {\n let index = -1;\n let inFirstCellAwaitingPipe = true;\n let rowKind = 0;\n let lastCell = [0, 0, 0, 0];\n let cell = [0, 0, 0, 0];\n let afterHeadAwaitingFirstBodyRow = false;\n let lastTableEnd = 0;\n let currentTable;\n let currentBody;\n let currentCell;\n const map2 = new EditMap();\n while (++index < events.length) {\n const event = events[index];\n const token = event[1];\n if (event[0] === \"enter\") {\n if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = false;\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n currentBody = void 0;\n lastTableEnd = 0;\n }\n currentTable = {\n type: \"table\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentTable, context]]);\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n inFirstCellAwaitingPipe = true;\n currentCell = void 0;\n lastCell = [0, 0, 0, 0];\n cell = [0, index + 1, 0, 0];\n if (afterHeadAwaitingFirstBodyRow) {\n afterHeadAwaitingFirstBodyRow = false;\n currentBody = {\n type: \"tableBody\",\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map2.add(index, 0, [[\"enter\", currentBody, context]]);\n }\n rowKind = token.type === \"tableDelimiterRow\" ? 2 : currentBody ? 3 : 1;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n inFirstCellAwaitingPipe = false;\n if (cell[2] === 0) {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n lastCell = [0, 0, 0, 0];\n }\n cell[2] = index;\n }\n } else if (token.type === \"tableCellDivider\") {\n if (inFirstCellAwaitingPipe) {\n inFirstCellAwaitingPipe = false;\n } else {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);\n }\n lastCell = cell;\n cell = [lastCell[1], index, 0, 0];\n }\n }\n } else if (token.type === \"tableHead\") {\n afterHeadAwaitingFirstBodyRow = true;\n lastTableEnd = index;\n } else if (token.type === \"tableRow\" || token.type === \"tableDelimiterRow\") {\n lastTableEnd = index;\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map2, context, lastCell, rowKind, index, currentCell);\n } else if (cell[1] !== 0) {\n currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);\n }\n rowKind = 0;\n } else if (rowKind && (token.type === \"data\" || token.type === \"tableDelimiterMarker\" || token.type === \"tableDelimiterFiller\")) {\n cell[3] = index;\n }\n }\n if (lastTableEnd !== 0) {\n flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);\n }\n map2.consume(context.events);\n index = -1;\n while (++index < context.events.length) {\n const event = context.events[index];\n if (event[0] === \"enter\" && event[1].type === \"table\") {\n event[1]._align = gfmTableAlign(context.events, index);\n }\n }\n return events;\n}\nfunction flushCell(map2, context, range, rowKind, rowEnd, previousCell) {\n const groupName = rowKind === 1 ? \"tableHeader\" : rowKind === 2 ? \"tableDelimiter\" : \"tableData\";\n const valueName = \"tableContent\";\n if (range[0] !== 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n map2.add(range[0], 0, [[\"exit\", previousCell, context]]);\n }\n const now = getPoint(context.events, range[1]);\n previousCell = {\n type: groupName,\n start: Object.assign({}, now),\n // Note: correct end is set later.\n end: Object.assign({}, now)\n };\n map2.add(range[1], 0, [[\"enter\", previousCell, context]]);\n if (range[2] !== 0) {\n const relatedStart = getPoint(context.events, range[2]);\n const relatedEnd = getPoint(context.events, range[3]);\n const valueToken = {\n type: valueName,\n start: Object.assign({}, relatedStart),\n end: Object.assign({}, relatedEnd)\n };\n map2.add(range[2], 0, [[\"enter\", valueToken, context]]);\n if (rowKind !== 2) {\n const start = context.events[range[2]];\n const end = context.events[range[3]];\n start[1].end = Object.assign({}, end[1].end);\n start[1].type = \"chunkText\";\n start[1].contentType = \"text\";\n if (range[3] > range[2] + 1) {\n const a = range[2] + 1;\n const b = range[3] - range[2] - 1;\n map2.add(a, b, []);\n }\n }\n map2.add(range[3] + 1, 0, [[\"exit\", valueToken, context]]);\n }\n if (rowEnd !== void 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n map2.add(rowEnd, 0, [[\"exit\", previousCell, context]]);\n previousCell = void 0;\n }\n return previousCell;\n}\nfunction flushTableEnd(map2, context, index, table, tableBody) {\n const exits = [];\n const related = getPoint(context.events, index);\n if (tableBody) {\n tableBody.end = Object.assign({}, related);\n exits.push([\"exit\", tableBody, context]);\n }\n table.end = Object.assign({}, related);\n exits.push([\"exit\", table, context]);\n map2.add(index + 1, 0, exits);\n}\nfunction getPoint(events, index) {\n const event = events[index];\n const side = event[0] === \"enter\" ? \"start\" : \"end\";\n return event[1][side];\n}\nconst tasklistCheck = {\n name: \"tasklistCheck\",\n tokenize: tokenizeTasklistCheck\n};\nfunction gfmTaskListItem() {\n return {\n text: {\n [91]: tasklistCheck\n }\n };\n}\nfunction tokenizeTasklistCheck(effects, ok2, nok) {\n const self = this;\n return open;\n function open(code2) {\n if (\n // Exit if there’s stuff before.\n self.previous !== null || // Exit if not in the first content that is the first child of a list\n // item.\n !self._gfmTasklistFirstContentOfListItem\n ) {\n return nok(code2);\n }\n effects.enter(\"taskListCheck\");\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n return inside;\n }\n function inside(code2) {\n if (markdownLineEndingOrSpace(code2)) {\n effects.enter(\"taskListCheckValueUnchecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueUnchecked\");\n return close;\n }\n if (code2 === 88 || code2 === 120) {\n effects.enter(\"taskListCheckValueChecked\");\n effects.consume(code2);\n effects.exit(\"taskListCheckValueChecked\");\n return close;\n }\n return nok(code2);\n }\n function close(code2) {\n if (code2 === 93) {\n effects.enter(\"taskListCheckMarker\");\n effects.consume(code2);\n effects.exit(\"taskListCheckMarker\");\n effects.exit(\"taskListCheck\");\n return after;\n }\n return nok(code2);\n }\n function after(code2) {\n if (markdownLineEnding(code2)) {\n return ok2(code2);\n }\n if (markdownSpace(code2)) {\n return effects.check({\n tokenize: spaceThenNonSpace\n }, ok2, nok)(code2);\n }\n return nok(code2);\n }\n}\nfunction spaceThenNonSpace(effects, ok2, nok) {\n return factorySpace(effects, after, \"whitespace\");\n function after(code2) {\n return code2 === null ? nok(code2) : ok2(code2);\n }\n}\nfunction gfm(options) {\n return combineExtensions([\n gfmAutolinkLiteral(),\n gfmFootnote(),\n gfmStrikethrough(options),\n gfmTable(),\n gfmTaskListItem()\n ]);\n}\nconst emptyOptions = {};\nfunction remarkGfm(options) {\n const self = (\n /** @type {Processor} */\n this\n );\n const settings = options || emptyOptions;\n const data = self.data();\n const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);\n const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);\n const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);\n micromarkExtensions.push(gfm(settings));\n fromMarkdownExtensions.push(gfmFromMarkdown());\n toMarkdownExtensions.push(gfmToMarkdown(settings));\n}\nconst _sfc_main$1 = /* @__PURE__ */ defineComponent({\n __name: \"NcRichTextCopyButton\",\n props: {\n contentId: {}\n },\n setup(__props) {\n const { copy, icon, altText } = useCopy(() => document.getElementById(__props.contentId).textContent);\n return (_ctx, _cache) => {\n return openBlock(), createBlock(NcButton, {\n variant: \"tertiary\",\n size: \"small\",\n \"aria-label\": unref(altText),\n title: unref(altText),\n onClick: unref(copy)\n }, {\n icon: withCtx(() => [\n createVNode(NcIconSvgWrapper, {\n path: unref(icon),\n inline: \"\"\n }, null, 8, [\"path\"])\n ]),\n _: 1\n }, 8, [\"aria-label\", \"title\", \"onClick\"]);\n };\n }\n});\n/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode$1(node2) {\n return node2.type === \"text\";\n}\nconst transformPlaceholders = function(ast) {\n visit(ast, isTextNode$1, visitor);\n function visitor(node2, index, parent) {\n const placeholders = node2.value.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return u(\"text\", entry);\n }\n const [, component] = matches;\n return u(\"element\", {\n tagName: `#${component}`,\n children: []\n });\n });\n parent.children.splice(index, 1, ...placeholders);\n }\n};\nconst remarkPlaceholder = () => transformPlaceholders;\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nfunction isTextNode(node2) {\n return [\"text\", \"code\", \"inlineCode\"].includes(node2.type);\n}\nconst remarkUnescape = function() {\n return function(tree) {\n visit(tree, isTextNode, (node2, index, parent) => {\n parent.children.splice(index, 1, {\n ...node2,\n value: node2.value.replace(/</gmi, \"<\").replace(/>/gmi, \">\")\n });\n return [SKIP$1, index + 1];\n });\n };\n};\nconst LINK_PROTOCOLS = [\"http\", \"https\", \"mailto\", \"tel\"];\nconst rehypeHighlight = ref(null);\nasync function importRehypeHighlightLibrary() {\n const module = await import(\"rehype-highlight\");\n rehypeHighlight.value = module.default;\n}\nconst _sfc_main = {\n name: \"NcRichText\",\n components: {\n NcReferenceList\n },\n /* eslint vue/require-prop-comment: warn -- TODO: Add a proper doc block about what this props do */\n props: {\n /**\n * The main text\n */\n text: {\n type: String,\n default: \"\"\n },\n arguments: {\n type: Object,\n default: () => {\n return {};\n }\n },\n referenceLimit: {\n type: Number,\n default: 0\n },\n referenceInteractive: {\n type: Boolean,\n default: true\n },\n referenceInteractiveOptIn: {\n type: Boolean,\n default: false\n },\n /** Provide data upfront to avoid extra http request */\n references: {\n type: Array,\n default: null\n },\n /** Provide basic Markdown syntax */\n useMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide GitHub Flavored Markdown syntax */\n useExtendedMarkdown: {\n type: Boolean,\n default: false\n },\n /** Provide event from rendered markdown inputs */\n interactive: {\n type: Boolean,\n default: false\n },\n /**\n * Automatically convert link-like text to markdown links\n */\n autolink: {\n type: Boolean,\n default: true\n }\n },\n emits: [\n \"interactTodo\"\n ],\n data() {\n return {\n parentId: createElementId()\n };\n },\n methods: {\n renderPlaintext() {\n const placeholders = this.text.split(/(\\{[a-z\\-_.0-9]+\\})/ig).map((entry) => {\n const matches = entry.match(/^\\{([a-z\\-_.0-9]+)\\}$/i);\n if (!matches) {\n return this.prepareTextNode(entry);\n }\n const argumentId = matches[1];\n const argument = this.arguments[argumentId];\n if (typeof argument === \"object\") {\n const { component, props } = argument;\n return h(typeof component === \"string\" ? resolveComponent(component) : component, {\n ...props,\n class: \"rich-text--component\"\n });\n }\n if (argument) {\n return h(\"span\", { class: \"rich-text--fallback\" }, argument);\n }\n return entry;\n });\n return h(\"div\", { class: \"rich-text--wrapper\" }, [\n h(\"div\", {}, placeholders.flat()),\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n renderMarkdown() {\n const renderedMarkdown = unified().use(remarkParse).use(remarkAutolink, {\n autolink: this.autolink,\n useMarkdown: this.useMarkdown,\n useExtendedMarkdown: this.useExtendedMarkdown\n }).use(remarkUnescape).use(this.useExtendedMarkdown ? remarkGfm : void 0).use(breaks).use(remarkUnlinkProtocols, { except: LINK_PROTOCOLS }).use(remark2rehype, {\n handlers: {\n component(toHast, node2) {\n return toHast(node2, node2.component, { value: node2.value });\n }\n }\n }).use(this.useExtendedMarkdown ? rehypeHighlight.value : void 0).use(remarkPlaceholder).use(rehypeExternalLinks, {\n target: \"_blank\",\n rel: [\"noopener noreferrer\"]\n }).use(rehype2react, {\n Fragment,\n jsx: this.createElement,\n jsxs: this.createElement,\n elementAttributeNameCase: \"html\",\n prefix: false\n }).processSync(this.text.replace(/<[^>]+>/g, (match) => match.replace(/\")).result;\n return h(\"div\", { class: \"rich-text--wrapper rich-text--wrapper-markdown\" }, [\n renderedMarkdown,\n this.referenceLimit > 0 ? h(\"div\", { class: \"rich-text--reference-widget\" }, [\n h(NcReferenceList, {\n text: this.text,\n referenceData: this.references,\n interactive: this.referenceInteractive,\n interactiveOptIn: this.referenceInteractiveOptIn\n })\n ]) : null\n ]);\n },\n /**\n * Render plain text nodes\n *\n * @param {string} text - Content of the node\n */\n prepareTextNode(text2) {\n if (this.autolink) {\n text2 = parseUrl(text2);\n }\n if (Array.isArray(text2)) {\n return text2.map((entry) => {\n if (typeof entry === \"string\") {\n return entry;\n }\n const { component, props } = entry;\n const componentClass = component.name === \"NcLink\" ? void 0 : \"rich-text--component\";\n return h(component, {\n ...props,\n class: componentClass\n });\n });\n }\n return text2;\n },\n createElement(type, props, key) {\n if (key) {\n props.key = key;\n }\n const children = props.children ?? [];\n delete props.children;\n if (!String(type).startsWith(\"#\")) {\n if ([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"].includes(String(type))) {\n type = `h${Math.min(+String(type)[1] + 3, 6)}`;\n }\n let nestedNode = null;\n if (this.useExtendedMarkdown) {\n if (String(type) === \"code\" && !rehypeHighlight.value && props?.class?.includes(\"language\")) {\n importRehypeHighlightLibrary();\n }\n if (String(type) === \"pre\" && children && String(children.type) === \"code\") {\n const id = this.parentId + \"-code-block-\" + createElementId();\n return h(\"p\", { class: \"rich-text__code-block\" }, [\n h(type, { ...props, id }, children),\n h(_sfc_main$1, { class: \"rich-text__code-block-button\", contentId: id })\n ]);\n }\n if (String(type) === \"li\" && Array.isArray(children) && children.length !== 0 && children[0].type === \"input\" && children[0].props.type === \"checkbox\") {\n const [inputNode, , ...labelParts] = children;\n const nestedNodeIndex = labelParts.findIndex((child) => [\"ul\", \"ol\", \"li\", \"blockquote\", \"pre\"].includes(child.type));\n if (nestedNodeIndex !== -1) {\n nestedNode = labelParts[nestedNodeIndex];\n labelParts.splice(nestedNodeIndex);\n }\n const id = this.parentId + \"-markdown-input-\" + createElementId();\n const propsToForward = { ...inputNode.props };\n delete propsToForward.checked;\n const inputComponent = h(NcCheckboxRadioSwitch, {\n ...propsToForward,\n modelValue: inputNode.props.checked,\n id,\n disabled: !this.interactive,\n \"onUpdate:modelValue\": () => {\n this.$emit(\"interactTodo\", id);\n }\n }, { default: () => labelParts });\n return h(type, props, [inputComponent, nestedNode]);\n }\n }\n if (String(type) === \"a\") {\n const route = getRoute(this.$router, props.href);\n if (route) {\n delete props.href;\n delete props.target;\n return h(RouterLink, {\n ...props,\n to: route\n }, { default: () => children });\n }\n }\n return h(type, props, children);\n }\n const placeholder = this.arguments[type.slice(1)];\n if (!placeholder) {\n return h(\"span\", { ...props, class: \"rich-text--fallback\" }, [`{${type.slice(1)}}`]);\n }\n if (!placeholder.component) {\n return h(\"span\", { ...props }, [placeholder]);\n }\n return h(\n typeof placeholder.component === \"string\" ? resolveComponent(placeholder.component) : placeholder.component,\n {\n ...props,\n ...placeholder.props,\n class: \"rich-text--component\"\n },\n { default: () => children }\n );\n }\n },\n render() {\n return this.useMarkdown || this.useExtendedMarkdown ? this.renderMarkdown() : this.renderPlaintext();\n }\n};\nconst NcRichText = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-a47e4ba7\"]]);\nexport {\n NcRichText as N,\n NcReferenceList as a\n};\n//# sourceMappingURL=NcRichText-1U5RXjPL.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n\n\n","\n\n\n\n\n","import { defaultWindow, isClient, onClickOutside, onKeyStroke, onLongPress, useActiveElement, useBattery, useBrowserLocation, useClipboard, useColorMode, useDark, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDocumentVisibility, useDraggable, useElementBounding, useElementHover, useElementSize, useElementVisibility, useEyeDropper, useFullscreen, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useMouse, useMouseInElement, useMousePressed, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, usePointer, usePointerLock, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePreferredReducedTransparency, useResizeObserver, useScreenSafeArea, useScroll, useScrollLock, useStorage, useTimeAgo, useTimestamp, useVirtualList, useWindowFocus, useWindowSize } from \"@vueuse/core\";\nimport { computed, defineComponent, h, reactive, shallowRef, toRefs, toValue, watch } from \"vue\";\nimport { reactiveOmit, toRefs as toRefs$1, useToggle } from \"@vueuse/shared\";\n\n//#region ../core/onClickOutside/component.ts\nconst OnClickOutside = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tonClickOutside(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default());\n\t};\n}, {\n\tname: \"OnClickOutside\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n\n//#endregion\n//#region ../core/onClickOutside/directive.ts\nconst stopClickOutsideMap = /* @__PURE__ */ new WeakMap();\nconst vOnClickOutside = {\n\tmounted(el, binding) {\n\t\tconst capture = !binding.modifiers.bubble;\n\t\tlet stop;\n\t\tif (typeof binding.value === \"function\") stop = onClickOutside(el, binding.value, { capture });\n\t\telse {\n\t\t\tconst [handler, options] = binding.value;\n\t\t\tstop = onClickOutside(el, handler, Object.assign({ capture }, options));\n\t\t}\n\t\tstopClickOutsideMap.set(el, stop);\n\t},\n\tunmounted(el) {\n\t\tconst stop = stopClickOutsideMap.get(el);\n\t\tif (stop && typeof stop === \"function\") stop();\n\t\telse stop === null || stop === void 0 || stop.stop();\n\t\tstopClickOutsideMap.delete(el);\n\t}\n};\n/** @deprecated use `vOnClickOutside` instead */\nconst VOnClickOutside = vOnClickOutside;\n\n//#endregion\n//#region ../core/onKeyStroke/directive.ts\nconst vOnKeyStroke = { mounted(el, binding) {\n\tvar _binding$arg$split, _binding$arg;\n\tconst keys = (_binding$arg$split = (_binding$arg = binding.arg) === null || _binding$arg === void 0 ? void 0 : _binding$arg.split(\",\")) !== null && _binding$arg$split !== void 0 ? _binding$arg$split : true;\n\tif (typeof binding.value === \"function\") onKeyStroke(keys, binding.value, { target: el });\n\telse {\n\t\tconst [handler, options] = binding.value;\n\t\tonKeyStroke(keys, handler, {\n\t\t\ttarget: el,\n\t\t\t...options\n\t\t});\n\t}\n} };\n\n//#endregion\n//#region ../core/onLongPress/component.ts\nconst OnLongPress = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst target = shallowRef();\n\tconst data = onLongPress(target, (e) => {\n\t\temit(\"trigger\", e);\n\t}, props.options);\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"OnLongPress\",\n\tprops: [\"as\", \"options\"],\n\temits: [\"trigger\"]\n});\n\n//#endregion\n//#region ../core/onLongPress/directive.ts\nconst vOnLongPress = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") onLongPress(el, binding.value, { modifiers: binding.modifiers });\n\telse onLongPress(el, ...binding.value);\n} };\n/** @deprecated use `vOnLongPress` instead */\nconst VOnLongPress = vOnLongPress;\n\n//#endregion\n//#region ../core/useActiveElement/component.ts\nconst UseActiveElement = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ element: useActiveElement(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseActiveElement\",\n\tprops: [\n\t\t\"deep\",\n\t\t\"triggerOnRemoval\",\n\t\t\"window\",\n\t\t\"document\"\n\t]\n});\n\n//#endregion\n//#region ../core/useBattery/component.ts\nconst UseBattery = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBattery(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBattery\",\n\tprops: [\"navigator\"]\n});\n\n//#endregion\n//#region ../core/useBrowserLocation/component.ts\nconst UseBrowserLocation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useBrowserLocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseBrowserLocation\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useClipboard/component.ts\nconst UseClipboard = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useClipboard(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseClipboard\",\n\tprops: [\n\t\t\"source\",\n\t\t\"read\",\n\t\t\"navigator\",\n\t\t\"copiedDuring\",\n\t\t\"legacy\"\n\t]\n});\n\n//#endregion\n//#region ../core/useColorMode/component.ts\nconst UseColorMode = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst mode = useColorMode(props);\n\tconst data = reactive({\n\t\tmode,\n\t\tsystem: mode.system,\n\t\tstore: mode.store\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseColorMode\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"modes\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDark/component.ts\nconst UseDark = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst isDark = useDark(props);\n\tconst data = reactive({\n\t\tisDark,\n\t\ttoggleDark: useToggle(isDark)\n\t});\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDark\",\n\tprops: [\n\t\t\"attribute\",\n\t\t\"deep\",\n\t\t\"disableTransition\",\n\t\t\"emitAuto\",\n\t\t\"eventFilter\",\n\t\t\"flush\",\n\t\t\"initOnMounted\",\n\t\t\"initialValue\",\n\t\t\"listenToStorageChanges\",\n\t\t\"mergeDefaults\",\n\t\t\"onChanged\",\n\t\t\"onError\",\n\t\t\"selector\",\n\t\t\"serializer\",\n\t\t\"shallow\",\n\t\t\"storage\",\n\t\t\"storageKey\",\n\t\t\"storageRef\",\n\t\t\"valueDark\",\n\t\t\"valueLight\",\n\t\t\"window\",\n\t\t\"writeDefaults\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDeviceMotion/component.ts\nconst UseDeviceMotion = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = useDeviceMotion(props);\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceMotion\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"requestPermissions\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDeviceOrientation/component.ts\nconst UseDeviceOrientation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDeviceOrientation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDeviceOrientation\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useDevicePixelRatio/component.ts\nconst UseDevicePixelRatio = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicePixelRatio(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicePixelRatio\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useDevicesList/component.ts\nconst UseDevicesList = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useDevicesList(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDevicesList\",\n\tprops: [\n\t\t\"constraints\",\n\t\t\"navigator\",\n\t\t\"onUpdated\",\n\t\t\"requestPermissions\"\n\t]\n});\n\n//#endregion\n//#region ../core/useDocumentVisibility/component.ts\nconst UseDocumentVisibility = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ visibility: useDocumentVisibility(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseDocumentVisibility\",\n\tprops: [\"document\"]\n});\n\n//#endregion\n//#region ../core/useDraggable/component.ts\nconst UseDraggable = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst handle = computed(() => {\n\t\tvar _toValue;\n\t\treturn (_toValue = toValue(props.handle)) !== null && _toValue !== void 0 ? _toValue : target.value;\n\t});\n\tconst containerElement = computed(() => {\n\t\tvar _ref;\n\t\treturn (_ref = props.containerElement) !== null && _ref !== void 0 ? _ref : void 0;\n\t});\n\tconst disabled = computed(() => !!props.disabled);\n\tconst storageValue = props.storageKey && useStorage(props.storageKey, toValue(props.initialValue) || {\n\t\tx: 0,\n\t\ty: 0\n\t}, isClient ? props.storageType === \"session\" ? sessionStorage : localStorage : void 0);\n\tconst initialValue = storageValue || props.initialValue || {\n\t\tx: 0,\n\t\ty: 0\n\t};\n\tconst onEnd = (position, event) => {\n\t\tvar _props$onEnd;\n\t\t(_props$onEnd = props.onEnd) === null || _props$onEnd === void 0 || _props$onEnd.call(props, position, event);\n\t\tif (!storageValue) return;\n\t\tstorageValue.value.x = position.x;\n\t\tstorageValue.value.y = position.y;\n\t};\n\tconst data = reactive(useDraggable(target, {\n\t\t...props,\n\t\thandle,\n\t\tinitialValue,\n\t\tonEnd,\n\t\tdisabled,\n\t\tcontainerElement\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", {\n\t\t\tref: target,\n\t\t\tstyle: `touch-action:none;${data.style}`\n\t\t}, slots.default(data));\n\t};\n}, {\n\tname: \"UseDraggable\",\n\tprops: [\n\t\t\"storageKey\",\n\t\t\"storageType\",\n\t\t\"initialValue\",\n\t\t\"exact\",\n\t\t\"preventDefault\",\n\t\t\"stopPropagation\",\n\t\t\"pointerTypes\",\n\t\t\"as\",\n\t\t\"handle\",\n\t\t\"axis\",\n\t\t\"onStart\",\n\t\t\"onMove\",\n\t\t\"onEnd\",\n\t\t\"disabled\",\n\t\t\"buttons\",\n\t\t\"containerElement\",\n\t\t\"capture\",\n\t\t\"draggingElement\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementBounding/component.ts\nconst UseElementBounding = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useElementBounding(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementBounding\",\n\tprops: [\n\t\t\"as\",\n\t\t\"immediate\",\n\t\t\"reset\",\n\t\t\"updateTiming\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementBounding/directive.ts\nconst vElementBounding = { mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\tconst { height, bottom, left, right, top, width, x, y } = useElementBounding(el, options);\n\twatch([\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t], () => handler({\n\t\theight,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\twidth,\n\t\tx,\n\t\ty\n\t}));\n} };\n\n//#endregion\n//#region ../core/useElementHover/directive.ts\nconst vElementHover = { mounted(el, binding) {\n\tconst value = binding.value;\n\tif (typeof value === \"function\") watch(useElementHover(el), (v) => value(v));\n\telse {\n\t\tconst [handler, options] = value;\n\t\twatch(useElementHover(el, options), (v) => handler(v));\n\t}\n} };\n\n//#endregion\n//#region ../core/useElementSize/component.ts\nconst UseElementSize = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tvar _toValue, _toValue2;\n\tconst target = shallowRef();\n\tconst { width, height } = toRefs(props);\n\tconst data = reactive(useElementSize(target, {\n\t\twidth: (_toValue = toValue(width)) !== null && _toValue !== void 0 ? _toValue : 0,\n\t\theight: (_toValue2 = toValue(height)) !== null && _toValue2 !== void 0 ? _toValue2 : 0\n\t}, {\n\t\tbox: props.box,\n\t\twindow: props.window\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementSize\",\n\tprops: [\n\t\t\"as\",\n\t\t\"box\",\n\t\t\"height\",\n\t\t\"width\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementSize/directive.ts\nconst vElementSize = { mounted(el, binding) {\n\tvar _binding$value;\n\tconst handler = typeof binding.value === \"function\" ? binding.value : (_binding$value = binding.value) === null || _binding$value === void 0 ? void 0 : _binding$value[0];\n\tconst { width, height } = useElementSize(el, ...typeof binding.value === \"function\" ? [] : binding.value.slice(1));\n\twatch([width, height], ([width$1, height$1]) => handler({\n\t\twidth: width$1,\n\t\theight: height$1\n\t}));\n} };\n\n//#endregion\n//#region ../core/useElementVisibility/component.ts\nconst UseElementVisibility = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive({ isVisible: useElementVisibility(target, props) });\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseElementVisibility\",\n\tprops: [\n\t\t\"as\",\n\t\t\"once\",\n\t\t\"rootMargin\",\n\t\t\"scrollTarget\",\n\t\t\"threshold\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useElementVisibility/directive.ts\nconst vElementVisibility = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\twatch(useElementVisibility(el), (v) => handler(v), { immediate: true });\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\twatch(useElementVisibility(el, options), (v) => handler(v), { immediate: true });\n\t}\n} };\n\n//#endregion\n//#region ../core/useEyeDropper/component.ts\nconst UseEyeDropper = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useEyeDropper(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseEyeDropper\",\n\tprops: [\"initialValue\"]\n});\n\n//#endregion\n//#region ../core/useFullscreen/component.ts\nconst UseFullscreen = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useFullscreen(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseFullscreen\",\n\tprops: [\n\t\t\"as\",\n\t\t\"autoExit\",\n\t\t\"document\"\n\t]\n});\n\n//#endregion\n//#region ../core/useGeolocation/component.ts\nconst UseGeolocation = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useGeolocation(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseGeolocation\",\n\tprops: [\n\t\t\"enableHighAccuracy\",\n\t\t\"immediate\",\n\t\t\"maximumAge\",\n\t\t\"navigator\",\n\t\t\"timeout\"\n\t]\n});\n\n//#endregion\n//#region ../core/useIdle/component.ts\nconst UseIdle = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useIdle(props.timeout, props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseIdle\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"events\",\n\t\t\"initialState\",\n\t\t\"listenForVisibilityChange\",\n\t\t\"timeout\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useImage/component.ts\nconst UseImage = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useImage(props));\n\treturn () => {\n\t\tif (data.isLoading && slots.loading) return slots.loading(data);\n\t\telse if (data.error && slots.error) return slots.error(data.error);\n\t\tif (slots.default) return slots.default(data);\n\t\treturn h(props.as || \"img\", props);\n\t};\n}, {\n\tname: \"UseImage\",\n\tprops: [\n\t\t\"alt\",\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"crossorigin\",\n\t\t\"decoding\",\n\t\t\"fetchPriority\",\n\t\t\"height\",\n\t\t\"ismap\",\n\t\t\"loading\",\n\t\t\"referrerPolicy\",\n\t\t\"sizes\",\n\t\t\"src\",\n\t\t\"srcset\",\n\t\t\"usemap\",\n\t\t\"width\"\n\t]\n});\n\n//#endregion\n//#region ../core/useInfiniteScroll/directive.ts\nconst vInfiniteScroll = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useInfiniteScroll(el, binding.value);\n\telse useInfiniteScroll(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useIntersectionObserver/directive.ts\nconst vIntersectionObserver = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useIntersectionObserver(el, binding.value);\n\telse useIntersectionObserver(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useMouse/component.ts\nconst UseMouse = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useMouse(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseMouse\",\n\tprops: [\n\t\t\"eventFilter\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useMouseInElement/component.ts\nconst UseMouseInElement = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMouseInElement(target, props));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMouseInElement\",\n\tprops: [\n\t\t\"as\",\n\t\t\"eventFilter\",\n\t\t\"handleOutside\",\n\t\t\"initialValue\",\n\t\t\"resetOnTouchEnds\",\n\t\t\"scroll\",\n\t\t\"target\",\n\t\t\"touch\",\n\t\t\"type\",\n\t\t\"window\",\n\t\t\"windowResize\",\n\t\t\"windowScroll\"\n\t]\n});\n\n//#endregion\n//#region ../core/useMouseInElement/directive.ts\nconst vMouseInElement = { mounted(el, binding) {\n\tconst [handler, options] = typeof binding.value === \"function\" ? [binding.value, {}] : binding.value;\n\twatch(reactiveOmit(reactive(useMouseInElement(el, options)), \"stop\"), (val) => handler(val));\n} };\n\n//#endregion\n//#region ../core/useMousePressed/component.ts\nconst UseMousePressed = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(useMousePressed({\n\t\t...props,\n\t\ttarget\n\t}));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UseMousePressed\",\n\tprops: [\n\t\t\"as\",\n\t\t\"capture\",\n\t\t\"drag\",\n\t\t\"initialValue\",\n\t\t\"onPressed\",\n\t\t\"onReleased\",\n\t\t\"touch\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/useNetwork/component.ts\nconst UseNetwork = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNetwork(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNetwork\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useNow/component.ts\nconst UseNow = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useNow({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseNow\",\n\tprops: [\"immediate\", \"interval\"]\n});\n\n//#endregion\n//#region ../core/useObjectUrl/component.ts\nconst UseObjectUrl = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst { object } = toRefs$1(props);\n\tconst url = useObjectUrl(object);\n\treturn () => {\n\t\tif (slots.default && url.value) return slots.default(url.value);\n\t};\n}, {\n\tname: \"UseObjectUrl\",\n\tprops: [\"object\"]\n});\n\n//#endregion\n//#region ../core/useOffsetPagination/component.ts\nconst UseOffsetPagination = /* @__PURE__ */ defineComponent((props, { slots, emit }) => {\n\tconst data = reactive(useOffsetPagination({\n\t\t...props,\n\t\ttotal: toValue(props.total) || void 0,\n\t\tonPageChange(...args) {\n\t\t\tvar _props$onPageChange;\n\t\t\t(_props$onPageChange = props.onPageChange) === null || _props$onPageChange === void 0 || _props$onPageChange.call(props, ...args);\n\t\t\temit(\"page-change\", ...args);\n\t\t},\n\t\tonPageSizeChange(...args) {\n\t\t\tvar _props$onPageSizeChan;\n\t\t\t(_props$onPageSizeChan = props.onPageSizeChange) === null || _props$onPageSizeChan === void 0 || _props$onPageSizeChan.call(props, ...args);\n\t\t\temit(\"page-size-change\", ...args);\n\t\t},\n\t\tonPageCountChange(...args) {\n\t\t\tvar _props$onPageCountCha;\n\t\t\t(_props$onPageCountCha = props.onPageCountChange) === null || _props$onPageCountCha === void 0 || _props$onPageCountCha.call(props, ...args);\n\t\t\temit(\"page-count-change\", ...args);\n\t\t}\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOffsetPagination\",\n\tprops: [\n\t\t\"onPageChange\",\n\t\t\"onPageCountChange\",\n\t\t\"onPageSizeChange\",\n\t\t\"page\",\n\t\t\"pageSize\",\n\t\t\"total\"\n\t]\n});\n\n//#endregion\n//#region ../core/useOnline/component.ts\nconst UseOnline = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isOnline: useOnline(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseOnline\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePageLeave/component.ts\nconst UsePageLeave = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ isLeft: usePageLeave(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePageLeave\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePointer/component.ts\nconst UsePointer = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst el = shallowRef(null);\n\tconst data = reactive(usePointer({\n\t\t...props,\n\t\ttarget: props.target === \"self\" ? el : defaultWindow\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePointer\",\n\tprops: [\n\t\t\"initialValue\",\n\t\t\"pointerTypes\",\n\t\t\"target\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\n//#region ../core/usePointerLock/component.ts\nconst UsePointerLock = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst target = shallowRef();\n\tconst data = reactive(usePointerLock(target));\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { ref: target }, slots.default(data));\n\t};\n}, {\n\tname: \"UsePointerLock\",\n\tprops: [\"as\", \"document\"]\n});\n\n//#endregion\n//#region ../core/usePreferredColorScheme/component.ts\nconst UsePreferredColorScheme = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ colorScheme: usePreferredColorScheme(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredColorScheme\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredContrast/component.ts\nconst UsePreferredContrast = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ contrast: usePreferredContrast(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredContrast\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredDark/component.ts\nconst UsePreferredDark = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ prefersDark: usePreferredDark(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredDark\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredLanguages/component.ts\nconst UsePreferredLanguages = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ languages: usePreferredLanguages(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredLanguages\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredReducedMotion/component.ts\nconst UsePreferredReducedMotion = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ motion: usePreferredReducedMotion(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UsePreferredReducedMotion\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/usePreferredReducedTransparency/component.ts\nconst UsePreferredReducedTransparency = /* @__PURE__ */ defineComponent({\n\tname: \"UsePreferredReducedTransparency\",\n\tsetup(props, { slots }) {\n\t\tconst data = reactive({ transparency: usePreferredReducedTransparency() });\n\t\treturn () => {\n\t\t\tif (slots.default) return slots.default(data);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region ../core/useResizeObserver/directive.ts\nconst vResizeObserver = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") useResizeObserver(el, binding.value);\n\telse useResizeObserver(el, ...binding.value);\n} };\n\n//#endregion\n//#region ../core/useScreenSafeArea/component.ts\nconst UseScreenSafeArea = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useScreenSafeArea());\n\treturn () => {\n\t\tif (slots.default) return h(props.as || \"div\", { style: {\n\t\t\tpaddingTop: props.top ? data.top : \"\",\n\t\t\tpaddingRight: props.right ? data.right : \"\",\n\t\t\tpaddingBottom: props.bottom ? data.bottom : \"\",\n\t\t\tpaddingLeft: props.left ? data.left : \"\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tmaxHeight: \"100vh\",\n\t\t\tmaxWidth: \"100vw\",\n\t\t\toverflow: \"auto\"\n\t\t} }, slots.default(data));\n\t};\n}, {\n\tname: \"UseScreenSafeArea\",\n\tprops: [\n\t\t\"top\",\n\t\t\"right\",\n\t\t\"bottom\",\n\t\t\"left\"\n\t]\n});\n\n//#endregion\n//#region ../core/useScroll/directive.ts\nconst vScroll = { mounted(el, binding) {\n\tif (typeof binding.value === \"function\") {\n\t\tconst handler = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\tonScroll() {\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop() {\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tconst [handler, options] = binding.value;\n\t\tconst state = useScroll(el, {\n\t\t\t...options,\n\t\t\tonScroll(e) {\n\t\t\t\tvar _options$onScroll;\n\t\t\t\t(_options$onScroll = options.onScroll) === null || _options$onScroll === void 0 || _options$onScroll.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t},\n\t\t\tonStop(e) {\n\t\t\t\tvar _options$onStop;\n\t\t\t\t(_options$onStop = options.onStop) === null || _options$onStop === void 0 || _options$onStop.call(options, e);\n\t\t\t\thandler(state);\n\t\t\t}\n\t\t});\n\t}\n} };\n\n//#endregion\n//#region ../core/useScrollLock/directive.ts\nfunction onScrollLock() {\n\tlet isMounted = false;\n\tconst state = shallowRef(false);\n\treturn (el, binding) => {\n\t\tstate.value = binding.value;\n\t\tif (isMounted) return;\n\t\tisMounted = true;\n\t\tconst isLocked = useScrollLock(el, binding.value);\n\t\twatch(state, (v) => isLocked.value = v);\n\t};\n}\nconst vScrollLock = onScrollLock();\n\n//#endregion\n//#region ../core/useTimeAgo/component.ts\nconst UseTimeAgo = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimeAgo(() => props.time, {\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimeAgo\",\n\tprops: [\n\t\t\"fullDateFormatter\",\n\t\t\"max\",\n\t\t\"messages\",\n\t\t\"rounding\",\n\t\t\"showSecond\",\n\t\t\"time\",\n\t\t\"units\",\n\t\t\"updateInterval\"\n\t]\n});\n\n//#endregion\n//#region ../core/useTimestamp/component.ts\nconst UseTimestamp = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useTimestamp({\n\t\t...props,\n\t\tcontrols: true\n\t}));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseTimestamp\",\n\tprops: [\n\t\t\"callback\",\n\t\t\"immediate\",\n\t\t\"interval\",\n\t\t\"offset\"\n\t]\n});\n\n//#endregion\n//#region ../core/useVirtualList/component.ts\nconst UseVirtualList = /* @__PURE__ */ defineComponent((props, { slots, expose }) => {\n\tconst { list: listRef } = toRefs(props);\n\tconst { list, containerProps, wrapperProps, scrollTo } = useVirtualList(listRef, props.options);\n\texpose({ scrollTo });\n\tif (containerProps.style && typeof containerProps.style === \"object\" && !Array.isArray(containerProps.style)) containerProps.style.height = props.height || \"300px\";\n\treturn () => h(\"div\", { ...containerProps }, [h(\"div\", { ...wrapperProps.value }, list.value.map((item) => h(\"div\", { style: {\n\t\toverflow: \"hidden\",\n\t\theight: item.height\n\t} }, slots.default ? slots.default(item) : \"Please set content!\")))]);\n}, {\n\tname: \"UseVirtualList\",\n\tprops: [\n\t\t\"height\",\n\t\t\"list\",\n\t\t\"options\"\n\t]\n});\n\n//#endregion\n//#region ../core/useWindowFocus/component.ts\nconst UseWindowFocus = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive({ focused: useWindowFocus(props) });\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowFocus\",\n\tprops: [\"window\"]\n});\n\n//#endregion\n//#region ../core/useWindowSize/component.ts\nconst UseWindowSize = /* @__PURE__ */ defineComponent((props, { slots }) => {\n\tconst data = reactive(useWindowSize(props));\n\treturn () => {\n\t\tif (slots.default) return slots.default(data);\n\t};\n}, {\n\tname: \"UseWindowSize\",\n\tprops: [\n\t\t\"includeScrollbar\",\n\t\t\"initialHeight\",\n\t\t\"initialWidth\",\n\t\t\"listenOrientation\",\n\t\t\"type\",\n\t\t\"window\"\n\t]\n});\n\n//#endregion\nexport { OnClickOutside, OnLongPress, UseActiveElement, UseBattery, UseBrowserLocation, UseClipboard, UseColorMode, UseDark, UseDeviceMotion, UseDeviceOrientation, UseDevicePixelRatio, UseDevicesList, UseDocumentVisibility, UseDraggable, UseElementBounding, UseElementSize, UseElementVisibility, UseEyeDropper, UseFullscreen, UseGeolocation, UseIdle, UseImage, UseMouse, UseMouseInElement, UseMousePressed, UseNetwork, UseNow, UseObjectUrl, UseOffsetPagination, UseOnline, UsePageLeave, UsePointer, UsePointerLock, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePreferredReducedMotion, UsePreferredReducedTransparency, UseScreenSafeArea, UseTimeAgo, UseTimestamp, UseVirtualList, UseWindowFocus, UseWindowSize, VOnClickOutside, VOnLongPress, vElementBounding, vElementHover, vElementSize, vElementVisibility, vInfiniteScroll, vIntersectionObserver, vMouseInElement, vOnClickOutside, vOnKeyStroke, vOnLongPress, vResizeObserver, vScroll, vScrollLock };","import { l as logger } from \"../../chunks/logger-D3RVzcfQ.mjs\";\nfunction registerContactsMenuAction(action) {\n window._nc_contacts_menu_hooks ??= {};\n if (window._nc_contacts_menu_hooks[action.id]) {\n logger.error(`ContactsMenu action for id ${action.id} has already been registered`, {\n action\n });\n return;\n }\n window._nc_contacts_menu_hooks[action.id] = action;\n}\nfunction getEnabledContactsMenuActions(entry) {\n if (!window._nc_contacts_menu_hooks) {\n return [];\n }\n return Object.values(window._nc_contacts_menu_hooks).filter((action) => action.enabled(entry));\n}\nexport {\n getEnabledContactsMenuActions,\n registerContactsMenuAction\n};\n//# sourceMappingURL=index.mjs.map\n","const c = new Int32Array(4);\nclass h {\n static hashStr(i, a = !1) {\n return this.onePassHasher.start().appendStr(i).end(a);\n }\n static hashAsciiStr(i, a = !1) {\n return this.onePassHasher.start().appendAsciiStr(i).end(a);\n }\n // Private Static Variables\n static stateIdentity = new Int32Array([\n 1732584193,\n -271733879,\n -1732584194,\n 271733878\n ]);\n static buffer32Identity = new Int32Array([\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]);\n static hexChars = \"0123456789abcdef\";\n static hexOut = [];\n // Permanent instance is to use for one-call hashing\n static onePassHasher = new h();\n static _hex(i) {\n const a = h.hexChars, t = h.hexOut;\n let e, s, r, n;\n for (n = 0; n < 4; n += 1)\n for (s = n * 8, e = i[n], r = 0; r < 8; r += 2)\n t[s + 1 + r] = a.charAt(e & 15), e >>>= 4, t[s + 0 + r] = a.charAt(e & 15), e >>>= 4;\n return t.join(\"\");\n }\n static _md5cycle(i, a) {\n let t = i[0], e = i[1], s = i[2], r = i[3];\n t += (e & s | ~e & r) + a[0] - 680876936 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[1] - 389564586 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[2] + 606105819 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[3] - 1044525330 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[4] - 176418897 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[5] + 1200080426 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[6] - 1473231341 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[7] - 45705983 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[8] + 1770035416 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[9] - 1958414417 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[10] - 42063 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[11] - 1990404162 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & s | ~e & r) + a[12] + 1804603682 | 0, t = (t << 7 | t >>> 25) + e | 0, r += (t & e | ~t & s) + a[13] - 40341101 | 0, r = (r << 12 | r >>> 20) + t | 0, s += (r & t | ~r & e) + a[14] - 1502002290 | 0, s = (s << 17 | s >>> 15) + r | 0, e += (s & r | ~s & t) + a[15] + 1236535329 | 0, e = (e << 22 | e >>> 10) + s | 0, t += (e & r | s & ~r) + a[1] - 165796510 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[6] - 1069501632 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[11] + 643717713 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[0] - 373897302 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[5] - 701558691 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[10] + 38016083 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[15] - 660478335 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[4] - 405537848 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[9] + 568446438 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[14] - 1019803690 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[3] - 187363961 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[8] + 1163531501 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e & r | s & ~r) + a[13] - 1444681467 | 0, t = (t << 5 | t >>> 27) + e | 0, r += (t & s | e & ~s) + a[2] - 51403784 | 0, r = (r << 9 | r >>> 23) + t | 0, s += (r & e | t & ~e) + a[7] + 1735328473 | 0, s = (s << 14 | s >>> 18) + r | 0, e += (s & t | r & ~t) + a[12] - 1926607734 | 0, e = (e << 20 | e >>> 12) + s | 0, t += (e ^ s ^ r) + a[5] - 378558 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[8] - 2022574463 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[11] + 1839030562 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[14] - 35309556 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[1] - 1530992060 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[4] + 1272893353 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[7] - 155497632 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[10] - 1094730640 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[13] + 681279174 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[0] - 358537222 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[3] - 722521979 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[6] + 76029189 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (e ^ s ^ r) + a[9] - 640364487 | 0, t = (t << 4 | t >>> 28) + e | 0, r += (t ^ e ^ s) + a[12] - 421815835 | 0, r = (r << 11 | r >>> 21) + t | 0, s += (r ^ t ^ e) + a[15] + 530742520 | 0, s = (s << 16 | s >>> 16) + r | 0, e += (s ^ r ^ t) + a[2] - 995338651 | 0, e = (e << 23 | e >>> 9) + s | 0, t += (s ^ (e | ~r)) + a[0] - 198630844 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[7] + 1126891415 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[14] - 1416354905 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[5] - 57434055 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[12] + 1700485571 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[3] - 1894986606 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[10] - 1051523 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[1] - 2054922799 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[8] + 1873313359 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[15] - 30611744 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[6] - 1560198380 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[13] + 1309151649 | 0, e = (e << 21 | e >>> 11) + s | 0, t += (s ^ (e | ~r)) + a[4] - 145523070 | 0, t = (t << 6 | t >>> 26) + e | 0, r += (e ^ (t | ~s)) + a[11] - 1120210379 | 0, r = (r << 10 | r >>> 22) + t | 0, s += (t ^ (r | ~e)) + a[2] + 718787259 | 0, s = (s << 15 | s >>> 17) + r | 0, e += (r ^ (s | ~t)) + a[9] - 343485551 | 0, e = (e << 21 | e >>> 11) + s | 0, i[0] = t + i[0] | 0, i[1] = e + i[1] | 0, i[2] = s + i[2] | 0, i[3] = r + i[3] | 0;\n }\n _dataLength = 0;\n _bufferLength = 0;\n _state = new Int32Array(4);\n _buffer = new ArrayBuffer(68);\n _buffer8;\n _buffer32;\n constructor() {\n this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();\n }\n /**\n * Initialise buffer to be hashed\n */\n start() {\n return this._dataLength = 0, this._bufferLength = 0, this._state.set(h.stateIdentity), this;\n }\n // Char to code point to to array conversion:\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt\n // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown\n /**\n * Append a UTF-8 string to the hash buffer\n * @param str String to append\n */\n appendStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r;\n for (r = 0; r < i.length; r += 1) {\n if (s = i.charCodeAt(r), s < 128)\n a[e++] = s;\n else if (s < 2048)\n a[e++] = (s >>> 6) + 192, a[e++] = s & 63 | 128;\n else if (s < 55296 || s > 56319)\n a[e++] = (s >>> 12) + 224, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n else {\n if (s = (s - 55296) * 1024 + (i.charCodeAt(++r) - 56320) + 65536, s > 1114111)\n throw new Error(\n \"Unicode standard supports code points up to U+10FFFF\"\n );\n a[e++] = (s >>> 18) + 240, a[e++] = s >>> 12 & 63 | 128, a[e++] = s >>> 6 & 63 | 128, a[e++] = s & 63 | 128;\n }\n e >= 64 && (this._dataLength += 64, h._md5cycle(this._state, t), e -= 64, t[0] = t[16]);\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append an ASCII string to the hash buffer\n * @param str String to append\n */\n appendAsciiStr(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i.charCodeAt(r++);\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Append a byte array to the hash buffer\n * @param input array to append\n */\n appendByteArray(i) {\n const a = this._buffer8, t = this._buffer32;\n let e = this._bufferLength, s, r = 0;\n for (; ; ) {\n for (s = Math.min(i.length - r, 64 - e); s--; )\n a[e++] = i[r++];\n if (e < 64)\n break;\n this._dataLength += 64, h._md5cycle(this._state, t), e = 0;\n }\n return this._bufferLength = e, this;\n }\n /**\n * Get the state of the hash buffer\n */\n getState() {\n const i = this._state;\n return {\n buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),\n buflen: this._bufferLength,\n length: this._dataLength,\n state: [i[0], i[1], i[2], i[3]]\n };\n }\n /**\n * Override the current state of the hash buffer\n * @param state New hash buffer state\n */\n setState(i) {\n const a = i.buffer, t = i.state, e = this._state;\n let s;\n for (this._dataLength = i.length, this._bufferLength = i.buflen, e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], s = 0; s < a.length; s += 1)\n this._buffer8[s] = a.charCodeAt(s);\n }\n /**\n * Hash the current state of the hash buffer and return the result\n * @param raw Whether to return the value as an `Int32Array`\n */\n end(i = !1) {\n const a = this._bufferLength, t = this._buffer8, e = this._buffer32, s = (a >> 2) + 1;\n this._dataLength += a;\n const r = this._dataLength * 8;\n if (t[a] = 128, t[a + 1] = t[a + 2] = t[a + 3] = 0, e.set(h.buffer32Identity.subarray(s), s), a > 55 && (h._md5cycle(this._state, e), e.set(h.buffer32Identity)), r <= 4294967295)\n e[14] = r;\n else {\n const n = r.toString(16).match(/(.*?)(.{0,8})$/);\n if (n === null) return i ? c : \"\";\n const o = parseInt(n[2], 16), _ = parseInt(n[1], 16) || 0;\n e[14] = o, e[15] = _;\n }\n return h._md5cycle(this._state, e), i ? this._state : h._hex(this._state);\n }\n}\nif (h.hashStr(\"hello\") !== \"5d41402abc4b2a76b9719d911017c592\")\n throw new Error(\"Md5 self test failed.\");\nclass l {\n constructor(i, a = !0, t = 1048576) {\n this._callback = i, this._async = a, this._partSize = t, this._configureReader();\n }\n _reader;\n _md5;\n _part;\n // private _length!: number;\n _blob;\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n */\n hash(i) {\n const a = this;\n a._blob = i, a._part = 0, a._md5 = new h(), a._processPart();\n }\n _fail() {\n this._callback({\n success: !1,\n result: \"data read failed\"\n });\n }\n _hashData(i) {\n let a = this;\n a._md5.appendByteArray(new Uint8Array(i.target.result)), a._part * a._partSize >= a._blob.size ? a._callback({\n success: !0,\n result: a._md5.end()\n }) : a._processPart();\n }\n _processPart() {\n const i = this;\n let a = 0, t;\n i._part += 1, i._blob.size > i._partSize ? (a = i._part * i._partSize, a > i._blob.size && (a = i._blob.size), t = i._blob.slice(\n (i._part - 1) * i._partSize,\n a\n )) : t = i._blob, i._async ? i._reader.readAsArrayBuffer(t) : setTimeout(() => {\n try {\n i._hashData({\n target: {\n result: i._reader.readAsArrayBuffer(\n t\n )\n }\n });\n } catch {\n i._fail();\n }\n }, 0);\n }\n _configureReader() {\n const i = this;\n i._async ? (i._reader = new FileReader(), i._reader.onload = i._hashData.bind(i), i._reader.onerror = i._fail.bind(i), i._reader.onabort = i._fail.bind(i)) : i._reader = new FileReaderSync();\n }\n}\nclass u {\n _queue = [];\n _hashWorker;\n _processing;\n _ready = !0;\n constructor(i, a) {\n const t = this;\n Worker ? (t._hashWorker = new Worker(i, a), t._hashWorker.onmessage = t._recievedMessage.bind(t), t._hashWorker.onerror = (e) => {\n t._ready = !1, console.error(\"Hash worker failure\", e);\n }) : (t._ready = !1, console.error(\"Web Workers are not supported in this browser\"));\n }\n /**\n * Hash a blob of data in the worker\n * @param blob Data to hash\n * @returns Promise of the Hashed result\n */\n hash(i) {\n const a = this;\n let t;\n return t = new Promise((e, s) => {\n a._queue.push({\n blob: i,\n resolve: e,\n reject: s\n }), a._processNext();\n }), t;\n }\n /** Terminate any existing hash requests */\n terminate() {\n this._ready = !1, this._hashWorker.terminate();\n }\n // Processes the next item in the queue\n _processNext() {\n this._ready && !this._processing && this._queue.length > 0 && (this._processing = this._queue.pop(), this._hashWorker.postMessage(this._processing.blob));\n }\n // Hash result is returned from the worker\n _recievedMessage(i) {\n const a = i.data;\n a.success ? this._processing?.resolve(a.result) : this._processing?.reject(a.result), this._processing = void 0, this._processNext();\n }\n}\nexport {\n h as Md5,\n l as Md5FileHasher,\n u as ParallelHasher\n};\n//# sourceMappingURL=index.es.js.map\n","import { r as register, t as t3, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nregister(t3);\nclass Color {\n /**\n * @param r - The red value\n * @param g - The green value\n * @param b - The blue value\n * @param name - The name of the color\n */\n constructor(r, g, b, name) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.name = name;\n this.r = Math.min(r, 255);\n this.g = Math.min(g, 255);\n this.b = Math.min(b, 255);\n this.name = name;\n }\n /**\n * The hexadecimal color string.\n */\n get color() {\n const toHex = (int) => `00${int.toString(16)}`.slice(-2);\n return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;\n }\n}\nfunction calculateStepIncrement(steps, color1, color2) {\n return {\n r: (color2.r - color1.r) / steps,\n g: (color2.g - color1.g) / steps,\n b: (color2.b - color1.b) / steps\n };\n}\nfunction mixPalette(steps, color1, color2) {\n const palette = [];\n palette.push(color1);\n const increment = calculateStepIncrement(steps, color1, color2);\n for (let i = 1; i < steps; i++) {\n const r = Math.floor(color1.r + increment.r * i);\n const g = Math.floor(color1.g + increment.g * i);\n const b = Math.floor(color1.b + increment.b * i);\n palette.push(new Color(r, g, b));\n }\n return palette;\n}\nconst COLOR_RED = new Color(182, 70, 157, t(\"Purple\"));\nconst COLOR_YELLOW = new Color(221, 203, 85, t(\"Gold\"));\nconst COLOR_BLUE = new Color(0, 130, 201, t(\"Nextcloud blue\"));\nconst COLOR_BLACK = new Color(0, 0, 0, t(\"Black\"));\nconst COLOR_WHITE = new Color(255, 255, 255, t(\"White\"));\nconst defaultPalette = [\n /* eslint-disable @stylistic/function-call-argument-newline -- Allow to put translators comments */\n COLOR_RED,\n new Color(\n 191,\n 103,\n 139,\n t(\"Rosy brown\")\n // TRANSLATORS: A color name for RGB(191, 103, 139)\n ),\n new Color(\n 201,\n 136,\n 121,\n t(\"Feldspar\")\n // TRANSLATORS: A color name for RGB(201, 136, 121)\n ),\n new Color(\n 211,\n 169,\n 103,\n t(\"Whiskey\")\n // TRANSLATORS: A color name for RGB(211, 169, 103)\n ),\n COLOR_YELLOW,\n new Color(\n 165,\n 184,\n 114,\n t(\"Olivine\")\n // TRANSLATORS: A color name for RGB(165, 184, 114)\n ),\n new Color(\n 110,\n 166,\n 143,\n t(\"Acapulco\")\n // TRANSLATORS: A color name for RGB(110, 166, 143)\n ),\n new Color(\n 55,\n 148,\n 172,\n t(\"Boston Blue\")\n // TRANSLATORS: A color name for RGB(55, 148, 172)\n ),\n COLOR_BLUE,\n new Color(\n 45,\n 115,\n 190,\n t(\"Mariner\")\n // TRANSLATORS: A color name for RGB(45, 115, 190)\n ),\n new Color(\n 91,\n 100,\n 179,\n t(\"Blue Violet\")\n // TRANSLATORS: A color name for RGB(91, 100, 179)\n ),\n new Color(\n 136,\n 85,\n 168,\n t(\"Deluge\")\n // TRANSLATORS: A color name for RGB(136, 85, 168)\n )\n /* eslint-enable @stylistic/function-call-argument-newline */\n];\nfunction generatePalette(steps) {\n const palette1 = mixPalette(steps, COLOR_RED, COLOR_YELLOW);\n const palette2 = mixPalette(steps, COLOR_YELLOW, COLOR_BLUE);\n const palette3 = mixPalette(steps, COLOR_BLUE, COLOR_RED);\n return palette1.concat(palette2).concat(palette3);\n}\nexport {\n Color as C,\n COLOR_BLACK as a,\n COLOR_WHITE as b,\n defaultPalette as d,\n generatePalette as g\n};\n//# sourceMappingURL=colors-CL_wvNtd.mjs.map\n","import { Md5 } from \"ts-md5\";\nimport { g as generatePalette } from \"../../chunks/colors-CL_wvNtd.mjs\";\nfunction hashCode(str) {\n let hash = str;\n if (str.match(/^([0-9a-f]{4}-?){8}$/) === null) {\n hash = Md5.hashStr(str);\n }\n hash = hash.replace(/[^0-9a-f]/g, \"\");\n let finalInt = 0;\n for (let i = 0; i < hash.length; i++) {\n finalInt += parseInt(hash.charAt(i), 16);\n }\n return finalInt;\n}\nfunction usernameToColor(username) {\n const steps = 6;\n const finalPalette = generatePalette(steps);\n const hash = hashCode(username.toLocaleLowerCase());\n return finalPalette[hash % finalPalette.length];\n}\nexport {\n usernameToColor\n};\n//# sourceMappingURL=index.mjs.map\n","'use strict';\n\n(function (global) {\n\n // minimal symbol polyfill for IE11 and others\n if (typeof Symbol !== 'function') {\n var Symbol = function(name) {\n return name;\n }\n\n Symbol.nonNative = true;\n }\n\n const STATE_PLAINTEXT = Symbol('plaintext');\n const STATE_HTML = Symbol('html');\n const STATE_COMMENT = Symbol('comment');\n\n const ALLOWED_TAGS_REGEX = /<(\\w*)>/g;\n const NORMALIZE_TAG_REGEX = /<\\/?([^\\s\\/>]+)/;\n\n function striptags(html, allowable_tags, tag_replacement) {\n html = html || '';\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return striptags_internal(html, context);\n }\n\n function init_striptags_stream(allowable_tags, tag_replacement) {\n allowable_tags = allowable_tags || [];\n tag_replacement = tag_replacement || '';\n\n let context = init_context(allowable_tags, tag_replacement);\n\n return function striptags_stream(html) {\n return striptags_internal(html || '', context);\n };\n }\n\n striptags.init_streaming_mode = init_striptags_stream;\n\n function init_context(allowable_tags, tag_replacement) {\n allowable_tags = parse_allowable_tags(allowable_tags);\n\n return {\n allowable_tags : allowable_tags,\n tag_replacement: tag_replacement,\n\n state : STATE_PLAINTEXT,\n tag_buffer : '',\n depth : 0,\n in_quote_char : ''\n };\n }\n\n function striptags_internal(html, context) {\n if (typeof html != \"string\") {\n throw new TypeError(\"'html' parameter must be a string\");\n }\n\n let allowable_tags = context.allowable_tags;\n let tag_replacement = context.tag_replacement;\n\n let state = context.state;\n let tag_buffer = context.tag_buffer;\n let depth = context.depth;\n let in_quote_char = context.in_quote_char;\n let output = '';\n\n for (let idx = 0, length = html.length; idx < length; idx++) {\n let char = html[idx];\n\n if (state === STATE_PLAINTEXT) {\n switch (char) {\n case '<':\n state = STATE_HTML;\n tag_buffer += char;\n break;\n\n default:\n output += char;\n break;\n }\n }\n\n else if (state === STATE_HTML) {\n switch (char) {\n case '<':\n // ignore '<' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // we're seeing a nested '<'\n depth++;\n break;\n\n case '>':\n // ignore '>' if inside a quote\n if (in_quote_char) {\n break;\n }\n\n // something like this is happening: '<<>>'\n if (depth) {\n depth--;\n\n break;\n }\n\n // this is closing the tag in tag_buffer\n in_quote_char = '';\n state = STATE_PLAINTEXT;\n tag_buffer += '>';\n\n if (allowable_tags.has(normalize_tag(tag_buffer))) {\n output += tag_buffer;\n } else {\n output += tag_replacement;\n }\n\n tag_buffer = '';\n break;\n\n case '\"':\n case '\\'':\n // catch both single and double quotes\n\n if (char === in_quote_char) {\n in_quote_char = '';\n } else {\n in_quote_char = in_quote_char || char;\n }\n\n tag_buffer += char;\n break;\n\n case '-':\n if (tag_buffer === '':\n if (tag_buffer.slice(-2) == '--') {\n // close the comment\n state = STATE_PLAINTEXT;\n }\n\n tag_buffer = '';\n break;\n\n default:\n tag_buffer += char;\n break;\n }\n }\n }\n\n // save the context for future iterations\n context.state = state;\n context.tag_buffer = tag_buffer;\n context.depth = depth;\n context.in_quote_char = in_quote_char;\n\n return output;\n }\n\n function parse_allowable_tags(allowable_tags) {\n let tag_set = new Set();\n\n if (typeof allowable_tags === 'string') {\n let match;\n\n while ((match = ALLOWED_TAGS_REGEX.exec(allowable_tags))) {\n tag_set.add(match[1]);\n }\n }\n\n else if (!Symbol.nonNative &&\n typeof allowable_tags[Symbol.iterator] === 'function') {\n\n tag_set = new Set(allowable_tags);\n }\n\n else if (typeof allowable_tags.forEach === 'function') {\n // IE11 compatible\n allowable_tags.forEach(tag_set.add, tag_set);\n }\n\n return tag_set;\n }\n\n function normalize_tag(tag_buffer) {\n let match = NORMALIZE_TAG_REGEX.exec(tag_buffer);\n\n return match ? match[1].toLowerCase() : null;\n }\n\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(function module_factory() { return striptags; });\n }\n\n else if (typeof module === 'object' && module.exports) {\n // Node\n module.exports = striptags;\n }\n\n else {\n // Browser\n global.striptags = striptags;\n }\n}(this));\n","import '../assets/NcMentionBubble-ptHUq68a.css';\nimport { generateUrl } from \"@nextcloud/router\";\nimport { checkIfDarkTheme } from \"../functions/isDarkTheme/index.mjs\";\nfunction getAvatarUrl(user, options) {\n const size = (options?.size || 64) <= 64 ? 64 : 512;\n const guestUrl = options?.isGuest ? \"/guest\" : \"\";\n const themeUrl = options?.isDarkTheme ?? checkIfDarkTheme(document.body) ? \"/dark\" : \"\";\n return generateUrl(`/avatar${guestUrl}/{user}/{size}${themeUrl}`, {\n user,\n size\n });\n}\nexport {\n getAvatarUrl as g\n};\n//# sourceMappingURL=NcMentionBubble.vue_vue_type_style_index_0_scoped_45238efd_lang-D6LzDiYf.mjs.map\n","import '../assets/NcUserStatusIcon-B3aHoBAd.css';\nimport { defineComponent, mergeModels, useModel, computed, watch, createElementBlock, createCommentVNode, openBlock, normalizeClass } from \"vue\";\nimport axios from \"@nextcloud/axios\";\nimport { getCapabilities } from \"@nextcloud/capabilities\";\nimport { generateOcsUrl } from \"@nextcloud/router\";\nimport { r as register, Q as t51, R as t11, a as t } from \"./_l10n-CgsPi8nC.mjs\";\nimport { l as logger } from \"./logger-D3RVzcfQ.mjs\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nconst awaySvg = '\\n\\n\t\\n\\n';\nconst busySvg = '\\n\\n\t\\n\\n';\nconst dndSvg = '\\n\\n\t\\n\\n';\nconst invisibleSvg = '\\n\\n\t\\n\\n';\nconst onlineSvg = '\\n\\n\t\\n\\n';\nregister(t51);\nregister(t11);\nfunction getUserStatusText(status) {\n switch (status) {\n case \"away\":\n return t(\"away\");\n // TRANSLATORS: User status if the user is currently away from keyboard\n case \"busy\":\n return t(\"busy\");\n case \"dnd\":\n return t(\"do not disturb\");\n case \"online\":\n return t(\"online\");\n case \"invisible\":\n return t(\"invisible\");\n case \"offline\":\n return t(\"offline\");\n default:\n return status;\n }\n}\nconst _hoisted_1 = [\"aria-hidden\", \"aria-label\", \"innerHTML\"];\nconst _sfc_main = /* @__PURE__ */ defineComponent({\n __name: \"NcUserStatusIcon\",\n props: /* @__PURE__ */ mergeModels({\n user: { default: void 0 },\n ariaHidden: { type: [Boolean, String], default: false }\n }, {\n \"status\": {},\n \"statusModifiers\": {}\n }),\n emits: [\"update:status\"],\n setup(__props) {\n const status = useModel(__props, \"status\");\n const props = __props;\n const isInvisible = computed(() => status.value && [\"invisible\", \"offline\"].includes(status.value));\n const ariaLabel = computed(() => status.value && (!props.ariaHidden || props.ariaHidden === \"false\") ? t(\"User status: {status}\", { status: getUserStatusText(status.value) }) : void 0);\n watch(() => props.user, async (user) => {\n if (!status.value && user && getCapabilities()?.user_status?.enabled) {\n try {\n const { data } = await axios.get(generateOcsUrl(\"/apps/user_status/api/v1/statuses/{user}\", { user }));\n status.value = data.ocs?.data?.status;\n } catch (error) {\n logger.debug(\"Error while fetching user status\", { error });\n }\n }\n }, { immediate: true });\n const matchSvg = {\n online: onlineSvg,\n away: awaySvg,\n busy: busySvg,\n dnd: dndSvg,\n invisible: invisibleSvg,\n offline: invisibleSvg\n };\n const activeSvg = computed(() => status.value && matchSvg[status.value]);\n return (_ctx, _cache) => {\n return status.value ? (openBlock(), createElementBlock(\"span\", {\n key: 0,\n class: normalizeClass([\"user-status-icon\", {\n \"user-status-icon--invisible\": isInvisible.value\n }]),\n \"aria-hidden\": !ariaLabel.value || void 0,\n \"aria-label\": ariaLabel.value,\n role: \"img\",\n innerHTML: activeSvg.value\n }, null, 10, _hoisted_1)) : createCommentVNode(\"\", true);\n };\n }\n});\nconst NcUserStatusIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [[\"__scopeId\", \"data-v-881a79fb\"]]);\nexport {\n NcUserStatusIcon as N,\n getUserStatusText as g\n};\n//# sourceMappingURL=NcUserStatusIcon-BgElapLh.mjs.map\n","const ActionGlobalMixin = {\n beforeUpdate() {\n this.text = this.getText();\n },\n data() {\n return {\n // $slots are not reactive.\n // We need to update the content manually\n text: this.getText()\n };\n },\n computed: {\n isLongText() {\n return this.text && this.text.trim().length > 20;\n }\n },\n methods: {\n getText() {\n return this.$slots.default?.()[0].children?.trim?.() || \"\";\n }\n }\n};\nexport {\n ActionGlobalMixin as A\n};\n//# sourceMappingURL=actionGlobal-BZFdtdJL.mjs.map\n","import { warn } from \"vue\";\nimport { N as NC_ACTIONS_CLOSE_MENU } from \"./useNcActions-BzPO2c4h.mjs\";\nimport { A as ActionGlobalMixin } from \"./actionGlobal-BZFdtdJL.mjs\";\nconst ActionTextMixin = {\n mixins: [ActionGlobalMixin],\n props: {\n /**\n * Icon to show with the action, can be either a CSS class or an URL\n */\n icon: {\n type: String,\n default: \"\"\n },\n /**\n * The main text content of the entry.\n */\n name: {\n type: String,\n default: \"\"\n },\n /**\n * The title attribute of the element.\n */\n title: {\n type: String,\n default: \"\"\n },\n /**\n * Whether we close the Actions menu after the click\n */\n closeAfterClick: {\n type: Boolean,\n default: false\n },\n /**\n * Aria label for the button. Not needed if the button has text.\n */\n ariaLabel: {\n type: String,\n default: null\n }\n },\n inject: {\n closeMenu: {\n from: NC_ACTIONS_CLOSE_MENU\n }\n },\n emits: [\n \"click\"\n ],\n created() {\n if (\"ariaHidden\" in this.$attrs) {\n warn(\"[NcAction*]: Do not set the ariaHidden attribute as the root element will inherit the incorrect aria-hidden.\");\n }\n },\n computed: {\n /**\n * Check if icon prop is an URL\n *\n * @return {boolean} Whether the icon prop is an URL\n */\n isIconUrl() {\n try {\n return !!new URL(this.icon, this.icon.startsWith(\"/\") ? window.location.origin : void 0);\n } catch {\n return false;\n }\n }\n },\n methods: {\n onClick(event) {\n this.$emit(\"click\", event);\n if (this.closeAfterClick) {\n this.closeMenu(false);\n }\n }\n }\n};\nexport {\n ActionTextMixin as A\n};\n//# sourceMappingURL=actionText-BXR0sWNu.mjs.map\n","import '../assets/NcActionButton-Bb0ihLdt.css';\nimport { c as mdiChevronRight, d as mdiCheck } from \"./mdi-CpchYUUV.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-BvLanNaW.mjs\";\nimport { A as ActionTextMixin } from \"./actionText-BXR0sWNu.mjs\";\nimport { a as NC_ACTIONS_IS_SEMANTIC_MENU } from \"./useNcActions-BzPO2c4h.mjs\";\nimport { resolveComponent, createElementBlock, openBlock, normalizeClass, createElementVNode, mergeProps, renderSlot, createBlock, createCommentVNode, normalizeStyle, toDisplayString } from \"vue\";\nimport { _ as _export_sfc } from \"./_plugin-vue_export-helper-1tPrXgE0.mjs\";\nconst _sfc_main = {\n name: \"NcActionButton\",\n components: {\n NcIconSvgWrapper\n },\n mixins: [ActionTextMixin],\n inject: {\n isInSemanticMenu: {\n from: NC_ACTIONS_IS_SEMANTIC_MENU,\n default: false\n }\n },\n props: {\n /**\n * disabled state of the action button\n */\n disabled: {\n type: Boolean,\n default: false\n },\n /**\n * If this is a menu, a chevron icon will\n * be added at the end of the line\n */\n isMenu: {\n type: Boolean,\n default: false\n },\n /**\n * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n * This extends the native HTML button type attribute.\n */\n type: {\n type: String,\n default: \"button\",\n validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n },\n /**\n * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n * For checkbox and toggle button behavior - boolean value.\n * For radio button behavior - could be a boolean checked or a string with the value of the button.\n * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n *\n * **This is not availabe for `type='submit'` or `type='reset'`**\n *\n * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n * For `type='radio'` `null` is equal to `false`\n */\n modelValue: {\n type: [Boolean, String],\n default: null\n },\n /**\n * The value used for the `modelValue` when this component is used with radio behavior\n * Similar to the `value` attribute of ``\n */\n value: {\n type: String,\n default: null\n },\n /**\n * Small underlying text content of the entry\n */\n description: {\n type: String,\n default: \"\"\n }\n },\n emits: [\"update:modelValue\"],\n setup() {\n return {\n mdiCheck,\n mdiChevronRight\n };\n },\n computed: {\n /**\n * determines if the action is focusable\n *\n * @return {boolean} is the action focusable ?\n */\n isFocusable() {\n return !this.disabled;\n },\n /**\n * The current \"checked\" or \"pressed\" state for the model behavior\n */\n isChecked() {\n if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n return this.modelValue === this.value;\n }\n return this.modelValue;\n },\n /**\n * The native HTML type to set on the button\n */\n nativeType() {\n if (this.type === \"submit\" || this.type === \"reset\") {\n return this.type;\n }\n return \"button\";\n },\n /**\n * HTML attributes to bind to the
+ @update:modelValue="updateSettings"> {{ t('notifications', 'Play sound when a new notification arrives') }} + @update:modelValue="updateSettings"> {{ t('notifications', 'Play sound when a call started (requires Nextcloud Talk)') }} diff --git a/src/views/UserSettings.vue b/src/views/UserSettings.vue index f3c610e6d..c22140cd8 100644 --- a/src/views/UserSettings.vue +++ b/src/views/UserSettings.vue @@ -17,19 +17,19 @@ v-model="currentBatchTime" class="notification-frequency__select" :clearable="false" - label-outside + labelOutside :options="BATCHTIME_OPTIONS" - @update:model-value="updateSettings" /> + @update:modelValue="updateSettings" />
+ @update:modelValue="updateSettings"> {{ t('notifications', 'Play sound when a new notification arrives') }} + @update:modelValue="updateSettings"> {{ t('notifications', 'Play sound when a call started (requires Nextcloud Talk)') }} @@ -38,7 +38,7 @@ v-model="storage.secondary_speaker" class="additional-margin-top" :disabled="isSafari" - @update:model-value="updateLocalSettings"> + @update:modelValue="updateLocalSettings"> {{ t('notifications', 'Also repeat sound on a secondary speaker') }}
@@ -47,14 +47,14 @@ + @update:modelValue="updateLocalSettings" />