@goldenhippo/builder-cart-plugin 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see plugin.system.js.LICENSE.txt */
2
- System.register(["@builder.io/react","@builder.io/app-context","react","mobx-react","react-dom"],function(e,t){var n={},r={},o={},i={},s={};return Object.defineProperty(o,"__esModule",{value:!0}),{setters:[function(e){n.Builder=e.Builder},function(e){r.default=e.default||e},function(e){o.default=e.default||e,Object.keys(e).forEach(function(t){o[t]=e[t]})},function(e){i.observer=e.observer,i.useLocalStore=e.useLocalStore,i.useObserver=e.useObserver},function(e){s.default=e.default||e,s.flushSync=e.flushSync}],execute:function(){e((()=>{"use strict";var e={205(e,t,n){n.d(t,{A:()=>f});var r=n(173),o=n.n(r),i=n(806),s=n.n(i),a=n(501),l=n.n(a),d=new URL(n(566),n.b),c=new URL(n(934),n.b),p=s()(o()),u=l()(d),h=l()(c);p.push([e.id,`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n :root, :host {\n --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",\n "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n "Courier New", monospace;\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --container-7xl: 80rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --font-weight-thin: 100;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --tracking-tight: -0.025em;\n --tracking-wide: 0.025em;\n --tracking-widest: 0.1em;\n --leading-tight: 1.25;\n --leading-relaxed: 1.625;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --animate-spin: spin 1s linear infinite;\n --blur-sm: 8px;\n --blur-xl: 24px;\n --aspect-video: 16 / 9;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden="until-found"])) {\n display: none !important;\n }\n}\n@layer utilities {\n .absolute {\n position: absolute;\n }\n .fixed {\n position: fixed;\n }\n .relative {\n position: relative;\n }\n .static {\n position: static;\n }\n .sticky {\n position: sticky;\n }\n .inset-0 {\n inset: calc(var(--spacing) * 0);\n }\n .inset-x-0 {\n inset-inline: calc(var(--spacing) * 0);\n }\n .top-0 {\n top: calc(var(--spacing) * 0);\n }\n .top-1\\.5 {\n top: calc(var(--spacing) * 1.5);\n }\n .top-1\\/2 {\n top: calc(1/2 * 100%);\n }\n .right-1\\.5 {\n right: calc(var(--spacing) * 1.5);\n }\n .right-2 {\n right: calc(var(--spacing) * 2);\n }\n .bottom-0 {\n bottom: calc(var(--spacing) * 0);\n }\n .bottom-2 {\n bottom: calc(var(--spacing) * 2);\n }\n .left-1\\/2 {\n left: calc(1/2 * 100%);\n }\n .left-2 {\n left: calc(var(--spacing) * 2);\n }\n .z-50 {\n z-index: 50;\n }\n .z-\\[100\\] {\n z-index: 100;\n }\n .container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n }\n .mx-1 {\n margin-inline: calc(var(--spacing) * 1);\n }\n .mx-auto {\n margin-inline: auto;\n }\n .my-3 {\n margin-block: calc(var(--spacing) * 3);\n }\n .my-5 {\n margin-block: calc(var(--spacing) * 5);\n }\n .my-7 {\n margin-block: calc(var(--spacing) * 7);\n }\n .prose-sm {\n font-size: 0.875rem;\n line-height: 1.7142857;\n :where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n }\n :where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.2857143em;\n line-height: 1.5555556;\n margin-top: 0.8888889em;\n margin-bottom: 0.8888889em;\n }\n :where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.3333333em;\n margin-bottom: 1.3333333em;\n padding-inline-start: 1.1111111em;\n }\n :where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 2.1428571em;\n margin-top: 0;\n margin-bottom: 0.8em;\n line-height: 1.2;\n }\n :where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.4285714em;\n margin-top: 1.6em;\n margin-bottom: 0.8em;\n line-height: 1.4;\n }\n :where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.2857143em;\n margin-top: 1.5555556em;\n margin-bottom: 0.4444444em;\n line-height: 1.5555556;\n }\n :where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.4285714em;\n margin-bottom: 0.5714286em;\n line-height: 1.4285714;\n }\n :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n }\n :where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n border-radius: 0.3125rem;\n padding-top: 0.1428571em;\n padding-inline-end: 0.3571429em;\n padding-bottom: 0.1428571em;\n padding-inline-start: 0.3571429em;\n }\n :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n }\n :where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.9em;\n }\n :where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8888889em;\n }\n :where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.6666667;\n margin-top: 1.6666667em;\n margin-bottom: 1.6666667em;\n border-radius: 0.25rem;\n padding-top: 0.6666667em;\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n padding-inline-start: 1.5714286em;\n }\n :where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n padding-inline-start: 1.5714286em;\n }\n :where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n margin-bottom: 0.2857143em;\n }\n :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0.4285714em;\n }\n :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0.4285714em;\n }\n :where(.prose-sm > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n }\n :where(.prose-sm > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(.prose-sm > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n }\n :where(.prose-sm > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(.prose-sm > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n }\n :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n }\n :where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n }\n :where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n padding-inline-start: 1.5714286em;\n }\n :where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 2.8571429em;\n margin-bottom: 2.8571429em;\n }\n :where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h2 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h3 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h4 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.5;\n }\n :where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0;\n }\n :where(thead th:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 0;\n }\n :where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-top: 0.6666667em;\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0;\n }\n :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 0;\n }\n :where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n }\n :where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.3333333;\n margin-top: 0.6666667em;\n }\n :where(.prose-sm > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(.prose-sm > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 0;\n }\n }\n .mt-0\\.5 {\n margin-top: calc(var(--spacing) * 0.5);\n }\n .mt-1 {\n margin-top: calc(var(--spacing) * 1);\n }\n .mt-2 {\n margin-top: calc(var(--spacing) * 2);\n }\n .mt-3 {\n margin-top: calc(var(--spacing) * 3);\n }\n .mt-6 {\n margin-top: calc(var(--spacing) * 6);\n }\n .mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n }\n .mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n }\n .mb-3 {\n margin-bottom: calc(var(--spacing) * 3);\n }\n .mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n }\n .mb-6 {\n margin-bottom: calc(var(--spacing) * 6);\n }\n .mb-7 {\n margin-bottom: calc(var(--spacing) * 7);\n }\n .mb-8 {\n margin-bottom: calc(var(--spacing) * 8);\n }\n .ml-0\\.5 {\n margin-left: calc(var(--spacing) * 0.5);\n }\n .ml-3 {\n margin-left: calc(var(--spacing) * 3);\n }\n .ml-4 {\n margin-left: calc(var(--spacing) * 4);\n }\n .ml-16 {\n margin-left: calc(var(--spacing) * 16);\n }\n .ml-auto {\n margin-left: auto;\n }\n .line-clamp-2 {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n }\n .contents {\n display: contents;\n }\n .flex {\n display: flex;\n }\n .grid {\n display: grid;\n }\n .inline {\n display: inline;\n }\n .inline-flex {\n display: inline-flex;\n }\n .aspect-square {\n aspect-ratio: 1 / 1;\n }\n .aspect-video {\n aspect-ratio: var(--aspect-video);\n }\n .h-2 {\n height: calc(var(--spacing) * 2);\n }\n .h-3 {\n height: calc(var(--spacing) * 3);\n }\n .h-4 {\n height: calc(var(--spacing) * 4);\n }\n .h-5 {\n height: calc(var(--spacing) * 5);\n }\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n .h-8 {\n height: calc(var(--spacing) * 8);\n }\n .h-9 {\n height: calc(var(--spacing) * 9);\n }\n .h-10 {\n height: calc(var(--spacing) * 10);\n }\n .h-16 {\n height: calc(var(--spacing) * 16);\n }\n .h-32 {\n height: calc(var(--spacing) * 32);\n }\n .h-full {\n height: 100%;\n }\n .h-px {\n height: 1px;\n }\n .max-h-\\[80vh\\] {\n max-height: 80vh;\n }\n .min-h-0 {\n min-height: calc(var(--spacing) * 0);\n }\n .min-h-\\[50vh\\] {\n min-height: 50vh;\n }\n .min-h-\\[60px\\] {\n min-height: 60px;\n }\n .min-h-full {\n min-height: 100%;\n }\n .min-h-screen {\n min-height: 100vh;\n }\n .w-2 {\n width: calc(var(--spacing) * 2);\n }\n .w-3 {\n width: calc(var(--spacing) * 3);\n }\n .w-4 {\n width: calc(var(--spacing) * 4);\n }\n .w-5 {\n width: calc(var(--spacing) * 5);\n }\n .w-7 {\n width: calc(var(--spacing) * 7);\n }\n .w-8 {\n width: calc(var(--spacing) * 8);\n }\n .w-9 {\n width: calc(var(--spacing) * 9);\n }\n .w-10 {\n width: calc(var(--spacing) * 10);\n }\n .w-16 {\n width: calc(var(--spacing) * 16);\n }\n .w-40 {\n width: calc(var(--spacing) * 40);\n }\n .w-\\[640px\\] {\n width: 640px;\n }\n .w-fit {\n width: fit-content;\n }\n .w-full {\n width: 100%;\n }\n .w-px {\n width: 1px;\n }\n .max-w-7xl {\n max-width: var(--container-7xl);\n }\n .max-w-\\[90vw\\] {\n max-width: 90vw;\n }\n .max-w-\\[1200px\\] {\n max-width: 1200px;\n }\n .max-w-full {\n max-width: 100%;\n }\n .max-w-none {\n max-width: none;\n }\n .min-w-full {\n min-width: 100%;\n }\n .flex-1 {\n flex: 1;\n }\n .shrink-0 {\n flex-shrink: 0;\n }\n .-translate-x-1\\/2 {\n --tw-translate-x: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .-translate-y-1\\/2 {\n --tw-translate-y: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .rotate-180 {\n rotate: 180deg;\n }\n .animate-spin {\n animation: var(--animate-spin);\n }\n .cursor-pointer {\n cursor: pointer;\n }\n .grid-cols-1 {\n grid-template-columns: repeat(1, minmax(0, 1fr));\n }\n .grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-wrap {\n flex-wrap: wrap;\n }\n .items-center {\n align-items: center;\n }\n .items-start {\n align-items: flex-start;\n }\n .justify-between {\n justify-content: space-between;\n }\n .justify-center {\n justify-content: center;\n }\n .justify-end {\n justify-content: flex-end;\n }\n .gap-0\\.5 {\n gap: calc(var(--spacing) * 0.5);\n }\n .gap-1 {\n gap: calc(var(--spacing) * 1);\n }\n .gap-1\\.5 {\n gap: calc(var(--spacing) * 1.5);\n }\n .gap-2 {\n gap: calc(var(--spacing) * 2);\n }\n .gap-3 {\n gap: calc(var(--spacing) * 3);\n }\n .gap-4 {\n gap: calc(var(--spacing) * 4);\n }\n .gap-5 {\n gap: calc(var(--spacing) * 5);\n }\n .gap-6 {\n gap: calc(var(--spacing) * 6);\n }\n .space-y-0 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-1 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-2\\.5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-3 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-4 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-6 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .gap-x-6 {\n column-gap: calc(var(--spacing) * 6);\n }\n .gap-y-4 {\n row-gap: calc(var(--spacing) * 4);\n }\n .gap-y-5 {\n row-gap: calc(var(--spacing) * 5);\n }\n .truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .overflow-hidden {\n overflow: hidden;\n }\n .overflow-x-auto {\n overflow-x: auto;\n }\n .overflow-y-auto {\n overflow-y: auto;\n }\n .rounded {\n border-radius: 0.25rem;\n }\n .rounded-2xl {\n border-radius: var(--radius-2xl);\n }\n .rounded-full {\n border-radius: calc(infinity * 1px);\n }\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n .rounded-md {\n border-radius: var(--radius-md);\n }\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n .border-t {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n }\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n .border-l-2 {\n border-left-style: var(--tw-border-style);\n border-left-width: 2px;\n }\n .border-dashed {\n --tw-border-style: dashed;\n border-style: dashed;\n }\n .border-\\[var\\(--accent\\)\\] {\n border-color: var(--accent);\n }\n .border-\\[var\\(--accent\\)\\]\\/20 {\n border-color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--accent) 20%, transparent);\n }\n }\n .border-\\[var\\(--border-glass\\)\\] {\n border-color: var(--border-glass);\n }\n .border-\\[var\\(--error\\)\\]\\/20 {\n border-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--error) 20%, transparent);\n }\n }\n .border-\\[var\\(--input-border\\)\\] {\n border-color: var(--input-border);\n }\n .border-\\[var\\(--success\\)\\]\\/20 {\n border-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--success) 20%, transparent);\n }\n }\n .border-\\[var\\(--success\\)\\]\\/30 {\n border-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--success) 30%, transparent);\n }\n }\n .border-\\[var\\(--warning\\)\\]\\/30 {\n border-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--warning) 30%, transparent);\n }\n }\n .bg-\\[var\\(--accent\\)\\] {\n background-color: var(--accent);\n }\n .bg-\\[var\\(--accent\\)\\]\\/15 {\n background-color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--accent) 15%, transparent);\n }\n }\n .bg-\\[var\\(--accent-subtle\\)\\] {\n background-color: var(--accent-subtle);\n }\n .bg-\\[var\\(--bg-glass\\)\\] {\n background-color: var(--bg-glass);\n }\n .bg-\\[var\\(--bg-glass-hover\\)\\] {\n background-color: var(--bg-glass-hover);\n }\n .bg-\\[var\\(--bg-primary\\)\\]\\/80 {\n background-color: var(--bg-primary);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--bg-primary) 80%, transparent);\n }\n }\n .bg-\\[var\\(--bg-secondary\\)\\] {\n background-color: var(--bg-secondary);\n }\n .bg-\\[var\\(--border-glass\\)\\] {\n background-color: var(--border-glass);\n }\n .bg-\\[var\\(--error\\)\\]\\/5 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 5%, transparent);\n }\n }\n .bg-\\[var\\(--error\\)\\]\\/10 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 10%, transparent);\n }\n }\n .bg-\\[var\\(--error\\)\\]\\/15 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 15%, transparent);\n }\n }\n .bg-\\[var\\(--input-bg\\)\\] {\n background-color: var(--input-bg);\n }\n .bg-\\[var\\(--success\\)\\]\\/10 {\n background-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--success) 10%, transparent);\n }\n }\n .bg-\\[var\\(--success\\)\\]\\/15 {\n background-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--success) 15%, transparent);\n }\n }\n .bg-\\[var\\(--warning\\)\\]\\/10 {\n background-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--warning) 10%, transparent);\n }\n }\n .bg-\\[var\\(--warning\\)\\]\\/15 {\n background-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--warning) 15%, transparent);\n }\n }\n .bg-black\\/50 {\n background-color: color-mix(in srgb, #000 50%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 50%, transparent);\n }\n }\n .bg-black\\/60 {\n background-color: color-mix(in srgb, #000 60%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 60%, transparent);\n }\n }\n .bg-black\\/70 {\n background-color: color-mix(in srgb, #000 70%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 70%, transparent);\n }\n }\n .bg-white\\/10 {\n background-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n .fill-current {\n fill: currentcolor;\n }\n .object-contain {\n object-fit: contain;\n }\n .object-cover {\n object-fit: cover;\n }\n .p-1 {\n padding: calc(var(--spacing) * 1);\n }\n .p-2 {\n padding: calc(var(--spacing) * 2);\n }\n .p-3 {\n padding: calc(var(--spacing) * 3);\n }\n .p-4 {\n padding: calc(var(--spacing) * 4);\n }\n .p-5 {\n padding: calc(var(--spacing) * 5);\n }\n .p-6 {\n padding: calc(var(--spacing) * 6);\n }\n .p-8 {\n padding: calc(var(--spacing) * 8);\n }\n .px-1\\.5 {\n padding-inline: calc(var(--spacing) * 1.5);\n }\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n .px-2\\.5 {\n padding-inline: calc(var(--spacing) * 2.5);\n }\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n .px-3\\.5 {\n padding-inline: calc(var(--spacing) * 3.5);\n }\n .px-4 {\n padding-inline: calc(var(--spacing) * 4);\n }\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n .px-8 {\n padding-inline: calc(var(--spacing) * 8);\n }\n .py-0\\.5 {\n padding-block: calc(var(--spacing) * 0.5);\n }\n .py-1 {\n padding-block: calc(var(--spacing) * 1);\n }\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n .py-2\\.5 {\n padding-block: calc(var(--spacing) * 2.5);\n }\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n .py-3\\.5 {\n padding-block: calc(var(--spacing) * 3.5);\n }\n .py-5 {\n padding-block: calc(var(--spacing) * 5);\n }\n .py-12 {\n padding-block: calc(var(--spacing) * 12);\n }\n .py-16 {\n padding-block: calc(var(--spacing) * 16);\n }\n .pt-0 {\n padding-top: calc(var(--spacing) * 0);\n }\n .pr-4 {\n padding-right: calc(var(--spacing) * 4);\n }\n .pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\n }\n .pl-4 {\n padding-left: calc(var(--spacing) * 4);\n }\n .text-center {\n text-align: center;\n }\n .text-left {\n text-align: left;\n }\n .text-right {\n text-align: right;\n }\n .font-mono {\n font-family: var(--font-mono);\n }\n .text-2xl {\n font-size: var(--text-2xl);\n line-height: var(--tw-leading, var(--text-2xl--line-height));\n }\n .text-6xl {\n font-size: var(--text-6xl);\n line-height: var(--tw-leading, var(--text-6xl--line-height));\n }\n .text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n }\n .text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n }\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n .text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n }\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n .text-\\[10px\\] {\n font-size: 10px;\n }\n .text-\\[11px\\] {\n font-size: 11px;\n }\n .text-\\[15px\\] {\n font-size: 15px;\n }\n .text-\\[17px\\] {\n font-size: 17px;\n }\n .leading-relaxed {\n --tw-leading: var(--leading-relaxed);\n line-height: var(--leading-relaxed);\n }\n .leading-tight {\n --tw-leading: var(--leading-tight);\n line-height: var(--leading-tight);\n }\n .font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n }\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n .font-thin {\n --tw-font-weight: var(--font-weight-thin);\n font-weight: var(--font-weight-thin);\n }\n .tracking-\\[1\\.5px\\] {\n --tw-tracking: 1.5px;\n letter-spacing: 1.5px;\n }\n .tracking-tight {\n --tw-tracking: var(--tracking-tight);\n letter-spacing: var(--tracking-tight);\n }\n .tracking-wide {\n --tw-tracking: var(--tracking-wide);\n letter-spacing: var(--tracking-wide);\n }\n .tracking-widest {\n --tw-tracking: var(--tracking-widest);\n letter-spacing: var(--tracking-widest);\n }\n .break-all {\n word-break: break-all;\n }\n .whitespace-nowrap {\n white-space: nowrap;\n }\n .text-\\[\\#1a1a2e\\] {\n color: #1a1a2e;\n }\n .text-\\[var\\(--accent\\)\\] {\n color: var(--accent);\n }\n .text-\\[var\\(--accent\\)\\]\\/60 {\n color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, var(--accent) 60%, transparent);\n }\n }\n .text-\\[var\\(--error\\)\\] {\n color: var(--error);\n }\n .text-\\[var\\(--success\\)\\] {\n color: var(--success);\n }\n .text-\\[var\\(--text-muted\\)\\] {\n color: var(--text-muted);\n }\n .text-\\[var\\(--text-primary\\)\\] {\n color: var(--text-primary);\n }\n .text-\\[var\\(--text-secondary\\)\\] {\n color: var(--text-secondary);\n }\n .text-\\[var\\(--warning\\)\\] {\n color: var(--warning);\n }\n .text-white\\/80 {\n color: color-mix(in srgb, #fff 80%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, var(--color-white) 80%, transparent);\n }\n }\n .uppercase {\n text-transform: uppercase;\n }\n .italic {\n font-style: italic;\n }\n .underline {\n text-decoration-line: underline;\n }\n .opacity-0 {\n opacity: 0%;\n }\n .opacity-25 {\n opacity: 25%;\n }\n .opacity-60 {\n opacity: 60%;\n }\n .opacity-70 {\n opacity: 70%;\n }\n .opacity-75 {\n opacity: 75%;\n }\n .opacity-100 {\n opacity: 100%;\n }\n .shadow-2xl {\n --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-sm {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-2 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-\\[var\\(--accent-glow\\)\\] {\n --tw-ring-color: var(--accent-glow);\n }\n .filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n .backdrop-blur-sm {\n --tw-backdrop-blur: blur(var(--blur-sm));\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .backdrop-blur-xl {\n --tw-backdrop-blur: blur(var(--blur-xl));\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .transition-all {\n transition-property: all;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-colors {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-opacity {\n transition-property: opacity;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-shadow {\n transition-property: box-shadow;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .duration-300 {\n --tw-duration: 300ms;\n transition-duration: 300ms;\n }\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n .group-hover\\:opacity-100 {\n &:is(:where(.group):hover *) {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .last\\:border-b-0 {\n &:last-child {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 0px;\n }\n }\n .focus-within\\:border-\\[var\\(--input-focus-border\\)\\] {\n &:focus-within {\n border-color: var(--input-focus-border);\n }\n }\n .focus-within\\:shadow-\\[0_0_0_3px_var\\(--input-focus-glow\\)\\] {\n &:focus-within {\n --tw-shadow: 0 0 0 3px var(--tw-shadow-color, var(--input-focus-glow));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .hover\\:border-\\[var\\(--border-glass-focus\\)\\] {\n &:hover {\n @media (hover: hover) {\n border-color: var(--border-glass-focus);\n }\n }\n }\n .hover\\:border-white\\/10 {\n &:hover {\n @media (hover: hover) {\n border-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-\\[var\\(--bg-glass-hover\\)\\] {\n &:hover {\n @media (hover: hover) {\n background-color: var(--bg-glass-hover);\n }\n }\n }\n .hover\\:bg-\\[var\\(--error\\)\\]\\/10 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-\\[var\\(--error\\)\\]\\/25 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 25%, transparent);\n }\n }\n }\n }\n .hover\\:text-\\[var\\(--accent\\)\\] {\n &:hover {\n @media (hover: hover) {\n color: var(--accent);\n }\n }\n }\n .hover\\:text-\\[var\\(--text-primary\\)\\] {\n &:hover {\n @media (hover: hover) {\n color: var(--text-primary);\n }\n }\n }\n .hover\\:opacity-100 {\n &:hover {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .hover\\:shadow-\\[0_0_20px_var\\(--accent-glow\\)\\] {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 0 20px var(--tw-shadow-color, var(--accent-glow));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:shadow-lg {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:brightness-110 {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(110%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n }\n .disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n }\n .disabled\\:opacity-40 {\n &:disabled {\n opacity: 40%;\n }\n }\n .disabled\\:hover\\:shadow-none {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 0 #0000;\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n }\n .disabled\\:hover\\:brightness-100 {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n }\n }\n .sm\\:grid-cols-4 {\n @media (width >= 40rem) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n .md\\:grid-cols-2 {\n @media (width >= 48rem) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n }\n .md\\:grid-cols-3 {\n @media (width >= 48rem) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n }\n .lg\\:grid-cols-3 {\n @media (width >= 64rem) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n }\n .lg\\:grid-cols-4 {\n @media (width >= 64rem) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n}\n#hippo-app, #hippo-app[data-theme='dark'] {\n --bg-primary: #0a0e1a;\n --bg-secondary: #111827;\n --bg-glass: rgba(255, 255, 255, 0.05);\n --bg-glass-hover: rgba(255, 255, 255, 0.08);\n --border-glass: rgba(255, 255, 255, 0.1);\n --border-glass-focus: rgba(200, 169, 81, 0.3);\n --text-primary: rgba(255, 255, 255, 0.92);\n --text-secondary: rgba(255, 255, 255, 0.55);\n --text-muted: rgba(255, 255, 255, 0.3);\n --accent: #c8a951;\n --accent-glow: rgba(200, 169, 81, 0.15);\n --accent-subtle: rgba(200, 169, 81, 0.08);\n --input-bg: rgba(255, 255, 255, 0.04);\n --input-border: rgba(255, 255, 255, 0.08);\n --input-focus-border: rgba(200, 169, 81, 0.4);\n --input-focus-glow: rgba(200, 169, 81, 0.08);\n --toggle-bg: rgba(255, 255, 255, 0.1);\n --toggle-active: #c8a951;\n --success: #34d399;\n --error: #f87171;\n --warning: #fbbf24;\n --radius-sm: 8px;\n --radius-md: 12px;\n --radius-lg: 16px;\n color-scheme: dark;\n}\n#hippo-app[data-theme='light'] {\n --bg-primary: #f8f9fc;\n --bg-secondary: #ffffff;\n --bg-glass: rgba(0, 0, 0, 0.02);\n --bg-glass-hover: rgba(0, 0, 0, 0.04);\n --border-glass: rgba(0, 0, 0, 0.06);\n --border-glass-focus: rgba(184, 153, 61, 0.3);\n --text-primary: rgba(0, 0, 0, 0.87);\n --text-secondary: rgba(0, 0, 0, 0.55);\n --text-muted: rgba(0, 0, 0, 0.3);\n --accent: #b8993d;\n --accent-glow: rgba(184, 153, 61, 0.15);\n --accent-subtle: rgba(184, 153, 61, 0.08);\n --input-bg: rgba(0, 0, 0, 0.03);\n --input-border: rgba(0, 0, 0, 0.08);\n --input-focus-border: rgba(184, 153, 61, 0.4);\n --input-focus-glow: rgba(184, 153, 61, 0.08);\n --toggle-bg: rgba(0, 0, 0, 0.12);\n --toggle-active: #b8993d;\n --success: #059669;\n --error: #dc2626;\n --warning: #d97706;\n color-scheme: light;\n}\n#hippo-app {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n color: var(--text-primary);\n background: var(--bg-primary);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n@layer utilities {\n .no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n}\n@keyframes hippo-spin {\n to {\n transform: rotate(360deg);\n }\n}\n.hippo-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--border-glass);\n border-top-color: var(--accent);\n border-radius: 50%;\n animation: hippo-spin 0.6s linear infinite;\n}\n.hippo-spinner-lg {\n width: 36px;\n height: 36px;\n border-width: 3px;\n}\n.hippo-toggle {\n position: relative;\n width: 40px;\n height: 22px;\n border-radius: 11px;\n background: var(--toggle-bg);\n cursor: pointer;\n transition: background 0.2s;\n appearance: none;\n border: none;\n outline: none;\n flex-shrink: 0;\n}\n.hippo-toggle::after {\n content: '';\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: white;\n top: 3px;\n left: 3px;\n transition: transform 0.2s;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n.hippo-toggle:checked {\n background: var(--toggle-active);\n}\n.hippo-toggle:checked::after {\n transform: translateX(18px);\n}\n.hippo-input {\n width: 100%;\n padding: 10px 14px;\n border-radius: var(--radius-sm);\n border: 1px solid var(--input-border);\n background: var(--input-bg);\n color: var(--text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;\n outline: none;\n}\n.hippo-input::placeholder {\n color: var(--text-muted);\n}\n.hippo-input:focus {\n border-color: var(--input-focus-border);\n box-shadow: 0 0 0 3px var(--input-focus-glow);\n background: var(--bg-glass-hover);\n}\ntextarea.hippo-input {\n resize: vertical;\n min-height: 80px;\n}\nselect.hippo-input {\n appearance: none;\n background-image: url(${u});\n background-repeat: no-repeat;\n background-position: right 12px center;\n padding-right: 36px;\n cursor: pointer;\n}\n#hippo-app[data-theme='light'] select.hippo-input {\n background-image: url(${h});\n}\n@property --tw-translate-x {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-y {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-z {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-space-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-leading {\n syntax: "*";\n inherits: false;\n}\n@property --tw-font-weight {\n syntax: "*";\n inherits: false;\n}\n@property --tw-tracking {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-inset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: "<length>";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: "*";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-drop-shadow-size {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-duration {\n syntax: "*";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *, ::before, ::after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-space-y-reverse: 0;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-tracking: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n --tw-backdrop-blur: initial;\n --tw-backdrop-brightness: initial;\n --tw-backdrop-contrast: initial;\n --tw-backdrop-grayscale: initial;\n --tw-backdrop-hue-rotate: initial;\n --tw-backdrop-invert: initial;\n --tw-backdrop-opacity: initial;\n --tw-backdrop-saturate: initial;\n --tw-backdrop-sepia: initial;\n --tw-duration: initial;\n }\n }\n}\n`,""]);const f=p},806(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var d=0;d<e.length;d++){var c=[].concat(e[d]);r&&s[c[0]]||(void 0!==i&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},501(e){e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},173(e){e.exports=function(e){return e[1]}},736(e,t,n){var r=n(726),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var r,i={},d=null,c=null;for(r in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},500(e,t,n){e.exports=n(736)},604(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},s=[],a=0;a<e.length;a++){var l=e[a],d=r.base?l[0]+r.base:l[0],c=i[d]||0,p="".concat(d," ").concat(c);i[d]=c+1;var u=n(p),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(h);else{var f=o(h,r);r.byIndex=a,t.splice(a,0,{identifier:p,updater:f,references:1})}s.push(p)}return s}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<i.length;s++){var a=n(i[s]);t[a].references--}for(var l=r(e,o),d=0;d<i.length;d++){var c=n(i[d]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}i=l}}},863(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},896(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},124(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},101(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},917(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},913(e,t,n){var r=n(726),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return a(function(){o.value=n,o.getSnapshot=t,d(o)&&c({inst:o})},[e,n,t]),s(function(){return d(o)&&c({inst:o}),e(function(){d(o)&&c({inst:o})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},414(e,t,n){var r=n(726),o=n(436),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,a=r.useRef,l=r.useEffect,d=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var p=a(null);if(null===p.current){var u={hasValue:!1,value:null};p.current=u}else u=p.current;p=d(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==o&&u.hasValue){var t=u.value;if(o(t,e))return a=t}return a=e}if(t=a,i(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,d=void 0===n?null:n;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]},[t,n,r,o]);var h=s(e,p[0],p[1]);return l(function(){u.hasValue=!0,u.value=h},[h]),c(h),h}},436(e,t,n){e.exports=n(913)},358(e,t,n){e.exports=n(414)},934(e){e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27rgba%280,0,0,0.4%29%27 stroke-width=%272%27%3E%3Cpath d=%27M6 9l6 6 6-6%27/%3E%3C/svg%3E"},566(e){e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27rgba%28255,255,255,0.4%29%27 stroke-width=%272%27%3E%3Cpath d=%27M6 9l6 6 6-6%27/%3E%3C/svg%3E"},404(e){e.exports=r},522(e){e.exports=n},979(e){e.exports=i},726(e){e.exports=o},867(e){e.exports=s}},t={};function a(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={id:n,exports:{}};return e[n](o,o.exports,a),o.exports}a.m=e,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.b="undefined"!=typeof document&&document.baseURI||self.location.href,a.nc=void 0;var l=a(522),d=a(404),c=a(500),p=a(726),u=a(979);const h="@goldenhippo/hippo-commerce-builder-cart-plugin",f=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#C8A951" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/>\n <circle cx="12" cy="12" r="3"/>\n</svg>')}`,m=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#C8A951" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>\n <path d="m9 12 2 2 4-4"/>\n</svg>')}`,g=class{static getUserDetails(e){const{user:t}=e;console.info("[Hippo Commerce] USER",JSON.parse(JSON.stringify(t)));const n=t.organizations.find(e=>e.value.id===t.currentOrganization),r=n?.value.settings.plugins.toJSON()[h],o=r?.brand??"Brand not configured",i=r?.otherBrand??"";return{id:t.id,brand:"Other"===o?i:o,email:t.data.email,name:t.data.displayName,permissions:{admin:t.can("admin"),createContent:t.can("createContent"),editCode:t.can("editCode"),editDesigns:t.can("editDesigns")},hippoApi:{user:r?.apiUser??"",password:r?.apiPassword??"",url:r?.apiUrl}}}};var y=a(604),b=a.n(y),x=a(101),v=a.n(x),w=a(863),k=a.n(w),C=a(124),T=a.n(C),N=a(896),S=a.n(N),M=a(917),j=a.n(M),O=a(205),A={};A.styleTagTransform=j(),A.setAttributes=T(),A.insert=k().bind(null,"head"),A.domAPI=v(),A.insertStyleElement=S(),b()(O.A,A),O.A&&O.A.locals&&O.A.locals;const E=({context:e,children:t})=>(0,u.useObserver)(()=>{const n=e.config.darkMode,r=n?"dark":"light",o=g.getUserDetails(e).brand;return(0,c.jsx)(p.default.StrictMode,{children:(0,c.jsxs)("div",{id:"hippo-app","data-theme":r,className:"min-h-screen",style:{background:n?"radial-gradient(ellipse 80% 60% at 50% -20%, rgba(200,169,81,0.06), transparent),\n radial-gradient(ellipse 60% 40% at 80% 100%, rgba(100,80,200,0.04), transparent),\n var(--bg-primary)":"var(--bg-primary)"},children:[(0,c.jsxs)("div",{className:"sticky top-0 z-50 flex items-center justify-between px-8 py-5 border-b border-[var(--border-glass)] backdrop-blur-xl bg-[var(--bg-primary)]/80",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h1",{className:"text-[17px] font-bold text-[var(--accent)] tracking-tight",children:"Hippo Commerce"}),o&&(0,c.jsx)("p",{className:"text-[11px] font-medium tracking-[1.5px] uppercase text-[var(--text-muted)] mt-0.5",children:o})]}),(0,c.jsx)("button",{className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer flex items-center justify-center hover:bg-[var(--bg-glass-hover)] hover:border-white/10 transition-all",onClick:()=>{e.config.darkMode=!e.config.darkMode},title:n?"Switch to light mode":"Switch to dark mode",children:n?(0,c.jsx)("svg",{className:"w-4 h-4 fill-current",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)("path",{d:"M21.64,13a1,1,0,0,0-1.05-.14,8.05,8.05,0,0,1-3.37.73A8.15,8.15,0,0,1,9.08,5.49a8.59,8.59,0,0,1,.25-2A1,1,0,0,0,8,2.36,10.14,10.14,0,1,0,22,14.05,1,1,0,0,0,21.64,13ZM18,22A10.11,10.11,0,0,1,4.46,10.28,8.11,8.11,0,0,0,17.09,4.73a10.16,10.16,0,0,1,2.28,8.71A10,10,0,0,1,18,22Z"})}):(0,c.jsx)("svg",{className:"w-4 h-4 fill-current",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)("path",{d:"M5.64,17l-.71.71a1,1,0,0,0,0,1.41,1,1,0,0,0,1.41,0l.71-.71A1,1,0,0,0,5.64,17ZM5,12a1,1,0,0,0-1-1H3a1,1,0,0,0,0,2H4A1,1,0,0,0,5,12Zm7-7a1,1,0,0,0,1-1V3a1,1,0,0,0-2,0V4A1,1,0,0,0,12,5ZM5.64,7.05a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41l-.71-.71A1,1,0,0,0,4.93,6.34Zm12,.29a1,1,0,0,0,.7-.29l.71-.71a1,1,0,1,0-1.41-1.41L17,5.64a1,1,0,0,0,0,1.41A1,1,0,0,0,17.66,7.34ZM21,11H20a1,1,0,0,0,0,2h1a1,1,0,0,0,0-2Zm-9,8a1,1,0,0,0-1,1v1a1,1,0,0,0,2,0V20A1,1,0,0,0,12,19ZM18.36,17A1,1,0,0,0,17,18.36l.71.71a1,1,0,0,0,1.41,0,1,1,0,0,0,0-1.41ZM12,6.5A5.5,5.5,0,1,0,17.5,12,5.51,5.51,0,0,0,12,6.5Zm0,9A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z"})})})]}),(0,c.jsx)("div",{className:"p-8 max-w-[1200px] mx-auto",children:t})]})})});function L(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=L(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const I=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=L(e))&&(r&&(r+=" "),r+=t);return r};function D({message:e,size:t="md"}){return(0,c.jsx)("section",{className:"p-4 max-w-7xl min-w-full mx-auto",children:(0,c.jsxs)("div",{className:"w-fit mx-auto flex flex-col items-center justify-center gap-3 py-12",role:"status","aria-live":"polite",children:[(0,c.jsx)("div",{className:I("hippo-spinner","lg"===t&&"hippo-spinner-lg"),"aria-label":"Loading"}),e&&(0,c.jsx)("div",{className:I("font-medium text-[var(--text-secondary)]","lg"===t?"text-base":"text-sm"),children:e})]})})}function R({title:e,subtitle:t,actions:n,children:r,className:o,variant:i="default"}){return(0,c.jsxs)("div",{className:I("rounded-2xl p-8 backdrop-blur-sm border","danger"===i?"border-[var(--error)]/20 bg-[var(--error)]/5":"bg-[var(--bg-glass)] border-[var(--border-glass)]",o),children:[(e||n)&&(0,c.jsxs)("div",{className:I("flex items-center justify-between",r?"mb-6":""),children:[(0,c.jsxs)("div",{children:[e&&(0,c.jsx)("h2",{className:"text-[15px] font-semibold text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("p",{className:"text-xs text-[var(--text-muted)] mt-1",children:t})]}),n&&(0,c.jsx)("div",{className:"flex items-center gap-2",children:n})]}),r]})}function P({title:e,subtitle:t,actions:n,className:r}){return(0,c.jsxs)("div",{className:I("flex items-center justify-between mb-7",r),children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h1",{className:"text-xl font-bold tracking-tight text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)] mt-1",children:t})]}),n&&(0,c.jsx)("div",{className:"flex items-center gap-3",children:n})]})}function z({label:e,required:t,helper:n,error:r,children:o,className:i}){return(0,c.jsxs)("div",{className:I("space-y-2.5",i),children:[(0,c.jsxs)("label",{className:"text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:[e,t&&(0,c.jsx)("span",{className:"text-[var(--accent)] ml-0.5",children:"*"})]}),o,r&&(0,c.jsx)("p",{className:"text-[11px] text-[var(--error)]",children:r}),!r&&n&&(0,c.jsx)("p",{className:"text-[11px] text-[var(--text-muted)] leading-relaxed",children:n})]})}function B({message:e,action:t,className:n}){return(0,c.jsx)("div",{className:I("rounded-2xl border border-dashed border-[var(--border-glass)] py-16 px-6 backdrop-blur-sm",n),children:(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("p",{className:"text-[var(--text-muted)] mb-4",children:e}),t&&(0,c.jsx)("button",{className:"px-5 py-2.5 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)]",onClick:t.onClick,children:t.label})]})})}function F({value:e,label:t,onChange:n,fetchAssets:r,className:o}){const[i,s]=(0,p.useState)(!1),[a,l]=(0,p.useState)([]),[d,u]=(0,p.useState)(!1),[h,f]=(0,p.useState)(null),[m,g]=(0,p.useState)(""),y="string"==typeof e&&e.length>0,b=(0,p.useCallback)(async()=>{if(r){u(!0),f(null);try{const e=await r();l(e)}catch(e){f(e.message??"Failed to load media library")}finally{u(!1)}}},[r]);(0,p.useEffect)(()=>{i&&r&&0===a.length&&!d&&b()},[i,r,a.length,d,b]);const x=()=>s(!0),v=()=>{s(!1),g("")},w=m?a.filter(e=>e.name?.toLowerCase().includes(m.toLowerCase())):a;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:I("w-40 flex flex-col gap-1.5",o),children:[y?(0,c.jsxs)("div",{className:"relative w-40 h-32 rounded-xl border border-[var(--border-glass)] bg-[var(--input-bg)] cursor-pointer overflow-hidden group",onClick:x,children:[(0,c.jsx)("img",{src:e,alt:t,className:"w-full h-full object-contain p-3"}),(0,c.jsxs)("div",{className:"absolute inset-0 bg-black/60 flex flex-col items-center justify-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,c.jsx)("button",{type:"button",className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-[var(--accent)] text-[#1a1a2e] cursor-pointer",onClick:e=>{e.stopPropagation(),x()},children:"Change"}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-white/10 text-white/80 cursor-pointer",onClick:e=>{e.stopPropagation(),n(void 0)},children:"Remove"})]})]}):(0,c.jsxs)("div",{className:"w-40 h-32 rounded-xl border border-dashed border-[var(--border-glass)] bg-[var(--input-bg)] cursor-pointer flex flex-col items-center justify-center gap-2 hover:border-[var(--border-glass-focus)] hover:bg-[var(--bg-glass-hover)] transition-all",onClick:x,children:[(0,c.jsx)("div",{className:"w-8 h-8 rounded-full bg-[var(--accent-subtle)] flex items-center justify-center",children:(0,c.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M12 5v14M5 12h14"})})}),(0,c.jsx)("span",{className:"text-xs font-medium text-[var(--text-muted)]",children:"Select Image"})]}),(0,c.jsx)("span",{className:"text-[11px] font-medium text-[var(--text-secondary)] text-center leading-tight",children:t})]}),i&&(0,c.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-[100]",onClick:v,children:(0,c.jsxs)("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border-glass)] rounded-2xl p-6 w-[640px] max-w-[90vw] max-h-[80vh] shadow-2xl flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-[var(--text-primary)]",children:"Select Image"}),(0,c.jsx)("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:"Choose from your Builder.io media library"})]}),(0,c.jsx)("button",{type:"button",className:"w-8 h-8 rounded-lg flex items-center justify-center text-[var(--text-muted)] hover:bg-[var(--bg-glass-hover)] cursor-pointer transition-colors",onClick:v,children:(0,c.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),(0,c.jsx)("input",{type:"text",className:"hippo-input mb-4 text-sm",placeholder:"Search images...",value:m,onChange:e=>g(e.target.value)}),(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[d&&(0,c.jsxs)("div",{className:"flex items-center justify-center py-16",children:[(0,c.jsx)("div",{className:"hippo-spinner"}),(0,c.jsx)("span",{className:"ml-3 text-sm text-[var(--text-muted)]",children:"Loading media library..."})]}),h&&(0,c.jsxs)("div",{className:"text-center py-12",children:[(0,c.jsx)("p",{className:"text-sm text-[var(--error)] mb-3",children:h}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:b,children:"Retry"})]}),!d&&!h&&!r&&(0,c.jsx)("div",{className:"text-center py-12 text-sm text-[var(--text-muted)]",children:"Media library not available"}),!d&&!h&&r&&0===w.length&&(0,c.jsx)("div",{className:"text-center py-12 text-sm text-[var(--text-muted)]",children:m?"No images match your search":"No images found in media library"}),!d&&!h&&w.length>0&&(0,c.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-3",children:w.map(t=>{const r=e===t.url;return(0,c.jsxs)("button",{type:"button",className:I("relative rounded-lg border overflow-hidden cursor-pointer transition-all group aspect-square",r?"border-[var(--accent)] ring-2 ring-[var(--accent-glow)]":"border-[var(--border-glass)] hover:border-[var(--border-glass-focus)]"),onClick:()=>(e=>{n(e.url),v()})(t),children:[(0,c.jsx)("img",{src:`${t.url}?width=160&format=webp`,alt:t.name,className:"w-full h-full object-contain p-2 bg-[var(--input-bg)]",loading:"lazy"}),r&&(0,c.jsx)("div",{className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-[var(--accent)] flex items-center justify-center",children:(0,c.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1a2e",strokeWidth:"3",children:(0,c.jsx)("path",{d:"M20 6L9 17l-5-5"})})}),(0,c.jsx)("div",{className:"absolute inset-x-0 bottom-0 px-1.5 py-1 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,c.jsx)("p",{className:"text-[10px] text-white/80 truncate text-center",children:t.name})})]},t.id)})})]})]})})]})}var q=a(867),$=a(436);function H(e){this.content=e}H.prototype={constructor:H,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new H(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new H(n)},addToStart:function(e,t){return new H([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new H(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new H(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=H.from(e)).size?new H(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=H.from(e)).size?new H(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=H.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},H.from=function(e){if(e instanceof H)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new H(t)};const V=H;function U(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=U(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function _(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=_(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}class W{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new W(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new W(n,r)}cutByIndex(e,t){return e==t?W.empty:0==e&&t==this.content.length?this:new W(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new W(r,o)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return U(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return _(this,e,t,n)}findIndex(e){if(0==e)return K(0,e);if(e==this.size)return K(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?K(t+1,r):K(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return W.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new W(t||e,n)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const G={index:0,offset:0};function K(e,t){return G.index=e,G.offset=t,G}function J(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!J(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!J(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Y{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&J(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Y.none;if(e instanceof Y)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Y.none=[];class Q extends Error{}class Z{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ee(this.content,e+this.openStart,t);return n&&new Z(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(X(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Z.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Z(W.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new Z(e,n,r)}}function X(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(X(i.content,t-o-1,n-o-1)))}function ee(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=ee(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function te(e,t,n){if(n.openStart>e.depth)throw new Q("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Q("Inconsistent open depths");return ne(e,t,n,0)}function ne(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ne(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(W.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return ae(i,le(e,o,s,t,r))}{let r=e.parent,o=r.content;return ae(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return ae(i,de(e,t,r))}function re(e,t){if(!t.type.compatibleContent(e.type))throw new Q("Cannot join "+t.type.name+" onto "+e.type.name)}function oe(e,t,n){let r=e.node(n);return re(r,t.node(n)),r}function ie(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function se(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(ie(e.nodeAfter,r),i++));for(let e=i;e<s;e++)ie(o.child(e),r);t&&t.depth==n&&t.textOffset&&ie(t.nodeBefore,r)}function ae(e,t){return e.type.checkContent(t),e.copy(t)}function le(e,t,n,r,o){let i=e.depth>o&&oe(e,t,o+1),s=r.depth>o&&oe(n,r,o+1),a=[];return se(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(re(i,s),ie(ae(i,le(e,t,n,r,o+1)),a)):(i&&ie(ae(i,de(e,t,o+1)),a),se(t,n,o,a),s&&ie(ae(s,de(n,r,o+1)),a)),se(r,null,o,a),new W(a)}function de(e,t,n){let r=[];return se(null,e,n,r),e.depth>n&&ie(ae(oe(e,t,n+1),de(e,t,n+1)),r),se(t,null,n,r),new W(r)}Z.empty=new Z(W.empty,0,0);class ce{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Y.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new fe(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new ce(t,n,o)}static resolveCached(e,t){let n=he.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else he.set(e,n=new pe);let r=n.elts[n.i]=ce.resolve(e,t);return n.i=(n.i+1)%ue,r}}class pe{constructor(){this.elts=[],this.i=0}}const ue=12,he=new WeakMap;class fe{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const me=Object.create(null);class ge{constructor(e,t,n,r=Y.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||W.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&J(this.attrs,t||e.defaultAttrs||me)&&Y.sameSet(this.marks,n||Y.none)}copy(e=null){return e==this.content?this:new ge(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ge(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Z.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Z(a,r.depth-i,o.depth-i)}replace(e,t,n){return te(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ce.resolveCached(this,e)}resolveNoCache(e){return ce.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),be(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=W.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Y.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=W.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ge.prototype.text=void 0;class ye extends ge{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):be(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ye(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ye(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function be(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class xe{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new ve(e,t);if(null==n.next)return xe.empty;let r=we(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);Me(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new xe(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Se);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(Me(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return W.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}xe.empty=new xe(!0);class ve{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function we(e){let t=[];do{t.push(ke(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ke(e){let t=[];do{t.push(Ce(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Ce(e){let t=function(e){if(e.eat("(")){let t=we(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Ne(e,t)}return t}function Te(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ne(e,t){let n=Te(e),r=n;return e.eat(",")&&(r="}"!=e.next?Te(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Se(e,t){return t-e}function Me(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Se)}function je(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Oe(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function Ae(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ee(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ie(e,r,t[r]);return n}class Le{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Ee(e,n.attrs),this.defaultAttrs=je(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xe.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Oe(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ge(this,this.computeAttrs(e),W.from(t),Y.setFrom(n))}createChecked(e=null,t,n){return t=W.from(t),this.checkContent(t),new ge(this,this.computeAttrs(e),t,Y.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=W.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(W.empty,!0);return o?new ge(this,e,t.append(o),Y.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ae(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Y.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new Le(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class Ie{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class De{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ee(e,r.attrs),this.excluded=null;let o=je(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Oe(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new De(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ae(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Re{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=V.from(e.nodes),t.marks=V.from(e.marks||{}),this.nodes=Le.compile(this.spec.nodes,this),this.marks=De.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=xe.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?Pe(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Pe(this,n.split(" "))}this.nodeFromJSON=e=>ge.fromJSON(this,e),this.markFromJSON=e=>Y.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Le))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ye(n,n.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Pe(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class ze{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Ve(this,t,!1);return n.addAll(e,Y.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ve(this,t,!0);return n.addAll(e,Y.none,t.from,t.to),Z.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ue(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_e(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_e(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ze(e,ze.schemaRules(e)))}}const Be={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Fe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},qe={ol:!0,ul:!0};function $e(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class He{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Y.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(W.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=W.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(W.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Be.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ve{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=$e(null,t.preserveWhitespace,0)|(n?4:0);r=o?new He(o.type,o.attrs,Y.none,!0,t.topMatch||o.type.contentMatch,i):new He(n?null:e.schema.topNodeType,null,Y.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();qe.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&qe.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Fe.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Be.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Y.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):We(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=$e(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Y.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):We(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new He(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Ue(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function _e(e){let t={};for(let n in e)t[n]=e[n];return t}function We(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Ge{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Je(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Qe(Je(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Qe(Je(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Qe(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ge(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ke(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ke(e.marks)}}function Ke(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Je(e){return e.document||window.document}const Ye=new WeakMap;function Qe(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){let t=Ye.get(e);return void 0===t&&Ye.set(e,t=function(e){let t=null;return function e(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(let t=0;t<n.length;t++)e(n[t]);else for(let t in n)e(n[t])}(e),t}(e)),t}(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),d=t[1],c=1;if(d&&"object"==typeof d&&null==d.nodeType&&!Array.isArray(d)){c=2;for(let e in d)if(null!=d[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),d[e]):"style"==e&&l.style?l.style.cssText=d[e]:l.setAttribute(e,d[e])}}for(let o=c;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:o}=Qe(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const Ze=Math.pow(2,16);function Xe(e,t){return e+t*Ze}function et(e){return 65535&e}class tt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class nt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nt.empty)return nt.empty}recover(e){let t=0,n=et(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ze}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],d=this.ranges[s+i],c=a+l;if(e<=c){let o=a+r+((l?e==a?-1:e==c?1:t:t)<0?0:d);if(n)return o;let i=e==(t<0?a:c)?null:Xe(s/3,e-a),p=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(p|=8),new tt(o,p,i)}r+=d-l}return n?e+r:new tt(e+r,0,null)}touches(e,t){let n=0,r=et(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],d=this.ranges[r+n];e(s,s+l,a,a+d),o+=d-l}}invert(){return new nt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?nt.empty:new nt(e<0?[0,-e,0]:[0,0,e])}}nt.empty=new nt([]);class rt{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new rt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new rt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new tt(e,r,null)}}const ot=Object.create(null);class it{getMap(){return nt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ot[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ot)throw new RangeError("Duplicate use of step JSON ID "+e);return ot[e]=t,t.prototype.jsonID=e,t}}class st{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,t,n,r){try{return st.ok(e.replace(t,n,r))}catch(e){if(e instanceof Q)return st.fail(e.message);throw e}}}function at(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(at(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return W.fromArray(r)}class lt extends it{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Z(at(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return st.fromReplace(e,this.from,this.to,o)}invert(){return new dt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new lt(t.pos,n.pos,this.mark)}merge(e){return e instanceof lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new lt(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("addMark",lt);class dt extends it{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Z(at(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return st.fromReplace(e,this.from,this.to,n)}invert(){return new lt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new dt(t.pos,n.pos,this.mark)}merge(e){return e instanceof dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new dt(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("removeMark",dt);class ct extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ct(this.pos,t.marks[n]);return new ct(this.pos,this.mark)}}return new pt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ct(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ct(t.pos,e.markFromJSON(t.mark))}}it.jsonID("addNodeMark",ct);class pt extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ct(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pt(t.pos,e.markFromJSON(t.mark))}}it.jsonID("removeNodeMark",pt);class ut extends it{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ft(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ut(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&ut.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new ut(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ut)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ut(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ut(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ut(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}ut.MAP_BIAS=1,it.jsonID("replace",ut);class ht extends it{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(ft(e,this.from,this.gapFrom)||ft(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return st.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?st.fromReplace(e,this.from,this.to,n):st.fail("Content does not fit in gap")}getMap(){return new nt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ht(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new ht(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ht(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ft(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function mt(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),d=a+l.nodeSize,c=r.matchType(l.type);if(c){r=c;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new dt(a,d,l.marks[t]));if(o&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Z(W.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new ut(a+e.index,a+e.index+e[0].length,t))}}else s.push(new ut(a,d,Z.empty));a=d}if(!r.validEnd){let t=r.fillBefore(W.empty,!0);e.replace(a,a,new Z(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function gt(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function yt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!gt(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function bt(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(xt).concat({type:t,attrs:n}).concat(i.map(xt)):null}function xt(e){return{type:e,attrs:null}}function vt(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function wt(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function kt(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Ct(e,t){let n=e.resolve(t),r=n.index();return Tt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Tt(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function Nt(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&Tt(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function St(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Mt(e,t,n=t,r=Z.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return jt(o,i,r)?new ut(t,n,r):new Ot(o,i,r).fit()}function jt(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}it.jsonID("replaceAround",ht);class Ot{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=W.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=W.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Z(o,i,s);return e>-1?new ht(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new ut(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Lt(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(W.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Lt(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new Z(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Lt(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Z(At(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Z(At(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,d=[],{match:c,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)d.push(r.child(e));c=c.matchFragment(r)}let u=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=c.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(c=t,d.push(It(e.mark(p.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?u:-1)))}let h=l==s.childCount;h||(u=-1),this.placed=Et(this.placed,t,W.from(d)),this.frontier[t].match=c,h&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?Z.empty:new Z(At(i.content,e-1,1),e-1,u<0?i.openEnd:e-1):new Z(At(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Dt(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Dt(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Dt(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Et(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Et(this.placed,this.depth,W.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(W.empty,!0);e.childCount&&(this.placed=Et(this.placed,this.frontier.length,e))}}function At(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(At(e.firstChild.content,t-1,n)))}function Et(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Et(e.lastChild.content,t-1,n)))}function Lt(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function It(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,It(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(W.empty,!0)))),e.copy(r)}function Dt(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Rt(e){return e.spec.defining||e.spec.definingForContent}function Pt(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Pt(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(W.empty,!0))}return e}function zt(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Bt extends it{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(r),0,t.isLeaf?0:1))}getMap(){return nt.empty}invert(e){return new Bt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bt(t.pos,t.attr,t.value)}}it.jsonID("attr",Bt);class Ft extends it{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return st.ok(n)}getMap(){return nt.empty}invert(e){return new Ft(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ft(t.attr,t.value)}}it.jsonID("docAttr",Ft);let qt=class extends Error{};qt=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(qt.prototype=Object.create(Error.prototype)).constructor=qt,qt.prototype.name="TransformError";class $t{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new qt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Z.empty){let r=Mt(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Z(W.from(n),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(jt(o,i,r))return e.step(new ut(t,n,r));let s=zt(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),d=[],c=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(d.push(n),t==r.openStart)break;e=n.content}for(let e=c-1;e>=0;e--){let t=d[e],n=Rt(t.type);if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))c=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+c+1)%(r.openStart+1),p=d[a];if(p)for(let t=0;t<s.length;t++){let d=s[(t+l)%s.length],c=!0;d<0&&(c=!1,d=-d);let u=o.node(d-1),h=o.index(d-1);if(u.canReplaceWith(h,h,p.type,p.marks))return e.replace(o.before(d),c?i.after(d):n,new Z(Pt(r.content,0,r.openStart,a),a,r.openEnd))}}let p=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>p));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Z(W.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&0==r.parentOffset&&0==o.parentOffset){let i=r.sharedDepth(n),s=!1;for(let e=r.depth;e>i;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=o.depth;e>i;e--)o.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=o.depth;e>0&&n==o.start(e);e--)n=o.before(e);r=e.doc.resolve(t),o=e.doc.resolve(n)}}let i=zt(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,d=a,c=W.empty,p=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,c=W.from(r.node(e).copy(c)),p++):l--;let u=W.empty,h=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,u=W.from(o.node(e).copy(u)),h++):d++;e.step(new ht(l,d,s,a,new Z(c.append(u),p,h),c.size-p,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);wt(e,r.node(),r.before(),a)}s.inlineContent&&mt(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),d=l.map(t-n);if(e.step(new ut(d,l.map(t+n,-1),Z.empty,!0)),!0===r){let t=e.doc.resolve(d);vt(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=W.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=W.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new ht(o,i,o,i,new Z(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&wt(e,t,n,i),mt(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),d=a.map(n+t.nodeSize,1);return e.step(new ht(l,d,l+1,d-1,new Z(W.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&vt(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ht(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Z(W.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Bt(e,t,n)),this}setDocAttribute(e,t){return this.step(new Ft(e,t)),this}addNodeMark(e,t){return this.step(new ct(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(n.marks)&&this.step(new pt(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new pt(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=W.empty,s=W.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){i=W.from(o.node(e).copy(i));let t=r&&r[a];s=W.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new ut(t,t,new Z(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,d)=>{if(!e.isInline)return;let c=e.marks;if(!r.isInSet(c)&&d.type.allowsMarkType(r.type)){let d=Math.max(l,t),p=Math.min(l+e.nodeSize,n),u=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(u)||(o&&o.to==d&&o.mark.eq(c[e])?o.to=p:s.push(o=new dt(d,p,c[e])));i&&i.to==d?i.to=p:a.push(i=new lt(d,p,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof De){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new dt(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return mt(this,e,t,n),this}}const Ht=Object.create(null);class Vt{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ut(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Z.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],d=e.mapping.slice(o);e.replaceRange(d.map(a.pos),d.map(l.pos),s?Z.empty:t),0==s&&en(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),d=a.map(s.pos);o?e.deleteRange(l,d):(e.replaceRangeWith(l,d,t),en(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Gt(e):Xt(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Xt(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Xt(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Qt(e.node(0))}static atStart(e){return Xt(e,e,0,0,1)||new Qt(e)}static atEnd(e){return Xt(e,e,e.content.size,e.childCount,-1)||new Qt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ht[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ht)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ht[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Gt.between(this.$anchor,this.$head).getBookmark()}}Vt.prototype.visible=!0;class Ut{constructor(e,t){this.$from=e,this.$to=t}}let _t=!1;function Wt(e){_t||e.parent.inlineContent||(_t=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Gt extends Vt{constructor(e,t=e){Wt(e),Wt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Vt.near(n);let r=e.resolve(t.map(this.anchor));return new Gt(r.parent.inlineContent?r:n,n)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Gt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Gt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Vt.findFrom(t,n,!0)||Vt.findFrom(t,-n,!0);if(!e)return Vt.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Vt.findFrom(e,-n,!0)||Vt.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Gt(e,t)}}Vt.jsonID("text",Gt);class Kt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Kt(e.map(this.anchor),e.map(this.head))}resolve(e){return Gt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Jt extends Vt{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Vt.near(o):new Jt(o)}content(){return new Z(W.from(this.node),0,0)}eq(e){return e instanceof Jt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Yt(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Jt(e.resolve(t.anchor))}static create(e,t){return new Jt(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Jt.prototype.visible=!1,Vt.jsonID("node",Jt);class Yt{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Kt(n,n):new Yt(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Jt.isSelectable(n)?new Jt(t):Vt.near(t)}}class Qt extends Vt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.empty){e.delete(0,e.doc.content.size);let t=Vt.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Qt(e)}map(e){return new Qt(e)}eq(e){return e instanceof Qt}getBookmark(){return Zt}}Vt.jsonID("all",Qt);const Zt={map(){return this},resolve:e=>new Qt(e)};function Xt(e,t,n,r,o,i=!1){if(t.inlineContent)return Gt.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Jt.isSelectable(r))return Jt.create(e,n-(o<0?r.nodeSize:0))}else{let t=Xt(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function en(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof ut||i instanceof ht)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Vt.near(e.doc.resolve(o),n)))}class tn extends $t{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Y.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Y.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Vt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function nn(e,t){return t&&e?e.bind(t):e}class rn{constructor(e,t,n){this.name=e,this.init=nn(t.init,n),this.apply=nn(t.apply,n)}}const on=[new rn("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new rn("selection",{init:(e,t)=>e.selection||Vt.atStart(t.doc),apply:e=>e.selection}),new rn("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new rn("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class sn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=on.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new rn(e.key,e.spec.state,e))})}}class an{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,d=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(d&&n.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(d),n=n.applyInner(d),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new an(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new tn(this)}static create(e){let t=new sn(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new an(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new sn(this.schema,e.plugins),n=t.fields,r=new an(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new sn(e.schema,e.plugins),o=new an(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ge.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Vt.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function ln(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=ln(o,t,{})),n[r]=o}return n}class dn{constructor(e){this.spec=e,this.props={},e.props&&ln(e.props,this,this.props),this.key=e.key?e.key.key:pn("plugin")}getState(e){return e[this.key]}}const cn=Object.create(null);function pn(e){return e in cn?e+"$"+ ++cn[e]:(cn[e]=0,e+"$")}class un{constructor(e="key"){this.key=pn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const hn=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function fn(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const mn=(e,t,n)=>{let r=fn(e,n);if(!r)return!1;let o=xn(r);if(!o){let n=r.blockRange(),o=n&&yt(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(An(e,o,t,-1))return!0;if(0==r.parent.content.size&&(yn(i,"end")||Jt.isSelectable(i)))for(let n=r.depth;;n--){let s=Mt(e.doc,r.before(n),r.after(n),Z.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(yn(i,"end")?Vt.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):Jt.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))};function gn(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=Mt(e.doc,o,s,Z.empty);if(!a||a.from!=o||a instanceof ut&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Gt.create(t.doc,o)),n(t.scrollIntoView())}return!0}function yn(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const bn=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=xn(r)}let s=i&&i.nodeBefore;return!(!s||!Jt.isSelectable(s)||(t&&t(e.tr.setSelection(Jt.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function xn(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function vn(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const wn=(e,t,n)=>{let r=vn(e,n);if(!r)return!1;let o=Cn(r);if(!o)return!1;let i=o.nodeAfter;if(An(e,o,t,1))return!0;if(0==r.parent.content.size&&(yn(i,"start")||Jt.isSelectable(i))){let n=Mt(e.doc,r.before(),r.after(),Z.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(yn(i,"start")?Vt.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Jt.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))},kn=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Cn(r)}let s=i&&i.nodeAfter;return!(!s||!Jt.isSelectable(s)||(t&&t(e.tr.setSelection(Jt.create(e.doc,i.pos)).scrollIntoView()),0))};function Cn(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Tn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function Nn(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Sn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Nn(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Vt.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Mn=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Qt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Nn(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Gt.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},jn=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(kt(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&yt(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var On;function An(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Ct(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=!l&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=W.empty;for(let e=o.length-1;e>=0;e--)i=W.from(o[e].create(null,i));i=W.from(s.copy(i));let l=e.tr.step(new ht(t.pos-1,r,t.pos,r,new Z(i,1,0),o.length,!0)),d=l.doc.resolve(r+2*o.length);d.nodeAfter&&d.nodeAfter.type==s.type&&Ct(l.doc,d.pos)&&l.join(d.pos),n(l.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:Vt.findFrom(t,1),p=c&&c.$from.blockRange(c.$to),u=p&&yt(p);if(null!=u&&u>=t.depth)return n&&n(e.tr.lift(p,u).scrollIntoView()),!0;if(d&&yn(a,"start",!0)&&yn(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=W.empty;for(let e=o.length-1;e>=0;e--)r=W.from(o[e].copy(r));n(e.tr.step(new ht(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Z(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function En(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Gt.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Ln=En(-1),In=En(1);function Dn(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Rn(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let Pn=Rn(hn,mn,bn),zn=Rn(hn,wn,kn);const Bn={Enter:Rn(Tn,Mn,jn,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Jt&&e.selection.node.isBlock)return!(!n.parentOffset||!kt(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=Nn(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let t=On;s.unshift(t||(a&&i?{type:i}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof Gt||e.selection instanceof Qt)&&d.deleteSelection();let c=d.mapping.map(n.pos),p=kt(d.doc,c,s.length,s);if(p||(s[0]=i?{type:i}:null,p=kt(d.doc,c,s.length,s)),!p)return!1;if(d.split(c,s.length,s),!a&&l&&n.node(o).type!=i){let e=d.mapping.map(n.before(o)),t=d.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&d.setNodeMarkup(d.mapping.map(n.before(o)),i)}return t&&t(d.scrollIntoView()),!0}),"Mod-Enter":Sn,Backspace:Pn,"Mod-Backspace":Pn,"Shift-Backspace":Pn,Delete:zn,"Mod-Delete":zn,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Qt(e.doc))),!0)},Fn={"Ctrl-h":Bn.Backspace,"Alt-Backspace":Bn["Mod-Backspace"],"Ctrl-d":Bn.Delete,"Ctrl-Alt-Backspace":Bn["Mod-Delete"],"Alt-Delete":Bn["Mod-Delete"],"Alt-d":Bn["Mod-Delete"],"Ctrl-a":Ln,"Ctrl-e":In};for(let e in Bn)Fn[e]=Bn[e];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const qn=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},$n=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Hn=null;const Vn=function(e,t,n){let r=Hn||(Hn=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Un=function(e,t,n,r){return n&&(Wn(e,t,n,r,-1)||Wn(e,t,n,r,1))},_n=/^(img|br|input|textarea|hr)$/i;function Wn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Gn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Kn(e)||_n.test(e.nodeName)||"false"==e.contentEditable)return!1;t=qn(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Gn(e):0}}}}function Gn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Kn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Jn=function(e){return e.focusNode&&Un(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Yn(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Qn="undefined"!=typeof navigator?navigator:null,Zn="undefined"!=typeof document?document:null,Xn=Qn&&Qn.userAgent||"",er=/Edge\/(\d+)/.exec(Xn),tr=/MSIE \d/.exec(Xn),nr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),rr=!!(tr||nr||er),or=tr?document.documentMode:nr?+nr[1]:er?+er[1]:0,ir=!rr&&/gecko\/(\d+)/i.test(Xn);ir&&(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const sr=!rr&&/Chrome\/(\d+)/.exec(Xn),ar=!!sr,lr=sr?+sr[1]:0,dr=!rr&&!!Qn&&/Apple Computer/.test(Qn.vendor),cr=dr&&(/Mobile\/\w+/.test(Xn)||!!Qn&&Qn.maxTouchPoints>2),pr=cr||!!Qn&&/Mac/.test(Qn.platform),ur=!!Qn&&/Win/.test(Qn.platform),hr=/Android \d/.test(Xn),fr=!!Zn&&"webkitFontSmoothing"in Zn.documentElement.style,mr=fr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function yr(e,t){return"number"==typeof e?e:e[t]}function br(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function xr(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=$n(s);continue}let e=s,n=e==i.body,a=n?gr(i):br(e),l=0,d=0;if(t.top<a.top+yr(r,"top")?d=-(a.top-t.top+yr(o,"top")):t.bottom>a.bottom-yr(r,"bottom")&&(d=t.bottom-t.top>a.bottom-a.top?t.top+yr(o,"top")-a.top:t.bottom-a.bottom+yr(o,"bottom")),t.left<a.left+yr(r,"left")?l=-(a.left-t.left+yr(o,"left")):t.right>a.right-yr(r,"right")&&(l=t.right-a.right+yr(o,"right")),l||d)if(n)i.defaultView.scrollBy(l,d);else{let n=e.scrollLeft,r=e.scrollTop;d&&(e.scrollTop+=d),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let c=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(c))break;s="absolute"==c?s.offsetParent:$n(s)}}function vr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=$n(r));return t}function wr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let kr=null;function Cr(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,d=t.top;for(let c=e.firstChild,p=0;c;c=c.nextSibling,p++){let e;if(1==c.nodeType)e=c.getClientRects();else{if(3!=c.nodeType)continue;e=Vn(c).getClientRects()}for(let u=0;u<e.length;u++){let h=e[u];if(h.top<=l&&h.bottom>=d){l=Math.max(h.bottom,l),d=Math.min(h.top,d);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<s){n=c,s=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==c.nodeType&&e&&(a=p+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!o&&h.left<=t.left&&h.right>=t.left&&(o=c,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(a=p+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=jr(o,1);if(r.top!=r.bottom&&Tr(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Cr(n,r)}function Tr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Nr(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Tr(t,o))return Nr(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Sr(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Gn(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Gn(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Tr(t,n))return null;if(a=Nr(e.dom,t,n),!a)return null}if(dr)for(let e=a;n&&e;e=$n(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(ir&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;fr&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Cr(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Mr(e){return e.top<e.bottom||e.left<e.right}function jr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Mr(e))return e}return Array.prototype.find.call(n,Mr)||e.getBoundingClientRect()}const Or=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ar(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=fr||ir;if(3==r.nodeType){if(!s||!Or.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Er(jr(Vn(r,e,t),i),i<0)}{let e=jr(Vn(r,o,o),n);if(ir&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=jr(Vn(r,o-1,o-1),-1);if(t.top==e.top){let n=jr(Vn(r,o,o+1),-1);if(n.top!=e.top)return Er(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Gn(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Lr(e.getBoundingClientRect(),!1)}if(null==i&&o<Gn(r)){let e=r.childNodes[o];if(1==e.nodeType)return Lr(e.getBoundingClientRect(),!0)}return Lr(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Gn(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Vn(e,Gn(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Er(jr(t,1),!1)}if(null==i&&o<Gn(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Vn(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Er(jr(t,-1),!0)}return Er(jr(3==r.nodeType?Vn(r):r,-n),n>=0)}function Er(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Lr(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ir(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Dr=/[\u0590-\u08ac]/;let Rr=null,Pr=null,zr=!1;class Br{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>qn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof _r){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Fr&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?qn(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?qn(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=qn(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=qn(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],d=a+l.size;if(o>a&&i<d)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=d}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),d=n.domSelectionRange(),c=!1;if((ir||dr)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(c=!(!t||"\n"!=e.nodeValue[t-1]),c&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:qn(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ir&&d.focusNode&&d.focusNode!=a.node&&1==d.focusNode.nodeType){let e=d.focusNode.childNodes[d.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&dr)&&Un(s.node,s.offset,d.anchorNode,d.anchorOffset)&&Un(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((l.extend||e==t)&&(!c||!ir)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),p=!0}catch(e){}}if(!p){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Fr extends Br{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class qr extends Br{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class $r extends Br{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Ge.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new $r(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=$r.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=oo(o,t,i,n)),e>0&&(o=oo(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Hr extends Br{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),d=l&&l.dom,c=l&&l.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else if(!d){let e=Ge.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:d,contentDOM:c}=e)}c||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=Xr(d,n,t),l?s=new Wr(e,t,n,r,d,c||null,p,l,o,i+1):t.isText?new Ur(e,t,n,r,d,p,o):new Hr(e,t,n,r,d,c||null,p,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>W.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&eo(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new no(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let d=0;;){let c,p,u,h;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(c?(p||(p=[c])).push(e):c=e)}if(c)if(p){p.sort(ro);for(let e=0;e<p.length;e++)n(p[e],d,!!l)}else n(c,d,!!l);if(l)h=-1,u=l,l=null;else{if(!(d<e.childCount))break;h=d,u=e.child(d++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+u.nodeSize;if(u.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=u.cut(e-i),u=u.cut(0,e-i),f=e,h=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(u,u.isInline&&!u.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,u),h),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Y.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,l,d)=>{let c;a.syncToMarks(t.marks,n,e,d),a.findNodeMatch(t,i,l,d)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(c=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,c,e)||a.updateNextNode(t,i,l,e,d,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Gr(this.contentDOM,this.children,e),cr&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Gt)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new qr(this,o,t,r);e.input.compositionNodes.push(i),this.children=oo(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(eo(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Qr(this.dom,this.nodeDOM,Yr(this.outerDeco,this.node,t),Yr(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Vr(e,t,n,r,o){Xr(r,t,e);let i=new Hr(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Ur extends Hr{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Ur(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _r extends Br{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Wr extends Hr{constructor(e,t,n,r,o,i,s,a,l,d){super(e,t,n,r,o,i,s,l,d),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Gr(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=to(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof $r){let t=r?r.previousSibling:e.lastChild;Gr(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=to(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Kr=function(e){e&&(this.nodeName=e)};Kr.prototype=Object.create(null);const Jr=[new Kr];function Yr(e,t,n){if(0==e.length)return Jr;let r=n?Jr[0]:new Kr,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Kr(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Kr(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Qr(e,t,n,r){if(n==Jr&&r==Jr)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=Jr[0]),o=t}Zr(o,s||Jr[0],i)}return o}function Zr(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Xr(e,t,n){return Qr(e,e,Jr,Yr(t,n,1!=e.nodeType))}function eo(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function to(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class no{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof $r)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=$r.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Hr){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let d,c=a.dom,p=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&eo(t,a.outerDeco));if(!p&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,i+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!eo(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Hr.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Hr.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Fr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof $r;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ur)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((dr||ar)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new _r(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function ro(e,t){return e.type.side-t.type.side}function oo(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],d=a,c=a+=l.size;d>=n||c<=t?i.push(l):(d<t&&i.push(l.slice(0,t-d,r)),o&&(i.push(o),o=void 0),c>n&&i.push(l.slice(n-d,l.size,r)))}return i}function io(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,d=r.resolve(s);if(Jn(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Jt.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Gn(e);r||o;){if(e==n)return!0;let t=qn(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Gn(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Jt(s==e?d:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],d=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);return l||(l=mo(e,c,d,"pointer"==t||e.state.selection.head<d.pos&&!i?1:-1)),l}function so(e){return e.editable?e.hasFocus():yo(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ao(e,t=!1){let n=e.state.selection;if(ho(e,n),so(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&ar){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Un(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,qn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&rr&&or<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!lo||n instanceof Gt||(n.$from.parent.inlineContent||(r=co(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=co(e,n.to))),e.docView.setSelection(i,s,e,t),lo&&(r&&uo(r),o&&uo(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{so(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const lo=dr||ar&&lr<63;function co(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(dr&&o&&"false"==o.contentEditable)return po(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return po(o);if(i)return po(i)}}function po(e){return e.contentEditable="true",dr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function uo(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ho(e,t){if(t instanceof Jt){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(fo(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else fo(e)}function fo(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function mo(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Gt.between(t,n,r)}function go(e){return!(e.editable&&!e.hasFocus())&&yo(e)}function yo(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function bo(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Vt.findFrom(i,t)}function xo(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vo(e,t,n){let r=e.state.selection;if(!(r instanceof Gt)){if(r instanceof Jt&&r.node.isInline)return xo(e,new Gt(t>0?r.$to:r.$from));{let n=bo(e.state,t);return!!n&&xo(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return xo(e,new Gt(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=bo(e.state,t);return!!(n&&n instanceof Jt)&&xo(e,n)}if(!(pr&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Jt.isSelectable(i)?xo(e,new Jt(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!fr&&xo(e,new Gt(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function wo(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ko(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Co(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(ir&&1==n.nodeType&&r<wo(n)&&ko(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(ko(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(To(n))break;{let t=n.previousSibling;for(;t&&ko(t,-1);)o=n.parentNode,i=qn(t),t=t.previousSibling;if(t)n=t,r=wo(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?No(e,n,r):o&&No(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=wo(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!ko(n.childNodes[r],1))break;o=n,i=++r}else{if(To(n))break;{let t=n.nextSibling;for(;t&&ko(t,1);)o=t.parentNode,i=qn(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=wo(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&No(e,o,i)}(e)}function To(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function No(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Kn(e);)t=qn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Kn(e);)t=qn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Jn(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ao(e)},50)}function So(e,t){let n=e.state.doc.resolve(t);if(!ar&&!ur&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Mo(e,t,n){let r=e.state.selection;if(r instanceof Gt&&!r.empty||n.indexOf("s")>-1)return!1;if(pr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=bo(e.state,t);if(n&&n instanceof Jt)return xo(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Qt?Vt.near(n,t):Vt.findFrom(n,t);return!!s&&xo(e,s)}return!1}function jo(e,t){if(!(e.state.selection instanceof Gt))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Oo(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ao(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Ge.fromSchema(e.state.schema),a=qo(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let d,c=l.firstChild,p=0;for(;c&&1==c.nodeType&&(d=Bo[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),p++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${o} ${i}${p?` -${p}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Eo(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Z(W.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Ge.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=qo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&Bo[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;return t?($o||($o=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),$o.createHTML(e)):e}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),fr&&function(e){let t=e.querySelectorAll(ar?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let d=i&&i.querySelector("[data-pm-slice]"),c=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let e=+c[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||ze.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!c),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Lo.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(c)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=W.from(t.create(n[e+1],o)),i++,s++}return new Z(o,i,s)}(zo(s,+c[1],+c[2]),c[4]);else if(s=Z.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&Do(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ro(i[i.length-1],r.length));let t=Io(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return W.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=zo(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Lo=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Io(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,W.from(e));return e}function Do(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Do(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(W.from(Io(n,e,o+1))))}}function Ro(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ro(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(W.empty,!0);return e.copy(n.append(r))}function Po(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Po(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(W.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function zo(e,t,n){return t<e.openStart&&(e=new Z(Po(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Z(Po(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Bo={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fo=null;function qo(){return Fo||(Fo=document.implementation.createHTMLDocument("title"))}let $o=null;const Ho={},Vo={},Uo={touchstart:!0,touchmove:!0};class _o{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Wo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Go(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Ko(e,t))})}function Ko(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Jo(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Yo(e){return{left:e.clientX,top:e.clientY}}function Qo(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function Zo(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Xo(e,t,n,r){return Qo(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function ei(e,t,n,r){return Qo(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Zo(e,Gt.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)Zo(e,Gt.create(r,i+1,i+1+n.content.size),"pointer");else{if(!Jt.isSelectable(n))continue;Zo(e,Jt.create(r,i),"pointer")}return!0}}(e,n,r)}function ti(e){return li(e)}Vo.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!oi(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!hr||!ar||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!cr||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||pr&&72==n&&"c"==r)return jo(e,-1)||Co(e,-1);if(46==n&&!t.shiftKey||pr&&68==n&&"c"==r)return jo(e,1)||Co(e,1);if(13==n||27==n)return!0;if(37==n||pr&&66==n&&"c"==r){let t=37==n?"ltr"==So(e,e.state.selection.from)?-1:1:-1;return vo(e,t,r)||Co(e,t)}if(39==n||pr&&70==n&&"c"==r){let t=39==n?"ltr"==So(e,e.state.selection.from)?1:-1:1;return vo(e,t,r)||Co(e,t)}return 38==n||pr&&80==n&&"c"==r?Mo(e,-1,r)||Co(e,-1):40==n||pr&&78==n&&"c"==r?function(e){if(!dr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Oo(e,n,"true"),setTimeout(()=>Oo(e,n,"false"),20)}return!1}(e)||Mo(e,1,r)||Co(e,1):r==(pr?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Wo(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Vo.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Vo.keypress=(e,t)=>{let n=t;if(oi(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||pr&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Gt&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const ni=pr?"metaKey":"ctrlKey";Ho.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ti(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[ni]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Yo(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ri(e,s,n,!!r)):("doubleClick"==i?Xo:ei)(e,s.pos,s.inside,n)?n.preventDefault():Wo(e,"pointer"))};class ri{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ni],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Jt&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!ir||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ao(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Yo(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wo(this.view,"pointer"):function(e,t,n,r,o){return Qo(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Jt&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(Jt.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(Zo(e,Jt.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Jt.isSelectable(r))&&(Zo(e,new Jt(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||dr&&this.mightDrag&&!this.mightDrag.node.isAtom||ar&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Zo(this.view,Vt.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Wo(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wo(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function oi(e,t){return!!e.composing||!!(dr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Ho.touchstart=e=>{e.input.lastTouch=Date.now(),ti(e),Wo(e,"pointer")},Ho.touchmove=e=>{e.input.lastTouch=Date.now(),Wo(e,"pointer")},Ho.contextmenu=e=>ti(e);const ii=hr?5e3:-1;function si(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>li(e),t))}function ai(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function li(e,t=!1){if(!(hr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ai(e),t||e.docView&&e.docView.dirty){let n=io(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Vo.compositionstart=Vo.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Gt&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||ar&&ur&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),li(e,!0),e.markCursor=null;else if(li(e,!t.selection.empty),ir&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}si(e,ii)},Vo.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,si(e,20))};const di=rr&&or<15||cr&&mr<604;function ci(e,t,n,r,o){let i=Eo(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||Z.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pi(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ho.copy=Vo.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=di?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ao(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vo.paste=(e,t)=>{let n=t;if(e.composing&&!hr)return;let r=di?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&ci(e,pi(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ci(e,r.value,null,o,t):ci(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class ui{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const hi=pr?"altKey":"ctrlKey";function fi(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[hi]}Ho.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Yo(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Jt?i.to-1:i.to));else if(r&&r.mightDrag)o=Jt.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Jt.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:d,slice:c}=Ao(e,a);(!n.dataTransfer.files.length||!ar||lr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(di?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",di||n.dataTransfer.setData("text/plain",d),e.dragging=new ui(c,fi(e,n),o)},Ho.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Vo.dragover=Vo.dragenter=(e,t)=>t.preventDefault(),Vo.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Yo(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Eo(e,pi(t.dataTransfer),di?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!fi(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||Z.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?St(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let d=l.mapping.map(a),c=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=l.doc;if(c?l.replaceRangeWith(d,d,i.content.firstChild):l.replaceRange(d,d,i),l.doc.eq(p))return;let u=l.doc.resolve(d);if(c&&Jt.isSelectable(i.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Jt(u));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(mo(e,u,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Ho.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ao(e)},20))},Ho.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Ho.beforeinput=(e,t)=>{if(ar&&hr&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Yn(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Vo)Ho[e]=Vo[e];function mi(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class gi{constructor(e,t){this.toDOM=e,this.spec=t||wi,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new xi(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof gi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&mi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yi{constructor(e,t){this.attrs=e,this.spec=t||wi}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new xi(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof yi&&mi(this.attrs,e.attrs)&&mi(this.spec,e.spec)}static is(e){return e.type instanceof yi}destroy(){}}class bi{constructor(e,t){this.attrs=e,this.spec=t||wi}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new xi(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof bi&&mi(this.attrs,e.attrs)&&mi(this.spec,e.spec)}destroy(){}}class xi{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new xi(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new xi(e,e,new gi(t,n))}static inline(e,t,n,r){return new xi(e,t,new yi(n,r))}static node(e,t,n,r){return new xi(e,t,new bi(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof yi}get widget(){return this.type instanceof gi}}const vi=[],wi={};class ki{constructor(e,t){this.local=e.length?e:vi,this.children=t.length?t:vi}static create(e,t){return t.length?ji(t,e,0,wi):Ci}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Ci||0==e.maps.length?this:this.mapInner(e,t,0,0,n||wi)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let d=n.map(e[t]+i),c=d-o;if(c<0||c>=r.content.size){l=!0;continue}let p=n.map(e[t+1]+i,-1)-o,{index:u,offset:h}=r.content.findIndex(c),f=r.maybeChild(u);if(f&&h==c&&h+f.nodeSize==p){let r=a[t+2].mapInner(n,f,d+1,e[t]+i+1,s);r!=Ci?(a[t]=c,a[t+1]=p,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),d=ji(l,r,0,s);t=d.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<d.children.length;e+=3){let n=d.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,d.children[e],d.children[e+1],d.children[e+2])}}return new ki(t.sort(Oi),a)}(this.children,i||[],e,t,n,r,o):i?new ki(i.sort(Oi),vi):Ci}add(e,t){return t.length?this==Ci?ki.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Si(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,ji(s,e,a+1,wi)),o+=3}});let i=Ni(o?Mi(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new ki(i.length?this.local.concat(i).sort(Oi):this.local,r||this.children)}remove(e){return 0==e.length||this==Ci?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Ci?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ki(r,n):Ci}forChild(e,t){if(this==Ci)return this;if(t.isLeaf)return ki.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof yi){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new ki(r.sort(Oi),vi);return n?new Ti([e,n]):e}return n||Ci}eq(e){if(this==e)return!0;if(!(e instanceof ki)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ai(this.localsInner(e))}localsInner(e){if(this==Ci)return vi;if(e.inlineContent||!this.local.some(yi.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof yi||t.push(this.local[e]);return t}forEachSet(e){e(this)}}ki.empty=new ki([],[]),ki.removeOverlap=Ai;const Ci=ki.empty;class Ti{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,wi));return Ti.from(n)}forChild(e,t){if(t.isLeaf)return ki.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Ci&&(o instanceof Ti?n=n.concat(o.members):n.push(o))}return Ti.from(n)}eq(e){if(!(e instanceof Ti)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ai(n?t:t.sort(Oi)):vi}static from(e){switch(e.length){case 0:return Ci;case 1:return e[0];default:return new Ti(e.every(e=>e instanceof ki)?e:e.reduce((e,t)=>e.concat(t instanceof ki?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ni(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new xi(o.from+t,o.to+t,o.type))}return n}function Si(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Mi(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ji(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Si(e,t,s+n);if(a){i=!0;let e=ji(a,t,n+s+1,r);e!=Ci&&o.push(s,s+t.nodeSize,e)}});let s=Ni(i?Mi(e):e,-n).sort(Oi);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new ki(s,o):Ci}function Oi(e,t){return e.from-t.from||e.to-t.to}function Ai(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Ei(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Ei(t,o+1,i.copy(r.to,i.to)))}}return t}function Ei(e,t,n){for(;t<e.length&&Oi(n,e[t])>0;)t++;e.splice(t,0,n)}function Li(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Ci&&t.push(r)}),e.cursorWrapper&&t.push(ki.create(e.state.doc,[e.cursorWrapper.deco])),Ti.from(t)}const Ii={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Di=rr&&or<=11;class Ri{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Pi{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ri,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);rr&&or<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():dr&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Di&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ii)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(go(this.view)){if(this.suppressingSelectionUpdates)return ao(this.view);if(rr&&or<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Un(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=$n(t))n.add(t);for(let r=e.anchorNode;r;r=$n(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&go(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(ir&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&qi(e,n)==t||r.remove()}}}}else for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jn(n)&&(l=io(e))&&l.eq(Vt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ao(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(!zi.has(e)&&(zi.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=ir,Bi)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Bi=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ao(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(rr&&or<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?qn(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?qn(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let zi=new WeakMap,Bi=!1;function Fi(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Un(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function qi(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function $i(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(dr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||dr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Hi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Vi(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:mo(e,t.resolve(n.anchor),t.resolve(n.head))}function Ui(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function _i(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Wi{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _o,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Qi),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ji(this),Ki(this),this.nodeViews=Yi(this),this.docView=Vr(this.state.doc,Gi(this),Li(this),this.dom,this),this.domObserver=new Pi(this,(e,t,n,r)=>function(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=io(e,t);if(n&&!e.state.selection.eq(n)){if(ar&&hr&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,d,c=e.state.selection,p=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),d=e.domSelectionRange(),c=d.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(r=[{node:c,offset:d.anchorOffset}],Jn(d)||r.push({node:d.focusNode,offset:d.focusOffset})),ar&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let p=e.state.doc,u=e.someProp("domParser")||ze.fromSchema(e.state.schema),h=p.resolve(a),f=null,m=u.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:$i,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),u=e.state.doc,h=u.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,d="end"):(l=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,a))-i),s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&_i(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&_i(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(h.content,p.doc.content,p.from,l,d);if(f&&e.input.domChangeCount++,(cr&&e.input.lastIOSEnter>Date.now()-225||hr)&&o.some(e=>1==e.nodeType&&!Hi.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof Gt&&!c.empty&&c.$head.sameParent(c.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let t=Vi(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:c.from,endA:c.to,endB:c.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Gt&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),rr&&or<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>p.from&&"  "==p.doc.textBetween(f.start-p.from-1,f.start-p.from+1)&&(f.start--,f.endA--,f.endB--);let m=p.doc.resolveNoCache(f.start-p.from),g=p.doc.resolveNoCache(f.endB-p.from),y=u.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((cr&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&m.pos<p.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(p.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Ui(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Ui(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Ui(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(u,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Yn(8,"Backspace"))))return void(hr&&ar&&e.domObserver.suppressSelectionUpdates());ar&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),hr&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==f.endA&&(f.endB-=2,g=p.doc.resolveNoCache(f.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Yn(13,"Enter"))})},20));let x,v=f.start,w=f.endA,k=t=>{let n=t||e.state.tr.replace(v,w,p.doc.slice(f.start-p.from,f.endB-p.from));if(p.sel){let t=Vi(e,n.doc,p.sel);t&&!(ar&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==v||t.head==n.mapping.map(w)-1)||rr&&t.empty&&t.head==v)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){rr&&or<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ao(e),20));let t=k(e.state.tr.delete(v,w)),n=u.resolve(f.start).marksAcross(u.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(x=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(o(t.child(e)));if(W.from(d).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start())))){let t=k(e.state.tr);"add"==x.type?t.addMark(v,w,x.mark):t.removeMark(v,w,x.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,v,w));e.someProp("handleTextInput",r=>r(e,v,w,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Ho){let n=Ho[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Jo(e,t)||Ko(e,t)||!e.editable&&t.type in Vo||n(e,t)},Uo[t]?{passive:!0}:void 0)}dr&&e.dom.addEventListener("input",()=>null),Go(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Go(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Qi),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(ai(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Yi(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Go(this),this.editable=Ji(this),Ki(this);let a=Li(this),l=Gi(this),d=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",c=o||!this.docView.matchesNode(e.doc,l,a);!c&&e.selection.eq(r.selection)||(i=!0);let p="preserve"==d&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:vr(e.dom)}}(this);if(i){this.domObserver.stop();let t=c&&(rr||ar)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(c){let n=ar?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Gn(e=e.childNodes[t-1])}else{if(!e.parentNode||Kn(e))return null;t=qn(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Kn(e))return null;t=qn(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Vr(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Un(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?ao(this,t):(ho(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wr(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Jt){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&xr(this,t.getBoundingClientRect(),e)}else xr(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new ui(e.slice,e.move,r<0?void 0:Jt.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(rr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(kr)return e.focus(kr);let t=vr(e);e.focus(null==kr?{get preventScroll(){return kr={preventScroll:!0},!0}}:void 0),kr||(kr=!1,wr(t,0))}(this.dom),ao(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Sr(this,e)}coordsAtPos(e,t=1){return Ar(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return Rr==t&&Pr==n?zr:(Rr=t,Pr=n,zr="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Ir(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ar(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Vn(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Dr.test(r.parent.textContent)&&a.modify?Ir(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let d=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:p}=e.domSelectionRange(),u=c&&!d.contains(1==c.nodeType?c:c.parentNode)||t==c&&o==p;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),u}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return ci(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ci(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ao(this,e)}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Li(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Hn=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Ko(e,t)||!Ho[t.type]||!e.editable&&t.type in Vo||Ho[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?dr&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Fi(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Fi(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Gi(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[xi.node(0,e.state.doc.content.size,t)]}function Ki(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:xi.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ji(e){return!e.someProp("editable",t=>!1===t(e.state))}function Yi(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Qi(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Wi.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Zi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},es="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ts="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ns=0;ns<10;ns++)Zi[48+ns]=Zi[96+ns]=String(ns);for(ns=1;ns<=24;ns++)Zi[ns+111]="F"+ns;for(ns=65;ns<=90;ns++)Zi[ns]=String.fromCharCode(ns+32),Xi[ns]=String.fromCharCode(ns);for(var rs in Zi)Xi.hasOwnProperty(rs)||(Xi[rs]=Zi[rs]);const is="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ss="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function as(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);is?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function ls(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ds(e){let t=function(e){let t=Object.create(null);for(let n in e)t[as(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(es&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ts&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Xi:Zi)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[ls(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[ls(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ss&&n.ctrlKey&&n.altKey)&&(r=Zi[n.keyCode])&&r!=o){let o=t[ls(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var cs=Object.defineProperty,ps=(e,t)=>{for(var n in t)cs(e,n,{get:t[n],enumerable:!0})};function us(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var hs=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),d}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return d}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:us({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},fs={};ps(fs,{blur:()=>ms,clearContent:()=>gs,clearNodes:()=>ys,command:()=>bs,createParagraphNear:()=>xs,cut:()=>vs,deleteCurrentNode:()=>ws,deleteNode:()=>Cs,deleteRange:()=>Ts,deleteSelection:()=>Ns,enter:()=>Ss,exitCode:()=>Ms,extendMarkRange:()=>Ds,first:()=>Rs,focus:()=>$s,forEach:()=>Hs,insertContent:()=>Vs,insertContentAt:()=>Gs,joinBackward:()=>Ys,joinDown:()=>Js,joinForward:()=>Qs,joinItemBackward:()=>Zs,joinItemForward:()=>Xs,joinTextblockBackward:()=>ea,joinTextblockForward:()=>ta,joinUp:()=>Ks,keyboardShortcut:()=>ra,lift:()=>ia,liftEmptyBlock:()=>sa,liftListItem:()=>aa,newlineInCode:()=>la,resetAttributes:()=>pa,scrollIntoView:()=>ua,selectAll:()=>ha,selectNodeBackward:()=>fa,selectNodeForward:()=>ma,selectParentNode:()=>ga,selectTextblockEnd:()=>ya,selectTextblockStart:()=>ba,setContent:()=>va,setMark:()=>el,setMeta:()=>tl,setNode:()=>nl,setNodeSelection:()=>rl,setTextDirection:()=>ol,setTextSelection:()=>il,sinkListItem:()=>sl,splitBlock:()=>ll,splitListItem:()=>dl,toggleList:()=>ul,toggleMark:()=>hl,toggleNode:()=>fl,toggleWrap:()=>ml,undoInputRule:()=>gl,unsetAllMarks:()=>yl,unsetMark:()=>bl,unsetTextDirection:()=>xl,updateAttributes:()=>vl,wrapIn:()=>wl,wrapInList:()=>kl});var ms=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),gs=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),ys=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=yt(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},bs=e=>t=>e(t),xs=()=>({state:e,dispatch:t})=>Mn(e,t),vs=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Gt(r.doc.resolve(Math.max(s-1,0)))),!0},ws=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ks(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Cs=e=>({tr:t,state:n,dispatch:r})=>{const o=ks(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Ts=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Ns=()=>({state:e,dispatch:t})=>hn(e,t),Ss=()=>({commands:e})=>e.keyboardShortcut("Enter"),Ms=()=>({state:e,dispatch:t})=>Sn(e,t);function js(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Os(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:js(t[r])?t[r].test(e[r]):t[r]===e[r])}function As(e,t,n={}){return e.find(e=>e.type===t&&Os(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Es(e,t,n={}){return!!As(e,t,n)}function Ls(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){const e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!As([...r.node.marks],t,n))return;let o=r.index,i=e.start()+r.offset,s=o+1,a=i+r.node.nodeSize;for(;o>0&&Es([...e.parent.child(o-1).marks],t,n);)o-=1,i-=e.parent.child(o).nodeSize;for(;s<e.parent.childCount&&Es([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:i,to:a}}function Is(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Ds=(e,t)=>({tr:n,state:r,dispatch:o})=>{const i=Is(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:d,to:c}=a;if(o){const e=Ls(l,i,t);if(e&&e.from<=d&&e.to>=c){const t=Gt.create(s,e.from,e.to);n.setSelection(t)}}return!0},Rs=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Ps(e){return e instanceof Gt}function zs(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Bs(e,t=null){if(!t)return null;const n=Vt.atStart(e),r=Vt.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Gt.create(e,zs(0,o,i),zs(e.content.size,o,i)):Gt.create(e,zs(t,o,i),zs(t,o,i))}function Fs(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function qs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var $s=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(qs()||Fs())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||qs()||Fs()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!Ps(n.state.selection))return s(),!0;const a=Bs(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Hs=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Vs=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Us=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Us(r)}return e};function _s(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Us(n)}function Ws(e,t,n){if(e instanceof ge||e instanceof W)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return W.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Ws("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Re({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?ze.fromSchema(i).parseSlice(_s(e),n.parseOptions):ze.fromSchema(i).parse(_s(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=ze.fromSchema(t);return n.slice?r.parseSlice(_s(e),n.parseOptions).content:r.parse(_s(e),n.parseOptions)}return Ws("",t,n)}var Gs=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const a=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ws(t,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(e){a(e)}try{o=Ws(t,i.schema,{parseOptions:l,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return a(e),!1}let d,{from:c,to:p}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,h=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),u=!!u&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),c===p&&h){const{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(c-=1,p+=1)}if(u){if(Array.isArray(t))d=t.map(e=>e.text||"").join("");else if(t instanceof W){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),d=e}else d="object"==typeof t&&t&&t.text?t.text:t;r.insertText(d,c,p)}else{d=o;const e=r.doc.resolve(c),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,p,d)}n.updateSelection&&function(e,t){const n=e.steps.length-1;if(n<t)return;const r=e.steps[n];if(!(r instanceof ut||r instanceof ht))return;const o=e.mapping.maps[n];let i=0;o.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(Vt.near(e.doc.resolve(i),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:d})}return!0},Ks=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Jt;if(o){if(r.node.isTextblock||!Ct(e.doc,r.from))return!1;n=r.from}else if(n=Nt(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Jt.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Js=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Jt){if(r.node.isTextblock||!Ct(e.doc,r.to))return!1;n=r.to}else if(n=Nt(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Ys=()=>({state:e,dispatch:t})=>mn(e,t),Qs=()=>({state:e,dispatch:t})=>wn(e,t),Zs=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nt(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Xs=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nt(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},ea=()=>({state:e,dispatch:t})=>((e,t)=>{let n=fn(e,void 0);if(!n)return!1;let r=xn(n);return!!r&&gn(e,r,t)})(e,t),ta=()=>({state:e,dispatch:t})=>((e,t)=>{let n=vn(e,void 0);if(!n)return!1;let r=Cn(n);return!!r&&gn(e,r,t)})(e,t);function na(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var ra=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);qs()||na()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function oa(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?ks(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,d=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>Os(e.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}var ia=(e,t={})=>({state:n,dispatch:r})=>!!oa(n,ks(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&yt(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),sa=()=>({state:e,dispatch:t})=>jn(e,t),aa=e=>({state:t,dispatch:n})=>{return(r=ks(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,i=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!i&&(!t||(n.node(i.depth-1).type==r?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new ht(i-1,s,i,s,new Z(W.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new fe(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=yt(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Ct(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),t(o.scrollIntoView()),!0}(e,t,r,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,d=i.node(-1),c=i.index(-1);if(!d.canReplace(c+(a?0:1),c+1,s.content.append(l?W.empty:W.from(o))))return!1;let p=i.pos,u=p+s.nodeSize;return r.step(new ht(p-(a?1:0),u+(l?1:0),p+1,u-1,new Z((a?W.empty:W.from(o.copy(W.empty))).append(l?W.empty:W.from(o.copy(W.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(e,t,i)))})(t,n);var r},la=()=>({state:e,dispatch:t})=>Tn(e,t);function da(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ca(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var pa=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=da("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=ks(e,r.schema)),"mark"===a&&(s=Is(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,ca(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(ca(i.attrs,t))))})})}),l},ua=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ha=()=>({tr:e,dispatch:t})=>{if(t){const t=new Qt(e.doc);e.setSelection(t)}return!0},fa=()=>({state:e,dispatch:t})=>bn(e,t),ma=()=>({state:e,dispatch:t})=>kn(e,t),ga=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(Jt.create(e.doc,n))),!0)})(e,t),ya=()=>({state:e,dispatch:t})=>In(e,t),ba=()=>({state:e,dispatch:t})=>Ln(e,t);function xa(e,t,n={},r={}){return Ws(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var va=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=xa(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function wa(e,t){const n=Is(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function ka(e,t){const n=new $t(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Ca(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function Ta(e,t,n){return void 0===e.config[t]&&e.parent?Ta(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?Ta(e.parent,t,n):null}):e.config[t]}function Na(e){return e.map(e=>{const t=Ta(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Na(t())]:e}).flat(10)}function Sa(e,t){const n=Ge.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Ma(e){return"function"==typeof e}function ja(e,t=void 0,...n){return Ma(e)?t?e.bind(t)(...n):e(...n):e}function Oa(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Aa(e){const t=[],{nodeExtensions:n,markExtensions:r}=Oa(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=Ta(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ta(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function Ea(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){const r=n[e],o=r.indexOf(":");if(-1===o)continue;const i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&s&&t.push([i,s])}return t}function La(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...Ea(n[e]),...Ea(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function Ia(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>La(e,t),{})}function Da(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function Ra(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Pa(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function za(e){return e.sort((e,t)=>{const n=Ta(e,"priority")||100,r=Ta(t,"priority")||100;return n>r?-1:n<r?1:0})}function Ba(e){const t=za(Na(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Fa(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,d)=>{var c;e.isBlock&&n>r&&(a+=i);const p=null==s?void 0:s[e.type.name];if(p)return l&&(a+=p({node:e,pos:n,parent:l,index:d,range:t})),!1;e.isText&&(a+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,o-n))}),a}function qa(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function $a(e,t){const n=da("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=ks(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?wa(e,t):{}}function Ha(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),function(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>{const r=t.filter((e,t)=>t!==n);return!r.some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to)})}(r)}function Va(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Ls(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Ua(e,t){return t.nodes[e]||t.marks[e]||null}function _a(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Wa(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Is(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Os(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Os(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=s}function Ga(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Ka(e,t){const{nodeExtensions:n}=Oa(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=ja(Ta(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Ja(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Ja(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Ya(e){return e instanceof Jt}var Qa=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Za(e,t){const n=t.mapping.mapResult(e.position);return{position:new Qa(n.pos),mapResult:n}}function Xa(e){return new Qa(e)}var el=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Is(e,r.schema);if(o)if(s){const e=wa(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(Ps(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},tl=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),nl=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=ks(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!Dn(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Dn(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},rl=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=zs(e,0,n.content.size),o=Jt.create(n,r);t.setSelection(o)}return!0},ol=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},il=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Gt.atStart(n).from,s=Gt.atEnd(n).to,a=zs(r,i,s),l=zs(o,i,s),d=Gt.create(n,a,l);t.setSelection(d)}return!0},sl=e=>({state:t,dispatch:n})=>{const r=ks(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=W.from(n?o.create():null),s=new Z(W.from(o.create(null,W.from(a.type.create(null,r)))),n?3:1,0),d=i.start,c=i.end;t(e.tr.step(new ht(d-(n?3:1),c,d,c,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function al(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var ll=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,d=_a(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof Jt&&i.node.isBlock)return!(!a.parentOffset||!kt(s,a.pos)||(r&&(e&&al(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),0));if(!a.parent.isBlock)return!1;const c=l.parentOffset===l.parent.content.size,p=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=c&&p?[{type:p,attrs:d}]:void 0,h=kt(t.doc,t.mapping.map(a.pos),1,u);if(u||h||!kt(t.doc,t.mapping.map(a.pos),1,p?[{type:p}]:void 0)||(h=!0,u=p?[{type:p,attrs:d}]:void 0),r){if(h&&(i instanceof Gt&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,u),p&&!c&&!a.parentOffset&&a.parent.type!==p)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&t.setNodeMarkup(t.mapping.map(a.before()),p)}e&&al(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return h},dl=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=ks(e,r.schema),{$from:l,$to:d}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(d))return!1;const p=l.node(-1);if(p.type!==a)return!1;const u=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=W.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=W.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={..._a(u,l.node().type.name,l.node().attrs),...t},d=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(W.from(a.createAndFill(null,d)||void 0));const c=l.before(l.depth-(r-1));n.replace(c,l.after(-o),new Z(e,4-r,0));let p=-1;n.doc.nodesBetween(c,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(Gt.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}const h=d.pos===l.end()?p.contentMatchAt(0).defaultType:null,f={..._a(u,p.type.name,p.attrs),...t},m={..._a(u,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,d.pos);const g=h?[{type:a,attrs:f},{type:h,attrs:m}]:[{type:a,attrs:f}];if(!kt(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const d=a.filter(e=>s.includes(e.type.name));n.ensureMarks(d)}return!0},cl=(e,t)=>{const n=Ca(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ct(e.doc,n.pos)||(e.join(n.pos),!0)},pl=(e,t)=>{const n=Ca(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ct(e.doc,r)||(e.join(r),!0)},ul=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:d,can:c})=>{const{extensions:p,splittableMarks:u}=o.extensionManager,h=ks(e,s.schema),f=ks(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,x=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const w=Ca(e=>Ka(e.type.name,p))(m),k=0===m.from&&m.to===s.doc.content.size,C=s.doc.content.content,T=1===C.length?C[0]:null,N=k&&T&&Ka(T.type.name,p)?{node:T,pos:0,depth:0}:null,S=null!=w?w:N,M=!!N;if((w&&x.depth>=1&&x.depth-w.depth<=1||M)&&S){if(S.node.type===h)return k&&M?l().command(({tr:e,dispatch:t})=>{const n=function(e){const t=e.doc,n=t.firstChild;if(!n)return null;const r=n.nodeSize-1;return Gt.create(t,1,r)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():d.liftListItem(f);if(Ka(S.node.type.name,p)&&h.validContent(S.node.content))return l().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>cl(i,h)).command(()=>pl(i,h)).run()}return n&&v&&a?l().command(()=>{const e=c().wrapInList(h,r),t=v.filter(e=>u.includes(e.type.name));return i.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(h,r).command(()=>cl(i,h)).command(()=>pl(i,h)).run():l().command(()=>!!c().wrapInList(h,r)||d.clearNodes()).wrapInList(h,r).command(()=>cl(i,h)).command(()=>pl(i,h)).run()},hl=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Is(e,r.schema);return Wa(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},fl=(e,t,n={})=>({state:r,commands:o})=>{const i=ks(e,r.schema),s=ks(t,r.schema),a=oa(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},ml=(e,t={})=>({state:n,commands:r})=>{const o=ks(e,n.schema);return oa(n,o,t)?r.lift(o):r.wrapIn(o,t)},gl=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},yl=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},bl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Is(e,r.schema),{$from:d,empty:c,ranges:p}=a;if(!o)return!0;if(c&&s){let{from:e,to:t}=a;const r=null==(i=d.marks().find(e=>e.type===l))?void 0:i.attrs,o=Ls(d,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else p.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},xl=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},vl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=da("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=ks(e,r.schema)),"mark"===a&&(s=Is(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,d=e.$to.pos;let c,p,u,h;n.selection.empty?r.doc.nodesBetween(a,d,(e,t)=>{i&&i===e.type&&(l=!0,u=Math.max(t,a),h=Math.min(t+e.nodeSize,d),c=t,p=e)}):r.doc.nodesBetween(a,d,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,u=Math.max(r,a),h=Math.min(r+e.nodeSize,d),c=r,p=e),r>=a&&r<=d&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,d);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),p&&(void 0!==c&&o&&n.setNodeMarkup(c,void 0,{...p.attrs,...t}),s&&p.marks.length&&p.marks.forEach(e=>{s===e.type&&o&&n.addMark(u,h,s.create({...e.attrs,...t}))}))}),l},wl=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&bt(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(ks(e,n.schema),t)(n,r),kl=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new fe(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new fe(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=bt(i,n,r,t);return!!a&&(e&&function(e,t,n,r,o){let i=W.empty;for(let e=n.length-1;e>=0;e--)i=W.from(n[e].type.create(n[e].attrs,i));e.step(new ht(t.start-(r?2:0),t.end,t.start,t.end,new Z(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let a=n.length-s,l=t.start+n.length-(r?2:0),d=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&kt(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=d.child(n).nodeSize}(e,t,a,o,n),!0)}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}(ks(e,n.schema),t)(n,r),Cl=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Tl=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Nl(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1;const p=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+i;return s.forEach(e=>{if(c)return;const t=((e,t)=>{if(js(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(p,e.find);if(!t)return;const s=l.state.tr,d=us({state:l.state,transaction:s}),u={from:r-(t[0].length-i.length),to:o},{commands:h,chain:f,can:m}=new hs({editor:n,state:d});null!==e.handler({state:d,range:u,match:t,commands:h,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),c=!0)}),c}function Sl(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Ml(e,t){const n={...e};return Sl(e)&&Sl(t)&&Object.keys(t).forEach(r=>{Sl(t[r])&&Sl(e[r])?n[r]=Ml(e[r],t[r]):n[r]=t[r]}),n}var jl=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ja(Ta(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ja(Ta(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Ol=class e extends jl{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Al=class{constructor(e){this.find=e.find,this.handler=e.handler}};var El=null;function Ll(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,d=us({state:e,transaction:l});if(function(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:d,can:c}=new hs({editor:t,state:n}),p=[];return n.doc.nodesBetween(r,o,(e,t)=>{var u,h,f,m,g;if((null==(h=null==(u=e.type)?void 0:u.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),x=Math.min(o,t+y);if(b>=x)return;const v=((e,t,n)=>{if(js(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,x-t,void 0,""),i.find,s);v.forEach(e=>{if(void 0===e.index)return;const t=b+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=i.handler({state:n,range:o,match:e,commands:l,chain:d,can:c,pasteEvent:s,dropEvent:a});p.push(u)})}),p.every(e=>null!==e)}({editor:t,state:d,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new dn({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(El=t)},r=()=>{El&&(El=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=El;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],d="paste"===o.getMeta("uiEvent")&&!i,c="drop"===o.getMeta("uiEvent")&&!s,p=o.getMeta("applyPasteRules"),u=!!p;if(!d&&!c&&!u)return;if(u){let{text:t}=p;"string"==typeof t||(t=Sa(W.from(t),r.schema));const{from:n}=p,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const h=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof h&&f&&h!==f.b?l({rule:e,state:r,from:h,to:f,pasteEvt:a}):void 0}}))}var Il=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Ba(e),this.schema=function(e,t){var n;const r=Aa(e),{nodeExtensions:o,markExtensions:i}=Oa(e),s=null==(n=o.find(e=>Ta(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Ra({...e.reduce((e,t)=>{const r=Ta(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:ja(Ta(n,"content",i)),marks:ja(Ta(n,"marks",i)),group:ja(Ta(n,"group",i)),inline:ja(Ta(n,"inline",i)),atom:ja(Ta(n,"atom",i)),selectable:ja(Ta(n,"selectable",i)),draggable:ja(Ta(n,"draggable",i)),code:ja(Ta(n,"code",i)),whitespace:ja(Ta(n,"whitespace",i)),linebreakReplacement:ja(Ta(n,"linebreakReplacement",i)),defining:ja(Ta(n,"defining",i)),isolating:ja(Ta(n,"isolating",i)),attrs:Object.fromEntries(o.map(Pa))}),a=ja(Ta(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Da(e,o)));const l=Ta(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:Ia(e,o)}));const d=Ta(n,"renderText",i);return d&&(s.toText=d),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Ra({...e.reduce((e,t)=>{const r=Ta(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:ja(Ta(n,"inclusive",i)),excludes:ja(Ta(n,"excludes",i)),group:ja(Ta(n,"group",i)),spanning:ja(Ta(n,"spanning",i)),code:ja(Ta(n,"code",i)),attrs:Object.fromEntries(o.map(Pa))}),a=ja(Ta(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Da(e,o)));const l=Ta(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:Ia(e,o)})),[n.name,s]}));return new Re({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Ta(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Ua(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=za([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ua(t.name,this.schema)},r=[],o=Ta(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Ta(t,"exitable",n)&&(i.ArrowRight=()=>Ol.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new dn({props:{handleKeyDown:ds(i)}});r.push(s);const a=Ta(t,"addInputRules",n);if(Ga(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new dn({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=Sa(W.from(e),i.schema));const{from:o}=a,s=o+e.length;Nl({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Nl({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Nl({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Nl({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=Ta(t,"addPasteRules",n);if(Ga(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=Ll({editor:e,rules:t});r.push(...n)}}const d=Ta(t,"addProseMirrorPlugins",n);if(d){const e=d();r.push(...e)}return r});return t}get attributes(){return Aa(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Oa(this.extensions);return Object.fromEntries(t.filter(e=>!!Ta(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ks(t.name,this.schema)},o=Ta(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,a,l)=>{const d=Ia(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){const{editor:t}=this;return za([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ua(n.name,this.schema)},o=Ta(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return za([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ua(n.name,this.schema)},o=Ta(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Oa(this.extensions);return Object.fromEntries(t.filter(e=>!!Ta(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Is(t.name,this.schema)},o=Ta(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const a=Ia(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let d=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(d=!0)}),d){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]:[]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ua(e.name,this.schema)};"mark"===e.type&&(null==(t=ja(Ta(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=Ta(e,"onBeforeCreate",n),o=Ta(e,"onCreate",n),i=Ta(e,"onUpdate",n),s=Ta(e,"onSelectionUpdate",n),a=Ta(e,"onTransaction",n),l=Ta(e,"onFocus",n),d=Ta(e,"onBlur",n),c=Ta(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}};Il.resolve=Ba,Il.sort=za,Il.flatten=Na,ps({},{ClipboardTextSerializer:()=>Rl,Commands:()=>Pl,Delete:()=>zl,Drop:()=>Bl,Editable:()=>Fl,FocusEvents:()=>$l,Keymap:()=>Hl,Paste:()=>Vl,Tabindex:()=>Ul,TextDirection:()=>_l,focusEventsPluginKey:()=>ql});var Dl=class e extends jl{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Rl=Dl.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new dn({key:new un("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=qa(n);return Fa(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Pl=Dl.create({name:"commands",addCommands:()=>({...fs})}),zl=Dl.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=ka(e.before,[e,...t]);Ha(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof dt){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),d=a.invert().map(i,-1),c=a.invert().map(l),p=i>0&&(null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark))),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:i,to:l},partial:Boolean(u||p),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),Bl=Dl.create({name:"drop",addProseMirrorPlugins(){return[new dn({key:new un("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Fl=Dl.create({name:"editable",addProseMirrorPlugins(){return[new dn({key:new un("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ql=new un("focusEvents"),$l=Dl.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new dn({key:ql,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Hl=Dl.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,d=l.parent.type.spec.isolating,c=i.pos-i.parentOffset,p=d&&1===l.parent.childCount?c===i.pos:Vt.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!p||p&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return qs()||na()?o:r},addProseMirrorPlugins(){return[new dn({key:new un("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Vt.atStart(t.doc).from,d=Vt.atEnd(t.doc).to;if(i||s!==l||a!==d)return;if(!Ja(n.doc))return;const c=n.tr,p=us({state:n,transaction:c}),{commands:u}=new hs({editor:this.editor,state:p});return u.clearNodes(),c.steps.length?c:void 0}})]}}),Vl=Dl.create({name:"paste",addProseMirrorPlugins(){return[new dn({key:new un("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Ul=Dl.create({name:"tabindex",addProseMirrorPlugins(){return[new dn({key:new un("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),_l=Dl.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Oa(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new dn({key:new un("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Wl=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const d=new e(l,this.editor,o,o||s?n:null);o&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{n&&r.length>0||(i.node.type.name===e&&o.every(e=>t[e]===i.node.attrs[e])&&r.push(i),n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Gl=class extends Cl{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Za,createMappablePosition:Xa},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Bs(t,this.options.autofocus);this.editorState=an.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',document.getElementsByTagName("head")[0].appendChild(r),r}(0,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Ma(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[Fl,Rl.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Pl,$l,Hl,Ul,Bl,Vl,zl,_l.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Il(n,this)}createCommandManager(){this.commandManager=new hs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=xa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=xa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Wi(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return $a(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return oa(e,null,n)||Wa(e,null,n);const r=da(t,e.schema);return"node"===r?oa(e,t,n):"mark"===r&&Wa(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Sa(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Fa(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...qa(this.schema),...n}})}get isEmpty(){return Ja(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Wl(t,this)}get $doc(){return this.$pos(0)}};function Kl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ja(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),d=l+s.length;if(Va(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;d<n.to&&i.delete(d,n.to),l>n.from&&i.delete(n.from+r,l);const c=n.from+r+s.length;i.addMark(n.from+r,c,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function Jl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=ja(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Yl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=ja(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&bt(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===e.type&&Ct(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,d))&&s.join(n.from-1)},undoable:e.undoable})}function Ql(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Zl(e){if(!e||0===Object.keys(e).length)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function Xl(e){const{nodeName:t,name:n,parseAttributes:r=Ql,serializeAttributes:o=Zl,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const d=a[1]||"",c=r(d);return s.find(e=>!(e in c))?void 0:{type:t,raw:a[0],attributes:c}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function ed(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Ql,serializeAttributes:i=Zl,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,d=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${d}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[c,p=""]=l,u=o(p);let h=1;const f=c.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)h+=1;else if(h-=1,0===h){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:u,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${d}${o}\n\n${s}\n\n:::`}}}function td(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function nd(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function rd(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=td,serializeAttributes:i=nd,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,d=n||t,c=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${c}\\s*[^\\]]*\\]`):new RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),s=e.match(i);if(!s)return;let l="",d="";if(a){const[,e]=s;d=e}else{const[,e,t]=s;d=e,l=t||""}const p=o(d.trim());return{type:t,raw:s[0],content:l.trim(),attributes:p}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${d}${s}]`:`[${d}${s}]${t}[/${d}]`}}}function od(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let d="",c=0;const p=t.baseIndentSize||2;for(;c<a.length;){const e=a[c],u=e.match(t.itemPattern);if(!u){if(l.length>0)break;if(""===e.trim()){c+=1,d=`${d}${e}\n`;continue}return}const h=t.extractItemData(u),{indentLevel:f,mainContent:m}=h;d=`${d}${e}\n`;const g=[m];for(c+=1;c<a.length;){const e=a[c];if(""===e.trim()){const t=a.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[c+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),d=`${d}${e}\n`,c+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),d=`${d}${e}\n`,c+=1}let y;const b=g.slice(1);if(b.length>0){const e=b.map(e=>e.slice(f+p)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const x=t.createToken(h,y);l.push(x)}if(0!==l.length)return{items:l,raw:d}}function id(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content;let a=`${o}${t.renderChildren([i])}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,o;const i=null!=(o=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?o:t.renderChildren([e]);if(null!=i){const n=i.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");a+="paragraph"===e.type?`\n\n${n}`:`\n${n}`}}),a}ps({},{createAtomBlockMarkdownSpec:()=>Xl,createBlockMarkdownSpec:()=>ed,createInlineMarkdownSpec:()=>rd,parseAttributes:()=>Ql,parseIndentedBlocks:()=>od,renderNestedMarkdownContent:()=>id,serializeAttributes:()=>Zl});var sd=class e extends jl{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function ad(e){return new Al({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=ja(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let d=n.to;if(a){const o=l.search(/\S/),c=n.from+l.indexOf(a),p=c+a.length;if(Va(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;p<n.to&&s.delete(p,n.to),c>n.from&&s.delete(n.from+o,c),d=n.from+o+a.length,s.addMark(n.from+o,d,e.type.create(i||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:ld,getOwnPropertySymbols:dd}=Object,{hasOwnProperty:cd}=Object.prototype;function pd(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function ud(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const a=e(t,n,r);return o.delete(t),o.delete(n),a}}function hd(e){return ld(e).concat(dd(e))}const fd=Object.hasOwn||((e,t)=>cd.call(e,t));function md(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:gd,keys:yd}=Object;function bd(e,t){return e.byteLength===t.byteLength&&Ed(new Uint8Array(e),new Uint8Array(t))}function xd(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function vd(e,t){return e.byteLength===t.byteLength&&Ed(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function wd(e,t){return md(e.getTime(),t.getTime())}function kd(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Cd(e,t){return e===t}function Td(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,a,l=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,d=0;for(;(a=r.next())&&!a.done;){if(o[d]){d++;continue}const r=s.value,c=a.value;if(n.equals(r[0],c[0],l,d,e,t,n)&&n.equals(r[1],c[1],r[0],c[0],e,t,n)){i=o[d]=!0;break}d++}if(!i)return!1;l++}return!0}const Nd=md;function Sd(e,t,n){const r=yd(e);let o=r.length;if(yd(t).length!==o)return!1;for(;o-- >0;)if(!Id(e,t,n,r[o]))return!1;return!0}function Md(e,t,n){const r=hd(e);let o,i,s,a=r.length;if(hd(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!Id(e,t,n,o))return!1;if(i=gd(e,o),s=gd(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function jd(e,t){return md(e.valueOf(),t.valueOf())}function Od(e,t){return e.source===t.source&&e.flags===t.flags}function Ad(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,a;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,l=0;for(;(a=r.next())&&!a.done;){if(!o[l]&&n.equals(s.value,a.value,s.value,a.value,e,t,n)){i=o[l]=!0;break}l++}if(!i)return!1}return!0}function Ed(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Ld(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Id(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||fd(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Dd={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Rd=Object.prototype.toString;const Pd=zd();function zd(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:bd,areArraysEqual:n?Md:xd,areDataViewsEqual:vd,areDatesEqual:wd,areErrorsEqual:kd,areFunctionsEqual:Cd,areMapsEqual:n?pd(Td,Md):Td,areNumbersEqual:Nd,areObjectsEqual:n?Md:Sd,arePrimitiveWrappersEqual:jd,areRegExpsEqual:Od,areSetsEqual:n?pd(Ad,Md):Ad,areTypedArraysEqual:n?pd(Ed,Md):Ed,areUrlsEqual:Ld,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=ud(r.areArraysEqual),t=ud(r.areMapsEqual),n=ud(r.areObjectsEqual),o=ud(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:d,areRegExpsEqual:c,areSetsEqual:p,areTypedArraysEqual:u,areUrlsEqual:h,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&i(m,g,y);const x=m.constructor;if(x!==g.constructor)return!1;if(x===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(x===Date)return r(m,g,y);if(x===RegExp)return c(m,g,y);if(x===Map)return s(m,g,y);if(x===Set)return p(m,g,y);const v=Rd.call(m);if("[object Date]"===v)return r(m,g,y);if("[object RegExp]"===v)return c(m,g,y);if("[object Map]"===v)return s(m,g,y);if("[object Set]"===v)return p(m,g,y);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===v)return h(m,g,y);if("[object Error]"===v)return o(m,g,y);if("[object Arguments]"===v)return l(m,g,y);if(Dd[v])return u(m,g,y);if("[object ArrayBuffer]"===v)return e(m,g,y);if("[object DataView]"===v)return n(m,g,y);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return d(m,g,y);if(f){let e=f[v];if(!e){const t=null!=(w=m)?w[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}var w;return!1}}(i);var a;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:a=(e?new WeakMap:void 0),meta:l}=n();return t(i,s,{cache:a,equals:r,meta:l,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(a=s,function(e,t,n,r,o,i,s){return a(e,t,s)}),strict:o})}zd({strict:!0}),zd({circular:!0}),zd({circular:!0,strict:!0}),zd({createInternalComparator:()=>md}),zd({strict:!0,createInternalComparator:()=>md}),zd({circular:!0,createInternalComparator:()=>md}),zd({circular:!0,createInternalComparator:()=>md,strict:!0});var Bd=a(358),Fd=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},qd=({contentComponent:e})=>{const t=(0,$.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,c.jsx)(c.Fragment,{children:Object.values(t)})},$d=class extends p.default.Component{constructor(e){super(e),this.editorContentRef=p.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(n,r){t={...t,[n]:q.default.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{ref:Fd(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,c.jsx)(qd,{contentComponent:e.contentComponent})]})}},Hd=(0,p.forwardRef)((e,t)=>{const n=p.default.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[e.editor]);return p.default.createElement($d,{key:n,innerRef:t,...e})}),Vd=p.default.memo(Hd),Ud="undefined"!=typeof window?p.useLayoutEffect:p.useEffect,_d=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var Wd="undefined"==typeof window,Gd=Wd||Boolean("undefined"!=typeof window&&window.next),Kd=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?Wd||Gd?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new Gl(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Jd(e={},t=[]){const n=(0,p.useRef)(e);n.current=e;const[r]=(0,p.useState)(()=>new Kd(n)),o=(0,$.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,p.useDebugValue)(o),(0,p.useEffect)(r.onRender(t)),function(e){var t;const[n]=(0,p.useState)(()=>new _d(e.editor)),r=(0,Bd.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:Pd);Ud(()=>n.watch(e.editor),[e.editor,n]),(0,p.useDebugValue)(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}var Yd=(0,p.createContext)({editor:null});Yd.Consumer;var Qd=(0,p.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});p.default.forwardRef((e,t)=>{const{onDragStart:n}=(0,p.useContext)(Qd),r=e.as||"div";return(0,c.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})}),p.default.createContext({markViewContentRef:()=>{}});var Zd=(0,p.createContext)({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Zd.displayName="TiptapContext";function Xd({editor:e,instance:t,children:n}){const r=null!=e?e:t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=(0,p.useMemo)(()=>({editor:r}),[r]),i=(0,p.useMemo)(()=>({editor:r}),[r]);return(0,c.jsx)(Yd.Provider,{value:i,children:(0,c.jsx)(Zd.Provider,{value:o,children:n})})}function ec({...e}){const{editor:t}=(0,p.useContext)(Zd);return(0,c.jsx)(Vd,{editor:t,...e})}Xd.displayName="Tiptap",ec.displayName="Tiptap.Content",Object.assign(Xd,{Content:ec});var tc=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},nc=/^\s*>\s$/,rc=sd.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return tc("blockquote",{...La(this.options.HTMLAttributes,e),children:tc("slot",{})})},parseMarkdown:(e,t)=>{var n;const r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach((e,r)=>{var o,i;const s=(null!=(i=null==(o=t.renderChild)?void 0:o.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Yl({find:nc,type:this.type})]}}),oc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ic=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ac=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,lc=Ol.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return tc("strong",{...La(this.options.HTMLAttributes,e),children:tc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Kl({find:oc,type:this.type}),Kl({find:sc,type:this.type})]},addPasteRules(){return[ad({find:ic,type:this.type}),ad({find:ac,type:this.type})]}}),dc=/(^|[^`])`([^`]+)`(?!`)$/,cc=/(^|[^`])`([^`]+)`(?!`)/g,pc=Ol.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Kl({find:dc,type:this.type})]},addPasteRules(){return[ad({find:cc,type:this.type})]}}),uc=/^```([a-z]+)?[\s\n]$/,hc=/^~~~([a-z]+)?[\s\n]$/,fc=sd.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;return[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0]||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",La(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return r=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let d=0,c=0;const p=o-s;for(let e=0;e<l.length;e+=1){if(c+l[e].length>=p){d=e;break}c+=l[e].length+1}const u=(null==(t=l[d].match(/^ */))?void 0:t[0])||"",h=Math.min(u.length,n);if(0===h)return!0;let f=s;for(let e=0;e<d;e+=1)f+=l[e].length+1;return e.delete(f,f+h),o-f<=h&&e.setSelection(Gt.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const s=o.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(Vt.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[Jl({find:uc,type:this.type,getAttributes:e=>({language:e[1]})}),Jl({find:hc,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new dn({key:new un("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Gt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),mc=sd.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),gc=sd.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",La(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yc=sd.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,La(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Jl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),bc=sd.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",La(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Jt){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Ya(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Gt.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Jt.create(t.doc,n.pos)):t.setSelection(Gt.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(Gt.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ja(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable}))];var e}}),xc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Cc=Ol.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",La(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Kl({find:xc,type:this.type}),Kl({find:wc,type:this.type})]},addPasteRules(){return[ad({find:vc,type:this.type}),ad({find:kc,type:this.type})]}});const Tc="numeric",Nc="ascii",Sc="alpha",Mc="asciinumeric",jc="alphanumeric",Oc="domain",Ac="emoji",Ec="scheme",Lc="slashscheme",Ic="whitespace";function Dc(e,t){return e in t||(t[e]=[]),t[e]}function Rc(e,t,n){t[Tc]&&(t[Mc]=!0,t[jc]=!0),t[Nc]&&(t[Mc]=!0,t[Sc]=!0),t[Mc]&&(t[jc]=!0),t[Sc]&&(t[jc]=!0),t[jc]&&(t[Oc]=!0),t[Ac]&&(t[Oc]=!0);for(const r in t){const t=Dc(r,n);t.indexOf(e)<0&&t.push(e)}}function Pc(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Pc.groups={},Pc.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Pc.groups,t&&t.j?o=t:(o=new Pc(t),n&&r&&Rc(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Pc.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Pc,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Pc,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Rc(i,e,r)}else n&&Rc(i,n,r);s.t=i}return o.j[e]=s,s}};const zc=(e,t,n,r,o)=>e.ta(t,n,r,o),Bc=(e,t,n,r,o)=>e.tr(t,n,r,o),Fc=(e,t,n,r,o)=>e.ts(t,n,r,o),qc=(e,t,n,r,o)=>e.tt(t,n,r,o),$c="WORD",Hc="UWORD",Vc="ASCIINUMERICAL",Uc="ALPHANUMERICAL",_c="LOCALHOST",Wc="TLD",Gc="UTLD",Kc="SCHEME",Jc="SLASH_SCHEME",Yc="NUM",Qc="WS",Zc="NL",Xc="OPENBRACE",ep="CLOSEBRACE",tp="OPENBRACKET",np="CLOSEBRACKET",rp="OPENPAREN",op="CLOSEPAREN",ip="OPENANGLEBRACKET",sp="CLOSEANGLEBRACKET",ap="FULLWIDTHLEFTPAREN",lp="FULLWIDTHRIGHTPAREN",dp="LEFTCORNERBRACKET",cp="RIGHTCORNERBRACKET",pp="LEFTWHITECORNERBRACKET",up="RIGHTWHITECORNERBRACKET",hp="FULLWIDTHLESSTHAN",fp="FULLWIDTHGREATERTHAN",mp="AMPERSAND",gp="APOSTROPHE",yp="ASTERISK",bp="AT",xp="BACKSLASH",vp="BACKTICK",wp="CARET",kp="COLON",Cp="COMMA",Tp="DOLLAR",Np="DOT",Sp="EQUALS",Mp="EXCLAMATION",jp="HYPHEN",Op="PERCENT",Ap="PIPE",Ep="PLUS",Lp="POUND",Ip="QUERY",Dp="QUOTE",Rp="FULLWIDTHMIDDLEDOT",Pp="SEMI",zp="SLASH",Bp="TILDE",Fp="UNDERSCORE",qp="EMOJI",$p="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:Uc,AMPERSAND:mp,APOSTROPHE:gp,ASCIINUMERICAL:Vc,ASTERISK:yp,AT:bp,BACKSLASH:xp,BACKTICK:vp,CARET:wp,CLOSEANGLEBRACKET:sp,CLOSEBRACE:ep,CLOSEBRACKET:np,CLOSEPAREN:op,COLON:kp,COMMA:Cp,DOLLAR:Tp,DOT:Np,EMOJI:qp,EQUALS:Sp,EXCLAMATION:Mp,FULLWIDTHGREATERTHAN:fp,FULLWIDTHLEFTPAREN:ap,FULLWIDTHLESSTHAN:hp,FULLWIDTHMIDDLEDOT:Rp,FULLWIDTHRIGHTPAREN:lp,HYPHEN:jp,LEFTCORNERBRACKET:dp,LEFTWHITECORNERBRACKET:pp,LOCALHOST:_c,NL:Zc,NUM:Yc,OPENANGLEBRACKET:ip,OPENBRACE:Xc,OPENBRACKET:tp,OPENPAREN:rp,PERCENT:Op,PIPE:Ap,PLUS:Ep,POUND:Lp,QUERY:Ip,QUOTE:Dp,RIGHTCORNERBRACKET:cp,RIGHTWHITECORNERBRACKET:up,SCHEME:Kc,SEMI:Pp,SLASH:zp,SLASH_SCHEME:Jc,SYM:$p,TILDE:Bp,TLD:Wc,UNDERSCORE:Fp,UTLD:Gc,UWORD:Hc,WORD:$c,WS:Qc});const Vp=/[a-z]/,Up=/\p{L}/u,_p=/\p{Emoji}/u,Wp=/\d/,Gp=/\s/;let Kp=null,Jp=null;function Yp(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,d=0,c=null,p=-1,u=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,u=0,c=a):p>=0&&(p+=n[s].length,u++),d+=n[s].length,i+=n[s].length,s++;i-=p,s-=u,d-=p,o.push({t:c.t,v:t.slice(i-d,i),s:i-d,e:i})}return o}function Qp(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new Pc(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new Pc(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Zp(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Xp={defaultProtocol:"http",events:null,format:tu,formatHref:tu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eu(e,t=null){let n=Object.assign({},Xp);e&&(n=Object.assign(n,e instanceof eu?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function tu(e){return e}function nu(e,t){this.t="token",this.v=e,this.tk=t}function ru(e,t){class n extends nu{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}eu.prototype={o:Xp,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Xp[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},nu.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Xp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),d=e.get("rel",n,t),c=e.getObj("attributes",n,t),p=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),d&&(s.rel=d),c&&Object.assign(s,c),{tagName:o,attributes:s,content:i,eventListeners:p}}};const ou=ru("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),iu=ru("text"),su=ru("nl"),au=ru("url",{isLink:!0,toHref(e=Xp.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==_c&&e[1].t===kp}}),lu=e=>new Pc(e);function du(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const cu="undefined"!=typeof console&&console&&console.warn||(()=>{}),pu={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function uu(e,t=!1){if(pu.initialized&&cu(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');pu.customSchemes.push([e,t])}function hu(e){return pu.initialized||function(){pu.scanner=function(e=[]){const t={};Pc.groups=t;const n=new Pc;null==Kp&&(Kp=Zp("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Jp&&(Jp=Zp("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),qc(n,"'",gp),qc(n,"{",Xc),qc(n,"}",ep),qc(n,"[",tp),qc(n,"]",np),qc(n,"(",rp),qc(n,")",op),qc(n,"<",ip),qc(n,">",sp),qc(n,"(",ap),qc(n,")",lp),qc(n,"「",dp),qc(n,"」",cp),qc(n,"『",pp),qc(n,"』",up),qc(n,"<",hp),qc(n,">",fp),qc(n,"&",mp),qc(n,"*",yp),qc(n,"@",bp),qc(n,"`",vp),qc(n,"^",wp),qc(n,":",kp),qc(n,",",Cp),qc(n,"$",Tp),qc(n,".",Np),qc(n,"=",Sp),qc(n,"!",Mp),qc(n,"-",jp),qc(n,"%",Op),qc(n,"|",Ap),qc(n,"+",Ep),qc(n,"#",Lp),qc(n,"?",Ip),qc(n,'"',Dp),qc(n,"/",zp),qc(n,";",Pp),qc(n,"~",Bp),qc(n,"_",Fp),qc(n,"\\",xp),qc(n,"・",Rp);const r=Bc(n,Wp,Yc,{[Tc]:!0});Bc(r,Wp,r);const o=Bc(r,Vp,Vc,{[Mc]:!0}),i=Bc(r,Up,Uc,{[jc]:!0}),s=Bc(n,Vp,$c,{[Nc]:!0});Bc(s,Wp,o),Bc(s,Vp,s),Bc(o,Wp,o),Bc(o,Vp,o);const a=Bc(n,Up,Hc,{[Sc]:!0});Bc(a,Vp),Bc(a,Wp,i),Bc(a,Up,a),Bc(i,Wp,i),Bc(i,Vp),Bc(i,Up,i);const l=qc(n,"\n",Zc,{[Ic]:!0}),d=qc(n,"\r",Qc,{[Ic]:!0}),c=Bc(n,Gp,Qc,{[Ic]:!0});qc(n,"",c),qc(d,"\n",l),qc(d,"",c),Bc(d,Gp,c),qc(c,"\r"),qc(c,"\n"),Bc(c,Gp,c),qc(c,"",c);const p=Bc(n,_p,qp,{[Ac]:!0});qc(p,"#"),Bc(p,_p,p),qc(p,"️",p);const u=qc(p,"‍");qc(u,"#"),Bc(u,_p,p);const h=[[Vp,s],[Wp,o]],f=[[Vp,null],[Up,a],[Wp,i]];for(let e=0;e<Kp.length;e++)Qp(n,Kp[e],Wc,$c,h);for(let e=0;e<Jp.length;e++)Qp(n,Jp[e],Gc,Hc,f);Rc(Wc,{tld:!0,ascii:!0},t),Rc(Gc,{utld:!0,alpha:!0},t),Qp(n,"file",Kc,$c,h),Qp(n,"mailto",Kc,$c,h),Qp(n,"http",Jc,$c,h),Qp(n,"https",Jc,$c,h),Qp(n,"ftp",Jc,$c,h),Qp(n,"ftps",Jc,$c,h),Rc(Kc,{scheme:!0,ascii:!0},t),Rc(Jc,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Ec]:!0}:{[Lc]:!0};r.indexOf("-")>=0?o[Oc]=!0:Vp.test(r)?Wp.test(r)?o[Mc]=!0:o[Nc]=!0:o[Tc]=!0,Fc(n,r,r,o)}return Fc(n,"localhost",_c,{ascii:!0}),n.jd=new Pc($p),{start:n,tokens:Object.assign({groups:t},Hp)}}(pu.customSchemes);for(let e=0;e<pu.tokenQueue.length;e++)pu.tokenQueue[e][1]({scanner:pu.scanner});pu.parser=function({groups:e}){const t=e.domain.concat([mp,yp,bp,xp,vp,wp,Tp,Sp,jp,Yc,Op,Ap,Ep,Lp,zp,$p,Bp,Fp]),n=[gp,kp,Cp,Np,Mp,Op,Ip,Dp,Pp,ip,sp,Xc,ep,np,tp,rp,op,ap,lp,dp,cp,pp,up,hp,fp],r=[mp,gp,yp,xp,vp,wp,Tp,Sp,jp,Xc,ep,Op,Ap,Ep,Lp,Ip,zp,$p,Bp,Fp],o=lu(),i=qc(o,Bp);zc(i,r,i),zc(i,e.domain,i);const s=lu(),a=lu(),l=lu();zc(o,e.domain,s),zc(o,e.scheme,a),zc(o,e.slashscheme,l),zc(s,r,i),zc(s,e.domain,s);const d=qc(s,bp);qc(i,bp,d),qc(a,bp,d),qc(l,bp,d);const c=qc(i,Np);zc(c,r,i),zc(c,e.domain,i);const p=lu();zc(d,e.domain,p),zc(p,e.domain,p);const u=qc(p,Np);zc(u,e.domain,p);const h=lu(ou);zc(u,e.tld,h),zc(u,e.utld,h),qc(d,_c,h);const f=qc(p,jp);qc(f,jp,f),zc(f,e.domain,p),zc(h,e.domain,p),qc(h,Np,u),qc(h,jp,f);const m=qc(h,kp);zc(m,e.numeric,ou);const g=qc(s,jp),y=qc(s,Np);qc(g,jp,g),zc(g,e.domain,s),zc(y,r,i),zc(y,e.domain,s);const b=lu(au);zc(y,e.tld,b),zc(y,e.utld,b),zc(b,e.domain,s),zc(b,r,i),qc(b,Np,y),qc(b,jp,g),qc(b,bp,d);const x=qc(b,kp),v=lu(au);zc(x,e.numeric,v);const w=lu(au),k=lu();zc(w,t,w),zc(w,n,k),zc(k,t,w),zc(k,n,k),qc(b,zp,w),qc(v,zp,w);const C=qc(a,kp),T=qc(l,kp),N=qc(T,zp),S=qc(N,zp);zc(a,e.domain,s),qc(a,Np,y),qc(a,jp,g),zc(l,e.domain,s),qc(l,Np,y),qc(l,jp,g),zc(C,e.domain,w),qc(C,zp,w),qc(C,Ip,w),zc(S,e.domain,w),zc(S,t,w),qc(S,zp,w);const M=[[Xc,ep],[tp,np],[rp,op],[ip,sp],[ap,lp],[dp,cp],[pp,up],[hp,fp]];for(let e=0;e<M.length;e++){const[r,o]=M[e],i=qc(w,r);qc(k,r,i),qc(i,o,w);const s=lu(au);zc(i,t,s);const a=lu();zc(i,n),zc(s,t,s),zc(s,n,a),zc(a,t,s),zc(a,n,a),qc(s,o,w),qc(a,o,w)}return qc(o,_c,b),qc(o,Zc,su),{start:o,tokens:Hp}}(pu.scanner.tokens);for(let e=0;e<pu.pluginQueue.length;e++)pu.pluginQueue[e][1]({scanner:pu.scanner,parser:pu.parser});pu.initialized=!0}(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,d=null,c=0,p=null,u=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(d=l||a.go(n[o].t));)l=null,a=d,a.accepts()?(u=0,p=a):u>=0&&u++,o++,c++;if(u<0)o-=c,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(du(iu,t,s)),s=[]),o-=u,c-=u;const e=p.t,r=n.slice(o-c,o);i.push(du(e,t,r))}}return s.length>0&&i.push(du(iu,t,s)),i}(pu.parser.start,e,Yp(pu.scanner.start,e))}function fu(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new eu(n),o=hu(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}hu.scan=Yp;var mu="[\0-   ᠎ -\u2029  ]",gu=new RegExp(mu),yu=new RegExp(`${mu}$`),bu=new RegExp(mu,"g");function xu(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(bu,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var vu=Ol.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?uu(e.scheme,e.optionalSlashes):uu(e)})},onDestroy(){Pc.groups={},pu.scanner=null,pu.parser=null,pu.tokenQueue=[],pu.pluginQueue=[],pu.customSchemes=[],pu.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!xu(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",La(this.options.HTMLAttributes,e),0]:["a",La(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ad({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=fu(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!xu(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(function(e){return new dn({key:new un("autolink"),appendTransaction:(t,n,r)=>{const o=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),i=t.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r;return Ha(ka(n.doc,[...t])).forEach(({newRange:t})=>{const n=function(e,t){const n=[];return e.nodesBetween(t.from,t.to,(e,t)=>{(e=>e.isTextblock)(e)&&n.push({node:e,pos:t})}),n}(r.doc,t);let o,i;if(n.length>1)o=n[0],i=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(n.length){const e=r.doc.textBetween(t.from,t.to," "," ");if(!yu.test(e))return;o=n[0],i=r.doc.textBetween(o.pos,t.to,void 0," ")}if(o&&i){const t=i.split(gu).filter(Boolean);if(t.length<=0)return!1;const n=t[t.length-1],l=o.pos+i.lastIndexOf(n);if(!n)return!1;const d=hu(n).map(t=>t.toObject(e.defaultProtocol));if(!(1===(a=d).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;d.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Va(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}var a}),s.steps.length?s:void 0}})}({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!xu(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(function(e){return new dn({key:new un("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=$a(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new dn({key:new un("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const d=fu(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!d||void 0!==o&&!o(d.value))&&e.editor.commands.setMark(e.type,{href:d.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),wu=vu,ku=Object.defineProperty,Cu="textStyle",Tu=/^\s*([-+*])\s$/,Nu=sd.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Cu)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Yl({find:Tu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Yl({find:Tu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Cu),editor:this.editor})),[e]}}),Su=sd.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n;if("list_item"!==e.type)return[];const r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;let o=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))o=r(e.tokens);else{const n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(o=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){const t=r(e.tokens.slice(1));o.push(...t)}}else o=r(e.tokens)}return 0===o.length&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:o}},renderMarkdown:(e,t,n)=>id(e,t,e=>{var t,n;return"bulletList"===e.parentType?"- ":"orderedList"===e.parentType?`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)ku(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>Mu,getNextListDepth:()=>ju,handleBackspace:()=>Lu,handleDelete:()=>Ru,hasListBefore:()=>Ou,hasListItemAfter:()=>Pu,hasListItemBefore:()=>Au,listItemHasSubList:()=>Eu,nextListIsDeeper:()=>Iu,nextListIsHigher:()=>Du});var Mu=(e,t)=>{const{$from:n}=t.selection,r=ks(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},ju=(e,t)=>{const n=Mu(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Ou=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Au=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Eu=(e,t,n)=>{if(!n)return!1;const r=ks(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},Lu=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!oa(e.state,t)&&Ou(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!oa(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=Mu(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Eu(t,e.state,o);return Au(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Iu=(e,t)=>{const n=ju(e,t),r=Mu(e,t);return!(!r||!n)&&n>r.depth},Du=(e,t)=>{const n=ju(e,t),r=Mu(e,t);return!(!r||!n)&&n<r.depth},Ru=(e,t)=>{if(!oa(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Ca(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Iu(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Du(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Pu=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},zu=Dl.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ru(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ru(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Lu(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Lu(e,n,r)&&(t=!0)}),t}}}}),Bu=/^(\s*)(\d+)\.\s+(.*)$/,Fu=/^\s/;function qu(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",d=[];l&&d.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const c=a.slice(1).join("\n").trim();if(c){const e=n.blockTokens(c);d.push(...e)}let p=i+1;const u=[];for(;p<e.length&&e[p].indent>t;)u.push(e[p]),p+=1;if(u.length>0){const e=Math.min(...u.map(e=>e.indent)),t=qu(u,e,n);d.push({type:"list",ordered:!0,start:u[0].number,items:t,raw:u.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:d}),i=p}else i+=1}return o}var $u="textStyle",Hu=/^(\d+)\.\s$/,Vu=sd.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",La(this.options.HTMLAttributes,n),0]:["ol",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Bu);if(!i)break;const[,s,a,l]=i,d=s.length;let c=l,p=n+1;const u=[o];for(;p<e.length;){const t=e[p];if(t.match(Bu))break;if(""===t.trim())u.push(t),c+="\n",p+=1;else{if(!t.match(Fu))break;u.push(t),c+=`\n${t.slice(d+2)}`,p+=1}}t.push({indent:d,number:parseInt(a,10),content:c.trim(),raw:u.join("\n")}),r=p,n=p}return[t,r]}(o);if(0===i.length)return;const a=qu(i,0,n);return 0!==a.length?{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}:void 0}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes($u)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Yl({find:Hu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Yl({find:Hu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($u)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Uu=/^\s*(\[([( |x])?\])\s$/,_u=sd.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",La(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return id(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),d=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};d(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let c=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,d(e);const t=Ia(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return c.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),c=n,!0}}}},addInputRules(){return[Yl({find:Uu,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),Wu=sd.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",La(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=od(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=od(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Gu=(Dl.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Nu.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Su.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(zu.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Vu.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(_u.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(Wu.configure(this.options.taskList)),e}}),"&nbsp;"),Ku=sd.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",La(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==n.length||"text"!==n[0].type||n[0].raw!==Gu&&n[0].text!==Gu&&" "!==n[0].raw&&" "!==n[0].text||1!==r.length||"text"!==r[0].type||r[0].text!==Gu&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t,n)=>{var r,o;if(!e)return"";const i=Array.isArray(e.content)?e.content:[];if(0===i.length){const e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return"paragraph"===(null==(o=null==n?void 0:n.previousNode)?void 0:o.type)&&0===e.length?Gu:""}return t.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ju=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Yu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qu=Ol.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Kl({find:Ju,type:this.type})]},addPasteRules(){return[ad({find:Yu,type:this.type})]}}),Zu=sd.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Xu=Ol.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",La(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),eh=Xu;function th(e={}){return new dn({view:t=>new nh(t,e)})}class nh{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,d=this.editorView.dom.offsetParent;if(this.element||(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!d||d==document.body&&"static"==getComputedStyle(d).position)a=-pageXOffset,l=-pageYOffset;else{let e=d.getBoundingClientRect(),t=e.width/d.offsetWidth,n=e.height/d.offsetHeight;a=e.left-d.scrollLeft*t,l=e.top-d.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=St(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class rh extends Vt{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return rh.valid(n)?new rh(n):Vt.near(n)}content(){return Z.empty}eq(e){return e instanceof rh&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new rh(e.resolve(t.pos))}getBookmark(){return new oh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||ih(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||ih(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&rh.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(rh.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Jt.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(rh.valid(s))return s}return null}}}rh.prototype.visible=!1,rh.findFrom=rh.findGapCursorFrom,Vt.jsonID("gapcursor",rh);class oh{constructor(e){this.pos=e}map(e){return new oh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return rh.valid(t)?new rh(t):Vt.near(t)}}function ih(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const sh=ds({ArrowLeft:ah("horiz",-1),ArrowRight:ah("horiz",1),ArrowUp:ah("vert",-1),ArrowDown:ah("vert",1)});function ah(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Gt){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=rh.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new rh(l))),!0)}}function lh(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!rh.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Jt.isSelectable(e.state.doc.nodeAt(o.inside))||(e.dispatch(e.state.tr.setSelection(new rh(r))),0))}function dh(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof rh))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=W.empty;for(let e=r.length-1;e>=0;e--)o=W.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Z(o,0,0));return i.setSelection(Gt.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function ch(e){if(!(e.selection instanceof rh))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ki.create(e.doc,[xi.widget(e.selection.head,t,{key:"gapcursor"})])}var ph=200,uh=function(){};uh.prototype.append=function(e){return e.length?(e=uh.from(e),!this.length&&e||e.length<ph&&this.leafAppend(e)||this.length<ph&&e.leafPrepend(this)||this.appendInner(e)):this},uh.prototype.prepend=function(e){return e.length?uh.from(e).append(this):this},uh.prototype.appendInner=function(e){return new fh(this,e)},uh.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?uh.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},uh.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},uh.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},uh.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},uh.from=function(e){return e instanceof uh?e:e&&e.length?new hh(e):uh.empty};var hh=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=ph)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=ph)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(uh);uh.empty=new hh([]);var fh=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(uh);const mh=uh;class gh{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],d=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void d.push(e);if(n){d.push(new yh(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new yh(t,void 0,void 0,l.length+d.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new gh(this.items.slice(0,o).append(d.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,d=e.steps[n].invert(e.docs[n]),c=new yh(e.mapping.maps[n],d,t);(l=a&&a.merge(c))&&(c=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(c),t&&(i++,t=void 0),r||(a=c)}let l=i-n.depth;return l>xh&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new gh(s.append(o),i)}remapping(e,t){let n=new rt;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new gh(this.items.append(e.map(e=>new yh(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(o.slice(a+1,r));d&&s++,n.push(new yh(l,i,d))}else n.push(new yh(l))},r);let l=[];for(let e=t;e<i;e++)l.push(new yh(o.maps[e]));let d=this.items.slice(0,r).append(l).append(n),c=new gh(d,s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,d=new yh(s.invert(),e,a),c=r.length-1;(l=r.length&&r[c].merge(d))?r[c]=l:r.push(d)}}else i.map&&n--},this.items.length,0),new gh(mh.from(r.reverse()),o)}}gh.empty=new gh(mh.empty,0);class yh{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new yh(t.getMap().invert(),t,this.selection)}}}class bh{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const xh=20;function vh(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function wh(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let kh=!1,Ch=null;function Th(e){let t=e.plugins;if(Ch!=t){kh=!1,Ch=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){kh=!0;break}}return kh}const Nh=new un("history"),Sh=new un("closeHistory");function Mh(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new dn({key:Nh,state:{init:()=>new bh(gh.empty,gh.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Nh);if(i)return i.historyState;n.getMeta(Sh)&&(e=new bh(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Nh))return s.getMeta(Nh).redo?new bh(e.done.addTransform(n,void 0,r,Th(t)),e.undone,vh(n.mapping.maps),e.prevTime,e.prevComposition):new bh(e.done,e.undone.addTransform(n,void 0,r,Th(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new bh(e.done.rebased(n,o),e.undone.rebased(n,o),wh(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new bh(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),wh(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?wh(e.prevRanges,n.mapping):vh(n.mapping.maps);return new bh(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Th(t)),gh.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Oh:"historyRedo"==n?Ah:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function jh(e,t){return(n,r)=>{let o=Nh.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Th(t),o=Nh.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new bh(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Nh,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Oh=jh(!1,!0),Ah=jh(!0,!0);jh(!1,!1),jh(!0,!1),Dl.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new dn({key:new un("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;return e.deleteRange(s,a),!(this.storage.characters({node:e.doc})>n)}})]}});var Eh=Dl.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[th(this.options)]}}),Lh=(Dl.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new dn({key:new un("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return ki.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText)return o>=t&&o<=t+e.nodeSize-1&&void(s+=1)});let a=0;return e.descendants((e,t)=>!e.isText&&(o>=t&&o<=t+e.nodeSize-1&&(a+=1,"deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1?"deepest"===this.options.mode:void i.push(xi.node(t,t+e.nodeSize,{class:this.options.className}))))),ki.create(e,i)}}})]}}),Dl.create({name:"gapCursor",addProseMirrorPlugins:()=>[new dn({props:{decorations:ch,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&rh.valid(n)?new rh(n):null,handleClick:lh,handleKeyDown:sh,handleDOMEvents:{beforeinput:dh}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=ja(Ta(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}})),Ih="placeholder",Dh=Dl.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ih,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Ih}`;var t;return[new dn({key:new un("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Ja(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=xi.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),ki.create(t,i)}}})]}});function Rh({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Dl.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new dn({key:new un("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||Ya(n.selection)||e.view.dragging?null:ki.create(n.doc,[xi.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Ph=Dl.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new un(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new dn({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),d=i.content.size,c=a.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return s.insert(d,c.create())},state:{init:(e,t)=>!Rh({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>e.docChanged?e.getMeta("__uniqueIDTransaction")?t:!Rh({node:e.doc.lastChild,types:r}):t}})]}}),zh=Dl.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Oh(e,t),redo:()=>({state:e,dispatch:t})=>Ah(e,t)}),addProseMirrorPlugins(){return[Mh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bh=Dl.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(lc.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(rc.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Nu.configure(this.options.bulletList)),!1!==this.options.code&&o.push(pc.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(fc.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(mc.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Eh.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Lh.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(gc.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(yc.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(zh.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(bc.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Cc.configure(this.options.italic)),!1!==this.options.listItem&&o.push(Su.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(zu.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(vu.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Vu.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Ku.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(Qu.configure(this.options.strike)),!1!==this.options.text&&o.push(Zu.configure(this.options.text)),!1!==this.options.underline&&o.push(Xu.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Ph.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Fh=Dh;function qh({active:e,onClick:t,title:n,children:r}){return(0,c.jsx)("button",{type:"button",title:n,onClick:t,className:I("w-7 h-7 rounded flex items-center justify-center text-xs font-bold cursor-pointer transition-colors",e?"bg-[var(--accent-subtle)] text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-glass-hover)] hover:text-[var(--text-primary)]"),children:r})}function $h({value:e,onChange:t,placeholder:n,className:r}){const o=Jd({extensions:[Bh.configure({heading:!1,codeBlock:!1,blockquote:!1,horizontalRule:!1,listItem:!1,bulletList:!1,orderedList:!1}),eh,wu.configure({openOnClick:!1,HTMLAttributes:{style:"color: var(--accent); text-decoration: underline; cursor: pointer;"}}),Fh.configure({placeholder:n??"Enter HTML content..."})],content:e||"",onUpdate:({editor:e})=>{t(e.getHTML())},editorProps:{attributes:{class:"outline-none min-h-[60px] px-3.5 py-2.5 text-sm text-[var(--text-primary)] prose-sm max-w-none"}}});(0,p.useEffect)(()=>{o&&e!==o.getHTML()&&o.commands.setContent(e||"",{emitUpdate:!1})},[e,o]);const i=(0,p.useCallback)(()=>{if(!o)return;const e=o.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""===t?o.chain().focus().extendMarkRange("link").unsetLink().run():o.chain().focus().extendMarkRange("link").setLink({href:t}).run())},[o]);return o?(0,c.jsxs)("div",{className:I("rounded-lg border border-[var(--input-border)] bg-[var(--input-bg)] overflow-hidden transition-all focus-within:border-[var(--input-focus-border)] focus-within:shadow-[0_0_0_3px_var(--input-focus-glow)]",r),children:[(0,c.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1.5 border-b border-[var(--border-glass)]",children:[(0,c.jsx)(qh,{active:o.isActive("bold"),onClick:()=>o.chain().focus().toggleBold().run(),title:"Bold",children:"B"}),(0,c.jsx)(qh,{active:o.isActive("italic"),onClick:()=>o.chain().focus().toggleItalic().run(),title:"Italic",children:(0,c.jsx)("span",{className:"italic",children:"I"})}),(0,c.jsx)(qh,{active:o.isActive("underline"),onClick:()=>o.chain().focus().toggleUnderline().run(),title:"Underline",children:(0,c.jsx)("span",{className:"underline",children:"U"})}),(0,c.jsx)("div",{className:"w-px h-4 bg-[var(--border-glass)] mx-1"}),(0,c.jsx)(qh,{active:o.isActive("link"),onClick:i,title:"Link",children:(0,c.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,c.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,c.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]}),(0,c.jsx)(Vd,{editor:o})]}):null}function Hh({value:e,onChange:t,placeholder:n,className:r}){const[o,i]=(0,p.useState)(""),s=Array.isArray(e)?e:[],a=(0,p.useCallback)(e=>{const n=e.trim();n&&!s.includes(n)&&t([...s,n]),i("")},[s,t]),l=(0,p.useCallback)(e=>{t(s.filter((t,n)=>n!==e))},[s,t]),d=(0,p.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),a(o)):"Backspace"===e.key&&""===o&&s.length>0&&l(s.length-1)},[o,s,a,l]);return(0,c.jsxs)("div",{className:I("space-y-2",r),children:[(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,t)=>(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent)]/20",children:[e,(0,c.jsx)("button",{type:"button",onClick:()=>l(t),className:"ml-0.5 text-[var(--accent)]/60 hover:text-[var(--accent)] cursor-pointer transition-colors",children:(0,c.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},t))}),(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o,onChange:e=>i(e.target.value),onKeyDown:d,placeholder:0===s.length?n??"Type and press Enter to add":"Press Enter to add"})]})}const Vh=class{authHeaders;apiKey;privateApiKey;context;constructor(e){this.authHeaders=e.user.authHeaders,this.apiKey=e.user.apiKey,this.context=e;const t=e.user.organization?.value?.settings?.plugins?.get(h);this.privateApiKey=t?.get("privateApiKey")??""}async getBrandConfig(){return this.fetchContent({modelName:"gh-brand-config",limit:10,bustCache:!0})}async createBrandConfig(e){return this.context.createContent("gh-brand-config",{name:e,published:"draft",data:{}})}async saveBrandConfig(e,t){const n=await fetch(`https://builder.io/api/v1/write/gh-brand-config/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.privateApiKey}`},body:JSON.stringify({data:t})});if(!n.ok){const e=await n.text();throw new Error(`Failed to save brand config: ${n.status} ${e}`)}}async listAssets(){const e=await fetch("https://cdn.builder.io/api/v2/admin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.privateApiKey}`},body:JSON.stringify({query:"{ assets { id name url type } }"})});if(!e.ok){const t=await e.text();throw new Error(`Failed to fetch assets: ${e.status} ${t}`)}const t=await e.json();if(t.errors?.length)throw new Error(`GraphQL error: ${t.errors[0].message}`);return(t?.data?.assets??[]).filter(e=>e.type?.startsWith("image/")).map(e=>({id:e.id,name:e.name??e.id,url:e.url,type:e.type}))}async getModelEntries(e){return this.fetchContent({modelName:e,limit:100})}async fetchContent(e){const{modelName:t,limit:n=20,bustCache:r=!1}=e,o=[];let i=0,s=`https://cdn.builder.io/api/v3/content/${t}?apiKey=${this.apiKey}&includeUnpublished=true&omit=data.blocks&limit=${Math.min(n,100)}&locale=en-US`;r&&(s+="&cachebust=true"),console.info(`[Hippo Commerce] Fetching ${t}`);const a=await fetch(s,{headers:this.authHeaders}),l=await a.json(),d=Array.isArray(l)?l:l?.results??[];o.push(...d);let c=d.length;for(;o.length<n&&c>0;){i=o.length;const e=await fetch(`${s}&offset=${i}`,{headers:this.authHeaders}),t=await e.json(),n=Array.isArray(t)?t:t?.results??[];o.push(...n),c=n.length}return console.info(`[Hippo Commerce] Fetched ${o.length} ${t} entries`),o}},Uh=[{key:"brandLogoSmall",label:"Logo (Small)"},{key:"brandLogoLarge",label:"Logo (Large)"},{key:"brandLogoFooter",label:"Logo (Footer)"},{key:"bbbImage",label:"BBB Image"},{key:"accesibilityLogo",label:"Accessibility Logo"},{key:"brandLogoOffWhite",label:"Logo (Off-White)"},{key:"defaultPetProfileImage",label:"Default Pet Profile Image"},{key:"defaultCatProfileImage",label:"Default Cat Profile Image"},{key:"defaultDogProfileImage",label:"Default Dog Profile Image"},{key:"linklessPageHeaderLogo",label:"Linkless Header Image"}],_h=[{key:"termsLink",label:"Terms of Service Link"},{key:"subscriptionTermsLink",label:"Subscription Terms of Service Link"},{key:"privacyLink",label:"Privacy Policy Link"},{key:"ccpaLink",label:"CCPA Link"},{key:"bbbLink",label:"BBB Link"},{key:"accessibiltyLink",label:"Accessibility Link"}],Wh=[{key:"twitter",label:"Twitter / X"},{key:"facebook",label:"Facebook"},{key:"youtube",label:"YouTube"},{key:"instagram",label:"Instagram"},{key:"pinterest",label:"Pinterest"},{key:"tiktok",label:"TikTok"}],Gh=(0,u.observer)(({data:e,onChangeRoot:t,markDirty:n,api:r})=>{const[o,i]=(0,p.useState)([]),[s,a]=(0,p.useState)(!0);(0,p.useEffect)(()=>{r.getModelEntries("banner").then(e=>i(e)).catch(e=>console.error("[Hippo Commerce] Failed to fetch banner entries:",e)).finally(()=>a(!1))},[r]);const l=(0,p.useCallback)(()=>r.listAssets(),[r]),d=e.images||{},u=e.links||{},h=u.socialMedia||{};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(R,{title:"Brand Display Name",children:(0,c.jsx)(z,{label:"Brand Display Name",helper:"The brand name displayed across the website",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.brandDisplayName??"",onChange:e=>t("brandDisplayName",e.target.value)})})}),(0,c.jsx)(R,{title:"Brand Images",subtitle:"Logo and brand images used throughout the website",children:(0,c.jsx)("div",{className:"flex flex-wrap gap-5",children:Uh.map(({key:t,label:r})=>(0,c.jsx)(F,{label:r,value:"string"==typeof d[t]?d[t]:void 0,onChange:r=>((t,r)=>{e.images||(e.images={}),e.images[t]=r,n()})(t,r??""),fetchAssets:l},t))})}),(0,c.jsx)(R,{title:"General Links",subtitle:"Links to legal pages and external profiles",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-5",children:_h.map(({key:t,label:r})=>(0,c.jsx)(z,{label:r,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:u[t]??"",onChange:r=>((t,r)=>{e.links||(e.links={}),e.links[t]=r,n()})(t,r.target.value)})},t))}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Social Media"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-5",children:Wh.map(({key:t,label:r})=>(0,c.jsx)(z,{label:r,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:h[t]??"",onChange:r=>((t,r)=>{e.links||(e.links={}),e.links.socialMedia||(e.links.socialMedia={}),e.links.socialMedia[t]=r,n()})(t,r.target.value)})},t))})]})}),(0,c.jsx)(R,{title:"Banners",subtitle:"Sitewide banners displayed above page-specific announcements",children:s?(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)]",children:"Loading..."}):(0,c.jsxs)("div",{className:"space-y-4",children:[(e.banners??[]).map((t,r)=>{const i=t.banner?.value?.id??t.banner?.id??"";return(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(z,{label:"Banner",children:(0,c.jsxs)("select",{className:"hippo-input",value:i,onChange:e=>{const r=o.find(t=>t.id===e.target.value);t.banner=r?{"@type":"@builder.io/core:Reference",model:"banner",id:r.id}:void 0,n()},children:[(0,c.jsx)("option",{value:"",children:"Select a banner..."}),o.map(e=>(0,c.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Always Show?"}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:!!t.alwaysShow,onChange:e=>{t.alwaysShow=e.target.checked,n()}})]}),(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.banners.splice(r,1),n()},children:"Remove"})})]},r)}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.banners||(e.banners=[]),e.banners.push({banner:void 0,alwaysShow:!1}),n()},children:"Add Banner"})]})})]})});var Kh,Jh,Yh,Qh;!function(e){e.BASIC="BASIC",e.MEDIUM="MEDIUM",e.MEGA="MEGA",e.LINKLESS="LINKLESS",e.NONE="NONE",e.DMP="DMP",e.CMS="CMS"}(Kh||(Kh={})),function(e){e.PRIMARY="primary",e.SECONDARY="secondary",e.OUTLINE="outline",e.LINK="link"}(Jh||(Jh={})),function(e){e.SEARCH="search",e.LINKS="links",e.ACCOUNT_LINKS="accountLinks",e.HTML="html",e.TIMED_HTML="timedHtml"}(Yh||(Yh={})),function(e){e.LINKS="links",e.LOGO="logo",e.ACCOUNT_LINKS="accountLinks",e.CART_COUNT="cartCount",e.HTML="html"}(Qh||(Qh={}));const Zh={basic:{name:"basicHeaderConfig",showIf:"return options.get('headerType') === 'BASIC'",friendlyName:"Basic Menu Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"logoImage",friendlyName:"Logo Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header"},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile dropdown menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!0,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!0,defaultCollapsed:!0},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"desktopLinks",friendlyName:"Desktop Links",helperText:"Links to display in the desktop menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!0,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"ctas",friendlyName:"Call To Action",helperText:"Call to action button(s) to display",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"type",friendlyName:"CTA Type",helperText:"Select the type of CTA to display",type:"select",localized:!1,defaultCollapsed:!0,required:!0,defaultValue:"primary",enum:[Jh.PRIMARY,Jh.SECONDARY,Jh.OUTLINE,Jh.LINK]},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0},{name:"hideOnMobile",friendlyName:"Hide on Mobile",helperText:"Set to true to disable this CTA on mobile devices",type:"boolean",localized:!1,defaultCollapsed:!0}]},{name:"myAccountGuest",friendlyName:"MyAccount Menu Links - Guest",helperText:"Links to show under the My Account menu when the user is logged out.",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"icon",friendlyName:"Icon",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,defaultCollapsed:!0,helperText:"Link icon"},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"myAccountAuthorized",friendlyName:"MyAccount Menu Links - Logged In",helperText:"Links to show under the My Account menu when the user is logged in.",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"icon",friendlyName:"Icon",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,defaultCollapsed:!0,helperText:"Link icon"},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"stickyHeader",type:"object",friendlyName:"Sticky Header Configuration",defaultCollapsed:!0,localized:!1,subFields:[{name:"enabled",type:"boolean",friendlyName:"Enabled?",defaultCollapsed:!0,localized:!1},{name:"backgroundColor",type:"color",friendlyName:"Background Color",defaultCollapsed:!0,localized:!1,helperText:"The header background color at the top of the page. Leave blank for a transparent header"},{name:"scrollBackgroundColor",type:"color",friendlyName:"Background Color - Scroll",defaultCollapsed:!0,localized:!1,helperText:"The header background color while scrolling. Leave blank for a transparent header",defaultValue:"#FFFFFF"},{name:"scrollLogo",friendlyName:"Scroll Logo",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header while scrolling. Leave blank to use the default header logo"}]},{name:"showLocaleSelection",type:"boolean",friendlyName:"Show Locale Selection?",defaultCollapsed:!0,localized:!1,helperText:"Show Locale Selection"}]},medium:{"@type":"@builder.io/core:Field",name:"mediumHeaderConfig",friendlyName:"Medium Header Configuration",type:"object",showIf:"return options.get('headerType') === 'MEDIUM'",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"wrapperID",friendlyName:"Wrapper ID",helperText:"ID for the medium header wrapper",type:"text",localized:!1,defaultValue:"header",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the medium header wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"showShippingMessage",friendlyName:"Show Shipping Message",helperText:"Display the free shipping message on the mega menu",type:"boolean",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"mobileMenu",friendlyName:"Mobile Menu",helperText:"Mobile menu configuration for the medium header",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"logo",friendlyName:"Logo",helperText:"Logo for the mobile header",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"logoClasses",friendlyName:"Logo Classes",helperText:"CSS classes for the mobile logo",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"navClasses",friendlyName:"Navigation Classes",helperText:"CSS classes for the mobile navigation",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropDownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,required:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropDownContent",friendlyName:"Dropdown Content",helperText:"Content to display in the dropdown",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"type",friendlyName:"Dropdown Type",helperText:"Select the type of dropdown content",type:"select",enum:[Yh.SEARCH,Yh.LINKS,Yh.ACCOUNT_LINKS,Yh.HTML,Yh.TIMED_HTML],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for this dropdown",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"itemClasses",friendlyName:"Item Classes",helperText:"CSS classes for the link item",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedInOnly",friendlyName:"Logged In Only",helperText:"Display this link only when the user is logged in",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedOutOnly",friendlyName:"Logged Out Only",helperText:"Display this link only when the user is logged out",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Title",helperText:"Title for the link",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinksWrapperClasses",friendlyName:"Sub Links Wrapper Classes",helperText:"CSS classes for the sub-links wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinks",friendlyName:"Sub Links",helperText:"Sub-links for this dropdown item",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"htmlContent",friendlyName:"HTML Content",helperText:"HTML content to display in the dropdown",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"inputs",friendlyName:"Inputs",helperText:"Inputs for the dropdown content",type:"object",localized:!1,required:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"defaultHtml",friendlyName:"Default HTML",helperText:"Default HTML content that will be displayed",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"temporaryHtml",friendlyName:"Temporary HTML",helperText:"Temporary HTML content that will be displayed for a limited time",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"startTime",friendlyName:"Start Time",helperText:"Start time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"endTime",friendlyName:"End Time",helperText:"End time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0}]}]}]},{"@type":"@builder.io/core:Field",name:"desktopMenu",friendlyName:"Desktop Menu",helperText:"Desktop menu configuration for the medium header",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"logo",friendlyName:"Logo",helperText:"Logo for the desktop header",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"navClasses",friendlyName:"Navigation Classes",helperText:"CSS classes for the desktop navigation",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Content",helperText:"Content to display in the desktop header",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"type",friendlyName:"Content Type",helperText:"Select the type of content",type:"select",enum:[Qh.LINKS,Qh.LOGO,Qh.ACCOUNT_LINKS,Qh.CART_COUNT,Qh.HTML],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the desktop header",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Text",helperText:"Text for the link",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedInOnly",friendlyName:"Logged In Only",helperText:"Display this link only when the user is logged in",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedOutOnly",friendlyName:"Logged Out Only",helperText:"Display this link only when the user is logged out",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownItemClasses",friendlyName:"Dropdown Item Classes",helperText:"CSS classes for the dropdown item",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinks",friendlyName:"Sub Links",helperText:"Sub-links for this header item",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"columnHeaderTitle",friendlyName:"Column Header Title",helperText:"Title for the column header",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"columnContentType",friendlyName:"Column Content Type",helperText:"Select the type of content for the column",type:"select",enum:["links","html","timedHtml"],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the column",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Text",helperText:"Text for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Content",helperText:"Content for the column",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"inputs",friendlyName:"Inputs",helperText:"Inputs for the dropdown content",type:"object",localized:!1,required:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"defaultHtml",friendlyName:"Default HTML",helperText:"Default HTML content that will be displayed",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"temporaryHtml",friendlyName:"Temporary HTML",helperText:"Temporary HTML content that will be displayed for a limited time",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"startTime",friendlyName:"Start Time",helperText:"Start time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"endTime",friendlyName:"End Time",helperText:"End time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0}]}]}]},{"@type":"@builder.io/core:Field",name:"accountLinksConfig",friendlyName:"Account Links Config",helperText:"",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"dropdownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownItemClasses",friendlyName:"Dropdown Item Classes",helperText:"CSS classes for the dropdown item",type:"text",localized:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"htmlContent",friendlyName:"HTML Content",helperText:"HTML content to display in the header",type:"html",localized:!1,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"bannersAboveHeader",friendlyName:"Banners Above Header",helperText:"Banners to display above the header",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the banner wrapper",type:"text",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Banner Content",helperText:"Content to display in the banner",type:"html",localized:!0,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"contactUrl",friendlyName:"Contact URL",helperText:"URL for the contact page",type:"url",localized:!0,defaultCollapsed:!0}]},mega:{"@type":"@builder.io/core:Field",name:"megaMenuConfig",showIf:"return options.get('headerType') === 'MEGA'",friendlyName:"Mega Menu Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"showShippingMessage",friendlyName:"Show Shipping Message",helperText:"Display the free shipping message on the mega menu",type:"boolean",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile mega menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"expanded",friendlyName:"Expanded",helperText:"Indicates if the mobile link is expanded by default",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Sub-Links",helperText:"Sub-links for the mobile link",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"desktopShopNavLinks",friendlyName:"Desktop Shop Navigation Links",helperText:"Links to display in the desktop shop navigation",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,required:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the desktop navigation",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"shopAllLink",friendlyName:"Shop All Link",helperText:'Link to the "Shop All" page',type:"object",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]}]}]},dmp:{"@type":"@builder.io/core:Field",name:"dmpHeaderConfig",showIf:"return options.get('headerType') === 'DMP'",friendlyName:"DMP Header Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"logoImage",friendlyName:"Logo Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header"},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile dropdown menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"desktopLinks",friendlyName:"Desktop Links",helperText:"Links to display in the desktop menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0}]}]},cms:{"@type":"@builder.io/core:Field",name:"cmsHeaderConfig",showIf:"return options.get('headerType') === 'CMS'",friendlyName:"CMS Header Config",helperText:"Reference a header created in Builder CMS to use as the website header.",type:"reference",model:"header",copyOnAdd:!1,localized:!1,required:!0,defaultCollapsed:!0}};var Xh,ef,tf;!function(e){e.BASIC="BASIC",e.MEGA="MEGA",e.NONE="NONE",e.CMS="CMS"}(Xh||(Xh={})),function(e){e.DROPDOWN="Dropdown",e.STACKED_LIST="Stacked List",e.HORIZONTAL_LIST="Horizontal List"}(ef||(ef={})),function(e){e.P="/p",e.PRODUCT="/product"}(tf||(tf={}));const nf=e=>({name:"features",friendlyName:"Features",type:"object",defaultCollapsed:!0,helperText:"Enable or disable site-wide features and behaviors",subFields:[{name:"productGridFilterType",friendlyName:"Product Grid Filter Type",type:"select",defaultCollapsed:!0,helperText:"Select the type of filters to use. 'Dropdown' will display a drop down of categories, ingredients, use cases, and tags. \n 'Stacked List' allows you to create your own filter groupings from amongst those four filter types.\n 'Horizontal List' displays Product Categories only horizontally; click to filter on page or navigate option available.",enum:[ef.DROPDOWN,ef.STACKED_LIST,ef.HORIZONTAL_LIST],defaultValue:"Dropdown"},{name:"productGridFilterGroups",friendlyName:"Product Grid Filter Groups",type:"list",defaultCollapsed:!0,helperText:"Select the filter groups to use. They will be presented in the order entered",subFields:[{name:"filterConfig",friendlyName:"Product Grid Filter",type:"reference",defaultCollapsed:!0,modelId:e,helperText:"Select a product grid filter group to display",copyOnAdd:!1}]},{name:"productGridHideRestricted",friendlyName:"Hide Restricted Products",helperText:"Hide restricted products from your product grid based on the user's selected country",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"productLinkPrefix",friendlyName:"Product Link Prefix",helperText:'Set the prefix to append before product slugs throughout your site. For example, if you enter "p", all links from the product grid will be {website}/p/{product-slug}',type:"select",enum:[tf.P,tf.PRODUCT],localized:!1,defaultCollapsed:!0,defaultValue:"/p"},{name:"subscriptionAddOnsEnabled",friendlyName:"Subscription Add-Ons Enabled",helperText:"Enable or disable subscription add-ons for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"shippingThresholdNotificationEnabled",friendlyName:"Shipping Threshold Notification Enabled",helperText:"Enable or disable shipping threshold notifications for the brand",type:"boolean",localized:!0,defaultCollapsed:!0},{name:"bundlingEnabled",friendlyName:"Enable Bundling Experience",helperText:"Enable or disable the bundling experience for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cartDrawerEnabled",friendlyName:"Enable Cart Drawer",helperText:"Enable or disable the cart drawer experience for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"subscriptionExperience",friendlyName:"Subscription Experience",type:"select",enum:["Classic","Version 2"],defaultValue:"Classic",defaultCollapsed:!1,helperText:"Select the subscription management experience for customers"},{name:"useDefaultFrequencies",friendlyName:"Use Default Frequencies",type:"boolean",helperText:"When enabled, the selected frequency on an Offer Selector is calculated based on the product and quantity selected.",defaultCollapsed:!1},{name:"recommendationConfig",friendlyName:"Recommendation Config",type:"reference",model:"recommendation-config",localized:!1,defaultCollapsed:!1,copyOnAdd:!1,helperText:"Select the global recommendation config used to generate product recommendations site-wide."},{name:"dynamicBrowserTab",friendlyName:"Dynamic Browser Tab",type:"object",defaultCollapsed:!0,helperText:"When enabled, the browser tab title blinks to a custom message after the user switches away from the tab.",subFields:[{name:"enabled",friendlyName:"Enabled",type:"boolean",required:!1,localized:!1,defaultCollapsed:!0,helperText:"Turn the dynamic browser tab on or off."},{name:"awayTitle",friendlyName:"Away Title",type:"text",required:!0,localized:!0,defaultCollapsed:!0,helperText:"Tab title that blinks when the user switches away from the tab. Emoji go inline here."},{name:"defaultTitle",friendlyName:"Default Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Optional. Overrides the page title on load."}]}]});var rf,of;!function(e){e.DoNotLike="DoNotLike",e.NotWorking="NotWorking",e.NoBenefits="NoBenefits",e.NoFitNoNeed="NoFitNoNeed",e.Budget="Budget",e.Mistake="Mistake",e.Try="Try",e.TooMuch="TooMuch",e.TravelMove="TravelMove",e.DoNotNeed="DoNotNeed",e.AnotherReason="AnotherReason",e.NotHelpingSkin="NotHelpingSkin",e.SkinImproved="SkinImproved",e.PetDoesNotLike="PetDoesNotLike",e.NotHelpingPet="NotHelpingPet",e.NoneGiven="NoneGiven"}(rf||(rf={})),function(e){e.Link="link",e.Update="update",e.Keep="keep",e.Continue="continue",e.Cancel="cancel"}(of||(of={}));const sf=e=>[{name:"brandDisplayName",friendlyName:"Brand Display Name",type:"text",defaultCollapsed:!0,localized:!1,required:!0,helperText:"The brand name displayed across the website"},{name:"images",friendlyName:"Brand Images",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Logo and brand images used throughout the website",subFields:[{name:"brandLogoSmall",friendlyName:"Logo (Small)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Small logo for the brand",defaultCollapsed:!0},{name:"brandLogoLarge",friendlyName:"Logo (Large)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Large logo for the brand",defaultCollapsed:!0},{name:"brandLogoFooter",friendlyName:"Logo (Footer)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Footer logo for the brand",defaultCollapsed:!0},{name:"bbbImage",friendlyName:"BBB Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"BBB logo for the brand",defaultCollapsed:!0},{name:"accesibilityLogo",friendlyName:"Accessibility Logo",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Accessibility logo for the brand",defaultCollapsed:!0},{name:"brandLogoOffWhite",friendlyName:"Logo (Off-White)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Off white logo for the brand",defaultCollapsed:!0},{name:"defaultPetProfileImage",friendlyName:"Default Pet Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for pet profiles",defaultCollapsed:!0},{name:"defaultCatProfileImage",friendlyName:"Default Cat Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for cat profiles",defaultCollapsed:!0},{name:"defaultDogProfileImage",friendlyName:"Default Dog Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for dog profiles",defaultCollapsed:!0},{name:"linklessPageHeaderLogo",friendlyName:"Linkless Header Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Logo Image for the linkless header",defaultCollapsed:!0}]},{name:"links",friendlyName:"General Links",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Links to legal pages and external profiles",subFields:[{name:"termsLink",friendlyName:"Terms of Service Link",type:"url",localized:!1,helperText:"Link to the terms of service page",defaultCollapsed:!0},{name:"subscriptionTermsLink",friendlyName:"Subscription Terms of Service Link",type:"url",localized:!1,helperText:"Link to the subscription terms of service page",defaultCollapsed:!0},{name:"privacyLink",friendlyName:"Privacy Policy Link",type:"url",localized:!1,helperText:"Link to the privacy policy page",defaultCollapsed:!0},{name:"ccpaLink",friendlyName:"CCPA Link",type:"url",localized:!1,helperText:"Link to the CCPA page",defaultCollapsed:!0},{name:"bbbLink",friendlyName:"BBB Link",type:"url",localized:!1,helperText:"Link to the Better Business Bureau page",defaultCollapsed:!0},{name:"accessibiltyLink",friendlyName:"Accessibility Link",type:"url",localized:!1,helperText:"Link to the accessibility page",defaultCollapsed:!0},{name:"socialMedia",friendlyName:"Social Media Links",type:"object",localized:!1,helperText:"Links to the brand's social media profiles",defaultCollapsed:!0,subFields:[{name:"twitter",friendlyName:"Twitter / X",type:"url",localized:!1,helperText:"Link to the brand's Twitter/X profile",defaultCollapsed:!0},{name:"facebook",friendlyName:"Facebook",type:"url",localized:!1,helperText:"Link to the brand's Facebook page",defaultCollapsed:!0},{name:"youtube",friendlyName:"YouTube",type:"url",localized:!1,helperText:"Link to the brand's YouTube channel",defaultCollapsed:!0},{name:"instagram",friendlyName:"Instagram",type:"url",localized:!1,helperText:"Link to the brand's Instagram profile",defaultCollapsed:!0},{name:"pinterest",friendlyName:"Pinterest",type:"url",localized:!1,helperText:"Link to the brand's Pinterest profile",defaultCollapsed:!0},{name:"tiktok",friendlyName:"TikTok",type:"url",localized:!1,helperText:"Link to the brand's TikTok profile",defaultCollapsed:!0}]}]},{name:"banners",friendlyName:"Banners",helperText:"Select the banner(s) to display site-wide. These will be displayed in the\n order provided, and always above page-specific announcements",type:"list",defaultCollapsed:!0,localized:!1,subFields:[{name:"banner",friendlyName:"Sitewide Banner",type:"reference",localized:!1,helperText:"Select the banner to display.",defaultCollapsed:!0,modelId:e,copyOnAdd:!1},{name:"alwaysShow",friendlyName:"Always Show?",type:"boolean",localized:!1,helperText:'By default, we hide sitewide banners on the classic "cart" pages. Use this setting to bypass those restrictions',defaultCollapsed:!0}]}],af={name:"blog-comment",displayName:"Blog Comment",kind:"data",helperText:"Comments on your website's blogs",contentTitleField:void 0,fields:[{name:"name",friendlyName:"Name",helperText:"Name of the user who submitted this comment",type:"text",defaultCollapsed:!1,localized:!1,required:!0},{name:"date",friendlyName:"Date",helperText:"Date this comment was submitted",type:"timestamp",defaultCollapsed:!1,localized:!1,required:!0},{name:"status",friendlyName:"Status",helperText:"Select the status of this comment. Only Approved comments will be displayed",type:"select",enum:["Pending Approval","Approved","Rejected"],defaultValue:"Pending Approval",defaultCollapsed:!1,localized:!1,required:!0},{type:"text",name:"email",friendlyName:"Email",required:!1,defaultCollapsed:!1,helperText:"Email address of the commenter"},{type:"html",name:"comment",friendlyName:"Comment",helperText:"HTML content of the comment",required:!0,defaultCollapsed:!1},{name:"language",friendlyName:"Language",helperText:"The language code of this comment. Legacy comments are synced as 'en'",type:"select",enum:["en"],defaultCollapsed:!0,localized:!1,defaultValue:"en",required:!0},{name:"locale",friendlyName:"Locale",helperText:"The country code of this comment. Legacy comments are synced as 'US'",type:"select",enum:["US"],defaultValue:"US",defaultCollapsed:!0,localized:!1,required:!0},{name:"parentId",friendlyName:"Parent Comment Id",helperText:"If this comment is a reply, this is the Id of the parent",type:"text",required:!1,defaultCollapsed:!0},{name:"internal",friendlyName:"Brand Response",helperText:"Indicates that this is a comment provided by the brand (i.e. a response)",type:"boolean",defaultCollapsed:!1,required:!1}],hideFromUI:!0};var lf,df,cf,pf,uf,hf,ff,mf,gf,yf,bf,xf;!function(e){e.FlavorOptionGroup="Flavor/Option Group",e.TrialGroup="Trial Group"}(lf||(lf={})),function(e){e.Age="Age",e.Gender="Gender",e.Weight="Weight",e.Type="Type",e.Breed="Breed",e.HealthConditions="Health Conditions"}(df||(df={})),function(e){e.Tag="Tag",e.Ingredient="Ingredient",e.Category="Category",e.UseCase="UseCase"}(cf||(cf={})),function(e){e.Exclusive="exclusive",e.Preferred="preferred",e.Required="required"}(pf||(pf={})),function(e){e.Inclusive="Inclusive",e.Exclusive="Exclusive"}(uf||(uf={})),function(e){e.AboveHeader="Above Header",e.BelowHeader="Below Header"}(hf||(hf={})),function(e){e.GENERAL="General",e.PRODUCT="Product",e.BLOG="Blog"}(ff||(ff={})),function(e){e.PRODUCT="Product",e.PRODUCT_GROUP="Product Group",e.MULTI_GROUP="Multi-Group"}(mf||(mf={})),function(e){e.VERTICAL="Vertical",e.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE="Vertical - Flavor Dropdown - Type Toggle",e.STACKED__FLAVOR_BUTTONS__QUANTITY_TOGGLE="Stacked - Flavor Buttons - Quantity Toggle",e.BUNDLE_GROUP="Bundle Group",e.VERTICAL_FLAVOR_BUTTONS_TOGGLE="Vertical - Flavor Buttons - Type Toggle"}(gf||(gf={})),function(e){e.SLIDER_A="Slider A",e.SLIDER_B="Slider B",e.SLIDER_ZOOM="Slider Zoom"}(yf||(yf={})),function(e){e.ONE_TIME="One-Time Purchase",e.SUBSCRIPTION="Subscription"}(bf||(bf={})),function(e){e.PERCENT="percentage",e.DOLLAR="dollar"}(xf||(xf={}));const vf=({text:e})=>(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:e}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),wf=({label:e,onClick:t})=>(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:t,children:e}),kf=({onClick:e})=>(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:e,children:"Remove"}),Cf=({title:e,index:t,onRemove:n})=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:[e," #",t+1]}),(0,c.jsx)(kf,{onClick:n})]}),Tf=({title:e,defaultOpen:t=!1,children:n})=>{const[r,o]=(0,p.useState)(t);return(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden",children:[(0,c.jsxs)("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>o(!r),children:[(0,c.jsx)("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:e}),(0,c.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-[var(--text-muted)] transition-transform "+(r?"rotate-180":""),children:(0,c.jsx)("path",{d:"M6 9l6 6 6-6"})})]}),r&&(0,c.jsx)("div",{className:"px-4 pb-4 space-y-4 border-t border-[var(--border-glass)]",children:n})]})},Nf=({label:e,helper:t,checked:n,onChange:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:t})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:n,onChange:e=>r(e.target.checked)})]}),Sf=({label:e,helper:t,value:n,onChange:r})=>(0,c.jsx)(z,{label:e,helper:t,children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0",value:n||"#FFFFFF",onChange:e=>r(e.target.value)}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n??"",placeholder:"#FFFFFF",onChange:e=>r(e.target.value)})]})}),Mf=({label:e,helper:t,value:n,onChange:r})=>(0,c.jsx)(z,{label:e,helper:t??"CSS classes",children:(0,c.jsx)(Hh,{value:n||[],onChange:r,placeholder:"Type a class and press Enter"})}),jf=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,r()}}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,r()}})]})]})),Of=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]}),(0,c.jsx)(z,{label:"Icon URL",helper:"URL to an icon image for this link",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.icon??"",onChange:t=>{e.icon=t.target.value,r()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,r()}}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,r()}})]})]})),Af=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"CTA",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,n()}})})]}),(0,c.jsx)(z,{label:"CTA Type",required:!0,children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Jh.PRIMARY,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Jh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,n()}}),(0,c.jsx)(Nf,{label:"Hide on Mobile",helper:"Disable this CTA on mobile devices",checked:!!e.hideOnMobile,onChange:t=>{e.hideOnMobile=t,n()}})]}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,n()}})]})),Ef=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.basicHeaderConfig||(e.header.basicHeaderConfig={}),e.header.basicHeaderConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]},i=()=>{const e=n();return e.stickyHeader||(e.stickyHeader={}),e.stickyHeader};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(F,{label:"Logo Image",value:"string"==typeof r.logoImage?r.logoImage:void 0,onChange:e=>{n().logoImage=e??"",t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(jf,{item:e,index:n,label:"Mobile Link",onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopLinks||[]).map((e,n)=>(0,c.jsx)(jf,{item:e,index:n,label:"Desktop Link",onChange:t,onRemove:()=>{o("desktopLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Desktop Link",onClick:()=>{o("desktopLinks").push({title:"",href:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Call To Action Buttons"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.ctas||[]).map((e,n)=>(0,c.jsx)(Af,{item:e,index:n,onChange:t,onRemove:()=>{o("ctas").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add CTA",onClick:()=>{o("ctas").push({title:"",href:"",type:Jh.PRIMARY,newTab:!1,cssClasses:[],hideOnMobile:!1}),t()}})]}),(0,c.jsx)(vf,{text:"MyAccount Links - Guest"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.myAccountGuest||[]).map((e,n)=>(0,c.jsx)(Of,{item:e,index:n,label:"Guest Link",onChange:t,onRemove:()=>{o("myAccountGuest").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Guest Link",onClick:()=>{o("myAccountGuest").push({title:"",href:"",icon:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"MyAccount Links - Logged In"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.myAccountAuthorized||[]).map((e,n)=>(0,c.jsx)(Of,{item:e,index:n,label:"Authorized Link",onChange:t,onRemove:()=>{o("myAccountAuthorized").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Authorized Link",onClick:()=>{o("myAccountAuthorized").push({title:"",href:"",icon:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Sticky Header"}),(0,c.jsxs)(Tf,{title:"Sticky Header Configuration",children:[(0,c.jsx)(Nf,{label:"Enabled",helper:"Enable sticky header behavior on scroll",checked:!!i().enabled,onChange:e=>{i().enabled=e,t()}}),(0,c.jsx)(Sf,{label:"Background Color",helper:"Header background color at the top of the page. Leave blank for transparent.",value:i().backgroundColor??"",onChange:e=>{i().backgroundColor=e,t()}}),(0,c.jsx)(Sf,{label:"Scroll Background Color",helper:"Header background color while scrolling. Leave blank for transparent.",value:i().scrollBackgroundColor??"#FFFFFF",onChange:e=>{i().scrollBackgroundColor=e,t()}}),(0,c.jsx)(F,{label:"Scroll Logo",value:"string"==typeof i().scrollLogo?i().scrollLogo:void 0,onChange:e=>{i().scrollLogo=e??"",t()}})]}),(0,c.jsx)(vf,{text:"Locale"}),(0,c.jsx)(Nf,{label:"Show Locale Selection",helper:"Display locale selection in the header",checked:!!r.showLocaleSelection,onChange:e=>{n().showLocaleSelection=e,t()}})]})}),Lf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Link Text (HTML)",children:(0,c.jsx)($h,{value:e.text??"",onChange:t=>{e.text=t,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}})})]}),(0,c.jsx)(z,{label:"Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.itemClasses??"",onChange:t=>{e.itemClasses=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Logged In Only",checked:!!e.loggedInOnly,onChange:t=>{e.loggedInOnly=t,n()}}),(0,c.jsx)(Nf,{label:"Logged Out Only",checked:!!e.loggedOutOnly,onChange:t=>{e.loggedOutOnly=t,n()}})]}),(0,c.jsx)(z,{label:"Sub Links Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.subLinksWrapperClasses??"",onChange:t=>{e.subLinksWrapperClasses=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links"}),(e.subLinks||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Text",value:t.text??"",onChange:e=>{t.text=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.URL??"",onChange:e=>{t.URL=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.subLinks.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Sub-Link",onClick:()=>{e.subLinks||(e.subLinks=[]),e.subLinks.push({text:"",URL:""}),n()}})]})]})),If=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Dropdown Item",index:t,onRemove:r}),(0,c.jsx)(z,{label:"Dropdown Type",children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Yh.LINKS,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Yh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(e.type===Yh.HTML||e.type===Yh.TIMED_HTML)&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:e.htmlContent??"",onChange:t=>{e.htmlContent=t,n()}})}),e.type===Yh.TIMED_HTML&&(0,c.jsxs)(Tf,{title:"Timed HTML Inputs",children:[(0,c.jsx)(z,{label:"Default HTML",children:(0,c.jsx)($h,{value:e.inputs?.defaultHtml??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.defaultHtml=t,n()}})}),(0,c.jsx)(z,{label:"Temporary HTML",children:(0,c.jsx)($h,{value:e.inputs?.temporaryHtml??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.temporaryHtml=t,n()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Start Time",children:(0,c.jsx)("input",{type:"datetime-local",className:"hippo-input",value:e.inputs?.startTime??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.startTime=t.target.value,n()}})}),(0,c.jsx)(z,{label:"End Time",children:(0,c.jsx)("input",{type:"datetime-local",className:"hippo-input",value:e.inputs?.endTime??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.endTime=t.target.value,n()}})})]})]}),(e.type===Yh.LINKS||e.type===Yh.ACCOUNT_LINKS)&&(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsx)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsx)(Lf,{item:t,index:r,onChange:n,onRemove:()=>{e.links.splice(r,1),n()}},r)),(0,c.jsx)(wf,{label:"+ Add Link",onClick:()=>{e.links||(e.links=[]),e.links.push({text:"",URL:""}),n()}})]})]})),Df=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Link Text (HTML)",children:(0,c.jsx)($h,{value:e.text??"",onChange:t=>{e.text=t,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Logged In Only",checked:!!e.loggedInOnly,onChange:t=>{e.loggedInOnly=t,n()}}),(0,c.jsx)(Nf,{label:"Logged Out Only",checked:!!e.loggedOutOnly,onChange:t=>{e.loggedOutOnly=t,n()}})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.dropdownWrapperClasses??"",onChange:t=>{e.dropdownWrapperClasses=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Dropdown Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.dropdownItemClasses??"",onChange:t=>{e.dropdownItemClasses=t.target.value,n()}})})]}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-3 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links / Columns"}),(e.subLinks||[]).map((t,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-3 space-y-2",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-[11px] font-semibold text-[var(--text-secondary)]",children:["Column #",r+1]}),(0,c.jsx)(kf,{onClick:()=>{e.subLinks.splice(r,1),n()}})]}),(0,c.jsx)(z,{label:"Column Header",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:t.columnHeaderTitle??"",onChange:e=>{t.columnHeaderTitle=e.target.value,n()}})}),(0,c.jsx)(z,{label:"Content Type",children:(0,c.jsxs)("select",{className:"hippo-input",value:t.columnContentType??"links",onChange:e=>{t.columnContentType=e.target.value,n()},children:[(0,c.jsx)("option",{value:"links",children:"links"}),(0,c.jsx)("option",{value:"html",children:"html"}),(0,c.jsx)("option",{value:"timedHtml",children:"timedHtml"})]})}),"links"===t.columnContentType&&(0,c.jsxs)("div",{className:"space-y-1",children:[(t.links||[]).map((e,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Text",value:e.text??"",onChange:t=>{e.text=t.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{t.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Link",onClick:()=>{t.links||(t.links=[]),t.links.push({text:"",URL:""}),n()}})]}),"html"===t.columnContentType&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:t.content??"",onChange:e=>{t.content=e,n()}})}),"timedHtml"===t.columnContentType&&(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(z,{label:"Default HTML",children:(0,c.jsx)($h,{value:t.inputs?.defaultHtml??"",onChange:e=>{t.inputs||(t.inputs={}),t.inputs.defaultHtml=e,n()}})}),(0,c.jsx)(z,{label:"Temporary HTML",children:(0,c.jsx)($h,{value:t.inputs?.temporaryHtml??"",onChange:e=>{t.inputs||(t.inputs={}),t.inputs.temporaryHtml=e,n()}})})]})]},r)),(0,c.jsx)(wf,{label:"+ Add Column",onClick:()=>{e.subLinks||(e.subLinks=[]),e.subLinks.push({columnHeaderTitle:"",columnContentType:"links",links:[]}),n()}})]})]})),Rf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Content Block",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Content Type",children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Qh.LINKS,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Qh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsx)(z,{label:"Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.wrapperClasses??"",onChange:t=>{e.wrapperClasses=t.target.value,n()}})})]}),e.type===Qh.HTML&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:e.htmlContent??"",onChange:t=>{e.htmlContent=t,n()}})}),e.type===Qh.ACCOUNT_LINKS&&(0,c.jsxs)(Tf,{title:"Account Links Config",children:[(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.accountLinksConfig?.dropdownWrapperClasses??"",onChange:t=>{e.accountLinksConfig||(e.accountLinksConfig={}),e.accountLinksConfig.dropdownWrapperClasses=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Dropdown Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.accountLinksConfig?.dropdownItemClasses??"",onChange:t=>{e.accountLinksConfig||(e.accountLinksConfig={}),e.accountLinksConfig.dropdownItemClasses=t.target.value,n()}})})]}),e.type===Qh.LINKS&&(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsx)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsx)(Df,{item:t,index:r,onChange:n,onRemove:()=>{e.links.splice(r,1),n()}},r)),(0,c.jsx)(wf,{label:"+ Add Link",onClick:()=>{e.links||(e.links=[]),e.links.push({text:"",URL:""}),n()}})]})]})),Pf=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.mediumHeaderConfig||(e.header.mediumHeaderConfig={}),e.header.mediumHeaderConfig),r=n(),o=()=>{const e=n();return e.mobileMenu||(e.mobileMenu={}),e.mobileMenu},i=()=>{const e=n();return e.desktopMenu||(e.desktopMenu={}),e.desktopMenu},s=(e,t)=>(Array.isArray(e[t])||(e[t]=[]),e[t]);return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Wrapper ID",helper:"ID for the medium header wrapper",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.wrapperID??"header",onChange:e=>{n().wrapperID=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Wrapper Classes",helper:"CSS classes for the medium header wrapper",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.wrapperClasses??"",onChange:e=>{n().wrapperClasses=e.target.value,t()}})})]}),(0,c.jsx)(Nf,{label:"Show Shipping Message",helper:"Display the free shipping message on the header",checked:!!r.showShippingMessage,onChange:e=>{n().showShippingMessage=e,t()}}),(0,c.jsx)(vf,{text:"Mobile Menu"}),(0,c.jsxs)(Tf,{title:"Mobile Menu Configuration",children:[(0,c.jsx)(F,{label:"Mobile Logo",value:"string"==typeof o().logo?o().logo:void 0,onChange:e=>{o().logo=e??"",t()}}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,c.jsx)(z,{label:"Logo Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().logoClasses??"",onChange:e=>{o().logoClasses=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Nav Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().navClasses??"",onChange:e=>{o().navClasses=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().dropDownWrapperClasses??"",onChange:e=>{o().dropDownWrapperClasses=e.target.value,t()}})})]}),(0,c.jsx)(vf,{text:"Dropdown Content"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(o().dropDownContent||[]).map((e,n)=>(0,c.jsx)(If,{item:e,index:n,onChange:t,onRemove:()=>{s(o(),"dropDownContent").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Dropdown Item",onClick:()=>{s(o(),"dropDownContent").push({type:Yh.LINKS,links:[]}),t()}})]})]}),(0,c.jsx)(vf,{text:"Desktop Menu"}),(0,c.jsxs)(Tf,{title:"Desktop Menu Configuration",children:[(0,c.jsx)(F,{label:"Desktop Logo",value:"string"==typeof i().logo?i().logo:void 0,onChange:e=>{i().logo=e??"",t()}}),(0,c.jsx)(z,{label:"Nav Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:i().navClasses??"",onChange:e=>{i().navClasses=e.target.value,t()}})}),(0,c.jsx)(vf,{text:"Content Blocks"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(i().content||[]).map((e,n)=>(0,c.jsx)(Rf,{item:e,index:n,onChange:t,onRemove:()=>{s(i(),"content").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Content Block",onClick:()=>{s(i(),"content").push({type:Qh.LINKS,links:[]}),t()}})]})]}),(0,c.jsx)(vf,{text:"Banners Above Header"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.bannersAboveHeader||[]).map((e,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Banner",index:r,onRemove:()=>{s(n(),"bannersAboveHeader").splice(r,1),t()}}),(0,c.jsx)(z,{label:"Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.wrapperClasses??"",onChange:n=>{e.wrapperClasses=n.target.value,t()}})}),(0,c.jsx)(z,{label:"Banner Content (HTML)",children:(0,c.jsx)($h,{value:e.content??"",onChange:n=>{e.content=n,t()}})})]},r)),(0,c.jsx)(wf,{label:"+ Add Banner",onClick:()=>{s(n(),"bannersAboveHeader").push({wrapperClasses:"",content:""}),t()}})]}),(0,c.jsx)(vf,{text:"Contact"}),(0,c.jsx)(z,{label:"Contact URL",helper:"URL for the contact page",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:r.contactUrl??"",onChange:e=>{n().contactUrl=e.target.value,t()}})})]})}),zf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Mobile Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,n()}})})]}),(0,c.jsx)(Nf,{label:"Expanded by Default",helper:"Show sub-links expanded on load",checked:!!e.expanded,onChange:t=>{e.expanded=t,n()}}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links"}),(e.links||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Title",value:t.title??"",onChange:e=>{t.title=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.href??"",onChange:e=>{t.href=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Sub-Link",onClick:()=>{e.links||(e.links=[]),e.links.push({title:"",href:""}),n()}})]})]})),Bf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Nav Group",index:t,onRemove:r}),(0,c.jsx)(z,{label:"Group Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Title",value:t.title??"",onChange:e=>{t.title=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.href??"",onChange:e=>{t.href=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Link",onClick:()=>{e.links||(e.links=[]),e.links.push({title:"",href:""}),n()}})]}),(0,c.jsx)(vf,{text:"Shop All Link"}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Shop All Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.shopAllLink?.title??"",onChange:t=>{e.shopAllLink||(e.shopAllLink={title:"",href:""}),e.shopAllLink.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Shop All URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.shopAllLink?.href??"",onChange:t=>{e.shopAllLink||(e.shopAllLink={title:"",href:""}),e.shopAllLink.href=t.target.value,n()}})})]})]})),Ff=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.megaMenuConfig||(e.header.megaMenuConfig={}),e.header.megaMenuConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(Nf,{label:"Show Shipping Message",helper:"Display the free shipping message on the mega menu",checked:!!r.showShippingMessage,onChange:e=>{n().showShippingMessage=e,t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(zf,{item:e,index:n,onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:"",expanded:!1,links:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Shop Navigation"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopShopNavLinks||[]).map((e,n)=>(0,c.jsx)(Bf,{item:e,index:n,onChange:t,onRemove:()=>{o("desktopShopNavLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Nav Group",onClick:()=>{o("desktopShopNavLinks").push({title:"",links:[],shopAllLink:{title:"",href:""}}),t()}})]})]})}),qf=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]})]})),$f=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.dmpHeaderConfig||(e.header.dmpHeaderConfig={}),e.header.dmpHeaderConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(F,{label:"Logo Image",value:"string"==typeof r.logoImage?r.logoImage:void 0,onChange:e=>{n().logoImage=e??"",t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(qf,{item:e,index:n,label:"Mobile Link",onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:""}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopLinks||[]).map((e,n)=>(0,c.jsx)(qf,{item:e,index:n,label:"Desktop Link",onChange:t,onRemove:()=>{o("desktopLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Desktop Link",onClick:()=>{o("desktopLinks").push({title:"",href:""}),t()}})]})]})}),Hf=(0,u.observer)(({data:e,onChange:t,markDirty:n})=>{const r=e.header||{};return(0,c.jsx)(R,{title:"Header",subtitle:"Header layout and navigation settings",children:(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(z,{label:"Header Type",helper:"Select the type of header to use",children:(0,c.jsx)("select",{className:"hippo-input",value:r.headerType??"MEDIUM",onChange:e=>t("header","headerType",e.target.value),children:Object.values(Kh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),r.headerType===Kh.BASIC&&(0,c.jsx)(Ef,{data:e,markDirty:n}),r.headerType===Kh.MEDIUM&&(0,c.jsx)(Pf,{data:e,markDirty:n}),r.headerType===Kh.MEGA&&(0,c.jsx)(Ff,{data:e,markDirty:n}),r.headerType===Kh.DMP&&(0,c.jsx)($f,{data:e,markDirty:n}),(r.headerType===Kh.LINKLESS||r.headerType===Kh.NONE)&&(0,c.jsx)("div",{className:"rounded-xl border border-dashed border-[var(--border-glass)] p-5 text-center",children:(0,c.jsxs)("p",{className:"text-sm text-[var(--text-muted)]",children:["No additional configuration needed for the ",r.headerType," header type."]})})]})})}),Vf=(0,u.observer)(({data:e,onChange:t})=>{const n=e.footer||{};return(0,c.jsx)(R,{title:"Footer",subtitle:"Footer layout and content settings",children:(0,c.jsx)(z,{label:"Footer Type",helper:"Choose the footer layout style for the website",children:(0,c.jsx)("select",{className:"hippo-input",value:n.footerType??"BASIC",onChange:e=>t("footer","footerType",e.target.value),children:Object.values(Xh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})})}),Uf=[{key:"productGridHideRestricted",label:"Hide Restricted Products",helper:"Hide restricted products from the product grid based on the user's selected country"},{key:"subscriptionAddOnsEnabled",label:"Subscription Add-Ons",helper:"Enable subscription add-ons for the brand"},{key:"shippingThresholdNotificationEnabled",label:"Shipping Threshold Notification",helper:"Enable shipping threshold notifications"},{key:"bundlingEnabled",label:"Bundling Experience",helper:"Enable the bundling experience"},{key:"cartDrawerEnabled",label:"Cart Drawer",helper:"Enable the cart drawer experience"},{key:"useDefaultFrequencies",label:"Use Default Frequencies",helper:"Calculate selected frequency based on product and quantity"}],_f=(0,u.observer)(({data:e,onChange:t,markDirty:n,api:r})=>{const o=e.features||{},[i,s]=(0,p.useState)([]),[a,l]=(0,p.useState)(!0);return(0,p.useEffect)(()=>{r.getModelEntries("product-grid-filter-group").then(e=>s(e)).catch(e=>console.error("[Hippo Commerce] Failed to fetch filter group entries:",e)).finally(()=>l(!1))},[r]),(0,c.jsx)(R,{title:"Features",subtitle:"Enable or disable site-wide features and behaviors",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Product Grid Filter Type",helper:"'Dropdown' displays a drop down of categories, ingredients, use cases, and tags. 'Stacked List' allows custom filter groupings.",children:(0,c.jsx)("select",{className:"hippo-input",value:o.productGridFilterType??"Dropdown",onChange:e=>t("features","productGridFilterType",e.target.value),children:Object.values(ef).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsx)(z,{label:"Product Link Prefix",helper:"Prefix before product slugs. e.g. /p/product-slug or /product/product-slug",children:(0,c.jsx)("select",{className:"hippo-input",value:o.productLinkPrefix??"/p",onChange:e=>t("features","productLinkPrefix",e.target.value),children:Object.values(tf).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})]}),(0,c.jsx)(z,{label:"Subscription Experience",helper:"Select the subscription management experience for customers",children:(0,c.jsxs)("select",{className:"hippo-input",value:o.subscriptionExperience??"Classic",onChange:e=>t("features","subscriptionExperience",e.target.value),children:[(0,c.jsx)("option",{value:"Classic",children:"Classic"}),(0,c.jsx)("option",{value:"Version 2",children:"Version 2"})]})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Feature Toggles"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)("div",{className:"space-y-0 rounded-xl border border-[var(--border-glass)] overflow-hidden",children:Uf.map(({key:e,label:n,helper:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 px-4 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:n}),(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:r})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:!!o[e],onChange:n=>t("features",e,n.target.checked)})]},e))}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Product Grid Filter Groups"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),a?(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)]",children:"Loading..."}):(0,c.jsxs)("div",{className:"space-y-4",children:[(o.productGridFilterGroups??[]).map((t,r)=>{const o=t.filterConfig?.value?.id??t.filterConfig?.id??"";return(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(z,{label:"Filter Group",children:(0,c.jsxs)("select",{className:"hippo-input",value:o,onChange:t=>{const o=i.find(e=>e.id===t.target.value);e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups[r].filterConfig=o?{"@type":"@builder.io/core:Reference",model:"product-grid-filter-group",id:o.id}:void 0,n()},children:[(0,c.jsx)("option",{value:"",children:"Select a filter group..."}),i.map(e=>(0,c.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups.splice(r,1),n()},children:"Remove"})})]},r)}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups.push({filterConfig:void 0}),n()},children:"Add Filter Group"})]})]})})}),Wf=(0,u.observer)(({data:e,onChange:t,markDirty:n})=>{const r=e.support||{},o=r.address||{},i=(t,r)=>{e.support||(e.support={}),e.support.address||(e.support.address={}),e.support.address[t]=r,n()};return(0,c.jsx)(R,{title:"Support Information",subtitle:"Contact information displayed to customers on the website",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Support Email",helper:"Email address for customer support inquiries",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.email??"",onChange:e=>t("support","email",e.target.value)})}),(0,c.jsx)(z,{label:"Support Phone Number",helper:"Phone number for customer support inquiries",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.phone??"",onChange:e=>t("support","phone",e.target.value)})})]}),(0,c.jsx)(z,{label:"Support Phone Display",helper:"Formatted phone number for display",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.phoneDisplay??"",onChange:e=>t("support","phoneDisplay",e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Address"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Street",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.street??"",onChange:e=>i("street",e.target.value)})}),(0,c.jsx)(z,{label:"City",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.city??"",onChange:e=>i("city",e.target.value)})}),(0,c.jsx)(z,{label:"State Code",helper:"e.g. CA",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.state??"",onChange:e=>i("state",e.target.value)})}),(0,c.jsx)(z,{label:"Zip Code",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.zipcode??"",onChange:e=>i("zipcode",e.target.value)})})]}),(0,c.jsx)(z,{label:"Full Address String",helper:"The full support address as a single formatted string",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.addressString??"",onChange:e=>t("support","addressString",e.target.value)})})]})})}),Gf=({open:e})=>(0,c.jsx)("svg",{className:"w-4 h-4 text-[var(--text-muted)] transition-transform "+(e?"rotate-180":""),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M6 9l6 6 6-6"})}),Kf=({label:e,helper:t,checked:n,onChange:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:t})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:n,onChange:e=>r(e.target.checked)})]}),Jf=({label:e,value:t,fallback:n,onChange:r})=>(0,c.jsx)(z,{label:e,children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:t||n,onChange:e=>r(e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:t,onChange:e=>r(e.target.value)})]})}),Yf=(0,u.observer)(({data:e,markDirty:t})=>{const[n,r]=(0,p.useState)(new Set),o=e.pageConfig||{},i=e=>{r(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},s=(n,r)=>{e.pageConfig||(e.pageConfig={});let o=e.pageConfig;for(let e=0;e<n.length-1;e++)o[n[e]]||(o[n[e]]={}),o=o[n[e]];o[n[n.length-1]]=r,t()},a=o.accountDetails||{},l=o.cart||{},d=o.checkout||{},u=o.orderDetails||{},h=o.resetPassword||{},f=o.subscriptionEdit||{},m=o.upsell||{};return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("cart"),children:[(0,c.jsx)("span",{children:"Cart Page"}),(0,c.jsx)(Gf,{open:n.has("cart")})]}),n.has("cart")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Continue Shopping URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:l.continueShoppingUrl??"",onChange:e=>s(["cart","continueShoppingUrl"],e.target.value)})}),(0,c.jsx)(Kf,{label:"Group Cart Contents by Purchase Type",helper:"Group cart contents by subscription and one-time purchases",checked:!!l?.groupCartContentsByPurchaseType,onChange:e=>s(["cart","groupCartContentsByPurchaseType"],e)}),(0,c.jsx)(Kf,{label:"Enable Cart Frequency Toggle",helper:"Show a frequency toggle on the cart page and in the cart drawer",checked:!!l?.enabledCartFrequencyToggle,onChange:e=>s(["cart","enabledCartFrequencyToggle"],e)}),(0,c.jsx)(Jf,{label:"Image Container Background Color",value:l.imageContainerBGColor??"",fallback:"#ffffff",onChange:e=>s(["cart","imageContainerBGColor"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Free Shipping Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Free Shipping Banner",checked:!!l.freeShippingBanner?.isVisible,onChange:e=>s(["cart","freeShippingBanner","isVisible"],e)}),(0,c.jsx)(z,{label:"Logged Out Banner Content",children:(0,c.jsx)($h,{value:l.freeShippingBanner?.loggedOutBannerContent??"",onChange:e=>s(["cart","freeShippingBanner","loggedOutBannerContent"],e)})}),(0,c.jsx)(z,{label:"Logged In Banner Content",children:(0,c.jsx)($h,{value:l.freeShippingBanner?.loggedInBannerContent??"",onChange:e=>s(["cart","freeShippingBanner","loggedInBannerContent"],e)})}),(0,c.jsx)(Jf,{label:"Banner Background Color",value:l.freeShippingBanner?.styles?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["cart","freeShippingBanner","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Banner Text Color",value:l.freeShippingBanner?.styles?.color??"",fallback:"#ffffff",onChange:e=>s(["cart","freeShippingBanner","styles","color"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Secure Payment Notice"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Secure Payment Notice",checked:!!l.notices?.securePaymentNotice?.isVisible,onChange:e=>s(["cart","notices","securePaymentNotice","isVisible"],e)}),(0,c.jsx)(z,{label:"Secure Payment Notice Content",children:(0,c.jsx)($h,{value:l.notices?.securePaymentNotice?.text??"",onChange:e=>s(["cart","notices","securePaymentNotice","text"],e)})}),(0,c.jsx)(Jf,{label:"Notice Background Color",value:l.notices?.securePaymentNotice?.styles?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["cart","notices","securePaymentNotice","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Notice Text Color",value:l.notices?.securePaymentNotice?.styles?.color??"",fallback:"#ffffff",onChange:e=>s(["cart","notices","securePaymentNotice","styles","color"],e)})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("checkout"),children:[(0,c.jsx)("span",{children:"Checkout Page"}),(0,c.jsx)(Gf,{open:n.has("checkout")})]}),n.has("checkout")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Free Shipping Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Free Shipping Banner",checked:!!d.freeShippingBanner?.isVisible,onChange:e=>s(["checkout","freeShippingBanner","isVisible"],e)}),(0,c.jsx)(z,{label:"Logged Out Banner Content",children:(0,c.jsx)($h,{value:d.freeShippingBanner?.loggedOutBannerContent??"",onChange:e=>s(["checkout","freeShippingBanner","loggedOutBannerContent"],e)})}),(0,c.jsx)(z,{label:"Logged In Banner Content",children:(0,c.jsx)($h,{value:d.freeShippingBanner?.loggedInBannerContent??"",onChange:e=>s(["checkout","freeShippingBanner","loggedInBannerContent"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Secure Payment Notice"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Secure Payment Notice",checked:!!d.securePaymentNotice?.isVisible,onChange:e=>s(["checkout","securePaymentNotice","isVisible"],e)}),(0,c.jsx)(z,{label:"Secure Payment Notice Content",children:(0,c.jsx)($h,{value:d.securePaymentNotice?.content??"",onChange:e=>s(["checkout","securePaymentNotice","content"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Auto Sign-Up"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Auto Sign-Up",checked:!!d.autoSignUp?.isVisible,onChange:e=>s(["checkout","autoSignUp","isVisible"],e)}),(0,c.jsx)(Kf,{label:"Auto Sign-Up Checked by Default",checked:!!d.autoSignUp?.isChecked,onChange:e=>s(["checkout","autoSignUp","isChecked"],e)}),(0,c.jsx)(z,{label:"Auto Sign-Up Checkbox Label",children:(0,c.jsx)($h,{value:d.autoSignUp?.labelText??"",onChange:e=>s(["checkout","autoSignUp","labelText"],e)})}),(0,c.jsx)(z,{label:"Help Modal Header",children:(0,c.jsx)($h,{value:d.autoSignUp?.helpModal?.header??"",onChange:e=>s(["checkout","autoSignUp","helpModal","header"],e)})}),(0,c.jsx)(z,{label:"Help Modal Content",children:(0,c.jsx)($h,{value:d.autoSignUp?.helpModal?.content??"",onChange:e=>s(["checkout","autoSignUp","helpModal","content"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"SMS Opt-In"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show SMS Opt-In",checked:!!d.smsOptIn?.isVisible,onChange:e=>s(["checkout","smsOptIn","isVisible"],e)}),(0,c.jsx)(z,{label:"SMS Opt-In Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:d.smsOptIn?.title??"",onChange:e=>s(["checkout","smsOptIn","title"],e.target.value)})}),(0,c.jsx)(z,{label:"SMS Opt-In CTA Content",children:(0,c.jsx)($h,{value:d.smsOptIn?.content??"",onChange:e=>s(["checkout","smsOptIn","content"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("orderDetails"),children:[(0,c.jsx)("span",{children:"Order Details Page"}),(0,c.jsx)(Gf,{open:n.has("orderDetails")})]}),n.has("orderDetails")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Title (HTML)",children:(0,c.jsx)($h,{value:u.title??"",onChange:e=>s(["orderDetails","title"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Table Header Style"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Jf,{label:"Table Header Background Color",value:u.tableHeaderStyle?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["orderDetails","tableHeaderStyle","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Table Header Text Color",value:u.tableHeaderStyle?.color??"",fallback:"#ffffff",onChange:e=>s(["orderDetails","tableHeaderStyle","color"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Table Content Style"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Jf,{label:"Table Content Background Color",value:u.tableContentStyle?.backgroundColor??"",fallback:"#ffffff",onChange:e=>s(["orderDetails","tableContentStyle","backgroundColor"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Buy It Again Button"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Buy It Again Button Text",children:(0,c.jsx)($h,{value:u.buyItAgainButton?.text??"",onChange:e=>s(["orderDetails","buyItAgainButton","text"],e)})}),(0,c.jsx)(z,{label:"CSS Classes",helper:"CSS classes to apply to the button",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:u.buyItAgainButton?.classes??"",onChange:e=>s(["orderDetails","buyItAgainButton","classes"],e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Re-Order All Button"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Re-Order All Button Text",children:(0,c.jsx)($h,{value:u.reOrderAllButton?.text??"",onChange:e=>s(["orderDetails","reOrderAllButton","text"],e)})}),(0,c.jsx)(z,{label:"CSS Classes",helper:"CSS classes to apply to the button",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:u.reOrderAllButton?.classes??"",onChange:e=>s(["orderDetails","reOrderAllButton","classes"],e.target.value)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("resetPassword"),children:[(0,c.jsx)("span",{children:"Reset Password Page"}),(0,c.jsx)(Gf,{open:n.has("resetPassword")})]}),n.has("resetPassword")&&(0,c.jsx)("div",{className:"p-5 pt-0 space-y-5",children:(0,c.jsx)(z,{label:"Page Title (HTML)",children:(0,c.jsx)($h,{value:h.title??"",onChange:e=>s(["resetPassword","title"],e)})})})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("subscriptionCancel"),children:[(0,c.jsx)("span",{children:"Subscription Cancellation Page"}),(0,c.jsx)(Gf,{open:n.has("subscriptionCancel")})]}),n.has("subscriptionCancel")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Cancel Text (HTML)",helper:"Text displayed on the subscription cancellation page",children:(0,c.jsx)($h,{value:o.subscriptionCancel?.cancelText??"",onChange:e=>s(["subscriptionCancel","cancelText"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Cancel Reasons"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(o.subscriptionCancel?.cancelReasons??[]).map((n,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:["Reason ",r+1,n.title?`: ${n.title}`:""]}),(0,c.jsx)("button",{className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons.splice(r,1),t())},children:"Remove"})]}),(0,c.jsx)(z,{label:"Reason",helper:"Required",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.title??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].title=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Display Content",children:(0,c.jsx)($h,{value:n.text??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].text=n,t())}})}),(0,c.jsx)(z,{label:"Identifier",helper:"System identifier for analytics tracking",children:(0,c.jsxs)("select",{className:"hippo-input",value:n.identifier??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].identifier=n.target.value,t())},children:[(0,c.jsx)("option",{value:"",children:"Select an identifier..."}),Object.values(rf).map(e=>(0,c.jsx)("option",{value:e,children:e},e))]})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-3",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Buttons"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(n.buttons??[]).map((n,o)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3 ml-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:["Button ",o+1]}),(0,c.jsx)("button",{className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons.splice(o,1),t())},children:"Remove"})]}),(0,c.jsx)(z,{label:"Button Text",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.text??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].text=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Button Link",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:n.link??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].link=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Button Type",helper:"Determines button behavior",children:(0,c.jsx)("select",{className:"hippo-input",value:n.type??"link",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].type=n.target.value,t())},children:Object.values(of).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})]},o)),(0,c.jsx)("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.pageConfig||(e.pageConfig={}),e.pageConfig.subscriptionCancel||(e.pageConfig.subscriptionCancel={}),e.pageConfig.subscriptionCancel.cancelReasons||(e.pageConfig.subscriptionCancel.cancelReasons=[]),e.pageConfig.subscriptionCancel.cancelReasons[r].buttons||(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons=[]),e.pageConfig.subscriptionCancel.cancelReasons[r].buttons.push({text:"",link:"",type:"link"}),t()},children:"+ Add Button"})]},r)),(0,c.jsx)("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.pageConfig||(e.pageConfig={}),e.pageConfig.subscriptionCancel||(e.pageConfig.subscriptionCancel={}),e.pageConfig.subscriptionCancel.cancelReasons||(e.pageConfig.subscriptionCancel.cancelReasons=[]),e.pageConfig.subscriptionCancel.cancelReasons.push({title:"",text:"",identifier:"",buttons:[]}),t()},children:"+ Add Reason"})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("subscriptionEdit"),children:[(0,c.jsx)("span",{children:"Subscription Edit"}),(0,c.jsx)(Gf,{open:n.has("subscriptionEdit")})]}),n.has("subscriptionEdit")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Subscription Item Default Image",helper:"Default image for subscription items",children:(0,c.jsxs)("div",{className:"flex items-center gap-3",children:["string"==typeof f.subscriptionItemDefaultImage&&f.subscriptionItemDefaultImage&&(0,c.jsx)("img",{src:f.subscriptionItemDefaultImage,alt:"Default subscription item",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Image URL",value:f.subscriptionItemDefaultImage??"",onChange:e=>s(["subscriptionEdit","subscriptionItemDefaultImage"],e.target.value)})]})}),(0,c.jsx)(z,{label:"Ship Now Modal Headline (HTML)",children:(0,c.jsx)($h,{value:f.shipNow?.modalHeadlineContent??"",onChange:e=>s(["subscriptionEdit","shipNow","modalHeadlineContent"],e)})}),(0,c.jsx)(z,{label:"Ship Now Modal Content (HTML)",helper:"Use $FREQUENCY for the subscription frequency",children:(0,c.jsx)($h,{value:f.shipNow?.modalContent??"",onChange:e=>s(["subscriptionEdit","shipNow","modalContent"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("upsell"),children:[(0,c.jsx)("span",{children:"Upsell Page"}),(0,c.jsx)(Gf,{open:n.has("upsell")})]}),n.has("upsell")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Money Back Guarantee Image",children:(0,c.jsxs)("div",{className:"flex items-center gap-3",children:["string"==typeof m.mbgImage&&m.mbgImage&&(0,c.jsx)("img",{src:m.mbgImage,alt:"MBG",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Image URL",value:m.mbgImage??"",onChange:e=>s(["upsell","mbgImage"],e.target.value)})]})}),(0,c.jsx)(z,{label:"Money Back Guarantee Text (HTML)",children:(0,c.jsx)($h,{value:m.mbgText??"",onChange:e=>s(["upsell","mbgText"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("accountDetails"),children:[(0,c.jsx)("span",{children:"Account Details Page"}),(0,c.jsx)(Gf,{open:n.has("accountDetails")})]}),n.has("accountDetails")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Birthday Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Banner Content",children:(0,c.jsx)($h,{value:a.birthdayBannerConfig?.content??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","content"],e)})}),(0,c.jsx)(z,{label:"Link Text",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.linkText??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","linkText"],e.target.value)})}),(0,c.jsx)(z,{label:"Link URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:a.birthdayBannerConfig?.linkUrl??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","linkUrl"],e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Banner Styles"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Display",helper:"CSS display value (e.g. flex, block)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.display??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","display"],e.target.value)})}),(0,c.jsx)(z,{label:"Align Items",helper:"CSS align-items value (e.g. center, flex-start)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.alignItems??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","alignItems"],e.target.value)})}),(0,c.jsx)(z,{label:"Margin",helper:"CSS margin value (e.g. 10px, 0 auto)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.margin??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","margin"],e.target.value)})}),(0,c.jsx)(z,{label:"Padding",helper:"CSS padding value (e.g. 16px, 10px 20px)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.padding??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","padding"],e.target.value)})}),(0,c.jsx)(Jf,{label:"Background Color",value:a.birthdayBannerConfig?.styles?.backgroundColor??"",fallback:"#ffffff",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Text Color",value:a.birthdayBannerConfig?.styles?.color??"",fallback:"#000000",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","color"],e)})]})]})]})}),Qf=Yf,Zf=(0,u.observer)(({data:e,markDirty:t})=>{const n=(e.cookieConfig||{}).popupBanner||{},r=(n,r,o)=>{e.cookieConfig||(e.cookieConfig={}),e.cookieConfig.popupBanner||(e.cookieConfig.popupBanner={}),e.cookieConfig.popupBanner[n]||(e.cookieConfig.popupBanner[n]={}),e.cookieConfig.popupBanner[n][r]=o,t()};return(0,c.jsx)(R,{title:"Cookie Configuration",subtitle:"Settings for the cookie consent popup displayed to visitors",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(z,{label:"Popup Content",children:(0,c.jsx)($h,{value:n.content??"",onChange:n=>{return r=n,e.cookieConfig||(e.cookieConfig={}),e.cookieConfig.popupBanner||(e.cookieConfig.popupBanner={}),e.cookieConfig.popupBanner.content=r,void t();var r}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("h4",{className:"text-sm font-semibold text-[var(--text-secondary)]",children:"Banner Styles"}),(0,c.jsx)(z,{label:"Background Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.bannerStyles?.backgroundColor??"#000000",onChange:e=>r("bannerStyles","backgroundColor",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.bannerStyles?.backgroundColor??"",onChange:e=>r("bannerStyles","backgroundColor",e.target.value)})]})}),(0,c.jsx)(z,{label:"Border Radius",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.bannerStyles?.borderRadius??"",onChange:e=>r("bannerStyles","borderRadius",e.target.value)})})]}),(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("h4",{className:"text-sm font-semibold text-[var(--text-secondary)]",children:"Button Styles"}),(0,c.jsx)(z,{label:"Background Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.buttonStyles?.backgroundColor??"#000000",onChange:e=>r("buttonStyles","backgroundColor",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.buttonStyles?.backgroundColor??"",onChange:e=>r("buttonStyles","backgroundColor",e.target.value)})]})}),(0,c.jsx)(z,{label:"Text Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.buttonStyles?.color??"#ffffff",onChange:e=>r("buttonStyles","color",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.buttonStyles?.color??"",onChange:e=>r("buttonStyles","color",e.target.value)})]})})]})]})]})})}),Xf=(0,u.observer)(({data:e,onChange:t})=>{const n=e.seo||{};return(0,c.jsx)(R,{title:"SEO",subtitle:"Search engine optimization settings for the brand",children:(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(z,{label:"Site Description",helper:"Default meta description for the website, used when pages do not provide their own",children:(0,c.jsx)("textarea",{className:"hippo-input",rows:3,value:n.description??"",onChange:e=>t("seo","description",e.target.value)})}),(0,c.jsx)(z,{label:"Topics",helper:"Topics the brand is knowledgeable about, used in structured data for search engines",children:(0,c.jsx)(Hh,{value:Array.isArray(n.knowsAbout)?n.knowsAbout:[],onChange:e=>t("seo","knowsAbout",e)})})]})})}),em=["General","Header","Footer","Features","Support","Pages","Cookies","SEO"],tm=({context:e})=>{const t=(0,u.useLocalStore)(()=>({config:null,data:{},loading:!0,saving:!1,error:null,dirty:!1,activeTab:"General"})),n=p.default.useMemo(()=>new Vh(e),[e]),r=g.getUserDetails(e).brand,o=(0,p.useCallback)(async()=>{t.loading=!0,t.error=null;try{const e=await n.getBrandConfig();e.length>0&&(t.config=e[0],t.data={...e[0].data||{}})}catch(e){console.error("[Hippo Commerce] Error loading brand config",e),t.error=e.message??"Failed to load brand configuration."}finally{t.loading=!1}},[n,t]),i=(0,p.useCallback)(async()=>{t.loading=!0;try{await n.createBrandConfig(`${r||"Brand"} Configuration`),await o()}catch(e){console.error("[Hippo Commerce] Error creating brand config",e),t.error=e.message??"Failed to create brand configuration.",t.loading=!1}},[n,r,o,t]),s=(0,p.useCallback)(async()=>{if(t.config?.id&&t.dirty){t.saving=!0;try{const r=JSON.parse(JSON.stringify(t.data));await n.saveBrandConfig(t.config.id,r),t.dirty=!1,await e.dialogs.alert("Brand configuration saved.","Success")}catch(t){console.error("[Hippo Commerce] Error saving brand config",t),await e.dialogs.alert(`Save failed: ${t.message}`,"Error")}finally{t.saving=!1}}},[n,e,t]),a=(0,p.useCallback)(()=>{t.dirty=!0},[t]),l=(0,p.useCallback)((e,n,r)=>{t.data[e]||(t.data[e]={}),t.data[e][n]=r,t.dirty=!0},[t]),d=(0,p.useCallback)((e,n)=>{t.data[e]=n,t.dirty=!0},[t]);return(0,p.useEffect)(()=>{o()},[]),(0,u.useObserver)(()=>t.loading?(0,c.jsx)(D,{message:"Loading brand configuration...",size:"lg"}):t.error&&!t.config?(0,c.jsxs)("div",{className:"text-center py-16",children:[(0,c.jsx)("p",{className:"text-[var(--error)] mb-4",children:t.error}),(0,c.jsx)("button",{className:"px-4 py-2 rounded-lg bg-[var(--error)]/15 text-[var(--error)] font-medium text-sm cursor-pointer hover:bg-[var(--error)]/25 transition-colors",onClick:()=>o(),children:"Retry"})]}):t.config?(0,c.jsxs)("div",{children:[(0,c.jsx)(P,{title:"Brand Configuration",actions:(0,c.jsx)("button",{className:"px-5 py-2 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:hover:shadow-none",disabled:!t.dirty||t.saving,onClick:s,children:t.saving?"Saving...":"Save"})}),(0,c.jsx)("div",{className:"flex gap-0.5 p-1 bg-[var(--bg-glass)] border border-[var(--border-glass)] rounded-xl mb-7 overflow-x-auto",children:em.map(e=>(0,c.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium whitespace-nowrap cursor-pointer transition-all "+(t.activeTab===e?"text-[var(--accent)] bg-[var(--accent-subtle)] font-semibold":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-glass-hover)]"),onClick:()=>t.activeTab=e,children:e},e))}),(()=>{const e={data:t.data,onChange:l,onChangeRoot:d,markDirty:a,api:n};switch(t.activeTab){case"General":return(0,c.jsx)(Gh,{...e});case"Header":return(0,c.jsx)(Hf,{...e});case"Footer":return(0,c.jsx)(Vf,{...e});case"Features":return(0,c.jsx)(_f,{...e});case"Support":return(0,c.jsx)(Wf,{...e});case"Pages":return(0,c.jsx)(Qf,{...e});case"Cookies":return(0,c.jsx)(Zf,{...e});case"SEO":return(0,c.jsx)(Xf,{...e});default:return null}})()]}):(0,c.jsx)(B,{message:"No brand configuration found. Create one to get started.",action:{label:"Create Brand Configuration",onClick:i}}))},nm=p.default.memo(e=>{const{context:t}=e;return(0,c.jsx)(E,{context:t,children:(0,c.jsx)(tm,{context:t})})});nm.displayName="HippoCMSBrandConfiguration";const rm=nm;let om=null;function im(){return om?.(h)}const sm=new class{ingredientsModel={name:"product-ingredient",displayName:"Product Ingredient",kind:"data",helperText:"Ingredients used in products",contentTitleField:"name",fields:[{"@type":"@builder.io/core:Field",name:"name",friendlyName:"Ingredient",type:"text",required:!0,defaultCollapsed:!0,helperText:"The display name of this ingredient as it appears on the website",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"description",friendlyName:"Description",type:"longText",required:!1,defaultCollapsed:!0,helperText:"A detailed description of this ingredient, shown on product detail pages",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"image",friendlyName:"Image",type:"file",showTemplatePicker:!0,defaultCollapsed:!0,helperText:"An image representing this ingredient, used in ingredient spotlights and carousels",allowedFileTypes:["jpeg","png","svg","webp"]},{"@type":"@builder.io/core:Field",name:"shortDescription",friendlyName:"Short Description",type:"longText",required:!1,defaultCollapsed:!0,helperText:"A brief summary of this ingredient, used in compact displays like product cards",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1}]};categoryModel={name:"product-category",kind:"data",displayName:"Product Category",helperText:"Categories for products",contentTitleField:"name",fields:[{name:"name",friendlyName:"Category",type:"text",required:!0,defaultCollapsed:!0,localized:!0,helperText:"The name of this category as it appears on the website"},{name:"description",friendlyName:"Description",type:"longText",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A description of this category, used in components that display category details"},{name:"desktopImage",friendlyName:"Desktop Image",type:"file",defaultCollapsed:!0,showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"Image displayed for this category on desktop screens"},{name:"mobileImage",defaultCollapsed:!0,friendlyName:"Mobile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"Image displayed for this category on mobile screens"},{name:"hidden",friendlyName:"Hide Category",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this category will not be displayed in product grids or search results for this locale"},{name:"slug",friendlyName:"Page Slug",type:"text",defaultCollapsed:!0,helperText:'If this category has a specific web page, provide the path here without a leading slash (e.g. "shop/supplements") for use in breadcrumb navigation. By default, the path "shop" will be used.',required:!1,localized:!1},{name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1}]};productTagModel={name:"product-tag",kind:"data",displayName:"Product Tag",helperText:"Provides a link between products across categories.",contentTitleField:"name",fields:[{name:"name",friendlyName:"Tag",type:"text",required:!0,defaultCollapsed:!0,localized:!0,makeEntryTitle:!0,helperText:'The display name of this tag (e.g. "Favorites", "New", "Best Seller")'},{name:"tagColor",friendlyName:"Color",type:"color",required:!0,defaultCollapsed:!0,localized:!1,defaultValue:"gba(255, 233, 214, 1)",helperText:"The background color shown behind the tag label on product cards"},{name:"hidden",friendlyName:"Hide Tag",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this tag will not be displayed in product grids or search results for this locale"},{name:"image",friendlyName:"Tag Image",type:"file",allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"For product grids that support tag images, you may provide the image here."},{name:"pluralDisplayName",friendlyName:"Plural Display Name",defaultCollapsed:!0,type:"text",helperText:'This is used when grouping/filtering. Allows us to display "Favorites" instead of "Fave", for example.',required:!1,localized:!0}]};useCaseModel={name:"product-use-case",kind:"data",displayName:"Product Use Case",helperText:"Provides a link between products used for the same goal.",contentTitleField:"name",fields:[{name:"name",defaultCollapsed:!0,helperText:'The display name of this use case (e.g. "Joint Support", "Weight Management")',friendlyName:"Use Case",type:"text",required:!0,localized:!0},{name:"description",friendlyName:"Description",type:"longText",defaultCollapsed:!0,required:!1,localized:!0,helperText:"A detailed description of this use case, shown when users browse by goal"},{name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1},{name:"image",friendlyName:"Image",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"An image representing this use case, used in grids and carousels"},{name:"hidden",friendlyName:"Hide Use Case",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this use case will not be displayed in product grids or search results for this locale"}]};profileReferenceRuleModel=(()=>({name:"profile-reference-rule",displayName:"Profile Reference Rule",kind:"data",helperText:"Apply profile-based personalization by associating tags, ingredients, etc. to profile properties.",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Rule Name",type:"text",required:!0,defaultCollapsed:!1,localized:!0,helperText:"The name of this profile reference rule."},{name:"applicationType",friendlyName:"Application Type",type:"select",required:!0,defaultCollapsed:!1,enum:[pf.Exclusive,pf.Preferred,pf.Required],defaultValue:pf.Preferred,helperText:"How this rule is applied relative to other rules."},{name:"referenceType",friendlyName:"Reference Type",type:"select",required:!0,defaultCollapsed:!1,enum:[cf.Tag,cf.Ingredient,cf.Category,cf.UseCase],helperText:"The type of content reference to apply when this rule is triggered.",defaultValue:cf.Tag},{name:"tagReference",friendlyName:"Tag",type:"reference",required:'return options.get("referenceType") === "Tag"',showIf:'return options.get("referenceType") === "Tag"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-tag"},{name:"ingredientReference",friendlyName:"Ingredient",type:"reference",required:'return options.get("referenceType") === "Ingredient"',showIf:'return options.get("referenceType") === "Ingredient"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-ingredient"},{name:"categoryReference",friendlyName:"Category",type:"reference",required:'return options.get("referenceType") === "Category"',showIf:'return options.get("referenceType") === "Category"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-category"},{name:"useCaseReference",friendlyName:"Use Case",type:"reference",required:'return options.get("referenceType") === "UseCase"',showIf:'return options.get("referenceType") === "UseCase"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-use-case"},{name:"applicationRules",type:"list",friendlyName:"Application Rules",required:!0,defaultCollapsed:!1,helperText:"The rules that determine when the linked reference should be applied. These rules are evaluated together, so all rules must be satisfied for the reference to be applied.",subFields:[{name:"profileField",friendlyName:"Profile Field",type:"select",required:!0,defaultCollapsed:!1,enum:[df.Age,df.Gender,df.Weight,df.Type,df.Breed,df.HealthConditions],helperText:"The profile field to evaluate for this rule."},{name:"stringOperator",friendlyName:"Operator",type:"select",required:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',showIf:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',defaultCollapsed:!1,enum:["is","is not","contains","does not contain"],helperText:"The operator to use when evaluating the profile field."},{name:"numberOperator",friendlyName:"Operator",type:"select",required:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",showIf:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",defaultCollapsed:!1,enum:["equals","not equals","greater than","less than"],helperText:"The operator to use when evaluating the profile field."},{name:"numberValue",friendlyName:"Value",type:"number",defaultValue:0,required:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",showIf:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",defaultCollapsed:!1,helperText:"The numeric value to compare against the profile field."},{name:"stringValue",friendlyName:"Value",type:"text",required:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',showIf:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',defaultCollapsed:!1,helperText:"The string value to compare against the profile field. Case insensitive."}]}]}))();recommendationConfigModel={name:"recommendation-config",displayName:"Recommendation Config",kind:"data",helperText:"Configuration for how product recommendations are generated.",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,defaultCollapsed:!1,localized:!1,helperText:"The name of this recommendation config.",makeEntryTitle:!0},{name:"recommendations",friendlyName:"Recommendations",type:"list",required:!0,defaultCollapsed:!1,helperText:"Each item defines a single recommendation slot. The number of items determines how many recommendations are generated.",subFields:[{name:"label",friendlyName:"Label",type:"text",required:!1,localized:!0,defaultCollapsed:!1,helperText:"Label for this recommendation slot."},{name:"showResult",friendlyName:"Show Result",type:"boolean",required:!1,defaultValue:!0,defaultCollapsed:!1,helperText:"When true, the result of this recommendation is displayed."},{name:"requiredTags",friendlyName:"Required Tags",type:"list",required:!1,defaultCollapsed:!1,helperText:"Tags that the recommended product must have. Leave empty to allow any tag.",subFields:[{name:"tag",friendlyName:"Tag",type:"reference",model:"product-tag",required:!0,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag the recommendation must have."}]},{name:"excludedTags",friendlyName:"Excluded Tags",type:"list",required:!1,defaultCollapsed:!1,helperText:"Tags that the recommended product must NOT have.",subFields:[{name:"tag",friendlyName:"Tag",type:"reference",model:"product-tag",required:!0,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag the recommendation must not have."}]}]}]};blogCategoryModel={name:"blog-category",displayName:"Blog Category",kind:"data",helperText:"Category for blog categorization",contentTitleField:void 0,fields:[{name:"name",friendlyName:"Name",helperText:"Name of the category",type:"text",defaultCollapsed:!1,localized:!0,required:!0},{name:"description",friendlyName:"Category Description",helperText:"Provide a description of the category. This may be used in components.",type:"html",defaultCollapsed:!1,localized:!0,required:!1},{name:"slug",friendlyName:"Slug",helperText:"Path to use for linking to this category",type:"text",defaultCollapsed:!1,localized:!1,required:!0},{name:"parentId",friendlyName:"Parent Category Id",helperText:"If this category is a child, provide the Id of the parent category",type:"text",required:!1,defaultCollapsed:!0,localized:!1}]};productModel(e){return(e=>({name:"product",displayName:"Product",kind:"data",helperText:"Product Catalog",contentTitleField:"name",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,localized:!0,defaultCollapsed:!0,helperText:"This is the name that will be displayed to the customer"},{name:"featuredImage",friendlyName:"Featured Image",helperText:"Displayed on the product card",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"]},{name:"emojis",friendlyName:"Emojis List",helperText:"Emoji shown on the flavor selector and used for the add-to-cart confetti.",defaultCollapsed:!0,type:"Tags",required:!1},{name:"secondaryImage",friendlyName:"Secondary Image",helperText:"Displayed on the product card hover for some grids",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"]},{name:"subHeading",defaultCollapsed:!0,friendlyName:"Product Headline",helperText:"Subheading (tagline) for the product, displayed on the product card",type:"text",localized:!0},{name:"gridTagline",defaultCollapsed:!0,friendlyName:"Grid Tagline",helperText:"By default, we use the Product Headline field. Use this to override the tagline when displayed on the product grid.",type:"text",required:!1,localized:!0},{name:"gridDescription",defaultCollapsed:!0,friendlyName:"Grid Description",helperText:"A small description, used on some product grids as an additional sub-heading or tagline.",type:"text",required:!1,localized:!0},{name:"shortDescription",defaultCollapsed:!0,friendlyName:"Short Description",helperText:"Short description of the product, typically displayed on the PDP",type:"html",required:!1,localized:!0},{name:"recommendationBlurb",defaultCollapsed:!0,friendlyName:"Recommendation Blurb",helperText:"Short blurb displayed when this product is surfaced as a recommendation.",type:"text",required:!1,localized:!0},{name:"quote",friendlyName:"Quote",defaultCollapsed:!0,helperText:"A quote provided by the brand guru or spokesperson",type:"html",localized:!0,required:!1},{name:"packagingLabels",friendlyName:"Packaging Labels",defaultCollapsed:!0,type:"object",helperText:"Labels describing the product packaging (e.g. Jar, Bottle, Pouch)",subFields:[{name:"singular",friendlyName:"Singular",defaultCollapsed:!0,type:"text",required:!0,localized:!0,helperText:"Provides the name of the packaging for single product (e.g. Unit, Jar, etc.)"},{name:"plural",defaultCollapsed:!0,friendlyName:"Plural",type:"text",required:!0,localized:!0,helperText:"Provides the name of the packaging for multiple quantities of the product (e.g. Units, Jars, etc.)"}]},{name:"hidden",friendlyName:"Hide Product",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this product will not be displayed in product grids or search results for this locale"},{name:"outOfStock",friendlyName:"Out of Stock",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Indicates whether this product is currently out of stock. When true, this product is not eligible for purchase."},{name:"cartOutOfStock",friendlyName:"Out of Stock (Site)",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Indicates that this product should be presented as out of stock on the site, even if it is not truly out of stock. This is used as an override for special cases where the product should not be purchasable on the site while remaining purchasable elsewhere."},{name:"upc",defaultCollapsed:!0,friendlyName:"UPC Code",type:"text",required:!1,helperText:"The UPC code of this product"},{name:"reviews",friendlyName:"Review Data",helperText:"Stores review data for this product. These values are automatically generated and should not be modified.",type:"object",defaultCollapsed:!0,subFields:[{name:"id",defaultCollapsed:!0,friendlyName:"Review ID",type:"text",required:!0,localized:!1,helperText:"ID used by the review service to identify this product. Do not modify this value."},{defaultCollapsed:!0,name:"count",friendlyName:"Review Count",type:"number",defaultValue:0,required:!0,localized:!1,helperText:"The number of reviews for this product. This value is automatically updated by the review service."},{name:"averageRating",friendlyName:"Average Rating",type:"number",defaultCollapsed:!0,defaultValue:0,required:!0,localized:!1,helperText:"The average rating for this product. This value is automatically updated by the review service."},{name:"globalFiveStarReviews",type:"number",friendlyName:"Global Five Star Reviews",required:!1,helperText:"",hidden:!1,defaultCollapsed:!0,defaultValue:0}]},{name:"tags",friendlyName:"Tags",type:"list",localized:!0,defaultCollapsed:!0,helperText:'Tags used to cross-reference products and enable filtering (e.g. "New", "Best Seller")',subFields:[{type:"reference",modelId:e.tagModelId,name:"tag",friendlyName:"Tag",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a product tag"}]},{name:"categories",friendlyName:"Categories",type:"list",localized:!0,defaultCollapsed:!0,helperText:"Categories this product belongs to, used for navigation and filtering",subFields:[{type:"reference",modelId:e.categoryModelId,name:"category",friendlyName:"Category",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a product category"}]},{name:"ingredients",friendlyName:"Ingredients",type:"list",localized:!0,defaultCollapsed:!0,helperText:"Key ingredients in this product, displayed on product detail pages",subFields:[{type:"reference",modelId:e.ingredientsModelId,name:"ingredient",friendlyName:"Ingredient",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select an ingredient"}]},{name:"useCases",defaultCollapsed:!0,friendlyName:"Use Cases",type:"list",localized:!0,helperText:"Goals or health benefits this product supports, used for filtering and recommendations",subFields:[{type:"reference",modelId:e.useCaseModelId,name:"useCase",friendlyName:"Use Case",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a use case"}]},{name:"featuredIngredients",friendlyName:"Featured Ingredients",type:"object",required:!1,defaultCollapsed:!0,helperText:"Showcases hero ingredients on the product detail page with imagery and descriptions",subFields:[{name:"featuredIngredientsHeading",friendlyName:"Featured Ingredients Heading",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The heading displayed above the featured ingredients list"},{name:"featuredIngredient",friendlyName:"Featured Ingredient",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"featuredIngredientImage",friendlyName:"Featured Ingredient Image",type:"file",required:!1,localized:!0,defaultCollapsed:!0,allowedFileTypes:["jpeg","png","svg","webp","gif"],helperText:"Image representing this featured ingredient"},{name:"featuredIngredientTitle",friendlyName:"Featured Ingredient Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Display name for this featured ingredient"},{name:"featuredIngredientDescription",friendlyName:"Featured Ingredient Description",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Description of this featured ingredient"}]}]},{name:"whatsInside",friendlyName:"What's Inside Accordion Items",type:"object",required:!1,defaultCollapsed:!0,helperText:"Accordion items detailing what's inside the product (ingredients, components, etc.)",subFields:[{name:"whatsInsideItems",friendlyName:"What's Inside Accordion Items",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The title shown in the accordion header"},{name:"description",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The content shown when the accordion is expanded"}]}]},{name:"faqs",friendlyName:"FAQ Accordion Items",type:"object",required:!1,defaultCollapsed:!0,helperText:"Frequently asked questions displayed in an accordion on the product detail page",subFields:[{name:"faqItem",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"faqTitle",friendlyName:"FAQ Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The question shown in the accordion header"},{name:"faqDescription",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The answer shown when the accordion is expanded"}]}]},{name:"supplementFacts",friendlyName:"Supplement Facts",type:"object",required:!1,defaultCollapsed:!0,helperText:"Supplement facts labels displayed on the product detail page",subFields:[{name:"supplementFactsLabel",friendlyName:"Supplement Facts Label",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"supplementFactsLabelTitle",friendlyName:"Supplement Facts Label Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Title for this supplement facts label (e.g. flavor or variant name)"},{name:"supplementFactsLabelHtml",friendlyName:"Supplement Facts Label HTML",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"HTML content of the supplement facts label"}]}]},{name:"servingsPerUnit",friendlyName:"Servings Per Unit",type:"number",defaultValue:void 0,required:!1,defaultCollapsed:!0,localized:!1,helperText:"Typical number of servings (or doses, days of supply) per unit. Used to auto-calculate default subscription frequency for funnel offers (servingsPerUnit × quantity). Defaults to 30 if not set."},{name:"name",friendlyName:"Name",type:"text",required:!0,defaultCollapsed:!0,localized:!1,helperText:"Internal name for the product, used for identification in the CMS"},{name:"components",friendlyName:"Bundle Components",type:"list",required:!1,defaultCollapsed:!1,helperText:"The individual products included in this bundle",showIf:"return options.get('gh')?.get(\"type\") === 'Bundle'",subFields:[{name:"slug",friendlyName:"Slug",type:"text",required:!0,defaultCollapsed:!1,helperText:"The unique identifier for this bundle component"},{name:"displayName",friendlyName:"Display Name",type:"text",localized:!0,defaultCollapsed:!1,helperText:"The name shown for this component on the product page"},{name:"description",friendlyName:"Description",type:"html",required:!1,defaultCollapsed:!1,helperText:"Use this to provide a description display beneath this component on the offer selector."}]},{name:"gh",friendlyName:"Golden Hippo Integration Data",helperText:"Stores integration data for Golden Hippo. Do not modify any of these values.",type:"object",subFields:[{name:"slug",friendlyName:"Page Slug",type:"text",required:!0,localized:!1,defaultCollapsed:!0,helperText:"This is the URL slug for this product. This value is unique and required for cross-environment development. Do not modify this value."},{name:"productionId",friendlyName:"Production ID",type:"text",required:!0,localized:!1,defaultCollapsed:!0,helperText:"This is the unique identifier for this product in the production environment. Do not modify this value."},{name:"type",friendlyName:"Product Type",type:"select",required:!0,localized:!1,defaultCollapsed:!0,enum:["Product","Bundle","Trial Size"],defaultValue:"Product",helperText:"Determines how this product is handled — Product, Bundle, or Trial Size"}],defaultCollapsed:!0,localized:!1}]}))(e)}productGroupModel(e,t){return((e,t)=>({name:"product-group",displayName:"Product Group",kind:"data",helperText:"Groups related products together (e.g. flavors, trial sizes).",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,defaultCollapsed:!0,localized:!0,helperText:"The display name of this product group."},{name:"featuredImage",friendlyName:"Featured Image",type:"file",defaultCollapsed:!0,showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"The primary image of this product group."},{name:"subHeading",friendlyName:"Sub Heading",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short tagline displayed beneath the group name."},{name:"gridTagline",friendlyName:"Grid Tagline",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short tagline displayed on product grid cards."},{name:"shortDescription",friendlyName:"Short Description",type:"html",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short description of the product group."},{name:"products",friendlyName:"Products",type:"list",defaultCollapsed:!0,helperText:"The products in this group.",subFields:[{name:"product",friendlyName:"Product",type:"reference",defaultCollapsed:!1,modelId:e,copyOnAdd:!1,helperText:"Select a product to include in this group"},{name:"displayName",friendlyName:"Display Name",type:"text",defaultCollapsed:!1,localized:!0,helperText:"Override display name for this product in the group context."},{name:"isTrialSize",friendlyName:"Is Trial Size",type:"boolean",defaultCollapsed:!1,helperText:"Whether this product is a trial size variant."}]},{name:"selectionLabel",friendlyName:"Selection Label",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:'Label for the product selector (e.g. "Choose your flavor").'},{name:"hidden",friendlyName:"Hide Group",type:"boolean",required:!1,defaultCollapsed:!0,localized:!1,helperText:"When true, this product group will not be displayed."},{name:"gh",friendlyName:"Golden Hippo",type:"object",defaultCollapsed:!0,helperText:"Integration data for Golden Hippo. Do not modify these values.",subFields:[{name:"productionId",friendlyName:"Production ID",type:"text",defaultCollapsed:!1,helperText:"The production environment content ID for this product group."},{name:"slug",friendlyName:"Slug",type:"text",defaultCollapsed:!1,helperText:"URL slug for this product group."}]},{name:"groupType",friendlyName:"Group Type",type:"select",defaultCollapsed:!0,enum:[lf.FlavorOptionGroup,lf.TrialGroup],helperText:"The type of product grouping."},{name:"name",friendlyName:"Group Name",type:"text",required:!0,defaultCollapsed:!0,localized:!1,helperText:"The internal name for this product group."},{name:"informationCallout",friendlyName:"Information Callout",type:"reference",required:!1,modelId:t,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Optional content section displayed alongside this product group"}]}))(e,t)}productGridConfigModel(e){return(e=>({name:"product-grid-filter-group",displayName:"Product Grid Filter Group",kind:"data",helperText:"Build filter group configurations. These can be applied in the brand configuration",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name/Label",type:"text",localized:!0,defaultCollapsed:!1,helperText:"Provide a name to display for this grouping",makeEntryTitle:!0},{name:"categories",friendlyName:"Categories",helperText:"Categories for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"category",friendlyName:"Category",type:"reference",modelId:e.categoryId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a category to include in this filter group"}]},{name:"ingredients",friendlyName:"Ingredients",helperText:"Ingredients for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"ingredient",friendlyName:"Ingredient",type:"reference",modelId:e.ingredientId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select an ingredient to include in this filter group"}]},{name:"useCases",friendlyName:"Use Cases",helperText:"Use Cases for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"useCase",friendlyName:"Use Case",type:"reference",modelId:e.useCaseId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a use case to include in this filter group"}],copyOnAdd:!1},{name:"tags",friendlyName:"Tags",helperText:"Tags for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"tag",friendlyName:"Tag",type:"reference",modelId:e.tagId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag to include in this filter group"}],copyOnAdd:!1},{name:"filterApplicationType",friendlyName:"Filter Application Type",type:"select",enum:[uf.Inclusive,uf.Exclusive],defaultValue:"Inclusive",required:!1,defaultCollapsed:!0,helperText:"Select how this filter is applied in relation to other filters. When set to Exclusive, ALL results must match a selected filter of this group."}]}))(e)}brandConfig(e,t){return((e,t)=>({name:"gh-brand-config",kind:"data",displayName:"Brand Configuration",helperText:"Manage global features and settings for your website",contentTitleField:void 0,fields:[...sf(t),{name:"header",friendlyName:"Header",type:"object",defaultCollapsed:!0,subFields:[{name:"headerType",friendlyName:"Type",helperText:"Select the type of header to use",defaultCollapsed:!0,type:"select",enum:[Kh.BASIC,Kh.MEDIUM,Kh.MEGA,Kh.LINKLESS,Kh.NONE,Kh.DMP,Kh.CMS],defaultValue:"MEDIUM"},Zh.basic,Zh.medium,Zh.mega,Zh.dmp,Zh.cms]},{name:"footer","@type":"@builder.io/core:Field",friendlyName:"Footer",type:"object",defaultCollapsed:!0,helperText:"Footer layout and content settings",subFields:[{name:"footerType",friendlyName:"Footer Type",type:"select",enum:[Xh.BASIC,Xh.MEGA,Xh.NONE,Xh.CMS],defaultValue:Xh.BASIC,defaultCollapsed:!0,helperText:"Choose the footer layout style for the website"},{"@type":"@builder.io/core:Field",name:"cmsFooterConfig",showIf:"return options.get('footerType') === 'CMS'",friendlyName:"CMS Footer Config",helperText:"Reference a footer created in Builder CMS to use as the website footer.",type:"reference",model:"footer",copyOnAdd:!1,localized:!1,required:!0,defaultCollapsed:!0}]},nf(e),{name:"support",friendlyName:"Support Information",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Contact information displayed to customers on the website",subFields:[{name:"email",friendlyName:"Support Email",type:"text",required:!0,localized:!0,helperText:"Email address for customer support inquiries",defaultCollapsed:!0},{name:"phone",friendlyName:"Support Phone Number",type:"text",required:!0,localized:!0,helperText:"Phone number for customer support inquiries",defaultCollapsed:!0},{name:"phoneDisplay",friendlyName:"Support Phone Display",type:"text",required:!0,localized:!0,helperText:"Formatted phone number for display",defaultCollapsed:!0},{name:"address",friendlyName:"Support Address",type:"object",required:!0,localized:!1,helperText:"Support address for customer inquiries",defaultCollapsed:!0,subFields:[{name:"street",friendlyName:"Street",type:"text",required:!0,helperText:"Street address for support",defaultCollapsed:!0},{name:"city",friendlyName:"City",type:"text",required:!0,helperText:"City for support address",defaultCollapsed:!0},{name:"state",friendlyName:"State Code",type:"text",required:!0,helperText:"State code for support address (e.g. CA)",defaultCollapsed:!0},{name:"zipcode",friendlyName:"Zip Code",type:"text",required:!0,helperText:"Zip code for support address",defaultCollapsed:!0}]},{name:"addressString",friendlyName:"Support Address String",type:"text",required:!1,localized:!1,helperText:"The full support address as a string",defaultCollapsed:!0}]},{name:"pageConfig",friendlyName:"Page Configurations",type:"object",defaultCollapsed:!0,subFields:[{name:"accountDetails",friendlyName:"Account Details Page",type:"object",defaultCollapsed:!0,subFields:[{name:"birthdayBannerConfig",friendlyName:"Birthday Banner Configuration",type:"object",defaultCollapsed:!0,subFields:[{name:"content",friendlyName:"Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"linkText",friendlyName:"Link Text",type:"text",localized:!0,defaultCollapsed:!0},{name:"linkUrl",friendlyName:"Link URL",type:"url",required:!1,localized:!0,defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"display",friendlyName:"Display",type:"text",defaultCollapsed:!0},{name:"alignItems",friendlyName:"Align Items",type:"text",defaultCollapsed:!0},{name:"margin",friendlyName:"Margin",type:"text",defaultCollapsed:!0},{name:"padding",friendlyName:"Padding",type:"text",defaultCollapsed:!0},{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0}]}]}]},{name:"cart",friendlyName:"Cart Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"continueShoppingUrl",friendlyName:"Continue Shopping URL",type:"url",required:!1,localized:!1,defaultCollapsed:!0},{name:"groupCartContentsByPurchaseType",friendlyName:"Indicates whether cart contents should be grouped by subscription and one-time purchases",type:"boolean",required:!0,localized:!0,defaultCollapsed:!0},{name:"enabledCartFrequencyToggle",friendlyName:"Determine whether we show a frequency toggle on the cart page and on the cart drawer",type:"boolean",required:!0,localized:!0,defaultCollapsed:!0},{name:"imageContainerBGColor",friendlyName:"Background color for Image Container",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"freeShippingBanner",friendlyName:"Free Shipping Banner Configuration",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Show Free Shipping Banner",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0},{name:"loggedOutBannerContent",friendlyName:"Logged Out Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"loggedInBannerContent",friendlyName:"Logged In Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0}]}]},{name:"notices",friendlyName:"Cart Notices",type:"object",defaultCollapsed:!0,subFields:[{name:"securePaymentNotice",friendlyName:"Secure Payment Notice",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",localized:!0,helperText:"Show the secure payment notice on the cart page",defaultCollapsed:!0},{name:"text",friendlyName:"Text",type:"html",required:!1,localized:!0,helperText:"Content for the secure payment notice",defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",helperText:"Styles for the secure payment notice",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",defaultCollapsed:!0}]}]}]},{name:"subscriptionUpgradeModuleEnabled",friendlyName:"Determine whether we show Subscription Upgrade Module on the cart page",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0}]},{name:"checkout",friendlyName:"Checkout Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"freeShippingBanner",friendlyName:"Free Shipping Banner",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the free shipping banner on the checkout page",defaultCollapsed:!0},{name:"loggedOutBannerContent",friendlyName:"Logged Out Banner Content",type:"html",required:!1,localized:!0,helperText:"Content for the free shipping banner when the user is not logged in",defaultCollapsed:!0},{name:"loggedInBannerContent",friendlyName:"Logged In Banner Content",type:"html",required:!1,localized:!0,helperText:"Content for the free shipping banner when the user is logged in",defaultCollapsed:!0}]},{name:"securePaymentNotice",friendlyName:"Secure Payment Notice",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the secure payment notice on the checkout page",defaultCollapsed:!0},{name:"content",friendlyName:"Content",type:"html",required:!1,localized:!0,helperText:"Content for the secure payment notice",defaultCollapsed:!0}]},{name:"autoSignUp",friendlyName:"Auto Sign Up",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the secure payment notice on the checkout page",defaultCollapsed:!0},{name:"isChecked",friendlyName:"Checked by Default",type:"boolean",required:!1,localized:!0,helperText:"Whether the checkbox is checked by default",defaultCollapsed:!0},{name:"labelText",friendlyName:"Label Text",type:"html",required:!1,localized:!0,helperText:"Text for the auto sign up checkbox",defaultCollapsed:!0},{name:"helpModal",friendlyName:"Help Modal",type:"object",defaultCollapsed:!0,subFields:[{name:"header",friendlyName:"Header",type:"html",required:!1,localized:!0,helperText:"Header content for the auto sign up help modal",defaultCollapsed:!0},{name:"content",friendlyName:"Content",type:"html",required:!1,localized:!0,helperText:"Content for the auto sign up help modal",defaultCollapsed:!0}]}]},{name:"smsOptIn",friendlyName:"SMS Opt In",helperText:"Use these settings to control whether you offer SMS sign up on the checkout form.",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Enabled?",type:"boolean",required:!1,localized:!0,helperText:"Show SMS opt-in at checkout to guests or returning customers who have not yet opted-in",defaultCollapsed:!0},{name:"title",friendlyName:"Title",type:"text",required:!1,localized:!0,helperText:"The text to display on this section title",defaultCollapsed:!0},{name:"content",friendlyName:"CTA Content",type:"html",required:!1,localized:!0,helperText:"Text for the SMS sign up CTA.",defaultCollapsed:!0}]}]},{name:"orderDetails",friendlyName:"Order Details Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"title",friendlyName:"Title",type:"html",required:!1,localized:!0,helperText:"Title for the order details section on the checkout page",defaultCollapsed:!0},{name:"tableHeaderStyle",friendlyName:"Table Header Style",type:"object",required:!1,localized:!1,helperText:"Style for the order details table header",defaultCollapsed:!0,subFields:[{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,helperText:"Text color for the order details table header",defaultCollapsed:!0},{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,helperText:"Background color for the order details table header",defaultCollapsed:!0}]},{name:"tableContentStyle",friendlyName:"Table Content Style",type:"object",required:!1,localized:!1,helperText:"Style for the order details table content",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,helperText:"Background color for the order details table content",defaultCollapsed:!0}]},{name:"buyItAgainButton",friendlyName:"Buy It Again Button",type:"object",required:!1,localized:!1,defaultCollapsed:!0,helperText:'Configuration for the "Buy It Again" button in the order details section',subFields:[{name:"text",friendlyName:"Button Text",type:"html",required:!1,localized:!0,helperText:'Text to display on the "Buy It Again" button',defaultCollapsed:!0},{name:"classes",friendlyName:"Classes",type:"text",required:!1,localized:!1,helperText:'CSS classes to apply to the "Buy It Again" button',defaultCollapsed:!0}]},{name:"reOrderAllButton",friendlyName:"Re-Order All Button",type:"object",required:!1,localized:!1,defaultCollapsed:!0,helperText:'Configuration for the "Re-Order All" button in the order details section',subFields:[{name:"text",friendlyName:"Button Text",type:"html",required:!1,localized:!0,helperText:'Text to display on the "Re-Order All" button',defaultCollapsed:!0},{name:"classes",friendlyName:"Classes",type:"text",required:!1,localized:!1,helperText:'CSS classes to apply to the "Re-Order All" button',defaultCollapsed:!0}]}]},{name:"resetPassword",friendlyName:"Reset Password Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"title",friendlyName:"Page Title",type:"html",required:!1,localized:!0,helperText:"Title for the reset password page",defaultCollapsed:!0}]},{name:"subscriptionCancel",friendlyName:"Subscription Cancellation Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"cancelText",friendlyName:"Cancel Text",type:"html",required:!1,localized:!0,helperText:"Text displayed on the subscription cancellation page",defaultCollapsed:!0},{name:"cancelReasons",friendlyName:"Cancel Reasons",type:"list",required:!1,localized:!0,defaultCollapsed:!0,helperText:"List of reasons for subscription cancellation",subFields:[{name:"title",friendlyName:"Reason",type:"text",required:!0,helperText:"The reason for cancellation.",localized:!0,makeEntryTitle:!0,defaultCollapsed:!0},{name:"text",friendlyName:"Display Content",type:"html",required:!1,helperText:"This is the content that will be displayed for this cancellation reason",localized:!0,defaultCollapsed:!0},{name:"identifier",friendlyName:"Identifier",type:"select",required:!0,defaultCollapsed:!0,helperText:"System identifier for this cancellation reason — used for analytics tracking",enum:[rf.DoNotLike,rf.NotWorking,rf.NoBenefits,rf.NoFitNoNeed,rf.Budget,rf.Mistake,rf.Try,rf.TooMuch,rf.TravelMove,rf.DoNotNeed,rf.AnotherReason,rf.NotHelpingSkin,rf.SkinImproved,rf.PetDoesNotLike,rf.NotHelpingPet,rf.NoneGiven]},{name:"buttons",friendlyName:"Buttons",type:"list",required:!1,defaultCollapsed:!0,subFields:[{name:"text",friendlyName:"Button Text",type:"text",required:!1,helperText:"Text to display on the button",defaultCollapsed:!0},{name:"link",friendlyName:"Button Link",type:"url",required:!1,helperText:"URL to navigate to when this button is clicked",defaultCollapsed:!0},{name:"type",type:"select",friendlyName:"Button Type",required:!1,helperText:"Determines the button behavior — links navigate away, while other types trigger actions",enum:[of.Link,of.Update,of.Keep,of.Continue,of.Cancel],defaultValue:"link",defaultCollapsed:!0}],helperText:"Buttons to display for this cancellation reason."}]}]},{name:"subscriptionEdit",friendlyName:"Subscription Edit",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"subscriptionItemDefaultImage",friendlyName:"Subscription Item Default Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!1,defaultCollapsed:!0,helperText:"Default image to display for subscription items"},{name:"shipNow",friendlyName:"Ship Now",type:"object",required:!1,defaultCollapsed:!0,localized:!1,subFields:[{name:"modalHeadlineContent",friendlyName:"Modal Headline Content",type:"html",required:!0,helperText:"Headline text displayed in the Ship Now modal",localized:!0,defaultCollapsed:!0},{name:"modalContent",friendlyName:"Modal Content",type:"html",required:!0,helperText:"Main content displayed in the Ship Now modal. You can use $FREQUENCY and it will be replaced with the frequency of the subscription.",localized:!0,defaultCollapsed:!0}]}]},{name:"upsell",friendlyName:"Upsell Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"mbgImage",friendlyName:"Money Back Guarantee Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed on the upsell page for the money back guarantee"},{name:"mbgText",friendlyName:"Money Back Guarantee Text",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Text displayed on the upsell page for the money back guarantee"}]}]},{name:"cookieConfig",friendlyName:"Cookie Configuration",type:"object",defaultCollapsed:!0,helperText:"Settings for the cookie consent popup displayed to visitors",subFields:[{name:"popupBanner",friendlyName:"Cookie Policy Popup Banner",type:"object",defaultCollapsed:!0,helperText:"Configure the cookie policy popup banner",subFields:[{name:"content",friendlyName:"Content",type:"html",localized:!0,defaultCollapsed:!0,helperText:"Content for the cookie policy popup banner"},{name:"bannerStyles",friendlyName:"Banner Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,defaultCollapsed:!0},{name:"borderRadius",friendlyName:"Border Radius",type:"text",required:!1,defaultCollapsed:!0}]},{name:"buttonStyles",friendlyName:"Button Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,defaultCollapsed:!0}]}]}]},{name:"seo",friendlyName:"SEO",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Search engine optimization settings for the brand",subFields:[{name:"description",friendlyName:"Site Description",type:"longText",defaultCollapsed:!1,helperText:"Default meta description for the website, used when pages do not provide their own"},{name:"knowsAbout",friendlyName:"Topics",type:"Tags",defaultCollapsed:!1,helperText:"Topics the brand is knowledgeable about, used in structured data for search engines"}]}]}))(e,t)}siteBanner(e){return(e=>({name:"banner",kind:"component",displayName:"Banner / Announcement",helperText:"Banners / Announcements to display on your website",contentTitleField:void 0,fields:[{name:"position",friendlyName:"Banner Position",type:"select",enum:[hf.AboveHeader,hf.BelowHeader],defaultValue:"Above Header",helperText:"Select where this banner should appear on the page",defaultCollapsed:!0}],editingUrlLogic:"return `"+e+"/builder-banner-section?builder.preview=true&builder.frameEditing=true`"}))(e)}defaultWebsiteSection(e){return(e=>({name:"default-website-section",kind:"component",displayName:"Default Website Section",helperText:"Default section for the website",contentTitleField:void 0,fields:[{name:"sectionType",friendlyName:"Section Type",type:"select",required:!0,localized:!1,defaultCollapsed:!0,enum:["cartPageAboveSummaryContent","cartPageBelowSummaryContent","cartPageEmptyCartContent","cartPageTopSectionContent","gdprContent","mainFooter","offerSelectorAboveCTAContent","offerSelectorBelowCTAContent","subscriptionManagementNoSubsContent","subscriptionCancellationContent","notFoundContent","productNotAvailableContent"],helperText:"Choose where this content section appears on the website"}],editingUrlLogic:"return `"+e+"/builder-default-website-section?builder.preview=true&builder.frameEditing=true`"}))(e)}subscriptionCancellationPanel(e){return(e=>({name:"subscription-cancellation-panel",kind:"component",displayName:"Subscription Cancellation Panel",helperText:"Panel that is available as part of the subscription cancellation flow",contentTitleField:void 0,fields:[{name:"panelType",friendlyName:"The type of panel",type:"text",required:!1,localized:!1,defaultCollapsed:!0}],editingUrlLogic:"return `"+e+"/builder-subscription-cancellation-panel-section?builder.preview=true&builder.frameEditing=true`"}))(e)}upsellTemplate(e){return(e=>({name:"upsell-template",kind:"component",displayName:"Upsell Template",helperText:"Upsell offer page template",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-upsell-template?builder.preview=true&builder.frameEditing=true`"}))(e)}headerModel(e){return(e=>({name:"header",kind:"component",displayName:"Header",helperText:"CMS controlled global header",contentTitleField:void 0,fields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",defaultValue:"transparent",helperText:"Select the background color for the header",defaultCollapsed:!1}],editingUrlLogic:"return `"+e+"/builder-header-section?builder.preview=true&builder.frameEditing=true`"}))(e)}footerModel(e){return(e=>({name:"footer",kind:"component",displayName:"Footer",helperText:"CMS controlled global footer",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-footer-section?builder.preview=true&builder.frameEditing=true`"}))(e)}offerSelectorContentModel(e){return(e=>({name:"offer-selector-content",kind:"component",displayName:"Offer Selector Content",helperText:"Add custom content in offer selector section",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-offer-selector-content?builder.preview=true&builder.frameEditing=true`"}))(e)}promotionalCardModel(e,t){return((e,t)=>({name:"promotional-card",kind:"component",displayName:"Promotional Card",helperText:"Create a promotional card to display in product grid page and more.",contentTitleField:void 0,fields:[{name:"rank",friendlyName:"Rank",type:"number",defaultValue:void 0,required:!1,localized:!1,defaultCollapsed:!1,helperText:"Lower shows first. Only used when no Product is set, or to order multiple cards on the same product."},{name:"product",friendlyName:"Product",type:"reference",modelId:e,required:!1,copyOnAdd:!1,defaultCollapsed:!1,helperText:"Places this card right after the chosen product. Leave empty to position by Rank."}],editingUrlLogic:"return `"+t+"/builder-promotional-card?builder.preview=true&builder.frameEditing=true`"}))(e,t)}pageModel(e){return(e=>{const{productModelId:t,productGroupModelId:n,categoryModelId:r,bannerModelId:o,blogCategoryModelId:i,sectionModelId:s,editUrl:a}=e;return{name:"page",displayName:"Page",kind:"page",helperText:"Default model for creating pages",contentTitleField:void 0,fields:[{name:"title",friendlyName:"Title",type:"text",required:!0,helperText:"A short title for this page. If the SEO Page Title is not provided, this field is used for SEO. This field is not localized, so it is highly suggested to use the Heading.",defaultCollapsed:!1},{name:"pageType",friendlyName:"Page Type",type:"select",defaultValue:ff.GENERAL,required:!0,helperText:"Select the type of page. This will determine which components are added automatically.",enum:[ff.GENERAL,ff.BLOG,ff.PRODUCT],defaultCollapsed:!1},{name:"pdp",friendlyName:"Product Detail Page",type:"object",required:!1,subFields:[{name:"type",friendlyName:"Product Page Type",type:"select",defaultValue:mf.PRODUCT,required:!0,helperText:"Choose whether this is a single product, product group, or multi-group page",enum:[mf.PRODUCT,mf.PRODUCT_GROUP,mf.MULTI_GROUP],defaultCollapsed:!1},{name:"product",friendlyName:"Product",type:"reference",required:!1,helperText:"Select the product to display",modelId:t,copyOnAdd:!0,showIf:"return options.get('type') === 'Product'",defaultCollapsed:!1},{name:"productGroup",friendlyName:"Product Group",type:"reference",required:!1,helperText:"Select the product group to display",modelId:n,copyOnAdd:!0,showIf:"return options.get('type') === 'Product Group'",defaultCollapsed:!1},{name:"pdpTitle",friendlyName:"Display Title",type:"text",localized:!0,required:!0,helperText:'For multi-group selectors, provide the "product" title to present.',showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1},{name:"pdpDescription",friendlyName:"Description",type:"html",localized:!0,required:!1,helperText:'For multi-group selectors, provide the "product" description to present.',showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1},{name:"multiProductGroup",friendlyName:"Product Groups",type:"list",required:!1,localized:!1,helperText:"Add the product groups to include in this multi-group page",showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1,subFields:[{name:"group",friendlyName:"Product Group",type:"reference",required:!0,helperText:"Select a product group to include",modelId:n,copyOnAdd:!0,defaultCollapsed:!1},{name:"optionsOverrides",friendlyName:"Offer Options",type:"list",localized:!0,required:!1,copyOnAdd:!1,defaultCollapsed:!1,helperText:"Override the default offer options for this product group",subFields:[{name:"quantity",friendlyName:"Quantity",type:"number",required:!1,defaultValue:void 0,defaultCollapsed:!1,helperText:"The quantity for this offer option"},{name:"description",friendlyName:"Description",type:"html",localized:!0,required:!1,defaultCollapsed:!1,helperText:"Description displayed for this offer option"},{name:"pillLabel",friendlyName:"Pill Label",type:"text",localized:!0,required:!1,defaultCollapsed:!1,helperText:'Text shown in the pill badge for this option (e.g. "Most Popular")'},{name:"pillColor",friendlyName:"Pill Color",type:"color",required:!1,defaultCollapsed:!1,helperText:"Background color of the pill badge"}]},{name:"pillLabel",friendlyName:"Pill Label",type:"text",localized:!0,required:!1,helperText:"(Optional) If provided, used to apply a pill on this option (e.g. Most Popular).",defaultCollapsed:!1}]},{name:"slides",friendlyName:"Product Slides",type:"list",required:!1,subFields:[{name:"image",friendlyName:"Image",type:"file",required:!0,helperText:"Upload a product slide image",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Select the image slides to display for this product. If no slides are provided, the product's default image will be used.",copyOnAdd:!0,defaultCollapsed:!1},{name:"slideThumbs",friendlyName:"Product Slides Thumbnails",type:"list",required:!1,subFields:[{name:"image",friendlyName:"Image",type:"file",required:!0,helperText:"Upload a thumbnail image",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Select the image thumbnails slides to display for this product. If no slides are provided, the Product Slides will be used",copyOnAdd:!0,defaultCollapsed:!1},{name:"sliderComponent",type:"select",enum:[yf.SLIDER_A,yf.SLIDER_B,yf.SLIDER_ZOOM],friendlyName:"Slider Component",defaultValue:yf.SLIDER_A,required:!1,helperText:"Select the style slider component to use for the product images",defaultCollapsed:!1},{name:"reviewSettings",friendlyName:"Review Settings",type:"object",required:!1,subFields:[{name:"showStarRating",type:"boolean",friendlyName:"Show Star Rating",required:!1,defaultValue:!0,helperText:"Display this product's average rating.",defaultCollapsed:!1},{name:"showGlobalFiveStarRating",type:"boolean",friendlyName:"Show Global Five Star Rating",required:!1,helperText:"Display the total 5 Star ratings received by this brand",defaultCollapsed:!1},{name:"globalRatingText",type:"html",localized:!0,friendlyName:"Global Rating Text",required:!1,helperText:'This is displayed after the count of global 5-star reviews (e.g. "5,000+ [your text here]")',defaultCollapsed:!1,showIf:'return !!(options.get("showGlobalFiveStarRating"))'},{name:"globalRatingLink",type:"url",friendlyName:"Global Rating Link",required:!1,helperText:"When provided, the number of reviews will be clickable.",defaultCollapsed:!1,showIf:'return !!(options.get("showGlobalFiveStarRating"))'}],helperText:"Configure how the reviews are displayed",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"hideNativeOfferSelector",friendlyName:"Hide Native Offer Selector",helperText:"Set to true to fully hide the native Offer Selector to provide your own (e.g. via VWO)",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"offerSelector",friendlyName:"Offer Selector",type:"object",required:!1,subFields:[{name:"osType",friendlyName:"Type",type:"select",defaultValue:gf.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE,required:!1,helperText:"Select the type of offer selector to display",enum:[gf.VERTICAL,gf.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE,gf.STACKED__FLAVOR_BUTTONS__QUANTITY_TOGGLE,gf.BUNDLE_GROUP,gf.VERTICAL_FLAVOR_BUTTONS_TOGGLE],defaultCollapsed:!1},{name:"features",friendlyName:"Features",type:"object",required:!1,helperText:"Configure behavior and defaults for the offer selector",subFields:[{name:"defaultPurchaseType",friendlyName:"Default Purchase Type",type:"select",defaultValue:bf.ONE_TIME,required:!1,helperText:"When both purchase options are available to the customer, this is the option that will be selected by default.",enum:[bf.ONE_TIME,bf.SUBSCRIPTION],defaultCollapsed:!1},{name:"preferredQuantity",friendlyName:"Initial Offer Quantity",type:"number",defaultValue:3,required:!1,helperText:"Enter the quantity you would prefer users see first. If that quantity is not available,\n we will locate the closest quantity available (defaults to 3 if not set).",defaultCollapsed:!1},{name:"showSavings",friendlyName:"Show Savings?",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Display the savings amount on each offer option",defaultCollapsed:!1},{name:"savingsType",friendlyName:"Savings Type",type:"select",defaultValue:xf.PERCENT,required:!1,helperText:"When showing savings, display as a percentage or value saved.",enum:[xf.PERCENT,xf.DOLLAR],defaultCollapsed:!1},{name:"showMemberPriceMessage",friendlyName:"Show Member Price Message",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Show the member price message below the offer selector",defaultCollapsed:!1},{name:"showSubscriptionPriceMessage",friendlyName:"Show Subscription Price Message",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Show the subscription price message below the offer selector",defaultCollapsed:!1},{name:"scrollToTopOffset",friendlyName:"Scroll to Top Offset (px)",type:"number",defaultValue:170,required:!1,helperText:'The number of pixels to offset the Scroll to Top button. Note: The label for this button may be set in the "Labels" section.',defaultCollapsed:!1},{name:"enableAnonymousSubscriptions",friendlyName:"Always Show Subscriptions",type:"boolean",defaultValue:!1,required:!1,helperText:"Enable this to present subscriptions (when available) to non-MyAccount visitors. By default, a user must be logged in to access this option.",defaultCollapsed:!1,hidden:!1,advanced:!0}],defaultCollapsed:!1},{name:"labels",friendlyName:"Labels",type:"object",defaultValue:{quantitySelector:{"@type":"@builder.io/core:LocalizedValue"},actionButton:{Default:"ADD TO CART"},subscriptionOffer:{Default:"Or $PRICE when you subscribe & save"},flavorSelector:{Default:"Choose a flavor"},otpToggle:{Default:"Single purchase"},memberOffer:{Default:"Or pay member price of"},scrollButton:{Default:'<span class="material-icons">keyboard_arrow_up</span> Back to top'},outOfStock:{Default:'Sorry, we"re currently out of stock'},outOfStockFormSuccess:{Default:'<p class="text-center">We will notify you as soon as this item is back in stock.</p>'},subscriptionToggle:{Default:"Subscribe & save"}},required:!1,subFields:[{name:"actionButton",friendlyName:"Action Button",type:"text",defaultValue:{Default:"ADD TO CART"},required:!1,helperText:'Text on the main call-to-action button (e.g. "ADD TO CART")',defaultCollapsed:!1},{name:"subscriptionOffer",friendlyName:"Subscription Offer",type:"text",defaultValue:{Default:"Or $PRICE when you subscribe & save"},required:!1,helperText:"Use $PRICE to represent the price, this will be automatically replaced.",defaultCollapsed:!1},{name:"memberOffer",friendlyName:"Member Offer",type:"text",defaultValue:{Default:"Or pay member price of"},required:!1,helperText:'Message shown for member pricing (e.g. "Or pay member price of")',defaultCollapsed:!1},{name:"subscriptionToggle",friendlyName:"Subscription Toggle",type:"text",defaultValue:{Default:"Subscribe & save"},required:!1,helperText:"The label for the button when selecting a subscription",defaultCollapsed:!1},{name:"otpToggle",friendlyName:"One-Time Purchase Toggle",type:"text",defaultValue:{Default:"Single purchase"},required:!1,helperText:"The label for the button when selecting a single purchase (otp).",defaultCollapsed:!1},{name:"outOfStock",friendlyName:"Out of Stock",type:"text",defaultValue:{Default:'Sorry, we"re currently out of stock'},required:!1,helperText:"The text to display when this product is marked as Out of Stock.",defaultCollapsed:!1},{name:"outOfStockFormSuccess",friendlyName:"Out of Stock Form Success Message",type:"html",defaultValue:{Default:'<p class="text-center">We will notify you as soon as this item is back in stock.</p>'},required:!1,helperText:"The message displayed when a user requests to be notified when this product is back in stock.",defaultCollapsed:!1},{name:"scrollButton",friendlyName:"Scroll Button Content",type:"html",defaultValue:{Default:'<span class="material-icons">keyboard_arrow_up</span> Back to top'},required:!1,helperText:"Content displayed in the scroll-to-top button",defaultCollapsed:!1},{name:"packageSelector",friendlyName:"Package Selector",type:"text",defaultValue:"Choose a package",required:!1,helperText:'Label for the package selector (e.g. "Choose a package")',defaultCollapsed:!1},{name:"flavorSelector",friendlyName:"Flavor / Option Selector",type:"text",defaultValue:{Default:"Choose a flavor"},required:!1,helperText:'Label for the flavor/option dropdown (e.g. "Choose a flavor")',defaultCollapsed:!1},{name:"quantitySelector",friendlyName:"Quantity Selector",type:"text",localized:!0,required:!1,helperText:"(Optional) Provide a label for the quantity selection. Only displayed if your selected offer selector supports this feature.",defaultCollapsed:!1}],helperText:"Customize the various labels on the offer selector",defaultCollapsed:!1},{name:"bestSellerImage",friendlyName:"Best Seller Image",type:"file",allowedFileTypes:["jpeg","png","svg","webp"],defaultValue:"https://cdn.builder.io/api/v1/image/assets%2Fcf992cf7343c4ca182a884e9a45f394e%2F3805efcc18184db8bccf74d5c5aaf891?format=webp",required:!1,helperText:"The small image to display alongside the best seller offer",defaultCollapsed:!0},{name:"bestValueImage",friendlyName:"Best Value Image",type:"file",defaultValue:"https://cdn.builder.io/api/v1/image/assets%2Fcf992cf7343c4ca182a884e9a45f394e%2F82105508987e4459bc4405617d4bee33",required:!1,helperText:"The small image to display alongside the best value offer (highest quantity)",allowedFileTypes:["jpeg","png","svg","webp"],defaultCollapsed:!0},{name:"content",friendlyName:"Custom Offer Selector Content",type:"object",required:!1,helperText:"Override the default offer selector content with custom content from Builder.",defaultCollapsed:!1,subFields:[{name:"aboveCTAContent",friendlyName:"Above CTA Content",type:"reference",required:!1,helperText:"Choose the content to display above the offer selector CTA",model:"offer-selector-content",copyOnAdd:!1,defaultCollapsed:!1},{name:"belowCTAContent",friendlyName:"Below CTA Content",type:"reference",required:!1,helperText:"Choose the content to display below the offer selector CTA",model:"offer-selector-content",copyOnAdd:!1,defaultCollapsed:!1}]},{name:"cssOverrides",friendlyName:"CSS Properties",type:"object",defaultValue:{},required:!1,helperText:"Advanced CSS customizations for the offer selector",subFields:[{name:"signupOfferCustomCssProps",friendlyName:"Signup Offer CSS",type:"map",required:!1,helperText:"Custom CSS properties for the signup offer section",defaultCollapsed:!1},{name:"signupOfferPriceCustomCssProps",friendlyName:"Signup Offer Price CSS",type:"map",required:!1,helperText:"Custom CSS properties for the signup offer price",defaultCollapsed:!1}],defaultCollapsed:!0}],helperText:"Configure the offer selector to display.",defaultCollapsed:!0,showIf:"return !(options.get('hideNativeOfferSelector'))"},{name:"category",type:"reference",required:!1,helperText:"Provide the category to display breadcrumb navigation",modelId:r,copyOnAdd:!0,friendlyName:"Category",defaultCollapsed:!1},{name:"desktopSliderOverride",friendlyName:"Slider Override (Desktop)",type:"reference",required:!1,helperText:"(Optional) Select content to display in place of your PDP's product image slider. Disables the slider on desktop. On mobile, this content is hidden and the standard slider is displayed.",modelId:s,copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Configure the PDP options",showIf:"return options.get('pageType') === 'Product'",defaultCollapsed:!1},{name:"blog",friendlyName:"Blog Configuration",type:"object",required:!1,subFields:[{name:"title",friendlyName:"Blog Title",helperText:"Provide a title for this blog when shown on a grid or list. If not provided, the page title will be used.",type:"text",required:!1,localized:!0,defaultCollapsed:!1},{name:"publicationDate",friendlyName:"Publication Date",type:"timestamp",helperText:"Provide the publication date, this is used for sorting.",required:!0,localized:!1,defaultCollapsed:!1},{name:"snippet",friendlyName:"Blog Snippet",helperText:"Provide a snippet of the blog to display when shown on a grid or list. If not provided, we will attempt to use the page description or SEO description (if available)",type:"longText",required:!1,localized:!0,defaultCollapsed:!1},{name:"author",friendlyName:"Blog Author",type:"text",helperText:"Provide an author for this blog to display when shown on a grid or list.",required:!1,localized:!1,defaultCollapsed:!1},{name:"thumbnail",friendlyName:"Blog Thumbnail",type:"file",required:!1,helperText:"Provide an image to display when shown on a grid or list. If not provided, we will attempt to use the SEO image (if available)",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1},{name:"categories",friendlyName:"Blog Categories",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,helperText:"Assign blog categories for filtering and navigation",subFields:[{name:"category",friendlyName:"Blog Category",type:"reference",modelId:i,required:!0,defaultCollapsed:!1,copyOnAdd:!1,helperText:"Select a blog category"}]}],helperText:"Configure the blog options",showIf:"return options.get('pageType') === 'Blog'",defaultCollapsed:!0},{name:"heading",friendlyName:"SEO Page Title",type:"text",required:!1,helperText:"Provide an alternate page title to use for SEO purposes (if blank, the page title is used)",defaultCollapsed:!1},{name:"description",friendlyName:"SEO Description",type:"longText",required:!1,helperText:"Set the page description for SEO here. This is automatically embedded in your page.",defaultCollapsed:!0},{name:"seoImage",friendlyName:"SEO Image",type:"file",required:!1,helperText:"Provide an image to be used for SEO purposes",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1},{name:"search",friendlyName:"Search Configuration",type:"object",required:!1,subFields:[{name:"title",friendlyName:"Search Title",type:"text",required:!1,helperText:"Used when showing this page in your site's search function. If no value is provided, the page title will be used.",defaultCollapsed:!1},{name:"description",friendlyName:"Search Description",type:"text",required:!1,helperText:"(Optional) Provide a description to be used when showing this page in search results. If no value is provided, the SEO description is used.",defaultCollapsed:!1},{name:"hide",friendlyName:"Hide from Search",type:"boolean",required:!1,helperText:"Use this to hide this page from search results. This does not prevent navigation to the page.",defaultCollapsed:!1},{name:"content",friendlyName:"Content",type:"longText",required:!1,helperText:"(Optional) Use this field to add keywords or phrases to assist in search results (e.g. related products, categories, key words, etc.)",defaultCollapsed:!1}],helperText:"Configure how this page displays in your site's built-in search results. Pages will not show in search results if neither the SEO or Search information is configured. You may also elect to hide the page from search results.",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"banners",friendlyName:"Banners",helperText:"Select the banner(s) to display on this page. These will be displayed in the\n order provided, but always below site-wide banners.",type:"list",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"banner",friendlyName:"Sitewide Banner",type:"reference",localized:!1,helperText:"Select the banner to display.",defaultCollapsed:!0,modelId:o,copyOnAdd:!1}]},{name:"disableStickyHeader",friendlyName:"Disable Sticky Header",helperText:"Disable the sticky header for this page only.",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"showBundleDrawer",friendlyName:"Show Bundle Drawer",helperText:"Enable the bundle drawer for this page.",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"robotsMeta",friendlyName:"Robots Meta",type:"object",required:!1,helperText:"Settings for the robots meta tag.",subFields:[{name:"noIndex",friendlyName:"No Index",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents pages from being indexed and displayed in search engine result pages"},{name:"noFollow",friendlyName:"No Follow",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents search engines from following links on the pages"},{name:"noArchive",friendlyName:"No Archive",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents search engines from showing Cached links for pages"},{name:"noImageIndex",friendlyName:"No Image Index",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"This option prevents images on a page from being indexed by Google and other search engines"},{name:"noSnippet",friendlyName:"No Snippet",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents a snippet from being shown in the search results"}],defaultCollapsed:!0}],editingUrlLogic:"return `"+a+"${targeting.urlPath}?builder.preview=true&builder.frameEditing=true`"}})(e)}blogCommentModel(e){return(e=>({...af,fields:[...af.fields,{name:"blog",friendlyName:"Blog Post",helperText:"The blog that this comment is linked to",type:"reference",modelId:e,required:!0,defaultCollapsed:!1,copyOnAdd:!1}]}))(e)}},am=[{name:"product-ingredient",displayName:"Product Ingredient",phase:1,dependencies:[],getShape:()=>sm.ingredientsModel},{name:"product-category",displayName:"Product Category",phase:1,dependencies:[],getShape:()=>sm.categoryModel},{name:"product-tag",displayName:"Product Tag",phase:1,dependencies:[],getShape:()=>sm.productTagModel},{name:"product-use-case",displayName:"Product Use Case",phase:1,dependencies:[],getShape:()=>sm.useCaseModel},{name:"profile-reference-rule",displayName:"Profile Reference Rule",phase:1,dependencies:[],getShape:()=>sm.profileReferenceRuleModel},{name:"recommendation-config",displayName:"Recommendation Config",phase:2,dependencies:["product-tag"],getShape:()=>sm.recommendationConfigModel},{name:"product",displayName:"Product",phase:2,dependencies:["product-ingredient","product-category","product-tag","product-use-case"],getShape:e=>sm.productModel({ingredientsModelId:e["product-ingredient"],categoryModelId:e["product-category"],tagModelId:e["product-tag"],useCaseModelId:e["product-use-case"]})},{name:"banner",displayName:"Site Banner",phase:3,dependencies:[],getShape:(e,t)=>sm.siteBanner(t)},{name:"blog-category",displayName:"Blog Category",phase:3,dependencies:[],getShape:()=>sm.blogCategoryModel},{name:"default-website-section",displayName:"Default Website Section",phase:3,dependencies:[],getShape:(e,t)=>sm.defaultWebsiteSection(t)},{name:"subscription-cancellation-panel",displayName:"Subscription Cancellation Panel",phase:3,dependencies:[],getShape:(e,t)=>sm.subscriptionCancellationPanel(t)},{name:"upsell-template",displayName:"Upsell Template",phase:3,dependencies:[],getShape:(e,t)=>sm.upsellTemplate(t)},{name:"header",displayName:"Header",phase:3,dependencies:[],getShape:(e,t)=>sm.headerModel(t)},{name:"footer",displayName:"Footer",phase:3,dependencies:[],getShape:(e,t)=>sm.footerModel(t)},{name:"offer-selector-content",displayName:"Offer Selector Content",phase:3,dependencies:[],getShape:(e,t)=>sm.offerSelectorContentModel(t)},{name:"promotional-card",displayName:"Promotional Card",phase:4,dependencies:["product"],getShape:(e,t)=>sm.promotionalCardModel(e.product,t)},{name:"product-group",displayName:"Product Group",phase:3.5,dependencies:["product","default-website-section"],getShape:e=>sm.productGroupModel(e.product,e["default-website-section"])},{name:"page",displayName:"Page",phase:4,dependencies:["product","product-group","product-category","banner","blog-category","default-website-section"],getShape:(e,t)=>sm.pageModel({productModelId:e.product,productGroupModelId:e["product-group"],categoryModelId:e["product-category"],bannerModelId:e.banner,blogCategoryModelId:e["blog-category"],sectionModelId:e["default-website-section"],editUrl:t})},{name:"blog-comment",displayName:"Blog Comment",phase:5,dependencies:["page"],getShape:e=>sm.blogCommentModel(e.page)},{name:"product-grid-filter-group",displayName:"Product Grid Filter Group",phase:6,dependencies:["product-category","product-use-case","product-ingredient","product-tag"],getShape:e=>sm.productGridConfigModel({categoryId:e["product-category"],useCaseId:e["product-use-case"],ingredientId:e["product-ingredient"],tagId:e["product-tag"]})},{name:"gh-brand-config",displayName:"Brand Configuration",phase:7,dependencies:["product-grid-filter-group","banner","recommendation-config"],getShape:e=>sm.brandConfig(e["product-grid-filter-group"],e.banner)}];function lm(e,t){const n=t.find(t=>t.name===e);return console.log(`[Hippo Commerce - CART] Retrieved model "${e}" ---\x3e`,n?.id),n}async function dm(e,t,n){const r=crypto.randomUUID().toString();try{await n.models.update({...e,id:t?t.id:r});const o=t?t.id:r;return console.log("[Hippo Commerce - CART] Model update complete ---\x3e",e.name,o),o}catch(t){console.error("[Hippo Commerce - CART] Set model error",t instanceof Error?{message:t.message,name:t.name,stack:t.stack}:t),console.error("[Hippo Commerce - CART] Failed model shape:",e.name)}return t?t.id:e.name}function cm(e){const t=e.user.organization.value.settings.plugins?.get(h),n=t?.get("editUrl");return n??""}const pm=new Set(["symbol"]);function um(e,t){const n=[],r=[],o=(e,t,i)=>{const s=new Map(t.map(e=>[e.name,e])),a=new Map(e.map(e=>[e.name,e]));for(const t of e){const e=i?`${i}.${t.name}`:t.name,r=s.get(t.name);r?(t.subFields?.length||r.subFields?.length)&&o(t.subFields??[],r.subFields??[],e):n.push(e)}for(const e of t)a.has(e.name)||r.push(i?`${i}.${e.name}`:e.name)};return o(e,t,""),{added:n,removed:r}}const hm=({variant:e,label:t})=>(0,c.jsx)("span",{className:`px-2.5 py-0.5 rounded-full text-xs font-medium ${{success:"bg-[var(--success)]/15 text-[var(--success)]",warning:"bg-[var(--warning)]/15 text-[var(--warning)]",error:"bg-[var(--error)]/15 text-[var(--error)]"}[e]}`,children:t}),fm=({children:e,className:t,...n})=>(0,c.jsx)("button",{className:`px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${t??""}`,...n,children:e}),mm=({children:e,className:t,...n})=>(0,c.jsx)("button",{className:`px-5 py-2 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:hover:shadow-none ${t??""}`,...n,children:e}),gm=({label:e,value:t})=>(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-xs font-semibold text-[var(--text-secondary)] tracking-wide mb-1",children:e}),(0,c.jsx)("div",{className:"text-sm text-[var(--text-primary)]",children:t})]}),ym=()=>(0,c.jsxs)("svg",{className:"animate-spin h-4 w-4 text-[var(--accent)]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,c.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,c.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),bm=({open:e,className:t})=>(0,c.jsx)("svg",{className:`h-4 w-4 shrink-0 transition-transform ${e?"rotate-180":""} ${t??""}`,viewBox:"0 0 20 20",fill:"currentColor",children:(0,c.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.84a.75.75 0 111.08 1.04l-4.25 4.4a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),xm=({variant:e,summary:t,children:n})=>{const[r,o]=(0,p.useState)(!1),i={success:{container:"bg-[var(--success)]/10 border-[var(--success)]/30",text:"text-[var(--success)]"},warning:{container:"bg-[var(--warning)]/10 border-[var(--warning)]/30",text:"text-[var(--warning)]"},neutral:{container:"bg-[var(--bg-glass)] border-[var(--border-glass)]",text:"text-[var(--text-primary)]"}}[e];return(0,c.jsxs)("div",{className:`mb-4 rounded-lg border ${i.container}`,children:[(0,c.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),"aria-expanded":r,className:"w-full flex items-center justify-between gap-3 px-4 py-3 cursor-pointer text-left",children:[(0,c.jsx)("span",{className:`text-sm font-semibold ${i.text}`,children:t}),(0,c.jsx)(bm,{open:r,className:i.text})]}),r&&(0,c.jsx)("div",{className:"px-4 pb-3",children:n})]})},vm=({version:e})=>(0,c.jsxs)("div",{className:"mb-4 flex items-center gap-2 text-sm",children:[(0,c.jsx)("span",{className:"text-[var(--text-secondary)]",children:"Schema version"}),(0,c.jsx)("span",{className:"font-mono font-semibold text-[var(--text-primary)]",children:e})]}),wm=({name:e,result:t,onTest:n})=>(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] bg-[var(--bg-glass)] p-5 flex flex-col gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:e}),"idle"===t.status&&(0,c.jsx)(hm,{variant:"warning",label:"Not tested"}),"testing"===t.status&&(0,c.jsx)(ym,{}),"success"===t.status&&(0,c.jsx)(hm,{variant:"success",label:"Connected"}),"error"===t.status&&(0,c.jsx)(hm,{variant:"error",label:"Failed"})]}),void 0!==t.time&&(0,c.jsxs)("div",{className:"text-xs text-[var(--text-muted)]",children:["Response time: ",t.time,"ms"]}),t.error&&(0,c.jsx)("div",{className:"text-xs text-[var(--error)] bg-[var(--error)]/10 rounded-lg px-3 py-2 break-all",children:t.error}),(0,c.jsx)(fm,{onClick:n,disabled:"testing"===t.status,children:"testing"===t.status?"Testing...":"Test Connection"})]}),km=({status:e,syncing:t,allStatuses:n,onSync:r})=>{const o=e.dependencies.filter(e=>{const t=n.find(t=>t.name===e);return!t?.exists}),i=0===o.length;return(0,c.jsxs)("tr",{className:"border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("td",{className:"py-3 pr-4",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e.displayName}),(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] font-mono",children:e.name})]}),(0,c.jsx)("td",{className:"py-3 pr-4",children:(0,c.jsxs)("span",{className:"text-xs text-[var(--text-muted)]",children:["Phase ",e.phase%1==0?e.phase:e.phase.toFixed(1)]})}),(0,c.jsx)("td",{className:"py-3 pr-4",children:e.exists?(0,c.jsx)(hm,{variant:"success",label:"Synced"}):(0,c.jsx)(hm,{variant:"warning",label:"Missing"})}),(0,c.jsx)("td",{className:"py-3 pr-4",children:e.dependencies.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:e.dependencies.map(e=>{const t=n.find(t=>t.name===e);return(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-mono "+(t?.exists?"bg-[var(--success)]/10 text-[var(--success)]":"bg-[var(--warning)]/10 text-[var(--warning)]"),children:e},e)})}):(0,c.jsx)("span",{className:"text-xs text-[var(--text-muted)]",children:"None"})}),(0,c.jsx)("td",{className:"py-3 text-right",children:t?(0,c.jsx)(ym,{}):(0,c.jsx)(fm,{onClick:()=>r(e.name),disabled:!i,title:i?`Sync ${e.displayName}`:`Missing dependencies: ${o.join(", ")}`,children:"Sync"})})]})},Cm=(0,u.observer)(({context:e})=>{const t=g.getUserDetails(e),n=function(e){const t=e.user.organization?.value?.settings?.plugins?.get(h);return{brand:t?.get("brand")??"",otherBrand:t?.get("otherBrand")??"",editUrl:t?.get("editUrl")??"",apiUrl:t?.get("apiUrl")??"",apiUser:t?.get("apiUser")??"",apiPassword:t?.get("apiPassword")??"",privateApiKey:t?.get("privateApiKey")??""}}(e),r="Other"===n.brand?n.otherBrand:n.brand,[o,i]=(0,p.useState)({status:"idle"}),[s,a]=(0,p.useState)({status:"idle"}),[l,d]=(0,p.useState)({status:"idle"}),[u,f]=(0,p.useState)(null),[m,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),v=e.user.organizations.find(t=>t.value.id===e.user.currentOrganization),w=v?.value.name??"Unknown",k=e.user.apiKey,C=e.user.authHeaders,T=(N=e.models.result,am.map(e=>{const t=N.find(t=>t.name===e.name);return{name:e.name,displayName:e.displayName,phase:e.phase,dependencies:e.dependencies,exists:!!t,modelId:t?.id}}));var N;const S=function(e){const t=new Set(am.map(e=>e.name));return e.filter(e=>e.name&&!t.has(e.name)&&!pm.has(e.name)).map(e=>({name:e.name,modelId:e.id,kind:e.kind}))}(e.models.result),M=function(e){const t=cm(e),n=e.models.result,r={};for(const e of am){const t=n.find(t=>t.name===e.name);t?.id&&(r[e.name]=t.id)}const o=[];for(const e of am){const i=n.find(t=>t.name===e.name);if(!i)continue;let s;try{s=e.getShape(r,t).fields??[]}catch{continue}const{added:a,removed:l}=um(s,i.fields??[]);(a.length>0||l.length>0)&&o.push({name:e.name,displayName:e.displayName,added:a,removed:l})}return o}(e),j=(0,p.useCallback)(async()=>{i({status:"testing"});const e=Date.now();try{const t=await fetch(`https://cdn.builder.io/api/v3/content/gh-brand-config?apiKey=${k}&limit=1`,{headers:C}),n=Date.now()-e;if(t.ok)i({status:"success",time:n});else{const e=await t.text();i({status:"error",time:n,error:`${t.status}: ${e.slice(0,200)}`})}}catch(t){i({status:"error",time:Date.now()-e,error:t instanceof Error?t.message:String(t)})}},[k,C]),O=(0,p.useCallback)(async()=>{a({status:"testing"});const e=Date.now();try{const t=await fetch(`${n.apiUrl}/config`,{headers:{Authorization:"Basic "+btoa(n.apiUser+":"+n.apiPassword),"X-Brand":r}}),o=Date.now()-e;if(t.ok)a({status:"success",time:o});else{const e=await t.text();a({status:"error",time:o,error:`${t.status}: ${e.slice(0,200)}`})}}catch(t){const n=Date.now()-e,r=t instanceof Error?t.message:String(t);r.includes("Failed to fetch")||r.includes("NetworkError")||r.includes("CORS")?a({status:"error",time:n,error:"CORS blocked — the Commerce API server does not allow requests from this origin. Test from a backend or use the API directly."}):a({status:"error",time:n,error:r})}},[n.apiUrl,n.apiUser,n.apiPassword,r]),A=(0,p.useCallback)(async()=>{d({status:"testing"});const e=Date.now();try{const t=await fetch("https://cdn.builder.io/api/v2/admin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.privateApiKey}`},body:JSON.stringify({query:"{ settings }"})}),r=Date.now()-e,o=await t.json();if(t.ok&&!o.errors?.length)d({status:"success",time:r});else{const e=o.errors?.[0]?.message??`${t.status}`;d({status:"error",time:r,error:e})}}catch(t){d({status:"error",time:Date.now()-e,error:t instanceof Error?t.message:String(t)})}},[n.privateApiKey]),E=(0,p.useCallback)(async()=>{y(!0),x(null);try{const t=await async function(e,t){const n=cm(e),r=e.models.result,o={},i=[];for(const e of am){const t=lm(e.name,r);t?.id&&(o[e.name]=t.id)}const s=[...am].sort((e,t)=>e.phase-t.phase);for(const a of s){t?.(a.name);const s=a.dependencies.filter(e=>!o[e]);if(s.length>0)i.push({success:!1,modelName:a.name,error:`Missing dependencies: ${s.join(", ")}`});else try{const t=a.getShape(o,n),s=lm(a.name,r),l=await dm(t,s,e);l?(o[a.name]=l,i.push({success:!0,modelName:a.name,modelId:l})):i.push({success:!1,modelName:a.name,error:"setModel returned undefined"})}catch(e){i.push({success:!1,modelName:a.name,error:e instanceof Error?e.message:String(e)})}}return console.info("[Hippo Commerce - CART] Model sync complete"),i}(e,e=>{f(e)});x(t)}finally{f(null),y(!1)}},[e]),L=(0,p.useCallback)(async t=>{f(t),x(null);try{const n=await async function(e,t){const n=am.find(t=>t.name===e);if(!n)return{success:!1,modelName:e,error:`Unknown model: ${e}`};const r=cm(t),o=t.models.result,i={};for(const e of am){const t=o.find(t=>t.name===e.name);t?.id&&(i[e.name]=t.id)}const s=n.dependencies.filter(e=>!i[e]);if(s.length>0)return{success:!1,modelName:e,error:`Missing dependencies: ${s.join(", ")}`};try{const s=n.getShape(i,r),a=lm(n.name,o),l=await dm(s,a,t);return l?{success:!0,modelName:e,modelId:l}:{success:!1,modelName:e,error:"setModel returned undefined"}}catch(t){return{success:!1,modelName:e,error:t instanceof Error?t.message:String(t)}}}(t,e);x([n])}finally{f(null)}},[e]);return(0,c.jsxs)("div",{children:[(0,c.jsx)(P,{title:"Administration",subtitle:"Space configuration, connectivity, and model management"}),(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(R,{title:"Space Information",subtitle:"Current Builder.io space and plugin context",children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[(0,c.jsx)(gm,{label:"Organization",value:w}),(0,c.jsx)(gm,{label:"User Email",value:t.email}),(0,c.jsx)(gm,{label:"Brand",value:r||"Not configured"}),(0,c.jsx)(gm,{label:"API Key",value:k?(0,c.jsxs)("span",{className:"font-mono text-xs",children:[k.slice(0,8),"..."]}):(0,c.jsx)("span",{className:"text-[var(--text-muted)]",children:"Not available"})}),(0,c.jsx)(gm,{label:"Private API Key",value:n.privateApiKey?(0,c.jsx)(hm,{variant:"success",label:"Configured"}):(0,c.jsx)(hm,{variant:"error",label:"Missing"})})]})}),(0,c.jsx)(R,{title:"API Connection Status",subtitle:"Test connectivity to Builder.io and Hippo Commerce services",children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,c.jsx)(wm,{name:"Builder.io CDN",result:o,onTest:j}),(0,c.jsx)(wm,{name:"Hippo Commerce API",result:s,onTest:O}),(0,c.jsx)(wm,{name:"Builder.io Write API",result:l,onTest:A})]})}),(0,c.jsx)(R,{title:"Plugin Settings",subtitle:"Current plugin configuration (read-only)",actions:(0,c.jsx)(fm,{onClick:im,children:"Open Settings"}),children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[(0,c.jsx)(gm,{label:"Brand",value:r||"Not configured"}),(0,c.jsx)(gm,{label:"Development Site URL",value:n.editUrl||"Not set"}),(0,c.jsx)(gm,{label:"API URL",value:n.apiUrl||"Not set"}),(0,c.jsx)(gm,{label:"API User",value:n.apiUser||"Not set"}),(0,c.jsx)(gm,{label:"API Password",value:n.apiPassword?"••••••":"Not set"}),(0,c.jsx)(gm,{label:"Private API Key",value:n.privateApiKey?"Configured":"Not set"})]})}),(0,c.jsxs)(R,{title:"Model Sync",subtitle:`${T.filter(e=>e.exists).length} of ${am.length} models synced`,actions:(0,c.jsx)(mm,{onClick:E,disabled:m,children:m?"Syncing...":"Sync All Models"}),children:[(0,c.jsx)(vm,{version:"0.19.0"}),T.some(e=>!e.exists)&&(0,c.jsxs)(xm,{variant:"success",summary:`${T.filter(e=>!e.exists).length} model${1===T.filter(e=>!e.exists).length?"":"s"} will be added by the sync`,children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"These models are defined by this package but don't exist on the brand yet. Running the sync will create them."}),(0,c.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:T.filter(e=>!e.exists).map(e=>(0,c.jsx)("span",{className:"inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--success)]/15 text-[var(--success)]",title:e.displayName,children:e.name},e.name))})]}),M.length>0&&(0,c.jsxs)(xm,{variant:"neutral",summary:`Field changes on ${M.length} existing model${1===M.length?"":"s"}`,children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"The sync replaces each model's shape. Fields shown in green will be added; fields in red will be removed along with any content stored in them."}),(0,c.jsx)("div",{className:"mt-3 space-y-2.5",children:M.map(e=>(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"text-xs font-medium text-[var(--text-primary)]",children:[e.displayName," ",(0,c.jsxs)("span",{className:"text-[var(--text-muted)] font-mono",children:["(",e.name,")"]})]}),(0,c.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[e.added.map(e=>(0,c.jsxs)("span",{className:"text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--success)]/15 text-[var(--success)]",children:["+ ",e]},`add-${e}`)),e.removed.map(e=>(0,c.jsxs)("span",{className:"text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--error)]/15 text-[var(--error)]",children:["− ",e]},`rm-${e}`))]})]},e.name))})]}),S.length>0&&(0,c.jsxs)(xm,{variant:"warning",summary:(0,c.jsxs)(c.Fragment,{children:[S.length," model",1===S.length?"":"s"," on this brand"," ",1===S.length?"is":"are"," not part of this package"]}),children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"These models exist on the brand but aren't managed by the sync. They won't be maintained and could be dropped or orphaned — relocate any content you need to keep before re-provisioning."}),(0,c.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:S.map(e=>(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--warning)]/15 text-[var(--warning)]",title:e.kind?`kind: ${e.kind}`:void 0,children:[e.name,e.kind&&(0,c.jsxs)("span",{className:"opacity-60",children:["· ",e.kind]})]},e.modelId))})]}),b&&(0,c.jsx)("div",{className:"mb-4",children:b.every(e=>e.success)?(0,c.jsxs)("div",{className:"rounded-lg bg-[var(--success)]/10 border border-[var(--success)]/20 px-4 py-3 text-sm text-[var(--success)]",children:["All ",b.length," model(s) synced successfully."]}):(0,c.jsxs)("div",{className:"rounded-lg bg-[var(--error)]/10 border border-[var(--error)]/20 px-4 py-3 text-sm text-[var(--error)]",children:[b.filter(e=>!e.success).length," model(s) failed to sync.",b.filter(e=>!e.success).map(e=>(0,c.jsxs)("div",{className:"mt-1 text-xs",children:[(0,c.jsxs)("strong",{children:[e.modelName,":"]})," ",e.error]},e.modelName))]})}),(0,c.jsx)("div",{className:"overflow-x-auto",children:(0,c.jsxs)("table",{className:"w-full text-left",children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{className:"border-b border-[var(--border-glass)]",children:[(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Model"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Phase"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Status"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Dependencies"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide text-right",children:"Action"})]})}),(0,c.jsx)("tbody",{children:T.map(e=>(0,c.jsx)(km,{status:e,syncing:u===e.name,allStatuses:T,onSync:L},e.name))})]})})]})]})]})}),Tm=Cm,Nm=p.default.memo(e=>{const{context:t}=e;return(0,c.jsx)(E,{context:t,children:(0,c.jsx)(Tm,{context:t})})});Nm.displayName="HippoCMSAdmin";const Sm=Nm;l.Builder.register("plugin",{id:h,name:"Hippo Commerce",settings:[{type:"select",enum:["Badlands Ranch","Beverly Hills MD","Dr. Marty","Driven Entrepreneur","Gundry MD","Roundhouse Provisions","Other"],name:"brand",friendlyName:"Brand",helperText:"Select your brand. If you select 'Other', provide your brand under the advanced settings.",required:!0},{type:"text",name:"editUrl",friendlyName:"Development Site URL",helperText:"Provide the URL to your development site.",required:!0},{type:"text",name:"apiUrl",friendlyName:"API URL",helperText:"Provide the URL to your instance of the Hippo Commerce API.",required:!0},{type:"text",name:"apiUser",friendlyName:"API User",helperText:"Provide your Hippo Commerce API User.",required:!0},{type:"password",name:"apiPassword",friendlyName:"API Password",helperText:"Provide your Hippo Commerce API Password.",required:!0},{type:"text",name:"privateApiKey",friendlyName:"Private API Key",helperText:"Your Builder.io private API key. Required for saving content from the plugin. Found in Settings → Space → Developer.",required:!0},{type:"text",name:"otherBrand",friendlyName:"Custom Brand",helperText:"Provide your brand exactly as it is configured in your Hippo Commerce API.",required:!1,advanced:!0}],ctaText:"Save Settings",async onSave(e){await e.updateSettings({hasConnected:!0}),await d.default.dialogs.alert("Hippo Commerce Cart settings saved.")}}),l.Builder.register("app.onLoad",async({triggerSettingsDialog:e})=>{om=e;const t=d.default.user.organization.value.settings.plugins?.get(h),n=t?.get("hasConnected"),r=t?.get("brand"),o=t?.get("apiUser"),i=t?.get("apiPassword"),s=t?.get("apiUrl"),a=t?.get("editUrl");n&&r&&o&&i&&s&&a||await e(h)});const Mm=g.getUserDetails(d.default);return Mm.permissions.admin&&l.Builder.register("appTab",{name:"Hippo Config",path:"gh/brand-config",icon:f,component:rm}),Mm.permissions.admin&&l.Builder.register("appTab",{name:"Hippo Admin",path:"gh/admin",icon:m,component:Sm}),{}})())}}});
2
+ System.register(["@builder.io/react","@builder.io/app-context","react","mobx-react","react-dom"],function(e,t){var n={},r={},o={},i={},s={};return Object.defineProperty(o,"__esModule",{value:!0}),{setters:[function(e){n.Builder=e.Builder},function(e){r.default=e.default||e},function(e){o.default=e.default||e,Object.keys(e).forEach(function(t){o[t]=e[t]})},function(e){i.observer=e.observer,i.useLocalStore=e.useLocalStore,i.useObserver=e.useObserver},function(e){s.default=e.default||e,s.flushSync=e.flushSync}],execute:function(){e((()=>{"use strict";var e={205(e,t,n){n.d(t,{A:()=>f});var r=n(173),o=n.n(r),i=n(806),s=n.n(i),a=n(501),l=n.n(a),d=new URL(n(566),n.b),c=new URL(n(934),n.b),p=s()(o()),u=l()(d),h=l()(c);p.push([e.id,`/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n :root, :host {\n --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",\n "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n "Courier New", monospace;\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --container-7xl: 80rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --font-weight-thin: 100;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --tracking-tight: -0.025em;\n --tracking-wide: 0.025em;\n --tracking-widest: 0.1em;\n --leading-tight: 1.25;\n --leading-relaxed: 1.625;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --animate-spin: spin 1s linear infinite;\n --blur-sm: 8px;\n --blur-xl: 24px;\n --aspect-video: 16 / 9;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden="until-found"])) {\n display: none !important;\n }\n}\n@layer utilities {\n .absolute {\n position: absolute;\n }\n .fixed {\n position: fixed;\n }\n .relative {\n position: relative;\n }\n .static {\n position: static;\n }\n .sticky {\n position: sticky;\n }\n .inset-0 {\n inset: calc(var(--spacing) * 0);\n }\n .inset-x-0 {\n inset-inline: calc(var(--spacing) * 0);\n }\n .top-0 {\n top: calc(var(--spacing) * 0);\n }\n .top-1\\.5 {\n top: calc(var(--spacing) * 1.5);\n }\n .top-1\\/2 {\n top: calc(1/2 * 100%);\n }\n .right-1\\.5 {\n right: calc(var(--spacing) * 1.5);\n }\n .right-2 {\n right: calc(var(--spacing) * 2);\n }\n .bottom-0 {\n bottom: calc(var(--spacing) * 0);\n }\n .bottom-2 {\n bottom: calc(var(--spacing) * 2);\n }\n .left-1\\/2 {\n left: calc(1/2 * 100%);\n }\n .left-2 {\n left: calc(var(--spacing) * 2);\n }\n .z-50 {\n z-index: 50;\n }\n .z-\\[100\\] {\n z-index: 100;\n }\n .container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n }\n .mx-1 {\n margin-inline: calc(var(--spacing) * 1);\n }\n .mx-auto {\n margin-inline: auto;\n }\n .my-3 {\n margin-block: calc(var(--spacing) * 3);\n }\n .my-5 {\n margin-block: calc(var(--spacing) * 5);\n }\n .my-7 {\n margin-block: calc(var(--spacing) * 7);\n }\n .prose-sm {\n font-size: 0.875rem;\n line-height: 1.7142857;\n :where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n }\n :where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.2857143em;\n line-height: 1.5555556;\n margin-top: 0.8888889em;\n margin-bottom: 0.8888889em;\n }\n :where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.3333333em;\n margin-bottom: 1.3333333em;\n padding-inline-start: 1.1111111em;\n }\n :where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 2.1428571em;\n margin-top: 0;\n margin-bottom: 0.8em;\n line-height: 1.2;\n }\n :where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.4285714em;\n margin-top: 1.6em;\n margin-bottom: 0.8em;\n line-height: 1.4;\n }\n :where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 1.2857143em;\n margin-top: 1.5555556em;\n margin-bottom: 0.4444444em;\n line-height: 1.5555556;\n }\n :where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.4285714em;\n margin-bottom: 0.5714286em;\n line-height: 1.4285714;\n }\n :where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n }\n :where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n border-radius: 0.3125rem;\n padding-top: 0.1428571em;\n padding-inline-end: 0.3571429em;\n padding-bottom: 0.1428571em;\n padding-inline-start: 0.3571429em;\n }\n :where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n }\n :where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.9em;\n }\n :where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8888889em;\n }\n :where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.6666667;\n margin-top: 1.6666667em;\n margin-bottom: 1.6666667em;\n border-radius: 0.25rem;\n padding-top: 0.6666667em;\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n padding-inline-start: 1.5714286em;\n }\n :where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n padding-inline-start: 1.5714286em;\n }\n :where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n margin-bottom: 0.2857143em;\n }\n :where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0.4285714em;\n }\n :where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0.4285714em;\n }\n :where(.prose-sm > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n }\n :where(.prose-sm > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(.prose-sm > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n }\n :where(.prose-sm > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(.prose-sm > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 1.1428571em;\n }\n :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.5714286em;\n margin-bottom: 0.5714286em;\n }\n :where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n margin-bottom: 1.1428571em;\n }\n :where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.1428571em;\n }\n :where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0.2857143em;\n padding-inline-start: 1.5714286em;\n }\n :where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 2.8571429em;\n margin-bottom: 2.8571429em;\n }\n :where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h2 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h3 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(h4 + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.5;\n }\n :where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0;\n }\n :where(thead th:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 0;\n }\n :where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-top: 0.6666667em;\n padding-inline-end: 1em;\n padding-bottom: 0.6666667em;\n padding-inline-start: 1em;\n }\n :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-start: 0;\n }\n :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n padding-inline-end: 0;\n }\n :where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 1.7142857em;\n margin-bottom: 1.7142857em;\n }\n :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n margin-bottom: 0;\n }\n :where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n font-size: 0.8571429em;\n line-height: 1.3333333;\n margin-top: 0.6666667em;\n }\n :where(.prose-sm > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-top: 0;\n }\n :where(.prose-sm > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {\n margin-bottom: 0;\n }\n }\n .mt-0\\.5 {\n margin-top: calc(var(--spacing) * 0.5);\n }\n .mt-1 {\n margin-top: calc(var(--spacing) * 1);\n }\n .mt-2 {\n margin-top: calc(var(--spacing) * 2);\n }\n .mt-3 {\n margin-top: calc(var(--spacing) * 3);\n }\n .mt-6 {\n margin-top: calc(var(--spacing) * 6);\n }\n .mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n }\n .mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n }\n .mb-3 {\n margin-bottom: calc(var(--spacing) * 3);\n }\n .mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n }\n .mb-6 {\n margin-bottom: calc(var(--spacing) * 6);\n }\n .mb-7 {\n margin-bottom: calc(var(--spacing) * 7);\n }\n .mb-8 {\n margin-bottom: calc(var(--spacing) * 8);\n }\n .ml-0\\.5 {\n margin-left: calc(var(--spacing) * 0.5);\n }\n .ml-3 {\n margin-left: calc(var(--spacing) * 3);\n }\n .ml-4 {\n margin-left: calc(var(--spacing) * 4);\n }\n .ml-16 {\n margin-left: calc(var(--spacing) * 16);\n }\n .ml-auto {\n margin-left: auto;\n }\n .line-clamp-2 {\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n }\n .contents {\n display: contents;\n }\n .flex {\n display: flex;\n }\n .grid {\n display: grid;\n }\n .inline {\n display: inline;\n }\n .inline-flex {\n display: inline-flex;\n }\n .aspect-square {\n aspect-ratio: 1 / 1;\n }\n .aspect-video {\n aspect-ratio: var(--aspect-video);\n }\n .h-2 {\n height: calc(var(--spacing) * 2);\n }\n .h-3 {\n height: calc(var(--spacing) * 3);\n }\n .h-4 {\n height: calc(var(--spacing) * 4);\n }\n .h-5 {\n height: calc(var(--spacing) * 5);\n }\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n .h-8 {\n height: calc(var(--spacing) * 8);\n }\n .h-9 {\n height: calc(var(--spacing) * 9);\n }\n .h-10 {\n height: calc(var(--spacing) * 10);\n }\n .h-16 {\n height: calc(var(--spacing) * 16);\n }\n .h-32 {\n height: calc(var(--spacing) * 32);\n }\n .h-full {\n height: 100%;\n }\n .h-px {\n height: 1px;\n }\n .max-h-\\[80vh\\] {\n max-height: 80vh;\n }\n .min-h-0 {\n min-height: calc(var(--spacing) * 0);\n }\n .min-h-\\[50vh\\] {\n min-height: 50vh;\n }\n .min-h-\\[60px\\] {\n min-height: 60px;\n }\n .min-h-full {\n min-height: 100%;\n }\n .min-h-screen {\n min-height: 100vh;\n }\n .w-2 {\n width: calc(var(--spacing) * 2);\n }\n .w-3 {\n width: calc(var(--spacing) * 3);\n }\n .w-4 {\n width: calc(var(--spacing) * 4);\n }\n .w-5 {\n width: calc(var(--spacing) * 5);\n }\n .w-7 {\n width: calc(var(--spacing) * 7);\n }\n .w-8 {\n width: calc(var(--spacing) * 8);\n }\n .w-9 {\n width: calc(var(--spacing) * 9);\n }\n .w-10 {\n width: calc(var(--spacing) * 10);\n }\n .w-16 {\n width: calc(var(--spacing) * 16);\n }\n .w-40 {\n width: calc(var(--spacing) * 40);\n }\n .w-\\[640px\\] {\n width: 640px;\n }\n .w-fit {\n width: fit-content;\n }\n .w-full {\n width: 100%;\n }\n .w-px {\n width: 1px;\n }\n .max-w-7xl {\n max-width: var(--container-7xl);\n }\n .max-w-\\[90vw\\] {\n max-width: 90vw;\n }\n .max-w-\\[1200px\\] {\n max-width: 1200px;\n }\n .max-w-full {\n max-width: 100%;\n }\n .max-w-none {\n max-width: none;\n }\n .min-w-full {\n min-width: 100%;\n }\n .flex-1 {\n flex: 1;\n }\n .shrink-0 {\n flex-shrink: 0;\n }\n .-translate-x-1\\/2 {\n --tw-translate-x: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .-translate-y-1\\/2 {\n --tw-translate-y: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .rotate-180 {\n rotate: 180deg;\n }\n .animate-spin {\n animation: var(--animate-spin);\n }\n .cursor-pointer {\n cursor: pointer;\n }\n .grid-cols-1 {\n grid-template-columns: repeat(1, minmax(0, 1fr));\n }\n .grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-wrap {\n flex-wrap: wrap;\n }\n .items-center {\n align-items: center;\n }\n .items-start {\n align-items: flex-start;\n }\n .justify-between {\n justify-content: space-between;\n }\n .justify-center {\n justify-content: center;\n }\n .justify-end {\n justify-content: flex-end;\n }\n .gap-0\\.5 {\n gap: calc(var(--spacing) * 0.5);\n }\n .gap-1 {\n gap: calc(var(--spacing) * 1);\n }\n .gap-1\\.5 {\n gap: calc(var(--spacing) * 1.5);\n }\n .gap-2 {\n gap: calc(var(--spacing) * 2);\n }\n .gap-3 {\n gap: calc(var(--spacing) * 3);\n }\n .gap-4 {\n gap: calc(var(--spacing) * 4);\n }\n .gap-5 {\n gap: calc(var(--spacing) * 5);\n }\n .gap-6 {\n gap: calc(var(--spacing) * 6);\n }\n .space-y-0 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-1 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-2\\.5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-3 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-4 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-6 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .gap-x-6 {\n column-gap: calc(var(--spacing) * 6);\n }\n .gap-y-4 {\n row-gap: calc(var(--spacing) * 4);\n }\n .gap-y-5 {\n row-gap: calc(var(--spacing) * 5);\n }\n .truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .overflow-hidden {\n overflow: hidden;\n }\n .overflow-x-auto {\n overflow-x: auto;\n }\n .overflow-y-auto {\n overflow-y: auto;\n }\n .rounded {\n border-radius: 0.25rem;\n }\n .rounded-2xl {\n border-radius: var(--radius-2xl);\n }\n .rounded-full {\n border-radius: calc(infinity * 1px);\n }\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n .rounded-md {\n border-radius: var(--radius-md);\n }\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n .border-t {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n }\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n .border-l-2 {\n border-left-style: var(--tw-border-style);\n border-left-width: 2px;\n }\n .border-dashed {\n --tw-border-style: dashed;\n border-style: dashed;\n }\n .border-\\[var\\(--accent\\)\\] {\n border-color: var(--accent);\n }\n .border-\\[var\\(--accent\\)\\]\\/20 {\n border-color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--accent) 20%, transparent);\n }\n }\n .border-\\[var\\(--border-glass\\)\\] {\n border-color: var(--border-glass);\n }\n .border-\\[var\\(--error\\)\\]\\/20 {\n border-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--error) 20%, transparent);\n }\n }\n .border-\\[var\\(--input-border\\)\\] {\n border-color: var(--input-border);\n }\n .border-\\[var\\(--success\\)\\]\\/20 {\n border-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--success) 20%, transparent);\n }\n }\n .border-\\[var\\(--success\\)\\]\\/30 {\n border-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--success) 30%, transparent);\n }\n }\n .border-\\[var\\(--warning\\)\\]\\/30 {\n border-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--warning) 30%, transparent);\n }\n }\n .bg-\\[var\\(--accent\\)\\] {\n background-color: var(--accent);\n }\n .bg-\\[var\\(--accent\\)\\]\\/15 {\n background-color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--accent) 15%, transparent);\n }\n }\n .bg-\\[var\\(--accent-subtle\\)\\] {\n background-color: var(--accent-subtle);\n }\n .bg-\\[var\\(--bg-glass\\)\\] {\n background-color: var(--bg-glass);\n }\n .bg-\\[var\\(--bg-glass-hover\\)\\] {\n background-color: var(--bg-glass-hover);\n }\n .bg-\\[var\\(--bg-primary\\)\\]\\/80 {\n background-color: var(--bg-primary);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--bg-primary) 80%, transparent);\n }\n }\n .bg-\\[var\\(--bg-secondary\\)\\] {\n background-color: var(--bg-secondary);\n }\n .bg-\\[var\\(--border-glass\\)\\] {\n background-color: var(--border-glass);\n }\n .bg-\\[var\\(--error\\)\\]\\/5 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 5%, transparent);\n }\n }\n .bg-\\[var\\(--error\\)\\]\\/10 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 10%, transparent);\n }\n }\n .bg-\\[var\\(--error\\)\\]\\/15 {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 15%, transparent);\n }\n }\n .bg-\\[var\\(--input-bg\\)\\] {\n background-color: var(--input-bg);\n }\n .bg-\\[var\\(--success\\)\\]\\/10 {\n background-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--success) 10%, transparent);\n }\n }\n .bg-\\[var\\(--success\\)\\]\\/15 {\n background-color: var(--success);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--success) 15%, transparent);\n }\n }\n .bg-\\[var\\(--warning\\)\\]\\/10 {\n background-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--warning) 10%, transparent);\n }\n }\n .bg-\\[var\\(--warning\\)\\]\\/15 {\n background-color: var(--warning);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--warning) 15%, transparent);\n }\n }\n .bg-black\\/50 {\n background-color: color-mix(in srgb, #000 50%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 50%, transparent);\n }\n }\n .bg-black\\/60 {\n background-color: color-mix(in srgb, #000 60%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 60%, transparent);\n }\n }\n .bg-black\\/70 {\n background-color: color-mix(in srgb, #000 70%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-black) 70%, transparent);\n }\n }\n .bg-white\\/10 {\n background-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n .fill-current {\n fill: currentcolor;\n }\n .object-contain {\n object-fit: contain;\n }\n .object-cover {\n object-fit: cover;\n }\n .p-1 {\n padding: calc(var(--spacing) * 1);\n }\n .p-2 {\n padding: calc(var(--spacing) * 2);\n }\n .p-3 {\n padding: calc(var(--spacing) * 3);\n }\n .p-4 {\n padding: calc(var(--spacing) * 4);\n }\n .p-5 {\n padding: calc(var(--spacing) * 5);\n }\n .p-6 {\n padding: calc(var(--spacing) * 6);\n }\n .p-8 {\n padding: calc(var(--spacing) * 8);\n }\n .px-1\\.5 {\n padding-inline: calc(var(--spacing) * 1.5);\n }\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n .px-2\\.5 {\n padding-inline: calc(var(--spacing) * 2.5);\n }\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n .px-3\\.5 {\n padding-inline: calc(var(--spacing) * 3.5);\n }\n .px-4 {\n padding-inline: calc(var(--spacing) * 4);\n }\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n .px-8 {\n padding-inline: calc(var(--spacing) * 8);\n }\n .py-0\\.5 {\n padding-block: calc(var(--spacing) * 0.5);\n }\n .py-1 {\n padding-block: calc(var(--spacing) * 1);\n }\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n .py-2\\.5 {\n padding-block: calc(var(--spacing) * 2.5);\n }\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n .py-3\\.5 {\n padding-block: calc(var(--spacing) * 3.5);\n }\n .py-5 {\n padding-block: calc(var(--spacing) * 5);\n }\n .py-12 {\n padding-block: calc(var(--spacing) * 12);\n }\n .py-16 {\n padding-block: calc(var(--spacing) * 16);\n }\n .pt-0 {\n padding-top: calc(var(--spacing) * 0);\n }\n .pr-4 {\n padding-right: calc(var(--spacing) * 4);\n }\n .pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\n }\n .pl-4 {\n padding-left: calc(var(--spacing) * 4);\n }\n .text-center {\n text-align: center;\n }\n .text-left {\n text-align: left;\n }\n .text-right {\n text-align: right;\n }\n .font-mono {\n font-family: var(--font-mono);\n }\n .text-2xl {\n font-size: var(--text-2xl);\n line-height: var(--tw-leading, var(--text-2xl--line-height));\n }\n .text-6xl {\n font-size: var(--text-6xl);\n line-height: var(--tw-leading, var(--text-6xl--line-height));\n }\n .text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n }\n .text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n }\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n .text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n }\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n .text-\\[10px\\] {\n font-size: 10px;\n }\n .text-\\[11px\\] {\n font-size: 11px;\n }\n .text-\\[15px\\] {\n font-size: 15px;\n }\n .text-\\[17px\\] {\n font-size: 17px;\n }\n .leading-relaxed {\n --tw-leading: var(--leading-relaxed);\n line-height: var(--leading-relaxed);\n }\n .leading-tight {\n --tw-leading: var(--leading-tight);\n line-height: var(--leading-tight);\n }\n .font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n }\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n .font-thin {\n --tw-font-weight: var(--font-weight-thin);\n font-weight: var(--font-weight-thin);\n }\n .tracking-\\[1\\.5px\\] {\n --tw-tracking: 1.5px;\n letter-spacing: 1.5px;\n }\n .tracking-tight {\n --tw-tracking: var(--tracking-tight);\n letter-spacing: var(--tracking-tight);\n }\n .tracking-wide {\n --tw-tracking: var(--tracking-wide);\n letter-spacing: var(--tracking-wide);\n }\n .tracking-widest {\n --tw-tracking: var(--tracking-widest);\n letter-spacing: var(--tracking-widest);\n }\n .break-all {\n word-break: break-all;\n }\n .whitespace-nowrap {\n white-space: nowrap;\n }\n .text-\\[\\#1a1a2e\\] {\n color: #1a1a2e;\n }\n .text-\\[var\\(--accent\\)\\] {\n color: var(--accent);\n }\n .text-\\[var\\(--accent\\)\\]\\/60 {\n color: var(--accent);\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, var(--accent) 60%, transparent);\n }\n }\n .text-\\[var\\(--error\\)\\] {\n color: var(--error);\n }\n .text-\\[var\\(--success\\)\\] {\n color: var(--success);\n }\n .text-\\[var\\(--text-muted\\)\\] {\n color: var(--text-muted);\n }\n .text-\\[var\\(--text-primary\\)\\] {\n color: var(--text-primary);\n }\n .text-\\[var\\(--text-secondary\\)\\] {\n color: var(--text-secondary);\n }\n .text-\\[var\\(--warning\\)\\] {\n color: var(--warning);\n }\n .text-white\\/80 {\n color: color-mix(in srgb, #fff 80%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, var(--color-white) 80%, transparent);\n }\n }\n .uppercase {\n text-transform: uppercase;\n }\n .italic {\n font-style: italic;\n }\n .underline {\n text-decoration-line: underline;\n }\n .opacity-0 {\n opacity: 0%;\n }\n .opacity-25 {\n opacity: 25%;\n }\n .opacity-60 {\n opacity: 60%;\n }\n .opacity-70 {\n opacity: 70%;\n }\n .opacity-75 {\n opacity: 75%;\n }\n .opacity-100 {\n opacity: 100%;\n }\n .shadow-2xl {\n --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-sm {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-2 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-\\[var\\(--accent-glow\\)\\] {\n --tw-ring-color: var(--accent-glow);\n }\n .filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n .backdrop-blur-sm {\n --tw-backdrop-blur: blur(var(--blur-sm));\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .backdrop-blur-xl {\n --tw-backdrop-blur: blur(var(--blur-xl));\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .transition-all {\n transition-property: all;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-colors {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-opacity {\n transition-property: opacity;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-shadow {\n transition-property: box-shadow;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .duration-300 {\n --tw-duration: 300ms;\n transition-duration: 300ms;\n }\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n .group-hover\\:opacity-100 {\n &:is(:where(.group):hover *) {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .last\\:border-b-0 {\n &:last-child {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 0px;\n }\n }\n .focus-within\\:border-\\[var\\(--input-focus-border\\)\\] {\n &:focus-within {\n border-color: var(--input-focus-border);\n }\n }\n .focus-within\\:shadow-\\[0_0_0_3px_var\\(--input-focus-glow\\)\\] {\n &:focus-within {\n --tw-shadow: 0 0 0 3px var(--tw-shadow-color, var(--input-focus-glow));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .hover\\:border-\\[var\\(--border-glass-focus\\)\\] {\n &:hover {\n @media (hover: hover) {\n border-color: var(--border-glass-focus);\n }\n }\n }\n .hover\\:border-white\\/10 {\n &:hover {\n @media (hover: hover) {\n border-color: color-mix(in srgb, #fff 10%, transparent);\n @supports (color: color-mix(in lab, red, red)) {\n border-color: color-mix(in oklab, var(--color-white) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-\\[var\\(--bg-glass-hover\\)\\] {\n &:hover {\n @media (hover: hover) {\n background-color: var(--bg-glass-hover);\n }\n }\n }\n .hover\\:bg-\\[var\\(--error\\)\\]\\/10 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 10%, transparent);\n }\n }\n }\n }\n .hover\\:bg-\\[var\\(--error\\)\\]\\/25 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--error) 25%, transparent);\n }\n }\n }\n }\n .hover\\:text-\\[var\\(--accent\\)\\] {\n &:hover {\n @media (hover: hover) {\n color: var(--accent);\n }\n }\n }\n .hover\\:text-\\[var\\(--text-primary\\)\\] {\n &:hover {\n @media (hover: hover) {\n color: var(--text-primary);\n }\n }\n }\n .hover\\:opacity-100 {\n &:hover {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .hover\\:shadow-\\[0_0_20px_var\\(--accent-glow\\)\\] {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 0 20px var(--tw-shadow-color, var(--accent-glow));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:shadow-lg {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:brightness-110 {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(110%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n }\n .disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n }\n .disabled\\:opacity-40 {\n &:disabled {\n opacity: 40%;\n }\n }\n .disabled\\:hover\\:shadow-none {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 0 #0000;\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n }\n .disabled\\:hover\\:brightness-100 {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-brightness: brightness(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n }\n }\n }\n }\n .sm\\:grid-cols-4 {\n @media (width >= 40rem) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n .md\\:grid-cols-2 {\n @media (width >= 48rem) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n }\n .md\\:grid-cols-3 {\n @media (width >= 48rem) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n }\n .lg\\:grid-cols-3 {\n @media (width >= 64rem) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n }\n .lg\\:grid-cols-4 {\n @media (width >= 64rem) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n}\n#hippo-app, #hippo-app[data-theme='dark'] {\n --bg-primary: #0a0e1a;\n --bg-secondary: #111827;\n --bg-glass: rgba(255, 255, 255, 0.05);\n --bg-glass-hover: rgba(255, 255, 255, 0.08);\n --border-glass: rgba(255, 255, 255, 0.1);\n --border-glass-focus: rgba(200, 169, 81, 0.3);\n --text-primary: rgba(255, 255, 255, 0.92);\n --text-secondary: rgba(255, 255, 255, 0.55);\n --text-muted: rgba(255, 255, 255, 0.3);\n --accent: #c8a951;\n --accent-glow: rgba(200, 169, 81, 0.15);\n --accent-subtle: rgba(200, 169, 81, 0.08);\n --input-bg: rgba(255, 255, 255, 0.04);\n --input-border: rgba(255, 255, 255, 0.08);\n --input-focus-border: rgba(200, 169, 81, 0.4);\n --input-focus-glow: rgba(200, 169, 81, 0.08);\n --toggle-bg: rgba(255, 255, 255, 0.1);\n --toggle-active: #c8a951;\n --success: #34d399;\n --error: #f87171;\n --warning: #fbbf24;\n --radius-sm: 8px;\n --radius-md: 12px;\n --radius-lg: 16px;\n color-scheme: dark;\n}\n#hippo-app[data-theme='light'] {\n --bg-primary: #f8f9fc;\n --bg-secondary: #ffffff;\n --bg-glass: rgba(0, 0, 0, 0.02);\n --bg-glass-hover: rgba(0, 0, 0, 0.04);\n --border-glass: rgba(0, 0, 0, 0.06);\n --border-glass-focus: rgba(184, 153, 61, 0.3);\n --text-primary: rgba(0, 0, 0, 0.87);\n --text-secondary: rgba(0, 0, 0, 0.55);\n --text-muted: rgba(0, 0, 0, 0.3);\n --accent: #b8993d;\n --accent-glow: rgba(184, 153, 61, 0.15);\n --accent-subtle: rgba(184, 153, 61, 0.08);\n --input-bg: rgba(0, 0, 0, 0.03);\n --input-border: rgba(0, 0, 0, 0.08);\n --input-focus-border: rgba(184, 153, 61, 0.4);\n --input-focus-glow: rgba(184, 153, 61, 0.08);\n --toggle-bg: rgba(0, 0, 0, 0.12);\n --toggle-active: #b8993d;\n --success: #059669;\n --error: #dc2626;\n --warning: #d97706;\n color-scheme: light;\n}\n#hippo-app {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;\n color: var(--text-primary);\n background: var(--bg-primary);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n@layer utilities {\n .no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n}\n@keyframes hippo-spin {\n to {\n transform: rotate(360deg);\n }\n}\n.hippo-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--border-glass);\n border-top-color: var(--accent);\n border-radius: 50%;\n animation: hippo-spin 0.6s linear infinite;\n}\n.hippo-spinner-lg {\n width: 36px;\n height: 36px;\n border-width: 3px;\n}\n.hippo-toggle {\n position: relative;\n width: 40px;\n height: 22px;\n border-radius: 11px;\n background: var(--toggle-bg);\n cursor: pointer;\n transition: background 0.2s;\n appearance: none;\n border: none;\n outline: none;\n flex-shrink: 0;\n}\n.hippo-toggle::after {\n content: '';\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: white;\n top: 3px;\n left: 3px;\n transition: transform 0.2s;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n.hippo-toggle:checked {\n background: var(--toggle-active);\n}\n.hippo-toggle:checked::after {\n transform: translateX(18px);\n}\n.hippo-input {\n width: 100%;\n padding: 10px 14px;\n border-radius: var(--radius-sm);\n border: 1px solid var(--input-border);\n background: var(--input-bg);\n color: var(--text-primary);\n font-size: 14px;\n font-family: inherit;\n transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;\n outline: none;\n}\n.hippo-input::placeholder {\n color: var(--text-muted);\n}\n.hippo-input:focus {\n border-color: var(--input-focus-border);\n box-shadow: 0 0 0 3px var(--input-focus-glow);\n background: var(--bg-glass-hover);\n}\ntextarea.hippo-input {\n resize: vertical;\n min-height: 80px;\n}\nselect.hippo-input {\n appearance: none;\n background-image: url(${u});\n background-repeat: no-repeat;\n background-position: right 12px center;\n padding-right: 36px;\n cursor: pointer;\n}\n#hippo-app[data-theme='light'] select.hippo-input {\n background-image: url(${h});\n}\n@property --tw-translate-x {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-y {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-z {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-space-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-leading {\n syntax: "*";\n inherits: false;\n}\n@property --tw-font-weight {\n syntax: "*";\n inherits: false;\n}\n@property --tw-tracking {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-inset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: "<length>";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: "*";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-drop-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-drop-shadow-size {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-duration {\n syntax: "*";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *, ::before, ::after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-space-y-reverse: 0;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-tracking: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n --tw-backdrop-blur: initial;\n --tw-backdrop-brightness: initial;\n --tw-backdrop-contrast: initial;\n --tw-backdrop-grayscale: initial;\n --tw-backdrop-hue-rotate: initial;\n --tw-backdrop-invert: initial;\n --tw-backdrop-opacity: initial;\n --tw-backdrop-saturate: initial;\n --tw-backdrop-sepia: initial;\n --tw-duration: initial;\n }\n }\n}\n`,""]);const f=p},806(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var d=0;d<e.length;d++){var c=[].concat(e[d]);r&&s[c[0]]||(void 0!==i&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},501(e){e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},173(e){e.exports=function(e){return e[1]}},736(e,t,n){var r=n(726),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var r,i={},d=null,c=null;for(r in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)s.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},500(e,t,n){e.exports=n(736)},604(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},s=[],a=0;a<e.length;a++){var l=e[a],d=r.base?l[0]+r.base:l[0],c=i[d]||0,p="".concat(d," ").concat(c);i[d]=c+1;var u=n(p),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(h);else{var f=o(h,r);r.byIndex=a,t.splice(a,0,{identifier:p,updater:f,references:1})}s.push(p)}return s}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<i.length;s++){var a=n(i[s]);t[a].references--}for(var l=r(e,o),d=0;d<i.length;d++){var c=n(i[d]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}i=l}}},863(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},896(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},124(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},101(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},917(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},913(e,t,n){var r=n(726),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return a(function(){o.value=n,o.getSnapshot=t,d(o)&&c({inst:o})},[e,n,t]),s(function(){return d(o)&&c({inst:o}),e(function(){d(o)&&c({inst:o})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},414(e,t,n){var r=n(726),o=n(436),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,a=r.useRef,l=r.useEffect,d=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var p=a(null);if(null===p.current){var u={hasValue:!1,value:null};p.current=u}else u=p.current;p=d(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==o&&u.hasValue){var t=u.value;if(o(t,e))return a=t}return a=e}if(t=a,i(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,d=void 0===n?null:n;return[function(){return e(t())},null===d?void 0:function(){return e(d())}]},[t,n,r,o]);var h=s(e,p[0],p[1]);return l(function(){u.hasValue=!0,u.value=h},[h]),c(h),h}},436(e,t,n){e.exports=n(913)},358(e,t,n){e.exports=n(414)},934(e){e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27rgba%280,0,0,0.4%29%27 stroke-width=%272%27%3E%3Cpath d=%27M6 9l6 6 6-6%27/%3E%3C/svg%3E"},566(e){e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27rgba%28255,255,255,0.4%29%27 stroke-width=%272%27%3E%3Cpath d=%27M6 9l6 6 6-6%27/%3E%3C/svg%3E"},404(e){e.exports=r},522(e){e.exports=n},979(e){e.exports=i},726(e){e.exports=o},867(e){e.exports=s}},t={};function a(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={id:n,exports:{}};return e[n](o,o.exports,a),o.exports}a.m=e,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.b="undefined"!=typeof document&&document.baseURI||self.location.href,a.nc=void 0;var l=a(522),d=a(404),c=a(500),p=a(726),u=a(979);const h="@goldenhippo/hippo-commerce-builder-cart-plugin",f=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#C8A951" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/>\n <circle cx="12" cy="12" r="3"/>\n</svg>')}`,m=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#C8A951" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>\n <path d="m9 12 2 2 4-4"/>\n</svg>')}`,g=class{static getUserDetails(e){const{user:t}=e;console.info("[Hippo Commerce] USER",JSON.parse(JSON.stringify(t)));const n=t.organizations.find(e=>e.value.id===t.currentOrganization),r=n?.value.settings.plugins.toJSON()[h],o=r?.brand??"Brand not configured",i=r?.otherBrand??"";return{id:t.id,brand:"Other"===o?i:o,email:t.data.email,name:t.data.displayName,permissions:{admin:t.can("admin"),createContent:t.can("createContent"),editCode:t.can("editCode"),editDesigns:t.can("editDesigns")},hippoApi:{user:r?.apiUser??"",password:r?.apiPassword??"",url:r?.apiUrl}}}};var y=a(604),b=a.n(y),x=a(101),v=a.n(x),w=a(863),k=a.n(w),C=a(124),T=a.n(C),N=a(896),S=a.n(N),M=a(917),j=a.n(M),O=a(205),A={};A.styleTagTransform=j(),A.setAttributes=T(),A.insert=k().bind(null,"head"),A.domAPI=v(),A.insertStyleElement=S(),b()(O.A,A),O.A&&O.A.locals&&O.A.locals;const E=({context:e,children:t})=>(0,u.useObserver)(()=>{const n=e.config.darkMode,r=n?"dark":"light",o=g.getUserDetails(e).brand;return(0,c.jsx)(p.default.StrictMode,{children:(0,c.jsxs)("div",{id:"hippo-app","data-theme":r,className:"min-h-screen",style:{background:n?"radial-gradient(ellipse 80% 60% at 50% -20%, rgba(200,169,81,0.06), transparent),\n radial-gradient(ellipse 60% 40% at 80% 100%, rgba(100,80,200,0.04), transparent),\n var(--bg-primary)":"var(--bg-primary)"},children:[(0,c.jsxs)("div",{className:"sticky top-0 z-50 flex items-center justify-between px-8 py-5 border-b border-[var(--border-glass)] backdrop-blur-xl bg-[var(--bg-primary)]/80",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h1",{className:"text-[17px] font-bold text-[var(--accent)] tracking-tight",children:"Hippo Commerce"}),o&&(0,c.jsx)("p",{className:"text-[11px] font-medium tracking-[1.5px] uppercase text-[var(--text-muted)] mt-0.5",children:o})]}),(0,c.jsx)("button",{className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer flex items-center justify-center hover:bg-[var(--bg-glass-hover)] hover:border-white/10 transition-all",onClick:()=>{e.config.darkMode=!e.config.darkMode},title:n?"Switch to light mode":"Switch to dark mode",children:n?(0,c.jsx)("svg",{className:"w-4 h-4 fill-current",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)("path",{d:"M21.64,13a1,1,0,0,0-1.05-.14,8.05,8.05,0,0,1-3.37.73A8.15,8.15,0,0,1,9.08,5.49a8.59,8.59,0,0,1,.25-2A1,1,0,0,0,8,2.36,10.14,10.14,0,1,0,22,14.05,1,1,0,0,0,21.64,13ZM18,22A10.11,10.11,0,0,1,4.46,10.28,8.11,8.11,0,0,0,17.09,4.73a10.16,10.16,0,0,1,2.28,8.71A10,10,0,0,1,18,22Z"})}):(0,c.jsx)("svg",{className:"w-4 h-4 fill-current",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)("path",{d:"M5.64,17l-.71.71a1,1,0,0,0,0,1.41,1,1,0,0,0,1.41,0l.71-.71A1,1,0,0,0,5.64,17ZM5,12a1,1,0,0,0-1-1H3a1,1,0,0,0,0,2H4A1,1,0,0,0,5,12Zm7-7a1,1,0,0,0,1-1V3a1,1,0,0,0-2,0V4A1,1,0,0,0,12,5ZM5.64,7.05a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41l-.71-.71A1,1,0,0,0,4.93,6.34Zm12,.29a1,1,0,0,0,.7-.29l.71-.71a1,1,0,1,0-1.41-1.41L17,5.64a1,1,0,0,0,0,1.41A1,1,0,0,0,17.66,7.34ZM21,11H20a1,1,0,0,0,0,2h1a1,1,0,0,0,0-2Zm-9,8a1,1,0,0,0-1,1v1a1,1,0,0,0,2,0V20A1,1,0,0,0,12,19ZM18.36,17A1,1,0,0,0,17,18.36l.71.71a1,1,0,0,0,1.41,0,1,1,0,0,0,0-1.41ZM12,6.5A5.5,5.5,0,1,0,17.5,12,5.51,5.51,0,0,0,12,6.5Zm0,9A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z"})})})]}),(0,c.jsx)("div",{className:"p-8 max-w-[1200px] mx-auto",children:t})]})})});function L(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=L(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const D=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=L(e))&&(r&&(r+=" "),r+=t);return r};function I({message:e,size:t="md"}){return(0,c.jsx)("section",{className:"p-4 max-w-7xl min-w-full mx-auto",children:(0,c.jsxs)("div",{className:"w-fit mx-auto flex flex-col items-center justify-center gap-3 py-12",role:"status","aria-live":"polite",children:[(0,c.jsx)("div",{className:D("hippo-spinner","lg"===t&&"hippo-spinner-lg"),"aria-label":"Loading"}),e&&(0,c.jsx)("div",{className:D("font-medium text-[var(--text-secondary)]","lg"===t?"text-base":"text-sm"),children:e})]})})}function R({title:e,subtitle:t,actions:n,children:r,className:o,variant:i="default"}){return(0,c.jsxs)("div",{className:D("rounded-2xl p-8 backdrop-blur-sm border","danger"===i?"border-[var(--error)]/20 bg-[var(--error)]/5":"bg-[var(--bg-glass)] border-[var(--border-glass)]",o),children:[(e||n)&&(0,c.jsxs)("div",{className:D("flex items-center justify-between",r?"mb-6":""),children:[(0,c.jsxs)("div",{children:[e&&(0,c.jsx)("h2",{className:"text-[15px] font-semibold text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("p",{className:"text-xs text-[var(--text-muted)] mt-1",children:t})]}),n&&(0,c.jsx)("div",{className:"flex items-center gap-2",children:n})]}),r]})}function P({title:e,subtitle:t,actions:n,className:r}){return(0,c.jsxs)("div",{className:D("flex items-center justify-between mb-7",r),children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h1",{className:"text-xl font-bold tracking-tight text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)] mt-1",children:t})]}),n&&(0,c.jsx)("div",{className:"flex items-center gap-3",children:n})]})}function z({label:e,required:t,helper:n,error:r,children:o,className:i}){return(0,c.jsxs)("div",{className:D("space-y-2.5",i),children:[(0,c.jsxs)("label",{className:"text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:[e,t&&(0,c.jsx)("span",{className:"text-[var(--accent)] ml-0.5",children:"*"})]}),o,r&&(0,c.jsx)("p",{className:"text-[11px] text-[var(--error)]",children:r}),!r&&n&&(0,c.jsx)("p",{className:"text-[11px] text-[var(--text-muted)] leading-relaxed",children:n})]})}function B({message:e,action:t,className:n}){return(0,c.jsx)("div",{className:D("rounded-2xl border border-dashed border-[var(--border-glass)] py-16 px-6 backdrop-blur-sm",n),children:(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("p",{className:"text-[var(--text-muted)] mb-4",children:e}),t&&(0,c.jsx)("button",{className:"px-5 py-2.5 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)]",onClick:t.onClick,children:t.label})]})})}function F({value:e,label:t,onChange:n,fetchAssets:r,className:o}){const[i,s]=(0,p.useState)(!1),[a,l]=(0,p.useState)([]),[d,u]=(0,p.useState)(!1),[h,f]=(0,p.useState)(null),[m,g]=(0,p.useState)(""),y="string"==typeof e&&e.length>0,b=(0,p.useCallback)(async()=>{if(r){u(!0),f(null);try{const e=await r();l(e)}catch(e){f(e.message??"Failed to load media library")}finally{u(!1)}}},[r]);(0,p.useEffect)(()=>{i&&r&&0===a.length&&!d&&b()},[i,r,a.length,d,b]);const x=()=>s(!0),v=()=>{s(!1),g("")},w=m?a.filter(e=>e.name?.toLowerCase().includes(m.toLowerCase())):a;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:D("w-40 flex flex-col gap-1.5",o),children:[y?(0,c.jsxs)("div",{className:"relative w-40 h-32 rounded-xl border border-[var(--border-glass)] bg-[var(--input-bg)] cursor-pointer overflow-hidden group",onClick:x,children:[(0,c.jsx)("img",{src:e,alt:t,className:"w-full h-full object-contain p-3"}),(0,c.jsxs)("div",{className:"absolute inset-0 bg-black/60 flex flex-col items-center justify-center gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,c.jsx)("button",{type:"button",className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-[var(--accent)] text-[#1a1a2e] cursor-pointer",onClick:e=>{e.stopPropagation(),x()},children:"Change"}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-white/10 text-white/80 cursor-pointer",onClick:e=>{e.stopPropagation(),n(void 0)},children:"Remove"})]})]}):(0,c.jsxs)("div",{className:"w-40 h-32 rounded-xl border border-dashed border-[var(--border-glass)] bg-[var(--input-bg)] cursor-pointer flex flex-col items-center justify-center gap-2 hover:border-[var(--border-glass-focus)] hover:bg-[var(--bg-glass-hover)] transition-all",onClick:x,children:[(0,c.jsx)("div",{className:"w-8 h-8 rounded-full bg-[var(--accent-subtle)] flex items-center justify-center",children:(0,c.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M12 5v14M5 12h14"})})}),(0,c.jsx)("span",{className:"text-xs font-medium text-[var(--text-muted)]",children:"Select Image"})]}),(0,c.jsx)("span",{className:"text-[11px] font-medium text-[var(--text-secondary)] text-center leading-tight",children:t})]}),i&&(0,c.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-[100]",onClick:v,children:(0,c.jsxs)("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border-glass)] rounded-2xl p-6 w-[640px] max-w-[90vw] max-h-[80vh] shadow-2xl flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-[var(--text-primary)]",children:"Select Image"}),(0,c.jsx)("p",{className:"text-xs text-[var(--text-muted)] mt-0.5",children:"Choose from your Builder.io media library"})]}),(0,c.jsx)("button",{type:"button",className:"w-8 h-8 rounded-lg flex items-center justify-center text-[var(--text-muted)] hover:bg-[var(--bg-glass-hover)] cursor-pointer transition-colors",onClick:v,children:(0,c.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),(0,c.jsx)("input",{type:"text",className:"hippo-input mb-4 text-sm",placeholder:"Search images...",value:m,onChange:e=>g(e.target.value)}),(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[d&&(0,c.jsxs)("div",{className:"flex items-center justify-center py-16",children:[(0,c.jsx)("div",{className:"hippo-spinner"}),(0,c.jsx)("span",{className:"ml-3 text-sm text-[var(--text-muted)]",children:"Loading media library..."})]}),h&&(0,c.jsxs)("div",{className:"text-center py-12",children:[(0,c.jsx)("p",{className:"text-sm text-[var(--error)] mb-3",children:h}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:b,children:"Retry"})]}),!d&&!h&&!r&&(0,c.jsx)("div",{className:"text-center py-12 text-sm text-[var(--text-muted)]",children:"Media library not available"}),!d&&!h&&r&&0===w.length&&(0,c.jsx)("div",{className:"text-center py-12 text-sm text-[var(--text-muted)]",children:m?"No images match your search":"No images found in media library"}),!d&&!h&&w.length>0&&(0,c.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-3",children:w.map(t=>{const r=e===t.url;return(0,c.jsxs)("button",{type:"button",className:D("relative rounded-lg border overflow-hidden cursor-pointer transition-all group aspect-square",r?"border-[var(--accent)] ring-2 ring-[var(--accent-glow)]":"border-[var(--border-glass)] hover:border-[var(--border-glass-focus)]"),onClick:()=>(e=>{n(e.url),v()})(t),children:[(0,c.jsx)("img",{src:`${t.url}?width=160&format=webp`,alt:t.name,className:"w-full h-full object-contain p-2 bg-[var(--input-bg)]",loading:"lazy"}),r&&(0,c.jsx)("div",{className:"absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-[var(--accent)] flex items-center justify-center",children:(0,c.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#1a1a2e",strokeWidth:"3",children:(0,c.jsx)("path",{d:"M20 6L9 17l-5-5"})})}),(0,c.jsx)("div",{className:"absolute inset-x-0 bottom-0 px-1.5 py-1 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,c.jsx)("p",{className:"text-[10px] text-white/80 truncate text-center",children:t.name})})]},t.id)})})]})]})})]})}var q=a(867),$=a(436);function H(e){this.content=e}H.prototype={constructor:H,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new H(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new H(n)},addToStart:function(e,t){return new H([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new H(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new H(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=H.from(e)).size?new H(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=H.from(e)).size?new H(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=H.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},H.from=function(e){if(e instanceof H)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new H(t)};const V=H;function U(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=U(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function _(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=_(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}class W{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new W(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new W(n,r)}cutByIndex(e,t){return e==t?W.empty:0==e&&t==this.content.length?this:new W(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new W(r,o)}addToStart(e){return new W([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new W(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return U(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return _(this,e,t,n)}findIndex(e){if(0==e)return K(0,e);if(e==this.size)return K(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?K(t+1,r):K(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return W.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new W(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return W.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new W(t||e,n)}static from(e){if(!e)return W.empty;if(e instanceof W)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new W([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}W.empty=new W([],0);const G={index:0,offset:0};function K(e,t){return G.index=e,G.offset=t,G}function J(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!J(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!J(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Y{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&J(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Y.none;if(e instanceof Y)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Y.none=[];class Q extends Error{}class Z{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ee(this.content,e+this.openStart,t);return n&&new Z(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(X(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Z.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Z(W.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new Z(e,n,r)}}function X(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(X(i.content,t-o-1,n-o-1)))}function ee(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=ee(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function te(e,t,n){if(n.openStart>e.depth)throw new Q("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Q("Inconsistent open depths");return ne(e,t,n,0)}function ne(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=ne(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(W.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return ae(i,le(e,o,s,t,r))}{let r=e.parent,o=r.content;return ae(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return ae(i,de(e,t,r))}function re(e,t){if(!t.type.compatibleContent(e.type))throw new Q("Cannot join "+t.type.name+" onto "+e.type.name)}function oe(e,t,n){let r=e.node(n);return re(r,t.node(n)),r}function ie(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function se(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(ie(e.nodeAfter,r),i++));for(let e=i;e<s;e++)ie(o.child(e),r);t&&t.depth==n&&t.textOffset&&ie(t.nodeBefore,r)}function ae(e,t){return e.type.checkContent(t),e.copy(t)}function le(e,t,n,r,o){let i=e.depth>o&&oe(e,t,o+1),s=r.depth>o&&oe(n,r,o+1),a=[];return se(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(re(i,s),ie(ae(i,le(e,t,n,r,o+1)),a)):(i&&ie(ae(i,de(e,t,o+1)),a),se(t,n,o,a),s&&ie(ae(s,de(n,r,o+1)),a)),se(r,null,o,a),new W(a)}function de(e,t,n){let r=[];return se(null,e,n,r),e.depth>n&&ie(ae(oe(e,t,n+1),de(e,t,n+1)),r),se(t,null,n,r),new W(r)}Z.empty=new Z(W.empty,0,0);class ce{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Y.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new fe(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new ce(t,n,o)}static resolveCached(e,t){let n=he.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else he.set(e,n=new pe);let r=n.elts[n.i]=ce.resolve(e,t);return n.i=(n.i+1)%ue,r}}class pe{constructor(){this.elts=[],this.i=0}}const ue=12,he=new WeakMap;class fe{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const me=Object.create(null);class ge{constructor(e,t,n,r=Y.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||W.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&J(this.attrs,t||e.defaultAttrs||me)&&Y.sameSet(this.marks,n||Y.none)}copy(e=null){return e==this.content?this:new ge(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ge(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Z.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Z(a,r.depth-i,o.depth-i)}replace(e,t,n){return te(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ce.resolveCached(this,e)}resolveNoCache(e){return ce.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),be(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=W.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Y.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Y.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=W.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ge.prototype.text=void 0;class ye extends ge{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):be(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ye(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ye(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function be(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class xe{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new ve(e,t);if(null==n.next)return xe.empty;let r=we(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);Me(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new xe(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Se);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(Me(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return W.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}xe.empty=new xe(!0);class ve{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function we(e){let t=[];do{t.push(ke(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ke(e){let t=[];do{t.push(Ce(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Ce(e){let t=function(e){if(e.eat("(")){let t=we(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Ne(e,t)}return t}function Te(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ne(e,t){let n=Te(e),r=n;return e.eat(",")&&(r="}"!=e.next?Te(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Se(e,t){return t-e}function Me(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Se)}function je(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Oe(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function Ae(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ee(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new De(e,r,t[r]);return n}class Le{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Ee(e,n.attrs),this.defaultAttrs=je(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xe.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Oe(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ge(this,this.computeAttrs(e),W.from(t),Y.setFrom(n))}createChecked(e=null,t,n){return t=W.from(t),this.checkContent(t),new ge(this,this.computeAttrs(e),t,Y.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=W.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(W.empty,!0);return o?new ge(this,e,t.append(o),Y.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ae(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Y.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new Le(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class De{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Ie{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ee(e,r.attrs),this.excluded=null;let o=je(this.attrs);this.instance=o?new Y(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Y(this,Oe(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Ie(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ae(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Re{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=V.from(e.nodes),t.marks=V.from(e.marks||{}),this.nodes=Le.compile(this.spec.nodes,this),this.marks=Ie.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=xe.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?Pe(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Pe(this,n.split(" "))}this.nodeFromJSON=e=>ge.fromJSON(this,e),this.markFromJSON=e=>Y.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Le))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new ye(n,n.defaultAttrs,e,Y.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Pe(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class ze{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Ve(this,t,!1);return n.addAll(e,Y.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ve(this,t,!0);return n.addAll(e,Y.none,t.from,t.to),Z.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ue(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_e(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_e(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ze(e,ze.schemaRules(e)))}}const Be={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Fe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},qe={ol:!0,ul:!0};function $e(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class He{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Y.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(W.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=W.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(W.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Be.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ve{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=$e(null,t.preserveWhitespace,0)|(n?4:0);r=o?new He(o.type,o.attrs,Y.none,!0,t.topMatch||o.type.contentMatch,i):new He(n?null:e.schema.topNodeType,null,Y.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();qe.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&qe.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Fe.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Be.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Y.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):We(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=$e(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Y.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):We(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new He(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Ue(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function _e(e){let t={};for(let n in e)t[n]=e[n];return t}function We(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Ge{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Je(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Qe(Je(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Qe(Je(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Qe(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ge(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ke(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ke(e.marks)}}function Ke(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Je(e){return e.document||window.document}const Ye=new WeakMap;function Qe(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){let t=Ye.get(e);return void 0===t&&Ye.set(e,t=function(e){let t=null;return function e(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(let t=0;t<n.length;t++)e(n[t]);else for(let t in n)e(n[t])}(e),t}(e)),t}(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),d=t[1],c=1;if(d&&"object"==typeof d&&null==d.nodeType&&!Array.isArray(d)){c=2;for(let e in d)if(null!=d[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),d[e]):"style"==e&&l.style?l.style.cssText=d[e]:l.setAttribute(e,d[e])}}for(let o=c;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:o}=Qe(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const Ze=Math.pow(2,16);function Xe(e,t){return e+t*Ze}function et(e){return 65535&e}class tt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class nt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&nt.empty)return nt.empty}recover(e){let t=0,n=et(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ze}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],d=this.ranges[s+i],c=a+l;if(e<=c){let o=a+r+((l?e==a?-1:e==c?1:t:t)<0?0:d);if(n)return o;let i=e==(t<0?a:c)?null:Xe(s/3,e-a),p=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(p|=8),new tt(o,p,i)}r+=d-l}return n?e+r:new tt(e+r,0,null)}touches(e,t){let n=0,r=et(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],d=this.ranges[r+n];e(s,s+l,a,a+d),o+=d-l}}invert(){return new nt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?nt.empty:new nt(e<0?[0,-e,0]:[0,0,e])}}nt.empty=new nt([]);class rt{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new rt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new rt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new tt(e,r,null)}}const ot=Object.create(null);class it{getMap(){return nt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ot[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ot)throw new RangeError("Duplicate use of step JSON ID "+e);return ot[e]=t,t.prototype.jsonID=e,t}}class st{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,t,n,r){try{return st.ok(e.replace(t,n,r))}catch(e){if(e instanceof Q)return st.fail(e.message);throw e}}}function at(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(at(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return W.fromArray(r)}class lt extends it{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Z(at(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return st.fromReplace(e,this.from,this.to,o)}invert(){return new dt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new lt(t.pos,n.pos,this.mark)}merge(e){return e instanceof lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new lt(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("addMark",lt);class dt extends it{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Z(at(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return st.fromReplace(e,this.from,this.to,n)}invert(){return new lt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new dt(t.pos,n.pos,this.mark)}merge(e){return e instanceof dt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new dt(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("removeMark",dt);class ct extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new ct(this.pos,t.marks[n]);return new ct(this.pos,this.mark)}}return new pt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ct(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ct(t.pos,e.markFromJSON(t.mark))}}it.jsonID("addNodeMark",ct);class pt extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new ct(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pt(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new pt(t.pos,e.markFromJSON(t.mark))}}it.jsonID("removeNodeMark",pt);class ut extends it{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ft(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new nt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ut(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&ut.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new ut(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ut)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ut(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ut(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ut(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}ut.MAP_BIAS=1,it.jsonID("replace",ut);class ht extends it{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(ft(e,this.from,this.gapFrom)||ft(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return st.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?st.fromReplace(e,this.from,this.to,n):st.fail("Content does not fit in gap")}getMap(){return new nt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ht(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new ht(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ht(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ft(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function mt(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t<i.childCount;t++){let l=i.child(t),d=a+l.nodeSize,c=r.matchType(l.type);if(c){r=c;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new dt(a,d,l.marks[t]));if(o&&l.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(l.text);)t||(t=new Z(W.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),s.push(new ut(a+e.index,a+e.index+e[0].length,t))}}else s.push(new ut(a,d,Z.empty));a=d}if(!r.validEnd){let t=r.fillBefore(W.empty,!0);e.replace(a,a,new Z(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function gt(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function yt(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!gt(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function bt(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(xt).concat({type:t,attrs:n}).concat(i.map(xt)):null}function xt(e){return{type:e,attrs:null}}function vt(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function wt(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function kt(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Ct(e,t){let n=e.resolve(t),r=n.index();return Tt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Tt(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function Nt(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&Tt(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function St(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Mt(e,t,n=t,r=Z.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return jt(o,i,r)?new ut(t,n,r):new Ot(o,i,r).fit()}function jt(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}it.jsonID("replaceAround",ht);class Ot{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=W.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=W.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Z(o,i,s);return e>-1?new ht(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new ut(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Lt(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:a}=this.frontier[e],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(W.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(2==t&&o&&(i=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Lt(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new Z(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Lt(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Z(At(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Z(At(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,d=[],{match:c,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)d.push(r.child(e));c=c.matchFragment(r)}let u=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=c.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(c=t,d.push(Dt(e.mark(p.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?u:-1)))}let h=l==s.childCount;h||(u=-1),this.placed=Et(this.placed,t,W.from(d)),this.frontier[t].match=c,h&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?Z.empty:new Z(At(i.content,e-1,1),e-1,u<0?i.openEnd:e-1):new Z(At(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!It(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=It(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=It(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Et(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Et(this.placed,this.depth,W.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(W.empty,!0);e.childCount&&(this.placed=Et(this.placed,this.frontier.length,e))}}function At(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(At(e.firstChild.content,t-1,n)))}function Et(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Et(e.lastChild.content,t-1,n)))}function Lt(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Dt(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Dt(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(W.empty,!0)))),e.copy(r)}function It(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Rt(e){return e.spec.defining||e.spec.definingForContent}function Pt(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Pt(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(W.empty,!0))}return e}function zt(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Bt extends it{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return st.fromReplace(e,this.pos,this.pos+1,new Z(W.from(r),0,t.isLeaf?0:1))}getMap(){return nt.empty}invert(e){return new Bt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bt(t.pos,t.attr,t.value)}}it.jsonID("attr",Bt);class Ft extends it{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return st.ok(n)}getMap(){return nt.empty}invert(e){return new Ft(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ft(t.attr,t.value)}}it.jsonID("docAttr",Ft);let qt=class extends Error{};qt=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(qt.prototype=Object.create(Error.prototype)).constructor=qt,qt.prototype.name="TransformError";class $t{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new qt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Z.empty){let r=Mt(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Z(W.from(n),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(jt(o,i,r))return e.step(new ut(t,n,r));let s=zt(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),d=[],c=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(d.push(n),t==r.openStart)break;e=n.content}for(let e=c-1;e>=0;e--){let t=d[e],n=Rt(t.type);if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))c=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+c+1)%(r.openStart+1),p=d[a];if(p)for(let t=0;t<s.length;t++){let d=s[(t+l)%s.length],c=!0;d<0&&(c=!1,d=-d);let u=o.node(d-1),h=o.index(d-1);if(u.canReplaceWith(h,h,p.type,p.marks))return e.replace(o.before(d),c?i.after(d):n,new Z(Pt(r.content,0,r.openStart,a),a,r.openEnd))}}let p=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>p));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Z(W.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&0==r.parentOffset&&0==o.parentOffset){let i=r.sharedDepth(n),s=!1;for(let e=r.depth;e>i;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=o.depth;e>i;e--)o.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=o.depth;e>0&&n==o.start(e);e--)n=o.before(e);r=e.doc.resolve(t),o=e.doc.resolve(n)}}let i=zt(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,d=a,c=W.empty,p=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,c=W.from(r.node(e).copy(c)),p++):l--;let u=W.empty,h=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,u=W.from(o.node(e).copy(u)),h++):d++;e.step(new ht(l,d,s,a,new Z(c.append(u),p,h),c.size-p,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);wt(e,r.node(),r.before(),a)}s.inlineContent&&mt(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),d=l.map(t-n);if(e.step(new ut(d,l.map(t+n,-1),Z.empty,!0)),!0===r){let t=e.doc.resolve(d);vt(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=W.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=W.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new ht(o,i,o,i,new Z(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&wt(e,t,n,i),mt(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),d=a.map(n+t.nodeSize,1);return e.step(new ht(l,d,l+1,d-1,new Z(W.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&vt(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ht(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Z(W.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Bt(e,t,n)),this}setDocAttribute(e,t){return this.step(new Ft(e,t)),this}addNodeMark(e,t){return this.step(new ct(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Y)t.isInSet(n.marks)&&this.step(new pt(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new pt(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=W.empty,s=W.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){i=W.from(o.node(e).copy(i));let t=r&&r[a];s=W.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new ut(t,t,new Z(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,d)=>{if(!e.isInline)return;let c=e.marks;if(!r.isInSet(c)&&d.type.allowsMarkType(r.type)){let d=Math.max(l,t),p=Math.min(l+e.nodeSize,n),u=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(u)||(o&&o.to==d&&o.mark.eq(c[e])?o.to=p:s.push(o=new dt(d,p,c[e])));i&&i.to==d?i.to=p:a.push(i=new lt(d,p,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof Ie){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new dt(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return mt(this,e,t,n),this}}const Ht=Object.create(null);class Vt{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Ut(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Z.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],d=e.mapping.slice(o);e.replaceRange(d.map(a.pos),d.map(l.pos),s?Z.empty:t),0==s&&en(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),d=a.map(s.pos);o?e.deleteRange(l,d):(e.replaceRangeWith(l,d,t),en(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Gt(e):Xt(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Xt(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Xt(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Qt(e.node(0))}static atStart(e){return Xt(e,e,0,0,1)||new Qt(e)}static atEnd(e){return Xt(e,e,e.content.size,e.childCount,-1)||new Qt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ht[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ht)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ht[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Gt.between(this.$anchor,this.$head).getBookmark()}}Vt.prototype.visible=!0;class Ut{constructor(e,t){this.$from=e,this.$to=t}}let _t=!1;function Wt(e){_t||e.parent.inlineContent||(_t=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Gt extends Vt{constructor(e,t=e){Wt(e),Wt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Vt.near(n);let r=e.resolve(t.map(this.anchor));return new Gt(r.parent.inlineContent?r:n,n)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Gt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Gt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Vt.findFrom(t,n,!0)||Vt.findFrom(t,-n,!0);if(!e)return Vt.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Vt.findFrom(e,-n,!0)||Vt.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Gt(e,t)}}Vt.jsonID("text",Gt);class Kt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Kt(e.map(this.anchor),e.map(this.head))}resolve(e){return Gt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Jt extends Vt{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Vt.near(o):new Jt(o)}content(){return new Z(W.from(this.node),0,0)}eq(e){return e instanceof Jt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Yt(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Jt(e.resolve(t.anchor))}static create(e,t){return new Jt(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Jt.prototype.visible=!1,Vt.jsonID("node",Jt);class Yt{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Kt(n,n):new Yt(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Jt.isSelectable(n)?new Jt(t):Vt.near(t)}}class Qt extends Vt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.empty){e.delete(0,e.doc.content.size);let t=Vt.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Qt(e)}map(e){return new Qt(e)}eq(e){return e instanceof Qt}getBookmark(){return Zt}}Vt.jsonID("all",Qt);const Zt={map(){return this},resolve:e=>new Qt(e)};function Xt(e,t,n,r,o,i=!1){if(t.inlineContent)return Gt.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Jt.isSelectable(r))return Jt.create(e,n-(o<0?r.nodeSize:0))}else{let t=Xt(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function en(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof ut||i instanceof ht)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Vt.near(e.doc.resolve(o),n)))}class tn extends $t{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Y.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Y.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Vt.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function nn(e,t){return t&&e?e.bind(t):e}class rn{constructor(e,t,n){this.name=e,this.init=nn(t.init,n),this.apply=nn(t.apply,n)}}const on=[new rn("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new rn("selection",{init:(e,t)=>e.selection||Vt.atStart(t.doc),apply:e=>e.selection}),new rn("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new rn("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class sn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=on.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new rn(e.key,e.spec.state,e))})}}class an{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,d=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(d&&n.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(d),n=n.applyInner(d),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new an(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new tn(this)}static create(e){let t=new sn(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new an(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new sn(this.schema,e.plugins),n=t.fields,r=new an(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new sn(e.schema,e.plugins),o=new an(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ge.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Vt.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function ln(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=ln(o,t,{})),n[r]=o}return n}class dn{constructor(e){this.spec=e,this.props={},e.props&&ln(e.props,this,this.props),this.key=e.key?e.key.key:pn("plugin")}getState(e){return e[this.key]}}const cn=Object.create(null);function pn(e){return e in cn?e+"$"+ ++cn[e]:(cn[e]=0,e+"$")}class un{constructor(e="key"){this.key=pn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const hn=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function fn(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const mn=(e,t,n)=>{let r=fn(e,n);if(!r)return!1;let o=xn(r);if(!o){let n=r.blockRange(),o=n&&yt(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(An(e,o,t,-1))return!0;if(0==r.parent.content.size&&(yn(i,"end")||Jt.isSelectable(i)))for(let n=r.depth;;n--){let s=Mt(e.doc,r.before(n),r.after(n),Z.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(yn(i,"end")?Vt.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):Jt.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))};function gn(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=Mt(e.doc,o,s,Z.empty);if(!a||a.from!=o||a instanceof ut&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Gt.create(t.doc,o)),n(t.scrollIntoView())}return!0}function yn(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const bn=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=xn(r)}let s=i&&i.nodeBefore;return!(!s||!Jt.isSelectable(s)||(t&&t(e.tr.setSelection(Jt.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function xn(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function vn(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const wn=(e,t,n)=>{let r=vn(e,n);if(!r)return!1;let o=Cn(r);if(!o)return!1;let i=o.nodeAfter;if(An(e,o,t,1))return!0;if(0==r.parent.content.size&&(yn(i,"start")||Jt.isSelectable(i))){let n=Mt(e.doc,r.before(),r.after(),Z.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(yn(i,"start")?Vt.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Jt.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))},kn=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Cn(r)}let s=i&&i.nodeAfter;return!(!s||!Jt.isSelectable(s)||(t&&t(e.tr.setSelection(Jt.create(e.doc,i.pos)).scrollIntoView()),0))};function Cn(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Tn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function Nn(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Sn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Nn(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Vt.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Mn=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Qt||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Nn(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Gt.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},jn=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(kt(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&yt(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var On;function An(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Ct(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=!l&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=W.empty;for(let e=o.length-1;e>=0;e--)i=W.from(o[e].create(null,i));i=W.from(s.copy(i));let l=e.tr.step(new ht(t.pos-1,r,t.pos,r,new Z(i,1,0),o.length,!0)),d=l.doc.resolve(r+2*o.length);d.nodeAfter&&d.nodeAfter.type==s.type&&Ct(l.doc,d.pos)&&l.join(d.pos),n(l.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:Vt.findFrom(t,1),p=c&&c.$from.blockRange(c.$to),u=p&&yt(p);if(null!=u&&u>=t.depth)return n&&n(e.tr.lift(p,u).scrollIntoView()),!0;if(d&&yn(a,"start",!0)&&yn(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=W.empty;for(let e=o.length-1;e>=0;e--)r=W.from(o[e].copy(r));n(e.tr.step(new ht(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Z(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function En(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Gt.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Ln=En(-1),Dn=En(1);function In(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Rn(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let Pn=Rn(hn,mn,bn),zn=Rn(hn,wn,kn);const Bn={Enter:Rn(Tn,Mn,jn,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Jt&&e.selection.node.isBlock)return!(!n.parentOffset||!kt(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=Nn(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let t=On;s.unshift(t||(a&&i?{type:i}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof Gt||e.selection instanceof Qt)&&d.deleteSelection();let c=d.mapping.map(n.pos),p=kt(d.doc,c,s.length,s);if(p||(s[0]=i?{type:i}:null,p=kt(d.doc,c,s.length,s)),!p)return!1;if(d.split(c,s.length,s),!a&&l&&n.node(o).type!=i){let e=d.mapping.map(n.before(o)),t=d.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&d.setNodeMarkup(d.mapping.map(n.before(o)),i)}return t&&t(d.scrollIntoView()),!0}),"Mod-Enter":Sn,Backspace:Pn,"Mod-Backspace":Pn,"Shift-Backspace":Pn,Delete:zn,"Mod-Delete":zn,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Qt(e.doc))),!0)},Fn={"Ctrl-h":Bn.Backspace,"Alt-Backspace":Bn["Mod-Backspace"],"Ctrl-d":Bn.Delete,"Ctrl-Alt-Backspace":Bn["Mod-Delete"],"Alt-Delete":Bn["Mod-Delete"],"Alt-d":Bn["Mod-Delete"],"Ctrl-a":Ln,"Ctrl-e":Dn};for(let e in Bn)Fn[e]=Bn[e];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const qn=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},$n=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Hn=null;const Vn=function(e,t,n){let r=Hn||(Hn=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Un=function(e,t,n,r){return n&&(Wn(e,t,n,r,-1)||Wn(e,t,n,r,1))},_n=/^(img|br|input|textarea|hr)$/i;function Wn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Gn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Kn(e)||_n.test(e.nodeName)||"false"==e.contentEditable)return!1;t=qn(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Gn(e):0}}}}function Gn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Kn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Jn=function(e){return e.focusNode&&Un(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Yn(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Qn="undefined"!=typeof navigator?navigator:null,Zn="undefined"!=typeof document?document:null,Xn=Qn&&Qn.userAgent||"",er=/Edge\/(\d+)/.exec(Xn),tr=/MSIE \d/.exec(Xn),nr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),rr=!!(tr||nr||er),or=tr?document.documentMode:nr?+nr[1]:er?+er[1]:0,ir=!rr&&/gecko\/(\d+)/i.test(Xn);ir&&(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const sr=!rr&&/Chrome\/(\d+)/.exec(Xn),ar=!!sr,lr=sr?+sr[1]:0,dr=!rr&&!!Qn&&/Apple Computer/.test(Qn.vendor),cr=dr&&(/Mobile\/\w+/.test(Xn)||!!Qn&&Qn.maxTouchPoints>2),pr=cr||!!Qn&&/Mac/.test(Qn.platform),ur=!!Qn&&/Win/.test(Qn.platform),hr=/Android \d/.test(Xn),fr=!!Zn&&"webkitFontSmoothing"in Zn.documentElement.style,mr=fr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function yr(e,t){return"number"==typeof e?e:e[t]}function br(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function xr(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=$n(s);continue}let e=s,n=e==i.body,a=n?gr(i):br(e),l=0,d=0;if(t.top<a.top+yr(r,"top")?d=-(a.top-t.top+yr(o,"top")):t.bottom>a.bottom-yr(r,"bottom")&&(d=t.bottom-t.top>a.bottom-a.top?t.top+yr(o,"top")-a.top:t.bottom-a.bottom+yr(o,"bottom")),t.left<a.left+yr(r,"left")?l=-(a.left-t.left+yr(o,"left")):t.right>a.right-yr(r,"right")&&(l=t.right-a.right+yr(o,"right")),l||d)if(n)i.defaultView.scrollBy(l,d);else{let n=e.scrollLeft,r=e.scrollTop;d&&(e.scrollTop+=d),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let c=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(c))break;s="absolute"==c?s.offsetParent:$n(s)}}function vr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=$n(r));return t}function wr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let kr=null;function Cr(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,d=t.top;for(let c=e.firstChild,p=0;c;c=c.nextSibling,p++){let e;if(1==c.nodeType)e=c.getClientRects();else{if(3!=c.nodeType)continue;e=Vn(c).getClientRects()}for(let u=0;u<e.length;u++){let h=e[u];if(h.top<=l&&h.bottom>=d){l=Math.max(h.bottom,l),d=Math.min(h.top,d);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<s){n=c,s=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==c.nodeType&&e&&(a=p+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!o&&h.left<=t.left&&h.right>=t.left&&(o=c,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(a=p+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=jr(o,1);if(r.top!=r.bottom&&Tr(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:Cr(n,r)}function Tr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Nr(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Tr(t,o))return Nr(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Sr(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Gn(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Gn(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Tr(t,n))return null;if(a=Nr(e.dom,t,n),!a)return null}if(dr)for(let e=a;n&&e;e=$n(e))e.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(ir&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;fr&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=Cr(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Mr(e){return e.top<e.bottom||e.left<e.right}function jr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Mr(e))return e}return Array.prototype.find.call(n,Mr)||e.getBoundingClientRect()}const Or=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ar(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=fr||ir;if(3==r.nodeType){if(!s||!Or.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Er(jr(Vn(r,e,t),i),i<0)}{let e=jr(Vn(r,o,o),n);if(ir&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=jr(Vn(r,o-1,o-1),-1);if(t.top==e.top){let n=jr(Vn(r,o,o+1),-1);if(n.top!=e.top)return Er(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Gn(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Lr(e.getBoundingClientRect(),!1)}if(null==i&&o<Gn(r)){let e=r.childNodes[o];if(1==e.nodeType)return Lr(e.getBoundingClientRect(),!0)}return Lr(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Gn(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Vn(e,Gn(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Er(jr(t,1),!1)}if(null==i&&o<Gn(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Vn(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Er(jr(t,-1),!0)}return Er(jr(3==r.nodeType?Vn(r):r,-n),n>=0)}function Er(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Lr(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Dr(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Ir=/[\u0590-\u08ac]/;let Rr=null,Pr=null,zr=!1;class Br{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>qn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof _r){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Fr&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?qn(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?qn(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=qn(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=qn(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],d=a+l.size;if(o>a&&i<d)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=d}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),d=n.domSelectionRange(),c=!1;if((ir||dr)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(c=!(!t||"\n"!=e.nodeValue[t-1]),c&&t==e.nodeValue.length)for(let t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=a={node:t.parentNode,offset:qn(t)+1});break}let e=n.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ir&&d.focusNode&&d.focusNode!=a.node&&1==d.focusNode.nodeType){let e=d.focusNode.childNodes[d.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&dr)&&Un(s.node,s.offset,d.anchorNode,d.anchorOffset)&&Un(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((l.extend||e==t)&&(!c||!ir)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),p=!0}catch(e){}}if(!p){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Fr extends Br{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class qr extends Br{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class $r extends Br{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Ge.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new $r(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=$r.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=oo(o,t,i,n)),e>0&&(o=oo(o,0,e,n));for(let e=0;e<o.length;e++)o[e].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Hr extends Br{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),d=l&&l.dom,c=l&&l.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else if(!d){let e=Ge.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:d,contentDOM:c}=e)}c||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=Xr(d,n,t),l?s=new Wr(e,t,n,r,d,c||null,p,l,o,i+1):t.isText?new Ur(e,t,n,r,d,p,o):new Hr(e,t,n,r,d,c||null,p,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>W.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&eo(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new no(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let d=0;;){let c,p,u,h;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(c?(p||(p=[c])).push(e):c=e)}if(c)if(p){p.sort(ro);for(let e=0;e<p.length;e++)n(p[e],d,!!l)}else n(c,d,!!l);if(l)h=-1,u=l,l=null;else{if(!(d<e.childCount))break;h=d,u=e.child(d++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+u.nodeSize;if(u.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=u.cut(e-i),u=u.cut(0,e-i),f=e,h=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(u,u.isInline&&!u.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,u),h),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Y.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,l,d)=>{let c;a.syncToMarks(t.marks,n,e,d),a.findNodeMatch(t,i,l,d)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(c=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,c,e)||a.updateNextNode(t,i,l,e,d,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Gr(this.contentDOM,this.children,e),cr&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Gt)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new qr(this,o,t,r);e.input.compositionNodes.push(i),this.children=oo(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(eo(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Qr(this.dom,this.nodeDOM,Yr(this.outerDeco,this.node,t),Yr(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Vr(e,t,n,r,o){Xr(r,t,e);let i=new Hr(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Ur extends Hr{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Ur(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _r extends Br{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Wr extends Hr{constructor(e,t,n,r,o,i,s,a,l,d){super(e,t,n,r,o,i,s,l,d),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Gr(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=to(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof $r){let t=r?r.previousSibling:e.lastChild;Gr(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=to(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Kr=function(e){e&&(this.nodeName=e)};Kr.prototype=Object.create(null);const Jr=[new Kr];function Yr(e,t,n){if(0==e.length)return Jr;let r=n?Jr[0]:new Kr,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Kr(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Kr(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Qr(e,t,n,r){if(n==Jr&&r==Jr)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=Jr[0]),o=t}Zr(o,s||Jr[0],i)}return o}function Zr(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Xr(e,t,n){return Qr(e,e,Jr,Yr(t,n,1!=e.nodeType))}function eo(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function to(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class no{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof $r)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=$r.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Hr){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let d,c=a.dom,p=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&eo(t,a.outerDeco));if(!p&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,i+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!eo(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Hr.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Hr.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Fr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof $r;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ur)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((dr||ar)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new _r(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function ro(e,t){return e.type.side-t.type.side}function oo(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],d=a,c=a+=l.size;d>=n||c<=t?i.push(l):(d<t&&i.push(l.slice(0,t-d,r)),o&&(i.push(o),o=void 0),c>n&&i.push(l.slice(n-d,l.size,r)))}return i}function io(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,d=r.resolve(s);if(Jn(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Jt.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Gn(e);r||o;){if(e==n)return!0;let t=qn(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Gn(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Jt(s==e?d:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],d=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);return l||(l=mo(e,c,d,"pointer"==t||e.state.selection.head<d.pos&&!i?1:-1)),l}function so(e){return e.editable?e.hasFocus():yo(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ao(e,t=!1){let n=e.state.selection;if(ho(e,n),so(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&ar){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Un(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,qn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&rr&&or<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!lo||n instanceof Gt||(n.$from.parent.inlineContent||(r=co(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=co(e,n.to))),e.docView.setSelection(i,s,e,t),lo&&(r&&uo(r),o&&uo(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{so(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const lo=dr||ar&&lr<63;function co(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(dr&&o&&"false"==o.contentEditable)return po(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return po(o);if(i)return po(i)}}function po(e){return e.contentEditable="true",dr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function uo(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function ho(e,t){if(t instanceof Jt){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(fo(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else fo(e)}function fo(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function mo(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Gt.between(t,n,r)}function go(e){return!(e.editable&&!e.hasFocus())&&yo(e)}function yo(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function bo(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Vt.findFrom(i,t)}function xo(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vo(e,t,n){let r=e.state.selection;if(!(r instanceof Gt)){if(r instanceof Jt&&r.node.isInline)return xo(e,new Gt(t>0?r.$to:r.$from));{let n=bo(e.state,t);return!!n&&xo(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return xo(e,new Gt(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=bo(e.state,t);return!!(n&&n instanceof Jt)&&xo(e,n)}if(!(pr&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Jt.isSelectable(i)?xo(e,new Jt(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!fr&&xo(e,new Gt(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function wo(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ko(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Co(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(ir&&1==n.nodeType&&r<wo(n)&&ko(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(ko(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(To(n))break;{let t=n.previousSibling;for(;t&&ko(t,-1);)o=n.parentNode,i=qn(t),t=t.previousSibling;if(t)n=t,r=wo(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?No(e,n,r):o&&No(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=wo(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!ko(n.childNodes[r],1))break;o=n,i=++r}else{if(To(n))break;{let t=n.nextSibling;for(;t&&ko(t,1);)o=t.parentNode,i=qn(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=wo(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&No(e,o,i)}(e)}function To(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function No(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Kn(e);)t=qn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Kn(e);)t=qn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Jn(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ao(e)},50)}function So(e,t){let n=e.state.doc.resolve(t);if(!ar&&!ur&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Mo(e,t,n){let r=e.state.selection;if(r instanceof Gt&&!r.empty||n.indexOf("s")>-1)return!1;if(pr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=bo(e.state,t);if(n&&n instanceof Jt)return xo(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Qt?Vt.near(n,t):Vt.findFrom(n,t);return!!s&&xo(e,s)}return!1}function jo(e,t){if(!(e.state.selection instanceof Gt))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Oo(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ao(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Ge.fromSchema(e.state.schema),a=qo(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let d,c=l.firstChild,p=0;for(;c&&1==c.nodeType&&(d=Bo[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),p++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${o} ${i}${p?` -${p}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Eo(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Z(W.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Ge.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=qo().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&Bo[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;return t?($o||($o=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),$o.createHTML(e)):e}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),fr&&function(e){let t=e.querySelectorAll(ar?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let d=i&&i.querySelector("[data-pm-slice]"),c=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let e=+c[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||ze.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!c),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Lo.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(c)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=W.from(t.create(n[e+1],o)),i++,s++}return new Z(o,i,s)}(zo(s,+c[1],+c[2]),c[4]);else if(s=Z.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&Io(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ro(i[i.length-1],r.length));let t=Do(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return W.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=zo(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Lo=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Do(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,W.from(e));return e}function Io(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Io(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(W.from(Do(n,e,o+1))))}}function Ro(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ro(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(W.empty,!0);return e.copy(n.append(r))}function Po(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Po(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(W.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function zo(e,t,n){return t<e.openStart&&(e=new Z(Po(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Z(Po(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Bo={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fo=null;function qo(){return Fo||(Fo=document.implementation.createHTMLDocument("title"))}let $o=null;const Ho={},Vo={},Uo={touchstart:!0,touchmove:!0};class _o{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Wo(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Go(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Ko(e,t))})}function Ko(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Jo(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Yo(e){return{left:e.clientX,top:e.clientY}}function Qo(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function Zo(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Xo(e,t,n,r){return Qo(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function ei(e,t,n,r){return Qo(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Zo(e,Gt.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)Zo(e,Gt.create(r,i+1,i+1+n.content.size),"pointer");else{if(!Jt.isSelectable(n))continue;Zo(e,Jt.create(r,i),"pointer")}return!0}}(e,n,r)}function ti(e){return li(e)}Vo.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!oi(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!hr||!ar||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!cr||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||pr&&72==n&&"c"==r)return jo(e,-1)||Co(e,-1);if(46==n&&!t.shiftKey||pr&&68==n&&"c"==r)return jo(e,1)||Co(e,1);if(13==n||27==n)return!0;if(37==n||pr&&66==n&&"c"==r){let t=37==n?"ltr"==So(e,e.state.selection.from)?-1:1:-1;return vo(e,t,r)||Co(e,t)}if(39==n||pr&&70==n&&"c"==r){let t=39==n?"ltr"==So(e,e.state.selection.from)?1:-1:1;return vo(e,t,r)||Co(e,t)}return 38==n||pr&&80==n&&"c"==r?Mo(e,-1,r)||Co(e,-1):40==n||pr&&78==n&&"c"==r?function(e){if(!dr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Oo(e,n,"true"),setTimeout(()=>Oo(e,n,"false"),20)}return!1}(e)||Mo(e,1,r)||Co(e,1):r==(pr?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Wo(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Vo.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Vo.keypress=(e,t)=>{let n=t;if(oi(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||pr&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Gt&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const ni=pr?"metaKey":"ctrlKey";Ho.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ti(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[ni]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Yo(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ri(e,s,n,!!r)):("doubleClick"==i?Xo:ei)(e,s.pos,s.inside,n)?n.preventDefault():Wo(e,"pointer"))};class ri{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ni],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;0==n.button&&(o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Jt&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!ir||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ao(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Yo(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wo(this.view,"pointer"):function(e,t,n,r,o){return Qo(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Jt&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(Jt.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(Zo(e,Jt.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Jt.isSelectable(r))&&(Zo(e,new Jt(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||dr&&this.mightDrag&&!this.mightDrag.node.isAtom||ar&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Zo(this.view,Vt.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Wo(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wo(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function oi(e,t){return!!e.composing||!!(dr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Ho.touchstart=e=>{e.input.lastTouch=Date.now(),ti(e),Wo(e,"pointer")},Ho.touchmove=e=>{e.input.lastTouch=Date.now(),Wo(e,"pointer")},Ho.contextmenu=e=>ti(e);const ii=hr?5e3:-1;function si(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>li(e),t))}function ai(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function li(e,t=!1){if(!(hr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ai(e),t||e.docView&&e.docView.dirty){let n=io(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Vo.compositionstart=Vo.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Gt&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||ar&&ur&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),li(e,!0),e.markCursor=null;else if(li(e,!t.selection.empty),ir&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}si(e,ii)},Vo.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,si(e,20))};const di=rr&&or<15||cr&&mr<604;function ci(e,t,n,r,o){let i=Eo(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||Z.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pi(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ho.copy=Vo.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=di?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ao(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vo.paste=(e,t)=>{let n=t;if(e.composing&&!hr)return;let r=di?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&ci(e,pi(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ci(e,r.value,null,o,t):ci(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class ui{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const hi=pr?"altKey":"ctrlKey";function fi(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[hi]}Ho.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Yo(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Jt?i.to-1:i.to));else if(r&&r.mightDrag)o=Jt.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Jt.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:d,slice:c}=Ao(e,a);(!n.dataTransfer.files.length||!ar||lr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(di?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",di||n.dataTransfer.setData("text/plain",d),e.dragging=new ui(c,fi(e,n),o)},Ho.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Vo.dragover=Vo.dragenter=(e,t)=>t.preventDefault(),Vo.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Yo(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Eo(e,pi(t.dataTransfer),di?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!fi(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||Z.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?St(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let d=l.mapping.map(a),c=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,p=l.doc;if(c?l.replaceRangeWith(d,d,i.content.firstChild):l.replaceRange(d,d,i),l.doc.eq(p))return;let u=l.doc.resolve(d);if(c&&Jt.isSelectable(i.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Jt(u));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(mo(e,u,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Ho.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ao(e)},20))},Ho.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Ho.beforeinput=(e,t)=>{if(ar&&hr&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Yn(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Vo)Ho[e]=Vo[e];function mi(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class gi{constructor(e,t){this.toDOM=e,this.spec=t||wi,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new xi(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof gi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&mi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yi{constructor(e,t){this.attrs=e,this.spec=t||wi}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new xi(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof yi&&mi(this.attrs,e.attrs)&&mi(this.spec,e.spec)}static is(e){return e.type instanceof yi}destroy(){}}class bi{constructor(e,t){this.attrs=e,this.spec=t||wi}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new xi(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof bi&&mi(this.attrs,e.attrs)&&mi(this.spec,e.spec)}destroy(){}}class xi{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new xi(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new xi(e,e,new gi(t,n))}static inline(e,t,n,r){return new xi(e,t,new yi(n,r))}static node(e,t,n,r){return new xi(e,t,new bi(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof yi}get widget(){return this.type instanceof gi}}const vi=[],wi={};class ki{constructor(e,t){this.local=e.length?e:vi,this.children=t.length?t:vi}static create(e,t){return t.length?ji(t,e,0,wi):Ci}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Ci||0==e.maps.length?this:this.mapInner(e,t,0,0,n||wi)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let d=n.map(e[t]+i),c=d-o;if(c<0||c>=r.content.size){l=!0;continue}let p=n.map(e[t+1]+i,-1)-o,{index:u,offset:h}=r.content.findIndex(c),f=r.maybeChild(u);if(f&&h==c&&h+f.nodeSize==p){let r=a[t+2].mapInner(n,f,d+1,e[t]+i+1,s);r!=Ci?(a[t]=c,a[t+1]=p,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),d=ji(l,r,0,s);t=d.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<d.children.length;e+=3){let n=d.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,d.children[e],d.children[e+1],d.children[e+2])}}return new ki(t.sort(Oi),a)}(this.children,i||[],e,t,n,r,o):i?new ki(i.sort(Oi),vi):Ci}add(e,t){return t.length?this==Ci?ki.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Si(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,ji(s,e,a+1,wi)),o+=3}});let i=Ni(o?Mi(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new ki(i.length?this.local.concat(i).sort(Oi):this.local,r||this.children)}remove(e){return 0==e.length||this==Ci?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Ci?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ki(r,n):Ci}forChild(e,t){if(this==Ci)return this;if(t.isLeaf)return ki.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof yi){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new ki(r.sort(Oi),vi);return n?new Ti([e,n]):e}return n||Ci}eq(e){if(this==e)return!0;if(!(e instanceof ki)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ai(this.localsInner(e))}localsInner(e){if(this==Ci)return vi;if(e.inlineContent||!this.local.some(yi.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof yi||t.push(this.local[e]);return t}forEachSet(e){e(this)}}ki.empty=new ki([],[]),ki.removeOverlap=Ai;const Ci=ki.empty;class Ti{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,wi));return Ti.from(n)}forChild(e,t){if(t.isLeaf)return ki.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Ci&&(o instanceof Ti?n=n.concat(o.members):n.push(o))}return Ti.from(n)}eq(e){if(!(e instanceof Ti)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ai(n?t:t.sort(Oi)):vi}static from(e){switch(e.length){case 0:return Ci;case 1:return e[0];default:return new Ti(e.every(e=>e instanceof ki)?e:e.reduce((e,t)=>e.concat(t instanceof ki?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ni(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new xi(o.from+t,o.to+t,o.type))}return n}function Si(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Mi(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ji(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Si(e,t,s+n);if(a){i=!0;let e=ji(a,t,n+s+1,r);e!=Ci&&o.push(s,s+t.nodeSize,e)}});let s=Ni(i?Mi(e):e,-n).sort(Oi);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new ki(s,o):Ci}function Oi(e,t){return e.from-t.from||e.to-t.to}function Ai(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Ei(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Ei(t,o+1,i.copy(r.to,i.to)))}}return t}function Ei(e,t,n){for(;t<e.length&&Oi(n,e[t])>0;)t++;e.splice(t,0,n)}function Li(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Ci&&t.push(r)}),e.cursorWrapper&&t.push(ki.create(e.state.doc,[e.cursorWrapper.deco])),Ti.from(t)}const Di={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ii=rr&&or<=11;class Ri{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Pi{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ri,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);rr&&or<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():dr&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ii&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Di)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(go(this.view)){if(this.suppressingSelectionUpdates)return ao(this.view);if(rr&&or<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Un(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let t=e.focusNode;t;t=$n(t))n.add(t);for(let r=e.anchorNode;r;r=$n(r))if(n.has(r)){t=r;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&go(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],a);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(ir&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&qi(e,n)==t||r.remove()}}}}else for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jn(n)&&(l=io(e))&&l.eq(Vt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ao(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(!zi.has(e)&&(zi.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=ir,Bi)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Bi=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ao(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(rr&&or<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?qn(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?qn(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let zi=new WeakMap,Bi=!1;function Fi(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Un(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function qi(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function $i(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(dr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||dr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Hi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Vi(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:mo(e,t.resolve(n.anchor),t.resolve(n.head))}function Ui(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function _i(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Wi{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _o,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Qi),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ji(this),Ki(this),this.nodeViews=Yi(this),this.docView=Vr(this.state.doc,Gi(this),Li(this),this.dom,this),this.domObserver=new Pi(this,(e,t,n,r)=>function(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=io(e,t);if(n&&!e.state.selection.eq(n)){if(ar&&hr&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,d,c=e.state.selection,p=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),d=e.domSelectionRange(),c=d.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(r=[{node:c,offset:d.anchorOffset}],Jn(d)||r.push({node:d.focusNode,offset:d.focusOffset})),ar&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let p=e.state.doc,u=e.someProp("domParser")||ze.fromSchema(e.state.schema),h=p.resolve(a),f=null,m=u.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:$i,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),u=e.state.doc,h=u.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,d="end"):(l=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,a))-i),s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&_i(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&_i(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(h.content,p.doc.content,p.from,l,d);if(f&&e.input.domChangeCount++,(cr&&e.input.lastIOSEnter>Date.now()-225||hr)&&o.some(e=>1==e.nodeType&&!Hi.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof Gt&&!c.empty&&c.$head.sameParent(c.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let t=Vi(e,e.state.doc,p.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:c.from,endA:c.to,endB:c.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Gt&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),rr&&or<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>p.from&&"  "==p.doc.textBetween(f.start-p.from-1,f.start-p.from+1)&&(f.start--,f.endA--,f.endB--);let m=p.doc.resolveNoCache(f.start-p.from),g=p.doc.resolveNoCache(f.endB-p.from),y=u.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((cr&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&m.pos<p.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(p.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Yn(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Ui(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Ui(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Ui(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(u,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Yn(8,"Backspace"))))return void(hr&&ar&&e.domObserver.suppressSelectionUpdates());ar&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),hr&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==f.endA&&(f.endB-=2,g=p.doc.resolveNoCache(f.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Yn(13,"Enter"))})},20));let x,v=f.start,w=f.endA,k=t=>{let n=t||e.state.tr.replace(v,w,p.doc.slice(f.start-p.from,f.endB-p.from));if(p.sel){let t=Vi(e,n.doc,p.sel);t&&!(ar&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==v||t.head==n.mapping.map(w)-1)||rr&&t.empty&&t.head==v)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){rr&&or<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ao(e),20));let t=k(e.state.tr.delete(v,w)),n=u.resolve(f.start).marksAcross(u.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(x=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let e=0;e<s.length;e++)a=s[e].removeFromSet(a);for(let e=0;e<i.length;e++)l=i[e].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(o(t.child(e)));if(W.from(d).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start())))){let t=k(e.state.tr);"add"==x.type?t.addMark(v,w,x.mark):t.removeMark(v,w,x.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,v,w));e.someProp("handleTextInput",r=>r(e,v,w,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Ho){let n=Ho[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Jo(e,t)||Ko(e,t)||!e.editable&&t.type in Vo||n(e,t)},Uo[t]?{passive:!0}:void 0)}dr&&e.dom.addEventListener("input",()=>null),Go(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Go(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Qi),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(ai(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Yi(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Go(this),this.editable=Ji(this),Ki(this);let a=Li(this),l=Gi(this),d=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",c=o||!this.docView.matchesNode(e.doc,l,a);!c&&e.selection.eq(r.selection)||(i=!0);let p="preserve"==d&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:vr(e.dom)}}(this);if(i){this.domObserver.stop();let t=c&&(rr||ar)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(c){let n=ar?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Gn(e=e.childNodes[t-1])}else{if(!e.parentNode||Kn(e))return null;t=qn(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Kn(e))return null;t=qn(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Vr(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Un(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?ao(this,t):(ho(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wr(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Jt){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&xr(this,t.getBoundingClientRect(),e)}else xr(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new ui(e.slice,e.move,r<0?void 0:Jt.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(rr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(kr)return e.focus(kr);let t=vr(e);e.focus(null==kr?{get preventScroll(){return kr={preventScroll:!0},!0}}:void 0),kr||(kr=!1,wr(t,0))}(this.dom),ao(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Sr(this,e)}coordsAtPos(e,t=1){return Ar(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return Rr==t&&Pr==n?zr:(Rr=t,Pr=n,zr="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Dr(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ar(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Vn(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Ir.test(r.parent.textContent)&&a.modify?Dr(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let d=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:p}=e.domSelectionRange(),u=c&&!d.contains(1==c.nodeType?c:c.parentNode)||t==c&&o==p;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(e){}return null!=l&&(a.caretBidiLevel=l),u}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return ci(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ci(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ao(this,e)}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Li(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Hn=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Ko(e,t)||!Ho[t.type]||!e.editable&&t.type in Vo||Ho[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?dr&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Fi(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Fi(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Gi(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[xi.node(0,e.state.doc.content.size,t)]}function Ki(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:xi.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ji(e){return!e.someProp("editable",t=>!1===t(e.state))}function Yi(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Qi(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Wi.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Zi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},es="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ts="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ns=0;ns<10;ns++)Zi[48+ns]=Zi[96+ns]=String(ns);for(ns=1;ns<=24;ns++)Zi[ns+111]="F"+ns;for(ns=65;ns<=90;ns++)Zi[ns]=String.fromCharCode(ns+32),Xi[ns]=String.fromCharCode(ns);for(var rs in Zi)Xi.hasOwnProperty(rs)||(Xi[rs]=Zi[rs]);const is="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ss="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function as(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);is?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function ls(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ds(e){let t=function(e){let t=Object.create(null);for(let n in e)t[as(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(es&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ts&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Xi:Zi)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[ls(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[ls(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(ss&&n.ctrlKey&&n.altKey)&&(r=Zi[n.keyCode])&&r!=o){let o=t[ls(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var cs=Object.defineProperty,ps=(e,t)=>{for(var n in t)cs(e,n,{get:t[n],enumerable:!0})};function us(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var hs=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),d}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return d}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:us({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},fs={};ps(fs,{blur:()=>ms,clearContent:()=>gs,clearNodes:()=>ys,command:()=>bs,createParagraphNear:()=>xs,cut:()=>vs,deleteCurrentNode:()=>ws,deleteNode:()=>Cs,deleteRange:()=>Ts,deleteSelection:()=>Ns,enter:()=>Ss,exitCode:()=>Ms,extendMarkRange:()=>Is,first:()=>Rs,focus:()=>$s,forEach:()=>Hs,insertContent:()=>Vs,insertContentAt:()=>Gs,joinBackward:()=>Ys,joinDown:()=>Js,joinForward:()=>Qs,joinItemBackward:()=>Zs,joinItemForward:()=>Xs,joinTextblockBackward:()=>ea,joinTextblockForward:()=>ta,joinUp:()=>Ks,keyboardShortcut:()=>ra,lift:()=>ia,liftEmptyBlock:()=>sa,liftListItem:()=>aa,newlineInCode:()=>la,resetAttributes:()=>pa,scrollIntoView:()=>ua,selectAll:()=>ha,selectNodeBackward:()=>fa,selectNodeForward:()=>ma,selectParentNode:()=>ga,selectTextblockEnd:()=>ya,selectTextblockStart:()=>ba,setContent:()=>va,setMark:()=>el,setMeta:()=>tl,setNode:()=>nl,setNodeSelection:()=>rl,setTextDirection:()=>ol,setTextSelection:()=>il,sinkListItem:()=>sl,splitBlock:()=>ll,splitListItem:()=>dl,toggleList:()=>ul,toggleMark:()=>hl,toggleNode:()=>fl,toggleWrap:()=>ml,undoInputRule:()=>gl,unsetAllMarks:()=>yl,unsetMark:()=>bl,unsetTextDirection:()=>xl,updateAttributes:()=>vl,wrapIn:()=>wl,wrapInList:()=>kl});var ms=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),gs=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),ys=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=yt(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},bs=e=>t=>e(t),xs=()=>({state:e,dispatch:t})=>Mn(e,t),vs=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Gt(r.doc.resolve(Math.max(s-1,0)))),!0},ws=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ks(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Cs=e=>({tr:t,state:n,dispatch:r})=>{const o=ks(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Ts=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Ns=()=>({state:e,dispatch:t})=>hn(e,t),Ss=()=>({commands:e})=>e.keyboardShortcut("Enter"),Ms=()=>({state:e,dispatch:t})=>Sn(e,t);function js(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Os(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:js(t[r])?t[r].test(e[r]):t[r]===e[r])}function As(e,t,n={}){return e.find(e=>e.type===t&&Os(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Es(e,t,n={}){return!!As(e,t,n)}function Ls(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){const e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!As([...r.node.marks],t,n))return;let o=r.index,i=e.start()+r.offset,s=o+1,a=i+r.node.nodeSize;for(;o>0&&Es([...e.parent.child(o-1).marks],t,n);)o-=1,i-=e.parent.child(o).nodeSize;for(;s<e.parent.childCount&&Es([...e.parent.child(s).marks],t,n);)a+=e.parent.child(s).nodeSize,s+=1;return{from:i,to:a}}function Ds(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Is=(e,t)=>({tr:n,state:r,dispatch:o})=>{const i=Ds(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:d,to:c}=a;if(o){const e=Ls(l,i,t);if(e&&e.from<=d&&e.to>=c){const t=Gt.create(s,e.from,e.to);n.setSelection(t)}}return!0},Rs=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Ps(e){return e instanceof Gt}function zs(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Bs(e,t=null){if(!t)return null;const n=Vt.atStart(e),r=Vt.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Gt.create(e,zs(0,o,i),zs(e.content.size,o,i)):Gt.create(e,zs(t,o,i),zs(t,o,i))}function Fs(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function qs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var $s=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(qs()||Fs())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||qs()||Fs()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!Ps(n.state.selection))return s(),!0;const a=Bs(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Hs=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Vs=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Us=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Us(r)}return e};function _s(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Us(n)}function Ws(e,t,n){if(e instanceof ge||e instanceof W)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return W.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Ws("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Re({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?ze.fromSchema(i).parseSlice(_s(e),n.parseOptions):ze.fromSchema(i).parse(_s(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=ze.fromSchema(t);return n.slice?r.parseSlice(_s(e),n.parseOptions).content:r.parse(_s(e),n.parseOptions)}return Ws("",t,n)}var Gs=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const a=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ws(t,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(e){a(e)}try{o=Ws(t,i.schema,{parseOptions:l,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return a(e),!1}let d,{from:c,to:p}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,h=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),u=!!u&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),c===p&&h){const{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(c-=1,p+=1)}if(u){if(Array.isArray(t))d=t.map(e=>e.text||"").join("");else if(t instanceof W){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),d=e}else d="object"==typeof t&&t&&t.text?t.text:t;r.insertText(d,c,p)}else{d=o;const e=r.doc.resolve(c),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,p,d)}n.updateSelection&&function(e,t){const n=e.steps.length-1;if(n<t)return;const r=e.steps[n];if(!(r instanceof ut||r instanceof ht))return;const o=e.mapping.maps[n];let i=0;o.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(Vt.near(e.doc.resolve(i),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:d})}return!0},Ks=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Jt;if(o){if(r.node.isTextblock||!Ct(e.doc,r.from))return!1;n=r.from}else if(n=Nt(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Jt.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Js=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Jt){if(r.node.isTextblock||!Ct(e.doc,r.to))return!1;n=r.to}else if(n=Nt(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Ys=()=>({state:e,dispatch:t})=>mn(e,t),Qs=()=>({state:e,dispatch:t})=>wn(e,t),Zs=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nt(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Xs=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nt(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},ea=()=>({state:e,dispatch:t})=>((e,t)=>{let n=fn(e,void 0);if(!n)return!1;let r=xn(n);return!!r&&gn(e,r,t)})(e,t),ta=()=>({state:e,dispatch:t})=>((e,t)=>{let n=vn(e,void 0);if(!n)return!1;let r=Cn(n);return!!r&&gn(e,r,t)})(e,t);function na(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var ra=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);qs()||na()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function oa(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?ks(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,d=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>Os(e.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}var ia=(e,t={})=>({state:n,dispatch:r})=>!!oa(n,ks(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&yt(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),sa=()=>({state:e,dispatch:t})=>jn(e,t),aa=e=>({state:t,dispatch:n})=>{return(r=ks(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,i=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!i&&(!t||(n.node(i.depth-1).type==r?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new ht(i-1,s,i,s,new Z(W.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new fe(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=yt(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Ct(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),t(o.scrollIntoView()),!0}(e,t,r,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,d=i.node(-1),c=i.index(-1);if(!d.canReplace(c+(a?0:1),c+1,s.content.append(l?W.empty:W.from(o))))return!1;let p=i.pos,u=p+s.nodeSize;return r.step(new ht(p-(a?1:0),u+(l?1:0),p+1,u-1,new Z((a?W.empty:W.from(o.copy(W.empty))).append(l?W.empty:W.from(o.copy(W.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(e,t,i)))})(t,n);var r},la=()=>({state:e,dispatch:t})=>Tn(e,t);function da(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ca(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var pa=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=da("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=ks(e,r.schema)),"mark"===a&&(s=Ds(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,ca(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(ca(i.attrs,t))))})})}),l},ua=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ha=()=>({tr:e,dispatch:t})=>{if(t){const t=new Qt(e.doc);e.setSelection(t)}return!0},fa=()=>({state:e,dispatch:t})=>bn(e,t),ma=()=>({state:e,dispatch:t})=>kn(e,t),ga=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(Jt.create(e.doc,n))),!0)})(e,t),ya=()=>({state:e,dispatch:t})=>Dn(e,t),ba=()=>({state:e,dispatch:t})=>Ln(e,t);function xa(e,t,n={},r={}){return Ws(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var va=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=xa(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function wa(e,t){const n=Ds(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function ka(e,t){const n=new $t(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Ca(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function Ta(e,t,n){return void 0===e.config[t]&&e.parent?Ta(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?Ta(e.parent,t,n):null}):e.config[t]}function Na(e){return e.map(e=>{const t=Ta(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Na(t())]:e}).flat(10)}function Sa(e,t){const n=Ge.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Ma(e){return"function"==typeof e}function ja(e,t=void 0,...n){return Ma(e)?t?e.bind(t)(...n):e(...n):e}function Oa(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Aa(e){const t=[],{nodeExtensions:n,markExtensions:r}=Oa(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=Ta(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ta(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function Ea(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){const r=n[e],o=r.indexOf(":");if(-1===o)continue;const i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&s&&t.push([i,s])}return t}function La(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...Ea(n[e]),...Ea(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function Da(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>La(e,t),{})}function Ia(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function Ra(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Pa(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function za(e){return e.sort((e,t)=>{const n=Ta(e,"priority")||100,r=Ta(t,"priority")||100;return n>r?-1:n<r?1:0})}function Ba(e){const t=za(Na(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Fa(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,d)=>{var c;e.isBlock&&n>r&&(a+=i);const p=null==s?void 0:s[e.type.name];if(p)return l&&(a+=p({node:e,pos:n,parent:l,index:d,range:t})),!1;e.isText&&(a+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,o-n))}),a}function qa(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function $a(e,t){const n=da("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=ks(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?wa(e,t):{}}function Ha(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),function(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>{const r=t.filter((e,t)=>t!==n);return!r.some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to)})}(r)}function Va(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Ls(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Ua(e,t){return t.nodes[e]||t.marks[e]||null}function _a(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Wa(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Ds(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Os(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Os(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=s}function Ga(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Ka(e,t){const{nodeExtensions:n}=Oa(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=ja(Ta(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Ja(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Ja(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Ya(e){return e instanceof Jt}var Qa=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Za(e,t){const n=t.mapping.mapResult(e.position);return{position:new Qa(n.pos),mapResult:n}}function Xa(e){return new Qa(e)}var el=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Ds(e,r.schema);if(o)if(s){const e=wa(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(Ps(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},tl=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),nl=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=ks(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!In(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>In(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},rl=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=zs(e,0,n.content.size),o=Jt.create(n,r);t.setSelection(o)}return!0},ol=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},il=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Gt.atStart(n).from,s=Gt.atEnd(n).to,a=zs(r,i,s),l=zs(o,i,s),d=Gt.create(n,a,l);t.setSelection(d)}return!0},sl=e=>({state:t,dispatch:n})=>{const r=ks(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=W.from(n?o.create():null),s=new Z(W.from(o.create(null,W.from(a.type.create(null,r)))),n?3:1,0),d=i.start,c=i.end;t(e.tr.step(new ht(d-(n?3:1),c,d,c,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function al(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var ll=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,d=_a(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof Jt&&i.node.isBlock)return!(!a.parentOffset||!kt(s,a.pos)||(r&&(e&&al(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),0));if(!a.parent.isBlock)return!1;const c=l.parentOffset===l.parent.content.size,p=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let u=c&&p?[{type:p,attrs:d}]:void 0,h=kt(t.doc,t.mapping.map(a.pos),1,u);if(u||h||!kt(t.doc,t.mapping.map(a.pos),1,p?[{type:p}]:void 0)||(h=!0,u=p?[{type:p,attrs:d}]:void 0),r){if(h&&(i instanceof Gt&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,u),p&&!c&&!a.parentOffset&&a.parent.type!==p)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&t.setNodeMarkup(t.mapping.map(a.before()),p)}e&&al(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return h},dl=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=ks(e,r.schema),{$from:l,$to:d}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(d))return!1;const p=l.node(-1);if(p.type!==a)return!1;const u=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=W.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=W.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={..._a(u,l.node().type.name,l.node().attrs),...t},d=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(W.from(a.createAndFill(null,d)||void 0));const c=l.before(l.depth-(r-1));n.replace(c,l.after(-o),new Z(e,4-r,0));let p=-1;n.doc.nodesBetween(c,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(Gt.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}const h=d.pos===l.end()?p.contentMatchAt(0).defaultType:null,f={..._a(u,p.type.name,p.attrs),...t},m={..._a(u,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,d.pos);const g=h?[{type:a,attrs:f},{type:h,attrs:m}]:[{type:a,attrs:f}];if(!kt(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const d=a.filter(e=>s.includes(e.type.name));n.ensureMarks(d)}return!0},cl=(e,t)=>{const n=Ca(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ct(e.doc,n.pos)||(e.join(n.pos),!0)},pl=(e,t)=>{const n=Ca(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ct(e.doc,r)||(e.join(r),!0)},ul=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:d,can:c})=>{const{extensions:p,splittableMarks:u}=o.extensionManager,h=ks(e,s.schema),f=ks(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,x=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const w=Ca(e=>Ka(e.type.name,p))(m),k=0===m.from&&m.to===s.doc.content.size,C=s.doc.content.content,T=1===C.length?C[0]:null,N=k&&T&&Ka(T.type.name,p)?{node:T,pos:0,depth:0}:null,S=null!=w?w:N,M=!!N;if((w&&x.depth>=1&&x.depth-w.depth<=1||M)&&S){if(S.node.type===h)return k&&M?l().command(({tr:e,dispatch:t})=>{const n=function(e){const t=e.doc,n=t.firstChild;if(!n)return null;const r=n.nodeSize-1;return Gt.create(t,1,r)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():d.liftListItem(f);if(Ka(S.node.type.name,p)&&h.validContent(S.node.content))return l().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>cl(i,h)).command(()=>pl(i,h)).run()}return n&&v&&a?l().command(()=>{const e=c().wrapInList(h,r),t=v.filter(e=>u.includes(e.type.name));return i.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(h,r).command(()=>cl(i,h)).command(()=>pl(i,h)).run():l().command(()=>!!c().wrapInList(h,r)||d.clearNodes()).wrapInList(h,r).command(()=>cl(i,h)).command(()=>pl(i,h)).run()},hl=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Ds(e,r.schema);return Wa(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},fl=(e,t,n={})=>({state:r,commands:o})=>{const i=ks(e,r.schema),s=ks(t,r.schema),a=oa(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},ml=(e,t={})=>({state:n,commands:r})=>{const o=ks(e,n.schema);return oa(n,o,t)?r.lift(o):r.wrapIn(o,t)},gl=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},yl=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},bl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Ds(e,r.schema),{$from:d,empty:c,ranges:p}=a;if(!o)return!0;if(c&&s){let{from:e,to:t}=a;const r=null==(i=d.marks().find(e=>e.type===l))?void 0:i.attrs,o=Ls(d,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else p.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},xl=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},vl=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=da("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=ks(e,r.schema)),"mark"===a&&(s=Ds(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,d=e.$to.pos;let c,p,u,h;n.selection.empty?r.doc.nodesBetween(a,d,(e,t)=>{i&&i===e.type&&(l=!0,u=Math.max(t,a),h=Math.min(t+e.nodeSize,d),c=t,p=e)}):r.doc.nodesBetween(a,d,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,u=Math.max(r,a),h=Math.min(r+e.nodeSize,d),c=r,p=e),r>=a&&r<=d&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,d);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),p&&(void 0!==c&&o&&n.setNodeMarkup(c,void 0,{...p.attrs,...t}),s&&p.marks.length&&p.marks.forEach(e=>{s===e.type&&o&&n.addMark(u,h,s.create({...e.attrs,...t}))}))}),l},wl=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&bt(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(ks(e,n.schema),t)(n,r),kl=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new fe(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new fe(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=bt(i,n,r,t);return!!a&&(e&&function(e,t,n,r,o){let i=W.empty;for(let e=n.length-1;e>=0;e--)i=W.from(n[e].type.create(n[e].attrs,i));e.step(new ht(t.start-(r?2:0),t.end,t.start,t.end,new Z(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let a=n.length-s,l=t.start+n.length-(r?2:0),d=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&kt(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=d.child(n).nodeSize}(e,t,a,o,n),!0)}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}(ks(e,n.schema),t)(n,r),Cl=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Tl=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Nl(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1;const p=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+i;return s.forEach(e=>{if(c)return;const t=((e,t)=>{if(js(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(p,e.find);if(!t)return;const s=l.state.tr,d=us({state:l.state,transaction:s}),u={from:r-(t[0].length-i.length),to:o},{commands:h,chain:f,can:m}=new hs({editor:n,state:d});null!==e.handler({state:d,range:u,match:t,commands:h,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),c=!0)}),c}function Sl(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Ml(e,t){const n={...e};return Sl(e)&&Sl(t)&&Object.keys(t).forEach(r=>{Sl(t[r])&&Sl(e[r])?n[r]=Ml(e[r],t[r]):n[r]=t[r]}),n}var jl=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ja(Ta(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ja(Ta(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Ml(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Ol=class e extends jl{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Al=class{constructor(e){this.find=e.find,this.handler=e.handler}};var El=null;function Ll(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,d=us({state:e,transaction:l});if(function(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:d,can:c}=new hs({editor:t,state:n}),p=[];return n.doc.nodesBetween(r,o,(e,t)=>{var u,h,f,m,g;if((null==(h=null==(u=e.type)?void 0:u.spec)?void 0:h.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),x=Math.min(o,t+y);if(b>=x)return;const v=((e,t,n)=>{if(js(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,x-t,void 0,""),i.find,s);v.forEach(e=>{if(void 0===e.index)return;const t=b+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=i.handler({state:n,range:o,match:e,commands:l,chain:d,can:c,pasteEvent:s,dropEvent:a});p.push(u)})}),p.every(e=>null!==e)}({editor:t,state:d,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new dn({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(El=t)},r=()=>{El&&(El=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=El;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],d="paste"===o.getMeta("uiEvent")&&!i,c="drop"===o.getMeta("uiEvent")&&!s,p=o.getMeta("applyPasteRules"),u=!!p;if(!d&&!c&&!u)return;if(u){let{text:t}=p;"string"==typeof t||(t=Sa(W.from(t),r.schema));const{from:n}=p,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const h=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof h&&f&&h!==f.b?l({rule:e,state:r,from:h,to:f,pasteEvt:a}):void 0}}))}var Dl=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Ba(e),this.schema=function(e,t){var n;const r=Aa(e),{nodeExtensions:o,markExtensions:i}=Oa(e),s=null==(n=o.find(e=>Ta(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Ra({...e.reduce((e,t)=>{const r=Ta(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:ja(Ta(n,"content",i)),marks:ja(Ta(n,"marks",i)),group:ja(Ta(n,"group",i)),inline:ja(Ta(n,"inline",i)),atom:ja(Ta(n,"atom",i)),selectable:ja(Ta(n,"selectable",i)),draggable:ja(Ta(n,"draggable",i)),code:ja(Ta(n,"code",i)),whitespace:ja(Ta(n,"whitespace",i)),linebreakReplacement:ja(Ta(n,"linebreakReplacement",i)),defining:ja(Ta(n,"defining",i)),isolating:ja(Ta(n,"isolating",i)),attrs:Object.fromEntries(o.map(Pa))}),a=ja(Ta(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Ia(e,o)));const l=Ta(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:Da(e,o)}));const d=Ta(n,"renderText",i);return d&&(s.toText=d),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Ra({...e.reduce((e,t)=>{const r=Ta(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:ja(Ta(n,"inclusive",i)),excludes:ja(Ta(n,"excludes",i)),group:ja(Ta(n,"group",i)),spanning:ja(Ta(n,"spanning",i)),code:ja(Ta(n,"code",i)),attrs:Object.fromEntries(o.map(Pa))}),a=ja(Ta(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Ia(e,o)));const l=Ta(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:Da(e,o)})),[n.name,s]}));return new Re({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Ta(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Ua(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=za([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ua(t.name,this.schema)},r=[],o=Ta(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Ta(t,"exitable",n)&&(i.ArrowRight=()=>Ol.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new dn({props:{handleKeyDown:ds(i)}});r.push(s);const a=Ta(t,"addInputRules",n);if(Ga(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new dn({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=Sa(W.from(e),i.schema));const{from:o}=a,s=o+e.length;Nl({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Nl({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Nl({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Nl({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=Ta(t,"addPasteRules",n);if(Ga(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=Ll({editor:e,rules:t});r.push(...n)}}const d=Ta(t,"addProseMirrorPlugins",n);if(d){const e=d();r.push(...e)}return r});return t}get attributes(){return Aa(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Oa(this.extensions);return Object.fromEntries(t.filter(e=>!!Ta(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ks(t.name,this.schema)},o=Ta(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,a,l)=>{const d=Da(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){const{editor:t}=this;return za([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ua(n.name,this.schema)},o=Ta(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return za([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ua(n.name,this.schema)},o=Ta(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Oa(this.extensions);return Object.fromEntries(t.filter(e=>!!Ta(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ds(t.name,this.schema)},o=Ta(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const a=Da(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let d=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(d=!0)}),d){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]:[]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ua(e.name,this.schema)};"mark"===e.type&&(null==(t=ja(Ta(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=Ta(e,"onBeforeCreate",n),o=Ta(e,"onCreate",n),i=Ta(e,"onUpdate",n),s=Ta(e,"onSelectionUpdate",n),a=Ta(e,"onTransaction",n),l=Ta(e,"onFocus",n),d=Ta(e,"onBlur",n),c=Ta(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}};Dl.resolve=Ba,Dl.sort=za,Dl.flatten=Na,ps({},{ClipboardTextSerializer:()=>Rl,Commands:()=>Pl,Delete:()=>zl,Drop:()=>Bl,Editable:()=>Fl,FocusEvents:()=>$l,Keymap:()=>Hl,Paste:()=>Vl,Tabindex:()=>Ul,TextDirection:()=>_l,focusEventsPluginKey:()=>ql});var Il=class e extends jl{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Rl=Il.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new dn({key:new un("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=qa(n);return Fa(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Pl=Il.create({name:"commands",addCommands:()=>({...fs})}),zl=Il.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=ka(e.before,[e,...t]);Ha(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof dt){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),d=a.invert().map(i,-1),c=a.invert().map(l),p=i>0&&(null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark))),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:i,to:l},partial:Boolean(u||p),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),Bl=Il.create({name:"drop",addProseMirrorPlugins(){return[new dn({key:new un("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Fl=Il.create({name:"editable",addProseMirrorPlugins(){return[new dn({key:new un("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ql=new un("focusEvents"),$l=Il.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new dn({key:ql,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Hl=Il.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,d=l.parent.type.spec.isolating,c=i.pos-i.parentOffset,p=d&&1===l.parent.childCount?c===i.pos:Vt.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!p||p&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return qs()||na()?o:r},addProseMirrorPlugins(){return[new dn({key:new un("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Vt.atStart(t.doc).from,d=Vt.atEnd(t.doc).to;if(i||s!==l||a!==d)return;if(!Ja(n.doc))return;const c=n.tr,p=us({state:n,transaction:c}),{commands:u}=new hs({editor:this.editor,state:p});return u.clearNodes(),c.steps.length?c:void 0}})]}}),Vl=Il.create({name:"paste",addProseMirrorPlugins(){return[new dn({key:new un("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Ul=Il.create({name:"tabindex",addProseMirrorPlugins(){return[new dn({key:new un("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),_l=Il.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Oa(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new dn({key:new un("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Wl=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const d=new e(l,this.editor,o,o||s?n:null);o&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{n&&r.length>0||(i.node.type.name===e&&o.every(e=>t[e]===i.node.attrs[e])&&r.push(i),n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Gl=class extends Cl{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Za,createMappablePosition:Xa},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Bs(t,this.options.autofocus);this.editorState=an.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',document.getElementsByTagName("head")[0].appendChild(r),r}(0,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Ma(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[Fl,Rl.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Pl,$l,Hl,Ul,Bl,Vl,zl,_l.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Dl(n,this)}createCommandManager(){this.commandManager=new hs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=xa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=xa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Wi(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return $a(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return oa(e,null,n)||Wa(e,null,n);const r=da(t,e.schema);return"node"===r?oa(e,t,n):"mark"===r&&Wa(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Sa(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Fa(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...qa(this.schema),...n}})}get isEmpty(){return Ja(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Wl(t,this)}get $doc(){return this.$pos(0)}};function Kl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ja(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),d=l+s.length;if(Va(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;d<n.to&&i.delete(d,n.to),l>n.from&&i.delete(n.from+r,l);const c=n.from+r+s.length;i.addMark(n.from+r,c,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function Jl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=ja(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Yl(e){return new Tl({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=ja(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&bt(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===e.type&&Ct(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,d))&&s.join(n.from-1)},undoable:e.undoable})}function Ql(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Zl(e){if(!e||0===Object.keys(e).length)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function Xl(e){const{nodeName:t,name:n,parseAttributes:r=Ql,serializeAttributes:o=Zl,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const d=a[1]||"",c=r(d);return s.find(e=>!(e in c))?void 0:{type:t,raw:a[0],attributes:c}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function ed(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Ql,serializeAttributes:i=Zl,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,d=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${d}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[c,p=""]=l,u=o(p);let h=1;const f=c.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)h+=1;else if(h-=1,0===h){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:u,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${d}${o}\n\n${s}\n\n:::`}}}function td(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function nd(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function rd(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=td,serializeAttributes:i=nd,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,d=n||t,c=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${c}\\s*[^\\]]*\\]`):new RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),s=e.match(i);if(!s)return;let l="",d="";if(a){const[,e]=s;d=e}else{const[,e,t]=s;d=e,l=t||""}const p=o(d.trim());return{type:t,raw:s[0],content:l.trim(),attributes:p}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${d}${s}]`:`[${d}${s}]${t}[/${d}]`}}}function od(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let d="",c=0;const p=t.baseIndentSize||2;for(;c<a.length;){const e=a[c],u=e.match(t.itemPattern);if(!u){if(l.length>0)break;if(""===e.trim()){c+=1,d=`${d}${e}\n`;continue}return}const h=t.extractItemData(u),{indentLevel:f,mainContent:m}=h;d=`${d}${e}\n`;const g=[m];for(c+=1;c<a.length;){const e=a[c];if(""===e.trim()){const t=a.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[c+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),d=`${d}${e}\n`,c+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),d=`${d}${e}\n`,c+=1}let y;const b=g.slice(1);if(b.length>0){const e=b.map(e=>e.slice(f+p)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const x=t.createToken(h,y);l.push(x)}if(0!==l.length)return{items:l,raw:d}}function id(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content;let a=`${o}${t.renderChildren([i])}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,o;const i=null!=(o=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?o:t.renderChildren([e]);if(null!=i){const n=i.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");a+="paragraph"===e.type?`\n\n${n}`:`\n${n}`}}),a}ps({},{createAtomBlockMarkdownSpec:()=>Xl,createBlockMarkdownSpec:()=>ed,createInlineMarkdownSpec:()=>rd,parseAttributes:()=>Ql,parseIndentedBlocks:()=>od,renderNestedMarkdownContent:()=>id,serializeAttributes:()=>Zl});var sd=class e extends jl{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function ad(e){return new Al({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=ja(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let d=n.to;if(a){const o=l.search(/\S/),c=n.from+l.indexOf(a),p=c+a.length;if(Va(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;p<n.to&&s.delete(p,n.to),c>n.from&&s.delete(n.from+o,c),d=n.from+o+a.length,s.addMark(n.from+o,d,e.type.create(i||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:ld,getOwnPropertySymbols:dd}=Object,{hasOwnProperty:cd}=Object.prototype;function pd(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function ud(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const a=e(t,n,r);return o.delete(t),o.delete(n),a}}function hd(e){return ld(e).concat(dd(e))}const fd=Object.hasOwn||((e,t)=>cd.call(e,t));function md(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:gd,keys:yd}=Object;function bd(e,t){return e.byteLength===t.byteLength&&Ed(new Uint8Array(e),new Uint8Array(t))}function xd(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function vd(e,t){return e.byteLength===t.byteLength&&Ed(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function wd(e,t){return md(e.getTime(),t.getTime())}function kd(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Cd(e,t){return e===t}function Td(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,a,l=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,d=0;for(;(a=r.next())&&!a.done;){if(o[d]){d++;continue}const r=s.value,c=a.value;if(n.equals(r[0],c[0],l,d,e,t,n)&&n.equals(r[1],c[1],r[0],c[0],e,t,n)){i=o[d]=!0;break}d++}if(!i)return!1;l++}return!0}const Nd=md;function Sd(e,t,n){const r=yd(e);let o=r.length;if(yd(t).length!==o)return!1;for(;o-- >0;)if(!Dd(e,t,n,r[o]))return!1;return!0}function Md(e,t,n){const r=hd(e);let o,i,s,a=r.length;if(hd(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!Dd(e,t,n,o))return!1;if(i=gd(e,o),s=gd(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function jd(e,t){return md(e.valueOf(),t.valueOf())}function Od(e,t){return e.source===t.source&&e.flags===t.flags}function Ad(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,a;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,l=0;for(;(a=r.next())&&!a.done;){if(!o[l]&&n.equals(s.value,a.value,s.value,a.value,e,t,n)){i=o[l]=!0;break}l++}if(!i)return!1}return!0}function Ed(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Ld(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Dd(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||fd(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Id={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Rd=Object.prototype.toString;const Pd=zd();function zd(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:bd,areArraysEqual:n?Md:xd,areDataViewsEqual:vd,areDatesEqual:wd,areErrorsEqual:kd,areFunctionsEqual:Cd,areMapsEqual:n?pd(Td,Md):Td,areNumbersEqual:Nd,areObjectsEqual:n?Md:Sd,arePrimitiveWrappersEqual:jd,areRegExpsEqual:Od,areSetsEqual:n?pd(Ad,Md):Ad,areTypedArraysEqual:n?pd(Ed,Md):Ed,areUrlsEqual:Ld,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=ud(r.areArraysEqual),t=ud(r.areMapsEqual),n=ud(r.areObjectsEqual),o=ud(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:d,areRegExpsEqual:c,areSetsEqual:p,areTypedArraysEqual:u,areUrlsEqual:h,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&i(m,g,y);const x=m.constructor;if(x!==g.constructor)return!1;if(x===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(x===Date)return r(m,g,y);if(x===RegExp)return c(m,g,y);if(x===Map)return s(m,g,y);if(x===Set)return p(m,g,y);const v=Rd.call(m);if("[object Date]"===v)return r(m,g,y);if("[object RegExp]"===v)return c(m,g,y);if("[object Map]"===v)return s(m,g,y);if("[object Set]"===v)return p(m,g,y);if("[object Object]"===v)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===v)return h(m,g,y);if("[object Error]"===v)return o(m,g,y);if("[object Arguments]"===v)return l(m,g,y);if(Id[v])return u(m,g,y);if("[object ArrayBuffer]"===v)return e(m,g,y);if("[object DataView]"===v)return n(m,g,y);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return d(m,g,y);if(f){let e=f[v];if(!e){const t=null!=(w=m)?w[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}var w;return!1}}(i);var a;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:a=(e?new WeakMap:void 0),meta:l}=n();return t(i,s,{cache:a,equals:r,meta:l,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(a=s,function(e,t,n,r,o,i,s){return a(e,t,s)}),strict:o})}zd({strict:!0}),zd({circular:!0}),zd({circular:!0,strict:!0}),zd({createInternalComparator:()=>md}),zd({strict:!0,createInternalComparator:()=>md}),zd({circular:!0,createInternalComparator:()=>md}),zd({circular:!0,createInternalComparator:()=>md,strict:!0});var Bd=a(358),Fd=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},qd=({contentComponent:e})=>{const t=(0,$.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,c.jsx)(c.Fragment,{children:Object.values(t)})},$d=class extends p.default.Component{constructor(e){super(e),this.editorContentRef=p.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(n,r){t={...t,[n]:q.default.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{ref:Fd(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,c.jsx)(qd,{contentComponent:e.contentComponent})]})}},Hd=(0,p.forwardRef)((e,t)=>{const n=p.default.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[e.editor]);return p.default.createElement($d,{key:n,innerRef:t,...e})}),Vd=p.default.memo(Hd),Ud="undefined"!=typeof window?p.useLayoutEffect:p.useEffect,_d=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var Wd="undefined"==typeof window,Gd=Wd||Boolean("undefined"!=typeof window&&window.next),Kd=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?Wd||Gd?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new Gl(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Jd(e={},t=[]){const n=(0,p.useRef)(e);n.current=e;const[r]=(0,p.useState)(()=>new Kd(n)),o=(0,$.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,p.useDebugValue)(o),(0,p.useEffect)(r.onRender(t)),function(e){var t;const[n]=(0,p.useState)(()=>new _d(e.editor)),r=(0,Bd.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:Pd);Ud(()=>n.watch(e.editor),[e.editor,n]),(0,p.useDebugValue)(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}var Yd=(0,p.createContext)({editor:null});Yd.Consumer;var Qd=(0,p.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});p.default.forwardRef((e,t)=>{const{onDragStart:n}=(0,p.useContext)(Qd),r=e.as||"div";return(0,c.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})}),p.default.createContext({markViewContentRef:()=>{}});var Zd=(0,p.createContext)({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Zd.displayName="TiptapContext";function Xd({editor:e,instance:t,children:n}){const r=null!=e?e:t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=(0,p.useMemo)(()=>({editor:r}),[r]),i=(0,p.useMemo)(()=>({editor:r}),[r]);return(0,c.jsx)(Yd.Provider,{value:i,children:(0,c.jsx)(Zd.Provider,{value:o,children:n})})}function ec({...e}){const{editor:t}=(0,p.useContext)(Zd);return(0,c.jsx)(Vd,{editor:t,...e})}Xd.displayName="Tiptap",ec.displayName="Tiptap.Content",Object.assign(Xd,{Content:ec});var tc=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},nc=/^\s*>\s$/,rc=sd.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return tc("blockquote",{...La(this.options.HTMLAttributes,e),children:tc("slot",{})})},parseMarkdown:(e,t)=>{var n;const r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach((e,r)=>{var o,i;const s=(null!=(i=null==(o=t.renderChild)?void 0:o.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Yl({find:nc,type:this.type})]}}),oc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ic=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ac=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,lc=Ol.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return tc("strong",{...La(this.options.HTMLAttributes,e),children:tc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Kl({find:oc,type:this.type}),Kl({find:sc,type:this.type})]},addPasteRules(){return[ad({find:ic,type:this.type}),ad({find:ac,type:this.type})]}}),dc=/(^|[^`])`([^`]+)`(?!`)$/,cc=/(^|[^`])`([^`]+)`(?!`)/g,pc=Ol.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Kl({find:dc,type:this.type})]},addPasteRules(){return[ad({find:cc,type:this.type})]}}),uc=/^```([a-z]+)?[\s\n]$/,hc=/^~~~([a-z]+)?[\s\n]$/,fc=sd.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;return[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0]||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",La(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return r=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let d=0,c=0;const p=o-s;for(let e=0;e<l.length;e+=1){if(c+l[e].length>=p){d=e;break}c+=l[e].length+1}const u=(null==(t=l[d].match(/^ */))?void 0:t[0])||"",h=Math.min(u.length,n);if(0===h)return!0;let f=s;for(let e=0;e<d;e+=1)f+=l[e].length+1;return e.delete(f,f+h),o-f<=h&&e.setSelection(Gt.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const s=o.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(Vt.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[Jl({find:uc,type:this.type,getAttributes:e=>({language:e[1]})}),Jl({find:hc,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new dn({key:new un("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Gt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),mc=sd.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),gc=sd.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",La(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yc=sd.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,La(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Jl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),bc=sd.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",La(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Jt){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Ya(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Gt.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Jt.create(t.doc,n.pos)):t.setSelection(Gt.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(Gt.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Tl({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ja(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable}))];var e}}),xc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Cc=Ol.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",La(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Kl({find:xc,type:this.type}),Kl({find:wc,type:this.type})]},addPasteRules(){return[ad({find:vc,type:this.type}),ad({find:kc,type:this.type})]}});const Tc="numeric",Nc="ascii",Sc="alpha",Mc="asciinumeric",jc="alphanumeric",Oc="domain",Ac="emoji",Ec="scheme",Lc="slashscheme",Dc="whitespace";function Ic(e,t){return e in t||(t[e]=[]),t[e]}function Rc(e,t,n){t[Tc]&&(t[Mc]=!0,t[jc]=!0),t[Nc]&&(t[Mc]=!0,t[Sc]=!0),t[Mc]&&(t[jc]=!0),t[Sc]&&(t[jc]=!0),t[jc]&&(t[Oc]=!0),t[Ac]&&(t[Oc]=!0);for(const r in t){const t=Ic(r,n);t.indexOf(e)<0&&t.push(e)}}function Pc(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Pc.groups={},Pc.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Pc.groups,t&&t.j?o=t:(o=new Pc(t),n&&r&&Rc(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Pc.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Pc,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Pc,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Rc(i,e,r)}else n&&Rc(i,n,r);s.t=i}return o.j[e]=s,s}};const zc=(e,t,n,r,o)=>e.ta(t,n,r,o),Bc=(e,t,n,r,o)=>e.tr(t,n,r,o),Fc=(e,t,n,r,o)=>e.ts(t,n,r,o),qc=(e,t,n,r,o)=>e.tt(t,n,r,o),$c="WORD",Hc="UWORD",Vc="ASCIINUMERICAL",Uc="ALPHANUMERICAL",_c="LOCALHOST",Wc="TLD",Gc="UTLD",Kc="SCHEME",Jc="SLASH_SCHEME",Yc="NUM",Qc="WS",Zc="NL",Xc="OPENBRACE",ep="CLOSEBRACE",tp="OPENBRACKET",np="CLOSEBRACKET",rp="OPENPAREN",op="CLOSEPAREN",ip="OPENANGLEBRACKET",sp="CLOSEANGLEBRACKET",ap="FULLWIDTHLEFTPAREN",lp="FULLWIDTHRIGHTPAREN",dp="LEFTCORNERBRACKET",cp="RIGHTCORNERBRACKET",pp="LEFTWHITECORNERBRACKET",up="RIGHTWHITECORNERBRACKET",hp="FULLWIDTHLESSTHAN",fp="FULLWIDTHGREATERTHAN",mp="AMPERSAND",gp="APOSTROPHE",yp="ASTERISK",bp="AT",xp="BACKSLASH",vp="BACKTICK",wp="CARET",kp="COLON",Cp="COMMA",Tp="DOLLAR",Np="DOT",Sp="EQUALS",Mp="EXCLAMATION",jp="HYPHEN",Op="PERCENT",Ap="PIPE",Ep="PLUS",Lp="POUND",Dp="QUERY",Ip="QUOTE",Rp="FULLWIDTHMIDDLEDOT",Pp="SEMI",zp="SLASH",Bp="TILDE",Fp="UNDERSCORE",qp="EMOJI",$p="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:Uc,AMPERSAND:mp,APOSTROPHE:gp,ASCIINUMERICAL:Vc,ASTERISK:yp,AT:bp,BACKSLASH:xp,BACKTICK:vp,CARET:wp,CLOSEANGLEBRACKET:sp,CLOSEBRACE:ep,CLOSEBRACKET:np,CLOSEPAREN:op,COLON:kp,COMMA:Cp,DOLLAR:Tp,DOT:Np,EMOJI:qp,EQUALS:Sp,EXCLAMATION:Mp,FULLWIDTHGREATERTHAN:fp,FULLWIDTHLEFTPAREN:ap,FULLWIDTHLESSTHAN:hp,FULLWIDTHMIDDLEDOT:Rp,FULLWIDTHRIGHTPAREN:lp,HYPHEN:jp,LEFTCORNERBRACKET:dp,LEFTWHITECORNERBRACKET:pp,LOCALHOST:_c,NL:Zc,NUM:Yc,OPENANGLEBRACKET:ip,OPENBRACE:Xc,OPENBRACKET:tp,OPENPAREN:rp,PERCENT:Op,PIPE:Ap,PLUS:Ep,POUND:Lp,QUERY:Dp,QUOTE:Ip,RIGHTCORNERBRACKET:cp,RIGHTWHITECORNERBRACKET:up,SCHEME:Kc,SEMI:Pp,SLASH:zp,SLASH_SCHEME:Jc,SYM:$p,TILDE:Bp,TLD:Wc,UNDERSCORE:Fp,UTLD:Gc,UWORD:Hc,WORD:$c,WS:Qc});const Vp=/[a-z]/,Up=/\p{L}/u,_p=/\p{Emoji}/u,Wp=/\d/,Gp=/\s/;let Kp=null,Jp=null;function Yp(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,d=0,c=null,p=-1,u=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,u=0,c=a):p>=0&&(p+=n[s].length,u++),d+=n[s].length,i+=n[s].length,s++;i-=p,s-=u,d-=p,o.push({t:c.t,v:t.slice(i-d,i),s:i-d,e:i})}return o}function Qp(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new Pc(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new Pc(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Zp(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Xp={defaultProtocol:"http",events:null,format:tu,formatHref:tu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function eu(e,t=null){let n=Object.assign({},Xp);e&&(n=Object.assign(n,e instanceof eu?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function tu(e){return e}function nu(e,t){this.t="token",this.v=e,this.tk=t}function ru(e,t){class n extends nu{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}eu.prototype={o:Xp,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Xp[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},nu.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Xp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),d=e.get("rel",n,t),c=e.getObj("attributes",n,t),p=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),d&&(s.rel=d),c&&Object.assign(s,c),{tagName:o,attributes:s,content:i,eventListeners:p}}};const ou=ru("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),iu=ru("text"),su=ru("nl"),au=ru("url",{isLink:!0,toHref(e=Xp.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==_c&&e[1].t===kp}}),lu=e=>new Pc(e);function du(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const cu="undefined"!=typeof console&&console&&console.warn||(()=>{}),pu={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function uu(e,t=!1){if(pu.initialized&&cu(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');pu.customSchemes.push([e,t])}function hu(e){return pu.initialized||function(){pu.scanner=function(e=[]){const t={};Pc.groups=t;const n=new Pc;null==Kp&&(Kp=Zp("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Jp&&(Jp=Zp("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),qc(n,"'",gp),qc(n,"{",Xc),qc(n,"}",ep),qc(n,"[",tp),qc(n,"]",np),qc(n,"(",rp),qc(n,")",op),qc(n,"<",ip),qc(n,">",sp),qc(n,"(",ap),qc(n,")",lp),qc(n,"「",dp),qc(n,"」",cp),qc(n,"『",pp),qc(n,"』",up),qc(n,"<",hp),qc(n,">",fp),qc(n,"&",mp),qc(n,"*",yp),qc(n,"@",bp),qc(n,"`",vp),qc(n,"^",wp),qc(n,":",kp),qc(n,",",Cp),qc(n,"$",Tp),qc(n,".",Np),qc(n,"=",Sp),qc(n,"!",Mp),qc(n,"-",jp),qc(n,"%",Op),qc(n,"|",Ap),qc(n,"+",Ep),qc(n,"#",Lp),qc(n,"?",Dp),qc(n,'"',Ip),qc(n,"/",zp),qc(n,";",Pp),qc(n,"~",Bp),qc(n,"_",Fp),qc(n,"\\",xp),qc(n,"・",Rp);const r=Bc(n,Wp,Yc,{[Tc]:!0});Bc(r,Wp,r);const o=Bc(r,Vp,Vc,{[Mc]:!0}),i=Bc(r,Up,Uc,{[jc]:!0}),s=Bc(n,Vp,$c,{[Nc]:!0});Bc(s,Wp,o),Bc(s,Vp,s),Bc(o,Wp,o),Bc(o,Vp,o);const a=Bc(n,Up,Hc,{[Sc]:!0});Bc(a,Vp),Bc(a,Wp,i),Bc(a,Up,a),Bc(i,Wp,i),Bc(i,Vp),Bc(i,Up,i);const l=qc(n,"\n",Zc,{[Dc]:!0}),d=qc(n,"\r",Qc,{[Dc]:!0}),c=Bc(n,Gp,Qc,{[Dc]:!0});qc(n,"",c),qc(d,"\n",l),qc(d,"",c),Bc(d,Gp,c),qc(c,"\r"),qc(c,"\n"),Bc(c,Gp,c),qc(c,"",c);const p=Bc(n,_p,qp,{[Ac]:!0});qc(p,"#"),Bc(p,_p,p),qc(p,"️",p);const u=qc(p,"‍");qc(u,"#"),Bc(u,_p,p);const h=[[Vp,s],[Wp,o]],f=[[Vp,null],[Up,a],[Wp,i]];for(let e=0;e<Kp.length;e++)Qp(n,Kp[e],Wc,$c,h);for(let e=0;e<Jp.length;e++)Qp(n,Jp[e],Gc,Hc,f);Rc(Wc,{tld:!0,ascii:!0},t),Rc(Gc,{utld:!0,alpha:!0},t),Qp(n,"file",Kc,$c,h),Qp(n,"mailto",Kc,$c,h),Qp(n,"http",Jc,$c,h),Qp(n,"https",Jc,$c,h),Qp(n,"ftp",Jc,$c,h),Qp(n,"ftps",Jc,$c,h),Rc(Kc,{scheme:!0,ascii:!0},t),Rc(Jc,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Ec]:!0}:{[Lc]:!0};r.indexOf("-")>=0?o[Oc]=!0:Vp.test(r)?Wp.test(r)?o[Mc]=!0:o[Nc]=!0:o[Tc]=!0,Fc(n,r,r,o)}return Fc(n,"localhost",_c,{ascii:!0}),n.jd=new Pc($p),{start:n,tokens:Object.assign({groups:t},Hp)}}(pu.customSchemes);for(let e=0;e<pu.tokenQueue.length;e++)pu.tokenQueue[e][1]({scanner:pu.scanner});pu.parser=function({groups:e}){const t=e.domain.concat([mp,yp,bp,xp,vp,wp,Tp,Sp,jp,Yc,Op,Ap,Ep,Lp,zp,$p,Bp,Fp]),n=[gp,kp,Cp,Np,Mp,Op,Dp,Ip,Pp,ip,sp,Xc,ep,np,tp,rp,op,ap,lp,dp,cp,pp,up,hp,fp],r=[mp,gp,yp,xp,vp,wp,Tp,Sp,jp,Xc,ep,Op,Ap,Ep,Lp,Dp,zp,$p,Bp,Fp],o=lu(),i=qc(o,Bp);zc(i,r,i),zc(i,e.domain,i);const s=lu(),a=lu(),l=lu();zc(o,e.domain,s),zc(o,e.scheme,a),zc(o,e.slashscheme,l),zc(s,r,i),zc(s,e.domain,s);const d=qc(s,bp);qc(i,bp,d),qc(a,bp,d),qc(l,bp,d);const c=qc(i,Np);zc(c,r,i),zc(c,e.domain,i);const p=lu();zc(d,e.domain,p),zc(p,e.domain,p);const u=qc(p,Np);zc(u,e.domain,p);const h=lu(ou);zc(u,e.tld,h),zc(u,e.utld,h),qc(d,_c,h);const f=qc(p,jp);qc(f,jp,f),zc(f,e.domain,p),zc(h,e.domain,p),qc(h,Np,u),qc(h,jp,f);const m=qc(h,kp);zc(m,e.numeric,ou);const g=qc(s,jp),y=qc(s,Np);qc(g,jp,g),zc(g,e.domain,s),zc(y,r,i),zc(y,e.domain,s);const b=lu(au);zc(y,e.tld,b),zc(y,e.utld,b),zc(b,e.domain,s),zc(b,r,i),qc(b,Np,y),qc(b,jp,g),qc(b,bp,d);const x=qc(b,kp),v=lu(au);zc(x,e.numeric,v);const w=lu(au),k=lu();zc(w,t,w),zc(w,n,k),zc(k,t,w),zc(k,n,k),qc(b,zp,w),qc(v,zp,w);const C=qc(a,kp),T=qc(l,kp),N=qc(T,zp),S=qc(N,zp);zc(a,e.domain,s),qc(a,Np,y),qc(a,jp,g),zc(l,e.domain,s),qc(l,Np,y),qc(l,jp,g),zc(C,e.domain,w),qc(C,zp,w),qc(C,Dp,w),zc(S,e.domain,w),zc(S,t,w),qc(S,zp,w);const M=[[Xc,ep],[tp,np],[rp,op],[ip,sp],[ap,lp],[dp,cp],[pp,up],[hp,fp]];for(let e=0;e<M.length;e++){const[r,o]=M[e],i=qc(w,r);qc(k,r,i),qc(i,o,w);const s=lu(au);zc(i,t,s);const a=lu();zc(i,n),zc(s,t,s),zc(s,n,a),zc(a,t,s),zc(a,n,a),qc(s,o,w),qc(a,o,w)}return qc(o,_c,b),qc(o,Zc,su),{start:o,tokens:Hp}}(pu.scanner.tokens);for(let e=0;e<pu.pluginQueue.length;e++)pu.pluginQueue[e][1]({scanner:pu.scanner,parser:pu.parser});pu.initialized=!0}(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,d=null,c=0,p=null,u=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(d=l||a.go(n[o].t));)l=null,a=d,a.accepts()?(u=0,p=a):u>=0&&u++,o++,c++;if(u<0)o-=c,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(du(iu,t,s)),s=[]),o-=u,c-=u;const e=p.t,r=n.slice(o-c,o);i.push(du(e,t,r))}}return s.length>0&&i.push(du(iu,t,s)),i}(pu.parser.start,e,Yp(pu.scanner.start,e))}function fu(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new eu(n),o=hu(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}hu.scan=Yp;var mu="[\0-   ᠎ -\u2029  ]",gu=new RegExp(mu),yu=new RegExp(`${mu}$`),bu=new RegExp(mu,"g");function xu(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(bu,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var vu=Ol.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?uu(e.scheme,e.optionalSlashes):uu(e)})},onDestroy(){Pc.groups={},pu.scanner=null,pu.parser=null,pu.tokenQueue=[],pu.pluginQueue=[],pu.customSchemes=[],pu.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!xu(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",La(this.options.HTMLAttributes,e),0]:["a",La(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!xu(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ad({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=fu(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!xu(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(function(e){return new dn({key:new un("autolink"),appendTransaction:(t,n,r)=>{const o=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),i=t.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r;return Ha(ka(n.doc,[...t])).forEach(({newRange:t})=>{const n=function(e,t){const n=[];return e.nodesBetween(t.from,t.to,(e,t)=>{(e=>e.isTextblock)(e)&&n.push({node:e,pos:t})}),n}(r.doc,t);let o,i;if(n.length>1)o=n[0],i=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(n.length){const e=r.doc.textBetween(t.from,t.to," "," ");if(!yu.test(e))return;o=n[0],i=r.doc.textBetween(o.pos,t.to,void 0," ")}if(o&&i){const t=i.split(gu).filter(Boolean);if(t.length<=0)return!1;const n=t[t.length-1],l=o.pos+i.lastIndexOf(n);if(!n)return!1;const d=hu(n).map(t=>t.toObject(e.defaultProtocol));if(!(1===(a=d).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;d.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Va(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}var a}),s.steps.length?s:void 0}})}({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!xu(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(function(e){return new dn({key:new un("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=$a(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new dn({key:new un("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const d=fu(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!d||void 0!==o&&!o(d.value))&&e.editor.commands.setMark(e.type,{href:d.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),wu=vu,ku=Object.defineProperty,Cu="textStyle",Tu=/^\s*([-+*])\s$/,Nu=sd.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Cu)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Yl({find:Tu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Yl({find:Tu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Cu),editor:this.editor})),[e]}}),Su=sd.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n;if("list_item"!==e.type)return[];const r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;let o=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))o=r(e.tokens);else{const n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(o=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){const t=r(e.tokens.slice(1));o.push(...t)}}else o=r(e.tokens)}return 0===o.length&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:o}},renderMarkdown:(e,t,n)=>id(e,t,e=>{var t,n;return"bulletList"===e.parentType?"- ":"orderedList"===e.parentType?`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)ku(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>Mu,getNextListDepth:()=>ju,handleBackspace:()=>Lu,handleDelete:()=>Ru,hasListBefore:()=>Ou,hasListItemAfter:()=>Pu,hasListItemBefore:()=>Au,listItemHasSubList:()=>Eu,nextListIsDeeper:()=>Du,nextListIsHigher:()=>Iu});var Mu=(e,t)=>{const{$from:n}=t.selection,r=ks(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},ju=(e,t)=>{const n=Mu(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Ou=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Au=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Eu=(e,t,n)=>{if(!n)return!1;const r=ks(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},Lu=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!oa(e.state,t)&&Ou(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!oa(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=Mu(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Eu(t,e.state,o);return Au(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Du=(e,t)=>{const n=ju(e,t),r=Mu(e,t);return!(!r||!n)&&n>r.depth},Iu=(e,t)=>{const n=ju(e,t),r=Mu(e,t);return!(!r||!n)&&n<r.depth},Ru=(e,t)=>{if(!oa(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Ca(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Du(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Iu(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Pu=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},zu=Il.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ru(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ru(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Lu(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Lu(e,n,r)&&(t=!0)}),t}}}}),Bu=/^(\s*)(\d+)\.\s+(.*)$/,Fu=/^\s/;function qu(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",d=[];l&&d.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const c=a.slice(1).join("\n").trim();if(c){const e=n.blockTokens(c);d.push(...e)}let p=i+1;const u=[];for(;p<e.length&&e[p].indent>t;)u.push(e[p]),p+=1;if(u.length>0){const e=Math.min(...u.map(e=>e.indent)),t=qu(u,e,n);d.push({type:"list",ordered:!0,start:u[0].number,items:t,raw:u.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:d}),i=p}else i+=1}return o}var $u="textStyle",Hu=/^(\d+)\.\s$/,Vu=sd.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",La(this.options.HTMLAttributes,n),0]:["ol",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Bu);if(!i)break;const[,s,a,l]=i,d=s.length;let c=l,p=n+1;const u=[o];for(;p<e.length;){const t=e[p];if(t.match(Bu))break;if(""===t.trim())u.push(t),c+="\n",p+=1;else{if(!t.match(Fu))break;u.push(t),c+=`\n${t.slice(d+2)}`,p+=1}}t.push({indent:d,number:parseInt(a,10),content:c.trim(),raw:u.join("\n")}),r=p,n=p}return[t,r]}(o);if(0===i.length)return;const a=qu(i,0,n);return 0!==a.length?{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}:void 0}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes($u)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Yl({find:Hu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Yl({find:Hu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($u)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Uu=/^\s*(\[([( |x])?\])\s$/,_u=sd.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",La(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return id(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),d=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};d(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let c=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,d(e);const t=Da(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return c.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),c=n,!0}}}},addInputRules(){return[Yl({find:Uu,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),Wu=sd.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",La(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=od(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=od(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Gu=(Il.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Nu.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Su.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(zu.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Vu.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(_u.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(Wu.configure(this.options.taskList)),e}}),"&nbsp;"),Ku=sd.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",La(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==n.length||"text"!==n[0].type||n[0].raw!==Gu&&n[0].text!==Gu&&" "!==n[0].raw&&" "!==n[0].text||1!==r.length||"text"!==r[0].type||r[0].text!==Gu&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t,n)=>{var r,o;if(!e)return"";const i=Array.isArray(e.content)?e.content:[];if(0===i.length){const e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return"paragraph"===(null==(o=null==n?void 0:n.previousNode)?void 0:o.type)&&0===e.length?Gu:""}return t.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ju=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Yu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qu=Ol.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",La(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Kl({find:Ju,type:this.type})]},addPasteRules(){return[ad({find:Yu,type:this.type})]}}),Zu=sd.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Xu=Ol.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",La(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),eh=Xu;function th(e={}){return new dn({view:t=>new nh(t,e)})}class nh{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,d=this.editorView.dom.offsetParent;if(this.element||(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!d||d==document.body&&"static"==getComputedStyle(d).position)a=-pageXOffset,l=-pageYOffset;else{let e=d.getBoundingClientRect(),t=e.width/d.offsetWidth,n=e.height/d.offsetHeight;a=e.left-d.scrollLeft*t,l=e.top-d.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=St(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class rh extends Vt{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return rh.valid(n)?new rh(n):Vt.near(n)}content(){return Z.empty}eq(e){return e instanceof rh&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new rh(e.resolve(t.pos))}getBookmark(){return new oh(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||ih(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||ih(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&rh.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(rh.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Jt.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(rh.valid(s))return s}return null}}}rh.prototype.visible=!1,rh.findFrom=rh.findGapCursorFrom,Vt.jsonID("gapcursor",rh);class oh{constructor(e){this.pos=e}map(e){return new oh(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return rh.valid(t)?new rh(t):Vt.near(t)}}function ih(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const sh=ds({ArrowLeft:ah("horiz",-1),ArrowRight:ah("horiz",1),ArrowUp:ah("vert",-1),ArrowDown:ah("vert",1)});function ah(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Gt){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=rh.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new rh(l))),!0)}}function lh(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!rh.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Jt.isSelectable(e.state.doc.nodeAt(o.inside))||(e.dispatch(e.state.tr.setSelection(new rh(r))),0))}function dh(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof rh))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=W.empty;for(let e=r.length-1;e>=0;e--)o=W.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Z(o,0,0));return i.setSelection(Gt.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function ch(e){if(!(e.selection instanceof rh))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ki.create(e.doc,[xi.widget(e.selection.head,t,{key:"gapcursor"})])}var ph=200,uh=function(){};uh.prototype.append=function(e){return e.length?(e=uh.from(e),!this.length&&e||e.length<ph&&this.leafAppend(e)||this.length<ph&&e.leafPrepend(this)||this.appendInner(e)):this},uh.prototype.prepend=function(e){return e.length?uh.from(e).append(this):this},uh.prototype.appendInner=function(e){return new fh(this,e)},uh.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?uh.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},uh.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},uh.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},uh.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},uh.from=function(e){return e instanceof uh?e:e&&e.length?new hh(e):uh.empty};var hh=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=ph)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=ph)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(uh);uh.empty=new hh([]);var fh=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(uh);const mh=uh;class gh{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],d=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void d.push(e);if(n){d.push(new yh(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new yh(t,void 0,void 0,l.length+d.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new gh(this.items.slice(0,o).append(d.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,d=e.steps[n].invert(e.docs[n]),c=new yh(e.mapping.maps[n],d,t);(l=a&&a.merge(c))&&(c=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(c),t&&(i++,t=void 0),r||(a=c)}let l=i-n.depth;return l>xh&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new gh(s.append(o),i)}remapping(e,t){let n=new rt;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new gh(this.items.append(e.map(e=>new yh(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(o.slice(a+1,r));d&&s++,n.push(new yh(l,i,d))}else n.push(new yh(l))},r);let l=[];for(let e=t;e<i;e++)l.push(new yh(o.maps[e]));let d=this.items.slice(0,r).append(l).append(n),c=new gh(d,s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,d=new yh(s.invert(),e,a),c=r.length-1;(l=r.length&&r[c].merge(d))?r[c]=l:r.push(d)}}else i.map&&n--},this.items.length,0),new gh(mh.from(r.reverse()),o)}}gh.empty=new gh(mh.empty,0);class yh{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new yh(t.getMap().invert(),t,this.selection)}}}class bh{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const xh=20;function vh(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function wh(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let kh=!1,Ch=null;function Th(e){let t=e.plugins;if(Ch!=t){kh=!1,Ch=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){kh=!0;break}}return kh}const Nh=new un("history"),Sh=new un("closeHistory");function Mh(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new dn({key:Nh,state:{init:()=>new bh(gh.empty,gh.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Nh);if(i)return i.historyState;n.getMeta(Sh)&&(e=new bh(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Nh))return s.getMeta(Nh).redo?new bh(e.done.addTransform(n,void 0,r,Th(t)),e.undone,vh(n.mapping.maps),e.prevTime,e.prevComposition):new bh(e.done,e.undone.addTransform(n,void 0,r,Th(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new bh(e.done.rebased(n,o),e.undone.rebased(n,o),wh(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new bh(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),wh(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?wh(e.prevRanges,n.mapping):vh(n.mapping.maps);return new bh(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Th(t)),gh.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Oh:"historyRedo"==n?Ah:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function jh(e,t){return(n,r)=>{let o=Nh.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Th(t),o=Nh.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new bh(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Nh,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Oh=jh(!1,!0),Ah=jh(!0,!0);jh(!1,!1),jh(!0,!1),Il.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new dn({key:new un("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;return e.deleteRange(s,a),!(this.storage.characters({node:e.doc})>n)}})]}});var Eh=Il.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[th(this.options)]}}),Lh=(Il.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new dn({key:new un("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return ki.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText)return o>=t&&o<=t+e.nodeSize-1&&void(s+=1)});let a=0;return e.descendants((e,t)=>!e.isText&&(o>=t&&o<=t+e.nodeSize-1&&(a+=1,"deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1?"deepest"===this.options.mode:void i.push(xi.node(t,t+e.nodeSize,{class:this.options.className}))))),ki.create(e,i)}}})]}}),Il.create({name:"gapCursor",addProseMirrorPlugins:()=>[new dn({props:{decorations:ch,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&rh.valid(n)?new rh(n):null,handleClick:lh,handleKeyDown:sh,handleDOMEvents:{beforeinput:dh}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=ja(Ta(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}})),Dh="placeholder",Ih=Il.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Dh,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Dh}`;var t;return[new dn({key:new un("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Ja(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=xi.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),ki.create(t,i)}}})]}});function Rh({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Il.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new dn({key:new un("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||Ya(n.selection)||e.view.dragging?null:ki.create(n.doc,[xi.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Ph=Il.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new un(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new dn({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),d=i.content.size,c=a.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&l)return s.insert(d,c.create())},state:{init:(e,t)=>!Rh({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>e.docChanged?e.getMeta("__uniqueIDTransaction")?t:!Rh({node:e.doc.lastChild,types:r}):t}})]}}),zh=Il.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Oh(e,t),redo:()=>({state:e,dispatch:t})=>Ah(e,t)}),addProseMirrorPlugins(){return[Mh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bh=Il.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(lc.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(rc.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Nu.configure(this.options.bulletList)),!1!==this.options.code&&o.push(pc.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(fc.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(mc.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Eh.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Lh.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(gc.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(yc.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(zh.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(bc.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Cc.configure(this.options.italic)),!1!==this.options.listItem&&o.push(Su.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(zu.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(vu.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Vu.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Ku.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(Qu.configure(this.options.strike)),!1!==this.options.text&&o.push(Zu.configure(this.options.text)),!1!==this.options.underline&&o.push(Xu.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Ph.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Fh=Ih;function qh({active:e,onClick:t,title:n,children:r}){return(0,c.jsx)("button",{type:"button",title:n,onClick:t,className:D("w-7 h-7 rounded flex items-center justify-center text-xs font-bold cursor-pointer transition-colors",e?"bg-[var(--accent-subtle)] text-[var(--accent)]":"text-[var(--text-secondary)] hover:bg-[var(--bg-glass-hover)] hover:text-[var(--text-primary)]"),children:r})}function $h({value:e,onChange:t,placeholder:n,className:r}){const o=Jd({extensions:[Bh.configure({heading:!1,codeBlock:!1,blockquote:!1,horizontalRule:!1,listItem:!1,bulletList:!1,orderedList:!1}),eh,wu.configure({openOnClick:!1,HTMLAttributes:{style:"color: var(--accent); text-decoration: underline; cursor: pointer;"}}),Fh.configure({placeholder:n??"Enter HTML content..."})],content:e||"",onUpdate:({editor:e})=>{t(e.getHTML())},editorProps:{attributes:{class:"outline-none min-h-[60px] px-3.5 py-2.5 text-sm text-[var(--text-primary)] prose-sm max-w-none"}}});(0,p.useEffect)(()=>{o&&e!==o.getHTML()&&o.commands.setContent(e||"",{emitUpdate:!1})},[e,o]);const i=(0,p.useCallback)(()=>{if(!o)return;const e=o.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""===t?o.chain().focus().extendMarkRange("link").unsetLink().run():o.chain().focus().extendMarkRange("link").setLink({href:t}).run())},[o]);return o?(0,c.jsxs)("div",{className:D("rounded-lg border border-[var(--input-border)] bg-[var(--input-bg)] overflow-hidden transition-all focus-within:border-[var(--input-focus-border)] focus-within:shadow-[0_0_0_3px_var(--input-focus-glow)]",r),children:[(0,c.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1.5 border-b border-[var(--border-glass)]",children:[(0,c.jsx)(qh,{active:o.isActive("bold"),onClick:()=>o.chain().focus().toggleBold().run(),title:"Bold",children:"B"}),(0,c.jsx)(qh,{active:o.isActive("italic"),onClick:()=>o.chain().focus().toggleItalic().run(),title:"Italic",children:(0,c.jsx)("span",{className:"italic",children:"I"})}),(0,c.jsx)(qh,{active:o.isActive("underline"),onClick:()=>o.chain().focus().toggleUnderline().run(),title:"Underline",children:(0,c.jsx)("span",{className:"underline",children:"U"})}),(0,c.jsx)("div",{className:"w-px h-4 bg-[var(--border-glass)] mx-1"}),(0,c.jsx)(qh,{active:o.isActive("link"),onClick:i,title:"Link",children:(0,c.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,c.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,c.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]}),(0,c.jsx)(Vd,{editor:o})]}):null}function Hh({value:e,onChange:t,placeholder:n,className:r}){const[o,i]=(0,p.useState)(""),s=Array.isArray(e)?e:[],a=(0,p.useCallback)(e=>{const n=e.trim();n&&!s.includes(n)&&t([...s,n]),i("")},[s,t]),l=(0,p.useCallback)(e=>{t(s.filter((t,n)=>n!==e))},[s,t]),d=(0,p.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),a(o)):"Backspace"===e.key&&""===o&&s.length>0&&l(s.length-1)},[o,s,a,l]);return(0,c.jsxs)("div",{className:D("space-y-2",r),children:[(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,t)=>(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-medium bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent)]/20",children:[e,(0,c.jsx)("button",{type:"button",onClick:()=>l(t),className:"ml-0.5 text-[var(--accent)]/60 hover:text-[var(--accent)] cursor-pointer transition-colors",children:(0,c.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},t))}),(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o,onChange:e=>i(e.target.value),onKeyDown:d,placeholder:0===s.length?n??"Type and press Enter to add":"Press Enter to add"})]})}const Vh=class{authHeaders;apiKey;privateApiKey;context;constructor(e){this.authHeaders=e.user.authHeaders,this.apiKey=e.user.apiKey,this.context=e;const t=e.user.organization?.value?.settings?.plugins?.get(h);this.privateApiKey=t?.get("privateApiKey")??""}async getBrandConfig(){return this.fetchContent({modelName:"gh-brand-config",limit:10,bustCache:!0})}async createBrandConfig(e){return this.context.createContent("gh-brand-config",{name:e,published:"draft",data:{}})}async saveBrandConfig(e,t){const n=await fetch(`https://builder.io/api/v1/write/gh-brand-config/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.privateApiKey}`},body:JSON.stringify({data:t})});if(!n.ok){const e=await n.text();throw new Error(`Failed to save brand config: ${n.status} ${e}`)}}async listAssets(){const e=await fetch("https://cdn.builder.io/api/v2/admin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.privateApiKey}`},body:JSON.stringify({query:"{ assets { id name url type } }"})});if(!e.ok){const t=await e.text();throw new Error(`Failed to fetch assets: ${e.status} ${t}`)}const t=await e.json();if(t.errors?.length)throw new Error(`GraphQL error: ${t.errors[0].message}`);return(t?.data?.assets??[]).filter(e=>e.type?.startsWith("image/")).map(e=>({id:e.id,name:e.name??e.id,url:e.url,type:e.type}))}async getModelEntries(e){return this.fetchContent({modelName:e,limit:100})}async fetchContent(e){const{modelName:t,limit:n=20,bustCache:r=!1}=e,o=[];let i=0,s=`https://cdn.builder.io/api/v3/content/${t}?apiKey=${this.apiKey}&includeUnpublished=true&omit=data.blocks&limit=${Math.min(n,100)}&locale=en-US`;r&&(s+="&cachebust=true"),console.info(`[Hippo Commerce] Fetching ${t}`);const a=await fetch(s,{headers:this.authHeaders}),l=await a.json(),d=Array.isArray(l)?l:l?.results??[];o.push(...d);let c=d.length;for(;o.length<n&&c>0;){i=o.length;const e=await fetch(`${s}&offset=${i}`,{headers:this.authHeaders}),t=await e.json(),n=Array.isArray(t)?t:t?.results??[];o.push(...n),c=n.length}return console.info(`[Hippo Commerce] Fetched ${o.length} ${t} entries`),o}},Uh=[{key:"brandLogoSmall",label:"Logo (Small)"},{key:"brandLogoLarge",label:"Logo (Large)"},{key:"brandLogoFooter",label:"Logo (Footer)"},{key:"bbbImage",label:"BBB Image"},{key:"accesibilityLogo",label:"Accessibility Logo"},{key:"brandLogoOffWhite",label:"Logo (Off-White)"},{key:"defaultPetProfileImage",label:"Default Pet Profile Image"},{key:"defaultCatProfileImage",label:"Default Cat Profile Image"},{key:"defaultDogProfileImage",label:"Default Dog Profile Image"},{key:"linklessPageHeaderLogo",label:"Linkless Header Image"}],_h=[{key:"termsLink",label:"Terms of Service Link"},{key:"subscriptionTermsLink",label:"Subscription Terms of Service Link"},{key:"privacyLink",label:"Privacy Policy Link"},{key:"ccpaLink",label:"CCPA Link"},{key:"bbbLink",label:"BBB Link"},{key:"accessibiltyLink",label:"Accessibility Link"}],Wh=[{key:"twitter",label:"Twitter / X"},{key:"facebook",label:"Facebook"},{key:"youtube",label:"YouTube"},{key:"instagram",label:"Instagram"},{key:"pinterest",label:"Pinterest"},{key:"tiktok",label:"TikTok"}],Gh=(0,u.observer)(({data:e,onChangeRoot:t,markDirty:n,api:r})=>{const[o,i]=(0,p.useState)([]),[s,a]=(0,p.useState)(!0);(0,p.useEffect)(()=>{r.getModelEntries("banner").then(e=>i(e)).catch(e=>console.error("[Hippo Commerce] Failed to fetch banner entries:",e)).finally(()=>a(!1))},[r]);const l=(0,p.useCallback)(()=>r.listAssets(),[r]),d=e.images||{},u=e.links||{},h=u.socialMedia||{};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(R,{title:"Brand Display Name",children:(0,c.jsx)(z,{label:"Brand Display Name",helper:"The brand name displayed across the website",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.brandDisplayName??"",onChange:e=>t("brandDisplayName",e.target.value)})})}),(0,c.jsx)(R,{title:"Brand Images",subtitle:"Logo and brand images used throughout the website",children:(0,c.jsx)("div",{className:"flex flex-wrap gap-5",children:Uh.map(({key:t,label:r})=>(0,c.jsx)(F,{label:r,value:"string"==typeof d[t]?d[t]:void 0,onChange:r=>((t,r)=>{e.images||(e.images={}),e.images[t]=r,n()})(t,r??""),fetchAssets:l},t))})}),(0,c.jsx)(R,{title:"General Links",subtitle:"Links to legal pages and external profiles",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-5",children:_h.map(({key:t,label:r})=>(0,c.jsx)(z,{label:r,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:u[t]??"",onChange:r=>((t,r)=>{e.links||(e.links={}),e.links[t]=r,n()})(t,r.target.value)})},t))}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Social Media"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-5",children:Wh.map(({key:t,label:r})=>(0,c.jsx)(z,{label:r,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:h[t]??"",onChange:r=>((t,r)=>{e.links||(e.links={}),e.links.socialMedia||(e.links.socialMedia={}),e.links.socialMedia[t]=r,n()})(t,r.target.value)})},t))})]})}),(0,c.jsx)(R,{title:"Banners",subtitle:"Sitewide banners displayed above page-specific announcements",children:s?(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)]",children:"Loading..."}):(0,c.jsxs)("div",{className:"space-y-4",children:[(e.banners??[]).map((t,r)=>{const i=t.banner?.value?.id??t.banner?.id??"";return(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(z,{label:"Banner",children:(0,c.jsxs)("select",{className:"hippo-input",value:i,onChange:e=>{const r=o.find(t=>t.id===e.target.value);t.banner=r?{"@type":"@builder.io/core:Reference",model:"banner",id:r.id}:void 0,n()},children:[(0,c.jsx)("option",{value:"",children:"Select a banner..."}),o.map(e=>(0,c.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Always Show?"}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:!!t.alwaysShow,onChange:e=>{t.alwaysShow=e.target.checked,n()}})]}),(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.banners.splice(r,1),n()},children:"Remove"})})]},r)}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.banners||(e.banners=[]),e.banners.push({banner:void 0,alwaysShow:!1}),n()},children:"Add Banner"})]})})]})});var Kh,Jh,Yh,Qh;!function(e){e.BASIC="BASIC",e.MEDIUM="MEDIUM",e.MEGA="MEGA",e.LINKLESS="LINKLESS",e.NONE="NONE",e.DMP="DMP",e.CMS="CMS"}(Kh||(Kh={})),function(e){e.PRIMARY="primary",e.SECONDARY="secondary",e.OUTLINE="outline",e.LINK="link"}(Jh||(Jh={})),function(e){e.SEARCH="search",e.LINKS="links",e.ACCOUNT_LINKS="accountLinks",e.HTML="html",e.TIMED_HTML="timedHtml"}(Yh||(Yh={})),function(e){e.LINKS="links",e.LOGO="logo",e.ACCOUNT_LINKS="accountLinks",e.CART_COUNT="cartCount",e.HTML="html"}(Qh||(Qh={}));const Zh={basic:{name:"basicHeaderConfig",showIf:"return options.get('headerType') === 'BASIC'",friendlyName:"Basic Menu Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"logoImage",friendlyName:"Logo Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header"},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile dropdown menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!0,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!0,defaultCollapsed:!0},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"desktopLinks",friendlyName:"Desktop Links",helperText:"Links to display in the desktop menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!0,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"ctas",friendlyName:"Call To Action",helperText:"Call to action button(s) to display",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"type",friendlyName:"CTA Type",helperText:"Select the type of CTA to display",type:"select",localized:!1,defaultCollapsed:!0,required:!0,defaultValue:"primary",enum:[Jh.PRIMARY,Jh.SECONDARY,Jh.OUTLINE,Jh.LINK]},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0},{name:"hideOnMobile",friendlyName:"Hide on Mobile",helperText:"Set to true to disable this CTA on mobile devices",type:"boolean",localized:!1,defaultCollapsed:!0}]},{name:"myAccountGuest",friendlyName:"MyAccount Menu Links - Guest",helperText:"Links to show under the My Account menu when the user is logged out.",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"icon",friendlyName:"Icon",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,defaultCollapsed:!0,helperText:"Link icon"},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"myAccountAuthorized",friendlyName:"MyAccount Menu Links - Logged In",helperText:"Links to show under the My Account menu when the user is logged in.",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0,required:!0},{name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,defaultCollapsed:!0,required:!0},{name:"icon",friendlyName:"Icon",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,defaultCollapsed:!0,helperText:"Link icon"},{name:"newTab",friendlyName:"New Tab",helperText:"When true, this link will open in a new tab",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cssClasses",friendlyName:"CSS Classes",helperText:"Used for VWO targeting",type:"Tags",localized:!1,defaultCollapsed:!0}]},{name:"stickyHeader",type:"object",friendlyName:"Sticky Header Configuration",defaultCollapsed:!0,localized:!1,subFields:[{name:"enabled",type:"boolean",friendlyName:"Enabled?",defaultCollapsed:!0,localized:!1},{name:"backgroundColor",type:"color",friendlyName:"Background Color",defaultCollapsed:!0,localized:!1,helperText:"The header background color at the top of the page. Leave blank for a transparent header"},{name:"scrollBackgroundColor",type:"color",friendlyName:"Background Color - Scroll",defaultCollapsed:!0,localized:!1,helperText:"The header background color while scrolling. Leave blank for a transparent header",defaultValue:"#FFFFFF"},{name:"scrollLogo",friendlyName:"Scroll Logo",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header while scrolling. Leave blank to use the default header logo"}]},{name:"showLocaleSelection",type:"boolean",friendlyName:"Show Locale Selection?",defaultCollapsed:!0,localized:!1,helperText:"Show Locale Selection"}]},medium:{"@type":"@builder.io/core:Field",name:"mediumHeaderConfig",friendlyName:"Medium Header Configuration",type:"object",showIf:"return options.get('headerType') === 'MEDIUM'",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"wrapperID",friendlyName:"Wrapper ID",helperText:"ID for the medium header wrapper",type:"text",localized:!1,defaultValue:"header",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the medium header wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"showShippingMessage",friendlyName:"Show Shipping Message",helperText:"Display the free shipping message on the mega menu",type:"boolean",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"mobileMenu",friendlyName:"Mobile Menu",helperText:"Mobile menu configuration for the medium header",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"logo",friendlyName:"Logo",helperText:"Logo for the mobile header",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"logoClasses",friendlyName:"Logo Classes",helperText:"CSS classes for the mobile logo",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"navClasses",friendlyName:"Navigation Classes",helperText:"CSS classes for the mobile navigation",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropDownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,required:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropDownContent",friendlyName:"Dropdown Content",helperText:"Content to display in the dropdown",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"type",friendlyName:"Dropdown Type",helperText:"Select the type of dropdown content",type:"select",enum:[Yh.SEARCH,Yh.LINKS,Yh.ACCOUNT_LINKS,Yh.HTML,Yh.TIMED_HTML],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for this dropdown",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"itemClasses",friendlyName:"Item Classes",helperText:"CSS classes for the link item",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedInOnly",friendlyName:"Logged In Only",helperText:"Display this link only when the user is logged in",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedOutOnly",friendlyName:"Logged Out Only",helperText:"Display this link only when the user is logged out",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Title",helperText:"Title for the link",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinksWrapperClasses",friendlyName:"Sub Links Wrapper Classes",helperText:"CSS classes for the sub-links wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinks",friendlyName:"Sub Links",helperText:"Sub-links for this dropdown item",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"htmlContent",friendlyName:"HTML Content",helperText:"HTML content to display in the dropdown",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"inputs",friendlyName:"Inputs",helperText:"Inputs for the dropdown content",type:"object",localized:!1,required:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"defaultHtml",friendlyName:"Default HTML",helperText:"Default HTML content that will be displayed",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"temporaryHtml",friendlyName:"Temporary HTML",helperText:"Temporary HTML content that will be displayed for a limited time",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"startTime",friendlyName:"Start Time",helperText:"Start time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"endTime",friendlyName:"End Time",helperText:"End time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0}]}]}]},{"@type":"@builder.io/core:Field",name:"desktopMenu",friendlyName:"Desktop Menu",helperText:"Desktop menu configuration for the medium header",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"logo",friendlyName:"Logo",helperText:"Logo for the desktop header",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"navClasses",friendlyName:"Navigation Classes",helperText:"CSS classes for the desktop navigation",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Content",helperText:"Content to display in the desktop header",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"type",friendlyName:"Content Type",helperText:"Select the type of content",type:"select",enum:[Qh.LINKS,Qh.LOGO,Qh.ACCOUNT_LINKS,Qh.CART_COUNT,Qh.HTML],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the desktop header",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Link Text",helperText:"Text for the link",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedInOnly",friendlyName:"Logged In Only",helperText:"Display this link only when the user is logged in",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"loggedOutOnly",friendlyName:"Logged Out Only",helperText:"Display this link only when the user is logged out",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownItemClasses",friendlyName:"Dropdown Item Classes",helperText:"CSS classes for the dropdown item",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"subLinks",friendlyName:"Sub Links",helperText:"Sub-links for this header item",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"columnHeaderTitle",friendlyName:"Column Header Title",helperText:"Title for the column header",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"columnContentType",friendlyName:"Column Content Type",helperText:"Select the type of content for the column",type:"select",enum:["links","html","timedHtml"],defaultValue:"links",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the column",type:"list",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"text",friendlyName:"Text",helperText:"Text for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"URL",friendlyName:"URL",helperText:"URL for the link",type:"url",localized:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Content",helperText:"Content for the column",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"inputs",friendlyName:"Inputs",helperText:"Inputs for the dropdown content",type:"object",localized:!1,required:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"defaultHtml",friendlyName:"Default HTML",helperText:"Default HTML content that will be displayed",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"temporaryHtml",friendlyName:"Temporary HTML",helperText:"Temporary HTML content that will be displayed for a limited time",type:"html",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"startTime",friendlyName:"Start Time",helperText:"Start time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"endTime",friendlyName:"End Time",helperText:"End time for the timed HTML content",type:"timestamp",localized:!1,defaultCollapsed:!0}]}]}]},{"@type":"@builder.io/core:Field",name:"accountLinksConfig",friendlyName:"Account Links Config",helperText:"",type:"object",localized:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"dropdownWrapperClasses",friendlyName:"Dropdown Wrapper Classes",helperText:"CSS classes for the dropdown wrapper",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"dropdownItemClasses",friendlyName:"Dropdown Item Classes",helperText:"CSS classes for the dropdown item",type:"text",localized:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"htmlContent",friendlyName:"HTML Content",helperText:"HTML content to display in the header",type:"html",localized:!1,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"bannersAboveHeader",friendlyName:"Banners Above Header",helperText:"Banners to display above the header",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"wrapperClasses",friendlyName:"Wrapper Classes",helperText:"CSS classes for the banner wrapper",type:"text",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"content",friendlyName:"Banner Content",helperText:"Content to display in the banner",type:"html",localized:!0,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"contactUrl",friendlyName:"Contact URL",helperText:"URL for the contact page",type:"url",localized:!0,defaultCollapsed:!0}]},mega:{"@type":"@builder.io/core:Field",name:"megaMenuConfig",showIf:"return options.get('headerType') === 'MEGA'",friendlyName:"Mega Menu Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"showShippingMessage",friendlyName:"Show Shipping Message",helperText:"Display the free shipping message on the mega menu",type:"boolean",localized:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile mega menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"expanded",friendlyName:"Expanded",helperText:"Indicates if the mobile link is expanded by default",type:"boolean",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Sub-Links",helperText:"Sub-links for the mobile link",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]}]},{"@type":"@builder.io/core:Field",name:"desktopShopNavLinks",friendlyName:"Desktop Shop Navigation Links",helperText:"Links to display in the desktop shop navigation",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,required:!0,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"links",friendlyName:"Links",helperText:"Links for the desktop navigation",type:"list",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"shopAllLink",friendlyName:"Shop All Link",helperText:'Link to the "Shop All" page',type:"object",localized:!1,required:!1,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Link Title",helperText:"Title for the link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the link",type:"url",localized:!1,required:!0,defaultCollapsed:!0}]}]}]},dmp:{"@type":"@builder.io/core:Field",name:"dmpHeaderConfig",showIf:"return options.get('headerType') === 'DMP'",friendlyName:"DMP Header Config",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"logoImage",friendlyName:"Logo Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed in the header"},{"@type":"@builder.io/core:Field",name:"mobileLinks",friendlyName:"Mobile Links",helperText:"Links to display in the mobile dropdown menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Mobile Link Title",helperText:"Title for the mobile link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0}]},{"@type":"@builder.io/core:Field",name:"desktopLinks",friendlyName:"Desktop Links",helperText:"Links to display in the desktop menu",type:"list",localized:!0,defaultCollapsed:!0,subFields:[{"@type":"@builder.io/core:Field",name:"title",friendlyName:"Desktop Link Title",helperText:"Title for the desktop link",type:"text",localized:!1,defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"href",friendlyName:"Link URL",helperText:"URL for the mobile link",type:"url",localized:!1,required:!1,defaultCollapsed:!0}]}]},cms:{"@type":"@builder.io/core:Field",name:"cmsHeaderConfig",showIf:"return options.get('headerType') === 'CMS'",friendlyName:"CMS Header Config",helperText:"Reference a header created in Builder CMS to use as the website header.",type:"reference",model:"header",copyOnAdd:!1,localized:!1,required:!0,defaultCollapsed:!0}};var Xh,ef,tf;!function(e){e.BASIC="BASIC",e.MEGA="MEGA",e.NONE="NONE",e.CMS="CMS"}(Xh||(Xh={})),function(e){e.DROPDOWN="Dropdown",e.STACKED_LIST="Stacked List",e.HORIZONTAL_LIST="Horizontal List"}(ef||(ef={})),function(e){e.P="/p",e.PRODUCT="/product"}(tf||(tf={}));const nf=e=>({name:"features",friendlyName:"Features",type:"object",defaultCollapsed:!0,helperText:"Enable or disable site-wide features and behaviors",subFields:[{name:"productGridFilterType",friendlyName:"Product Grid Filter Type",type:"select",defaultCollapsed:!0,helperText:"Select the type of filters to use. 'Dropdown' will display a drop down of categories, ingredients, use cases, and tags. \n 'Stacked List' allows you to create your own filter groupings from amongst those four filter types.\n 'Horizontal List' displays Product Categories only horizontally; click to filter on page or navigate option available.",enum:[ef.DROPDOWN,ef.STACKED_LIST,ef.HORIZONTAL_LIST],defaultValue:"Dropdown"},{name:"productGridFilterGroups",friendlyName:"Product Grid Filter Groups",type:"list",defaultCollapsed:!0,helperText:"Select the filter groups to use. They will be presented in the order entered",subFields:[{name:"filterConfig",friendlyName:"Product Grid Filter",type:"reference",defaultCollapsed:!0,modelId:e,helperText:"Select a product grid filter group to display",copyOnAdd:!1}]},{name:"productGridHideRestricted",friendlyName:"Hide Restricted Products",helperText:"Hide restricted products from your product grid based on the user's selected country",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"productLinkPrefix",friendlyName:"Product Link Prefix",helperText:'Set the prefix to append before product slugs throughout your site. For example, if you enter "p", all links from the product grid will be {website}/p/{product-slug}',type:"select",enum:[tf.P,tf.PRODUCT],localized:!1,defaultCollapsed:!0,defaultValue:"/p"},{name:"subscriptionAddOnsEnabled",friendlyName:"Subscription Add-Ons Enabled",helperText:"Enable or disable subscription add-ons for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"shippingThresholdNotificationEnabled",friendlyName:"Shipping Threshold Notification Enabled",helperText:"Enable or disable shipping threshold notifications for the brand",type:"boolean",localized:!0,defaultCollapsed:!0},{name:"bundlingEnabled",friendlyName:"Enable Bundling Experience",helperText:"Enable or disable the bundling experience for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"cartDrawerEnabled",friendlyName:"Enable Cart Drawer",helperText:"Enable or disable the cart drawer experience for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"passwordlessLoginEnabled",friendlyName:"Enable Passwordless Login",helperText:"Enable or disable passwordless login for the brand",type:"boolean",localized:!1,defaultCollapsed:!0},{name:"passwordlessLoginDefault",friendlyName:"Passwordless Login is Default",helperText:"When enabled, passwordless login is presented as the default login method",type:"boolean",localized:!1,defaultCollapsed:!0,showIf:"return options.get('passwordlessLoginEnabled') === true"},{name:"subscriptionExperience",friendlyName:"Subscription Experience",type:"select",enum:["Classic","Version 2"],defaultValue:"Classic",defaultCollapsed:!1,helperText:"Select the subscription management experience for customers"},{name:"useDefaultFrequencies",friendlyName:"Use Default Frequencies",type:"boolean",helperText:"When enabled, the selected frequency on an Offer Selector is calculated based on the product and quantity selected.",defaultCollapsed:!1},{name:"recommendationConfig",friendlyName:"Recommendation Config",type:"reference",model:"recommendation-config",localized:!1,defaultCollapsed:!1,copyOnAdd:!1,helperText:"Select the global recommendation config used to generate product recommendations site-wide."},{name:"dynamicBrowserTab",friendlyName:"Dynamic Browser Tab",type:"object",defaultCollapsed:!0,helperText:"When enabled, the browser tab title blinks to a custom message after the user switches away from the tab.",subFields:[{name:"enabled",friendlyName:"Enabled",type:"boolean",required:!1,localized:!1,defaultCollapsed:!0,helperText:"Turn the dynamic browser tab on or off."},{name:"awayTitle",friendlyName:"Away Title",type:"text",required:!0,localized:!0,defaultCollapsed:!0,helperText:"Tab title that blinks when the user switches away from the tab. Emoji go inline here."},{name:"defaultTitle",friendlyName:"Default Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Optional. Overrides the page title on load."}]}]});var rf,of;!function(e){e.DoNotLike="DoNotLike",e.NotWorking="NotWorking",e.NoBenefits="NoBenefits",e.NoFitNoNeed="NoFitNoNeed",e.Budget="Budget",e.Mistake="Mistake",e.Try="Try",e.TooMuch="TooMuch",e.TravelMove="TravelMove",e.DoNotNeed="DoNotNeed",e.AnotherReason="AnotherReason",e.NotHelpingSkin="NotHelpingSkin",e.SkinImproved="SkinImproved",e.PetDoesNotLike="PetDoesNotLike",e.NotHelpingPet="NotHelpingPet",e.NoneGiven="NoneGiven"}(rf||(rf={})),function(e){e.Link="link",e.Update="update",e.Keep="keep",e.Continue="continue",e.Cancel="cancel"}(of||(of={}));const sf=e=>[{name:"brandDisplayName",friendlyName:"Brand Display Name",type:"text",defaultCollapsed:!0,localized:!1,required:!0,helperText:"The brand name displayed across the website"},{name:"images",friendlyName:"Brand Images",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Logo and brand images used throughout the website",subFields:[{name:"brandLogoSmall",friendlyName:"Logo (Small)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Small logo for the brand",defaultCollapsed:!0},{name:"brandLogoLarge",friendlyName:"Logo (Large)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Large logo for the brand",defaultCollapsed:!0},{name:"brandLogoFooter",friendlyName:"Logo (Footer)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Footer logo for the brand",defaultCollapsed:!0},{name:"bbbImage",friendlyName:"BBB Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"BBB logo for the brand",defaultCollapsed:!0},{name:"accesibilityLogo",friendlyName:"Accessibility Logo",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Accessibility logo for the brand",defaultCollapsed:!0},{name:"brandLogoOffWhite",friendlyName:"Logo (Off-White)",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Off white logo for the brand",defaultCollapsed:!0},{name:"defaultPetProfileImage",friendlyName:"Default Pet Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for pet profiles",defaultCollapsed:!0},{name:"defaultCatProfileImage",friendlyName:"Default Cat Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for cat profiles",defaultCollapsed:!0},{name:"defaultDogProfileImage",friendlyName:"Default Dog Profile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Default image for dog profiles",defaultCollapsed:!0},{name:"linklessPageHeaderLogo",friendlyName:"Linkless Header Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],localized:!0,helperText:"Logo Image for the linkless header",defaultCollapsed:!0}]},{name:"links",friendlyName:"General Links",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Links to legal pages and external profiles",subFields:[{name:"termsLink",friendlyName:"Terms of Service Link",type:"url",localized:!1,helperText:"Link to the terms of service page",defaultCollapsed:!0},{name:"subscriptionTermsLink",friendlyName:"Subscription Terms of Service Link",type:"url",localized:!1,helperText:"Link to the subscription terms of service page",defaultCollapsed:!0},{name:"privacyLink",friendlyName:"Privacy Policy Link",type:"url",localized:!1,helperText:"Link to the privacy policy page",defaultCollapsed:!0},{name:"ccpaLink",friendlyName:"CCPA Link",type:"url",localized:!1,helperText:"Link to the CCPA page",defaultCollapsed:!0},{name:"bbbLink",friendlyName:"BBB Link",type:"url",localized:!1,helperText:"Link to the Better Business Bureau page",defaultCollapsed:!0},{name:"accessibiltyLink",friendlyName:"Accessibility Link",type:"url",localized:!1,helperText:"Link to the accessibility page",defaultCollapsed:!0},{name:"socialMedia",friendlyName:"Social Media Links",type:"object",localized:!1,helperText:"Links to the brand's social media profiles",defaultCollapsed:!0,subFields:[{name:"twitter",friendlyName:"Twitter / X",type:"url",localized:!1,helperText:"Link to the brand's Twitter/X profile",defaultCollapsed:!0},{name:"facebook",friendlyName:"Facebook",type:"url",localized:!1,helperText:"Link to the brand's Facebook page",defaultCollapsed:!0},{name:"youtube",friendlyName:"YouTube",type:"url",localized:!1,helperText:"Link to the brand's YouTube channel",defaultCollapsed:!0},{name:"instagram",friendlyName:"Instagram",type:"url",localized:!1,helperText:"Link to the brand's Instagram profile",defaultCollapsed:!0},{name:"pinterest",friendlyName:"Pinterest",type:"url",localized:!1,helperText:"Link to the brand's Pinterest profile",defaultCollapsed:!0},{name:"tiktok",friendlyName:"TikTok",type:"url",localized:!1,helperText:"Link to the brand's TikTok profile",defaultCollapsed:!0}]}]},{name:"banners",friendlyName:"Banners",helperText:"Select the banner(s) to display site-wide. These will be displayed in the\n order provided, and always above page-specific announcements",type:"list",defaultCollapsed:!0,localized:!1,subFields:[{name:"banner",friendlyName:"Sitewide Banner",type:"reference",localized:!1,helperText:"Select the banner to display.",defaultCollapsed:!0,modelId:e,copyOnAdd:!1},{name:"alwaysShow",friendlyName:"Always Show?",type:"boolean",localized:!1,helperText:'By default, we hide sitewide banners on the classic "cart" pages. Use this setting to bypass those restrictions',defaultCollapsed:!0}]}],af={name:"blog-comment",displayName:"Blog Comment",kind:"data",helperText:"Comments on your website's blogs",contentTitleField:void 0,fields:[{name:"name",friendlyName:"Name",helperText:"Name of the user who submitted this comment",type:"text",defaultCollapsed:!1,localized:!1,required:!0},{name:"date",friendlyName:"Date",helperText:"Date this comment was submitted",type:"timestamp",defaultCollapsed:!1,localized:!1,required:!0},{name:"status",friendlyName:"Status",helperText:"Select the status of this comment. Only Approved comments will be displayed",type:"select",enum:["Pending Approval","Approved","Rejected"],defaultValue:"Pending Approval",defaultCollapsed:!1,localized:!1,required:!0},{type:"text",name:"email",friendlyName:"Email",required:!1,defaultCollapsed:!1,helperText:"Email address of the commenter"},{type:"html",name:"comment",friendlyName:"Comment",helperText:"HTML content of the comment",required:!0,defaultCollapsed:!1},{name:"language",friendlyName:"Language",helperText:"The language code of this comment. Legacy comments are synced as 'en'",type:"select",enum:["en"],defaultCollapsed:!0,localized:!1,defaultValue:"en",required:!0},{name:"locale",friendlyName:"Locale",helperText:"The country code of this comment. Legacy comments are synced as 'US'",type:"select",enum:["US"],defaultValue:"US",defaultCollapsed:!0,localized:!1,required:!0},{name:"parentId",friendlyName:"Parent Comment Id",helperText:"If this comment is a reply, this is the Id of the parent",type:"text",required:!1,defaultCollapsed:!0},{name:"internal",friendlyName:"Brand Response",helperText:"Indicates that this is a comment provided by the brand (i.e. a response)",type:"boolean",defaultCollapsed:!1,required:!1}],hideFromUI:!0};var lf,df,cf,pf,uf,hf,ff,mf,gf,yf,bf,xf;!function(e){e.FlavorOptionGroup="Flavor/Option Group",e.TrialGroup="Trial Group"}(lf||(lf={})),function(e){e.Age="Age",e.Gender="Gender",e.Weight="Weight",e.Type="Type",e.Breed="Breed",e.HealthConditions="Health Conditions"}(df||(df={})),function(e){e.Tag="Tag",e.Ingredient="Ingredient",e.Category="Category",e.UseCase="UseCase"}(cf||(cf={})),function(e){e.Exclusive="exclusive",e.Preferred="preferred",e.Required="required"}(pf||(pf={})),function(e){e.Inclusive="Inclusive",e.Exclusive="Exclusive"}(uf||(uf={})),function(e){e.AboveHeader="Above Header",e.BelowHeader="Below Header"}(hf||(hf={})),function(e){e.GENERAL="General",e.PRODUCT="Product",e.BLOG="Blog"}(ff||(ff={})),function(e){e.PRODUCT="Product",e.PRODUCT_GROUP="Product Group",e.MULTI_GROUP="Multi-Group"}(mf||(mf={})),function(e){e.VERTICAL="Vertical",e.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE="Vertical - Flavor Dropdown - Type Toggle",e.STACKED__FLAVOR_BUTTONS__QUANTITY_TOGGLE="Stacked - Flavor Buttons - Quantity Toggle",e.BUNDLE_GROUP="Bundle Group",e.VERTICAL_FLAVOR_BUTTONS_TOGGLE="Vertical - Flavor Buttons - Type Toggle"}(gf||(gf={})),function(e){e.SLIDER_A="Slider A",e.SLIDER_B="Slider B",e.SLIDER_ZOOM="Slider Zoom"}(yf||(yf={})),function(e){e.ONE_TIME="One-Time Purchase",e.SUBSCRIPTION="Subscription"}(bf||(bf={})),function(e){e.PERCENT="percentage",e.DOLLAR="dollar"}(xf||(xf={}));const vf=({text:e})=>(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:e}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),wf=({label:e,onClick:t})=>(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:t,children:e}),kf=({onClick:e})=>(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:e,children:"Remove"}),Cf=({title:e,index:t,onRemove:n})=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:[e," #",t+1]}),(0,c.jsx)(kf,{onClick:n})]}),Tf=({title:e,defaultOpen:t=!1,children:n})=>{const[r,o]=(0,p.useState)(t);return(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden",children:[(0,c.jsxs)("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>o(!r),children:[(0,c.jsx)("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:e}),(0,c.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-[var(--text-muted)] transition-transform "+(r?"rotate-180":""),children:(0,c.jsx)("path",{d:"M6 9l6 6 6-6"})})]}),r&&(0,c.jsx)("div",{className:"px-4 pb-4 space-y-4 border-t border-[var(--border-glass)]",children:n})]})},Nf=({label:e,helper:t,checked:n,onChange:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:t})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:n,onChange:e=>r(e.target.checked)})]}),Sf=({label:e,helper:t,value:n,onChange:r})=>(0,c.jsx)(z,{label:e,helper:t,children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0",value:n||"#FFFFFF",onChange:e=>r(e.target.value)}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n??"",placeholder:"#FFFFFF",onChange:e=>r(e.target.value)})]})}),Mf=({label:e,helper:t,value:n,onChange:r})=>(0,c.jsx)(z,{label:e,helper:t??"CSS classes",children:(0,c.jsx)(Hh,{value:n||[],onChange:r,placeholder:"Type a class and press Enter"})}),jf=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,r()}}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,r()}})]})]})),Of=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]}),(0,c.jsx)(z,{label:"Icon URL",helper:"URL to an icon image for this link",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.icon??"",onChange:t=>{e.icon=t.target.value,r()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,r()}}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,r()}})]})]})),Af=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"CTA",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,n()}})})]}),(0,c.jsx)(z,{label:"CTA Type",required:!0,children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Jh.PRIMARY,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Jh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Open in New Tab",checked:!!e.newTab,onChange:t=>{e.newTab=t,n()}}),(0,c.jsx)(Nf,{label:"Hide on Mobile",helper:"Disable this CTA on mobile devices",checked:!!e.hideOnMobile,onChange:t=>{e.hideOnMobile=t,n()}})]}),(0,c.jsx)(Mf,{label:"CSS Classes",helper:"Used for VWO targeting",value:e.cssClasses||[],onChange:t=>{e.cssClasses=t,n()}})]})),Ef=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.basicHeaderConfig||(e.header.basicHeaderConfig={}),e.header.basicHeaderConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]},i=()=>{const e=n();return e.stickyHeader||(e.stickyHeader={}),e.stickyHeader};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(F,{label:"Logo Image",value:"string"==typeof r.logoImage?r.logoImage:void 0,onChange:e=>{n().logoImage=e??"",t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(jf,{item:e,index:n,label:"Mobile Link",onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopLinks||[]).map((e,n)=>(0,c.jsx)(jf,{item:e,index:n,label:"Desktop Link",onChange:t,onRemove:()=>{o("desktopLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Desktop Link",onClick:()=>{o("desktopLinks").push({title:"",href:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Call To Action Buttons"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.ctas||[]).map((e,n)=>(0,c.jsx)(Af,{item:e,index:n,onChange:t,onRemove:()=>{o("ctas").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add CTA",onClick:()=>{o("ctas").push({title:"",href:"",type:Jh.PRIMARY,newTab:!1,cssClasses:[],hideOnMobile:!1}),t()}})]}),(0,c.jsx)(vf,{text:"MyAccount Links - Guest"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.myAccountGuest||[]).map((e,n)=>(0,c.jsx)(Of,{item:e,index:n,label:"Guest Link",onChange:t,onRemove:()=>{o("myAccountGuest").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Guest Link",onClick:()=>{o("myAccountGuest").push({title:"",href:"",icon:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"MyAccount Links - Logged In"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.myAccountAuthorized||[]).map((e,n)=>(0,c.jsx)(Of,{item:e,index:n,label:"Authorized Link",onChange:t,onRemove:()=>{o("myAccountAuthorized").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Authorized Link",onClick:()=>{o("myAccountAuthorized").push({title:"",href:"",icon:"",newTab:!1,cssClasses:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Sticky Header"}),(0,c.jsxs)(Tf,{title:"Sticky Header Configuration",children:[(0,c.jsx)(Nf,{label:"Enabled",helper:"Enable sticky header behavior on scroll",checked:!!i().enabled,onChange:e=>{i().enabled=e,t()}}),(0,c.jsx)(Sf,{label:"Background Color",helper:"Header background color at the top of the page. Leave blank for transparent.",value:i().backgroundColor??"",onChange:e=>{i().backgroundColor=e,t()}}),(0,c.jsx)(Sf,{label:"Scroll Background Color",helper:"Header background color while scrolling. Leave blank for transparent.",value:i().scrollBackgroundColor??"#FFFFFF",onChange:e=>{i().scrollBackgroundColor=e,t()}}),(0,c.jsx)(F,{label:"Scroll Logo",value:"string"==typeof i().scrollLogo?i().scrollLogo:void 0,onChange:e=>{i().scrollLogo=e??"",t()}})]}),(0,c.jsx)(vf,{text:"Locale"}),(0,c.jsx)(Nf,{label:"Show Locale Selection",helper:"Display locale selection in the header",checked:!!r.showLocaleSelection,onChange:e=>{n().showLocaleSelection=e,t()}})]})}),Lf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Link Text (HTML)",children:(0,c.jsx)($h,{value:e.text??"",onChange:t=>{e.text=t,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}})})]}),(0,c.jsx)(z,{label:"Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.itemClasses??"",onChange:t=>{e.itemClasses=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Logged In Only",checked:!!e.loggedInOnly,onChange:t=>{e.loggedInOnly=t,n()}}),(0,c.jsx)(Nf,{label:"Logged Out Only",checked:!!e.loggedOutOnly,onChange:t=>{e.loggedOutOnly=t,n()}})]}),(0,c.jsx)(z,{label:"Sub Links Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.subLinksWrapperClasses??"",onChange:t=>{e.subLinksWrapperClasses=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links"}),(e.subLinks||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Text",value:t.text??"",onChange:e=>{t.text=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.URL??"",onChange:e=>{t.URL=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.subLinks.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Sub-Link",onClick:()=>{e.subLinks||(e.subLinks=[]),e.subLinks.push({text:"",URL:""}),n()}})]})]})),Df=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Dropdown Item",index:t,onRemove:r}),(0,c.jsx)(z,{label:"Dropdown Type",children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Yh.LINKS,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Yh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(e.type===Yh.HTML||e.type===Yh.TIMED_HTML)&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:e.htmlContent??"",onChange:t=>{e.htmlContent=t,n()}})}),e.type===Yh.TIMED_HTML&&(0,c.jsxs)(Tf,{title:"Timed HTML Inputs",children:[(0,c.jsx)(z,{label:"Default HTML",children:(0,c.jsx)($h,{value:e.inputs?.defaultHtml??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.defaultHtml=t,n()}})}),(0,c.jsx)(z,{label:"Temporary HTML",children:(0,c.jsx)($h,{value:e.inputs?.temporaryHtml??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.temporaryHtml=t,n()}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Start Time",children:(0,c.jsx)("input",{type:"datetime-local",className:"hippo-input",value:e.inputs?.startTime??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.startTime=t.target.value,n()}})}),(0,c.jsx)(z,{label:"End Time",children:(0,c.jsx)("input",{type:"datetime-local",className:"hippo-input",value:e.inputs?.endTime??"",onChange:t=>{e.inputs||(e.inputs={}),e.inputs.endTime=t.target.value,n()}})})]})]}),(e.type===Yh.LINKS||e.type===Yh.ACCOUNT_LINKS)&&(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsx)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsx)(Lf,{item:t,index:r,onChange:n,onRemove:()=>{e.links.splice(r,1),n()}},r)),(0,c.jsx)(wf,{label:"+ Add Link",onClick:()=>{e.links||(e.links=[]),e.links.push({text:"",URL:""}),n()}})]})]})),If=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Link Text (HTML)",children:(0,c.jsx)($h,{value:e.text??"",onChange:t=>{e.text=t,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(Nf,{label:"Logged In Only",checked:!!e.loggedInOnly,onChange:t=>{e.loggedInOnly=t,n()}}),(0,c.jsx)(Nf,{label:"Logged Out Only",checked:!!e.loggedOutOnly,onChange:t=>{e.loggedOutOnly=t,n()}})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.dropdownWrapperClasses??"",onChange:t=>{e.dropdownWrapperClasses=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Dropdown Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.dropdownItemClasses??"",onChange:t=>{e.dropdownItemClasses=t.target.value,n()}})})]}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-3 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links / Columns"}),(e.subLinks||[]).map((t,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-3 space-y-2",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-[11px] font-semibold text-[var(--text-secondary)]",children:["Column #",r+1]}),(0,c.jsx)(kf,{onClick:()=>{e.subLinks.splice(r,1),n()}})]}),(0,c.jsx)(z,{label:"Column Header",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:t.columnHeaderTitle??"",onChange:e=>{t.columnHeaderTitle=e.target.value,n()}})}),(0,c.jsx)(z,{label:"Content Type",children:(0,c.jsxs)("select",{className:"hippo-input",value:t.columnContentType??"links",onChange:e=>{t.columnContentType=e.target.value,n()},children:[(0,c.jsx)("option",{value:"links",children:"links"}),(0,c.jsx)("option",{value:"html",children:"html"}),(0,c.jsx)("option",{value:"timedHtml",children:"timedHtml"})]})}),"links"===t.columnContentType&&(0,c.jsxs)("div",{className:"space-y-1",children:[(t.links||[]).map((e,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Text",value:e.text??"",onChange:t=>{e.text=t.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:e.URL??"",onChange:t=>{e.URL=t.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{t.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Link",onClick:()=>{t.links||(t.links=[]),t.links.push({text:"",URL:""}),n()}})]}),"html"===t.columnContentType&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:t.content??"",onChange:e=>{t.content=e,n()}})}),"timedHtml"===t.columnContentType&&(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)(z,{label:"Default HTML",children:(0,c.jsx)($h,{value:t.inputs?.defaultHtml??"",onChange:e=>{t.inputs||(t.inputs={}),t.inputs.defaultHtml=e,n()}})}),(0,c.jsx)(z,{label:"Temporary HTML",children:(0,c.jsx)($h,{value:t.inputs?.temporaryHtml??"",onChange:e=>{t.inputs||(t.inputs={}),t.inputs.temporaryHtml=e,n()}})})]})]},r)),(0,c.jsx)(wf,{label:"+ Add Column",onClick:()=>{e.subLinks||(e.subLinks=[]),e.subLinks.push({columnHeaderTitle:"",columnContentType:"links",links:[]}),n()}})]})]})),Rf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Content Block",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Content Type",children:(0,c.jsx)("select",{className:"hippo-input",value:e.type??Qh.LINKS,onChange:t=>{e.type=t.target.value,n()},children:Object.values(Qh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsx)(z,{label:"Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.wrapperClasses??"",onChange:t=>{e.wrapperClasses=t.target.value,n()}})})]}),e.type===Qh.HTML&&(0,c.jsx)(z,{label:"HTML Content",children:(0,c.jsx)($h,{value:e.htmlContent??"",onChange:t=>{e.htmlContent=t,n()}})}),e.type===Qh.ACCOUNT_LINKS&&(0,c.jsxs)(Tf,{title:"Account Links Config",children:[(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.accountLinksConfig?.dropdownWrapperClasses??"",onChange:t=>{e.accountLinksConfig||(e.accountLinksConfig={}),e.accountLinksConfig.dropdownWrapperClasses=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Dropdown Item Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.accountLinksConfig?.dropdownItemClasses??"",onChange:t=>{e.accountLinksConfig||(e.accountLinksConfig={}),e.accountLinksConfig.dropdownItemClasses=t.target.value,n()}})})]}),e.type===Qh.LINKS&&(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsx)("span",{className:"text-xs font-semibold text-[var(--text-secondary)]",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsx)(If,{item:t,index:r,onChange:n,onRemove:()=>{e.links.splice(r,1),n()}},r)),(0,c.jsx)(wf,{label:"+ Add Link",onClick:()=>{e.links||(e.links=[]),e.links.push({text:"",URL:""}),n()}})]})]})),Pf=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.mediumHeaderConfig||(e.header.mediumHeaderConfig={}),e.header.mediumHeaderConfig),r=n(),o=()=>{const e=n();return e.mobileMenu||(e.mobileMenu={}),e.mobileMenu},i=()=>{const e=n();return e.desktopMenu||(e.desktopMenu={}),e.desktopMenu},s=(e,t)=>(Array.isArray(e[t])||(e[t]=[]),e[t]);return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Wrapper ID",helper:"ID for the medium header wrapper",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.wrapperID??"header",onChange:e=>{n().wrapperID=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Wrapper Classes",helper:"CSS classes for the medium header wrapper",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.wrapperClasses??"",onChange:e=>{n().wrapperClasses=e.target.value,t()}})})]}),(0,c.jsx)(Nf,{label:"Show Shipping Message",helper:"Display the free shipping message on the header",checked:!!r.showShippingMessage,onChange:e=>{n().showShippingMessage=e,t()}}),(0,c.jsx)(vf,{text:"Mobile Menu"}),(0,c.jsxs)(Tf,{title:"Mobile Menu Configuration",children:[(0,c.jsx)(F,{label:"Mobile Logo",value:"string"==typeof o().logo?o().logo:void 0,onChange:e=>{o().logo=e??"",t()}}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,c.jsx)(z,{label:"Logo Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().logoClasses??"",onChange:e=>{o().logoClasses=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Nav Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().navClasses??"",onChange:e=>{o().navClasses=e.target.value,t()}})}),(0,c.jsx)(z,{label:"Dropdown Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o().dropDownWrapperClasses??"",onChange:e=>{o().dropDownWrapperClasses=e.target.value,t()}})})]}),(0,c.jsx)(vf,{text:"Dropdown Content"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(o().dropDownContent||[]).map((e,n)=>(0,c.jsx)(Df,{item:e,index:n,onChange:t,onRemove:()=>{s(o(),"dropDownContent").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Dropdown Item",onClick:()=>{s(o(),"dropDownContent").push({type:Yh.LINKS,links:[]}),t()}})]})]}),(0,c.jsx)(vf,{text:"Desktop Menu"}),(0,c.jsxs)(Tf,{title:"Desktop Menu Configuration",children:[(0,c.jsx)(F,{label:"Desktop Logo",value:"string"==typeof i().logo?i().logo:void 0,onChange:e=>{i().logo=e??"",t()}}),(0,c.jsx)(z,{label:"Nav Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:i().navClasses??"",onChange:e=>{i().navClasses=e.target.value,t()}})}),(0,c.jsx)(vf,{text:"Content Blocks"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(i().content||[]).map((e,n)=>(0,c.jsx)(Rf,{item:e,index:n,onChange:t,onRemove:()=>{s(i(),"content").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Content Block",onClick:()=>{s(i(),"content").push({type:Qh.LINKS,links:[]}),t()}})]})]}),(0,c.jsx)(vf,{text:"Banners Above Header"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.bannersAboveHeader||[]).map((e,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Banner",index:r,onRemove:()=>{s(n(),"bannersAboveHeader").splice(r,1),t()}}),(0,c.jsx)(z,{label:"Wrapper Classes",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.wrapperClasses??"",onChange:n=>{e.wrapperClasses=n.target.value,t()}})}),(0,c.jsx)(z,{label:"Banner Content (HTML)",children:(0,c.jsx)($h,{value:e.content??"",onChange:n=>{e.content=n,t()}})})]},r)),(0,c.jsx)(wf,{label:"+ Add Banner",onClick:()=>{s(n(),"bannersAboveHeader").push({wrapperClasses:"",content:""}),t()}})]}),(0,c.jsx)(vf,{text:"Contact"}),(0,c.jsx)(z,{label:"Contact URL",helper:"URL for the contact page",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:r.contactUrl??"",onChange:e=>{n().contactUrl=e.target.value,t()}})})]})}),zf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Mobile Link",index:t,onRemove:r}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,n()}})})]}),(0,c.jsx)(Nf,{label:"Expanded by Default",helper:"Show sub-links expanded on load",checked:!!e.expanded,onChange:t=>{e.expanded=t,n()}}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Sub-Links"}),(e.links||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Title",value:t.title??"",onChange:e=>{t.title=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.href??"",onChange:e=>{t.href=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Sub-Link",onClick:()=>{e.links||(e.links=[]),e.links.push({title:"",href:""}),n()}})]})]})),Bf=(0,u.observer)(({item:e,index:t,onChange:n,onRemove:r})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:"Nav Group",index:t,onRemove:r}),(0,c.jsx)(z,{label:"Group Title",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,n()}})}),(0,c.jsxs)("div",{className:"pl-4 border-l-2 border-[var(--border-glass)] space-y-2 mt-2",children:[(0,c.jsx)("span",{className:"text-[11px] font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Links"}),(e.links||[]).map((t,r)=>(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Title",value:t.title??"",onChange:e=>{t.title=e.target.value,n()}}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"URL",value:t.href??"",onChange:e=>{t.href=e.target.value,n()}}),(0,c.jsx)(kf,{onClick:()=>{e.links.splice(r,1),n()}})]},r)),(0,c.jsx)(wf,{label:"+ Link",onClick:()=>{e.links||(e.links=[]),e.links.push({title:"",href:""}),n()}})]}),(0,c.jsx)(vf,{text:"Shop All Link"}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Shop All Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.shopAllLink?.title??"",onChange:t=>{e.shopAllLink||(e.shopAllLink={title:"",href:""}),e.shopAllLink.title=t.target.value,n()}})}),(0,c.jsx)(z,{label:"Shop All URL",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.shopAllLink?.href??"",onChange:t=>{e.shopAllLink||(e.shopAllLink={title:"",href:""}),e.shopAllLink.href=t.target.value,n()}})})]})]})),Ff=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.megaMenuConfig||(e.header.megaMenuConfig={}),e.header.megaMenuConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(Nf,{label:"Show Shipping Message",helper:"Display the free shipping message on the mega menu",checked:!!r.showShippingMessage,onChange:e=>{n().showShippingMessage=e,t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(zf,{item:e,index:n,onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:"",expanded:!1,links:[]}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Shop Navigation"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopShopNavLinks||[]).map((e,n)=>(0,c.jsx)(Bf,{item:e,index:n,onChange:t,onRemove:()=>{o("desktopShopNavLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Nav Group",onClick:()=>{o("desktopShopNavLinks").push({title:"",links:[],shopAllLink:{title:"",href:""}}),t()}})]})]})}),qf=(0,u.observer)(({item:e,index:t,label:n,onChange:r,onRemove:o})=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(Cf,{title:n,index:t,onRemove:o}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,c.jsx)(z,{label:"Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:e.title??"",onChange:t=>{e.title=t.target.value,r()}})}),(0,c.jsx)(z,{label:"URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:e.href??"",onChange:t=>{e.href=t.target.value,r()}})})]})]})),$f=(0,u.observer)(({data:e,markDirty:t})=>{const n=()=>(e.header||(e.header={}),e.header.dmpHeaderConfig||(e.header.dmpHeaderConfig={}),e.header.dmpHeaderConfig),r=n(),o=e=>{const t=n();return Array.isArray(t[e])||(t[e]=[]),t[e]};return(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(F,{label:"Logo Image",value:"string"==typeof r.logoImage?r.logoImage:void 0,onChange:e=>{n().logoImage=e??"",t()}}),(0,c.jsx)(vf,{text:"Mobile Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.mobileLinks||[]).map((e,n)=>(0,c.jsx)(qf,{item:e,index:n,label:"Mobile Link",onChange:t,onRemove:()=>{o("mobileLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Mobile Link",onClick:()=>{o("mobileLinks").push({title:"",href:""}),t()}})]}),(0,c.jsx)(vf,{text:"Desktop Links"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(r.desktopLinks||[]).map((e,n)=>(0,c.jsx)(qf,{item:e,index:n,label:"Desktop Link",onChange:t,onRemove:()=>{o("desktopLinks").splice(n,1),t()}},n)),(0,c.jsx)(wf,{label:"+ Add Desktop Link",onClick:()=>{o("desktopLinks").push({title:"",href:""}),t()}})]})]})}),Hf=(0,u.observer)(({data:e,onChange:t,markDirty:n})=>{const r=e.header||{};return(0,c.jsx)(R,{title:"Header",subtitle:"Header layout and navigation settings",children:(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(z,{label:"Header Type",helper:"Select the type of header to use",children:(0,c.jsx)("select",{className:"hippo-input",value:r.headerType??"MEDIUM",onChange:e=>t("header","headerType",e.target.value),children:Object.values(Kh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),r.headerType===Kh.BASIC&&(0,c.jsx)(Ef,{data:e,markDirty:n}),r.headerType===Kh.MEDIUM&&(0,c.jsx)(Pf,{data:e,markDirty:n}),r.headerType===Kh.MEGA&&(0,c.jsx)(Ff,{data:e,markDirty:n}),r.headerType===Kh.DMP&&(0,c.jsx)($f,{data:e,markDirty:n}),(r.headerType===Kh.LINKLESS||r.headerType===Kh.NONE)&&(0,c.jsx)("div",{className:"rounded-xl border border-dashed border-[var(--border-glass)] p-5 text-center",children:(0,c.jsxs)("p",{className:"text-sm text-[var(--text-muted)]",children:["No additional configuration needed for the ",r.headerType," header type."]})})]})})}),Vf=(0,u.observer)(({data:e,onChange:t})=>{const n=e.footer||{};return(0,c.jsx)(R,{title:"Footer",subtitle:"Footer layout and content settings",children:(0,c.jsx)(z,{label:"Footer Type",helper:"Choose the footer layout style for the website",children:(0,c.jsx)("select",{className:"hippo-input",value:n.footerType??"BASIC",onChange:e=>t("footer","footerType",e.target.value),children:Object.values(Xh).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})})}),Uf=[{key:"productGridHideRestricted",label:"Hide Restricted Products",helper:"Hide restricted products from the product grid based on the user's selected country"},{key:"subscriptionAddOnsEnabled",label:"Subscription Add-Ons",helper:"Enable subscription add-ons for the brand"},{key:"shippingThresholdNotificationEnabled",label:"Shipping Threshold Notification",helper:"Enable shipping threshold notifications"},{key:"bundlingEnabled",label:"Bundling Experience",helper:"Enable the bundling experience"},{key:"cartDrawerEnabled",label:"Cart Drawer",helper:"Enable the cart drawer experience"},{key:"useDefaultFrequencies",label:"Use Default Frequencies",helper:"Calculate selected frequency based on product and quantity"}],_f=(0,u.observer)(({data:e,onChange:t,markDirty:n,api:r})=>{const o=e.features||{},[i,s]=(0,p.useState)([]),[a,l]=(0,p.useState)(!0);return(0,p.useEffect)(()=>{r.getModelEntries("product-grid-filter-group").then(e=>s(e)).catch(e=>console.error("[Hippo Commerce] Failed to fetch filter group entries:",e)).finally(()=>l(!1))},[r]),(0,c.jsx)(R,{title:"Features",subtitle:"Enable or disable site-wide features and behaviors",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Product Grid Filter Type",helper:"'Dropdown' displays a drop down of categories, ingredients, use cases, and tags. 'Stacked List' allows custom filter groupings.",children:(0,c.jsx)("select",{className:"hippo-input",value:o.productGridFilterType??"Dropdown",onChange:e=>t("features","productGridFilterType",e.target.value),children:Object.values(ef).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})}),(0,c.jsx)(z,{label:"Product Link Prefix",helper:"Prefix before product slugs. e.g. /p/product-slug or /product/product-slug",children:(0,c.jsx)("select",{className:"hippo-input",value:o.productLinkPrefix??"/p",onChange:e=>t("features","productLinkPrefix",e.target.value),children:Object.values(tf).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})]}),(0,c.jsx)(z,{label:"Subscription Experience",helper:"Select the subscription management experience for customers",children:(0,c.jsxs)("select",{className:"hippo-input",value:o.subscriptionExperience??"Classic",onChange:e=>t("features","subscriptionExperience",e.target.value),children:[(0,c.jsx)("option",{value:"Classic",children:"Classic"}),(0,c.jsx)("option",{value:"Version 2",children:"Version 2"})]})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Feature Toggles"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)("div",{className:"space-y-0 rounded-xl border border-[var(--border-glass)] overflow-hidden",children:Uf.map(({key:e,label:n,helper:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 px-4 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:n}),(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:r})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:!!o[e],onChange:n=>t("features",e,n.target.checked)})]},e))}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Product Grid Filter Groups"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),a?(0,c.jsx)("p",{className:"text-sm text-[var(--text-muted)]",children:"Loading..."}):(0,c.jsxs)("div",{className:"space-y-4",children:[(o.productGridFilterGroups??[]).map((t,r)=>{const o=t.filterConfig?.value?.id??t.filterConfig?.id??"";return(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsx)(z,{label:"Filter Group",children:(0,c.jsxs)("select",{className:"hippo-input",value:o,onChange:t=>{const o=i.find(e=>e.id===t.target.value);e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups[r].filterConfig=o?{"@type":"@builder.io/core:Reference",model:"product-grid-filter-group",id:o.id}:void 0,n()},children:[(0,c.jsx)("option",{value:"",children:"Select a filter group..."}),i.map(e=>(0,c.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups.splice(r,1),n()},children:"Remove"})})]},r)}),(0,c.jsx)("button",{type:"button",className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.features||(e.features={}),e.features.productGridFilterGroups||(e.features.productGridFilterGroups=[]),e.features.productGridFilterGroups.push({filterConfig:void 0}),n()},children:"Add Filter Group"})]})]})})}),Wf=(0,u.observer)(({data:e,onChange:t,markDirty:n})=>{const r=e.support||{},o=r.address||{},i=(t,r)=>{e.support||(e.support={}),e.support.address||(e.support.address={}),e.support.address[t]=r,n()};return(0,c.jsx)(R,{title:"Support Information",subtitle:"Contact information displayed to customers on the website",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Support Email",helper:"Email address for customer support inquiries",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.email??"",onChange:e=>t("support","email",e.target.value)})}),(0,c.jsx)(z,{label:"Support Phone Number",helper:"Phone number for customer support inquiries",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.phone??"",onChange:e=>t("support","phone",e.target.value)})})]}),(0,c.jsx)(z,{label:"Support Phone Display",helper:"Formatted phone number for display",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.phoneDisplay??"",onChange:e=>t("support","phoneDisplay",e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-7",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Address"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)(z,{label:"Street",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.street??"",onChange:e=>i("street",e.target.value)})}),(0,c.jsx)(z,{label:"City",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.city??"",onChange:e=>i("city",e.target.value)})}),(0,c.jsx)(z,{label:"State Code",helper:"e.g. CA",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.state??"",onChange:e=>i("state",e.target.value)})}),(0,c.jsx)(z,{label:"Zip Code",required:!0,children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:o.zipcode??"",onChange:e=>i("zipcode",e.target.value)})})]}),(0,c.jsx)(z,{label:"Full Address String",helper:"The full support address as a single formatted string",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:r.addressString??"",onChange:e=>t("support","addressString",e.target.value)})})]})})}),Gf=({open:e})=>(0,c.jsx)("svg",{className:"w-4 h-4 text-[var(--text-muted)] transition-transform "+(e?"rotate-180":""),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,c.jsx)("path",{d:"M6 9l6 6 6-6"})}),Kf=({label:e,helper:t,checked:n,onChange:r})=>(0,c.jsxs)("div",{className:"flex items-center justify-between py-3.5 border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e}),t&&(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] mt-0.5",children:t})]}),(0,c.jsx)("input",{type:"checkbox",className:"hippo-toggle",checked:n,onChange:e=>r(e.target.checked)})]}),Jf=({label:e,value:t,fallback:n,onChange:r})=>(0,c.jsx)(z,{label:e,children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:t||n,onChange:e=>r(e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:t,onChange:e=>r(e.target.value)})]})}),Yf=(0,u.observer)(({data:e,markDirty:t})=>{const[n,r]=(0,p.useState)(new Set),o=e.pageConfig||{},i=e=>{r(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},s=(n,r)=>{e.pageConfig||(e.pageConfig={});let o=e.pageConfig;for(let e=0;e<n.length-1;e++)o[n[e]]||(o[n[e]]={}),o=o[n[e]];o[n[n.length-1]]=r,t()},a=o.accountDetails||{},l=o.cart||{},d=o.checkout||{},u=o.orderDetails||{},h=o.resetPassword||{},f=o.subscriptionEdit||{},m=o.upsell||{};return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("cart"),children:[(0,c.jsx)("span",{children:"Cart Page"}),(0,c.jsx)(Gf,{open:n.has("cart")})]}),n.has("cart")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Continue Shopping URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:l.continueShoppingUrl??"",onChange:e=>s(["cart","continueShoppingUrl"],e.target.value)})}),(0,c.jsx)(Kf,{label:"Group Cart Contents by Purchase Type",helper:"Group cart contents by subscription and one-time purchases",checked:!!l?.groupCartContentsByPurchaseType,onChange:e=>s(["cart","groupCartContentsByPurchaseType"],e)}),(0,c.jsx)(Kf,{label:"Enable Cart Frequency Toggle",helper:"Show a frequency toggle on the cart page and in the cart drawer",checked:!!l?.enabledCartFrequencyToggle,onChange:e=>s(["cart","enabledCartFrequencyToggle"],e)}),(0,c.jsx)(Jf,{label:"Image Container Background Color",value:l.imageContainerBGColor??"",fallback:"#ffffff",onChange:e=>s(["cart","imageContainerBGColor"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Free Shipping Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Free Shipping Banner",checked:!!l.freeShippingBanner?.isVisible,onChange:e=>s(["cart","freeShippingBanner","isVisible"],e)}),(0,c.jsx)(z,{label:"Logged Out Banner Content",children:(0,c.jsx)($h,{value:l.freeShippingBanner?.loggedOutBannerContent??"",onChange:e=>s(["cart","freeShippingBanner","loggedOutBannerContent"],e)})}),(0,c.jsx)(z,{label:"Logged In Banner Content",children:(0,c.jsx)($h,{value:l.freeShippingBanner?.loggedInBannerContent??"",onChange:e=>s(["cart","freeShippingBanner","loggedInBannerContent"],e)})}),(0,c.jsx)(Jf,{label:"Banner Background Color",value:l.freeShippingBanner?.styles?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["cart","freeShippingBanner","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Banner Text Color",value:l.freeShippingBanner?.styles?.color??"",fallback:"#ffffff",onChange:e=>s(["cart","freeShippingBanner","styles","color"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Secure Payment Notice"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Secure Payment Notice",checked:!!l.notices?.securePaymentNotice?.isVisible,onChange:e=>s(["cart","notices","securePaymentNotice","isVisible"],e)}),(0,c.jsx)(z,{label:"Secure Payment Notice Content",children:(0,c.jsx)($h,{value:l.notices?.securePaymentNotice?.text??"",onChange:e=>s(["cart","notices","securePaymentNotice","text"],e)})}),(0,c.jsx)(Jf,{label:"Notice Background Color",value:l.notices?.securePaymentNotice?.styles?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["cart","notices","securePaymentNotice","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Notice Text Color",value:l.notices?.securePaymentNotice?.styles?.color??"",fallback:"#ffffff",onChange:e=>s(["cart","notices","securePaymentNotice","styles","color"],e)})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("checkout"),children:[(0,c.jsx)("span",{children:"Checkout Page"}),(0,c.jsx)(Gf,{open:n.has("checkout")})]}),n.has("checkout")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Free Shipping Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Free Shipping Banner",checked:!!d.freeShippingBanner?.isVisible,onChange:e=>s(["checkout","freeShippingBanner","isVisible"],e)}),(0,c.jsx)(z,{label:"Logged Out Banner Content",children:(0,c.jsx)($h,{value:d.freeShippingBanner?.loggedOutBannerContent??"",onChange:e=>s(["checkout","freeShippingBanner","loggedOutBannerContent"],e)})}),(0,c.jsx)(z,{label:"Logged In Banner Content",children:(0,c.jsx)($h,{value:d.freeShippingBanner?.loggedInBannerContent??"",onChange:e=>s(["checkout","freeShippingBanner","loggedInBannerContent"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Secure Payment Notice"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Secure Payment Notice",checked:!!d.securePaymentNotice?.isVisible,onChange:e=>s(["checkout","securePaymentNotice","isVisible"],e)}),(0,c.jsx)(z,{label:"Secure Payment Notice Content",children:(0,c.jsx)($h,{value:d.securePaymentNotice?.content??"",onChange:e=>s(["checkout","securePaymentNotice","content"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Auto Sign-Up"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show Auto Sign-Up",checked:!!d.autoSignUp?.isVisible,onChange:e=>s(["checkout","autoSignUp","isVisible"],e)}),(0,c.jsx)(Kf,{label:"Auto Sign-Up Checked by Default",checked:!!d.autoSignUp?.isChecked,onChange:e=>s(["checkout","autoSignUp","isChecked"],e)}),(0,c.jsx)(z,{label:"Auto Sign-Up Checkbox Label",children:(0,c.jsx)($h,{value:d.autoSignUp?.labelText??"",onChange:e=>s(["checkout","autoSignUp","labelText"],e)})}),(0,c.jsx)(z,{label:"Help Modal Header",children:(0,c.jsx)($h,{value:d.autoSignUp?.helpModal?.header??"",onChange:e=>s(["checkout","autoSignUp","helpModal","header"],e)})}),(0,c.jsx)(z,{label:"Help Modal Content",children:(0,c.jsx)($h,{value:d.autoSignUp?.helpModal?.content??"",onChange:e=>s(["checkout","autoSignUp","helpModal","content"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"SMS Opt-In"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Kf,{label:"Show SMS Opt-In",checked:!!d.smsOptIn?.isVisible,onChange:e=>s(["checkout","smsOptIn","isVisible"],e)}),(0,c.jsx)(z,{label:"SMS Opt-In Title",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:d.smsOptIn?.title??"",onChange:e=>s(["checkout","smsOptIn","title"],e.target.value)})}),(0,c.jsx)(z,{label:"SMS Opt-In CTA Content",children:(0,c.jsx)($h,{value:d.smsOptIn?.content??"",onChange:e=>s(["checkout","smsOptIn","content"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("orderDetails"),children:[(0,c.jsx)("span",{children:"Order Details Page"}),(0,c.jsx)(Gf,{open:n.has("orderDetails")})]}),n.has("orderDetails")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Title (HTML)",children:(0,c.jsx)($h,{value:u.title??"",onChange:e=>s(["orderDetails","title"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Table Header Style"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Jf,{label:"Table Header Background Color",value:u.tableHeaderStyle?.backgroundColor??"",fallback:"#000000",onChange:e=>s(["orderDetails","tableHeaderStyle","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Table Header Text Color",value:u.tableHeaderStyle?.color??"",fallback:"#ffffff",onChange:e=>s(["orderDetails","tableHeaderStyle","color"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Table Content Style"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(Jf,{label:"Table Content Background Color",value:u.tableContentStyle?.backgroundColor??"",fallback:"#ffffff",onChange:e=>s(["orderDetails","tableContentStyle","backgroundColor"],e)}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Buy It Again Button"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Buy It Again Button Text",children:(0,c.jsx)($h,{value:u.buyItAgainButton?.text??"",onChange:e=>s(["orderDetails","buyItAgainButton","text"],e)})}),(0,c.jsx)(z,{label:"CSS Classes",helper:"CSS classes to apply to the button",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:u.buyItAgainButton?.classes??"",onChange:e=>s(["orderDetails","buyItAgainButton","classes"],e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Re-Order All Button"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Re-Order All Button Text",children:(0,c.jsx)($h,{value:u.reOrderAllButton?.text??"",onChange:e=>s(["orderDetails","reOrderAllButton","text"],e)})}),(0,c.jsx)(z,{label:"CSS Classes",helper:"CSS classes to apply to the button",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:u.reOrderAllButton?.classes??"",onChange:e=>s(["orderDetails","reOrderAllButton","classes"],e.target.value)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("resetPassword"),children:[(0,c.jsx)("span",{children:"Reset Password Page"}),(0,c.jsx)(Gf,{open:n.has("resetPassword")})]}),n.has("resetPassword")&&(0,c.jsx)("div",{className:"p-5 pt-0 space-y-5",children:(0,c.jsx)(z,{label:"Page Title (HTML)",children:(0,c.jsx)($h,{value:h.title??"",onChange:e=>s(["resetPassword","title"],e)})})})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("subscriptionCancel"),children:[(0,c.jsx)("span",{children:"Subscription Cancellation Page"}),(0,c.jsx)(Gf,{open:n.has("subscriptionCancel")})]}),n.has("subscriptionCancel")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Cancel Text (HTML)",helper:"Text displayed on the subscription cancellation page",children:(0,c.jsx)($h,{value:o.subscriptionCancel?.cancelText??"",onChange:e=>s(["subscriptionCancel","cancelText"],e)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Cancel Reasons"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(o.subscriptionCancel?.cancelReasons??[]).map((n,r)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:["Reason ",r+1,n.title?`: ${n.title}`:""]}),(0,c.jsx)("button",{className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons.splice(r,1),t())},children:"Remove"})]}),(0,c.jsx)(z,{label:"Reason",helper:"Required",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.title??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].title=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Display Content",children:(0,c.jsx)($h,{value:n.text??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].text=n,t())}})}),(0,c.jsx)(z,{label:"Identifier",helper:"System identifier for analytics tracking",children:(0,c.jsxs)("select",{className:"hippo-input",value:n.identifier??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].identifier=n.target.value,t())},children:[(0,c.jsx)("option",{value:"",children:"Select an identifier..."}),Object.values(rf).map(e=>(0,c.jsx)("option",{value:e,children:e},e))]})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-3",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Buttons"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(n.buttons??[]).map((n,o)=>(0,c.jsxs)("div",{className:"rounded-lg border border-[var(--border-glass)] p-4 space-y-3 ml-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:["Button ",o+1]}),(0,c.jsx)("button",{className:"px-2 py-1 rounded text-[11px] font-medium text-[var(--error)] cursor-pointer hover:bg-[var(--error)]/10 transition-colors",onClick:()=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons.splice(o,1),t())},children:"Remove"})]}),(0,c.jsx)(z,{label:"Button Text",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.text??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].text=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Button Link",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:n.link??"",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].link=n.target.value,t())}})}),(0,c.jsx)(z,{label:"Button Type",helper:"Determines button behavior",children:(0,c.jsx)("select",{className:"hippo-input",value:n.type??"link",onChange:n=>{e.pageConfig?.subscriptionCancel?.cancelReasons?.[r]?.buttons&&(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons[o].type=n.target.value,t())},children:Object.values(of).map(e=>(0,c.jsx)("option",{value:e,children:e},e))})})]},o)),(0,c.jsx)("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.pageConfig||(e.pageConfig={}),e.pageConfig.subscriptionCancel||(e.pageConfig.subscriptionCancel={}),e.pageConfig.subscriptionCancel.cancelReasons||(e.pageConfig.subscriptionCancel.cancelReasons=[]),e.pageConfig.subscriptionCancel.cancelReasons[r].buttons||(e.pageConfig.subscriptionCancel.cancelReasons[r].buttons=[]),e.pageConfig.subscriptionCancel.cancelReasons[r].buttons.push({text:"",link:"",type:"link"}),t()},children:"+ Add Button"})]},r)),(0,c.jsx)("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>{e.pageConfig||(e.pageConfig={}),e.pageConfig.subscriptionCancel||(e.pageConfig.subscriptionCancel={}),e.pageConfig.subscriptionCancel.cancelReasons||(e.pageConfig.subscriptionCancel.cancelReasons=[]),e.pageConfig.subscriptionCancel.cancelReasons.push({title:"",text:"",identifier:"",buttons:[]}),t()},children:"+ Add Reason"})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("subscriptionEdit"),children:[(0,c.jsx)("span",{children:"Subscription Edit"}),(0,c.jsx)(Gf,{open:n.has("subscriptionEdit")})]}),n.has("subscriptionEdit")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Subscription Item Default Image",helper:"Default image for subscription items",children:(0,c.jsxs)("div",{className:"flex items-center gap-3",children:["string"==typeof f.subscriptionItemDefaultImage&&f.subscriptionItemDefaultImage&&(0,c.jsx)("img",{src:f.subscriptionItemDefaultImage,alt:"Default subscription item",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Image URL",value:f.subscriptionItemDefaultImage??"",onChange:e=>s(["subscriptionEdit","subscriptionItemDefaultImage"],e.target.value)})]})}),(0,c.jsx)(z,{label:"Ship Now Modal Headline (HTML)",children:(0,c.jsx)($h,{value:f.shipNow?.modalHeadlineContent??"",onChange:e=>s(["subscriptionEdit","shipNow","modalHeadlineContent"],e)})}),(0,c.jsx)(z,{label:"Ship Now Modal Content (HTML)",helper:"Use $FREQUENCY for the subscription frequency",children:(0,c.jsx)($h,{value:f.shipNow?.modalContent??"",onChange:e=>s(["subscriptionEdit","shipNow","modalContent"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("upsell"),children:[(0,c.jsx)("span",{children:"Upsell Page"}),(0,c.jsx)(Gf,{open:n.has("upsell")})]}),n.has("upsell")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsx)(z,{label:"Money Back Guarantee Image",children:(0,c.jsxs)("div",{className:"flex items-center gap-3",children:["string"==typeof m.mbgImage&&m.mbgImage&&(0,c.jsx)("img",{src:m.mbgImage,alt:"MBG",className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",placeholder:"Image URL",value:m.mbgImage??"",onChange:e=>s(["upsell","mbgImage"],e.target.value)})]})}),(0,c.jsx)(z,{label:"Money Back Guarantee Text (HTML)",children:(0,c.jsx)($h,{value:m.mbgText??"",onChange:e=>s(["upsell","mbgText"],e)})})]})]}),(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] overflow-hidden mb-2",children:[(0,c.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left font-medium text-[var(--text-primary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors",onClick:()=>i("accountDetails"),children:[(0,c.jsx)("span",{children:"Account Details Page"}),(0,c.jsx)(Gf,{open:n.has("accountDetails")})]}),n.has("accountDetails")&&(0,c.jsxs)("div",{className:"p-5 pt-0 space-y-5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Birthday Banner"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Banner Content",children:(0,c.jsx)($h,{value:a.birthdayBannerConfig?.content??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","content"],e)})}),(0,c.jsx)(z,{label:"Link Text",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.linkText??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","linkText"],e.target.value)})}),(0,c.jsx)(z,{label:"Link URL",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",placeholder:"https://...",value:a.birthdayBannerConfig?.linkUrl??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","linkUrl"],e.target.value)})}),(0,c.jsxs)("div",{className:"flex items-center gap-3 my-5",children:[(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"}),(0,c.jsx)("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-muted)]",children:"Banner Styles"}),(0,c.jsx)("div",{className:"flex-1 h-px bg-[var(--border-glass)]"})]}),(0,c.jsx)(z,{label:"Display",helper:"CSS display value (e.g. flex, block)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.display??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","display"],e.target.value)})}),(0,c.jsx)(z,{label:"Align Items",helper:"CSS align-items value (e.g. center, flex-start)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.alignItems??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","alignItems"],e.target.value)})}),(0,c.jsx)(z,{label:"Margin",helper:"CSS margin value (e.g. 10px, 0 auto)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.margin??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","margin"],e.target.value)})}),(0,c.jsx)(z,{label:"Padding",helper:"CSS padding value (e.g. 16px, 10px 20px)",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:a.birthdayBannerConfig?.styles?.padding??"",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","padding"],e.target.value)})}),(0,c.jsx)(Jf,{label:"Background Color",value:a.birthdayBannerConfig?.styles?.backgroundColor??"",fallback:"#ffffff",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","backgroundColor"],e)}),(0,c.jsx)(Jf,{label:"Text Color",value:a.birthdayBannerConfig?.styles?.color??"",fallback:"#000000",onChange:e=>s(["accountDetails","birthdayBannerConfig","styles","color"],e)})]})]})]})}),Qf=Yf,Zf=(0,u.observer)(({data:e,markDirty:t})=>{const n=(e.cookieConfig||{}).popupBanner||{},r=(n,r,o)=>{e.cookieConfig||(e.cookieConfig={}),e.cookieConfig.popupBanner||(e.cookieConfig.popupBanner={}),e.cookieConfig.popupBanner[n]||(e.cookieConfig.popupBanner[n]={}),e.cookieConfig.popupBanner[n][r]=o,t()};return(0,c.jsx)(R,{title:"Cookie Configuration",subtitle:"Settings for the cookie consent popup displayed to visitors",children:(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(z,{label:"Popup Content",children:(0,c.jsx)($h,{value:n.content??"",onChange:n=>{return r=n,e.cookieConfig||(e.cookieConfig={}),e.cookieConfig.popupBanner||(e.cookieConfig.popupBanner={}),e.cookieConfig.popupBanner.content=r,void t();var r}})}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("h4",{className:"text-sm font-semibold text-[var(--text-secondary)]",children:"Banner Styles"}),(0,c.jsx)(z,{label:"Background Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.bannerStyles?.backgroundColor??"#000000",onChange:e=>r("bannerStyles","backgroundColor",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.bannerStyles?.backgroundColor??"",onChange:e=>r("bannerStyles","backgroundColor",e.target.value)})]})}),(0,c.jsx)(z,{label:"Border Radius",children:(0,c.jsx)("input",{type:"text",className:"hippo-input",value:n.bannerStyles?.borderRadius??"",onChange:e=>r("bannerStyles","borderRadius",e.target.value)})})]}),(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)("h4",{className:"text-sm font-semibold text-[var(--text-secondary)]",children:"Button Styles"}),(0,c.jsx)(z,{label:"Background Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.buttonStyles?.backgroundColor??"#000000",onChange:e=>r("buttonStyles","backgroundColor",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.buttonStyles?.backgroundColor??"",onChange:e=>r("buttonStyles","backgroundColor",e.target.value)})]})}),(0,c.jsx)(z,{label:"Text Color",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("input",{type:"color",value:n.buttonStyles?.color??"#ffffff",onChange:e=>r("buttonStyles","color",e.target.value),className:"w-9 h-9 rounded-lg border border-[var(--border-glass)] cursor-pointer shrink-0"}),(0,c.jsx)("input",{type:"text",className:"hippo-input text-xs flex-1",value:n.buttonStyles?.color??"",onChange:e=>r("buttonStyles","color",e.target.value)})]})})]})]})]})})}),Xf=(0,u.observer)(({data:e,onChange:t})=>{const n=e.seo||{};return(0,c.jsx)(R,{title:"SEO",subtitle:"Search engine optimization settings for the brand",children:(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(z,{label:"Site Description",helper:"Default meta description for the website, used when pages do not provide their own",children:(0,c.jsx)("textarea",{className:"hippo-input",rows:3,value:n.description??"",onChange:e=>t("seo","description",e.target.value)})}),(0,c.jsx)(z,{label:"Topics",helper:"Topics the brand is knowledgeable about, used in structured data for search engines",children:(0,c.jsx)(Hh,{value:Array.isArray(n.knowsAbout)?n.knowsAbout:[],onChange:e=>t("seo","knowsAbout",e)})})]})})}),em=["General","Header","Footer","Features","Support","Pages","Cookies","SEO"],tm=({context:e})=>{const t=(0,u.useLocalStore)(()=>({config:null,data:{},loading:!0,saving:!1,error:null,dirty:!1,activeTab:"General"})),n=p.default.useMemo(()=>new Vh(e),[e]),r=g.getUserDetails(e).brand,o=(0,p.useCallback)(async()=>{t.loading=!0,t.error=null;try{const e=await n.getBrandConfig();e.length>0&&(t.config=e[0],t.data={...e[0].data||{}})}catch(e){console.error("[Hippo Commerce] Error loading brand config",e),t.error=e.message??"Failed to load brand configuration."}finally{t.loading=!1}},[n,t]),i=(0,p.useCallback)(async()=>{t.loading=!0;try{await n.createBrandConfig(`${r||"Brand"} Configuration`),await o()}catch(e){console.error("[Hippo Commerce] Error creating brand config",e),t.error=e.message??"Failed to create brand configuration.",t.loading=!1}},[n,r,o,t]),s=(0,p.useCallback)(async()=>{if(t.config?.id&&t.dirty){t.saving=!0;try{const r=JSON.parse(JSON.stringify(t.data));await n.saveBrandConfig(t.config.id,r),t.dirty=!1,await e.dialogs.alert("Brand configuration saved.","Success")}catch(t){console.error("[Hippo Commerce] Error saving brand config",t),await e.dialogs.alert(`Save failed: ${t.message}`,"Error")}finally{t.saving=!1}}},[n,e,t]),a=(0,p.useCallback)(()=>{t.dirty=!0},[t]),l=(0,p.useCallback)((e,n,r)=>{t.data[e]||(t.data[e]={}),t.data[e][n]=r,t.dirty=!0},[t]),d=(0,p.useCallback)((e,n)=>{t.data[e]=n,t.dirty=!0},[t]);return(0,p.useEffect)(()=>{o()},[]),(0,u.useObserver)(()=>t.loading?(0,c.jsx)(I,{message:"Loading brand configuration...",size:"lg"}):t.error&&!t.config?(0,c.jsxs)("div",{className:"text-center py-16",children:[(0,c.jsx)("p",{className:"text-[var(--error)] mb-4",children:t.error}),(0,c.jsx)("button",{className:"px-4 py-2 rounded-lg bg-[var(--error)]/15 text-[var(--error)] font-medium text-sm cursor-pointer hover:bg-[var(--error)]/25 transition-colors",onClick:()=>o(),children:"Retry"})]}):t.config?(0,c.jsxs)("div",{children:[(0,c.jsx)(P,{title:"Brand Configuration",actions:(0,c.jsx)("button",{className:"px-5 py-2 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:hover:shadow-none",disabled:!t.dirty||t.saving,onClick:s,children:t.saving?"Saving...":"Save"})}),(0,c.jsx)("div",{className:"flex gap-0.5 p-1 bg-[var(--bg-glass)] border border-[var(--border-glass)] rounded-xl mb-7 overflow-x-auto",children:em.map(e=>(0,c.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium whitespace-nowrap cursor-pointer transition-all "+(t.activeTab===e?"text-[var(--accent)] bg-[var(--accent-subtle)] font-semibold":"text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-glass-hover)]"),onClick:()=>t.activeTab=e,children:e},e))}),(()=>{const e={data:t.data,onChange:l,onChangeRoot:d,markDirty:a,api:n};switch(t.activeTab){case"General":return(0,c.jsx)(Gh,{...e});case"Header":return(0,c.jsx)(Hf,{...e});case"Footer":return(0,c.jsx)(Vf,{...e});case"Features":return(0,c.jsx)(_f,{...e});case"Support":return(0,c.jsx)(Wf,{...e});case"Pages":return(0,c.jsx)(Qf,{...e});case"Cookies":return(0,c.jsx)(Zf,{...e});case"SEO":return(0,c.jsx)(Xf,{...e});default:return null}})()]}):(0,c.jsx)(B,{message:"No brand configuration found. Create one to get started.",action:{label:"Create Brand Configuration",onClick:i}}))},nm=p.default.memo(e=>{const{context:t}=e;return(0,c.jsx)(E,{context:t,children:(0,c.jsx)(tm,{context:t})})});nm.displayName="HippoCMSBrandConfiguration";const rm=nm;let om=null;function im(){return om?.(h)}const sm=new class{ingredientsModel={name:"product-ingredient",displayName:"Product Ingredient",kind:"data",helperText:"Ingredients used in products",contentTitleField:"name",fields:[{"@type":"@builder.io/core:Field",name:"name",friendlyName:"Ingredient",type:"text",required:!0,defaultCollapsed:!0,helperText:"The display name of this ingredient as it appears on the website",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"description",friendlyName:"Description",type:"longText",required:!1,defaultCollapsed:!0,helperText:"A detailed description of this ingredient, shown on product detail pages",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"image",friendlyName:"Image",type:"file",showTemplatePicker:!0,defaultCollapsed:!0,helperText:"An image representing this ingredient, used in ingredient spotlights and carousels",allowedFileTypes:["jpeg","png","svg","webp"]},{"@type":"@builder.io/core:Field",name:"shortDescription",friendlyName:"Short Description",type:"longText",required:!1,defaultCollapsed:!0,helperText:"A brief summary of this ingredient, used in compact displays like product cards",localized:!0,defaultValue:{"@type":"@builder.io/core:LocalizedValue"}},{"@type":"@builder.io/core:Field",name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1}]};categoryModel={name:"product-category",kind:"data",displayName:"Product Category",helperText:"Categories for products",contentTitleField:"name",fields:[{name:"name",friendlyName:"Category",type:"text",required:!0,defaultCollapsed:!0,localized:!0,helperText:"The name of this category as it appears on the website"},{name:"description",friendlyName:"Description",type:"longText",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A description of this category, used in components that display category details"},{name:"desktopImage",friendlyName:"Desktop Image",type:"file",defaultCollapsed:!0,showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"Image displayed for this category on desktop screens"},{name:"mobileImage",defaultCollapsed:!0,friendlyName:"Mobile Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"Image displayed for this category on mobile screens"},{name:"hidden",friendlyName:"Hide Category",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this category will not be displayed in product grids or search results for this locale"},{name:"slug",friendlyName:"Page Slug",type:"text",defaultCollapsed:!0,helperText:'If this category has a specific web page, provide the path here without a leading slash (e.g. "shop/supplements") for use in breadcrumb navigation. By default, the path "shop" will be used.',required:!1,localized:!1},{name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1}]};productTagModel={name:"product-tag",kind:"data",displayName:"Product Tag",helperText:"Provides a link between products across categories.",contentTitleField:"name",fields:[{name:"name",friendlyName:"Tag",type:"text",required:!0,defaultCollapsed:!0,localized:!0,makeEntryTitle:!0,helperText:'The display name of this tag (e.g. "Favorites", "New", "Best Seller")'},{name:"tagColor",friendlyName:"Color",type:"color",required:!0,defaultCollapsed:!0,localized:!1,defaultValue:"gba(255, 233, 214, 1)",helperText:"The background color shown behind the tag label on product cards"},{name:"hidden",friendlyName:"Hide Tag",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this tag will not be displayed in product grids or search results for this locale"},{name:"image",friendlyName:"Tag Image",type:"file",allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"For product grids that support tag images, you may provide the image here."},{name:"pluralDisplayName",friendlyName:"Plural Display Name",defaultCollapsed:!0,type:"text",helperText:'This is used when grouping/filtering. Allows us to display "Favorites" instead of "Fave", for example.',required:!1,localized:!0}]};useCaseModel={name:"product-use-case",kind:"data",displayName:"Product Use Case",helperText:"Provides a link between products used for the same goal.",contentTitleField:"name",fields:[{name:"name",defaultCollapsed:!0,helperText:'The display name of this use case (e.g. "Joint Support", "Weight Management")',friendlyName:"Use Case",type:"text",required:!0,localized:!0},{name:"description",friendlyName:"Description",type:"longText",defaultCollapsed:!0,required:!1,localized:!0,helperText:"A detailed description of this use case, shown when users browse by goal"},{name:"searchKeys",friendlyName:"Search Keys",type:"Tags",defaultCollapsed:!0,helperText:'Used when building links (e.g. "products?category=[Search Key]")',required:!1,localized:!1},{name:"image",friendlyName:"Image",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"An image representing this use case, used in grids and carousels"},{name:"hidden",friendlyName:"Hide Use Case",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this use case will not be displayed in product grids or search results for this locale"}]};profileReferenceRuleModel=(()=>({name:"profile-reference-rule",displayName:"Profile Reference Rule",kind:"data",helperText:"Apply profile-based personalization by associating tags, ingredients, etc. to profile properties.",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Rule Name",type:"text",required:!0,defaultCollapsed:!1,localized:!0,helperText:"The name of this profile reference rule."},{name:"applicationType",friendlyName:"Application Type",type:"select",required:!0,defaultCollapsed:!1,enum:[pf.Exclusive,pf.Preferred,pf.Required],defaultValue:pf.Preferred,helperText:"How this rule is applied relative to other rules."},{name:"referenceType",friendlyName:"Reference Type",type:"select",required:!0,defaultCollapsed:!1,enum:[cf.Tag,cf.Ingredient,cf.Category,cf.UseCase],helperText:"The type of content reference to apply when this rule is triggered.",defaultValue:cf.Tag},{name:"tagReference",friendlyName:"Tag",type:"reference",required:'return options.get("referenceType") === "Tag"',showIf:'return options.get("referenceType") === "Tag"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-tag"},{name:"ingredientReference",friendlyName:"Ingredient",type:"reference",required:'return options.get("referenceType") === "Ingredient"',showIf:'return options.get("referenceType") === "Ingredient"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-ingredient"},{name:"categoryReference",friendlyName:"Category",type:"reference",required:'return options.get("referenceType") === "Category"',showIf:'return options.get("referenceType") === "Category"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-category"},{name:"useCaseReference",friendlyName:"Use Case",type:"reference",required:'return options.get("referenceType") === "UseCase"',showIf:'return options.get("referenceType") === "UseCase"',defaultCollapsed:!1,helperText:"The content reference to apply when this rule is triggered.",copyOnAdd:!0,model:"product-use-case"},{name:"applicationRules",type:"list",friendlyName:"Application Rules",required:!0,defaultCollapsed:!1,helperText:"The rules that determine when the linked reference should be applied. These rules are evaluated together, so all rules must be satisfied for the reference to be applied.",subFields:[{name:"profileField",friendlyName:"Profile Field",type:"select",required:!0,defaultCollapsed:!1,enum:[df.Age,df.Gender,df.Weight,df.Type,df.Breed,df.HealthConditions],helperText:"The profile field to evaluate for this rule."},{name:"stringOperator",friendlyName:"Operator",type:"select",required:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',showIf:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',defaultCollapsed:!1,enum:["is","is not","contains","does not contain"],helperText:"The operator to use when evaluating the profile field."},{name:"numberOperator",friendlyName:"Operator",type:"select",required:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",showIf:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",defaultCollapsed:!1,enum:["equals","not equals","greater than","less than"],helperText:"The operator to use when evaluating the profile field."},{name:"numberValue",friendlyName:"Value",type:"number",defaultValue:0,required:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",showIf:"return ['Age', 'Weight'].includes(options.get('profileField') ?? '')",defaultCollapsed:!1,helperText:"The numeric value to compare against the profile field."},{name:"stringValue",friendlyName:"Value",type:"text",required:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',showIf:'return ["Gender", "Type", "Breed", "Health Conditions"].includes(options.get(\'profileField\') ?? \'\')',defaultCollapsed:!1,helperText:"The string value to compare against the profile field. Case insensitive."}]}]}))();recommendationConfigModel={name:"recommendation-config",displayName:"Recommendation Config",kind:"data",helperText:"Configuration for how product recommendations are generated.",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,defaultCollapsed:!1,localized:!1,helperText:"The name of this recommendation config.",makeEntryTitle:!0},{name:"recommendations",friendlyName:"Recommendations",type:"list",required:!0,defaultCollapsed:!1,helperText:"Each item defines a single recommendation slot. The number of items determines how many recommendations are generated.",subFields:[{name:"label",friendlyName:"Label",type:"text",required:!1,localized:!0,defaultCollapsed:!1,helperText:"Label for this recommendation slot."},{name:"showResult",friendlyName:"Show Result",type:"boolean",required:!1,defaultValue:!0,defaultCollapsed:!1,helperText:"When true, the result of this recommendation is displayed."},{name:"requiredTags",friendlyName:"Required Tags",type:"list",required:!1,defaultCollapsed:!1,helperText:"Tags that the recommended product must have. Leave empty to allow any tag.",subFields:[{name:"tag",friendlyName:"Tag",type:"reference",model:"product-tag",required:!0,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag the recommendation must have."}]},{name:"excludedTags",friendlyName:"Excluded Tags",type:"list",required:!1,defaultCollapsed:!1,helperText:"Tags that the recommended product must NOT have.",subFields:[{name:"tag",friendlyName:"Tag",type:"reference",model:"product-tag",required:!0,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag the recommendation must not have."}]}]}]};blogCategoryModel={name:"blog-category",displayName:"Blog Category",kind:"data",helperText:"Category for blog categorization",contentTitleField:void 0,fields:[{name:"name",friendlyName:"Name",helperText:"Name of the category",type:"text",defaultCollapsed:!1,localized:!0,required:!0},{name:"description",friendlyName:"Category Description",helperText:"Provide a description of the category. This may be used in components.",type:"html",defaultCollapsed:!1,localized:!0,required:!1},{name:"slug",friendlyName:"Slug",helperText:"Path to use for linking to this category",type:"text",defaultCollapsed:!1,localized:!1,required:!0},{name:"parentId",friendlyName:"Parent Category Id",helperText:"If this category is a child, provide the Id of the parent category",type:"text",required:!1,defaultCollapsed:!0,localized:!1}]};productModel(e){return(e=>({name:"product",displayName:"Product",kind:"data",helperText:"Product Catalog",contentTitleField:"name",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,localized:!0,defaultCollapsed:!0,helperText:"This is the name that will be displayed to the customer"},{name:"featuredImage",friendlyName:"Featured Image",helperText:"Displayed on the product card",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"]},{name:"emojis",friendlyName:"Emojis List",helperText:"Emoji shown on the flavor selector and used for the add-to-cart confetti.",defaultCollapsed:!0,type:"Tags",required:!1},{name:"secondaryImage",friendlyName:"Secondary Image",helperText:"Displayed on the product card hover for some grids",defaultCollapsed:!0,type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"]},{name:"subHeading",defaultCollapsed:!0,friendlyName:"Product Headline",helperText:"Subheading (tagline) for the product, displayed on the product card",type:"text",localized:!0},{name:"gridTagline",defaultCollapsed:!0,friendlyName:"Grid Tagline",helperText:"By default, we use the Product Headline field. Use this to override the tagline when displayed on the product grid.",type:"text",required:!1,localized:!0},{name:"gridDescription",defaultCollapsed:!0,friendlyName:"Grid Description",helperText:"A small description, used on some product grids as an additional sub-heading or tagline.",type:"text",required:!1,localized:!0},{name:"shortDescription",defaultCollapsed:!0,friendlyName:"Short Description",helperText:"Short description of the product, typically displayed on the PDP",type:"html",required:!1,localized:!0},{name:"recommendationBlurb",defaultCollapsed:!0,friendlyName:"Recommendation Blurb",helperText:"Short blurb displayed when this product is surfaced as a recommendation.",type:"text",required:!1,localized:!0},{name:"quote",friendlyName:"Quote",defaultCollapsed:!0,helperText:"A quote provided by the brand guru or spokesperson",type:"html",localized:!0,required:!1},{name:"packagingLabels",friendlyName:"Packaging Labels",defaultCollapsed:!0,type:"object",helperText:"Labels describing the product packaging (e.g. Jar, Bottle, Pouch)",subFields:[{name:"singular",friendlyName:"Singular",defaultCollapsed:!0,type:"text",required:!0,localized:!0,helperText:"Provides the name of the packaging for single product (e.g. Unit, Jar, etc.)"},{name:"plural",defaultCollapsed:!0,friendlyName:"Plural",type:"text",required:!0,localized:!0,helperText:"Provides the name of the packaging for multiple quantities of the product (e.g. Units, Jars, etc.)"}]},{name:"hidden",friendlyName:"Hide Product",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0,helperText:"When true, this product will not be displayed in product grids or search results for this locale"},{name:"outOfStock",friendlyName:"Out of Stock",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Indicates whether this product is currently out of stock. When true, this product is not eligible for purchase."},{name:"cartOutOfStock",friendlyName:"Out of Stock (Site)",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Indicates that this product should be presented as out of stock on the site, even if it is not truly out of stock. This is used as an override for special cases where the product should not be purchasable on the site while remaining purchasable elsewhere."},{name:"upc",defaultCollapsed:!0,friendlyName:"UPC Code",type:"text",required:!1,helperText:"The UPC code of this product"},{name:"reviews",friendlyName:"Review Data",helperText:"Stores review data for this product. These values are automatically generated and should not be modified.",type:"object",defaultCollapsed:!0,subFields:[{name:"id",defaultCollapsed:!0,friendlyName:"Review ID",type:"text",required:!0,localized:!1,helperText:"ID used by the review service to identify this product. Do not modify this value."},{defaultCollapsed:!0,name:"count",friendlyName:"Review Count",type:"number",defaultValue:0,required:!0,localized:!1,helperText:"The number of reviews for this product. This value is automatically updated by the review service."},{name:"averageRating",friendlyName:"Average Rating",type:"number",defaultCollapsed:!0,defaultValue:0,required:!0,localized:!1,helperText:"The average rating for this product. This value is automatically updated by the review service."},{name:"globalFiveStarReviews",type:"number",friendlyName:"Global Five Star Reviews",required:!1,helperText:"",hidden:!1,defaultCollapsed:!0,defaultValue:0}]},{name:"tags",friendlyName:"Tags",type:"list",localized:!0,defaultCollapsed:!0,helperText:'Tags used to cross-reference products and enable filtering (e.g. "New", "Best Seller")',subFields:[{type:"reference",modelId:e.tagModelId,name:"tag",friendlyName:"Tag",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a product tag"}]},{name:"categories",friendlyName:"Categories",type:"list",localized:!0,defaultCollapsed:!0,helperText:"Categories this product belongs to, used for navigation and filtering",subFields:[{type:"reference",modelId:e.categoryModelId,name:"category",friendlyName:"Category",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a product category"}]},{name:"ingredients",friendlyName:"Ingredients",type:"list",localized:!0,defaultCollapsed:!0,helperText:"Key ingredients in this product, displayed on product detail pages",subFields:[{type:"reference",modelId:e.ingredientsModelId,name:"ingredient",friendlyName:"Ingredient",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select an ingredient"}]},{name:"useCases",defaultCollapsed:!0,friendlyName:"Use Cases",type:"list",localized:!0,helperText:"Goals or health benefits this product supports, used for filtering and recommendations",subFields:[{type:"reference",modelId:e.useCaseModelId,name:"useCase",friendlyName:"Use Case",copyOnAdd:!1,defaultCollapsed:!0,helperText:"Select a use case"}]},{name:"featuredIngredients",friendlyName:"Featured Ingredients",type:"object",required:!1,defaultCollapsed:!0,helperText:"Showcases hero ingredients on the product detail page with imagery and descriptions",subFields:[{name:"featuredIngredientsHeading",friendlyName:"Featured Ingredients Heading",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The heading displayed above the featured ingredients list"},{name:"featuredIngredient",friendlyName:"Featured Ingredient",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"featuredIngredientImage",friendlyName:"Featured Ingredient Image",type:"file",required:!1,localized:!0,defaultCollapsed:!0,allowedFileTypes:["jpeg","png","svg","webp","gif"],helperText:"Image representing this featured ingredient"},{name:"featuredIngredientTitle",friendlyName:"Featured Ingredient Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Display name for this featured ingredient"},{name:"featuredIngredientDescription",friendlyName:"Featured Ingredient Description",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Description of this featured ingredient"}]}]},{name:"whatsInside",friendlyName:"What's Inside Accordion Items",type:"object",required:!1,defaultCollapsed:!0,helperText:"Accordion items detailing what's inside the product (ingredients, components, etc.)",subFields:[{name:"whatsInsideItems",friendlyName:"What's Inside Accordion Items",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"title",friendlyName:"Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The title shown in the accordion header"},{name:"description",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The content shown when the accordion is expanded"}]}]},{name:"faqs",friendlyName:"FAQ Accordion Items",type:"object",required:!1,defaultCollapsed:!0,helperText:"Frequently asked questions displayed in an accordion on the product detail page",subFields:[{name:"faqItem",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"faqTitle",friendlyName:"FAQ Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The question shown in the accordion header"},{name:"faqDescription",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"The answer shown when the accordion is expanded"}]}]},{name:"supplementFacts",friendlyName:"Supplement Facts",type:"object",required:!1,defaultCollapsed:!0,helperText:"Supplement facts labels displayed on the product detail page",subFields:[{name:"supplementFactsLabel",friendlyName:"Supplement Facts Label",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,subFields:[{name:"supplementFactsLabelTitle",friendlyName:"Supplement Facts Label Title",type:"text",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Title for this supplement facts label (e.g. flavor or variant name)"},{name:"supplementFactsLabelHtml",friendlyName:"Supplement Facts Label HTML",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"HTML content of the supplement facts label"}]}]},{name:"servingsPerUnit",friendlyName:"Servings Per Unit",type:"number",defaultValue:void 0,required:!1,defaultCollapsed:!0,localized:!1,helperText:"Typical number of servings (or doses, days of supply) per unit. Used to auto-calculate default subscription frequency for funnel offers (servingsPerUnit × quantity). Defaults to 30 if not set."},{name:"name",friendlyName:"Name",type:"text",required:!0,defaultCollapsed:!0,localized:!1,helperText:"Internal name for the product, used for identification in the CMS"},{name:"components",friendlyName:"Bundle Components",type:"list",required:!1,defaultCollapsed:!1,helperText:"The individual products included in this bundle",showIf:"return options.get('gh')?.get(\"type\") === 'Bundle'",subFields:[{name:"slug",friendlyName:"Slug",type:"text",required:!0,defaultCollapsed:!1,helperText:"The unique identifier for this bundle component"},{name:"displayName",friendlyName:"Display Name",type:"text",localized:!0,defaultCollapsed:!1,helperText:"The name shown for this component on the product page"},{name:"description",friendlyName:"Description",type:"html",required:!1,defaultCollapsed:!1,helperText:"Use this to provide a description display beneath this component on the offer selector."}]},{name:"gh",friendlyName:"Golden Hippo Integration Data",helperText:"Stores integration data for Golden Hippo. Do not modify any of these values.",type:"object",subFields:[{name:"slug",friendlyName:"Page Slug",type:"text",required:!0,localized:!1,defaultCollapsed:!0,helperText:"This is the URL slug for this product. This value is unique and required for cross-environment development. Do not modify this value."},{name:"productionId",friendlyName:"Production ID",type:"text",required:!0,localized:!1,defaultCollapsed:!0,helperText:"This is the unique identifier for this product in the production environment. Do not modify this value."},{name:"type",friendlyName:"Product Type",type:"select",required:!0,localized:!1,defaultCollapsed:!0,enum:["Product","Bundle","Trial Size"],defaultValue:"Product",helperText:"Determines how this product is handled — Product, Bundle, or Trial Size"}],defaultCollapsed:!0,localized:!1}]}))(e)}productGroupModel(e,t){return((e,t)=>({name:"product-group",displayName:"Product Group",kind:"data",helperText:"Groups related products together (e.g. flavors, trial sizes).",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name",type:"text",required:!0,defaultCollapsed:!0,localized:!0,helperText:"The display name of this product group."},{name:"featuredImage",friendlyName:"Featured Image",type:"file",defaultCollapsed:!0,showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],helperText:"The primary image of this product group."},{name:"subHeading",friendlyName:"Sub Heading",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short tagline displayed beneath the group name."},{name:"gridTagline",friendlyName:"Grid Tagline",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short tagline displayed on product grid cards."},{name:"shortDescription",friendlyName:"Short Description",type:"html",required:!1,defaultCollapsed:!0,localized:!0,helperText:"A short description of the product group."},{name:"products",friendlyName:"Products",type:"list",defaultCollapsed:!0,helperText:"The products in this group.",subFields:[{name:"product",friendlyName:"Product",type:"reference",defaultCollapsed:!1,modelId:e,copyOnAdd:!1,helperText:"Select a product to include in this group"},{name:"displayName",friendlyName:"Display Name",type:"text",defaultCollapsed:!1,localized:!0,helperText:"Override display name for this product in the group context."},{name:"isTrialSize",friendlyName:"Is Trial Size",type:"boolean",defaultCollapsed:!1,helperText:"Whether this product is a trial size variant."}]},{name:"selectionLabel",friendlyName:"Selection Label",type:"text",required:!1,defaultCollapsed:!0,localized:!0,helperText:'Label for the product selector (e.g. "Choose your flavor").'},{name:"hidden",friendlyName:"Hide Group",type:"boolean",required:!1,defaultCollapsed:!0,localized:!1,helperText:"When true, this product group will not be displayed."},{name:"gh",friendlyName:"Golden Hippo",type:"object",defaultCollapsed:!0,helperText:"Integration data for Golden Hippo. Do not modify these values.",subFields:[{name:"productionId",friendlyName:"Production ID",type:"text",defaultCollapsed:!1,helperText:"The production environment content ID for this product group."},{name:"slug",friendlyName:"Slug",type:"text",defaultCollapsed:!1,helperText:"URL slug for this product group."}]},{name:"groupType",friendlyName:"Group Type",type:"select",defaultCollapsed:!0,enum:[lf.FlavorOptionGroup,lf.TrialGroup],helperText:"The type of product grouping."},{name:"name",friendlyName:"Group Name",type:"text",required:!0,defaultCollapsed:!0,localized:!1,helperText:"The internal name for this product group."},{name:"informationCallout",friendlyName:"Information Callout",type:"reference",required:!1,modelId:t,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Optional content section displayed alongside this product group"}]}))(e,t)}productGridConfigModel(e){return(e=>({name:"product-grid-filter-group",displayName:"Product Grid Filter Group",kind:"data",helperText:"Build filter group configurations. These can be applied in the brand configuration",contentTitleField:"displayName",fields:[{name:"displayName",friendlyName:"Display Name/Label",type:"text",localized:!0,defaultCollapsed:!1,helperText:"Provide a name to display for this grouping",makeEntryTitle:!0},{name:"categories",friendlyName:"Categories",helperText:"Categories for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"category",friendlyName:"Category",type:"reference",modelId:e.categoryId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a category to include in this filter group"}]},{name:"ingredients",friendlyName:"Ingredients",helperText:"Ingredients for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"ingredient",friendlyName:"Ingredient",type:"reference",modelId:e.ingredientId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select an ingredient to include in this filter group"}]},{name:"useCases",friendlyName:"Use Cases",helperText:"Use Cases for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"useCase",friendlyName:"Use Case",type:"reference",modelId:e.useCaseId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a use case to include in this filter group"}],copyOnAdd:!1},{name:"tags",friendlyName:"Tags",helperText:"Tags for this group",type:"list",defaultCollapsed:!0,subFields:[{name:"tag",friendlyName:"Tag",type:"reference",modelId:e.tagId,required:!0,localized:!1,copyOnAdd:!0,defaultCollapsed:!1,helperText:"Select a tag to include in this filter group"}],copyOnAdd:!1},{name:"filterApplicationType",friendlyName:"Filter Application Type",type:"select",enum:[uf.Inclusive,uf.Exclusive],defaultValue:"Inclusive",required:!1,defaultCollapsed:!0,helperText:"Select how this filter is applied in relation to other filters. When set to Exclusive, ALL results must match a selected filter of this group."}]}))(e)}brandConfig(e,t){return((e,t)=>({name:"gh-brand-config",kind:"data",displayName:"Brand Configuration",helperText:"Manage global features and settings for your website",contentTitleField:void 0,fields:[...sf(t),{name:"header",friendlyName:"Header",type:"object",defaultCollapsed:!0,subFields:[{name:"headerType",friendlyName:"Type",helperText:"Select the type of header to use",defaultCollapsed:!0,type:"select",enum:[Kh.BASIC,Kh.MEDIUM,Kh.MEGA,Kh.LINKLESS,Kh.NONE,Kh.DMP,Kh.CMS],defaultValue:"MEDIUM"},Zh.basic,Zh.medium,Zh.mega,Zh.dmp,Zh.cms]},{name:"footer","@type":"@builder.io/core:Field",friendlyName:"Footer",type:"object",defaultCollapsed:!0,helperText:"Footer layout and content settings",subFields:[{name:"footerType",friendlyName:"Footer Type",type:"select",enum:[Xh.BASIC,Xh.MEGA,Xh.NONE,Xh.CMS],defaultValue:Xh.BASIC,defaultCollapsed:!0,helperText:"Choose the footer layout style for the website"},{"@type":"@builder.io/core:Field",name:"cmsFooterConfig",showIf:"return options.get('footerType') === 'CMS'",friendlyName:"CMS Footer Config",helperText:"Reference a footer created in Builder CMS to use as the website footer.",type:"reference",model:"footer",copyOnAdd:!1,localized:!1,required:!0,defaultCollapsed:!0}]},nf(e),{name:"support",friendlyName:"Support Information",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Contact information displayed to customers on the website",subFields:[{name:"email",friendlyName:"Support Email",type:"text",required:!0,localized:!0,helperText:"Email address for customer support inquiries",defaultCollapsed:!0},{name:"phone",friendlyName:"Support Phone Number",type:"text",required:!0,localized:!0,helperText:"Phone number for customer support inquiries",defaultCollapsed:!0},{name:"phoneDisplay",friendlyName:"Support Phone Display",type:"text",required:!0,localized:!0,helperText:"Formatted phone number for display",defaultCollapsed:!0},{name:"address",friendlyName:"Support Address",type:"object",required:!0,localized:!1,helperText:"Support address for customer inquiries",defaultCollapsed:!0,subFields:[{name:"street",friendlyName:"Street",type:"text",required:!0,helperText:"Street address for support",defaultCollapsed:!0},{name:"city",friendlyName:"City",type:"text",required:!0,helperText:"City for support address",defaultCollapsed:!0},{name:"state",friendlyName:"State Code",type:"text",required:!0,helperText:"State code for support address (e.g. CA)",defaultCollapsed:!0},{name:"zipcode",friendlyName:"Zip Code",type:"text",required:!0,helperText:"Zip code for support address",defaultCollapsed:!0}]},{name:"addressString",friendlyName:"Support Address String",type:"text",required:!1,localized:!1,helperText:"The full support address as a string",defaultCollapsed:!0}]},{name:"pageConfig",friendlyName:"Page Configurations",type:"object",defaultCollapsed:!0,subFields:[{name:"accountDetails",friendlyName:"Account Details Page",type:"object",defaultCollapsed:!0,subFields:[{name:"birthdayBannerConfig",friendlyName:"Birthday Banner Configuration",type:"object",defaultCollapsed:!0,subFields:[{name:"content",friendlyName:"Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"linkText",friendlyName:"Link Text",type:"text",localized:!0,defaultCollapsed:!0},{name:"linkUrl",friendlyName:"Link URL",type:"url",required:!1,localized:!0,defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"display",friendlyName:"Display",type:"text",defaultCollapsed:!0},{name:"alignItems",friendlyName:"Align Items",type:"text",defaultCollapsed:!0},{name:"margin",friendlyName:"Margin",type:"text",defaultCollapsed:!0},{name:"padding",friendlyName:"Padding",type:"text",defaultCollapsed:!0},{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0}]}]}]},{name:"cart",friendlyName:"Cart Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"continueShoppingUrl",friendlyName:"Continue Shopping URL",type:"url",required:!1,localized:!1,defaultCollapsed:!0},{name:"groupCartContentsByPurchaseType",friendlyName:"Indicates whether cart contents should be grouped by subscription and one-time purchases",type:"boolean",required:!0,localized:!0,defaultCollapsed:!0},{name:"enabledCartFrequencyToggle",friendlyName:"Determine whether we show a frequency toggle on the cart page and on the cart drawer",type:"boolean",required:!0,localized:!0,defaultCollapsed:!0},{name:"imageContainerBGColor",friendlyName:"Background color for Image Container",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"freeShippingBanner",friendlyName:"Free Shipping Banner Configuration",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Show Free Shipping Banner",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0},{name:"loggedOutBannerContent",friendlyName:"Logged Out Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"loggedInBannerContent",friendlyName:"Logged In Banner Content",type:"html",required:!1,localized:!0,defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,defaultCollapsed:!0}]}]},{name:"notices",friendlyName:"Cart Notices",type:"object",defaultCollapsed:!0,subFields:[{name:"securePaymentNotice",friendlyName:"Secure Payment Notice",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",localized:!0,helperText:"Show the secure payment notice on the cart page",defaultCollapsed:!0},{name:"text",friendlyName:"Text",type:"html",required:!1,localized:!0,helperText:"Content for the secure payment notice",defaultCollapsed:!0},{name:"styles",friendlyName:"Styles",type:"object",helperText:"Styles for the secure payment notice",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",defaultCollapsed:!0}]}]}]},{name:"subscriptionUpgradeModuleEnabled",friendlyName:"Determine whether we show Subscription Upgrade Module on the cart page",type:"boolean",required:!1,localized:!0,defaultCollapsed:!0}]},{name:"checkout",friendlyName:"Checkout Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"freeShippingBanner",friendlyName:"Free Shipping Banner",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the free shipping banner on the checkout page",defaultCollapsed:!0},{name:"loggedOutBannerContent",friendlyName:"Logged Out Banner Content",type:"html",required:!1,localized:!0,helperText:"Content for the free shipping banner when the user is not logged in",defaultCollapsed:!0},{name:"loggedInBannerContent",friendlyName:"Logged In Banner Content",type:"html",required:!1,localized:!0,helperText:"Content for the free shipping banner when the user is logged in",defaultCollapsed:!0}]},{name:"securePaymentNotice",friendlyName:"Secure Payment Notice",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the secure payment notice on the checkout page",defaultCollapsed:!0},{name:"content",friendlyName:"Content",type:"html",required:!1,localized:!0,helperText:"Content for the secure payment notice",defaultCollapsed:!0}]},{name:"autoSignUp",friendlyName:"Auto Sign Up",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Visible?",type:"boolean",required:!1,localized:!0,helperText:"Show the secure payment notice on the checkout page",defaultCollapsed:!0},{name:"isChecked",friendlyName:"Checked by Default",type:"boolean",required:!1,localized:!0,helperText:"Whether the checkbox is checked by default",defaultCollapsed:!0},{name:"labelText",friendlyName:"Label Text",type:"html",required:!1,localized:!0,helperText:"Text for the auto sign up checkbox",defaultCollapsed:!0},{name:"helpModal",friendlyName:"Help Modal",type:"object",defaultCollapsed:!0,subFields:[{name:"header",friendlyName:"Header",type:"html",required:!1,localized:!0,helperText:"Header content for the auto sign up help modal",defaultCollapsed:!0},{name:"content",friendlyName:"Content",type:"html",required:!1,localized:!0,helperText:"Content for the auto sign up help modal",defaultCollapsed:!0}]}]},{name:"smsOptIn",friendlyName:"SMS Opt In",helperText:"Use these settings to control whether you offer SMS sign up on the checkout form.",type:"object",defaultCollapsed:!0,subFields:[{name:"isVisible",friendlyName:"Enabled?",type:"boolean",required:!1,localized:!0,helperText:"Show SMS opt-in at checkout to guests or returning customers who have not yet opted-in",defaultCollapsed:!0},{name:"title",friendlyName:"Title",type:"text",required:!1,localized:!0,helperText:"The text to display on this section title",defaultCollapsed:!0},{name:"content",friendlyName:"CTA Content",type:"html",required:!1,localized:!0,helperText:"Text for the SMS sign up CTA.",defaultCollapsed:!0}]}]},{name:"orderDetails",friendlyName:"Order Details Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"title",friendlyName:"Title",type:"html",required:!1,localized:!0,helperText:"Title for the order details section on the checkout page",defaultCollapsed:!0},{name:"tableHeaderStyle",friendlyName:"Table Header Style",type:"object",required:!1,localized:!1,helperText:"Style for the order details table header",defaultCollapsed:!0,subFields:[{name:"color",friendlyName:"Color",type:"color",required:!1,localized:!1,helperText:"Text color for the order details table header",defaultCollapsed:!0},{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,helperText:"Background color for the order details table header",defaultCollapsed:!0}]},{name:"tableContentStyle",friendlyName:"Table Content Style",type:"object",required:!1,localized:!1,helperText:"Style for the order details table content",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,localized:!1,helperText:"Background color for the order details table content",defaultCollapsed:!0}]},{name:"buyItAgainButton",friendlyName:"Buy It Again Button",type:"object",required:!1,localized:!1,defaultCollapsed:!0,helperText:'Configuration for the "Buy It Again" button in the order details section',subFields:[{name:"text",friendlyName:"Button Text",type:"html",required:!1,localized:!0,helperText:'Text to display on the "Buy It Again" button',defaultCollapsed:!0},{name:"classes",friendlyName:"Classes",type:"text",required:!1,localized:!1,helperText:'CSS classes to apply to the "Buy It Again" button',defaultCollapsed:!0}]},{name:"reOrderAllButton",friendlyName:"Re-Order All Button",type:"object",required:!1,localized:!1,defaultCollapsed:!0,helperText:'Configuration for the "Re-Order All" button in the order details section',subFields:[{name:"text",friendlyName:"Button Text",type:"html",required:!1,localized:!0,helperText:'Text to display on the "Re-Order All" button',defaultCollapsed:!0},{name:"classes",friendlyName:"Classes",type:"text",required:!1,localized:!1,helperText:'CSS classes to apply to the "Re-Order All" button',defaultCollapsed:!0}]}]},{name:"resetPassword",friendlyName:"Reset Password Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"title",friendlyName:"Page Title",type:"html",required:!1,localized:!0,helperText:"Title for the reset password page",defaultCollapsed:!0}]},{name:"subscriptionCancel",friendlyName:"Subscription Cancellation Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"cancelText",friendlyName:"Cancel Text",type:"html",required:!1,localized:!0,helperText:"Text displayed on the subscription cancellation page",defaultCollapsed:!0},{name:"cancelReasons",friendlyName:"Cancel Reasons",type:"list",required:!1,localized:!0,defaultCollapsed:!0,helperText:"List of reasons for subscription cancellation",subFields:[{name:"title",friendlyName:"Reason",type:"text",required:!0,helperText:"The reason for cancellation.",localized:!0,makeEntryTitle:!0,defaultCollapsed:!0},{name:"text",friendlyName:"Display Content",type:"html",required:!1,helperText:"This is the content that will be displayed for this cancellation reason",localized:!0,defaultCollapsed:!0},{name:"identifier",friendlyName:"Identifier",type:"select",required:!0,defaultCollapsed:!0,helperText:"System identifier for this cancellation reason — used for analytics tracking",enum:[rf.DoNotLike,rf.NotWorking,rf.NoBenefits,rf.NoFitNoNeed,rf.Budget,rf.Mistake,rf.Try,rf.TooMuch,rf.TravelMove,rf.DoNotNeed,rf.AnotherReason,rf.NotHelpingSkin,rf.SkinImproved,rf.PetDoesNotLike,rf.NotHelpingPet,rf.NoneGiven]},{name:"buttons",friendlyName:"Buttons",type:"list",required:!1,defaultCollapsed:!0,subFields:[{name:"text",friendlyName:"Button Text",type:"text",required:!1,helperText:"Text to display on the button",defaultCollapsed:!0},{name:"link",friendlyName:"Button Link",type:"url",required:!1,helperText:"URL to navigate to when this button is clicked",defaultCollapsed:!0},{name:"type",type:"select",friendlyName:"Button Type",required:!1,helperText:"Determines the button behavior — links navigate away, while other types trigger actions",enum:[of.Link,of.Update,of.Keep,of.Continue,of.Cancel],defaultValue:"link",defaultCollapsed:!0}],helperText:"Buttons to display for this cancellation reason."}]}]},{name:"subscriptionEdit",friendlyName:"Subscription Edit",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"subscriptionItemDefaultImage",friendlyName:"Subscription Item Default Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!1,defaultCollapsed:!0,helperText:"Default image to display for subscription items"},{name:"shipNow",friendlyName:"Ship Now",type:"object",required:!1,defaultCollapsed:!0,localized:!1,subFields:[{name:"modalHeadlineContent",friendlyName:"Modal Headline Content",type:"html",required:!0,helperText:"Headline text displayed in the Ship Now modal",localized:!0,defaultCollapsed:!0},{name:"modalContent",friendlyName:"Modal Content",type:"html",required:!0,helperText:"Main content displayed in the Ship Now modal. You can use $FREQUENCY and it will be replaced with the frequency of the subscription.",localized:!0,defaultCollapsed:!0}]}]},{name:"upsell",friendlyName:"Upsell Page",type:"object",defaultCollapsed:!0,localized:!1,subFields:[{name:"mbgImage",friendlyName:"Money Back Guarantee Image",type:"file",showTemplatePicker:!0,allowedFileTypes:["jpeg","png","svg","webp"],required:!1,localized:!0,defaultCollapsed:!0,helperText:"Image displayed on the upsell page for the money back guarantee"},{name:"mbgText",friendlyName:"Money Back Guarantee Text",type:"html",required:!1,localized:!0,defaultCollapsed:!0,helperText:"Text displayed on the upsell page for the money back guarantee"}]}]},{name:"cookieConfig",friendlyName:"Cookie Configuration",type:"object",defaultCollapsed:!0,helperText:"Settings for the cookie consent popup displayed to visitors",subFields:[{name:"popupBanner",friendlyName:"Cookie Policy Popup Banner",type:"object",defaultCollapsed:!0,helperText:"Configure the cookie policy popup banner",subFields:[{name:"content",friendlyName:"Content",type:"html",localized:!0,defaultCollapsed:!0,helperText:"Content for the cookie policy popup banner"},{name:"bannerStyles",friendlyName:"Banner Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,defaultCollapsed:!0},{name:"borderRadius",friendlyName:"Border Radius",type:"text",required:!1,defaultCollapsed:!0}]},{name:"buttonStyles",friendlyName:"Button Styles",type:"object",defaultCollapsed:!0,subFields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",required:!1,defaultCollapsed:!0},{name:"color",friendlyName:"Color",type:"color",required:!1,defaultCollapsed:!0}]}]}]},{name:"seo",friendlyName:"SEO",type:"object",defaultCollapsed:!0,localized:!1,helperText:"Search engine optimization settings for the brand",subFields:[{name:"description",friendlyName:"Site Description",type:"longText",defaultCollapsed:!1,helperText:"Default meta description for the website, used when pages do not provide their own"},{name:"knowsAbout",friendlyName:"Topics",type:"Tags",defaultCollapsed:!1,helperText:"Topics the brand is knowledgeable about, used in structured data for search engines"}]}]}))(e,t)}siteBanner(e){return(e=>({name:"banner",kind:"component",displayName:"Banner / Announcement",helperText:"Banners / Announcements to display on your website",contentTitleField:void 0,fields:[{name:"position",friendlyName:"Banner Position",type:"select",enum:[hf.AboveHeader,hf.BelowHeader],defaultValue:"Above Header",helperText:"Select where this banner should appear on the page",defaultCollapsed:!0}],editingUrlLogic:"return `"+e+"/builder-banner-section?builder.preview=true&builder.frameEditing=true`"}))(e)}defaultWebsiteSection(e){return(e=>({name:"default-website-section",kind:"component",displayName:"Default Website Section",helperText:"Default section for the website",contentTitleField:void 0,fields:[{name:"sectionType",friendlyName:"Section Type",type:"select",required:!0,localized:!1,defaultCollapsed:!0,enum:["cartPageAboveSummaryContent","cartPageBelowSummaryContent","cartPageEmptyCartContent","cartPageTopSectionContent","gdprContent","mainFooter","offerSelectorAboveCTAContent","offerSelectorBelowCTAContent","subscriptionManagementNoSubsContent","subscriptionCancellationContent","notFoundContent","productNotAvailableContent"],helperText:"Choose where this content section appears on the website"}],editingUrlLogic:"return `"+e+"/builder-default-website-section?builder.preview=true&builder.frameEditing=true`"}))(e)}subscriptionCancellationPanel(e){return(e=>({name:"subscription-cancellation-panel",kind:"component",displayName:"Subscription Cancellation Panel",helperText:"Panel that is available as part of the subscription cancellation flow",contentTitleField:void 0,fields:[{name:"panelType",friendlyName:"The type of panel",type:"text",required:!1,localized:!1,defaultCollapsed:!0}],editingUrlLogic:"return `"+e+"/builder-subscription-cancellation-panel-section?builder.preview=true&builder.frameEditing=true`"}))(e)}upsellTemplate(e){return(e=>({name:"upsell-template",kind:"component",displayName:"Upsell Template",helperText:"Upsell offer page template",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-upsell-template?builder.preview=true&builder.frameEditing=true`"}))(e)}headerModel(e){return(e=>({name:"header",kind:"component",displayName:"Header",helperText:"CMS controlled global header",contentTitleField:void 0,fields:[{name:"backgroundColor",friendlyName:"Background Color",type:"color",defaultValue:"transparent",helperText:"Select the background color for the header",defaultCollapsed:!1}],editingUrlLogic:"return `"+e+"/builder-header-section?builder.preview=true&builder.frameEditing=true`"}))(e)}footerModel(e){return(e=>({name:"footer",kind:"component",displayName:"Footer",helperText:"CMS controlled global footer",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-footer-section?builder.preview=true&builder.frameEditing=true`"}))(e)}offerSelectorContentModel(e){return(e=>({name:"offer-selector-content",kind:"component",displayName:"Offer Selector Content",helperText:"Add custom content in offer selector section",contentTitleField:void 0,fields:[],editingUrlLogic:"return `"+e+"/builder-offer-selector-content?builder.preview=true&builder.frameEditing=true`"}))(e)}promotionalCardModel(e,t){return((e,t)=>({name:"promotional-card",kind:"component",displayName:"Promotional Card",helperText:"Create a promotional card to display in product grid page and more.",contentTitleField:void 0,fields:[{name:"rank",friendlyName:"Rank",type:"number",defaultValue:void 0,required:!1,localized:!1,defaultCollapsed:!1,helperText:"Lower shows first. Only used when no Product is set, or to order multiple cards on the same product."},{name:"product",friendlyName:"Product",type:"reference",modelId:e,required:!1,copyOnAdd:!1,defaultCollapsed:!1,helperText:"Places this card right after the chosen product. Leave empty to position by Rank."}],editingUrlLogic:"return `"+t+"/builder-promotional-card?builder.preview=true&builder.frameEditing=true`"}))(e,t)}pageModel(e){return(e=>{const{productModelId:t,productGroupModelId:n,categoryModelId:r,bannerModelId:o,blogCategoryModelId:i,sectionModelId:s,editUrl:a}=e;return{name:"page",displayName:"Page",kind:"page",helperText:"Default model for creating pages",contentTitleField:void 0,fields:[{name:"title",friendlyName:"Title",type:"text",required:!0,helperText:"A short title for this page. If the SEO Page Title is not provided, this field is used for SEO. This field is not localized, so it is highly suggested to use the Heading.",defaultCollapsed:!1},{name:"pageType",friendlyName:"Page Type",type:"select",defaultValue:ff.GENERAL,required:!0,helperText:"Select the type of page. This will determine which components are added automatically.",enum:[ff.GENERAL,ff.BLOG,ff.PRODUCT],defaultCollapsed:!1},{name:"pdp",friendlyName:"Product Detail Page",type:"object",required:!1,subFields:[{name:"type",friendlyName:"Product Page Type",type:"select",defaultValue:mf.PRODUCT,required:!0,helperText:"Choose whether this is a single product, product group, or multi-group page",enum:[mf.PRODUCT,mf.PRODUCT_GROUP,mf.MULTI_GROUP],defaultCollapsed:!1},{name:"product",friendlyName:"Product",type:"reference",required:!1,helperText:"Select the product to display",modelId:t,copyOnAdd:!0,showIf:"return options.get('type') === 'Product'",defaultCollapsed:!1},{name:"productGroup",friendlyName:"Product Group",type:"reference",required:!1,helperText:"Select the product group to display",modelId:n,copyOnAdd:!0,showIf:"return options.get('type') === 'Product Group'",defaultCollapsed:!1},{name:"pdpTitle",friendlyName:"Display Title",type:"text",localized:!0,required:!0,helperText:'For multi-group selectors, provide the "product" title to present.',showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1},{name:"pdpDescription",friendlyName:"Description",type:"html",localized:!0,required:!1,helperText:'For multi-group selectors, provide the "product" description to present.',showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1},{name:"multiProductGroup",friendlyName:"Product Groups",type:"list",required:!1,localized:!1,helperText:"Add the product groups to include in this multi-group page",showIf:"return options.get('type') === 'Multi-Group'",defaultCollapsed:!1,subFields:[{name:"group",friendlyName:"Product Group",type:"reference",required:!0,helperText:"Select a product group to include",modelId:n,copyOnAdd:!0,defaultCollapsed:!1},{name:"optionsOverrides",friendlyName:"Offer Options",type:"list",localized:!0,required:!1,copyOnAdd:!1,defaultCollapsed:!1,helperText:"Override the default offer options for this product group",subFields:[{name:"quantity",friendlyName:"Quantity",type:"number",required:!1,defaultValue:void 0,defaultCollapsed:!1,helperText:"The quantity for this offer option"},{name:"description",friendlyName:"Description",type:"html",localized:!0,required:!1,defaultCollapsed:!1,helperText:"Description displayed for this offer option"},{name:"pillLabel",friendlyName:"Pill Label",type:"text",localized:!0,required:!1,defaultCollapsed:!1,helperText:'Text shown in the pill badge for this option (e.g. "Most Popular")'},{name:"pillColor",friendlyName:"Pill Color",type:"color",required:!1,defaultCollapsed:!1,helperText:"Background color of the pill badge"}]},{name:"pillLabel",friendlyName:"Pill Label",type:"text",localized:!0,required:!1,helperText:"(Optional) If provided, used to apply a pill on this option (e.g. Most Popular).",defaultCollapsed:!1}]},{name:"slides",friendlyName:"Product Slides",type:"list",required:!1,subFields:[{name:"image",friendlyName:"Image",type:"file",required:!0,helperText:"Upload a product slide image",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Select the image slides to display for this product. If no slides are provided, the product's default image will be used.",copyOnAdd:!0,defaultCollapsed:!1},{name:"slideThumbs",friendlyName:"Product Slides Thumbnails",type:"list",required:!1,subFields:[{name:"image",friendlyName:"Image",type:"file",required:!0,helperText:"Upload a thumbnail image",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Select the image thumbnails slides to display for this product. If no slides are provided, the Product Slides will be used",copyOnAdd:!0,defaultCollapsed:!1},{name:"sliderComponent",type:"select",enum:[yf.SLIDER_A,yf.SLIDER_B,yf.SLIDER_ZOOM],friendlyName:"Slider Component",defaultValue:yf.SLIDER_A,required:!1,helperText:"Select the style slider component to use for the product images",defaultCollapsed:!1},{name:"reviewSettings",friendlyName:"Review Settings",type:"object",required:!1,subFields:[{name:"showStarRating",type:"boolean",friendlyName:"Show Star Rating",required:!1,defaultValue:!0,helperText:"Display this product's average rating.",defaultCollapsed:!1},{name:"showGlobalFiveStarRating",type:"boolean",friendlyName:"Show Global Five Star Rating",required:!1,helperText:"Display the total 5 Star ratings received by this brand",defaultCollapsed:!1},{name:"globalRatingText",type:"html",localized:!0,friendlyName:"Global Rating Text",required:!1,helperText:'This is displayed after the count of global 5-star reviews (e.g. "5,000+ [your text here]")',defaultCollapsed:!1,showIf:'return !!(options.get("showGlobalFiveStarRating"))'},{name:"globalRatingLink",type:"url",friendlyName:"Global Rating Link",required:!1,helperText:"When provided, the number of reviews will be clickable.",defaultCollapsed:!1,showIf:'return !!(options.get("showGlobalFiveStarRating"))'}],helperText:"Configure how the reviews are displayed",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"hideNativeOfferSelector",friendlyName:"Hide Native Offer Selector",helperText:"Set to true to fully hide the native Offer Selector to provide your own (e.g. via VWO)",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"offerSelector",friendlyName:"Offer Selector",type:"object",required:!1,subFields:[{name:"osType",friendlyName:"Type",type:"select",defaultValue:gf.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE,required:!1,helperText:"Select the type of offer selector to display",enum:[gf.VERTICAL,gf.VERTICAL__FLAVOR_DROPDOWN__TYPE_TOGGLE,gf.STACKED__FLAVOR_BUTTONS__QUANTITY_TOGGLE,gf.BUNDLE_GROUP,gf.VERTICAL_FLAVOR_BUTTONS_TOGGLE],defaultCollapsed:!1},{name:"features",friendlyName:"Features",type:"object",required:!1,helperText:"Configure behavior and defaults for the offer selector",subFields:[{name:"defaultPurchaseType",friendlyName:"Default Purchase Type",type:"select",defaultValue:bf.ONE_TIME,required:!1,helperText:"When both purchase options are available to the customer, this is the option that will be selected by default.",enum:[bf.ONE_TIME,bf.SUBSCRIPTION],defaultCollapsed:!1},{name:"preferredQuantity",friendlyName:"Initial Offer Quantity",type:"number",defaultValue:3,required:!1,helperText:"Enter the quantity you would prefer users see first. If that quantity is not available,\n we will locate the closest quantity available (defaults to 3 if not set).",defaultCollapsed:!1},{name:"showSavings",friendlyName:"Show Savings?",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Display the savings amount on each offer option",defaultCollapsed:!1},{name:"savingsType",friendlyName:"Savings Type",type:"select",defaultValue:xf.PERCENT,required:!1,helperText:"When showing savings, display as a percentage or value saved.",enum:[xf.PERCENT,xf.DOLLAR],defaultCollapsed:!1},{name:"showMemberPriceMessage",friendlyName:"Show Member Price Message",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Show the member price message below the offer selector",defaultCollapsed:!1},{name:"showSubscriptionPriceMessage",friendlyName:"Show Subscription Price Message",type:"boolean",defaultValue:{Default:!0},required:!1,helperText:"Show the subscription price message below the offer selector",defaultCollapsed:!1},{name:"scrollToTopOffset",friendlyName:"Scroll to Top Offset (px)",type:"number",defaultValue:170,required:!1,helperText:'The number of pixels to offset the Scroll to Top button. Note: The label for this button may be set in the "Labels" section.',defaultCollapsed:!1},{name:"enableAnonymousSubscriptions",friendlyName:"Always Show Subscriptions",type:"boolean",defaultValue:!1,required:!1,helperText:"Enable this to present subscriptions (when available) to non-MyAccount visitors. By default, a user must be logged in to access this option.",defaultCollapsed:!1,hidden:!1,advanced:!0}],defaultCollapsed:!1},{name:"labels",friendlyName:"Labels",type:"object",defaultValue:{quantitySelector:{"@type":"@builder.io/core:LocalizedValue"},actionButton:{Default:"ADD TO CART"},subscriptionOffer:{Default:"Or $PRICE when you subscribe & save"},flavorSelector:{Default:"Choose a flavor"},otpToggle:{Default:"Single purchase"},memberOffer:{Default:"Or pay member price of"},scrollButton:{Default:'<span class="material-icons">keyboard_arrow_up</span> Back to top'},outOfStock:{Default:'Sorry, we"re currently out of stock'},outOfStockFormSuccess:{Default:'<p class="text-center">We will notify you as soon as this item is back in stock.</p>'},subscriptionToggle:{Default:"Subscribe & save"}},required:!1,subFields:[{name:"actionButton",friendlyName:"Action Button",type:"text",defaultValue:{Default:"ADD TO CART"},required:!1,helperText:'Text on the main call-to-action button (e.g. "ADD TO CART")',defaultCollapsed:!1},{name:"subscriptionOffer",friendlyName:"Subscription Offer",type:"text",defaultValue:{Default:"Or $PRICE when you subscribe & save"},required:!1,helperText:"Use $PRICE to represent the price, this will be automatically replaced.",defaultCollapsed:!1},{name:"memberOffer",friendlyName:"Member Offer",type:"text",defaultValue:{Default:"Or pay member price of"},required:!1,helperText:'Message shown for member pricing (e.g. "Or pay member price of")',defaultCollapsed:!1},{name:"subscriptionToggle",friendlyName:"Subscription Toggle",type:"text",defaultValue:{Default:"Subscribe & save"},required:!1,helperText:"The label for the button when selecting a subscription",defaultCollapsed:!1},{name:"otpToggle",friendlyName:"One-Time Purchase Toggle",type:"text",defaultValue:{Default:"Single purchase"},required:!1,helperText:"The label for the button when selecting a single purchase (otp).",defaultCollapsed:!1},{name:"outOfStock",friendlyName:"Out of Stock",type:"text",defaultValue:{Default:'Sorry, we"re currently out of stock'},required:!1,helperText:"The text to display when this product is marked as Out of Stock.",defaultCollapsed:!1},{name:"outOfStockFormSuccess",friendlyName:"Out of Stock Form Success Message",type:"html",defaultValue:{Default:'<p class="text-center">We will notify you as soon as this item is back in stock.</p>'},required:!1,helperText:"The message displayed when a user requests to be notified when this product is back in stock.",defaultCollapsed:!1},{name:"scrollButton",friendlyName:"Scroll Button Content",type:"html",defaultValue:{Default:'<span class="material-icons">keyboard_arrow_up</span> Back to top'},required:!1,helperText:"Content displayed in the scroll-to-top button",defaultCollapsed:!1},{name:"packageSelector",friendlyName:"Package Selector",type:"text",defaultValue:"Choose a package",required:!1,helperText:'Label for the package selector (e.g. "Choose a package")',defaultCollapsed:!1},{name:"flavorSelector",friendlyName:"Flavor / Option Selector",type:"text",defaultValue:{Default:"Choose a flavor"},required:!1,helperText:'Label for the flavor/option dropdown (e.g. "Choose a flavor")',defaultCollapsed:!1},{name:"quantitySelector",friendlyName:"Quantity Selector",type:"text",localized:!0,required:!1,helperText:"(Optional) Provide a label for the quantity selection. Only displayed if your selected offer selector supports this feature.",defaultCollapsed:!1}],helperText:"Customize the various labels on the offer selector",defaultCollapsed:!1},{name:"bestSellerImage",friendlyName:"Best Seller Image",type:"file",allowedFileTypes:["jpeg","png","svg","webp"],defaultValue:"https://cdn.builder.io/api/v1/image/assets%2Fcf992cf7343c4ca182a884e9a45f394e%2F3805efcc18184db8bccf74d5c5aaf891?format=webp",required:!1,helperText:"The small image to display alongside the best seller offer",defaultCollapsed:!0},{name:"bestValueImage",friendlyName:"Best Value Image",type:"file",defaultValue:"https://cdn.builder.io/api/v1/image/assets%2Fcf992cf7343c4ca182a884e9a45f394e%2F82105508987e4459bc4405617d4bee33",required:!1,helperText:"The small image to display alongside the best value offer (highest quantity)",allowedFileTypes:["jpeg","png","svg","webp"],defaultCollapsed:!0},{name:"content",friendlyName:"Custom Offer Selector Content",type:"object",required:!1,helperText:"Override the default offer selector content with custom content from Builder.",defaultCollapsed:!1,subFields:[{name:"aboveCTAContent",friendlyName:"Above CTA Content",type:"reference",required:!1,helperText:"Choose the content to display above the offer selector CTA",model:"offer-selector-content",copyOnAdd:!1,defaultCollapsed:!1},{name:"belowCTAContent",friendlyName:"Below CTA Content",type:"reference",required:!1,helperText:"Choose the content to display below the offer selector CTA",model:"offer-selector-content",copyOnAdd:!1,defaultCollapsed:!1}]},{name:"cssOverrides",friendlyName:"CSS Properties",type:"object",defaultValue:{},required:!1,helperText:"Advanced CSS customizations for the offer selector",subFields:[{name:"signupOfferCustomCssProps",friendlyName:"Signup Offer CSS",type:"map",required:!1,helperText:"Custom CSS properties for the signup offer section",defaultCollapsed:!1},{name:"signupOfferPriceCustomCssProps",friendlyName:"Signup Offer Price CSS",type:"map",required:!1,helperText:"Custom CSS properties for the signup offer price",defaultCollapsed:!1}],defaultCollapsed:!0}],helperText:"Configure the offer selector to display.",defaultCollapsed:!0,showIf:"return !(options.get('hideNativeOfferSelector'))"},{name:"category",type:"reference",required:!1,helperText:"Provide the category to display breadcrumb navigation",modelId:r,copyOnAdd:!0,friendlyName:"Category",defaultCollapsed:!1},{name:"desktopSliderOverride",friendlyName:"Slider Override (Desktop)",type:"reference",required:!1,helperText:"(Optional) Select content to display in place of your PDP's product image slider. Disables the slider on desktop. On mobile, this content is hidden and the standard slider is displayed.",modelId:s,copyOnAdd:!0,defaultCollapsed:!1}],helperText:"Configure the PDP options",showIf:"return options.get('pageType') === 'Product'",defaultCollapsed:!1},{name:"blog",friendlyName:"Blog Configuration",type:"object",required:!1,subFields:[{name:"title",friendlyName:"Blog Title",helperText:"Provide a title for this blog when shown on a grid or list. If not provided, the page title will be used.",type:"text",required:!1,localized:!0,defaultCollapsed:!1},{name:"publicationDate",friendlyName:"Publication Date",type:"timestamp",helperText:"Provide the publication date, this is used for sorting.",required:!0,localized:!1,defaultCollapsed:!1},{name:"snippet",friendlyName:"Blog Snippet",helperText:"Provide a snippet of the blog to display when shown on a grid or list. If not provided, we will attempt to use the page description or SEO description (if available)",type:"longText",required:!1,localized:!0,defaultCollapsed:!1},{name:"author",friendlyName:"Blog Author",type:"text",helperText:"Provide an author for this blog to display when shown on a grid or list.",required:!1,localized:!1,defaultCollapsed:!1},{name:"thumbnail",friendlyName:"Blog Thumbnail",type:"file",required:!1,helperText:"Provide an image to display when shown on a grid or list. If not provided, we will attempt to use the SEO image (if available)",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1},{name:"categories",friendlyName:"Blog Categories",type:"list",required:!1,copyOnAdd:!0,defaultCollapsed:!0,helperText:"Assign blog categories for filtering and navigation",subFields:[{name:"category",friendlyName:"Blog Category",type:"reference",modelId:i,required:!0,defaultCollapsed:!1,copyOnAdd:!1,helperText:"Select a blog category"}]}],helperText:"Configure the blog options",showIf:"return options.get('pageType') === 'Blog'",defaultCollapsed:!0},{name:"heading",friendlyName:"SEO Page Title",type:"text",required:!1,helperText:"Provide an alternate page title to use for SEO purposes (if blank, the page title is used)",defaultCollapsed:!1},{name:"description",friendlyName:"SEO Description",type:"longText",required:!1,helperText:"Set the page description for SEO here. This is automatically embedded in your page.",defaultCollapsed:!0},{name:"seoImage",friendlyName:"SEO Image",type:"file",required:!1,helperText:"Provide an image to be used for SEO purposes",allowedFileTypes:["jpeg","png","svg","webp"],copyOnAdd:!0,defaultCollapsed:!1},{name:"search",friendlyName:"Search Configuration",type:"object",required:!1,subFields:[{name:"title",friendlyName:"Search Title",type:"text",required:!1,helperText:"Used when showing this page in your site's search function. If no value is provided, the page title will be used.",defaultCollapsed:!1},{name:"description",friendlyName:"Search Description",type:"text",required:!1,helperText:"(Optional) Provide a description to be used when showing this page in search results. If no value is provided, the SEO description is used.",defaultCollapsed:!1},{name:"hide",friendlyName:"Hide from Search",type:"boolean",required:!1,helperText:"Use this to hide this page from search results. This does not prevent navigation to the page.",defaultCollapsed:!1},{name:"content",friendlyName:"Content",type:"longText",required:!1,helperText:"(Optional) Use this field to add keywords or phrases to assist in search results (e.g. related products, categories, key words, etc.)",defaultCollapsed:!1}],helperText:"Configure how this page displays in your site's built-in search results. Pages will not show in search results if neither the SEO or Search information is configured. You may also elect to hide the page from search results.",defaultCollapsed:!0},{"@type":"@builder.io/core:Field",name:"banners",friendlyName:"Banners",helperText:"Select the banner(s) to display on this page. These will be displayed in the\n order provided, but always below site-wide banners.",type:"list",defaultCollapsed:!0,localized:!1,subFields:[{"@type":"@builder.io/core:Field",name:"banner",friendlyName:"Sitewide Banner",type:"reference",localized:!1,helperText:"Select the banner to display.",defaultCollapsed:!0,modelId:o,copyOnAdd:!1}]},{name:"disableStickyHeader",friendlyName:"Disable Sticky Header",helperText:"Disable the sticky header for this page only.",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"showBundleDrawer",friendlyName:"Show Bundle Drawer",helperText:"Enable the bundle drawer for this page.",type:"boolean",localized:!1,defaultCollapsed:!0,advanced:!0},{name:"robotsMeta",friendlyName:"Robots Meta",type:"object",required:!1,helperText:"Settings for the robots meta tag.",subFields:[{name:"noIndex",friendlyName:"No Index",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents pages from being indexed and displayed in search engine result pages"},{name:"noFollow",friendlyName:"No Follow",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents search engines from following links on the pages"},{name:"noArchive",friendlyName:"No Archive",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents search engines from showing Cached links for pages"},{name:"noImageIndex",friendlyName:"No Image Index",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"This option prevents images on a page from being indexed by Google and other search engines"},{name:"noSnippet",friendlyName:"No Snippet",type:"boolean",required:!1,defaultCollapsed:!0,helperText:"Prevents a snippet from being shown in the search results"}],defaultCollapsed:!0}],editingUrlLogic:"return `"+a+"${targeting.urlPath}?builder.preview=true&builder.frameEditing=true`"}})(e)}blogCommentModel(e){return(e=>({...af,fields:[...af.fields,{name:"blog",friendlyName:"Blog Post",helperText:"The blog that this comment is linked to",type:"reference",modelId:e,required:!0,defaultCollapsed:!1,copyOnAdd:!1}]}))(e)}},am=[{name:"product-ingredient",displayName:"Product Ingredient",phase:1,dependencies:[],getShape:()=>sm.ingredientsModel},{name:"product-category",displayName:"Product Category",phase:1,dependencies:[],getShape:()=>sm.categoryModel},{name:"product-tag",displayName:"Product Tag",phase:1,dependencies:[],getShape:()=>sm.productTagModel},{name:"product-use-case",displayName:"Product Use Case",phase:1,dependencies:[],getShape:()=>sm.useCaseModel},{name:"profile-reference-rule",displayName:"Profile Reference Rule",phase:1,dependencies:[],getShape:()=>sm.profileReferenceRuleModel},{name:"recommendation-config",displayName:"Recommendation Config",phase:2,dependencies:["product-tag"],getShape:()=>sm.recommendationConfigModel},{name:"product",displayName:"Product",phase:2,dependencies:["product-ingredient","product-category","product-tag","product-use-case"],getShape:e=>sm.productModel({ingredientsModelId:e["product-ingredient"],categoryModelId:e["product-category"],tagModelId:e["product-tag"],useCaseModelId:e["product-use-case"]})},{name:"banner",displayName:"Site Banner",phase:3,dependencies:[],getShape:(e,t)=>sm.siteBanner(t)},{name:"blog-category",displayName:"Blog Category",phase:3,dependencies:[],getShape:()=>sm.blogCategoryModel},{name:"default-website-section",displayName:"Default Website Section",phase:3,dependencies:[],getShape:(e,t)=>sm.defaultWebsiteSection(t)},{name:"subscription-cancellation-panel",displayName:"Subscription Cancellation Panel",phase:3,dependencies:[],getShape:(e,t)=>sm.subscriptionCancellationPanel(t)},{name:"upsell-template",displayName:"Upsell Template",phase:3,dependencies:[],getShape:(e,t)=>sm.upsellTemplate(t)},{name:"header",displayName:"Header",phase:3,dependencies:[],getShape:(e,t)=>sm.headerModel(t)},{name:"footer",displayName:"Footer",phase:3,dependencies:[],getShape:(e,t)=>sm.footerModel(t)},{name:"offer-selector-content",displayName:"Offer Selector Content",phase:3,dependencies:[],getShape:(e,t)=>sm.offerSelectorContentModel(t)},{name:"promotional-card",displayName:"Promotional Card",phase:4,dependencies:["product"],getShape:(e,t)=>sm.promotionalCardModel(e.product,t)},{name:"product-group",displayName:"Product Group",phase:3.5,dependencies:["product","default-website-section"],getShape:e=>sm.productGroupModel(e.product,e["default-website-section"])},{name:"page",displayName:"Page",phase:4,dependencies:["product","product-group","product-category","banner","blog-category","default-website-section"],getShape:(e,t)=>sm.pageModel({productModelId:e.product,productGroupModelId:e["product-group"],categoryModelId:e["product-category"],bannerModelId:e.banner,blogCategoryModelId:e["blog-category"],sectionModelId:e["default-website-section"],editUrl:t})},{name:"blog-comment",displayName:"Blog Comment",phase:5,dependencies:["page"],getShape:e=>sm.blogCommentModel(e.page)},{name:"product-grid-filter-group",displayName:"Product Grid Filter Group",phase:6,dependencies:["product-category","product-use-case","product-ingredient","product-tag"],getShape:e=>sm.productGridConfigModel({categoryId:e["product-category"],useCaseId:e["product-use-case"],ingredientId:e["product-ingredient"],tagId:e["product-tag"]})},{name:"gh-brand-config",displayName:"Brand Configuration",phase:7,dependencies:["product-grid-filter-group","banner","recommendation-config"],getShape:e=>sm.brandConfig(e["product-grid-filter-group"],e.banner)}];function lm(e,t){const n=t.find(t=>t.name===e);return console.log(`[Hippo Commerce - CART] Retrieved model "${e}" ---\x3e`,n?.id),n}async function dm(e,t,n){const r=crypto.randomUUID().toString();try{await n.models.update({...e,id:t?t.id:r});const o=t?t.id:r;return console.log("[Hippo Commerce - CART] Model update complete ---\x3e",e.name,o),o}catch(t){console.error("[Hippo Commerce - CART] Set model error",t instanceof Error?{message:t.message,name:t.name,stack:t.stack}:t),console.error("[Hippo Commerce - CART] Failed model shape:",e.name)}return t?t.id:e.name}function cm(e){const t=e.user.organization.value.settings.plugins?.get(h),n=t?.get("editUrl");return n??""}const pm=new Set(["symbol"]);function um(e,t){const n=[],r=[],o=(e,t,i)=>{const s=new Map(t.map(e=>[e.name,e])),a=new Map(e.map(e=>[e.name,e]));for(const t of e){const e=i?`${i}.${t.name}`:t.name,r=s.get(t.name);r?(t.subFields?.length||r.subFields?.length)&&o(t.subFields??[],r.subFields??[],e):n.push(e)}for(const e of t)a.has(e.name)||r.push(i?`${i}.${e.name}`:e.name)};return o(e,t,""),{added:n,removed:r}}const hm=({variant:e,label:t})=>(0,c.jsx)("span",{className:`px-2.5 py-0.5 rounded-full text-xs font-medium ${{success:"bg-[var(--success)]/15 text-[var(--success)]",warning:"bg-[var(--warning)]/15 text-[var(--warning)]",error:"bg-[var(--error)]/15 text-[var(--error)]"}[e]}`,children:t}),fm=({children:e,className:t,...n})=>(0,c.jsx)("button",{className:`px-3 py-1.5 rounded-lg text-xs font-medium border border-[var(--border-glass)] bg-[var(--bg-glass)] text-[var(--text-secondary)] cursor-pointer hover:bg-[var(--bg-glass-hover)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${t??""}`,...n,children:e}),mm=({children:e,className:t,...n})=>(0,c.jsx)("button",{className:`px-5 py-2 rounded-lg bg-[var(--accent)] text-[#1a1a2e] font-semibold text-sm cursor-pointer transition-all hover:brightness-110 hover:shadow-[0_0_20px_var(--accent-glow)] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:brightness-100 disabled:hover:shadow-none ${t??""}`,...n,children:e}),gm=({label:e,value:t})=>(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-xs font-semibold text-[var(--text-secondary)] tracking-wide mb-1",children:e}),(0,c.jsx)("div",{className:"text-sm text-[var(--text-primary)]",children:t})]}),ym=()=>(0,c.jsxs)("svg",{className:"animate-spin h-4 w-4 text-[var(--accent)]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,c.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,c.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),bm=({open:e,className:t})=>(0,c.jsx)("svg",{className:`h-4 w-4 shrink-0 transition-transform ${e?"rotate-180":""} ${t??""}`,viewBox:"0 0 20 20",fill:"currentColor",children:(0,c.jsx)("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.84a.75.75 0 111.08 1.04l-4.25 4.4a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),xm=({variant:e,summary:t,children:n})=>{const[r,o]=(0,p.useState)(!1),i={success:{container:"bg-[var(--success)]/10 border-[var(--success)]/30",text:"text-[var(--success)]"},warning:{container:"bg-[var(--warning)]/10 border-[var(--warning)]/30",text:"text-[var(--warning)]"},neutral:{container:"bg-[var(--bg-glass)] border-[var(--border-glass)]",text:"text-[var(--text-primary)]"}}[e];return(0,c.jsxs)("div",{className:`mb-4 rounded-lg border ${i.container}`,children:[(0,c.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),"aria-expanded":r,className:"w-full flex items-center justify-between gap-3 px-4 py-3 cursor-pointer text-left",children:[(0,c.jsx)("span",{className:`text-sm font-semibold ${i.text}`,children:t}),(0,c.jsx)(bm,{open:r,className:i.text})]}),r&&(0,c.jsx)("div",{className:"px-4 pb-3",children:n})]})},vm=({version:e})=>(0,c.jsxs)("div",{className:"mb-4 flex items-center gap-2 text-sm",children:[(0,c.jsx)("span",{className:"text-[var(--text-secondary)]",children:"Schema version"}),(0,c.jsx)("span",{className:"font-mono font-semibold text-[var(--text-primary)]",children:e})]}),wm=({name:e,result:t,onTest:n})=>(0,c.jsxs)("div",{className:"rounded-xl border border-[var(--border-glass)] bg-[var(--bg-glass)] p-5 flex flex-col gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-sm font-semibold text-[var(--text-primary)]",children:e}),"idle"===t.status&&(0,c.jsx)(hm,{variant:"warning",label:"Not tested"}),"testing"===t.status&&(0,c.jsx)(ym,{}),"success"===t.status&&(0,c.jsx)(hm,{variant:"success",label:"Connected"}),"error"===t.status&&(0,c.jsx)(hm,{variant:"error",label:"Failed"})]}),void 0!==t.time&&(0,c.jsxs)("div",{className:"text-xs text-[var(--text-muted)]",children:["Response time: ",t.time,"ms"]}),t.error&&(0,c.jsx)("div",{className:"text-xs text-[var(--error)] bg-[var(--error)]/10 rounded-lg px-3 py-2 break-all",children:t.error}),(0,c.jsx)(fm,{onClick:n,disabled:"testing"===t.status,children:"testing"===t.status?"Testing...":"Test Connection"})]}),km=({status:e,syncing:t,allStatuses:n,onSync:r})=>{const o=e.dependencies.filter(e=>{const t=n.find(t=>t.name===e);return!t?.exists}),i=0===o.length;return(0,c.jsxs)("tr",{className:"border-b border-[var(--border-glass)] last:border-b-0",children:[(0,c.jsxs)("td",{className:"py-3 pr-4",children:[(0,c.jsx)("div",{className:"text-sm font-medium text-[var(--text-primary)]",children:e.displayName}),(0,c.jsx)("div",{className:"text-[11px] text-[var(--text-muted)] font-mono",children:e.name})]}),(0,c.jsx)("td",{className:"py-3 pr-4",children:(0,c.jsxs)("span",{className:"text-xs text-[var(--text-muted)]",children:["Phase ",e.phase%1==0?e.phase:e.phase.toFixed(1)]})}),(0,c.jsx)("td",{className:"py-3 pr-4",children:e.exists?(0,c.jsx)(hm,{variant:"success",label:"Synced"}):(0,c.jsx)(hm,{variant:"warning",label:"Missing"})}),(0,c.jsx)("td",{className:"py-3 pr-4",children:e.dependencies.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:e.dependencies.map(e=>{const t=n.find(t=>t.name===e);return(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-mono "+(t?.exists?"bg-[var(--success)]/10 text-[var(--success)]":"bg-[var(--warning)]/10 text-[var(--warning)]"),children:e},e)})}):(0,c.jsx)("span",{className:"text-xs text-[var(--text-muted)]",children:"None"})}),(0,c.jsx)("td",{className:"py-3 text-right",children:t?(0,c.jsx)(ym,{}):(0,c.jsx)(fm,{onClick:()=>r(e.name),disabled:!i,title:i?`Sync ${e.displayName}`:`Missing dependencies: ${o.join(", ")}`,children:"Sync"})})]})},Cm=(0,u.observer)(({context:e})=>{const t=g.getUserDetails(e),n=function(e){const t=e.user.organization?.value?.settings?.plugins?.get(h);return{brand:t?.get("brand")??"",otherBrand:t?.get("otherBrand")??"",editUrl:t?.get("editUrl")??"",apiUrl:t?.get("apiUrl")??"",apiUser:t?.get("apiUser")??"",apiPassword:t?.get("apiPassword")??"",privateApiKey:t?.get("privateApiKey")??""}}(e),r="Other"===n.brand?n.otherBrand:n.brand,[o,i]=(0,p.useState)({status:"idle"}),[s,a]=(0,p.useState)({status:"idle"}),[l,d]=(0,p.useState)({status:"idle"}),[u,f]=(0,p.useState)(null),[m,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),v=e.user.organizations.find(t=>t.value.id===e.user.currentOrganization),w=v?.value.name??"Unknown",k=e.user.apiKey,C=e.user.authHeaders,T=(N=e.models.result,am.map(e=>{const t=N.find(t=>t.name===e.name);return{name:e.name,displayName:e.displayName,phase:e.phase,dependencies:e.dependencies,exists:!!t,modelId:t?.id}}));var N;const S=function(e){const t=new Set(am.map(e=>e.name));return e.filter(e=>e.name&&!t.has(e.name)&&!pm.has(e.name)).map(e=>({name:e.name,modelId:e.id,kind:e.kind}))}(e.models.result),M=function(e){const t=cm(e),n=e.models.result,r={};for(const e of am){const t=n.find(t=>t.name===e.name);t?.id&&(r[e.name]=t.id)}const o=[];for(const e of am){const i=n.find(t=>t.name===e.name);if(!i)continue;let s;try{s=e.getShape(r,t).fields??[]}catch{continue}const{added:a,removed:l}=um(s,i.fields??[]);(a.length>0||l.length>0)&&o.push({name:e.name,displayName:e.displayName,added:a,removed:l})}return o}(e),j=(0,p.useCallback)(async()=>{i({status:"testing"});const e=Date.now();try{const t=await fetch(`https://cdn.builder.io/api/v3/content/gh-brand-config?apiKey=${k}&limit=1`,{headers:C}),n=Date.now()-e;if(t.ok)i({status:"success",time:n});else{const e=await t.text();i({status:"error",time:n,error:`${t.status}: ${e.slice(0,200)}`})}}catch(t){i({status:"error",time:Date.now()-e,error:t instanceof Error?t.message:String(t)})}},[k,C]),O=(0,p.useCallback)(async()=>{a({status:"testing"});const e=Date.now();try{const t=await fetch(`${n.apiUrl}/config`,{headers:{Authorization:"Basic "+btoa(n.apiUser+":"+n.apiPassword),"X-Brand":r}}),o=Date.now()-e;if(t.ok)a({status:"success",time:o});else{const e=await t.text();a({status:"error",time:o,error:`${t.status}: ${e.slice(0,200)}`})}}catch(t){const n=Date.now()-e,r=t instanceof Error?t.message:String(t);r.includes("Failed to fetch")||r.includes("NetworkError")||r.includes("CORS")?a({status:"error",time:n,error:"CORS blocked — the Commerce API server does not allow requests from this origin. Test from a backend or use the API directly."}):a({status:"error",time:n,error:r})}},[n.apiUrl,n.apiUser,n.apiPassword,r]),A=(0,p.useCallback)(async()=>{d({status:"testing"});const e=Date.now();try{const t=await fetch("https://cdn.builder.io/api/v2/admin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.privateApiKey}`},body:JSON.stringify({query:"{ settings }"})}),r=Date.now()-e,o=await t.json();if(t.ok&&!o.errors?.length)d({status:"success",time:r});else{const e=o.errors?.[0]?.message??`${t.status}`;d({status:"error",time:r,error:e})}}catch(t){d({status:"error",time:Date.now()-e,error:t instanceof Error?t.message:String(t)})}},[n.privateApiKey]),E=(0,p.useCallback)(async()=>{y(!0),x(null);try{const t=await async function(e,t){const n=cm(e),r=e.models.result,o={},i=[];for(const e of am){const t=lm(e.name,r);t?.id&&(o[e.name]=t.id)}const s=[...am].sort((e,t)=>e.phase-t.phase);for(const a of s){t?.(a.name);const s=a.dependencies.filter(e=>!o[e]);if(s.length>0)i.push({success:!1,modelName:a.name,error:`Missing dependencies: ${s.join(", ")}`});else try{const t=a.getShape(o,n),s=lm(a.name,r),l=await dm(t,s,e);l?(o[a.name]=l,i.push({success:!0,modelName:a.name,modelId:l})):i.push({success:!1,modelName:a.name,error:"setModel returned undefined"})}catch(e){i.push({success:!1,modelName:a.name,error:e instanceof Error?e.message:String(e)})}}return console.info("[Hippo Commerce - CART] Model sync complete"),i}(e,e=>{f(e)});x(t)}finally{f(null),y(!1)}},[e]),L=(0,p.useCallback)(async t=>{f(t),x(null);try{const n=await async function(e,t){const n=am.find(t=>t.name===e);if(!n)return{success:!1,modelName:e,error:`Unknown model: ${e}`};const r=cm(t),o=t.models.result,i={};for(const e of am){const t=o.find(t=>t.name===e.name);t?.id&&(i[e.name]=t.id)}const s=n.dependencies.filter(e=>!i[e]);if(s.length>0)return{success:!1,modelName:e,error:`Missing dependencies: ${s.join(", ")}`};try{const s=n.getShape(i,r),a=lm(n.name,o),l=await dm(s,a,t);return l?{success:!0,modelName:e,modelId:l}:{success:!1,modelName:e,error:"setModel returned undefined"}}catch(t){return{success:!1,modelName:e,error:t instanceof Error?t.message:String(t)}}}(t,e);x([n])}finally{f(null)}},[e]);return(0,c.jsxs)("div",{children:[(0,c.jsx)(P,{title:"Administration",subtitle:"Space configuration, connectivity, and model management"}),(0,c.jsxs)("div",{className:"space-y-6",children:[(0,c.jsx)(R,{title:"Space Information",subtitle:"Current Builder.io space and plugin context",children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[(0,c.jsx)(gm,{label:"Organization",value:w}),(0,c.jsx)(gm,{label:"User Email",value:t.email}),(0,c.jsx)(gm,{label:"Brand",value:r||"Not configured"}),(0,c.jsx)(gm,{label:"API Key",value:k?(0,c.jsxs)("span",{className:"font-mono text-xs",children:[k.slice(0,8),"..."]}):(0,c.jsx)("span",{className:"text-[var(--text-muted)]",children:"Not available"})}),(0,c.jsx)(gm,{label:"Private API Key",value:n.privateApiKey?(0,c.jsx)(hm,{variant:"success",label:"Configured"}):(0,c.jsx)(hm,{variant:"error",label:"Missing"})})]})}),(0,c.jsx)(R,{title:"API Connection Status",subtitle:"Test connectivity to Builder.io and Hippo Commerce services",children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,c.jsx)(wm,{name:"Builder.io CDN",result:o,onTest:j}),(0,c.jsx)(wm,{name:"Hippo Commerce API",result:s,onTest:O}),(0,c.jsx)(wm,{name:"Builder.io Write API",result:l,onTest:A})]})}),(0,c.jsx)(R,{title:"Plugin Settings",subtitle:"Current plugin configuration (read-only)",actions:(0,c.jsx)(fm,{onClick:im,children:"Open Settings"}),children:(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[(0,c.jsx)(gm,{label:"Brand",value:r||"Not configured"}),(0,c.jsx)(gm,{label:"Development Site URL",value:n.editUrl||"Not set"}),(0,c.jsx)(gm,{label:"API URL",value:n.apiUrl||"Not set"}),(0,c.jsx)(gm,{label:"API User",value:n.apiUser||"Not set"}),(0,c.jsx)(gm,{label:"API Password",value:n.apiPassword?"••••••":"Not set"}),(0,c.jsx)(gm,{label:"Private API Key",value:n.privateApiKey?"Configured":"Not set"})]})}),(0,c.jsxs)(R,{title:"Model Sync",subtitle:`${T.filter(e=>e.exists).length} of ${am.length} models synced`,actions:(0,c.jsx)(mm,{onClick:E,disabled:m,children:m?"Syncing...":"Sync All Models"}),children:[(0,c.jsx)(vm,{version:"0.20.0"}),T.some(e=>!e.exists)&&(0,c.jsxs)(xm,{variant:"success",summary:`${T.filter(e=>!e.exists).length} model${1===T.filter(e=>!e.exists).length?"":"s"} will be added by the sync`,children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"These models are defined by this package but don't exist on the brand yet. Running the sync will create them."}),(0,c.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:T.filter(e=>!e.exists).map(e=>(0,c.jsx)("span",{className:"inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--success)]/15 text-[var(--success)]",title:e.displayName,children:e.name},e.name))})]}),M.length>0&&(0,c.jsxs)(xm,{variant:"neutral",summary:`Field changes on ${M.length} existing model${1===M.length?"":"s"}`,children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"The sync replaces each model's shape. Fields shown in green will be added; fields in red will be removed along with any content stored in them."}),(0,c.jsx)("div",{className:"mt-3 space-y-2.5",children:M.map(e=>(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"text-xs font-medium text-[var(--text-primary)]",children:[e.displayName," ",(0,c.jsxs)("span",{className:"text-[var(--text-muted)] font-mono",children:["(",e.name,")"]})]}),(0,c.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[e.added.map(e=>(0,c.jsxs)("span",{className:"text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--success)]/15 text-[var(--success)]",children:["+ ",e]},`add-${e}`)),e.removed.map(e=>(0,c.jsxs)("span",{className:"text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--error)]/15 text-[var(--error)]",children:["− ",e]},`rm-${e}`))]})]},e.name))})]}),S.length>0&&(0,c.jsxs)(xm,{variant:"warning",summary:(0,c.jsxs)(c.Fragment,{children:[S.length," model",1===S.length?"":"s"," on this brand"," ",1===S.length?"is":"are"," not part of this package"]}),children:[(0,c.jsx)("div",{className:"text-xs text-[var(--text-secondary)]",children:"These models exist on the brand but aren't managed by the sync. They won't be maintained and could be dropped or orphaned — relocate any content you need to keep before re-provisioning."}),(0,c.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:S.map(e=>(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded font-mono bg-[var(--warning)]/15 text-[var(--warning)]",title:e.kind?`kind: ${e.kind}`:void 0,children:[e.name,e.kind&&(0,c.jsxs)("span",{className:"opacity-60",children:["· ",e.kind]})]},e.modelId))})]}),b&&(0,c.jsx)("div",{className:"mb-4",children:b.every(e=>e.success)?(0,c.jsxs)("div",{className:"rounded-lg bg-[var(--success)]/10 border border-[var(--success)]/20 px-4 py-3 text-sm text-[var(--success)]",children:["All ",b.length," model(s) synced successfully."]}):(0,c.jsxs)("div",{className:"rounded-lg bg-[var(--error)]/10 border border-[var(--error)]/20 px-4 py-3 text-sm text-[var(--error)]",children:[b.filter(e=>!e.success).length," model(s) failed to sync.",b.filter(e=>!e.success).map(e=>(0,c.jsxs)("div",{className:"mt-1 text-xs",children:[(0,c.jsxs)("strong",{children:[e.modelName,":"]})," ",e.error]},e.modelName))]})}),(0,c.jsx)("div",{className:"overflow-x-auto",children:(0,c.jsxs)("table",{className:"w-full text-left",children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{className:"border-b border-[var(--border-glass)]",children:[(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Model"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Phase"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Status"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide",children:"Dependencies"}),(0,c.jsx)("th",{className:"pb-3 text-xs font-semibold text-[var(--text-secondary)] tracking-wide text-right",children:"Action"})]})}),(0,c.jsx)("tbody",{children:T.map(e=>(0,c.jsx)(km,{status:e,syncing:u===e.name,allStatuses:T,onSync:L},e.name))})]})})]})]})]})}),Tm=Cm,Nm=p.default.memo(e=>{const{context:t}=e;return(0,c.jsx)(E,{context:t,children:(0,c.jsx)(Tm,{context:t})})});Nm.displayName="HippoCMSAdmin";const Sm=Nm;l.Builder.register("plugin",{id:h,name:"Hippo Commerce",settings:[{type:"select",enum:["Badlands Ranch","Beverly Hills MD","Dr. Marty","Driven Entrepreneur","Gundry MD","Roundhouse Provisions","Other"],name:"brand",friendlyName:"Brand",helperText:"Select your brand. If you select 'Other', provide your brand under the advanced settings.",required:!0},{type:"text",name:"editUrl",friendlyName:"Development Site URL",helperText:"Provide the URL to your development site.",required:!0},{type:"text",name:"apiUrl",friendlyName:"API URL",helperText:"Provide the URL to your instance of the Hippo Commerce API.",required:!0},{type:"text",name:"apiUser",friendlyName:"API User",helperText:"Provide your Hippo Commerce API User.",required:!0},{type:"password",name:"apiPassword",friendlyName:"API Password",helperText:"Provide your Hippo Commerce API Password.",required:!0},{type:"text",name:"privateApiKey",friendlyName:"Private API Key",helperText:"Your Builder.io private API key. Required for saving content from the plugin. Found in Settings → Space → Developer.",required:!0},{type:"text",name:"otherBrand",friendlyName:"Custom Brand",helperText:"Provide your brand exactly as it is configured in your Hippo Commerce API.",required:!1,advanced:!0}],ctaText:"Save Settings",async onSave(e){await e.updateSettings({hasConnected:!0}),await d.default.dialogs.alert("Hippo Commerce Cart settings saved.")}}),l.Builder.register("app.onLoad",async({triggerSettingsDialog:e})=>{om=e;const t=d.default.user.organization.value.settings.plugins?.get(h),n=t?.get("hasConnected"),r=t?.get("brand"),o=t?.get("apiUser"),i=t?.get("apiPassword"),s=t?.get("apiUrl"),a=t?.get("editUrl");n&&r&&o&&i&&s&&a||await e(h)});const Mm=g.getUserDetails(d.default);return Mm.permissions.admin&&l.Builder.register("appTab",{name:"Hippo Config",path:"gh/brand-config",icon:f,component:rm}),Mm.permissions.admin&&l.Builder.register("appTab",{name:"Hippo Admin",path:"gh/admin",icon:m,component:Sm}),{}})())}}});