@dialpad/dialtone 9.169.0 → 9.171.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.
- package/dist/tokens/doc.json +88738 -88738
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/lib/editor/editor.cjs +1 -1
- package/dist/vue3/lib/editor/editor.cjs.map +1 -1
- package/dist/vue3/lib/editor/editor.js +18 -6
- package/dist/vue3/lib/editor/editor.js.map +1 -1
- package/dist/vue3/lib/hovercard/hovercard.cjs +1 -1
- package/dist/vue3/lib/hovercard/hovercard.cjs.map +1 -1
- package/dist/vue3/lib/hovercard/hovercard.js +47 -47
- package/dist/vue3/lib/hovercard/hovercard.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +2 -2
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +16 -2
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts +4 -0
- package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { getUniqueString as
|
|
3
|
-
import { TOOLTIP_DELAY_MS as
|
|
4
|
-
import
|
|
5
|
-
import { POPOVER_APPEND_TO_VALUES as
|
|
6
|
-
const
|
|
1
|
+
import { ref as n, onMounted as E, nextTick as S, onBeforeUnmount as A, watch as D, openBlock as M, createBlock as L, unref as k, withCtx as s, renderSlot as i, createElementVNode as I, normalizeProps as N, guardReactiveProps as $ } from "vue";
|
|
2
|
+
import { getUniqueString as j } from "../../common/utils/index.js";
|
|
3
|
+
import { TOOLTIP_DELAY_MS as C, TOOLTIP_DIRECTIONS as B } from "../tooltip/tooltip-constants.js";
|
|
4
|
+
import F from "../popover/popover.js";
|
|
5
|
+
import { POPOVER_APPEND_TO_VALUES as w, POPOVER_PADDING_CLASSES as x } from "../popover/popover-constants.js";
|
|
6
|
+
const z = {
|
|
7
7
|
__name: "hovercard",
|
|
8
8
|
props: {
|
|
9
9
|
/**
|
|
@@ -47,7 +47,7 @@ const q = {
|
|
|
47
47
|
type: String,
|
|
48
48
|
default: "top-start",
|
|
49
49
|
validator(e) {
|
|
50
|
-
return
|
|
50
|
+
return B.includes(e);
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
/**
|
|
@@ -57,7 +57,7 @@ const q = {
|
|
|
57
57
|
padding: {
|
|
58
58
|
type: String,
|
|
59
59
|
default: "large",
|
|
60
|
-
validator: (e) => Object.keys(
|
|
60
|
+
validator: (e) => Object.keys(x).some((c) => c === e)
|
|
61
61
|
},
|
|
62
62
|
/**
|
|
63
63
|
* Displaces the content box from its anchor element
|
|
@@ -74,7 +74,7 @@ const q = {
|
|
|
74
74
|
id: {
|
|
75
75
|
type: String,
|
|
76
76
|
default() {
|
|
77
|
-
return
|
|
77
|
+
return j();
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
/**
|
|
@@ -113,7 +113,7 @@ const q = {
|
|
|
113
113
|
appendTo: {
|
|
114
114
|
type: [HTMLElement, String],
|
|
115
115
|
default: "body",
|
|
116
|
-
validator: (e) =>
|
|
116
|
+
validator: (e) => w.includes(e) || e instanceof HTMLElement
|
|
117
117
|
},
|
|
118
118
|
/**
|
|
119
119
|
* The enter delay in milliseconds before the hovercard is shown.
|
|
@@ -121,7 +121,7 @@ const q = {
|
|
|
121
121
|
*/
|
|
122
122
|
enterDelay: {
|
|
123
123
|
type: Number,
|
|
124
|
-
default:
|
|
124
|
+
default: C
|
|
125
125
|
},
|
|
126
126
|
/**
|
|
127
127
|
* The leave delay in milliseconds before the hovercard is hidden.
|
|
@@ -129,7 +129,7 @@ const q = {
|
|
|
129
129
|
*/
|
|
130
130
|
leaveDelay: {
|
|
131
131
|
type: Number,
|
|
132
|
-
default:
|
|
132
|
+
default: C
|
|
133
133
|
},
|
|
134
134
|
/**
|
|
135
135
|
* External anchor element reference. Use this instead of the anchor slot when
|
|
@@ -149,49 +149,49 @@ const q = {
|
|
|
149
149
|
*/
|
|
150
150
|
"opened"
|
|
151
151
|
],
|
|
152
|
-
setup(e) {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
setup(e, { expose: c }) {
|
|
153
|
+
const a = e, l = n(a.open), d = n(!1), f = n(!1), m = n(null), v = n(null), p = n(null), u = n(null), O = n(null);
|
|
154
|
+
E(() => {
|
|
155
|
+
S(() => {
|
|
156
156
|
var t, r, o;
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
p.value = (o = (r = (t = O.value) == null ? void 0 : t.$refs) == null ? void 0 : r.anchor) == null ? void 0 : o.firstElementChild, u.value = new MutationObserver(() => {
|
|
158
|
+
p.value && !p.value.isConnected && (l.value = !1);
|
|
159
159
|
}), u.value.observe(document.body, {
|
|
160
160
|
childList: !0,
|
|
161
161
|
subtree: !0
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
|
-
}),
|
|
165
|
-
u.value && u.value.disconnect(), clearTimeout(
|
|
166
|
-
}),
|
|
164
|
+
}), A(() => {
|
|
165
|
+
u.value && u.value.disconnect(), clearTimeout(m), clearTimeout(v);
|
|
166
|
+
}), D(() => a.open, (t) => {
|
|
167
167
|
l.value = t;
|
|
168
|
-
}, { immediate: !0 });
|
|
169
|
-
function
|
|
170
|
-
|
|
168
|
+
}, { immediate: !0 }), c({ show: y, hide: h });
|
|
169
|
+
function T() {
|
|
170
|
+
a.open === null && (clearTimeout(v.value), m.value = setTimeout(() => {
|
|
171
171
|
l.value = !0;
|
|
172
|
-
},
|
|
172
|
+
}, a.enterDelay));
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
|
|
174
|
+
function g() {
|
|
175
|
+
a.open === null && (clearTimeout(m.value), v.value = setTimeout(() => {
|
|
176
176
|
l.value = !1;
|
|
177
|
-
},
|
|
178
|
-
}
|
|
179
|
-
function O() {
|
|
180
|
-
d.value = !0, y();
|
|
177
|
+
}, a.leaveDelay));
|
|
181
178
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
179
|
+
function y() {
|
|
180
|
+
f.value = !0, T();
|
|
184
181
|
}
|
|
185
|
-
function
|
|
186
|
-
|
|
182
|
+
function h() {
|
|
183
|
+
f.value = !1, !d.value && g();
|
|
187
184
|
}
|
|
188
185
|
function P() {
|
|
189
|
-
|
|
186
|
+
d.value = !0, T();
|
|
187
|
+
}
|
|
188
|
+
function b() {
|
|
189
|
+
d.value = !1, f.value || g();
|
|
190
190
|
}
|
|
191
|
-
return (t, r) => (
|
|
191
|
+
return (t, r) => (M(), L(k(F), {
|
|
192
192
|
id: e.id,
|
|
193
193
|
ref_key: "popover",
|
|
194
|
-
ref:
|
|
194
|
+
ref: O,
|
|
195
195
|
open: l.value,
|
|
196
196
|
placement: e.placement,
|
|
197
197
|
"content-class": e.contentClass,
|
|
@@ -210,18 +210,18 @@ const q = {
|
|
|
210
210
|
"enter-delay": e.enterDelay,
|
|
211
211
|
"leave-delay": e.leaveDelay,
|
|
212
212
|
onOpened: r[0] || (r[0] = (o) => t.$emit("opened", o)),
|
|
213
|
-
onMouseenterPopover:
|
|
214
|
-
onMouseleavePopover:
|
|
215
|
-
onMouseenterPopoverAnchor:
|
|
216
|
-
onMouseleavePopoverAnchor:
|
|
213
|
+
onMouseenterPopover: y,
|
|
214
|
+
onMouseleavePopover: h,
|
|
215
|
+
onMouseenterPopoverAnchor: y,
|
|
216
|
+
onMouseleavePopoverAnchor: h
|
|
217
217
|
}, {
|
|
218
218
|
anchor: s(({ attrs: o }) => [
|
|
219
|
-
i(t.$slots, "anchor",
|
|
219
|
+
i(t.$slots, "anchor", N($(o)))
|
|
220
220
|
]),
|
|
221
221
|
content: s(() => [
|
|
222
|
-
|
|
223
|
-
onFocusin:
|
|
224
|
-
onFocusout:
|
|
222
|
+
I("div", {
|
|
223
|
+
onFocusin: P,
|
|
224
|
+
onFocusout: b
|
|
225
225
|
}, [
|
|
226
226
|
i(t.$slots, "content")
|
|
227
227
|
], 32)
|
|
@@ -237,6 +237,6 @@ const q = {
|
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
export {
|
|
240
|
-
|
|
240
|
+
z as default
|
|
241
241
|
};
|
|
242
242
|
//# sourceMappingURL=hovercard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hovercard.js","sources":["../../../components/hovercard/hovercard.vue"],"sourcesContent":["<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-popover\n :id=\"id\"\n ref=\"popover\"\n :open=\"hovercardOpen\"\n :placement=\"placement\"\n :content-class=\"contentClass\"\n :dialog-class=\"dialogClass\"\n :fallback-placements=\"fallbackPlacements\"\n :padding=\"padding\"\n :transition=\"transition ? 'fade' : null\"\n :offset=\"offset\"\n :modal=\"false\"\n initial-focus-element=\"none\"\n :header-class=\"headerClass\"\n :footer-class=\"footerClass\"\n :append-to=\"appendTo\"\n :external-anchor-element=\"externalAnchorElement\"\n data-qa=\"dt-hovercard\"\n :enter-delay=\"enterDelay\"\n :leave-delay=\"leaveDelay\"\n @opened=\"(e) => ($emit('opened', e))\"\n @mouseenter-popover=\"onMouseEnter\"\n @mouseleave-popover=\"onMouseLeave\"\n @mouseenter-popover-anchor=\"onMouseEnter\"\n @mouseleave-popover-anchor=\"onMouseLeave\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the hovercard. Usually a button. -->\n <slot\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content>\n <div\n @focusin=\"onContentFocusIn\"\n @focusout=\"onContentFocusOut\"\n >\n <!-- @slot Slot for the content that is displayed in the hovercard. -->\n <slot name=\"content\" />\n </div>\n </template>\n <template #headerContent>\n <!-- @slot Slot for hovercard header content -->\n <slot name=\"headerContent\" />\n </template>\n\n <template #footerContent>\n <!-- @slot Slot for the footer content. -->\n <slot name=\"footerContent\" />\n </template>\n </dt-popover>\n</template>\n\n<script setup>\nimport { ref, watch, nextTick, onMounted, onBeforeUnmount } from 'vue';\nimport { POPOVER_APPEND_TO_VALUES, POPOVER_PADDING_CLASSES, DtPopover } from '@/components/popover/index.js';\nimport { TOOLTIP_DIRECTIONS, TOOLTIP_DELAY_MS } from '@/components/tooltip/index.js';\nimport { getUniqueString } from '@/common/utils';\n\nconst props = defineProps({\n /**\n * Fade transition when the content display is toggled.\n * @type boolean\n * @values true, false\n */\n transition: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls whether the hovercard is shown. Leaving this null will have the hovercard trigger on hover by default.\n * If you set this value, the default trigger behavior will be disabled, and you can control it as you need.\n * Supports .sync modifier\n * @values null, true, false\n */\n open: {\n type: Boolean,\n default: null,\n },\n\n /**\n * If the popover does not fit in the direction described by \"placement\",\n * it will attempt to change its direction to the \"fallbackPlacements\".\n * @see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements\"\n */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @see https://atomiks.github.io/tippyjs/v6/all-props/#placement\"\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'top-start',\n validator (placement) {\n return TOOLTIP_DIRECTIONS.includes(placement);\n },\n },\n\n /**\n * Padding size class for the popover content.\n * @values none, small, medium, large\n */\n padding: {\n type: String,\n default: 'large',\n validator: (padding) => {\n return Object.keys(POPOVER_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * @see https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The id of the tooltip\n */\n id: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * Additional class name for the header content wrapper element.\n */\n headerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the footer content wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * The enter delay in milliseconds before the hovercard is shown.\n * @type number\n */\n enterDelay: {\n type: Number,\n default: TOOLTIP_DELAY_MS,\n },\n\n /**\n * The leave delay in milliseconds before the hovercard is hidden.\n * @type number\n */\n leaveDelay: {\n type: Number,\n default: TOOLTIP_DELAY_MS,\n },\n\n /**\n * External anchor element reference. Use this instead of the anchor slot when\n * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.\n */\n externalAnchorElement: {\n type: HTMLElement,\n default: null,\n },\n});\n\ndefineEmits([\n /**\n * Emitted when hovercard is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n]);\n\nconst hovercardOpen = ref(props.open);\nconst contentFocused = ref(false);\nconst mouseOverHovercard = ref(false);\nconst inTimer = ref(null);\nconst outTimer = ref(null);\nconst anchorEl = ref(null);\nconst observer = ref(null);\nconst popover = ref(null);\n\nonMounted(() => {\n nextTick(() => {\n anchorEl.value = popover.value?.$refs?.anchor?.firstElementChild;\n\n observer.value = new MutationObserver(() => {\n if (anchorEl.value && !anchorEl.value.isConnected) {\n hovercardOpen.value = false;\n }\n });\n\n observer.value.observe(document.body, {\n childList: true,\n subtree: true,\n });\n });\n});\n\nonBeforeUnmount(() => {\n if (observer.value) {\n observer.value.disconnect();\n }\n clearTimeout(inTimer);\n clearTimeout(outTimer);\n});\nwatch(() => props.open, (open) => {\n hovercardOpen.value = open;\n}, { immediate: true });\n\nfunction setInTimer () {\n if (props.open === null) {\n clearTimeout(outTimer.value);\n inTimer.value = setTimeout(() => {\n hovercardOpen.value = true;\n }, props.enterDelay);\n }\n}\n\nfunction setOutTimer () {\n if (props.open === null) {\n clearTimeout(inTimer.value);\n outTimer.value = setTimeout(() => {\n hovercardOpen.value = false;\n }, props.leaveDelay);\n }\n}\n\nfunction onMouseEnter () {\n mouseOverHovercard.value = true;\n setInTimer();\n}\n\nfunction onMouseLeave () {\n mouseOverHovercard.value = false;\n if (contentFocused.value) {\n return;\n }\n setOutTimer();\n}\n\nfunction onContentFocusIn () {\n contentFocused.value = true;\n setInTimer();\n}\n\nfunction onContentFocusOut () {\n contentFocused.value = false;\n\n // If mouse is not over the hovercard, close it\n if (!mouseOverHovercard.value) {\n setOutTimer();\n }\n}\n</script>\n"],"names":["props","__props","hovercardOpen","ref","contentFocused","mouseOverHovercard","inTimer","outTimer","anchorEl","observer","popover","onMounted","nextTick","_c","_b","_a","onBeforeUnmount","watch","open","setInTimer","setOutTimer","onMouseEnter","onMouseLeave","onContentFocusIn","onContentFocusOut","_createBlock","_unref","DtPopover","_cache","e","$emit","_withCtx","attrs","_renderSlot","_ctx","_createElementVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,UAAMA,IAAQC,GAqKRC,IAAgBC,EAAIH,EAAM,IAAI,GAC9BI,IAAiBD,EAAI,EAAK,GAC1BE,IAAqBF,EAAI,EAAK,GAC9BG,IAAUH,EAAI,IAAI,GAClBI,IAAWJ,EAAI,IAAI,GACnBK,IAAWL,EAAI,IAAI,GACnBM,IAAWN,EAAI,IAAI,GACnBO,IAAUP,EAAI,IAAI;AAExB,IAAAQ,EAAU,MAAM;AACd,MAAAC,EAAS,MAAM;;AACb,QAAAJ,EAAS,SAAQK,KAAAC,KAAAC,IAAAL,EAAQ,UAAR,gBAAAK,EAAe,UAAf,gBAAAD,EAAsB,WAAtB,gBAAAD,EAA8B,mBAE/CJ,EAAS,QAAQ,IAAI,iBAAiB,MAAM;AAC1C,UAAID,EAAS,SAAS,CAACA,EAAS,MAAM,gBACpCN,EAAc,QAAQ;AAAA,QAE1B,CAAC,GAEDO,EAAS,MAAM,QAAQ,SAAS,MAAM;AAAA,UACpC,WAAW;AAAA,UACX,SAAS;AAAA,QACf,CAAK;AAAA,MACH,CAAC;AAAA,IACH,CAAC,GAEDO,EAAgB,MAAM;AACpB,MAAIP,EAAS,SACXA,EAAS,MAAM,WAAU,GAE3B,aAAaH,CAAO,GACpB,aAAaC,CAAQ;AAAA,IACvB,CAAC,GACDU,EAAM,MAAMjB,EAAM,MAAM,CAACkB,MAAS;AAChC,MAAAhB,EAAc,QAAQgB;AAAA,IACxB,GAAG,EAAE,WAAW,IAAM;AAEtB,aAASC,IAAc;AACrB,MAAInB,EAAM,SAAS,SACjB,aAAaO,EAAS,KAAK,GAC3BD,EAAQ,QAAQ,WAAW,MAAM;AAC/B,QAAAJ,EAAc,QAAQ;AAAA,MACxB,GAAGF,EAAM,UAAU;AAAA,IAEvB;AAEA,aAASoB,IAAe;AACtB,MAAIpB,EAAM,SAAS,SACjB,aAAaM,EAAQ,KAAK,GAC1BC,EAAS,QAAQ,WAAW,MAAM;AAChC,QAAAL,EAAc,QAAQ;AAAA,MACxB,GAAGF,EAAM,UAAU;AAAA,IAEvB;AAEA,aAASqB,IAAgB;AACvB,MAAAhB,EAAmB,QAAQ,IAC3Bc,EAAU;AAAA,IACZ;AAEA,aAASG,IAAgB;AAEvB,MADAjB,EAAmB,QAAQ,IACvB,CAAAD,EAAe,SAGnBgB,EAAW;AAAA,IACb;AAEA,aAASG,IAAoB;AAC3B,MAAAnB,EAAe,QAAQ,IACvBe,EAAU;AAAA,IACZ;AAEA,aAASK,IAAqB;AAC5B,MAAApB,EAAe,QAAQ,IAGlBC,EAAmB,SACtBe,EAAW;AAAA,IAEf;2BAjTEK,EAmDaC,EAAAC,CAAA,GAAA;AAAA,MAlDV,IAAI1B,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIS;AAAA,MACH,MAAMR,EAAA;AAAA,MACN,WAAWD,EAAA;AAAA,MACX,iBAAeA,EAAA;AAAA,MACf,gBAAcA,EAAA;AAAA,MACd,uBAAqBA,EAAA;AAAA,MACrB,SAASA,EAAA;AAAA,MACT,YAAYA,EAAA,aAAU,SAAA;AAAA,MACtB,QAAQA,EAAA;AAAA,MACR,OAAO;AAAA,MACR,yBAAsB;AAAA,MACrB,gBAAcA,EAAA;AAAA,MACd,gBAAcA,EAAA;AAAA,MACd,aAAWA,EAAA;AAAA,MACX,2BAAyBA,EAAA;AAAA,MAC1B,WAAQ;AAAA,MACP,eAAaA,EAAA;AAAA,MACb,eAAaA,EAAA;AAAA,MACb,UAAM2B,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAGC,MAAOC,EAAAA,gBAAgBD,CAAC;AAAA,MACjC,qBAAoBR;AAAA,MACpB,qBAAoBC;AAAA,MACpB,2BAA2BD;AAAA,MAC3B,2BAA2BC;AAAA;MAEjB,QAAMS,EAEf,CAGE,EALiB,OAAAC,QAAK;AAAA,QAExBC,EAGEC,wBADQF,CAAK,CAAA,CAAA;AAAA;MAGN,WACT,MAMM;AAAA,QANNG,EAMM,OAAA;AAAA,UALH,WAASZ;AAAA,UACT,YAAUC;AAAA;UAGXS,EAAuBC,EAAA,QAAA,SAAA;AAAA;;MAGhB,iBAET,MAA6B;AAAA,QAA7BD,EAA6BC,EAAA,QAAA,eAAA;AAAA;MAGpB,iBAET,MAA6B;AAAA,QAA7BD,EAA6BC,EAAA,QAAA,eAAA;AAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"hovercard.js","sources":["../../../components/hovercard/hovercard.vue"],"sourcesContent":["<!-- eslint-disable vue/multi-word-component-names -->\n<template>\n <dt-popover\n :id=\"id\"\n ref=\"popover\"\n :open=\"hovercardOpen\"\n :placement=\"placement\"\n :content-class=\"contentClass\"\n :dialog-class=\"dialogClass\"\n :fallback-placements=\"fallbackPlacements\"\n :padding=\"padding\"\n :transition=\"transition ? 'fade' : null\"\n :offset=\"offset\"\n :modal=\"false\"\n initial-focus-element=\"none\"\n :header-class=\"headerClass\"\n :footer-class=\"footerClass\"\n :append-to=\"appendTo\"\n :external-anchor-element=\"externalAnchorElement\"\n data-qa=\"dt-hovercard\"\n :enter-delay=\"enterDelay\"\n :leave-delay=\"leaveDelay\"\n @opened=\"(e) => ($emit('opened', e))\"\n @mouseenter-popover=\"onMouseEnter\"\n @mouseleave-popover=\"onMouseLeave\"\n @mouseenter-popover-anchor=\"onMouseEnter\"\n @mouseleave-popover-anchor=\"onMouseLeave\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the hovercard. Usually a button. -->\n <slot\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content>\n <div\n @focusin=\"onContentFocusIn\"\n @focusout=\"onContentFocusOut\"\n >\n <!-- @slot Slot for the content that is displayed in the hovercard. -->\n <slot name=\"content\" />\n </div>\n </template>\n <template #headerContent>\n <!-- @slot Slot for hovercard header content -->\n <slot name=\"headerContent\" />\n </template>\n\n <template #footerContent>\n <!-- @slot Slot for the footer content. -->\n <slot name=\"footerContent\" />\n </template>\n </dt-popover>\n</template>\n\n<script setup>\nimport { ref, watch, nextTick, onMounted, onBeforeUnmount } from 'vue';\nimport { POPOVER_APPEND_TO_VALUES, POPOVER_PADDING_CLASSES, DtPopover } from '@/components/popover/index.js';\nimport { TOOLTIP_DIRECTIONS, TOOLTIP_DELAY_MS } from '@/components/tooltip/index.js';\nimport { getUniqueString } from '@/common/utils';\n\nconst props = defineProps({\n /**\n * Fade transition when the content display is toggled.\n * @type boolean\n * @values true, false\n */\n transition: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls whether the hovercard is shown. Leaving this null will have the hovercard trigger on hover by default.\n * If you set this value, the default trigger behavior will be disabled, and you can control it as you need.\n * Supports .sync modifier\n * @values null, true, false\n */\n open: {\n type: Boolean,\n default: null,\n },\n\n /**\n * If the popover does not fit in the direction described by \"placement\",\n * it will attempt to change its direction to the \"fallbackPlacements\".\n * @see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements\"\n */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * @see https://atomiks.github.io/tippyjs/v6/all-props/#placement\"\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'top-start',\n validator (placement) {\n return TOOLTIP_DIRECTIONS.includes(placement);\n },\n },\n\n /**\n * Padding size class for the popover content.\n * @values none, small, medium, large\n */\n padding: {\n type: String,\n default: 'large',\n validator: (padding) => {\n return Object.keys(POPOVER_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Displaces the content box from its anchor element\n * by the specified number of pixels.\n * @see https://atomiks.github.io/tippyjs/v6/all-props/#offset\"\n */\n offset: {\n type: Array,\n default: () => [0, 16],\n },\n\n /**\n * The id of the tooltip\n */\n id: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * Additional class name for the header content wrapper element.\n */\n headerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the footer content wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element.\n */\n dialogClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class name for the content wrapper element.\n */\n contentClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', HTMLElement,\n */\n appendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * The enter delay in milliseconds before the hovercard is shown.\n * @type number\n */\n enterDelay: {\n type: Number,\n default: TOOLTIP_DELAY_MS,\n },\n\n /**\n * The leave delay in milliseconds before the hovercard is hidden.\n * @type number\n */\n leaveDelay: {\n type: Number,\n default: TOOLTIP_DELAY_MS,\n },\n\n /**\n * External anchor element reference. Use this instead of the anchor slot when\n * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.\n */\n externalAnchorElement: {\n type: HTMLElement,\n default: null,\n },\n});\n\ndefineEmits([\n /**\n * Emitted when hovercard is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n]);\n\nconst hovercardOpen = ref(props.open);\nconst contentFocused = ref(false);\nconst mouseOverHovercard = ref(false);\nconst inTimer = ref(null);\nconst outTimer = ref(null);\nconst anchorEl = ref(null);\nconst observer = ref(null);\nconst popover = ref(null);\n\nonMounted(() => {\n nextTick(() => {\n anchorEl.value = popover.value?.$refs?.anchor?.firstElementChild;\n\n observer.value = new MutationObserver(() => {\n if (anchorEl.value && !anchorEl.value.isConnected) {\n hovercardOpen.value = false;\n }\n });\n\n observer.value.observe(document.body, {\n childList: true,\n subtree: true,\n });\n });\n});\n\nonBeforeUnmount(() => {\n if (observer.value) {\n observer.value.disconnect();\n }\n clearTimeout(inTimer);\n clearTimeout(outTimer);\n});\nwatch(() => props.open, (open) => {\n hovercardOpen.value = open;\n}, { immediate: true });\n\ndefineExpose({ show: onMouseEnter, hide: onMouseLeave });\n\nfunction setInTimer () {\n if (props.open === null) {\n clearTimeout(outTimer.value);\n inTimer.value = setTimeout(() => {\n hovercardOpen.value = true;\n }, props.enterDelay);\n }\n}\n\nfunction setOutTimer () {\n if (props.open === null) {\n clearTimeout(inTimer.value);\n outTimer.value = setTimeout(() => {\n hovercardOpen.value = false;\n }, props.leaveDelay);\n }\n}\n\nfunction onMouseEnter () {\n mouseOverHovercard.value = true;\n setInTimer();\n}\n\nfunction onMouseLeave () {\n mouseOverHovercard.value = false;\n if (contentFocused.value) {\n return;\n }\n setOutTimer();\n}\n\nfunction onContentFocusIn () {\n contentFocused.value = true;\n setInTimer();\n}\n\nfunction onContentFocusOut () {\n contentFocused.value = false;\n\n // If mouse is not over the hovercard, close it\n if (!mouseOverHovercard.value) {\n setOutTimer();\n }\n}\n</script>\n"],"names":["props","__props","hovercardOpen","ref","contentFocused","mouseOverHovercard","inTimer","outTimer","anchorEl","observer","popover","onMounted","nextTick","_c","_b","_a","onBeforeUnmount","watch","open","__expose","onMouseEnter","onMouseLeave","setInTimer","setOutTimer","onContentFocusIn","onContentFocusOut","_createBlock","_unref","DtPopover","_cache","e","$emit","_withCtx","attrs","_renderSlot","_ctx","_createElementVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,UAAMA,IAAQC,GAqKRC,IAAgBC,EAAIH,EAAM,IAAI,GAC9BI,IAAiBD,EAAI,EAAK,GAC1BE,IAAqBF,EAAI,EAAK,GAC9BG,IAAUH,EAAI,IAAI,GAClBI,IAAWJ,EAAI,IAAI,GACnBK,IAAWL,EAAI,IAAI,GACnBM,IAAWN,EAAI,IAAI,GACnBO,IAAUP,EAAI,IAAI;AAExB,IAAAQ,EAAU,MAAM;AACd,MAAAC,EAAS,MAAM;;AACb,QAAAJ,EAAS,SAAQK,KAAAC,KAAAC,IAAAL,EAAQ,UAAR,gBAAAK,EAAe,UAAf,gBAAAD,EAAsB,WAAtB,gBAAAD,EAA8B,mBAE/CJ,EAAS,QAAQ,IAAI,iBAAiB,MAAM;AAC1C,UAAID,EAAS,SAAS,CAACA,EAAS,MAAM,gBACpCN,EAAc,QAAQ;AAAA,QAE1B,CAAC,GAEDO,EAAS,MAAM,QAAQ,SAAS,MAAM;AAAA,UACpC,WAAW;AAAA,UACX,SAAS;AAAA,QACf,CAAK;AAAA,MACH,CAAC;AAAA,IACH,CAAC,GAEDO,EAAgB,MAAM;AACpB,MAAIP,EAAS,SACXA,EAAS,MAAM,WAAU,GAE3B,aAAaH,CAAO,GACpB,aAAaC,CAAQ;AAAA,IACvB,CAAC,GACDU,EAAM,MAAMjB,EAAM,MAAM,CAACkB,MAAS;AAChC,MAAAhB,EAAc,QAAQgB;AAAA,IACxB,GAAG,EAAE,WAAW,IAAM,GAEtBC,EAAa,EAAE,MAAMC,GAAc,MAAMC,EAAY,CAAE;AAEvD,aAASC,IAAc;AACrB,MAAItB,EAAM,SAAS,SACjB,aAAaO,EAAS,KAAK,GAC3BD,EAAQ,QAAQ,WAAW,MAAM;AAC/B,QAAAJ,EAAc,QAAQ;AAAA,MACxB,GAAGF,EAAM,UAAU;AAAA,IAEvB;AAEA,aAASuB,IAAe;AACtB,MAAIvB,EAAM,SAAS,SACjB,aAAaM,EAAQ,KAAK,GAC1BC,EAAS,QAAQ,WAAW,MAAM;AAChC,QAAAL,EAAc,QAAQ;AAAA,MACxB,GAAGF,EAAM,UAAU;AAAA,IAEvB;AAEA,aAASoB,IAAgB;AACvB,MAAAf,EAAmB,QAAQ,IAC3BiB,EAAU;AAAA,IACZ;AAEA,aAASD,IAAgB;AAEvB,MADAhB,EAAmB,QAAQ,IACvB,CAAAD,EAAe,SAGnBmB,EAAW;AAAA,IACb;AAEA,aAASC,IAAoB;AAC3B,MAAApB,EAAe,QAAQ,IACvBkB,EAAU;AAAA,IACZ;AAEA,aAASG,IAAqB;AAC5B,MAAArB,EAAe,QAAQ,IAGlBC,EAAmB,SACtBkB,EAAW;AAAA,IAEf;2BAnTEG,EAmDaC,EAAAC,CAAA,GAAA;AAAA,MAlDV,IAAI3B,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIS;AAAA,MACH,MAAMR,EAAA;AAAA,MACN,WAAWD,EAAA;AAAA,MACX,iBAAeA,EAAA;AAAA,MACf,gBAAcA,EAAA;AAAA,MACd,uBAAqBA,EAAA;AAAA,MACrB,SAASA,EAAA;AAAA,MACT,YAAYA,EAAA,aAAU,SAAA;AAAA,MACtB,QAAQA,EAAA;AAAA,MACR,OAAO;AAAA,MACR,yBAAsB;AAAA,MACrB,gBAAcA,EAAA;AAAA,MACd,gBAAcA,EAAA;AAAA,MACd,aAAWA,EAAA;AAAA,MACX,2BAAyBA,EAAA;AAAA,MAC1B,WAAQ;AAAA,MACP,eAAaA,EAAA;AAAA,MACb,eAAaA,EAAA;AAAA,MACb,UAAM4B,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAGC,MAAOC,EAAAA,gBAAgBD,CAAC;AAAA,MACjC,qBAAoBV;AAAA,MACpB,qBAAoBC;AAAA,MACpB,2BAA2BD;AAAA,MAC3B,2BAA2BC;AAAA;MAEjB,QAAMW,EAEf,CAGE,EALiB,OAAAC,QAAK;AAAA,QAExBC,EAGEC,wBADQF,CAAK,CAAA,CAAA;AAAA;MAGN,WACT,MAMM;AAAA,QANNG,EAMM,OAAA;AAAA,UALH,WAASZ;AAAA,UACT,YAAUC;AAAA;UAGXS,EAAuBC,EAAA,QAAA,SAAA;AAAA;;MAGhB,iBAET,MAA6B;AAAA,QAA7BD,EAA6BC,EAAA,QAAA,eAAA;AAAA;MAGpB,iBAET,MAA6B;AAAA,QAA7BD,EAA6BC,EAAA,QAAA,eAAA;AAAA;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("../../node_modules/@tiptap/vue-3.cjs"),T=require("@tiptap/core"),j=require("@tiptap/pm/state"),_t=require("@tiptap/pm/tables"),a=require("vue"),Tt=require("@tiptap/extension-blockquote"),kt=require("@tiptap/extension-code-block"),Ct=require("@tiptap/extension-code"),Et=require("@tiptap/extension-document"),be=require("@tiptap/extensions"),Ot=require("@tiptap/extension-hard-break"),Ye=require("@tiptap/extension-paragraph"),St=require("@tiptap/extension-bold"),ve=require("@tiptap/extension-list"),Lt=require("@tiptap/extension-italic"),Dt=require("@tiptap/extension-link"),It=require("@tiptap/extension-strike"),At=require("@tiptap/extension-underline"),Bt=require("@tiptap/extension-text"),Rt=require("@tiptap/extension-text-align"),ce=require("@tiptap/extension-table"),Mt=require("@tiptap/extension-text-style"),Nt=require("@tiptap/suggestion"),Ge=require("regex-combined-emojis"),F=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),Je=require("../emoji/emoji.cjs"),ee=require("../../common/emoji/index.cjs"),Ht=require("../list-item/list-item.cjs"),ae=require("../stack/stack.cjs"),se=require("../../common/utils/index.cjs"),Vt=require("@tiptap/extension-image"),ke=require("@tiptap/extension-mention"),Ze=require("../link/link.cjs"),$t=require("@dialpad/dialtone-icons/vue3"),Qe=require("../../localization/index.cjs"),Pt=require("../input/input.cjs"),Ut=require("../popover/popover.cjs"),et=require("../button/button.cjs"),jt=require("../badge/badge.cjs"),de=require("./rich-text-editor-constants.cjs"),zt=require("../avatar/avatar.cjs"),qt=require("@dialpad/dialtone-icons/vue3/hash"),Ft=require("@dialpad/dialtone-icons/vue3/lock"),Kt=require("deep-equal"),tt=["top","right","bottom","left"],Re=["start","end"],Me=tt.reduce((e,t)=>e.concat(t,t+"-"+Re[0],t+"-"+Re[1]),[]),X=Math.min,A=Math.max,ue=Math.round,W=e=>({x:e,y:e}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function _e(e,t,o){return A(e,X(t,o))}function G(e,t){return typeof e=="function"?e(t):e}function $(e){return e.split("-")[0]}function U(e){return e.split("-")[1]}function nt(e){return e==="x"?"y":"x"}function Ce(e){return e==="y"?"height":"width"}const Yt=new Set(["top","bottom"]);function K(e){return Yt.has($(e))?"y":"x"}function Ee(e){return nt(K(e))}function ot(e,t,o){o===void 0&&(o=!1);const n=U(e),i=Ee(e),s=Ce(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=fe(r)),[r,fe(r)]}function Gt(e){const t=fe(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>Xt[t])}const Ne=["left","right"],He=["right","left"],Jt=["top","bottom"],Zt=["bottom","top"];function Qt(e,t,o){switch(e){case"top":case"bottom":return o?t?He:Ne:t?Ne:He;case"left":case"right":return t?Jt:Zt;default:return[]}}function en(e,t,o,n){const i=U(e);let s=Qt($(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(he)))),s}function fe(e){return e.replace(/left|right|bottom|top/g,t=>Wt[t])}function tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oe(e){return typeof e!="number"?tn(e):{top:e,right:e,bottom:e,left:e}}function ne(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Ve(e,t,o){let{reference:n,floating:i}=e;const s=K(t),r=Ee(t),l=Ce(r),c=$(t),h=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[l]/2-i[l]/2;let p;switch(c){case"top":p={x:u,y:n.y-i.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-i.width,y:d};break;default:p={x:n.x,y:n.y}}switch(U(t)){case"start":p[r]-=f*(o&&h?-1:1);break;case"end":p[r]+=f*(o&&h?-1:1);break}return p}async function nn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:l,strategy:c}=e,{boundary:h="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=G(t,e),m=Oe(p),w=l[f?d==="floating"?"reference":"floating":d],y=ne(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:h,rootBoundary:u,strategy:c})),v=d==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),_=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},C=ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-C.top+m.top)/_.y,bottom:(C.bottom-y.bottom+m.bottom)/_.y,left:(y.left-C.left+m.left)/_.x,right:(C.right-y.right+m.right)/_.x}}const on=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,l=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let h=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ve(h,n,c),f=n,p={},m=0;for(let w=0;w<l.length;w++){var g;const{name:y,fn:v}=l[w],{x,y:_,data:C,reset:k}=await v({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:h,platform:{...r,detectOverflow:(g=r.detectOverflow)!=null?g:nn},elements:{reference:e,floating:t}});u=x??u,d=_??d,p={...p,[y]:{...p[y],...C}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(h=k.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ve(h,f,c)),w=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},sn=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:l,middlewareData:c}=t,{element:h,padding:u=0}=G(e,t)||{};if(h==null)return{};const d=Oe(u),f={x:o,y:n},p=Ee(i),m=Ce(p),g=await r.getDimensions(h),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(h));let L=k?k[x]:0;(!L||!await(r.isElement==null?void 0:r.isElement(k)))&&(L=l.floating[x]||s.floating[m]);const H=_/2-C/2,D=L/2-g[m]/2-1,b=X(d[y],D),E=X(d[v],D),I=b,B=L-g[m]-E,O=L/2-g[m]/2+H,P=_e(I,O,B),V=!c.arrow&&U(i)!=null&&O!==P&&s.reference[m]/2-(O<I?b:E)-g[m]/2<0,R=V?O<I?O-I:O-B:0;return{[p]:f[p]+R,data:{[p]:P,centerOffset:O-P-R,...V&&{alignmentOffset:R}},reset:V}}});function rn(e,t,o){return(e?[...o.filter(i=>U(i)===e),...o.filter(i=>U(i)!==e)]:o.filter(i=>$(i)===i)).filter(i=>e?U(i)===e||(t?he(i)!==i:!1):!0)}const an=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var o,n,i;const{rects:s,middlewareData:r,placement:l,platform:c,elements:h}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=Me,autoAlignment:p=!0,...m}=G(e,t),g=d!==void 0||f===Me?rn(d||null,p,f):f,w=await c.detectOverflow(t,m),y=((o=r.autoPlacement)==null?void 0:o.index)||0,v=g[y];if(v==null)return{};const x=ot(v,s,await(c.isRTL==null?void 0:c.isRTL(h.floating)));if(l!==v)return{reset:{placement:g[0]}};const _=[w[$(v)],w[x[0]],w[x[1]]],C=[...((n=r.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:_}],k=g[y+1];if(k)return{data:{index:y+1,overflows:C},reset:{placement:k}};const L=C.map(b=>{const E=U(b.placement);return[b.placement,E&&u?b.overflows.slice(0,2).reduce((I,B)=>I+B,0):b.overflows[0],b.overflows]}).sort((b,E)=>b[1]-E[1]),D=((i=L.filter(b=>b[2].slice(0,U(b[0])?2:3).every(E=>E<=0))[0])==null?void 0:i[0])||L[0][0];return D!==l?{data:{index:y+1,overflows:C},reset:{placement:D}}:{}}}},ln=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:c,elements:h}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=G(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const y=$(i),v=K(l),x=$(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(h.floating)),C=f||(x||!g?[fe(l)]:Gt(l)),k=m!=="none";!f&&k&&C.push(...en(l,g,m,_));const L=[l,...C],H=await c.detectOverflow(t,w),D=[];let b=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&D.push(H[y]),d){const O=ot(i,r,_);D.push(H[O[0]],H[O[1]])}if(b=[...b,{placement:i,overflows:D}],!D.every(O=>O<=0)){var E,I;const O=(((E=s.flip)==null?void 0:E.index)||0)+1,P=L[O];if(P&&(!(d==="alignment"?v!==K(P):!1)||b.every(M=>K(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:O,overflows:b},reset:{placement:P}};let V=(I=b.filter(R=>R.overflows[0]<=0).sort((R,M)=>R.overflows[1]-M.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(p){case"bestFit":{var B;const R=(B=b.filter(M=>{if(k){const Z=K(M.placement);return Z===v||Z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Z=>Z>0).reduce((Z,xt)=>Z+xt,0)]).sort((M,Z)=>M[1]-Z[1])[0])==null?void 0:B[0];R&&(V=R);break}case"initialPlacement":V=l;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function $e(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return tt.some(t=>e[t]>=0)}const cn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=G(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=$e(r,o.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Pe(l)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),l=$e(r,o.floating);return{data:{escapedOffsets:l,escaped:Pe(l)}}}default:return{}}}}};function it(e){const t=X(...e.map(s=>s.left)),o=X(...e.map(s=>s.top)),n=A(...e.map(s=>s.right)),i=A(...e.map(s=>s.bottom));return{x:t,y:o,width:n-t,height:i-o}}function dn(e){const t=e.slice().sort((i,s)=>i.y-s.y),o=[];let n=null;for(let i=0;i<t.length;i++){const s=t[i];!n||s.y-n.y>n.height/2?o.push([s]):o[o.length-1].push(s),n=s}return o.map(i=>ne(it(i)))}const un=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:n,rects:i,platform:s,strategy:r}=t,{padding:l=2,x:c,y:h}=G(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=dn(u),f=ne(it(u)),p=Oe(l);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&h!=null)return d.find(w=>c>w.left-p.left&&c<w.right+p.right&&h>w.top-p.top&&h<w.bottom+p.bottom)||f;if(d.length>=2){if(K(o)==="y"){const b=d[0],E=d[d.length-1],I=$(o)==="top",B=b.top,O=E.bottom,P=I?b.left:E.left,V=I?b.right:E.right,R=V-P,M=O-B;return{top:B,bottom:O,left:P,right:V,width:R,height:M,x:P,y:B}}const w=$(o)==="left",y=A(...d.map(b=>b.right)),v=X(...d.map(b=>b.left)),x=d.filter(b=>w?b.left===v:b.right===y),_=x[0].top,C=x[x.length-1].bottom,k=v,L=y,H=L-k,D=C-_;return{top:_,bottom:C,left:k,right:L,width:H,height:D,x:k,y:_}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:r});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},hn=new Set(["left","top"]);async function fn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=$(o),l=U(o),c=K(o)==="y",h=hn.has(r)?-1:1,u=s&&c?-1:1,d=G(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*u,y:f*h}:{x:f*h,y:p*u}}const pn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:l}=t,c=await fn(t,e);return r===((o=l.offset)==null?void 0:o.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:r}}}}},mn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...h}=G(e,t),u={x:o,y:n},d=await s.detectOverflow(t,h),f=K($(i)),p=nt(f);let m=u[p],g=u[f];if(r){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+d[y],_=m-d[v];m=_e(x,m,_)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[y],_=g-d[v];g=_e(x,g,_)}const w=c.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-o,y:w.y-n,enabled:{[p]:r,[f]:l}}}}}},gn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:l}=t,{apply:c=()=>{},...h}=G(e,t),u=await r.detectOverflow(t,h),d=$(i),f=U(i),p=K(i)==="y",{width:m,height:g}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=f===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,w=f==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=m-u.left-u.right,_=X(g-u[w],v),C=X(m-u[y],x),k=!t.middlewareData.shift;let L=_,H=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(H=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(L=v),k&&!f){const b=A(u.left,0),E=A(u.right,0),I=A(u.top,0),B=A(u.bottom,0);p?H=m-2*(b!==0||E!==0?b+E:A(u.left,u.right)):L=g-2*(I!==0||B!==0?I+B:A(u.top,u.bottom))}await c({...t,availableWidth:H,availableHeight:L});const D=await r.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function pe(){return typeof window<"u"}function ie(e){return st(e)?(e.nodeName||"").toLowerCase():"#document"}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){var t;return(t=(st(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function st(e){return pe()?e instanceof Node||e instanceof N(e).Node:!1}function z(e){return pe()?e instanceof Element||e instanceof N(e).Element:!1}function Y(e){return pe()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ue(e){return!pe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}const wn=new Set(["inline","contents"]);function le(e){const{overflow:t,overflowX:o,overflowY:n,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+o)&&!wn.has(i)}const yn=new Set(["table","td","th"]);function bn(e){return yn.has(ie(e))}const vn=[":popover-open",":modal"];function me(e){return vn.some(t=>{try{return e.matches(t)}catch{return!1}})}const xn=["transform","translate","scale","rotate","perspective"],_n=["transform","translate","scale","rotate","perspective","filter"],Tn=["paint","layout","strict","content"];function Se(e){const t=Le(),o=z(e)?q(e):e;return xn.some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||_n.some(n=>(o.willChange||"").includes(n))||Tn.some(n=>(o.contain||"").includes(n))}function kn(e){let t=Q(e);for(;Y(t)&&!oe(t);){if(Se(t))return t;if(me(t))return null;t=Q(t)}return null}function Le(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Cn=new Set(["html","body","#document"]);function oe(e){return Cn.has(ie(e))}function q(e){return N(e).getComputedStyle(e)}function ge(e){return z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(ie(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ue(e)&&e.host||J(e);return Ue(t)?t.host:t}function rt(e){const t=Q(e);return oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&le(t)?t:rt(t)}function at(e,t,o){var n;t===void 0&&(t=[]);const i=rt(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),r=N(i);return s?t.concat(r,r.visualViewport||[],le(i)?i:[],[]):t.concat(i,at(i,[]))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lt(e){const t=q(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Y(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,l=ue(o)!==s||ue(n)!==r;return l&&(o=s,n=r),{width:o,height:n,$:l}}function ct(e){return z(e)?e:e.contextElement}function te(e){const t=ct(e);if(!Y(t))return W(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=lt(t);let r=(s?ue(o.width):o.width)/n,l=(s?ue(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const En=W(0);function dt(e){const t=N(e);return!Le()||!t.visualViewport?En:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function On(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==N(e)?!1:t}function re(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=ct(e);let r=W(1);t&&(n?z(n)&&(r=te(n)):r=te(e));const l=On(s,o,n)?dt(s):W(0);let c=(i.left+l.x)/r.x,h=(i.top+l.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s){const f=N(s),p=n&&z(n)?N(n):n;let m=f,g=je(m);for(;g&&n&&p!==m;){const w=te(g),y=g.getBoundingClientRect(),v=q(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,h*=w.y,u*=w.x,d*=w.y,c+=x,h+=_,m=N(g),g=je(m)}}return ne({width:u,height:d,x:c,y:h})}function we(e,t){const o=ge(e).scrollLeft;return t?t.left+o:re(J(e)).left+o}function ut(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-we(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function Sn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=J(n),l=t?me(t.floating):!1;if(n===r||l&&s)return o;let c={scrollLeft:0,scrollTop:0},h=W(1);const u=W(0),d=Y(n);if((d||!d&&!s)&&((ie(n)!=="body"||le(r))&&(c=ge(n)),Y(n))){const p=re(n);h=te(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const f=r&&!d&&!s?ut(r,c):W(0);return{width:o.width*h.x,height:o.height*h.y,x:o.x*h.x-c.scrollLeft*h.x+u.x+f.x,y:o.y*h.y-c.scrollTop*h.y+u.y+f.y}}function Ln(e){return Array.from(e.getClientRects())}function Dn(e){const t=J(e),o=ge(e),n=e.ownerDocument.body,i=A(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=A(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+we(e);const l=-o.scrollTop;return q(n).direction==="rtl"&&(r+=A(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:l}}const ze=25;function In(e,t){const o=N(e),n=J(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;const u=Le();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const h=we(n);if(h<=0){const u=n.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=ze&&(s-=m)}else h<=ze&&(s+=h);return{width:s,height:r,x:l,y:c}}const An=new Set(["absolute","fixed"]);function Bn(e,t){const o=re(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=Y(e)?te(e):W(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,h=n*s.y;return{width:r,height:l,x:c,y:h}}function qe(e,t,o){let n;if(t==="viewport")n=In(e,o);else if(t==="document")n=Dn(J(e));else if(z(t))n=Bn(t,o);else{const i=dt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ne(n)}function ht(e,t){const o=Q(e);return o===t||!z(o)||oe(o)?!1:q(o).position==="fixed"||ht(o,t)}function Rn(e,t){const o=t.get(e);if(o)return o;let n=at(e,[]).filter(l=>z(l)&&ie(l)!=="body"),i=null;const s=q(e).position==="fixed";let r=s?Q(e):e;for(;z(r)&&!oe(r);){const l=q(r),c=Se(r);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&An.has(i.position)||le(r)&&!c&&ht(e,r))?n=n.filter(u=>u!==r):i=l,r=Q(r)}return t.set(e,n),n}function Mn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?me(t)?[]:Rn(t,this._c):[].concat(o),n],l=r[0],c=r.reduce((h,u)=>{const d=qe(t,u,i);return h.top=A(d.top,h.top),h.right=X(d.right,h.right),h.bottom=X(d.bottom,h.bottom),h.left=A(d.left,h.left),h},qe(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nn(e){const{width:t,height:o}=lt(e);return{width:t,height:o}}function Hn(e,t,o){const n=Y(t),i=J(t),s=o==="fixed",r=re(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=W(0);function h(){c.x=we(i)}if(n||!n&&!s)if((ie(t)!=="body"||le(i))&&(l=ge(t)),n){const p=re(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&h();s&&!n&&i&&h();const u=i&&!n&&!s?ut(i,l):W(0),d=r.left+l.scrollLeft-c.x-u.x,f=r.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:r.width,height:r.height}}function xe(e){return q(e).position==="static"}function Fe(e,t){if(!Y(e)||q(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return J(e)===o&&(o=o.ownerDocument.body),o}function ft(e,t){const o=N(e);if(me(e))return o;if(!Y(e)){let i=Q(e);for(;i&&!oe(i);){if(z(i)&&!xe(i))return i;i=Q(i)}return o}let n=Fe(e,t);for(;n&&bn(n)&&xe(n);)n=Fe(n,t);return n&&oe(n)&&xe(n)&&!Se(n)?o:n||kn(e)||o}const Vn=async function(e){const t=this.getOffsetParent||ft,o=this.getDimensions,n=await o(e.floating);return{reference:Hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function $n(e){return q(e).direction==="rtl"}const Pn={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:J,getClippingRect:Mn,getOffsetParent:ft,getElementRects:Vn,getClientRects:Ln,getDimensions:Nn,getScale:te,isElement:z,isRTL:$n},De=pn,pt=an,Ie=mn,Ae=ln,mt=gn,gt=cn,wt=sn,yt=un,Be=(e,t,o)=>{const n=new Map,i={platform:Pn,...o},s={...i.platform,_c:n};return on(e,t,{...i,platform:s})};function Un(e,t){const o=Math.min(e.top,t.top),n=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),r=Math.max(e.right,t.right)-i,l=n-o,c=i,h=o;return new DOMRect(c,h,r,l)}var jn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:r,getReferencedVirtualElement:l,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:f,to:p})=>{const{doc:m,selection:g}=d,{empty:w}=g,y=!m.textBetween(f,p).length&&T.isTextSelection(d.selection),v=this.element.contains(document.activeElement);return!(!(u.hasFocus()||v)||w||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const f=!(d!=null&&d.selection.eq(u.state.selection)),p=!(d!=null&&d.doc.eq(u.state.doc));!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,f,p,d)},this.updateDelay))},this.updateHandler=(u,d,f,p)=>{const{composing:m}=u;if(m||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var h;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(h=c==null?void 0:c.scrollTarget)!=null?h:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Ae(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,o;const{selection:n}=this.editor.state,i=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(i)return i;if(!((o=(t=this.view)==null?void 0:t.dom)!=null&&o.parentNode))return;const s=T.posToDOMRect(this.view,n.from,n.to);let r={getBoundingClientRect:()=>s,getClientRects:()=>[s]};if(n instanceof j.NodeSelection){let l=this.view.nodeDOM(n.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof _t.CellSelection){const{$anchorCell:l,$headCell:c}=n,h=l?l.pos:c.pos,u=c?c.pos:l.pos,d=this.view.nodeDOM(h),f=this.view.nodeDOM(u);if(!d||!f)return;const p=d===f?d.getBoundingClientRect():Un(d.getBoundingClientRect(),f.getBoundingClientRect());r={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return r}updatePosition(){const e=this.virtualElement;e&&Be(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:o,strategy:n,middlewareData:i})=>{var s,r;if((s=i.hide)!=null&&s.referenceHidden||(r=i.hide)!=null&&r.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:o}=e,n=o.selection.from!==o.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:e,from:s,to:r}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},zn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new jn({view:t,...e})}),qn=a.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{editor:i,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}=e,f=n.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),a.nextTick(()=>{i.registerPlugin(zn({editor:i,element:f,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}))}))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}}),Fn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,options:s,appendTo:r,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:d}=u,{$anchor:f,empty:p}=d,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!h.hasFocus()||!p||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,d,f)=>{const{composing:p}=h;if(p||!u&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta("floatingMenu");u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"&&this.updateOptions(u.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var c;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(c=s==null?void 0:s.scrollTarget)!=null?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Ae(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:o,oldState:e,from:s,to:r})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to);Be({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s,middlewareData:r})=>{var l,c;if((l=r.hide)!=null&&l.referenceHidden||(c=r.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const o=!(t!=null&&t.selection.eq(e.state.selection)),n=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,n,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Kn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Fn({view:t,...e})});a.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:i,editor:s,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u}=e,d=n.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),s.registerPlugin(Kn({pluginKey:i,editor:s,element:d,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u})))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}});const Wn={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtEmoji:Je.default},props:S.nodeViewProps};function Xn(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:a.withCtx(()=>[a.createVNode(r,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const Yn=F._(Wn,[["render",Xn]]),Gn={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:Ht.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},Jn={class:"d-popover__dialog d-suggestion-list__container"},Zn={ref:"suggestionList",class:"d-suggestion-list"};function Qn(e,t,o,n,i,s){const r=a.resolveComponent("dt-list-item");return a.openBlock(),a.createElementBlock("div",Jn,[a.withDirectives(a.createElementVNode("ul",Zn,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.items,(l,c)=>(a.openBlock(),a.createBlock(r,{key:l.id,class:a.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":c===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:h=>s.selectItem(c),onKeydown:a.withModifiers(s.onKeyDown,["prevent"])},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[a.vShow,o.items.length]])])}const eo=F._(Gn,[["render",Qn]]),bt="top-start",vt="650";function to(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function Ke(e){return{getBoundingClientRect:e}}async function no(e,t,o={}){if(!e||!(t!=null&&t.getBoundingClientRect))return;const{placement:n=bt,middleware:i=[De(0),Ae(),Ie({padding:8})]}=o,{x:s,y:r}=await Be(t,e,{placement:n,middleware:i});Object.assign(e.style,{left:`${s}px`,top:`${r}px`})}function oo(e,t={}){const{zIndex:o=vt}=t;e.style.position="absolute",e.style.zIndex=o,e.style.display="none"}function io(e){e&&(e.style.display="block")}function so(e){e&&(e.style.display="none")}function ro(e,t){return o=>{o.key==="Escape"&&t()&&e()}}function ao(e){document.addEventListener("keydown",e)}function lo(e){document.removeEventListener("keydown",e)}function co(e,t,o,n){return new S.VueRenderer(e,{props:{itemComponent:a.markRaw(t),itemType:o,...n},editor:n.editor})}function uo(e){var t,o;e.escHandler&&lo(e.escHandler),(t=e.floatingEl)==null||t.remove(),(o=e.component)==null||o.destroy()}function ye(e,t,o={}){const{listComponent:n=eo,placement:i=bt,zIndex:s=vt}=o;return()=>{let r=null,l=null,c=!1,h=to(),u=null;function d(){no(l,h,{placement:i})}function f(){l&&(io(l),c=!0,d())}function p(){l&&(so(l),c=!1)}return{onStart:m=>{r=co(n,e,t,m),m.clientRect&&(l=r.element,oo(l,{zIndex:s}),document.body.appendChild(l),h=Ke(m.clientRect),u=ro(p,()=>c),ao(u),m.items.length>0&&f())},onUpdate(m){r==null||r.updateProps(m),m.items.length>0?f():p(),m.clientRect&&(h=Ke(m.clientRect),d())},onKeyDown(m){var g;if(c)return(g=r==null?void 0:r.ref)==null?void 0:g.onKeyDown(m)},onExit(){uo({escHandler:u,floatingEl:l,component:r}),u=null,l=null,r=null}}}}const ho={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:Je.default,DtStack:ae.default},props:{item:{type:Object,required:!0}}};function fo(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{size:"200",code:o.item.code},null,8,["code"]),a.createTextVNode(" "+a.toDisplayString(o.item.code),1)]),_:1})}const po=F._(ho,[["render",fo]]),mo=20,go=(e,t,o)=>{var l,c;const n=(l=e.shortname)==null?void 0:l.replaceAll(":",""),i=(c=t.shortname)==null?void 0:c.replaceAll(":",""),s=n.startsWith(o),r=i.startsWith(o);return s&&!r?-1:!s&&r?1:n.localeCompare(i)},wo={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(ee.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var i;return[n.name,(i=n.shortname)==null?void 0:i.replaceAll(":",""),...n.keywords||[]].some(s=>s&&s.startsWith(e))}).splice(0,mo).sort((n,i)=>go(n,i,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:o})=>{var s,r;const n=e.view.state.selection.$to.nodeAfter;((s=n==null?void 0:n.text)==null?void 0:s.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:o}]).run(),(r=window.getSelection())==null||r.collapseToEnd()},render:ye(po,"emoji")},yo=/(:\w+:)$/,bo=new RegExp(Ge.emojiPattern+"$"),vo=e=>{if(e&&ee.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},xo=e=>[...e.matchAll(ee.emojiShortCodeRegex)].filter(o=>ee.codeToEmojiData(o[0])).map(o=>({index:o.index,text:o[0],match:o})),_o=T.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return S.VueNodeViewRenderer(Yn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return ee.stringToUnicode(ee.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new T.InputRule({find:e=>{const t=e.match(yo)||e.match(bo);if(t)return vo(t)},handler:({state:e,range:t,match:o})=>{const{tr:n}=e,i=t.from,s=t.to;n.replaceWith(i,s,this.type.create({code:o[0]}))}})]},addPasteRules(){return[T.nodePasteRule({find:xo,type:this.type,getAttributes(e){return{code:e[0]}}}),T.nodePasteRule({find:ee.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[Nt({char:":",pluginKey:new j.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...wo})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=!1;const{selection:n}=t,{empty:i,anchor:s}=n;return i?(t.doc.nodesBetween(s-1,s,(r,l)=>{if(r.type.name===this.name)return o=!0,e.insertText("",l,l+r.nodeSize),!1}),o):!1})}}});function To(e,t,o=()=>!0){const n=[];t.lastIndex=0;let i;for(;i=t.exec(e);)o(e,i)&&n.push(i);return n}function ko(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Co(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function Eo(e,t){const o=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const i=e.slice(o);return{text:i,from:o,to:o+i.length}}return{text:e.slice(o,n+t),from:o,to:n+t}}function Te(e,t,o,n){const i=Eo(e,t);if(n.lastIndex=0,!n.test(i.text))return i;const s=o==="left"?i.from-1:i.to+1;return s<=0||s>=e.length||s===t?i:Te(e,s,o,n)}function Oo(e,t,o,n){const i=Math.max(e.from-1,0),s=Math.min(e.to+1,t.content.size),r=T.getMarksBetween(i,s,t);for(const l of r)l.mark.type===n&&o.removeMark(l.from,l.to,n)}const We=se.getPhoneNumberRegex(1,15);function Xe(e,t,o,n,i,s){if(!e)return;let r=o-t-1;r=r<0?0:r;const l=n-t,c=Te(e,r,"left",We),h=Te(e,l,"right",We),u=e.slice(c.from,h.to);To(u,se.linkRegex,ko).forEach(f=>{const p=Co(f[0]),m=t+c.from+f.index+1,g=m+p.length;i.addMark(m,g,s.create())})}function So(e){let t=!1;return new j.Plugin({key:new j.PluginKey("autolink"),appendTransaction:(o,n,i)=>{const s=o.some(u=>u.docChanged)&&!n.doc.eq(i.doc);if(t&&!s)return;const{tr:r}=i,{textContent:l}=i.doc;t||Xe(l,0,0,l.length,r,e.type),t=!0;const c=T.combineTransactionSteps(n.doc,[...o]);return T.getChangedRanges(c).forEach(({oldRange:u,newRange:d})=>{Oo(d,i.doc,r,e.type),T.findChildrenInRange(i.doc,d,p=>p.isTextblock).forEach(({node:p,pos:m})=>{Xe(p.textContent,m,u.from,d.to,r,e.type)})}),r}})}const Lo={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Do=T.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",T.mergeAttributes(this.options.HTMLAttributes,e,Lo)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[So({type:this.type})]}}),Io=Vt.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ao=Ye.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",T.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Bo={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default},props:S.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit("mention-click",this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit("mention-hover",{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit("mention-leave",{...this.getMentionData(),event:e})}}};function Ro(e,t,o,n,i,s){const r=a.resolveComponent("dt-link"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(r,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"]),onMouseenter:s.handleMouseEnter,onMouseleave:s.handleMouseLeave,onFocusin:s.handleMouseEnter,onFocusout:s.handleMouseLeave},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1},8,["onClick","onMouseenter","onMouseleave","onFocusin","onFocusout"])]),_:1})}const Mo=F._(Bo,[["render",Ro]]),No=ke.extend({addNodeView(){return S.VueNodeViewRenderer(Mo)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new j.PluginKey("mentionSuggestion")}}),Ho={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default,DtIconLock:$t.DtIconLock,DtStack:ae.default},props:S.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Vo(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-lock"),l=a.resolveComponent("dt-stack"),c=a.resolveComponent("dt-link"),h=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(h,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(c,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"])},{default:a.withCtx(()=>[a.createVNode(l,{direction:"row",gap:"0"},{default:a.withCtx(()=>[e.$props.node.attrs.locked?(a.openBlock(),a.createBlock(r,{key:0,size:"200"})):a.createCommentVNode("",!0),a.createElementVNode("span",null,a.toDisplayString(s.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const $o=F._(Ho,[["render",Vo]]),Po=ke.extend({name:"channel",addNodeView(){return S.VueNodeViewRenderer($o)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new j.PluginKey("channelSuggestion")}}),Uo={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:S.NodeViewWrapper},props:{...S.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var o,n,i;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(i=(n=(o=this.editor)==null?void 0:o.storage)==null?void 0:n["slash-commands"])==null?void 0:i.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function jo(e,t,o,n,i,s){const r=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(r,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1})}const zo=F._(Uo,[["render",jo]]),qo=(e,t)=>[...e.matchAll(t)].map(n=>{let i=n[2];return i.endsWith(" ")||(i+=" "),{index:n.index,text:i,match:n}}),Fo=ke.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return S.VueNodeViewRenderer(zo)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return["command-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[T.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[T.nodePasteRule({find:n=>qo(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new j.PluginKey("slashCommandSuggestion")}}),Ko=100,Wo={name:"VariableComponent",components:{DtBadge:jt.default,DtButton:et.default,DtPopover:Ut.default,DtInput:Pt.default,NodeViewWrapper:S.NodeViewWrapper},props:S.nodeViewProps,data(){return{i18n:new Qe.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:Ko}},computed:{altText:{get(){var e,t;return((t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.altText)||""},set(e){this.updateAttributes({altText:e})}},variableId(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.id},placeholder(){var e;return((e=this.variableData)==null?void 0:e.placeholder)||""},variableItems(){var e,t;return((t=(e=this.extension)==null?void 0:e.options)==null?void 0:t.variableItems)||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function Xo(e,t,o,n,i,s){const r=a.resolveComponent("dt-badge"),l=a.resolveComponent("dt-button"),c=a.resolveComponent("dt-input"),h=a.resolveComponent("dt-popover"),u=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(u,{class:"d-d-inline-block"},{default:a.withCtx(()=>[s.enableAltText?(a.openBlock(),a.createBlock(h,{key:0,padding:"small","navigation-type":"arrow-keys",placement:"top-start",modal:!1},{anchor:a.withCtx(({attrs:d})=>[a.createVNode(l,a.mergeProps(d,{kind:"unstyled"}),{default:a.withCtx(()=>[a.createVNode(r,{text:s.badgeLabel,contenteditable:"false"},null,8,["text"])]),_:1},16)]),content:a.withCtx(({close:d})=>[a.createVNode(c,{modelValue:s.altText,"onUpdate:modelValue":t[0]||(t[0]=f=>s.altText=f),"root-class":"d-p8 d-w332",label:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),placeholder:s.placeholderText,validate:{length:{description:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),message:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:a.withKeys(f=>d(),["enter"])},null,8,["modelValue","label","placeholder","validate","onKeyup"])]),_:1})):(a.openBlock(),a.createBlock(r,{key:1,text:s.badgeLabel,contenteditable:"false"},null,8,["text"]))]),_:1})}const Yo=F._(Wo,[["render",Xo]]),Go=T.Node.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return S.VueNodeViewRenderer(Yo)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-variable-id"),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:"",parseHTML:e=>e.getAttribute("data-alt-text"),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute("data-enable-alt-text")==="true",renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:"variable"}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return["variable",T.mergeAttributes(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||"",enableAltText:e.enableAltText}})}}}),Jo={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:zt.default,DtStack:ae.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}},Zo={class:"d-mention-suggestion__name"},Qo={key:1,class:"d-mention-suggestion__divider"},ei={key:2,class:"d-mention-suggestion__status"};function ti(e,t,o,n,i,s){const r=a.resolveComponent("dt-avatar"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,"show-presence":s.showDetails,presence:s.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),a.createVNode(l,{class:"d-mention-suggestion__details-container",gap:"100"},{default:a.withCtx(()=>[a.createElementVNode("span",Zo,a.toDisplayString(s.name),1),s.showDetails?(a.openBlock(),a.createBlock(l,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:a.withCtx(()=>[s.presenceText?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["d-mention-suggestion__presence",[s.presenceFontColorClass]])},a.toDisplayString(s.presenceText),3)):a.createCommentVNode("",!0),s.status&&s.presenceText?(a.openBlock(),a.createElementBlock("div",Qo," • ")):a.createCommentVNode("",!0),s.status?(a.openBlock(),a.createElementBlock("div",ei,a.toDisplayString(s.status),1)):a.createCommentVNode("",!0)]),_:1})):a.createCommentVNode("",!0)]),_:1})]),_:1})}const ni=F._(Jo,[["render",ti]]),oi={allowSpaces:!0,render:ye(ni,"mention")},ii={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:ae.default,DtIconHash:qt,DtIconLock:Ft},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function si(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-hash"),l=a.resolveComponent("dt-icon-lock"),c=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(c,{direction:"row",gap:"400"},{default:a.withCtx(()=>[o.item.locked?(a.openBlock(),a.createBlock(l,{key:1,size:"300"})):(a.openBlock(),a.createBlock(r,{key:0,size:"300"})),a.createElementVNode("span",null,a.toDisplayString(s.name),1)]),_:1})}const ri=F._(ii,[["render",si]]),ai={allowSpaces:!0,render:ye(ri,"channel")},li={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},ci={class:"d-body--md-compact"},di={key:0},ui={class:"d-body--sm d-fc-tertiary"};function hi(e,t,o,n,i,s){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",ci,[a.createElementVNode("span",null,"/"+a.toDisplayString(s.command),1),s.parametersExample?(a.openBlock(),a.createElementBlock("span",di,a.toDisplayString(s.parametersExample),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",ui,a.toDisplayString(s.description),1)])}const fi=F._(li,[["render",hi]]),pi={allowSpaces:!0,startOfLine:!0,render:ye(fi,"slash-command")},mi={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:S.EditorContent,BubbleMenu:qn,DtButton:et.default,DtStack:ae.default},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?de.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return de.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowImageResize:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","mention-hover","mention-leave","channel-click"],data(){return{editor:null,appendTo:()=>{var e;return(e=se.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},floatingOptions:{placement:"top-start"},i18n:new Qe.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const o={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n),variable:n=>this.processVariableNode(n)}[e.type];return o?o(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("../../node_modules/@tiptap/vue-3.cjs"),T=require("@tiptap/core"),j=require("@tiptap/pm/state"),_t=require("@tiptap/pm/tables"),a=require("vue"),Tt=require("@tiptap/extension-blockquote"),kt=require("@tiptap/extension-code-block"),Ct=require("@tiptap/extension-code"),Et=require("@tiptap/extension-document"),be=require("@tiptap/extensions"),Ot=require("@tiptap/extension-hard-break"),Ye=require("@tiptap/extension-paragraph"),St=require("@tiptap/extension-bold"),ve=require("@tiptap/extension-list"),Lt=require("@tiptap/extension-italic"),Dt=require("@tiptap/extension-link"),It=require("@tiptap/extension-strike"),At=require("@tiptap/extension-underline"),Bt=require("@tiptap/extension-text"),Rt=require("@tiptap/extension-text-align"),ce=require("@tiptap/extension-table"),Mt=require("@tiptap/extension-text-style"),Nt=require("@tiptap/suggestion"),Ge=require("regex-combined-emojis"),F=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),Je=require("../emoji/emoji.cjs"),ee=require("../../common/emoji/index.cjs"),Ht=require("../list-item/list-item.cjs"),ae=require("../stack/stack.cjs"),se=require("../../common/utils/index.cjs"),Vt=require("@tiptap/extension-image"),ke=require("@tiptap/extension-mention"),Ze=require("../link/link.cjs"),$t=require("@dialpad/dialtone-icons/vue3"),Qe=require("../../localization/index.cjs"),Pt=require("../input/input.cjs"),Ut=require("../popover/popover.cjs"),et=require("../button/button.cjs"),jt=require("../badge/badge.cjs"),de=require("./rich-text-editor-constants.cjs"),zt=require("../avatar/avatar.cjs"),qt=require("@dialpad/dialtone-icons/vue3/hash"),Ft=require("@dialpad/dialtone-icons/vue3/lock"),Kt=require("deep-equal"),tt=["top","right","bottom","left"],Re=["start","end"],Me=tt.reduce((e,t)=>e.concat(t,t+"-"+Re[0],t+"-"+Re[1]),[]),X=Math.min,A=Math.max,ue=Math.round,W=e=>({x:e,y:e}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function _e(e,t,o){return A(e,X(t,o))}function G(e,t){return typeof e=="function"?e(t):e}function $(e){return e.split("-")[0]}function U(e){return e.split("-")[1]}function nt(e){return e==="x"?"y":"x"}function Ce(e){return e==="y"?"height":"width"}const Yt=new Set(["top","bottom"]);function K(e){return Yt.has($(e))?"y":"x"}function Ee(e){return nt(K(e))}function ot(e,t,o){o===void 0&&(o=!1);const n=U(e),i=Ee(e),s=Ce(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=fe(r)),[r,fe(r)]}function Gt(e){const t=fe(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>Xt[t])}const Ne=["left","right"],He=["right","left"],Jt=["top","bottom"],Zt=["bottom","top"];function Qt(e,t,o){switch(e){case"top":case"bottom":return o?t?He:Ne:t?Ne:He;case"left":case"right":return t?Jt:Zt;default:return[]}}function en(e,t,o,n){const i=U(e);let s=Qt($(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(he)))),s}function fe(e){return e.replace(/left|right|bottom|top/g,t=>Wt[t])}function tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oe(e){return typeof e!="number"?tn(e):{top:e,right:e,bottom:e,left:e}}function ne(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Ve(e,t,o){let{reference:n,floating:i}=e;const s=K(t),r=Ee(t),l=Ce(r),c=$(t),h=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[l]/2-i[l]/2;let p;switch(c){case"top":p={x:u,y:n.y-i.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-i.width,y:d};break;default:p={x:n.x,y:n.y}}switch(U(t)){case"start":p[r]-=f*(o&&h?-1:1);break;case"end":p[r]+=f*(o&&h?-1:1);break}return p}async function nn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:l,strategy:c}=e,{boundary:h="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=G(t,e),m=Oe(p),w=l[f?d==="floating"?"reference":"floating":d],y=ne(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:h,rootBoundary:u,strategy:c})),v=d==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),_=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},C=ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-C.top+m.top)/_.y,bottom:(C.bottom-y.bottom+m.bottom)/_.y,left:(y.left-C.left+m.left)/_.x,right:(C.right-y.right+m.right)/_.x}}const on=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,l=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let h=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ve(h,n,c),f=n,p={},m=0;for(let w=0;w<l.length;w++){var g;const{name:y,fn:v}=l[w],{x,y:_,data:C,reset:k}=await v({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:h,platform:{...r,detectOverflow:(g=r.detectOverflow)!=null?g:nn},elements:{reference:e,floating:t}});u=x??u,d=_??d,p={...p,[y]:{...p[y],...C}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(h=k.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ve(h,f,c)),w=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},sn=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:l,middlewareData:c}=t,{element:h,padding:u=0}=G(e,t)||{};if(h==null)return{};const d=Oe(u),f={x:o,y:n},p=Ee(i),m=Ce(p),g=await r.getDimensions(h),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(h));let L=k?k[x]:0;(!L||!await(r.isElement==null?void 0:r.isElement(k)))&&(L=l.floating[x]||s.floating[m]);const H=_/2-C/2,D=L/2-g[m]/2-1,b=X(d[y],D),E=X(d[v],D),I=b,B=L-g[m]-E,O=L/2-g[m]/2+H,P=_e(I,O,B),V=!c.arrow&&U(i)!=null&&O!==P&&s.reference[m]/2-(O<I?b:E)-g[m]/2<0,R=V?O<I?O-I:O-B:0;return{[p]:f[p]+R,data:{[p]:P,centerOffset:O-P-R,...V&&{alignmentOffset:R}},reset:V}}});function rn(e,t,o){return(e?[...o.filter(i=>U(i)===e),...o.filter(i=>U(i)!==e)]:o.filter(i=>$(i)===i)).filter(i=>e?U(i)===e||(t?he(i)!==i:!1):!0)}const an=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var o,n,i;const{rects:s,middlewareData:r,placement:l,platform:c,elements:h}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=Me,autoAlignment:p=!0,...m}=G(e,t),g=d!==void 0||f===Me?rn(d||null,p,f):f,w=await c.detectOverflow(t,m),y=((o=r.autoPlacement)==null?void 0:o.index)||0,v=g[y];if(v==null)return{};const x=ot(v,s,await(c.isRTL==null?void 0:c.isRTL(h.floating)));if(l!==v)return{reset:{placement:g[0]}};const _=[w[$(v)],w[x[0]],w[x[1]]],C=[...((n=r.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:_}],k=g[y+1];if(k)return{data:{index:y+1,overflows:C},reset:{placement:k}};const L=C.map(b=>{const E=U(b.placement);return[b.placement,E&&u?b.overflows.slice(0,2).reduce((I,B)=>I+B,0):b.overflows[0],b.overflows]}).sort((b,E)=>b[1]-E[1]),D=((i=L.filter(b=>b[2].slice(0,U(b[0])?2:3).every(E=>E<=0))[0])==null?void 0:i[0])||L[0][0];return D!==l?{data:{index:y+1,overflows:C},reset:{placement:D}}:{}}}},ln=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:c,elements:h}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=G(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const y=$(i),v=K(l),x=$(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(h.floating)),C=f||(x||!g?[fe(l)]:Gt(l)),k=m!=="none";!f&&k&&C.push(...en(l,g,m,_));const L=[l,...C],H=await c.detectOverflow(t,w),D=[];let b=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&D.push(H[y]),d){const O=ot(i,r,_);D.push(H[O[0]],H[O[1]])}if(b=[...b,{placement:i,overflows:D}],!D.every(O=>O<=0)){var E,I;const O=(((E=s.flip)==null?void 0:E.index)||0)+1,P=L[O];if(P&&(!(d==="alignment"?v!==K(P):!1)||b.every(M=>K(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:O,overflows:b},reset:{placement:P}};let V=(I=b.filter(R=>R.overflows[0]<=0).sort((R,M)=>R.overflows[1]-M.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(p){case"bestFit":{var B;const R=(B=b.filter(M=>{if(k){const Z=K(M.placement);return Z===v||Z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Z=>Z>0).reduce((Z,xt)=>Z+xt,0)]).sort((M,Z)=>M[1]-Z[1])[0])==null?void 0:B[0];R&&(V=R);break}case"initialPlacement":V=l;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function $e(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return tt.some(t=>e[t]>=0)}const cn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=G(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=$e(r,o.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Pe(l)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),l=$e(r,o.floating);return{data:{escapedOffsets:l,escaped:Pe(l)}}}default:return{}}}}};function it(e){const t=X(...e.map(s=>s.left)),o=X(...e.map(s=>s.top)),n=A(...e.map(s=>s.right)),i=A(...e.map(s=>s.bottom));return{x:t,y:o,width:n-t,height:i-o}}function dn(e){const t=e.slice().sort((i,s)=>i.y-s.y),o=[];let n=null;for(let i=0;i<t.length;i++){const s=t[i];!n||s.y-n.y>n.height/2?o.push([s]):o[o.length-1].push(s),n=s}return o.map(i=>ne(it(i)))}const un=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:n,rects:i,platform:s,strategy:r}=t,{padding:l=2,x:c,y:h}=G(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=dn(u),f=ne(it(u)),p=Oe(l);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&h!=null)return d.find(w=>c>w.left-p.left&&c<w.right+p.right&&h>w.top-p.top&&h<w.bottom+p.bottom)||f;if(d.length>=2){if(K(o)==="y"){const b=d[0],E=d[d.length-1],I=$(o)==="top",B=b.top,O=E.bottom,P=I?b.left:E.left,V=I?b.right:E.right,R=V-P,M=O-B;return{top:B,bottom:O,left:P,right:V,width:R,height:M,x:P,y:B}}const w=$(o)==="left",y=A(...d.map(b=>b.right)),v=X(...d.map(b=>b.left)),x=d.filter(b=>w?b.left===v:b.right===y),_=x[0].top,C=x[x.length-1].bottom,k=v,L=y,H=L-k,D=C-_;return{top:_,bottom:C,left:k,right:L,width:H,height:D,x:k,y:_}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:r});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},hn=new Set(["left","top"]);async function fn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=$(o),l=U(o),c=K(o)==="y",h=hn.has(r)?-1:1,u=s&&c?-1:1,d=G(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*u,y:f*h}:{x:f*h,y:p*u}}const pn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:l}=t,c=await fn(t,e);return r===((o=l.offset)==null?void 0:o.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:r}}}}},mn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...h}=G(e,t),u={x:o,y:n},d=await s.detectOverflow(t,h),f=K($(i)),p=nt(f);let m=u[p],g=u[f];if(r){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+d[y],_=m-d[v];m=_e(x,m,_)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[y],_=g-d[v];g=_e(x,g,_)}const w=c.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-o,y:w.y-n,enabled:{[p]:r,[f]:l}}}}}},gn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:l}=t,{apply:c=()=>{},...h}=G(e,t),u=await r.detectOverflow(t,h),d=$(i),f=U(i),p=K(i)==="y",{width:m,height:g}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=f===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,w=f==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=m-u.left-u.right,_=X(g-u[w],v),C=X(m-u[y],x),k=!t.middlewareData.shift;let L=_,H=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(H=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(L=v),k&&!f){const b=A(u.left,0),E=A(u.right,0),I=A(u.top,0),B=A(u.bottom,0);p?H=m-2*(b!==0||E!==0?b+E:A(u.left,u.right)):L=g-2*(I!==0||B!==0?I+B:A(u.top,u.bottom))}await c({...t,availableWidth:H,availableHeight:L});const D=await r.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function pe(){return typeof window<"u"}function ie(e){return st(e)?(e.nodeName||"").toLowerCase():"#document"}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){var t;return(t=(st(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function st(e){return pe()?e instanceof Node||e instanceof N(e).Node:!1}function z(e){return pe()?e instanceof Element||e instanceof N(e).Element:!1}function Y(e){return pe()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ue(e){return!pe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}const wn=new Set(["inline","contents"]);function le(e){const{overflow:t,overflowX:o,overflowY:n,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+o)&&!wn.has(i)}const yn=new Set(["table","td","th"]);function bn(e){return yn.has(ie(e))}const vn=[":popover-open",":modal"];function me(e){return vn.some(t=>{try{return e.matches(t)}catch{return!1}})}const xn=["transform","translate","scale","rotate","perspective"],_n=["transform","translate","scale","rotate","perspective","filter"],Tn=["paint","layout","strict","content"];function Se(e){const t=Le(),o=z(e)?q(e):e;return xn.some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||_n.some(n=>(o.willChange||"").includes(n))||Tn.some(n=>(o.contain||"").includes(n))}function kn(e){let t=Q(e);for(;Y(t)&&!oe(t);){if(Se(t))return t;if(me(t))return null;t=Q(t)}return null}function Le(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Cn=new Set(["html","body","#document"]);function oe(e){return Cn.has(ie(e))}function q(e){return N(e).getComputedStyle(e)}function ge(e){return z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(ie(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ue(e)&&e.host||J(e);return Ue(t)?t.host:t}function rt(e){const t=Q(e);return oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&le(t)?t:rt(t)}function at(e,t,o){var n;t===void 0&&(t=[]);const i=rt(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),r=N(i);return s?t.concat(r,r.visualViewport||[],le(i)?i:[],[]):t.concat(i,at(i,[]))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lt(e){const t=q(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Y(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,l=ue(o)!==s||ue(n)!==r;return l&&(o=s,n=r),{width:o,height:n,$:l}}function ct(e){return z(e)?e:e.contextElement}function te(e){const t=ct(e);if(!Y(t))return W(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=lt(t);let r=(s?ue(o.width):o.width)/n,l=(s?ue(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const En=W(0);function dt(e){const t=N(e);return!Le()||!t.visualViewport?En:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function On(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==N(e)?!1:t}function re(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=ct(e);let r=W(1);t&&(n?z(n)&&(r=te(n)):r=te(e));const l=On(s,o,n)?dt(s):W(0);let c=(i.left+l.x)/r.x,h=(i.top+l.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s){const f=N(s),p=n&&z(n)?N(n):n;let m=f,g=je(m);for(;g&&n&&p!==m;){const w=te(g),y=g.getBoundingClientRect(),v=q(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,h*=w.y,u*=w.x,d*=w.y,c+=x,h+=_,m=N(g),g=je(m)}}return ne({width:u,height:d,x:c,y:h})}function we(e,t){const o=ge(e).scrollLeft;return t?t.left+o:re(J(e)).left+o}function ut(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-we(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function Sn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=J(n),l=t?me(t.floating):!1;if(n===r||l&&s)return o;let c={scrollLeft:0,scrollTop:0},h=W(1);const u=W(0),d=Y(n);if((d||!d&&!s)&&((ie(n)!=="body"||le(r))&&(c=ge(n)),Y(n))){const p=re(n);h=te(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const f=r&&!d&&!s?ut(r,c):W(0);return{width:o.width*h.x,height:o.height*h.y,x:o.x*h.x-c.scrollLeft*h.x+u.x+f.x,y:o.y*h.y-c.scrollTop*h.y+u.y+f.y}}function Ln(e){return Array.from(e.getClientRects())}function Dn(e){const t=J(e),o=ge(e),n=e.ownerDocument.body,i=A(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=A(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+we(e);const l=-o.scrollTop;return q(n).direction==="rtl"&&(r+=A(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:l}}const ze=25;function In(e,t){const o=N(e),n=J(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;const u=Le();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const h=we(n);if(h<=0){const u=n.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=ze&&(s-=m)}else h<=ze&&(s+=h);return{width:s,height:r,x:l,y:c}}const An=new Set(["absolute","fixed"]);function Bn(e,t){const o=re(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=Y(e)?te(e):W(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,h=n*s.y;return{width:r,height:l,x:c,y:h}}function qe(e,t,o){let n;if(t==="viewport")n=In(e,o);else if(t==="document")n=Dn(J(e));else if(z(t))n=Bn(t,o);else{const i=dt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ne(n)}function ht(e,t){const o=Q(e);return o===t||!z(o)||oe(o)?!1:q(o).position==="fixed"||ht(o,t)}function Rn(e,t){const o=t.get(e);if(o)return o;let n=at(e,[]).filter(l=>z(l)&&ie(l)!=="body"),i=null;const s=q(e).position==="fixed";let r=s?Q(e):e;for(;z(r)&&!oe(r);){const l=q(r),c=Se(r);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&An.has(i.position)||le(r)&&!c&&ht(e,r))?n=n.filter(u=>u!==r):i=l,r=Q(r)}return t.set(e,n),n}function Mn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?me(t)?[]:Rn(t,this._c):[].concat(o),n],l=r[0],c=r.reduce((h,u)=>{const d=qe(t,u,i);return h.top=A(d.top,h.top),h.right=X(d.right,h.right),h.bottom=X(d.bottom,h.bottom),h.left=A(d.left,h.left),h},qe(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nn(e){const{width:t,height:o}=lt(e);return{width:t,height:o}}function Hn(e,t,o){const n=Y(t),i=J(t),s=o==="fixed",r=re(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=W(0);function h(){c.x=we(i)}if(n||!n&&!s)if((ie(t)!=="body"||le(i))&&(l=ge(t)),n){const p=re(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&h();s&&!n&&i&&h();const u=i&&!n&&!s?ut(i,l):W(0),d=r.left+l.scrollLeft-c.x-u.x,f=r.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:r.width,height:r.height}}function xe(e){return q(e).position==="static"}function Fe(e,t){if(!Y(e)||q(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return J(e)===o&&(o=o.ownerDocument.body),o}function ft(e,t){const o=N(e);if(me(e))return o;if(!Y(e)){let i=Q(e);for(;i&&!oe(i);){if(z(i)&&!xe(i))return i;i=Q(i)}return o}let n=Fe(e,t);for(;n&&bn(n)&&xe(n);)n=Fe(n,t);return n&&oe(n)&&xe(n)&&!Se(n)?o:n||kn(e)||o}const Vn=async function(e){const t=this.getOffsetParent||ft,o=this.getDimensions,n=await o(e.floating);return{reference:Hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function $n(e){return q(e).direction==="rtl"}const Pn={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:J,getClippingRect:Mn,getOffsetParent:ft,getElementRects:Vn,getClientRects:Ln,getDimensions:Nn,getScale:te,isElement:z,isRTL:$n},De=pn,pt=an,Ie=mn,Ae=ln,mt=gn,gt=cn,wt=sn,yt=un,Be=(e,t,o)=>{const n=new Map,i={platform:Pn,...o},s={...i.platform,_c:n};return on(e,t,{...i,platform:s})};function Un(e,t){const o=Math.min(e.top,t.top),n=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),r=Math.max(e.right,t.right)-i,l=n-o,c=i,h=o;return new DOMRect(c,h,r,l)}var jn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:r,getReferencedVirtualElement:l,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:f,to:p})=>{const{doc:m,selection:g}=d,{empty:w}=g,y=!m.textBetween(f,p).length&&T.isTextSelection(d.selection),v=this.element.contains(document.activeElement);return!(!(u.hasFocus()||v)||w||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const f=!(d!=null&&d.selection.eq(u.state.selection)),p=!(d!=null&&d.doc.eq(u.state.doc));!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,f,p,d)},this.updateDelay))},this.updateHandler=(u,d,f,p)=>{const{composing:m}=u;if(m||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var h;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(h=c==null?void 0:c.scrollTarget)!=null?h:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Ae(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,o;const{selection:n}=this.editor.state,i=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(i)return i;if(!((o=(t=this.view)==null?void 0:t.dom)!=null&&o.parentNode))return;const s=T.posToDOMRect(this.view,n.from,n.to);let r={getBoundingClientRect:()=>s,getClientRects:()=>[s]};if(n instanceof j.NodeSelection){let l=this.view.nodeDOM(n.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof _t.CellSelection){const{$anchorCell:l,$headCell:c}=n,h=l?l.pos:c.pos,u=c?c.pos:l.pos,d=this.view.nodeDOM(h),f=this.view.nodeDOM(u);if(!d||!f)return;const p=d===f?d.getBoundingClientRect():Un(d.getBoundingClientRect(),f.getBoundingClientRect());r={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return r}updatePosition(){const e=this.virtualElement;e&&Be(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:o,strategy:n,middlewareData:i})=>{var s,r;if((s=i.hide)!=null&&s.referenceHidden||(r=i.hide)!=null&&r.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:o}=e,n=o.selection.from!==o.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:e,from:s,to:r}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},zn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new jn({view:t,...e})}),qn=a.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{editor:i,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}=e,f=n.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),a.nextTick(()=>{i.registerPlugin(zn({editor:i,element:f,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}))}))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}}),Fn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,options:s,appendTo:r,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:d}=u,{$anchor:f,empty:p}=d,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!h.hasFocus()||!p||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,d,f)=>{const{composing:p}=h;if(p||!u&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta("floatingMenu");u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"&&this.updateOptions(u.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var c;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(c=s==null?void 0:s.scrollTarget)!=null?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Ae(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:o,oldState:e,from:s,to:r})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to);Be({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s,middlewareData:r})=>{var l,c;if((l=r.hide)!=null&&l.referenceHidden||(c=r.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const o=!(t!=null&&t.selection.eq(e.state.selection)),n=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,n,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Kn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Fn({view:t,...e})});a.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:i,editor:s,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u}=e,d=n.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),s.registerPlugin(Kn({pluginKey:i,editor:s,element:d,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u})))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}});const Wn={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtEmoji:Je.default},props:S.nodeViewProps};function Xn(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:a.withCtx(()=>[a.createVNode(r,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const Yn=F._(Wn,[["render",Xn]]),Gn={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:Ht.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},Jn={class:"d-popover__dialog d-suggestion-list__container"},Zn={ref:"suggestionList",class:"d-suggestion-list"};function Qn(e,t,o,n,i,s){const r=a.resolveComponent("dt-list-item");return a.openBlock(),a.createElementBlock("div",Jn,[a.withDirectives(a.createElementVNode("ul",Zn,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.items,(l,c)=>(a.openBlock(),a.createBlock(r,{key:l.id,class:a.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":c===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:h=>s.selectItem(c),onKeydown:a.withModifiers(s.onKeyDown,["prevent"])},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[a.vShow,o.items.length]])])}const eo=F._(Gn,[["render",Qn]]),bt="top-start",vt="650";function to(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function Ke(e){return{getBoundingClientRect:e}}async function no(e,t,o={}){if(!e||!(t!=null&&t.getBoundingClientRect))return;const{placement:n=bt,middleware:i=[De(0),Ae(),Ie({padding:8})]}=o,{x:s,y:r}=await Be(t,e,{placement:n,middleware:i});Object.assign(e.style,{left:`${s}px`,top:`${r}px`})}function oo(e,t={}){const{zIndex:o=vt}=t;e.style.position="absolute",e.style.zIndex=o,e.style.display="none"}function io(e){e&&(e.style.display="block")}function so(e){e&&(e.style.display="none")}function ro(e,t){return o=>{o.key==="Escape"&&t()&&e()}}function ao(e){document.addEventListener("keydown",e)}function lo(e){document.removeEventListener("keydown",e)}function co(e,t,o,n){return new S.VueRenderer(e,{props:{itemComponent:a.markRaw(t),itemType:o,...n},editor:n.editor})}function uo(e){var t,o;e.escHandler&&lo(e.escHandler),(t=e.floatingEl)==null||t.remove(),(o=e.component)==null||o.destroy()}function ye(e,t,o={}){const{listComponent:n=eo,placement:i=bt,zIndex:s=vt}=o;return()=>{let r=null,l=null,c=!1,h=to(),u=null;function d(){no(l,h,{placement:i})}function f(){l&&(io(l),c=!0,d())}function p(){l&&(so(l),c=!1)}return{onStart:m=>{r=co(n,e,t,m),m.clientRect&&(l=r.element,oo(l,{zIndex:s}),document.body.appendChild(l),h=Ke(m.clientRect),u=ro(p,()=>c),ao(u),m.items.length>0&&f())},onUpdate(m){r==null||r.updateProps(m),m.items.length>0?f():p(),m.clientRect&&(h=Ke(m.clientRect),d())},onKeyDown(m){var g;if(c)return(g=r==null?void 0:r.ref)==null?void 0:g.onKeyDown(m)},onExit(){uo({escHandler:u,floatingEl:l,component:r}),u=null,l=null,r=null}}}}const ho={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:Je.default,DtStack:ae.default},props:{item:{type:Object,required:!0}}};function fo(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{size:"200",code:o.item.code},null,8,["code"]),a.createTextVNode(" "+a.toDisplayString(o.item.code),1)]),_:1})}const po=F._(ho,[["render",fo]]),mo=20,go=(e,t,o)=>{var l,c;const n=(l=e.shortname)==null?void 0:l.replaceAll(":",""),i=(c=t.shortname)==null?void 0:c.replaceAll(":",""),s=n.startsWith(o),r=i.startsWith(o);return s&&!r?-1:!s&&r?1:n.localeCompare(i)},wo={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(ee.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var i;return[n.name,(i=n.shortname)==null?void 0:i.replaceAll(":",""),...n.keywords||[]].some(s=>s&&s.startsWith(e))}).splice(0,mo).sort((n,i)=>go(n,i,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:o})=>{var s,r;const n=e.view.state.selection.$to.nodeAfter;((s=n==null?void 0:n.text)==null?void 0:s.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:o}]).run(),(r=window.getSelection())==null||r.collapseToEnd()},render:ye(po,"emoji")},yo=/(:\w+:)$/,bo=new RegExp(Ge.emojiPattern+"$"),vo=e=>{if(e&&ee.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},xo=e=>[...e.matchAll(ee.emojiShortCodeRegex)].filter(o=>ee.codeToEmojiData(o[0])).map(o=>({index:o.index,text:o[0],match:o})),_o=T.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return S.VueNodeViewRenderer(Yn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return ee.stringToUnicode(ee.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new T.InputRule({find:e=>{const t=e.match(yo)||e.match(bo);if(t)return vo(t)},handler:({state:e,range:t,match:o})=>{const{tr:n}=e,i=t.from,s=t.to;n.replaceWith(i,s,this.type.create({code:o[0]}))}})]},addPasteRules(){return[T.nodePasteRule({find:xo,type:this.type,getAttributes(e){return{code:e[0]}}}),T.nodePasteRule({find:ee.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[Nt({char:":",pluginKey:new j.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...wo})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=!1;const{selection:n}=t,{empty:i,anchor:s}=n;return i?(t.doc.nodesBetween(s-1,s,(r,l)=>{if(r.type.name===this.name)return o=!0,e.insertText("",l,l+r.nodeSize),!1}),o):!1})}}});function To(e,t,o=()=>!0){const n=[];t.lastIndex=0;let i;for(;i=t.exec(e);)o(e,i)&&n.push(i);return n}function ko(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Co(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function Eo(e,t){const o=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const i=e.slice(o);return{text:i,from:o,to:o+i.length}}return{text:e.slice(o,n+t),from:o,to:n+t}}function Te(e,t,o,n){const i=Eo(e,t);if(n.lastIndex=0,!n.test(i.text))return i;const s=o==="left"?i.from-1:i.to+1;return s<=0||s>=e.length||s===t?i:Te(e,s,o,n)}function Oo(e,t,o,n){const i=Math.max(e.from-1,0),s=Math.min(e.to+1,t.content.size),r=T.getMarksBetween(i,s,t);for(const l of r)l.mark.type===n&&o.removeMark(l.from,l.to,n)}const We=se.getPhoneNumberRegex(1,15);function Xe(e,t,o,n,i,s){if(!e)return;let r=o-t-1;r=r<0?0:r;const l=n-t,c=Te(e,r,"left",We),h=Te(e,l,"right",We),u=e.slice(c.from,h.to);To(u,se.linkRegex,ko).forEach(f=>{const p=Co(f[0]),m=t+c.from+f.index+1,g=m+p.length;i.addMark(m,g,s.create())})}function So(e){let t=!1;return new j.Plugin({key:new j.PluginKey("autolink"),appendTransaction:(o,n,i)=>{const s=o.some(u=>u.docChanged)&&!n.doc.eq(i.doc);if(t&&!s)return;const{tr:r}=i,{textContent:l}=i.doc;t||Xe(l,0,0,l.length,r,e.type),t=!0;const c=T.combineTransactionSteps(n.doc,[...o]);return T.getChangedRanges(c).forEach(({oldRange:u,newRange:d})=>{Oo(d,i.doc,r,e.type),T.findChildrenInRange(i.doc,d,p=>p.isTextblock).forEach(({node:p,pos:m})=>{Xe(p.textContent,m,u.from,d.to,r,e.type)})}),r}})}const Lo={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Do=T.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",T.mergeAttributes(this.options.HTMLAttributes,e,Lo)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[So({type:this.type})]}}),Io=Vt.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ao=Ye.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",T.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Bo={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default},props:S.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit("mention-click",this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit("mention-hover",{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit("mention-leave",{...this.getMentionData(),event:e})}}};function Ro(e,t,o,n,i,s){const r=a.resolveComponent("dt-link"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(r,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"]),onMouseenter:s.handleMouseEnter,onMouseleave:s.handleMouseLeave,onFocusin:s.handleMouseEnter,onFocusout:s.handleMouseLeave},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1},8,["onClick","onMouseenter","onMouseleave","onFocusin","onFocusout"])]),_:1})}const Mo=F._(Bo,[["render",Ro]]),No=ke.extend({addNodeView(){return S.VueNodeViewRenderer(Mo)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new j.PluginKey("mentionSuggestion")}}),Ho={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default,DtIconLock:$t.DtIconLock,DtStack:ae.default},props:S.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Vo(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-lock"),l=a.resolveComponent("dt-stack"),c=a.resolveComponent("dt-link"),h=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(h,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(c,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"])},{default:a.withCtx(()=>[a.createVNode(l,{direction:"row",gap:"0"},{default:a.withCtx(()=>[e.$props.node.attrs.locked?(a.openBlock(),a.createBlock(r,{key:0,size:"200"})):a.createCommentVNode("",!0),a.createElementVNode("span",null,a.toDisplayString(s.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const $o=F._(Ho,[["render",Vo]]),Po=ke.extend({name:"channel",addNodeView(){return S.VueNodeViewRenderer($o)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new j.PluginKey("channelSuggestion")}}),Uo={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:S.NodeViewWrapper},props:{...S.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var o,n,i;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(i=(n=(o=this.editor)==null?void 0:o.storage)==null?void 0:n["slash-commands"])==null?void 0:i.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function jo(e,t,o,n,i,s){const r=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(r,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1})}const zo=F._(Uo,[["render",jo]]),qo=(e,t)=>[...e.matchAll(t)].map(n=>{let i=n[2];return i.endsWith(" ")||(i+=" "),{index:n.index,text:i,match:n}}),Fo=ke.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return S.VueNodeViewRenderer(zo)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return["command-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[T.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[T.nodePasteRule({find:n=>qo(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new j.PluginKey("slashCommandSuggestion")}}),Ko=100,Wo={name:"VariableComponent",components:{DtBadge:jt.default,DtButton:et.default,DtPopover:Ut.default,DtInput:Pt.default,NodeViewWrapper:S.NodeViewWrapper},props:S.nodeViewProps,data(){return{i18n:new Qe.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:Ko}},computed:{altText:{get(){var e,t;return((t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.altText)||""},set(e){this.updateAttributes({altText:e})}},variableId(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.id},placeholder(){var e;return((e=this.variableData)==null?void 0:e.placeholder)||""},variableItems(){var e,t;return((t=(e=this.extension)==null?void 0:e.options)==null?void 0:t.variableItems)||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function Xo(e,t,o,n,i,s){const r=a.resolveComponent("dt-badge"),l=a.resolveComponent("dt-button"),c=a.resolveComponent("dt-input"),h=a.resolveComponent("dt-popover"),u=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(u,{class:"d-d-inline-block"},{default:a.withCtx(()=>[s.enableAltText?(a.openBlock(),a.createBlock(h,{key:0,padding:"small","navigation-type":"arrow-keys",placement:"top-start",modal:!1},{anchor:a.withCtx(({attrs:d})=>[a.createVNode(l,a.mergeProps(d,{kind:"unstyled"}),{default:a.withCtx(()=>[a.createVNode(r,{text:s.badgeLabel,contenteditable:"false"},null,8,["text"])]),_:1},16)]),content:a.withCtx(({close:d})=>[a.createVNode(c,{modelValue:s.altText,"onUpdate:modelValue":t[0]||(t[0]=f=>s.altText=f),"root-class":"d-p8 d-w332",label:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),placeholder:s.placeholderText,validate:{length:{description:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),message:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:a.withKeys(f=>d(),["enter"])},null,8,["modelValue","label","placeholder","validate","onKeyup"])]),_:1})):(a.openBlock(),a.createBlock(r,{key:1,text:s.badgeLabel,contenteditable:"false"},null,8,["text"]))]),_:1})}const Yo=F._(Wo,[["render",Xo]]),Go=T.Node.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return S.VueNodeViewRenderer(Yo)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-variable-id"),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:"",parseHTML:e=>e.getAttribute("data-alt-text"),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute("data-enable-alt-text")==="true",renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:"variable"}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return["variable",T.mergeAttributes(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||"",enableAltText:e.enableAltText}})}}}),Jo={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:zt.default,DtStack:ae.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}},Zo={class:"d-mention-suggestion__name"},Qo={key:1,class:"d-mention-suggestion__divider"},ei={key:2,class:"d-mention-suggestion__status"};function ti(e,t,o,n,i,s){const r=a.resolveComponent("dt-avatar"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,"show-presence":s.showDetails,presence:s.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),a.createVNode(l,{class:"d-mention-suggestion__details-container",gap:"100"},{default:a.withCtx(()=>[a.createElementVNode("span",Zo,a.toDisplayString(s.name),1),s.showDetails?(a.openBlock(),a.createBlock(l,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:a.withCtx(()=>[s.presenceText?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["d-mention-suggestion__presence",[s.presenceFontColorClass]])},a.toDisplayString(s.presenceText),3)):a.createCommentVNode("",!0),s.status&&s.presenceText?(a.openBlock(),a.createElementBlock("div",Qo," • ")):a.createCommentVNode("",!0),s.status?(a.openBlock(),a.createElementBlock("div",ei,a.toDisplayString(s.status),1)):a.createCommentVNode("",!0)]),_:1})):a.createCommentVNode("",!0)]),_:1})]),_:1})}const ni=F._(Jo,[["render",ti]]),oi={allowSpaces:!0,render:ye(ni,"mention")},ii={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:ae.default,DtIconHash:qt,DtIconLock:Ft},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function si(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-hash"),l=a.resolveComponent("dt-icon-lock"),c=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(c,{direction:"row",gap:"400"},{default:a.withCtx(()=>[o.item.locked?(a.openBlock(),a.createBlock(l,{key:1,size:"300"})):(a.openBlock(),a.createBlock(r,{key:0,size:"300"})),a.createElementVNode("span",null,a.toDisplayString(s.name),1)]),_:1})}const ri=F._(ii,[["render",si]]),ai={allowSpaces:!0,render:ye(ri,"channel")},li={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},ci={class:"d-body--md-compact"},di={key:0},ui={class:"d-body--sm d-fc-tertiary"};function hi(e,t,o,n,i,s){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",ci,[a.createElementVNode("span",null,"/"+a.toDisplayString(s.command),1),s.parametersExample?(a.openBlock(),a.createElementBlock("span",di,a.toDisplayString(s.parametersExample),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",ui,a.toDisplayString(s.description),1)])}const fi=F._(li,[["render",hi]]),pi={allowSpaces:!0,startOfLine:!0,render:ye(fi,"slash-command")},mi={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:S.EditorContent,BubbleMenu:qn,DtButton:et.default,DtStack:ae.default},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?de.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return de.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},preserveWhitespace:{type:[Boolean,String],default:"full"},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowImageResize:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","mention-hover","mention-leave","channel-click"],data(){return{editor:null,appendTo:()=>{var e;return(e=se.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},floatingOptions:{placement:"top-start"},i18n:new Qe.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const o={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n),variable:n=>this.processVariableNode(n)}[e.type];return o?o(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
|
|
2
2
|
`:`
|
|
3
3
|
`},processTextNode(e){let t=e.text||"";return e.marks&&(t=this.applyMarks(t,e.marks)),t},processHardBreakNode(){return`
|
|
4
4
|
`},processBlockquoteNode(e){return this.processNodeContent(e).split(`
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
${this.processNodeContent(e)}
|
|
10
10
|
\`\`\``},processMentionNode(e){var i,s,r;const t=((i=e.attrs)==null?void 0:i.name)||"",o=((s=e.attrs)==null?void 0:s.id)||"",n=((r=e.attrs)==null?void 0:r.contactKey)||"";return`<!-- @mention: {"id": "${o}", "contactKey": "${n}", "name": "${t}"} -->`},processChannelNode(e){var s,r,l,c;const t=((s=e.attrs)==null?void 0:s.name)||"",o=((r=e.attrs)==null?void 0:r.id)||"",n=((l=e.attrs)==null?void 0:l.locked.toString())||"",i=((c=e.attrs)==null?void 0:c.channelKey)||"";return`<!-- @channel: {"id": "${o}", "channelKey": "${i}", "name": "${t}", "locked": "${n}"} -->`},processSlashCommandsNode(e){var n,i;const t=((n=e.attrs)==null?void 0:n.command)||"",o=((i=e.attrs)==null?void 0:i.parameters)||"";return`/${t}${o?` ${o}`:""}`},processEmojiNode(e){var t;return((t=e.attrs)==null?void 0:t.code)||""},processVariableNode(e){var n,i;const t=((n=e.attrs)==null?void 0:n.id)||"",o=((i=e.attrs)==null?void 0:i.altText)||"";return`{{${t}=${o}}}`},processUnknownNode(e){return this.processNodeContent(e)},applyMarks(e,t){let o=e;return[...t].sort((i,s)=>{const r={link:0,bold:1,italic:2,strike:3,code:4};return(r[i.type]||5)-(r[s.type]||5)}).forEach(i=>{var s;switch(i.type){case"bold":o=`**${o}**`;break;case"italic":o=`*${o}*`;break;case"strike":o=`~~${o}~~`;break;case"code":o=`\`${o}\``;break;case"link":{const r=((s=i.attrs)==null?void 0:s.href)||"";o=`[${o}](${r})`;break}}}),o}}}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){const e=[Et,Bt,be.UndoRedo,Ot];e.push(this.useDivTags?Ao:Ye),this.allowBold&&e.push(St),this.allowBlockquote&&e.push(Tt),this.allowBulletList&&(e.push(ve.BulletList),e.push(ve.ListItem.extend({renderText({node:n}){return n.textContent}})),e.push(ve.OrderedList)),this.allowItalic&&e.push(Lt),this.allowStrike&&e.push(It),this.allowUnderline&&e.push(At),this.placeholder&&e.push(be.Placeholder.configure({placeholder:this.placeholder}));const t=this,o=T.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:n})=>t.allowLineBreaks?!1:(n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>t.allowBulletList&&i.splitListItem("listItem"),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit("enter"),!0)}}});if(e.push(o),this.link&&e.push(Dt.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit("edit-link"),!0)}}}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:de.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Do,this.customLink)),this.mentionSuggestion){const n={...this.mentionSuggestion,...oi};e.push(No.configure({suggestion:n}))}if(this.channelSuggestion){const n={...this.channelSuggestion,...ai};e.push(Po.configure({suggestion:n}))}if(this.slashCommandSuggestion){const n={...this.slashCommandSuggestion,...pi};e.push(Fo.configure({suggestion:n,onSelectedCommand:i=>{this.$emit("selected-command",i)}}))}return this.allowVariable&&e.push(Go.configure({variableItems:this.variableItems})),e.push(_o),e.push(Rt.configure({types:["paragraph"]})),this.allowCode&&e.push(Ct),this.allowCodeblock&&e.push(kt.extend({renderText({node:n}){return`\`\`\`
|
|
11
11
|
${n.textContent}
|
|
12
|
-
\`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Io.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&e.push(Mt.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(ce.Table.configure({resizable:!0}),ce.TableRow,ce.TableHeader,ce.TableCell,be.Gapcursor),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){se.warnIfUnmounted(se.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new S.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:
|
|
12
|
+
\`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Io.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&e.push(Mt.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(ce.Table.configure({resizable:!0}),ce.TableRow,ce.TableHeader,ce.TableCell,be.Gapcursor),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){se.warnIfUnmounted(se.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new S.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(!this.preventTyping)return!1;const o=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&o.push("Enter"),!o.includes(t.key)},handlePaste:(e,t)=>{const o=t.clipboardData||window.clipboardData,n=o.getData("text/plain"),i=o.getData("text/html");return this.processPasteData(e,n,i)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var l,c,h;const{view:t,state:o}=e,{from:n,to:i}=t.state.selection,s=o.doc.textBetween(n,i,""),r=this.editor.state.doc.nodeAt(n);return r&&((h=(c=(l=r.marks)==null?void 0:l.at(0))==null?void 0:c.type)==null?void 0:h.name)==="link"?r.textContent:s},editLink(){const e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes("link").href,text:e};this.$emit("edit-link",t)},removeLink(){var e,t,o,n;(n=(o=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:o.unsetLink())==null||n.run()},openLink(){var t,o;(o=(t=this.editor)==null?void 0:t.chain())==null||o.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,o,n=de.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){var l,c,h;if(!e){this.removeLink();return}n.find(u=>u.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const r=(h=(c=(l=this.editor)==null?void 0:l.view)==null?void 0:c.state)==null?void 0:h.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:r.from,to:r.from+t.length}).setLink({href:e,class:o.class}).run()},processValue(e,t=!0){if(!this.editor)return;const o=this.getOutput();if(!(t&&Kt(e,o))){if(typeof e=="string"&&this.outputFormat==="text"){const n=new RegExp(`(${Ge.emojiPattern})`,"g");e=e==null?void 0:e.replace(n,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace}})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const i=(this.pasteRichText?t:t.replace(/\r\n/g,`
|
|
13
13
|
`).replace(/\n\n/g,`
|
|
14
14
|
`)).replace(/[\r\n]+$/,"").split(/\r?\n/),s=[];for(let r=0;r<i.length;r++)r>0&&s.push({type:"hardBreak"}),i[r]&&s.push({type:"text",text:i[r]});this.editor.chain().focus().insertContent(s).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,o){if(this.shouldPreserveLineBreaks(t,o))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(o)){const n=this.extractPreformattedText(o);if(n&&n.includes(`
|
|
15
15
|
`))return this.insertPlainTextWithHardBreaks(e,n),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){const t=document.createElement("div");t.innerHTML=e;const o=t.querySelectorAll("*");for(const n of o)if(this.hasPreWhitespace(n)&&this.hasLineBreaks(n))return!0;return!1},hasPreWhitespace(e){const t=e.getAttribute("style")||"",o=e.style.whiteSpace||"",n=o==="pre"||o==="pre-wrap",i=t.includes("white-space: pre");return n||i},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
|