import {
cloneDeep
} from "./chunk-GAIPUJQA.js";
import {
toNumber
} from "./chunk-ZXSZILPV.js";
import {
baseIsEqual,
isUndefined
} from "./chunk-CGU436GM.js";
import {
CHANGE_EVENT,
DEFAULT_PROPS,
EVENT_CODE,
ElButton,
ElFocusTrap,
ElIcon,
ElScrollbar,
ElTeleport,
FOCUS_TRAP_INJECTION_KEY,
GLOBAL_SHIKI_KEY,
INPUT_EVENT,
MarkdownRenderer,
MarkdownRendererAsync,
NOOP,
UPDATE_MODEL_EVENT,
ValidateComponentsMap,
_export_sfc,
_export_sfc2,
addUnit,
buildProp,
buildProps,
ccount,
commonjsGlobal,
componentSizes,
composeRefs,
computedEager,
debounce,
debugWarn,
definePropType,
entriesOf,
find,
formItemContextKey,
fromPairs,
getDefaultExportFromCjs,
getScrollContainer,
html,
htmlVoidElements,
iconPropType,
isArray,
isArray2,
isBoolean,
isClient,
isElement,
isFocusable,
isFunction$1,
isNil,
isNumber,
isObject,
isObject2,
isPlainObject,
isPromise,
isString$1,
isWindow,
keysOf,
mutable,
onClickOutside,
pick,
purify,
root,
scrollIntoView,
stringify,
stringify$1,
svg,
teleportProps,
throwError,
tryFocus,
tryOnScopeDispose,
unrefElement,
useAriaProps,
useEventListener,
useFormDisabled,
useFormItem,
useFormItemInputId,
useFormSize,
useGetDerivedNamespace,
useId,
useIdInjection,
useIntersectionObserver,
useLocale,
useMarkdownContext,
useNamespace,
useResizeObserver,
useSizeProp,
useThrottleFn,
useVModel,
useZIndex,
withInstall,
withInstallDirective,
withNoopInstall,
zwitch
} from "./chunk-LB3CVB72.js";
import {
arrow_down_bold_default,
arrow_down_default,
arrow_left_bold_default,
arrow_left_default,
arrow_right_bold_default,
arrow_right_default,
arrow_up_bold_default,
brush_default,
check_default,
circle_check_default,
circle_close_default,
circle_close_filled_default,
close_default,
delete_default,
document_default,
edit_default,
full_screen_default,
hide_default,
loading_default,
microphone_default,
more_filled_default,
opportunity_default,
plus_default,
refresh_left_default,
refresh_right_default,
scale_to_original_default,
success_filled_default,
top_default,
upload_filled_default,
view_default,
warning_filled_default,
zoom_in_default,
zoom_out_default
} from "./chunk-3C23FNYW.js";
import "./chunk-VAL2CHZC.js";
import {
Comment,
Fragment,
Teleport,
Text,
Transition,
TransitionGroup,
cloneVNode,
computed,
createBaseVNode,
createBlock,
createCommentVNode,
createElementBlock,
createSlots,
createStaticVNode,
createTextVNode,
createVNode,
defineComponent,
effectScope,
getCurrentInstance,
guardReactiveProps,
h,
inject,
isRef,
markRaw,
mergeDefaults,
mergeProps,
nextTick,
onBeforeMount,
onBeforeUnmount,
onDeactivated,
onMounted,
onUnmounted,
openBlock,
provide,
reactive,
readonly,
ref,
renderList,
renderSlot,
resolveComponent,
resolveDynamicComponent,
shallowRef,
toHandlers,
toRef,
toRefs,
unref,
useAttrs,
useCssVars,
useSlots,
vShow,
watch,
withCtx,
withDirectives,
withKeys,
withModifiers
} from "./chunk-AAHVYXXY.js";
import {
normalizeClass,
normalizeProps,
normalizeStyle,
toDisplayString
} from "./chunk-OWZYVOTZ.js";
import "./chunk-V4OQ3NZ2.js";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Attachments/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style7.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style5.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-DsvcTVEy.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-image-viewer.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style7.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/FilesCard/options.js
var colorMap = {
word: "#0078D4",
excel: "#00C851",
ppt: "#FF5722",
pdf: "#E53935",
txt: "#424242",
mark: "#6C6C6C",
image: "#FF80AB",
audio: "#FF7878",
video: "#8B72F7",
three: "#29B6F6",
code: "#00008B",
database: "#FF9800",
link: "#2962FF",
zip: "#673AB7",
file: "#FFC757",
unknown: "#6E9DA4"
};
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-1XX1dK_n.js
var DEFAULT_EXCLUDE_KEYS = ["class", "style"];
var LISTENER_PREFIX = /^on[A-Z]/;
var useAttrs2 = (params = {}) => {
const { excludeListeners = false, excludeKeys } = params;
const allExcludeKeys = computed(() => {
return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
});
const instance = getCurrentInstance();
if (!instance) {
return computed(() => ({}));
}
return computed(() => {
var _a3;
return fromPairs(Object.entries((_a3 = instance.proxy) == null ? void 0 : _a3.$attrs).filter(([key2]) => !allExcludeKeys.value.includes(key2) && !(excludeListeners && LISTENER_PREFIX.test(key2))));
});
};
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-CP_B4XMk.js
var now = function() {
return root.Date.now();
};
var FUNC_ERROR_TEXT$1 = "Expected a function";
var nativeMax = Math.max;
var nativeMin = Math.min;
function debounce2(func, wait, options) {
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
wait = toNumber(wait) || 0;
if (isObject2(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = void 0;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = void 0;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = void 0;
return result;
}
function cancel() {
if (timerId !== void 0) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = void 0;
}
function flush() {
return timerId === void 0 ? result : trailingEdge(now());
}
function debounced() {
var time = now(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === void 0) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === void 0) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var FUNC_ERROR_TEXT = "Expected a function";
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject2(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce2(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
var imageViewerProps = buildProps({
urlList: {
type: definePropType(Array),
default: () => mutable([])
},
zIndex: {
type: Number
},
initialIndex: {
type: Number,
default: 0
},
infinite: {
type: Boolean,
default: true
},
hideOnClickModal: Boolean,
teleported: Boolean,
closeOnPressEscape: {
type: Boolean,
default: true
},
zoomRate: {
type: Number,
default: 1.2
},
minScale: {
type: Number,
default: 0.2
},
maxScale: {
type: Number,
default: 7
},
showProgress: Boolean,
crossorigin: {
type: definePropType(String)
}
});
var imageViewerEmits = {
close: () => true,
switch: (index) => isNumber(index),
rotate: (deg) => isNumber(deg)
};
var __default__$1 = defineComponent({
name: "ElImageViewer"
});
var _sfc_main$1 = defineComponent({
...__default__$1,
props: imageViewerProps,
emits: imageViewerEmits,
setup(__props, { expose, emit }) {
var _a3;
const props = __props;
const modes = {
CONTAIN: {
name: "contain",
icon: markRaw(full_screen_default)
},
ORIGINAL: {
name: "original",
icon: markRaw(scale_to_original_default)
}
};
let stopWheelListener;
let prevOverflow = "";
const { t } = useLocale();
const ns = useNamespace("image-viewer");
const { nextZIndex } = useZIndex();
const wrapper = ref();
const imgRefs = ref([]);
const scopeEventListener = effectScope();
const loading4 = ref(true);
const activeIndex = ref(props.initialIndex);
const mode = shallowRef(modes.CONTAIN);
const transform = ref({
scale: 1,
deg: 0,
offsetX: 0,
offsetY: 0,
enableTransition: false
});
const zIndex = ref((_a3 = props.zIndex) != null ? _a3 : nextZIndex());
const isSingle = computed(() => {
const { urlList } = props;
return urlList.length <= 1;
});
const isFirst = computed(() => activeIndex.value === 0);
const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
const currentImg = computed(() => props.urlList[activeIndex.value]);
const arrowPrevKls = computed(() => [
ns.e("btn"),
ns.e("prev"),
ns.is("disabled", !props.infinite && isFirst.value)
]);
const arrowNextKls = computed(() => [
ns.e("btn"),
ns.e("next"),
ns.is("disabled", !props.infinite && isLast.value)
]);
const imgStyle = computed(() => {
const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
let translateX = offsetX / scale;
let translateY = offsetY / scale;
const radian = deg * Math.PI / 180;
const cosRadian = Math.cos(radian);
const sinRadian = Math.sin(radian);
translateX = translateX * cosRadian + translateY * sinRadian;
translateY = translateY * cosRadian - offsetX / scale * sinRadian;
const style = {
transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
transition: enableTransition ? "transform .3s" : ""
};
if (mode.value.name === modes.CONTAIN.name) {
style.maxWidth = style.maxHeight = "100%";
}
return style;
});
const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
function hide() {
unregisterEventListener();
stopWheelListener == null ? void 0 : stopWheelListener();
document.body.style.overflow = prevOverflow;
emit("close");
}
function registerEventListener() {
const keydownHandler = throttle((e) => {
switch (e.code) {
case EVENT_CODE.esc:
props.closeOnPressEscape && hide();
break;
case EVENT_CODE.space:
toggleMode();
break;
case EVENT_CODE.left:
prev();
break;
case EVENT_CODE.up:
handleActions("zoomIn");
break;
case EVENT_CODE.right:
next();
break;
case EVENT_CODE.down:
handleActions("zoomOut");
break;
}
});
const mousewheelHandler = throttle((e) => {
const delta = e.deltaY || e.deltaX;
handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
zoomRate: props.zoomRate,
enableTransition: false
});
});
scopeEventListener.run(() => {
useEventListener(document, "keydown", keydownHandler);
useEventListener(document, "wheel", mousewheelHandler);
});
}
function unregisterEventListener() {
scopeEventListener.stop();
}
function handleImgLoad() {
loading4.value = false;
}
function handleImgError(e) {
loading4.value = false;
e.target.alt = t("el.image.error");
}
function handleMouseDown(e) {
if (loading4.value || e.button !== 0 || !wrapper.value)
return;
transform.value.enableTransition = false;
const { offsetX, offsetY } = transform.value;
const startX = e.pageX;
const startY = e.pageY;
const dragHandler = throttle((ev) => {
transform.value = {
...transform.value,
offsetX: offsetX + ev.pageX - startX,
offsetY: offsetY + ev.pageY - startY
};
});
const removeMousemove = useEventListener(document, "mousemove", dragHandler);
useEventListener(document, "mouseup", () => {
removeMousemove();
});
e.preventDefault();
}
function reset() {
transform.value = {
scale: 1,
deg: 0,
offsetX: 0,
offsetY: 0,
enableTransition: false
};
}
function toggleMode() {
if (loading4.value)
return;
const modeNames = keysOf(modes);
const modeValues = Object.values(modes);
const currentMode = mode.value.name;
const index = modeValues.findIndex((i) => i.name === currentMode);
const nextIndex = (index + 1) % modeNames.length;
mode.value = modes[modeNames[nextIndex]];
reset();
}
function setActiveItem(index) {
const len = props.urlList.length;
activeIndex.value = (index + len) % len;
}
function prev() {
if (isFirst.value && !props.infinite)
return;
setActiveItem(activeIndex.value - 1);
}
function next() {
if (isLast.value && !props.infinite)
return;
setActiveItem(activeIndex.value + 1);
}
function handleActions(action, options = {}) {
if (loading4.value)
return;
const { minScale, maxScale } = props;
const { zoomRate, rotateDeg, enableTransition } = {
zoomRate: props.zoomRate,
rotateDeg: 90,
enableTransition: true,
...options
};
switch (action) {
case "zoomOut":
if (transform.value.scale > minScale) {
transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
}
break;
case "zoomIn":
if (transform.value.scale < maxScale) {
transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
}
break;
case "clockwise":
transform.value.deg += rotateDeg;
emit("rotate", transform.value.deg);
break;
case "anticlockwise":
transform.value.deg -= rotateDeg;
emit("rotate", transform.value.deg);
break;
}
transform.value.enableTransition = enableTransition;
}
function onFocusoutPrevented(event) {
var _a22;
if (((_a22 = event.detail) == null ? void 0 : _a22.focusReason) === "pointer") {
event.preventDefault();
}
}
function onCloseRequested() {
if (props.closeOnPressEscape) {
hide();
}
}
function wheelHandler(e) {
if (!e.ctrlKey)
return;
if (e.deltaY < 0) {
e.preventDefault();
return false;
} else if (e.deltaY > 0) {
e.preventDefault();
return false;
}
}
watch(currentImg, () => {
nextTick(() => {
const $img = imgRefs.value[0];
if (!($img == null ? void 0 : $img.complete)) {
loading4.value = true;
}
});
});
watch(activeIndex, (val) => {
reset();
emit("switch", val);
});
onMounted(() => {
registerEventListener();
stopWheelListener = useEventListener("wheel", wheelHandler, {
passive: false
});
prevOverflow = document.body.style.overflow;
document.body.style.overflow = "hidden";
});
expose({
setActiveItem
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTeleport), {
to: "body",
disabled: !_ctx.teleported
}, {
default: withCtx(() => [
createVNode(Transition, {
name: "viewer-fade",
appear: ""
}, {
default: withCtx(() => [
createBaseVNode("div", {
ref_key: "wrapper",
ref: wrapper,
tabindex: -1,
class: normalizeClass(unref(ns).e("wrapper")),
style: normalizeStyle({ zIndex: zIndex.value })
}, [
createVNode(unref(ElFocusTrap), {
loop: "",
trapped: "",
"focus-trap-el": wrapper.value,
"focus-start-el": "container",
onFocusoutPrevented,
onReleaseRequested: onCloseRequested
}, {
default: withCtx(() => [
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("mask")),
onClick: withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
}, null, 10, ["onClick"]),
createCommentVNode(" CLOSE "),
createBaseVNode("span", {
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
onClick: hide
}, [
createVNode(unref(ElIcon), null, {
default: withCtx(() => [
createVNode(unref(close_default))
]),
_: 1
})
], 2),
createCommentVNode(" ARROW "),
!unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createBaseVNode("span", {
class: normalizeClass(unref(arrowPrevKls)),
onClick: prev
}, [
createVNode(unref(ElIcon), null, {
default: withCtx(() => [
createVNode(unref(arrow_left_default))
]),
_: 1
})
], 2),
createBaseVNode("span", {
class: normalizeClass(unref(arrowNextKls)),
onClick: next
}, [
createVNode(unref(ElIcon), null, {
default: withCtx(() => [
createVNode(unref(arrow_right_default))
]),
_: 1
})
], 2)
], 64)) : createCommentVNode("v-if", true),
_ctx.$slots.progress || _ctx.showProgress ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
}, [
renderSlot(_ctx.$slots, "progress", {
activeIndex: activeIndex.value,
total: _ctx.urlList.length
}, () => [
createTextVNode(toDisplayString(unref(progress)), 1)
])
], 2)) : createCommentVNode("v-if", true),
createCommentVNode(" ACTIONS "),
createBaseVNode("div", {
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
}, [
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("actions__inner"))
}, [
renderSlot(_ctx.$slots, "toolbar", {
actions: handleActions,
prev,
next,
reset: toggleMode,
activeIndex: activeIndex.value,
setActiveItem
}, () => [
createVNode(unref(ElIcon), {
onClick: ($event) => handleActions("zoomOut")
}, {
default: withCtx(() => [
createVNode(unref(zoom_out_default))
]),
_: 1
}, 8, ["onClick"]),
createVNode(unref(ElIcon), {
onClick: ($event) => handleActions("zoomIn")
}, {
default: withCtx(() => [
createVNode(unref(zoom_in_default))
]),
_: 1
}, 8, ["onClick"]),
createBaseVNode("i", {
class: normalizeClass(unref(ns).e("actions__divider"))
}, null, 2),
createVNode(unref(ElIcon), { onClick: toggleMode }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
]),
_: 1
}),
createBaseVNode("i", {
class: normalizeClass(unref(ns).e("actions__divider"))
}, null, 2),
createVNode(unref(ElIcon), {
onClick: ($event) => handleActions("anticlockwise")
}, {
default: withCtx(() => [
createVNode(unref(refresh_left_default))
]),
_: 1
}, 8, ["onClick"]),
createVNode(unref(ElIcon), {
onClick: ($event) => handleActions("clockwise")
}, {
default: withCtx(() => [
createVNode(unref(refresh_right_default))
]),
_: 1
}, 8, ["onClick"])
])
], 2)
], 2),
createCommentVNode(" CANVAS "),
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("canvas"))
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url, i) => {
return openBlock(), createElementBlock(Fragment, { key: i }, [
i === activeIndex.value ? (openBlock(), createElementBlock("img", {
key: 0,
ref_for: true,
ref: (el) => imgRefs.value[i] = el,
src: url,
style: normalizeStyle(unref(imgStyle)),
class: normalizeClass(unref(ns).e("img")),
crossorigin: _ctx.crossorigin,
onLoad: handleImgLoad,
onError: handleImgError,
onMousedown: handleMouseDown
}, null, 46, ["src", "crossorigin"])) : createCommentVNode("v-if", true)
], 64);
}), 128))
], 2),
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["focus-trap-el"])
], 6)
]),
_: 3
})
]),
_: 3
}, 8, ["disabled"]);
};
}
});
var ImageViewer = _export_sfc(_sfc_main$1, [["__file", "image-viewer.vue"]]);
var ElImageViewer = withInstall(ImageViewer);
var imageProps = buildProps({
hideOnClickModal: Boolean,
src: {
type: String,
default: ""
},
fit: {
type: String,
values: ["", "contain", "cover", "fill", "none", "scale-down"],
default: ""
},
loading: {
type: String,
values: ["eager", "lazy"]
},
lazy: Boolean,
scrollContainer: {
type: definePropType([String, Object])
},
previewSrcList: {
type: definePropType(Array),
default: () => mutable([])
},
previewTeleported: Boolean,
zIndex: {
type: Number
},
initialIndex: {
type: Number,
default: 0
},
infinite: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: true
},
zoomRate: {
type: Number,
default: 1.2
},
minScale: {
type: Number,
default: 0.2
},
maxScale: {
type: Number,
default: 7
},
showProgress: Boolean,
crossorigin: {
type: definePropType(String)
}
});
var imageEmits = {
load: (evt) => evt instanceof Event,
error: (evt) => evt instanceof Event,
switch: (val) => isNumber(val),
close: () => true,
show: () => true
};
var __default__ = defineComponent({
name: "ElImage",
inheritAttrs: false
});
var _sfc_main = defineComponent({
...__default__,
props: imageProps,
emits: imageEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { t } = useLocale();
const ns = useNamespace("image");
const rawAttrs = useAttrs();
const containerAttrs = computed(() => {
return fromPairs(Object.entries(rawAttrs).filter(([key2]) => /^(data-|on[A-Z])/i.test(key2) || ["id", "style"].includes(key2)));
});
const imgAttrs = useAttrs2({
excludeListeners: true,
excludeKeys: computed(() => {
return Object.keys(containerAttrs.value);
})
});
const imageSrc = ref();
const hasLoadError = ref(false);
const isLoading = ref(true);
const showViewer = ref(false);
const container = ref();
const _scrollContainer = ref();
const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
let stopScrollListener;
const imageKls = computed(() => [
ns.e("inner"),
preview.value && ns.e("preview"),
isLoading.value && ns.is("loading")
]);
const imageStyle = computed(() => {
const { fit } = props;
if (isClient && fit) {
return { objectFit: fit };
}
return {};
});
const preview = computed(() => {
const { previewSrcList } = props;
return isArray(previewSrcList) && previewSrcList.length > 0;
});
const imageIndex = computed(() => {
const { previewSrcList, initialIndex } = props;
let previewIndex = initialIndex;
if (initialIndex > previewSrcList.length - 1) {
previewIndex = 0;
}
return previewIndex;
});
const isManual = computed(() => {
if (props.loading === "eager")
return false;
return !supportLoading && props.loading === "lazy" || props.lazy;
});
const loadImage = () => {
if (!isClient)
return;
isLoading.value = true;
hasLoadError.value = false;
imageSrc.value = props.src;
};
function handleLoad(event) {
isLoading.value = false;
hasLoadError.value = false;
emit("load", event);
}
function handleError(event) {
isLoading.value = false;
hasLoadError.value = true;
emit("error", event);
}
function handleLazyLoad(isIntersecting) {
if (isIntersecting) {
loadImage();
removeLazyLoadListener();
}
}
const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
async function addLazyLoadListener() {
var _a3;
if (!isClient)
return;
await nextTick();
const { scrollContainer } = props;
if (isElement(scrollContainer)) {
_scrollContainer.value = scrollContainer;
} else if (isString$1(scrollContainer) && scrollContainer !== "") {
_scrollContainer.value = (_a3 = document.querySelector(scrollContainer)) != null ? _a3 : void 0;
} else if (container.value) {
const scrollContainer2 = getScrollContainer(container.value);
_scrollContainer.value = isWindow(scrollContainer2) ? void 0 : scrollContainer2;
}
const { stop } = useIntersectionObserver(container, ([entry]) => {
lazyLoadHandler(entry.isIntersecting);
}, { root: _scrollContainer });
stopScrollListener = stop;
}
function removeLazyLoadListener() {
if (!isClient || !lazyLoadHandler)
return;
stopScrollListener == null ? void 0 : stopScrollListener();
_scrollContainer.value = void 0;
stopScrollListener = void 0;
}
function clickHandler() {
if (!preview.value)
return;
showViewer.value = true;
emit("show");
}
function closeViewer() {
showViewer.value = false;
emit("close");
}
function switchViewer(val) {
emit("switch", val);
}
watch(() => props.src, () => {
if (isManual.value) {
isLoading.value = true;
hasLoadError.value = false;
removeLazyLoadListener();
addLazyLoadListener();
} else {
loadImage();
}
});
onMounted(() => {
if (isManual.value) {
addLazyLoadListener();
} else {
loadImage();
}
});
expose({
showPreview: clickHandler
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", mergeProps({
ref_key: "container",
ref: container
}, unref(containerAttrs), {
class: [unref(ns).b(), _ctx.$attrs.class]
}), [
hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("error"))
}, toDisplayString(unref(t)("el.image.error")), 3)
]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
src: imageSrc.value,
loading: _ctx.loading,
style: unref(imageStyle),
class: unref(imageKls),
crossorigin: _ctx.crossorigin,
onClick: clickHandler,
onLoad: handleLoad,
onError: handleError
}), null, 16, ["src", "loading", "crossorigin"])) : createCommentVNode("v-if", true),
isLoading.value ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).e("wrapper"))
}, [
renderSlot(_ctx.$slots, "placeholder", {}, () => [
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("placeholder"))
}, null, 2)
])
], 2)) : createCommentVNode("v-if", true)
], 64)),
unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
key: 0,
"z-index": _ctx.zIndex,
"initial-index": unref(imageIndex),
infinite: _ctx.infinite,
"zoom-rate": _ctx.zoomRate,
"min-scale": _ctx.minScale,
"max-scale": _ctx.maxScale,
"show-progress": _ctx.showProgress,
"url-list": _ctx.previewSrcList,
crossorigin: _ctx.crossorigin,
"hide-on-click-modal": _ctx.hideOnClickModal,
teleported: _ctx.previewTeleported,
"close-on-press-escape": _ctx.closeOnPressEscape,
onClose: closeViewer,
onSwitch: switchViewer
}, createSlots({
toolbar: withCtx((toolbar) => [
renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))
]),
default: withCtx(() => [
_ctx.$slots.viewer ? (openBlock(), createElementBlock("div", { key: 0 }, [
renderSlot(_ctx.$slots, "viewer")
])) : createCommentVNode("v-if", true)
]),
_: 2
}, [
_ctx.$slots.progress ? {
name: "progress",
fn: withCtx((progress) => [
renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))
])
} : void 0
]), 1032, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
], 64)) : createCommentVNode("v-if", true)
], 16);
};
}
});
var Image2 = _export_sfc(_sfc_main, [["__file", "image.vue"]]);
var ElImage = withInstall(Image2);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-DsvcTVEy.js
var progressProps = buildProps({
type: {
type: String,
default: "line",
values: ["line", "circle", "dashboard"]
},
percentage: {
type: Number,
default: 0,
validator: (val) => val >= 0 && val <= 100
},
status: {
type: String,
default: "",
values: ["", "success", "exception", "warning"]
},
indeterminate: Boolean,
duration: {
type: Number,
default: 3
},
strokeWidth: {
type: Number,
default: 6
},
strokeLinecap: {
type: definePropType(String),
default: "round"
},
textInside: Boolean,
width: {
type: Number,
default: 126
},
showText: {
type: Boolean,
default: true
},
color: {
type: definePropType([
String,
Array,
Function
]),
default: ""
},
striped: Boolean,
stripedFlow: Boolean,
format: {
type: definePropType(Function),
default: (percentage) => `${percentage}%`
}
});
var __default__2 = defineComponent({
name: "ElProgress"
});
var _sfc_main$h = defineComponent({
...__default__2,
props: progressProps,
setup(__props) {
const props = __props;
const STATUS_COLOR_MAP = {
success: "#13ce66",
exception: "#ff4949",
warning: "#e6a23c",
default: "#20a0ff"
};
const ns = useNamespace("progress");
const barStyle = computed(() => {
const barStyle2 = {
width: `${props.percentage}%`,
animationDuration: `${props.duration}s`
};
const color = getCurrentColor(props.percentage);
if (color.includes("gradient")) {
barStyle2.background = color;
} else {
barStyle2.backgroundColor = color;
}
return barStyle2;
});
const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
const radius = computed(() => {
if (["circle", "dashboard"].includes(props.type)) {
return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
}
return 0;
});
const trackPath = computed(() => {
const r = radius.value;
const isDashboard = props.type === "dashboard";
return `
M 50 50
m 0 ${isDashboard ? "" : "-"}${r}
a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
`;
});
const perimeter = computed(() => 2 * Math.PI * radius.value);
const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
const strokeDashoffset = computed(() => {
const offset = -1 * perimeter.value * (1 - rate.value) / 2;
return `${offset}px`;
});
const trailPathStyle = computed(() => ({
strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
strokeDashoffset: strokeDashoffset.value
}));
const circlePathStyle = computed(() => ({
strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
strokeDashoffset: strokeDashoffset.value,
transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
}));
const stroke = computed(() => {
let ret;
if (props.color) {
ret = getCurrentColor(props.percentage);
} else {
ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
}
return ret;
});
const statusIcon = computed(() => {
if (props.status === "warning") {
return warning_filled_default;
}
if (props.type === "line") {
return props.status === "success" ? circle_check_default : circle_close_default;
} else {
return props.status === "success" ? check_default : close_default;
}
});
const progressTextSize = computed(() => {
return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
});
const content = computed(() => props.format(props.percentage));
function getColors(color) {
const span = 100 / color.length;
const seriesColors = color.map((seriesColor, index) => {
if (isString$1(seriesColor)) {
return {
color: seriesColor,
percentage: (index + 1) * span
};
}
return seriesColor;
});
return seriesColors.sort((a, b) => a.percentage - b.percentage);
}
const getCurrentColor = (percentage) => {
var _a3;
const { color } = props;
if (isFunction$1(color)) {
return color(percentage);
} else if (isString$1(color)) {
return color;
} else {
const colors = getColors(color);
for (const color2 of colors) {
if (color2.percentage > percentage)
return color2.color;
}
return (_a3 = colors[colors.length - 1]) == null ? void 0 : _a3.color;
}
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([
unref(ns).b(),
unref(ns).m(_ctx.type),
unref(ns).is(_ctx.status),
{
[unref(ns).m("without-text")]: !_ctx.showText,
[unref(ns).m("text-inside")]: _ctx.textInside
}
]),
role: "progressbar",
"aria-valuenow": _ctx.percentage,
"aria-valuemin": "0",
"aria-valuemax": "100"
}, [
_ctx.type === "line" ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).b("bar"))
}, [
createBaseVNode("div", {
class: normalizeClass(unref(ns).be("bar", "outer")),
style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
}, [
createBaseVNode("div", {
class: normalizeClass([
unref(ns).be("bar", "inner"),
{ [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
{ [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
{ [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
]),
style: normalizeStyle(unref(barStyle))
}, [
(_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).be("bar", "innerText"))
}, [
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
createBaseVNode("span", null, toDisplayString(unref(content)), 1)
])
], 2)) : createCommentVNode("v-if", true)
], 6)
], 6)
], 2)) : (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).b("circle")),
style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
}, [
(openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [
createBaseVNode("path", {
class: normalizeClass(unref(ns).be("circle", "track")),
d: unref(trackPath),
stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
"stroke-linecap": _ctx.strokeLinecap,
"stroke-width": unref(relativeStrokeWidth),
fill: "none",
style: normalizeStyle(unref(trailPathStyle))
}, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
createBaseVNode("path", {
class: normalizeClass(unref(ns).be("circle", "path")),
d: unref(trackPath),
stroke: unref(stroke),
fill: "none",
opacity: _ctx.percentage ? 1 : 0,
"stroke-linecap": _ctx.strokeLinecap,
"stroke-width": unref(relativeStrokeWidth),
style: normalizeStyle(unref(circlePathStyle))
}, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
]))
], 6)),
(_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass(unref(ns).e("text")),
style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
}, [
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
!_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
]),
_: 1
}))
])
], 6)) : createCommentVNode("v-if", true)
], 10, ["aria-valuenow"]);
};
}
});
var Progress = _export_sfc(_sfc_main$h, [["__file", "progress.vue"]]);
var ElProgress = withInstall(Progress);
function getFileType(fileExtension) {
const cleanExtension = fileExtension.replace(".", "").toLowerCase();
if (!cleanExtension) {
return { lowerCase: "unknown", upperCase: "Unknown" };
}
const imageExtensions = ["png", "jpg", "jpeg", "gif", "bmp", "svg", "webp"];
const wordExtensions = ["doc", "docx"];
const excelExtensions = ["xls", "xlsx"];
const pptExtensions = ["ppt", "pptx"];
const audioExtensions = ["mp3", "wav", "ogg", "flac"];
const videoExtensions = ["mp4", "avi", "mov", "mkv"];
const codeExtensions = [
"js",
"ts",
"html",
"css",
"py",
"java",
"c",
"cpp",
"json",
"php"
];
const databaseExtensions = ["sql", "db", "sqlite"];
const zipExtensions = ["zip", "rar", "7z"];
const markExtensions = ["md", "mdx"];
if (imageExtensions.includes(cleanExtension)) {
return { lowerCase: "image", upperCase: "Image" };
}
if (wordExtensions.includes(cleanExtension)) {
return { lowerCase: "word", upperCase: "Word" };
}
if (excelExtensions.includes(cleanExtension)) {
return { lowerCase: "excel", upperCase: "Excel" };
}
if (pptExtensions.includes(cleanExtension)) {
return { lowerCase: "ppt", upperCase: "Ppt" };
}
if (cleanExtension === "pdf") {
return { lowerCase: "pdf", upperCase: "Pdf" };
}
if (cleanExtension === "txt") {
return { lowerCase: "txt", upperCase: "Txt" };
}
if (markExtensions.includes(cleanExtension)) {
return { lowerCase: "mark", upperCase: "Markdown" };
}
if (audioExtensions.includes(cleanExtension)) {
return { lowerCase: "audio", upperCase: "Audio" };
}
if (videoExtensions.includes(cleanExtension)) {
return { lowerCase: "video", upperCase: "Video" };
}
if (codeExtensions.includes(cleanExtension)) {
return { lowerCase: "code", upperCase: "Code" };
}
if (databaseExtensions.includes(cleanExtension)) {
return { lowerCase: "database", upperCase: "Database" };
}
if (cleanExtension === "lnk") {
return { lowerCase: "link", upperCase: "Link" };
}
if (zipExtensions.includes(cleanExtension)) {
return { lowerCase: "zip", upperCase: "Zip" };
}
if (cleanExtension === "obj" || cleanExtension === "fbx" || cleanExtension === "glb") {
return { lowerCase: "three", upperCase: "3D" };
}
return { lowerCase: "file", upperCase: "File" };
}
function getSize(size) {
let retSize = size;
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB"];
let unitIndex = 0;
while (retSize >= 1024 && unitIndex < units.length - 1) {
retSize /= 1024;
unitIndex++;
}
return `${retSize.toFixed(0)} ${units[unitIndex]}`;
}
function isImageFileType(type) {
return type.indexOf("image/") === 0;
}
var MEASURE_SIZE = 200;
function previewImage(file2) {
return new Promise((resolve) => {
if (!file2 || !file2.type || !isImageFileType(file2.type)) {
resolve("");
return;
}
const img = new Image();
img.onload = () => {
const { width, height } = img;
const ratio = width / height;
const MEASURE_SIZE_WIDTH = ratio > 1 ? MEASURE_SIZE : MEASURE_SIZE * ratio;
const MEASURE_SIZE_HEIGHT = ratio > 1 ? MEASURE_SIZE / ratio : MEASURE_SIZE;
const canvas = document.createElement("canvas");
canvas.width = MEASURE_SIZE_WIDTH;
canvas.height = MEASURE_SIZE_HEIGHT;
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE_WIDTH}px; height: ${MEASURE_SIZE_HEIGHT}px; z-index: 9999; display: none;`;
document.body.appendChild(canvas);
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, MEASURE_SIZE_WIDTH, MEASURE_SIZE_HEIGHT);
const dataURL = canvas.toDataURL();
document.body.removeChild(canvas);
window.URL.revokeObjectURL(img.src);
resolve(dataURL);
};
img.crossOrigin = "anonymous";
if (file2.type.startsWith("image/svg+xml")) {
const reader = new FileReader();
reader.onload = () => {
if (reader.result && typeof reader.result === "string") {
img.src = reader.result;
}
};
reader.readAsDataURL(file2);
} else if (file2.type.startsWith("image/gif")) {
const reader = new FileReader();
reader.onload = () => {
if (reader.result) {
resolve(reader.result);
}
};
reader.readAsDataURL(file2);
} else {
img.src = window.URL.createObjectURL(file2);
}
});
}
function useFileNameParser(name) {
const namePrefix = computed(() => {
const nameStr = name.value || "";
const lastDotIndex = nameStr.lastIndexOf(".");
return lastDotIndex === -1 ? nameStr : nameStr.slice(0, lastDotIndex);
});
const nameSuffix = computed(() => {
const nameStr = name.value || "";
const lastDotIndex = nameStr.lastIndexOf(".");
if (lastDotIndex === -1 && nameStr.length - lastDotIndex > 10) {
return ".file";
}
return lastDotIndex === -1 ? "" : nameStr.slice(lastDotIndex);
});
return {
namePrefix,
nameSuffix
};
}
var _sfc_main$g = {};
var _hoisted_1$g = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$f(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$g, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.7801,30.808L120.8914,6.73925C117.6075,3.28624,113.4198,0.940079,108.86269999999999,0L108.86269999999999,27.0143C108.86269999999999,35.591,115.4741,42.5433,123.6303,42.5433L150,42.5433C149.003,38.1003,146.849,34.0369,143.7801,30.808ZM112.2728,63.4637C112.273,62.2072,111.6695,61.0158,110.6263,60.2131C109.58279999999999,59.4109,108.20830000000001,59.0807,106.8757,59.3119L63.9774,66.7645C61.8208,67.1384,60.2595,68.883,60.2595,70.9164L60.2891,108.928C59.1133,108.527,57.8701,108.322,56.6172,108.323C50.752629999999996,108.323,46,112.728,46,118.161C46,123.596,50.75427,128,56.6172,128C62.4801,128,67.2343,123.594,67.2343,118.161L67.2343,82.3036L105.3292,75.6853L105.3292,101.475C104.1534,101.074,102.9102,100.869,101.65729999999999,100.87C95.7928,100.87,91.0401,105.276,91.0401,110.709C91.0401,116.142,95.7944,120.547,101.65729999999999,120.547C107.5202,120.547,112.2745,116.142,112.2745,110.709Q112.2728,110.528,112.2728,63.4637Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M107.9983,59.48451C107.9984,58.15049,107.361,56.88564,106.2592,56.03341C105.1571,55.181845,103.7053,54.831213,102.2977,55.0766483L56.987899999999996,62.98886C54.7101,63.38576,53.061099999999996,65.238,53.061099999999996,67.3967L53.0923,107.7516C51.8504,107.3258,50.5373,107.1084,49.214,107.1094C43.01979,107.1094,38,111.7867,38,117.5547C38,123.3243,43.02153,128,49.214,128C55.4065,128,60.428,123.3227,60.428,117.5547L60.428,79.4861L100.6643,72.4596L100.6643,99.8394C99.42240000000001,99.4136,98.10929999999999,99.1962,96.786,99.19720000000001C90.5918,99.19720000000001,85.572,103.8745,85.572,109.6425C85.572,115.4105,90.5935,120.0878,96.786,120.0878C102.9785,120.0878,108,115.4105,108,109.6425Q107.9983,109.4505,107.9983,59.48451Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var audio = _export_sfc2(_sfc_main$g, [["render", _sfc_render$f]]);
var _sfc_main$f = {};
var _hoisted_1$f = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$e(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.4069C150,40.1874,147.532,34.2239,143.136,29.8274L120.191,6.86822C115.795,2.47051,109.835,-0.00000298153,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1"
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.13623844909668,29.827444455909728L120.19133844909668,6.868224455909729C116.89933844909667,3.574394455909729,112.70153844909667,1.336388455909729,108.13313844909668,0.439644455909729L108.13313844909668,26.208644455909727C108.13313844909668,34.38994445590973,114.76073844909668,41.021744455909726,122.93693844909669,41.021744455909726L149.37123844909667,41.021744455909726C148.3722384490967,36.78324445590973,146.21323844909668,32.90694445590973,143.13623844909668,29.827444455909728ZM55.04783844909668,67.17184445590973C53.218138449096685,65.34094445590974,50.249938449096675,65.34094445590974,48.42023844909668,67.17184445590973L28.49052844909668,87.11214445590973C26.66080844909668,88.94304445590973,26.66080844909668,91.91304445590973,28.49052844909668,93.74394445590973L48.41823844909668,113.68464445590973C49.29613844909668,114.56564445590973,50.488838449096676,115.05964445590973,51.73203844909668,115.05764445590972C52.931038449096675,115.05764445590972,54.13203844909668,114.60064445590973,55.04583844909668,113.68464445590973C56.875638449096684,111.85364445590973,56.875638449096684,108.88364445590973,55.04583844909668,107.05264445590973L38.43193844909668,90.42804445590973L55.04593844909668,73.80364445590973C56.877538449096676,71.97274445590973,56.877538449096676,69.00264445590973,55.04783844909668,67.17184445590973ZM101.57783844909667,67.17184445590973C99.74813844909669,65.34094445590974,96.77993844909668,65.34094445590974,94.95023844909667,67.17184445590973C93.12043844909668,69.00264445590973,93.12043844909668,71.97274445590973,94.95023844909667,73.80364445590973L111.56413844909667,90.42804445590973L94.95023844909667,107.05264445590973C93.12043844909668,108.88364445590973,93.12043844909668,111.85364445590973,94.95023844909667,113.68464445590973C95.86603844909668,114.60064445590973,97.06503844909668,115.05764445590972,98.26403844909667,115.05764445590972C99.46293844909668,115.05764445590972,100.66193844909668,114.60064445590973,101.57783844909667,113.68464445590973L121.50553844909668,93.74394445590973C123.33523844909668,91.91304445590973,123.33523844909668,88.94304445590973,121.50553844909668,87.11214445590973L101.57783844909667,67.17184445590973ZM85.38763844909667,57.898244455909726C82.91933844909667,57.11864445590973,80.28703844909668,58.488344455909726,79.50793844909668,60.95814445590973L61.55443844909668,117.86364445590974C60.775238449096676,120.33364445590973,62.14413844909668,122.96764445590973,64.61233844909668,123.74764445590974C65.08103844909668,123.89564445590973,65.55753844909668,123.96564445590973,66.02423844909669,123.96564445590973C68.01403844909669,123.96564445590973,69.86133844909668,122.68664445590973,70.49213844909667,120.68764445590973L88.44563844909668,63.78164445590973C89.22473844909668,61.31184445590973,87.85583844909668,58.67784445590973,85.38763844909667,57.898244455909726Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224"
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M55.04783844909668,64.82700524414062C53.218138449096685,62.996135244140625,50.249938449096675,62.996135244140625,48.42023844909668,64.82700524414062L28.49052844909668,84.76732524414062C26.66080844909668,86.59822524414062,26.66080844909668,89.56822524414062,28.49052844909668,91.39912524414063L48.41823844909668,111.33942524414063C49.29613844909668,112.22042524414063,50.488838449096676,112.71482524414063,51.73203844909668,112.71312524414063C52.931038449096675,112.71312524414063,54.13203844909668,112.25582524414062,55.04583844909668,111.33942524414063C56.875638449096684,109.50852524414063,56.875638449096684,106.53852524414063,55.04583844909668,104.70762524414062L38.43193844909668,88.08322524414064L55.04593844909668,71.45882524414063C56.877538449096676,69.62792524414063,56.877538449096676,66.65782524414062,55.04783844909668,64.82700524414062ZM121.50753844909669,84.76732524414062L101.57783844909667,64.82700524414062C99.74813844909669,62.996135244140625,96.77993844909668,62.996135244140625,94.95023844909667,64.82700524414062C93.12043844909668,66.65792524414063,93.12043844909668,69.62792524414063,94.95023844909667,71.45882524414063L111.56413844909667,88.08322524414064L94.95023844909667,104.70762524414062C93.12043844909668,106.53852524414063,93.12043844909668,109.50852524414063,94.95023844909667,111.33942524414063C95.86603844909668,112.25582524414062,97.06503844909668,112.71312524414063,98.26403844909667,112.71312524414063C99.46293844909668,112.71312524414063,100.66193844909668,112.25582524414062,101.57783844909667,111.33942524414063L121.50553844909668,91.39912524414063C123.33723844909667,89.56822524414062,123.33723844909667,86.60012524414063,121.50753844909669,84.76732524414062ZM85.38763844909667,55.55343924414063C82.91933844909667,54.773805244140625,80.28703844909668,56.14353824414062,79.50793844909668,58.613365244140624L61.55433844909668,115.51902524414062C60.775238449096676,117.98882524414063,62.14413844909668,120.62272524414063,64.61233844909668,121.40242524414063C65.08103844909668,121.55092524414063,65.55753844909668,121.62122524414063,66.02423844909669,121.62122524414063C68.01403844909669,121.62122524414063,69.86133844909668,120.34142524414062,70.49213844909667,118.34252524414063L88.44563844909668,61.436855244140624C89.22473844909668,58.96702524414062,87.85583844909668,56.333074244140626,85.38763844909667,55.55343924414063Z",
fill: "#FFFFFF",
"fill-opacity": "1"
})
])
], -1)
]));
}
var code = _export_sfc2(_sfc_main$f, [["render", _sfc_render$e]]);
var _sfc_main$e = {};
var _hoisted_1$e = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$d(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$e, _cache[0] || (_cache[0] = [
createStaticVNode('', 1)
]));
}
var database = _export_sfc2(_sfc_main$e, [["render", _sfc_render$d]]);
var _sfc_main$d = {};
var _hoisted_1$d = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$c(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M102.9993763305664,63.478790526247025C101.1696763305664,61.647890526247025,98.20147633056641,61.647890526247025,96.3717763305664,63.478790526247025L74.74517633056641,85.11909052624702L53.118526330566404,63.478790526247025C51.28880633056641,61.647890526247025,48.32063633056641,61.647890526247025,46.49091633056641,63.478790526247025C44.66119533056641,65.30969052624702,44.66119533056641,68.27969052624702,46.49091633056641,70.11059052624702L68.11757633056641,91.75089052624702L46.488966330566406,113.39069052624703C44.659246330566404,115.22169052624703,44.659246330566404,118.19169052624703,46.488966330566406,120.02269052624702C47.40480633056641,120.93969052624702,48.60378633056641,121.39669052624703,49.8027763305664,121.39669052624703C51.00175633056641,121.39669052624703,52.20073633056641,120.93969052624702,53.1165763305664,120.02269052624702L74.74517633056641,98.38269052624702L96.3698763305664,120.02269052624702C97.2856763305664,120.93969052624702,98.4846763305664,121.39669052624703,99.68367633056641,121.39669052624703C100.88257633056641,121.39669052624703,102.0815763305664,120.93969052624702,102.9974763305664,120.02269052624702C104.8271763305664,118.19169052624703,104.8271763305664,115.22169052624703,102.9974763305664,113.39069052624703L81.37277633056641,91.75089052624702L102.9993763305664,70.11059052624702C104.82917633056641,68.27969052624702,104.82917633056641,65.30969052624702,102.9993763305664,63.478790526247025ZM143.13607633056642,29.825490526247023L120.19137633056641,6.866270526247025C116.89937633056641,3.5724405262470245,112.70147633056641,1.3344315262470245,108.13317633056641,0.43769052624702454L108.13317633056641,26.206690526247023C108.13317633056641,34.38799052624702,114.7607763305664,41.01979052624702,122.93697633056641,41.01979052624702L149.3716763305664,41.01979052624702C148.3716763305664,36.78159052624702,146.2126763305664,32.90549052624702,143.13607633056642,29.825490526247023Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M81.37277633056641,89.4060757019043L102.9993763305664,67.76582570190429C104.82917633056641,65.9349557019043,104.82917633056641,62.9649057019043,102.9993763305664,61.134035701904295C101.1696763305664,59.3031567019043,98.20147633056641,59.3031567019043,96.3717763305664,61.134035701904295L74.74517633056641,82.7742757019043L53.118526330566404,61.134035701904295C51.28880633056641,59.3031567019043,48.32063633056641,59.3031567019043,46.49091633056641,61.134035701904295C44.66119533056641,62.9649057019043,44.66119533056641,65.9349557019043,46.49091633056641,67.76582570190429L68.11757633056641,89.4060757019043L46.488966330566406,111.0463757019043C44.659246330566404,112.8772757019043,44.659246330566404,115.8472757019043,46.488966330566406,117.6781757019043C47.40480633056641,118.59457570190429,48.60378633056641,119.0518757019043,49.8027763305664,119.0518757019043C51.00175633056641,119.0518757019043,52.20073633056641,118.59457570190429,53.1165763305664,117.6781757019043L74.74517633056641,96.0378757019043L96.3698763305664,117.6781757019043C97.2856763305664,118.59457570190429,98.4846763305664,119.0518757019043,99.68367633056641,119.0518757019043C100.88257633056641,119.0518757019043,102.0815763305664,118.59457570190429,102.9974763305664,117.6781757019043C104.8271763305664,115.8472757019043,104.8271763305664,112.8772757019043,102.9974763305664,111.0463757019043L81.37277633056641,89.4060757019043Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var excel = _export_sfc2(_sfc_main$d, [["render", _sfc_render$c]]);
var _sfc_main$c = {};
var _hoisted_1$c = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$b(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M119.4187,6.43348L142.679,29.4102C145.799,32.4921,147.987,36.3713,149,40.613L122.202,40.613C113.9134,40.613,107.1945,33.9762,107.1945,25.7887L107.1945,0C111.8257,0.897429,116.0814,3.13714,119.4187,6.43348ZM102.2165,77.5181L78.4159,77.5181C77.3094,77.5182,76.292,76.8169,75.7664,75.6919L66.9447,56.7338C66.4191,55.6088,65.4017,54.9076,64.2951,54.9076L48.02165,54.9076C44.69598,54.9076,42,58.0224,42,61.8647L42,114.043C42,117.885,44.69598,121,48.02165,121L102.2165,121C105.5421,121,108.2381,117.885,108.2381,114.043L108.2381,84.4752C108.2381,80.6329,105.5421,77.5181,102.2165,77.5181ZM79.3878,73.0348C79.78110000000001,73.8506,80.52170000000001,74.3613,81.3298,74.3741L100.9002,74.3741C102.1591,74.3742,103.1751,73.1848,103.1583,71.7304L103.1583,67.2604C103.15,63.9821,100.8474,61.3295,98.0098,61.3295L77.6115,61.3295C75.8888,61.33,74.801,63.4694,75.6394,65.2081L79.3878,73.0348ZM76.6245,107.955L55.5487,107.955C54.3016,107.955,53.2906,106.787,53.2906,105.347C53.2906,103.906,54.3016,102.738,55.5487,102.738L76.6245,102.738C77.8716,102.738,78.8826,103.906,78.8826,105.347C78.8826,106.787,77.8716,107.955,76.6245,107.955ZM87.1623,107.955L84.1515,107.955C82.90440000000001,107.955,81.8934,106.787,81.8934,105.347C81.8934,103.906,82.90440000000001,102.738,84.1515,102.738L87.1623,102.738C88.40950000000001,102.738,89.4205,103.906,89.4205,105.347C89.4205,106.787,88.40950000000001,107.955,87.1623,107.955Z",
"fill-rule": "evenodd",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M80.73519999999999,75.2368L104.0909,75.2368C107.3544,75.2368,110,78.3002,110,82.0789L110,111.1579C110,114.9367,107.3544,118,104.0909,118L50.90909,118C47.64559,118,45,114.9367,45,111.1579L45,59.84211C45,56.06331,47.64559,53,50.90909,53L66.8784,53C67.96430000000001,53,68.9626,53.689657,69.4784,54.79605L78.1352,73.4408C78.65100000000001,74.5472,79.6494,75.23689999999999,80.73519999999999,75.2368ZM83.5947,72.1447C82.8017,72.1322,82.0749,71.62989999999999,81.689,70.8276L78.0106,63.1303C77.1879,61.42029,78.2553,59.31629,79.94579999999999,59.31579L99.96289999999999,59.31579C102.7474,59.31579,105.007,61.92451,105.01509999999999,65.1487L105.01509999999999,69.5447C105.0316,70.9751,104.0347,72.1449,102.7992,72.1447L83.5947,72.1447ZM58.295500000000004,105.1711L78.9773,105.1711C80.2011,105.1711,81.19319999999999,104.0223,81.19319999999999,102.6053C81.19319999999999,101.1882,80.2011,100.0395,78.9773,100.0395L58.295500000000004,100.0395C57.071600000000004,100.0395,56.079499999999996,101.1882,56.079499999999996,102.6053C56.079499999999996,104.0223,57.071600000000004,105.1711,58.295500000000004,105.1711ZM86.36359999999999,105.1711L89.31819999999999,105.1711C90.542,105.1711,91.5341,104.0223,91.5341,102.6053C91.5341,101.1882,90.542,100.0395,89.31819999999999,100.0395L86.36359999999999,100.0395C85.13980000000001,100.0395,84.1477,101.1882,84.1477,102.6053C84.1477,104.0223,85.13980000000001,105.1711,86.36359999999999,105.1711Z",
"fill-rule": "evenodd",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var file = _export_sfc2(_sfc_main$c, [["render", _sfc_render$b]]);
var _sfc_main$b = {};
var _hoisted_1$b = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$a(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M121.4512,6.3707L143.8997,29.1232C146.9096,32.1755,149.022,36.0167,150,40.2167L124.1374,40.2167C116.138,40.2167,109.6537,33.6446,109.6537,25.537L109.6537,0C114.1233,0.888667,118.2304,3.10652,121.4512,6.3707ZM87.7937,65.9973C89.4664,69.7349,93.815,71.3907,97.505,69.6951C101.195,67.9995,102.8281,63.595,101.1519,59.8591C99.4793,56.1216,95.1306,54.4657,91.4406,56.1613C87.75059999999999,57.8569,86.1175,62.2614,87.7937,65.9973ZM110.9348,108.381L102.7132,85.7332C100.8391,80.5692,96.15270000000001,80.5692,94.2787,85.7332L86.48910000000001,107.194L72.0064,67.2953C70.1323,62.1332,65.44839999999999,62.1332,63.5743,67.2953L48.659585,108.385C46.78551,113.547,49.1281,120,52.87625,120L106.71809999999999,120C110.46629999999999,119.998,112.8089,113.545,110.9348,108.381Z",
"fill-rule": "evenodd",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M93.5992,66.3085C89.8277,68.0171,85.3829,66.3485,83.6733,62.582300000000004C81.96000000000001,58.81768,83.6292,54.37933,87.4008,52.670698C91.1723,50.96207,95.6171,52.630641,97.3267,56.39691C99.03999999999999,60.16151,97.3708,64.5999,93.5992,66.3085ZM98.9225,82.4699L107.3258,105.29169999999999C109.2413,110.49539999999999,106.84700000000001,116.9981,103.01599999999999,117L47.98403,117C44.15304,117,41.75867,110.4973,43.674163,105.29560000000001L58.9185,63.8902C60.834,58.68846,65.6215,58.68846,67.537,63.8902L82.3398,104.0961L90.30160000000001,82.4699C92.2171,77.2662,97.007,77.2662,98.9225,82.4699Z",
"fill-rule": "evenodd",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var image = _export_sfc2(_sfc_main$b, [["render", _sfc_render$a]]);
var _sfc_main$a = {};
var _hoisted_1$a = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$9(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [
createStaticVNode('', 1)
]));
}
var link = _export_sfc2(_sfc_main$a, [["render", _sfc_render$9]]);
var _sfc_main$9 = {};
var _hoisted_1$9 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$8(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.6847224914551,29.348195451831817L120.64612249145507,6.751235451831818C117.34072249145508,3.5093754518318176,113.12572249145508,1.3066904518318176,108.53872249145508,0.4240954518318176L108.53872249145508,25.78649545183182C108.53872249145508,33.83869545183182,115.19342249145508,40.36589545183182,123.40292249145507,40.36589545183182L149.94502249145506,40.36589545183182C148.94202249145508,36.19419545183182,146.77402249145507,32.379095451831816,143.6847224914551,29.348195451831817ZM101.86832249145507,56.54919545183182C100.65262249145508,56.54919545183182,99.45662249145508,57.010695451831815,98.55852249145508,57.88189545183182L75.34352249145508,80.39609545183181L51.96971249145508,57.87229545183182C50.61767249145508,56.56899545183182,48.60014249145508,56.189195451831814,46.85221249145508,56.908795451831814C45.10387249145508,57.62709545183182,43.96602249145508,59.304995451831815,43.96602249145508,61.16469545183182L43.96602249145508,115.86109545183182C43.96602249145508,118.40909545183182,46.073802491455076,120.47609545183182,48.67177249145508,120.47609545183182C51.26973249145508,120.47609545183182,53.37751249145508,118.40909545183182,53.37751249145508,115.86109545183182L53.37751249145508,72.16889545183182L72.05542249145508,90.16949545183182C73.89062249145508,91.93689545183182,76.83372249145508,91.93309545183182,78.66112249145507,90.15989545183182L97.16052249145508,72.21889545183181L97.16052249145508,115.73409545183182C97.16052249145508,118.28209545183182,99.26832249145508,120.34909545183181,101.86632249145508,120.34909545183181C104.46432249145508,120.34909545183181,106.57202249145507,118.28209545183182,106.57202249145507,115.73409545183182L106.57202249145507,61.16469545183182C106.57202249145507,59.303095451831815,105.43092249145508,57.62229545183182,103.68002249145508,56.90489545183182C103.10582249145509,56.670595451831815,102.49012249145508,56.549695451831816,101.86832249145507,56.54919545183182Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", { transform: "matrix(1,0,0,-1,0,236)" }, [
createBaseVNode("path", {
d: "M101.3418,183C100.1379,183,98.9534,182.5307,98.0641,181.6449L75.0738,158.7528L51.92622,181.65460000000002C50.58726,182.9798,48.58926,183.36599999999999,46.85825,182.6343C45.12683,181.9039,44,180.1979,44,178.30700000000002L44,122.693C44,120.10207,46.08738,118,48.66019,118C51.23301,118,53.32039,120.10207,53.32039,122.693L53.32039,167.1181L71.8175,148.8154C73.635,147.01839999999999,76.5495,147.0223,78.3592,148.8252L96.6796,167.0672L96.6796,122.82205C96.6796,120.23113,98.767,118.129058,101.3398,118.129058C103.9126,118.129058,106,120.23113,106,122.82205L106,178.30700000000002C106,180.1998,104.8699,181.90879999999999,103.13589999999999,182.63819999999998C102.5673,182.8764,101.9576,182.99939999999998,101.3418,183Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var mark = _export_sfc2(_sfc_main$9, [["render", _sfc_render$8]]);
var _sfc_main$8 = {};
var _hoisted_1$8 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$7(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.13620864868165,29.825575939702986L120.19140864868164,6.866355939702988C116.89940864868164,3.5725259397029876,112.70150864868164,1.3345169397029877,108.13320864868165,0.43777593970298767L108.13320864868165,26.206775939702986C108.13320864868165,34.388075939702986,114.76080864868165,41.019875939702985,122.93690864868164,41.019875939702985L149.37120864868166,41.019875939702985C148.37120864868166,36.781675939702986,146.21220864868164,32.905575939702985,143.13620864868165,29.825575939702986ZM101.77890864868164,95.86997593970298C97.32860864868164,95.86997593970298,92.91740864868164,96.51677593970298,88.46900864868164,97.35497593970298C83.22200864868165,92.51687593970298,78.77170864868164,86.80347593970299,75.38760864868163,80.441375939703C79.00020864868165,68.59437593970299,79.18960864868164,60.55767593970299,76.45190864868164,56.74747593970299C75.19620864868165,55.07097593970299,73.10480864868164,54.004075939702986,70.97640864868164,54.004075939702986C68.23860864868163,53.81457593970299,65.69030864868164,55.07097593970299,64.43470864868164,57.39417593970299C60.63270864868164,63.75637593970299,66.14530864868163,76.25007593970298,68.69360864868165,81.31677593970299C65.76450864868164,90.42027593970299,62.15190864868164,99.10567593970299,57.51410864868164,107.56277593970299C37.436047648681644,116.24777593970299,37.01620864868164,121.54077593970298,37.01620864868164,123.44677593970299C37.01620864868164,125.76977593970298,38.27181864868164,128.092775939703,40.59167864868164,129.159775939703C41.42745864868164,129.76977593970298,42.68306864868164,129.997775939703,43.74731864868164,129.997775939703C49.03340864868164,129.997775939703,55.155208648681636,124.05577593970298,61.69690864868164,112.40077593970298C69.94920864868163,109.01077593970298,78.16250864868164,106.26677593970298,86.83460864868164,104.36377593970299C91.28490864868164,108.17177593970298,96.76040864868165,110.30577593970298,102.46440864868164,110.72577593970298C106.07690864868164,110.72577593970298,113.03650864868165,110.72577593970298,112.96030864868165,103.48877593970299C113.18880864868164,100.74477593970299,111.70470864868165,96.09857593970298,101.77890864868164,95.86997593970298ZM44.03437864868164,123.58877593970298L43.39777864868164,123.81777593970298C45.27240864868164,121.07077593970298,47.74460864868164,118.93277593970299,50.89240864868164,117.63577593970298C49.24430864868164,120.42177593970298,46.95762864868164,122.51977593970298,44.03437864868164,123.58877593970298ZM69.92580864868164,60.60067593970299C70.12500864868164,60.37407593970299,70.54480864868164,60.141475939702985,70.78500864868164,60.141475939702985L71.48210864868165,60.37407593970299C72.56000864868165,63.971275939702984,72.56000864868165,67.76007593970299,71.24190864868164,71.32017593970299C69.68760864868165,67.94767593970299,69.04900864868165,64.16087593970299,69.92580864868164,60.60067593970299ZM80.88850864868164,101.61677593970299C76.27810864868164,102.69177593970299,71.21260864868164,104.18977593970298,66.60220864868164,105.87777593970299L66.12380864868165,106.06577593970299L66.18630864868165,105.68677593970298C68.49250864868164,101.00277593970299,70.60730864868164,96.08687593970299,72.49760864868165,91.172575939703L72.72410864868164,90.69387593970299L72.95260864868163,90.98107593970299C75.29580864868164,94.59007593970298,78.26400864868164,98.31047593970298,81.43920864868164,101.49777593970299L80.88850864868164,101.61677593970299ZM102.59710864868164,104.26977593970298C100.47450864868165,104.084775939703,98.39090864868163,103.67577593970299,96.27020864868163,102.63877593970298C98.16440864868164,102.22977593970299,99.83200864868164,102.22977593970299,101.72620864868163,102.22977593970299C105.93240864868164,102.22977593970299,106.76620864868164,103.26977593970298,106.80340864868164,103.861775939703C105.55170864868164,104.26977593970298,104.07340864868164,104.492775939703,102.59710864868164,104.26977593970298Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M101.72420864868164,99.88526478271484C99.83010864868163,99.88526478271484,98.16240864868163,99.88526478271484,96.26830864868164,100.29366478271484C98.39090864868163,101.33316478271485,100.47450864868165,101.73956478271484,102.59520864868163,101.92526478271483C104.07340864868164,102.14796478271484,105.55160864868164,101.92526478271483,106.80140864868164,101.51686478271483C106.76430864868163,100.92476478271485,105.93040864868163,99.88526478271484,101.72420864868164,99.88526478271484ZM72.95250864868164,88.63626478271485L72.72400864868163,88.34896478271484L72.49750864868165,88.82776478271484C70.60730864868164,93.74196478271485,68.49050864868164,98.65816478271483,66.18630864868165,103.34186478271485L66.12380864868165,103.72096478271484L66.60220864868164,103.53336478271484C71.21260864868164,101.84316478271484,76.27800864868163,100.34646478271485,80.88850864868164,99.27176478271485L81.43720864868163,99.15256478271485C78.26400864868164,95.96366478271484,75.29580864868164,92.24526478271484,72.95250864868164,88.63626478271485ZM71.48410864868164,58.02720478271485L70.78690864868165,57.794684782714846C70.54670864868164,57.794684782714846,70.12690864868165,58.02720478271485,69.92770864868163,58.25386478271484C69.04900864868165,61.81396478271485,69.68750864868164,65.60086478271484,71.24580864868165,68.97146478271485C72.56200864868164,65.41326478271485,72.56200864868164,61.626434782714846,71.48410864868164,58.02720478271485ZM43.39776864868164,121.47276478271485L44.03435864868164,121.24416478271485C46.95761864868164,120.17536478271484,49.24430864868164,118.07676478271485,50.89240864868164,115.29036478271485C47.74460864868164,116.58786478271485,45.272398648681644,118.72556478271484,43.39776864868164,121.47276478271485ZM102.46430864868164,108.38116478271485C96.76040864868165,107.96296478271483,91.28490864868164,105.82926478271484,86.83460864868164,102.01896478271485C78.16440864868164,103.92416478271485,69.94920864868163,106.66556478271485,61.69690864868164,110.05566478271484C55.155208648681636,121.71116478271485,49.03340864868164,127.65316478271484,43.74730864868164,127.65316478271484C42.68306864868164,127.65316478271484,41.42745864868164,127.42456478271484,40.59167864868164,126.81496478271484C38.27181864868164,125.74806478271485,37.01620864868164,123.42486478271485,37.01620864868164,121.10156478271485C37.01620864868164,119.19646478271484,37.43409864868164,113.90306478271484,57.51410864868164,105.21766478271485C62.153908648681636,96.76086478271483,65.76640864868165,88.07546478271485,68.69360864868165,78.97186478271485C66.14530864868163,73.90516478271485,60.63070864868164,61.41149478271484,64.43470864868164,55.04935478271484C65.69030864868164,52.726074782714846,68.23670864868164,51.46967078271484,70.97640864868164,51.659206682714846C73.10680864868164,51.659206682714846,75.19820864868164,52.726074782714846,76.45180864868163,54.40259478271484C79.18960864868164,58.21088478271484,79.00020864868165,66.24956478271484,75.38760864868163,78.09646478271485C78.77170864868164,84.45866478271483,83.22200864868165,90.17206478271484,88.46900864868164,95.01016478271484C92.91930864868164,94.17186478271483,97.33060864868165,93.52506478271485,101.77890864868164,93.52506478271485C111.70470864868165,93.75366478271485,113.18680864868163,98.40026478271484,112.95840864868164,101.14366478271484C113.03650864868165,108.38116478271485,106.07690864868164,108.38116478271485,102.46430864868164,108.38116478271485Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var pdf = _export_sfc2(_sfc_main$8, [["render", _sfc_render$7]]);
var _sfc_main$7 = {};
var _hoisted_1$7 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$6(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0.00000223615L27.5981,0.00000223615C12.355,0.00000223615,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.4069C150,40.1874,147.532,34.2239,143.136,29.8274L120.191,6.86823C115.795,2.47051,109.835,7.45383e-7,103.622,0.00000223615Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.13607473144532,29.82753037600517L120.19137473144531,6.868310376005173C116.8993747314453,3.5744803760051727,112.70147473144532,1.3364713760051727,108.13317473144531,0.43973037600517273L108.13317473144531,26.20873037600517C108.13317473144531,34.39003037600517,114.76077473144531,41.02183037600517,122.93697473144532,41.02183037600517L149.37147473144532,41.02183037600517C148.37247473144532,36.783130376005175,146.21347473144533,32.90673037600517,143.13607473144532,29.82753037600517ZM83.59497473144532,55.578930376005175L49.29505473144531,55.578930376005175C46.707674731445316,55.578930376005175,44.60847473144531,57.67943037600517,44.60847473144531,60.268530376005174L44.60847473144531,119.42273037600518C44.60847473144531,122.01173037600518,46.707674731445316,124.11273037600517,49.29505473144531,124.11273037600517C51.88244473144531,124.11273037600517,53.981644731445314,122.01173037600518,53.981644731445314,119.42273037600518L53.981644731445314,103.88473037600517L83.59497473144532,103.88473037600517C96.90487473144532,103.88473037600517,107.73287473144532,93.05033037600518,107.73287473144532,79.73203037600517C107.73287473144532,66.41373037600518,96.90487473144532,55.578930376005175,83.59497473144532,55.578930376005175ZM83.59497473144532,94.50603037600517L53.981644731445314,94.50603037600517L53.981644731445314,64.95803037600517L83.59497473144532,64.95803037600517C91.73597473144531,64.95803037600517,98.35967473144531,71.58593037600517,98.35967473144531,79.73203037600517C98.35967473144531,87.87813037600517,91.73597473144531,94.50603037600517,83.59497473144532,94.50603037600517Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M83.59497473144532,53.23410415649414L49.29505473144531,53.23410415649414C46.707674731445316,53.23410415649414,44.60847473144531,55.334624156494144,44.60847473144531,57.92364415649414L44.60847473144531,117.07830415649414C44.60847473144531,119.66730415649414,46.707674731445316,121.76780415649414,49.29505473144531,121.76780415649414C51.88244473144531,121.76780415649414,53.981644731445314,119.66730415649414,53.981644731445314,117.07830415649414L53.981644731445314,101.54030415649413L83.59497473144532,101.54030415649413C96.90487473144532,101.54030415649413,107.73287473144532,90.70550415649414,107.73287473144532,77.38720415649414C107.73287473144532,64.06890415649414,96.90487473144532,53.23410415649414,83.59497473144532,53.23410415649414ZM83.59497473144532,92.16120415649414L53.981644731445314,92.16120415649414L53.981644731445314,62.61318415649414L83.59497473144532,62.61318415649414C91.73597473144531,62.61318415649414,98.35967473144531,69.24110415649415,98.35967473144531,77.38720415649414C98.35967473144531,85.53330415649414,91.73597473144531,92.16120415649414,83.59497473144532,92.16120415649414Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var ppt = _export_sfc2(_sfc_main$7, [["render", _sfc_render$6]]);
var _sfc_main$6 = {};
var _hoisted_1$6 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$5(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.4069C150,40.1874,147.532,34.2239,143.136,29.8274L120.191,6.86822C115.799,2.4707,109.839,-0.00000298153,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.13617915039063,29.825530376005172L120.19137915039063,6.8663503760051725C116.89947915039062,3.5738503760051725,112.70247915039063,1.3366073760051727,108.13517915039063,0.43973037600517273L108.13517915039063,26.20873037600517C108.13517915039063,34.39003037600517,114.76277915039063,41.02183037600517,122.93897915039062,41.02183037600517L149.37087915039064,41.02183037600517C148.37287915039065,36.782730376005176,146.21287915039062,32.90583037600517,143.13617915039063,29.825530376005172ZM66.64137915039063,91.54183037600517L49.033449150390624,81.97323037600518C46.162909150390625,80.62503037600517,43.79618415039062,81.87163037600517,43.770798150390625,84.74403037600517L43.59505197039063,105.53673037600517C43.57161995039063,108.40873037600517,45.89928915039062,111.86373037600518,48.769819150390624,113.21173037600518L66.37767915039063,122.77973037600518C69.24827915039063,124.12873037600517,71.61497915039062,122.88173037600517,71.64037915039063,120.00973037600517L71.81607915039062,99.21713037600517C71.83957915039062,96.34473037600517,69.51187915039063,92.89203037600517,66.64137915039063,91.54183037600517ZM102.39807915039063,76.15233037600517C105.64157915039063,73.96973037600517,105.82507915039062,70.67343037600517,102.80417915039062,68.82883037600517L80.15827915039063,57.82023037600517C76.96747915039063,56.169030376005175,74.18087915039062,56.03813037600517,70.33007915039062,58.04093037600517L47.578649150390625,68.96373037600517C44.33514315039063,71.14633037600517,44.15158515039062,74.44263037600517,47.17247915039062,76.28723037600517L69.03737915039062,88.07753037600517C72.05827915039063,89.92403037600518,76.51047915039062,89.87513037600517,80.42767915039062,87.85663037600517L102.39807915039063,76.15233037600517ZM100.96667915039063,81.58243037600518L81.99187915039062,91.73723037600517C79.12127915039062,93.08553037600517,76.79367915039063,96.54013037600517,76.81707915039063,99.41253037600518L76.99287915039062,120.59573037600518C77.01627915039063,123.46773037600518,79.38497915039062,124.71473037600518,82.25547915039063,123.36673037600518L101.23027915039063,113.21173037600518C104.10087915039063,111.86273037600517,106.42847915039061,108.40873037600517,106.40507915039063,105.53673037600517L106.22927915039062,84.35323037600517C106.20587915039061,81.48083037600517,103.83717915039063,80.23423037600517,100.96667915039063,81.58243037600518Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M66.64137915039063,89.39237504882811L49.03343915039063,79.82377504882813C46.162909150390625,78.47557504882812,43.79618415039062,79.72217504882812,43.770798150390625,82.59457504882812L43.59505197039063,103.38677504882813C43.57162005039063,106.25917504882813,45.89928915039062,109.71377504882813,48.769819150390624,111.06197504882812L66.37767915039063,120.63057504882812C69.24827915039063,121.97887504882813,71.61497915039062,120.73217504882813,71.64037915039063,117.85987504882812L71.81607915039062,97.06767504882812C71.83957915039062,94.19527504882812,69.51187915039063,90.74257504882812,66.64137915039063,89.39237504882811ZM102.39807915039063,74.00287504882812C105.64147915039062,71.82027504882812,105.82507915039062,68.52397504882812,102.80417915039062,66.67937504882812L80.15827915039063,55.67071504882813C76.96747915039063,54.019600048828124,74.18087915039062,53.888687048828125,70.33007915039062,55.891515048828126L47.578649150390625,66.81427504882812C44.33514315039063,68.99687504882813,44.15158515039062,72.29317504882812,47.17247915039062,74.13777504882813L69.03737915039062,85.92807504882812C72.05827915039063,87.77457504882813,76.51047915039062,87.72567504882812,80.42767915039062,85.70717504882813L102.39807915039063,74.00287504882812ZM106.22927915039062,82.20377504882812C106.20587915039061,79.33137504882812,103.83717915039063,78.08477504882812,100.96667915039063,79.43297504882813L81.99187915039062,89.58787504882812C79.12127915039062,90.93607504882812,76.79367915039063,94.39067504882811,76.81707915039063,97.26307504882813L76.99287915039062,118.44607504882812C77.01627915039063,121.31847504882812,79.38497915039062,122.56507504882812,82.25547915039063,121.21687504882813L101.23027915039063,111.06197504882812C104.10077915039062,109.71377504882813,106.42847915039061,106.25917504882813,106.40507915039063,103.38677504882813L106.22927915039062,82.20377504882812Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var three = _export_sfc2(_sfc_main$6, [["render", _sfc_render$5]]);
var _sfc_main$5 = {};
var _hoisted_1$5 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$4(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.4069C150,40.1874,147.532,34.2239,143.136,29.8274L120.191,6.86822C115.795,2.47051,109.835,-0.00000298153,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.163625,29.814453125L120.214825,6.865233125C116.922225,3.572843125,112.723525,1.335807125,108.154325,0.439453125L108.154325,26.197253125C108.154325,34.374953125,114.783225,41.003953125,122.960925,41.003953125L149.400625,41.003953125C148.401625,36.767253125,146.241625,32.892653125,143.163625,29.814453125ZM105.699225,62.048853125L75.957025,62.048853125C75.334625,61.921253125,74.692725,61.921253125,74.070325,62.048853125L44.328125,62.048853125C41.740235,62.048853125,39.640625,64.148453125,39.640625,66.736353125C39.640625,69.324253125,41.740235,71.423853125,44.328125,71.423853125L70.326225,71.423853125L70.326225,121.957453125C70.326225,124.544453125,72.425825,126.644453125,75.013725,126.644453125C77.60152500000001,126.644453125,79.701225,124.544453125,79.701225,121.957453125L79.701225,71.423853125L105.699225,71.423853125C108.287125,71.423853125,110.386725,69.324253125,110.386725,66.736353125C110.386725,64.148453125,108.287125,62.048853125,105.699225,62.048853125Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M105.699225,59.7050702L75.957025,59.7050702C75.334625,59.5774746,74.692725,59.5774746,74.070325,59.7050702L44.328125,59.7050702C41.740235,59.7050702,39.640625,61.804675,39.640625,64.392575C39.640625,66.980465,41.740235,69.080065,44.328125,69.080065L70.326225,69.080065L70.326225,119.613275C70.326225,122.201175,72.425825,124.300775,75.013725,124.300775C77.60152500000001,124.300775,79.701225,122.201175,79.701225,119.613275L79.701225,69.080065L105.699225,69.080065C108.287125,69.080065,110.386725,66.980465,110.386725,64.392575C110.386725,61.804675,108.287125,59.7050702,105.699225,59.7050702Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var txt = _export_sfc2(_sfc_main$5, [["render", _sfc_render$4]]);
var _sfc_main$4 = {};
var _hoisted_1$4 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$3(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
createStaticVNode('', 1)
]));
}
var unknown = _export_sfc2(_sfc_main$4, [["render", _sfc_render$3]]);
var _sfc_main$3 = {};
var _hoisted_1$3 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$2(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M143.6605,30.808L120.3316,6.73925C116.9845,3.28624,112.7164,0.940079,108.0716,0L108.0716,27.0143C108.0716,35.591,114.8101,42.5433,123.1232,42.5433L150,42.5433C148.98399999999998,38.1003,146.788,34.0369,143.6605,30.808ZM72.9483,74.8181L63.1549,63L52.06524,63L61.8587,74.8181L72.9483,74.8181ZM101.7527,74.8181L91.95920000000001,63L80.86959999999999,63L90.663,74.8181L101.7527,74.8181ZM87.3506,74.8181L77.55709999999999,63L66.4674,63L76.26089999999999,74.8181L87.3506,74.8181ZM105.9293,63L95.27170000000001,63L105.0652,74.8181L110.25,74.8181L110.25,67.4318C110.25,64.9204,108.3777,63,105.9293,63ZM48.75271,63L48.32065,63C45.87232,63,44,64.9204,44,67.4318L44,74.8181L58.5462,74.8181L48.75271,63ZM44,123.568C44,126.08,45.87232,128,48.32065,128L105.9293,128C108.3777,128,110.25,126.08,110.25,123.568L110.25,77.7727L44.00000388806,77.7727L44,123.568ZM67.0435,91.0682C67.0435,88.5568,69.0598,87.375,71.3642,87.375C72.0842,87.375,72.9483,87.5227,73.6685,87.9659L90.0869,97.7159C92.9674,99.3409,92.9674,103.477,90.0869,105.102L73.6685,114.852C72.9483,115.295,72.2283,115.443,71.3642,115.443C69.0598,115.443,67.0435,114.261,67.0435,111.75L67.0435,91.0682Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M72.4022,71.8181L62.7935,60.000000528314L51.91306,60.000000528314L61.5218,71.8181L72.4022,71.8181ZM100.663,71.8181L91.0543,60.000000528314L80.1739,60.000000528314L89.7826,71.8181L100.663,71.8181ZM86.5326,71.8181L76.9239,60.000000528314L66.0435,60.000000528314L75.6522,71.8181L86.5326,71.8181ZM104.76089999999999,60L94.3043,60L103.913,71.8181L109,71.8181L109,64.43182C109,61.92043,107.163,60.000000528314,104.76089999999999,60ZM48.66304,60L48.23913,60C45.837,60,44,61.92043,44,64.43182L44,71.8181L58.2718,71.8181L48.66304,60ZM44,120.56819999999999C44,123.0796,45.837,125,48.23913,125L104.76089999999999,125C107.163,125,109,123.0796,109,120.56819999999999L109,74.7727L44.00000202137,74.7727L44,120.56819999999999ZM66.6087,88.0682C66.6087,85.5568,68.5869,84.375,70.8479,84.375C71.5543,84.375,72.4022,84.5227,73.1087,84.9659L89.2174,94.7159C92.0435,96.3409,92.0435,100.4773,89.2174,102.1023L73.1087,111.8523C72.4022,112.2955,71.6957,112.44319999999999,70.8479,112.44319999999999C68.5869,112.44319999999999,66.6087,111.26140000000001,66.6087,108.75L66.6087,88.0682Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var video = _export_sfc2(_sfc_main$3, [["render", _sfc_render$2]]);
var _sfc_main$2 = {};
var _hoisted_1$2 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render$1(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,0,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M101.48797106933594,57.88857593970299C98.90057106933594,57.88857593970299,96.80137106933594,59.989075939702985,96.80137106933594,62.57807593970299L96.80137106933594,106.78877593970299L78.37727106933593,88.56017593970299C76.55537106933593,86.758575939703,73.62427106933593,86.75267593970298,71.79847106933593,88.55037593970299L53.19664106933594,106.83977593970299L53.19664106933594,62.44917593970299C53.19664106933594,59.86007593970299,51.097441069335936,57.75957593970299,48.51005106933594,57.75957593970299C45.92267106933594,57.75957593970299,43.82347106933594,59.86007593970299,43.82347106933594,62.44917593970299L43.82347106933594,118.02177593970299C43.82347106933594,119.91177593970299,44.95606106933594,121.61577593970298,46.69791106933594,122.346775939703C48.438791069335934,123.07677593970298,50.44772106933594,122.69077593970299,51.79457106933594,121.367775939703L75.07327106933593,98.48237593970299L98.19377106933594,121.35777593970299C99.07137106933594,122.22577593970298,100.25587106933594,122.712775939703,101.48997106933594,122.71177593970299C102.09727106933593,122.71177593970299,102.71037106933593,122.59277593970299,103.29427106933593,122.349775939703C105.03867106933595,121.62177593970299,106.17457106933594,119.91477593970299,106.17457106933594,118.02177593970299L106.17457106933594,62.57807593970299C106.17457106933594,59.989075939702985,104.07737106933594,57.88857593970299,101.48797106933594,57.88857593970299ZM143.13607106933594,29.825575939702986L120.19137106933594,6.866355939702988C116.89937106933594,3.5725259397029876,112.70147106933594,1.3345169397029877,108.13317106933594,0.43777593970298767L108.13317106933594,26.206775939702986C108.13317106933594,34.388075939702986,114.76077106933593,41.019875939702985,122.93687106933594,41.019875939702985L149.37147106933594,41.019875939702985C148.37247106933594,36.78137593970299,146.21347106933592,32.90507593970299,143.13607106933594,29.825575939702986Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M101.48997106933594,120.36685296020508C100.27927106933595,120.36685296020508,99.08807106933594,119.89785296020507,98.19367106933593,119.01275296020508L75.07327106933593,96.13755296020508L51.79457106933594,119.02255296020508C50.44803106933594,120.34665296020508,48.43872106933594,120.73265296020507,46.69791106933594,120.00145296020507C44.956681069335936,119.27155296020507,43.82347106933594,117.56685296020507,43.82347106933594,115.67735296020507L43.82347106933594,60.10429296020508C43.82347106933594,57.51527296020508,45.92267106933594,55.41475296020508,48.51005106933594,55.41475296020508C51.097441069335936,55.41475296020508,53.19664106933594,57.51527296020508,53.19664106933594,60.10429296020508L53.19664106933594,104.49665296020507L71.79847106933593,86.20745296020507C73.62627106933594,84.41175296020508,76.55727106933594,84.41565296020508,78.37727106933593,86.21725296020507L96.80137106933594,104.44585296020509L96.80137106933594,60.23325296020508C96.80137106933594,57.64424296020508,98.90057106933594,55.54371596020508,101.48797106933594,55.54371596020508C104.07537106933594,55.54371596020508,106.17457106933594,57.64424296020508,106.17457106933594,60.23325296020508L106.17457106933594,115.67735296020507C106.17457106933594,117.56875296020507,105.03807106933593,119.27655296020508,103.29427106933593,120.00535296020507C102.72247106933594,120.24345296020508,102.10927106933593,120.36625296020507,101.48997106933594,120.36685296020508Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var word = _export_sfc2(_sfc_main$2, [["render", _sfc_render$1]]);
var _sfc_main$12 = {};
var _hoisted_1$1 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
fill: "none",
version: "1.1",
width: "1em",
height: "1em",
viewBox: "0 0 150 175"
};
function _sfc_render(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
createBaseVNode("g", null, [
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M103.622,0L27.5981,0C12.355,0,0,12.3648,0,27.6155L0,147.384C0,162.637,12.357,175,27.5981,175L122.402,175C137.645,175,150,162.635,150,147.384L150,46.405C150,40.1855,147.532,34.2219,143.136,29.8255L120.191,6.86627C115.797,2.46982,109.837,-0.00000447229,103.622,0Z",
fill: "currentColor",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M34.325330513916015,25.79257593970299L48.29132051391602,25.79257593970299C49.82622051391601,25.79257593970299,51.072020513916016,24.545875939702988,51.072020513916016,23.010075939702986L51.072020513916016,9.035265939702988C51.072020513916016,7.497485939702988,49.82622051391601,6.252805939702988,48.29132051391602,6.252805939702988L34.325330513916015,6.252805939702988C32.790480513916016,6.252805939702988,31.544626473216017,7.499445939702988,31.544626473216017,9.035265939702988L31.544626473216017,23.010075939702986C31.544626473216017,24.545875939702988,32.790480513916016,25.79257593970299,34.325330513916015,25.79257593970299ZM67.81882051391602,25.79257593970299L53.85272051391601,25.79257593970299C52.317920513916015,25.79257593970299,51.072020513916016,27.03917593970299,51.072020513916016,28.574975939702988L51.072020513916016,42.549875939702986C51.072020513916016,44.08767593970299,52.317920513916015,45.33227593970299,53.85272051391601,45.33227593970299L67.81882051391602,45.33227593970299C69.35362051391601,45.33227593970299,70.59952051391602,44.08567593970299,70.59952051391602,42.549875939702986L70.59952051391602,28.575075939702987C70.59952051391602,27.03917593970299,69.35362051391601,25.79257593970299,67.81882051391602,25.79257593970299ZM34.325330513916015,64.87207593970298L48.29132051391602,64.87207593970298C49.82622051391601,64.87207593970298,51.072020513916016,63.62547593970299,51.072020513916016,62.08957593970299L51.072020513916016,48.11477593970299C51.072020513916016,46.57697593970299,49.82622051391601,45.33227593970299,48.29132051391602,45.33227593970299L34.325330513916015,45.33227593970299C32.790480513916016,45.33227593970299,31.544626473216017,46.578975939702985,31.544626473216017,48.11477593970299L31.544626473216017,62.08957593970299C31.544626473216017,63.62547593970299,32.790480513916016,64.87207593970298,34.325330513916015,64.87207593970298ZM67.81882051391602,64.87207593970298L53.85272051391601,64.87207593970298C52.317920513916015,64.87207593970298,51.072020513916016,66.11867593970298,51.072020513916016,67.65447593970299L51.072020513916016,81.62937593970298C51.072020513916016,83.16717593970299,52.317920513916015,84.411875939703,53.85272051391601,84.411875939703L67.81882051391602,84.411875939703C69.35362051391601,84.411875939703,70.59952051391602,83.16517593970299,70.59952051391602,81.62937593970298L70.59952051391602,67.65447593970299C70.59952051391602,66.11867593970298,69.35362051391601,64.87207593970298,67.81882051391602,64.87207593970298ZM63.77272051391601,95.19977593970299L37.580550513916016,95.19977593970299C34.24722051391601,95.19977593970299,31.544620513916016,97.90407593970299,31.544620513916016,101.239775939703L31.544620513916016,131.61977593970298C31.544620513916016,134.955775939703,34.24722051391601,137.659775939703,37.580550513916016,137.659775939703L63.77272051391601,137.659775939703C67.10602051391601,137.659775939703,69.80862051391603,134.955775939703,69.80862051391603,131.61977593970298L69.80862051391603,101.239775939703C69.80862051391603,97.90407593970299,67.10602051391601,95.19977593970299,63.77272051391601,95.19977593970299ZM62.810020513916015,127.35977593970298C62.810020513916015,130.040775939703,60.63852051391602,132.213775939703,57.959420513916015,132.213775939703L43.39192051391602,132.213775939703C40.71275051391601,132.213775939703,38.54130051391601,130.040775939703,38.54130051391601,127.35977593970298L38.54130051391601,122.01377593970298C38.54130051391601,119.33377593970299,40.71275051391601,117.16077593970299,43.39192051391602,117.16077593970299L57.959420513916015,117.16077593970299C60.63852051391602,117.16077593970299,62.810020513916015,119.33277593970298,62.810020513916015,122.01377593970298L62.810020513916015,127.35977593970298ZM143.13562051391602,29.825575939702986L120.19142051391601,6.866355939702988C116.89942051391601,3.5725259397029876,112.70152051391601,1.3345199397029877,108.13322051391602,0.43777593970298767L108.13322051391602,26.206775939702986C108.13322051391602,34.388075939702986,114.76082051391602,41.019875939702985,122.93692051391602,41.019875939702985L149.371620513916,41.019875939702985C148.371620513916,36.78157593970299,146.21262051391602,32.905375939702985,143.13562051391602,29.825575939702986Z",
fill: "#000000",
"fill-opacity": "0.20000000298023224",
style: { "mix-blend-mode": "passthrough" }
})
]),
createBaseVNode("g", null, [
createBaseVNode("path", {
d: "M34.325330513916015,23.44775087814331L48.29132051391602,23.44775087814331C49.82622051391601,23.44775087814331,51.072020513916016,22.20105087814331,51.072020513916016,20.66525087814331L51.072020513916016,6.690410878143311C51.072020513916016,5.15263087814331,49.82622051391601,3.9079508781433105,48.29132051391602,3.9079508781433105L34.325330513916015,3.9079508781433105C32.790480513916016,3.9079508781433105,31.544626473216017,5.154590878143311,31.544626473216017,6.690410878143311L31.544626473216017,20.66525087814331C31.544626473216017,22.20105087814331,32.790480513916016,23.44775087814331,34.325330513916015,23.44775087814331ZM67.81882051391602,23.44775087814331L53.85272051391601,23.44775087814331C52.317920513916015,23.44775087814331,51.072020513916016,24.69435087814331,51.072020513916016,26.23015087814331L51.072020513916016,40.20505087814331C51.072020513916016,41.74275087814331,52.317920513916015,42.987450878143314,53.85272051391601,42.987450878143314L67.81882051391602,42.987450878143314C69.35362051391601,42.987450878143314,70.59952051391602,41.74085087814331,70.59952051391602,40.20505087814331L70.59952051391602,26.23015087814331C70.59952051391602,24.69435087814331,69.35362051391601,23.44775087814331,67.81882051391602,23.44775087814331ZM34.325330513916015,62.52725087814331L48.29132051391602,62.52725087814331C49.82622051391601,62.52725087814331,51.072020513916016,61.28055087814331,51.072020513916016,59.74475087814331L51.072020513916016,45.76995087814331C51.072020513916016,44.23215087814331,49.82622051391601,42.987450878143314,48.29132051391602,42.987450878143314L34.325330513916015,42.987450878143314C32.790480513916016,42.987450878143314,31.544626473216017,44.23405087814331,31.544626473216017,45.76995087814331L31.544626473216017,59.74475087814331C31.544626473216017,61.28055087814331,32.790480513916016,62.52725087814331,34.325330513916015,62.52725087814331ZM67.81882051391602,62.52725087814331L53.85272051391601,62.52725087814331C52.317920513916015,62.52725087814331,51.072020513916016,63.773850878143314,51.072020513916016,65.30965087814332L51.072020513916016,79.2845508781433C51.072020513916016,80.82235087814331,52.317920513916015,82.06695087814332,53.85272051391601,82.06695087814332L67.81882051391602,82.06695087814332C69.35362051391601,82.06695087814332,70.59952051391602,80.82035087814332,70.59952051391602,79.2845508781433L70.59952051391602,65.30965087814332C70.59952051391602,63.773850878143314,69.35362051391601,62.52725087814331,67.81882051391602,62.52725087814331ZM63.77272051391601,92.85485087814331L37.580550513916016,92.85485087814331C34.24722051391601,92.85485087814331,31.544620513916016,95.55915087814331,31.544620513916016,98.8945508781433L31.544620513916016,129.27495087814333C31.544620513916016,132.6099508781433,34.24722051391601,135.31495087814332,37.580550513916016,135.31495087814332L63.77272051391601,135.31495087814332C67.10602051391601,135.31495087814332,69.80862051391603,132.6099508781433,69.80862051391603,129.27495087814333L69.80862051391603,98.8945508781433C69.80862051391603,95.55915087814331,67.10602051391601,92.85485087814331,63.77272051391601,92.85485087814331ZM62.810020513916015,125.01495087814331C62.810020513916015,127.69595087814331,60.63852051391602,129.86895087814332,57.959420513916015,129.86895087814332L43.39192051391602,129.86895087814332C40.71275051391601,129.86895087814332,38.54130051391601,127.69595087814331,38.54130051391601,125.01495087814331L38.54130051391601,119.6689508781433C38.54130051391601,116.98795087814331,40.71275051391601,114.81595087814331,43.39192051391602,114.81595087814331L57.959420513916015,114.81595087814331C60.63852051391602,114.81595087814331,62.810020513916015,116.98795087814331,62.810020513916015,119.6689508781433L62.810020513916015,125.01495087814331Z",
fill: "#FFFFFF",
"fill-opacity": "1",
style: { "mix-blend-mode": "passthrough" }
})
])
], -1)
]));
}
var zip = _export_sfc2(_sfc_main$12, [["render", _sfc_render]]);
var svgIconMap = {
// 文档类
word,
excel,
ppt,
pdf,
txt,
mark,
// 图片类
image,
// 音频类
audio,
// 视频类
video,
// 3D 模型类
three,
// 可执行程序类
code,
// 数据库类
database,
// 链接文件类
link,
// 压缩包类
zip,
// 通用文件/文件夹类
file,
// 未知文件类
unknown
};
var _hoisted_1 = {
key: 2,
class: "preview-mask-loading"
};
var _hoisted_2 = {
key: 3,
class: "preview-mask-error"
};
var _hoisted_3 = { class: "error-text" };
var _hoisted_4 = { class: "elx-files-card-content" };
var _hoisted_5 = {
key: 0,
class: "elx-files-card-name"
};
var _hoisted_6 = { class: "elx-files-card-name-prefix" };
var _hoisted_7 = { class: "elx-files-card-name-suffix" };
var _sfc_main2 = defineComponent({
__name: "index",
props: {
uid: { default: void 0 },
name: { default: void 0 },
fileSize: { default: void 0 },
fileType: { default: void 0 },
description: { default: void 0 },
url: { default: void 0 },
thumbUrl: { default: void 0 },
imgFile: { default: void 0 },
iconSize: { default: "42px" },
iconColor: { default: void 0 },
showDelIcon: { type: Boolean, default: false },
maxWidth: { default: "236px" },
noStyle: { type: Boolean },
style: { default: void 0 },
hoverStyle: { default: void 0 },
imgVariant: { default: "rectangle" },
imgPreview: { type: Boolean, default: true },
imgPreviewMask: { type: Boolean, default: true },
status: { default: void 0 },
percent: { default: void 0 },
errorTip: { default: void 0 }
},
emits: ["delete", "imagePreview"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const { name, fileType, description, url, thumbUrl, fileSize, imgVariant } = toRefs(props);
const { namePrefix, nameSuffix } = useFileNameParser(name);
const isHovered = ref(false);
const imageHovered = ref(false);
const _previewImg = ref(void 0);
const _fileType = computed(() => {
if (fileType.value)
return fileType.value;
if (!name.value)
return void 0;
if (!nameSuffix.value) {
return "unknown";
}
return getFileType(nameSuffix.value).lowerCase;
});
const _fileTypeUpperCase = computed(() => {
if (fileType.value)
return fileType.value.replace(/^\w/, (match2) => match2.toUpperCase());
if (!name.value)
return "";
if (!nameSuffix.value) {
return "Unknown";
}
return getFileType(nameSuffix.value).upperCase;
});
const _description = computed(() => {
if (description.value) {
return description.value;
}
const typeStr = _fileTypeUpperCase.value;
const sizeStr = fileSize.value ? `・${getSize(fileSize.value)}` : "";
if (props.status === "uploading") {
return `上传中...${`・${props.percent || 0}`}%${sizeStr}`;
}
if (props.status === "error") {
return props.errorTip || "上传失败";
}
return `${typeStr}${sizeStr}`;
});
const isImageFile = computed(() => _fileType.value === "image");
const isSquareVariant = computed(() => imgVariant.value === "square");
const _previewImgUrl = computed(() => {
if (!isImageFile.value)
return void 0;
if (thumbUrl.value)
return thumbUrl.value;
if (url.value)
return url.value;
return _previewImg.value;
});
const _iconSize = computed(() => {
if (isSquareVariant.value && isImageFile.value && !props.iconSize || isSquareVariant.value && isImageFile.value && props.iconSize === "42px") {
return "64px";
}
return props.iconSize;
});
watch(
() => props.imgFile,
async (newFile) => {
if (newFile) {
try {
const url2 = await previewImage(newFile);
_previewImg.value = url2;
} catch (error2) {
}
} else {
_previewImg.value = void 0;
}
},
{ deep: true, immediate: true }
);
function handleDelete() {
emits("delete", { ...props });
}
const imgRef = ref();
function handlePreviewAction(type) {
if (props.imgPreview && imgRef.value && _previewImgUrl && type === "mask") {
imgRef.value.showPreview();
}
if (type === "self") {
emits("imagePreview", { ...props });
}
}
__expose({
namePrefix,
nameSuffix,
colorMap
});
return (_ctx, _cache) => {
const _component_el_image = ElImage;
const _component_el_icon = ElIcon;
const _component_el_progress = ElProgress;
return openBlock(), createElementBlock("div", {
style: normalizeStyle({
"--elx-files-card-icon-size": `${unref(_iconSize)}`,
"--elx-files-card-max-width": `${props.maxWidth}`,
...props.style,
...unref(isHovered) && props.hoverStyle ? props.hoverStyle : {}
}),
class: normalizeClass(["elx-files-card", {
"elx-files-card-square": unref(isSquareVariant) && unref(isImageFile),
"elx-files-card-hovered": unref(isHovered),
"elx-files-card-error": props.status === "error",
"elx-files-card-done": props.status === "done",
"elx-files-card-uploading": props.status === "uploading"
}]),
onMouseenter: _cache[4] || (_cache[4] = ($event) => isHovered.value = true),
onMouseleave: _cache[5] || (_cache[5] = ($event) => isHovered.value = false)
}, [
props.status === "uploading" && !(unref(isSquareVariant) && unref(isImageFile)) ? (openBlock(), createElementBlock("div", {
key: 0,
class: "elx-files-card-progress",
style: normalizeStyle({ width: `${props.percent || 0}%` })
}, null, 4)) : createCommentVNode("", true),
_ctx.$slots.icon || unref(_fileType) ? renderSlot(_ctx.$slots, "icon", normalizeProps(mergeProps({ key: 1 }, { item: props })), () => [
!unref(isImageFile) ? (openBlock(), createBlock(resolveDynamicComponent(unref(svgIconMap)[unref(_fileType)]), {
key: 0,
class: "elx-files-card-icon",
color: props.iconColor || unref(colorMap)[unref(_fileType)]
}, null, 8, ["color"])) : createCommentVNode("", true),
unref(isImageFile) ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(["image-preview-container", {
"image-preview-container-square": unref(isSquareVariant) && unref(isImageFile)
}]),
onMouseenter: _cache[2] || (_cache[2] = ($event) => imageHovered.value = true),
onMouseleave: _cache[3] || (_cache[3] = ($event) => imageHovered.value = false)
}, [
unref(_previewImgUrl) ? (openBlock(), createBlock(_component_el_image, {
key: 0,
ref_key: "imgRef",
ref: imgRef,
class: "elx-files-card-img",
src: unref(_previewImgUrl),
"preview-src-list": props.imgPreview ? [unref(_previewImgUrl)] : [],
fit: "cover",
"show-progress": false,
"hide-on-click-modal": "",
onShow: _cache[0] || (_cache[0] = ($event) => handlePreviewAction("self"))
}, null, 8, ["src", "preview-src-list"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(svgIconMap)[unref(_fileType)]), {
key: 1,
class: "elx-files-card-img",
color: props.iconColor || unref(colorMap)[unref(_fileType)]
}, null, 8, ["color"])),
createVNode(Transition, { name: "fade" }, {
default: withCtx(() => [
unref(imageHovered) && unref(_previewImgUrl) && props.imgPreviewMask && props.imgPreview ? renderSlot(_ctx.$slots, "image-preview-actions", normalizeProps(mergeProps({ key: 0 }, {
item: { ...props, prefix: unref(namePrefix), suffix: unref(nameSuffix) }
})), () => [
createBaseVNode("div", {
class: "preview-mask",
onClick: _cache[1] || (_cache[1] = ($event) => handlePreviewAction("mask"))
}, [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(view_default))
]),
_: 1
}),
_cache[6] || (_cache[6] = createBaseVNode("span", null, "预览", -1))
])
], true) : createCommentVNode("", true)
]),
_: 3
}),
props.status === "uploading" && unref(isSquareVariant) ? (openBlock(), createElementBlock("div", _hoisted_1, [
createVNode(_component_el_progress, {
color: "#fff",
type: "circle",
percentage: props.percent,
class: "circle-progress"
}, null, 8, ["percentage"])
])) : props.status === "error" && unref(isSquareVariant) ? (openBlock(), createElementBlock("div", _hoisted_2, [
createBaseVNode("span", _hoisted_3, toDisplayString(props.errorTip || "上传失败"), 1)
])) : createCommentVNode("", true)
], 34)) : createCommentVNode("", true)
], true) : createCommentVNode("", true),
(_ctx.$slots.content || props.name || unref(description)) && !(unref(isSquareVariant) && unref(isImageFile)) ? renderSlot(_ctx.$slots, "content", normalizeProps(mergeProps({ key: 2 }, { item: props })), () => [
createBaseVNode("div", _hoisted_4, [
props.name ? (openBlock(), createElementBlock("div", _hoisted_5, [
renderSlot(_ctx.$slots, "name-prefix", normalizeProps(guardReactiveProps({
item: { ...props, prefix: unref(namePrefix), suffix: unref(nameSuffix) }
})), () => [
createBaseVNode("div", _hoisted_6, toDisplayString(unref(namePrefix)), 1)
], true),
renderSlot(_ctx.$slots, "name-suffix", normalizeProps(guardReactiveProps({
item: { ...props, prefix: unref(namePrefix), suffix: unref(nameSuffix) }
})), () => [
createBaseVNode("div", _hoisted_7, toDisplayString(unref(nameSuffix)), 1)
], true)
])) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "description", normalizeProps(guardReactiveProps({
item: { ...props, prefix: unref(namePrefix), suffix: unref(nameSuffix) }
})), () => [
createBaseVNode("div", {
class: normalizeClass(["elx-files-card-description", {
"elx-files-card-description-error": props.status === "error",
"elx-files-card-description-done": props.status === "done",
"elx-files-card-description-uploading": props.status === "uploading"
}])
}, toDisplayString(unref(_description)), 3)
], true)
])
], true) : createCommentVNode("", true),
props.showDelIcon && unref(isHovered) ? (openBlock(), createElementBlock("div", {
key: 3,
class: "elx-files-card-delete-icon",
onClick: handleDelete
}, [
renderSlot(_ctx.$slots, "del-icon", normalizeProps(guardReactiveProps({ item: props })), () => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(circle_close_filled_default))
]),
_: 1
})
], true)
])) : createCommentVNode("", true)
], 38);
};
}
});
var FilesCard = _export_sfc2(_sfc_main2, [["__scopeId", "data-v-7f40a054"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Attachments/index.js
function isEqual(value, other) {
return baseIsEqual(value, other);
}
var uploadContextKey = Symbol("uploadContextKey");
var SCOPE$1 = "ElUpload";
var UploadAjaxError = class extends Error {
constructor(message, status, method, url) {
super(message);
this.name = "UploadAjaxError";
this.status = status;
this.method = method;
this.url = url;
}
};
function getError(action, option2, xhr) {
let msg;
if (xhr.response) {
msg = `${xhr.response.error || xhr.response}`;
} else if (xhr.responseText) {
msg = `${xhr.responseText}`;
} else {
msg = `fail to ${option2.method} ${action} ${xhr.status}`;
}
return new UploadAjaxError(msg, xhr.status, option2.method, action);
}
function getBody(xhr) {
const text3 = xhr.responseText || xhr.response;
if (!text3) {
return text3;
}
try {
return JSON.parse(text3);
} catch (e) {
return text3;
}
}
var ajaxUpload = (option2) => {
if (typeof XMLHttpRequest === "undefined")
throwError(SCOPE$1, "XMLHttpRequest is undefined");
const xhr = new XMLHttpRequest();
const action = option2.action;
if (xhr.upload) {
xhr.upload.addEventListener("progress", (evt) => {
const progressEvt = evt;
progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
option2.onProgress(progressEvt);
});
}
const formData = new FormData();
if (option2.data) {
for (const [key2, value] of Object.entries(option2.data)) {
if (isArray(value) && value.length)
formData.append(key2, ...value);
else
formData.append(key2, value);
}
}
formData.append(option2.filename, option2.file, option2.file.name);
xhr.addEventListener("error", () => {
option2.onError(getError(action, option2, xhr));
});
xhr.addEventListener("load", () => {
if (xhr.status < 200 || xhr.status >= 300) {
return option2.onError(getError(action, option2, xhr));
}
option2.onSuccess(getBody(xhr));
});
xhr.open(option2.method, action, true);
if (option2.withCredentials && "withCredentials" in xhr) {
xhr.withCredentials = true;
}
const headers = option2.headers || {};
if (headers instanceof Headers) {
headers.forEach((value, key2) => xhr.setRequestHeader(key2, value));
} else {
for (const [key2, value] of Object.entries(headers)) {
if (isNil(value))
continue;
xhr.setRequestHeader(key2, String(value));
}
}
xhr.send(formData);
return xhr;
};
var uploadListTypes = ["text", "picture", "picture-card"];
var fileId = 1;
var genFileId = () => Date.now() + fileId++;
var uploadBaseProps = buildProps({
action: {
type: String,
default: "#"
},
headers: {
type: definePropType(Object)
},
method: {
type: String,
default: "post"
},
data: {
type: definePropType([Object, Function, Promise]),
default: () => mutable({})
},
multiple: Boolean,
name: {
type: String,
default: "file"
},
drag: Boolean,
withCredentials: Boolean,
showFileList: {
type: Boolean,
default: true
},
accept: {
type: String,
default: ""
},
fileList: {
type: definePropType(Array),
default: () => mutable([])
},
autoUpload: {
type: Boolean,
default: true
},
listType: {
type: String,
values: uploadListTypes,
default: "text"
},
httpRequest: {
type: definePropType(Function),
default: ajaxUpload
},
disabled: Boolean,
limit: Number
});
var uploadProps = buildProps({
...uploadBaseProps,
beforeUpload: {
type: definePropType(Function),
default: NOOP
},
beforeRemove: {
type: definePropType(Function)
},
onRemove: {
type: definePropType(Function),
default: NOOP
},
onChange: {
type: definePropType(Function),
default: NOOP
},
onPreview: {
type: definePropType(Function),
default: NOOP
},
onSuccess: {
type: definePropType(Function),
default: NOOP
},
onProgress: {
type: definePropType(Function),
default: NOOP
},
onError: {
type: definePropType(Function),
default: NOOP
},
onExceed: {
type: definePropType(Function),
default: NOOP
},
crossorigin: {
type: definePropType(String)
}
});
var uploadListProps = buildProps({
files: {
type: definePropType(Array),
default: () => mutable([])
},
disabled: Boolean,
handlePreview: {
type: definePropType(Function),
default: NOOP
},
listType: {
type: String,
values: uploadListTypes,
default: "text"
},
crossorigin: {
type: definePropType(String)
}
});
var uploadListEmits = {
remove: (file2) => !!file2
};
var __default__$3 = defineComponent({
name: "ElUploadList"
});
var _sfc_main$42 = defineComponent({
...__default__$3,
props: uploadListProps,
emits: uploadListEmits,
setup(__props, { emit }) {
const props = __props;
const { t } = useLocale();
const nsUpload = useNamespace("upload");
const nsIcon = useNamespace("icon");
const nsList = useNamespace("list");
const disabled = useFormDisabled();
const focusing = ref(false);
const containerKls = computed(() => [
nsUpload.b("list"),
nsUpload.bm("list", props.listType),
nsUpload.is("disabled", props.disabled)
]);
const handleRemove = (file2) => {
emit("remove", file2);
};
return (_ctx, _cache) => {
return openBlock(), createBlock(TransitionGroup, {
tag: "ul",
class: normalizeClass(unref(containerKls)),
name: unref(nsList).b()
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file2, index) => {
return openBlock(), createElementBlock("li", {
key: file2.uid || file2.name,
class: normalizeClass([
unref(nsUpload).be("list", "item"),
unref(nsUpload).is(file2.status),
{ focusing: focusing.value }
]),
tabindex: "0",
onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file2), ["delete"]),
onFocus: ($event) => focusing.value = true,
onBlur: ($event) => focusing.value = false,
onClick: ($event) => focusing.value = false
}, [
renderSlot(_ctx.$slots, "default", {
file: file2,
index
}, () => [
_ctx.listType === "picture" || file2.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
key: 0,
class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
src: file2.url,
crossorigin: _ctx.crossorigin,
alt: ""
}, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true),
file2.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(nsUpload).be("list", "item-info"))
}, [
createBaseVNode("a", {
class: normalizeClass(unref(nsUpload).be("list", "item-name")),
onClick: withModifiers(($event) => _ctx.handlePreview(file2), ["prevent"])
}, [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(nsIcon).m("document"))
}, {
default: withCtx(() => [
createVNode(unref(document_default))
]),
_: 1
}, 8, ["class"]),
createBaseVNode("span", {
class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
title: file2.name
}, toDisplayString(file2.name), 11, ["title"])
], 10, ["onClick"]),
file2.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
key: 0,
type: _ctx.listType === "picture-card" ? "circle" : "line",
"stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
percentage: Number(file2.percentage),
style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
}, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("label", {
class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
}, [
_ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
}, {
default: withCtx(() => [
createVNode(unref(circle_check_default))
]),
_: 1
}, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
}, {
default: withCtx(() => [
createVNode(unref(check_default))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2),
!unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
key: 2,
class: normalizeClass(unref(nsIcon).m("close")),
onClick: ($event) => handleRemove(file2)
}, {
default: withCtx(() => [
createVNode(unref(close_default))
]),
_: 2
}, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
createCommentVNode(" This is a bug which needs to be fixed "),
createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
!unref(disabled) ? (openBlock(), createElementBlock("i", {
key: 3,
class: normalizeClass(unref(nsIcon).m("close-tip"))
}, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
_ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
key: 4,
class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
}, [
createBaseVNode("span", {
class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
onClick: ($event) => _ctx.handlePreview(file2)
}, [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(nsIcon).m("zoom-in"))
}, {
default: withCtx(() => [
createVNode(unref(zoom_in_default))
]),
_: 1
}, 8, ["class"])
], 10, ["onClick"]),
!unref(disabled) ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
onClick: ($event) => handleRemove(file2)
}, [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(nsIcon).m("delete"))
}, {
default: withCtx(() => [
createVNode(unref(delete_default))
]),
_: 1
}, 8, ["class"])
], 10, ["onClick"])) : createCommentVNode("v-if", true)
], 2)) : createCommentVNode("v-if", true)
])
], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
}), 128)),
renderSlot(_ctx.$slots, "append")
]),
_: 3
}, 8, ["class", "name"]);
};
}
});
var UploadList = _export_sfc(_sfc_main$42, [["__file", "upload-list.vue"]]);
var uploadDraggerProps = buildProps({
disabled: Boolean
});
var uploadDraggerEmits = {
file: (file2) => isArray(file2)
};
var COMPONENT_NAME = "ElUploadDrag";
var __default__$2 = defineComponent({
name: COMPONENT_NAME
});
var _sfc_main$32 = defineComponent({
...__default__$2,
props: uploadDraggerProps,
emits: uploadDraggerEmits,
setup(__props, { emit }) {
const uploaderContext = inject(uploadContextKey);
if (!uploaderContext) {
throwError(COMPONENT_NAME, "usage: ");
}
const ns = useNamespace("upload");
const dragover = ref(false);
const disabled = useFormDisabled();
const onDrop = (e) => {
if (disabled.value)
return;
dragover.value = false;
e.stopPropagation();
const files = Array.from(e.dataTransfer.files);
const items = e.dataTransfer.items || [];
files.forEach((file2, index) => {
var _a3;
const item = items[index];
const entry = (_a3 = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a3.call(item);
if (entry) {
file2.isDirectory = entry.isDirectory;
}
});
emit("file", files);
};
const onDragover = () => {
if (!disabled.value)
dragover.value = true;
};
const onDragleave = (e) => {
if (!e.currentTarget.contains(e.relatedTarget))
dragover.value = false;
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
onDrop: withModifiers(onDrop, ["prevent"]),
onDragover: withModifiers(onDragover, ["prevent"]),
onDragleave: withModifiers(onDragleave, ["prevent"])
}, [
renderSlot(_ctx.$slots, "default")
], 42, ["onDrop", "onDragover", "onDragleave"]);
};
}
});
var UploadDragger = _export_sfc(_sfc_main$32, [["__file", "upload-dragger.vue"]]);
var uploadContentProps = buildProps({
...uploadBaseProps,
beforeUpload: {
type: definePropType(Function),
default: NOOP
},
onRemove: {
type: definePropType(Function),
default: NOOP
},
onStart: {
type: definePropType(Function),
default: NOOP
},
onSuccess: {
type: definePropType(Function),
default: NOOP
},
onProgress: {
type: definePropType(Function),
default: NOOP
},
onError: {
type: definePropType(Function),
default: NOOP
},
onExceed: {
type: definePropType(Function),
default: NOOP
}
});
var __default__$12 = defineComponent({
name: "ElUploadContent",
inheritAttrs: false
});
var _sfc_main$22 = defineComponent({
...__default__$12,
props: uploadContentProps,
setup(__props, { expose }) {
const props = __props;
const ns = useNamespace("upload");
const disabled = useFormDisabled();
const requests = shallowRef({});
const inputRef = shallowRef();
const uploadFiles = (files) => {
if (files.length === 0)
return;
const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
if (limit && fileList.length + files.length > limit) {
onExceed(files, fileList);
return;
}
if (!multiple) {
files = files.slice(0, 1);
}
for (const file2 of files) {
const rawFile = file2;
rawFile.uid = genFileId();
onStart(rawFile);
if (autoUpload)
upload(rawFile);
}
};
const upload = async (rawFile) => {
inputRef.value.value = "";
if (!props.beforeUpload) {
return doUpload(rawFile);
}
let hookResult;
let beforeData = {};
try {
const originData = props.data;
const beforeUploadPromise = props.beforeUpload(rawFile);
beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data;
hookResult = await beforeUploadPromise;
if (isPlainObject(props.data) && isEqual(originData, beforeData)) {
beforeData = cloneDeep(props.data);
}
} catch (e) {
hookResult = false;
}
if (hookResult === false) {
props.onRemove(rawFile);
return;
}
let file2 = rawFile;
if (hookResult instanceof Blob) {
if (hookResult instanceof File) {
file2 = hookResult;
} else {
file2 = new File([hookResult], rawFile.name, {
type: rawFile.type
});
}
}
doUpload(Object.assign(file2, {
uid: rawFile.uid
}), beforeData);
};
const resolveData = async (data, rawFile) => {
if (isFunction$1(data)) {
return data(rawFile);
}
return data;
};
const doUpload = async (rawFile, beforeData) => {
const {
headers,
data,
method,
withCredentials,
name: filename,
action,
onProgress,
onSuccess,
onError,
httpRequest
} = props;
try {
beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
} catch (e) {
props.onRemove(rawFile);
return;
}
const { uid } = rawFile;
const options = {
headers: headers || {},
withCredentials,
file: rawFile,
data: beforeData,
method,
filename,
action,
onProgress: (evt) => {
onProgress(evt, rawFile);
},
onSuccess: (res) => {
onSuccess(res, rawFile);
delete requests.value[uid];
},
onError: (err) => {
onError(err, rawFile);
delete requests.value[uid];
}
};
const request = httpRequest(options);
requests.value[uid] = request;
if (request instanceof Promise) {
request.then(options.onSuccess, options.onError);
}
};
const handleChange = (e) => {
const files = e.target.files;
if (!files)
return;
uploadFiles(Array.from(files));
};
const handleClick = () => {
if (!disabled.value) {
inputRef.value.value = "";
inputRef.value.click();
}
};
const handleKeydown = () => {
handleClick();
};
const abort = (file2) => {
const _reqs = entriesOf(requests.value).filter(file2 ? ([uid]) => String(file2.uid) === uid : () => true);
_reqs.forEach(([uid, req]) => {
if (req instanceof XMLHttpRequest)
req.abort();
delete requests.value[uid];
});
};
expose({
abort,
upload
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([
unref(ns).b(),
unref(ns).m(_ctx.listType),
unref(ns).is("drag", _ctx.drag),
unref(ns).is("disabled", unref(disabled))
]),
tabindex: unref(disabled) ? "-1" : "0",
onClick: handleClick,
onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
}, [
_ctx.drag ? (openBlock(), createBlock(UploadDragger, {
key: 0,
disabled: unref(disabled),
onFile: uploadFiles
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
createBaseVNode("input", {
ref_key: "inputRef",
ref: inputRef,
class: normalizeClass(unref(ns).e("input")),
name: _ctx.name,
disabled: unref(disabled),
multiple: _ctx.multiple,
accept: _ctx.accept,
type: "file",
onChange: handleChange,
onClick: withModifiers(() => {
}, ["stop"])
}, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
], 42, ["tabindex", "onKeydown"]);
};
}
});
var UploadContent = _export_sfc(_sfc_main$22, [["__file", "upload-content.vue"]]);
var SCOPE = "ElUpload";
var revokeFileObjectURL = (file2) => {
var _a3;
if ((_a3 = file2.url) == null ? void 0 : _a3.startsWith("blob:")) {
URL.revokeObjectURL(file2.url);
}
};
var useHandlers = (props, uploadRef) => {
const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
const getFile = (rawFile) => uploadFiles.value.find((file2) => file2.uid === rawFile.uid);
function abort(file2) {
var _a3;
(_a3 = uploadRef.value) == null ? void 0 : _a3.abort(file2);
}
function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
}
function removeFile(file2) {
uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file2.uid);
}
const handleError = (err, rawFile) => {
const file2 = getFile(rawFile);
if (!file2)
return;
file2.status = "fail";
removeFile(file2);
props.onError(err, file2, uploadFiles.value);
props.onChange(file2, uploadFiles.value);
};
const handleProgress = (evt, rawFile) => {
const file2 = getFile(rawFile);
if (!file2)
return;
props.onProgress(evt, file2, uploadFiles.value);
file2.status = "uploading";
file2.percentage = Math.round(evt.percent);
};
const handleSuccess = (response, rawFile) => {
const file2 = getFile(rawFile);
if (!file2)
return;
file2.status = "success";
file2.response = response;
props.onSuccess(response, file2, uploadFiles.value);
props.onChange(file2, uploadFiles.value);
};
const handleStart = (file2) => {
if (isNil(file2.uid))
file2.uid = genFileId();
const uploadFile = {
name: file2.name,
percentage: 0,
status: "ready",
size: file2.size,
raw: file2,
uid: file2.uid
};
if (props.listType === "picture-card" || props.listType === "picture") {
try {
uploadFile.url = URL.createObjectURL(file2);
} catch (err) {
debugWarn(SCOPE, err.message);
props.onError(err, uploadFile, uploadFiles.value);
}
}
uploadFiles.value = [...uploadFiles.value, uploadFile];
props.onChange(uploadFile, uploadFiles.value);
};
const handleRemove = async (file2) => {
const uploadFile = file2 instanceof File ? getFile(file2) : file2;
if (!uploadFile)
throwError(SCOPE, "file to be removed not found");
const doRemove = (file22) => {
abort(file22);
removeFile(file22);
props.onRemove(file22, uploadFiles.value);
revokeFileObjectURL(file22);
};
if (props.beforeRemove) {
const before = await props.beforeRemove(uploadFile, uploadFiles.value);
if (before !== false)
doRemove(uploadFile);
} else {
doRemove(uploadFile);
}
};
function submit() {
uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw: raw2 }) => {
var _a3;
return raw2 && ((_a3 = uploadRef.value) == null ? void 0 : _a3.upload(raw2));
});
}
watch(() => props.listType, (val) => {
if (val !== "picture-card" && val !== "picture") {
return;
}
uploadFiles.value = uploadFiles.value.map((file2) => {
const { raw: raw2, url } = file2;
if (!url && raw2) {
try {
file2.url = URL.createObjectURL(raw2);
} catch (err) {
props.onError(err, file2, uploadFiles.value);
}
}
return file2;
});
});
watch(uploadFiles, (files) => {
for (const file2 of files) {
file2.uid || (file2.uid = genFileId());
file2.status || (file2.status = "success");
}
}, { immediate: true, deep: true });
return {
uploadFiles,
abort,
clearFiles,
handleError,
handleProgress,
handleStart,
handleSuccess,
handleRemove,
submit,
revokeFileObjectURL
};
};
var __default__3 = defineComponent({
name: "ElUpload"
});
var _sfc_main$13 = defineComponent({
...__default__3,
props: uploadProps,
setup(__props, { expose }) {
const props = __props;
const disabled = useFormDisabled();
const uploadRef = shallowRef();
const {
abort,
submit,
clearFiles,
uploadFiles,
handleStart,
handleError,
handleRemove,
handleSuccess,
handleProgress,
revokeFileObjectURL: revokeFileObjectURL2
} = useHandlers(props, uploadRef);
const isPictureCard = computed(() => props.listType === "picture-card");
const uploadContentProps2 = computed(() => ({
...props,
fileList: uploadFiles.value,
onStart: handleStart,
onProgress: handleProgress,
onSuccess: handleSuccess,
onError: handleError,
onRemove: handleRemove
}));
onBeforeUnmount(() => {
uploadFiles.value.forEach(revokeFileObjectURL2);
});
provide(uploadContextKey, {
accept: toRef(props, "accept")
});
expose({
abort,
submit,
clearFiles,
handleStart,
handleRemove
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", null, [
unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
key: 0,
disabled: unref(disabled),
"list-type": _ctx.listType,
files: unref(uploadFiles),
crossorigin: _ctx.crossorigin,
"handle-preview": _ctx.onPreview,
onRemove: unref(handleRemove)
}, createSlots({
append: withCtx(() => [
createVNode(UploadContent, mergeProps({
ref_key: "uploadRef",
ref: uploadRef
}, unref(uploadContentProps2)), {
default: withCtx(() => [
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 16)
]),
_: 2
}, [
_ctx.$slots.file ? {
name: "default",
fn: withCtx(({ file: file2, index }) => [
renderSlot(_ctx.$slots, "file", {
file: file2,
index
})
])
} : void 0
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
!unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
key: 1,
ref_key: "uploadRef",
ref: uploadRef
}, unref(uploadContentProps2)), {
default: withCtx(() => [
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 16)) : createCommentVNode("v-if", true),
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
renderSlot(_ctx.$slots, "tip"),
!unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
key: 3,
disabled: unref(disabled),
"list-type": _ctx.listType,
files: unref(uploadFiles),
crossorigin: _ctx.crossorigin,
"handle-preview": _ctx.onPreview,
onRemove: unref(handleRemove)
}, createSlots({
_: 2
}, [
_ctx.$slots.file ? {
name: "default",
fn: withCtx(({ file: file2, index }) => [
renderSlot(_ctx.$slots, "file", {
file: file2,
index
})
])
} : void 0
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
]);
};
}
});
var Upload = _export_sfc(_sfc_main$13, [["__file", "upload.vue"]]);
var ElUpload = withInstall(Upload);
var _hoisted_12 = { key: 0 };
var _hoisted_22 = { class: "elx-attachments-background" };
var _hoisted_32 = {
key: 0,
class: "elx-attachments-background-start"
};
var _hoisted_42 = {
key: 1,
class: "elx-attachments-background-end"
};
var _hoisted_52 = {
key: 0,
class: "elx-attachments-upload-placeholder"
};
var TOLERANCE = 1;
var _sfc_main3 = defineComponent({
__name: "index",
props: {
items: { default: () => [] },
overflow: { default: "scrollX" },
listStyle: { default: () => ({}) },
limit: {},
hideUpload: { type: Boolean, default: false },
uploadIconSize: { default: "64px" },
dragTarget: { default: void 0 }
},
emits: ["uploadChange", "uploadSuccess", "uploadError", "uploadDrop", "deleteCard"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const containerRef = ref(null);
const wrapperRef = ref(null);
const firstMount = ref(false);
const pingStart = ref(false);
const pingEnd = ref(false);
function checkPing() {
const containerEle = containerRef.value;
if (!containerEle)
return;
if (props.overflow === "scrollX") {
pingStart.value = Math.abs(containerEle.scrollLeft) >= TOLERANCE;
pingEnd.value = containerEle.scrollWidth - containerEle.clientWidth - Math.abs(containerEle.scrollLeft) >= TOLERANCE;
} else if (props.overflow === "scrollY") {
pingStart.value = containerEle.scrollTop !== 0;
pingEnd.value = containerEle.scrollHeight - containerEle.clientHeight !== containerEle.scrollTop;
} else {
pingStart.value = false;
pingEnd.value = false;
}
}
function onScrollOffset(offset) {
const containerEle = containerRef.value;
if (containerEle) {
containerEle.scrollTo({
left: props.overflow === "scrollX" ? containerEle.scrollLeft + offset * containerEle.clientWidth : containerEle.scrollLeft,
top: props.overflow === "scrollY" ? containerEle.scrollTop + offset * containerEle.clientHeight : containerEle.scrollTop,
behavior: "smooth"
});
}
}
function onScrollLeft() {
onScrollOffset(-1);
}
function onScrollRight() {
onScrollOffset(1);
}
const debouncedCheckPing = debounce({ delay: 100 }, checkPing);
const targetElement = ref(null);
const isTargetDrag = ref(false);
const debouncedStyle = debounce({ delay: 100 }, toggleDragStyle);
const _isOverLimit = computed(() => {
if (props.limit && props.items.length >= props.limit) {
return true;
}
return false;
});
const dropAreaRef = ref();
function toggleDragStyle(isDrag) {
isTargetDrag.value = isDrag;
if (targetElement.value) {
const isBodyTarget = targetElement.value === document.body;
if (isDrag) {
if (isBodyTarget && dropAreaRef.value) {
dropAreaRef.value.style.position = "fixed";
dropAreaRef.value.style.width = "100vw";
dropAreaRef.value.style.height = "100vh";
dropAreaRef.value.style.left = "0";
dropAreaRef.value.style.top = "0";
} else {
targetElement.value.style.position = "relative";
}
} else {
targetElement.value.style.position = "";
}
}
}
function handleUploadChange(file2, props2) {
emits("uploadChange", file2, props2);
}
function handleUploadSuccess(response, file2, props2) {
emits("uploadSuccess", response, file2, props2);
}
function handleUploadError(error2, file2, props2) {
emits("uploadError", error2, file2, props2);
}
function getTargetElement() {
if (!props.dragTarget)
return wrapperRef.value;
if (props.dragTarget instanceof HTMLElement) {
return props.dragTarget;
}
if (typeof props.dragTarget === "string") {
return document.getElementById(props.dragTarget);
}
if (isRef(props.dragTarget)) {
return props.dragTarget.value;
}
return wrapperRef.value;
}
function targetDragEnter(event) {
event.preventDefault();
debouncedStyle(true);
}
function targetDropLeave(event) {
event.preventDefault();
const relatedTarget = event.relatedTarget;
if (targetElement.value && targetElement.value.contains(relatedTarget)) {
return;
}
debouncedStyle(false);
}
function targetDrop(event) {
event.preventDefault();
debouncedStyle(false);
if (event.dataTransfer) {
const files = event.dataTransfer.files;
if (files.length) {
emits("uploadDrop", [...files], { ...props });
}
}
}
function targetDragOver(event) {
event.preventDefault();
}
function handleDelete(item, index) {
emits("deleteCard", item, index);
nextTick(() => debouncedCheckPing());
}
onMounted(() => {
firstMount.value = true;
nextTick(() => debouncedCheckPing());
window.addEventListener("resize", debouncedCheckPing);
if (wrapperRef.value) {
targetElement.value = getTargetElement() || wrapperRef.value;
targetElement.value.addEventListener("dragenter", targetDragEnter, false);
targetElement.value.addEventListener("dragleave", targetDropLeave, false);
targetElement.value.addEventListener("drop", targetDrop, false);
targetElement.value.addEventListener("dragover", targetDragOver, false);
}
});
onUnmounted(() => {
window.removeEventListener("resize", debouncedCheckPing);
if (targetElement.value) {
targetElement.value.removeEventListener(
"dragenter",
targetDragEnter,
false
);
targetElement.value.removeEventListener(
"dragleave",
targetDropLeave,
false
);
targetElement.value.removeEventListener("drop", targetDrop, false);
targetElement.value.removeEventListener("dragover", targetDragOver, false);
}
});
watch(
() => [props.overflow, props.items.length],
() => {
nextTick(() => debouncedCheckPing());
},
{
immediate: true,
// 组件初始化时立即调用一次
deep: true
// 如果 items 是对象或数组,需要深度监听
}
);
watch(
() => props.dragTarget,
() => {
nextTick(() => {
if (wrapperRef.value) {
targetElement.value = getTargetElement() || wrapperRef.value;
targetElement.value.addEventListener(
"dragenter",
targetDragEnter,
false
);
targetElement.value.addEventListener(
"dragleave",
targetDropLeave,
false
);
targetElement.value.addEventListener("drop", targetDrop, false);
targetElement.value.addEventListener("dragover", targetDragOver, false);
}
});
},
{
immediate: true,
// 组件初始化时立即调用一次
deep: true
}
);
__expose({
onScrollLeft,
onScrollRight,
debouncedCheckPing
});
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_upload = ElUpload;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", {
ref_key: "wrapperRef",
ref: wrapperRef,
class: normalizeClass(["elx-attachments-wrapper", {
"elx-attachments-overflow-ping-start": _ctx.overflow === "scrollX" && unref(pingStart),
"elx-attachments-overflow-ping-end": _ctx.overflow === "scrollX" && unref(pingEnd)
}]),
style: normalizeStyle({
..._ctx.listStyle,
"--elx-attachments-upload-icon-size": props.uploadIconSize
})
}, [
!_ctx.items.length && !props.hideUpload ? (openBlock(), createElementBlock("div", _hoisted_12, [
renderSlot(_ctx.$slots, "empty-upload", {}, () => [
createVNode(_component_el_upload, mergeProps({ class: "elx-attachments-upload-btn" }, _ctx.$attrs, {
"show-file-list": false,
onChange: handleUploadChange,
onSuccess: handleUploadSuccess,
onError: handleUploadError
}), {
default: withCtx(() => [
createVNode(_component_el_icon, { class: "uploader-icon" }, {
default: withCtx(() => [
createVNode(unref(plus_default))
]),
_: 1
})
]),
_: 1
}, 16)
], true)
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_22, [
_ctx.overflow === "scrollX" && unref(pingStart) ? (openBlock(), createElementBlock("div", _hoisted_32)) : createCommentVNode("", true),
_ctx.overflow === "scrollX" && unref(pingEnd) ? (openBlock(), createElementBlock("div", _hoisted_42)) : createCommentVNode("", true)
]),
createBaseVNode("div", {
ref_key: "containerRef",
ref: containerRef,
class: normalizeClass(["elx-attachments", {
[`elx-attachments-overflow-${_ctx.overflow}`]: _ctx.overflow
}]),
style: normalizeStyle({
..._ctx.overflow === "scrollX" ? { whiteSpace: "nowrap", overflowX: "auto", overflowY: "hidden" } : {},
..._ctx.overflow === "scrollY" ? { overflowX: "hidden", overflowY: "auto" } : {},
..._ctx.overflow === "wrap" ? { display: "flex", flexWrap: "wrap" } : {}
}),
onScroll: _cache[0] || (_cache[0] = //@ts-ignore
(...args) => unref(debouncedCheckPing) && unref(debouncedCheckPing)(...args))
}, [
_ctx.items.length ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass({
"elx-attachments-file-card-wrap": _ctx.overflow === "scrollX"
})
}, [
renderSlot(_ctx.$slots, "file-list", { items: _ctx.items }, () => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index) => {
return openBlock(), createElementBlock("div", {
key: item.uid,
class: "elx-attachments-card"
}, [
createVNode(Transition, { name: "card-motion" }, {
default: withCtx(() => [
item.uid ? (openBlock(), createBlock(FilesCard, mergeProps({
key: 0,
ref_for: true
}, item, {
class: "elx-attachments-card-item",
onDelete: ($event) => handleDelete(item, index)
}), null, 16, ["onDelete"])) : createCommentVNode("", true)
]),
_: 2
}, 1024)
]);
}), 128))
], true),
_ctx.items.length && !unref(_isOverLimit) && !props.hideUpload ? (openBlock(), createElementBlock("div", _hoisted_52, [
renderSlot(_ctx.$slots, "no-empty-upload", {}, () => [
createVNode(_component_el_upload, mergeProps(_ctx.$attrs, {
"show-file-list": false,
style: {
height: _ctx.overflow === "scrollY" && ""
},
class: "elx-attachments-upload-btn",
onChange: handleUploadChange,
onSuccess: handleUploadSuccess,
onError: handleUploadError
}), {
trigger: withCtx(() => [
createVNode(_component_el_icon, { class: "uploader-icon" }, {
default: withCtx(() => [
createVNode(unref(plus_default))
]),
_: 1
})
]),
_: 1
}, 16, ["style"])
], true)
])) : createCommentVNode("", true)
], 2)) : createCommentVNode("", true)
], 38),
renderSlot(_ctx.$slots, "prev-button", {
show: _ctx.overflow === "scrollX" && unref(pingStart),
onScrollLeft
}, () => [
_ctx.overflow === "scrollX" && unref(pingStart) ? (openBlock(), createBlock(_component_el_button, {
key: 0,
size: "small",
class: "elx-attachments-prev-btn",
onClick: onScrollLeft
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(arrow_left_bold_default))
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true)
], true),
renderSlot(_ctx.$slots, "next-button", {
show: _ctx.overflow === "scrollX" && unref(pingEnd),
onScrollRight
}, () => [
_ctx.overflow === "scrollX" && unref(pingEnd) ? (openBlock(), createBlock(_component_el_button, {
key: 0,
size: "small",
class: "elx-attachments-next-btn",
onClick: onScrollRight
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(arrow_right_bold_default))
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true)
], true),
unref(targetElement) && unref(isTargetDrag) ? (openBlock(), createBlock(Teleport, {
key: 1,
to: unref(targetElement)
}, [
renderSlot(_ctx.$slots, "drop-area", {}, () => [
createBaseVNode("div", {
ref_key: "dropAreaRef",
ref: dropAreaRef,
class: "elx-attachments-drop-area"
}, [
createVNode(_component_el_icon, { class: "elx-attachments-drop-area-icon" }, {
default: withCtx(() => [
createVNode(unref(upload_filled_default))
]),
_: 1
}),
_cache[1] || (_cache[1] = createBaseVNode("div", { class: "elx-attachments-drop-area-text" }, " 在此处拖放文件上传 ", -1))
], 512)
], true)
], 8, ["to"])) : createCommentVNode("", true)
], 6);
};
}
});
var Attachments = _export_sfc2(_sfc_main3, [["__scopeId", "data-v-ac17ead1"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Bubble/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style6.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ConfigProvider/constants.js
var decodeCache = {};
function getDecodeCache(exclude) {
let cache = decodeCache[exclude];
if (cache) {
return cache;
}
cache = decodeCache[exclude] = [];
for (let i = 0; i < 128; i++) {
const ch = String.fromCharCode(i);
cache.push(ch);
}
for (let i = 0; i < exclude.length; i++) {
const ch = exclude.charCodeAt(i);
cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
}
return cache;
}
function decode$1(string, exclude) {
if (typeof exclude !== "string") {
exclude = decode$1.defaultChars;
}
const cache = getDecodeCache(exclude);
return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
let result = "";
for (let i = 0, l = seq.length; i < l; i += 3) {
const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
if (b1 < 128) {
result += cache[b1];
continue;
}
if ((b1 & 224) === 192 && i + 3 < l) {
const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
if ((b2 & 192) === 128) {
const chr = b1 << 6 & 1984 | b2 & 63;
if (chr < 128) {
result += "��";
} else {
result += String.fromCharCode(chr);
}
i += 3;
continue;
}
}
if ((b1 & 240) === 224 && i + 6 < l) {
const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
if ((b2 & 192) === 128 && (b3 & 192) === 128) {
const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
if (chr < 2048 || chr >= 55296 && chr <= 57343) {
result += "���";
} else {
result += String.fromCharCode(chr);
}
i += 6;
continue;
}
}
if ((b1 & 248) === 240 && i + 9 < l) {
const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
if (chr < 65536 || chr > 1114111) {
result += "����";
} else {
chr -= 65536;
result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
}
i += 9;
continue;
}
}
result += "�";
}
return result;
});
}
decode$1.defaultChars = ";/?:@&=+$,#";
decode$1.componentChars = "";
var encodeCache = {};
function getEncodeCache(exclude) {
let cache = encodeCache[exclude];
if (cache) {
return cache;
}
cache = encodeCache[exclude] = [];
for (let i = 0; i < 128; i++) {
const ch = String.fromCharCode(i);
if (/^[0-9a-z]$/i.test(ch)) {
cache.push(ch);
} else {
cache.push("%" + ("0" + i.toString(16).toUpperCase()).slice(-2));
}
}
for (let i = 0; i < exclude.length; i++) {
cache[exclude.charCodeAt(i)] = exclude[i];
}
return cache;
}
function encode$1(string, exclude, keepEscaped) {
if (typeof exclude !== "string") {
keepEscaped = exclude;
exclude = encode$1.defaultChars;
}
if (typeof keepEscaped === "undefined") {
keepEscaped = true;
}
const cache = getEncodeCache(exclude);
let result = "";
for (let i = 0, l = string.length; i < l; i++) {
const code22 = string.charCodeAt(i);
if (keepEscaped && code22 === 37 && i + 2 < l) {
if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
result += string.slice(i, i + 3);
i += 2;
continue;
}
}
if (code22 < 128) {
result += cache[code22];
continue;
}
if (code22 >= 55296 && code22 <= 57343) {
if (code22 >= 55296 && code22 <= 56319 && i + 1 < l) {
const nextCode = string.charCodeAt(i + 1);
if (nextCode >= 56320 && nextCode <= 57343) {
result += encodeURIComponent(string[i] + string[i + 1]);
i++;
continue;
}
}
result += "%EF%BF%BD";
continue;
}
result += encodeURIComponent(string[i]);
}
return result;
}
encode$1.defaultChars = ";/?:@&=+$,-_.!~*'()#";
encode$1.componentChars = "-_.!~*'()";
function format(url) {
let result = "";
result += url.protocol || "";
result += url.slashes ? "//" : "";
result += url.auth ? url.auth + "@" : "";
if (url.hostname && url.hostname.indexOf(":") !== -1) {
result += "[" + url.hostname + "]";
} else {
result += url.hostname || "";
}
result += url.port ? ":" + url.port : "";
result += url.pathname || "";
result += url.search || "";
result += url.hash || "";
return result;
}
function Url() {
this.protocol = null;
this.slashes = null;
this.auth = null;
this.port = null;
this.hostname = null;
this.hash = null;
this.search = null;
this.pathname = null;
}
var protocolPattern = /^([a-z0-9.+-]+:)/i;
var portPattern = /:[0-9]*$/;
var simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
var delims = ["<", ">", '"', "`", " ", "\r", "\n", " "];
var unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims);
var autoEscape = ["'"].concat(unwise);
var nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape);
var hostEndingChars = ["/", "?", "#"];
var hostnameMaxLen = 255;
var hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
var hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
var hostlessProtocol = {
javascript: true,
"javascript:": true
};
var slashedProtocol = {
http: true,
https: true,
ftp: true,
gopher: true,
file: true,
"http:": true,
"https:": true,
"ftp:": true,
"gopher:": true,
"file:": true
};
function urlParse(url, slashesDenoteHost) {
if (url && url instanceof Url) return url;
const u = new Url();
u.parse(url, slashesDenoteHost);
return u;
}
Url.prototype.parse = function(url, slashesDenoteHost) {
let lowerProto, hec, slashes;
let rest = url;
rest = rest.trim();
if (!slashesDenoteHost && url.split("#").length === 1) {
const simplePath = simplePathPattern.exec(rest);
if (simplePath) {
this.pathname = simplePath[1];
if (simplePath[2]) {
this.search = simplePath[2];
}
return this;
}
}
let proto = protocolPattern.exec(rest);
if (proto) {
proto = proto[0];
lowerProto = proto.toLowerCase();
this.protocol = proto;
rest = rest.substr(proto.length);
}
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
slashes = rest.substr(0, 2) === "//";
if (slashes && !(proto && hostlessProtocol[proto])) {
rest = rest.substr(2);
this.slashes = true;
}
}
if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
let hostEnd = -1;
for (let i = 0; i < hostEndingChars.length; i++) {
hec = rest.indexOf(hostEndingChars[i]);
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
hostEnd = hec;
}
}
let auth, atSign;
if (hostEnd === -1) {
atSign = rest.lastIndexOf("@");
} else {
atSign = rest.lastIndexOf("@", hostEnd);
}
if (atSign !== -1) {
auth = rest.slice(0, atSign);
rest = rest.slice(atSign + 1);
this.auth = auth;
}
hostEnd = -1;
for (let i = 0; i < nonHostChars.length; i++) {
hec = rest.indexOf(nonHostChars[i]);
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
hostEnd = hec;
}
}
if (hostEnd === -1) {
hostEnd = rest.length;
}
if (rest[hostEnd - 1] === ":") {
hostEnd--;
}
const host = rest.slice(0, hostEnd);
rest = rest.slice(hostEnd);
this.parseHost(host);
this.hostname = this.hostname || "";
const ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
if (!ipv6Hostname) {
const hostparts = this.hostname.split(/\./);
for (let i = 0, l = hostparts.length; i < l; i++) {
const part = hostparts[i];
if (!part) {
continue;
}
if (!part.match(hostnamePartPattern)) {
let newpart = "";
for (let j = 0, k = part.length; j < k; j++) {
if (part.charCodeAt(j) > 127) {
newpart += "x";
} else {
newpart += part[j];
}
}
if (!newpart.match(hostnamePartPattern)) {
const validParts = hostparts.slice(0, i);
const notHost = hostparts.slice(i + 1);
const bit = part.match(hostnamePartStart);
if (bit) {
validParts.push(bit[1]);
notHost.unshift(bit[2]);
}
if (notHost.length) {
rest = notHost.join(".") + rest;
}
this.hostname = validParts.join(".");
break;
}
}
}
}
if (this.hostname.length > hostnameMaxLen) {
this.hostname = "";
}
if (ipv6Hostname) {
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
}
}
const hash = rest.indexOf("#");
if (hash !== -1) {
this.hash = rest.substr(hash);
rest = rest.slice(0, hash);
}
const qm = rest.indexOf("?");
if (qm !== -1) {
this.search = rest.substr(qm);
rest = rest.slice(0, qm);
}
if (rest) {
this.pathname = rest;
}
if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
this.pathname = "";
}
return this;
};
Url.prototype.parseHost = function(host) {
let port = portPattern.exec(host);
if (port) {
port = port[0];
if (port !== ":") {
this.port = port.substr(1);
}
host = host.substr(0, host.length - port.length);
}
if (host) {
this.hostname = host;
}
};
var mdurl = Object.freeze(Object.defineProperty({
__proto__: null,
decode: decode$1,
encode: encode$1,
format,
parse: urlParse
}, Symbol.toStringTag, { value: "Module" }));
var Any = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var Cc = /[\0-\x1F\x7F-\x9F]/;
var regex$1 = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;
var P = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
var regex = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;
var Z = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
var ucmicro = Object.freeze(Object.defineProperty({
__proto__: null,
Any,
Cc,
Cf: regex$1,
P,
S: regex,
Z
}, Symbol.toStringTag, { value: "Module" }));
var htmlDecodeTree = new Uint16Array(
// prettier-ignore
'ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((c) => c.charCodeAt(0))
);
var xmlDecodeTree = new Uint16Array(
// prettier-ignore
"Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((c) => c.charCodeAt(0))
);
var _a;
var decodeMap = /* @__PURE__ */ new Map([
[0, 65533],
// C1 Unicode control character reference replacements
[128, 8364],
[130, 8218],
[131, 402],
[132, 8222],
[133, 8230],
[134, 8224],
[135, 8225],
[136, 710],
[137, 8240],
[138, 352],
[139, 8249],
[140, 338],
[142, 381],
[145, 8216],
[146, 8217],
[147, 8220],
[148, 8221],
[149, 8226],
[150, 8211],
[151, 8212],
[152, 732],
[153, 8482],
[154, 353],
[155, 8250],
[156, 339],
[158, 382],
[159, 376]
]);
var fromCodePoint$1 = (
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function(codePoint) {
let output = "";
if (codePoint > 65535) {
codePoint -= 65536;
output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296);
codePoint = 56320 | codePoint & 1023;
}
output += String.fromCharCode(codePoint);
return output;
}
);
function replaceCodePoint(codePoint) {
var _a22;
if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) {
return 65533;
}
return (_a22 = decodeMap.get(codePoint)) !== null && _a22 !== void 0 ? _a22 : codePoint;
}
var CharCodes;
(function(CharCodes2) {
CharCodes2[CharCodes2["NUM"] = 35] = "NUM";
CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI";
CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS";
CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO";
CharCodes2[CharCodes2["NINE"] = 57] = "NINE";
CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A";
CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F";
CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X";
CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z";
CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A";
CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F";
CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z";
})(CharCodes || (CharCodes = {}));
var TO_LOWER_BIT = 32;
var BinTrieFlags;
(function(BinTrieFlags2) {
BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
})(BinTrieFlags || (BinTrieFlags = {}));
function isNumber2(code22) {
return code22 >= CharCodes.ZERO && code22 <= CharCodes.NINE;
}
function isHexadecimalCharacter(code22) {
return code22 >= CharCodes.UPPER_A && code22 <= CharCodes.UPPER_F || code22 >= CharCodes.LOWER_A && code22 <= CharCodes.LOWER_F;
}
function isAsciiAlphaNumeric(code22) {
return code22 >= CharCodes.UPPER_A && code22 <= CharCodes.UPPER_Z || code22 >= CharCodes.LOWER_A && code22 <= CharCodes.LOWER_Z || isNumber2(code22);
}
function isEntityInAttributeInvalidEnd(code22) {
return code22 === CharCodes.EQUALS || isAsciiAlphaNumeric(code22);
}
var EntityDecoderState;
(function(EntityDecoderState2) {
EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart";
EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart";
EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal";
EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex";
EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity";
})(EntityDecoderState || (EntityDecoderState = {}));
var DecodingMode;
(function(DecodingMode2) {
DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy";
DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict";
DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute";
})(DecodingMode || (DecodingMode = {}));
var EntityDecoder = class {
constructor(decodeTree, emitCodePoint, errors2) {
this.decodeTree = decodeTree;
this.emitCodePoint = emitCodePoint;
this.errors = errors2;
this.state = EntityDecoderState.EntityStart;
this.consumed = 1;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.decodeMode = DecodingMode.Strict;
}
/** Resets the instance to make it reusable. */
startEntity(decodeMode) {
this.decodeMode = decodeMode;
this.state = EntityDecoderState.EntityStart;
this.result = 0;
this.treeIndex = 0;
this.excess = 1;
this.consumed = 1;
}
/**
* Write an entity to the decoder. This can be called multiple times with partial entities.
* If the entity is incomplete, the decoder will return -1.
*
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
* entity is incomplete, and resume when the next string is written.
*
* @param string The string containing the entity (or a continuation of the entity).
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
write(str, offset) {
switch (this.state) {
case EntityDecoderState.EntityStart: {
if (str.charCodeAt(offset) === CharCodes.NUM) {
this.state = EntityDecoderState.NumericStart;
this.consumed += 1;
return this.stateNumericStart(str, offset + 1);
}
this.state = EntityDecoderState.NamedEntity;
return this.stateNamedEntity(str, offset);
}
case EntityDecoderState.NumericStart: {
return this.stateNumericStart(str, offset);
}
case EntityDecoderState.NumericDecimal: {
return this.stateNumericDecimal(str, offset);
}
case EntityDecoderState.NumericHex: {
return this.stateNumericHex(str, offset);
}
case EntityDecoderState.NamedEntity: {
return this.stateNamedEntity(str, offset);
}
}
}
/**
* Switches between the numeric decimal and hexadecimal states.
*
* Equivalent to the `Numeric character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericStart(str, offset) {
if (offset >= str.length) {
return -1;
}
if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
this.state = EntityDecoderState.NumericHex;
this.consumed += 1;
return this.stateNumericHex(str, offset + 1);
}
this.state = EntityDecoderState.NumericDecimal;
return this.stateNumericDecimal(str, offset);
}
addToNumericResult(str, start, end, base2) {
if (start !== end) {
const digitCount = end - start;
this.result = this.result * Math.pow(base2, digitCount) + parseInt(str.substr(start, digitCount), base2);
this.consumed += digitCount;
}
}
/**
* Parses a hexadecimal numeric entity.
*
* Equivalent to the `Hexademical character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericHex(str, offset) {
const startIdx = offset;
while (offset < str.length) {
const char = str.charCodeAt(offset);
if (isNumber2(char) || isHexadecimalCharacter(char)) {
offset += 1;
} else {
this.addToNumericResult(str, startIdx, offset, 16);
return this.emitNumericEntity(char, 3);
}
}
this.addToNumericResult(str, startIdx, offset, 16);
return -1;
}
/**
* Parses a decimal numeric entity.
*
* Equivalent to the `Decimal character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNumericDecimal(str, offset) {
const startIdx = offset;
while (offset < str.length) {
const char = str.charCodeAt(offset);
if (isNumber2(char)) {
offset += 1;
} else {
this.addToNumericResult(str, startIdx, offset, 10);
return this.emitNumericEntity(char, 2);
}
}
this.addToNumericResult(str, startIdx, offset, 10);
return -1;
}
/**
* Validate and emit a numeric entity.
*
* Implements the logic from the `Hexademical character reference start
* state` and `Numeric character reference end state` in the HTML spec.
*
* @param lastCp The last code point of the entity. Used to see if the
* entity was terminated with a semicolon.
* @param expectedLength The minimum number of characters that should be
* consumed. Used to validate that at least one digit
* was consumed.
* @returns The number of characters that were consumed.
*/
emitNumericEntity(lastCp, expectedLength) {
var _a22;
if (this.consumed <= expectedLength) {
(_a22 = this.errors) === null || _a22 === void 0 ? void 0 : _a22.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
if (lastCp === CharCodes.SEMI) {
this.consumed += 1;
} else if (this.decodeMode === DecodingMode.Strict) {
return 0;
}
this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
if (this.errors) {
if (lastCp !== CharCodes.SEMI) {
this.errors.missingSemicolonAfterCharacterReference();
}
this.errors.validateNumericCharacterReference(this.result);
}
return this.consumed;
}
/**
* Parses a named entity.
*
* Equivalent to the `Named character reference state` in the HTML spec.
*
* @param str The string containing the entity (or a continuation of the entity).
* @param offset The current offset.
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
*/
stateNamedEntity(str, offset) {
const { decodeTree } = this;
let current = decodeTree[this.treeIndex];
let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
for (; offset < str.length; offset++, this.excess++) {
const char = str.charCodeAt(offset);
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
if (this.treeIndex < 0) {
return this.result === 0 || // If we are parsing an attribute
this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity,
(valueLength === 0 || // And there should be no invalid characters.
isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity();
}
current = decodeTree[this.treeIndex];
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
if (valueLength !== 0) {
if (char === CharCodes.SEMI) {
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
}
if (this.decodeMode !== DecodingMode.Strict) {
this.result = this.treeIndex;
this.consumed += this.excess;
this.excess = 0;
}
}
}
return -1;
}
/**
* Emit a named entity that was not terminated with a semicolon.
*
* @returns The number of characters consumed.
*/
emitNotTerminatedNamedEntity() {
var _a22;
const { result, decodeTree } = this;
const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
this.emitNamedEntityData(result, valueLength, this.consumed);
(_a22 = this.errors) === null || _a22 === void 0 ? void 0 : _a22.missingSemicolonAfterCharacterReference();
return this.consumed;
}
/**
* Emit a named entity.
*
* @param result The index of the entity in the decode tree.
* @param valueLength The number of bytes in the entity.
* @param consumed The number of characters consumed.
*
* @returns The number of characters consumed.
*/
emitNamedEntityData(result, valueLength, consumed) {
const { decodeTree } = this;
this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH : decodeTree[result + 1], consumed);
if (valueLength === 3) {
this.emitCodePoint(decodeTree[result + 2], consumed);
}
return consumed;
}
/**
* Signal to the parser that the end of the input was reached.
*
* Remaining data will be emitted and relevant errors will be produced.
*
* @returns The number of characters consumed.
*/
end() {
var _a22;
switch (this.state) {
case EntityDecoderState.NamedEntity: {
return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
}
// Otherwise, emit a numeric entity if we have one.
case EntityDecoderState.NumericDecimal: {
return this.emitNumericEntity(0, 2);
}
case EntityDecoderState.NumericHex: {
return this.emitNumericEntity(0, 3);
}
case EntityDecoderState.NumericStart: {
(_a22 = this.errors) === null || _a22 === void 0 ? void 0 : _a22.absenceOfDigitsInNumericCharacterReference(this.consumed);
return 0;
}
case EntityDecoderState.EntityStart: {
return 0;
}
}
}
};
function getDecoder(decodeTree) {
let ret = "";
const decoder = new EntityDecoder(decodeTree, (str) => ret += fromCodePoint$1(str));
return function decodeWithTrie(str, decodeMode) {
let lastIndex = 0;
let offset = 0;
while ((offset = str.indexOf("&", offset)) >= 0) {
ret += str.slice(lastIndex, offset);
decoder.startEntity(decodeMode);
const len = decoder.write(
str,
// Skip the "&"
offset + 1
);
if (len < 0) {
lastIndex = offset + decoder.end();
break;
}
lastIndex = offset + len;
offset = len === 0 ? lastIndex + 1 : lastIndex;
}
const result = ret + str.slice(lastIndex);
ret = "";
return result;
};
}
function determineBranch(decodeTree, current, nodeIdx, char) {
const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
if (branchCount === 0) {
return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
}
if (jumpOffset) {
const value = char - jumpOffset;
return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIdx + value] - 1;
}
let lo = nodeIdx;
let hi = lo + branchCount - 1;
while (lo <= hi) {
const mid = lo + hi >>> 1;
const midVal = decodeTree[mid];
if (midVal < char) {
lo = mid + 1;
} else if (midVal > char) {
hi = mid - 1;
} else {
return decodeTree[mid + branchCount];
}
}
return -1;
}
var htmlDecoder = getDecoder(htmlDecodeTree);
getDecoder(xmlDecodeTree);
function decodeHTML(str, mode = DecodingMode.Legacy) {
return htmlDecoder(str, mode);
}
function _class$1(obj) {
return Object.prototype.toString.call(obj);
}
function isString$12(obj) {
return _class$1(obj) === "[object String]";
}
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function has(object, key2) {
return _hasOwnProperty.call(object, key2);
}
function assign$1(obj) {
const sources = Array.prototype.slice.call(arguments, 1);
sources.forEach(function(source) {
if (!source) {
return;
}
if (typeof source !== "object") {
throw new TypeError(source + "must be object");
}
Object.keys(source).forEach(function(key2) {
obj[key2] = source[key2];
});
});
return obj;
}
function arrayReplaceAt(src, pos, newElements) {
return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
}
function isValidEntityCode(c) {
if (c >= 55296 && c <= 57343) {
return false;
}
if (c >= 64976 && c <= 65007) {
return false;
}
if ((c & 65535) === 65535 || (c & 65535) === 65534) {
return false;
}
if (c >= 0 && c <= 8) {
return false;
}
if (c === 11) {
return false;
}
if (c >= 14 && c <= 31) {
return false;
}
if (c >= 127 && c <= 159) {
return false;
}
if (c > 1114111) {
return false;
}
return true;
}
function fromCodePoint(c) {
if (c > 65535) {
c -= 65536;
const surrogate1 = 55296 + (c >> 10);
const surrogate2 = 56320 + (c & 1023);
return String.fromCharCode(surrogate1, surrogate2);
}
return String.fromCharCode(c);
}
var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + "|" + ENTITY_RE.source, "gi");
var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
function replaceEntityPattern(match2, name) {
if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
const code22 = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
if (isValidEntityCode(code22)) {
return fromCodePoint(code22);
}
return match2;
}
const decoded = decodeHTML(match2);
if (decoded !== match2) {
return decoded;
}
return match2;
}
function unescapeMd(str) {
if (str.indexOf("\\") < 0) {
return str;
}
return str.replace(UNESCAPE_MD_RE, "$1");
}
function unescapeAll(str) {
if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) {
return str;
}
return str.replace(UNESCAPE_ALL_RE, function(match2, escaped, entity2) {
if (escaped) {
return escaped;
}
return replaceEntityPattern(match2, entity2);
});
}
var HTML_ESCAPE_TEST_RE = /[&<>"]/;
var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
var HTML_REPLACEMENTS = {
"&": "&",
"<": "<",
">": ">",
'"': """
};
function replaceUnsafeChar(ch) {
return HTML_REPLACEMENTS[ch];
}
function escapeHtml(str) {
if (HTML_ESCAPE_TEST_RE.test(str)) {
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
}
return str;
}
var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
function escapeRE$1(str) {
return str.replace(REGEXP_ESCAPE_RE, "\\$&");
}
function isSpace(code22) {
switch (code22) {
case 9:
case 32:
return true;
}
return false;
}
function isWhiteSpace(code22) {
if (code22 >= 8192 && code22 <= 8202) {
return true;
}
switch (code22) {
case 9:
// \t
case 10:
// \n
case 11:
// \v
case 12:
// \f
case 13:
// \r
case 32:
case 160:
case 5760:
case 8239:
case 8287:
case 12288:
return true;
}
return false;
}
function isPunctChar(ch) {
return P.test(ch) || regex.test(ch);
}
function isMdAsciiPunct(ch) {
switch (ch) {
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
case 123:
case 124:
case 125:
case 126:
return true;
default:
return false;
}
}
function normalizeReference(str) {
str = str.trim().replace(/\s+/g, " ");
if ("ẞ".toLowerCase() === "Ṿ") {
str = str.replace(/ẞ/g, "ß");
}
return str.toLowerCase().toUpperCase();
}
var lib = { mdurl, ucmicro };
var utils = Object.freeze(Object.defineProperty({
__proto__: null,
arrayReplaceAt,
assign: assign$1,
escapeHtml,
escapeRE: escapeRE$1,
fromCodePoint,
has,
isMdAsciiPunct,
isPunctChar,
isSpace,
isString: isString$12,
isValidEntityCode,
isWhiteSpace,
lib,
normalizeReference,
unescapeAll,
unescapeMd
}, Symbol.toStringTag, { value: "Module" }));
function parseLinkLabel(state, start, disableNested) {
let level, found, marker, prevPos;
const max = state.posMax;
const oldPos = state.pos;
state.pos = start + 1;
level = 1;
while (state.pos < max) {
marker = state.src.charCodeAt(state.pos);
if (marker === 93) {
level--;
if (level === 0) {
found = true;
break;
}
}
prevPos = state.pos;
state.md.inline.skipToken(state);
if (marker === 91) {
if (prevPos === state.pos - 1) {
level++;
} else if (disableNested) {
state.pos = oldPos;
return -1;
}
}
}
let labelEnd = -1;
if (found) {
labelEnd = state.pos;
}
state.pos = oldPos;
return labelEnd;
}
function parseLinkDestination(str, start, max) {
let code22;
let pos = start;
const result = {
ok: false,
pos: 0,
str: ""
};
if (str.charCodeAt(pos) === 60) {
pos++;
while (pos < max) {
code22 = str.charCodeAt(pos);
if (code22 === 10) {
return result;
}
if (code22 === 60) {
return result;
}
if (code22 === 62) {
result.pos = pos + 1;
result.str = unescapeAll(str.slice(start + 1, pos));
result.ok = true;
return result;
}
if (code22 === 92 && pos + 1 < max) {
pos += 2;
continue;
}
pos++;
}
return result;
}
let level = 0;
while (pos < max) {
code22 = str.charCodeAt(pos);
if (code22 === 32) {
break;
}
if (code22 < 32 || code22 === 127) {
break;
}
if (code22 === 92 && pos + 1 < max) {
if (str.charCodeAt(pos + 1) === 32) {
break;
}
pos += 2;
continue;
}
if (code22 === 40) {
level++;
if (level > 32) {
return result;
}
}
if (code22 === 41) {
if (level === 0) {
break;
}
level--;
}
pos++;
}
if (start === pos) {
return result;
}
if (level !== 0) {
return result;
}
result.str = unescapeAll(str.slice(start, pos));
result.pos = pos;
result.ok = true;
return result;
}
function parseLinkTitle(str, start, max, prev_state) {
let code22;
let pos = start;
const state = {
// if `true`, this is a valid link title
ok: false,
// if `true`, this link can be continued on the next line
can_continue: false,
// if `ok`, it's the position of the first character after the closing marker
pos: 0,
// if `ok`, it's the unescaped title
str: "",
// expected closing marker character code
marker: 0
};
if (prev_state) {
state.str = prev_state.str;
state.marker = prev_state.marker;
} else {
if (pos >= max) {
return state;
}
let marker = str.charCodeAt(pos);
if (marker !== 34 && marker !== 39 && marker !== 40) {
return state;
}
start++;
pos++;
if (marker === 40) {
marker = 41;
}
state.marker = marker;
}
while (pos < max) {
code22 = str.charCodeAt(pos);
if (code22 === state.marker) {
state.pos = pos + 1;
state.str += unescapeAll(str.slice(start, pos));
state.ok = true;
return state;
} else if (code22 === 40 && state.marker === 41) {
return state;
} else if (code22 === 92 && pos + 1 < max) {
pos++;
}
pos++;
}
state.can_continue = true;
state.str += unescapeAll(str.slice(start, pos));
return state;
}
var helpers = Object.freeze(Object.defineProperty({
__proto__: null,
parseLinkDestination,
parseLinkLabel,
parseLinkTitle
}, Symbol.toStringTag, { value: "Module" }));
var default_rules = {};
default_rules.code_inline = function(tokens, idx, options, env, slf) {
const token = tokens[idx];
return "" + escapeHtml(token.content) + "";
};
default_rules.code_block = function(tokens, idx, options, env, slf) {
const token = tokens[idx];
return "
" + escapeHtml(tokens[idx].content) + "
\n";
};
default_rules.fence = function(tokens, idx, options, env, slf) {
const token = tokens[idx];
const info = token.info ? unescapeAll(token.info).trim() : "";
let langName = "";
let langAttrs = "";
if (info) {
const arr = info.split(/(\s+)/g);
langName = arr[0];
langAttrs = arr.slice(2).join("");
}
let highlighted;
if (options.highlight) {
highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
} else {
highlighted = escapeHtml(token.content);
}
if (highlighted.indexOf("${highlighted}
`;
}
return `${highlighted}
`;
};
default_rules.image = function(tokens, idx, options, env, slf) {
const token = tokens[idx];
token.attrs[token.attrIndex("alt")][1] = slf.renderInlineAsText(token.children, options, env);
return slf.renderToken(tokens, idx, options);
};
default_rules.hardbreak = function(tokens, idx, options) {
return options.xhtmlOut ? "
\n" : "
\n";
};
default_rules.softbreak = function(tokens, idx, options) {
return options.breaks ? options.xhtmlOut ? "
\n" : "
\n" : "\n";
};
default_rules.text = function(tokens, idx) {
return escapeHtml(tokens[idx].content);
};
default_rules.html_block = function(tokens, idx) {
return tokens[idx].content;
};
default_rules.html_inline = function(tokens, idx) {
return tokens[idx].content;
};
function Renderer() {
this.rules = assign$1({}, default_rules);
}
Renderer.prototype.renderAttrs = function renderAttrs(token) {
let i, l, result;
if (!token.attrs) {
return "";
}
result = "";
for (i = 0, l = token.attrs.length; i < l; i++) {
result += " " + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
}
return result;
};
Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
const token = tokens[idx];
let result = "";
if (token.hidden) {
return "";
}
if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
result += "\n";
}
result += (token.nesting === -1 ? "" : "<") + token.tag;
result += this.renderAttrs(token);
if (token.nesting === 0 && options.xhtmlOut) {
result += " /";
}
let needLf = false;
if (token.block) {
needLf = true;
if (token.nesting === 1) {
if (idx + 1 < tokens.length) {
const nextToken = tokens[idx + 1];
if (nextToken.type === "inline" || nextToken.hidden) {
needLf = false;
} else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
needLf = false;
}
}
}
}
result += needLf ? ">\n" : ">";
return result;
};
Renderer.prototype.renderInline = function(tokens, options, env) {
let result = "";
const rules = this.rules;
for (let i = 0, len = tokens.length; i < len; i++) {
const type = tokens[i].type;
if (typeof rules[type] !== "undefined") {
result += rules[type](tokens, i, options, env, this);
} else {
result += this.renderToken(tokens, i, options);
}
}
return result;
};
Renderer.prototype.renderInlineAsText = function(tokens, options, env) {
let result = "";
for (let i = 0, len = tokens.length; i < len; i++) {
switch (tokens[i].type) {
case "text":
result += tokens[i].content;
break;
case "image":
result += this.renderInlineAsText(tokens[i].children, options, env);
break;
case "html_inline":
case "html_block":
result += tokens[i].content;
break;
case "softbreak":
case "hardbreak":
result += "\n";
break;
}
}
return result;
};
Renderer.prototype.render = function(tokens, options, env) {
let result = "";
const rules = this.rules;
for (let i = 0, len = tokens.length; i < len; i++) {
const type = tokens[i].type;
if (type === "inline") {
result += this.renderInline(tokens[i].children, options, env);
} else if (typeof rules[type] !== "undefined") {
result += rules[type](tokens, i, options, env, this);
} else {
result += this.renderToken(tokens, i, options, env);
}
}
return result;
};
function Ruler() {
this.__rules__ = [];
this.__cache__ = null;
}
Ruler.prototype.__find__ = function(name) {
for (let i = 0; i < this.__rules__.length; i++) {
if (this.__rules__[i].name === name) {
return i;
}
}
return -1;
};
Ruler.prototype.__compile__ = function() {
const self2 = this;
const chains = [""];
self2.__rules__.forEach(function(rule) {
if (!rule.enabled) {
return;
}
rule.alt.forEach(function(altName) {
if (chains.indexOf(altName) < 0) {
chains.push(altName);
}
});
});
self2.__cache__ = {};
chains.forEach(function(chain) {
self2.__cache__[chain] = [];
self2.__rules__.forEach(function(rule) {
if (!rule.enabled) {
return;
}
if (chain && rule.alt.indexOf(chain) < 0) {
return;
}
self2.__cache__[chain].push(rule.fn);
});
});
};
Ruler.prototype.at = function(name, fn2, options) {
const index = this.__find__(name);
const opt = options || {};
if (index === -1) {
throw new Error("Parser rule not found: " + name);
}
this.__rules__[index].fn = fn2;
this.__rules__[index].alt = opt.alt || [];
this.__cache__ = null;
};
Ruler.prototype.before = function(beforeName, ruleName, fn2, options) {
const index = this.__find__(beforeName);
const opt = options || {};
if (index === -1) {
throw new Error("Parser rule not found: " + beforeName);
}
this.__rules__.splice(index, 0, {
name: ruleName,
enabled: true,
fn: fn2,
alt: opt.alt || []
});
this.__cache__ = null;
};
Ruler.prototype.after = function(afterName, ruleName, fn2, options) {
const index = this.__find__(afterName);
const opt = options || {};
if (index === -1) {
throw new Error("Parser rule not found: " + afterName);
}
this.__rules__.splice(index + 1, 0, {
name: ruleName,
enabled: true,
fn: fn2,
alt: opt.alt || []
});
this.__cache__ = null;
};
Ruler.prototype.push = function(ruleName, fn2, options) {
const opt = options || {};
this.__rules__.push({
name: ruleName,
enabled: true,
fn: fn2,
alt: opt.alt || []
});
this.__cache__ = null;
};
Ruler.prototype.enable = function(list2, ignoreInvalid) {
if (!Array.isArray(list2)) {
list2 = [list2];
}
const result = [];
list2.forEach(function(name) {
const idx = this.__find__(name);
if (idx < 0) {
if (ignoreInvalid) {
return;
}
throw new Error("Rules manager: invalid rule name " + name);
}
this.__rules__[idx].enabled = true;
result.push(name);
}, this);
this.__cache__ = null;
return result;
};
Ruler.prototype.enableOnly = function(list2, ignoreInvalid) {
if (!Array.isArray(list2)) {
list2 = [list2];
}
this.__rules__.forEach(function(rule) {
rule.enabled = false;
});
this.enable(list2, ignoreInvalid);
};
Ruler.prototype.disable = function(list2, ignoreInvalid) {
if (!Array.isArray(list2)) {
list2 = [list2];
}
const result = [];
list2.forEach(function(name) {
const idx = this.__find__(name);
if (idx < 0) {
if (ignoreInvalid) {
return;
}
throw new Error("Rules manager: invalid rule name " + name);
}
this.__rules__[idx].enabled = false;
result.push(name);
}, this);
this.__cache__ = null;
return result;
};
Ruler.prototype.getRules = function(chainName) {
if (this.__cache__ === null) {
this.__compile__();
}
return this.__cache__[chainName] || [];
};
function Token(type, tag, nesting) {
this.type = type;
this.tag = tag;
this.attrs = null;
this.map = null;
this.nesting = nesting;
this.level = 0;
this.children = null;
this.content = "";
this.markup = "";
this.info = "";
this.meta = null;
this.block = false;
this.hidden = false;
}
Token.prototype.attrIndex = function attrIndex(name) {
if (!this.attrs) {
return -1;
}
const attrs = this.attrs;
for (let i = 0, len = attrs.length; i < len; i++) {
if (attrs[i][0] === name) {
return i;
}
}
return -1;
};
Token.prototype.attrPush = function attrPush(attrData) {
if (this.attrs) {
this.attrs.push(attrData);
} else {
this.attrs = [attrData];
}
};
Token.prototype.attrSet = function attrSet(name, value) {
const idx = this.attrIndex(name);
const attrData = [name, value];
if (idx < 0) {
this.attrPush(attrData);
} else {
this.attrs[idx] = attrData;
}
};
Token.prototype.attrGet = function attrGet(name) {
const idx = this.attrIndex(name);
let value = null;
if (idx >= 0) {
value = this.attrs[idx][1];
}
return value;
};
Token.prototype.attrJoin = function attrJoin(name, value) {
const idx = this.attrIndex(name);
if (idx < 0) {
this.attrPush([name, value]);
} else {
this.attrs[idx][1] = this.attrs[idx][1] + " " + value;
}
};
function StateCore(src, md, env) {
this.src = src;
this.env = env;
this.tokens = [];
this.inlineMode = false;
this.md = md;
}
StateCore.prototype.Token = Token;
var NEWLINES_RE = /\r\n?|\n/g;
var NULL_RE = /\0/g;
function normalize(state) {
let str;
str = state.src.replace(NEWLINES_RE, "\n");
str = str.replace(NULL_RE, "�");
state.src = str;
}
function block(state) {
let token;
if (state.inlineMode) {
token = new state.Token("inline", "", 0);
token.content = state.src;
token.map = [0, 1];
token.children = [];
state.tokens.push(token);
} else {
state.md.block.parse(state.src, state.md, state.env, state.tokens);
}
}
function inline(state) {
const tokens = state.tokens;
for (let i = 0, l = tokens.length; i < l; i++) {
const tok = tokens[i];
if (tok.type === "inline") {
state.md.inline.parse(tok.content, state.md, state.env, tok.children);
}
}
}
function isLinkOpen$1(str) {
return /^\s]/i.test(str);
}
function isLinkClose$1(str) {
return /^<\/a\s*>/i.test(str);
}
function linkify$1(state) {
const blockTokens = state.tokens;
if (!state.md.options.linkify) {
return;
}
for (let j = 0, l = blockTokens.length; j < l; j++) {
if (blockTokens[j].type !== "inline" || !state.md.linkify.pretest(blockTokens[j].content)) {
continue;
}
let tokens = blockTokens[j].children;
let htmlLinkLevel = 0;
for (let i = tokens.length - 1; i >= 0; i--) {
const currentToken = tokens[i];
if (currentToken.type === "link_close") {
i--;
while (tokens[i].level !== currentToken.level && tokens[i].type !== "link_open") {
i--;
}
continue;
}
if (currentToken.type === "html_inline") {
if (isLinkOpen$1(currentToken.content) && htmlLinkLevel > 0) {
htmlLinkLevel--;
}
if (isLinkClose$1(currentToken.content)) {
htmlLinkLevel++;
}
}
if (htmlLinkLevel > 0) {
continue;
}
if (currentToken.type === "text" && state.md.linkify.test(currentToken.content)) {
const text22 = currentToken.content;
let links = state.md.linkify.match(text22);
const nodes = [];
let level = currentToken.level;
let lastPos = 0;
if (links.length > 0 && links[0].index === 0 && i > 0 && tokens[i - 1].type === "text_special") {
links = links.slice(1);
}
for (let ln2 = 0; ln2 < links.length; ln2++) {
const url = links[ln2].url;
const fullUrl = state.md.normalizeLink(url);
if (!state.md.validateLink(fullUrl)) {
continue;
}
let urlText = links[ln2].text;
if (!links[ln2].schema) {
urlText = state.md.normalizeLinkText("http://" + urlText).replace(/^http:\/\//, "");
} else if (links[ln2].schema === "mailto:" && !/^mailto:/i.test(urlText)) {
urlText = state.md.normalizeLinkText("mailto:" + urlText).replace(/^mailto:/, "");
} else {
urlText = state.md.normalizeLinkText(urlText);
}
const pos = links[ln2].index;
if (pos > lastPos) {
const token = new state.Token("text", "", 0);
token.content = text22.slice(lastPos, pos);
token.level = level;
nodes.push(token);
}
const token_o = new state.Token("link_open", "a", 1);
token_o.attrs = [["href", fullUrl]];
token_o.level = level++;
token_o.markup = "linkify";
token_o.info = "auto";
nodes.push(token_o);
const token_t = new state.Token("text", "", 0);
token_t.content = urlText;
token_t.level = level;
nodes.push(token_t);
const token_c = new state.Token("link_close", "a", -1);
token_c.level = --level;
token_c.markup = "linkify";
token_c.info = "auto";
nodes.push(token_c);
lastPos = links[ln2].lastIndex;
}
if (lastPos < text22.length) {
const token = new state.Token("text", "", 0);
token.content = text22.slice(lastPos);
token.level = level;
nodes.push(token);
}
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
}
}
}
}
var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
var SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
var SCOPED_ABBR_RE = /\((c|tm|r)\)/ig;
var SCOPED_ABBR = {
c: "©",
r: "®",
tm: "™"
};
function replaceFn(match2, name) {
return SCOPED_ABBR[name.toLowerCase()];
}
function replace_scoped(inlineTokens) {
let inside_autolink = 0;
for (let i = inlineTokens.length - 1; i >= 0; i--) {
const token = inlineTokens[i];
if (token.type === "text" && !inside_autolink) {
token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
}
if (token.type === "link_open" && token.info === "auto") {
inside_autolink--;
}
if (token.type === "link_close" && token.info === "auto") {
inside_autolink++;
}
}
}
function replace_rare(inlineTokens) {
let inside_autolink = 0;
for (let i = inlineTokens.length - 1; i >= 0; i--) {
const token = inlineTokens[i];
if (token.type === "text" && !inside_autolink) {
if (RARE_RE.test(token.content)) {
token.content = token.content.replace(/\+-/g, "±").replace(/\.{2,}/g, "…").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/mg, "$1—").replace(/(^|\s)--(?=\s|$)/mg, "$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg, "$1–");
}
}
if (token.type === "link_open" && token.info === "auto") {
inside_autolink--;
}
if (token.type === "link_close" && token.info === "auto") {
inside_autolink++;
}
}
}
function replace(state) {
let blkIdx;
if (!state.md.options.typographer) {
return;
}
for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
if (state.tokens[blkIdx].type !== "inline") {
continue;
}
if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
replace_scoped(state.tokens[blkIdx].children);
}
if (RARE_RE.test(state.tokens[blkIdx].content)) {
replace_rare(state.tokens[blkIdx].children);
}
}
}
var QUOTE_TEST_RE = /['"]/;
var QUOTE_RE = /['"]/g;
var APOSTROPHE = "’";
function replaceAt(str, index, ch) {
return str.slice(0, index) + ch + str.slice(index + 1);
}
function process_inlines(tokens, state) {
let j;
const stack = [];
for (let i = 0; i < tokens.length; i++) {
const token = tokens[i];
const thisLevel = tokens[i].level;
for (j = stack.length - 1; j >= 0; j--) {
if (stack[j].level <= thisLevel) {
break;
}
}
stack.length = j + 1;
if (token.type !== "text") {
continue;
}
let text22 = token.content;
let pos = 0;
let max = text22.length;
OUTER:
while (pos < max) {
QUOTE_RE.lastIndex = pos;
const t = QUOTE_RE.exec(text22);
if (!t) {
break;
}
let canOpen = true;
let canClose = true;
pos = t.index + 1;
const isSingle = t[0] === "'";
let lastChar = 32;
if (t.index - 1 >= 0) {
lastChar = text22.charCodeAt(t.index - 1);
} else {
for (j = i - 1; j >= 0; j--) {
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
if (!tokens[j].content) continue;
lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
break;
}
}
let nextChar = 32;
if (pos < max) {
nextChar = text22.charCodeAt(pos);
} else {
for (j = i + 1; j < tokens.length; j++) {
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
if (!tokens[j].content) continue;
nextChar = tokens[j].content.charCodeAt(0);
break;
}
}
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
const isLastWhiteSpace = isWhiteSpace(lastChar);
const isNextWhiteSpace = isWhiteSpace(nextChar);
if (isNextWhiteSpace) {
canOpen = false;
} else if (isNextPunctChar) {
if (!(isLastWhiteSpace || isLastPunctChar)) {
canOpen = false;
}
}
if (isLastWhiteSpace) {
canClose = false;
} else if (isLastPunctChar) {
if (!(isNextWhiteSpace || isNextPunctChar)) {
canClose = false;
}
}
if (nextChar === 34 && t[0] === '"') {
if (lastChar >= 48 && lastChar <= 57) {
canClose = canOpen = false;
}
}
if (canOpen && canClose) {
canOpen = isLastPunctChar;
canClose = isNextPunctChar;
}
if (!canOpen && !canClose) {
if (isSingle) {
token.content = replaceAt(token.content, t.index, APOSTROPHE);
}
continue;
}
if (canClose) {
for (j = stack.length - 1; j >= 0; j--) {
let item = stack[j];
if (stack[j].level < thisLevel) {
break;
}
if (item.single === isSingle && stack[j].level === thisLevel) {
item = stack[j];
let openQuote;
let closeQuote;
if (isSingle) {
openQuote = state.md.options.quotes[2];
closeQuote = state.md.options.quotes[3];
} else {
openQuote = state.md.options.quotes[0];
closeQuote = state.md.options.quotes[1];
}
token.content = replaceAt(token.content, t.index, closeQuote);
tokens[item.token].content = replaceAt(
tokens[item.token].content,
item.pos,
openQuote
);
pos += closeQuote.length - 1;
if (item.token === i) {
pos += openQuote.length - 1;
}
text22 = token.content;
max = text22.length;
stack.length = j;
continue OUTER;
}
}
}
if (canOpen) {
stack.push({
token: i,
pos: t.index,
single: isSingle,
level: thisLevel
});
} else if (canClose && isSingle) {
token.content = replaceAt(token.content, t.index, APOSTROPHE);
}
}
}
}
function smartquotes(state) {
if (!state.md.options.typographer) {
return;
}
for (let blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
if (state.tokens[blkIdx].type !== "inline" || !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
continue;
}
process_inlines(state.tokens[blkIdx].children, state);
}
}
function text_join(state) {
let curr, last;
const blockTokens = state.tokens;
const l = blockTokens.length;
for (let j = 0; j < l; j++) {
if (blockTokens[j].type !== "inline") continue;
const tokens = blockTokens[j].children;
const max = tokens.length;
for (curr = 0; curr < max; curr++) {
if (tokens[curr].type === "text_special") {
tokens[curr].type = "text";
}
}
for (curr = last = 0; curr < max; curr++) {
if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") {
tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
} else {
if (curr !== last) {
tokens[last] = tokens[curr];
}
last++;
}
}
if (curr !== last) {
tokens.length = last;
}
}
}
var _rules$2 = [
["normalize", normalize],
["block", block],
["inline", inline],
["linkify", linkify$1],
["replacements", replace],
["smartquotes", smartquotes],
// `text_join` finds `text_special` tokens (for escape sequences)
// and joins them with the rest of the text
["text_join", text_join]
];
function Core() {
this.ruler = new Ruler();
for (let i = 0; i < _rules$2.length; i++) {
this.ruler.push(_rules$2[i][0], _rules$2[i][1]);
}
}
Core.prototype.process = function(state) {
const rules = this.ruler.getRules("");
for (let i = 0, l = rules.length; i < l; i++) {
rules[i](state);
}
};
Core.prototype.State = StateCore;
function StateBlock(src, md, env, tokens) {
this.src = src;
this.md = md;
this.env = env;
this.tokens = tokens;
this.bMarks = [];
this.eMarks = [];
this.tShift = [];
this.sCount = [];
this.bsCount = [];
this.blkIndent = 0;
this.line = 0;
this.lineMax = 0;
this.tight = false;
this.ddIndent = -1;
this.listIndent = -1;
this.parentType = "root";
this.level = 0;
const s = this.src;
for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
const ch = s.charCodeAt(pos);
if (!indent_found) {
if (isSpace(ch)) {
indent++;
if (ch === 9) {
offset += 4 - offset % 4;
} else {
offset++;
}
continue;
} else {
indent_found = true;
}
}
if (ch === 10 || pos === len - 1) {
if (ch !== 10) {
pos++;
}
this.bMarks.push(start);
this.eMarks.push(pos);
this.tShift.push(indent);
this.sCount.push(offset);
this.bsCount.push(0);
indent_found = false;
indent = 0;
offset = 0;
start = pos + 1;
}
}
this.bMarks.push(s.length);
this.eMarks.push(s.length);
this.tShift.push(0);
this.sCount.push(0);
this.bsCount.push(0);
this.lineMax = this.bMarks.length - 1;
}
StateBlock.prototype.push = function(type, tag, nesting) {
const token = new Token(type, tag, nesting);
token.block = true;
if (nesting < 0) this.level--;
token.level = this.level;
if (nesting > 0) this.level++;
this.tokens.push(token);
return token;
};
StateBlock.prototype.isEmpty = function isEmpty(line) {
return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
};
StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
for (let max = this.lineMax; from < max; from++) {
if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
break;
}
}
return from;
};
StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
for (let max = this.src.length; pos < max; pos++) {
const ch = this.src.charCodeAt(pos);
if (!isSpace(ch)) {
break;
}
}
return pos;
};
StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
if (pos <= min) {
return pos;
}
while (pos > min) {
if (!isSpace(this.src.charCodeAt(--pos))) {
return pos + 1;
}
}
return pos;
};
StateBlock.prototype.skipChars = function skipChars(pos, code22) {
for (let max = this.src.length; pos < max; pos++) {
if (this.src.charCodeAt(pos) !== code22) {
break;
}
}
return pos;
};
StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code22, min) {
if (pos <= min) {
return pos;
}
while (pos > min) {
if (code22 !== this.src.charCodeAt(--pos)) {
return pos + 1;
}
}
return pos;
};
StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
if (begin >= end) {
return "";
}
const queue = new Array(end - begin);
for (let i = 0, line = begin; line < end; line++, i++) {
let lineIndent = 0;
const lineStart = this.bMarks[line];
let first = lineStart;
let last;
if (line + 1 < end || keepLastLF) {
last = this.eMarks[line] + 1;
} else {
last = this.eMarks[line];
}
while (first < last && lineIndent < indent) {
const ch = this.src.charCodeAt(first);
if (isSpace(ch)) {
if (ch === 9) {
lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
} else {
lineIndent++;
}
} else if (first - lineStart < this.tShift[line]) {
lineIndent++;
} else {
break;
}
first++;
}
if (lineIndent > indent) {
queue[i] = new Array(lineIndent - indent + 1).join(" ") + this.src.slice(first, last);
} else {
queue[i] = this.src.slice(first, last);
}
}
return queue.join("");
};
StateBlock.prototype.Token = Token;
var MAX_AUTOCOMPLETED_CELLS = 65536;
function getLine(state, line) {
const pos = state.bMarks[line] + state.tShift[line];
const max = state.eMarks[line];
return state.src.slice(pos, max);
}
function escapedSplit(str) {
const result = [];
const max = str.length;
let pos = 0;
let ch = str.charCodeAt(pos);
let isEscaped = false;
let lastPos = 0;
let current = "";
while (pos < max) {
if (ch === 124) {
if (!isEscaped) {
result.push(current + str.substring(lastPos, pos));
current = "";
lastPos = pos + 1;
} else {
current += str.substring(lastPos, pos - 1);
lastPos = pos;
}
}
isEscaped = ch === 92;
pos++;
ch = str.charCodeAt(pos);
}
result.push(current + str.substring(lastPos));
return result;
}
function table(state, startLine, endLine, silent) {
if (startLine + 2 > endLine) {
return false;
}
let nextLine = startLine + 1;
if (state.sCount[nextLine] < state.blkIndent) {
return false;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
return false;
}
let pos = state.bMarks[nextLine] + state.tShift[nextLine];
if (pos >= state.eMarks[nextLine]) {
return false;
}
const firstCh = state.src.charCodeAt(pos++);
if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) {
return false;
}
if (pos >= state.eMarks[nextLine]) {
return false;
}
const secondCh = state.src.charCodeAt(pos++);
if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace(secondCh)) {
return false;
}
if (firstCh === 45 && isSpace(secondCh)) {
return false;
}
while (pos < state.eMarks[nextLine]) {
const ch = state.src.charCodeAt(pos);
if (ch !== 124 && ch !== 45 && ch !== 58 && !isSpace(ch)) {
return false;
}
pos++;
}
let lineText = getLine(state, startLine + 1);
let columns = lineText.split("|");
const aligns = [];
for (let i = 0; i < columns.length; i++) {
const t = columns[i].trim();
if (!t) {
if (i === 0 || i === columns.length - 1) {
continue;
} else {
return false;
}
}
if (!/^:?-+:?$/.test(t)) {
return false;
}
if (t.charCodeAt(t.length - 1) === 58) {
aligns.push(t.charCodeAt(0) === 58 ? "center" : "right");
} else if (t.charCodeAt(0) === 58) {
aligns.push("left");
} else {
aligns.push("");
}
}
lineText = getLine(state, startLine).trim();
if (lineText.indexOf("|") === -1) {
return false;
}
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
columns = escapedSplit(lineText);
if (columns.length && columns[0] === "") columns.shift();
if (columns.length && columns[columns.length - 1] === "") columns.pop();
const columnCount = columns.length;
if (columnCount === 0 || columnCount !== aligns.length) {
return false;
}
if (silent) {
return true;
}
const oldParentType = state.parentType;
state.parentType = "table";
const terminatorRules = state.md.block.ruler.getRules("blockquote");
const token_to = state.push("table_open", "table", 1);
const tableLines = [startLine, 0];
token_to.map = tableLines;
const token_tho = state.push("thead_open", "thead", 1);
token_tho.map = [startLine, startLine + 1];
const token_htro = state.push("tr_open", "tr", 1);
token_htro.map = [startLine, startLine + 1];
for (let i = 0; i < columns.length; i++) {
const token_ho = state.push("th_open", "th", 1);
if (aligns[i]) {
token_ho.attrs = [["style", "text-align:" + aligns[i]]];
}
const token_il = state.push("inline", "", 0);
token_il.content = columns[i].trim();
token_il.children = [];
state.push("th_close", "th", -1);
}
state.push("tr_close", "tr", -1);
state.push("thead_close", "thead", -1);
let tbodyLines;
let autocompletedCells = 0;
for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
if (state.sCount[nextLine] < state.blkIndent) {
break;
}
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine, endLine, true)) {
terminate = true;
break;
}
}
if (terminate) {
break;
}
lineText = getLine(state, nextLine).trim();
if (!lineText) {
break;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
break;
}
columns = escapedSplit(lineText);
if (columns.length && columns[0] === "") columns.shift();
if (columns.length && columns[columns.length - 1] === "") columns.pop();
autocompletedCells += columnCount - columns.length;
if (autocompletedCells > MAX_AUTOCOMPLETED_CELLS) {
break;
}
if (nextLine === startLine + 2) {
const token_tbo = state.push("tbody_open", "tbody", 1);
token_tbo.map = tbodyLines = [startLine + 2, 0];
}
const token_tro = state.push("tr_open", "tr", 1);
token_tro.map = [nextLine, nextLine + 1];
for (let i = 0; i < columnCount; i++) {
const token_tdo = state.push("td_open", "td", 1);
if (aligns[i]) {
token_tdo.attrs = [["style", "text-align:" + aligns[i]]];
}
const token_il = state.push("inline", "", 0);
token_il.content = columns[i] ? columns[i].trim() : "";
token_il.children = [];
state.push("td_close", "td", -1);
}
state.push("tr_close", "tr", -1);
}
if (tbodyLines) {
state.push("tbody_close", "tbody", -1);
tbodyLines[1] = nextLine;
}
state.push("table_close", "table", -1);
tableLines[1] = nextLine;
state.parentType = oldParentType;
state.line = nextLine;
return true;
}
function code2(state, startLine, endLine) {
if (state.sCount[startLine] - state.blkIndent < 4) {
return false;
}
let nextLine = startLine + 1;
let last = nextLine;
while (nextLine < endLine) {
if (state.isEmpty(nextLine)) {
nextLine++;
continue;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
nextLine++;
last = nextLine;
continue;
}
break;
}
state.line = last;
const token = state.push("code_block", "code", 0);
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + "\n";
token.map = [startLine, state.line];
return true;
}
function fence(state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
if (pos + 3 > max) {
return false;
}
const marker = state.src.charCodeAt(pos);
if (marker !== 126 && marker !== 96) {
return false;
}
let mem = pos;
pos = state.skipChars(pos, marker);
let len = pos - mem;
if (len < 3) {
return false;
}
const markup = state.src.slice(mem, pos);
const params = state.src.slice(pos, max);
if (marker === 96) {
if (params.indexOf(String.fromCharCode(marker)) >= 0) {
return false;
}
}
if (silent) {
return true;
}
let nextLine = startLine;
let haveEndMarker = false;
for (; ; ) {
nextLine++;
if (nextLine >= endLine) {
break;
}
pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
if (pos < max && state.sCount[nextLine] < state.blkIndent) {
break;
}
if (state.src.charCodeAt(pos) !== marker) {
continue;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
continue;
}
pos = state.skipChars(pos, marker);
if (pos - mem < len) {
continue;
}
pos = state.skipSpaces(pos);
if (pos < max) {
continue;
}
haveEndMarker = true;
break;
}
len = state.sCount[startLine];
state.line = nextLine + (haveEndMarker ? 1 : 0);
const token = state.push("fence", "code", 0);
token.info = params;
token.content = state.getLines(startLine + 1, nextLine, len, true);
token.markup = markup;
token.map = [startLine, state.line];
return true;
}
function blockquote(state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
const oldLineMax = state.lineMax;
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
if (state.src.charCodeAt(pos) !== 62) {
return false;
}
if (silent) {
return true;
}
const oldBMarks = [];
const oldBSCount = [];
const oldSCount = [];
const oldTShift = [];
const terminatorRules = state.md.block.ruler.getRules("blockquote");
const oldParentType = state.parentType;
state.parentType = "blockquote";
let lastLineEmpty = false;
let nextLine;
for (nextLine = startLine; nextLine < endLine; nextLine++) {
const isOutdented = state.sCount[nextLine] < state.blkIndent;
pos = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
if (pos >= max) {
break;
}
if (state.src.charCodeAt(pos++) === 62 && !isOutdented) {
let initial = state.sCount[nextLine] + 1;
let spaceAfterMarker;
let adjustTab;
if (state.src.charCodeAt(pos) === 32) {
pos++;
initial++;
adjustTab = false;
spaceAfterMarker = true;
} else if (state.src.charCodeAt(pos) === 9) {
spaceAfterMarker = true;
if ((state.bsCount[nextLine] + initial) % 4 === 3) {
pos++;
initial++;
adjustTab = false;
} else {
adjustTab = true;
}
} else {
spaceAfterMarker = false;
}
let offset = initial;
oldBMarks.push(state.bMarks[nextLine]);
state.bMarks[nextLine] = pos;
while (pos < max) {
const ch = state.src.charCodeAt(pos);
if (isSpace(ch)) {
if (ch === 9) {
offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
} else {
offset++;
}
} else {
break;
}
pos++;
}
lastLineEmpty = pos >= max;
oldBSCount.push(state.bsCount[nextLine]);
state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
oldSCount.push(state.sCount[nextLine]);
state.sCount[nextLine] = offset - initial;
oldTShift.push(state.tShift[nextLine]);
state.tShift[nextLine] = pos - state.bMarks[nextLine];
continue;
}
if (lastLineEmpty) {
break;
}
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine, endLine, true)) {
terminate = true;
break;
}
}
if (terminate) {
state.lineMax = nextLine;
if (state.blkIndent !== 0) {
oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);
oldTShift.push(state.tShift[nextLine]);
oldSCount.push(state.sCount[nextLine]);
state.sCount[nextLine] -= state.blkIndent;
}
break;
}
oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);
oldTShift.push(state.tShift[nextLine]);
oldSCount.push(state.sCount[nextLine]);
state.sCount[nextLine] = -1;
}
const oldIndent = state.blkIndent;
state.blkIndent = 0;
const token_o = state.push("blockquote_open", "blockquote", 1);
token_o.markup = ">";
const lines = [startLine, 0];
token_o.map = lines;
state.md.block.tokenize(state, startLine, nextLine);
const token_c = state.push("blockquote_close", "blockquote", -1);
token_c.markup = ">";
state.lineMax = oldLineMax;
state.parentType = oldParentType;
lines[1] = state.line;
for (let i = 0; i < oldTShift.length; i++) {
state.bMarks[i + startLine] = oldBMarks[i];
state.tShift[i + startLine] = oldTShift[i];
state.sCount[i + startLine] = oldSCount[i];
state.bsCount[i + startLine] = oldBSCount[i];
}
state.blkIndent = oldIndent;
return true;
}
function hr(state, startLine, endLine, silent) {
const max = state.eMarks[startLine];
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
let pos = state.bMarks[startLine] + state.tShift[startLine];
const marker = state.src.charCodeAt(pos++);
if (marker !== 42 && marker !== 45 && marker !== 95) {
return false;
}
let cnt = 1;
while (pos < max) {
const ch = state.src.charCodeAt(pos++);
if (ch !== marker && !isSpace(ch)) {
return false;
}
if (ch === marker) {
cnt++;
}
}
if (cnt < 3) {
return false;
}
if (silent) {
return true;
}
state.line = startLine + 1;
const token = state.push("hr", "hr", 0);
token.map = [startLine, state.line];
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
return true;
}
function skipBulletListMarker(state, startLine) {
const max = state.eMarks[startLine];
let pos = state.bMarks[startLine] + state.tShift[startLine];
const marker = state.src.charCodeAt(pos++);
if (marker !== 42 && marker !== 45 && marker !== 43) {
return -1;
}
if (pos < max) {
const ch = state.src.charCodeAt(pos);
if (!isSpace(ch)) {
return -1;
}
}
return pos;
}
function skipOrderedListMarker(state, startLine) {
const start = state.bMarks[startLine] + state.tShift[startLine];
const max = state.eMarks[startLine];
let pos = start;
if (pos + 1 >= max) {
return -1;
}
let ch = state.src.charCodeAt(pos++);
if (ch < 48 || ch > 57) {
return -1;
}
for (; ; ) {
if (pos >= max) {
return -1;
}
ch = state.src.charCodeAt(pos++);
if (ch >= 48 && ch <= 57) {
if (pos - start >= 10) {
return -1;
}
continue;
}
if (ch === 41 || ch === 46) {
break;
}
return -1;
}
if (pos < max) {
ch = state.src.charCodeAt(pos);
if (!isSpace(ch)) {
return -1;
}
}
return pos;
}
function markTightParagraphs(state, idx) {
const level = state.level + 2;
for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
if (state.tokens[i].level === level && state.tokens[i].type === "paragraph_open") {
state.tokens[i + 2].hidden = true;
state.tokens[i].hidden = true;
i += 2;
}
}
}
function list(state, startLine, endLine, silent) {
let max, pos, start, token;
let nextLine = startLine;
let tight = true;
if (state.sCount[nextLine] - state.blkIndent >= 4) {
return false;
}
if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) {
return false;
}
let isTerminatingParagraph = false;
if (silent && state.parentType === "paragraph") {
if (state.sCount[nextLine] >= state.blkIndent) {
isTerminatingParagraph = true;
}
}
let isOrdered;
let markerValue;
let posAfterMarker;
if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
isOrdered = true;
start = state.bMarks[nextLine] + state.tShift[nextLine];
markerValue = Number(state.src.slice(start, posAfterMarker - 1));
if (isTerminatingParagraph && markerValue !== 1) return false;
} else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
isOrdered = false;
} else {
return false;
}
if (isTerminatingParagraph) {
if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
}
if (silent) {
return true;
}
const markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
const listTokIdx = state.tokens.length;
if (isOrdered) {
token = state.push("ordered_list_open", "ol", 1);
if (markerValue !== 1) {
token.attrs = [["start", markerValue]];
}
} else {
token = state.push("bullet_list_open", "ul", 1);
}
const listLines = [nextLine, 0];
token.map = listLines;
token.markup = String.fromCharCode(markerCharCode);
let prevEmptyEnd = false;
const terminatorRules = state.md.block.ruler.getRules("list");
const oldParentType = state.parentType;
state.parentType = "list";
while (nextLine < endLine) {
pos = posAfterMarker;
max = state.eMarks[nextLine];
const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
let offset = initial;
while (pos < max) {
const ch = state.src.charCodeAt(pos);
if (ch === 9) {
offset += 4 - (offset + state.bsCount[nextLine]) % 4;
} else if (ch === 32) {
offset++;
} else {
break;
}
pos++;
}
const contentStart = pos;
let indentAfterMarker;
if (contentStart >= max) {
indentAfterMarker = 1;
} else {
indentAfterMarker = offset - initial;
}
if (indentAfterMarker > 4) {
indentAfterMarker = 1;
}
const indent = initial + indentAfterMarker;
token = state.push("list_item_open", "li", 1);
token.markup = String.fromCharCode(markerCharCode);
const itemLines = [nextLine, 0];
token.map = itemLines;
if (isOrdered) {
token.info = state.src.slice(start, posAfterMarker - 1);
}
const oldTight = state.tight;
const oldTShift = state.tShift[nextLine];
const oldSCount = state.sCount[nextLine];
const oldListIndent = state.listIndent;
state.listIndent = state.blkIndent;
state.blkIndent = indent;
state.tight = true;
state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
state.sCount[nextLine] = offset;
if (contentStart >= max && state.isEmpty(nextLine + 1)) {
state.line = Math.min(state.line + 2, endLine);
} else {
state.md.block.tokenize(state, nextLine, endLine, true);
}
if (!state.tight || prevEmptyEnd) {
tight = false;
}
prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
state.blkIndent = state.listIndent;
state.listIndent = oldListIndent;
state.tShift[nextLine] = oldTShift;
state.sCount[nextLine] = oldSCount;
state.tight = oldTight;
token = state.push("list_item_close", "li", -1);
token.markup = String.fromCharCode(markerCharCode);
nextLine = state.line;
itemLines[1] = nextLine;
if (nextLine >= endLine) {
break;
}
if (state.sCount[nextLine] < state.blkIndent) {
break;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
break;
}
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine, endLine, true)) {
terminate = true;
break;
}
}
if (terminate) {
break;
}
if (isOrdered) {
posAfterMarker = skipOrderedListMarker(state, nextLine);
if (posAfterMarker < 0) {
break;
}
start = state.bMarks[nextLine] + state.tShift[nextLine];
} else {
posAfterMarker = skipBulletListMarker(state, nextLine);
if (posAfterMarker < 0) {
break;
}
}
if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) {
break;
}
}
if (isOrdered) {
token = state.push("ordered_list_close", "ol", -1);
} else {
token = state.push("bullet_list_close", "ul", -1);
}
token.markup = String.fromCharCode(markerCharCode);
listLines[1] = nextLine;
state.line = nextLine;
state.parentType = oldParentType;
if (tight) {
markTightParagraphs(state, listTokIdx);
}
return true;
}
function reference(state, startLine, _endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
let nextLine = startLine + 1;
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
if (state.src.charCodeAt(pos) !== 91) {
return false;
}
function getNextLine(nextLine2) {
const endLine = state.lineMax;
if (nextLine2 >= endLine || state.isEmpty(nextLine2)) {
return null;
}
let isContinuation = false;
if (state.sCount[nextLine2] - state.blkIndent > 3) {
isContinuation = true;
}
if (state.sCount[nextLine2] < 0) {
isContinuation = true;
}
if (!isContinuation) {
const terminatorRules = state.md.block.ruler.getRules("reference");
const oldParentType = state.parentType;
state.parentType = "reference";
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine2, endLine, true)) {
terminate = true;
break;
}
}
state.parentType = oldParentType;
if (terminate) {
return null;
}
}
const pos2 = state.bMarks[nextLine2] + state.tShift[nextLine2];
const max2 = state.eMarks[nextLine2];
return state.src.slice(pos2, max2 + 1);
}
let str = state.src.slice(pos, max + 1);
max = str.length;
let labelEnd = -1;
for (pos = 1; pos < max; pos++) {
const ch = str.charCodeAt(pos);
if (ch === 91) {
return false;
} else if (ch === 93) {
labelEnd = pos;
break;
} else if (ch === 10) {
const lineContent = getNextLine(nextLine);
if (lineContent !== null) {
str += lineContent;
max = str.length;
nextLine++;
}
} else if (ch === 92) {
pos++;
if (pos < max && str.charCodeAt(pos) === 10) {
const lineContent = getNextLine(nextLine);
if (lineContent !== null) {
str += lineContent;
max = str.length;
nextLine++;
}
}
}
}
if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) {
return false;
}
for (pos = labelEnd + 2; pos < max; pos++) {
const ch = str.charCodeAt(pos);
if (ch === 10) {
const lineContent = getNextLine(nextLine);
if (lineContent !== null) {
str += lineContent;
max = str.length;
nextLine++;
}
} else if (isSpace(ch)) ;
else {
break;
}
}
const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
if (!destRes.ok) {
return false;
}
const href = state.md.normalizeLink(destRes.str);
if (!state.md.validateLink(href)) {
return false;
}
pos = destRes.pos;
const destEndPos = pos;
const destEndLineNo = nextLine;
const start = pos;
for (; pos < max; pos++) {
const ch = str.charCodeAt(pos);
if (ch === 10) {
const lineContent = getNextLine(nextLine);
if (lineContent !== null) {
str += lineContent;
max = str.length;
nextLine++;
}
} else if (isSpace(ch)) ;
else {
break;
}
}
let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
while (titleRes.can_continue) {
const lineContent = getNextLine(nextLine);
if (lineContent === null) break;
str += lineContent;
pos = max;
max = str.length;
nextLine++;
titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
}
let title;
if (pos < max && start !== pos && titleRes.ok) {
title = titleRes.str;
pos = titleRes.pos;
} else {
title = "";
pos = destEndPos;
nextLine = destEndLineNo;
}
while (pos < max) {
const ch = str.charCodeAt(pos);
if (!isSpace(ch)) {
break;
}
pos++;
}
if (pos < max && str.charCodeAt(pos) !== 10) {
if (title) {
title = "";
pos = destEndPos;
nextLine = destEndLineNo;
while (pos < max) {
const ch = str.charCodeAt(pos);
if (!isSpace(ch)) {
break;
}
pos++;
}
}
}
if (pos < max && str.charCodeAt(pos) !== 10) {
return false;
}
const label = normalizeReference(str.slice(1, labelEnd));
if (!label) {
return false;
}
if (silent) {
return true;
}
if (typeof state.env.references === "undefined") {
state.env.references = {};
}
if (typeof state.env.references[label] === "undefined") {
state.env.references[label] = { title, href };
}
state.line = nextLine;
return true;
}
var block_names = [
"address",
"article",
"aside",
"base",
"basefont",
"blockquote",
"body",
"caption",
"center",
"col",
"colgroup",
"dd",
"details",
"dialog",
"dir",
"div",
"dl",
"dt",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"frame",
"frameset",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hr",
"html",
"iframe",
"legend",
"li",
"link",
"main",
"menu",
"menuitem",
"nav",
"noframes",
"ol",
"optgroup",
"option",
"p",
"param",
"search",
"section",
"summary",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"title",
"tr",
"track",
"ul"
];
var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
var unquoted = "[^\"'=<>`\\x00-\\x20]+";
var single_quoted = "'[^']*'";
var double_quoted = '"[^"]*"';
var attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
var comment = "";
var processing = "<[?][\\s\\S]*?[?]>";
var declaration = "]*>";
var cdata = "";
var HTML_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + "|" + comment + "|" + processing + "|" + declaration + "|" + cdata + ")");
var HTML_OPEN_CLOSE_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + ")");
var HTML_SEQUENCES = [
[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
[/^/, true],
[/^<\?/, /\?>/, true],
[/^/, true],
[/^/, true],
[new RegExp("^?(" + block_names.join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, true],
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"), /^$/, false]
];
function html_block(state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
if (!state.md.options.html) {
return false;
}
if (state.src.charCodeAt(pos) !== 60) {
return false;
}
let lineText = state.src.slice(pos, max);
let i = 0;
for (; i < HTML_SEQUENCES.length; i++) {
if (HTML_SEQUENCES[i][0].test(lineText)) {
break;
}
}
if (i === HTML_SEQUENCES.length) {
return false;
}
if (silent) {
return HTML_SEQUENCES[i][2];
}
let nextLine = startLine + 1;
if (!HTML_SEQUENCES[i][1].test(lineText)) {
for (; nextLine < endLine; nextLine++) {
if (state.sCount[nextLine] < state.blkIndent) {
break;
}
pos = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
lineText = state.src.slice(pos, max);
if (HTML_SEQUENCES[i][1].test(lineText)) {
if (lineText.length !== 0) {
nextLine++;
}
break;
}
}
}
state.line = nextLine;
const token = state.push("html_block", "", 0);
token.map = [startLine, nextLine];
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
return true;
}
function heading(state, startLine, endLine, silent) {
let pos = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
let ch = state.src.charCodeAt(pos);
if (ch !== 35 || pos >= max) {
return false;
}
let level = 1;
ch = state.src.charCodeAt(++pos);
while (ch === 35 && pos < max && level <= 6) {
level++;
ch = state.src.charCodeAt(++pos);
}
if (level > 6 || pos < max && !isSpace(ch)) {
return false;
}
if (silent) {
return true;
}
max = state.skipSpacesBack(max, pos);
const tmp = state.skipCharsBack(max, 35, pos);
if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
max = tmp;
}
state.line = startLine + 1;
const token_o = state.push("heading_open", "h" + String(level), 1);
token_o.markup = "########".slice(0, level);
token_o.map = [startLine, state.line];
const token_i = state.push("inline", "", 0);
token_i.content = state.src.slice(pos, max).trim();
token_i.map = [startLine, state.line];
token_i.children = [];
const token_c = state.push("heading_close", "h" + String(level), -1);
token_c.markup = "########".slice(0, level);
return true;
}
function lheading(state, startLine, endLine) {
const terminatorRules = state.md.block.ruler.getRules("paragraph");
if (state.sCount[startLine] - state.blkIndent >= 4) {
return false;
}
const oldParentType = state.parentType;
state.parentType = "paragraph";
let level = 0;
let marker;
let nextLine = startLine + 1;
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
if (state.sCount[nextLine] - state.blkIndent > 3) {
continue;
}
if (state.sCount[nextLine] >= state.blkIndent) {
let pos = state.bMarks[nextLine] + state.tShift[nextLine];
const max = state.eMarks[nextLine];
if (pos < max) {
marker = state.src.charCodeAt(pos);
if (marker === 45 || marker === 61) {
pos = state.skipChars(pos, marker);
pos = state.skipSpaces(pos);
if (pos >= max) {
level = marker === 61 ? 1 : 2;
break;
}
}
}
}
if (state.sCount[nextLine] < 0) {
continue;
}
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine, endLine, true)) {
terminate = true;
break;
}
}
if (terminate) {
break;
}
}
if (!level) {
return false;
}
const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
state.line = nextLine + 1;
const token_o = state.push("heading_open", "h" + String(level), 1);
token_o.markup = String.fromCharCode(marker);
token_o.map = [startLine, state.line];
const token_i = state.push("inline", "", 0);
token_i.content = content;
token_i.map = [startLine, state.line - 1];
token_i.children = [];
const token_c = state.push("heading_close", "h" + String(level), -1);
token_c.markup = String.fromCharCode(marker);
state.parentType = oldParentType;
return true;
}
function paragraph(state, startLine, endLine) {
const terminatorRules = state.md.block.ruler.getRules("paragraph");
const oldParentType = state.parentType;
let nextLine = startLine + 1;
state.parentType = "paragraph";
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
if (state.sCount[nextLine] - state.blkIndent > 3) {
continue;
}
if (state.sCount[nextLine] < 0) {
continue;
}
let terminate = false;
for (let i = 0, l = terminatorRules.length; i < l; i++) {
if (terminatorRules[i](state, nextLine, endLine, true)) {
terminate = true;
break;
}
}
if (terminate) {
break;
}
}
const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
state.line = nextLine;
const token_o = state.push("paragraph_open", "p", 1);
token_o.map = [startLine, state.line];
const token_i = state.push("inline", "", 0);
token_i.content = content;
token_i.map = [startLine, state.line];
token_i.children = [];
state.push("paragraph_close", "p", -1);
state.parentType = oldParentType;
return true;
}
var _rules$1 = [
// First 2 params - rule name & source. Secondary array - list of rules,
// which can be terminated by this one.
["table", table, ["paragraph", "reference"]],
["code", code2],
["fence", fence, ["paragraph", "reference", "blockquote", "list"]],
["blockquote", blockquote, ["paragraph", "reference", "blockquote", "list"]],
["hr", hr, ["paragraph", "reference", "blockquote", "list"]],
["list", list, ["paragraph", "reference", "blockquote"]],
["reference", reference],
["html_block", html_block, ["paragraph", "reference", "blockquote"]],
["heading", heading, ["paragraph", "reference", "blockquote"]],
["lheading", lheading],
["paragraph", paragraph]
];
function ParserBlock() {
this.ruler = new Ruler();
for (let i = 0; i < _rules$1.length; i++) {
this.ruler.push(_rules$1[i][0], _rules$1[i][1], { alt: (_rules$1[i][2] || []).slice() });
}
}
ParserBlock.prototype.tokenize = function(state, startLine, endLine) {
const rules = this.ruler.getRules("");
const len = rules.length;
const maxNesting = state.md.options.maxNesting;
let line = startLine;
let hasEmptyLines = false;
while (line < endLine) {
state.line = line = state.skipEmptyLines(line);
if (line >= endLine) {
break;
}
if (state.sCount[line] < state.blkIndent) {
break;
}
if (state.level >= maxNesting) {
state.line = endLine;
break;
}
const prevLine = state.line;
let ok = false;
for (let i = 0; i < len; i++) {
ok = rules[i](state, line, endLine, false);
if (ok) {
if (prevLine >= state.line) {
throw new Error("block rule didn't increment state.line");
}
break;
}
}
if (!ok) throw new Error("none of the block rules matched");
state.tight = !hasEmptyLines;
if (state.isEmpty(state.line - 1)) {
hasEmptyLines = true;
}
line = state.line;
if (line < endLine && state.isEmpty(line)) {
hasEmptyLines = true;
line++;
state.line = line;
}
}
};
ParserBlock.prototype.parse = function(src, md, env, outTokens) {
if (!src) {
return;
}
const state = new this.State(src, md, env, outTokens);
this.tokenize(state, state.line, state.lineMax);
};
ParserBlock.prototype.State = StateBlock;
function StateInline(src, md, env, outTokens) {
this.src = src;
this.env = env;
this.md = md;
this.tokens = outTokens;
this.tokens_meta = Array(outTokens.length);
this.pos = 0;
this.posMax = this.src.length;
this.level = 0;
this.pending = "";
this.pendingLevel = 0;
this.cache = {};
this.delimiters = [];
this._prev_delimiters = [];
this.backticks = {};
this.backticksScanned = false;
this.linkLevel = 0;
}
StateInline.prototype.pushPending = function() {
const token = new Token("text", "", 0);
token.content = this.pending;
token.level = this.pendingLevel;
this.tokens.push(token);
this.pending = "";
return token;
};
StateInline.prototype.push = function(type, tag, nesting) {
if (this.pending) {
this.pushPending();
}
const token = new Token(type, tag, nesting);
let token_meta = null;
if (nesting < 0) {
this.level--;
this.delimiters = this._prev_delimiters.pop();
}
token.level = this.level;
if (nesting > 0) {
this.level++;
this._prev_delimiters.push(this.delimiters);
this.delimiters = [];
token_meta = { delimiters: this.delimiters };
}
this.pendingLevel = this.level;
this.tokens.push(token);
this.tokens_meta.push(token_meta);
return token;
};
StateInline.prototype.scanDelims = function(start, canSplitWord) {
const max = this.posMax;
const marker = this.src.charCodeAt(start);
const lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 32;
let pos = start;
while (pos < max && this.src.charCodeAt(pos) === marker) {
pos++;
}
const count = pos - start;
const nextChar = pos < max ? this.src.charCodeAt(pos) : 32;
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
const isLastWhiteSpace = isWhiteSpace(lastChar);
const isNextWhiteSpace = isWhiteSpace(nextChar);
const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
return { can_open, can_close, length: count };
};
StateInline.prototype.Token = Token;
function isTerminatorChar(ch) {
switch (ch) {
case 10:
case 33:
case 35:
case 36:
case 37:
case 38:
case 42:
case 43:
case 45:
case 58:
case 60:
case 61:
case 62:
case 64:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
case 123:
case 125:
case 126:
return true;
default:
return false;
}
}
function text(state, silent) {
let pos = state.pos;
while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
pos++;
}
if (pos === state.pos) {
return false;
}
if (!silent) {
state.pending += state.src.slice(state.pos, pos);
}
state.pos = pos;
return true;
}
var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
function linkify(state, silent) {
if (!state.md.options.linkify) return false;
if (state.linkLevel > 0) return false;
const pos = state.pos;
const max = state.posMax;
if (pos + 3 > max) return false;
if (state.src.charCodeAt(pos) !== 58) return false;
if (state.src.charCodeAt(pos + 1) !== 47) return false;
if (state.src.charCodeAt(pos + 2) !== 47) return false;
const match2 = state.pending.match(SCHEME_RE);
if (!match2) return false;
const proto = match2[1];
const link22 = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
if (!link22) return false;
let url = link22.url;
if (url.length <= proto.length) return false;
url = url.replace(/\*+$/, "");
const fullUrl = state.md.normalizeLink(url);
if (!state.md.validateLink(fullUrl)) return false;
if (!silent) {
state.pending = state.pending.slice(0, -proto.length);
const token_o = state.push("link_open", "a", 1);
token_o.attrs = [["href", fullUrl]];
token_o.markup = "linkify";
token_o.info = "auto";
const token_t = state.push("text", "", 0);
token_t.content = state.md.normalizeLinkText(url);
const token_c = state.push("link_close", "a", -1);
token_c.markup = "linkify";
token_c.info = "auto";
}
state.pos += url.length - proto.length;
return true;
}
function newline(state, silent) {
let pos = state.pos;
if (state.src.charCodeAt(pos) !== 10) {
return false;
}
const pmax = state.pending.length - 1;
const max = state.posMax;
if (!silent) {
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
let ws = pmax - 1;
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
state.pending = state.pending.slice(0, ws);
state.push("hardbreak", "br", 0);
} else {
state.pending = state.pending.slice(0, -1);
state.push("softbreak", "br", 0);
}
} else {
state.push("softbreak", "br", 0);
}
}
pos++;
while (pos < max && isSpace(state.src.charCodeAt(pos))) {
pos++;
}
state.pos = pos;
return true;
}
var ESCAPED = [];
for (let i = 0; i < 256; i++) {
ESCAPED.push(0);
}
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch) {
ESCAPED[ch.charCodeAt(0)] = 1;
});
function escape(state, silent) {
let pos = state.pos;
const max = state.posMax;
if (state.src.charCodeAt(pos) !== 92) return false;
pos++;
if (pos >= max) return false;
let ch1 = state.src.charCodeAt(pos);
if (ch1 === 10) {
if (!silent) {
state.push("hardbreak", "br", 0);
}
pos++;
while (pos < max) {
ch1 = state.src.charCodeAt(pos);
if (!isSpace(ch1)) break;
pos++;
}
state.pos = pos;
return true;
}
let escapedStr = state.src[pos];
if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max) {
const ch2 = state.src.charCodeAt(pos + 1);
if (ch2 >= 56320 && ch2 <= 57343) {
escapedStr += state.src[pos + 1];
pos++;
}
}
const origStr = "\\" + escapedStr;
if (!silent) {
const token = state.push("text_special", "", 0);
if (ch1 < 256 && ESCAPED[ch1] !== 0) {
token.content = escapedStr;
} else {
token.content = origStr;
}
token.markup = origStr;
token.info = "escape";
}
state.pos = pos + 1;
return true;
}
function backtick(state, silent) {
let pos = state.pos;
const ch = state.src.charCodeAt(pos);
if (ch !== 96) {
return false;
}
const start = pos;
pos++;
const max = state.posMax;
while (pos < max && state.src.charCodeAt(pos) === 96) {
pos++;
}
const marker = state.src.slice(start, pos);
const openerLength = marker.length;
if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
if (!silent) state.pending += marker;
state.pos += openerLength;
return true;
}
let matchEnd = pos;
let matchStart;
while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
matchEnd = matchStart + 1;
while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96) {
matchEnd++;
}
const closerLength = matchEnd - matchStart;
if (closerLength === openerLength) {
if (!silent) {
const token = state.push("code_inline", "code", 0);
token.markup = marker;
token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
}
state.pos = matchEnd;
return true;
}
state.backticks[closerLength] = matchStart;
}
state.backticksScanned = true;
if (!silent) state.pending += marker;
state.pos += openerLength;
return true;
}
function strikethrough_tokenize(state, silent) {
const start = state.pos;
const marker = state.src.charCodeAt(start);
if (silent) {
return false;
}
if (marker !== 126) {
return false;
}
const scanned = state.scanDelims(state.pos, true);
let len = scanned.length;
const ch = String.fromCharCode(marker);
if (len < 2) {
return false;
}
let token;
if (len % 2) {
token = state.push("text", "", 0);
token.content = ch;
len--;
}
for (let i = 0; i < len; i += 2) {
token = state.push("text", "", 0);
token.content = ch + ch;
state.delimiters.push({
marker,
length: 0,
// disable "rule of 3" length checks meant for emphasis
token: state.tokens.length - 1,
end: -1,
open: scanned.can_open,
close: scanned.can_close
});
}
state.pos += scanned.length;
return true;
}
function postProcess$1(state, delimiters) {
let token;
const loneMarkers = [];
const max = delimiters.length;
for (let i = 0; i < max; i++) {
const startDelim = delimiters[i];
if (startDelim.marker !== 126) {
continue;
}
if (startDelim.end === -1) {
continue;
}
const endDelim = delimiters[startDelim.end];
token = state.tokens[startDelim.token];
token.type = "s_open";
token.tag = "s";
token.nesting = 1;
token.markup = "~~";
token.content = "";
token = state.tokens[endDelim.token];
token.type = "s_close";
token.tag = "s";
token.nesting = -1;
token.markup = "~~";
token.content = "";
if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "~") {
loneMarkers.push(endDelim.token - 1);
}
}
while (loneMarkers.length) {
const i = loneMarkers.pop();
let j = i + 1;
while (j < state.tokens.length && state.tokens[j].type === "s_close") {
j++;
}
j--;
if (i !== j) {
token = state.tokens[j];
state.tokens[j] = state.tokens[i];
state.tokens[i] = token;
}
}
}
function strikethrough_postProcess(state) {
const tokens_meta = state.tokens_meta;
const max = state.tokens_meta.length;
postProcess$1(state, state.delimiters);
for (let curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
postProcess$1(state, tokens_meta[curr].delimiters);
}
}
}
var r_strikethrough = {
tokenize: strikethrough_tokenize,
postProcess: strikethrough_postProcess
};
function emphasis_tokenize(state, silent) {
const start = state.pos;
const marker = state.src.charCodeAt(start);
if (silent) {
return false;
}
if (marker !== 95 && marker !== 42) {
return false;
}
const scanned = state.scanDelims(state.pos, marker === 42);
for (let i = 0; i < scanned.length; i++) {
const token = state.push("text", "", 0);
token.content = String.fromCharCode(marker);
state.delimiters.push({
// Char code of the starting marker (number).
//
marker,
// Total length of these series of delimiters.
//
length: scanned.length,
// A position of the token this delimiter corresponds to.
//
token: state.tokens.length - 1,
// If this delimiter is matched as a valid opener, `end` will be
// equal to its position, otherwise it's `-1`.
//
end: -1,
// Boolean flags that determine if this delimiter could open or close
// an emphasis.
//
open: scanned.can_open,
close: scanned.can_close
});
}
state.pos += scanned.length;
return true;
}
function postProcess(state, delimiters) {
const max = delimiters.length;
for (let i = max - 1; i >= 0; i--) {
const startDelim = delimiters[i];
if (startDelim.marker !== 95 && startDelim.marker !== 42) {
continue;
}
if (startDelim.end === -1) {
continue;
}
const endDelim = delimiters[startDelim.end];
const isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && // check that first two markers match and adjacent
delimiters[i - 1].marker === startDelim.marker && delimiters[i - 1].token === startDelim.token - 1 && // check that last two markers are adjacent (we can safely assume they match)
delimiters[startDelim.end + 1].token === endDelim.token + 1;
const ch = String.fromCharCode(startDelim.marker);
const token_o = state.tokens[startDelim.token];
token_o.type = isStrong ? "strong_open" : "em_open";
token_o.tag = isStrong ? "strong" : "em";
token_o.nesting = 1;
token_o.markup = isStrong ? ch + ch : ch;
token_o.content = "";
const token_c = state.tokens[endDelim.token];
token_c.type = isStrong ? "strong_close" : "em_close";
token_c.tag = isStrong ? "strong" : "em";
token_c.nesting = -1;
token_c.markup = isStrong ? ch + ch : ch;
token_c.content = "";
if (isStrong) {
state.tokens[delimiters[i - 1].token].content = "";
state.tokens[delimiters[startDelim.end + 1].token].content = "";
i--;
}
}
}
function emphasis_post_process(state) {
const tokens_meta = state.tokens_meta;
const max = state.tokens_meta.length;
postProcess(state, state.delimiters);
for (let curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
postProcess(state, tokens_meta[curr].delimiters);
}
}
}
var r_emphasis = {
tokenize: emphasis_tokenize,
postProcess: emphasis_post_process
};
function link2(state, silent) {
let code22, label, res, ref2;
let href = "";
let title = "";
let start = state.pos;
let parseReference = true;
if (state.src.charCodeAt(state.pos) !== 91) {
return false;
}
const oldPos = state.pos;
const max = state.posMax;
const labelStart = state.pos + 1;
const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
if (labelEnd < 0) {
return false;
}
let pos = labelEnd + 1;
if (pos < max && state.src.charCodeAt(pos) === 40) {
parseReference = false;
pos++;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
if (pos >= max) {
return false;
}
start = pos;
res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
if (res.ok) {
href = state.md.normalizeLink(res.str);
if (state.md.validateLink(href)) {
pos = res.pos;
} else {
href = "";
}
start = pos;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
if (pos < max && start !== pos && res.ok) {
title = res.str;
pos = res.pos;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
}
}
if (pos >= max || state.src.charCodeAt(pos) !== 41) {
parseReference = true;
}
pos++;
}
if (parseReference) {
if (typeof state.env.references === "undefined") {
return false;
}
if (pos < max && state.src.charCodeAt(pos) === 91) {
start = pos + 1;
pos = state.md.helpers.parseLinkLabel(state, pos);
if (pos >= 0) {
label = state.src.slice(start, pos++);
} else {
pos = labelEnd + 1;
}
} else {
pos = labelEnd + 1;
}
if (!label) {
label = state.src.slice(labelStart, labelEnd);
}
ref2 = state.env.references[normalizeReference(label)];
if (!ref2) {
state.pos = oldPos;
return false;
}
href = ref2.href;
title = ref2.title;
}
if (!silent) {
state.pos = labelStart;
state.posMax = labelEnd;
const token_o = state.push("link_open", "a", 1);
const attrs = [["href", href]];
token_o.attrs = attrs;
if (title) {
attrs.push(["title", title]);
}
state.linkLevel++;
state.md.inline.tokenize(state);
state.linkLevel--;
state.push("link_close", "a", -1);
}
state.pos = pos;
state.posMax = max;
return true;
}
function image2(state, silent) {
let code22, content, label, pos, ref2, res, title, start;
let href = "";
const oldPos = state.pos;
const max = state.posMax;
if (state.src.charCodeAt(state.pos) !== 33) {
return false;
}
if (state.src.charCodeAt(state.pos + 1) !== 91) {
return false;
}
const labelStart = state.pos + 2;
const labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
if (labelEnd < 0) {
return false;
}
pos = labelEnd + 1;
if (pos < max && state.src.charCodeAt(pos) === 40) {
pos++;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
if (pos >= max) {
return false;
}
start = pos;
res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
if (res.ok) {
href = state.md.normalizeLink(res.str);
if (state.md.validateLink(href)) {
pos = res.pos;
} else {
href = "";
}
}
start = pos;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
if (pos < max && start !== pos && res.ok) {
title = res.str;
pos = res.pos;
for (; pos < max; pos++) {
code22 = state.src.charCodeAt(pos);
if (!isSpace(code22) && code22 !== 10) {
break;
}
}
} else {
title = "";
}
if (pos >= max || state.src.charCodeAt(pos) !== 41) {
state.pos = oldPos;
return false;
}
pos++;
} else {
if (typeof state.env.references === "undefined") {
return false;
}
if (pos < max && state.src.charCodeAt(pos) === 91) {
start = pos + 1;
pos = state.md.helpers.parseLinkLabel(state, pos);
if (pos >= 0) {
label = state.src.slice(start, pos++);
} else {
pos = labelEnd + 1;
}
} else {
pos = labelEnd + 1;
}
if (!label) {
label = state.src.slice(labelStart, labelEnd);
}
ref2 = state.env.references[normalizeReference(label)];
if (!ref2) {
state.pos = oldPos;
return false;
}
href = ref2.href;
title = ref2.title;
}
if (!silent) {
content = state.src.slice(labelStart, labelEnd);
const tokens = [];
state.md.inline.parse(
content,
state.md,
state.env,
tokens
);
const token = state.push("image", "img", 0);
const attrs = [["src", href], ["alt", ""]];
token.attrs = attrs;
token.children = tokens;
token.content = content;
if (title) {
attrs.push(["title", title]);
}
}
state.pos = pos;
state.posMax = max;
return true;
}
var EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
var AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
function autolink(state, silent) {
let pos = state.pos;
if (state.src.charCodeAt(pos) !== 60) {
return false;
}
const start = state.pos;
const max = state.posMax;
for (; ; ) {
if (++pos >= max) return false;
const ch = state.src.charCodeAt(pos);
if (ch === 60) return false;
if (ch === 62) break;
}
const url = state.src.slice(start + 1, pos);
if (AUTOLINK_RE.test(url)) {
const fullUrl = state.md.normalizeLink(url);
if (!state.md.validateLink(fullUrl)) {
return false;
}
if (!silent) {
const token_o = state.push("link_open", "a", 1);
token_o.attrs = [["href", fullUrl]];
token_o.markup = "autolink";
token_o.info = "auto";
const token_t = state.push("text", "", 0);
token_t.content = state.md.normalizeLinkText(url);
const token_c = state.push("link_close", "a", -1);
token_c.markup = "autolink";
token_c.info = "auto";
}
state.pos += url.length + 2;
return true;
}
if (EMAIL_RE.test(url)) {
const fullUrl = state.md.normalizeLink("mailto:" + url);
if (!state.md.validateLink(fullUrl)) {
return false;
}
if (!silent) {
const token_o = state.push("link_open", "a", 1);
token_o.attrs = [["href", fullUrl]];
token_o.markup = "autolink";
token_o.info = "auto";
const token_t = state.push("text", "", 0);
token_t.content = state.md.normalizeLinkText(url);
const token_c = state.push("link_close", "a", -1);
token_c.markup = "autolink";
token_c.info = "auto";
}
state.pos += url.length + 2;
return true;
}
return false;
}
function isLinkOpen(str) {
return /^\s]/i.test(str);
}
function isLinkClose(str) {
return /^<\/a\s*>/i.test(str);
}
function isLetter(ch) {
const lc = ch | 32;
return lc >= 97 && lc <= 122;
}
function html_inline(state, silent) {
if (!state.md.options.html) {
return false;
}
const max = state.posMax;
const pos = state.pos;
if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) {
return false;
}
const ch = state.src.charCodeAt(pos + 1);
if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) {
return false;
}
const match2 = state.src.slice(pos).match(HTML_TAG_RE);
if (!match2) {
return false;
}
if (!silent) {
const token = state.push("html_inline", "", 0);
token.content = match2[0];
if (isLinkOpen(token.content)) state.linkLevel++;
if (isLinkClose(token.content)) state.linkLevel--;
}
state.pos += match2[0].length;
return true;
}
var DIGITAL_RE = /^((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
function entity(state, silent) {
const pos = state.pos;
const max = state.posMax;
if (state.src.charCodeAt(pos) !== 38) return false;
if (pos + 1 >= max) return false;
const ch = state.src.charCodeAt(pos + 1);
if (ch === 35) {
const match2 = state.src.slice(pos).match(DIGITAL_RE);
if (match2) {
if (!silent) {
const code22 = match2[1][0].toLowerCase() === "x" ? parseInt(match2[1].slice(1), 16) : parseInt(match2[1], 10);
const token = state.push("text_special", "", 0);
token.content = isValidEntityCode(code22) ? fromCodePoint(code22) : fromCodePoint(65533);
token.markup = match2[0];
token.info = "entity";
}
state.pos += match2[0].length;
return true;
}
} else {
const match2 = state.src.slice(pos).match(NAMED_RE);
if (match2) {
const decoded = decodeHTML(match2[0]);
if (decoded !== match2[0]) {
if (!silent) {
const token = state.push("text_special", "", 0);
token.content = decoded;
token.markup = match2[0];
token.info = "entity";
}
state.pos += match2[0].length;
return true;
}
}
}
return false;
}
function processDelimiters(delimiters) {
const openersBottom = {};
const max = delimiters.length;
if (!max) return;
let headerIdx = 0;
let lastTokenIdx = -2;
const jumps = [];
for (let closerIdx = 0; closerIdx < max; closerIdx++) {
const closer = delimiters[closerIdx];
jumps.push(0);
if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {
headerIdx = closerIdx;
}
lastTokenIdx = closer.token;
closer.length = closer.length || 0;
if (!closer.close) continue;
if (!openersBottom.hasOwnProperty(closer.marker)) {
openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1];
}
const minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
let openerIdx = headerIdx - jumps[headerIdx] - 1;
let newMinOpenerIdx = openerIdx;
for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
const opener = delimiters[openerIdx];
if (opener.marker !== closer.marker) continue;
if (opener.open && opener.end < 0) {
let isOddMatch = false;
if (opener.close || closer.open) {
if ((opener.length + closer.length) % 3 === 0) {
if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
isOddMatch = true;
}
}
}
if (!isOddMatch) {
const lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
jumps[openerIdx] = lastJump;
closer.open = false;
opener.end = closerIdx;
opener.close = false;
newMinOpenerIdx = -1;
lastTokenIdx = -2;
break;
}
}
}
if (newMinOpenerIdx !== -1) {
openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length || 0) % 3] = newMinOpenerIdx;
}
}
}
function link_pairs(state) {
const tokens_meta = state.tokens_meta;
const max = state.tokens_meta.length;
processDelimiters(state.delimiters);
for (let curr = 0; curr < max; curr++) {
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
processDelimiters(tokens_meta[curr].delimiters);
}
}
}
function fragments_join(state) {
let curr, last;
let level = 0;
const tokens = state.tokens;
const max = state.tokens.length;
for (curr = last = 0; curr < max; curr++) {
if (tokens[curr].nesting < 0) level--;
tokens[curr].level = level;
if (tokens[curr].nesting > 0) level++;
if (tokens[curr].type === "text" && curr + 1 < max && tokens[curr + 1].type === "text") {
tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
} else {
if (curr !== last) {
tokens[last] = tokens[curr];
}
last++;
}
}
if (curr !== last) {
tokens.length = last;
}
}
var _rules = [
["text", text],
["linkify", linkify],
["newline", newline],
["escape", escape],
["backticks", backtick],
["strikethrough", r_strikethrough.tokenize],
["emphasis", r_emphasis.tokenize],
["link", link2],
["image", image2],
["autolink", autolink],
["html_inline", html_inline],
["entity", entity]
];
var _rules2 = [
["balance_pairs", link_pairs],
["strikethrough", r_strikethrough.postProcess],
["emphasis", r_emphasis.postProcess],
// rules for pairs separate '**' into its own text tokens, which may be left unused,
// rule below merges unused segments back with the rest of the text
["fragments_join", fragments_join]
];
function ParserInline() {
this.ruler = new Ruler();
for (let i = 0; i < _rules.length; i++) {
this.ruler.push(_rules[i][0], _rules[i][1]);
}
this.ruler2 = new Ruler();
for (let i = 0; i < _rules2.length; i++) {
this.ruler2.push(_rules2[i][0], _rules2[i][1]);
}
}
ParserInline.prototype.skipToken = function(state) {
const pos = state.pos;
const rules = this.ruler.getRules("");
const len = rules.length;
const maxNesting = state.md.options.maxNesting;
const cache = state.cache;
if (typeof cache[pos] !== "undefined") {
state.pos = cache[pos];
return;
}
let ok = false;
if (state.level < maxNesting) {
for (let i = 0; i < len; i++) {
state.level++;
ok = rules[i](state, true);
state.level--;
if (ok) {
if (pos >= state.pos) {
throw new Error("inline rule didn't increment state.pos");
}
break;
}
}
} else {
state.pos = state.posMax;
}
if (!ok) {
state.pos++;
}
cache[pos] = state.pos;
};
ParserInline.prototype.tokenize = function(state) {
const rules = this.ruler.getRules("");
const len = rules.length;
const end = state.posMax;
const maxNesting = state.md.options.maxNesting;
while (state.pos < end) {
const prevPos = state.pos;
let ok = false;
if (state.level < maxNesting) {
for (let i = 0; i < len; i++) {
ok = rules[i](state, false);
if (ok) {
if (prevPos >= state.pos) {
throw new Error("inline rule didn't increment state.pos");
}
break;
}
}
}
if (ok) {
if (state.pos >= end) {
break;
}
continue;
}
state.pending += state.src[state.pos++];
}
if (state.pending) {
state.pushPending();
}
};
ParserInline.prototype.parse = function(str, md, env, outTokens) {
const state = new this.State(str, md, env, outTokens);
this.tokenize(state);
const rules = this.ruler2.getRules("");
const len = rules.length;
for (let i = 0; i < len; i++) {
rules[i](state);
}
};
ParserInline.prototype.State = StateInline;
function reFactory(opts) {
const re2 = {};
opts = opts || {};
re2.src_Any = Any.source;
re2.src_Cc = Cc.source;
re2.src_Z = Z.source;
re2.src_P = P.source;
re2.src_ZPCc = [re2.src_Z, re2.src_P, re2.src_Cc].join("|");
re2.src_ZCc = [re2.src_Z, re2.src_Cc].join("|");
const text_separators = "[><|]";
re2.src_pseudo_letter = "(?:(?!" + text_separators + "|" + re2.src_ZPCc + ")" + re2.src_Any + ")";
re2.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
re2.src_auth = "(?:(?:(?!" + re2.src_ZCc + "|[@/\\[\\]()]).)+@)?";
re2.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
re2.src_host_terminator = "(?=$|" + text_separators + "|" + re2.src_ZPCc + ")(?!" + (opts["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + re2.src_ZPCc + "))";
re2.src_path = "(?:[/?#](?:(?!" + re2.src_ZCc + "|" + text_separators + `|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!` + re2.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + re2.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + re2.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + re2.src_ZCc + `|["]).)+\\"|\\'(?:(?!` + re2.src_ZCc + "|[']).)+\\'|\\'(?=" + re2.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + re2.src_ZCc + "|[.]|$)|" + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + // allow `,,,` in paths
",(?!" + re2.src_ZCc + "|$)|;(?!" + re2.src_ZCc + "|$)|\\!+(?!" + re2.src_ZCc + "|[!]|$)|\\?(?!" + re2.src_ZCc + "|[?]|$))+|\\/)?";
re2.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';
re2.src_xn = "xn--[a-z0-9\\-]{1,59}";
re2.src_domain_root = // Allow letters & digits (http://test1)
"(?:" + re2.src_xn + "|" + re2.src_pseudo_letter + "{1,63})";
re2.src_domain = "(?:" + re2.src_xn + "|(?:" + re2.src_pseudo_letter + ")|(?:" + re2.src_pseudo_letter + "(?:-|" + re2.src_pseudo_letter + "){0,61}" + re2.src_pseudo_letter + "))";
re2.src_host = "(?:(?:(?:(?:" + re2.src_domain + ")\\.)*" + re2.src_domain + "))";
re2.tpl_host_fuzzy = "(?:" + re2.src_ip4 + "|(?:(?:(?:" + re2.src_domain + ")\\.)+(?:%TLDS%)))";
re2.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + re2.src_domain + ")\\.)+(?:%TLDS%))";
re2.src_host_strict = re2.src_host + re2.src_host_terminator;
re2.tpl_host_fuzzy_strict = re2.tpl_host_fuzzy + re2.src_host_terminator;
re2.src_host_port_strict = re2.src_host + re2.src_port + re2.src_host_terminator;
re2.tpl_host_port_fuzzy_strict = re2.tpl_host_fuzzy + re2.src_port + re2.src_host_terminator;
re2.tpl_host_port_no_ip_fuzzy_strict = re2.tpl_host_no_ip_fuzzy + re2.src_port + re2.src_host_terminator;
re2.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + re2.src_ZPCc + "|>|$))";
re2.tpl_email_fuzzy = "(^|" + text_separators + '|"|\\(|' + re2.src_ZCc + ")(" + re2.src_email_name + "@" + re2.tpl_host_fuzzy_strict + ")";
re2.tpl_link_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
// but can start with > (markdown blockquote)
"(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + re2.src_ZPCc + "))((?![$+<=>^`||])" + re2.tpl_host_port_fuzzy_strict + re2.src_path + ")";
re2.tpl_link_no_ip_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
// but can start with > (markdown blockquote)
"(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + re2.src_ZPCc + "))((?![$+<=>^`||])" + re2.tpl_host_port_no_ip_fuzzy_strict + re2.src_path + ")";
return re2;
}
function assign(obj) {
const sources = Array.prototype.slice.call(arguments, 1);
sources.forEach(function(source) {
if (!source) {
return;
}
Object.keys(source).forEach(function(key2) {
obj[key2] = source[key2];
});
});
return obj;
}
function _class(obj) {
return Object.prototype.toString.call(obj);
}
function isString(obj) {
return _class(obj) === "[object String]";
}
function isObject3(obj) {
return _class(obj) === "[object Object]";
}
function isRegExp(obj) {
return _class(obj) === "[object RegExp]";
}
function isFunction(obj) {
return _class(obj) === "[object Function]";
}
function escapeRE(str) {
return str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
}
var defaultOptions = {
fuzzyLink: true,
fuzzyEmail: true,
fuzzyIP: false
};
function isOptionsObj(obj) {
return Object.keys(obj || {}).reduce(function(acc, k) {
return acc || defaultOptions.hasOwnProperty(k);
}, false);
}
var defaultSchemas = {
"http:": {
validate: function(text22, pos, self2) {
const tail = text22.slice(pos);
if (!self2.re.http) {
self2.re.http = new RegExp(
"^\\/\\/" + self2.re.src_auth + self2.re.src_host_port_strict + self2.re.src_path,
"i"
);
}
if (self2.re.http.test(tail)) {
return tail.match(self2.re.http)[0].length;
}
return 0;
}
},
"https:": "http:",
"ftp:": "http:",
"//": {
validate: function(text22, pos, self2) {
const tail = text22.slice(pos);
if (!self2.re.no_http) {
self2.re.no_http = new RegExp(
"^" + self2.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
// with code comments
"(?:localhost|(?:(?:" + self2.re.src_domain + ")\\.)+" + self2.re.src_domain_root + ")" + self2.re.src_port + self2.re.src_host_terminator + self2.re.src_path,
"i"
);
}
if (self2.re.no_http.test(tail)) {
if (pos >= 3 && text22[pos - 3] === ":") {
return 0;
}
if (pos >= 3 && text22[pos - 3] === "/") {
return 0;
}
return tail.match(self2.re.no_http)[0].length;
}
return 0;
}
},
"mailto:": {
validate: function(text22, pos, self2) {
const tail = text22.slice(pos);
if (!self2.re.mailto) {
self2.re.mailto = new RegExp(
"^" + self2.re.src_email_name + "@" + self2.re.src_host_strict,
"i"
);
}
if (self2.re.mailto.test(tail)) {
return tail.match(self2.re.mailto)[0].length;
}
return 0;
}
}
};
var tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
var tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
function resetScanCache(self2) {
self2.__index__ = -1;
self2.__text_cache__ = "";
}
function createValidator(re2) {
return function(text22, pos) {
const tail = text22.slice(pos);
if (re2.test(tail)) {
return tail.match(re2)[0].length;
}
return 0;
};
}
function createNormalizer() {
return function(match2, self2) {
self2.normalize(match2);
};
}
function compile(self2) {
const re2 = self2.re = reFactory(self2.__opts__);
const tlds2 = self2.__tlds__.slice();
self2.onCompile();
if (!self2.__tlds_replaced__) {
tlds2.push(tlds_2ch_src_re);
}
tlds2.push(re2.src_xn);
re2.src_tlds = tlds2.join("|");
function untpl(tpl) {
return tpl.replace("%TLDS%", re2.src_tlds);
}
re2.email_fuzzy = RegExp(untpl(re2.tpl_email_fuzzy), "i");
re2.link_fuzzy = RegExp(untpl(re2.tpl_link_fuzzy), "i");
re2.link_no_ip_fuzzy = RegExp(untpl(re2.tpl_link_no_ip_fuzzy), "i");
re2.host_fuzzy_test = RegExp(untpl(re2.tpl_host_fuzzy_test), "i");
const aliases = [];
self2.__compiled__ = {};
function schemaError(name, val) {
throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
}
Object.keys(self2.__schemas__).forEach(function(name) {
const val = self2.__schemas__[name];
if (val === null) {
return;
}
const compiled = { validate: null, link: null };
self2.__compiled__[name] = compiled;
if (isObject3(val)) {
if (isRegExp(val.validate)) {
compiled.validate = createValidator(val.validate);
} else if (isFunction(val.validate)) {
compiled.validate = val.validate;
} else {
schemaError(name, val);
}
if (isFunction(val.normalize)) {
compiled.normalize = val.normalize;
} else if (!val.normalize) {
compiled.normalize = createNormalizer();
} else {
schemaError(name, val);
}
return;
}
if (isString(val)) {
aliases.push(name);
return;
}
schemaError(name, val);
});
aliases.forEach(function(alias) {
if (!self2.__compiled__[self2.__schemas__[alias]]) {
return;
}
self2.__compiled__[alias].validate = self2.__compiled__[self2.__schemas__[alias]].validate;
self2.__compiled__[alias].normalize = self2.__compiled__[self2.__schemas__[alias]].normalize;
});
self2.__compiled__[""] = { validate: null, normalize: createNormalizer() };
const slist = Object.keys(self2.__compiled__).filter(function(name) {
return name.length > 0 && self2.__compiled__[name];
}).map(escapeRE).join("|");
self2.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + re2.src_ZPCc + "))(" + slist + ")", "i");
self2.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + re2.src_ZPCc + "))(" + slist + ")", "ig");
self2.re.schema_at_start = RegExp("^" + self2.re.schema_search.source, "i");
self2.re.pretest = RegExp(
"(" + self2.re.schema_test.source + ")|(" + self2.re.host_fuzzy_test.source + ")|@",
"i"
);
resetScanCache(self2);
}
function Match(self2, shift) {
const start = self2.__index__;
const end = self2.__last_index__;
const text22 = self2.__text_cache__.slice(start, end);
this.schema = self2.__schema__.toLowerCase();
this.index = start + shift;
this.lastIndex = end + shift;
this.raw = text22;
this.text = text22;
this.url = text22;
}
function createMatch(self2, shift) {
const match2 = new Match(self2, shift);
self2.__compiled__[match2.schema].normalize(match2, self2);
return match2;
}
function LinkifyIt(schemas, options) {
if (!(this instanceof LinkifyIt)) {
return new LinkifyIt(schemas, options);
}
if (!options) {
if (isOptionsObj(schemas)) {
options = schemas;
schemas = {};
}
}
this.__opts__ = assign({}, defaultOptions, options);
this.__index__ = -1;
this.__last_index__ = -1;
this.__schema__ = "";
this.__text_cache__ = "";
this.__schemas__ = assign({}, defaultSchemas, schemas);
this.__compiled__ = {};
this.__tlds__ = tlds_default;
this.__tlds_replaced__ = false;
this.re = {};
compile(this);
}
LinkifyIt.prototype.add = function add(schema, definition) {
this.__schemas__[schema] = definition;
compile(this);
return this;
};
LinkifyIt.prototype.set = function set(options) {
this.__opts__ = assign(this.__opts__, options);
return this;
};
LinkifyIt.prototype.test = function test(text22) {
this.__text_cache__ = text22;
this.__index__ = -1;
if (!text22.length) {
return false;
}
let m, ml, me2, len, shift, next, re2, tld_pos, at_pos;
if (this.re.schema_test.test(text22)) {
re2 = this.re.schema_search;
re2.lastIndex = 0;
while ((m = re2.exec(text22)) !== null) {
len = this.testSchemaAt(text22, m[2], re2.lastIndex);
if (len) {
this.__schema__ = m[2];
this.__index__ = m.index + m[1].length;
this.__last_index__ = m.index + m[0].length + len;
break;
}
}
}
if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
tld_pos = text22.search(this.re.host_fuzzy_test);
if (tld_pos >= 0) {
if (this.__index__ < 0 || tld_pos < this.__index__) {
if ((ml = text22.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
shift = ml.index + ml[1].length;
if (this.__index__ < 0 || shift < this.__index__) {
this.__schema__ = "";
this.__index__ = shift;
this.__last_index__ = ml.index + ml[0].length;
}
}
}
}
}
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
at_pos = text22.indexOf("@");
if (at_pos >= 0) {
if ((me2 = text22.match(this.re.email_fuzzy)) !== null) {
shift = me2.index + me2[1].length;
next = me2.index + me2[0].length;
if (this.__index__ < 0 || shift < this.__index__ || shift === this.__index__ && next > this.__last_index__) {
this.__schema__ = "mailto:";
this.__index__ = shift;
this.__last_index__ = next;
}
}
}
}
return this.__index__ >= 0;
};
LinkifyIt.prototype.pretest = function pretest(text22) {
return this.re.pretest.test(text22);
};
LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text22, schema, pos) {
if (!this.__compiled__[schema.toLowerCase()]) {
return 0;
}
return this.__compiled__[schema.toLowerCase()].validate(text22, pos, this);
};
LinkifyIt.prototype.match = function match(text22) {
const result = [];
let shift = 0;
if (this.__index__ >= 0 && this.__text_cache__ === text22) {
result.push(createMatch(this, shift));
shift = this.__last_index__;
}
let tail = shift ? text22.slice(shift) : text22;
while (this.test(tail)) {
result.push(createMatch(this, shift));
tail = tail.slice(this.__last_index__);
shift += this.__last_index__;
}
if (result.length) {
return result;
}
return null;
};
LinkifyIt.prototype.matchAtStart = function matchAtStart(text22) {
this.__text_cache__ = text22;
this.__index__ = -1;
if (!text22.length) return null;
const m = this.re.schema_at_start.exec(text22);
if (!m) return null;
const len = this.testSchemaAt(text22, m[2], m[0].length);
if (!len) return null;
this.__schema__ = m[2];
this.__index__ = m.index + m[1].length;
this.__last_index__ = m.index + m[0].length + len;
return createMatch(this, 0);
};
LinkifyIt.prototype.tlds = function tlds(list2, keepOld) {
list2 = Array.isArray(list2) ? list2 : [list2];
if (!keepOld) {
this.__tlds__ = list2.slice();
this.__tlds_replaced__ = true;
compile(this);
return this;
}
this.__tlds__ = this.__tlds__.concat(list2).sort().filter(function(el, idx, arr) {
return el !== arr[idx - 1];
}).reverse();
compile(this);
return this;
};
LinkifyIt.prototype.normalize = function normalize2(match2) {
if (!match2.schema) {
match2.url = "http://" + match2.url;
}
if (match2.schema === "mailto:" && !/^mailto:/i.test(match2.url)) {
match2.url = "mailto:" + match2.url;
}
};
LinkifyIt.prototype.onCompile = function onCompile() {
};
var maxInt = 2147483647;
var base = 36;
var tMin = 1;
var tMax = 26;
var skew = 38;
var damp = 700;
var initialBias = 72;
var initialN = 128;
var delimiter = "-";
var regexPunycode = /^xn--/;
var regexNonASCII = /[^\0-\x7F]/;
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
var errors = {
"overflow": "Overflow: input needs wider integers to process",
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
"invalid-input": "Invalid input"
};
var baseMinusTMin = base - tMin;
var floor = Math.floor;
var stringFromCharCode = String.fromCharCode;
function error(type) {
throw new RangeError(errors[type]);
}
function map(array, callback) {
const result = [];
let length = array.length;
while (length--) {
result[length] = callback(array[length]);
}
return result;
}
function mapDomain(domain, callback) {
const parts = domain.split("@");
let result = "";
if (parts.length > 1) {
result = parts[0] + "@";
domain = parts[1];
}
domain = domain.replace(regexSeparators, ".");
const labels = domain.split(".");
const encoded = map(labels, callback).join(".");
return result + encoded;
}
function ucs2decode(string) {
const output = [];
let counter = 0;
const length = string.length;
while (counter < length) {
const value = string.charCodeAt(counter++);
if (value >= 55296 && value <= 56319 && counter < length) {
const extra = string.charCodeAt(counter++);
if ((extra & 64512) == 56320) {
output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
} else {
output.push(value);
counter--;
}
} else {
output.push(value);
}
}
return output;
}
var ucs2encode = (codePoints) => String.fromCodePoint(...codePoints);
var basicToDigit = function(codePoint) {
if (codePoint >= 48 && codePoint < 58) {
return 26 + (codePoint - 48);
}
if (codePoint >= 65 && codePoint < 91) {
return codePoint - 65;
}
if (codePoint >= 97 && codePoint < 123) {
return codePoint - 97;
}
return base;
};
var digitToBasic = function(digit, flag) {
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
};
var adapt = function(delta, numPoints, firstTime) {
let k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (; delta > baseMinusTMin * tMax >> 1; k += base) {
delta = floor(delta / baseMinusTMin);
}
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};
var decode = function(input) {
const output = [];
const inputLength = input.length;
let i = 0;
let n = initialN;
let bias = initialBias;
let basic = input.lastIndexOf(delimiter);
if (basic < 0) {
basic = 0;
}
for (let j = 0; j < basic; ++j) {
if (input.charCodeAt(j) >= 128) {
error("not-basic");
}
output.push(input.charCodeAt(j));
}
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
const oldi = i;
for (let w = 1, k = base; ; k += base) {
if (index >= inputLength) {
error("invalid-input");
}
const digit = basicToDigit(input.charCodeAt(index++));
if (digit >= base) {
error("invalid-input");
}
if (digit > floor((maxInt - i) / w)) {
error("overflow");
}
i += digit * w;
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
if (digit < t) {
break;
}
const baseMinusT = base - t;
if (w > floor(maxInt / baseMinusT)) {
error("overflow");
}
w *= baseMinusT;
}
const out = output.length + 1;
bias = adapt(i - oldi, out, oldi == 0);
if (floor(i / out) > maxInt - n) {
error("overflow");
}
n += floor(i / out);
i %= out;
output.splice(i++, 0, n);
}
return String.fromCodePoint(...output);
};
var encode = function(input) {
const output = [];
input = ucs2decode(input);
const inputLength = input.length;
let n = initialN;
let delta = 0;
let bias = initialBias;
for (const currentValue of input) {
if (currentValue < 128) {
output.push(stringFromCharCode(currentValue));
}
}
const basicLength = output.length;
let handledCPCount = basicLength;
if (basicLength) {
output.push(delimiter);
}
while (handledCPCount < inputLength) {
let m = maxInt;
for (const currentValue of input) {
if (currentValue >= n && currentValue < m) {
m = currentValue;
}
}
const handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
error("overflow");
}
delta += (m - n) * handledCPCountPlusOne;
n = m;
for (const currentValue of input) {
if (currentValue < n && ++delta > maxInt) {
error("overflow");
}
if (currentValue === n) {
let q2 = delta;
for (let k = base; ; k += base) {
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
if (q2 < t) {
break;
}
const qMinusT = q2 - t;
const baseMinusT = base - t;
output.push(
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
);
q2 = floor(qMinusT / baseMinusT);
}
output.push(stringFromCharCode(digitToBasic(q2, 0)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
delta = 0;
++handledCPCount;
}
}
++delta;
++n;
}
return output.join("");
};
var toUnicode = function(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
});
};
var toASCII = function(input) {
return mapDomain(input, function(string) {
return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
});
};
var punycode = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
* @type String
*/
"version": "2.3.1",
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
* @see
* @memberOf punycode
* @type Object
*/
"ucs2": {
"decode": ucs2decode,
"encode": ucs2encode
},
"decode": decode,
"encode": encode,
"toASCII": toASCII,
"toUnicode": toUnicode
};
var cfg_default = {
options: {
// Enable HTML tags in source
html: false,
// Use '/' to close single tags (
)
xhtmlOut: false,
// Convert '\n' in paragraphs into
breaks: false,
// CSS language prefix for fenced blocks
langPrefix: "language-",
// autoconvert URL-like texts to links
linkify: false,
// Enable some language-neutral replacements + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
quotes: "“”‘’",
/* “”‘’ */
// Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed and should be escaped externaly.
// If result starts with )
xhtmlOut: false,
// Convert '\n' in paragraphs into
breaks: false,
// CSS language prefix for fenced blocks
langPrefix: "language-",
// autoconvert URL-like texts to links
linkify: false,
// Enable some language-neutral replacements + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
quotes: "“”‘’",
/* “”‘’ */
// Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed and should be escaped externaly.
// If result starts with )
xhtmlOut: true,
// Convert '\n' in paragraphs into
breaks: false,
// CSS language prefix for fenced blocks
langPrefix: "language-",
// autoconvert URL-like texts to links
linkify: false,
// Enable some language-neutral replacements + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
quotes: "“”‘’",
/* “”‘’ */
// Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed and should be escaped externaly.
// If result starts with = 0) {
try {
parsed.hostname = punycode.toASCII(parsed.hostname);
} catch (er) {
}
}
}
return encode$1(format(parsed));
}
function normalizeLinkText(url) {
const parsed = urlParse(url, true);
if (parsed.hostname) {
if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
try {
parsed.hostname = punycode.toUnicode(parsed.hostname);
} catch (er) {
}
}
}
return decode$1(format(parsed), decode$1.defaultChars + "%");
}
function MarkdownIt(presetName, options) {
if (!(this instanceof MarkdownIt)) {
return new MarkdownIt(presetName, options);
}
if (!options) {
if (!isString$12(presetName)) {
options = presetName || {};
presetName = "default";
}
}
this.inline = new ParserInline();
this.block = new ParserBlock();
this.core = new Core();
this.renderer = new Renderer();
this.linkify = new LinkifyIt();
this.validateLink = validateLink;
this.normalizeLink = normalizeLink;
this.normalizeLinkText = normalizeLinkText;
this.utils = utils;
this.helpers = assign$1({}, helpers);
this.options = {};
this.configure(presetName);
if (options) {
this.set(options);
}
}
MarkdownIt.prototype.set = function(options) {
assign$1(this.options, options);
return this;
};
MarkdownIt.prototype.configure = function(presets) {
const self2 = this;
if (isString$12(presets)) {
const presetName = presets;
presets = config[presetName];
if (!presets) {
throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
}
}
if (!presets) {
throw new Error("Wrong `markdown-it` preset, can't be empty");
}
if (presets.options) {
self2.set(presets.options);
}
if (presets.components) {
Object.keys(presets.components).forEach(function(name) {
if (presets.components[name].rules) {
self2[name].ruler.enableOnly(presets.components[name].rules);
}
if (presets.components[name].rules2) {
self2[name].ruler2.enableOnly(presets.components[name].rules2);
}
});
}
return this;
};
MarkdownIt.prototype.enable = function(list2, ignoreInvalid) {
let result = [];
if (!Array.isArray(list2)) {
list2 = [list2];
}
["core", "block", "inline"].forEach(function(chain) {
result = result.concat(this[chain].ruler.enable(list2, true));
}, this);
result = result.concat(this.inline.ruler2.enable(list2, true));
const missed = list2.filter(function(name) {
return result.indexOf(name) < 0;
});
if (missed.length && !ignoreInvalid) {
throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + missed);
}
return this;
};
MarkdownIt.prototype.disable = function(list2, ignoreInvalid) {
let result = [];
if (!Array.isArray(list2)) {
list2 = [list2];
}
["core", "block", "inline"].forEach(function(chain) {
result = result.concat(this[chain].ruler.disable(list2, true));
}, this);
result = result.concat(this.inline.ruler2.disable(list2, true));
const missed = list2.filter(function(name) {
return result.indexOf(name) < 0;
});
if (missed.length && !ignoreInvalid) {
throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + missed);
}
return this;
};
MarkdownIt.prototype.use = function(plugin) {
const args = [this].concat(Array.prototype.slice.call(arguments, 1));
plugin.apply(plugin, args);
return this;
};
MarkdownIt.prototype.parse = function(src, env) {
if (typeof src !== "string") {
throw new Error("Input data should be a String");
}
const state = new this.core.State(src, this, env);
this.core.process(state);
return state.tokens;
};
MarkdownIt.prototype.render = function(src, env) {
env = env || {};
return this.renderer.render(this.parse(src, env), this.options, env);
};
MarkdownIt.prototype.parseInline = function(src, env) {
const state = new this.core.State(src, this, env);
state.inlineMode = true;
this.core.process(state);
return state.tokens;
};
MarkdownIt.prototype.renderInline = function(src, env) {
env = env || {};
return this.renderer.render(this.parseInline(src, env), this.options, env);
};
var APP_CONFIG_PROVIDE_KEY = Symbol("vue-element-plus-x-config");
var DEFAULT_MD_CONFIG = {
html: true,
linkify: true,
typographer: true,
breaks: true
};
var DEFAULT_APP_CONFIG = {
mdPlugins: [],
md: new MarkdownIt(DEFAULT_MD_CONFIG)
};
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ConfigProvider/hooks.js
function useConfigProvider() {
return inject(APP_CONFIG_PROVIDE_KEY, DEFAULT_APP_CONFIG);
}
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Typewriter/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Typewriter/index.css";
var _hoisted_13 = ["innerHTML"];
var _sfc_main4 = defineComponent({
__name: "index",
props: {
content: { default: "" },
isMarkdown: { type: Boolean, default: false },
typing: { type: [Boolean, Object], default: false },
isFog: { type: [Boolean, Object], default: false },
highlight: {},
mdPlugins: {}
},
emits: ["start", "writing", "finish"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const configProvider = useConfigProvider();
const { md } = configProvider;
const markdownContentRef = ref(null);
const typeWriterRef = ref(null);
function initMarkdownPlugins() {
var _a3, _b2;
if ((_a3 = configProvider.mdPlugins) == null ? void 0 : _a3.length) {
configProvider.mdPlugins.forEach((plugin) => {
md == null ? void 0 : md.use(plugin);
});
}
if ((_b2 = props.mdPlugins) == null ? void 0 : _b2.length) {
props.mdPlugins.forEach((plugin) => {
md == null ? void 0 : md.use(plugin);
});
}
}
initMarkdownPlugins();
const typingIndex = ref(0);
const isTyping = ref(false);
let timer = null;
const contentCache = ref("");
const mergedConfig = computed(() => {
const defaultConfig = {
step: typeof props.typing === "object" ? props.typing.step ?? 2 : 2,
interval: typeof props.typing === "object" ? props.typing.interval ?? 50 : 50,
// 根据条件动态设置后缀
suffix: props.isMarkdown ? "" : typeof props.typing === "object" ? props.typing.suffix ?? "|" : "|"
};
if (props.typing === true) {
return {
...defaultConfig
};
}
if (typeof props.typing === "object") {
return {
...defaultConfig,
...props.typing,
// 强制覆盖后缀设置
suffix: props.isMarkdown ? "" : props.typing.suffix ?? "|"
};
}
return defaultConfig;
});
const processedContent = computed(() => {
if (!props.content)
return "";
if (!props.typing) {
return props.content;
}
const displayed = contentCache.value.slice(0, typingIndex.value);
return displayed;
});
const typingProgress = computed(() => {
return contentCache.value ? Math.min(typingIndex.value / contentCache.value.length * 100, 100) : 0;
});
const renderedContent = computed(() => {
if (!props.isMarkdown) {
return processedContent.value;
}
return purify.sanitize((md == null ? void 0 : md.render(processedContent.value ?? "")) ?? "");
});
const instance = {
interrupt,
continue: continueTyping,
restart,
destroy,
renderedContent: computed(() => renderedContent.value),
isTyping: toRef(isTyping),
progress: computed(() => typingProgress.value)
};
watch(
() => props.content,
(newVal, oldVal) => {
if (!props.typing) {
typingIndex.value = (newVal == null ? void 0 : newVal.length) || 0;
isTyping.value = false;
contentCache.value = newVal || "";
return;
}
const shouldReset = !oldVal || !(newVal == null ? void 0 : newVal.startsWith(oldVal));
if (shouldReset) {
typingIndex.value = 0;
contentCache.value = newVal || "";
} else {
contentCache.value = newVal || "";
}
if (!isTyping.value) {
startTyping();
}
},
{ immediate: true }
);
function startTyping() {
clearTimeout(timer);
if (!props.typing || !contentCache.value)
return;
isTyping.value = true;
emits("start", instance);
const typeNext = () => {
typingIndex.value += mergedConfig.value.step;
emits("writing", instance);
if (typingIndex.value >= contentCache.value.length) {
finishTyping();
return;
}
timer = setTimeout(typeNext, mergedConfig.value.interval);
};
timer = setTimeout(typeNext, mergedConfig.value.interval);
}
function finishTyping() {
var _a3;
isTyping.value = false;
typingIndex.value = contentCache.value.length;
if (((_a3 = props.typing) == null ? void 0 : _a3.isRequestEnd) ?? true) {
emits("finish", instance);
}
}
function interrupt() {
clearTimeout(timer);
isTyping.value = false;
}
function continueTyping() {
if (typingIndex.value < contentCache.value.length) {
startTyping();
}
}
function restart() {
typingIndex.value = 0;
startTyping();
}
function destroy() {
clearTimeout(timer);
timer = null;
typingIndex.value = 0;
isTyping.value = false;
}
onUnmounted(destroy);
__expose(instance);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "typeWriterRef",
ref: typeWriterRef,
class: "typer-container"
}, [
createBaseVNode("div", {
ref_key: "markdownContentRef",
ref: markdownContentRef,
class: normalizeClass(["typer-content", [
{
"markdown-content": _ctx.isMarkdown,
"typing-cursor": _ctx.typing && unref(mergedConfig).suffix && unref(isTyping),
"typing-cursor-foggy": props.isFog && _ctx.typing && unref(mergedConfig).suffix && unref(isTyping),
"typing-markdown-cursor-foggy": _ctx.isMarkdown && props.isFog && _ctx.typing && unref(isTyping)
},
_ctx.isMarkdown ? "markdown-body" : ""
]]),
style: normalizeStyle({
"--cursor-char": `'${unref(mergedConfig).suffix}'`,
"--cursor-fog-bg-color": props.isFog ? typeof props.isFog === "object" ? props.isFog.bgColor ?? "var(--el-fill-color)" : "var(--el-fill-color)" : "",
"--cursor-fog-width": props.isFog ? typeof props.isFog === "object" ? props.isFog.width ?? "80px" : "80px" : ""
}),
innerHTML: unref(renderedContent)
}, null, 14, _hoisted_13)
], 512);
};
}
});
var Typewriter = _export_sfc2(_sfc_main4, [["__scopeId", "data-v-9311cb64"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Bubble/index.js
var avatarProps = buildProps({
size: {
type: [Number, String],
values: componentSizes,
default: "",
validator: (val) => isNumber(val)
},
shape: {
type: String,
values: ["circle", "square"],
default: "circle"
},
icon: {
type: iconPropType
},
src: {
type: String,
default: ""
},
alt: String,
srcSet: String,
fit: {
type: definePropType(String),
default: "cover"
}
});
var avatarEmits = {
error: (evt) => evt instanceof Event
};
var __default__4 = defineComponent({
name: "ElAvatar"
});
var _sfc_main$14 = defineComponent({
...__default__4,
props: avatarProps,
emits: avatarEmits,
setup(__props, { emit }) {
const props = __props;
const ns = useNamespace("avatar");
const hasLoadError = ref(false);
const avatarClass = computed(() => {
const { size, icon, shape } = props;
const classList = [ns.b()];
if (isString$1(size))
classList.push(ns.m(size));
if (icon)
classList.push(ns.m("icon"));
if (shape)
classList.push(ns.m(shape));
return classList;
});
const sizeStyle = computed(() => {
const { size } = props;
return isNumber(size) ? ns.cssVarBlock({
size: addUnit(size) || ""
}) : void 0;
});
const fitStyle = computed(() => ({
objectFit: props.fit
}));
watch(() => props.src, () => hasLoadError.value = false);
function handleError(e) {
hasLoadError.value = true;
emit("error", e);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
class: normalizeClass(unref(avatarClass)),
style: normalizeStyle(unref(sizeStyle))
}, [
(_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
key: 0,
src: _ctx.src,
alt: _ctx.alt,
srcset: _ctx.srcSet,
style: normalizeStyle(unref(fitStyle)),
onError: handleError
}, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
})) : renderSlot(_ctx.$slots, "default", { key: 2 })
], 6);
};
}
});
var Avatar = _export_sfc(_sfc_main$14, [["__file", "avatar.vue"]]);
var ElAvatar = withInstall(Avatar);
var _hoisted_14 = {
key: 0,
class: "el-bubble-avatar el-bubble-avatar-size"
};
var _hoisted_23 = {
key: 1,
class: "el-bubble-avatar-placeholder"
};
var _hoisted_33 = {
key: 2,
class: "el-bubble-avatar"
};
var _hoisted_43 = { class: "el-bubble-content-wrapper" };
var _hoisted_53 = {
key: 0,
class: "el-bubble-header"
};
var _hoisted_62 = {
key: 2,
class: "el-bubble-loading-wrap"
};
var _hoisted_72 = {
key: 3,
class: "el-bubble-loading-wrap"
};
var _hoisted_8 = {
key: 1,
class: "el-bubble-footer"
};
var _sfc_main5 = defineComponent({
__name: "index",
props: {
isFog: { type: [Boolean, Object] },
typing: { type: [Boolean, Object] },
content: { default: "" },
isMarkdown: { type: Boolean },
placement: { default: "start" },
avatar: { default: "" },
loading: { type: Boolean },
shape: {},
variant: { default: "filled" },
maxWidth: { default: "500px" },
avatarSize: { default: "" },
avatarGap: { default: "12px" },
avatarShape: { default: "circle" },
avatarSrcSet: { default: "" },
avatarAlt: { default: "" },
avatarFit: { default: "cover" },
noStyle: { type: Boolean, default: false }
},
emits: ["start", "finish", "writing", "avatarError"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const internalDestroyed = ref(false);
const isTypingClass = ref(false);
watch(
() => props.content,
(newVal, oldVal) => {
if (newVal !== oldVal && internalDestroyed.value) {
restart();
}
}
);
const typewriterRef = ref();
const instance = {
interrupt,
continue: continueTyping,
restart,
destroy,
renderedContent: computed(
() => {
var _a3;
return internalDestroyed.value ? "" : ((_a3 = typewriterRef.value) == null ? void 0 : _a3.renderedContent.value) || "";
}
),
isTyping: computed(
() => {
var _a3;
return !internalDestroyed.value && (((_a3 = typewriterRef.value) == null ? void 0 : _a3.isTyping.value) || false);
}
),
progress: computed(
() => {
var _a3;
return internalDestroyed.value ? 0 : ((_a3 = typewriterRef.value) == null ? void 0 : _a3.progress.value) || 0;
}
)
};
const DEFAULT_TYPING = {
step: 2,
suffix: "|",
interval: 50,
isRequestEnd: true
};
const _typing = computed(() => {
if (typeof props.typing === "undefined") {
return false;
} else if (typeof props.typing === "boolean") {
return props.typing;
} else {
return Object.assign({}, DEFAULT_TYPING, props.typing);
}
});
function onStart(instance2) {
emits("start", instance2);
}
function onFinish(instance2) {
isTypingClass.value = false;
emits("finish", instance2);
}
function onWriting(instance2) {
isTypingClass.value = true;
emits("writing", instance2);
}
function avatarError(e) {
emits("avatarError", e);
}
function interrupt() {
var _a3;
(_a3 = typewriterRef.value) == null ? void 0 : _a3.interrupt();
}
function continueTyping() {
var _a3;
(_a3 = typewriterRef.value) == null ? void 0 : _a3.continue();
}
function restart() {
var _a3;
internalDestroyed.value = false;
(_a3 = typewriterRef.value) == null ? void 0 : _a3.restart();
}
function destroy() {
var _a3;
(_a3 = typewriterRef.value) == null ? void 0 : _a3.destroy();
internalDestroyed.value = true;
}
onUnmounted(instance.destroy);
__expose(instance);
return (_ctx, _cache) => {
const _component_el_avatar = ElAvatar;
return !unref(internalDestroyed) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["el-bubble", {
"el-bubble-start": _ctx.placement === "start",
"el-bubble-end": _ctx.placement === "end",
"el-bubble-no-style": _ctx.noStyle,
"el-bubble-is-typing": unref(isTypingClass)
// 新增动态类名
}]),
style: normalizeStyle({
"--el-box-shadow-tertiary": `0 1px 2px 0 rgba(0, 0, 0, 0.03),
0 1px 6px -1px rgba(0, 0, 0, 0.02),
0 2px 4px 0 rgba(0, 0, 0, 0.02)`,
"--bubble-content-max-width": `${_ctx.maxWidth}`,
"--el-bubble-avatar-placeholder-width": `${_ctx.$slots.avatar ? "" : _ctx.avatarSize}`,
"--el-bubble-avatar-placeholder-height": `${_ctx.$slots.avatar ? "" : _ctx.avatarSize}`,
"--el-bubble-avatar-placeholder-gap": `${_ctx.avatarGap}`
})
}, [
!_ctx.$slots.avatar && _ctx.avatar ? (openBlock(), createElementBlock("div", _hoisted_14, [
createVNode(_component_el_avatar, {
size: 0,
src: _ctx.avatar,
shape: _ctx.avatarShape,
"src-set": _ctx.avatarSrcSet,
alt: _ctx.avatarFit,
onError: avatarError
}, null, 8, ["src", "shape", "src-set", "alt"])
])) : createCommentVNode("", true),
!_ctx.$slots.avatar && !_ctx.avatar && _ctx.avatarSize ? (openBlock(), createElementBlock("div", _hoisted_23)) : createCommentVNode("", true),
_ctx.$slots.avatar ? (openBlock(), createElementBlock("div", _hoisted_33, [
renderSlot(_ctx.$slots, "avatar", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_43, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_53, [
renderSlot(_ctx.$slots, "header", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", {
class: normalizeClass(["el-bubble-content", {
"el-bubble-content-loading": _ctx.loading,
"el-bubble-content-round": _ctx.shape === "round" && !_ctx.noStyle,
"el-bubble-content-corner": _ctx.shape === "corner" && !_ctx.noStyle,
"el-bubble-content-filled": _ctx.variant === "filled" && !_ctx.noStyle,
"el-bubble-content-borderless": _ctx.variant === "borderless" && !_ctx.noStyle,
"el-bubble-content-outlined": _ctx.variant === "outlined" && !_ctx.noStyle,
"el-bubble-content-shadow": _ctx.variant === "shadow" && !_ctx.noStyle
}])
}, [
!_ctx.loading ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["el-typewriter", {
"no-content": !_ctx.content
}])
}, [
!_ctx.$slots.content && _ctx.content ? (openBlock(), createBlock(Typewriter, {
key: 0,
ref_key: "typewriterRef",
ref: typewriterRef,
typing: unref(_typing),
content: _ctx.content,
"is-markdown": _ctx.isMarkdown,
"is-fog": props.isFog,
onStart,
onWriting,
onFinish
}, null, 8, ["typing", "content", "is-markdown", "is-fog"])) : createCommentVNode("", true)
], 2)) : createCommentVNode("", true),
!unref(internalDestroyed) && _ctx.$slots.content && !_ctx.loading ? renderSlot(_ctx.$slots, "content", { key: 1 }, void 0, true) : createCommentVNode("", true),
_ctx.loading && !_ctx.$slots.loading ? (openBlock(), createElementBlock("div", _hoisted_62, [
(openBlock(), createElementBlock(Fragment, null, renderList(3, (_, index) => {
return createBaseVNode("div", {
key: index,
class: "dot",
style: normalizeStyle({ animationDelay: `${index * 0.2}s` })
}, null, 4);
}), 64))
])) : createCommentVNode("", true),
_ctx.loading && _ctx.$slots.loading ? (openBlock(), createElementBlock("div", _hoisted_72, [
renderSlot(_ctx.$slots, "loading", {}, void 0, true)
])) : createCommentVNode("", true)
], 2),
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_8, [
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : createCommentVNode("", true)
])
], 6)) : createCommentVNode("", true);
};
}
});
var Bubble = _export_sfc2(_sfc_main5, [["__scopeId", "data-v-a52d8fe0"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/BubbleList/loading.js
var _sfc_main6 = {};
var _hoisted_15 = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
version: "1.1",
width: "704",
height: "704",
viewBox: "0 0 704 704"
};
function _sfc_render2(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_15, _cache[0] || (_cache[0] = [
createStaticVNode('', 2)
]));
}
var loadingBg = _export_sfc2(_sfc_main6, [["render", _sfc_render2]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/BubbleList/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style.css";
var useScrollDetector = (elementRef) => {
const hasVertical = ref(false);
const hasHorizontal = ref(false);
const check = () => {
const el = elementRef.value;
if (!el)
return;
hasVertical.value = el.scrollHeight > el.clientHeight;
hasHorizontal.value = el.scrollWidth > el.clientWidth;
};
onMounted(() => {
check();
const observer = new ResizeObserver(check);
observer.observe(elementRef.value);
onBeforeUnmount(() => observer.disconnect());
});
return {
hasVertical,
// 是否有纵向滚动条
hasHorizontal,
// 是否有横向滚动条
check
// 检查滚动条状态
};
};
var threshold = 20;
var _sfc_main7 = defineComponent({
__name: "index",
props: {
list: { default: () => [] },
maxHeight: { default: "500px" },
triggerIndices: { default: "only-last" },
showBackButton: { type: Boolean, default: true },
backButtonThreshold: { default: 80 },
backButtonPosition: { default: () => {
return { bottom: "20px", left: "calc(50% - 19px)" };
} },
alwaysShowScrollbar: { type: Boolean, default: false },
btnLoading: { type: Boolean, default: true },
btnColor: { default: "#409EFF" },
btnIconSize: { default: 24 }
},
emits: ["complete"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
function initStyle() {
document.documentElement.style.setProperty(
"--el-bubble-list-max-height",
props.maxHeight
);
document.documentElement.style.setProperty(
"--el-bubble-list-btn-size",
`${props.btnIconSize}px`
);
}
onMounted(() => {
initStyle();
});
const scrollContainer = ref(null);
const { hasVertical } = useScrollDetector(scrollContainer);
const stopAutoScrollToBottom = ref(false);
const lastScrollTop = ref(0);
const accumulatedScrollUpDistance = ref(0);
const resizeObserver = ref(null);
const showBackToBottom = ref(false);
watch(
() => props.list.length,
() => {
if (props.list && props.list.length > 0) {
nextTick(() => {
autoScroll();
});
}
},
{ immediate: true }
);
function scrollToTop() {
stopAutoScrollToBottom.value = true;
nextTick(() => {
scrollContainer.value.scrollTop = 0;
});
}
function scrollToBottom() {
try {
if (scrollContainer.value && scrollContainer.value.scrollHeight) {
nextTick(() => {
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
stopAutoScrollToBottom.value = false;
});
}
} catch (error2) {
}
}
function scrollToBubble(index) {
const container = scrollContainer.value;
if (!container)
return;
const bubbles = container.querySelectorAll(".el-bubble");
if (index >= bubbles.length)
return;
stopAutoScrollToBottom.value = true;
const targetBubble = bubbles[index];
const containerRect = container.getBoundingClientRect();
const bubbleRect = targetBubble.getBoundingClientRect();
const scrollPosition = bubbleRect.top - containerRect.top + container.scrollTop;
container.scrollTo({
top: scrollPosition,
behavior: "smooth"
});
}
function autoScroll() {
if (scrollContainer.value) {
const listBubbles = scrollContainer.value.querySelectorAll(
".el-bubble-content-wrapper"
);
if (resizeObserver.value) {
resizeObserver.value.disconnect();
}
const lastItem = listBubbles[listBubbles.length - 1];
if (lastItem) {
resizeObserver.value = new ResizeObserver(() => {
if (!stopAutoScrollToBottom.value) {
scrollToBottom();
}
});
resizeObserver.value.observe(lastItem);
}
}
}
const completeMap = ref({});
const typingList = computed(
() => props.list.map((item, _index_) => ({ ...item, _index_ })).filter((item) => item.typing)
);
function handleBubbleComplete(index, instance) {
var _a3;
switch (props.triggerIndices) {
case "only-last":
if (index === ((_a3 = typingList.value[typingList.value.length - 1]) == null ? void 0 : _a3._index_)) {
emits("complete", instance, index);
}
break;
case "all":
completeMap.value[index] = instance;
if (Object.keys(completeMap.value).length === typingList.value.length) {
emits("complete", instance, index);
}
break;
default:
props.triggerIndices.includes(index) && emits("complete", instance, index);
break;
}
}
function handleScroll() {
if (scrollContainer.value) {
const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value;
const distanceToBottom = scrollHeight - (scrollTop + clientHeight);
showBackToBottom.value = props.showBackButton && distanceToBottom > props.backButtonThreshold;
const isCloseToBottom = scrollTop + clientHeight >= scrollHeight - 30;
const isScrollingUp = lastScrollTop.value > scrollTop;
const isScrollingDown = lastScrollTop.value < scrollTop;
const scrollDelta = lastScrollTop.value - scrollTop;
lastScrollTop.value = scrollTop;
if (isScrollingUp) {
accumulatedScrollUpDistance.value += scrollDelta;
if (accumulatedScrollUpDistance.value >= threshold) {
if (!stopAutoScrollToBottom.value) {
stopAutoScrollToBottom.value = true;
}
accumulatedScrollUpDistance.value = 0;
}
} else {
accumulatedScrollUpDistance.value = 0;
}
if (isScrollingDown && isCloseToBottom) {
if (stopAutoScrollToBottom.value) {
stopAutoScrollToBottom.value = false;
}
}
}
}
__expose({
scrollToTop,
scrollToBottom,
scrollToBubble
});
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
return openBlock(), createElementBlock("div", {
ref_key: "scrollContainer",
ref: scrollContainer,
class: normalizeClass(["el-bubble-list", { "always-scrollbar": props.alwaysShowScrollbar }]),
onScroll: handleScroll
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
return openBlock(), createBlock(Bubble, {
key: index,
content: item.content,
placement: item.placement,
loading: item.loading,
shape: item.shape,
variant: item.variant,
"is-markdown": item.isMarkdown,
"is-fog": item.isFog,
typing: item.typing,
"max-width": item.maxWidth,
avatar: item.avatar,
"avatar-size": item.avatarSize,
"avatar-gap": item.avatarGap,
"avatar-shape": item.avatarShape,
"avatar-src-set": item.avatarSrcSet,
"avatar-alt": item.avatarAlt,
"avatar-fit": item.avatarFit,
"no-style": item.noStyle,
onFinish: (instance) => handleBubbleComplete(index, instance)
}, createSlots({ _: 2 }, [
_ctx.$slots.avatar ? {
name: "avatar",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "avatar", { item }, void 0, true)
]),
key: "0"
} : void 0,
_ctx.$slots.header ? {
name: "header",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "header", { item }, void 0, true)
]),
key: "1"
} : void 0,
_ctx.$slots.content ? {
name: "content",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "content", { item }, void 0, true)
]),
key: "2"
} : void 0,
_ctx.$slots.footer ? {
name: "footer",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "footer", { item }, void 0, true)
]),
key: "3"
} : void 0,
_ctx.$slots.loading ? {
name: "loading",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "loading", { item }, void 0, true)
]),
key: "4"
} : void 0
]), 1032, ["content", "placement", "loading", "shape", "variant", "is-markdown", "is-fog", "typing", "max-width", "avatar", "avatar-size", "avatar-gap", "avatar-shape", "avatar-src-set", "avatar-alt", "avatar-fit", "no-style", "onFinish"]);
}), 128)),
unref(showBackToBottom) && unref(hasVertical) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["el-bubble-list-default-back-button", {
"el-bubble-list-back-to-bottom-solt": _ctx.$slots.backToBottom
}]),
style: normalizeStyle({
bottom: _ctx.backButtonPosition.bottom,
left: _ctx.backButtonPosition.left
}),
onClick: scrollToBottom
}, [
renderSlot(_ctx.$slots, "backToBottom", {}, () => [
createVNode(_component_el_icon, {
class: "el-bubble-list-back-to-bottom-icon",
style: normalizeStyle({ color: props.btnColor })
}, {
default: withCtx(() => [
createVNode(unref(arrow_down_bold_default)),
props.btnLoading ? (openBlock(), createBlock(loadingBg, {
key: 0,
class: "back-to-bottom-loading-svg-bg"
})) : createCommentVNode("", true)
]),
_: 1
}, 8, ["style"])
], true)
], 6)) : createCommentVNode("", true)
], 34);
};
}
});
var BubbleList = _export_sfc2(_sfc_main7, [["__scopeId", "data-v-854e3219"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ConfigProvider/index.js
var _sfc_main8 = defineComponent({
__name: "index",
props: {
mdPlugins: {},
md: {}
},
setup(__props) {
const props = __props;
provide(APP_CONFIG_PROVIDE_KEY, {
md: props.md ?? DEFAULT_APP_CONFIG.md,
mdPlugins: props.mdPlugins ?? DEFAULT_APP_CONFIG.mdPlugins
});
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default", {}, void 0, true);
};
}
});
var ConfigProvider = _export_sfc2(_sfc_main8, [["__scopeId", "data-v-b6c7c904"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Conversations/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-popper.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-scrollbar.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style.scss_vue_type_style_index_0_src_fe156336_scoped_fe156336_lang-cq-zH-iH.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style11.css";
var get = (value, path, defaultValue) => {
const segments = path.split(/[\.\[\]]/g);
let current = value;
for (const key2 of segments) {
if (current === null)
return defaultValue;
if (current === void 0)
return defaultValue;
const dequoted = key2.replace(/['"]/g, "");
if (dequoted.trim() === "")
continue;
current = current[dequoted];
}
if (current === void 0)
return defaultValue;
return current;
};
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-tooltip-CnErFYFq.js
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray2(value) ? value : [value];
}
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-hKTecJ71.js
function useTimeout() {
let timeoutHandle;
const registerTimeout = (fn2, delay) => {
cancelTimeout();
timeoutHandle = window.setTimeout(fn2, delay);
};
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
tryOnScopeDispose(() => cancelTimeout());
return {
registerTimeout,
cancelTimeout
};
}
var useDelayedToggleProps = buildProps({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
});
var useDelayedToggle = ({
showAfter,
hideAfter,
autoClose,
open,
close
}) => {
const { registerTimeout } = useTimeout();
const {
registerTimeout: registerTimeoutForAutoClose,
cancelTimeout: cancelTimeoutForAutoClose
} = useTimeout();
const onOpen = (event) => {
registerTimeout(() => {
open(event);
const _autoClose = unref(autoClose);
if (isNumber(_autoClose) && _autoClose > 0) {
registerTimeoutForAutoClose(() => {
close(event);
}, _autoClose);
}
}, unref(showAfter));
};
const onClose = (event) => {
cancelTimeoutForAutoClose();
registerTimeout(() => {
close(event);
}, unref(hideAfter));
};
return {
onOpen,
onClose
};
};
var POPPER_INJECTION_KEY = Symbol("popper");
var POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
var roleTypes = [
"dialog",
"grid",
"group",
"listbox",
"menu",
"navigation",
"tooltip",
"tree"
];
var popperProps = buildProps({
role: {
type: String,
values: roleTypes,
default: "tooltip"
}
});
var __default__$6 = defineComponent({
name: "ElPopper",
inheritAttrs: false
});
var _sfc_main$62 = defineComponent({
...__default__$6,
props: popperProps,
setup(__props, { expose }) {
const props = __props;
const triggerRef = ref();
const popperInstanceRef = ref();
const contentRef = ref();
const referenceRef = ref();
const role = computed(() => props.role);
const popperProvides = {
triggerRef,
popperInstanceRef,
contentRef,
referenceRef,
role
};
expose(popperProvides);
provide(POPPER_INJECTION_KEY, popperProvides);
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};
}
});
var Popper = _export_sfc(_sfc_main$62, [["__file", "popper.vue"]]);
var __default__$5 = defineComponent({
name: "ElPopperArrow",
inheritAttrs: false
});
var _sfc_main$52 = defineComponent({
...__default__$5,
setup(__props, { expose }) {
const ns = useNamespace("popper");
const { arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
onBeforeUnmount(() => {
arrowRef.value = void 0;
});
expose({
arrowRef
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("span", {
ref_key: "arrowRef",
ref: arrowRef,
class: normalizeClass(unref(ns).e("arrow")),
style: normalizeStyle(unref(arrowStyle)),
"data-popper-arrow": ""
}, null, 6);
};
}
});
var ElPopperArrow = _export_sfc(_sfc_main$52, [["__file", "arrow.vue"]]);
var popperTriggerProps = buildProps({
virtualRef: {
type: definePropType(Object)
},
virtualTriggering: Boolean,
onMouseenter: {
type: definePropType(Function)
},
onMouseleave: {
type: definePropType(Function)
},
onClick: {
type: definePropType(Function)
},
onKeydown: {
type: definePropType(Function)
},
onFocus: {
type: definePropType(Function)
},
onBlur: {
type: definePropType(Function)
},
onContextmenu: {
type: definePropType(Function)
},
id: String,
open: Boolean
});
var FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
var useForwardRef = (forwardRef) => {
const setForwardRef = (el) => {
forwardRef.value = el;
};
provide(FORWARD_REF_INJECTION_KEY, {
setForwardRef
});
};
var useForwardRefDirective = (setForwardRef) => {
return {
mounted(el) {
setForwardRef(el);
},
updated(el) {
setForwardRef(el);
},
unmounted() {
setForwardRef(null);
}
};
};
var NAME = "ElOnlyChild";
var OnlyChild = defineComponent({
name: NAME,
setup(_, {
slots,
attrs
}) {
var _a3;
const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
const forwardRefDirective = useForwardRefDirective((_a3 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a3 : NOOP);
return () => {
var _a22;
const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
if (!defaultSlot)
return null;
if (defaultSlot.length > 1) {
return null;
}
const firstLegitNode = findFirstLegitChild(defaultSlot);
if (!firstLegitNode) {
return null;
}
return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
};
}
});
function findFirstLegitChild(node) {
if (!node)
return null;
const children = node;
for (const child of children) {
if (isObject(child)) {
switch (child.type) {
case Comment:
continue;
case Text:
case "svg":
return wrapTextContent(child);
case Fragment:
return findFirstLegitChild(child.children);
default:
return child;
}
}
return wrapTextContent(child);
}
return null;
}
function wrapTextContent(s) {
const ns = useNamespace("only-child");
return createVNode("span", {
"class": ns.e("content")
}, [s]);
}
var __default__$4 = defineComponent({
name: "ElPopperTrigger",
inheritAttrs: false
});
var _sfc_main$43 = defineComponent({
...__default__$4,
props: popperTriggerProps,
setup(__props, { expose }) {
const props = __props;
const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
useForwardRef(triggerRef);
const ariaControls = computed(() => {
return ariaHaspopup.value ? props.id : void 0;
});
const ariaDescribedby = computed(() => {
if (role && role.value === "tooltip") {
return props.open && props.id ? props.id : void 0;
}
return void 0;
});
const ariaHaspopup = computed(() => {
if (role && role.value !== "tooltip") {
return role.value;
}
return void 0;
});
const ariaExpanded = computed(() => {
return ariaHaspopup.value ? `${props.open}` : void 0;
});
let virtualTriggerAriaStopWatch = void 0;
const TRIGGER_ELE_EVENTS = [
"onMouseenter",
"onMouseleave",
"onClick",
"onKeydown",
"onFocus",
"onBlur",
"onContextmenu"
];
onMounted(() => {
watch(() => props.virtualRef, (virtualEl) => {
if (virtualEl) {
triggerRef.value = unrefElement(virtualEl);
}
}, {
immediate: true
});
watch(triggerRef, (el, prevEl) => {
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
virtualTriggerAriaStopWatch = void 0;
if (isElement(el)) {
TRIGGER_ELE_EVENTS.forEach((eventName) => {
var _a3;
const handler = props[eventName];
if (handler) {
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
(_a3 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a3.call(prevEl, eventName.slice(2).toLowerCase(), handler);
}
});
if (isFocusable(el)) {
virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((key2, idx) => {
isNil(watches[idx]) ? el.removeAttribute(key2) : el.setAttribute(key2, watches[idx]);
});
}, { immediate: true });
}
}
if (isElement(prevEl) && isFocusable(prevEl)) {
[
"aria-controls",
"aria-describedby",
"aria-haspopup",
"aria-expanded"
].forEach((key2) => prevEl.removeAttribute(key2));
}
}, {
immediate: true
});
});
onBeforeUnmount(() => {
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
virtualTriggerAriaStopWatch = void 0;
if (triggerRef.value && isElement(triggerRef.value)) {
const el = triggerRef.value;
TRIGGER_ELE_EVENTS.forEach((eventName) => {
const handler = props[eventName];
if (handler) {
el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
}
});
triggerRef.value = void 0;
}
});
expose({
triggerRef
});
return (_ctx, _cache) => {
return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
"aria-controls": unref(ariaControls),
"aria-describedby": unref(ariaDescribedby),
"aria-expanded": unref(ariaExpanded),
"aria-haspopup": unref(ariaHaspopup)
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
};
}
});
var ElPopperTrigger = _export_sfc(_sfc_main$43, [["__file", "trigger.vue"]]);
var E = "top";
var R = "bottom";
var W = "right";
var P2 = "left";
var me = "auto";
var G = [E, R, W, P2];
var U = "start";
var J = "end";
var Xe = "clippingParents";
var je = "viewport";
var K = "popper";
var Ye = "reference";
var De = G.reduce(function(t, e) {
return t.concat([e + "-" + U, e + "-" + J]);
}, []);
var Ee = [].concat(G, [me]).reduce(function(t, e) {
return t.concat([e, e + "-" + U, e + "-" + J]);
}, []);
var Ge = "beforeRead";
var Je = "read";
var Ke = "afterRead";
var Qe = "beforeMain";
var Ze = "main";
var et = "afterMain";
var tt = "beforeWrite";
var nt = "write";
var rt = "afterWrite";
var ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
function C(t) {
return t ? (t.nodeName || "").toLowerCase() : null;
}
function H(t) {
if (t == null) return window;
if (t.toString() !== "[object Window]") {
var e = t.ownerDocument;
return e && e.defaultView || window;
}
return t;
}
function Q(t) {
var e = H(t).Element;
return t instanceof e || t instanceof Element;
}
function B(t) {
var e = H(t).HTMLElement;
return t instanceof e || t instanceof HTMLElement;
}
function Pe(t) {
if (typeof ShadowRoot == "undefined") return false;
var e = H(t).ShadowRoot;
return t instanceof e || t instanceof ShadowRoot;
}
function Mt(t) {
var e = t.state;
Object.keys(e.elements).forEach(function(n) {
var r = e.styles[n] || {}, o = e.attributes[n] || {}, i = e.elements[n];
!B(i) || !C(i) || (Object.assign(i.style, r), Object.keys(o).forEach(function(a) {
var s = o[a];
s === false ? i.removeAttribute(a) : i.setAttribute(a, s === true ? "" : s);
}));
});
}
function Rt(t) {
var e = t.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
Object.keys(e.elements).forEach(function(r) {
var o = e.elements[r], i = e.attributes[r] || {}, a = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : n[r]), s = a.reduce(function(f, c) {
return f[c] = "", f;
}, {});
!B(o) || !C(o) || (Object.assign(o.style, s), Object.keys(i).forEach(function(f) {
o.removeAttribute(f);
}));
});
};
}
var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
function q(t) {
return t.split("-")[0];
}
var X = Math.max;
var ve = Math.min;
var Z2 = Math.round;
function ee(t, e) {
e === void 0 && (e = false);
var n = t.getBoundingClientRect(), r = 1, o = 1;
if (B(t) && e) {
var i = t.offsetHeight, a = t.offsetWidth;
a > 0 && (r = Z2(n.width) / a || 1), i > 0 && (o = Z2(n.height) / i || 1);
}
return { width: n.width / r, height: n.height / o, top: n.top / o, right: n.right / r, bottom: n.bottom / o, left: n.left / r, x: n.left / r, y: n.top / o };
}
function ke(t) {
var e = ee(t), n = t.offsetWidth, r = t.offsetHeight;
return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r) <= 1 && (r = e.height), { x: t.offsetLeft, y: t.offsetTop, width: n, height: r };
}
function it(t, e) {
var n = e.getRootNode && e.getRootNode();
if (t.contains(e)) return true;
if (n && Pe(n)) {
var r = e;
do {
if (r && t.isSameNode(r)) return true;
r = r.parentNode || r.host;
} while (r);
}
return false;
}
function N(t) {
return H(t).getComputedStyle(t);
}
function Wt(t) {
return ["table", "td", "th"].indexOf(C(t)) >= 0;
}
function I(t) {
return ((Q(t) ? t.ownerDocument : t.document) || window.document).documentElement;
}
function ge(t) {
return C(t) === "html" ? t : t.assignedSlot || t.parentNode || (Pe(t) ? t.host : null) || I(t);
}
function at(t) {
return !B(t) || N(t).position === "fixed" ? null : t.offsetParent;
}
function Bt(t) {
var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
if (n && B(t)) {
var r = N(t);
if (r.position === "fixed") return null;
}
var o = ge(t);
for (Pe(o) && (o = o.host); B(o) && ["html", "body"].indexOf(C(o)) < 0; ) {
var i = N(o);
if (i.transform !== "none" || i.perspective !== "none" || i.contain === "paint" || ["transform", "perspective"].indexOf(i.willChange) !== -1 || e && i.willChange === "filter" || e && i.filter && i.filter !== "none") return o;
o = o.parentNode;
}
return null;
}
function se(t) {
for (var e = H(t), n = at(t); n && Wt(n) && N(n).position === "static"; ) n = at(n);
return n && (C(n) === "html" || C(n) === "body" && N(n).position === "static") ? e : n || Bt(t) || e;
}
function Le(t) {
return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
}
function fe(t, e, n) {
return X(t, ve(e, n));
}
function St(t, e, n) {
var r = fe(t, e, n);
return r > n ? n : r;
}
function st() {
return { top: 0, right: 0, bottom: 0, left: 0 };
}
function ft(t) {
return Object.assign({}, st(), t);
}
function ct(t, e) {
return e.reduce(function(n, r) {
return n[r] = t, n;
}, {});
}
var Tt = function(t, e) {
return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, ft(typeof t != "number" ? t : ct(t, G));
};
function Ht(t) {
var e, n = t.state, r = t.name, o = t.options, i = n.elements.arrow, a = n.modifiersData.popperOffsets, s = q(n.placement), f = Le(s), c = [P2, W].indexOf(s) >= 0, u = c ? "height" : "width";
if (!(!i || !a)) {
var m = Tt(o.padding, n), v = ke(i), l = f === "y" ? E : P2, h2 = f === "y" ? R : W, p2 = n.rects.reference[u] + n.rects.reference[f] - a[f] - n.rects.popper[u], g = a[f] - n.rects.reference[f], x = se(i), y = x ? f === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, $ = p2 / 2 - g / 2, d = m[l], b = y - v[u] - m[h2], w = y / 2 - v[u] / 2 + $, O = fe(d, w, b), j = f;
n.modifiersData[r] = (e = {}, e[j] = O, e.centerOffset = O - w, e);
}
}
function Ct(t) {
var e = t.state, n = t.options, r = n.element, o = r === void 0 ? "[data-popper-arrow]" : r;
o != null && (typeof o == "string" && (o = e.elements.popper.querySelector(o), !o) || !it(e.elements.popper, o) || (e.elements.arrow = o));
}
var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function te(t) {
return t.split("-")[1];
}
var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function Vt(t) {
var e = t.x, n = t.y, r = window, o = r.devicePixelRatio || 1;
return { x: Z2(e * o) / o || 0, y: Z2(n * o) / o || 0 };
}
function ut(t) {
var e, n = t.popper, r = t.popperRect, o = t.placement, i = t.variation, a = t.offsets, s = t.position, f = t.gpuAcceleration, c = t.adaptive, u = t.roundOffsets, m = t.isFixed, v = a.x, l = v === void 0 ? 0 : v, h2 = a.y, p2 = h2 === void 0 ? 0 : h2, g = typeof u == "function" ? u({ x: l, y: p2 }) : { x: l, y: p2 };
l = g.x, p2 = g.y;
var x = a.hasOwnProperty("x"), y = a.hasOwnProperty("y"), $ = P2, d = E, b = window;
if (c) {
var w = se(n), O = "clientHeight", j = "clientWidth";
if (w === H(n) && (w = I(n), N(w).position !== "static" && s === "absolute" && (O = "scrollHeight", j = "scrollWidth")), w = w, o === E || (o === P2 || o === W) && i === J) {
d = R;
var A = m && w === b && b.visualViewport ? b.visualViewport.height : w[O];
p2 -= A - r.height, p2 *= f ? 1 : -1;
}
if (o === P2 || (o === E || o === R) && i === J) {
$ = W;
var k = m && w === b && b.visualViewport ? b.visualViewport.width : w[j];
l -= k - r.width, l *= f ? 1 : -1;
}
}
var D = Object.assign({ position: s }, c && qt), S = u === true ? Vt({ x: l, y: p2 }) : { x: l, y: p2 };
if (l = S.x, p2 = S.y, f) {
var L;
return Object.assign({}, D, (L = {}, L[d] = y ? "0" : "", L[$] = x ? "0" : "", L.transform = (b.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p2 + "px)" : "translate3d(" + l + "px, " + p2 + "px, 0)", L));
}
return Object.assign({}, D, (e = {}, e[d] = y ? p2 + "px" : "", e[$] = x ? l + "px" : "", e.transform = "", e));
}
function Nt(t) {
var e = t.state, n = t.options, r = n.gpuAcceleration, o = r === void 0 ? true : r, i = n.adaptive, a = i === void 0 ? true : i, s = n.roundOffsets, f = s === void 0 ? true : s, c = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o, isFixed: e.options.strategy === "fixed" };
e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a, roundOffsets: f })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} };
var ye = { passive: true };
function It(t) {
var e = t.state, n = t.instance, r = t.options, o = r.scroll, i = o === void 0 ? true : o, a = r.resize, s = a === void 0 ? true : a, f = H(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
return i && c.forEach(function(u) {
u.addEventListener("scroll", n.update, ye);
}), s && f.addEventListener("resize", n.update, ye), function() {
i && c.forEach(function(u) {
u.removeEventListener("scroll", n.update, ye);
}), s && f.removeEventListener("resize", n.update, ye);
};
}
var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
}, effect: It, data: {} };
var _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
function be(t) {
return t.replace(/left|right|bottom|top/g, function(e) {
return _t[e];
});
}
var zt = { start: "end", end: "start" };
function lt(t) {
return t.replace(/start|end/g, function(e) {
return zt[e];
});
}
function We(t) {
var e = H(t), n = e.pageXOffset, r = e.pageYOffset;
return { scrollLeft: n, scrollTop: r };
}
function Be(t) {
return ee(I(t)).left + We(t).scrollLeft;
}
function Ft(t) {
var e = H(t), n = I(t), r = e.visualViewport, o = n.clientWidth, i = n.clientHeight, a = 0, s = 0;
return r && (o = r.width, i = r.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a = r.offsetLeft, s = r.offsetTop)), { width: o, height: i, x: a + Be(t), y: s };
}
function Ut(t) {
var e, n = I(t), r = We(t), o = (e = t.ownerDocument) == null ? void 0 : e.body, i = X(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), a = X(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r.scrollLeft + Be(t), f = -r.scrollTop;
return N(o || n).direction === "rtl" && (s += X(n.clientWidth, o ? o.clientWidth : 0) - i), { width: i, height: a, x: s, y: f };
}
function Se(t) {
var e = N(t), n = e.overflow, r = e.overflowX, o = e.overflowY;
return /auto|scroll|overlay|hidden/.test(n + o + r);
}
function dt(t) {
return ["html", "body", "#document"].indexOf(C(t)) >= 0 ? t.ownerDocument.body : B(t) && Se(t) ? t : dt(ge(t));
}
function ce(t, e) {
var n;
e === void 0 && (e = []);
var r = dt(t), o = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = H(r), a = o ? [i].concat(i.visualViewport || [], Se(r) ? r : []) : r, s = e.concat(a);
return o ? s : s.concat(ce(ge(a)));
}
function Te(t) {
return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height });
}
function Xt(t) {
var e = ee(t);
return e.top = e.top + t.clientTop, e.left = e.left + t.clientLeft, e.bottom = e.top + t.clientHeight, e.right = e.left + t.clientWidth, e.width = t.clientWidth, e.height = t.clientHeight, e.x = e.left, e.y = e.top, e;
}
function ht(t, e) {
return e === je ? Te(Ft(t)) : Q(e) ? Xt(e) : Te(Ut(I(t)));
}
function Yt(t) {
var e = ce(ge(t)), n = ["absolute", "fixed"].indexOf(N(t).position) >= 0, r = n && B(t) ? se(t) : t;
return Q(r) ? e.filter(function(o) {
return Q(o) && it(o, r) && C(o) !== "body";
}) : [];
}
function Gt(t, e, n) {
var r = e === "clippingParents" ? Yt(t) : [].concat(e), o = [].concat(r, [n]), i = o[0], a = o.reduce(function(s, f) {
var c = ht(t, f);
return s.top = X(c.top, s.top), s.right = ve(c.right, s.right), s.bottom = ve(c.bottom, s.bottom), s.left = X(c.left, s.left), s;
}, ht(t, i));
return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
}
function mt(t) {
var e = t.reference, n = t.element, r = t.placement, o = r ? q(r) : null, i = r ? te(r) : null, a = e.x + e.width / 2 - n.width / 2, s = e.y + e.height / 2 - n.height / 2, f;
switch (o) {
case E:
f = { x: a, y: e.y - n.height };
break;
case R:
f = { x: a, y: e.y + e.height };
break;
case W:
f = { x: e.x + e.width, y: s };
break;
case P2:
f = { x: e.x - n.width, y: s };
break;
default:
f = { x: e.x, y: e.y };
}
var c = o ? Le(o) : null;
if (c != null) {
var u = c === "y" ? "height" : "width";
switch (i) {
case U:
f[c] = f[c] - (e[u] / 2 - n[u] / 2);
break;
case J:
f[c] = f[c] + (e[u] / 2 - n[u] / 2);
break;
}
}
return f;
}
function ne(t, e) {
e === void 0 && (e = {});
var n = e, r = n.placement, o = r === void 0 ? t.placement : r, i = n.boundary, a = i === void 0 ? Xe : i, s = n.rootBoundary, f = s === void 0 ? je : s, c = n.elementContext, u = c === void 0 ? K : c, m = n.altBoundary, v = m === void 0 ? false : m, l = n.padding, h2 = l === void 0 ? 0 : l, p2 = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u === K ? Ye : K, x = t.rects.popper, y = t.elements[v ? g : u], $ = Gt(Q(y) ? y : y.contextElement || I(t.elements.popper), a, f), d = ee(t.elements.reference), b = mt({ reference: d, element: x, placement: o }), w = Te(Object.assign({}, x, b)), O = u === K ? w : d, j = { top: $.top - O.top + p2.top, bottom: O.bottom - $.bottom + p2.bottom, left: $.left - O.left + p2.left, right: O.right - $.right + p2.right }, A = t.modifiersData.offset;
if (u === K && A) {
var k = A[o];
Object.keys(j).forEach(function(D) {
var S = [W, R].indexOf(D) >= 0 ? 1 : -1, L = [E, R].indexOf(D) >= 0 ? "y" : "x";
j[D] += k[L] * S;
});
}
return j;
}
function Jt(t, e) {
e === void 0 && (e = {});
var n = e, r = n.placement, o = n.boundary, i = n.rootBoundary, a = n.padding, s = n.flipVariations, f = n.allowedAutoPlacements, c = f === void 0 ? Ee : f, u = te(r), m = u ? s ? De : De.filter(function(h2) {
return te(h2) === u;
}) : G, v = m.filter(function(h2) {
return c.indexOf(h2) >= 0;
});
v.length === 0 && (v = m);
var l = v.reduce(function(h2, p2) {
return h2[p2] = ne(t, { placement: p2, boundary: o, rootBoundary: i, padding: a })[q(p2)], h2;
}, {});
return Object.keys(l).sort(function(h2, p2) {
return l[h2] - l[p2];
});
}
function Kt(t) {
if (q(t) === me) return [];
var e = be(t);
return [lt(t), e, lt(e)];
}
function Qt(t) {
var e = t.state, n = t.options, r = t.name;
if (!e.modifiersData[r]._skip) {
for (var o = n.mainAxis, i = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? true : a, f = n.fallbackPlacements, c = n.padding, u = n.boundary, m = n.rootBoundary, v = n.altBoundary, l = n.flipVariations, h2 = l === void 0 ? true : l, p2 = n.allowedAutoPlacements, g = e.options.placement, x = q(g), y = x === g, $ = f || (y || !h2 ? [be(g)] : Kt(g)), d = [g].concat($).reduce(function(z, V) {
return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u, rootBoundary: m, padding: c, flipVariations: h2, allowedAutoPlacements: p2 }) : V);
}, []), b = e.rects.reference, w = e.rects.popper, O = /* @__PURE__ */ new Map(), j = true, A = d[0], k = 0; k < d.length; k++) {
var D = d[k], S = q(D), L = te(D) === U, re2 = [E, R].indexOf(S) >= 0, oe = re2 ? "width" : "height", M = ne(e, { placement: D, boundary: u, rootBoundary: m, altBoundary: v, padding: c }), T = re2 ? L ? W : P2 : L ? R : E;
b[oe] > w[oe] && (T = be(T));
var pe = be(T), _ = [];
if (i && _.push(M[S] <= 0), s && _.push(M[T] <= 0, M[pe] <= 0), _.every(function(z) {
return z;
})) {
A = D, j = false;
break;
}
O.set(D, _);
}
if (j) for (var ue = h2 ? 3 : 1, xe = function(z) {
var V = d.find(function(de) {
var ae = O.get(de);
if (ae) return ae.slice(0, z).every(function(Y) {
return Y;
});
});
if (V) return A = V, "break";
}, ie = ue; ie > 0; ie--) {
var le = xe(ie);
if (le === "break") break;
}
e.placement !== A && (e.modifiersData[r]._skip = true, e.placement = A, e.reset = true);
}
}
var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
function gt(t, e, n) {
return n === void 0 && (n = { x: 0, y: 0 }), { top: t.top - e.height - n.y, right: t.right - e.width + n.x, bottom: t.bottom - e.height + n.y, left: t.left - e.width - n.x };
}
function yt(t) {
return [E, W, R, P2].some(function(e) {
return t[e] >= 0;
});
}
function Zt(t) {
var e = t.state, n = t.name, r = e.rects.reference, o = e.rects.popper, i = e.modifiersData.preventOverflow, a = ne(e, { elementContext: "reference" }), s = ne(e, { altBoundary: true }), f = gt(a, r), c = gt(s, o, i), u = yt(f), m = yt(c);
e.modifiersData[n] = { referenceClippingOffsets: f, popperEscapeOffsets: c, isReferenceHidden: u, hasPopperEscaped: m }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u, "data-popper-escaped": m });
}
var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
function en(t, e, n) {
var r = q(t), o = [P2, E].indexOf(r) >= 0 ? -1 : 1, i = typeof n == "function" ? n(Object.assign({}, e, { placement: t })) : n, a = i[0], s = i[1];
return a = a || 0, s = (s || 0) * o, [P2, W].indexOf(r) >= 0 ? { x: s, y: a } : { x: a, y: s };
}
function tn(t) {
var e = t.state, n = t.options, r = t.name, o = n.offset, i = o === void 0 ? [0, 0] : o, a = Ee.reduce(function(u, m) {
return u[m] = en(m, e.rects, i), u;
}, {}), s = a[e.placement], f = s.x, c = s.y;
e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f, e.modifiersData.popperOffsets.y += c), e.modifiersData[r] = a;
}
var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
function nn(t) {
var e = t.state, n = t.name;
e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, placement: e.placement });
}
var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
function rn(t) {
return t === "x" ? "y" : "x";
}
function on(t) {
var e = t.state, n = t.options, r = t.name, o = n.mainAxis, i = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? false : a, f = n.boundary, c = n.rootBoundary, u = n.altBoundary, m = n.padding, v = n.tether, l = v === void 0 ? true : v, h2 = n.tetherOffset, p2 = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f, rootBoundary: c, padding: m, altBoundary: u }), x = q(e.placement), y = te(e.placement), $ = !y, d = Le(x), b = rn(d), w = e.modifiersData.popperOffsets, O = e.rects.reference, j = e.rects.popper, A = typeof p2 == "function" ? p2(Object.assign({}, e.rects, { placement: e.placement })) : p2, k = typeof A == "number" ? { mainAxis: A, altAxis: A } : Object.assign({ mainAxis: 0, altAxis: 0 }, A), D = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S = { x: 0, y: 0 };
if (w) {
if (i) {
var L, re2 = d === "y" ? E : P2, oe = d === "y" ? R : W, M = d === "y" ? "height" : "width", T = w[d], pe = T + g[re2], _ = T - g[oe], ue = l ? -j[M] / 2 : 0, xe = y === U ? O[M] : j[M], ie = y === U ? -j[M] : -O[M], le = e.elements.arrow, z = l && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re2], ae = V[oe], Y = fe(0, O[M], z[M]), jt = $ ? O[M] / 2 - ue - Y - de - k.mainAxis : xe - Y - de - k.mainAxis, Dt = $ ? -O[M] / 2 + ue + Y + ae + k.mainAxis : ie + Y + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D == null ? void 0 : D[d]) != null ? L : 0, Pt = T + jt - Ce - Et, At = T + Dt - Ce, qe = fe(l ? ve(pe, Pt) : pe, T, l ? X(_, At) : _);
w[d] = qe, S[d] = qe - T;
}
if (s) {
var Ve, kt = d === "x" ? E : P2, Lt = d === "x" ? R : W, F = w[b], he = b === "y" ? "height" : "width", Ne = F + g[kt], Ie = F - g[Lt], $e = [E, P2].indexOf(x) !== -1, _e = (Ve = D == null ? void 0 : D[b]) != null ? Ve : 0, ze = $e ? Ne : F - O[he] - j[he] - _e + k.altAxis, Fe = $e ? F + O[he] + j[he] - _e - k.altAxis : Ie, Ue = l && $e ? St(ze, F, Fe) : fe(l ? ze : Ne, F, l ? Fe : Ie);
w[b] = Ue, S[b] = Ue - F;
}
e.modifiersData[r] = S;
}
}
var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on, requiresIfExists: ["offset"] };
function an(t) {
return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
}
function sn(t) {
return t === H(t) || !B(t) ? We(t) : an(t);
}
function fn(t) {
var e = t.getBoundingClientRect(), n = Z2(e.width) / t.offsetWidth || 1, r = Z2(e.height) / t.offsetHeight || 1;
return n !== 1 || r !== 1;
}
function cn(t, e, n) {
n === void 0 && (n = false);
var r = B(e), o = B(e) && fn(e), i = I(e), a = ee(t, o), s = { scrollLeft: 0, scrollTop: 0 }, f = { x: 0, y: 0 };
return (r || !r && !n) && ((C(e) !== "body" || Se(i)) && (s = sn(e)), B(e) ? (f = ee(e, true), f.x += e.clientLeft, f.y += e.clientTop) : i && (f.x = Be(i))), { x: a.left + s.scrollLeft - f.x, y: a.top + s.scrollTop - f.y, width: a.width, height: a.height };
}
function pn(t) {
var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
t.forEach(function(i) {
e.set(i.name, i);
});
function o(i) {
n.add(i.name);
var a = [].concat(i.requires || [], i.requiresIfExists || []);
a.forEach(function(s) {
if (!n.has(s)) {
var f = e.get(s);
f && o(f);
}
}), r.push(i);
}
return t.forEach(function(i) {
n.has(i.name) || o(i);
}), r;
}
function un(t) {
var e = pn(t);
return ot.reduce(function(n, r) {
return n.concat(e.filter(function(o) {
return o.phase === r;
}));
}, []);
}
function ln(t) {
var e;
return function() {
return e || (e = new Promise(function(n) {
Promise.resolve().then(function() {
e = void 0, n(t());
});
})), e;
};
}
function dn(t) {
var e = t.reduce(function(n, r) {
var o = n[r.name];
return n[r.name] = o ? Object.assign({}, o, r, { options: Object.assign({}, o.options, r.options), data: Object.assign({}, o.data, r.data) }) : r, n;
}, {});
return Object.keys(e).map(function(n) {
return e[n];
});
}
var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
function $t() {
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++) e[n] = arguments[n];
return !e.some(function(r) {
return !(r && typeof r.getBoundingClientRect == "function");
});
}
function we(t) {
t === void 0 && (t = {});
var e = t, n = e.defaultModifiers, r = n === void 0 ? [] : n, o = e.defaultOptions, i = o === void 0 ? Ot : o;
return function(a, s, f) {
f === void 0 && (f = i);
var c = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i), modifiersData: {}, elements: { reference: a, popper: s }, attributes: {}, styles: {} }, u = [], m = false, v = { state: c, setOptions: function(p2) {
var g = typeof p2 == "function" ? p2(c.options) : p2;
h2(), c.options = Object.assign({}, i, c.options, g), c.scrollParents = { reference: Q(a) ? ce(a) : a.contextElement ? ce(a.contextElement) : [], popper: ce(s) };
var x = un(dn([].concat(r, c.options.modifiers)));
return c.orderedModifiers = x.filter(function(y) {
return y.enabled;
}), l(), v.update();
}, forceUpdate: function() {
if (!m) {
var p2 = c.elements, g = p2.reference, x = p2.popper;
if ($t(g, x)) {
c.rects = { reference: cn(g, se(x), c.options.strategy === "fixed"), popper: ke(x) }, c.reset = false, c.placement = c.options.placement, c.orderedModifiers.forEach(function(j) {
return c.modifiersData[j.name] = Object.assign({}, j.data);
});
for (var y = 0; y < c.orderedModifiers.length; y++) {
if (c.reset === true) {
c.reset = false, y = -1;
continue;
}
var $ = c.orderedModifiers[y], d = $.fn, b = $.options, w = b === void 0 ? {} : b, O = $.name;
typeof d == "function" && (c = d({ state: c, options: w, name: O, instance: v }) || c);
}
}
}
}, update: ln(function() {
return new Promise(function(p2) {
v.forceUpdate(), p2(c);
});
}), destroy: function() {
h2(), m = true;
} };
if (!$t(a, s)) return v;
v.setOptions(f).then(function(p2) {
!m && f.onFirstUpdate && f.onFirstUpdate(p2);
});
function l() {
c.orderedModifiers.forEach(function(p2) {
var g = p2.name, x = p2.options, y = x === void 0 ? {} : x, $ = p2.effect;
if (typeof $ == "function") {
var d = $({ state: c, name: g, instance: v, options: y }), b = function() {
};
u.push(d || b);
}
});
}
function h2() {
u.forEach(function(p2) {
return p2();
}), u = [];
}
return v;
};
}
we();
var mn = [Re, He, Me, Ae];
we({ defaultModifiers: mn });
var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt];
var yn = we({ defaultModifiers: gn });
var popperArrowProps = buildProps({
arrowOffset: {
type: Number,
default: 5
}
});
var POSITIONING_STRATEGIES = ["fixed", "absolute"];
var popperCoreConfigProps = buildProps({
boundariesPadding: {
type: Number,
default: 0
},
fallbackPlacements: {
type: definePropType(Array),
default: void 0
},
gpuAcceleration: {
type: Boolean,
default: true
},
offset: {
type: Number,
default: 12
},
placement: {
type: String,
values: Ee,
default: "bottom"
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
strategy: {
type: String,
values: POSITIONING_STRATEGIES,
default: "absolute"
}
});
var popperContentProps = buildProps({
...popperCoreConfigProps,
...popperArrowProps,
id: String,
style: {
type: definePropType([String, Array, Object])
},
className: {
type: definePropType([String, Array, Object])
},
effect: {
type: definePropType(String),
default: "dark"
},
visible: Boolean,
enterable: {
type: Boolean,
default: true
},
pure: Boolean,
focusOnShow: Boolean,
trapping: Boolean,
popperClass: {
type: definePropType([String, Array, Object])
},
popperStyle: {
type: definePropType([String, Array, Object])
},
referenceEl: {
type: definePropType(Object)
},
triggerTargetEl: {
type: definePropType(Object)
},
stopPopperMouseEvent: {
type: Boolean,
default: true
},
virtualTriggering: Boolean,
zIndex: Number,
...useAriaProps(["ariaLabel"])
});
var popperContentEmits = {
mouseenter: (evt) => evt instanceof MouseEvent,
mouseleave: (evt) => evt instanceof MouseEvent,
focus: () => true,
blur: () => true,
close: () => true
};
var usePopperContentFocusTrap = (props, emit) => {
const trapped = ref(false);
const focusStartRef = ref();
const onFocusAfterTrapped = () => {
emit("focus");
};
const onFocusAfterReleased = (event) => {
var _a3;
if (((_a3 = event.detail) == null ? void 0 : _a3.focusReason) !== "pointer") {
focusStartRef.value = "first";
emit("blur");
}
};
const onFocusInTrap = (event) => {
if (props.visible && !trapped.value) {
if (event.target) {
focusStartRef.value = event.target;
}
trapped.value = true;
}
};
const onFocusoutPrevented = (event) => {
if (!props.trapping) {
if (event.detail.focusReason === "pointer") {
event.preventDefault();
}
trapped.value = false;
}
};
const onReleaseRequested = () => {
trapped.value = false;
emit("close");
};
return {
focusStartRef,
trapped,
onFocusAfterReleased,
onFocusAfterTrapped,
onFocusInTrap,
onFocusoutPrevented,
onReleaseRequested
};
};
var buildPopperOptions = (props, modifiers = []) => {
const { placement, strategy, popperOptions } = props;
const options = {
placement,
strategy,
...popperOptions,
modifiers: [...genModifiers(props), ...modifiers]
};
deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
return options;
};
var unwrapMeasurableEl = ($el) => {
if (!isClient)
return;
return unrefElement($el);
};
function genModifiers(options) {
const { offset, gpuAcceleration, fallbackPlacements } = options;
return [
{
name: "offset",
options: {
offset: [0, offset != null ? offset : 12]
}
},
{
name: "preventOverflow",
options: {
padding: {
top: 2,
bottom: 2,
left: 5,
right: 5
}
}
},
{
name: "flip",
options: {
padding: 5,
fallbackPlacements
}
},
{
name: "computeStyles",
options: {
gpuAcceleration
}
}
];
}
function deriveExtraModifiers(options, modifiers) {
if (modifiers) {
options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
}
}
var usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
const stateUpdater = {
name: "updateState",
enabled: true,
phase: "write",
fn: ({ state }) => {
const derivedState = deriveState(state);
Object.assign(states.value, derivedState);
},
requires: ["computeStyles"]
};
const options = computed(() => {
const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
return {
onFirstUpdate,
placement: placement || "bottom",
strategy: strategy || "absolute",
modifiers: [
...modifiers || [],
stateUpdater,
{ name: "applyStyles", enabled: false }
]
};
});
const instanceRef = shallowRef();
const states = ref({
styles: {
popper: {
position: unref(options).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
});
const destroy = () => {
if (!instanceRef.value)
return;
instanceRef.value.destroy();
instanceRef.value = void 0;
};
watch(options, (newOptions) => {
const instance = unref(instanceRef);
if (instance) {
instance.setOptions(newOptions);
}
}, {
deep: true
});
watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
destroy();
if (!referenceElement || !popperElement)
return;
instanceRef.value = yn(referenceElement, popperElement, unref(options));
});
onBeforeUnmount(() => {
destroy();
});
return {
state: computed(() => {
var _a3;
return { ...((_a3 = unref(instanceRef)) == null ? void 0 : _a3.state) || {} };
}),
styles: computed(() => unref(states).styles),
attributes: computed(() => unref(states).attributes),
update: () => {
var _a3;
return (_a3 = unref(instanceRef)) == null ? void 0 : _a3.update();
},
forceUpdate: () => {
var _a3;
return (_a3 = unref(instanceRef)) == null ? void 0 : _a3.forceUpdate();
},
instanceRef: computed(() => unref(instanceRef))
};
};
function deriveState(state) {
const elements = Object.keys(state.elements);
const styles = fromPairs(elements.map((element2) => [element2, state.styles[element2] || {}]));
const attributes = fromPairs(elements.map((element2) => [element2, state.attributes[element2]]));
return {
styles,
attributes
};
}
var DEFAULT_ARROW_OFFSET = 0;
var usePopperContent = (props) => {
const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
const arrowRef = ref();
const arrowOffset = computed(() => props.arrowOffset);
const eventListenerModifier = computed(() => {
return {
name: "eventListeners",
enabled: !!props.visible
};
});
const arrowModifier = computed(() => {
var _a3;
const arrowEl = unref(arrowRef);
const offset = (_a3 = unref(arrowOffset)) != null ? _a3 : DEFAULT_ARROW_OFFSET;
return {
name: "arrow",
enabled: !isUndefined(arrowEl),
options: {
element: arrowEl,
padding: offset
}
};
});
const options = computed(() => {
return {
onFirstUpdate: () => {
update();
},
...buildPopperOptions(props, [
unref(arrowModifier),
unref(eventListenerModifier)
])
};
});
const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
watch(instanceRef, (instance) => popperInstanceRef.value = instance, {
flush: "sync"
});
onMounted(() => {
watch(() => {
var _a3;
return (_a3 = unref(computedReference)) == null ? void 0 : _a3.getBoundingClientRect();
}, () => {
update();
});
});
return {
attributes,
arrowRef,
contentRef,
instanceRef,
state,
styles,
role,
forceUpdate,
update
};
};
var usePopperContentDOM = (props, {
attributes,
styles,
role
}) => {
const { nextZIndex } = useZIndex();
const ns = useNamespace("popper");
const contentAttrs = computed(() => unref(attributes).popper);
const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
const contentClass = computed(() => [
ns.b(),
ns.is("pure", props.pure),
ns.is(props.effect),
props.popperClass
]);
const contentStyle = computed(() => {
return [
{ zIndex: unref(contentZIndex) },
unref(styles).popper,
props.popperStyle || {}
];
});
const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
const arrowStyle = computed(() => unref(styles).arrow || {});
const updateZIndex = () => {
contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
};
return {
ariaModal,
arrowStyle,
contentAttrs,
contentClass,
contentStyle,
contentZIndex,
updateZIndex
};
};
var __default__$32 = defineComponent({
name: "ElPopperContent"
});
var _sfc_main$33 = defineComponent({
...__default__$32,
props: popperContentProps,
emits: popperContentEmits,
setup(__props, { expose, emit }) {
const props = __props;
const {
focusStartRef,
trapped,
onFocusAfterReleased,
onFocusAfterTrapped,
onFocusInTrap,
onFocusoutPrevented,
onReleaseRequested
} = usePopperContentFocusTrap(props, emit);
const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
const {
ariaModal,
arrowStyle,
contentAttrs,
contentClass,
contentStyle,
updateZIndex
} = usePopperContentDOM(props, {
styles,
attributes,
role
});
const formItemContext = inject(formItemContextKey, void 0);
provide(POPPER_CONTENT_INJECTION_KEY, {
arrowStyle,
arrowRef
});
if (formItemContext) {
provide(formItemContextKey, {
...formItemContext,
addInputId: NOOP,
removeInputId: NOOP
});
}
let triggerTargetAriaStopWatch = void 0;
const updatePopper = (shouldUpdateZIndex = true) => {
update();
shouldUpdateZIndex && updateZIndex();
};
const togglePopperAlive = () => {
updatePopper(false);
if (props.visible && props.focusOnShow) {
trapped.value = true;
} else if (props.visible === false) {
trapped.value = false;
}
};
onMounted(() => {
watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
triggerTargetAriaStopWatch = void 0;
const el = unref(triggerTargetEl || contentRef.value);
const prevEl = unref(prevTriggerTargetEl || contentRef.value);
if (isElement(el)) {
triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
["role", "aria-label", "aria-modal", "id"].forEach((key2, idx) => {
isNil(watches[idx]) ? el.removeAttribute(key2) : el.setAttribute(key2, watches[idx]);
});
}, { immediate: true });
}
if (prevEl !== el && isElement(prevEl)) {
["role", "aria-label", "aria-modal", "id"].forEach((key2) => {
prevEl.removeAttribute(key2);
});
}
}, { immediate: true });
watch(() => props.visible, togglePopperAlive, { immediate: true });
});
onBeforeUnmount(() => {
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
triggerTargetAriaStopWatch = void 0;
});
expose({
popperContentRef: contentRef,
popperInstanceRef: instanceRef,
updatePopper,
contentStyle
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", mergeProps({
ref_key: "contentRef",
ref: contentRef
}, unref(contentAttrs), {
style: unref(contentStyle),
class: unref(contentClass),
tabindex: "-1",
onMouseenter: (e) => _ctx.$emit("mouseenter", e),
onMouseleave: (e) => _ctx.$emit("mouseleave", e)
}), [
createVNode(unref(ElFocusTrap), {
trapped: unref(trapped),
"trap-on-focus-in": true,
"focus-trap-el": unref(contentRef),
"focus-start-el": unref(focusStartRef),
onFocusAfterTrapped: unref(onFocusAfterTrapped),
onFocusAfterReleased: unref(onFocusAfterReleased),
onFocusin: unref(onFocusInTrap),
onFocusoutPrevented: unref(onFocusoutPrevented),
onReleaseRequested: unref(onReleaseRequested)
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
], 16, ["onMouseenter", "onMouseleave"]);
};
}
});
var ElPopperContent = _export_sfc(_sfc_main$33, [["__file", "content.vue"]]);
var ElPopper = withInstall(Popper);
var TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
var useTooltipContentProps = buildProps({
...useDelayedToggleProps,
...popperContentProps,
appendTo: {
type: teleportProps.to.type
},
content: {
type: String,
default: ""
},
rawContent: Boolean,
persistent: Boolean,
visible: {
type: definePropType(Boolean),
default: null
},
transition: String,
teleported: {
type: Boolean,
default: true
},
disabled: Boolean,
...useAriaProps(["ariaLabel"])
});
var useTooltipTriggerProps = buildProps({
...popperTriggerProps,
disabled: Boolean,
trigger: {
type: definePropType([String, Array]),
default: "hover"
},
triggerKeys: {
type: definePropType(Array),
default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
}
});
var _prop = buildProp({
type: definePropType(Boolean),
default: null
});
var _event = buildProp({
type: definePropType(Function)
});
var createModelToggleComposable = (name) => {
const updateEventKey = `update:${name}`;
const updateEventKeyRaw2 = `onUpdate:${name}`;
const useModelToggleEmits2 = [updateEventKey];
const useModelToggleProps2 = {
[name]: _prop,
[updateEventKeyRaw2]: _event
};
const useModelToggle2 = ({
indicator,
toggleReason,
shouldHideWhenRouteChanges,
shouldProceed,
onShow,
onHide
}) => {
const instance = getCurrentInstance();
const { emit } = instance;
const props = instance.props;
const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw2]));
const isModelBindingAbsent = computed(() => props[name] === null);
const doShow = (event) => {
if (indicator.value === true) {
return;
}
indicator.value = true;
if (toggleReason) {
toggleReason.value = event;
}
if (isFunction$1(onShow)) {
onShow(event);
}
};
const doHide = (event) => {
if (indicator.value === false) {
return;
}
indicator.value = false;
if (toggleReason) {
toggleReason.value = event;
}
if (isFunction$1(onHide)) {
onHide(event);
}
};
const show = (event) => {
if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
return;
const shouldEmit = hasUpdateHandler.value && isClient;
if (shouldEmit) {
emit(updateEventKey, true);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doShow(event);
}
};
const hide = (event) => {
if (props.disabled === true || !isClient)
return;
const shouldEmit = hasUpdateHandler.value && isClient;
if (shouldEmit) {
emit(updateEventKey, false);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doHide(event);
}
};
const onChange = (val) => {
if (!isBoolean(val))
return;
if (props.disabled && val) {
if (hasUpdateHandler.value) {
emit(updateEventKey, false);
}
} else if (indicator.value !== val) {
if (val) {
doShow();
} else {
doHide();
}
}
};
const toggle = () => {
if (indicator.value) {
hide();
} else {
show();
}
};
watch(() => props[name], onChange);
if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
watch(() => ({
...instance.proxy.$route
}), () => {
if (shouldHideWhenRouteChanges.value && indicator.value) {
hide();
}
});
}
onMounted(() => {
onChange(props[name]);
});
return {
hide,
show,
toggle,
hasUpdateHandler
};
};
return {
useModelToggle: useModelToggle2,
useModelToggleProps: useModelToggleProps2,
useModelToggleEmits: useModelToggleEmits2
};
};
var {
useModelToggleProps: useTooltipModelToggleProps,
useModelToggleEmits: useTooltipModelToggleEmits,
useModelToggle: useTooltipModelToggle
} = createModelToggleComposable("visible");
var useTooltipProps = buildProps({
...popperProps,
...useTooltipModelToggleProps,
...useTooltipContentProps,
...useTooltipTriggerProps,
...popperArrowProps,
showArrow: {
type: Boolean,
default: true
}
});
var tooltipEmits = [
...useTooltipModelToggleEmits,
"before-show",
"before-hide",
"show",
"hide",
"open",
"close"
];
var isTriggerType = (trigger, type) => {
if (isArray(trigger)) {
return trigger.includes(type);
}
return trigger === type;
};
var whenTrigger = (trigger, type, handler) => {
return (e) => {
isTriggerType(unref(trigger), type) && handler(e);
};
};
var composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
const handleEvent = (event) => {
const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
if (checkForDefaultPrevented === false || !shouldPrevent) {
return oursHandler == null ? void 0 : oursHandler(event);
}
};
return handleEvent;
};
var whenMouse = (handler) => {
return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
};
var __default__$22 = defineComponent({
name: "ElTooltipTrigger"
});
var _sfc_main$23 = defineComponent({
...__default__$22,
props: useTooltipTriggerProps,
setup(__props, { expose }) {
const props = __props;
const ns = useNamespace("tooltip");
const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
const triggerRef = ref(null);
const stopWhenControlledOrDisabled = () => {
if (unref(controlled) || props.disabled) {
return true;
}
};
const trigger = toRef(props, "trigger");
const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
if (e.button === 0) {
onToggle(e);
}
}));
const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
e.preventDefault();
onToggle(e);
}));
const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
const { code: code3 } = e;
if (props.triggerKeys.includes(code3)) {
e.preventDefault();
onToggle(e);
}
});
expose({
triggerRef
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElPopperTrigger), {
id: unref(id),
"virtual-ref": _ctx.virtualRef,
open: unref(open),
"virtual-triggering": _ctx.virtualTriggering,
class: normalizeClass(unref(ns).e("trigger")),
onBlur: unref(onBlur),
onClick: unref(onClick),
onContextmenu: unref(onContextMenu),
onFocus: unref(onFocus),
onMouseenter: unref(onMouseenter),
onMouseleave: unref(onMouseleave),
onKeydown: unref(onKeydown)
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
};
}
});
var ElTooltipTrigger = _export_sfc(_sfc_main$23, [["__file", "trigger.vue"]]);
var usePopperContainerId = () => {
const namespace = useGetDerivedNamespace();
const idInjection = useIdInjection();
const id = computed(() => {
return `${namespace.value}-popper-container-${idInjection.prefix}`;
});
const selector = computed(() => `#${id.value}`);
return {
id,
selector
};
};
var createContainer = (id) => {
const container = document.createElement("div");
container.id = id;
document.body.appendChild(container);
return container;
};
var usePopperContainer = () => {
const { id, selector } = usePopperContainerId();
onBeforeMount(() => {
if (!isClient)
return;
if (!document.body.querySelector(selector.value)) {
createContainer(id.value);
}
});
return {
id,
selector
};
};
var __default__$13 = defineComponent({
name: "ElTooltipContent",
inheritAttrs: false
});
var _sfc_main$15 = defineComponent({
...__default__$13,
props: useTooltipContentProps,
setup(__props, { expose }) {
const props = __props;
const { selector } = usePopperContainerId();
const ns = useNamespace("tooltip");
const contentRef = ref();
const popperContentRef = computedEager(() => {
var _a3;
return (_a3 = contentRef.value) == null ? void 0 : _a3.popperContentRef;
});
let stopHandle;
const {
controlled,
id,
open,
trigger,
onClose,
onOpen,
onShow,
onHide,
onBeforeShow,
onBeforeHide
} = inject(TOOLTIP_INJECTION_KEY, void 0);
const transitionClass = computed(() => {
return props.transition || `${ns.namespace.value}-fade-in-linear`;
});
const persistentRef = computed(() => {
return props.persistent;
});
onBeforeUnmount(() => {
stopHandle == null ? void 0 : stopHandle();
});
const shouldRender = computed(() => {
return unref(persistentRef) ? true : unref(open);
});
const shouldShow = computed(() => {
return props.disabled ? false : unref(open);
});
const appendTo = computed(() => {
return props.appendTo || selector.value;
});
const contentStyle = computed(() => {
var _a3;
return (_a3 = props.style) != null ? _a3 : {};
});
const ariaHidden = ref(true);
const onTransitionLeave = () => {
onHide();
isFocusInsideContent() && tryFocus(document.body);
ariaHidden.value = true;
};
const stopWhenControlled = () => {
if (unref(controlled))
return true;
};
const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
if (props.enterable && unref(trigger) === "hover") {
onOpen();
}
});
const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
if (unref(trigger) === "hover") {
onClose();
}
});
const onBeforeEnter = () => {
var _a3, _b2;
(_b2 = (_a3 = contentRef.value) == null ? void 0 : _a3.updatePopper) == null ? void 0 : _b2.call(_a3);
onBeforeShow == null ? void 0 : onBeforeShow();
};
const onBeforeLeave = () => {
onBeforeHide == null ? void 0 : onBeforeHide();
};
const onAfterShow = () => {
onShow();
};
const onBlur = () => {
if (!props.virtualTriggering) {
onClose();
}
};
const isFocusInsideContent = (event) => {
var _a3;
const popperContent = (_a3 = contentRef.value) == null ? void 0 : _a3.popperContentRef;
const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
return popperContent == null ? void 0 : popperContent.contains(activeElement);
};
watch(() => unref(open), (val) => {
if (!val) {
stopHandle == null ? void 0 : stopHandle();
} else {
ariaHidden.value = false;
stopHandle = onClickOutside(popperContentRef, () => {
if (unref(controlled))
return;
const $trigger = unref(trigger);
if ($trigger !== "hover") {
onClose();
}
});
}
}, {
flush: "post"
});
watch(() => props.content, () => {
var _a3, _b2;
(_b2 = (_a3 = contentRef.value) == null ? void 0 : _a3.updatePopper) == null ? void 0 : _b2.call(_a3);
});
expose({
contentRef,
isFocusInsideContent
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTeleport), {
disabled: !_ctx.teleported,
to: unref(appendTo)
}, {
default: withCtx(() => [
unref(shouldRender) || !ariaHidden.value ? (openBlock(), createBlock(Transition, {
key: 0,
name: unref(transitionClass),
appear: !unref(persistentRef),
onAfterLeave: onTransitionLeave,
onBeforeEnter,
onAfterEnter: onAfterShow,
onBeforeLeave,
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createVNode(unref(ElPopperContent), mergeProps({
id: unref(id),
ref_key: "contentRef",
ref: contentRef
}, _ctx.$attrs, {
"aria-label": _ctx.ariaLabel,
"aria-hidden": ariaHidden.value,
"boundaries-padding": _ctx.boundariesPadding,
"fallback-placements": _ctx.fallbackPlacements,
"gpu-acceleration": _ctx.gpuAcceleration,
offset: _ctx.offset,
placement: _ctx.placement,
"popper-options": _ctx.popperOptions,
"arrow-offset": _ctx.arrowOffset,
strategy: _ctx.strategy,
effect: _ctx.effect,
enterable: _ctx.enterable,
pure: _ctx.pure,
"popper-class": _ctx.popperClass,
"popper-style": [_ctx.popperStyle, unref(contentStyle)],
"reference-el": _ctx.referenceEl,
"trigger-target-el": _ctx.triggerTargetEl,
visible: unref(shouldShow),
"z-index": _ctx.zIndex,
onMouseenter: unref(onContentEnter),
onMouseleave: unref(onContentLeave),
onBlur,
onClose: unref(onClose)
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "arrow-offset", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"]), [
[vShow, unref(shouldShow)]
])
]),
_: 3
}, 8, ["name", "appear"])) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["disabled", "to"]);
};
}
});
var ElTooltipContent = _export_sfc(_sfc_main$15, [["__file", "content.vue"]]);
var __default__5 = defineComponent({
name: "ElTooltip"
});
var _sfc_main9 = defineComponent({
...__default__5,
props: useTooltipProps,
emits: tooltipEmits,
setup(__props, { expose, emit }) {
const props = __props;
usePopperContainer();
const ns = useNamespace("tooltip");
const id = useId();
const popperRef = ref();
const contentRef = ref();
const updatePopper = () => {
var _a3;
const popperComponent = unref(popperRef);
if (popperComponent) {
(_a3 = popperComponent.popperInstanceRef) == null ? void 0 : _a3.update();
}
};
const open = ref(false);
const toggleReason = ref();
const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
indicator: open,
toggleReason
});
const { onOpen, onClose } = useDelayedToggle({
showAfter: toRef(props, "showAfter"),
hideAfter: toRef(props, "hideAfter"),
autoClose: toRef(props, "autoClose"),
open: show,
close: hide
});
const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
const kls = computed(() => {
return [ns.b(), props.popperClass];
});
provide(TOOLTIP_INJECTION_KEY, {
controlled,
id,
open: readonly(open),
trigger: toRef(props, "trigger"),
onOpen,
onClose,
onToggle: (event) => {
if (unref(open)) {
onClose(event);
} else {
onOpen(event);
}
},
onShow: () => {
emit("show", toggleReason.value);
},
onHide: () => {
emit("hide", toggleReason.value);
},
onBeforeShow: () => {
emit("before-show", toggleReason.value);
},
onBeforeHide: () => {
emit("before-hide", toggleReason.value);
},
updatePopper
});
watch(() => props.disabled, (disabled) => {
if (disabled && open.value) {
open.value = false;
}
});
const isFocusInsideContent = (event) => {
var _a3;
return (_a3 = contentRef.value) == null ? void 0 : _a3.isFocusInsideContent(event);
};
onDeactivated(() => open.value && hide());
expose({
popperRef,
contentRef,
isFocusInsideContent,
updatePopper,
onOpen,
onClose,
hide
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElPopper), {
ref_key: "popperRef",
ref: popperRef,
role: _ctx.role
}, {
default: withCtx(() => [
createVNode(ElTooltipTrigger, {
disabled: _ctx.disabled,
trigger: _ctx.trigger,
"trigger-keys": _ctx.triggerKeys,
"virtual-ref": _ctx.virtualRef,
"virtual-triggering": _ctx.virtualTriggering
}, {
default: withCtx(() => [
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
createVNode(ElTooltipContent, {
ref_key: "contentRef",
ref: contentRef,
"aria-label": _ctx.ariaLabel,
"boundaries-padding": _ctx.boundariesPadding,
content: _ctx.content,
disabled: _ctx.disabled,
effect: _ctx.effect,
enterable: _ctx.enterable,
"fallback-placements": _ctx.fallbackPlacements,
"hide-after": _ctx.hideAfter,
"gpu-acceleration": _ctx.gpuAcceleration,
offset: _ctx.offset,
persistent: _ctx.persistent,
"popper-class": unref(kls),
"popper-style": _ctx.popperStyle,
placement: _ctx.placement,
"popper-options": _ctx.popperOptions,
"arrow-offset": _ctx.arrowOffset,
pure: _ctx.pure,
"raw-content": _ctx.rawContent,
"reference-el": _ctx.referenceEl,
"trigger-target-el": _ctx.triggerTargetEl,
"show-after": _ctx.showAfter,
strategy: _ctx.strategy,
teleported: _ctx.teleported,
transition: _ctx.transition,
"virtual-triggering": _ctx.virtualTriggering,
"z-index": _ctx.zIndex,
"append-to": _ctx.appendTo
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "content", {}, () => [
_ctx.rawContent ? (openBlock(), createElementBlock("span", {
key: 0,
innerHTML: _ctx.content
}, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.content), 1))
]),
_ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), { key: 0 })) : createCommentVNode("v-if", true)
]),
_: 3
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "arrow-offset", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
]),
_: 3
}, 8, ["role"]);
};
}
});
var Tooltip = _export_sfc(_sfc_main9, [["__file", "tooltip.vue"]]);
var ElTooltip = withInstall(Tooltip);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/dropdown-DO9gLsGO.js
var _sfc_main$16 = defineComponent({
inheritAttrs: false
});
function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
return renderSlot(_ctx.$slots, "default");
}
var Collection = _export_sfc(_sfc_main$16, [["render", _sfc_render$12], ["__file", "collection.vue"]]);
var _sfc_main10 = defineComponent({
name: "ElCollectionItem",
inheritAttrs: false
});
function _sfc_render3(_ctx, _cache, $props, $setup, $data, $options) {
return renderSlot(_ctx.$slots, "default");
}
var CollectionItem = _export_sfc(_sfc_main10, [["render", _sfc_render3], ["__file", "collection-item.vue"]]);
var COLLECTION_ITEM_SIGN = `data-el-collection-item`;
var createCollectionWithScope = (name) => {
const COLLECTION_NAME = `El${name}Collection`;
const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
const COLLECTION_INJECTION_KEY22 = Symbol(COLLECTION_NAME);
const COLLECTION_ITEM_INJECTION_KEY22 = Symbol(COLLECTION_ITEM_NAME);
const ElCollection22 = {
...Collection,
name: COLLECTION_NAME,
setup() {
const collectionRef = ref();
const itemMap = /* @__PURE__ */ new Map();
const getItems = () => {
const collectionEl = unref(collectionRef);
if (!collectionEl)
return [];
const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
const items = [...itemMap.values()];
return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
};
provide(COLLECTION_INJECTION_KEY22, {
itemMap,
getItems,
collectionRef
});
}
};
const ElCollectionItem22 = {
...CollectionItem,
name: COLLECTION_ITEM_NAME,
setup(_, { attrs }) {
const collectionItemRef = ref();
const collectionInjection = inject(COLLECTION_INJECTION_KEY22, void 0);
provide(COLLECTION_ITEM_INJECTION_KEY22, {
collectionItemRef
});
onMounted(() => {
const collectionItemEl = unref(collectionItemRef);
if (collectionItemEl) {
collectionInjection.itemMap.set(collectionItemEl, {
ref: collectionItemEl,
...attrs
});
}
});
onBeforeUnmount(() => {
const collectionItemEl = unref(collectionItemRef);
collectionInjection.itemMap.delete(collectionItemEl);
});
}
};
return {
COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY22,
COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY22,
ElCollection: ElCollection22,
ElCollectionItem: ElCollectionItem22
};
};
var dropdownProps = buildProps({
trigger: useTooltipTriggerProps.trigger,
triggerKeys: {
type: definePropType(Array),
default: () => [
EVENT_CODE.enter,
EVENT_CODE.numpadEnter,
EVENT_CODE.space,
EVENT_CODE.down
]
},
effect: {
...useTooltipContentProps.effect,
default: "light"
},
type: {
type: definePropType(String)
},
placement: {
type: definePropType(String),
default: "bottom"
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
},
id: String,
size: {
type: String,
default: ""
},
splitButton: Boolean,
hideOnClick: {
type: Boolean,
default: true
},
loop: {
type: Boolean,
default: true
},
showTimeout: {
type: Number,
default: 150
},
hideTimeout: {
type: Number,
default: 150
},
tabindex: {
type: definePropType([Number, String]),
default: 0
},
maxHeight: {
type: definePropType([Number, String]),
default: ""
},
popperClass: {
type: String,
default: ""
},
disabled: Boolean,
role: {
type: String,
values: roleTypes,
default: "menu"
},
buttonProps: {
type: definePropType(Object)
},
teleported: useTooltipContentProps.teleported,
persistent: {
type: Boolean,
default: true
}
});
var dropdownItemProps = buildProps({
command: {
type: [Object, String, Number],
default: () => ({})
},
disabled: Boolean,
divided: Boolean,
textValue: String,
icon: {
type: iconPropType
}
});
var dropdownMenuProps = buildProps({
onKeydown: { type: definePropType(Function) }
});
var FIRST_KEYS = [
EVENT_CODE.down,
EVENT_CODE.pageDown,
EVENT_CODE.home
];
var LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
var {
ElCollection,
ElCollectionItem,
COLLECTION_INJECTION_KEY,
COLLECTION_ITEM_INJECTION_KEY
} = createCollectionWithScope("Dropdown");
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Conversations/index.js
var rovingFocusGroupProps = buildProps({
style: { type: definePropType([String, Array, Object]) },
currentTabId: {
type: definePropType(String)
},
defaultCurrentTabId: String,
loop: Boolean,
dir: {
type: String,
values: ["ltr", "rtl"],
default: "ltr"
},
orientation: {
type: definePropType(String)
},
onBlur: Function,
onFocus: Function,
onMousedown: Function
});
var {
ElCollection: ElCollection2,
ElCollectionItem: ElCollectionItem2,
COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY2,
COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY2
} = createCollectionWithScope("RovingFocusGroup");
var ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
var ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
var MAP_KEY_TO_FOCUS_INTENT = {
ArrowLeft: "prev",
ArrowUp: "prev",
ArrowRight: "next",
ArrowDown: "next",
PageUp: "first",
Home: "first",
PageDown: "last",
End: "last"
};
var getDirectionAwareKey = (key2, dir) => {
return key2;
};
var getFocusIntent = (event, orientation, dir) => {
const key2 = getDirectionAwareKey(event.code);
return MAP_KEY_TO_FOCUS_INTENT[key2];
};
var reorderArray = (array, atIdx) => {
return array.map((_, idx) => array[(idx + atIdx) % array.length]);
};
var focusFirst = (elements) => {
const { activeElement: prevActive } = document;
for (const element2 of elements) {
if (element2 === prevActive)
return;
element2.focus();
if (prevActive !== document.activeElement)
return;
}
};
var CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
var ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
var EVT_OPTS = { bubbles: false, cancelable: true };
var _sfc_main$82 = defineComponent({
name: "ElRovingFocusGroupImpl",
inheritAttrs: false,
props: rovingFocusGroupProps,
emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
setup(props, { emit }) {
var _a3;
const currentTabbedId = ref((_a3 = props.currentTabId || props.defaultCurrentTabId) != null ? _a3 : null);
const isBackingOut = ref(false);
const isClickFocus = ref(false);
const rovingFocusGroupRef = ref();
const { getItems } = inject(COLLECTION_INJECTION_KEY2, void 0);
const rovingFocusGroupRootStyle = computed(() => {
return [
{
outline: "none"
},
props.style
];
});
const onItemFocus = (tabbedId) => {
emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
};
const onItemShiftTab = () => {
isBackingOut.value = true;
};
const onMousedown = composeEventHandlers((e) => {
var _a22;
(_a22 = props.onMousedown) == null ? void 0 : _a22.call(props, e);
}, () => {
isClickFocus.value = true;
});
const onFocus = composeEventHandlers((e) => {
var _a22;
(_a22 = props.onFocus) == null ? void 0 : _a22.call(props, e);
}, (e) => {
const isKeyboardFocus = !unref(isClickFocus);
const { target, currentTarget } = e;
if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
if (!entryFocusEvt.defaultPrevented) {
const items = getItems().filter((item) => item.focusable);
const activeItem = items.find((item) => item.active);
const currentItem = items.find((item) => item.id === unref(currentTabbedId));
const candidates = [activeItem, currentItem, ...items].filter(Boolean);
const candidateNodes = candidates.map((item) => item.ref);
focusFirst(candidateNodes);
}
}
isClickFocus.value = false;
});
const onBlur = composeEventHandlers((e) => {
var _a22;
(_a22 = props.onBlur) == null ? void 0 : _a22.call(props, e);
}, () => {
isBackingOut.value = false;
});
const handleEntryFocus = (...args) => {
emit("entryFocus", ...args);
};
provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
currentTabbedId: readonly(currentTabbedId),
loop: toRef(props, "loop"),
tabIndex: computed(() => {
return unref(isBackingOut) ? -1 : 0;
}),
rovingFocusGroupRef,
rovingFocusGroupRootStyle,
orientation: toRef(props, "orientation"),
dir: toRef(props, "dir"),
onItemFocus,
onItemShiftTab,
onBlur,
onFocus,
onMousedown
});
watch(() => props.currentTabId, (val) => {
currentTabbedId.value = val != null ? val : null;
});
useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
}
});
function _sfc_render$62(_ctx, _cache, $props, $setup, $data, $options) {
return renderSlot(_ctx.$slots, "default");
}
var ElRovingFocusGroupImpl = _export_sfc(_sfc_main$82, [["render", _sfc_render$62], ["__file", "roving-focus-group-impl.vue"]]);
var _sfc_main$72 = defineComponent({
name: "ElRovingFocusGroup",
components: {
ElFocusGroupCollection: ElCollection2,
ElRovingFocusGroupImpl
}
});
function _sfc_render$52(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
return openBlock(), createBlock(_component_el_focus_group_collection, null, {
default: withCtx(() => [
createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16)
]),
_: 3
});
}
var ElRovingFocusGroup = _export_sfc(_sfc_main$72, [["render", _sfc_render$52], ["__file", "roving-focus-group.vue"]]);
var DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
var DROPDOWN_INSTANCE_INJECTION_KEY = "elDropdown";
var { ButtonGroup: ElButtonGroup } = ElButton;
var _sfc_main$63 = defineComponent({
name: "ElDropdown",
components: {
ElButton,
ElButtonGroup,
ElScrollbar,
ElDropdownCollection: ElCollection,
ElTooltip,
ElRovingFocusGroup,
ElOnlyChild: OnlyChild,
ElIcon,
ArrowDown: arrow_down_default
},
props: dropdownProps,
emits: ["visible-change", "click", "command"],
setup(props, { emit }) {
const _instance2 = getCurrentInstance();
const ns = useNamespace("dropdown");
const { t } = useLocale();
const triggeringElementRef = ref();
const referenceElementRef = ref();
const popperRef = ref();
const contentRef = ref();
const scrollbar = ref(null);
const currentTabId = ref(null);
const isUsingKeyboard = ref(false);
const wrapStyle = computed(() => ({
maxHeight: addUnit(props.maxHeight)
}));
const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
const trigger = computed(() => castArray(props.trigger));
const defaultTriggerId = useId().value;
const triggerId = computed(() => props.id || defaultTriggerId);
watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
var _a3, _b2, _c;
if ((_a3 = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a3.removeEventListener) {
prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
}
if ((_b2 = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b2.removeEventListener) {
triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
}
if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
}
}, { immediate: true });
onBeforeUnmount(() => {
var _a3, _b2;
if ((_b2 = (_a3 = triggeringElementRef.value) == null ? void 0 : _a3.$el) == null ? void 0 : _b2.removeEventListener) {
triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
}
});
function handleClick() {
handleClose();
}
function handleClose() {
var _a3;
(_a3 = popperRef.value) == null ? void 0 : _a3.onClose();
}
function handleOpen() {
var _a3;
(_a3 = popperRef.value) == null ? void 0 : _a3.onOpen();
}
const dropdownSize = useFormSize();
function commandHandler(...args) {
emit("command", ...args);
}
function onAutofocusTriggerEnter() {
var _a3, _b2;
(_b2 = (_a3 = triggeringElementRef.value) == null ? void 0 : _a3.$el) == null ? void 0 : _b2.focus({
preventScroll: true
});
}
function onItemEnter() {
}
function onItemLeave() {
const contentEl = unref(contentRef);
trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus({
preventScroll: true
}));
currentTabId.value = null;
}
function handleCurrentTabIdChange(id) {
currentTabId.value = id;
}
function handleEntryFocus(e) {
if (!isUsingKeyboard.value) {
e.preventDefault();
e.stopImmediatePropagation();
}
}
function handleBeforeShowTooltip() {
emit("visible-change", true);
}
function handleShowTooltip(event) {
var _a3;
if ((event == null ? void 0 : event.type) === "keydown") {
(_a3 = contentRef.value) == null ? void 0 : _a3.focus();
}
}
function handleBeforeHideTooltip() {
emit("visible-change", false);
}
provide(DROPDOWN_INJECTION_KEY, {
contentRef,
role: computed(() => props.role),
triggerId,
isUsingKeyboard,
onItemEnter,
onItemLeave
});
provide(DROPDOWN_INSTANCE_INJECTION_KEY, {
instance: _instance2,
dropdownSize,
handleClick,
commandHandler,
trigger: toRef(props, "trigger"),
hideOnClick: toRef(props, "hideOnClick")
});
const onFocusAfterTrapped = (e) => {
var _a3, _b2;
e.preventDefault();
(_b2 = (_a3 = contentRef.value) == null ? void 0 : _a3.focus) == null ? void 0 : _b2.call(_a3, {
preventScroll: true
});
};
const handlerMainButtonClick = (event) => {
emit("click", event);
};
return {
t,
ns,
scrollbar,
wrapStyle,
dropdownTriggerKls,
dropdownSize,
triggerId,
currentTabId,
handleCurrentTabIdChange,
handlerMainButtonClick,
handleEntryFocus,
handleClose,
handleOpen,
handleBeforeShowTooltip,
handleShowTooltip,
handleBeforeHideTooltip,
onFocusAfterTrapped,
popperRef,
contentRef,
triggeringElementRef,
referenceElementRef
};
}
});
function _sfc_render$42(_ctx, _cache, $props, $setup, $data, $options) {
var _a3;
const _component_el_dropdown_collection = resolveComponent("el-dropdown-collection");
const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
const _component_el_scrollbar = resolveComponent("el-scrollbar");
const _component_el_only_child = resolveComponent("el-only-child");
const _component_el_tooltip = resolveComponent("el-tooltip");
const _component_el_button = resolveComponent("el-button");
const _component_arrow_down = resolveComponent("arrow-down");
const _component_el_icon = resolveComponent("el-icon");
const _component_el_button_group = resolveComponent("el-button-group");
return openBlock(), createElementBlock("div", {
class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
}, [
createVNode(_component_el_tooltip, {
ref: "popperRef",
role: _ctx.role,
effect: _ctx.effect,
"fallback-placements": ["bottom", "top"],
"popper-options": _ctx.popperOptions,
"gpu-acceleration": false,
"hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
"manual-mode": true,
placement: _ctx.placement,
"popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
"reference-element": (_a3 = _ctx.referenceElementRef) == null ? void 0 : _a3.$el,
trigger: _ctx.trigger,
"trigger-keys": _ctx.triggerKeys,
"trigger-target-el": _ctx.contentRef,
"show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
"stop-popper-mouse-event": false,
"virtual-ref": _ctx.triggeringElementRef,
"virtual-triggering": _ctx.splitButton,
disabled: _ctx.disabled,
transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
teleported: _ctx.teleported,
pure: "",
persistent: _ctx.persistent,
onBeforeShow: _ctx.handleBeforeShowTooltip,
onShow: _ctx.handleShowTooltip,
onBeforeHide: _ctx.handleBeforeHideTooltip
}, createSlots({
content: withCtx(() => [
createVNode(_component_el_scrollbar, {
ref: "scrollbar",
"wrap-style": _ctx.wrapStyle,
tag: "div",
"view-class": _ctx.ns.e("list")
}, {
default: withCtx(() => [
createVNode(_component_el_roving_focus_group, {
loop: _ctx.loop,
"current-tab-id": _ctx.currentTabId,
orientation: "horizontal",
onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
onEntryFocus: _ctx.handleEntryFocus
}, {
default: withCtx(() => [
createVNode(_component_el_dropdown_collection, null, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "dropdown")
]),
_: 3
})
]),
_: 3
}, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
]),
_: 3
}, 8, ["wrap-style", "view-class"])
]),
_: 2
}, [
!_ctx.splitButton ? {
name: "default",
fn: withCtx(() => [
createVNode(_component_el_only_child, {
id: _ctx.triggerId,
ref: "triggeringElementRef",
role: "button",
tabindex: _ctx.tabindex
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["id", "tabindex"])
])
} : void 0
]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
_ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
default: withCtx(() => [
createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
size: _ctx.dropdownSize,
type: _ctx.type,
disabled: _ctx.disabled,
tabindex: _ctx.tabindex,
onClick: _ctx.handlerMainButtonClick
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
createVNode(_component_el_button, mergeProps({
id: _ctx.triggerId,
ref: "triggeringElementRef"
}, _ctx.buttonProps, {
role: "button",
size: _ctx.dropdownSize,
type: _ctx.type,
class: _ctx.ns.e("caret-button"),
disabled: _ctx.disabled,
tabindex: _ctx.tabindex,
"aria-label": _ctx.t("el.dropdown.toggleDropdown")
}), {
default: withCtx(() => [
createVNode(_component_el_icon, {
class: normalizeClass(_ctx.ns.e("icon"))
}, {
default: withCtx(() => [
createVNode(_component_arrow_down)
]),
_: 1
}, 8, ["class"])
]),
_: 1
}, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
]),
_: 3
})) : createCommentVNode("v-if", true)
], 2);
}
var Dropdown = _export_sfc(_sfc_main$63, [["render", _sfc_render$42], ["__file", "dropdown.vue"]]);
var _sfc_main$53 = defineComponent({
components: {
ElRovingFocusCollectionItem: ElCollectionItem2
},
props: {
focusable: {
type: Boolean,
default: true
},
active: Boolean
},
emits: ["mousedown", "focus", "keydown"],
setup(props, { emit }) {
const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
const { getItems } = inject(COLLECTION_INJECTION_KEY2, void 0);
const id = useId();
const rovingFocusGroupItemRef = ref();
const handleMousedown = composeEventHandlers((e) => {
emit("mousedown", e);
}, (e) => {
if (!props.focusable) {
e.preventDefault();
} else {
onItemFocus(unref(id));
}
});
const handleFocus = composeEventHandlers((e) => {
emit("focus", e);
}, () => {
onItemFocus(unref(id));
});
const handleKeydown = composeEventHandlers((e) => {
emit("keydown", e);
}, (e) => {
const { code: code3, shiftKey, target, currentTarget } = e;
if (code3 === EVENT_CODE.tab && shiftKey) {
onItemShiftTab();
return;
}
if (target !== currentTarget)
return;
const focusIntent = getFocusIntent(e);
if (focusIntent) {
e.preventDefault();
const items = getItems().filter((item) => item.focusable);
let elements = items.map((item) => item.ref);
switch (focusIntent) {
case "last": {
elements.reverse();
break;
}
case "prev":
case "next": {
if (focusIntent === "prev") {
elements.reverse();
}
const currentIdx = elements.indexOf(currentTarget);
elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
break;
}
}
nextTick(() => {
focusFirst(elements);
});
}
});
const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
rovingFocusGroupItemRef,
tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
handleMousedown,
handleFocus,
handleKeydown
});
return {
id,
handleKeydown,
handleFocus,
handleMousedown
};
}
});
function _sfc_render$32(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
id: _ctx.id,
focusable: _ctx.focusable,
active: _ctx.active
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["id", "focusable", "active"]);
}
var ElRovingFocusItem = _export_sfc(_sfc_main$53, [["render", _sfc_render$32], ["__file", "roving-focus-item.vue"]]);
var _sfc_main$44 = defineComponent({
name: "DropdownItemImpl",
components: {
ElIcon
},
props: dropdownItemProps,
emits: ["pointermove", "pointerleave", "click", "clickimpl"],
setup(_, { emit }) {
const ns = useNamespace("dropdown");
const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
const { collectionItemRef: dropdownCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY2, void 0);
const {
rovingFocusGroupItemRef,
tabIndex,
handleFocus,
handleKeydown: handleItemKeydown,
handleMousedown
} = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
const role = computed(() => {
if (menuRole.value === "menu") {
return "menuitem";
} else if (menuRole.value === "navigation") {
return "link";
}
return "button";
});
const handleKeydown = composeEventHandlers((e) => {
if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
e.preventDefault();
e.stopImmediatePropagation();
emit("clickimpl", e);
return true;
}
}, handleItemKeydown);
return {
ns,
itemRef,
dataset: {
[COLLECTION_ITEM_SIGN]: ""
},
role,
tabIndex,
handleFocus,
handleKeydown,
handleMousedown
};
}
});
function _sfc_render$22(_ctx, _cache, $props, $setup, $data, $options) {
const _component_el_icon = resolveComponent("el-icon");
return openBlock(), createElementBlock(Fragment, null, [
_ctx.divided ? (openBlock(), createElementBlock("li", {
key: 0,
role: "separator",
class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
}, null, 2)) : createCommentVNode("v-if", true),
createBaseVNode("li", mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
"aria-disabled": _ctx.disabled,
class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
tabindex: _ctx.tabIndex,
role: _ctx.role,
onClick: (e) => _ctx.$emit("clickimpl", e),
onFocus: _ctx.handleFocus,
onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
onMousedown: _ctx.handleMousedown,
onPointermove: (e) => _ctx.$emit("pointermove", e),
onPointerleave: (e) => _ctx.$emit("pointerleave", e)
}), [
_ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
})) : createCommentVNode("v-if", true),
renderSlot(_ctx.$slots, "default")
], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
], 64);
}
var ElDropdownItemImpl = _export_sfc(_sfc_main$44, [["render", _sfc_render$22], ["__file", "dropdown-item-impl.vue"]]);
var useDropdown = () => {
const elDropdown = inject(DROPDOWN_INSTANCE_INJECTION_KEY, {});
const _elDropdownSize = computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
return {
elDropdown,
_elDropdownSize
};
};
var _sfc_main$34 = defineComponent({
name: "ElDropdownItem",
components: {
ElDropdownCollectionItem: ElCollectionItem,
ElRovingFocusItem,
ElDropdownItemImpl
},
inheritAttrs: false,
props: dropdownItemProps,
emits: ["pointermove", "pointerleave", "click"],
setup(props, { emit, attrs }) {
const { elDropdown } = useDropdown();
const _instance2 = getCurrentInstance();
const itemRef = ref(null);
const textContent = computed(() => {
var _a3, _b2;
return (_b2 = (_a3 = unref(itemRef)) == null ? void 0 : _a3.textContent) != null ? _b2 : "";
});
const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
const handlePointerMove = composeEventHandlers((e) => {
emit("pointermove", e);
return e.defaultPrevented;
}, whenMouse((e) => {
if (props.disabled) {
onItemLeave(e);
return;
}
const target = e.currentTarget;
if (target === document.activeElement || target.contains(document.activeElement)) {
return;
}
onItemEnter(e);
if (!e.defaultPrevented) {
target == null ? void 0 : target.focus({
preventScroll: true
});
}
}));
const handlePointerLeave = composeEventHandlers((e) => {
emit("pointerleave", e);
return e.defaultPrevented;
}, whenMouse(onItemLeave));
const handleClick = composeEventHandlers((e) => {
if (props.disabled) {
return;
}
emit("click", e);
return e.type !== "keydown" && e.defaultPrevented;
}, (e) => {
var _a3, _b2, _c;
if (props.disabled) {
e.stopImmediatePropagation();
return;
}
if ((_a3 = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a3.value) {
(_b2 = elDropdown.handleClick) == null ? void 0 : _b2.call(elDropdown);
}
(_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance2, e);
});
const propsAndAttrs = computed(() => ({ ...props, ...attrs }));
return {
handleClick,
handlePointerMove,
handlePointerLeave,
textContent,
propsAndAttrs
};
}
});
function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
var _a3;
const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
const _component_el_dropdown_collection_item = resolveComponent("el-dropdown-collection-item");
return openBlock(), createBlock(_component_el_dropdown_collection_item, {
disabled: _ctx.disabled,
"text-value": (_a3 = _ctx.textValue) != null ? _a3 : _ctx.textContent
}, {
default: withCtx(() => [
createVNode(_component_el_roving_focus_item, {
focusable: !_ctx.disabled
}, {
default: withCtx(() => [
createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
onPointerleave: _ctx.handlePointerLeave,
onPointermove: _ctx.handlePointerMove,
onClickimpl: _ctx.handleClick
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
]),
_: 3
}, 8, ["focusable"])
]),
_: 3
}, 8, ["disabled", "text-value"]);
}
var DropdownItem = _export_sfc(_sfc_main$34, [["render", _sfc_render$13], ["__file", "dropdown-item.vue"]]);
var _sfc_main$24 = defineComponent({
name: "ElDropdownMenu",
props: dropdownMenuProps,
setup(props) {
const ns = useNamespace("dropdown");
const { _elDropdownSize } = useDropdown();
const size = _elDropdownSize.value;
const { focusTrapRef, onKeydown } = inject(FOCUS_TRAP_INJECTION_KEY, void 0);
const { contentRef, role, triggerId } = inject(DROPDOWN_INJECTION_KEY, void 0);
const { collectionRef: dropdownCollectionRef, getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
const {
rovingFocusGroupRef,
rovingFocusGroupRootStyle,
tabIndex,
onBlur,
onFocus,
onMousedown
} = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY2, void 0);
const dropdownKls = computed(() => {
return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
});
const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
const composedKeydown = composeEventHandlers((e) => {
var _a3;
(_a3 = props.onKeydown) == null ? void 0 : _a3.call(props, e);
}, (e) => {
const { currentTarget, code: code3, target } = e;
currentTarget.contains(target);
if (EVENT_CODE.tab === code3) {
e.stopImmediatePropagation();
}
e.preventDefault();
if (target !== unref(contentRef) || !FIRST_LAST_KEYS.includes(code3))
return;
const items = getItems().filter((item) => !item.disabled);
const targets = items.map((item) => item.ref);
if (LAST_KEYS.includes(code3)) {
targets.reverse();
}
focusFirst(targets);
});
const handleKeydown = (e) => {
composedKeydown(e);
onKeydown(e);
};
return {
size,
rovingFocusGroupRootStyle,
tabIndex,
dropdownKls,
role,
triggerId,
dropdownListWrapperRef,
handleKeydown,
onBlur,
onFocus,
onMousedown
};
}
});
function _sfc_render4(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("ul", {
ref: _ctx.dropdownListWrapperRef,
class: normalizeClass(_ctx.dropdownKls),
style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
tabindex: -1,
role: _ctx.role,
"aria-labelledby": _ctx.triggerId,
onBlur: _ctx.onBlur,
onFocus: _ctx.onFocus,
onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
onMousedown: withModifiers(_ctx.onMousedown, ["self"])
}, [
renderSlot(_ctx.$slots, "default")
], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
}
var DropdownMenu = _export_sfc(_sfc_main$24, [["render", _sfc_render4], ["__file", "dropdown-menu.vue"]]);
var ElDropdown = withInstall(Dropdown, {
DropdownItem,
DropdownMenu
});
var ElDropdownItem = withNoopInstall(DropdownItem);
var ElDropdownMenu = withNoopInstall(DropdownMenu);
var _hoisted_1$12 = { class: "conversation-content" };
var _hoisted_2$1 = { class: "conversation-content-main" };
var _hoisted_3$1 = {
key: 0,
class: "conversation-prefix-icon"
};
var _hoisted_4$1 = { class: "conversation-label-container" };
var _hoisted_54 = {
key: 0,
class: "conversation-suffix-icon"
};
var _hoisted_63 = {
key: 1,
class: "conversation-dropdown-menu-container"
};
var _sfc_main$17 = defineComponent({
__name: "item",
props: {
item: {},
itemsStyle: {},
itemsHoverStyle: {},
itemsActiveStyle: {},
itemsMenuOpenedStyle: {},
prefixIcon: {},
suffixIcon: {},
showTooltip: { type: Boolean },
labelMaxWidth: {},
menu: {},
showBuiltInMenu: { type: Boolean },
alwaysShowBuiltInMenu: { type: Boolean },
tooltipPlacement: {},
tooltipOffset: {},
menuPlacement: {},
menuOffset: {},
menuMaxHeight: {},
menuStyle: {},
menuShowArrow: { type: Boolean },
menuClassName: {},
menuTeleported: { type: Boolean },
active: { type: Boolean }
},
emits: ["click", "menuCommand"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const slots = useSlots();
const {
item,
itemsStyle,
itemsHoverStyle,
itemsActiveStyle,
itemsMenuOpenedStyle,
showTooltip,
labelMaxWidth,
menu,
showBuiltInMenu,
alwaysShowBuiltInMenu,
tooltipPlacement,
tooltipOffset,
menuPlacement,
menuOffset,
menuMaxHeight,
menuStyle,
menuShowArrow,
menuClassName,
menuTeleported
} = toRefs(props);
function renderIcon(icon) {
if (!icon) return null;
return h(icon);
}
const prefixIconRender = computed(() => {
return renderIcon(props.prefixIcon);
});
const suffixIconRender = computed(() => {
return renderIcon(props.suffixIcon);
});
const isHovered = ref(false);
function handleMouseEnter() {
isHovered.value = true;
}
function handleMouseLeave() {
isHovered.value = false;
}
function handleClick(key2) {
emit("click", key2);
}
const isTextOverflow = computed(() => {
return (label = "") => {
if (!labelMaxWidth.value) return false;
const span = document.createElement("span");
span.style.visibility = "hidden";
span.style.position = "absolute";
span.style.whiteSpace = "nowrap";
span.style.fontSize = "14px";
span.textContent = label;
document.body.appendChild(span);
const textWidth = span.offsetWidth;
document.body.removeChild(span);
return textWidth > labelMaxWidth.value;
};
});
const labelStyle = computed(() => {
if (labelMaxWidth.value) {
return {
maxWidth: `${labelMaxWidth.value}px`,
overflow: "hidden"
};
}
return {};
});
const isShowMenuBtn = ref(false);
const shouldShowMenu = computed(() => {
return isHovered.value || props.active || isShowMenuBtn.value;
});
const menuButtonRef = ref(null);
const mergedMenuStyle = computed(() => {
return {
...menuStyle.value
};
});
function camelToKebab(str) {
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
}
function updateMenuStatus(isOpen) {
isShowMenuBtn.value = isOpen;
if (isOpen) {
nextTick(() => {
const dropdownMenu = document.querySelectorAll(
".conversation-dropdown-menu"
);
if (dropdownMenu.length === 0) {
return;
}
dropdownMenu.forEach((dropdownMenuItem) => {
if (dropdownMenuItem && dropdownMenuItem.style.display !== "none") {
const arrows = dropdownMenuItem.querySelectorAll(".el-popper__arrow");
if (arrows.length === 0) {
return;
}
arrows.forEach((arrow) => {
arrow.style.display = menuShowArrow.value ? "block" : "none";
});
const items = dropdownMenuItem.querySelectorAll(
".el-dropdown-menu__item:not(.is-disabled)"
);
if (items.length === 0) {
return;
}
items.forEach((item2, index) => {
if (!menu.value || menu.value.length === 0) {
return;
}
const menuItemHoverStyle = menu.value[index].menuItemHoverStyle || {};
const className = `custom-hover-${index}`;
item2.classList.add(className);
const style = document.createElement("style");
style.textContent = `
.${className}:hover,
.${className}:focus {
${Object.entries(menuItemHoverStyle).map(
([prop, val]) => `${camelToKebab(prop)}: ${val} !important;`
).join(" ")}
}
`;
document.head.appendChild(style);
});
}
});
});
}
}
function menuCommand(command, item2) {
if (slots.menu) {
return false;
}
emit("menuCommand", command, item2);
}
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_ElTooltip = ElTooltip;
const _component_ElIcon = ElIcon;
const _component_el_dropdown_item = ElDropdownItem;
const _component_el_dropdown_menu = ElDropdownMenu;
const _component_el_dropdown = ElDropdown;
return openBlock(), createElementBlock("li", {
key: unref(item).key,
class: normalizeClass(["conversation-item", {
disabled: unref(item).disabled,
active: _ctx.active,
hovered: unref(item).disabled ? false : unref(isHovered),
"menu-opened": unref(isShowMenuBtn),
"always-show-built-in-menu": unref(alwaysShowBuiltInMenu)
}]),
style: normalizeStyle({
...unref(itemsStyle),
...unref(isHovered) ? unref(itemsHoverStyle) : {},
...unref(isShowMenuBtn) ? unref(itemsMenuOpenedStyle) : {},
..._ctx.active ? unref(itemsActiveStyle) : {}
}),
onClick: _cache[2] || (_cache[2] = ($event) => handleClick(unref(item).key)),
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave
}, [
createBaseVNode("div", _hoisted_1$12, [
createBaseVNode("div", _hoisted_2$1, [
renderSlot(_ctx.$slots, "label", {}, () => [
unref(prefixIconRender) ? (openBlock(), createElementBlock("span", _hoisted_3$1, [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(prefixIconRender))))
]),
_: 1
})
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_4$1, [
unref(showTooltip) && unref(isTextOverflow)(unref(item).label) ? (openBlock(), createBlock(_component_ElTooltip, {
key: 0,
content: unref(item).label,
placement: unref(tooltipPlacement),
offset: unref(tooltipOffset),
effect: "dark"
}, {
default: withCtx(() => [
createBaseVNode("span", {
class: normalizeClass(["conversation-label", { "text-gradient": unref(isTextOverflow)(unref(item).label) }]),
style: normalizeStyle(unref(labelStyle))
}, toDisplayString(unref(item).label), 7)
]),
_: 1
}, 8, ["content", "placement", "offset"])) : (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(["conversation-label", { "text-gradient": unref(isTextOverflow)(unref(item).label) }]),
style: normalizeStyle(unref(labelStyle))
}, toDisplayString(unref(item).label), 7))
])
], true)
]),
unref(suffixIconRender) ? (openBlock(), createElementBlock("span", _hoisted_54, [
createVNode(_component_ElIcon, null, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(suffixIconRender))))
]),
_: 1
})
])) : createCommentVNode("", true),
unref(shouldShowMenu) && unref(showBuiltInMenu) || unref(alwaysShowBuiltInMenu) ? (openBlock(), createElementBlock("div", _hoisted_63, [
unref(menu) && unref(menu).length ? (openBlock(), createElementBlock("div", {
key: 0,
ref_key: "menuButtonRef",
ref: menuButtonRef,
class: "conversation-dropdown-more",
onClick: _cache[1] || (_cache[1] = (e) => e.stopPropagation())
}, [
createVNode(_component_el_dropdown, {
trigger: "click",
placement: unref(menuPlacement),
offset: unref(menuOffset),
teleported: unref(menuTeleported),
"popper-class": unref(menuClassName) ? `conversation-dropdown-menu ${unref(menuClassName)}` : "conversation-dropdown-menu",
"max-height": unref(menuMaxHeight),
disabled: unref(item).disabled,
onVisibleChange: updateMenuStatus,
onCommand: _cache[0] || (_cache[0] = (command) => menuCommand(command, unref(item)))
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "more-filled", normalizeProps(guardReactiveProps({
item: unref(item),
isHovered: unref(item).disabled ? false : unref(isHovered),
isActive: _ctx.active,
isMenuOpened: unref(isShowMenuBtn),
isDisabled: unref(item).disabled
})), () => [
createVNode(_component_el_icon, { class: "conversation-dropdown-more-icon" }, {
default: withCtx(() => [
createVNode(unref(more_filled_default))
]),
_: 1
})
], true)
]),
dropdown: withCtx(() => [
renderSlot(_ctx.$slots, "menu", {}, () => [
createVNode(_component_el_dropdown_menu, {
style: normalizeStyle(unref(mergedMenuStyle))
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(menu), (menuItem) => {
return openBlock(), createBlock(_component_el_dropdown_item, {
key: menuItem.key,
icon: menuItem.icon,
disabled: menuItem.disabled,
divided: menuItem.divided,
command: menuItem.command,
style: normalizeStyle(menuItem.menuItemStyle)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(menuItem.label), 1)
]),
_: 2
}, 1032, ["icon", "disabled", "divided", "command", "style"]);
}), 128))
]),
_: 1
}, 8, ["style"])
], true)
]),
_: 3
}, 8, ["placement", "offset", "teleported", "popper-class", "max-height", "disabled"])
], 512)) : createCommentVNode("", true)
])) : createCommentVNode("", true)
])
], 38);
};
}
});
var Item = _export_sfc2(_sfc_main$17, [["__scopeId", "data-v-32cc7342"]]);
var _hoisted_16 = { class: "conversations-scroll-wrapper" };
var _hoisted_24 = { class: "scroll-content" };
var _hoisted_34 = { class: "conversation-group-items" };
var _hoisted_44 = {
key: 0,
class: "conversations-load-more"
};
var _sfc_main11 = defineComponent({
__name: "index",
props: {
active: { default: void 0 },
items: { default: () => [] },
itemsStyle: { default: () => ({}) },
itemsHoverStyle: { default: () => ({}) },
itemsActiveStyle: { default: () => ({}) },
itemsMenuOpenedStyle: { default: () => ({}) },
style: { default: () => ({}) },
labelMaxWidth: { default: void 0 },
labelHeight: { default: 20 },
showTooltip: { type: Boolean, default: () => false },
tooltipPlacement: { default: "top" },
tooltipOffset: { default: 12 },
groupable: { type: [Boolean, Object], default: () => false },
ungroupedTitle: { default: "未分组" },
menu: { default: () => [
{
label: "重命名",
key: "rename",
icon: markRaw(edit_default),
command: "rename"
},
{
label: "删除",
key: "delete",
icon: markRaw(delete_default),
command: "delete",
menuItemHoverStyle: {
color: "red",
backgroundColor: "rgba(255, 0, 0, 0.1)"
}
}
] },
showBuiltInMenu: { type: Boolean, default: false },
showBuiltInMenuType: { default: "hover" },
menuPlacement: { default: "bottom-start" },
menuOffset: { default: 50 },
menuShowArrow: { type: Boolean, default: false },
menuMaxHeight: {},
menuStyle: { default: () => ({}) },
menuClassName: { default: "" },
menuTeleported: { type: Boolean, default: true },
loadMore: {},
loadMoreLoading: { type: Boolean, default: false },
showToTopBtn: { type: Boolean, default: false },
rowKey: { default: "id" },
labelKey: { default: "label" }
},
emits: ["menuCommand", "change", "update:active"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const activeKey = computed({
get() {
return props.active;
},
set(value) {
emits("update:active", value);
}
});
const alwaysShowBuiltInMenu = computed(
() => props.showBuiltInMenuType === "always" && props.showBuiltInMenu
);
const itemsUse = computed(() => {
return props.items.map((item, index) => ({
...item,
uniqueKey: props.rowKey ? get(item, props.rowKey) : index.toString(),
label: get(item, props.labelKey)
}));
});
const mergedStyle = computed(() => {
const defaultStyle = {
padding: "10px 0 10px 10px",
backgroundColor: "#fff",
borderRadius: "8px",
width: "280px",
height: "0"
};
return { ...defaultStyle, ...props.style };
});
function handleClick(item) {
if (item.disabled) return;
emits("change", item);
activeKey.value = item.uniqueKey;
}
const shouldUseGrouping = computed(() => {
return !!props.groupable;
});
const filteredItems = computed(() => {
return itemsUse.value;
});
const groups = computed(() => {
if (!shouldUseGrouping.value) return [];
if (!filteredItems.value || filteredItems.value.length === 0) {
return [];
}
const groupMap = {};
filteredItems.value.forEach((item) => {
let groupName = null;
if (item.group) {
groupName = item.group;
}
const finalGroupName = groupName || props.ungroupedTitle;
if (!groupMap[finalGroupName]) {
groupMap[finalGroupName] = {
title: finalGroupName,
key: finalGroupName,
children: [],
isUngrouped: !groupName
// 如果没有找到组名,则标记为未分组
};
}
groupMap[finalGroupName].children.push(item);
});
const groupArray = Object.values(groupMap);
if (typeof props.groupable === "object" && props.groupable.sort) {
return groupArray.sort((a, b) => {
if (a.isUngrouped) return 1;
if (b.isUngrouped) return -1;
const sortFn = props.groupable.sort;
return sortFn ? sortFn(a.key, b.key) : 0;
});
}
return groupArray.sort((a, b) => {
if (a.isUngrouped) return 1;
if (b.isUngrouped) return -1;
return 0;
});
});
const scrollbarRef = ref(null);
const showScrollTop = ref(false);
const groupRefs = ref({});
const stickyGroupKeys = ref(/* @__PURE__ */ new Set());
function handleScroll(e) {
const scrollTop = e.scrollTop;
showScrollTop.value = scrollTop > 200;
const scrollbar = scrollbarRef.value;
if (!scrollbar) return;
const wrap = scrollbar.wrapRef;
if (!wrap) return;
const bottomOffset = 20;
const scrollHeight = wrap.scrollHeight;
const clientHeight = wrap.clientHeight;
const isNearBottom = scrollHeight - scrollTop - clientHeight < bottomOffset;
if (isNearBottom) {
loadMoreData();
}
updateStickyStatus();
}
function updateStickyStatus(_e) {
var _a3;
if (!shouldUseGrouping.value || groups.value.length === 0) return;
stickyGroupKeys.value.clear();
const scrollContainer = (_a3 = scrollbarRef.value) == null ? void 0 : _a3.wrapRef;
if (!scrollContainer) return;
if (groups.value.length === 1) {
stickyGroupKeys.value.add(groups.value[0].key);
return;
}
const scrollContainerTop = scrollContainer.getBoundingClientRect().top;
const containerHeight = scrollContainer.clientHeight;
const scrollHeight = scrollContainer.scrollHeight;
const scrollTop = scrollContainer.scrollTop;
const isNearBottom = scrollHeight - scrollTop - containerHeight < 20;
if (isNearBottom && groups.value.length > 0) {
stickyGroupKeys.value.add(groups.value[groups.value.length - 1].key);
return;
}
const visibleGroups = [];
for (const group of groups.value) {
const groupElement = groupRefs.value[group.key];
if (groupElement) {
const groupRect = groupElement.getBoundingClientRect();
const relativeTop = groupRect.top - scrollContainerTop;
if (relativeTop < containerHeight && relativeTop + groupRect.height > 0) {
visibleGroups.push({
group,
relativeTop,
height: groupRect.height
});
}
}
}
visibleGroups.sort((a, b) => a.relativeTop - b.relativeTop);
if (visibleGroups.length > 0) {
const fullyVisibleGroup = visibleGroups.find((g) => g.relativeTop >= 0);
if (fullyVisibleGroup) {
stickyGroupKeys.value.add(fullyVisibleGroup.group.key);
} else {
stickyGroupKeys.value.add(visibleGroups[0].group.key);
}
} else if (groups.value.length > 0) {
stickyGroupKeys.value.add(groups.value[0].key);
}
}
function loadMoreData() {
if (!props.loadMore) return;
props.loadMore();
}
function scrollToTop() {
var _a3;
(_a3 = scrollbarRef.value) == null ? void 0 : _a3.setScrollTop(0);
}
function handleMenuItemClick(command, item) {
emits("menuCommand", command, item);
}
function bindGroupRef(el, item) {
if (el) {
groupRefs.value[item.key] = el;
}
}
onMounted(() => {
if (shouldUseGrouping.value && groups.value.length > 0) {
stickyGroupKeys.value.add(groups.value[0].key);
}
});
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_scrollbar = ElScrollbar;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", {
class: "conversations-container",
style: normalizeStyle({
"--conversation-label-height": `${props.labelHeight}px`,
"--conversation-list-auto-bg-color": unref(mergedStyle).backgroundColor
})
}, [
renderSlot(_ctx.$slots, "header", {}, void 0, true),
createBaseVNode("ul", {
class: "conversations-list",
style: normalizeStyle(unref(mergedStyle))
}, [
createBaseVNode("li", _hoisted_16, [
createVNode(_component_el_scrollbar, {
ref_key: "scrollbarRef",
ref: scrollbarRef,
height: "100%",
class: "custom-scrollbar",
always: "",
onScroll: handleScroll
}, {
default: withCtx(() => [
createBaseVNode("div", _hoisted_24, [
unref(shouldUseGrouping) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(groups), (group) => {
return openBlock(), createElementBlock("div", {
key: group.key,
ref_for: true,
ref: (el) => bindGroupRef(el, group),
class: "conversation-group"
}, [
createBaseVNode("div", {
class: normalizeClass(["conversation-group-title sticky-title", { "active-sticky": unref(stickyGroupKeys).has(group.key) }])
}, [
renderSlot(_ctx.$slots, "groupTitle", mergeProps({ ref_for: true }, { group }), () => [
createTextVNode(toDisplayString(group.title), 1)
], true)
], 2),
createBaseVNode("div", _hoisted_34, [
(openBlock(true), createElementBlock(Fragment, null, renderList(group.children, (item) => {
return openBlock(), createBlock(Item, {
key: item.uniqueKey,
item,
active: item.uniqueKey === unref(activeKey),
"items-style": props.itemsStyle,
"items-hover-style": props.itemsHoverStyle,
"items-active-style": props.itemsActiveStyle,
"items-menu-opened-style": props.itemsMenuOpenedStyle,
"prefix-icon": item.prefixIcon,
"show-tooltip": _ctx.showTooltip,
"tooltip-placement": props.tooltipPlacement,
"tooltip-offset": props.tooltipOffset,
"suffix-icon": item.suffixIcon,
"active-key": unref(activeKey) || "",
"label-max-width": _ctx.labelMaxWidth,
menu: _ctx.menu,
"show-built-in-menu": props.showBuiltInMenu,
"always-show-built-in-menu": unref(alwaysShowBuiltInMenu),
"menu-placement": props.menuPlacement,
"menu-offset": props.menuOffset,
"menu-max-height": props.menuMaxHeight,
"menu-style": props.menuStyle,
"menu-show-arrow": props.menuShowArrow,
"menu-class-name": props.menuClassName,
"menu-teleported": props.menuTeleported,
onClick: ($event) => handleClick(item),
onMenuCommand: handleMenuItemClick
}, createSlots({ _: 2 }, [
_ctx.$slots.label ? {
name: "label",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, { item }), void 0, true)
]),
key: "0"
} : void 0,
_ctx.$slots["more-filled"] ? {
name: "more-filled",
fn: withCtx((moreFilledSoltProps) => [
renderSlot(_ctx.$slots, "more-filled", mergeProps({ ref_for: true }, moreFilledSoltProps), void 0, true)
]),
key: "1"
} : void 0,
_ctx.$slots.menu ? {
name: "menu",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "menu", mergeProps({ ref_for: true }, { item }), void 0, true)
]),
key: "2"
} : void 0
]), 1032, ["item", "active", "items-style", "items-hover-style", "items-active-style", "items-menu-opened-style", "prefix-icon", "show-tooltip", "tooltip-placement", "tooltip-offset", "suffix-icon", "active-key", "label-max-width", "menu", "show-built-in-menu", "always-show-built-in-menu", "menu-placement", "menu-offset", "menu-max-height", "menu-style", "menu-show-arrow", "menu-class-name", "menu-teleported", "onClick"]);
}), 128))
])
]);
}), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(filteredItems), (item) => {
return openBlock(), createBlock(Item, {
key: item.uniqueKey,
item,
"items-style": props.itemsStyle,
"items-hover-style": props.itemsHoverStyle,
"items-active-style": props.itemsActiveStyle,
active: item.uniqueKey === unref(activeKey),
"items-menu-opened-style": props.itemsMenuOpenedStyle,
"prefix-icon": item.prefixIcon,
"show-tooltip": _ctx.showTooltip,
"tooltip-placement": props.tooltipPlacement,
"tooltip-offset": props.tooltipOffset,
"suffix-icon": item.suffixIcon,
"active-key": unref(activeKey) || "",
"label-max-width": _ctx.labelMaxWidth,
menu: _ctx.menu,
"show-built-in-menu": props.showBuiltInMenu,
"always-show-built-in-menu": unref(alwaysShowBuiltInMenu),
"menu-placement": props.menuPlacement,
"menu-offset": props.menuOffset,
"menu-max-height": props.menuMaxHeight,
"menu-style": props.menuStyle,
"menu-show-arrow": props.menuShowArrow,
"menu-class-name": props.menuClassName,
"menu-teleported": props.menuTeleported,
onClick: ($event) => handleClick(item),
onMenuCommand: handleMenuItemClick
}, createSlots({ _: 2 }, [
_ctx.$slots.label ? {
name: "label",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, { item }), void 0, true)
]),
key: "0"
} : void 0,
_ctx.$slots["more-filled"] ? {
name: "more-filled",
fn: withCtx((moreFilledSoltProps) => [
renderSlot(_ctx.$slots, "more-filled", mergeProps({ ref_for: true }, moreFilledSoltProps), void 0, true)
]),
key: "1"
} : void 0,
_ctx.$slots.menu ? {
name: "menu",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "menu", mergeProps({ ref_for: true }, { item }), void 0, true)
]),
key: "2"
} : void 0
]), 1032, ["item", "items-style", "items-hover-style", "items-active-style", "active", "items-menu-opened-style", "prefix-icon", "show-tooltip", "tooltip-placement", "tooltip-offset", "suffix-icon", "active-key", "label-max-width", "menu", "show-built-in-menu", "always-show-built-in-menu", "menu-placement", "menu-offset", "menu-max-height", "menu-style", "menu-show-arrow", "menu-class-name", "menu-teleported", "onClick"]);
}), 128))
]),
props.loadMoreLoading ? (openBlock(), createElementBlock("div", _hoisted_44, [
renderSlot(_ctx.$slots, "load-more", {}, () => [
createVNode(_component_el_icon, { class: "conversations-load-more-is-loading" }, {
default: withCtx(() => [
createVNode(unref(loading_default))
]),
_: 1
}),
_cache[0] || (_cache[0] = createBaseVNode("span", null, "加载更多...", -1))
], true)
])) : createCommentVNode("", true)
]),
_: 3
}, 512)
])
], 4),
renderSlot(_ctx.$slots, "footer", {}, void 0, true),
withDirectives(createVNode(_component_el_button, {
class: "scroll-to-top-btn",
circle: "",
onClick: scrollToTop
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(top_default))
]),
_: 1
})
]),
_: 1
}, 512), [
[vShow, unref(showScrollTop) && props.showToTopBtn]
])
], 4);
};
}
});
var Conversations = _export_sfc2(_sfc_main11, [["__scopeId", "data-v-fe156336"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style.scss_vue_type_style_index_0_src_4b153ac6_scoped_4b153ac6_lang-BBV4NivZ.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style10.css";
var __defProp = Object.defineProperty;
var __defNormalProp = (t, e, i) => e in t ? __defProp(t, e, { enumerable: true, configurable: true, writable: true, value: i }) : t[e] = i;
var __publicField = (t, e, i) => __defNormalProp(t, "symbol" != typeof e ? e + "" : e, i);
function os() {
const t = navigator.userAgent, e = /(?:Windows Phone)/.test(t), i = /(?:SymbianOS)/.test(t) || e, n = /(?:Android)/.test(t), s = /(?:Firefox)/.test(t), a = /(?:iPad|PlayBook)/.test(t) || n && !/(?:Mobile)/.test(t) || s && /(?:Tablet)/.test(t), l = /(?:iPhone)/.test(t) && !a;
return { isTablet: a, isPhone: l, isAndroid: n, isPc: !l && !n && !i };
}
function domItVisible(t, e = false, i = "block") {
t && (t.className = t.className.replace(/ chat-view-show| chat-view-hidden/g, ""), e ? (t.style.display = i, t.className += " chat-view-show") : (t.className += " chat-view-hidden", t.style.display = "none"));
}
function hasElmShow(t) {
return t && t.classList.contains("chat-view-show");
}
function updateElmClass(t, e, i) {
t.classList[i ? "add" : "remove"](e);
}
var RICH_WRAP = "richWrap";
var RICH_GRID = "richGrid";
var RICH_MARK = "richMark";
var RICH_INPUT = "richInput";
var RICH_TAG = "richTag";
var sleep = (t = 50) => new Promise((e) => {
setTimeout(e, t);
});
var getBoolean = (t) => "false" !== String(t) && "null" !== String(t) && "0" !== String(t);
var debounce3 = (t, e, i = false) => {
let n;
return function(...s) {
const a = this, l = i && !n;
clearTimeout(n), n = setTimeout(() => {
n = null, i || t.apply(a, s);
}, e), l && t.apply(a, s);
};
};
var throttle2 = (t, e) => {
let i;
return function(...n) {
const s = this;
i || (t.apply(s, n), i = true, setTimeout(function() {
i = false;
}, e));
};
};
var upFindElm = (t, e) => {
const i = t.getAttribute("data-set-richType");
return i === RICH_GRID ? null : i === RICH_MARK || i === RICH_TAG ? t : t.parentElement && e > 0 ? upFindElm(t.parentElement, e - 1) : null;
};
var getObjValue = (t, e, i) => t && t[e] ? t[e] : i;
function pinyinMatch(t, e, i) {
const n = e.split(/\s+/), s = t.split("").map((t2, i2) => {
let s2 = n[i2] || "";
return "" === e && "" === s2 && (s2 = t2), { char: t2, pinyin: s2.toLowerCase(), initial: s2 ? s2[0].toLowerCase() : "" };
}), a = ((t2) => {
const e2 = [];
let i2 = "";
for (const n2 of t2) /[a-zA-Z]/.test(n2) ? i2 += n2.toLowerCase() : (i2 && (e2.push({ type: "pinyin", value: i2 }), i2 = ""), e2.push({ type: "char", value: n2 }));
return i2 && e2.push({ type: "pinyin", value: i2 }), e2;
})(i), l = s.length, o = a.length, r = Array.from({ length: l + 1 }, () => Array(o + 1).fill(false));
r[0][0] = true;
for (let t2 = 0; t2 <= l; t2++) for (let e2 = 0; e2 <= o; e2++) if (r[t2][e2] && e2 < o) {
const i2 = a[e2];
for (let n2 = t2; n2 < l; n2++) {
const t3 = s[n2];
if ("char" === i2.type) t3.char === i2.value && (r[n2 + 1][e2 + 1] = true);
else {
const a2 = t3.pinyin.toLowerCase(), o2 = t3.initial, c = i2.value;
if (c === o2) r[n2 + 1][e2 + 1] = true;
else if (c === a2) r[n2 + 1][e2 + 1] = true;
else if (isSubsequence(c, a2)) r[n2 + 1][e2 + 1] = true;
else for (let t4 = 2; t4 <= l - n2; t4++) {
const i3 = s.slice(n2, n2 + t4), a3 = i3.map((t5) => t5.pinyin.toLowerCase()).join(""), l2 = i3.map((t5) => t5.initial).join("");
if (c === a3 || c === l2 || isSubsequence(c, a3)) {
r[n2 + t4][e2 + 1] = true;
break;
}
}
}
}
}
for (let t2 = 0; t2 <= l; t2++) if (r[t2][o]) return true;
return false;
}
function isSubsequence(t, e) {
let i = 0, n = 0;
for (; i < t.length && n < e.length; ) t[i] === e[n] && i++, n++;
return i === t.length;
}
var checkEmptySvg = '';
var searchEmptySvg = '';
var searchSvg = '';
var antdLoading = '
';
var matchEmptySvg = '';
var checkSvg = '';
var arrowSvg = '';
var closeSvg = '';
var ChatElement = class {
constructor(t) {
__publicField(this, "target"), __publicField(this, "richText", document.createElement("div")), __publicField(this, "placeholderElm", document.createElement("div")), __publicField(this, "tipElm", null), __publicField(this, "isExternalCallPopup", false), __publicField(this, "isPointSearchMode", false), __publicField(this, "checkboxRows", []), __publicField(this, "customTags", {}), __publicField(this, "selectTags", {}), __publicField(this, "rects", {}), __publicField(this, "pcElms", { containerDialogElm: null, pointDialogElm: null, pointDialogCheckElm: null, pointDialogMainElm: null, pointDialogUsersElm: [], pointDialogActiveElm: null, pointDialogLoadingElm: null, pointDialogEmptyElm: null, checkDialogElm: null, checkDialogSearchResultElm: null, checkDialogUsersElm: null, checkDialogSearchInputElm: null, checkDialogTagsElm: null, customTagDialogElms: {}, customTagDialogTagKey: "", customTagDialogActiveElm: null, selectDialogElms: {}, selectDialogKey: "", selectDialogAim: null, tipContainerPopoverElm: null, tipPopoverElm: null }), __publicField(this, "h5Elms", { dialogElm: null, dialogMainElm: null, dialogCheckElm: null, dialogShowElm: null, dialogSearchElm: null, dialogEmptyElm: null, dialogLoadingElm: null }), this.target = t, this.createRichText(), this.createPlaceholder(), t.deviceInfo.isPc ? this.createPCDialog() : this.createH5Dialog();
}
createRichText() {
const { options: t, deviceInfo: e } = this.target, { elm: i } = t;
updateElmClass(i, "chat-area-" + (e.isPc ? "pc" : "h5"), true), updateElmClass(this.richText, "chat-rich-text", true), this.richText.setAttribute("data-set-richType", RICH_WRAP), this.richText.setAttribute("contenteditable", "true"), i.appendChild(this.richText);
}
createPlaceholder() {
const { options: t } = this.target, { elm: e } = t;
updateElmClass(this.placeholderElm, "chat-placeholder-wrap", true), domItVisible(this.placeholderElm, true), e.appendChild(this.placeholderElm), this.rects.plaRect = this.placeholderElm.getBoundingClientRect();
}
createPCDialog() {
const { options: t } = this.target, { needDialog: e, elm: i, asyncMatch: n } = t;
if (!e) return;
const { pcElms: s } = this;
if (s.containerDialogElm = document.createElement("div"), updateElmClass(this.pcElms.containerDialogElm, "chat-dialog", true), !i.parentElement) throw new Error('配置项:"elm" 需要存在一个父级元素,请检查后重新配置!');
i.nextElementSibling ? i.parentElement.insertBefore(s.containerDialogElm, i.nextElementSibling) : i.parentElement.appendChild(s.containerDialogElm), n || this.createPCCheckDialog(), this.createPCPointDialog();
}
createPCCheckDialog() {
const { options: t } = this.target, e = this.target.options.dialogLabels.pcPCheckDialog, { pcElms: i } = this;
i.checkDialogElm = document.createElement("div"), updateElmClass(i.checkDialogElm, "checkbox-dialog", true), domItVisible(i.checkDialogElm), i.checkDialogElm.innerHTML = `
`, i.containerDialogElm.appendChild(i.checkDialogElm), i.checkDialogUsersElm = i.checkDialogElm.querySelector(".checkbox-dialog-check-group"), i.checkDialogSearchResultElm = i.checkDialogElm.querySelector(".checkbox-dialog-search-group"), i.checkDialogSearchInputElm = i.checkDialogElm.querySelector(".checkbox-dialog-search-input"), i.checkDialogTagsElm = i.checkDialogElm.querySelector(".checkbox-dialog-tags");
const n = () => {
domItVisible(i.checkDialogElm), updateElmClass(document.body, "disable-scroll");
};
i.checkDialogElm.querySelector(".checkbox-dialog-container-header-close").onclick = n, i.checkDialogElm.querySelector(".btn-close").onclick = n;
const s = i.checkDialogElm.querySelector(".btn-submit");
s.onclick = async () => {
if (s.classList.contains("disabled")) return;
const e2 = this.checkboxRows.map((e3) => {
const i2 = /* @__PURE__ */ Object.create(null);
return i2[t.userProps.id] = e3.id, i2[t.userProps.name] = e3.name, i2;
});
await this.target.batchSetTag(e2), n();
}, domItVisible(i.checkDialogSearchResultElm), i.checkDialogSearchResultElm.onclick = (t2) => {
t2.stopPropagation();
}, i.checkDialogSearchInputElm.onclick = (t2) => {
t2.stopPropagation();
};
const a = debounce3((t2) => {
const e2 = String(t2.target.value || "").replace(/'/g, "").trim();
if (!e2) return void domItVisible(i.checkDialogSearchResultElm);
const n2 = this.target.searchUserList(e2).map((t3) => t3.id);
Array.from(i.checkDialogSearchResultElm.children, (t3, e3) => {
if (e3 === i.checkDialogSearchResultElm.children.length - 1) domItVisible(t3, 0 === n2.length);
else {
const e4 = t3.getAttribute("data-set-id");
domItVisible(t3, -1 !== n2.indexOf(e4), "flex");
}
}), domItVisible(i.checkDialogSearchResultElm, true);
}, 200);
i.checkDialogSearchInputElm.oninput = a, i.checkDialogSearchInputElm.onfocus = a;
}
createPCPointDialog() {
const { pcElms: t, target: e } = this;
t.pointDialogElm = document.createElement("div"), updateElmClass(t.pointDialogElm, "call-user-dialog", true), domItVisible(t.pointDialogElm);
const i = document.createElement("div");
updateElmClass(i, "call-user-dialog-header", true), i.innerHTML = ``, t.pointDialogCheckElm = document.createElement("span"), updateElmClass(t.pointDialogCheckElm, "call-user-dialog-header-check", true), t.pointDialogCheckElm.innerText = e.options.dialogLabels.pcPointDialog.checkLabel, t.pointDialogCheckElm.onclick = () => {
this.target.showPCCheckDialog(), this.isExternalCallPopup = false;
}, i.appendChild(t.pointDialogCheckElm), t.pointDialogElm.appendChild(i), t.pointDialogMainElm = document.createElement("div"), updateElmClass(t.pointDialogMainElm, "call-user-dialog-main", true), t.pointDialogElm.appendChild(t.pointDialogMainElm), e.options.asyncMatch && (t.pointDialogLoadingElm = document.createElement("div"), updateElmClass(t.pointDialogLoadingElm, "call-user-dialog-loading", true), t.pointDialogLoadingElm.innerHTML = antdLoading, t.pointDialogElm.appendChild(t.pointDialogLoadingElm), domItVisible(t.pointDialogLoadingElm), t.pointDialogEmptyElm = document.createElement("div"), updateElmClass(t.pointDialogEmptyElm, "call-user-dialog-empty", true), t.pointDialogEmptyElm.innerHTML = `
${matchEmptySvg}
${e.options.dialogLabels.pcPointDialog.emptyLabel}
`, t.pointDialogElm.appendChild(t.pointDialogEmptyElm), domItVisible(t.pointDialogEmptyElm)), t.containerDialogElm.appendChild(t.pointDialogElm);
}
createH5Dialog() {
const { options: t, chatEvent: e } = this.target, { needDialog: i, dialogLabels: n } = t;
if (!i) return;
const { h5Elms: s } = this;
s.dialogElm = document.createElement("div"), updateElmClass(s.dialogElm, "call-user-popup", true), s.dialogElm.innerHTML = `
`;
const a = async () => {
s.dialogElm.className = s.dialogElm.className.replace(/ chat-view-show/g, " chat-view-hidden"), s.dialogSearchElm.value = "", await sleep(260), domItVisible(s.dialogElm), updateElmClass(document.body, "disable-scroll"), t.asyncMatch && this.target.updateUserList([]), this.target.chatInput.restCursorPos(this.target.chatInput.vnode, this.target.chatInput.cursorIndex), this.target.chatInput.viewIntoPoint();
};
s.dialogElm.onclick = a;
const l = s.dialogElm.querySelector(".call-user-popup-main");
l.onclick = (t2) => {
t2.stopPropagation();
}, s.dialogShowElm = s.dialogElm.querySelector(".popup-show"), s.dialogShowElm.onclick = a, s.dialogCheckElm = s.dialogElm.querySelector(".popup-check"), s.dialogCheckElm.onclick = async () => {
if (s.dialogCheckElm.classList.contains("disabled")) return;
const e2 = s.dialogElm.querySelectorAll(".user-popup-check-item-check") || [];
if (0 === e2.length) return void await a();
if (Array.prototype.some.call(e2, (t2) => "isALL" === t2.getAttribute("data-set-id"))) return await this.target.onceSetTag({ [t.userProps.id]: "isALL", [t.userProps.name]: t.dialogLabels.h5Dialog.callEveryLabel }), void await a();
const i2 = Array.from(e2, (t2) => t2.getAttribute("data-set-id")), n2 = t.userList.filter((e3) => -1 !== i2.indexOf(String(e3[t.userProps.id])));
await this.target.batchSetTag(n2), await a();
}, s.dialogMainElm = s.dialogElm.querySelector(".call-user-popup-body"), s.dialogEmptyElm = document.createElement("div"), updateElmClass(s.dialogEmptyElm, "call-user-popup-empty", true), this.h5Elms.dialogEmptyElm.innerHTML = `
${searchEmptySvg}
${t.dialogLabels.h5Dialog.searchEmptyLabel}
`, domItVisible(s.dialogEmptyElm), l.appendChild(s.dialogEmptyElm), t.asyncMatch && (s.dialogLoadingElm = document.createElement("div"), updateElmClass(s.dialogLoadingElm, "call-user-popup-loading", true), s.dialogLoadingElm.innerHTML = antdLoading, domItVisible(s.dialogLoadingElm), l.appendChild(s.dialogLoadingElm)), s.dialogSearchElm = s.dialogElm.querySelector(".call-user-popup-search-input"), s.dialogSearchElm.oninput = debounce3((i2) => {
const n2 = String(i2.target.value || "").replace(/'/g, "").trim();
if (t.asyncMatch) {
e.matchKey++;
const t2 = e.matchKey;
this.target.updateUserList([]), domItVisible(s.dialogLoadingElm, true), domItVisible(s.dialogEmptyElm);
const i3 = e.triggerChatEvent("atMatch", n2).find((t3) => t3 && t3 instanceof Promise);
return void (i3 && i3.then((i4) => {
t2 === e.matchKey && (domItVisible(s.dialogLoadingElm), !i4 || i4.length <= 0 ? domItVisible(s.dialogEmptyElm, true, "flex") : this.target.updateUserList(i4));
}));
}
const a2 = [];
Array.from(this.h5Elms.dialogMainElm.children, (t2) => {
if (!n2) return domItVisible(t2, true, "flex"), void a2.push(t2);
pinyinMatch(t2.getAttribute("data-set-name") || "", t2.getAttribute("data-set-pinyin") || "", n2) ? (domItVisible(t2, true, "flex"), a2.push(t2)) : domItVisible(t2);
}), domItVisible(this.h5Elms.dialogEmptyElm, !a2.length, "flex");
}, 200), domItVisible(s.dialogElm), document.body.appendChild(s.dialogElm);
}
updatePCUser() {
const { pcElms: t, target: e } = this;
t.pointDialogMainElm.innerHTML = "", t.pointDialogActiveElm = void 0;
const i = document.createDocumentFragment();
if (this.target.options.needCallEvery) {
const t2 = document.createElement("div");
updateElmClass(t2, "call-user-dialog-item", true), t2.setAttribute("data-set-id", "isALL"), this.userSelectStyleAndEvent(t2, { id: "isALL", name: e.options.dialogLabels.pcPointDialog.callEveryLabel }), t2.innerHTML = `
@
${e.options.dialogLabels.pcPointDialog.callEveryLabel}(${e.options.reformList.length})
`, i.appendChild(t2);
}
if (e.options.reformList.forEach((t2) => {
const e2 = document.createElement("div");
updateElmClass(e2, "call-user-dialog-item", true), e2.setAttribute("data-set-id", t2.id), this.userSelectStyleAndEvent(e2, t2), this.getUserHtmlTemplate(e2, t2), i.appendChild(e2);
}), t.pointDialogMainElm.appendChild(i), t.pointDialogUsersElm = [], Array.from(t.pointDialogMainElm.children || [], (e2, i2) => {
t.pointDialogUsersElm.push({ index: i2, elm: e2 });
}), e.options.asyncMatch) return;
t.checkDialogUsersElm.innerHTML = `
`;
const n = document.createDocumentFragment();
e.options.reformList.forEach((t2) => {
const e2 = document.createElement("div");
updateElmClass(e2, "checkbox-dialog-check-item", true), e2.setAttribute("data-set-value", t2.id), e2.innerHTML = '\n \n \n ', this.getUserHtmlTemplate(e2, t2), n.appendChild(e2);
}), t.checkDialogUsersElm.appendChild(n), t.checkDialogUsersElm && t.checkDialogUsersElm.children.length && Array.from(t.checkDialogUsersElm.children, (t2) => {
t2.onclick = () => {
const i2 = t2.getAttribute("data-set-value") || "", n2 = e.options.reformList.find((t3) => t3.id === i2), s2 = -1 === t2.className.indexOf("checkbox-dialog-check-item-check");
"ALL" === i2 ? this.checkboxRows = s2 ? e.options.reformList.map((t3) => t3) : [] : s2 ? this.checkboxRows.push(n2) : this.checkboxRows = this.checkboxRows.filter((t3) => t3.id !== i2), this.updateCheckDialogTags();
};
}), t.checkDialogSearchResultElm.innerHTML = "";
const s = document.createDocumentFragment();
e.options.reformList.forEach((t2) => {
const i2 = document.createElement("div");
updateElmClass(i2, "checkbox-dialog-check-item", true), i2.setAttribute("data-set-id", t2.id);
const n2 = document.createElement("div");
updateElmClass(n2, "checkbox-dialog-check-item-label", true), this.getUserHtmlTemplate(n2, t2), i2.appendChild(n2), i2.onclick = () => {
domItVisible(this.pcElms.checkDialogSearchResultElm);
const t3 = i2.getAttribute("data-set-id") || "";
if (this.pcElms.checkDialogSearchInputElm.value = "", this.pcElms.checkDialogSearchInputElm.focus(), this.checkboxRows.some((e2) => e2.id === t3)) return;
const n3 = e.options.reformList.find((e2) => e2.id === t3);
n3 && this.checkboxRows.push(n3), this.updateCheckDialogTags();
}, s.appendChild(i2);
});
const a = document.createElement("div");
updateElmClass(a, "checkbox-dialog-search-empty", true), a.innerText = e.options.dialogLabels.pcPCheckDialog.searchEmptyLabel, s.appendChild(a), t.checkDialogSearchResultElm.appendChild(s);
}
updateH5User() {
const { h5Elms: t, target: e } = this;
t.dialogMainElm.innerHTML = "";
const i = e.options.reformList && e.options.reformList.length > 0, n = document.createDocumentFragment(), s = document.createElement("span");
if (s.innerHTML = '\n \n \n ', i) {
const t2 = document.createElement("div");
e.options.needCallEvery && (updateElmClass(t2, "call-user-popup-item", true), t2.setAttribute("data-set-id", "isALL"), t2.innerHTML = `
@
${e.options.dialogLabels.h5Dialog.callEveryLabel}(${e.options.reformList.length})
`, t2.appendChild(s.cloneNode(true)), t2.onclick = () => {
const e2 = !t2.classList.contains("user-popup-check-item-check");
Array.from(this.h5Elms.dialogMainElm.children, (t3) => {
updateElmClass(t3, "user-popup-check-item-check", e2);
}), updateElmClass(this.h5Elms.dialogCheckElm, "disabled", !e2);
}, n.appendChild(t2)), e.options.reformList.forEach((e2, i2) => {
const a = document.createElement("div");
updateElmClass(a, "call-user-popup-item", true), a.setAttribute("data-set-id", e2.id), a.setAttribute("data-set-name", e2.name), a.setAttribute("data-set-pinyin", e2.pinyin || ""), this.getUserHtmlTemplate(a, e2), a.appendChild(s.cloneNode(true)), n.appendChild(a), a.onclick = (e3) => {
const i3 = !a.classList.contains("user-popup-check-item-check");
updateElmClass(a, "user-popup-check-item-check", i3);
const n2 = Array.prototype.every.call(this.h5Elms.dialogMainElm.children, (t3) => t3.classList.contains("user-popup-check-item-check") || "isALL" === t3.getAttribute("data-set-id"));
updateElmClass(t2, "user-popup-check-item-check", n2);
const s2 = Array.prototype.some.call(this.h5Elms.dialogMainElm.children, (t3) => t3.classList.contains("user-popup-check-item-check"));
updateElmClass(this.h5Elms.dialogCheckElm, "disabled", !s2);
};
});
}
t.dialogMainElm.appendChild(n);
}
updateCheckDialogTags() {
const t = this.checkboxRows.map((t2) => t2.id), e = [], i = [], n = document.createElement("div");
n.className = "check-empty", n.innerHTML = `
${checkEmptySvg}
${this.target.options.dialogLabels.pcPCheckDialog.checkEmptyLabel}
`, Array.from(this.pcElms.checkDialogTagsElm.children, (n2) => {
const s2 = n2.getAttribute("data-set-value");
-1 === t.indexOf(s2) ? i.push(n2) : e.push(s2);
}), Array.from(this.pcElms.checkDialogUsersElm.children, (e2, i2) => {
if (0 === i2) return void updateElmClass(e2, "checkbox-dialog-check-item-check", t.length === this.target.options.reformList.length);
const n2 = e2.getAttribute("data-set-value");
updateElmClass(e2, "checkbox-dialog-check-item-check", -1 !== t.indexOf(n2));
}), i.forEach((t2) => {
this.pcElms.checkDialogTagsElm.removeChild(t2);
});
updateElmClass(this.pcElms.checkDialogElm.querySelector(".btn-submit"), "disabled", t.length <= 0), t.length || this.pcElms.checkDialogTagsElm.appendChild(n);
const s = this.checkboxRows.filter((t2) => -1 === e.indexOf(t2.id));
if (!s.length) return;
const a = document.createDocumentFragment();
s.forEach((t2) => {
const e2 = document.createElement("div");
e2.setAttribute("class", "checkbox-dialog-tag-item"), e2.setAttribute("data-set-value", t2.id), e2.innerHTML = `
${t2.name}
`;
const i2 = document.createElement("span");
i2.setAttribute("class", "checkbox-dialog-tag-item-close"), i2.innerHTML = "⛌", i2.onclick = () => {
const t3 = e2.getAttribute("data-set-value");
this.checkboxRows = this.checkboxRows.filter((e3) => e3.id !== t3), this.updateCheckDialogTags();
}, e2.appendChild(i2), a.appendChild(e2);
}), this.pcElms.checkDialogTagsElm.appendChild(a);
}
userSelectStyleAndEvent(t, e) {
t.addEventListener("click", async (i) => {
const { options: n } = this.target;
if (i.stopPropagation(), this.updatePointActiveUserElm(t), this.isPointSearchMode || n.asyncMatch) await this.target.matchSetTag(e);
else {
const t2 = n.userList.find((t3) => String(t3[n.userProps.id]) === e.id);
await this.target.onceSetTag(t2);
}
this.exitPointDialog();
});
}
bindCustomTrigger() {
Object.values(this.pcElms.customTagDialogElms).forEach((t) => {
this.pcElms.containerDialogElm.removeChild(t);
}), this.pcElms.customTagDialogElms = {}, this.customTags = {}, this.target.options.customTrigger.forEach((t) => {
t.tagList && t.tagList.length > 0 && (this.customTags[t.prefix] = t.tagList.map((t2) => ({ id: String(t2.id), name: String(t2.name), pinyin: String(t2.pinyin || "") })), this.createCustomTagDialog(t));
});
}
createCustomTagDialog(t) {
const e = document.createElement("div");
e.setAttribute("class", "call-tag-dialog"), domItVisible(e);
const i = document.createElement("div");
i.setAttribute("class", "call-tag-dialog-header"), i.innerHTML = ``, e.appendChild(i);
const n = document.createElement("div");
n.setAttribute("class", "call-tag-dialog-main"), t.tagList.forEach((t2) => {
const e2 = document.createElement("div");
e2.setAttribute("class", "call-tag-dialog-item"), e2.setAttribute("data-set-id", t2.id);
const i2 = document.createElement("span");
i2.setAttribute("class", "call-tag-dialog-item-name"), i2.innerHTML = t2.name, e2.appendChild(i2), e2.addEventListener("click", async (i3) => {
i3.stopPropagation(), this.updateActiveCustomTagElm(e2), this.isPointSearchMode ? await this.target.matchSetCustomTag(t2) : await this.target.onceSetCustomTag(t2), this.exitCustomTagDialog();
}), n.appendChild(e2);
}), e.appendChild(n), this.pcElms.containerDialogElm.appendChild(e), this.pcElms.customTagDialogElms[t.prefix] = e;
}
getUserHtmlTemplate(t, e) {
const i = document.createElement("span");
if (i.setAttribute("class", "call-user-dialog-item-sculpture " + (e.avatar ? "is-avatar" : "")), e.avatar) {
const t2 = new Image();
t2.alt = "", t2.src = String(e.avatar), i.appendChild(t2);
} else i.innerHTML = `${e.name.slice(-2)}`;
t.appendChild(i);
const n = document.createElement("span");
n.setAttribute("class", "call-user-dialog-item-name"), n.innerHTML = e.name, t.appendChild(n);
}
updatePointActiveUserElm(t, e = false) {
if (this.pcElms.pointDialogActiveElm && updateElmClass(this.pcElms.pointDialogActiveElm, "call-user-dialog-item-active"), this.pcElms.pointDialogActiveElm = t, t && (updateElmClass(t, "call-user-dialog-item-active", true), e)) {
const e2 = Array.prototype.filter.call(this.pcElms.pointDialogMainElm.children, (t2) => -1 === t2.className.indexOf("user-no-match")), i = t.clientHeight, n = Array.prototype.indexOf.call(e2, t) + 1 - Math.ceil(Math.floor(this.pcElms.pointDialogMainElm.clientHeight / i) / 2);
this.pcElms.pointDialogMainElm.scrollTop = n > 0 ? n * i : 0;
}
}
updateActiveCustomTagElm(t, e = false) {
if (this.pcElms.customTagDialogActiveElm && updateElmClass(this.pcElms.customTagDialogActiveElm, "call-tag-dialog-item-active"), this.pcElms.customTagDialogActiveElm = t, t && (updateElmClass(t, "call-tag-dialog-item-active", true), e)) {
const e2 = this.pcElms.customTagDialogElms[this.pcElms.customTagDialogTagKey].children[1], i = Array.prototype.filter.call(e2.children, (t2) => -1 === t2.className.indexOf("tag-no-match")), n = t.clientHeight, s = Array.prototype.indexOf.call(i, t) + 1 - Math.ceil(Math.floor(e2.clientHeight / n) / 2);
e2.scrollTop = s > 0 ? s * n : 0;
}
}
showPointDialog(t) {
this.exitSelectDialog(), this.exitCustomTagDialog(), this.exitPointDialog(), this.isPointSearchMode = !!t;
let e = null;
this.pcElms.pointDialogUsersElm.forEach((i) => {
const n = i.elm, s = n.getAttribute("data-set-id"), a = t && t.every((t2) => t2.id !== s);
e || a || (e = n), updateElmClass(n, "user-no-match", a);
}), null !== e && this.updatePointActiveUserElm(e), domItVisible(this.pcElms.pointDialogCheckElm, !this.target.options.asyncMatch && !this.isPointSearchMode), domItVisible(this.pcElms.pointDialogElm, true), this.target.chatEvent.debounceEvents.dialogMoveToRange(this.pcElms.pointDialogElm), this.pcElms.pointDialogMainElm.scrollTop = 0;
}
showCustomTagDialog(t, e) {
this.exitSelectDialog(), this.exitCustomTagDialog(), this.exitPointDialog(), this.isPointSearchMode = !!e, this.pcElms.customTagDialogTagKey = t;
const i = this.pcElms.customTagDialogElms[t], n = i.children[1];
let s = null;
Array.from(n.children, (t2) => {
const i2 = t2.getAttribute("data-set-id"), n2 = e && e.every((t3) => t3.id !== i2);
s || n2 || (s = t2), updateElmClass(t2, "tag-no-match", n2);
}), null !== s && this.updateActiveCustomTagElm(s), domItVisible(i, true), this.target.chatEvent.debounceEvents.dialogMoveToRange(i), i.children[1].scrollTop = 0;
}
exitPointDialog() {
this.updatePointActiveUserElm(), this.target.options.asyncMatch && this.target.updateUserList([]), domItVisible(this.pcElms.pointDialogElm);
}
exitCustomTagDialog() {
this.updateActiveCustomTagElm();
for (const t in this.pcElms.customTagDialogElms) domItVisible(this.pcElms.customTagDialogElms[t]);
}
ruleShowPointDialog() {
const { options: t } = this.target;
t.needDialog && t.reformList.length > 0 && (this.isExternalCallPopup = false, this.showPointDialog());
}
showPlaceholder() {
domItVisible(this.placeholderElm, this.target.isEmpty()), this.offsetTipElm();
}
bindSelectList() {
Object.values(this.pcElms.selectDialogElms).forEach((t) => {
this.pcElms.containerDialogElm.removeChild(t);
}), this.pcElms.selectDialogElms = {}, this.selectTags = {}, this.target.options.selectList.forEach((t) => {
t.options && t.options.length > 0 && (this.selectTags[t.key] = t.options.map((t2) => ({ id: String(t2.id), name: String(t2.name), preview: String(t2.preview || "") })), this.createSelectDialog(t));
});
}
createSelectDialog(t) {
const e = document.createElement("div");
e.setAttribute("class", "chat-select-dialog"), domItVisible(e);
const i = document.createElement("div");
i.setAttribute("class", "chat-select-dialog-header"), i.innerHTML = ``, e.appendChild(i);
const n = document.createElement("div");
n.setAttribute("class", "chat-select-dialog-main"), t.options.forEach((t2) => {
const e2 = document.createElement("div");
if (e2.setAttribute("class", "chat-select-dialog-item"), e2.setAttribute("data-set-id", t2.id), t2.preview) {
const i3 = document.createElement("img");
i3.setAttribute("class", "chat-select-dialog-preview"), i3.src = String(t2.preview), e2.appendChild(i3);
}
const i2 = document.createElement("span");
i2.setAttribute("class", "chat-select-dialog-name"), i2.textContent = t2.name;
const s2 = document.createElement("span");
s2.setAttribute("class", "chat-select-dialog-check"), s2.innerHTML = checkSvg, domItVisible(s2), i2.appendChild(s2), e2.appendChild(i2), e2.onclick = async () => {
await this.target.setSelectTag(t2);
}, n.appendChild(e2);
}), e.appendChild(n);
const s = document.createElement("div");
s.setAttribute("class", "chat-select-arrow"), e.appendChild(s), this.pcElms.containerDialogElm.appendChild(e), this.pcElms.selectDialogElms[t.key] = e;
}
exitSelectDialog() {
for (const t in this.pcElms.selectDialogElms) domItVisible(this.pcElms.selectDialogElms[t]);
this.pcElms.selectDialogKey = "", this.pcElms.selectDialogAim && (updateElmClass(this.pcElms.selectDialogAim, "aim"), this.pcElms.selectDialogAim = null);
}
createTipElm(t) {
this.tipElm || (this.tipElm = document.createElement("div")), updateElmClass(this.tipElm, "chat-tip-wrap", true), this.tipElm.innerHTML = `
${t.tagLabel || "--"}
${this.target.deviceInfo.isPc ? closeSvg : ""}
`, this.target.options.elm.appendChild(this.tipElm);
const e = this.tipElm.children[0], i = (e.clientHeight - this.target.chatInput.NODE_HEIGHT) / 2;
this.tipElm.style.top = `-${i}px`, e.onclick = () => {
this.target.deviceInfo.isPc && this.target.closeTipTag();
}, e.onmouseenter = () => {
if (this.pcElms.tipContainerPopoverElm && this.pcElms.tipPopoverElm) {
domItVisible(this.pcElms.tipPopoverElm, true);
const t2 = this.pcElms.tipContainerPopoverElm.getBoundingClientRect();
this.rects.tipRect = this.tipElm.getBoundingClientRect();
const i2 = (this.pcElms.tipPopoverElm.clientWidth - (this.tipElm.clientWidth + (this.tipElm.clientWidth - e.clientWidth))) / 2;
this.pcElms.tipPopoverElm.style.left = -i2 + "px", this.pcElms.tipPopoverElm.style.bottom = t2.y - this.rects.tipRect.y + "px", this.pcElms.tipPopoverElm.style.transform = e.style.transform;
}
}, e.onmouseleave = () => {
this.pcElms.tipPopoverElm && domItVisible(this.pcElms.tipPopoverElm);
};
const n = this.richText.children[0].children[0];
this.rects.tipRect = this.tipElm.getBoundingClientRect();
const s = this.rects.tipRect;
if (this.placeholderElm.style.paddingLeft = s.width + "px", n.style.paddingLeft = s.width - n.offsetLeft + "px", this.offsetTipElm(), this.target.deviceInfo.isPc) {
this.pcElms.tipContainerPopoverElm || (this.pcElms.tipContainerPopoverElm = document.createElement("div"), updateElmClass(this.pcElms.tipContainerPopoverElm, "chat-tip-dialog", true)), this.pcElms.tipPopoverElm || (this.pcElms.tipPopoverElm = document.createElement("div")), updateElmClass(this.pcElms.tipPopoverElm, "chat-tip-popover", true), this.pcElms.tipPopoverElm.innerHTML = `
${t.popoverLabel || "--"}
${t.codeLabel || "--"}
`, this.pcElms.tipContainerPopoverElm.appendChild(this.pcElms.tipPopoverElm), domItVisible(this.pcElms.tipPopoverElm);
const { elm: e2 } = this.target.options;
e2.parentElement && (e2.nextElementSibling ? e2.parentElement.insertBefore(this.pcElms.tipContainerPopoverElm, e2.nextElementSibling) : e2.parentElement.appendChild(this.pcElms.tipContainerPopoverElm));
}
this.target.chatEvent.triggerChatEvent("tipTagState", true);
}
offsetTipElm() {
if (this.tipElm) {
const t = this.richText.children[0].children[0];
t.style.paddingLeft = this.rects.tipRect.width - t.offsetLeft + "px", this.target.nextTick(() => {
if (this.tipElm) {
const t2 = this.tipElm.children[0], e = this.richText.children[0].children[0];
t2.style.transform = `translateY(${e.offsetTop - this.target.chatInput.NODE_PADDING_DIFF}px)`;
}
});
}
}
removeTipElm() {
this.tipElm && (this.target.options.elm.removeChild(this.tipElm), this.tipElm = null), this.pcElms.tipContainerPopoverElm && (this.pcElms.tipContainerPopoverElm.removeChild(this.pcElms.tipPopoverElm), this.target.options.elm.parentElement.removeChild(this.pcElms.tipContainerPopoverElm), this.pcElms.tipContainerPopoverElm = null, this.pcElms.tipPopoverElm = null);
const t = this.richText.children[0].children[0];
this.placeholderElm.style.removeProperty("padding-left"), t.style.removeProperty("padding-left"), this.target.chatInput.setRangeLastText(), this.target.chatEvent.triggerChatEvent("tipTagState", false);
}
};
var ChatInput = class {
constructor(t) {
__publicField(this, "target"), __publicField(this, "richText"), __publicField(this, "vnode"), __publicField(this, "cursorIndex"), __publicField(this, "cursorLeft"), __publicField(this, "needCallSpace", false), __publicField(this, "VOID_KEY", "\uFEFF"), __publicField(this, "ZERO_WIDTH_KEY", ""), __publicField(this, "INPUT_TAG_WRAP_KEY", "\n"), __publicField(this, "NODE_HEIGHT", 24), __publicField(this, "NODE_PADDING_DIFF", 10), __publicField(this, "IME_RECORD", { MARK: void 0, GRID: void 0, TAG: void 0, NODE: void 0, INDEX: void 0 }), this.target = t, this.richText = t.chatElement.richText, this.initEditor();
}
initEditor(t = false, e) {
if (t || this.getNodeEmpty(this.richText)) {
this.richText.innerHTML = "";
const i = this.getGridElm();
this.richText.appendChild(i);
const n = i.children[0].children[0];
e && (n.textContent = e, n.setAttribute("data-set-empty", "false"));
const s = n.childNodes[0];
t || this.target.options.autoFocus ? this.restCursorPos(s, s.textContent === this.VOID_KEY ? 1 : s.textContent.length) : (this.vnode = s, this.cursorIndex = s.textContent === this.VOID_KEY ? 1 : s.textContent.length), this.target.nextTick(() => {
const t2 = i.getBoundingClientRect();
this.NODE_HEIGHT = t2.height, this.NODE_PADDING_DIFF = t2.top - this.target.options.elm.getBoundingClientRect().top;
});
}
}
onceCall(t) {
return new Promise((e) => {
const i = this.createChatTagElm(t, "@", "at-user", "user-id");
this.replaceRegContent(i), e();
});
}
onceSearchCall(t, e) {
return new Promise((i) => {
const n = this.createChatTagElm(t, "@", "at-user", "user-id");
this.replaceRegContent(n, e), i();
});
}
onceCustomCall(t, e, i) {
return new Promise((n) => {
const s = this.createChatTagElm(t, i, "at-tag", "tag-id");
s.children[0].setAttribute("data-set-prefix", i), this.replaceRegContent(s, e), n();
});
}
upDataNodeOrIndex() {
var t, e, i;
const { focusNode: n, focusOffset: s, anchorOffset: a } = window.getSelection(), l = (null == n ? void 0 : n.parentNode) || void 0;
if (!l || !l.getAttribute || l.getAttribute("data-set-richType") !== RICH_INPUT) return;
(null == (i = null == (e = null == (t = null == n ? void 0 : n.parentNode) ? void 0 : t.parentNode) ? void 0 : e.parentNode) ? void 0 : i.parentNode) === this.richText && (this.vnode = n, this.cursorIndex = s, this.cursorLeft = a < s ? a : s);
}
keyUpAsKey(t) {
if (this.upDataNodeOrIndex(), !this.vnode || this.vnode.nodeType !== Node.TEXT_NODE) return false;
const e = this.vnode.textContent || "", i = new RegExp(`${t}([^${t}\\s]*)$`), n = e.slice(0, this.cursorIndex), s = i.exec(n);
return s && 2 === s.length && n[n.length - 1] === t;
}
getRangeRect() {
let t = 0, e = 0;
const i = window.getSelection();
if (i.focusNode.nodeType !== Node.TEXT_NODE) return null;
const n = i.getRangeAt(0).getClientRects()[0];
return n && (t = n.x, e = n.y), { x: t, y: e };
}
createChatTagElm(t, e, i, n) {
const s = document.createElement("span");
return s.className = i, s.setAttribute(`data-${n}`, String(t.id)), s.textContent = `${e}${t.name}${this.needCallSpace ? " " : ""}`, this.createNewDom(s);
}
createNewDom(t) {
const e = document.createElement("span");
return e.className = "chat-tag", e.setAttribute("contenteditable", "false"), e.setAttribute("data-set-richType", RICH_TAG), e.appendChild(t), e;
}
restCursorPos(t, e) {
null == e ? e = t.textContent === this.VOID_KEY ? 1 : 0 : e > t.textContent.length && (e = t.textContent.length);
const i = new Range();
i.setStart(t, e), i.setEnd(t, e);
const n = window.getSelection();
n && (this.vnode = t, this.cursorIndex = e, this.cursorLeft = e, n.removeAllRanges(), n.addRange(i));
}
replaceRegContent(t, e = true) {
const i = this.vnode.textContent;
let n;
n = "boolean" == typeof e ? i.slice(0, e ? this.cursorIndex - 1 : this.cursorIndex) : i.slice(0, e - 1), 0 === n.length ? (this.vnode.parentElement.setAttribute("data-set-empty", "true"), this.vnode.textContent = this.VOID_KEY) : this.vnode.textContent = n;
let s = i.slice(this.cursorIndex);
const a = this.vnode.parentNode.parentNode, l = a.nextSibling;
l ? a.parentNode.insertBefore(t, l) : a.parentNode.appendChild(t);
const o = t.previousSibling.childNodes[0], r = o.childNodes[1];
r && o.removeChild(r);
const c = this.getGridElm(true), h2 = c.childNodes[0];
s && s !== this.VOID_KEY && (h2.setAttribute("data-set-empty", "false"), h2.innerHTML = s);
const d = h2.childNodes[1];
t.nextSibling ? (d && h2.removeChild(d), a.parentNode.insertBefore(c, t.nextSibling)) : a.parentNode.appendChild(c), this.restCursorPos(h2.childNodes[0]);
}
batchReplaceRegContent(t = [], e = true) {
return new Promise((i) => {
let n = `${this.VOID_KEY}`;
t.forEach((t2) => {
n += `@${t2.name}${this.needCallSpace ? " " : ""}${this.VOID_KEY}`;
});
const s = document.createElement("div");
s.innerHTML = n, this.insetRangeGrid(s, e ? 1 : 0), i();
});
}
switchRange(t) {
var e, i;
let { focusNode: n, focusOffset: s } = window.getSelection();
n.getAttribute && n.getAttribute("data-set-richType") === RICH_INPUT && (n = n.childNodes[0]);
let a, l, o = false;
if (n.nodeType === Node.TEXT_NODE) {
const r = n.textContent.length, c = n.parentNode.parentNode;
switch (t) {
case "ArrowLeft":
if (s > 0 && n.textContent !== this.VOID_KEY) {
l = s - 1, a = n;
break;
}
const t2 = c.previousSibling;
if (t2 && t2.children[0].classList.contains("at-input")) {
a = t2.children[0].children[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : a.textContent.length, o = true;
break;
}
const h2 = null == (e = null == c ? void 0 : c.previousSibling) ? void 0 : e.previousSibling;
if (h2) a = h2.childNodes[0].childNodes[0], l = a.textContent.length;
else {
const t3 = c.parentNode.previousSibling;
if (t3) {
a = t3.lastChild.childNodes[0].childNodes[0], l = a.textContent.length;
}
}
break;
case "ArrowRight":
if (s < r && n.textContent !== this.VOID_KEY) {
l = s + 1, a = n;
break;
}
const d = c.nextSibling;
if (d && d.children[0].classList.contains("at-input")) {
a = d.children[0].children[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : 0, o = true;
break;
}
const p2 = null == (i = null == c ? void 0 : c.nextSibling) ? void 0 : i.nextSibling;
if (p2) a = p2.childNodes[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : 0;
else {
const t3 = c.parentNode.nextSibling;
t3 && (a = t3.childNodes[0].childNodes[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : 0);
}
}
}
(l || 0 === l) && (o ? this.setInputTagRange(a, l) : this.restCursorPos(a, l));
}
getGridElm(t = false) {
const e = document.createElement("span");
if (e.setAttribute("data-set-richType", RICH_MARK), e.innerHTML = `${this.VOID_KEY}
`, t) return e;
const i = document.createElement("p");
return i.className = "chat-grid-wrap", i.setAttribute("data-set-richType", RICH_GRID), i.appendChild(e), i;
}
updateGrid() {
const t = window.getSelection(), e = t.focusNode;
if (!e) return;
const i = e.parentNode;
let n, s, a, l;
switch (i.getAttribute("data-set-richType")) {
case RICH_WRAP:
if (n = e.childNodes[t.focusOffset], !n || n.getAttribute("data-set-richType") === RICH_TAG) {
const t2 = this.getGridElm(true), i2 = t2.children[0];
n ? (i2.removeChild(i2.childNodes[1]), e.insertBefore(t2, n)) : e.appendChild(t2), this.restCursorPos(i2.childNodes[0]);
break;
}
if (n.tagName && "BR" === n.tagName.toLocaleUpperCase()) {
const t2 = this.getGridElm(true), i2 = t2.children[0];
e.insertBefore(t2, n), e.removeChild(n), this.restCursorPos(i2.childNodes[0], i2.childNodes[0].textContent.length);
}
break;
case RICH_MARK:
const o = i.parentNode, r = Array.prototype.indexOf.call(o.childNodes, i);
if (-1 === r) break;
if (0 === r) {
const e2 = t.focusNode;
e2.setAttribute("data-set-empty", "true"), e2.innerHTML = `${this.VOID_KEY}
`, n = e2.childNodes[0], this.restCursorPos(n, n.textContent.length);
break;
}
let c, h2 = i.previousSibling;
h2.getAttribute("data-set-richType") === RICH_TAG ? (c = h2.previousSibling, o.removeChild(h2), o.removeChild(i)) : (c = i.previousSibling, o.removeChild(i));
n = c.childNodes[0].childNodes[0], n.textContent === this.VOID_KEY && n.parentNode.appendChild(document.createElement("br")), this.restCursorPos(n, n.textContent.length);
break;
case RICH_INPUT:
if (l = i.parentNode, a = l.parentNode, this.getNodeEmpty(i)) {
i.setAttribute("data-set-empty", "true"), a.childNodes[a.childNodes.length - 1] === l && (i.innerHTML = `${this.VOID_KEY}
`), n = i.childNodes[0], this.restCursorPos(n, n.textContent.length);
break;
}
if ("true" === String(i.getAttribute("data-set-empty"))) {
i.setAttribute("data-set-empty", "false"), n = i.childNodes[0], this.target.chatEvent.isIMEModel ? (i.childNodes[1] && i.removeChild(i.childNodes[1]), n.textContent === this.VOID_KEY && i.setAttribute("data-set-empty", "true")) : i.textContent = n.textContent.replace(new RegExp(this.VOID_KEY, "g"), "");
const t2 = i.childNodes[0];
this.restCursorPos(t2, t2.textContent.length);
}
if (s = i.parentNode.nextSibling, s && s.nodeType === Node.TEXT_NODE) {
let t2 = s.textContent, e2 = this.getGridElm(true);
e2.childNodes[0].textContent = t2, e2.childNodes[0].setAttribute("data-set-empty", "false"), s.parentNode.insertBefore(e2, s), s.parentNode.removeChild(s), s = e2;
}
s && s.getAttribute("data-set-richType") === RICH_MARK && this.markMerge(i.parentNode, s);
}
}
getNodeEmpty(t) {
const e = new RegExp(`^(${this.ZERO_WIDTH_KEY}|
|${this.VOID_KEY})+$`);
return !t.innerHTML || e.test(t.innerHTML);
}
setWrap(t = true) {
const e = window.getSelection();
let { focusNode: i, focusOffset: n } = e;
if (i.nodeType !== Node.TEXT_NODE) {
if (!i.getAttribute || i.getAttribute("data-set-richType") !== RICH_INPUT) return;
i = i.childNodes[0];
}
const s = i.textContent.slice(n), a = i.parentNode.parentNode, l = a.parentNode, o = Array.prototype.indexOf.call(l.childNodes, a), r = Array.prototype.slice.call(l.childNodes, o + 1), c = this.getGridElm();
let h2 = c.children[0].children[0].childNodes[0];
(s || r.length > 0) && h2.parentNode.removeChild(h2.parentNode.childNodes[1]), s && s !== this.VOID_KEY && (i.textContent = i.textContent.slice(0, n), h2.textContent = s, h2.parentElement.setAttribute("data-set-empty", "false")), r.forEach((t2) => {
l.removeChild(t2), c.appendChild(t2);
});
const d = l.lastChild.childNodes[0], p2 = c.lastChild.childNodes[0];
if (d.childNodes.length <= 1) {
const t2 = d.childNodes[0];
t2.textContent && t2.textContent !== this.VOID_KEY || (d.innerHTML = `${this.VOID_KEY}
`, d.setAttribute("data-set-empty", "true"));
}
if (p2.parentElement.getAttribute("data-set-richType") !== RICH_MARK) c.appendChild(this.getGridElm(true));
else if (p2.childNodes.length <= 1) {
const t2 = p2.childNodes[0];
t2.textContent && t2.textContent !== this.VOID_KEY || (p2.innerHTML = `${this.VOID_KEY}
`, p2.setAttribute("data-set-empty", "true"), h2 = c.children[0].children[0].childNodes[0]);
}
l.nextSibling ? this.richText.insertBefore(c, l.nextSibling) : this.richText.appendChild(c), t && this.restCursorPos(h2, h2.textContent === this.VOID_KEY ? 1 : 0);
}
selectRegionMerge() {
const t = window.getSelection();
if (t.isCollapsed || t.rangeCount <= 0) return;
const e = t.getRangeAt(0);
if (e.startContainer.nodeType === Node.TEXT_NODE && e.startContainer === e.endContainer) {
const t2 = e.startContainer;
if (t2.length === e.endOffset - e.startOffset) {
const e2 = t2.parentNode, i = e2.parentNode === e2.parentNode.parentNode.lastChild;
e2.setAttribute("data-set-empty", "true"), e2.innerHTML = "\uFEFF" + (i ? "
" : ""), this.restCursorPos(e2.childNodes[0]);
} else e.deleteContents();
} else if (e.commonAncestorContainer && e.commonAncestorContainer.getAttribute("data-set-richType") === RICH_GRID) {
const t2 = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentNode.parentNode : e.startContainer, i = e.endContainer.nodeType === Node.TEXT_NODE ? e.endContainer.parentNode.parentNode : e.endContainer;
e.deleteContents(), t2.getAttribute("data-set-richType") === i.getAttribute("data-set-richType") && this.markMerge(t2, i);
} else if (e.commonAncestorContainer === e.startContainer && e.startContainer === e.endContainer) this.initEditor(true);
else {
const t2 = (t3) => {
if (t3.nodeType === Node.TEXT_NODE) return t3.parentNode.parentNode.parentNode;
switch (t3.getAttribute("data-set-richType")) {
case RICH_INPUT:
return t3.parentNode.parentNode;
case RICH_MARK:
return t3.parentNode;
case RICH_GRID:
return t3;
default:
return null;
}
}, i = t2(e.startContainer), n = t2(e.endContainer);
if (!i || !n) return;
e.deleteContents(), this.gridMerge(i, n);
}
return true;
}
gridElmMerge() {
const t = window.getSelection(), { focusNode: e, focusOffset: i, isCollapsed: n } = t;
if (!e) return this.restCursorPos(this.vnode, this.cursorIndex), false;
if (i > 1) return false;
if (!n) return false;
const s = (t2, e2) => (t2.parentNode === this.richText || t2 === t2.parentNode.childNodes[0]) && (-1 !== Array.prototype.indexOf.call(this.richText.childNodes, t2) ? t2 : !(e2 >= 6) && s(t2.parentNode, e2 + 1)), a = s(e, 0);
if (!a || a === this.richText.childNodes[0] || 1 === i && "false" === a.children[0].children[0].getAttribute("data-set-empty")) return false;
const l = a.previousSibling;
return this.gridMerge(l, a), true;
}
delMarkRule() {
const t = window.getSelection(), e = t.focusNode;
if (!e) return this.restCursorPos(this.vnode, this.cursorIndex), false;
const i = e.textContent, n = e.parentNode, s = n.parentNode, a = s.parentNode;
if (!t.isCollapsed || n.getAttribute("data-set-richType") !== RICH_INPUT) return false;
if (i && 1 === i.length && s !== a.childNodes[0] && (0 !== t.focusOffset || i === this.VOID_KEY)) {
if (i === this.VOID_KEY) {
const t2 = s.previousSibling;
if (t2.children[0].classList.contains("at-input") && t2.children[0].children[0].textContent !== this.VOID_KEY) return this.rangeToInputTag(t2.children[0]), true;
const e2 = t2.previousSibling;
a.removeChild(t2), a.removeChild(s);
const i2 = e2.childNodes[0], n2 = i2.childNodes[0];
n2.textContent === this.VOID_KEY && e2 === a.lastChild && i2.appendChild(document.createElement("br")), this.restCursorPos(n2, n2.textContent.length);
} else {
n.innerHTML = s === a.lastChild ? `${this.VOID_KEY}
` : this.VOID_KEY, n.setAttribute("data-set-empty", "true");
const t2 = n.childNodes[0];
this.restCursorPos(t2, 1);
}
return true;
}
if (0 === t.focusOffset) {
const t2 = n.parentNode, e2 = null == t2 ? void 0 : t2.previousSibling;
return !(!e2 || e2.getAttribute("data-set-richType") !== RICH_TAG) && (e2.children[0].classList.contains("at-input") && e2.children[0].children[0].textContent !== this.VOID_KEY ? (this.rangeToInputTag(e2.children[0]), true) : (this.delTag(e2), true));
}
}
delTag(t) {
const e = t.previousSibling, i = t.nextSibling;
t.parentNode.removeChild(t), this.markMerge(e, i);
}
gridMerge(t, e, i = true) {
t.lastChild.getAttribute("data-set-richType") !== RICH_MARK && t.appendChild(this.getGridElm(true)), e.childNodes[0].getAttribute("data-set-richType") !== RICH_MARK && e.insertBefore(this.getGridElm(true), e.childNodes[0]);
const n = t.lastChild.childNodes[0], s = n.childNodes[0];
let a = s.textContent.length;
Array.from(e.childNodes, (e2) => {
t.appendChild(e2.cloneNode(true));
}), e.childNodes.length > 1 && n.childNodes[1] && n.removeChild(n.childNodes[1]);
const l = n.parentNode.nextSibling;
if (l) {
const e2 = l.children[0].childNodes[0];
e2 && e2.textContent !== this.VOID_KEY && (n.childNodes[1] && n.removeChild(n.childNodes[1]), s.textContent = (s.textContent + e2.textContent).replace(new RegExp(this.VOID_KEY, "g"), () => (a--, "")), s.parentElement.setAttribute("data-set-empty", "false")), t.removeChild(l);
}
"" === s.textContent && (s.textContent = this.VOID_KEY, s.parentNode.setAttribute("data-set-empty", "true"), a = 1), this.richText.removeChild(e), i && this.restCursorPos(s, a);
}
markMerge(t, e) {
const i = t.children[0].childNodes[0];
let n = i.textContent.length;
if (e) {
const t2 = e.children[0].childNodes[0];
t2 && t2.textContent !== this.VOID_KEY && (i.textContent = (i.textContent + t2.textContent).replace(new RegExp(this.VOID_KEY, "g"), () => (n--, "")), i.parentElement.setAttribute("data-set-empty", "false")), e.parentNode.removeChild(e);
}
"" === i.textContent && (i.textContent = this.VOID_KEY, i.parentNode.setAttribute("data-set-empty", "true"), n = 1);
const s = t.parentNode;
i.textContent === this.VOID_KEY && t === s.lastChild && (i.parentNode.appendChild(document.createElement("br")), i.parentNode.setAttribute("data-set-empty", "true"), n = 1), this.restCursorPos(i, n);
}
setCallSpace(t) {
this.needCallSpace = t;
}
getWrapNode(t, e = false) {
if (t.nodeType === Node.TEXT_NODE) return t.parentNode.parentNode.parentNode;
const i = t.getAttribute("data-set-richType");
if (e && i === RICH_TAG) return t.parentNode;
switch (i) {
case RICH_INPUT:
return t.parentNode.parentNode;
case RICH_MARK:
return t.parentNode;
case RICH_GRID:
return t;
}
}
getMarkNode(t, e = false) {
if (t.nodeType === Node.TEXT_NODE) return t.parentNode ? t.parentNode.parentNode : null;
const i = t.getAttribute("data-set-richType");
if (e && i === RICH_TAG) return t;
switch (i) {
case RICH_INPUT:
return t.parentNode;
case RICH_MARK:
return t;
}
}
getRichTextNodeIndex(t) {
const e = this.getMarkNode(t), i = e ? e.parentNode : null;
return e && i ? { gridIndex: Array.prototype.indexOf.call(this.richText.childNodes, i), markIndex: Array.prototype.indexOf.call(i.childNodes, e) } : { gridIndex: null, markIndex: null };
}
setWrapNodeByMark(t) {
const e = document.createElement("p");
return e.className = "chat-grid-wrap", e.setAttribute("data-set-richType", RICH_GRID), Array.from(t, (t2) => {
e.appendChild(t2);
}), e;
}
setRangeLastText() {
const t = this.richText.childNodes[this.richText.childNodes.length - 1], e = t.childNodes[t.childNodes.length - 1].children[0].childNodes[0];
this.restCursorPos(e, e.textContent === this.VOID_KEY ? 1 : e.textContent.length), this.viewIntoPoint();
}
viewIntoPoint() {
let t, e;
const i = window.getSelection(), { focusNode: n, focusOffset: s } = i;
if (n && n.parentElement && n.parentElement.classList.contains("input-write")) t = n.parentElement.parentElement, e = s;
else {
if (!this.vnode) return;
t = this.getMarkNode(this.vnode), e = this.cursorIndex;
}
if (!t) return;
const a = t.getBoundingClientRect(), l = Math.ceil(a.height / this.NODE_HEIGHT), o = Math.floor(t.textContent.length / l) || 1, r = (Math.floor(e / o) || 1) * this.NODE_HEIGHT, c = a.top + (r - this.NODE_HEIGHT), h2 = this.richText.parentElement, d = h2.getBoundingClientRect(), p2 = d.top, g = d.top + d.height;
if (c < p2 + this.NODE_PADDING_DIFF) {
const t2 = p2 - c;
h2.scrollTo(0, h2.scrollTop - t2);
} else if (c > g - this.NODE_HEIGHT) {
const t2 = c - g + this.NODE_HEIGHT;
h2.scrollTo(0, h2.scrollTop + t2);
}
}
insetRangeGrid(t, e = 0) {
const i = this.vnode.textContent, n = i.slice(0, this.cursorIndex - e);
0 === n.length ? (this.vnode.parentElement.setAttribute("data-set-empty", "true"), this.vnode.textContent = this.VOID_KEY) : this.vnode.textContent = n;
let s = i.slice(this.cursorIndex);
const a = [], l = document.createDocumentFragment();
Array.from(t.children).forEach((t2, e2) => {
a.push(t2), 0 !== e2 && l.appendChild(t2);
});
const o = a[a.length - 1].children[0];
s && s.length > 0 && s !== this.VOID_KEY ? (o.setAttribute("data-set-empty", "false"), o.innerHTML = o.textContent + s) : o.setAttribute("data-set-empty", "true");
const r = this.getMarkNode(this.vnode), c = r.parentElement, h2 = r.children[0], d = a[0].textContent;
d && d.length > 0 && d !== this.VOID_KEY && (h2.setAttribute("data-set-empty", "false"), h2.innerHTML = (h2.textContent + d).replace(new RegExp(this.VOID_KEY, "g"), "")), h2.childNodes[1] && h2.removeChild(h2.childNodes[1]), r.nextElementSibling ? (o.childNodes[1] && o.removeChild(o.childNodes[1]), c.insertBefore(l, r.nextElementSibling)) : c.appendChild(l);
const p2 = s && s !== this.VOID_KEY ? s.length : 0;
if (a.length > 1) {
const t2 = o.childNodes[0];
this.restCursorPos(t2, t2.textContent === this.VOID_KEY ? 1 : t2.textContent.length - p2);
} else {
const t2 = h2.childNodes[0];
this.restCursorPos(t2, t2.textContent === this.VOID_KEY ? 1 : t2.textContent.length - p2);
}
}
insetRangeGrids(t) {
const e = document.createDocumentFragment();
Array.from(t).forEach((t2) => {
e.appendChild(t2);
});
const i = this.getWrapNode(this.vnode);
this.restCursorPos(this.vnode, this.cursorIndex), this.setWrap(false);
const n = i.nextElementSibling;
n && this.richText.insertBefore(e, n);
n && n.previousElementSibling ? (this.gridMerge(i, i.nextElementSibling, false), this.gridMerge(n.previousElementSibling, n, true)) : this.gridMerge(i, i.nextElementSibling, true);
}
getOffsetRange(t, e, i = false) {
const n = e.children[0].childNodes[0], s = n.textContent;
if (0 === t) return { rangeNode: n, rangeIndex: i ? s.length : s === this.VOID_KEY ? 1 : 0 };
if (s !== this.VOID_KEY && s.length >= t) return { rangeNode: n, rangeIndex: i ? s.length - t : t };
let a, l;
if (i ? (a = Boolean(e.previousElementSibling && e.previousElementSibling.previousElementSibling), l = Boolean(e.parentElement.previousElementSibling)) : (a = Boolean(e.nextElementSibling && e.nextElementSibling.nextElementSibling), l = Boolean(e.parentElement.nextElementSibling)), !a && !l) return { rangeNode: n, rangeIndex: i ? s.length === this.VOID_KEY ? 1 : 0 : s.length === this.VOID_KEY ? 1 : s.length };
const o = t - s.length, r = i ? a ? e.previousElementSibling.previousElementSibling : e.parentElement.previousElementSibling.lastElementChild : a ? e.nextElementSibling.nextElementSibling : e.parentElement.nextElementSibling.children[0];
return this.getOffsetRange(o, r, i);
}
rangeToInputTag(t) {
const e = t.children[0].childNodes[0];
this.setInputTagRange(e, e.textContent === this.VOID_KEY ? 1 : e.textContent.length);
}
watchInputTag(t) {
if (0 === t.childNodes.length || 0 === t.textContent.length) t.textContent = this.VOID_KEY, this.rangeToInputTag(t.parentElement);
else {
const e = t.childNodes[0];
this.target.nextTick(() => {
if (!this.target.chatEvent.isComposition) {
const i = window.getSelection().focusOffset, n = t.textContent === this.VOID_KEY || -1 === t.textContent.indexOf(this.VOID_KEY) ? 0 : 1;
let s = false;
1 === n && (e.textContent = e.textContent.replace(this.VOID_KEY, ""), s = true), -1 !== t.textContent.indexOf(this.INPUT_TAG_WRAP_KEY[1]) && (t.textContent = t.textContent.replace(new RegExp(this.INPUT_TAG_WRAP_KEY[0], "g"), "").replace(new RegExp(this.INPUT_TAG_WRAP_KEY[1], "g"), this.INPUT_TAG_WRAP_KEY), s = true), s && this.setInputTagRange(t.childNodes[0], i - n);
}
});
}
domItVisible(t.nextElementSibling, t.textContent === this.VOID_KEY, "inline");
}
backRuleInputTag(t) {
if (t.textContent === this.VOID_KEY) return this.delTag(t.parentElement.parentElement), true;
const e = window.getSelection();
if (0 === e.focusOffset && e.isCollapsed) {
const e2 = t.parentElement.parentElement.previousElementSibling.children[0].childNodes[0];
return this.restCursorPos(e2, e2.textContent === this.VOID_KEY ? 1 : e2.textContent.length), true;
}
if (-1 !== e.focusNode.textContent.indexOf(this.INPUT_TAG_WRAP_KEY[1])) {
const t2 = this.getDiffInputTagOffset(e.focusNode, e.focusOffset, "left");
if (t2 > 0) {
const i = e.focusNode.textContent.slice(0, e.focusOffset - 1 - t2), n = e.focusNode.textContent.slice(e.focusOffset);
return e.focusNode.textContent = i + n, e.focusNode.textContent ? this.setInputTagRange(e.focusNode, i.length) : (e.focusNode.textContent = this.VOID_KEY, this.watchInputTag(e.focusNode.parentElement), this.setInputTagRange(e.focusNode, 1)), true;
}
}
return false;
}
mergeRuleInputTag(t) {
this.target.nextTick(() => {
t.childNodes.length > 1 && (t.removeChild(t.childNodes[1]), this.watchInputTag(t));
});
}
inputTagSwitchRange(t) {
const { focusNode: e, focusOffset: i } = window.getSelection(), n = e.textContent.length, s = e.parentElement.parentElement.parentElement;
let a, l, o, r = false;
switch (t) {
case "ArrowLeft":
i > 0 && e.textContent !== this.VOID_KEY ? (o = this.getDiffInputTagOffset(e, i, "left"), l = i - 1 - o, a = e) : (a = s.previousElementSibling.children[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : a.textContent.length, r = true);
break;
case "ArrowRight":
i < n && e.textContent !== this.VOID_KEY ? (o = this.getDiffInputTagOffset(e, i, "right"), l = i + 1 + o, a = e) : (a = s.nextElementSibling.children[0].childNodes[0], l = a.textContent === this.VOID_KEY ? 1 : 0, r = true);
}
r ? this.restCursorPos(a, l) : this.setInputTagRange(a, l);
}
setInputTagRange(t, e) {
const i = new Range();
i.setStart(t, e), i.setEnd(t, e);
const n = window.getSelection();
n && (n.removeAllRanges(), n.addRange(i));
}
pasteInputTag(t) {
t = t.replace(new RegExp(this.INPUT_TAG_WRAP_KEY[0], "g"), "").replace(new RegExp(this.INPUT_TAG_WRAP_KEY[1], "g"), this.INPUT_TAG_WRAP_KEY);
const e = window.getSelection(), { focusNode: i, focusOffset: n, anchorOffset: s } = e;
let a = "", l = "";
e.isCollapsed ? (a = i.textContent.slice(0, n) || "", l = i.textContent.slice(n) || "") : (a = i.textContent.slice(0, s < n ? s : n) || "", l = i.textContent.slice(n > s ? n : s) || ""), i.textContent = a + t + l, this.setInputTagRange(i, (s < n ? s : n) + t.length);
const o = i.parentElement;
this.watchInputTag(o);
}
setInputTagWrap(t) {
const e = window.getSelection(), { focusOffset: i } = e, n = t.textContent, s = n.slice(0, i), a = n.slice(i);
t.textContent = s + this.INPUT_TAG_WRAP_KEY + a, this.setInputTagRange(t.childNodes[0], i + this.INPUT_TAG_WRAP_KEY.length), this.watchInputTag(t);
}
getDiffInputTagOffset(t, e, i) {
const n = "left" === i ? t.textContent[e - 1] : t.textContent[e];
if (-1 === this.INPUT_TAG_WRAP_KEY.indexOf(n)) return 0;
switch (i) {
case "left":
return t.textContent[e - 2] === this.INPUT_TAG_WRAP_KEY[1] ? 2 : t.textContent[e - 2] === this.INPUT_TAG_WRAP_KEY[0] ? 3 : 1;
case "right":
return t.textContent[e + 1] === this.INPUT_TAG_WRAP_KEY[1] ? 2 : t.textContent[e + 1] === this.INPUT_TAG_WRAP_KEY[0] ? 3 : 1;
}
}
};
var DEFAULT_OPTIONS = { device: "auto", autoFocus: true, needDialog: true, needDebounce: true, asyncMatch: false, userList: [], reformList: [], placeholder: "", maxLength: -1, copyType: ["text"], uploadImage: void 0, needCallEvery: true, needCallSpace: false, userProps: {}, customTrigger: [], dialogLabels: { pcPointDialog: {}, pcPCheckDialog: {}, h5Dialog: {} }, wrapKeyFun: (t) => t.ctrlKey && ["Enter"].includes(t.key), sendKeyFun: (t) => !t.ctrlKey && ["Enter"].includes(t.key) };
var DEFAULT_USER_PROPS = { id: "id", name: "name", avatar: "avatar", pinyin: "pinyin" };
var DEFAULT_PC_POINT_DIALOG = { title: "群成员", callEveryLabel: "所有人", checkLabel: "多选", emptyLabel: "暂无数据" };
var DEFAULT_PC_CHECK_DIALOG = { title: "选择要@的人", searchPlaceholder: "搜素人员名称", searchEmptyLabel: "没有匹配到任何结果", userTagTitle: "研讨成员列表", checkAllLabel: "全选", checkEmptyLabel: "请选择需要@的成员", confirmLabel: "确定", cancelLabel: "取消" };
var DEFAULT_H5_DIALOG = { title: "选择提醒的人", callEveryLabel: "所有人", searchPlaceholder: "搜素人员名称", searchEmptyLabel: "没有匹配到任何结果", confirmLabel: "确定", cancelLabel: "收起" };
var DEFAULT_REDUCE_CONFIG = { saveTagData: false, needUserId: false, needTagId: false, needSelectId: false, wrapClassName: void 0, rowClassName: void 0, imgToText: false, identifyLink: false };
var NotMergeKey = ["Backspace", "Shift", "Tab", "CapsLock", "Control", "Meta", "Alt", "ContextMenu", "Enter", "NumpadEnter", "Escape", "ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "Home", "End", "PageUp", "PageDown", "Insert", "Delete", "NumLock"];
var ChatEvent = class {
constructor(t) {
__publicField(this, "target"), __publicField(this, "outerApply", false), __publicField(this, "isComposition", false), __publicField(this, "matchKey", 0), __publicField(this, "startOpenIndex", 0), __publicField(this, "textLength", 0), __publicField(this, "isIMEModel", false), __publicField(this, "takeIMEModel", false), __publicField(this, "undoHistory", []), __publicField(this, "redoHistory", []), __publicField(this, "doOverHistory", true), __publicField(this, "notMergeKey", NotMergeKey), __publicField(this, "chatEventModule", { enterSend: [], operate: [], defaultAction: [], atMatch: [], atCheck: [], tagCheck: [], selectCheck: [], tipTagState: [], afterAtCheck: [], afterTagCheck: [], afterSelectCheck: [], showAtDialog: [], showTagDialog: [], showSelectDialog: [], elementClicked: [] }), __publicField(this, "debounceEvents", { recordHistory: () => {
}, dialogMoveToRange: (t2) => {
}, selectDialogToAim: () => {
}, matchPointDialog: () => {
}, movePointActiveUserElm: (t2) => {
}, moveCustomActiveTagElm: (t2) => {
} }), this.target = t, this.registerEvent(), this.otherEvent();
}
registerEvent() {
const { chatElement: t, options: e, deviceInfo: i, chatInput: n } = this.target;
t.richText.addEventListener("keyup", (s) => {
if (!s.target.classList.contains("input-write")) if (s.stopPropagation(), i.isPc) if ("@" === s.key && n.keyUpAsKey("@")) this.triggerChatEvent("showAtDialog"), e.needDialog && t.ruleShowPointDialog();
else {
const i2 = e.customTrigger.map((t2) => t2.prefix), a = i2.indexOf(s.key);
-1 !== a && n.keyUpAsKey(i2[a]) && (this.triggerChatEvent("showTagDialog", s.key), e.needDialog && t.showCustomTagDialog(s.key));
}
else if ((e.reformList.length > 0 || e.asyncMatch) && n.keyUpAsKey("@")) this.triggerChatEvent("showAtDialog"), e.needDialog && this.target.showH5Dialog(), t.isExternalCallPopup = false;
else {
const t2 = e.customTrigger.map((t3) => t3.prefix), i2 = t2.indexOf(s.key);
-1 !== i2 && n.keyUpAsKey(t2[i2]) && this.triggerChatEvent("showTagDialog", s.key);
}
}), t.richText.addEventListener("keydown", (s) => {
const a = s.target.classList.contains("input-write");
if (!i.isPc && "Unidentified" === s.key && 229 === s.keyCode) return a && n.mergeRuleInputTag(s.target), void (this.isIMEModel = true);
if (!this.isIMEModel) {
if (hasElmShow(t.pcElms.pointDialogElm)) ["ArrowUp", "ArrowDown", "Enter", "NumpadEnter"].includes(s.code) ? s.preventDefault() : ["ArrowLeft", "ArrowRight"].includes(s.code) && t.exitPointDialog();
else if (t.pcElms.customTagDialogTagKey && hasElmShow(t.pcElms.customTagDialogElms[t.pcElms.customTagDialogTagKey])) ["ArrowUp", "ArrowDown", "Enter", "NumpadEnter"].includes(s.code) ? s.preventDefault() : ["ArrowLeft", "ArrowRight"].includes(s.code) && t.exitCustomTagDialog();
else if ("Backspace" === s.code || "Backspace" === s.key ? a && n.backRuleInputTag(s.target) || n.selectRegionMerge() || n.gridElmMerge() || n.delMarkRule() ? (s.preventDefault(), this.richTextInput()) : t.tipElm && this.target.isEmpty() && t.removeTipElm() : e.wrapKeyFun(s) || !i.isPc && "Enter" === s.key ? (s.preventDefault(), a ? n.setInputTagWrap(s.target) : n.setWrap(), this.richTextInput()) : e.sendKeyFun(s) ? (s.preventDefault(), setTimeout(() => {
this.triggerChatEvent("enterSend");
}, 100)) : ["ArrowLeft", "ArrowRight"].includes(s.code) ? (s.preventDefault(), a ? n.inputTagSwitchRange(s.code) : n.switchRange(s.code)) : s.ctrlKey && "KeyA" === s.code ? this.target.isEmpty() && s.preventDefault() : s.ctrlKey && "KeyZ" === s.code ? (s.preventDefault(), this.ruleChatEvent(() => {
this.target.undo();
}, "defaultAction", "UNDO")) : s.ctrlKey && "KeyY" === s.code && (s.preventDefault(), this.ruleChatEvent(() => {
this.target.redo();
}, "defaultAction", "REDO")), !s.ctrlKey && !s.altKey && !s.metaKey) {
const t2 = -1 === this.notMergeKey.indexOf(s.key);
a ? (t2 || "Backspace" === s.code || "Backspace" === s.key) && n.mergeRuleInputTag(s.target) : t2 && n.selectRegionMerge();
}
}
}), t.richText.addEventListener("beforeinput", (e2) => {
const i2 = e2.target.classList.contains("input-write");
if (this.isIMEModel) {
if ("insertParagraph" === e2.inputType) return e2.preventDefault(), i2 ? n.setInputTagWrap(e2.target) : n.setWrap(), void this.richTextInput();
if ("deleteContentBackward" === e2.inputType) {
this.takeIMEModel = true, e2.preventDefault();
const s = t.richText.innerHTML, a = window.getSelection(), l = a.focusNode, o = a.focusOffset, r = i2 ? l.parentElement.parentElement.parentElement : l.parentElement.parentElement, c = r.parentElement, h2 = Array.prototype.indexOf.call(t.richText.children, c), d = Array.prototype.indexOf.call(c.children, r);
this.target.nextTick(() => {
t.richText.innerHTML = s;
const e3 = t.richText.children[h2].children[d], a2 = i2 ? e3.children[0].children[0].childNodes[0] : e3.children[0].childNodes[0];
i2 ? (n.setInputTagRange(a2, o), n.backRuleInputTag(a2.parentElement) || (a2.textContent = a2.textContent.slice(0, o - 1) + a2.textContent.slice(o), n.setInputTagRange(a2, o - 1)), n.watchInputTag(a2.parentElement)) : (n.restCursorPos(a2, o), n.selectRegionMerge() || n.gridElmMerge() || n.delMarkRule() || (a2.textContent = a2.textContent.slice(0, o - 1) + a2.textContent.slice(o), n.restCursorPos(a2, o - 1))), this.target.nextTick(async () => {
await this.richTextInput(), this.takeIMEModel = false, this.isIMEModel = false;
});
});
}
}
}), t.richText.addEventListener("input", async (s) => {
const a = s.target.classList.contains("input-write");
if (this.isIMEModel) {
if (this.takeIMEModel) return;
await this.target.nextTick(() => {
a && n.watchInputTag(s.target), -1 !== e.maxLength && this.ruleMaxLength(), t.showPlaceholder(), this.triggerChatEvent("operate"), this.isIMEModel = false;
});
} else {
if (a) return n.watchInputTag(s.target), void await this.richTextInput();
await this.richTextInput(), i.isPc && !this.isComposition && this.debounceEvents.matchPointDialog();
}
}), t.richText.addEventListener("copy", (t2) => {
t2.preventDefault(), this.ruleChatEvent(() => {
this.copyRange(t2);
}, "defaultAction", "COPY");
}), t.richText.addEventListener("cut", (t2) => {
t2.preventDefault(), this.ruleChatEvent(() => {
this.copyRange(t2), this.removeRange(), t2.target.classList.contains("input-write") && this.target.chatInput.watchInputTag(t2.target);
}, "defaultAction", "CUT");
}), t.richText.addEventListener("paste", (t2) => {
t2.preventDefault();
const { options: e2, chatInput: i2 } = this.target;
this.ruleChatEvent(() => {
const n2 = t2.clipboardData.getData("text/plain");
if ("string" == typeof n2 && "" !== n2) {
if (-1 === e2.copyType.indexOf("text")) return;
if (t2.target.classList.contains("input-write")) return i2.pasteInputTag(n2), void this.richTextInput();
let s = document.createElement("div");
s.innerHTML = t2.clipboardData.getData("application/my-custom-format") || "", i2.selectRegionMerge(), s.children[0] && s.children[0].getAttribute("data-set-richType") === RICH_GRID ? this.insertInsideHtml(s.innerHTML) : (s.innerHTML = n2, this.target.insertText(s.innerText)), s = null;
} else {
if (-1 === e2.copyType.indexOf("image")) return;
const i3 = (t2.clipboardData || t2.originalEvent.clipboardData).items || [];
Array.from(i3, async (t3) => {
if (-1 === t3.type.indexOf("image")) return;
const i4 = t3.getAsFile();
if (e2.uploadImage) {
const t4 = await e2.uploadImage(i4);
this.target.insertHtml(`
`);
} else {
const t4 = new FileReader();
t4.onload = (t5) => {
this.target.insertHtml(`
`);
}, t4.readAsDataURL(i4);
}
});
}
}, "defaultAction", "PASTE");
}), t.richText.addEventListener("blur", () => {
n.upDataNodeOrIndex();
}), t.richText.addEventListener("focus", () => {
n.upDataNodeOrIndex();
}), t.richText.addEventListener("click", (t2) => {
n.upDataNodeOrIndex();
const i2 = upFindElm(t2.target, 5);
if (i2) {
const t3 = i2.children[0];
if (t3.classList.contains("chat-grid-input")) return void this.triggerChatEvent("elementClicked", "gridInput", t3);
if (t3.classList.contains("at-input")) return t3.children[0].textContent === n.VOID_KEY && n.rangeToInputTag(t3), void this.triggerChatEvent("elementClicked", "inputTag", t3);
if (t3.classList.contains("at-select")) {
const i3 = t3.getAttribute("data-select-key");
return this.triggerChatEvent("showSelectDialog", i3, t3), e.needDialog && this.target.showPCSelectDialog(i3, t3), void this.triggerChatEvent("elementClicked", "selectTag", t3);
}
if (t3.classList.contains("at-user")) return void this.triggerChatEvent("elementClicked", "userTag", t3);
if (t3.classList.contains("at-tag")) return void this.triggerChatEvent("elementClicked", "customTag", t3);
if (t3.classList.contains("chat-set-html")) return void this.triggerChatEvent("elementClicked", "htmlTag", t3.children[0]);
}
}), t.richText.addEventListener("dragstart", (t2) => {
t2.stopPropagation(), t2.preventDefault();
}), t.richText.addEventListener("dragover", (t2) => {
t2.stopPropagation(), t2.preventDefault();
}), t.richText.addEventListener("drop", (t2) => {
t2.stopPropagation(), t2.preventDefault();
}), t.richText.addEventListener("compositionstart", () => {
this.isComposition = true;
}), t.richText.addEventListener("compositionend", () => {
this.isComposition = false;
}), window.addEventListener("click", this.winClick.bind(this)), window.addEventListener("keydown", this.winKeydown.bind(this));
}
otherEvent() {
const { options: t, chatInput: e, chatElement: i } = this.target, { needDebounce: n } = t, s = () => {
const { gridIndex: t2, markIndex: n2 } = e.getRichTextNodeIndex(e.vnode);
if (null === t2 || null == n2) return;
const s2 = { html: i.richText.innerHTML, gridIndex: t2, markIndex: n2, cursorIndex: e.cursorIndex };
this.undoHistory.push(s2), this.undoHistory.length > 50 && this.undoHistory.shift();
};
this.debounceEvents.recordHistory = n ? debounce3(s, 200) : s;
const a = (t2) => {
let n2 = "0", s2 = "100%";
const a2 = e.getRangeRect();
if (!a2) return;
const l2 = i.pcElms.containerDialogElm.getBoundingClientRect();
let o2 = a2.x - l2.x, r2 = l2.y - a2.y;
const { clientWidth: c, clientHeight: h2 } = t2;
a2.x > window.innerWidth - c - 30 && (o2 = a2.x - c - l2.x - 16, n2 = "100%"), a2.y < h2 && (r2 -= h2, s2 = "0"), t2.style.transform = "translate(0, 0)", t2.style.transformOrigin = `${n2} ${s2}`, t2.style.left = o2 + 6 + "px", t2.style.bottom = `${r2}px`, t2.style.opacity = "1";
};
this.debounceEvents.dialogMoveToRange = n ? debounce3(a, 120, true) : a;
const l = () => {
if (!t.needDialog) return;
const n2 = e.vnode.textContent || "", s2 = e.cursorIndex, a2 = n2.slice(0, s2);
let l2 = -1, o2 = -1, r2 = "userTag";
if (-1 !== a2.lastIndexOf("@") && (l2 = a2.lastIndexOf("@")), i.pcElms.customTagDialogTagKey && -1 !== a2.lastIndexOf(i.pcElms.customTagDialogTagKey) && (o2 = a2.lastIndexOf(i.pcElms.customTagDialogTagKey)), o2 > l2 && (r2 = "customTag"), "userTag" === r2 && t.asyncMatch) {
if (l2 < 0) return void i.exitPointDialog();
this.matchKey++;
const t2 = this.matchKey;
this.startOpenIndex = l2 + 1;
const e2 = a2.slice(this.startOpenIndex) || "";
if (/\s/gi.test(e2)) return void i.exitPointDialog();
this.target.updateUserList([]), domItVisible(i.pcElms.pointDialogLoadingElm, true, "flex"), domItVisible(i.pcElms.pointDialogEmptyElm), i.showPointDialog();
const n3 = this.triggerChatEvent("atMatch", e2).find((t3) => t3 && t3 instanceof Promise);
return void (n3 && n3.then((e3) => {
t2 === this.matchKey && (domItVisible(i.pcElms.pointDialogLoadingElm), !e3 || e3.length <= 0 ? domItVisible(i.pcElms.pointDialogEmptyElm, true, "flex") : (this.target.updateUserList(e3), i.pcElms.pointDialogUsersElm && i.pcElms.pointDialogUsersElm.length > 0 && i.updatePointActiveUserElm(i.pcElms.pointDialogUsersElm[0].elm)));
}));
}
if ("userTag" === r2 && t.reformList.length <= 0) return void i.exitCustomTagDialog();
if ("customTag" === r2 && i.customTags[i.pcElms.customTagDialogTagKey].length <= 0) return;
const c = () => {
"userTag" === r2 ? i.exitPointDialog() : i.exitCustomTagDialog();
};
if (l2 < 0 && o2 < 0) return i.exitPointDialog(), void i.exitCustomTagDialog();
this.startOpenIndex = "userTag" === r2 ? l2 + 1 : o2 + 1;
const h2 = new RegExp(`^([${e.ZERO_WIDTH_KEY}${e.VOID_KEY}])+$`);
if (!a2 || h2.test(a2) || s2 < this.startOpenIndex) return void c();
const d = a2.slice(this.startOpenIndex) || "";
if (/\s/gi.test(d)) c();
else if (d) if ("userTag" === r2) {
const t2 = this.target.searchUserList(d);
t2.length > 0 ? i.showPointDialog(t2) : c();
} else {
const t2 = i.customTags[i.pcElms.customTagDialogTagKey].filter((t3) => pinyinMatch(t3.name, t3.pinyin || "", d));
t2.length > 0 ? i.showCustomTagDialog(i.pcElms.customTagDialogTagKey, t2) : c();
}
else "userTag" === r2 ? i.showPointDialog() : i.showCustomTagDialog(i.pcElms.customTagDialogTagKey);
};
this.debounceEvents.matchPointDialog = n ? debounce3(l, 200) : l;
this.debounceEvents.movePointActiveUserElm = throttle2((t2) => {
if (!i.pcElms.pointDialogActiveElm) return;
let e2 = 0;
const n2 = i.pcElms.pointDialogActiveElm.getAttribute("data-set-id");
i.pcElms.pointDialogUsersElm.some((t3) => {
const i2 = t3.elm.getAttribute("data-set-id");
return e2 = t3.index, n2 === i2;
});
const s2 = i.pcElms.pointDialogUsersElm.filter((t3) => !t3.elm.classList.contains("user-no-match")), a2 = s2.map((t3) => t3.index);
let l2;
"down" === t2 ? l2 = e2 === s2[s2.length - 1].index ? s2[0] : s2[a2.indexOf(e2) + 1] : "up" === t2 && (l2 = e2 === s2[0].index ? s2[s2.length - 1] : s2[a2.indexOf(e2) - 1]), l2 && i.updatePointActiveUserElm(l2.elm, true);
}, 80);
this.debounceEvents.moveCustomActiveTagElm = throttle2((t2) => {
if (!i.pcElms.customTagDialogActiveElm) return;
const e2 = i.customTags[i.pcElms.customTagDialogTagKey].map((t3) => t3.id), n2 = i.pcElms.customTagDialogActiveElm.getAttribute("data-set-id"), s2 = e2.indexOf(n2), a2 = Array.from(i.pcElms.customTagDialogElms[i.pcElms.customTagDialogTagKey].children[1].children, (t3, e3) => ({ elm: t3, index: e3 })).filter((t3) => !t3.elm.classList.contains("tag-no-match")), l2 = a2.map((t3) => t3.index);
let o2;
"down" === t2 ? o2 = s2 === a2[a2.length - 1].index ? a2[0] : a2[l2.indexOf(s2) + 1] : "up" === t2 && (o2 = s2 === a2[0].index ? a2[a2.length - 1] : a2[l2.indexOf(s2) - 1]), o2 && i.updateActiveCustomTagElm(o2.elm, true);
}, 80);
const o = () => {
const t2 = i.pcElms.selectDialogAim.getClientRects()[0], e2 = i.pcElms.selectDialogElms[i.pcElms.selectDialogKey];
domItVisible(e2, true);
const n2 = e2.querySelector(".chat-select-arrow");
let s2 = e2.clientHeight + 16;
if (s2 > t2.y ? (s2 = -(t2.height + 16), n2.style.top = "-16px", n2.style.bottom = "auto", n2.style.transform = "rotate(0deg)") : (n2.style.transform = "rotate(180deg)", n2.style.bottom = "-16px", n2.style.top = "auto"), window.innerWidth - t2.x < e2.clientWidth) {
const i2 = e2.clientWidth - (window.innerWidth - t2.x) - 10;
e2.style.left = "auto", e2.style.right = "10px", n2.style.left = "auto", n2.style.right = i2 - n2.clientWidth / 2 + t2.width / 2 + "px";
} else e2.style.left = t2.x + "px", e2.style.right = "auto", n2.style.left = t2.width / 2 - n2.clientWidth / 2 + "px", n2.style.right = "auto";
e2.style.top = t2.y + "px", e2.style.transform = `translateY(${-s2}px)`;
const a2 = e2.querySelector(".chat-select-dialog-main"), l2 = e2.querySelectorAll(".chat-select-dialog-item");
let o2 = 0, r2 = false, c = 0;
if (i.pcElms.selectDialogAim.classList.contains("at-select")) {
const t3 = i.pcElms.selectDialogAim.getAttribute("data-select-id");
updateElmClass(i.pcElms.selectDialogAim, "aim", true), Array.from(l2, (e4) => {
const i2 = e4.lastChild.lastChild, n3 = t3 === e4.getAttribute("data-set-id");
n3 && (c = e4.clientHeight, r2 = true), n3 || r2 || (o2 += e4.clientHeight), domItVisible(i2, n3, "inline-block");
});
const e3 = o2 - a2.clientHeight / 2 + c / 2;
a2.scrollTop = e3 > 0 ? e3 : 0;
} else Array.from(l2, (t3) => {
domItVisible(t3.lastChild.lastChild, false, "inline-block");
});
};
this.debounceEvents.selectDialogToAim = n ? debounce3(o, 120) : o;
const r = { html: i.richText.innerHTML, gridIndex: 0, markIndex: 0, cursorIndex: e.cursorIndex };
this.undoHistory = [r];
}
winClick() {
if (!this.target || this.outerApply) return;
const { chatElement: t } = this.target;
hasElmShow(t.pcElms.pointDialogElm) && t.exitPointDialog(), t.pcElms.checkDialogSearchResultElm && domItVisible(t.pcElms.checkDialogSearchResultElm), t.pcElms.customTagDialogTagKey && hasElmShow(t.pcElms.customTagDialogElms[t.pcElms.customTagDialogTagKey]) && t.exitCustomTagDialog(), t.pcElms.selectDialogKey && hasElmShow(t.pcElms.selectDialogElms[t.pcElms.selectDialogKey]) && t.exitSelectDialog();
}
async winKeydown(t) {
if (!this.target) return;
const { chatElement: e, options: i } = this.target;
if (t.ctrlKey && "KeyZ" === t.code && t.preventDefault(), !this.isComposition) {
if (hasElmShow(e.pcElms.pointDialogElm)) {
if ("ArrowDown" === t.code) return t.preventDefault(), void this.debounceEvents.movePointActiveUserElm("down");
if ("ArrowUp" === t.code) return t.preventDefault(), void this.debounceEvents.movePointActiveUserElm("up");
if (("Enter" === t.code || "NumpadEnter" === t.code) && e.pcElms.pointDialogActiveElm) {
t.preventDefault();
const n = e.pcElms.pointDialogActiveElm.getAttribute("data-set-id");
if (await sleep(100), e.isPointSearchMode || i.asyncMatch) await this.target.matchSetTag(i.reformList.find((t2) => t2.id === n));
else {
const t2 = i.userList.find((t3) => String(t3[i.userProps.id]) === n);
await this.target.onceSetTag(t2);
}
e.exitPointDialog();
}
} else if (e.pcElms.customTagDialogTagKey && hasElmShow(e.pcElms.customTagDialogElms[e.pcElms.customTagDialogTagKey])) {
if ("ArrowDown" === t.code) return t.preventDefault(), void this.debounceEvents.moveCustomActiveTagElm("down");
if ("ArrowUp" === t.code) return t.preventDefault(), void this.debounceEvents.moveCustomActiveTagElm("up");
if (("Enter" === t.code || "NumpadEnter" === t.code) && e.pcElms.customTagDialogActiveElm) {
t.preventDefault();
const i2 = e.pcElms.customTagDialogActiveElm.getAttribute("data-set-id");
await sleep(100);
const n = e.customTags[e.pcElms.customTagDialogTagKey].find((t2) => t2.id === i2);
e.isPointSearchMode ? await this.target.matchSetCustomTag(n) : await this.target.onceSetCustomTag(n), e.exitCustomTagDialog();
}
}
}
}
async richTextInput(t = true) {
const { chatInput: e, deviceInfo: i, chatElement: n, options: s } = this.target;
return e.upDataNodeOrIndex(), i.isPc && e.selectRegionMerge(), await this.target.nextTick(() => {
this.isComposition || e.updateGrid();
const i2 = (n.richText.children[0] || { children: [] }).children[0];
if (!i2 || !i2.getAttribute || i2.getAttribute("data-set-richType") !== RICH_MARK) return e.initEditor(true), n.showPlaceholder(), void this.triggerChatEvent("operate");
-1 !== s.maxLength && this.ruleMaxLength(), n.showPlaceholder(), this.triggerChatEvent("operate"), t && this.doOverHistory && !this.isComposition && this.debounceEvents.recordHistory(), e.viewIntoPoint();
}), true;
}
ruleMaxLength() {
const { options: t, chatElement: e } = this.target;
if (this.target.isEmpty() || -1 === t.maxLength) return void (this.textLength = 0);
let i = 0, n = 0;
const s = [];
Array.prototype.some.call(e.richText.children, (e2, a2) => {
const { nodeInfos: l, nodeTextLength: o } = this.getGirdNodeTextInfo(e2);
if (i += o, s.push(l), n = a2, i >= t.maxLength) return true;
});
const a = [];
Array.from(e.richText.children, (t2, e2) => {
e2 > n && a.push(t2);
}), a.forEach((t2) => e.richText.removeChild(t2)), this.deepDelGirdText(s, i);
}
getGirdNodeTextInfo(t) {
const { chatInput: e } = this.target, i = [];
let n = 0;
if (1 === t.children.length && t !== t.parentElement.children[0]) {
const s = t.children[0], a = (s.textContent || "").replace(new RegExp(e.VOID_KEY, "g"), "");
n += a.length || 1, i[0] = { node: s, textLength: a.length || 1, type: RICH_MARK };
} else Array.from(t.children, (t2, s) => {
if (t2.getAttribute("data-set-richType") === RICH_MARK) {
const a = (t2.textContent || "").replace(new RegExp(e.VOID_KEY, "g"), "");
n += a.length, i[s] = { node: t2, textLength: a.length, type: RICH_MARK };
} else {
const a = (t2.textContent || "").replace(new RegExp(e.VOID_KEY, "g"), "");
n += a.length || 1, i[s] = { node: t2, textLength: a.length || 1, type: RICH_TAG };
}
});
return { nodeInfos: i, nodeTextLength: n };
}
deepDelGirdText(t, e) {
if (e > this.target.options.maxLength) {
const i = t[t.length - 1];
t.pop(), this.deepDelNode(i, t, e);
} else this.textLength = e;
}
deepDelNode(t, e, i) {
const n = t[0].node.parentElement;
if (i > this.target.options.maxLength) {
let s = i - this.target.options.maxLength, a = t[t.length - 1];
if (a.type === RICH_MARK) if (0 === a.textLength || s >= a.textLength) n.removeChild(a.node), t.pop(), s -= a.textLength, a = t[t.length - 1], n.removeChild(a.node), t.pop(), s -= a.textLength;
else {
const t2 = a.node.childNodes[0];
t2.textContent = t2.textContent.slice(0, a.textLength - s), 0 === t2.textContent && (t2.setAttribute("data-set-empty", "true"), t2.innerHTML = `${this.target.chatInput.VOID_KEY}
`), s = 0;
}
else n.removeChild(a.node), t.pop(), s -= a.textLength;
s > 0 ? t.length > 0 ? this.deepDelNode(t, e, s + this.target.options.maxLength) : (this.target.chatElement.richText.appendChild(n), this.deepDelGirdText(e, s + this.target.options.maxLength)) : (this.textLength = this.target.options.maxLength + s, this.target.chatInput.setRangeLastText());
}
}
copyRange(t) {
const e = window.getSelection();
if (e.isCollapsed || e.rangeCount <= 0) return t.clipboardData.setData("application/my-custom-format", ""), void t.clipboardData.setData("text/plain", "");
const { chatElement: i, chatInput: n } = this.target, s = e.toString() || "";
let a = document.createElement("div");
a.innerHTML = s;
const l = a.innerText.replace(/\n\n/g, "\n");
a = null, t.clipboardData.setData("text/plain", l);
const o = e.anchorNode, r = e.focusNode;
if (o === r && o.nodeType === Node.TEXT_NODE) return void t.clipboardData.setData("application/my-custom-format", l);
if (o === i.richText && r === i.richText) return void t.clipboardData.setData("application/my-custom-format", i.richText.innerHTML);
const c = n.getWrapNode(o, true), h2 = n.getWrapNode(r, true), d = n.getMarkNode(o, true), p2 = n.getMarkNode(r, true), g = d.getAttribute("data-set-richType") === RICH_MARK, u = p2.getAttribute("data-set-richType") === RICH_MARK, m = Array.prototype.indexOf.call(c.childNodes, d), E2 = Array.prototype.indexOf.call(h2.childNodes, p2);
if (c === h2 && c.parentNode === i.richText) {
const i2 = m > E2, s2 = Array.prototype.filter.call(c.childNodes, (t2, e2) => i2 ? e2 < m && e2 > E2 : e2 > m && e2 < E2).map((t2) => t2.cloneNode(true)), a2 = g ? i2 ? o.textContent.slice(0, e.anchorOffset) : o.textContent.slice(e.anchorOffset) : "", l2 = u ? i2 ? r.textContent.slice(e.focusOffset) : r.textContent.slice(0, e.focusOffset) : "", h22 = n.getGridElm(true), d2 = n.getGridElm(true);
a2 && (h22.childNodes[0].innerHTML = a2, h22.childNodes[0].setAttribute("data-set-empty", "false")), l2 && (d2.childNodes[0].innerHTML = l2, d2.childNodes[0].setAttribute("data-set-empty", "false")), i2 ? (s2[0].getAttribute("data-set-richType") !== RICH_MARK && s2.unshift(d2), s2[s2.length - 1].getAttribute("data-set-richType") !== RICH_MARK && s2.push(h22)) : (s2[0].getAttribute("data-set-richType") !== RICH_MARK && s2.unshift(h22), s2[s2.length - 1].getAttribute("data-set-richType") !== RICH_MARK && s2.push(d2));
let p22 = document.createElement("div");
const C2 = n.setWrapNodeByMark(s2);
return p22.appendChild(C2), t.clipboardData.setData("application/my-custom-format", p22.innerHTML), void (p22 = null);
}
if (c.parentNode === i.richText && h2.parentNode === i.richText) {
const s2 = Array.prototype.indexOf.call(i.richText.childNodes, c), a2 = Array.prototype.indexOf.call(i.richText.childNodes, h2), l2 = s2 > a2, d2 = Array.prototype.filter.call(i.richText.childNodes, (t2, e2) => l2 ? e2 < s2 && e2 > a2 : e2 > s2 && e2 < a2).map((t2) => t2.cloneNode(true)), p22 = g ? l2 ? o.textContent.slice(0, e.anchorOffset) : o.textContent.slice(e.anchorOffset) : "", C2 = u ? l2 ? r.textContent.slice(e.focusOffset) : r.textContent.slice(0, e.focusOffset) : "", f = n.getGridElm(true), x = n.getGridElm(true);
p22 && (f.childNodes[0].innerHTML = p22, f.childNodes[0].setAttribute("data-set-empty", "false")), C2 && (x.childNodes[0].innerHTML = C2, x.childNodes[0].setAttribute("data-set-empty", "false"));
const T = Array.prototype.filter.call(c.childNodes, (t2, e2) => l2 ? e2 < m : e2 > m).map((t2) => t2.cloneNode(true)), y = Array.prototype.filter.call(h2.childNodes, (t2, e2) => l2 ? e2 > E2 : e2 < E2).map((t2) => t2.cloneNode(true));
if (l2) {
T.push(f), y.unshift(x);
const t2 = n.setWrapNodeByMark(T), e2 = n.setWrapNodeByMark(y);
d2.push(t2), d2.unshift(e2);
} else {
T.unshift(f), y.push(x);
const t2 = n.setWrapNodeByMark(T), e2 = n.setWrapNodeByMark(y);
d2.unshift(t2), d2.push(e2);
}
let v = document.createElement("div");
return Array.from(d2, (t2) => {
v.appendChild(t2);
}), t.clipboardData.setData("application/my-custom-format", v.innerHTML), void (v = null);
}
}
removeRange() {
const { chatInput: t, chatElement: e } = this.target;
window.getSelection().getRangeAt(0).deleteContents(), this.target.nextTick(() => {
t.updateGrid(), e.showPlaceholder();
});
}
async setChatHistory(t) {
const { chatElement: e, chatInput: i } = this.target;
this.doOverHistory = false;
const { html: n, gridIndex: s, markIndex: a, cursorIndex: l } = t;
e.richText.innerHTML = n;
const o = e.richText.childNodes[s].childNodes[a].childNodes[0].childNodes[0];
i.restCursorPos(o, l), await this.richTextInput(), this.doOverHistory = true;
}
async insertInsideHtml(t) {
const { chatInput: e } = this.target;
let i = document.createElement("div");
i.innerHTML = t, i.children.length && (1 === i.children.length ? e.insetRangeGrid(i.children[0]) : e.insetRangeGrids(i.children), i = null, await this.richTextInput());
}
triggerChatEvent(t, ...e) {
const i = [];
return this.chatEventModule[t].forEach((t2) => {
t2 && i.push(t2(...e));
}), i;
}
ruleChatEvent(t, e, ...i) {
this.triggerChatEvent(e, ...i).some((t2) => t2 && "PREVENT" === t2) || (t && t.bind(this)(), t = null);
}
};
var ChatOperateNode = class {
constructor(t) {
__publicField(this, "target"), __publicField(this, "rankLen", 4), this.target = t;
}
getCurrentNodes() {
const t = [];
return Array.from(this.target.chatElement.richText.children, (e, i) => {
t.push(this.analyzeGrid(e, i));
}), t;
}
getRank(t) {
let e = t + 1 + "";
const i = this.rankLen - e.length;
for (let t2 = 0; t2 < i; t2++) e = "0" + e;
return e;
}
analyzeGrid(t, e) {
const i = { type: "gridBox", rank: this.getRank(e), children: [] };
return Array.from(t.children, (t2, e2) => {
switch (t2.getAttribute("data-set-richType")) {
case RICH_MARK:
i.children.push(this.analyzeMark(t2, e2, i.rank));
break;
case RICH_TAG:
i.children.push(this.analyzeTag(t2, e2, i.rank));
}
}), i;
}
analyzeMark(t, e, i) {
return { type: "gridInput", rank: i + this.getRank(e), text: t.textContent.replace(new RegExp(this.target.chatInput.VOID_KEY, "g"), "") };
}
analyzeTag(t, e, i) {
const n = t.children[0], s = { type: "htmlTag", rank: i + this.getRank(e) };
return n.classList.contains("at-user") ? (s.type = "userTag", s.dataset = { [this.target.options.userProps.id]: n.getAttribute("data-user-id"), [this.target.options.userProps.name]: n.textContent.slice(1) }) : n.classList.contains("at-tag") ? (s.type = "customTag", s.dataset = { id: n.getAttribute("data-tag-id"), name: n.textContent.slice(1), prefix: n.getAttribute("data-set-prefix") }) : n.classList.contains("at-select") ? (s.type = "selectTag", s.dataset = { id: n.getAttribute("data-select-id"), name: n.textContent, key: n.getAttribute("data-select-key") }) : n.classList.contains("at-input") ? (s.type = "inputTag", s.dataset = { key: n.getAttribute("data-input-key"), placeholder: n.children[1].textContent, value: n.children[0].textContent === this.target.chatInput.VOID_KEY ? "" : n.children[0].textContent.replace(new RegExp(this.target.chatInput.INPUT_TAG_WRAP_KEY[0], "g"), "") }) : (s.type = "htmlTag", s.html = t.children[0].innerHTML), s;
}
analyzeGridNodes(t) {
t.children = t.children || [];
const e = t.children;
if (0 === e.length) return void e.push({ type: "gridInput", rank: t.rank + this.getRank(0), text: "" });
const i = [];
e.forEach((t2, n2) => {
if (n2 === e.length - 1) return;
const s = n2 + 1;
if ("gridInput" === t2.type && "gridInput" === e[s].type) {
let t3 = s - i.length;
i.push(t3);
}
}), i.forEach((t2) => {
const i2 = e[t2];
e[t2 - 1].text += i2.text, e.splice(t2, 1);
});
const n = [];
e.forEach((t2, i2) => {
if (i2 === e.length - 1) return;
const s = i2 + 1;
if ("gridInput" !== t2.type && "gridInput" !== e[s].type) {
let t3 = s + n.length;
n.push(t3);
}
}), n.forEach((t2) => {
e.splice(t2, 0, { type: "gridInput", rank: "", text: "" });
}), "gridInput" !== e[0].type && e.unshift({ type: "gridInput", rank: "", text: "" }), "gridInput" !== e[e.length - 1].type && e.push({ type: "gridInput", rank: "", text: "" }), e.forEach((e2, i2) => {
e2.rank = t.rank + this.getRank(i2);
});
}
analyzeNode(t, e = false) {
switch (t.type) {
case "gridInput":
return `${"" === t.text ? this.target.chatInput.VOID_KEY : t.text}${e && "" === t.text ? "
" : ""}`;
case "userTag":
return `@${t.dataset[this.target.options.userProps.name]}`;
case "customTag":
return `${t.dataset.prefix}${t.dataset.name}`;
case "selectTag":
return `${t.dataset.name}${arrowSvg}`;
case "htmlTag":
return `${t.html}`;
case "inputTag":
const i = !Boolean(t.dataset.value), n = i ? `${t.dataset.placeholder}` : `${t.dataset.placeholder}`;
return `${i ? this.target.chatInput.VOID_KEY : t.dataset.value.replace(new RegExp(this.target.chatInput.INPUT_TAG_WRAP_KEY[1], "g"), this.target.chatInput.INPUT_TAG_WRAP_KEY)}${n}`;
case "gridBox":
let s = "";
return this.analyzeGridNodes(t), t.children.forEach((e2, i2) => {
s += this.analyzeNode(e2, i2 === t.children.length - 1);
}), `${s}
`;
default:
return "";
}
}
async insertNode(t) {
if ("gridBox" === t.type) {
const e = this.analyzeNode(t);
let i = document.createElement("div");
i.innerHTML = e;
const n = i.children[0], s = parseFloat(t.rank) - 1;
if (-1 === s || s > this.target.chatElement.richText.children.length - 1) this.target.chatElement.richText.appendChild(n);
else {
const t2 = this.target.chatElement.richText.children[s];
if (!t2) return;
this.target.chatElement.richText.insertBefore(n, t2);
}
const a = n.lastElementChild.children[0].childNodes[0];
this.target.chatInput.restCursorPos(a, a.textContent === this.target.chatInput.VOID_KEY ? 1 : a.textContent.length), i = null, await this.target.chatEvent.richTextInput();
} else {
const e = (t.text || "").length, i = t.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), n = this.getNodeByRank(i[0]);
if (!n) return;
const s = parseFloat(i[1]) - 1;
-1 == s ? n.children.push(t) : n.children.splice(s, 0, t), await this.updateNode(n, () => {
if ("gridInput" === t.type) {
const t2 = -1 === s || s > n.children.length - 1, i2 = !t2 && s % 2 == 0, a = t2 ? n.children[n.children.length - 1] : n.children[i2 ? s : s - 1];
this.setCursorNode(a, i2 ? e : -1);
} else {
const e2 = n.children.indexOf(t);
this.setCursorNode(n.children[e2 + 1], 0);
}
});
}
}
async updateNode(t, e) {
const i = t.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), n = parseFloat(i[0]) - 1, s = this.target.chatElement.richText.children[n];
if ("gridBox" === t.type) {
if (!s) return;
this.analyzeGridNodes(t);
let i2 = "";
if (t.children.forEach((e2, n2) => {
i2 += this.analyzeNode(e2, n2 === t.children.length - 1);
}), s.innerHTML = i2, e) e();
else {
const t2 = s.lastElementChild.children[0].childNodes[0];
this.target.chatInput.restCursorPos(t2, t2.textContent === this.target.chatInput.VOID_KEY ? 1 : t2.textContent.length);
}
return void await this.target.chatEvent.richTextInput();
}
const a = parseFloat(i[1]) - 1, l = s.children[a], o = this.getNodeByRank(t.rank);
if (!o || t.type !== o.type) return;
let r, c;
if ("gridInput" === t.type) {
const e2 = l.children[0];
e2.textContent = t.text;
const i2 = "" !== e2.textContent;
e2.setAttribute("data-set-empty", String(!i2)), i2 || (e2.innerHTML = l.nextElementSibling ? this.target.chatInput.VOID_KEY : `${this.target.chatInput.VOID_KEY}
`), r = e2.childNodes[0], c = r.textContent.length;
} else if ("userTag" === t.type) {
const e2 = l.children[0];
e2.setAttribute("data-user-id", t.dataset[this.target.options.userProps.id]), e2.textContent = `@${t.dataset[this.target.options.userProps.name]}`;
r = l.nextElementSibling.children[0].childNodes[0];
} else if ("customTag" === t.type) {
const e2 = l.children[0];
e2.setAttribute("data-tag-id", t.dataset.id), e2.setAttribute("data-set-prefix", t.dataset.prefix), e2.textContent = `${t.dataset.prefix}${t.dataset.name}`;
r = l.nextElementSibling.children[0].childNodes[0];
} else if ("selectTag" === t.type) {
const e2 = l.children[0];
e2.setAttribute("data-select-id", t.dataset.id), e2.setAttribute("data-select-key", t.dataset.key), e2.childNodes[0].textContent = t.dataset.name;
r = l.nextElementSibling.children[0].childNodes[0];
} else if ("htmlTag" === t.type) {
l.children[0].innerHTML = t.html;
r = l.nextElementSibling.children[0].childNodes[0];
}
e ? e() : this.target.chatInput.restCursorPos(r, c), await this.target.chatEvent.richTextInput();
}
getNodeByRank(t) {
if (!t) return null;
const e = t.match(new RegExp(`.{1,${this.rankLen}}`, "g"));
if (0 === e.length) return null;
const i = parseFloat(e[0]) - 1, n = -1 === i ? this.target.chatElement.richText.lastElementChild : this.target.chatElement.richText.children[i];
if (!n) return null;
if (1 === e.length) return this.analyzeGrid(n, -1 === i ? this.target.chatElement.richText.children.length - 1 : i);
-1 === i && (e[0] = this.getRank(this.target.chatElement.richText.children.length - 1));
const s = parseFloat(e[1]) - 1, a = -1 === s ? n.lastElementChild : n.children[s];
if (!a) return null;
return a.getAttribute("data-set-richType") === RICH_MARK ? this.analyzeMark(a, -1 === s ? n.children.length - 1 : s, e[0]) : this.analyzeTag(a, -1 === s ? n.children.length - 1 : s, e[0]);
}
async delNodeByRank(t) {
const e = this.getNodeByRank(t);
if (e) if ("gridBox" === e.type) {
const e2 = parseFloat(t) - 1, i = this.target.chatElement.richText.children[e2], n = i.nextElementSibling || i.previousElementSibling;
if (n) {
const t2 = n.lastElementChild.children[0].childNodes[0];
this.target.chatInput.restCursorPos(t2, t2.textContent === this.target.chatInput.VOID_KEY ? 1 : t2.textContent.length);
}
this.target.chatElement.richText.removeChild(i), 0 === this.target.chatElement.richText.children.length && this.target.chatInput.initEditor(true), await this.target.chatEvent.richTextInput();
} else if ("gridInput" === e.type) e.text = "", await this.updateNode(e);
else {
const i = e.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), n = this.getNodeByRank(i[0]), s = n.children[parseFloat(i[1]) - 1 - 1], a = s.text.length;
n.children = n.children.filter((e2) => e2.rank !== t), await this.updateNode(n, () => {
this.setCursorNode(s, a);
});
}
}
async coverNodes(t) {
if (t.length < 0) return;
let e = "";
t.forEach((t2) => {
e += this.analyzeNode(t2);
}), this.target.chatElement.richText.innerHTML = e, this.target.chatInput.setRangeLastText(), await this.target.chatEvent.richTextInput();
}
setCursorNode(t, e = -1) {
const i = t.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), n = parseFloat(i[0]) - 1, s = -1 === n ? this.target.chatElement.richText.lastElementChild : this.target.chatElement.richText.children[n];
let a = null;
if ("gridInput" === t.type) {
const t2 = parseFloat(i[1]) - 1;
a = -1 === t2 ? s.lastElementChild : s.children[t2];
} else if ("gridBox" === t.type) a = -1 === e ? s.lastElementChild : s.children[0];
else if ("inputTag" === t.type) {
const t2 = parseFloat(i[1]) - 1, n2 = s.children[t2].children[0].children[0].childNodes[0], a2 = n2.textContent === this.target.chatInput.VOID_KEY ? 1 : -1 === e ? n2.textContent.length : e;
this.target.chatInput.setInputTagRange(n2, a2);
} else {
const t2 = parseFloat(i[1]) - 1, n2 = s.children[t2];
a = -1 === e ? n2.nextElementSibling : n2.previousElementSibling, e = -1 === e ? 0 : -1;
}
if (a) {
const t2 = a.children[0].childNodes[0];
-1 === e && (e = t2.textContent.length), this.target.chatInput.restCursorPos(t2, t2.textContent === this.target.chatInput.VOID_KEY ? 1 : e);
}
}
getCursorNode() {
const t = window.getSelection(), e = t.focusNode;
if (e && e.parentElement && e.parentElement.classList.contains("input-write")) {
const i2 = e.parentElement.parentElement.parentElement;
return { node: this.analyzeTag(i2, Array.prototype.indexOf.call(i2.parentElement.children, i2), this.getRank(Array.prototype.indexOf.call(this.target.chatElement.richText.children, i2.parentElement))), offset: e.textContent === this.target.chatInput.VOID_KEY ? 0 : t.focusOffset };
}
const i = this.target.chatInput.vnode.parentElement.parentElement;
return { node: this.analyzeMark(i, Array.prototype.indexOf.call(i.parentElement.children, i), this.getRank(Array.prototype.indexOf.call(this.target.chatElement.richText.children, i.parentElement))), offset: this.target.chatInput.vnode.textContent === this.target.chatInput.VOID_KEY ? 0 : this.target.chatInput.cursorIndex };
}
setSelectNodes(t, e, i = 0, n = -1) {
let s, a;
const l = t.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), o = e.rank.match(new RegExp(`.{1,${this.rankLen}}`, "g")), r = this.target.chatElement.richText.children[parseFloat(l[0]) - 1], c = this.target.chatElement.richText.children[parseFloat(o[0]) - 1];
if ("gridInput" === t.type) s = r.children[parseFloat(l[1]) - 1];
else if ("gridBox" === t.type) s = -1 === i ? r.lastElementChild : r.children[0];
else {
const t2 = parseFloat(l[1]) - 1, e2 = r.children[t2];
s = -1 === i ? e2.nextElementSibling : e2.previousElementSibling, i = -1 === i ? 0 : -1;
}
if ("gridInput" === e.type) a = c.children[parseFloat(o[1]) - 1];
else if ("gridBox" === t.type) a = -1 === n ? c.lastElementChild : c.children[0];
else {
const t2 = parseFloat(o[1]) - 1, e2 = c.children[t2];
a = -1 === n ? e2.nextElementSibling : e2.previousElementSibling, n = -1 === n ? 0 : -1;
}
const h2 = s.children[0].childNodes[0], d = a.children[0].childNodes[0], p2 = document.createRange(), g = parseFloat(t.rank) > parseFloat(e.rank);
p2[g ? "setEnd" : "setStart"](h2, h2.textContent === this.target.chatInput.VOID_KEY ? 1 : -1 === i ? h2.textContent.length : i), p2[g ? "setStart" : "setEnd"](d, d.textContent === this.target.chatInput.VOID_KEY ? 1 : -1 === n ? d.textContent.length : n);
const u = window.getSelection();
u.removeAllRanges(), u.addRange(p2);
}
getElmByRank(t) {
const e = t.match(new RegExp(`.{1,${this.rankLen}}`, "g")), i = parseFloat(e[0]) - 1, n = -1 === i ? this.target.chatElement.richText.lastElementChild : this.target.chatElement.richText.children[i];
if (1 === e.length) return n;
const s = parseFloat(e[1]) - 1;
return -1 === s ? n.lastElementChild : n.children[s];
}
getRankByElm(t) {
const e = this.target.chatElement.richText.children;
let i = null, n = null;
return Array.prototype.find.call(e, (e2, s) => t === e2 ? (i = s, true) : Array.prototype.find.call(e2.children, (e3, a) => e3 === t && (i = s, n = a, true))), (null !== i ? this.getRank(i) : "") + (null !== n ? this.getRank(n) : "");
}
};
var arrObSort = function(t, e, i) {
return t.forEach((t2) => {
if (i in t2) {
const n = e.indexOf(String(t2[i]));
-1 !== n && (e[n] = t2);
}
}), e.filter((t2) => t2[i]);
};
var ChatArea = class {
constructor(t) {
switch (__publicField(this, "options"), __publicField(this, "deviceInfo", os()), __publicField(this, "chatElement"), __publicField(this, "chatInput"), __publicField(this, "chatEvent"), this.options = Object.assign({}, DEFAULT_OPTIONS, t), this.options.device = this.options.device.toLocaleLowerCase(), this.deviceInfo.isTablet && (this.deviceInfo.isPc = false), this.options.device) {
case "pc":
this.deviceInfo.isPc = true;
break;
case "h5":
this.deviceInfo.isPc = false;
}
this.options.userProps = Object.assign({}, DEFAULT_USER_PROPS, t.userProps || {}), this.options.dialogLabels.pcPointDialog = Object.assign({}, DEFAULT_PC_POINT_DIALOG, getObjValue(t.dialogLabels, "pcPointDialog", {})), this.options.dialogLabels.pcPCheckDialog = Object.assign({}, DEFAULT_PC_CHECK_DIALOG, getObjValue(t.dialogLabels, "pcPCheckDialog", {})), this.options.dialogLabels.h5Dialog = Object.assign({}, DEFAULT_H5_DIALOG, getObjValue(t.dialogLabels, "h5Dialog", {})), this.chatElement = new ChatElement(this), this.chatInput = new ChatInput(this), this.chatEvent = new ChatEvent(this), this.updateConfig(t);
const e = this;
Object.defineProperty(this, "richText", { get: () => e.chatElement.richText }), Object.defineProperty(this, "textLength", { get: () => e.chatEvent.textLength }), this.options.autoFocus && this.nextTick(() => {
this.chatElement.richText.focus();
});
}
updateConfig(t) {
void 0 !== t.copyType && (this.options.copyType = t.copyType), t.userProps && (this.options.userProps = Object.assign({}, DEFAULT_USER_PROPS, t.userProps)), void 0 !== t.uploadImage && (this.options.uploadImage = t.uploadImage), void 0 !== t.placeholder && (this.chatElement.placeholderElm.textContent = t.placeholder), void 0 !== t.maxLength && (this.options.maxLength = t.maxLength <= 0 ? -1 : t.maxLength, this.chatEvent.ruleMaxLength()), this.options.asyncMatch ? (this.options.needCallEvery = false, this.updateUserList([])) : (void 0 !== t.needCallEvery || t.userList) && (this.options.needCallEvery = getBoolean(void 0 === t.needCallEvery ? this.options.needCallEvery : t.needCallEvery), this.updateUserList(t.userList)), void 0 !== t.needCallSpace && this.chatInput.setCallSpace(getBoolean(t.needCallSpace)), void 0 !== t.wrapKeyFun && (this.options.wrapKeyFun = t.wrapKeyFun), void 0 !== t.sendKeyFun && (this.options.sendKeyFun = t.sendKeyFun), this.options.needDialog && t.customTrigger && this.deviceInfo.isPc && (this.options.customTrigger = t.customTrigger, this.chatElement.bindCustomTrigger()), this.options.needDialog && t.selectList && this.deviceInfo.isPc && (this.options.selectList = t.selectList, this.chatElement.bindSelectList());
}
updateUserList(t = void 0) {
const { options: e, chatElement: i } = this;
if (t) {
e.userList = JSON.parse(JSON.stringify(t));
const i2 = { [e.userProps.id]: "isALL", [e.userProps.name]: "" };
e.userList.unshift(i2), e.reformList = t.map((t2, i3) => {
const n2 = t2[e.userProps.id];
if (!n2 && 0 !== n2) throw new Error(`配置项userList:下标第${i3}项${e.userProps.id}值异常!`);
return { id: String(n2), name: String(t2[e.userProps.name] || ""), avatar: String(t2[e.userProps.avatar] || ""), pinyin: String(t2[e.userProps.pinyin] || "") };
});
}
const n = e.userList[0];
n && "isALL" === n[e.userProps.id] && (n[e.userProps.name] = this.deviceInfo.isPc ? e.dialogLabels.pcPointDialog.callEveryLabel : e.dialogLabels.h5Dialog.callEveryLabel), e.needDialog && (this.deviceInfo.isPc ? i.updatePCUser() : i.updateH5User());
}
searchUserList(t) {
return this.options.reformList.filter((e) => pinyinMatch(e.name, e.pinyin || "", t));
}
getReduceNode(t) {
const e = Object.assign({}, DEFAULT_REDUCE_CONFIG, t || {});
e.saveTagData && (e.needUserId = true, e.needTagId = true, e.needSelectId = true);
const i = /(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g, n = this.chatElement.richText.cloneNode(true).children || [], s = document.createElement("div");
return e.wrapClassName && (s.className = e.wrapClassName), Array.from(n, (t2, n2) => {
const a = document.createElement("p");
Array.from(t2.children, (t3) => {
const n3 = t3.children[0];
this.chatInput.getNodeEmpty(n3) || (n3.removeAttribute("data-set-richType"), n3.removeAttribute("contenteditable"), n3.removeAttribute("data-set-empty"), e.needUserId || n3.removeAttribute("data-user-id"), e.needTagId || (n3.removeAttribute("data-set-prefix"), n3.removeAttribute("data-tag-id")), e.needSelectId || (n3.removeAttribute("data-select-id"), n3.removeAttribute("data-select-key")), e.imgToText && n3.firstChild && "IMG" === n3.firstChild.tagName && (n3.classList.add("img-to-text"), n3.innerHTML = `[${n3.firstChild.getAttribute("data-img-text") || "you need set data-img-text"}]`), e.identifyLink && n3.classList.contains("chat-grid-input") && (n3.innerHTML = n3.innerHTML.replace(i, (t4) => `${t4}`)), n3.classList.contains("at-select") && (n3.classList.remove("aim"), n3.removeChild(n3.lastChild)), n3.classList.contains("at-input") && (e.saveTagData ? n3.setAttribute("data-input-tip", n3.children[1].textContent) : n3.removeAttribute("data-input-key"), n3.textContent = n3.children[0].textContent !== this.chatInput.VOID_KEY ? n3.children[0].textContent : n3.children[1].textContent, n3.textContent = n3.textContent.replace(new RegExp(this.chatInput.INPUT_TAG_WRAP_KEY[0], "g"), "")), a.appendChild(n3));
}), e.rowClassName && (a.className = e.rowClassName), a.innerHTML || (a.innerHTML = "
"), s.appendChild(a);
}), s;
}
getText(t) {
let e = "";
const i = this.getReduceNode(t);
return Array.from(i.children, (t2, i2) => {
e = e + (i2 > 0 ? "\n" : "") + t2.textContent;
}), e;
}
getHtml(t) {
return this.getReduceNode(t).innerHTML;
}
async reverseAnalysis(t, e) {
if (!t) return;
const i = document.createElement("div");
i.innerHTML = t;
const n = i.children;
Array.from(n, (t2) => {
t2.className = "chat-grid-wrap", t2.setAttribute("data-set-richType", RICH_GRID);
const e2 = t2.children, i2 = {}, n2 = [];
Array.from(e2, (s2, a2) => {
if (-1 !== s2.className.indexOf("chat-grid-input")) {
const t3 = s2.textContent || "";
return s2.className = "", s2.setAttribute("data-set-richType", RICH_MARK), void (s2.innerHTML = `${t3}`);
}
if (s2.tagName && "BR" === s2.tagName.toLocaleUpperCase()) {
const e3 = this.chatInput.getGridElm(true);
return t2.removeChild(s2), void t2.appendChild(e3);
}
const l = s2.cloneNode(true);
l.setAttribute("contenteditable", "false");
const o = document.createElement("span");
if (o.className = "chat-tag", o.setAttribute("contenteditable", "false"), o.setAttribute("data-set-richType", RICH_TAG), o.appendChild(l), i2[a2] = o, a2 !== e2.length - 1) {
-1 === e2[a2 + 1].className.indexOf("chat-grid-input") && n2.push(a2);
} else n2.push(a2);
0 === a2 && n2.push(-1);
});
for (const n3 in i2) {
const s2 = Number(n3), a2 = i2[n3].lastChild;
if (a2.classList.contains("at-select")) a2.innerHTML = `${a2.textContent}${arrowSvg}`;
else if (a2.classList.contains("at-input")) {
const t3 = "" === a2.textContent, e3 = t3 ? `${a2.getAttribute("data-input-tip")}` : `${a2.getAttribute("data-input-tip")}`;
a2.innerHTML = `${t3 ? this.chatInput.VOID_KEY : a2.textContent.replace(new RegExp(this.chatInput.INPUT_TAG_WRAP_KEY[1], "g"), this.chatInput.INPUT_TAG_WRAP_KEY)}${e3}`, a2.removeAttribute("data-input-tip");
}
s2 === e2.length - 1 ? (t2.removeChild(e2[s2]), t2.appendChild(i2[n3])) : (t2.insertBefore(i2[n3], e2[s2 + 1]), t2.removeChild(e2[s2]));
}
const s = [], a = t2.children;
n2.forEach((t3) => {
t3 === a.length - 1 ? s.push("isEnd") : s.push(a[t3 + 1]);
}), s.forEach((e3) => {
const i3 = this.chatInput.getGridElm(true);
if ("isEnd" === e3) t2.appendChild(i3);
else {
const n3 = i3.children[0];
n3.childNodes.length > 1 && n3.removeChild(n3.childNodes[1]), t2.insertBefore(i3, e3);
}
});
}), e ? (this.chatInput.setRangeLastText(), await this.chatEvent.insertInsideHtml(i.innerHTML)) : (this.chatElement.richText.innerHTML = i.innerHTML, this.chatInput.setRangeLastText(), await this.chatEvent.richTextInput());
}
async insertHtml(t) {
if (!t) return;
const e = document.createElement("span");
e.innerHTML = t, e.className = "chat-set-html";
const i = this.chatInput.createNewDom(e);
return this.chatInput.replaceRegContent(i, false), await this.chatEvent.richTextInput(), i;
}
async insertText(t) {
if (!t) return;
const e = new RegExp(`[${this.chatInput.ZERO_WIDTH_KEY}|${this.chatInput.VOID_KEY}]`, "ig"), i = t.replace(e, "");
if (!i) return;
const n = i.split("\n");
let s = "";
n.forEach((t2) => {
const e2 = "" !== t2;
s += `${e2 ? t2 : this.chatInput.VOID_KEY + "
"}
`;
}), await this.chatEvent.insertInsideHtml(s);
}
getCallUserList() {
const t = this.chatElement.richText.querySelectorAll(".at-user");
if (t && t.length > 0) {
const e = Array.from(t, (t2) => t2.dataset.userId);
return arrObSort(this.options.userList, e, this.options.userProps.id);
}
return [];
}
getCallUserTagList() {
const t = this.chatElement.richText.querySelectorAll(".at-user");
if (t && t.length > 0) {
const e = [];
return Array.from(t, (t2) => {
e.some((e2) => e2[this.options.userProps.id] === t2.dataset.userId) || e.push({ [this.options.userProps.id]: t2.dataset.userId, [this.options.userProps.name]: t2.textContent.slice(1) });
}), e;
}
return [];
}
getCustomTagList() {
const t = Object.keys(this.chatElement.customTags), e = {}, i = this.chatElement.richText.querySelectorAll(".at-tag");
return t.forEach((t2) => {
let n = Array.prototype.filter.call(i, (e2) => e2.getAttribute("data-set-prefix") === String(t2)).map((t3) => t3.getAttribute("data-tag-id"));
n = n.filter((t3, e2) => n.indexOf(t3) === e2), e[t2] = arrObSort(this.chatElement.customTags[t2], n, "id");
}), e;
}
getSelectTagList() {
const t = Object.keys(this.chatElement.selectTags), e = {}, i = this.chatElement.richText.querySelectorAll(".at-select");
return t.forEach((t2) => {
let n = Array.prototype.filter.call(i, (e2) => e2.getAttribute("data-select-key") === String(t2)).map((t3) => t3.getAttribute("data-select-id"));
n = n.filter((t3, e2) => n.indexOf(t3) === e2), e[t2] = arrObSort(this.chatElement.selectTags[t2], n, "id");
}), e;
}
getInputTagList() {
const t = {}, e = this.chatElement.richText.querySelectorAll(".at-input");
return Array.from(e, (e2) => {
const i = e2.getAttribute("data-input-key"), n = e2.children[0].textContent === this.chatInput.VOID_KEY ? null : e2.children[0].textContent;
t[i] || (t[i] = []), t[i].push(n);
}), t;
}
async clear(t) {
this.chatInput.initEditor(true, t), this.clearHistory(), await this.chatEvent.richTextInput(false);
}
isEmpty(t = false) {
if ((this.chatElement.richText.querySelectorAll(".chat-tag") || []).length > 0) return false;
const e = new RegExp(`^(${this.chatInput.ZERO_WIDTH_KEY}|
|${this.chatInput.VOID_KEY})+$`), i = this.chatElement.richText.querySelectorAll(".chat-grid-input") || [];
return t ? Array.prototype.every.call(i, (t2) => !t2.innerHTML || !t2.textContent || !t2.textContent.trim() || e.test(t2.innerHTML)) : Array.prototype.every.call(i, (t2) => !t2.innerHTML || !t2.textContent || e.test(t2.innerHTML));
}
dispose() {
if (this.options.elm.removeChild(this.chatElement.richText), this.options.elm.removeChild(this.chatElement.placeholderElm), this.options.needDialog) if (this.deviceInfo.isPc) {
const t = this.chatElement.pcElms.containerDialogElm.parentElement;
t && t.removeChild(this.chatElement.pcElms.containerDialogElm);
} else document.body.removeChild(this.chatElement.h5Elms.dialogElm);
}
showPCPointDialog() {
this.options.needDialog && (this.insertText("@"), this.options.asyncMatch && domItVisible(this.chatElement.pcElms.pointDialogEmptyElm, true, "flex"), this.chatEvent.outerApply = true, this.chatElement.showPointDialog(), sleep(50).then(() => {
this.chatEvent.outerApply = false;
}));
}
showPCCheckDialog() {
this.options.needDialog && !this.options.asyncMatch && (this.chatEvent.winClick(), this.chatElement.checkboxRows = [], domItVisible(this.chatElement.pcElms.checkDialogElm, true), updateElmClass(document.body, "disable-scroll", true), this.chatElement.pcElms.checkDialogTagsElm.scrollTop = 0, this.chatElement.pcElms.checkDialogUsersElm.scrollTop = 0, this.chatElement.pcElms.checkDialogSearchInputElm.value = "", this.chatElement.updateCheckDialogTags(), this.chatElement.isExternalCallPopup = true);
}
showPCCustomTagDialog(t) {
this.options.needDialog && !this.options.asyncMatch && (this.insertText(t), this.chatEvent.outerApply = true, this.chatElement.showCustomTagDialog(t), sleep(50).then(() => {
this.chatEvent.outerApply = false;
}));
}
showPCSelectDialog(t, e) {
this.chatElement.exitCustomTagDialog(), this.chatElement.exitPointDialog(), this.chatEvent.outerApply = true, e && (this.chatElement.exitSelectDialog(), this.chatElement.pcElms.selectDialogAim = e), this.chatElement.pcElms.selectDialogKey = t, this.chatEvent.debounceEvents.selectDialogToAim(), sleep(50).then(() => {
this.chatEvent.outerApply = false;
});
}
showH5Dialog() {
this.chatElement.richText && this.chatElement.richText.blur(), Array.from(this.chatElement.h5Elms.dialogMainElm.children, (t) => {
t.style.display = "", updateElmClass(t, "user-popup-check-item-check");
}), updateElmClass(this.chatElement.h5Elms.dialogCheckElm, "disabled", true), domItVisible(this.chatElement.h5Elms.dialogElm, true), updateElmClass(document.body, "disable-scroll", true), this.options.asyncMatch && domItVisible(this.chatElement.h5Elms.dialogEmptyElm, true, "flex"), this.chatElement.h5Elms.dialogMainElm.scrollTop = 0, this.chatElement.isExternalCallPopup = true;
}
disabled() {
this.chatElement.richText.setAttribute("contenteditable", "false"), updateElmClass(this.chatElement.richText, "chat-rich-text-disabled", true);
}
enable() {
this.chatElement.richText.setAttribute("contenteditable", "true"), updateElmClass(this.chatElement.richText, "chat-rich-text-disabled"), this.chatInput.setRangeLastText();
}
async setUserTag(t) {
this.chatEvent.triggerChatEvent("atCheck", [t]);
const e = this.chatInput.createChatTagElm({ id: t[this.options.userProps.id], name: t[this.options.userProps.name] }, "@", "at-user", "user-id");
this.chatInput.replaceRegContent(e, false), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterAtCheck", [t]);
}
async setCustomTag(t, e) {
this.chatEvent.triggerChatEvent("tagCheck", t, e), await this.chatInput.onceCustomCall(t, false, e), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterTagCheck", t, e);
}
async setSelectTag(t, e) {
if (e || (e = this.chatElement.pcElms.selectDialogKey), this.chatEvent.triggerChatEvent("selectCheck", t, e), this.chatElement.pcElms.selectDialogAim && this.chatElement.pcElms.selectDialogAim.classList.contains("at-select")) {
const e2 = this.chatElement.pcElms.selectDialogAim.getAttribute("data-select-id"), i = this.chatElement.pcElms.selectDialogAim.parentElement.nextElementSibling.childNodes[0].childNodes[0];
if (this.chatInput.restCursorPos(i), e2 === t.id) return;
this.chatElement.pcElms.selectDialogAim.setAttribute("data-select-id", t.id), this.chatElement.pcElms.selectDialogAim.childNodes[0].textContent = t.name;
} else {
const i = document.createElement("span");
i.setAttribute("class", "at-select"), i.setAttribute("data-select-key", e), i.setAttribute("data-select-id", t.id), i.innerHTML = `${t.name}${arrowSvg}`;
const n = this.chatInput.createNewDom(i);
this.chatInput.replaceRegContent(n, false);
}
await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterSelectCheck", t, e);
}
async setInputTag(t, e, i = "") {
const n = document.createElement("span");
n.setAttribute("class", "at-input"), n.setAttribute("contenteditable", "false"), n.setAttribute("data-input-key", t);
const s = document.createElement("span");
s.setAttribute("class", "input-write"), s.setAttribute("contenteditable", "true"), s.textContent = i || this.chatInput.VOID_KEY;
const a = document.createElement("span");
a.setAttribute("class", "input-tip"), a.textContent = "[" + (e || "Please input") + "]", n.appendChild(s), n.appendChild(a);
const l = this.chatInput.createNewDom(n);
this.chatInput.replaceRegContent(l, false), i && this.chatInput.watchInputTag(s), this.chatInput.rangeToInputTag(n), await this.chatEvent.richTextInput();
}
async matchSetTag(t) {
this.chatEvent.triggerChatEvent("atCheck", [t]), await this.chatInput.onceSearchCall(t, this.chatEvent.startOpenIndex), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterAtCheck", [t]);
}
async onceSetTag(t) {
this.chatEvent.triggerChatEvent("atCheck", [t]), await this.chatInput.onceCall({ id: t[this.options.userProps.id], name: t[this.options.userProps.name] }), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterAtCheck", [t]);
}
async batchSetTag(t) {
this.chatEvent.triggerChatEvent("atCheck", t);
const e = [];
for (let i = 0; i <= t.length - 1; ) e.push({ id: t[i][this.options.userProps.id], name: t[i][this.options.userProps.name] }), i++;
await this.chatInput.batchReplaceRegContent(e, !this.chatElement.isExternalCallPopup), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterAtCheck", t);
}
async onceSetCustomTag(t, e) {
e || (e = this.chatElement.pcElms.customTagDialogTagKey), this.chatEvent.triggerChatEvent("tagCheck", t, e), await this.chatInput.onceCustomCall(t, true, e), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterTagCheck", t, e);
}
async matchSetCustomTag(t, e) {
e || (e = this.chatElement.pcElms.customTagDialogTagKey), this.chatEvent.triggerChatEvent("tagCheck", t, e), await this.chatInput.onceCustomCall(t, this.chatEvent.startOpenIndex, e), await this.chatEvent.richTextInput(), this.chatEvent.triggerChatEvent("afterTagCheck", e);
}
async undo() {
const { chatEvent: t } = this;
if (!t.doOverHistory || !t.undoHistory || t.undoHistory.length <= 1) return;
const e = t.undoHistory[t.undoHistory.length - 2], i = t.undoHistory[t.undoHistory.length - 1];
t.redoHistory.push(i), t.undoHistory.pop(), await t.setChatHistory(e);
}
async redo() {
const { chatEvent: t } = this;
if (!t.doOverHistory || !t.redoHistory || t.redoHistory.length < 1) return;
const e = t.redoHistory[t.redoHistory.length - 1];
t.redoHistory.pop(), t.undoHistory.push(e), await t.setChatHistory(e);
}
clearHistory() {
const { gridIndex: t, markIndex: e } = this.chatInput.getRichTextNodeIndex(this.chatInput.vnode);
this.chatEvent.undoHistory = null === t || null == e ? [{ html: this.chatElement.richText.innerHTML, gridIndex: 0, markIndex: 0, cursorIndex: this.chatInput.cursorIndex }] : [{ html: this.chatElement.richText.innerHTML, gridIndex: t, markIndex: e, cursorIndex: this.chatInput.cursorIndex }], this.chatEvent.redoHistory = [];
}
cursorMove(t) {
if (0 === t) return void this.chatInput.restCursorPos(this.chatInput.vnode, this.chatInput.cursorIndex);
const e = new RegExp(`[${this.chatInput.ZERO_WIDTH_KEY}|${this.chatInput.VOID_KEY}]`, "ig");
if (t > 0) {
const i = this.chatInput.vnode.textContent.replace(e, "").slice(this.chatInput.cursorIndex);
if (i.length >= t) return this.chatInput.cursorIndex += t, void this.chatInput.restCursorPos(this.chatInput.vnode, this.chatInput.cursorIndex);
const n = this.chatInput.vnode.parentElement.parentElement, s = n.parentElement;
let a = Boolean(n.nextElementSibling && n.nextElementSibling.nextElementSibling);
const l = Boolean(s.nextElementSibling);
if (!a && !l) return this.chatInput.cursorIndex += i.length, 0 === this.chatInput.cursorIndex && (this.chatInput.cursorIndex = 1), void this.chatInput.restCursorPos(this.chatInput.vnode, this.chatInput.cursorIndex);
const o = t - i.length - 1, r = a ? n.nextElementSibling.nextElementSibling : s.nextElementSibling.children[0], { rangeNode: c, rangeIndex: h2 } = this.chatInput.getOffsetRange(o, r);
this.chatInput.restCursorPos(c, h2);
} else if (t < 0) {
let i = Math.abs(t);
const n = this.chatInput.vnode.textContent.replace(e, "").slice(0, this.chatInput.cursorIndex);
if (n.length >= i) return this.chatInput.cursorIndex -= i, void this.chatInput.restCursorPos(this.chatInput.vnode, this.chatInput.cursorIndex);
const s = this.chatInput.vnode.parentElement.parentElement, a = s.parentElement, l = Boolean(s.previousElementSibling && s.previousElementSibling.previousElementSibling), o = Boolean(a.previousElementSibling);
if (!l && !o) return void this.chatInput.restCursorPos(this.chatInput.vnode);
i = i - n.length - 1;
const r = l ? s.previousElementSibling.previousElementSibling : a.previousElementSibling.lastElementChild, { rangeNode: c, rangeIndex: h2 } = this.chatInput.getOffsetRange(i, r, true);
this.chatInput.restCursorPos(c, h2);
}
}
async cursorDel(t) {
if (0 === t) return void this.chatInput.restCursorPos(this.chatInput.vnode, this.chatInput.cursorIndex);
const e = this.chatInput.vnode, i = this.chatInput.cursorIndex;
this.cursorMove(t);
const n = this.chatInput.vnode, s = this.chatInput.cursorIndex, a = document.createRange();
t < 0 ? (a.setStart(n, s), a.setEnd(e, i)) : (a.setStart(e, i), a.setEnd(n, s));
const l = window.getSelection();
l.removeAllRanges(), l.addRange(a), (this.chatInput.selectRegionMerge() || this.chatInput.gridElmMerge() || this.chatInput.delMarkRule()) && await this.chatEvent.richTextInput();
}
async delUserTags(t) {
const e = t || this.options.userList.map((t2) => t2[this.options.userProps.id]), i = this.chatElement.richText.querySelectorAll(".at-user"), n = [];
Array.from(i, (t2) => {
const i2 = t2.getAttribute("data-user-id");
e.some((t3) => String(t3) === i2) && n.push(t2.parentElement);
});
for (let t2 = 0; t2 < n.length; ) {
const e2 = n[t2];
this.chatInput.delTag(e2), t2++;
}
this.chatInput.setRangeLastText(), await this.chatEvent.richTextInput();
}
async delCustomTags(t, e) {
const i = this.options.customTrigger.find((e2) => e2.prefix === t);
if (!i || 0 === i.tagList.length) return;
const n = e || i.tagList.map((t2) => t2.id), s = this.chatElement.richText.querySelectorAll(".at-tag"), a = [];
Array.from(s, (e2) => {
const i2 = e2.getAttribute("data-set-prefix"), s2 = e2.getAttribute("data-tag-id");
i2 === t && n.some((t2) => String(t2) === s2) && a.push(e2.parentElement);
});
for (let t2 = 0; t2 < a.length; ) {
const e2 = a[t2];
this.chatInput.delTag(e2), t2++;
}
this.chatInput.setRangeLastText(), await this.chatEvent.richTextInput();
}
async delSelectTags(t, e) {
const i = this.options.selectList.find((e2) => e2.key === t);
if (!i || 0 === i.options.length) return;
const n = e || i.options.map((t2) => t2.id), s = this.chatElement.richText.querySelectorAll(".at-select"), a = [];
Array.from(s, (e2) => {
const i2 = e2.getAttribute("data-select-key"), s2 = e2.getAttribute("data-select-id");
i2 === t && n.some((t2) => String(t2) === s2) && a.push(e2.parentElement);
});
for (let t2 = 0; t2 < a.length; ) {
const e2 = a[t2];
this.chatInput.delTag(e2), t2++;
}
this.chatInput.setRangeLastText(), await this.chatEvent.richTextInput();
}
async delInputTags(t) {
const e = this.chatElement.richText.querySelectorAll(".at-input"), i = [];
Array.from(e, (e2) => {
if (t) {
const n = e2.getAttribute("data-input-key");
t.some((t2) => String(t2) === n) && i.push(e2.parentElement);
} else i.push(e2.parentElement);
});
for (let t2 = 0; t2 < i.length; ) {
const e2 = i[t2];
this.chatInput.delTag(e2), t2++;
}
this.chatInput.setRangeLastText(), await this.chatEvent.richTextInput();
}
openTipTag(t) {
this.chatElement.createTipElm(t), this.chatInput.setRangeLastText();
}
closeTipTag() {
this.chatElement.tipElm && this.chatElement.removeTipElm();
}
addEventListener(t, e) {
this.chatEvent.chatEventModule[t].push(e);
}
removeEventListener(t, e) {
const i = this.chatEvent.chatEventModule[t], n = i.indexOf(e);
-1 !== n && i.splice(n, 1);
}
revisePCPointDialogLabel(t) {
this.options.needDialog && (this.options.dialogLabels.pcPointDialog = Object.assign({}, DEFAULT_PC_POINT_DIALOG, t || {}), this.chatElement.pcElms.pointDialogElm.querySelector(".call-user-dialog-header-title").textContent = this.options.dialogLabels.pcPointDialog.title, this.chatElement.pcElms.pointDialogCheckElm.textContent = this.options.dialogLabels.pcPointDialog.checkLabel, this.chatElement.pcElms.pointDialogEmptyElm && (this.chatElement.pcElms.pointDialogEmptyElm.children[1].textContent = this.options.dialogLabels.pcPointDialog.emptyLabel), this.options.asyncMatch || this.updateUserList());
}
revisePCCheckDialogLabel(t) {
this.options.needDialog && !this.options.asyncMatch && (this.options.dialogLabels.pcPCheckDialog = Object.assign({}, DEFAULT_PC_CHECK_DIALOG, t || {}), this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-container-header").children[0].textContent = this.options.dialogLabels.pcPCheckDialog.title, this.chatElement.pcElms.checkDialogSearchInputElm.setAttribute("placeholder", this.options.dialogLabels.pcPCheckDialog.searchPlaceholder), this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-search-empty").textContent = this.options.dialogLabels.pcPCheckDialog.searchEmptyLabel, this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-right-box-title").textContent = this.options.dialogLabels.pcPCheckDialog.userTagTitle, this.chatElement.pcElms.checkDialogUsersElm.children[0].children[2].textContent = this.options.dialogLabels.pcPCheckDialog.checkAllLabel, this.chatElement.pcElms.checkDialogElm.querySelector(".btn-submit").textContent = this.options.dialogLabels.pcPCheckDialog.confirmLabel, this.chatElement.pcElms.checkDialogElm.querySelector(".btn-close").textContent = this.options.dialogLabels.pcPCheckDialog.cancelLabel);
}
reviseH5DialogLabel(t) {
this.options.needDialog && (this.options.dialogLabels.h5Dialog = Object.assign({}, DEFAULT_H5_DIALOG, t || {}), this.chatElement.h5Elms.dialogElm.querySelector(".popup-title").textContent = this.options.dialogLabels.h5Dialog.title, this.chatElement.h5Elms.dialogSearchElm.setAttribute("placeholder", this.options.dialogLabels.h5Dialog.searchPlaceholder), this.chatElement.h5Elms.dialogEmptyElm.children[1].textContent = this.options.dialogLabels.h5Dialog.searchEmptyLabel, this.chatElement.h5Elms.dialogCheckElm.textContent = this.options.dialogLabels.h5Dialog.confirmLabel, this.chatElement.h5Elms.dialogShowElm.textContent = this.options.dialogLabels.h5Dialog.cancelLabel, this.options.asyncMatch || this.updateUserList());
}
createOperateNode() {
return new ChatOperateNode(this);
}
async nextTick(t) {
return new Promise((e) => {
requestAnimationFrame(() => {
const i = t();
i instanceof Promise ? i.then(() => {
e();
}) : e();
});
});
}
};
__publicField(ChatArea, "version", "5.7.2");
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/EditorSender/index.js
var _hoisted_1$42 = { class: "el-send-button" };
var _sfc_main$45 = defineComponent({
__name: "index",
props: {
disabled: {
type: Boolean,
default: false
}
},
emits: ["clear"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$42, [
createVNode(_component_el_button, {
circle: "",
disabled: props.disabled,
onClick: _cache[0] || (_cache[0] = ($event) => emit("clear"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(brush_default))
]),
_: 1
})
]),
_: 1
}, 8, ["disabled"])
]);
};
}
});
var ClearButton = _export_sfc2(_sfc_main$45, [["__scopeId", "data-v-a84afe1a"]]);
var _sfc_main$35 = {};
var _hoisted_1$32 = {
viewBox: "0 0 1000 1000",
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
};
function _sfc_render5(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$32, _cache[0] || (_cache[0] = [
createBaseVNode("title", null, "Loading", -1),
createBaseVNode("rect", {
fill: "currentColor",
height: "250",
rx: "24",
ry: "24",
width: "250",
x: "375",
y: "375"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
opacity: "0.45"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
"stroke-dasharray": "600 9999999"
}, [
createBaseVNode("animateTransform", {
attributeName: "transform",
dur: "1s",
from: "0 500 500",
repeatCount: "indefinite",
to: "360 500 500",
type: "rotate"
})
], -1)
]));
}
var loading = _export_sfc2(_sfc_main$35, [["render", _sfc_render5]]);
var _hoisted_1$22 = { class: "el-send-button" };
var _sfc_main$25 = defineComponent({
__name: "index",
emits: ["cancel"],
setup(__props, { emit: __emit }) {
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$22, [
createVNode(_component_el_button, {
circle: "",
onClick: _cache[0] || (_cache[0] = ($event) => emits("cancel"))
}, {
default: withCtx(() => [
createVNode(loading, { class: "loading-svg" })
]),
_: 1
})
]);
};
}
});
var LoadingButton = _export_sfc2(_sfc_main$25, [["__scopeId", "data-v-70409eb5"]]);
var _hoisted_1$13 = { class: "el-send-button" };
var _sfc_main$18 = defineComponent({
__name: "index",
props: {
disabled: {
type: Boolean,
default: false
}
},
emits: ["submit"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$13, [
createVNode(_component_el_button, {
circle: "",
disabled: props.disabled,
onClick: _cache[0] || (_cache[0] = ($event) => emits("submit"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(top_default))
]),
_: 1
})
]),
_: 1
}, 8, ["disabled"])
]);
};
}
});
var _hoisted_17 = {
key: 0,
class: "el-editor-sender-header"
};
var _hoisted_25 = { class: "el-editor-sender-header-container" };
var _hoisted_35 = {
key: 0,
class: "el-editor-sender-prefix"
};
var _hoisted_45 = {
key: 1,
class: "el-editor-sender-action-list"
};
var _hoisted_55 = { class: "el-editor-sender-action-list-presets" };
var _hoisted_64 = {
key: 2,
class: "el-editor-sender-updown-action-list"
};
var _hoisted_73 = {
key: 0,
class: "el-editor-sender-prefix"
};
var _hoisted_82 = { class: "el-editor-sender-action-list" };
var _hoisted_9 = { class: "el-editor-sender-action-list-presets" };
var _hoisted_10 = {
key: 0,
class: "el-editor-sender-footer"
};
var _sfc_main12 = defineComponent({
__name: "index",
props: {
placeholder: { default: "请输入内容" },
device: { default: "pc" },
autoFocus: { type: Boolean, default: false },
variant: { default: "default" },
userList: { default: () => [] },
customTrigger: { default: () => [] },
selectList: { default: () => [] },
maxLength: { default: void 0 },
submitType: { default: "enter" },
customStyle: { default: () => ({}) },
loading: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
clearable: { type: Boolean, default: false },
headerAnimationTimer: { default: 300 },
asyncMatchFun: { type: Function, default: void 0 },
customDialog: { type: Boolean, default: false }
},
emits: ["submit", "change", "cancel", "showAtDialog", "showSelectDialog", "showTagDialog"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const chat = ref();
const opNode = ref();
const container = ref();
const chatState = reactive({
isEmpty: true,
textLength: 0,
// 该属性值只会在配置了maxLength情况下才拥有赋值
lastFocusNode: null,
lastOffset: 0,
wrapCallSelectDialog: false,
// 记录是否是外部调用了选择弹窗进行插值行为操作
beforeText: "",
afterText: ""
});
function createChat() {
chat.value = new ChatArea({
elm: container.value,
...props,
userList: JSON.parse(JSON.stringify(props.userList)),
needDialog: !props.customDialog && props.device === "pc",
copyType: ["text"],
asyncMatch: Boolean(props.asyncMatchFun),
needDebounce: true,
needCallSpace: false,
sendKeyFun: props.submitType === "enter" ? (event) => !event.shiftKey && event.key === "Enter" : (event) => event.shiftKey && event.key === "Enter",
wrapKeyFun: props.submitType === "shiftEnter" ? (event) => !event.shiftKey && event.key === "Enter" : (event) => event.shiftKey && event.key === "Enter"
});
opNode.value = chat.value.createOperateNode();
chat.value.addEventListener("enterSend", onSubmit);
chat.value.addEventListener("operate", () => {
chatState.isEmpty = chat.value.isEmpty(true);
chatState.textLength = chat.value.textLength;
emits("change");
});
chat.value.richText.addEventListener(
"blur",
() => {
const sel = getSelection();
chatState.lastFocusNode = sel.focusNode;
chatState.lastOffset = sel.focusOffset;
},
true
);
chat.value.addEventListener("selectCheck", () => {
var _a3;
if (chatState.wrapCallSelectDialog && chatState.beforeText) {
(_a3 = chat.value) == null ? void 0 : _a3.insertText(chatState.beforeText);
chatState.beforeText = "";
}
});
chat.value.addEventListener("afterSelectCheck", () => {
var _a3;
if (chatState.wrapCallSelectDialog && chatState.afterText) {
(_a3 = chat.value) == null ? void 0 : _a3.insertText(chatState.afterText);
chatState.afterText = "";
chatState.wrapCallSelectDialog = false;
}
});
if (props.asyncMatchFun) {
chat.value.addEventListener("atMatch", props.asyncMatchFun);
}
chat.value.addEventListener("showAtDialog", () => {
emits("showAtDialog");
});
chat.value.addEventListener(
"showSelectDialog",
(key2, elm) => {
emits("showSelectDialog", key2, elm);
}
);
chat.value.addEventListener("showTagDialog", (prefix) => {
emits("showTagDialog", prefix);
});
if (props.disabled) {
chat.value.disabled();
}
window.addEventListener("keydown", keydownESC);
}
function getCurrentValue() {
const text3 = chat.value.getText();
const html3 = chat.value.getHtml();
const inputTags = chat.value.getInputTagList();
const userTags = props.userList.length > 0 ? chat.value.getCallUserTagList() : void 0;
const selectTags = props.selectList.length > 0 ? chat.value.getSelectTagList() : void 0;
const customTags = props.customTrigger.length > 0 ? chat.value.getCustomTagList() : void 0;
return {
text: text3,
html: html3,
inputTags,
userTags,
selectTags,
customTags
};
}
function onSubmit() {
if (chatState.isEmpty) {
return;
}
emits("submit", getCurrentValue());
}
function onCancel() {
emits("cancel");
}
function onClear(txt2) {
chat.value.clear(txt2);
focusToEnd();
}
function onContentMouseDown() {
requestAnimationFrame(() => {
var _a3;
const focusElm = (_a3 = chatState.lastFocusNode) == null ? void 0 : _a3.parentElement;
const chatInput = chat.value.chatInput;
if (focusElm && focusElm.classList.contains("input-write")) {
chatInput.setInputTagRange(chatState.lastFocusNode, chatState.lastOffset);
} else {
chatInput.restCursorPos(chatInput.vnode, chatInput.cursorIndex);
}
});
}
function focusToStart() {
if (chat.value && opNode.value) {
opNode.value.setCursorNode(
opNode.value.getNodeByRank(
opNode.value.getRank(0) + opNode.value.getRank(0)
),
0
);
}
}
function focusToEnd() {
if (chat.value && opNode.value) {
opNode.value.setCursorNode(
opNode.value.getNodeByRank(
opNode.value.getRank(-1) + opNode.value.getRank(-1)
)
);
}
}
function blur() {
if (chat.value) {
const selection = getSelection();
selection.removeAllRanges();
chat.value.richText.blur();
}
}
function selectAll() {
if (chat.value && opNode.value) {
const firstNode = opNode.value.getNodeByRank(
opNode.value.getRank(0) + opNode.value.getRank(0)
);
const lastNode = opNode.value.getNodeByRank(
opNode.value.getRank(-1) + opNode.value.getRank(-1)
);
opNode.value.setSelectNodes(firstNode, lastNode);
}
}
function setSelectTag(key2, tagId) {
var _a3, _b2, _c;
chatState.wrapCallSelectDialog = false;
const tag = (_b2 = (_a3 = props.selectList) == null ? void 0 : _a3.find((option2) => option2.key === key2)) == null ? void 0 : _b2.options.find((tag2) => tag2.id === tagId);
if (tag) {
(_c = chat.value) == null ? void 0 : _c.setSelectTag(tag, key2);
}
}
function setInputTag(key2, placeholder, defaultValue) {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.setInputTag(key2, placeholder, defaultValue);
}
function setUserTag(userId) {
var _a3, _b2;
const user = (_a3 = props.userList) == null ? void 0 : _a3.find((user2) => user2.id === userId);
if (user) {
(_b2 = chat.value) == null ? void 0 : _b2.setUserTag(user);
}
}
function setCustomTag(prefix, id) {
var _a3, _b2, _c;
const custom = (_b2 = (_a3 = props.customTrigger) == null ? void 0 : _a3.find((option2) => option2.prefix === prefix)) == null ? void 0 : _b2.tagList.find((tag) => tag.id === id);
if (custom) {
(_c = chat.value) == null ? void 0 : _c.setCustomTag(custom, prefix);
}
}
function setMixTags(tags) {
var _a3;
const chatNodes = tags.map((row, index) => {
var _a22;
return {
type: "gridBox",
rank: (_a22 = opNode.value) == null ? void 0 : _a22.getRank(index),
children: row.map((cRow) => {
return {
type: cRow.type,
text: cRow.value,
html: cRow.value,
dataset: {
id: cRow.value,
name: getNameByTypeId(cRow),
prefix: cRow.key,
key: cRow.key,
placeholder: cRow.placeholder,
value: cRow.value
}
};
})
};
});
(_a3 = opNode.value) == null ? void 0 : _a3.coverNodes(chatNodes);
}
function getNameByTypeId(mixTag) {
var _a3, _b2, _c, _d, _e, _f, _g, _h;
const { type, value, key: key2 } = mixTag;
switch (type) {
case "userTag":
return ((_b2 = (_a3 = props.userList) == null ? void 0 : _a3.find((user) => user.id === value)) == null ? void 0 : _b2.name) || "";
case "selectTag":
return ((_e = (_d = (_c = props.selectList) == null ? void 0 : _c.find((row) => row.key === key2)) == null ? void 0 : _d.options.find((select) => select.id === value)) == null ? void 0 : _e.name) || "";
case "customTag":
return ((_h = (_g = (_f = props.customTrigger) == null ? void 0 : _f.find((row) => row.prefix === key2)) == null ? void 0 : _g.tagList.find((custom) => custom.id === value)) == null ? void 0 : _h.name) || "";
default:
return "";
}
}
function setHtml(html3) {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.insertHtml(html3);
}
function setText(txt2) {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.insertText(txt2);
}
function openSelectDialog(option2) {
var _a3;
chatState.beforeText = option2.beforeText || "";
chatState.afterText = option2.afterText || "";
chatState.wrapCallSelectDialog = true;
(_a3 = chat.value) == null ? void 0 : _a3.showPCSelectDialog(option2.key, option2.elm);
}
function openTipTag(options) {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.openTipTag({
...options,
codeLabel: "ESC"
});
}
function closeTipTag() {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.closeTipTag();
}
function keydownESC(event) {
if (event.key === "Escape") {
closeTipTag();
}
}
function customSetUser(user) {
chat.value.onceSetTag(user);
}
function customSetTag(prefix, tag) {
chat.value.onceSetCustomTag(tag, prefix);
}
function updateSelectTag(elm, tag) {
var _a3, _b2, _c;
const rank = (_a3 = opNode.value) == null ? void 0 : _a3.getRankByElm(elm.parentElement);
if (!rank) {
return;
}
const chatNode = (_b2 = opNode.value) == null ? void 0 : _b2.getNodeByRank(rank);
if (!chatNode) {
return;
}
const dataset = chatNode.dataset;
dataset.id = tag.id;
dataset.name = tag.name;
(_c = opNode.value) == null ? void 0 : _c.updateNode(chatNode);
}
watch(
() => props.disabled,
() => {
var _a3, _b2;
props.disabled ? (_a3 = chat.value) == null ? void 0 : _a3.disabled() : (_b2 = chat.value) == null ? void 0 : _b2.enable();
}
);
watch(
() => props.placeholder,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
placeholder: props.placeholder
});
}
);
watch(
() => props.maxLength,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
maxLength: props.maxLength
});
}
);
watch(
() => props.submitType,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
sendKeyFun: props.submitType === "enter" ? (event) => !event.shiftKey && event.key === "Enter" : (event) => event.shiftKey && event.key === "Enter",
wrapKeyFun: props.submitType === "shiftEnter" ? (event) => !event.shiftKey && event.key === "Enter" : (event) => event.shiftKey && event.key === "Enter"
});
}
);
watch(
() => props.userList,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
userList: props.userList
});
},
{ deep: true }
);
watch(
() => props.selectList,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
selectList: props.selectList
});
},
{ deep: true }
);
watch(
() => props.customTrigger,
() => {
var _a3;
(_a3 = chat.value) == null ? void 0 : _a3.updateConfig({
customTrigger: props.customTrigger
});
},
{ deep: true }
);
onMounted(() => {
createChat();
});
onBeforeUnmount(() => {
if (chat.value) {
chat.value.dispose();
chat.value = void 0;
opNode.value = void 0;
window.removeEventListener("keydown", keydownESC);
}
});
__expose({
getCurrentValue,
focusToStart,
focusToEnd,
blur,
selectAll,
clear: onClear,
setSelectTag,
setInputTag,
setUserTag,
setCustomTag,
setMixTags,
setHtml,
setText,
openSelectDialog,
customSetUser,
customSetTag,
updateSelectTag,
openTipTag,
closeTipTag,
chat,
// 暴露chat实例对象
opNode,
// 暴露ChatNode操作对象
chatState
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: "el-editor-sender-wrap",
style: normalizeStyle({
"--el-editor-sender-header-duration": `${_ctx.headerAnimationTimer}ms`
})
}, [
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_17, [
createBaseVNode("div", _hoisted_25, [
renderSlot(_ctx.$slots, "header", {}, void 0, true)
])
])) : createCommentVNode("", true)
]),
_: 3
}),
createBaseVNode("div", {
class: normalizeClass(["el-editor-sender-content", { "content-variant-updown": props.variant === "updown" }]),
onMousedown: onContentMouseDown
}, [
_ctx.$slots.prefix && props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_35, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", {
class: "el-editor-sender-chat-room",
onMousedown: withModifiers(() => {
}, ["stop"])
}, [
createBaseVNode("div", {
ref_key: "container",
ref: container,
style: normalizeStyle({ ..._ctx.customStyle }),
class: "el-editor-sender-chat"
}, null, 4)
], 32),
props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_45, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_55, [
!props.loading ? (openBlock(), createBlock(_sfc_main$18, {
key: 0,
disabled: chatState.isEmpty || props.disabled,
onSubmit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
props.loading ? (openBlock(), createBlock(LoadingButton, {
key: 1,
onCancel
})) : createCommentVNode("", true),
props.clearable ? (openBlock(), createBlock(ClearButton, {
key: 2,
disabled: chatState.isEmpty || props.disabled,
onClear
}, null, 8, ["disabled"])) : createCommentVNode("", true)
])
], true)
])) : props.variant === "updown" ? (openBlock(), createElementBlock("div", _hoisted_64, [
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_73, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_82, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_9, [
!props.loading ? (openBlock(), createBlock(_sfc_main$18, {
key: 0,
disabled: chatState.isEmpty || props.disabled,
onSubmit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
props.loading ? (openBlock(), createBlock(LoadingButton, {
key: 1,
onCancel
})) : createCommentVNode("", true),
props.clearable ? (openBlock(), createBlock(ClearButton, {
key: 2,
disabled: chatState.isEmpty || props.disabled,
onClear
}, null, 8, ["disabled"])) : createCommentVNode("", true)
])
], true)
])
])) : createCommentVNode("", true)
], 34),
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_10, [
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : createCommentVNode("", true)
]),
_: 3
})
], 4);
};
}
});
var EditorSender = _export_sfc2(_sfc_main12, [["__scopeId", "data-v-4b153ac6"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/MentionSender/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style8.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-scrollbar.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-popper.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-input.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/MentionSender/index.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index-VFbd7WQZ.js
var isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
var hiddenTextarea = void 0;
var HIDDEN_STYLE = {
height: "0",
visibility: "hidden",
overflow: isFirefox() ? "" : "hidden",
position: "absolute",
"z-index": "-1000",
top: "0",
right: "0"
};
var CONTEXT_STYLE = [
"letter-spacing",
"line-height",
"padding-top",
"padding-bottom",
"font-family",
"font-weight",
"font-size",
"text-rendering",
"text-transform",
"width",
"text-indent",
"padding-left",
"padding-right",
"border-width",
"box-sizing"
];
function calculateNodeStyling(targetElement) {
const style = window.getComputedStyle(targetElement);
const boxSizing = style.getPropertyValue("box-sizing");
const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
const contextStyle = CONTEXT_STYLE.map((name) => [
name,
style.getPropertyValue(name)
]);
return { contextStyle, paddingSize, borderSize, boxSizing };
}
function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
var _a3;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement("textarea");
document.body.appendChild(hiddenTextarea);
}
const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
contextStyle.forEach(([key2, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key2, value));
Object.entries(HIDDEN_STYLE).forEach(([key2, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key2, value, "important"));
hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
let height = hiddenTextarea.scrollHeight;
const result = {};
if (boxSizing === "border-box") {
height = height + borderSize;
} else if (boxSizing === "content-box") {
height = height - paddingSize;
}
hiddenTextarea.value = "";
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (isNumber(minRows)) {
let minHeight = singleRowHeight * minRows;
if (boxSizing === "border-box") {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
result.minHeight = `${minHeight}px`;
}
if (isNumber(maxRows)) {
let maxHeight = singleRowHeight * maxRows;
if (boxSizing === "border-box") {
maxHeight = maxHeight + paddingSize + borderSize;
}
height = Math.min(maxHeight, height);
}
result.height = `${height}px`;
(_a3 = hiddenTextarea.parentNode) == null ? void 0 : _a3.removeChild(hiddenTextarea);
hiddenTextarea = void 0;
return result;
}
var inputProps = buildProps({
id: {
type: String,
default: void 0
},
size: useSizeProp,
disabled: Boolean,
modelValue: {
type: definePropType([
String,
Number,
Object
]),
default: ""
},
maxlength: {
type: [String, Number]
},
minlength: {
type: [String, Number]
},
type: {
type: String,
default: "text"
},
resize: {
type: String,
values: ["none", "both", "horizontal", "vertical"]
},
autosize: {
type: definePropType([Boolean, Object]),
default: false
},
autocomplete: {
type: String,
default: "off"
},
formatter: {
type: Function
},
parser: {
type: Function
},
placeholder: {
type: String
},
form: {
type: String
},
readonly: Boolean,
clearable: Boolean,
showPassword: Boolean,
showWordLimit: Boolean,
suffixIcon: {
type: iconPropType
},
prefixIcon: {
type: iconPropType
},
containerRole: {
type: String,
default: void 0
},
tabindex: {
type: [String, Number],
default: 0
},
validateEvent: {
type: Boolean,
default: true
},
inputStyle: {
type: definePropType([Object, Array, String]),
default: () => mutable({})
},
autofocus: Boolean,
rows: {
type: Number,
default: 2
},
...useAriaProps(["ariaLabel"]),
inputmode: {
type: definePropType(String),
default: void 0
},
name: String
});
var inputEmits = {
[UPDATE_MODEL_EVENT]: (value) => isString$1(value),
input: (value) => isString$1(value),
change: (value) => isString$1(value),
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true,
mouseleave: (evt) => evt instanceof MouseEvent,
mouseenter: (evt) => evt instanceof MouseEvent,
keydown: (evt) => evt instanceof Event,
compositionstart: (evt) => evt instanceof CompositionEvent,
compositionupdate: (evt) => evt instanceof CompositionEvent,
compositionend: (evt) => evt instanceof CompositionEvent
};
function useFocusController(target, {
disabled,
beforeFocus,
afterFocus,
beforeBlur,
afterBlur
} = {}) {
const instance = getCurrentInstance();
const { emit } = instance;
const wrapperRef = shallowRef();
const isFocused = ref(false);
const handleFocus = (event) => {
const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
if (unref(disabled) || isFocused.value || cancelFocus)
return;
isFocused.value = true;
emit("focus", event);
afterFocus == null ? void 0 : afterFocus();
};
const handleBlur = (event) => {
var _a3;
const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
if (unref(disabled) || event.relatedTarget && ((_a3 = wrapperRef.value) == null ? void 0 : _a3.contains(event.relatedTarget)) || cancelBlur)
return;
isFocused.value = false;
emit("blur", event);
afterBlur == null ? void 0 : afterBlur();
};
const handleClick = (event) => {
var _a3, _b2;
if (unref(disabled) || isFocusable(event.target) || ((_a3 = wrapperRef.value) == null ? void 0 : _a3.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
return;
(_b2 = target.value) == null ? void 0 : _b2.focus();
};
watch([wrapperRef, () => unref(disabled)], ([el, disabled2]) => {
if (!el)
return;
if (disabled2) {
el.removeAttribute("tabindex");
} else {
el.setAttribute("tabindex", "-1");
}
});
useEventListener(wrapperRef, "focus", handleFocus, true);
useEventListener(wrapperRef, "blur", handleBlur, true);
useEventListener(wrapperRef, "click", handleClick, true);
return {
isFocused,
wrapperRef,
handleFocus,
handleBlur
};
}
var isKorean = (text3) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text3);
function useComposition({
afterComposition,
emit
}) {
const isComposing = ref(false);
const handleCompositionStart = (event) => {
emit == null ? void 0 : emit("compositionstart", event);
isComposing.value = true;
};
const handleCompositionUpdate = (event) => {
var _a3;
emit == null ? void 0 : emit("compositionupdate", event);
const text3 = (_a3 = event.target) == null ? void 0 : _a3.value;
const lastCharacter = text3[text3.length - 1] || "";
isComposing.value = !isKorean(lastCharacter);
};
const handleCompositionEnd = (event) => {
emit == null ? void 0 : emit("compositionend", event);
if (isComposing.value) {
isComposing.value = false;
nextTick(() => afterComposition(event));
}
};
const handleComposition = (event) => {
event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
};
return {
isComposing,
handleComposition,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd
};
}
function useCursor(input) {
let selectionInfo;
function recordCursor() {
if (input.value == void 0)
return;
const { selectionStart, selectionEnd, value } = input.value;
if (selectionStart == null || selectionEnd == null)
return;
const beforeTxt = value.slice(0, Math.max(0, selectionStart));
const afterTxt = value.slice(Math.max(0, selectionEnd));
selectionInfo = {
selectionStart,
selectionEnd,
value,
beforeTxt,
afterTxt
};
}
function setCursor() {
if (input.value == void 0 || selectionInfo == void 0)
return;
const { value } = input.value;
const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
return;
let startPos = value.length;
if (value.endsWith(afterTxt)) {
startPos = value.length - afterTxt.length;
} else if (value.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else {
const beforeLastChar = beforeTxt[selectionStart - 1];
const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
input.value.setSelectionRange(startPos, startPos);
}
return [recordCursor, setCursor];
}
var COMPONENT_NAME2 = "ElInput";
var __default__6 = defineComponent({
name: COMPONENT_NAME2,
inheritAttrs: false
});
var _sfc_main13 = defineComponent({
...__default__6,
props: inputProps,
emits: inputEmits,
setup(__props, { expose, emit }) {
const props = __props;
const rawAttrs = useAttrs();
const attrs = useAttrs2();
const slots = useSlots();
const containerKls = computed(() => [
props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
nsInput.m(inputSize.value),
nsInput.is("disabled", inputDisabled.value),
nsInput.is("exceed", inputExceed.value),
{
[nsInput.b("group")]: slots.prepend || slots.append,
[nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
[nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
[nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
[nsInput.b("hidden")]: props.type === "hidden"
},
rawAttrs.class
]);
const wrapperKls = computed(() => [
nsInput.e("wrapper"),
nsInput.is("focus", isFocused.value)
]);
const { form: elForm, formItem: elFormItem } = useFormItem();
const { inputId } = useFormItemInputId(props, {
formItemContext: elFormItem
});
const inputSize = useFormSize();
const inputDisabled = useFormDisabled();
const nsInput = useNamespace("input");
const nsTextarea = useNamespace("textarea");
const input = shallowRef();
const textarea = shallowRef();
const hovering = ref(false);
const passwordVisible = ref(false);
const countStyle = ref();
const textareaCalcStyle = shallowRef(props.inputStyle);
const _ref = computed(() => input.value || textarea.value);
const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
disabled: inputDisabled,
afterBlur() {
var _a3;
if (props.validateEvent) {
(_a3 = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a3.call(elFormItem, "blur").catch((err) => debugWarn());
}
}
});
const needStatusIcon = computed(() => {
var _a3;
return (_a3 = elForm == null ? void 0 : elForm.statusIcon) != null ? _a3 : false;
});
const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
const containerStyle = computed(() => [
rawAttrs.style
]);
const textareaStyle = computed(() => [
props.inputStyle,
textareaCalcStyle.value,
{ resize: props.resize }
]);
const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
const textLength = computed(() => nativeInputValue.value.length);
const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
const [recordCursor, setCursor] = useCursor(input);
useResizeObserver(textarea, (entries) => {
onceInitSizeTextarea();
if (!isWordLimitVisible.value || props.resize !== "both")
return;
const entry = entries[0];
const { width } = entry.contentRect;
countStyle.value = {
right: `calc(100% - ${width + 15 + 6}px)`
};
});
const resizeTextarea = () => {
const { type, autosize } = props;
if (!isClient || type !== "textarea" || !textarea.value)
return;
if (autosize) {
const minRows = isObject(autosize) ? autosize.minRows : void 0;
const maxRows = isObject(autosize) ? autosize.maxRows : void 0;
const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
textareaCalcStyle.value = {
overflowY: "hidden",
...textareaStyle2
};
nextTick(() => {
textarea.value.offsetHeight;
textareaCalcStyle.value = textareaStyle2;
});
} else {
textareaCalcStyle.value = {
minHeight: calcTextareaHeight(textarea.value).minHeight
};
}
};
const createOnceInitResize = (resizeTextarea2) => {
let isInit = false;
return () => {
var _a3;
if (isInit || !props.autosize)
return;
const isElHidden = ((_a3 = textarea.value) == null ? void 0 : _a3.offsetParent) === null;
if (!isElHidden) {
resizeTextarea2();
isInit = true;
}
};
};
const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
const setNativeInputValue = () => {
const input2 = _ref.value;
const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
if (!input2 || input2.value === formatterValue)
return;
input2.value = formatterValue;
};
const handleInput = async (event) => {
recordCursor();
let { value } = event.target;
if (props.formatter && props.parser) {
value = props.parser(value);
}
if (isComposing.value)
return;
if (value === nativeInputValue.value) {
setNativeInputValue();
return;
}
emit(UPDATE_MODEL_EVENT, value);
emit(INPUT_EVENT, value);
await nextTick();
setNativeInputValue();
setCursor();
};
const handleChange = (event) => {
let { value } = event.target;
if (props.formatter && props.parser) {
value = props.parser(value);
}
emit(CHANGE_EVENT, value);
};
const {
isComposing,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd
} = useComposition({ emit, afterComposition: handleInput });
const handlePasswordVisible = () => {
recordCursor();
passwordVisible.value = !passwordVisible.value;
setTimeout(setCursor);
};
const focus = () => {
var _a3;
return (_a3 = _ref.value) == null ? void 0 : _a3.focus();
};
const blur = () => {
var _a3;
return (_a3 = _ref.value) == null ? void 0 : _a3.blur();
};
const handleMouseLeave = (evt) => {
hovering.value = false;
emit("mouseleave", evt);
};
const handleMouseEnter = (evt) => {
hovering.value = true;
emit("mouseenter", evt);
};
const handleKeydown = (evt) => {
emit("keydown", evt);
};
const select = () => {
var _a3;
(_a3 = _ref.value) == null ? void 0 : _a3.select();
};
const clear = () => {
emit(UPDATE_MODEL_EVENT, "");
emit(CHANGE_EVENT, "");
emit("clear");
emit(INPUT_EVENT, "");
};
watch(() => props.modelValue, () => {
var _a3;
nextTick(() => resizeTextarea());
if (props.validateEvent) {
(_a3 = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a3.call(elFormItem, "change").catch((err) => debugWarn());
}
});
watch(nativeInputValue, () => setNativeInputValue());
watch(() => props.type, async () => {
await nextTick();
setNativeInputValue();
resizeTextarea();
});
onMounted(() => {
if (!props.formatter && props.parser) ;
setNativeInputValue();
nextTick(resizeTextarea);
});
expose({
input,
textarea,
ref: _ref,
textareaStyle,
autosize: toRef(props, "autosize"),
isComposing,
focus,
blur,
select,
clear,
resizeTextarea
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([
unref(containerKls),
{
[unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
[unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
}
]),
style: normalizeStyle(unref(containerStyle)),
onMouseenter: handleMouseEnter,
onMouseleave: handleMouseLeave
}, [
createCommentVNode(" input "),
_ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
createCommentVNode(" prepend slot "),
_ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(nsInput).be("group", "prepend"))
}, [
renderSlot(_ctx.$slots, "prepend")
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("div", {
ref_key: "wrapperRef",
ref: wrapperRef,
class: normalizeClass(unref(wrapperKls))
}, [
createCommentVNode(" prefix slot "),
_ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(unref(nsInput).e("prefix"))
}, [
createBaseVNode("span", {
class: normalizeClass(unref(nsInput).e("prefix-inner"))
}, [
renderSlot(_ctx.$slots, "prefix"),
_ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(nsInput).e("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("input", mergeProps({
id: unref(inputId),
ref_key: "input",
ref: input,
class: unref(nsInput).e("inner")
}, unref(attrs), {
name: _ctx.name,
minlength: _ctx.minlength,
maxlength: _ctx.maxlength,
type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
disabled: unref(inputDisabled),
readonly: _ctx.readonly,
autocomplete: _ctx.autocomplete,
tabindex: _ctx.tabindex,
"aria-label": _ctx.ariaLabel,
placeholder: _ctx.placeholder,
style: _ctx.inputStyle,
form: _ctx.form,
autofocus: _ctx.autofocus,
role: _ctx.containerRole,
inputmode: _ctx.inputmode,
onCompositionstart: unref(handleCompositionStart),
onCompositionupdate: unref(handleCompositionUpdate),
onCompositionend: unref(handleCompositionEnd),
onInput: handleInput,
onChange: handleChange,
onKeydown: handleKeydown
}), null, 16, ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
createCommentVNode(" suffix slot "),
unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
key: 1,
class: normalizeClass(unref(nsInput).e("suffix"))
}, [
createBaseVNode("span", {
class: normalizeClass(unref(nsInput).e("suffix-inner"))
}, [
!unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
renderSlot(_ctx.$slots, "suffix"),
_ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(nsInput).e("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 64)) : createCommentVNode("v-if", true),
unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
onMousedown: withModifiers(unref(NOOP), ["prevent"]),
onClick: clear
}, {
default: withCtx(() => [
createVNode(unref(circle_close_default))
]),
_: 1
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
key: 2,
class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
onClick: handlePasswordVisible
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true),
unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
key: 3,
class: normalizeClass(unref(nsInput).e("count"))
}, [
createBaseVNode("span", {
class: normalizeClass(unref(nsInput).e("count-inner"))
}, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 3)
], 2)) : createCommentVNode("v-if", true),
unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
key: 4,
class: normalizeClass([
unref(nsInput).e("icon"),
unref(nsInput).e("validateIcon"),
unref(nsInput).is("loading", unref(validateState) === "validating")
])
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 2)
], 2)) : createCommentVNode("v-if", true)
], 2),
createCommentVNode(" append slot "),
_ctx.$slots.append ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(nsInput).be("group", "append"))
}, [
renderSlot(_ctx.$slots, "append")
], 2)) : createCommentVNode("v-if", true)
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
createCommentVNode(" textarea "),
createBaseVNode("textarea", mergeProps({
id: unref(inputId),
ref_key: "textarea",
ref: textarea,
class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
}, unref(attrs), {
minlength: _ctx.minlength,
maxlength: _ctx.maxlength,
tabindex: _ctx.tabindex,
disabled: unref(inputDisabled),
readonly: _ctx.readonly,
autocomplete: _ctx.autocomplete,
style: unref(textareaStyle),
"aria-label": _ctx.ariaLabel,
placeholder: _ctx.placeholder,
form: _ctx.form,
autofocus: _ctx.autofocus,
rows: _ctx.rows,
role: _ctx.containerRole,
onCompositionstart: unref(handleCompositionStart),
onCompositionupdate: unref(handleCompositionUpdate),
onCompositionend: unref(handleCompositionEnd),
onInput: handleInput,
onFocus: unref(handleFocus),
onBlur: unref(handleBlur),
onChange: handleChange,
onKeydown: handleKeydown
}), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
key: 0,
style: normalizeStyle(countStyle.value),
class: normalizeClass(unref(nsInput).e("count"))
}, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 7)) : createCommentVNode("v-if", true)
], 64))
], 38);
};
}
});
var Input = _export_sfc(_sfc_main13, [["__file", "input.vue"]]);
var ElInput = withInstall(Input);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/MentionSender/index.js
var filterOption = (pattern, option2) => {
const lowerCase = pattern.toLowerCase();
const label = option2.label || option2.value;
return label.toLowerCase().includes(lowerCase);
};
var getMentionCtx = (inputEl, prefix, split) => {
const { selectionEnd } = inputEl;
if (selectionEnd === null)
return;
const inputValue = inputEl.value;
const prefixArray = castArray(prefix);
let splitIndex = -1;
let mentionCtx;
for (let i = selectionEnd - 1; i >= 0; --i) {
const char = inputValue[i];
if (char === split || char === "\n" || char === "\r") {
splitIndex = i;
continue;
}
if (prefixArray.includes(char)) {
const end = splitIndex === -1 ? selectionEnd : splitIndex;
const pattern = inputValue.slice(i + 1, end);
mentionCtx = {
pattern,
start: i + 1,
end,
prefix: char,
prefixIndex: i,
splitIndex,
selectionEnd
};
break;
}
}
return mentionCtx;
};
var getCursorPosition = (element2, options = {
debug: false,
useSelectionEnd: false
}) => {
const selectionStart = element2.selectionStart !== null ? element2.selectionStart : 0;
const selectionEnd = element2.selectionEnd !== null ? element2.selectionEnd : 0;
const position = options.useSelectionEnd ? selectionEnd : selectionStart;
const properties = [
"direction",
"boxSizing",
"width",
"height",
"overflowX",
"overflowY",
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"borderStyle",
"paddingTop",
"paddingRight",
"paddingBottom",
"paddingLeft",
"fontStyle",
"fontVariant",
"fontWeight",
"fontStretch",
"fontSize",
"fontSizeAdjust",
"lineHeight",
"fontFamily",
"textAlign",
"textTransform",
"textIndent",
"textDecoration",
"letterSpacing",
"wordSpacing",
"tabSize",
"MozTabSize"
];
if (options.debug) {
const el = document.querySelector("#input-textarea-caret-position-mirror-div");
if (el == null ? void 0 : el.parentNode)
el.parentNode.removeChild(el);
}
const div = document.createElement("div");
div.id = "input-textarea-caret-position-mirror-div";
document.body.appendChild(div);
const style = div.style;
const computed2 = window.getComputedStyle(element2);
const isInput = element2.nodeName === "INPUT";
style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
if (!isInput)
style.wordWrap = "break-word";
style.position = "absolute";
if (!options.debug)
style.visibility = "hidden";
properties.forEach((prop) => {
if (isInput && prop === "lineHeight") {
if (computed2.boxSizing === "border-box") {
const height = Number.parseInt(computed2.height);
const outerHeight = Number.parseInt(computed2.paddingTop) + Number.parseInt(computed2.paddingBottom) + Number.parseInt(computed2.borderTopWidth) + Number.parseInt(computed2.borderBottomWidth);
const targetHeight = outerHeight + Number.parseInt(computed2.lineHeight);
if (height > targetHeight) {
style.lineHeight = `${height - outerHeight}px`;
} else if (height === targetHeight) {
style.lineHeight = computed2.lineHeight;
} else {
style.lineHeight = "0";
}
} else {
style.lineHeight = computed2.height;
}
} else {
style[prop] = computed2[prop];
}
});
if (isFirefox()) {
if (element2.scrollHeight > Number.parseInt(computed2.height)) {
style.overflowY = "scroll";
}
} else {
style.overflow = "hidden";
}
div.textContent = element2.value.slice(0, Math.max(0, position));
if (isInput && div.textContent) {
div.textContent = div.textContent.replace(/\s/g, " ");
}
const span = document.createElement("span");
span.textContent = element2.value.slice(Math.max(0, position)) || ".";
span.style.position = "relative";
span.style.left = `${-element2.scrollLeft}px`;
span.style.top = `${-element2.scrollTop}px`;
div.appendChild(span);
const relativePosition = {
top: span.offsetTop + Number.parseInt(computed2.borderTopWidth),
left: span.offsetLeft + Number.parseInt(computed2.borderLeftWidth),
height: Number.parseInt(computed2.fontSize) * 1.5
};
if (options.debug) {
span.style.backgroundColor = "#aaa";
} else {
document.body.removeChild(div);
}
if (relativePosition.left >= element2.clientWidth) {
relativePosition.left = element2.clientWidth;
}
return relativePosition;
};
var mentionProps = buildProps({
...inputProps,
options: {
type: definePropType(Array),
default: () => []
},
prefix: {
type: definePropType([String, Array]),
default: "@",
validator: (val) => {
if (isString$1(val))
return val.length === 1;
return val.every((v) => isString$1(v) && v.length === 1);
}
},
split: {
type: String,
default: " ",
validator: (val) => val.length === 1
},
filterOption: {
type: definePropType([Boolean, Function]),
default: () => filterOption,
validator: (val) => {
if (val === false)
return true;
return isFunction$1(val);
}
},
placement: {
type: definePropType(String),
default: "bottom"
},
showArrow: Boolean,
offset: {
type: Number,
default: 0
},
whole: Boolean,
checkIsWhole: {
type: definePropType(Function)
},
modelValue: String,
loading: Boolean,
popperClass: {
type: String,
default: ""
},
popperOptions: {
type: definePropType(Object),
default: () => ({})
}
});
var mentionEmits = {
[UPDATE_MODEL_EVENT]: (value) => isString$1(value),
"whole-remove": (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
input: (value) => isString$1(value),
search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
select: (option2, prefix) => isString$1(option2.value) && isString$1(prefix),
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent
};
var mentionDropdownProps = buildProps({
options: {
type: definePropType(Array),
default: () => []
},
loading: Boolean,
disabled: Boolean,
contentId: String,
ariaLabel: String
});
var mentionDropdownEmits = {
select: (option2) => isString$1(option2.value)
};
var __default__$14 = defineComponent({
name: "ElMentionDropdown"
});
var _sfc_main$92 = defineComponent({
...__default__$14,
props: mentionDropdownProps,
emits: mentionDropdownEmits,
setup(__props, { expose, emit }) {
const props = __props;
const ns = useNamespace("mention");
const { t } = useLocale();
const hoveringIndex = ref(-1);
const scrollbarRef = ref();
const optionRefs = ref();
const dropdownRef = ref();
const optionkls = (item, index) => [
ns.be("dropdown", "item"),
ns.is("hovering", hoveringIndex.value === index),
ns.is("disabled", item.disabled || props.disabled)
];
const handleSelect = (item) => {
if (item.disabled || props.disabled)
return;
emit("select", item);
};
const handleMouseEnter = (index) => {
hoveringIndex.value = index;
};
const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
const hoverOption = computed(() => props.options[hoveringIndex.value]);
const selectHoverOption = () => {
if (!hoverOption.value)
return;
emit("select", hoverOption.value);
};
const navigateOptions = (direction) => {
const { options } = props;
if (options.length === 0 || filteredAllDisabled.value)
return;
if (direction === "next") {
hoveringIndex.value++;
if (hoveringIndex.value === options.length) {
hoveringIndex.value = 0;
}
} else if (direction === "prev") {
hoveringIndex.value--;
if (hoveringIndex.value < 0) {
hoveringIndex.value = options.length - 1;
}
}
const option2 = options[hoveringIndex.value];
if (option2.disabled) {
navigateOptions(direction);
return;
}
nextTick(() => scrollToOption(option2));
};
const scrollToOption = (option2) => {
var _a3, _b2, _c, _d;
const { options } = props;
const index = options.findIndex((item) => item.value === option2.value);
const target = (_a3 = optionRefs.value) == null ? void 0 : _a3[index];
if (target) {
const menu = (_c = (_b2 = dropdownRef.value) == null ? void 0 : _b2.querySelector) == null ? void 0 : _c.call(_b2, `.${ns.be("dropdown", "wrap")}`);
if (menu) {
scrollIntoView(menu, target);
}
}
(_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
};
const resetHoveringIndex = () => {
if (filteredAllDisabled.value || props.options.length === 0) {
hoveringIndex.value = -1;
} else {
hoveringIndex.value = 0;
}
};
watch(() => props.options, resetHoveringIndex, {
immediate: true
});
expose({
hoveringIndex,
navigateOptions,
selectHoverOption,
hoverOption
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "dropdownRef",
ref: dropdownRef,
class: normalizeClass(unref(ns).b("dropdown"))
}, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).be("dropdown", "header"))
}, [
renderSlot(_ctx.$slots, "header")
], 2)) : createCommentVNode("v-if", true),
withDirectives(createVNode(unref(ElScrollbar), {
id: _ctx.contentId,
ref_key: "scrollbarRef",
ref: scrollbarRef,
tag: "ul",
"wrap-class": unref(ns).be("dropdown", "wrap"),
"view-class": unref(ns).be("dropdown", "list"),
role: "listbox",
"aria-label": _ctx.ariaLabel,
"aria-orientation": "vertical"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
return openBlock(), createElementBlock("li", {
id: `${_ctx.contentId}-${index}`,
ref_for: true,
ref_key: "optionRefs",
ref: optionRefs,
key: index,
class: normalizeClass(optionkls(item, index)),
role: "option",
"aria-disabled": item.disabled || _ctx.disabled || void 0,
"aria-selected": hoveringIndex.value === index,
onMousemove: ($event) => handleMouseEnter(index),
onClick: withModifiers(($event) => handleSelect(item), ["stop"])
}, [
renderSlot(_ctx.$slots, "label", {
item,
index
}, () => {
var _a3;
return [
createBaseVNode("span", null, toDisplayString((_a3 = item.label) != null ? _a3 : item.value), 1)
];
})
], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
}), 128))
]),
_: 3
}, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
[vShow, _ctx.options.length > 0 && !_ctx.loading]
]),
_ctx.loading ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).be("dropdown", "loading"))
}, [
renderSlot(_ctx.$slots, "loading", {}, () => [
createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)
])
], 2)) : createCommentVNode("v-if", true),
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass(unref(ns).be("dropdown", "footer"))
}, [
renderSlot(_ctx.$slots, "footer")
], 2)) : createCommentVNode("v-if", true)
], 2);
};
}
});
var ElMentionDropdown = _export_sfc(_sfc_main$92, [["__file", "mention-dropdown.vue"]]);
var __default__7 = defineComponent({
name: "ElMention",
inheritAttrs: false
});
var _sfc_main$83 = defineComponent({
...__default__7,
props: mentionProps,
emits: mentionEmits,
setup(__props, { expose, emit }) {
const props = __props;
const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
const ns = useNamespace("mention");
const disabled = useFormDisabled();
const contentId = useId();
const elInputRef = ref();
const tooltipRef = ref();
const dropdownRef = ref();
const visible = ref(false);
const cursorStyle = ref();
const mentionCtx = ref();
const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
const filteredOptions = computed(() => {
const { filterOption: filterOption2, options } = props;
if (!mentionCtx.value || !filterOption2)
return options;
return options.filter((option2) => filterOption2(mentionCtx.value.pattern, option2));
});
const dropdownVisible = computed(() => {
return visible.value && (!!filteredOptions.value.length || props.loading);
});
const hoveringId = computed(() => {
var _a3;
return `${contentId.value}-${(_a3 = dropdownRef.value) == null ? void 0 : _a3.hoveringIndex}`;
});
const handleInputChange = (value) => {
emit(UPDATE_MODEL_EVENT, value);
emit(INPUT_EVENT, value);
syncAfterCursorMove();
};
const handleInputKeyDown = (event) => {
var _a3, _b2, _c, _d;
if (!("code" in event) || ((_a3 = elInputRef.value) == null ? void 0 : _a3.isComposing))
return;
switch (event.code) {
case EVENT_CODE.left:
case EVENT_CODE.right:
syncAfterCursorMove();
break;
case EVENT_CODE.up:
case EVENT_CODE.down:
if (!visible.value)
return;
event.preventDefault();
(_b2 = dropdownRef.value) == null ? void 0 : _b2.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
break;
case EVENT_CODE.enter:
case EVENT_CODE.numpadEnter:
if (!visible.value)
return;
event.preventDefault();
if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
(_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
} else {
visible.value = false;
}
break;
case EVENT_CODE.esc:
if (!visible.value)
return;
event.preventDefault();
visible.value = false;
break;
case EVENT_CODE.backspace:
if (props.whole && mentionCtx.value) {
const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
const inputEl = getInputEl();
if (!inputEl)
return;
const inputValue = inputEl.value;
const matchOption = props.options.find((item) => item.value === pattern);
const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
event.preventDefault();
const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
emit(UPDATE_MODEL_EVENT, newValue);
emit(INPUT_EVENT, newValue);
emit("whole-remove", pattern, prefix);
const newSelectionEnd = prefixIndex;
nextTick(() => {
inputEl.selectionStart = newSelectionEnd;
inputEl.selectionEnd = newSelectionEnd;
syncDropdownVisible();
});
}
}
}
};
const { wrapperRef } = useFocusController(elInputRef, {
disabled,
afterFocus() {
syncAfterCursorMove();
},
beforeBlur(event) {
var _a3;
return (_a3 = tooltipRef.value) == null ? void 0 : _a3.isFocusInsideContent(event);
},
afterBlur() {
visible.value = false;
}
});
const handleInputMouseDown = () => {
syncAfterCursorMove();
};
const handleSelect = (item) => {
if (!mentionCtx.value)
return;
const inputEl = getInputEl();
if (!inputEl)
return;
const inputValue = inputEl.value;
const { split } = props;
const newEndPart = inputValue.slice(mentionCtx.value.end);
const alreadySeparated = newEndPart.startsWith(split);
const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
emit(UPDATE_MODEL_EVENT, newValue);
emit(INPUT_EVENT, newValue);
emit("select", item, mentionCtx.value.prefix);
const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
nextTick(() => {
inputEl.selectionStart = newSelectionEnd;
inputEl.selectionEnd = newSelectionEnd;
inputEl.focus();
syncDropdownVisible();
});
};
const getInputEl = () => {
var _a3, _b2;
return props.type === "textarea" ? (_a3 = elInputRef.value) == null ? void 0 : _a3.textarea : (_b2 = elInputRef.value) == null ? void 0 : _b2.input;
};
const syncAfterCursorMove = () => {
setTimeout(() => {
syncCursor();
syncDropdownVisible();
nextTick(() => {
var _a3;
return (_a3 = tooltipRef.value) == null ? void 0 : _a3.updatePopper();
});
}, 0);
};
const syncCursor = () => {
const inputEl = getInputEl();
if (!inputEl)
return;
const caretPosition = getCursorPosition(inputEl);
const inputRect = inputEl.getBoundingClientRect();
const elInputRect = elInputRef.value.$el.getBoundingClientRect();
cursorStyle.value = {
position: "absolute",
width: 0,
height: `${caretPosition.height}px`,
left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
};
};
const syncDropdownVisible = () => {
const inputEl = getInputEl();
if (document.activeElement !== inputEl) {
visible.value = false;
return;
}
const { prefix, split } = props;
mentionCtx.value = getMentionCtx(inputEl, prefix, split);
if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
visible.value = true;
emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
return;
}
visible.value = false;
};
expose({
input: elInputRef,
tooltip: tooltipRef,
dropdownVisible
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
ref_key: "wrapperRef",
ref: wrapperRef,
class: normalizeClass(unref(ns).b())
}, [
createVNode(unref(ElInput), mergeProps(mergeProps(unref(passInputProps), _ctx.$attrs), {
ref_key: "elInputRef",
ref: elInputRef,
"model-value": _ctx.modelValue,
disabled: unref(disabled),
role: unref(dropdownVisible) ? "combobox" : void 0,
"aria-activedescendant": unref(dropdownVisible) ? unref(hoveringId) || "" : void 0,
"aria-controls": unref(dropdownVisible) ? unref(contentId) : void 0,
"aria-expanded": unref(dropdownVisible) || void 0,
"aria-label": _ctx.ariaLabel,
"aria-autocomplete": unref(dropdownVisible) ? "none" : void 0,
"aria-haspopup": unref(dropdownVisible) ? "listbox" : void 0,
onInput: handleInputChange,
onKeydown: handleInputKeyDown,
onMousedown: handleInputMouseDown
}), createSlots({
_: 2
}, [
renderList(_ctx.$slots, (_, name) => {
return {
name,
fn: withCtx((slotProps) => [
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
])
};
})
]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
createVNode(unref(ElTooltip), {
ref_key: "tooltipRef",
ref: tooltipRef,
visible: unref(dropdownVisible),
"popper-class": [unref(ns).e("popper"), _ctx.popperClass],
"popper-options": _ctx.popperOptions,
placement: unref(computedPlacement),
"fallback-placements": unref(computedFallbackPlacements),
effect: "light",
pure: "",
offset: _ctx.offset,
"show-arrow": _ctx.showArrow
}, {
default: withCtx(() => [
createBaseVNode("div", {
style: normalizeStyle(cursorStyle.value)
}, null, 4)
]),
content: withCtx(() => {
var _a3;
return [
createVNode(ElMentionDropdown, {
ref_key: "dropdownRef",
ref: dropdownRef,
options: unref(filteredOptions),
disabled: unref(disabled),
loading: _ctx.loading,
"content-id": unref(contentId),
"aria-label": _ctx.ariaLabel,
onSelect: handleSelect,
onClick: withModifiers((_a3 = elInputRef.value) == null ? void 0 : _a3.focus, ["stop"])
}, createSlots({
_: 2
}, [
renderList(_ctx.$slots, (_, name) => {
return {
name,
fn: withCtx((slotProps) => [
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
])
};
})
]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
];
}),
_: 3
}, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
], 2);
};
}
});
var Mention = _export_sfc(_sfc_main$83, [["__file", "mention.vue"]]);
var ElMention = withInstall(Mention);
var _hoisted_1$72 = { class: "el-send-button" };
var _sfc_main$73 = defineComponent({
__name: "index",
emits: ["clear"],
setup(__props, { emit: __emit }) {
const emit = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$72, [
createVNode(_component_el_button, {
circle: "",
onClick: _cache[0] || (_cache[0] = ($event) => emit("clear"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(brush_default))
]),
_: 1
})
]),
_: 1
})
]);
};
}
});
var ClearButton2 = _export_sfc2(_sfc_main$73, [["__scopeId", "data-v-396dd350"]]);
var _sfc_main$64 = {};
var _hoisted_1$62 = {
viewBox: "0 0 1000 1000",
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
};
function _sfc_render6(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$62, _cache[0] || (_cache[0] = [
createBaseVNode("title", null, "Loading", -1),
createBaseVNode("rect", {
fill: "currentColor",
height: "250",
rx: "24",
ry: "24",
width: "250",
x: "375",
y: "375"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
opacity: "0.45"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
"stroke-dasharray": "600 9999999"
}, [
createBaseVNode("animateTransform", {
attributeName: "transform",
dur: "1s",
from: "0 500 500",
repeatCount: "indefinite",
to: "360 500 500",
type: "rotate"
})
], -1)
]));
}
var loading$1 = _export_sfc2(_sfc_main$64, [["render", _sfc_render6]]);
var _hoisted_1$52 = { class: "el-send-button" };
var _sfc_main$54 = defineComponent({
__name: "index",
emits: ["cancel"],
setup(__props, { emit: __emit }) {
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$52, [
createVNode(_component_el_button, {
circle: "",
onClick: _cache[0] || (_cache[0] = ($event) => emits("cancel"))
}, {
default: withCtx(() => [
createVNode(loading$1, { class: "loading-svg" })
]),
_: 1
})
]);
};
}
});
var LoadingButton2 = _export_sfc2(_sfc_main$54, [["__scopeId", "data-v-786c884b"]]);
var _hoisted_1$43 = { class: "el-send-button" };
var _sfc_main$46 = defineComponent({
__name: "index",
props: {
disabled: {
type: Boolean,
default: false
}
},
emits: ["submit"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$43, [
createVNode(_component_el_button, {
circle: "",
disabled: props.disabled,
onClick: _cache[0] || (_cache[0] = ($event) => emits("submit"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(top_default))
]),
_: 1
})
]),
_: 1
}, 8, ["disabled"])
]);
};
}
});
var _hoisted_1$33 = { class: "el-send-button" };
var _sfc_main$36 = defineComponent({
__name: "index",
setup(__props) {
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$33, [
createVNode(_component_el_button, { circle: "" }, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(microphone_default))
]),
_: 1
})
]),
_: 1
})
]);
};
}
});
var _hoisted_1$23 = ["viewBox"];
var _hoisted_2$12 = ["x", "y"];
var _hoisted_3$12 = ["values", "dur", "begin"];
var _hoisted_4$12 = ["values", "dur", "begin"];
var SIZE = 1e3;
var COUNT = 4;
var RECT_WIDTH = 140;
var RECT_HEIGHT_MIN = 250;
var RECT_HEIGHT_MAX = 500;
var DURATION = 0.8;
var _sfc_main$26 = defineComponent({
__name: "loading",
props: {
className: { default: "" }
},
setup(__props) {
const RECT_RADIUS = RECT_WIDTH / 2;
const rects = computed(() => {
const dest = (SIZE - RECT_WIDTH * COUNT) / (COUNT - 1);
return Array.from({ length: COUNT }).map((_, index) => {
const x = index * (dest + RECT_WIDTH);
const yMin = SIZE / 2 - RECT_HEIGHT_MIN / 2;
const yMax = SIZE / 2 - RECT_HEIGHT_MAX / 2;
return { x, yMin, yMax };
});
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("svg", {
class: normalizeClass(_ctx.className),
color: "currentColor",
viewBox: `0 0 ${SIZE} ${SIZE}`,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
}, [
_cache[0] || (_cache[0] = createBaseVNode("title", null, "Speech Recording", -1)),
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rects), (item, index) => {
return openBlock(), createElementBlock("rect", {
key: index,
fill: "currentColor",
rx: RECT_RADIUS,
ry: RECT_RADIUS,
height: RECT_HEIGHT_MIN,
width: RECT_WIDTH,
x: item.x,
y: item.yMin
}, [
createBaseVNode("animate", {
attributeName: "height",
values: `${RECT_HEIGHT_MIN}; ${RECT_HEIGHT_MAX}; ${RECT_HEIGHT_MIN}`,
keyTimes: "0; 0.5; 1",
dur: `${DURATION}s`,
begin: `${DURATION / COUNT * index}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_3$12),
createBaseVNode("animate", {
attributeName: "y",
values: `${item.yMin}; ${item.yMax}; ${item.yMin}`,
keyTimes: "0; 0.5; 1",
dur: `${DURATION}s`,
begin: `${DURATION / COUNT * index}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_4$12)
], 8, _hoisted_2$12);
}), 128))
], 10, _hoisted_1$23);
};
}
});
var loading2 = _export_sfc2(_sfc_main$26, [["__scopeId", "data-v-363a4fe5"]]);
var _hoisted_1$14 = { class: "el-send-button" };
var _sfc_main$19 = defineComponent({
__name: "index",
setup(__props) {
return (_ctx, _cache) => {
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$14, [
createVNode(_component_el_button, { circle: "" }, {
default: withCtx(() => [
createVNode(loading2, { class: "loading-svg" })
]),
_: 1
})
]);
};
}
});
var SpeechLoadingButton = _export_sfc2(_sfc_main$19, [["__scopeId", "data-v-6d1893bc"]]);
var _hoisted_18 = {
key: 0,
class: "el-sender-header-wrap"
};
var _hoisted_26 = {
key: 0,
class: "el-sender-header"
};
var _hoisted_36 = {
key: 0,
class: "el-sender-prefix"
};
var _hoisted_46 = {
key: 1,
class: "el-sender-action-list"
};
var _hoisted_56 = { class: "el-sender-action-list-presets" };
var _hoisted_65 = {
key: 2,
class: "el-sender-updown-wrap"
};
var _hoisted_74 = {
key: 0,
class: "el-sender-prefix"
};
var _hoisted_83 = { class: "el-sender-action-list" };
var _hoisted_92 = { class: "el-sender-action-list-presets" };
var _hoisted_102 = {
key: 0,
class: "el-sender-footer"
};
var _sfc_main14 = defineComponent({
__name: "index",
props: {
modelValue: { default: "" },
placeholder: { default: "请输入内容" },
autoSize: { default: () => ({
minRows: 1,
maxRows: 6
}) },
readOnly: { type: Boolean },
disabled: { type: Boolean },
loading: { type: Boolean },
clearable: { type: Boolean },
allowSpeech: { type: Boolean },
submitType: { default: "enter" },
headerAnimationTimer: { default: 300 },
inputWidth: { default: "100%" },
variant: { default: "default" },
showUpdown: { type: Boolean, default: true },
submitBtnDisabled: { type: Boolean, default: void 0 },
inputStyle: { default: "" },
options: { default: () => [] },
filterOption: { type: Function, default: () => true },
whole: { type: Boolean, default: false },
checkIsWhole: { type: Function, default: () => true },
triggerLoading: { type: Boolean, default: false },
triggerStrings: { default: () => [] },
triggerSplit: { default: " " },
triggerPopoverPlacement: { default: "top" },
triggerPopoverOffset: { default: 20 }
},
emits: ["update:modelValue", "submit", "cancel", "recordingChange", "search", "select", "pasteFile"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const slots = useSlots();
const internalValue = computed({
get() {
return props.modelValue;
},
set(val) {
if (props.readOnly || props.disabled)
return;
emits("update:modelValue", val);
}
});
const instance = getCurrentInstance();
const hasOnRecordingChangeListener = computed(() => {
var _a3;
return !!((_a3 = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a3.onRecordingChange);
});
const hasOnPasteFileListener = computed(() => {
var _a3;
return !!((_a3 = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a3.onPasteFile);
});
const senderRef = ref();
const inputRef = ref();
const isSubmitDisabled = computed(() => {
if (typeof props.submitBtnDisabled === "boolean") {
return props.submitBtnDisabled;
}
return !internalValue.value;
});
const popoverVisible = computed(() => {
var _a3;
return (_a3 = inputRef.value) == null ? void 0 : _a3.dropdownVisible;
});
const inputInstance = computed(() => {
var _a3;
return (_a3 = inputRef.value) == null ? void 0 : _a3.input.ref;
});
function onContentMouseDown(e) {
if (e.target !== senderRef.value.querySelector(`.el-textarea__inner`)) {
e.preventDefault();
}
inputRef.value.input.focus();
}
const visiableHeader = ref(false);
function openHeader() {
if (!slots.header)
return false;
if (props.readOnly)
return false;
visiableHeader.value = true;
}
function closeHeader() {
if (!slots.header)
return;
if (props.readOnly)
return;
visiableHeader.value = false;
}
const recognition = ref(null);
const speechLoading = ref(false);
function startRecognition() {
if (props.readOnly)
return;
if (hasOnRecordingChangeListener.value) {
speechLoading.value = true;
emits("recordingChange", true);
return;
}
if ("webkitSpeechRecognition" in window) {
recognition.value = new webkitSpeechRecognition();
recognition.value.continuous = true;
recognition.value.interimResults = true;
recognition.value.lang = "zh-CN";
recognition.value.onresult = (event) => {
let results = "";
for (let i = 0; i <= event.resultIndex; i++) {
results += event.results[i][0].transcript;
}
if (!props.readOnly) {
internalValue.value = results;
}
};
recognition.value.onstart = () => {
speechLoading.value = true;
};
recognition.value.onend = () => {
speechLoading.value = false;
};
recognition.value.onerror = (event) => {
speechLoading.value = false;
};
recognition.value.start();
}
}
function stopRecognition() {
if (hasOnRecordingChangeListener.value) {
speechLoading.value = false;
emits("recordingChange", false);
return;
}
if (recognition.value) {
recognition.value.stop();
speechLoading.value = false;
}
}
function submit() {
if (props.readOnly || props.loading || props.disabled || isSubmitDisabled.value) {
return;
}
emits("submit", internalValue.value);
}
function cancel() {
if (props.readOnly)
return;
emits("cancel", internalValue.value);
}
function clear() {
if (props.readOnly)
return;
inputRef.value.input.clear();
internalValue.value = "";
}
function handleKeyDown(e) {
if (props.readOnly)
return;
const _resetSelectionRange = () => {
const cursorPosition = e.target.selectionStart;
const textBeforeCursor = internalValue.value.slice(0, cursorPosition);
const textAfterCursor = internalValue.value.slice(cursorPosition);
internalValue.value = `${textBeforeCursor}
${textAfterCursor}`;
e.target.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
};
let _isComKeyDown = false;
switch (props.submitType) {
case "cmdOrCtrlEnter":
_isComKeyDown = e.metaKey || e.ctrlKey;
break;
case "shiftEnter":
_isComKeyDown = e.shiftKey;
break;
case "altEnter":
_isComKeyDown = e.altKey;
break;
case "enter":
_isComKeyDown = e.shiftKey || e.metaKey || e.ctrlKey || e.altKey;
break;
default:
_isComKeyDown = false;
break;
}
if (e.keyCode === 13) {
e.preventDefault();
if (props.submitType === "enter") {
_isComKeyDown ? _resetSelectionRange() : submit();
} else {
_isComKeyDown ? submit() : _resetSelectionRange();
}
}
}
function blur() {
if (props.readOnly) {
return false;
}
inputRef.value.input.blur();
}
function focus(type = "all") {
if (props.readOnly) {
return false;
}
if (type === "all") {
inputRef.value.input.select();
} else if (type === "start") {
focusToStart();
} else if (type === "end") {
focusToEnd();
}
}
function focusToStart() {
if (inputRef.value) {
const textarea = inputRef.value.input.ref;
if (textarea) {
textarea.focus();
textarea.setSelectionRange(0, 0);
}
}
}
function focusToEnd() {
if (inputRef.value) {
const textarea = inputRef.value.input.ref;
if (textarea) {
textarea.focus();
textarea.setSelectionRange(
internalValue.value.length,
internalValue.value.length
);
}
}
}
function handleSearch(pattern, prefix) {
emits("search", pattern, prefix);
}
function handleSelect(option2, prefix) {
emits("select", option2, prefix);
}
function handleInternalPaste(e) {
var _a3;
const files = (_a3 = e.clipboardData) == null ? void 0 : _a3.files;
if ((files == null ? void 0 : files.length) && hasOnPasteFileListener.value) {
emits("pasteFile", files[0], files);
e.preventDefault();
}
}
__expose({
openHeader,
// 打开头部
closeHeader,
// 关闭头部
clear,
// 清空输入框
blur,
// 失去焦点
focus,
// 获取焦点
// 按钮操作
submit,
cancel,
startRecognition,
stopRecognition,
popoverVisible,
inputInstance
});
return (_ctx, _cache) => {
const _component_el_mention = ElMention;
return openBlock(), createElementBlock("div", {
class: "el-sender-wrap",
tabindex: "-1",
style: normalizeStyle({ cursor: _ctx.disabled ? "not-allowed" : "default" })
}, [
createBaseVNode("div", {
ref_key: "senderRef",
ref: senderRef,
class: normalizeClass(["el-sender", {
"el-sender-disabled": _ctx.disabled
}]),
style: normalizeStyle({
"--el-box-shadow-tertiary": "0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02)",
"--el-sender-input-input-font-size": "14px",
"--el-sender-header-animation-duration": `${_ctx.headerAnimationTimer}ms`
})
}, [
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
unref(visiableHeader) ? (openBlock(), createElementBlock("div", _hoisted_18, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_26, [
renderSlot(_ctx.$slots, "header", {}, void 0, true)
])) : createCommentVNode("", true)
])) : createCommentVNode("", true)
]),
_: 3
}),
createBaseVNode("div", {
class: normalizeClass(["el-sender-content", { "content-variant-updown": props.variant === "updown" }]),
onMousedown: onContentMouseDown
}, [
_ctx.$slots.prefix && props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_36, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createVNode(_component_el_mention, {
ref_key: "inputRef",
ref: inputRef,
modelValue: unref(internalValue),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(internalValue) ? internalValue.value = $event : null),
class: "el-sender-input",
"input-style": props.inputStyle || {
resize: "none",
"max-height": "176px",
"max-width": _ctx.inputWidth
},
rows: 1,
autosize: _ctx.autoSize,
type: "textarea",
"validate-event": false,
placeholder: _ctx.placeholder,
"read-only": _ctx.readOnly || _ctx.disabled,
disabled: _ctx.disabled,
options: props.options,
"filter-option": props.filterOption,
whole: props.whole,
"check-is-whole": props.checkIsWhole,
loading: props.triggerLoading,
prefix: props.triggerStrings,
split: props.triggerSplit,
placement: props.triggerPopoverPlacement,
offset: props.triggerPopoverOffset,
onKeydown: handleKeyDown,
onSearch: handleSearch,
onSelect: handleSelect,
onPaste: handleInternalPaste
}, createSlots({ _: 2 }, [
_ctx.$slots["trigger-label"] ? {
name: "label",
fn: withCtx(({ item, index }) => [
renderSlot(_ctx.$slots, "trigger-label", {
item,
index
}, void 0, true)
]),
key: "0"
} : void 0,
_ctx.$slots["trigger-loading"] ? {
name: "loading",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "trigger-loading", {}, void 0, true)
]),
key: "1"
} : void 0,
_ctx.$slots["trigger-header"] ? {
name: "header",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "trigger-header", {}, void 0, true)
]),
key: "2"
} : void 0,
_ctx.$slots["trigger-footer"] ? {
name: "footer",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "trigger-footer", {}, void 0, true)
]),
key: "3"
} : void 0
]), 1032, ["modelValue", "input-style", "autosize", "placeholder", "read-only", "disabled", "options", "filter-option", "whole", "check-is-whole", "loading", "prefix", "split", "placement", "offset"]),
props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_46, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_56, [
!_ctx.loading ? (openBlock(), createBlock(unref(_sfc_main$46), {
key: 0,
disabled: unref(isSubmitDisabled),
onSubmit: submit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
_ctx.loading ? (openBlock(), createBlock(unref(LoadingButton2), {
key: 1,
onCancel: cancel
})) : createCommentVNode("", true),
!unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(_sfc_main$36), {
key: 2,
onClick: startRecognition
})) : createCommentVNode("", true),
unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(SpeechLoadingButton), {
key: 3,
onClick: stopRecognition
})) : createCommentVNode("", true),
_ctx.clearable ? (openBlock(), createBlock(unref(ClearButton2), {
key: 4,
onClear: clear
})) : createCommentVNode("", true)
])
], true)
])) : createCommentVNode("", true),
props.variant === "updown" && props.showUpdown ? (openBlock(), createElementBlock("div", _hoisted_65, [
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_74, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_83, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_92, [
!_ctx.loading ? (openBlock(), createBlock(unref(_sfc_main$46), {
key: 0,
disabled: unref(isSubmitDisabled),
onSubmit: submit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
_ctx.loading ? (openBlock(), createBlock(unref(LoadingButton2), {
key: 1,
onCancel: cancel
})) : createCommentVNode("", true),
!unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(_sfc_main$36), {
key: 2,
onClick: startRecognition
})) : createCommentVNode("", true),
unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(SpeechLoadingButton), {
key: 3,
onClick: stopRecognition
})) : createCommentVNode("", true),
_ctx.clearable ? (openBlock(), createBlock(unref(ClearButton2), {
key: 4,
onClear: clear
})) : createCommentVNode("", true)
])
], true)
])
])) : createCommentVNode("", true)
], 34),
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_102, [
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : createCommentVNode("", true)
]),
_: 3
})
], 6)
], 4);
};
}
});
var MentionSender = _export_sfc2(_sfc_main14, [["__scopeId", "data-v-611c2794"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Prompts/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style2.css";
var _hoisted_19 = { class: "el-prompts-title" };
var _hoisted_27 = ["onClick", "onMouseenter", "onMouseleave", "onMousedown", "onMouseup"];
var _hoisted_37 = { class: "item-content-container" };
var _hoisted_47 = { class: "el-prompts-item-content" };
var _hoisted_57 = { class: "el-prompts-item-label" };
var _hoisted_66 = { class: "el-prompts-item-description" };
var _hoisted_75 = {
key: 1,
class: "el-prompts-children"
};
var _sfc_main15 = defineComponent({
__name: "index",
props: {
title: { default: "" },
items: { default: () => [] },
wrap: { type: Boolean, default: false },
vertical: { type: Boolean, default: false },
style: { default: () => ({}) }
},
emits: ["itemClick"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const hoveredKeys = ref(/* @__PURE__ */ new Set());
const activeKeys = ref(/* @__PURE__ */ new Set());
function handleItemClick(item) {
if (item.disabled)
return;
if (item.children && item.children.length > 0)
return;
emits("itemClick", item);
}
function handleMouseEnter(key2) {
hoveredKeys.value.add(key2);
}
function handleMouseLeave(key2) {
hoveredKeys.value.delete(key2);
}
function handleMouseDown(key2) {
activeKeys.value.add(key2);
}
function handleMouseUp(key2) {
activeKeys.value.delete(key2);
}
function isHovered(key2) {
return hoveredKeys.value.has(key2);
}
function isActive(key2) {
return activeKeys.value.has(key2);
}
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_index = resolveComponent("index", true);
return openBlock(), createElementBlock("div", {
class: "el-prompts",
style: normalizeStyle(props.style)
}, [
_ctx.$slots.title || props.title ? renderSlot(_ctx.$slots, "title", { key: 0 }, () => [
createBaseVNode("div", _hoisted_19, toDisplayString(_ctx.title), 1)
], true) : createCommentVNode("", true),
createBaseVNode("div", {
class: normalizeClass(["el-prompts-items", {
"el-prompts-items-wrap": props.wrap,
"el-prompts-items-vertical": props.vertical
}])
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
return openBlock(), createElementBlock("div", {
key: item.key,
class: normalizeClass(["el-prompts-item", {
"el-prompts-item-disabled": item.disabled,
"el-prompts-item-gap": item.icon || _ctx.$slots.icon,
hovered: isHovered(item.key),
actived: isActive(item.key)
}]),
style: normalizeStyle({
...item.itemStyle,
...isHovered(item.key) ? item.itemHoverStyle ? item.itemHoverStyle : {} : {},
...isActive(item.key) ? item.itemActiveStyle ? item.itemActiveStyle : {} : {}
}),
onClick: withModifiers(($event) => handleItemClick(item), ["stop"]),
onMouseenter: withModifiers(($event) => handleMouseEnter(item.key), ["stop"]),
onMouseleave: withModifiers(($event) => handleMouseLeave(item.key), ["stop"]),
onMousedown: withModifiers(($event) => handleMouseDown(item.key), ["stop"]),
onMouseup: withModifiers(($event) => handleMouseUp(item.key), ["stop"])
}, [
createBaseVNode("div", _hoisted_37, [
_ctx.$slots.icon || item.icon ? renderSlot(_ctx.$slots, "icon", {
key: 0,
item
}, () => [
createVNode(_component_el_icon, { class: "el-prompts-item-icon" }, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(item.icon)))
]),
_: 2
}, 1024)
], true) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_47, [
_ctx.$slots.label || item.label ? renderSlot(_ctx.$slots, "label", {
key: 0,
item
}, () => [
createBaseVNode("h6", _hoisted_57, toDisplayString(item.label), 1)
], true) : createCommentVNode("", true),
_ctx.$slots.description || item.description ? renderSlot(_ctx.$slots, "description", {
key: 1,
item
}, () => [
createBaseVNode("p", _hoisted_66, toDisplayString(item.description), 1)
], true) : createCommentVNode("", true)
]),
item.children && item.children.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_75, [
createVNode(_component_index, {
items: item.children,
vertical: "",
style: normalizeStyle(props.style),
onItemClick: handleItemClick
}, null, 8, ["items", "style"])
])) : createCommentVNode("", true)
])
], 46, _hoisted_27);
}), 128))
], 2)
], 4);
};
}
});
var Prompts = _export_sfc2(_sfc_main15, [["__scopeId", "data-v-7bcbf7fa"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Sender/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-input.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style9.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-popper.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Sender/index.css";
var popoverProps = buildProps({
trigger: useTooltipTriggerProps.trigger,
triggerKeys: useTooltipTriggerProps.triggerKeys,
placement: dropdownProps.placement,
disabled: useTooltipTriggerProps.disabled,
visible: useTooltipContentProps.visible,
transition: useTooltipContentProps.transition,
popperOptions: dropdownProps.popperOptions,
tabindex: dropdownProps.tabindex,
content: useTooltipContentProps.content,
popperStyle: useTooltipContentProps.popperStyle,
popperClass: useTooltipContentProps.popperClass,
enterable: {
...useTooltipContentProps.enterable,
default: true
},
effect: {
...useTooltipContentProps.effect,
default: "light"
},
teleported: useTooltipContentProps.teleported,
appendTo: useTooltipContentProps.appendTo,
title: String,
width: {
type: [String, Number],
default: 150
},
offset: {
type: Number,
default: void 0
},
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
},
showArrow: {
type: Boolean,
default: true
},
persistent: {
type: Boolean,
default: true
},
"onUpdate:visible": {
type: Function
}
});
var popoverEmits = {
"update:visible": (value) => isBoolean(value),
"before-enter": () => true,
"before-leave": () => true,
"after-enter": () => true,
"after-leave": () => true
};
var updateEventKeyRaw = `onUpdate:visible`;
var __default__8 = defineComponent({
name: "ElPopover"
});
var _sfc_main$84 = defineComponent({
...__default__8,
props: popoverProps,
emits: popoverEmits,
setup(__props, { expose, emit }) {
const props = __props;
const onUpdateVisible = computed(() => {
return props[updateEventKeyRaw];
});
const ns = useNamespace("popover");
const tooltipRef = ref();
const popperRef = computed(() => {
var _a3;
return (_a3 = unref(tooltipRef)) == null ? void 0 : _a3.popperRef;
});
const style = computed(() => {
return [
{
width: addUnit(props.width)
},
props.popperStyle
];
});
const kls = computed(() => {
return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
});
const gpuAcceleration = computed(() => {
return props.transition === `${ns.namespace.value}-fade-in-linear`;
});
const hide = () => {
var _a3;
(_a3 = tooltipRef.value) == null ? void 0 : _a3.hide();
};
const beforeEnter = () => {
emit("before-enter");
};
const beforeLeave = () => {
emit("before-leave");
};
const afterEnter = () => {
emit("after-enter");
};
const afterLeave = () => {
emit("update:visible", false);
emit("after-leave");
};
expose({
popperRef,
hide
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTooltip), mergeProps({
ref_key: "tooltipRef",
ref: tooltipRef
}, _ctx.$attrs, {
trigger: _ctx.trigger,
"trigger-keys": _ctx.triggerKeys,
placement: _ctx.placement,
disabled: _ctx.disabled,
visible: _ctx.visible,
transition: _ctx.transition,
"popper-options": _ctx.popperOptions,
tabindex: _ctx.tabindex,
content: _ctx.content,
offset: _ctx.offset,
"show-after": _ctx.showAfter,
"hide-after": _ctx.hideAfter,
"auto-close": _ctx.autoClose,
"show-arrow": _ctx.showArrow,
"aria-label": _ctx.title,
effect: _ctx.effect,
enterable: _ctx.enterable,
"popper-class": unref(kls),
"popper-style": unref(style),
teleported: _ctx.teleported,
"append-to": _ctx.appendTo,
persistent: _ctx.persistent,
"gpu-acceleration": unref(gpuAcceleration),
"onUpdate:visible": unref(onUpdateVisible),
onBeforeShow: beforeEnter,
onBeforeHide: beforeLeave,
onShow: afterEnter,
onHide: afterLeave
}), {
content: withCtx(() => [
_ctx.title ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(ns).e("title")),
role: "title"
}, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.content), 1)
])
]),
default: withCtx(() => [
_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["trigger", "trigger-keys", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "append-to", "persistent", "gpu-acceleration", "onUpdate:visible"]);
};
}
});
var Popover = _export_sfc(_sfc_main$84, [["__file", "popover.vue"]]);
var attachEvents = (el, binding) => {
const popperComponent = binding.arg || binding.value;
const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
if (popover) {
popover.triggerRef = el;
}
};
var PopoverDirective = {
mounted(el, binding) {
attachEvents(el, binding);
},
updated(el, binding) {
attachEvents(el, binding);
}
};
var VPopover = "popover";
var ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
var ElPopover = withInstall(Popover, {
directive: ElPopoverDirective
});
var _hoisted_1$73 = { class: "el-send-button" };
var _sfc_main$74 = defineComponent({
__name: "index",
emits: ["clear"],
setup(__props, { emit: __emit }) {
const emit = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$73, [
createVNode(_component_el_button, {
circle: "",
onClick: _cache[0] || (_cache[0] = ($event) => emit("clear"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(brush_default))
]),
_: 1
})
]),
_: 1
})
]);
};
}
});
var ClearButton3 = _export_sfc2(_sfc_main$74, [["__scopeId", "data-v-891c848d"]]);
var _sfc_main$65 = {};
var _hoisted_1$63 = {
viewBox: "0 0 1000 1000",
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
};
function _sfc_render7(_ctx, _cache) {
return openBlock(), createElementBlock("svg", _hoisted_1$63, _cache[0] || (_cache[0] = [
createBaseVNode("title", null, "Loading", -1),
createBaseVNode("rect", {
fill: "currentColor",
height: "250",
rx: "24",
ry: "24",
width: "250",
x: "375",
y: "375"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
opacity: "0.45"
}, null, -1),
createBaseVNode("circle", {
cx: "500",
cy: "500",
fill: "none",
r: "450",
stroke: "currentColor",
"stroke-width": "100",
"stroke-dasharray": "600 9999999"
}, [
createBaseVNode("animateTransform", {
attributeName: "transform",
dur: "1s",
from: "0 500 500",
repeatCount: "indefinite",
to: "360 500 500",
type: "rotate"
})
], -1)
]));
}
var loading$12 = _export_sfc2(_sfc_main$65, [["render", _sfc_render7]]);
var _hoisted_1$53 = { class: "el-send-button" };
var _sfc_main$55 = defineComponent({
__name: "index",
emits: ["cancel"],
setup(__props, { emit: __emit }) {
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$53, [
createVNode(_component_el_button, {
circle: "",
onClick: _cache[0] || (_cache[0] = ($event) => emits("cancel"))
}, {
default: withCtx(() => [
createVNode(loading$12, { class: "loading-svg" })
]),
_: 1
})
]);
};
}
});
var LoadingButton3 = _export_sfc2(_sfc_main$55, [["__scopeId", "data-v-cabe7c8e"]]);
var _hoisted_1$44 = { class: "el-send-button" };
var _sfc_main$47 = defineComponent({
__name: "index",
props: {
disabled: {
type: Boolean,
default: false
}
},
emits: ["submit"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$44, [
createVNode(_component_el_button, {
circle: "",
disabled: props.disabled,
onClick: _cache[0] || (_cache[0] = ($event) => emits("submit"))
}, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(top_default))
]),
_: 1
})
]),
_: 1
}, 8, ["disabled"])
]);
};
}
});
var _hoisted_1$34 = { class: "el-send-button" };
var _sfc_main$37 = defineComponent({
__name: "index",
setup(__props) {
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$34, [
createVNode(_component_el_button, { circle: "" }, {
default: withCtx(() => [
createVNode(_component_el_icon, null, {
default: withCtx(() => [
createVNode(unref(microphone_default))
]),
_: 1
})
]),
_: 1
})
]);
};
}
});
var _hoisted_1$24 = ["viewBox"];
var _hoisted_2$13 = ["x", "y"];
var _hoisted_3$13 = ["values", "dur", "begin"];
var _hoisted_4$13 = ["values", "dur", "begin"];
var SIZE2 = 1e3;
var COUNT2 = 4;
var RECT_WIDTH2 = 140;
var RECT_HEIGHT_MIN2 = 250;
var RECT_HEIGHT_MAX2 = 500;
var DURATION2 = 0.8;
var _sfc_main$27 = defineComponent({
__name: "loading",
props: {
className: { default: "" }
},
setup(__props) {
const RECT_RADIUS = RECT_WIDTH2 / 2;
const rects = computed(() => {
const dest = (SIZE2 - RECT_WIDTH2 * COUNT2) / (COUNT2 - 1);
return Array.from({ length: COUNT2 }).map((_, index) => {
const x = index * (dest + RECT_WIDTH2);
const yMin = SIZE2 / 2 - RECT_HEIGHT_MIN2 / 2;
const yMax = SIZE2 / 2 - RECT_HEIGHT_MAX2 / 2;
return { x, yMin, yMax };
});
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("svg", {
class: normalizeClass(_ctx.className),
color: "currentColor",
viewBox: `0 0 ${SIZE2} ${SIZE2}`,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
}, [
_cache[0] || (_cache[0] = createBaseVNode("title", null, "Speech Recording", -1)),
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rects), (item, index) => {
return openBlock(), createElementBlock("rect", {
key: index,
fill: "currentColor",
rx: RECT_RADIUS,
ry: RECT_RADIUS,
height: RECT_HEIGHT_MIN2,
width: RECT_WIDTH2,
x: item.x,
y: item.yMin
}, [
createBaseVNode("animate", {
attributeName: "height",
values: `${RECT_HEIGHT_MIN2}; ${RECT_HEIGHT_MAX2}; ${RECT_HEIGHT_MIN2}`,
keyTimes: "0; 0.5; 1",
dur: `${DURATION2}s`,
begin: `${DURATION2 / COUNT2 * index}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_3$13),
createBaseVNode("animate", {
attributeName: "y",
values: `${item.yMin}; ${item.yMax}; ${item.yMin}`,
keyTimes: "0; 0.5; 1",
dur: `${DURATION2}s`,
begin: `${DURATION2 / COUNT2 * index}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_4$13)
], 8, _hoisted_2$13);
}), 128))
], 10, _hoisted_1$24);
};
}
});
var loading3 = _export_sfc2(_sfc_main$27, [["__scopeId", "data-v-dd795da4"]]);
var _hoisted_1$15 = { class: "el-send-button" };
var _sfc_main$110 = defineComponent({
__name: "index",
setup(__props) {
return (_ctx, _cache) => {
const _component_el_button = ElButton;
return openBlock(), createElementBlock("div", _hoisted_1$15, [
createVNode(_component_el_button, { circle: "" }, {
default: withCtx(() => [
createVNode(loading3, { class: "loading-svg" })
]),
_: 1
})
]);
};
}
});
var SpeechLoadingButton2 = _export_sfc2(_sfc_main$110, [["__scopeId", "data-v-5179693f"]]);
var _hoisted_110 = {
key: 0,
class: "el-sender-header-wrap"
};
var _hoisted_28 = {
key: 0,
class: "el-sender-header"
};
var _hoisted_38 = {
key: 0,
class: "el-sender-prefix"
};
var _hoisted_48 = {
key: 1,
class: "el-sender-action-list"
};
var _hoisted_58 = { class: "el-sender-action-list-presets" };
var _hoisted_67 = {
key: 2,
class: "el-sender-updown-wrap"
};
var _hoisted_76 = {
key: 0,
class: "el-sender-prefix"
};
var _hoisted_84 = { class: "el-sender-action-list" };
var _hoisted_93 = { class: "el-sender-action-list-presets" };
var _hoisted_103 = {
key: 0,
class: "el-sender-footer"
};
var _sfc_main16 = defineComponent({
__name: "index",
props: {
modelValue: { default: "" },
placeholder: { default: "请输入内容" },
autoSize: { default: () => ({
minRows: 1,
maxRows: 6
}) },
readOnly: { type: Boolean },
disabled: { type: Boolean },
loading: { type: Boolean },
clearable: { type: Boolean },
allowSpeech: { type: Boolean },
submitType: { default: "enter" },
headerAnimationTimer: { default: 300 },
inputWidth: { default: "100%" },
variant: { default: "default" },
showUpdown: { type: Boolean, default: true },
submitBtnDisabled: { type: Boolean, default: void 0 },
inputStyle: { default: () => {
} },
triggerStrings: { default: () => [] },
triggerPopoverVisible: { type: Boolean, default: false },
triggerPopoverWidth: { default: "fit-content" },
triggerPopoverLeft: { default: "0px" },
triggerPopoverOffset: { default: 8 },
triggerPopoverPlacement: { default: "top-start" }
},
emits: ["update:modelValue", "update:triggerPopoverVisible", "submit", "cancel", "recordingChange", "trigger", "pasteFile"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
const slots = useSlots();
const instance = getCurrentInstance();
const hasOnRecordingChangeListener = computed(() => {
var _a3;
return !!((_a3 = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a3.onRecordingChange);
});
const hasOnPasteFileListener = computed(() => {
var _a3;
return !!((_a3 = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a3.onPasteFile);
});
const senderRef = ref();
const inputRef = ref();
const internalValue = computed({
get() {
return props.modelValue;
},
set(val) {
if (props.readOnly || props.disabled)
return;
emits("update:modelValue", val);
}
});
const inputInstance = computed(() => {
var _a3;
return (_a3 = inputRef.value) == null ? void 0 : _a3.ref;
});
const isComposing = ref(false);
const popoverRef = ref();
const hasOnTriggerListener = computed(() => {
var _a3;
return !!((_a3 = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a3.onTrigger);
});
const isSubmitDisabled = computed(() => {
if (typeof props.submitBtnDisabled === "boolean") {
return props.submitBtnDisabled;
}
return !internalValue.value;
});
const popoverVisible = computed({
get() {
return props.triggerPopoverVisible;
},
set(value) {
if (props.readOnly || props.disabled)
return;
emits("update:triggerPopoverVisible", value);
}
});
const triggerString = ref("");
watch(
() => internalValue.value,
(newVal, oldVal) => {
if (isComposing.value)
return;
const triggerStrings = props.triggerStrings || [];
const validOldVal = typeof oldVal === "string" ? oldVal : "";
const wasOldValTrigger = triggerStrings.includes(validOldVal);
const isNewValTrigger = triggerStrings.includes(newVal);
if (oldVal === "" && isNewValTrigger) {
triggerString.value = newVal;
if (hasOnTriggerListener.value) {
emits("trigger", {
oldValue: oldVal,
// 关闭时返回之前触发的字符
newValue: newVal,
triggerString: newVal,
isOpen: true
});
popoverVisible.value = true;
} else {
popoverVisible.value = true;
}
} else if (!isNewValTrigger && wasOldValTrigger) {
if (hasOnTriggerListener.value) {
emits("trigger", {
oldValue: oldVal || "",
// 关闭时返回之前触发的字符
newValue: newVal,
triggerString: void 0,
isOpen: false
});
popoverVisible.value = false;
} else {
popoverVisible.value = false;
}
} else if (oldVal !== "" && isNewValTrigger && !wasOldValTrigger) {
triggerString.value = newVal;
if (hasOnTriggerListener.value) {
emits("trigger", {
oldValue: oldVal || "",
// 关闭时返回之前触发的字符
newValue: newVal,
triggerString: newVal,
isOpen: true
});
popoverVisible.value = true;
} else {
popoverVisible.value = true;
}
}
},
{ deep: true, immediate: true }
);
function onContentMouseDown(e) {
if (e.target !== senderRef.value.querySelector(`.el-textarea__inner`)) {
e.preventDefault();
}
inputRef.value.focus();
}
const visiableHeader = ref(false);
function openHeader() {
if (!slots.header)
return false;
if (props.readOnly)
return false;
visiableHeader.value = true;
}
function closeHeader() {
if (!slots.header)
return;
if (props.readOnly)
return;
visiableHeader.value = false;
}
const recognition = ref(null);
const speechLoading = ref(false);
function startRecognition() {
if (props.readOnly)
return;
if (hasOnRecordingChangeListener.value) {
speechLoading.value = true;
emits("recordingChange", true);
return;
}
if ("webkitSpeechRecognition" in window) {
recognition.value = new webkitSpeechRecognition();
recognition.value.continuous = true;
recognition.value.interimResults = true;
recognition.value.lang = "zh-CN";
recognition.value.onresult = (event) => {
let results = "";
for (let i = 0; i <= event.resultIndex; i++) {
results += event.results[i][0].transcript;
}
if (!props.readOnly) {
internalValue.value = results;
}
};
recognition.value.onstart = () => {
speechLoading.value = true;
};
recognition.value.onend = () => {
speechLoading.value = false;
};
recognition.value.onerror = (event) => {
speechLoading.value = false;
};
recognition.value.start();
}
}
function stopRecognition() {
if (hasOnRecordingChangeListener.value) {
speechLoading.value = false;
emits("recordingChange", false);
return;
}
if (recognition.value) {
recognition.value.stop();
speechLoading.value = false;
}
}
function submit() {
if (props.readOnly || props.loading || props.disabled || isSubmitDisabled.value) {
return;
}
emits("submit", internalValue.value);
}
function cancel() {
if (props.readOnly)
return;
emits("cancel", internalValue.value);
}
function clear() {
if (props.readOnly)
return;
inputRef.value.clear();
internalValue.value = "";
}
function handleKeyDown(e) {
if (props.readOnly)
return;
const _resetSelectionRange = () => {
const cursorPosition = e.target.selectionStart;
const textBeforeCursor = internalValue.value.slice(0, cursorPosition);
const textAfterCursor = internalValue.value.slice(cursorPosition);
internalValue.value = `${textBeforeCursor}
${textAfterCursor}`;
e.target.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
};
let _isComKeyDown = false;
switch (props.submitType) {
case "cmdOrCtrlEnter":
_isComKeyDown = e.metaKey || e.ctrlKey;
break;
case "shiftEnter":
_isComKeyDown = e.shiftKey;
break;
case "altEnter":
_isComKeyDown = e.altKey;
break;
case "enter":
_isComKeyDown = e.shiftKey || e.metaKey || e.ctrlKey || e.altKey;
break;
default:
_isComKeyDown = false;
break;
}
if (e.keyCode === 13) {
e.preventDefault();
if (props.submitType === "enter") {
_isComKeyDown ? _resetSelectionRange() : submit();
} else {
_isComKeyDown ? submit() : _resetSelectionRange();
}
}
}
function blur() {
if (props.readOnly) {
return false;
}
inputRef.value.blur();
}
function focus(type = "all") {
if (props.readOnly) {
return false;
}
if (type === "all") {
inputRef.value.select();
} else if (type === "start") {
focusToStart();
} else if (type === "end") {
focusToEnd();
}
}
function focusToStart() {
if (inputRef.value) {
const textarea = inputRef.value.ref;
if (textarea) {
textarea.focus();
textarea.setSelectionRange(0, 0);
}
}
}
function focusToEnd() {
if (inputRef.value) {
const textarea = inputRef.value.ref;
if (textarea) {
textarea.focus();
textarea.setSelectionRange(
internalValue.value.length,
internalValue.value.length
);
}
}
}
function handleCompositionStart() {
isComposing.value = true;
}
function handleCompositionEnd() {
isComposing.value = false;
}
function handleInternalPaste(e) {
var _a3;
const files = (_a3 = e.clipboardData) == null ? void 0 : _a3.files;
if ((files == null ? void 0 : files.length) && hasOnPasteFileListener.value) {
emits("pasteFile", files[0], files);
e.preventDefault();
}
}
__expose({
openHeader,
// 打开头部
closeHeader,
// 关闭头部
clear,
// 清空输入框
blur,
// 失去焦点
focus,
// 获取焦点
// 按钮操作
submit,
cancel,
startRecognition,
stopRecognition,
popoverVisible,
inputInstance
});
return (_ctx, _cache) => {
const _component_el_input = ElInput;
const _component_el_popover = ElPopover;
return openBlock(), createElementBlock("div", {
class: "el-sender-wrap",
tabindex: "-1",
style: normalizeStyle({
cursor: _ctx.disabled ? "not-allowed" : "default",
"--el-sender-trigger-popover-width": props.triggerPopoverWidth,
"--el-sender-trigger-popover-left": props.triggerPopoverLeft
})
}, [
createBaseVNode("div", {
ref_key: "senderRef",
ref: senderRef,
class: normalizeClass(["el-sender", {
"el-sender-disabled": _ctx.disabled
}]),
style: normalizeStyle({
"--el-box-shadow-tertiary": "0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02)",
"--el-sender-input-input-font-size": "14px",
"--el-sender-header-animation-duration": `${_ctx.headerAnimationTimer}ms`
})
}, [
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
unref(visiableHeader) ? (openBlock(), createElementBlock("div", _hoisted_110, [
_ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_28, [
renderSlot(_ctx.$slots, "header", {}, void 0, true)
])) : createCommentVNode("", true)
])) : createCommentVNode("", true)
]),
_: 3
}),
createBaseVNode("div", {
class: normalizeClass(["el-sender-content", { "content-variant-updown": props.variant === "updown" }]),
onMousedown: onContentMouseDown
}, [
_ctx.$slots.prefix && props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_38, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createVNode(_component_el_input, {
ref_key: "inputRef",
ref: inputRef,
modelValue: unref(internalValue),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(internalValue) ? internalValue.value = $event : null),
class: "el-sender-input",
"input-style": props.inputStyle || {
resize: "none",
"max-height": "176px",
"max-width": _ctx.inputWidth
},
rows: 1,
autosize: _ctx.autoSize,
type: "textarea",
"validate-event": false,
placeholder: _ctx.placeholder,
"read-only": _ctx.readOnly || _ctx.disabled,
disabled: _ctx.disabled,
onKeydown: handleKeyDown,
onCompositionstart: handleCompositionStart,
onCompositionend: handleCompositionEnd,
onPaste: handleInternalPaste
}, null, 8, ["modelValue", "input-style", "autosize", "placeholder", "read-only", "disabled"]),
props.variant === "default" ? (openBlock(), createElementBlock("div", _hoisted_48, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_58, [
!_ctx.loading ? (openBlock(), createBlock(unref(_sfc_main$47), {
key: 0,
disabled: unref(isSubmitDisabled),
onSubmit: submit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
_ctx.loading ? (openBlock(), createBlock(unref(LoadingButton3), {
key: 1,
onCancel: cancel
})) : createCommentVNode("", true),
!unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(_sfc_main$37), {
key: 2,
onClick: startRecognition
})) : createCommentVNode("", true),
unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(SpeechLoadingButton2), {
key: 3,
onClick: stopRecognition
})) : createCommentVNode("", true),
_ctx.clearable ? (openBlock(), createBlock(unref(ClearButton3), {
key: 4,
onClear: clear
})) : createCommentVNode("", true)
])
], true)
])) : createCommentVNode("", true),
props.variant === "updown" && props.showUpdown ? (openBlock(), createElementBlock("div", _hoisted_67, [
_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_76, [
renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
])) : createCommentVNode("", true),
createBaseVNode("div", _hoisted_84, [
renderSlot(_ctx.$slots, "action-list", {}, () => [
createBaseVNode("div", _hoisted_93, [
!_ctx.loading ? (openBlock(), createBlock(unref(_sfc_main$47), {
key: 0,
disabled: unref(isSubmitDisabled),
onSubmit: submit
}, null, 8, ["disabled"])) : createCommentVNode("", true),
_ctx.loading ? (openBlock(), createBlock(unref(LoadingButton3), {
key: 1,
onCancel: cancel
})) : createCommentVNode("", true),
!unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(_sfc_main$37), {
key: 2,
onClick: startRecognition
})) : createCommentVNode("", true),
unref(speechLoading) && _ctx.allowSpeech ? (openBlock(), createBlock(unref(SpeechLoadingButton2), {
key: 3,
onClick: stopRecognition
})) : createCommentVNode("", true),
_ctx.clearable ? (openBlock(), createBlock(unref(ClearButton3), {
key: 4,
onClear: clear
})) : createCommentVNode("", true)
])
], true)
])
])) : createCommentVNode("", true)
], 34),
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_103, [
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : createCommentVNode("", true)
]),
_: 3
})
], 6),
createVNode(_component_el_popover, {
ref_key: "popoverRef",
ref: popoverRef,
"virtual-ref": unref(senderRef),
"virtual-triggering": "",
visible: unref(popoverVisible),
disabled: props.disabled,
"show-arrow": false,
placement: props.triggerPopoverPlacement,
offset: props.triggerPopoverOffset,
"popper-class": "el-sender-trigger-popover",
teleported: false
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "trigger-popover", { triggerString: unref(triggerString) }, () => [
createTextVNode(" 当前触发的字符为:" + toDisplayString(`${unref(triggerString)}`) + " 在这里定义的内容,但注意这里的回车事件将会被 输入框 覆盖 ", 1)
], true)
]),
_: 3
}, 8, ["virtual-ref", "visible", "disabled", "placement", "offset"])
], 4);
};
}
});
var Sender = _export_sfc2(_sfc_main16, [["__scopeId", "data-v-e36999c6"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Thinking/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style3.css";
var _hoisted_111 = ["disabled"];
var _hoisted_29 = { class: "status-icon" };
var _hoisted_39 = { class: "label" };
var _hoisted_49 = { class: "content" };
var _hoisted_59 = { class: "error-message" };
var _sfc_main17 = defineComponent({
__name: "index",
props: {
modelValue: { type: Boolean, default: true },
content: { default: "" },
status: { default: "start" },
disabled: { type: Boolean, default: false },
autoCollapse: { type: Boolean, default: false },
duration: { default: "0.2s" },
buttonWidth: { default: "160px" },
maxWidth: { default: "500px" },
backgroundColor: { default: "#fcfcfc" },
color: { default: "var(--el-color-info)" }
},
emits: ["change", "update:modelValue"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const isExpanded = ref(props.modelValue);
watch(
() => props.modelValue,
(newVal) => {
isExpanded.value = newVal;
}
);
function changeExpand() {
if (props.disabled)
return;
isExpanded.value = !isExpanded.value;
emit("change", { value: isExpanded.value, status: props.status });
emit("update:modelValue", isExpanded.value);
}
const displayedContent = computed(() => {
return props.status === "error" ? "思考过程中出现错误" : props.content;
});
watch(
() => props.status,
(newVal) => {
if (newVal === "end" && props.autoCollapse) {
isExpanded.value = false;
emit("update:modelValue", isExpanded.value);
}
}
);
return (_ctx, _cache) => {
const _component_el_icon = ElIcon;
return openBlock(), createElementBlock("div", {
class: "el-thinking",
style: normalizeStyle({
"--el-thinking-button-width": props.buttonWidth,
"--el-thinking-animation-duration": props.duration,
"--el-thinking-content-wrapper-width": props.maxWidth,
"--el-thinking-content-wrapper-background-color": props.backgroundColor,
"--el-thinking-content-wrapper-color": props.color
})
}, [
createBaseVNode("button", {
class: normalizeClass(["trigger", [_ctx.status, { disabled: !props.disabled }]]),
disabled: props.disabled,
onClick: changeExpand
}, [
createBaseVNode("span", _hoisted_29, [
renderSlot(_ctx.$slots, "status-icon", {
status: props.status
}, () => [
_ctx.status === "thinking" ? (openBlock(), createBlock(_component_el_icon, {
key: 0,
class: "is-loading el-icon-center"
}, {
default: withCtx(() => [
createVNode(unref(loading_default))
]),
_: 1
})) : createCommentVNode("", true),
_ctx.status === "start" ? (openBlock(), createBlock(_component_el_icon, {
key: 1,
class: "el-icon-center start-color"
}, {
default: withCtx(() => [
createVNode(unref(opportunity_default))
]),
_: 1
})) : createCommentVNode("", true),
_ctx.status === "end" ? (openBlock(), createBlock(_component_el_icon, {
key: 2,
class: "el-icon-center end-color"
}, {
default: withCtx(() => [
createVNode(unref(success_filled_default))
]),
_: 1
})) : createCommentVNode("", true),
_ctx.status === "error" ? (openBlock(), createBlock(_component_el_icon, {
key: 3,
class: "el-icon-center error-color"
}, {
default: withCtx(() => [
createVNode(unref(circle_close_filled_default))
]),
_: 1
})) : createCommentVNode("", true)
], true)
]),
createBaseVNode("span", _hoisted_39, [
renderSlot(_ctx.$slots, "label", {
status: props.status
}, () => [
createTextVNode(toDisplayString(_ctx.status === "thinking" ? "思考中..." : _ctx.status === "error" ? "思考遇到问题" : _ctx.status === "end" ? "思考完成" : "开始思考"), 1)
], true)
]),
createVNode(Transition, { name: "rotate" }, {
default: withCtx(() => [
!props.disabled ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(["arrow el-icon-center", { expanded: unref(isExpanded) }])
}, [
renderSlot(_ctx.$slots, "arrow", {}, () => [
createVNode(_component_el_icon, { class: "el-icon-center" }, {
default: withCtx(() => [
createVNode(unref(arrow_up_bold_default))
]),
_: 1
})
], true)
], 2)) : createCommentVNode("", true)
]),
_: 3
})
], 10, _hoisted_111),
createVNode(Transition, { name: "slide" }, {
default: withCtx(() => [
unref(displayedContent) ? withDirectives((openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(["content-wrapper", { "error-state": _ctx.status === "error" }])
}, [
createBaseVNode("div", _hoisted_49, [
_ctx.status !== "error" ? renderSlot(_ctx.$slots, "content", {
key: 0,
content: unref(displayedContent)
}, () => [
createBaseVNode("pre", null, toDisplayString(unref(displayedContent)), 1)
], true) : renderSlot(_ctx.$slots, "error", {
key: 1,
errorContent: unref(displayedContent)
}, () => [
createBaseVNode("div", _hoisted_59, toDisplayString(unref(displayedContent)), 1)
], true)
])
], 2)), [
[vShow, unref(isExpanded)]
]) : createCommentVNode("", true)
]),
_: 3
})
], 4);
};
}
});
var Thinking = _export_sfc2(_sfc_main17, [["__scopeId", "data-v-059ddb88"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ThoughtChain/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style4.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style3.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style9.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style2.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style8.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-input.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-popper.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-scrollbar.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style6.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-image-viewer.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style7.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style5.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ThoughtChain/index.css";
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/hooks/shiki-loader.js
var languageLoaders = {
abap: () => import("./abap-B7h4dtBh-ITY7Z7HM.js"),
"actionscript-3": () => import("./actionscript-3-Bmm7RA3Y-NZZEEC52.js"),
ada: () => import("./ada-BZS802Se-PZIS6OBL.js"),
apache: () => import("./apache-D4roVlsU-HY3NK3ML.js"),
apex: () => import("./apex-D6mfw0H5-TC7GWFOZ.js"),
apl: () => import("./apl-DDK-VObo-5QYXYZRU.js"),
applescript: () => import("./applescript-C43Knf0G-7SAO6K2J.js"),
ara: () => import("./ara-DRBH84ND-X2HBH7D4.js"),
asm: () => import("./asm-3tg4MVib-FVWUFPRQ.js"),
astro: () => import("./astro-v4FYbRud-XTMUBHR7.js"),
awk: () => import("./awk-ChreaG-G-HGLRS6GF.js"),
ballerina: () => import("./ballerina-B0yt0TYU-ROOR7HAP.js"),
bash: () => import("./zsh-hcK4TBd7-PAHYLZJM.js").then((n) => n.b),
bat: () => import("./batch-Ce_EX3Sx-7A4E7OIU.js").then((n) => n.b),
batch: () => import("./batch-Ce_EX3Sx-7A4E7OIU.js").then((n) => n.a),
be: () => import("./berry-Brv4WWdL-YHYRMKZU.js").then((n) => n.b),
beancount: () => import("./beancount-BRIsdQEB-WT2CZ3I2.js"),
berry: () => import("./berry-Brv4WWdL-YHYRMKZU.js").then((n) => n.a),
bibtex: () => import("./bibtex-BLeFwAes-OCVWUPVX.js"),
bicep: () => import("./bicep-BVrgfErX-TNVUKHVM.js"),
blade: () => import("./blade-By3Sw_Ex-4MY4HM2G.js"),
c: () => import("./c-C4VtT7JA-X6VNTGNI.js"),
"c#": () => import("./cs-h3ksD6-P-MU6DPSBR.js").then((n) => n.a),
cadence: () => import("./cdc-30ktANo3-7VCU4GJR.js").then((n) => n.c),
cdc: () => import("./cdc-30ktANo3-7VCU4GJR.js").then((n) => n.a),
clarity: () => import("./clarity-6uBl6Vpb-6QUODGBU.js"),
clj: () => import("./clojure-COBRmwo8-LNES7KVP.js").then((n) => n.c),
clojure: () => import("./clojure-COBRmwo8-LNES7KVP.js").then((n) => n.a),
cmake: () => import("./cmake-CDfQILeU-BEGF3TX5.js"),
cmd: () => import("./vb-DuF6ZenW-ITYTUCNH.js").then((n) => n.c),
cobol: () => import("./cobol-BOOIiISO-BOV42JY7.js"),
codeql: () => import("./ql-DTm-NCRo-HZPQJZON.js").then((n) => n.c),
coffee: () => import("./coffee-DO_RGoZp-Z77O4566.js"),
console: () => import("./shellsession-Cu3c0QAc-3FIYJMDE.js").then((n) => n.c),
cpp: () => import("./cpp-DAK8ktHO-IOYVEWMX.js"),
cql: () => import("./cypher-Dl2CXoXF-K7REDBCS.js").then((n) => n.c),
crystal: () => import("./crystal-CBGbbyVp-M7JLNUR5.js"),
cs: () => import("./cs-h3ksD6-P-MU6DPSBR.js").then((n) => n.b),
csharp: () => import("./cs-h3ksD6-P-MU6DPSBR.js").then((n) => n.a),
css: () => import("./css-BtVcDqlU-3SMBI4VF.js"),
cue: () => import("./cue-BFSVLV6N-RAH6U54O.js"),
cypher: () => import("./cypher-Dl2CXoXF-K7REDBCS.js").then((n) => n.a),
d: () => import("./d-9qSZPw74-IYMMGDOW.js"),
dart: () => import("./dart-CCSsOg9l-INBK66BK.js"),
dax: () => import("./dax-CvsmLV-B-T5NWJUQW.js"),
diff: () => import("./diff-BEdzuHlE-RX7HNH3R.js"),
docker: () => import("./dockerfile-B3DP334t-ERWMYCIN.js").then((n) => n.d),
dockerfile: () => import("./dockerfile-B3DP334t-ERWMYCIN.js").then((n) => n.a),
"dream-maker": () => import("./dream-maker-CNLQpoF--BGUBYSP6.js"),
elixir: () => import("./elixir-0rTCSSfp-RUK4BXPG.js"),
elm: () => import("./elm-BhwiZPvf-ANH3IG75.js"),
erb: () => import("./erb-Lra8TlYM-XILCHRPG.js"),
erl: () => import("./erlang-D2NNgvtR-VOT5GRY5.js").then((n) => n.e),
erlang: () => import("./erlang-D2NNgvtR-VOT5GRY5.js").then((n) => n.a),
"f#": () => import("./fs-CdBSddpF-ILJMGZZ7.js").then((n) => n.f),
fish: () => import("./fish-BU5HSdZy-QWRYXXJX.js"),
fs: () => import("./fs-CdBSddpF-ILJMGZZ7.js").then((n) => n.a),
fsharp: () => import("./fs-CdBSddpF-ILJMGZZ7.js").then((n) => n.f),
fsl: () => import("./jssm-D_YBQ_cM-QCKKVGLU.js").then((n) => n.f),
gdresource: () => import("./gdresource-CAbkn6H_-QY6INQLV.js"),
gdscript: () => import("./gdscript-Be_cubqt-2GQ745VM.js"),
gdshader: () => import("./gdshader-BEzE4j_3-P2FIILZ3.js"),
gherkin: () => import("./gherkin-xCNF9gh8-PTG6AEL7.js"),
"git-commit": () => import("./git-commit-PP9xCApN-PMAN7FU7.js"),
"git-rebase": () => import("./git-rebase-DqdGofLo-OOLIIKPX.js"),
gjs: () => import("./glimmer-js-BkPYTyD4-DFOHPKPZ.js").then((n) => n.g),
"glimmer-js": () => import("./glimmer-js-BkPYTyD4-DFOHPKPZ.js").then((n) => n.a),
"glimmer-ts": () => import("./gts-d3WsqAZM-TIR72DEQ.js").then((n) => n.g),
glsl: () => import("./glsl-CGsiYPcu-JVYKULSU.js"),
gnuplot: () => import("./gnuplot-tV8vezdE-ML3VW7WN.js"),
go: () => import("./go-CBmVHZBz-GLK2ZGGG.js"),
graphql: () => import("./graphql-D4pgneW3-FSRK7BQM.js"),
groovy: () => import("./groovy-Bn4MhXgW-FOHQLEJV.js"),
gts: () => import("./gts-d3WsqAZM-TIR72DEQ.js").then((n) => n.a),
hack: () => import("./hack-CwaBuF5l-FKYAZCJQ.js"),
haml: () => import("./haml-gLijj4rW-GTFMDHRM.js"),
handlebars: () => import("./hbs-CFi5SpI3-BB3HTAST.js").then((n) => n.h),
haskell: () => import("./hs-DXSGqUFF-DAZWYHW5.js").then((n) => n.h),
hbs: () => import("./hbs-CFi5SpI3-BB3HTAST.js").then((n) => n.a),
hcl: () => import("./hcl-axoq0Ycu-X4BVA3XM.js"),
hjson: () => import("./hjson-I7LcauIB-7FRZHYWL.js"),
hlsl: () => import("./hlsl-TRzjajlb-QLF7Z6NX.js"),
hs: () => import("./hs-DXSGqUFF-DAZWYHW5.js").then((n) => n.a),
html: () => import("./html-CLq-n30c-ATSLVLEY.js"),
http: () => import("./http-BYUKZ6kX-EXHN23MH.js"),
imba: () => import("./imba-C4923lSV-WHFJUBQ5.js"),
ini: () => import("./properties-D6yKO1eW-FQNI4TOH.js").then((n) => n.i),
jade: () => import("./pug-BrOx0bSt-PXJX45XU.js").then((n) => n.j),
java: () => import("./java-BfXh-0uJ-FHD23QOY.js"),
javascript: () => import("./js-CN_xSsjU-36SQ2CIF.js").then((n) => n.a),
"jinja-html": () => import("./jinja-html-BmW4v_vu-4UUOR2HI.js"),
jison: () => import("./jison-C9kAT_Oj-MRFQSPPZ.js"),
js: () => import("./js-CN_xSsjU-36SQ2CIF.js").then((n) => n.b),
json: () => import("./json-TjWBGEk1-RKFFVAON.js"),
json5: () => import("./json5-DCGCKrmX-QYDXS524.js"),
jsonc: () => import("./jsonc-DLVLp8id-VAJ4LX4A.js"),
jsonl: () => import("./jsonl-B-R_pDGg-4LSD6BGT.js"),
jsonnet: () => import("./jsonnet-Cs8BnnC6-3GJBBOMS.js"),
jssm: () => import("./jssm-D_YBQ_cM-QCKKVGLU.js").then((n) => n.j),
jsx: () => import("./jsx-BPmvoin2-EVDYAZRX.js"),
julia: () => import("./julia-C-JjBobP-JCFPXGOS.js"),
kotlin: () => import("./kotlin-BM2ZNTMh-MWGDV7QS.js"),
kql: () => import("./kusto-D9MF7CZf-V44PRARI.js").then((n) => n.k),
kusto: () => import("./kusto-D9MF7CZf-V44PRARI.js").then((n) => n.a),
latex: () => import("./latex-BsqkLZB_-ISGBZV5D.js"),
less: () => import("./less-BAzLMJNR-VHDH2WUP.js"),
liquid: () => import("./liquid-f2VHt0dg-CTR6LTFK.js"),
lisp: () => import("./lisp-DAq1kaby-5D6SHULQ.js"),
logo: () => import("./logo-D9l7oEJ8-P6MWBBBQ.js"),
lua: () => import("./lua-CH3ttzl_-KTQBKENM.js"),
make: () => import("./makefile-D2qLe7q0-MHL77QOA.js").then((n) => n.m),
makefile: () => import("./makefile-D2qLe7q0-MHL77QOA.js").then((n) => n.a),
markdown: () => import("./md-BIvDPr-W-4RBYARBF.js").then((n) => n.a),
marko: () => import("./marko-DwRyI_---LKFM2HBH.js"),
matlab: () => import("./matlab-7XHduepk-2E6RW6A4.js"),
md: () => import("./md-BIvDPr-W-4RBYARBF.js").then((n) => n.b),
mdc: () => import("./mdc-Rx6hWSHn-JUJFUE6A.js"),
mdx: () => import("./mdx-D5wExp-O-VE2SLJAB.js"),
mermaid: () => import("./mermaid-CUjtoYEe-R6I6CXS5.js"),
mojo: () => import("./mojo-CrbF881p-XOKRSW37.js"),
nar: () => import("./narrat-DOwkIbBe-FP3ELV5H.js").then((n) => n.n),
narrat: () => import("./narrat-DOwkIbBe-FP3ELV5H.js").then((n) => n.a),
nextflow: () => import("./nf-DHfvJ2gH-26Z6ZCE2.js").then((n) => n.n),
nf: () => import("./nf-DHfvJ2gH-26Z6ZCE2.js").then((n) => n.a),
nginx: () => import("./nginx-B_jWsywZ-SY6XP6TW.js"),
nim: () => import("./nim-yzbnZKJd-T4YV6CLK.js"),
nix: () => import("./nix--3K2gyjg-6PM4CBOK.js"),
objc: () => import("./objective-c-DkOBZg1J-63SD6VRZ.js").then((n) => n.o),
"objective-c": () => import("./objective-c-DkOBZg1J-63SD6VRZ.js").then((n) => n.a),
"objective-cpp": () => import("./objective-cpp-DEoN9Fe5-DPCIXJY5.js"),
ocaml: () => import("./ocaml-B1kfGk9Y-FKZ7DPXO.js"),
pascal: () => import("./pascal-CU8Kjkr_-57FRAEAK.js"),
perl: () => import("./perl-FH6su6vZ-PCL3A7NV.js"),
perl6: () => import("./raku-xArQd_rF-KZNJ2W5X.js").then((n) => n.p),
php: () => import("./php-Dnl1TfYH-FJZJVOSU.js"),
plsql: () => import("./plsql-B3Na24V4-XEPBFTIH.js"),
postcss: () => import("./postcss-kj1IbjVd-C7AJWBZX.js"),
powerquery: () => import("./powerquery-B-e1fO-k-UDBQFAKG.js"),
powershell: () => import("./ps1-aFyNx8UH-2BME32P7.js").then((n) => n.p),
prisma: () => import("./prisma-bmxcSDxq-CPHFGPTD.js"),
prolog: () => import("./prolog-BT9GCzqD-MEYOBGSU.js"),
properties: () => import("./properties-D6yKO1eW-FQNI4TOH.js").then((n) => n.p),
proto: () => import("./proto-BIXM0k1a-ZVXXKOPG.js"),
ps: () => import("./ps1-aFyNx8UH-2BME32P7.js").then((n) => n.a),
ps1: () => import("./ps1-aFyNx8UH-2BME32P7.js").then((n) => n.b),
pug: () => import("./pug-BrOx0bSt-PXJX45XU.js").then((n) => n.p),
puppet: () => import("./puppet-N15G4Usj-SJZCQZQ5.js"),
purescript: () => import("./purescript-DrwsEYNH-7HIEVFNL.js"),
py: () => import("./python-D2s92fRP-UF6ZKOEG.js").then((n) => n.a),
python: () => import("./python-D2s92fRP-UF6ZKOEG.js").then((n) => n.b),
ql: () => import("./ql-DTm-NCRo-HZPQJZON.js").then((n) => n.q),
r: () => import("./r-oprfD2-9-TOCU75ET.js"),
raku: () => import("./raku-xArQd_rF-KZNJ2W5X.js").then((n) => n.r),
razor: () => import("./razor-BoXCAbWQ-DTXQTEHG.js"),
rb: () => import("./ruby-BmfBy6EV-YIMTAOPU.js").then((n) => n.a),
reg: () => import("./reg-CULnG2WX-KECQ4F36.js"),
rel: () => import("./rel-CHRwzjd4-7P4NKKNJ.js"),
riscv: () => import("./riscv-BNQ9cVpw-HFHT67WZ.js"),
rs: () => import("./rust-Bf_fdNdL-5ECRZA4T.js").then((n) => n.r),
rst: () => import("./rst-bEtD1v7N-GYGWOIT2.js"),
ruby: () => import("./ruby-BmfBy6EV-YIMTAOPU.js").then((n) => n.b),
rust: () => import("./rust-Bf_fdNdL-5ECRZA4T.js").then((n) => n.a),
sas: () => import("./sas-BLBgC3TA-SKXVO6BG.js"),
sass: () => import("./sass-BheygBdF-4QHRWLQW.js"),
scala: () => import("./scala-B-_7vFVn-RAAT2IW7.js"),
scheme: () => import("./scheme-BSHdPinv-AQD3TLXD.js"),
scss: () => import("./scss-Dq-LbI_c-APEV25XL.js"),
sh: () => import("./zsh-hcK4TBd7-PAHYLZJM.js").then((n) => n.a),
shader: () => import("./shaderlab-BOQRTiQi-FPGWRTL3.js").then((n) => n.s),
shaderlab: () => import("./shaderlab-BOQRTiQi-FPGWRTL3.js").then((n) => n.a),
shell: () => import("./zsh-hcK4TBd7-PAHYLZJM.js").then((n) => n.c),
shellscript: () => import("./zsh-hcK4TBd7-PAHYLZJM.js").then((n) => n.d),
shellsession: () => import("./shellsession-Cu3c0QAc-3FIYJMDE.js").then((n) => n.s),
smalltalk: () => import("./smalltalk-qxcGy4fT-S4E5TX5N.js"),
solidity: () => import("./solidity-CewKZgp--NZBZAYFN.js"),
sparql: () => import("./sparql-DswowMAp-URGM6TW3.js"),
spl: () => import("./splunk-gK6Iw_P9-NWXRSW72.js").then((n) => n.s),
splunk: () => import("./splunk-gK6Iw_P9-NWXRSW72.js").then((n) => n.a),
sql: () => import("./sql-DzUuSofg-PZB4HCWG.js"),
"ssh-config": () => import("./ssh-config-Bk_I5wDR-EDVNTCR4.js"),
stata: () => import("./stata-Dl7wDdBE-ID35N5TX.js"),
styl: () => import("./stylus-qRNkxrFU-QEUQDGPE.js").then((n) => n.s),
stylus: () => import("./stylus-qRNkxrFU-QEUQDGPE.js").then((n) => n.a),
svelte: () => import("./svelte-B9qv3vkS-XNQ5XEUM.js"),
swift: () => import("./swift-BRQRsam8-OB7JGN6M.js"),
"system-verilog": () => import("./system-verilog-BcESSvRn-SQBH2VYZ.js"),
tasl: () => import("./tasl-DfOr2qHi-DZ5EQYXO.js"),
tcl: () => import("./tcl-CTsc4-t7-H2B7WGRJ.js"),
tex: () => import("./tex-CumJx1zu-MB463OUA.js"),
toml: () => import("./toml-vHPzWDj6-BNBD4YEU.js"),
ts: () => import("./typescript-CgxwwAuC-QPYZBPNP.js").then((n) => n.a),
tsx: () => import("./tsx-CmGGo4Hm-Z3QOD4YJ.js"),
turtle: () => import("./turtle-BnC7StHY-JPREPB4R.js"),
twig: () => import("./twig-0XKNpXN1-UMIK72V3.js"),
typescript: () => import("./typescript-CgxwwAuC-QPYZBPNP.js").then((n) => n.b),
v: () => import("./v-Bmdjo9cy-KYQCDDTN.js"),
vb: () => import("./vb-DuF6ZenW-ITYTUCNH.js").then((n) => n.v),
verilog: () => import("./verilog-CCb_iTfF-2HXXR6JE.js"),
vhdl: () => import("./vhdl-DMqk4T2s-P2X5NSLF.js"),
vim: () => import("./vimscript-aKp9YbYm-TO236O5Y.js").then((n) => n.v),
viml: () => import("./vimscript-aKp9YbYm-TO236O5Y.js").then((n) => n.a),
vimscript: () => import("./vimscript-aKp9YbYm-TO236O5Y.js").then((n) => n.b),
vue: () => import("./vue-DVNNTw2l-EMHXSDRN.js"),
"vue-html": () => import("./vue-html-Cr5wciIP-TLE33MBK.js"),
vy: () => import("./vyper-DYedWgAE-4QRBU4P6.js").then((n) => n.v),
vyper: () => import("./vyper-DYedWgAE-4QRBU4P6.js").then((n) => n.a),
wasm: () => import("./wasm-BBh6f151-V3FMGEKD.js"),
wenyan: () => import("./wenyan-BdqozpMZ-YTYBZGQ5.js"),
wgsl: () => import("./wgsl-Vo-hHVWH-VNE2MRDK.js"),
wolfram: () => import("./wolfram-CRmjUoI4-DHDYQFA5.js"),
xml: () => import("./xml-BMzZeaqs-UTMN7HSZ.js"),
xsl: () => import("./xsl-CAhvzxWv-CXA2LT4S.js"),
yaml: () => import("./yml-BhSrWWMS-76PVANHE.js").then((n) => n.a),
yml: () => import("./yml-BhSrWWMS-76PVANHE.js").then((n) => n.b),
zenscript: () => import("./zenscript-DFINJL6j-25YRTYN4.js"),
zig: () => import("./zig-CS4FMAZp-Q7BFSYOK.js"),
zsh: () => import("./zsh-hcK4TBd7-PAHYLZJM.js").then((n) => n.z),
文言: () => import("./wenyan-BdqozpMZ-YTYBZGQ5.js")
};
var themeLoaders = {
andromeeda: () => import("./andromeeda-CrngpmZk-HN7ZUSMY.js"),
"aurora-x": () => import("./aurora-x-wJ4-eM2h-RFJQGYWA.js"),
"ayu-dark": () => import("./ayu-dark-BEKp3oqs-3MWOVUHL.js"),
"catppuccin-frappe": () => import("./catppuccin-frappe-zLMNRRUx-UFUOFDQ3.js"),
"catppuccin-latte": () => import("./catppuccin-latte-CdF5jC3c-DM2XDYRZ.js"),
"catppuccin-macchiato": () => import("./catppuccin-macchiato-DyjXeyRt-O3DUAUOX.js"),
"catppuccin-mocha": () => import("./catppuccin-mocha-66IdYxR8-SSAZCBEZ.js"),
"dark-plus": () => import("./dark-plus-DmZ1Dzd4-UI7C2NS4.js"),
dracula: () => import("./dracula-B8-AVrwI-XVQPP5G3.js"),
"dracula-soft": () => import("./dracula-soft-BHeefow7-CKYACYGX.js"),
"everforest-dark": () => import("./everforest-dark-Cg1xdODP-PXBU4JOY.js"),
"everforest-light": () => import("./everforest-light-BmTD3bxe-ZOOH4LRL.js"),
"github-dark": () => import("./github-dark-O22yVQaY-HTVWP3HV.js"),
"github-dark-default": () => import("./github-dark-default-DB2Hkvqn-7A6A3WKG.js"),
"github-dark-dimmed": () => import("./github-dark-dimmed-CMZ_OfqC-OV5EY2O6.js"),
"github-dark-high-contrast": () => import("./github-dark-high-contrast-DmxWVmCU-2GSQSE54.js"),
"github-light": () => import("./github-light-BTbR9xVK-WXDV5DSL.js"),
"github-light-default": () => import("./github-light-default-DWEonwFe-6MC2CH6R.js"),
"github-light-high-contrast": () => import("./github-light-high-contrast-WJ_cPDts-HA4V5UMM.js"),
"gruvbox-dark-hard": () => import("./gruvbox-dark-hard-C89wZ4s3-Q5X53QET.js"),
"gruvbox-dark-medium": () => import("./gruvbox-dark-medium-swz85q_b-KPFV36ES.js"),
"gruvbox-dark-soft": () => import("./gruvbox-dark-soft-BYHBHQJW-YAW3WL5U.js"),
"gruvbox-light-hard": () => import("./gruvbox-light-hard-DEF_ZxYZ-EGV2T4PT.js"),
"gruvbox-light-medium": () => import("./gruvbox-light-medium-ziUMnHJx-S2G5COY6.js"),
"gruvbox-light-soft": () => import("./gruvbox-light-soft-Cuwp0tsB-7BUG6HNN.js"),
houston: () => import("./houston-CF_ws8Cq-AZ3DEEHO.js"),
"kanagawa-dragon": () => import("./kanagawa-dragon-DU8n2NNT-XUWYRP2B.js"),
"kanagawa-lotus": () => import("./kanagawa-lotus-Byd0CDet-WPKT3G7O.js"),
"kanagawa-wave": () => import("./kanagawa-wave-DExoagcR-4ZYZCOZF.js"),
laserwave: () => import("./laserwave-DF03wMlf-ZHPWCAD3.js"),
"light-plus": () => import("./light-plus-DS08Xg5J-U7NY645S.js"),
"material-theme": () => import("./material-theme-B8B2U48Q-G2W4LBJM.js"),
"material-theme-darker": () => import("./material-theme-darker-BV0iY_T3-EKHLPE25.js"),
"material-theme-lighter": () => import("./material-theme-lighter-DrzybSTF-TEEK3FPL.js"),
"material-theme-ocean": () => import("./material-theme-ocean-BRPLVReX-ITUDM7M6.js"),
"material-theme-palenight": () => import("./material-theme-palenight-DSJwsR_D-FPWVECUQ.js"),
"min-dark": () => import("./min-dark-BNaN9fWk-GJDAQJKE.js"),
"min-light": () => import("./min-light-CMrjentn-H53W5QDP.js"),
monokai: () => import("./monokai-DelygWXa-PFMS5GHV.js"),
"night-owl": () => import("./night-owl-DSS199ra-FHL7YFOO.js"),
nord: () => import("./nord-CvDbBq5M-6UILZFYV.js"),
"one-dark-pro": () => import("./one-dark-pro-CsMf0BoJ-6RBHUAYB.js"),
"one-light": () => import("./one-light-BwwAsfsj-UNM4ZOBA.js"),
plastic: () => import("./plastic-BjwMpBc0-TAWBMAET.js"),
poimandres: () => import("./poimandres-ChWyhPrn-PJYPK75N.js"),
red: () => import("./red-DByOl5N0-PX7FQRL7.js"),
"rose-pine": () => import("./rose-pine-LL9gXmP2-5XBSJCF3.js"),
"rose-pine-dawn": () => import("./rose-pine-dawn-CH9zdisO-3UVT44Z7.js"),
"rose-pine-moon": () => import("./rose-pine-moon-B1oKSfEJ-5NMJ646C.js"),
"slack-dark": () => import("./slack-dark-BEe10hxO-ZH4C6QFQ.js"),
"slack-ochin": () => import("./slack-ochin-BKmu9pBc-XDCXUJKO.js"),
"snazzy-light": () => import("./snazzy-light-Dcvd-ZyI-I7I23VNZ.js"),
"solarized-dark": () => import("./solarized-dark-BBl5y5sR-FLAURJWR.js"),
"solarized-light": () => import("./solarized-light-DW9b_AY8-5IKHGM4A.js"),
"synthwave-84": () => import("./synthwave-84-CoUef9sh-MX7KSDOB.js"),
"tokyo-night": () => import("./tokyo-night-DjtLpAEY-BIA3RPKX.js"),
vesper: () => import("./vesper-4Q1cEwPL-REU7W5HH.js"),
"vitesse-black": () => import("./vitesse-black-BqNLki8b-THAMRXAN.js"),
"vitesse-dark": () => import("./vitesse-dark-jJ32WhwH-O5WABCQD.js"),
"vitesse-light": () => import("./vitesse-light-476zM4e6-PUSMORMP.js")
};
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/useShiki-CKCxYD6P.js
var __defProp2 = Object.defineProperty;
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
var _a2;
var _b;
var ShikiError$2 = class ShikiError extends Error {
constructor(message) {
super(message);
this.name = "ShikiError";
}
};
function clone(something) {
return doClone(something);
}
function doClone(something) {
if (Array.isArray(something)) {
return cloneArray(something);
}
if (something instanceof RegExp) {
return something;
}
if (typeof something === "object") {
return cloneObj(something);
}
return something;
}
function cloneArray(arr) {
let r = [];
for (let i = 0, len = arr.length; i < len; i++) {
r[i] = doClone(arr[i]);
}
return r;
}
function cloneObj(obj) {
let r = {};
for (let key2 in obj) {
r[key2] = doClone(obj[key2]);
}
return r;
}
function mergeObjects(target, ...sources) {
sources.forEach((source) => {
for (let key2 in source) {
target[key2] = source[key2];
}
});
return target;
}
function basename(path) {
const idx = ~path.lastIndexOf("/") || ~path.lastIndexOf("\\");
if (idx === 0) {
return path;
} else if (~idx === path.length - 1) {
return basename(path.substring(0, path.length - 1));
} else {
return path.substr(~idx + 1);
}
}
var CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g;
var RegexSource = class {
static hasCaptures(regexSource) {
if (regexSource === null) {
return false;
}
CAPTURING_REGEX_SOURCE.lastIndex = 0;
return CAPTURING_REGEX_SOURCE.test(regexSource);
}
static replaceCaptures(regexSource, captureSource, captureIndices) {
return regexSource.replace(CAPTURING_REGEX_SOURCE, (match2, index, commandIndex, command) => {
let capture = captureIndices[parseInt(index || commandIndex, 10)];
if (capture) {
let result = captureSource.substring(capture.start, capture.end);
while (result[0] === ".") {
result = result.substring(1);
}
switch (command) {
case "downcase":
return result.toLowerCase();
case "upcase":
return result.toUpperCase();
default:
return result;
}
} else {
return match2;
}
});
}
};
function strcmp(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
function strArrCmp(a, b) {
if (a === null && b === null) {
return 0;
}
if (!a) {
return -1;
}
if (!b) {
return 1;
}
let len1 = a.length;
let len2 = b.length;
if (len1 === len2) {
for (let i = 0; i < len1; i++) {
let res = strcmp(a[i], b[i]);
if (res !== 0) {
return res;
}
}
return 0;
}
return len1 - len2;
}
function isValidHexColor(hex) {
if (/^#[0-9a-f]{6}$/i.test(hex)) {
return true;
}
if (/^#[0-9a-f]{8}$/i.test(hex)) {
return true;
}
if (/^#[0-9a-f]{3}$/i.test(hex)) {
return true;
}
if (/^#[0-9a-f]{4}$/i.test(hex)) {
return true;
}
return false;
}
function escapeRegExpCharacters(value) {
return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
}
var CachedFn = class {
constructor(fn2) {
__publicField2(this, "cache", /* @__PURE__ */ new Map());
this.fn = fn2;
}
get(key2) {
if (this.cache.has(key2)) {
return this.cache.get(key2);
}
const value = this.fn(key2);
this.cache.set(key2, value);
return value;
}
};
var Theme = class {
constructor(_colorMap, _defaults, _root) {
__publicField2(this, "_cachedMatchRoot", new CachedFn(
(scopeName) => this._root.match(scopeName)
));
this._colorMap = _colorMap;
this._defaults = _defaults;
this._root = _root;
}
static createFromRawTheme(source, colorMap2) {
return this.createFromParsedTheme(parseTheme(source), colorMap2);
}
static createFromParsedTheme(source, colorMap2) {
return resolveParsedThemeRules(source, colorMap2);
}
getColorMap() {
return this._colorMap.getColorMap();
}
getDefaults() {
return this._defaults;
}
match(scopePath) {
if (scopePath === null) {
return this._defaults;
}
const scopeName = scopePath.scopeName;
const matchingTrieElements = this._cachedMatchRoot.get(scopeName);
const effectiveRule = matchingTrieElements.find(
(v) => _scopePathMatchesParentScopes(scopePath.parent, v.parentScopes)
);
if (!effectiveRule) {
return null;
}
return new StyleAttributes(
effectiveRule.fontStyle,
effectiveRule.foreground,
effectiveRule.background
);
}
};
var ScopeStack = class _ScopeStack {
constructor(parent, scopeName) {
this.parent = parent;
this.scopeName = scopeName;
}
static push(path, scopeNames) {
for (const name of scopeNames) {
path = new _ScopeStack(path, name);
}
return path;
}
static from(...segments) {
let result = null;
for (let i = 0; i < segments.length; i++) {
result = new _ScopeStack(result, segments[i]);
}
return result;
}
push(scopeName) {
return new _ScopeStack(this, scopeName);
}
getSegments() {
let item = this;
const result = [];
while (item) {
result.push(item.scopeName);
item = item.parent;
}
result.reverse();
return result;
}
toString() {
return this.getSegments().join(" ");
}
extends(other) {
if (this === other) {
return true;
}
if (this.parent === null) {
return false;
}
return this.parent.extends(other);
}
getExtensionIfDefined(base2) {
const result = [];
let item = this;
while (item && item !== base2) {
result.push(item.scopeName);
item = item.parent;
}
return item === base2 ? result.reverse() : void 0;
}
};
function _scopePathMatchesParentScopes(scopePath, parentScopes) {
if (parentScopes.length === 0) {
return true;
}
for (let index = 0; index < parentScopes.length; index++) {
let scopePattern = parentScopes[index];
let scopeMustMatch = false;
if (scopePattern === ">") {
if (index === parentScopes.length - 1) {
return false;
}
scopePattern = parentScopes[++index];
scopeMustMatch = true;
}
while (scopePath) {
if (_matchesScope(scopePath.scopeName, scopePattern)) {
break;
}
if (scopeMustMatch) {
return false;
}
scopePath = scopePath.parent;
}
if (!scopePath) {
return false;
}
scopePath = scopePath.parent;
}
return true;
}
function _matchesScope(scopeName, scopePattern) {
return scopePattern === scopeName || scopeName.startsWith(scopePattern) && scopeName[scopePattern.length] === ".";
}
var StyleAttributes = class {
constructor(fontStyle, foregroundId, backgroundId) {
this.fontStyle = fontStyle;
this.foregroundId = foregroundId;
this.backgroundId = backgroundId;
}
};
function parseTheme(source) {
if (!source) {
return [];
}
if (!source.settings || !Array.isArray(source.settings)) {
return [];
}
let settings = source.settings;
let result = [], resultLen = 0;
for (let i = 0, len = settings.length; i < len; i++) {
let entry = settings[i];
if (!entry.settings) {
continue;
}
let scopes;
if (typeof entry.scope === "string") {
let _scope = entry.scope;
_scope = _scope.replace(/^[,]+/, "");
_scope = _scope.replace(/[,]+$/, "");
scopes = _scope.split(",");
} else if (Array.isArray(entry.scope)) {
scopes = entry.scope;
} else {
scopes = [""];
}
let fontStyle = -1;
if (typeof entry.settings.fontStyle === "string") {
fontStyle = 0;
let segments = entry.settings.fontStyle.split(" ");
for (let j = 0, lenJ = segments.length; j < lenJ; j++) {
let segment = segments[j];
switch (segment) {
case "italic":
fontStyle = fontStyle | 1;
break;
case "bold":
fontStyle = fontStyle | 2;
break;
case "underline":
fontStyle = fontStyle | 4;
break;
case "strikethrough":
fontStyle = fontStyle | 8;
break;
}
}
}
let foreground = null;
if (typeof entry.settings.foreground === "string" && isValidHexColor(entry.settings.foreground)) {
foreground = entry.settings.foreground;
}
let background = null;
if (typeof entry.settings.background === "string" && isValidHexColor(entry.settings.background)) {
background = entry.settings.background;
}
for (let j = 0, lenJ = scopes.length; j < lenJ; j++) {
let _scope = scopes[j].trim();
let segments = _scope.split(" ");
let scope = segments[segments.length - 1];
let parentScopes = null;
if (segments.length > 1) {
parentScopes = segments.slice(0, segments.length - 1);
parentScopes.reverse();
}
result[resultLen++] = new ParsedThemeRule(
scope,
parentScopes,
i,
fontStyle,
foreground,
background
);
}
}
return result;
}
var ParsedThemeRule = class {
constructor(scope, parentScopes, index, fontStyle, foreground, background) {
this.scope = scope;
this.parentScopes = parentScopes;
this.index = index;
this.fontStyle = fontStyle;
this.foreground = foreground;
this.background = background;
}
};
var FontStyle = ((FontStyle2) => {
FontStyle2[FontStyle2["NotSet"] = -1] = "NotSet";
FontStyle2[FontStyle2["None"] = 0] = "None";
FontStyle2[FontStyle2["Italic"] = 1] = "Italic";
FontStyle2[FontStyle2["Bold"] = 2] = "Bold";
FontStyle2[FontStyle2["Underline"] = 4] = "Underline";
FontStyle2[FontStyle2["Strikethrough"] = 8] = "Strikethrough";
return FontStyle2;
})(FontStyle || {});
function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
parsedThemeRules.sort((a, b) => {
let r = strcmp(a.scope, b.scope);
if (r !== 0) {
return r;
}
r = strArrCmp(a.parentScopes, b.parentScopes);
if (r !== 0) {
return r;
}
return a.index - b.index;
});
let defaultFontStyle = 0;
let defaultForeground = "#000000";
let defaultBackground = "#ffffff";
while (parsedThemeRules.length >= 1 && parsedThemeRules[0].scope === "") {
let incomingDefaults = parsedThemeRules.shift();
if (incomingDefaults.fontStyle !== -1) {
defaultFontStyle = incomingDefaults.fontStyle;
}
if (incomingDefaults.foreground !== null) {
defaultForeground = incomingDefaults.foreground;
}
if (incomingDefaults.background !== null) {
defaultBackground = incomingDefaults.background;
}
}
let colorMap2 = new ColorMap(_colorMap);
let defaults = new StyleAttributes(defaultFontStyle, colorMap2.getId(defaultForeground), colorMap2.getId(defaultBackground));
let root22 = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
for (let i = 0, len = parsedThemeRules.length; i < len; i++) {
let rule = parsedThemeRules[i];
root22.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap2.getId(rule.foreground), colorMap2.getId(rule.background));
}
return new Theme(colorMap2, defaults, root22);
}
var ColorMap = class {
constructor(_colorMap) {
__publicField2(this, "_isFrozen");
__publicField2(this, "_lastColorId");
__publicField2(this, "_id2color");
__publicField2(this, "_color2id");
this._lastColorId = 0;
this._id2color = [];
this._color2id = /* @__PURE__ */ Object.create(null);
if (Array.isArray(_colorMap)) {
this._isFrozen = true;
for (let i = 0, len = _colorMap.length; i < len; i++) {
this._color2id[_colorMap[i]] = i;
this._id2color[i] = _colorMap[i];
}
} else {
this._isFrozen = false;
}
}
getId(color) {
if (color === null) {
return 0;
}
color = color.toUpperCase();
let value = this._color2id[color];
if (value) {
return value;
}
if (this._isFrozen) {
throw new Error(`Missing color in color map - ${color}`);
}
value = ++this._lastColorId;
this._color2id[color] = value;
this._id2color[value] = color;
return value;
}
getColorMap() {
return this._id2color.slice(0);
}
};
var emptyParentScopes = Object.freeze([]);
var ThemeTrieElementRule = class _ThemeTrieElementRule {
constructor(scopeDepth, parentScopes, fontStyle, foreground, background) {
__publicField2(this, "scopeDepth");
__publicField2(this, "parentScopes");
__publicField2(this, "fontStyle");
__publicField2(this, "foreground");
__publicField2(this, "background");
this.scopeDepth = scopeDepth;
this.parentScopes = parentScopes || emptyParentScopes;
this.fontStyle = fontStyle;
this.foreground = foreground;
this.background = background;
}
clone() {
return new _ThemeTrieElementRule(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
}
static cloneArr(arr) {
let r = [];
for (let i = 0, len = arr.length; i < len; i++) {
r[i] = arr[i].clone();
}
return r;
}
acceptOverwrite(scopeDepth, fontStyle, foreground, background) {
if (this.scopeDepth > scopeDepth) {
} else {
this.scopeDepth = scopeDepth;
}
if (fontStyle !== -1) {
this.fontStyle = fontStyle;
}
if (foreground !== 0) {
this.foreground = foreground;
}
if (background !== 0) {
this.background = background;
}
}
};
var ThemeTrieElement = class _ThemeTrieElement {
constructor(_mainRule, rulesWithParentScopes = [], _children = {}) {
__publicField2(this, "_rulesWithParentScopes");
this._mainRule = _mainRule;
this._children = _children;
this._rulesWithParentScopes = rulesWithParentScopes;
}
static _cmpBySpecificity(a, b) {
if (a.scopeDepth !== b.scopeDepth) {
return b.scopeDepth - a.scopeDepth;
}
let aParentIndex = 0;
let bParentIndex = 0;
while (true) {
if (a.parentScopes[aParentIndex] === ">") {
aParentIndex++;
}
if (b.parentScopes[bParentIndex] === ">") {
bParentIndex++;
}
if (aParentIndex >= a.parentScopes.length || bParentIndex >= b.parentScopes.length) {
break;
}
const parentScopeLengthDiff = b.parentScopes[bParentIndex].length - a.parentScopes[aParentIndex].length;
if (parentScopeLengthDiff !== 0) {
return parentScopeLengthDiff;
}
aParentIndex++;
bParentIndex++;
}
return b.parentScopes.length - a.parentScopes.length;
}
match(scope) {
if (scope !== "") {
let dotIndex = scope.indexOf(".");
let head2;
let tail;
if (dotIndex === -1) {
head2 = scope;
tail = "";
} else {
head2 = scope.substring(0, dotIndex);
tail = scope.substring(dotIndex + 1);
}
if (this._children.hasOwnProperty(head2)) {
return this._children[head2].match(tail);
}
}
const rules = this._rulesWithParentScopes.concat(this._mainRule);
rules.sort(_ThemeTrieElement._cmpBySpecificity);
return rules;
}
insert(scopeDepth, scope, parentScopes, fontStyle, foreground, background) {
if (scope === "") {
this._doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background);
return;
}
let dotIndex = scope.indexOf(".");
let head2;
let tail;
if (dotIndex === -1) {
head2 = scope;
tail = "";
} else {
head2 = scope.substring(0, dotIndex);
tail = scope.substring(dotIndex + 1);
}
let child;
if (this._children.hasOwnProperty(head2)) {
child = this._children[head2];
} else {
child = new _ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));
this._children[head2] = child;
}
child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);
}
_doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background) {
if (parentScopes === null) {
this._mainRule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
return;
}
for (let i = 0, len = this._rulesWithParentScopes.length; i < len; i++) {
let rule = this._rulesWithParentScopes[i];
if (strArrCmp(rule.parentScopes, parentScopes) === 0) {
rule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
return;
}
}
if (fontStyle === -1) {
fontStyle = this._mainRule.fontStyle;
}
if (foreground === 0) {
foreground = this._mainRule.foreground;
}
if (background === 0) {
background = this._mainRule.background;
}
this._rulesWithParentScopes.push(new ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background));
}
};
var EncodedTokenMetadata = class _EncodedTokenMetadata {
static toBinaryStr(encodedTokenAttributes) {
return encodedTokenAttributes.toString(2).padStart(32, "0");
}
static print(encodedTokenAttributes) {
const languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
const tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
const fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
const foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
const background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
}
static getLanguageId(encodedTokenAttributes) {
return (encodedTokenAttributes & 255) >>> 0;
}
static getTokenType(encodedTokenAttributes) {
return (encodedTokenAttributes & 768) >>> 8;
}
static containsBalancedBrackets(encodedTokenAttributes) {
return (encodedTokenAttributes & 1024) !== 0;
}
static getFontStyle(encodedTokenAttributes) {
return (encodedTokenAttributes & 30720) >>> 11;
}
static getForeground(encodedTokenAttributes) {
return (encodedTokenAttributes & 16744448) >>> 15;
}
static getBackground(encodedTokenAttributes) {
return (encodedTokenAttributes & 4278190080) >>> 24;
}
/**
* Updates the fields in `metadata`.
* A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
*/
static set(encodedTokenAttributes, languageId, tokenType, containsBalancedBrackets, fontStyle, foreground, background) {
let _languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
let _tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
let _containsBalancedBracketsBit = _EncodedTokenMetadata.containsBalancedBrackets(encodedTokenAttributes) ? 1 : 0;
let _fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
let _foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
let _background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
if (languageId !== 0) {
_languageId = languageId;
}
if (tokenType !== 8) {
_tokenType = fromOptionalTokenType(tokenType);
}
if (containsBalancedBrackets !== null) {
_containsBalancedBracketsBit = containsBalancedBrackets ? 1 : 0;
}
if (fontStyle !== -1) {
_fontStyle = fontStyle;
}
if (foreground !== 0) {
_foreground = foreground;
}
if (background !== 0) {
_background = background;
}
return (_languageId << 0 | _tokenType << 8 | _containsBalancedBracketsBit << 10 | _fontStyle << 11 | _foreground << 15 | _background << 24) >>> 0;
}
};
function toOptionalTokenType(standardType) {
return standardType;
}
function fromOptionalTokenType(standardType) {
return standardType;
}
function createMatchers(selector, matchesName) {
const results = [];
const tokenizer = newTokenizer(selector);
let token = tokenizer.next();
while (token !== null) {
let priority = 0;
if (token.length === 2 && token.charAt(1) === ":") {
switch (token.charAt(0)) {
case "R":
priority = 1;
break;
case "L":
priority = -1;
break;
default:
}
token = tokenizer.next();
}
let matcher = parseConjunction();
results.push({ matcher, priority });
if (token !== ",") {
break;
}
token = tokenizer.next();
}
return results;
function parseOperand() {
if (token === "-") {
token = tokenizer.next();
const expressionToNegate = parseOperand();
return (matcherInput) => !!expressionToNegate && !expressionToNegate(matcherInput);
}
if (token === "(") {
token = tokenizer.next();
const expressionInParents = parseInnerExpression();
if (token === ")") {
token = tokenizer.next();
}
return expressionInParents;
}
if (isIdentifier(token)) {
const identifiers = [];
do {
identifiers.push(token);
token = tokenizer.next();
} while (isIdentifier(token));
return (matcherInput) => matchesName(identifiers, matcherInput);
}
return null;
}
function parseConjunction() {
const matchers = [];
let matcher = parseOperand();
while (matcher) {
matchers.push(matcher);
matcher = parseOperand();
}
return (matcherInput) => matchers.every((matcher2) => matcher2(matcherInput));
}
function parseInnerExpression() {
const matchers = [];
let matcher = parseConjunction();
while (matcher) {
matchers.push(matcher);
if (token === "|" || token === ",") {
do {
token = tokenizer.next();
} while (token === "|" || token === ",");
} else {
break;
}
matcher = parseConjunction();
}
return (matcherInput) => matchers.some((matcher2) => matcher2(matcherInput));
}
}
function isIdentifier(token) {
return !!token && !!token.match(/[\w\.:]+/);
}
function newTokenizer(input) {
let regex2 = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g;
let match2 = regex2.exec(input);
return {
next: () => {
if (!match2) {
return null;
}
const res = match2[0];
match2 = regex2.exec(input);
return res;
}
};
}
function disposeOnigString(str) {
if (typeof str.dispose === "function") {
str.dispose();
}
}
var TopLevelRuleReference = class {
constructor(scopeName) {
this.scopeName = scopeName;
}
toKey() {
return this.scopeName;
}
};
var TopLevelRepositoryRuleReference = class {
constructor(scopeName, ruleName) {
this.scopeName = scopeName;
this.ruleName = ruleName;
}
toKey() {
return `${this.scopeName}#${this.ruleName}`;
}
};
var ExternalReferenceCollector = class {
constructor() {
__publicField2(this, "_references", []);
__publicField2(this, "_seenReferenceKeys", /* @__PURE__ */ new Set());
__publicField2(this, "visitedRule", /* @__PURE__ */ new Set());
}
get references() {
return this._references;
}
add(reference2) {
const key2 = reference2.toKey();
if (this._seenReferenceKeys.has(key2)) {
return;
}
this._seenReferenceKeys.add(key2);
this._references.push(reference2);
}
};
var ScopeDependencyProcessor = class {
constructor(repo, initialScopeName) {
__publicField2(this, "seenFullScopeRequests", /* @__PURE__ */ new Set());
__publicField2(this, "seenPartialScopeRequests", /* @__PURE__ */ new Set());
__publicField2(this, "Q");
this.repo = repo;
this.initialScopeName = initialScopeName;
this.seenFullScopeRequests.add(this.initialScopeName);
this.Q = [new TopLevelRuleReference(this.initialScopeName)];
}
processQueue() {
const q2 = this.Q;
this.Q = [];
const deps = new ExternalReferenceCollector();
for (const dep of q2) {
collectReferencesOfReference(dep, this.initialScopeName, this.repo, deps);
}
for (const dep of deps.references) {
if (dep instanceof TopLevelRuleReference) {
if (this.seenFullScopeRequests.has(dep.scopeName)) {
continue;
}
this.seenFullScopeRequests.add(dep.scopeName);
this.Q.push(dep);
} else {
if (this.seenFullScopeRequests.has(dep.scopeName)) {
continue;
}
if (this.seenPartialScopeRequests.has(dep.toKey())) {
continue;
}
this.seenPartialScopeRequests.add(dep.toKey());
this.Q.push(dep);
}
}
}
};
function collectReferencesOfReference(reference2, baseGrammarScopeName, repo, result) {
const selfGrammar = repo.lookup(reference2.scopeName);
if (!selfGrammar) {
if (reference2.scopeName === baseGrammarScopeName) {
throw new Error(`No grammar provided for <${baseGrammarScopeName}>`);
}
return;
}
const baseGrammar = repo.lookup(baseGrammarScopeName);
if (reference2 instanceof TopLevelRuleReference) {
collectExternalReferencesInTopLevelRule({ baseGrammar, selfGrammar }, result);
} else {
collectExternalReferencesInTopLevelRepositoryRule(
reference2.ruleName,
{ baseGrammar, selfGrammar, repository: selfGrammar.repository },
result
);
}
const injections = repo.injections(reference2.scopeName);
if (injections) {
for (const injection of injections) {
result.add(new TopLevelRuleReference(injection));
}
}
}
function collectExternalReferencesInTopLevelRepositoryRule(ruleName, context, result) {
if (context.repository && context.repository[ruleName]) {
const rule = context.repository[ruleName];
collectExternalReferencesInRules([rule], context, result);
}
}
function collectExternalReferencesInTopLevelRule(context, result) {
if (context.selfGrammar.patterns && Array.isArray(context.selfGrammar.patterns)) {
collectExternalReferencesInRules(
context.selfGrammar.patterns,
{ ...context, repository: context.selfGrammar.repository },
result
);
}
if (context.selfGrammar.injections) {
collectExternalReferencesInRules(
Object.values(context.selfGrammar.injections),
{ ...context, repository: context.selfGrammar.repository },
result
);
}
}
function collectExternalReferencesInRules(rules, context, result) {
for (const rule of rules) {
if (result.visitedRule.has(rule)) {
continue;
}
result.visitedRule.add(rule);
const patternRepository = rule.repository ? mergeObjects({}, context.repository, rule.repository) : context.repository;
if (Array.isArray(rule.patterns)) {
collectExternalReferencesInRules(rule.patterns, { ...context, repository: patternRepository }, result);
}
const include = rule.include;
if (!include) {
continue;
}
const reference2 = parseInclude(include);
switch (reference2.kind) {
case 0:
collectExternalReferencesInTopLevelRule({ ...context, selfGrammar: context.baseGrammar }, result);
break;
case 1:
collectExternalReferencesInTopLevelRule(context, result);
break;
case 2:
collectExternalReferencesInTopLevelRepositoryRule(reference2.ruleName, { ...context, repository: patternRepository }, result);
break;
case 3:
case 4:
const selfGrammar = reference2.scopeName === context.selfGrammar.scopeName ? context.selfGrammar : reference2.scopeName === context.baseGrammar.scopeName ? context.baseGrammar : void 0;
if (selfGrammar) {
const newContext = { baseGrammar: context.baseGrammar, selfGrammar, repository: patternRepository };
if (reference2.kind === 4) {
collectExternalReferencesInTopLevelRepositoryRule(reference2.ruleName, newContext, result);
} else {
collectExternalReferencesInTopLevelRule(newContext, result);
}
} else {
if (reference2.kind === 4) {
result.add(new TopLevelRepositoryRuleReference(reference2.scopeName, reference2.ruleName));
} else {
result.add(new TopLevelRuleReference(reference2.scopeName));
}
}
break;
}
}
}
var BaseReference = class {
constructor() {
__publicField2(this, "kind", 0);
}
};
var SelfReference = class {
constructor() {
__publicField2(this, "kind", 1);
}
};
var RelativeReference = class {
constructor(ruleName) {
__publicField2(this, "kind", 2);
this.ruleName = ruleName;
}
};
var TopLevelReference = class {
constructor(scopeName) {
__publicField2(this, "kind", 3);
this.scopeName = scopeName;
}
};
var TopLevelRepositoryReference = class {
constructor(scopeName, ruleName) {
__publicField2(this, "kind", 4);
this.scopeName = scopeName;
this.ruleName = ruleName;
}
};
function parseInclude(include) {
if (include === "$base") {
return new BaseReference();
} else if (include === "$self") {
return new SelfReference();
}
const indexOfSharp = include.indexOf("#");
if (indexOfSharp === -1) {
return new TopLevelReference(include);
} else if (indexOfSharp === 0) {
return new RelativeReference(include.substring(1));
} else {
const scopeName = include.substring(0, indexOfSharp);
const ruleName = include.substring(indexOfSharp + 1);
return new TopLevelRepositoryReference(scopeName, ruleName);
}
}
var HAS_BACK_REFERENCES = /\\(\d+)/;
var BACK_REFERENCING_END = /\\(\d+)/g;
var endRuleId = -1;
var whileRuleId = -2;
function ruleIdFromNumber(id) {
return id;
}
function ruleIdToNumber(id) {
return id;
}
var Rule = class {
constructor($location, id, name, contentName) {
__publicField2(this, "$location");
__publicField2(this, "id");
__publicField2(this, "_nameIsCapturing");
__publicField2(this, "_name");
__publicField2(this, "_contentNameIsCapturing");
__publicField2(this, "_contentName");
this.$location = $location;
this.id = id;
this._name = name || null;
this._nameIsCapturing = RegexSource.hasCaptures(this._name);
this._contentName = contentName || null;
this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
}
get debugName() {
const location = this.$location ? `${basename(this.$location.filename)}:${this.$location.line}` : "unknown";
return `${this.constructor.name}#${this.id} @ ${location}`;
}
getName(lineText, captureIndices) {
if (!this._nameIsCapturing || this._name === null || lineText === null || captureIndices === null) {
return this._name;
}
return RegexSource.replaceCaptures(this._name, lineText, captureIndices);
}
getContentName(lineText, captureIndices) {
if (!this._contentNameIsCapturing || this._contentName === null) {
return this._contentName;
}
return RegexSource.replaceCaptures(this._contentName, lineText, captureIndices);
}
};
var CaptureRule = class extends Rule {
constructor($location, id, name, contentName, retokenizeCapturedWithRuleId) {
super($location, id, name, contentName);
__publicField2(this, "retokenizeCapturedWithRuleId");
this.retokenizeCapturedWithRuleId = retokenizeCapturedWithRuleId;
}
dispose() {
}
collectPatterns(grammar, out) {
throw new Error("Not supported!");
}
compile(grammar, endRegexSource) {
throw new Error("Not supported!");
}
compileAG(grammar, endRegexSource, allowA, allowG) {
throw new Error("Not supported!");
}
};
var MatchRule = class extends Rule {
constructor($location, id, name, match2, captures) {
super($location, id, name, null);
__publicField2(this, "_match");
__publicField2(this, "captures");
__publicField2(this, "_cachedCompiledPatterns");
this._match = new RegExpSource(match2, this.id);
this.captures = captures;
this._cachedCompiledPatterns = null;
}
dispose() {
if (this._cachedCompiledPatterns) {
this._cachedCompiledPatterns.dispose();
this._cachedCompiledPatterns = null;
}
}
get debugMatchRegExp() {
return `${this._match.source}`;
}
collectPatterns(grammar, out) {
out.push(this._match);
}
compile(grammar, endRegexSource) {
return this._getCachedCompiledPatterns(grammar).compile(grammar);
}
compileAG(grammar, endRegexSource, allowA, allowG) {
return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
}
_getCachedCompiledPatterns(grammar) {
if (!this._cachedCompiledPatterns) {
this._cachedCompiledPatterns = new RegExpSourceList();
this.collectPatterns(grammar, this._cachedCompiledPatterns);
}
return this._cachedCompiledPatterns;
}
};
var IncludeOnlyRule = class extends Rule {
constructor($location, id, name, contentName, patterns) {
super($location, id, name, contentName);
__publicField2(this, "hasMissingPatterns");
__publicField2(this, "patterns");
__publicField2(this, "_cachedCompiledPatterns");
this.patterns = patterns.patterns;
this.hasMissingPatterns = patterns.hasMissingPatterns;
this._cachedCompiledPatterns = null;
}
dispose() {
if (this._cachedCompiledPatterns) {
this._cachedCompiledPatterns.dispose();
this._cachedCompiledPatterns = null;
}
}
collectPatterns(grammar, out) {
for (const pattern of this.patterns) {
const rule = grammar.getRule(pattern);
rule.collectPatterns(grammar, out);
}
}
compile(grammar, endRegexSource) {
return this._getCachedCompiledPatterns(grammar).compile(grammar);
}
compileAG(grammar, endRegexSource, allowA, allowG) {
return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
}
_getCachedCompiledPatterns(grammar) {
if (!this._cachedCompiledPatterns) {
this._cachedCompiledPatterns = new RegExpSourceList();
this.collectPatterns(grammar, this._cachedCompiledPatterns);
}
return this._cachedCompiledPatterns;
}
};
var BeginEndRule = class extends Rule {
constructor($location, id, name, contentName, begin, beginCaptures, end, endCaptures, applyEndPatternLast, patterns) {
super($location, id, name, contentName);
__publicField2(this, "_begin");
__publicField2(this, "beginCaptures");
__publicField2(this, "_end");
__publicField2(this, "endHasBackReferences");
__publicField2(this, "endCaptures");
__publicField2(this, "applyEndPatternLast");
__publicField2(this, "hasMissingPatterns");
__publicField2(this, "patterns");
__publicField2(this, "_cachedCompiledPatterns");
this._begin = new RegExpSource(begin, this.id);
this.beginCaptures = beginCaptures;
this._end = new RegExpSource(end ? end : "", -1);
this.endHasBackReferences = this._end.hasBackReferences;
this.endCaptures = endCaptures;
this.applyEndPatternLast = applyEndPatternLast || false;
this.patterns = patterns.patterns;
this.hasMissingPatterns = patterns.hasMissingPatterns;
this._cachedCompiledPatterns = null;
}
dispose() {
if (this._cachedCompiledPatterns) {
this._cachedCompiledPatterns.dispose();
this._cachedCompiledPatterns = null;
}
}
get debugBeginRegExp() {
return `${this._begin.source}`;
}
get debugEndRegExp() {
return `${this._end.source}`;
}
getEndWithResolvedBackReferences(lineText, captureIndices) {
return this._end.resolveBackReferences(lineText, captureIndices);
}
collectPatterns(grammar, out) {
out.push(this._begin);
}
compile(grammar, endRegexSource) {
return this._getCachedCompiledPatterns(grammar, endRegexSource).compile(grammar);
}
compileAG(grammar, endRegexSource, allowA, allowG) {
return this._getCachedCompiledPatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
}
_getCachedCompiledPatterns(grammar, endRegexSource) {
if (!this._cachedCompiledPatterns) {
this._cachedCompiledPatterns = new RegExpSourceList();
for (const pattern of this.patterns) {
const rule = grammar.getRule(pattern);
rule.collectPatterns(grammar, this._cachedCompiledPatterns);
}
if (this.applyEndPatternLast) {
this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end);
} else {
this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);
}
}
if (this._end.hasBackReferences) {
if (this.applyEndPatternLast) {
this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, endRegexSource);
} else {
this._cachedCompiledPatterns.setSource(0, endRegexSource);
}
}
return this._cachedCompiledPatterns;
}
};
var BeginWhileRule = class extends Rule {
constructor($location, id, name, contentName, begin, beginCaptures, _while, whileCaptures, patterns) {
super($location, id, name, contentName);
__publicField2(this, "_begin");
__publicField2(this, "beginCaptures");
__publicField2(this, "whileCaptures");
__publicField2(this, "_while");
__publicField2(this, "whileHasBackReferences");
__publicField2(this, "hasMissingPatterns");
__publicField2(this, "patterns");
__publicField2(this, "_cachedCompiledPatterns");
__publicField2(this, "_cachedCompiledWhilePatterns");
this._begin = new RegExpSource(begin, this.id);
this.beginCaptures = beginCaptures;
this.whileCaptures = whileCaptures;
this._while = new RegExpSource(_while, whileRuleId);
this.whileHasBackReferences = this._while.hasBackReferences;
this.patterns = patterns.patterns;
this.hasMissingPatterns = patterns.hasMissingPatterns;
this._cachedCompiledPatterns = null;
this._cachedCompiledWhilePatterns = null;
}
dispose() {
if (this._cachedCompiledPatterns) {
this._cachedCompiledPatterns.dispose();
this._cachedCompiledPatterns = null;
}
if (this._cachedCompiledWhilePatterns) {
this._cachedCompiledWhilePatterns.dispose();
this._cachedCompiledWhilePatterns = null;
}
}
get debugBeginRegExp() {
return `${this._begin.source}`;
}
get debugWhileRegExp() {
return `${this._while.source}`;
}
getWhileWithResolvedBackReferences(lineText, captureIndices) {
return this._while.resolveBackReferences(lineText, captureIndices);
}
collectPatterns(grammar, out) {
out.push(this._begin);
}
compile(grammar, endRegexSource) {
return this._getCachedCompiledPatterns(grammar).compile(grammar);
}
compileAG(grammar, endRegexSource, allowA, allowG) {
return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
}
_getCachedCompiledPatterns(grammar) {
if (!this._cachedCompiledPatterns) {
this._cachedCompiledPatterns = new RegExpSourceList();
for (const pattern of this.patterns) {
const rule = grammar.getRule(pattern);
rule.collectPatterns(grammar, this._cachedCompiledPatterns);
}
}
return this._cachedCompiledPatterns;
}
compileWhile(grammar, endRegexSource) {
return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compile(grammar);
}
compileWhileAG(grammar, endRegexSource, allowA, allowG) {
return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
}
_getCachedCompiledWhilePatterns(grammar, endRegexSource) {
if (!this._cachedCompiledWhilePatterns) {
this._cachedCompiledWhilePatterns = new RegExpSourceList();
this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while);
}
if (this._while.hasBackReferences) {
this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : "");
}
return this._cachedCompiledWhilePatterns;
}
};
var RuleFactory = class _RuleFactory {
static createCaptureRule(helper, $location, name, contentName, retokenizeCapturedWithRuleId) {
return helper.registerRule((id) => {
return new CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId);
});
}
static getCompiledRuleId(desc, helper, repository) {
if (!desc.id) {
helper.registerRule((id) => {
desc.id = id;
if (desc.match) {
return new MatchRule(
desc.$vscodeTextmateLocation,
desc.id,
desc.name,
desc.match,
_RuleFactory._compileCaptures(desc.captures, helper, repository)
);
}
if (typeof desc.begin === "undefined") {
if (desc.repository) {
repository = mergeObjects({}, repository, desc.repository);
}
let patterns = desc.patterns;
if (typeof patterns === "undefined" && desc.include) {
patterns = [{ include: desc.include }];
}
return new IncludeOnlyRule(
desc.$vscodeTextmateLocation,
desc.id,
desc.name,
desc.contentName,
_RuleFactory._compilePatterns(patterns, helper, repository)
);
}
if (desc.while) {
return new BeginWhileRule(
desc.$vscodeTextmateLocation,
desc.id,
desc.name,
desc.contentName,
desc.begin,
_RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository),
desc.while,
_RuleFactory._compileCaptures(desc.whileCaptures || desc.captures, helper, repository),
_RuleFactory._compilePatterns(desc.patterns, helper, repository)
);
}
return new BeginEndRule(
desc.$vscodeTextmateLocation,
desc.id,
desc.name,
desc.contentName,
desc.begin,
_RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository),
desc.end,
_RuleFactory._compileCaptures(desc.endCaptures || desc.captures, helper, repository),
desc.applyEndPatternLast,
_RuleFactory._compilePatterns(desc.patterns, helper, repository)
);
});
}
return desc.id;
}
static _compileCaptures(captures, helper, repository) {
let r = [];
if (captures) {
let maximumCaptureId = 0;
for (const captureId in captures) {
if (captureId === "$vscodeTextmateLocation") {
continue;
}
const numericCaptureId = parseInt(captureId, 10);
if (numericCaptureId > maximumCaptureId) {
maximumCaptureId = numericCaptureId;
}
}
for (let i = 0; i <= maximumCaptureId; i++) {
r[i] = null;
}
for (const captureId in captures) {
if (captureId === "$vscodeTextmateLocation") {
continue;
}
const numericCaptureId = parseInt(captureId, 10);
let retokenizeCapturedWithRuleId = 0;
if (captures[captureId].patterns) {
retokenizeCapturedWithRuleId = _RuleFactory.getCompiledRuleId(captures[captureId], helper, repository);
}
r[numericCaptureId] = _RuleFactory.createCaptureRule(helper, captures[captureId].$vscodeTextmateLocation, captures[captureId].name, captures[captureId].contentName, retokenizeCapturedWithRuleId);
}
}
return r;
}
static _compilePatterns(patterns, helper, repository) {
let r = [];
if (patterns) {
for (let i = 0, len = patterns.length; i < len; i++) {
const pattern = patterns[i];
let ruleId = -1;
if (pattern.include) {
const reference2 = parseInclude(pattern.include);
switch (reference2.kind) {
case 0:
case 1:
ruleId = _RuleFactory.getCompiledRuleId(repository[pattern.include], helper, repository);
break;
case 2:
let localIncludedRule = repository[reference2.ruleName];
if (localIncludedRule) {
ruleId = _RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);
}
break;
case 3:
case 4:
const externalGrammarName = reference2.scopeName;
const externalGrammarInclude = reference2.kind === 4 ? reference2.ruleName : null;
const externalGrammar = helper.getExternalGrammar(externalGrammarName, repository);
if (externalGrammar) {
if (externalGrammarInclude) {
let externalIncludedRule = externalGrammar.repository[externalGrammarInclude];
if (externalIncludedRule) {
ruleId = _RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);
}
} else {
ruleId = _RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);
}
}
break;
}
} else {
ruleId = _RuleFactory.getCompiledRuleId(pattern, helper, repository);
}
if (ruleId !== -1) {
const rule = helper.getRule(ruleId);
let skipRule = false;
if (rule instanceof IncludeOnlyRule || rule instanceof BeginEndRule || rule instanceof BeginWhileRule) {
if (rule.hasMissingPatterns && rule.patterns.length === 0) {
skipRule = true;
}
}
if (skipRule) {
continue;
}
r.push(ruleId);
}
}
}
return {
patterns: r,
hasMissingPatterns: (patterns ? patterns.length : 0) !== r.length
};
}
};
var RegExpSource = class _RegExpSource {
constructor(regExpSource, ruleId) {
__publicField2(this, "source");
__publicField2(this, "ruleId");
__publicField2(this, "hasAnchor");
__publicField2(this, "hasBackReferences");
__publicField2(this, "_anchorCache");
if (regExpSource && typeof regExpSource === "string") {
const len = regExpSource.length;
let lastPushedPos = 0;
let output = [];
let hasAnchor = false;
for (let pos = 0; pos < len; pos++) {
const ch = regExpSource.charAt(pos);
if (ch === "\\") {
if (pos + 1 < len) {
const nextCh = regExpSource.charAt(pos + 1);
if (nextCh === "z") {
output.push(regExpSource.substring(lastPushedPos, pos));
output.push("$(?!\\n)(? {
return lineText.substring(capture.start, capture.end);
});
BACK_REFERENCING_END.lastIndex = 0;
return this.source.replace(BACK_REFERENCING_END, (match2, g1) => {
return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || "");
});
}
_buildAnchorCache() {
if (typeof this.source !== "string") {
throw new Error("This method should only be called if the source is a string");
}
let A0_G0_result = [];
let A0_G1_result = [];
let A1_G0_result = [];
let A1_G1_result = [];
let pos, len, ch, nextCh;
for (pos = 0, len = this.source.length; pos < len; pos++) {
ch = this.source.charAt(pos);
A0_G0_result[pos] = ch;
A0_G1_result[pos] = ch;
A1_G0_result[pos] = ch;
A1_G1_result[pos] = ch;
if (ch === "\\") {
if (pos + 1 < len) {
nextCh = this.source.charAt(pos + 1);
if (nextCh === "A") {
A0_G0_result[pos + 1] = "";
A0_G1_result[pos + 1] = "";
A1_G0_result[pos + 1] = "A";
A1_G1_result[pos + 1] = "A";
} else if (nextCh === "G") {
A0_G0_result[pos + 1] = "";
A0_G1_result[pos + 1] = "G";
A1_G0_result[pos + 1] = "";
A1_G1_result[pos + 1] = "G";
} else {
A0_G0_result[pos + 1] = nextCh;
A0_G1_result[pos + 1] = nextCh;
A1_G0_result[pos + 1] = nextCh;
A1_G1_result[pos + 1] = nextCh;
}
pos++;
}
}
}
return {
A0_G0: A0_G0_result.join(""),
A0_G1: A0_G1_result.join(""),
A1_G0: A1_G0_result.join(""),
A1_G1: A1_G1_result.join("")
};
}
resolveAnchors(allowA, allowG) {
if (!this.hasAnchor || !this._anchorCache || typeof this.source !== "string") {
return this.source;
}
if (allowA) {
if (allowG) {
return this._anchorCache.A1_G1;
} else {
return this._anchorCache.A1_G0;
}
} else {
if (allowG) {
return this._anchorCache.A0_G1;
} else {
return this._anchorCache.A0_G0;
}
}
}
};
var RegExpSourceList = class {
constructor() {
__publicField2(this, "_items");
__publicField2(this, "_hasAnchors");
__publicField2(this, "_cached");
__publicField2(this, "_anchorCache");
this._items = [];
this._hasAnchors = false;
this._cached = null;
this._anchorCache = {
A0_G0: null,
A0_G1: null,
A1_G0: null,
A1_G1: null
};
}
dispose() {
this._disposeCaches();
}
_disposeCaches() {
if (this._cached) {
this._cached.dispose();
this._cached = null;
}
if (this._anchorCache.A0_G0) {
this._anchorCache.A0_G0.dispose();
this._anchorCache.A0_G0 = null;
}
if (this._anchorCache.A0_G1) {
this._anchorCache.A0_G1.dispose();
this._anchorCache.A0_G1 = null;
}
if (this._anchorCache.A1_G0) {
this._anchorCache.A1_G0.dispose();
this._anchorCache.A1_G0 = null;
}
if (this._anchorCache.A1_G1) {
this._anchorCache.A1_G1.dispose();
this._anchorCache.A1_G1 = null;
}
}
push(item) {
this._items.push(item);
this._hasAnchors = this._hasAnchors || item.hasAnchor;
}
unshift(item) {
this._items.unshift(item);
this._hasAnchors = this._hasAnchors || item.hasAnchor;
}
length() {
return this._items.length;
}
setSource(index, newSource) {
if (this._items[index].source !== newSource) {
this._disposeCaches();
this._items[index].setSource(newSource);
}
}
compile(onigLib) {
if (!this._cached) {
let regExps = this._items.map((e) => e.source);
this._cached = new CompiledRule(onigLib, regExps, this._items.map((e) => e.ruleId));
}
return this._cached;
}
compileAG(onigLib, allowA, allowG) {
if (!this._hasAnchors) {
return this.compile(onigLib);
} else {
if (allowA) {
if (allowG) {
if (!this._anchorCache.A1_G1) {
this._anchorCache.A1_G1 = this._resolveAnchors(onigLib, allowA, allowG);
}
return this._anchorCache.A1_G1;
} else {
if (!this._anchorCache.A1_G0) {
this._anchorCache.A1_G0 = this._resolveAnchors(onigLib, allowA, allowG);
}
return this._anchorCache.A1_G0;
}
} else {
if (allowG) {
if (!this._anchorCache.A0_G1) {
this._anchorCache.A0_G1 = this._resolveAnchors(onigLib, allowA, allowG);
}
return this._anchorCache.A0_G1;
} else {
if (!this._anchorCache.A0_G0) {
this._anchorCache.A0_G0 = this._resolveAnchors(onigLib, allowA, allowG);
}
return this._anchorCache.A0_G0;
}
}
}
}
_resolveAnchors(onigLib, allowA, allowG) {
let regExps = this._items.map((e) => e.resolveAnchors(allowA, allowG));
return new CompiledRule(onigLib, regExps, this._items.map((e) => e.ruleId));
}
};
var CompiledRule = class {
constructor(onigLib, regExps, rules) {
__publicField2(this, "scanner");
this.regExps = regExps;
this.rules = rules;
this.scanner = onigLib.createOnigScanner(regExps);
}
dispose() {
if (typeof this.scanner.dispose === "function") {
this.scanner.dispose();
}
}
toString() {
const r = [];
for (let i = 0, len = this.rules.length; i < len; i++) {
r.push(" - " + this.rules[i] + ": " + this.regExps[i]);
}
return r.join("\n");
}
findNextMatchSync(string, startPosition, options) {
const result = this.scanner.findNextMatchSync(string, startPosition, options);
if (!result) {
return null;
}
return {
ruleId: this.rules[result.index],
captureIndices: result.captureIndices
};
}
};
var BasicScopeAttributes = class {
constructor(languageId, tokenType) {
this.languageId = languageId;
this.tokenType = tokenType;
}
};
var BasicScopeAttributesProvider = (_a2 = class {
constructor(initialLanguageId, embeddedLanguages) {
__publicField2(this, "_defaultAttributes");
__publicField2(this, "_embeddedLanguagesMatcher");
__publicField2(this, "_getBasicScopeAttributes", new CachedFn((scopeName) => {
const languageId = this._scopeToLanguage(scopeName);
const standardTokenType = this._toStandardTokenType(scopeName);
return new BasicScopeAttributes(languageId, standardTokenType);
}));
this._defaultAttributes = new BasicScopeAttributes(
initialLanguageId,
8
/* NotSet */
);
this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(embeddedLanguages || {}));
}
getDefaultAttributes() {
return this._defaultAttributes;
}
getBasicScopeAttributes(scopeName) {
if (scopeName === null) {
return _a2._NULL_SCOPE_METADATA;
}
return this._getBasicScopeAttributes.get(scopeName);
}
/**
* Given a produced TM scope, return the language that token describes or null if unknown.
* e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
*/
_scopeToLanguage(scope) {
return this._embeddedLanguagesMatcher.match(scope) || 0;
}
_toStandardTokenType(scopeName) {
const m = scopeName.match(_a2.STANDARD_TOKEN_TYPE_REGEXP);
if (!m) {
return 8;
}
switch (m[1]) {
case "comment":
return 1;
case "string":
return 2;
case "regex":
return 3;
case "meta.embedded":
return 0;
}
throw new Error("Unexpected match for standard token type!");
}
}, __publicField2(_a2, "_NULL_SCOPE_METADATA", new BasicScopeAttributes(0, 0)), __publicField2(_a2, "STANDARD_TOKEN_TYPE_REGEXP", /\b(comment|string|regex|meta\.embedded)\b/), _a2);
var ScopeMatcher = class {
constructor(values) {
__publicField2(this, "values");
__publicField2(this, "scopesRegExp");
if (values.length === 0) {
this.values = null;
this.scopesRegExp = null;
} else {
this.values = new Map(values);
const escapedScopes = values.map(
([scopeName, value]) => escapeRegExpCharacters(scopeName)
);
escapedScopes.sort();
escapedScopes.reverse();
this.scopesRegExp = new RegExp(
`^((${escapedScopes.join(")|(")}))($|\\.)`,
""
);
}
}
match(scope) {
if (!this.scopesRegExp) {
return void 0;
}
const m = scope.match(this.scopesRegExp);
if (!m) {
return void 0;
}
return this.values.get(m[1]);
}
};
({
InDebugMode: typeof process !== "undefined" && !!process.env["VSCODE_TEXTMATE_DEBUG"]
});
var TokenizeStringResult = class {
constructor(stack, stoppedEarly) {
this.stack = stack;
this.stoppedEarly = stoppedEarly;
}
};
function _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens, checkWhileConditions, timeLimit) {
const lineLength = lineText.content.length;
let STOP = false;
let anchorPosition = -1;
if (checkWhileConditions) {
const whileCheckResult = _checkWhileConditions(
grammar,
lineText,
isFirstLine,
linePos,
stack,
lineTokens
);
stack = whileCheckResult.stack;
linePos = whileCheckResult.linePos;
isFirstLine = whileCheckResult.isFirstLine;
anchorPosition = whileCheckResult.anchorPosition;
}
const startTime = Date.now();
while (!STOP) {
if (timeLimit !== 0) {
const elapsedTime = Date.now() - startTime;
if (elapsedTime > timeLimit) {
return new TokenizeStringResult(stack, true);
}
}
scanNext();
}
return new TokenizeStringResult(stack, false);
function scanNext() {
const r = matchRuleOrInjections(
grammar,
lineText,
isFirstLine,
linePos,
stack,
anchorPosition
);
if (!r) {
lineTokens.produce(stack, lineLength);
STOP = true;
return;
}
const captureIndices = r.captureIndices;
const matchedRuleId = r.matchedRuleId;
const hasAdvanced = captureIndices && captureIndices.length > 0 ? captureIndices[0].end > linePos : false;
if (matchedRuleId === endRuleId) {
const poppedRule = stack.getRule(grammar);
lineTokens.produce(stack, captureIndices[0].start);
stack = stack.withContentNameScopesList(stack.nameScopesList);
handleCaptures(
grammar,
lineText,
isFirstLine,
stack,
lineTokens,
poppedRule.endCaptures,
captureIndices
);
lineTokens.produce(stack, captureIndices[0].end);
const popped = stack;
stack = stack.parent;
anchorPosition = popped.getAnchorPos();
if (!hasAdvanced && popped.getEnterPos() === linePos) {
stack = popped;
lineTokens.produce(stack, lineLength);
STOP = true;
return;
}
} else {
const _rule = grammar.getRule(matchedRuleId);
lineTokens.produce(stack, captureIndices[0].start);
const beforePush = stack;
const scopeName = _rule.getName(lineText.content, captureIndices);
const nameScopesList = stack.contentNameScopesList.pushAttributed(
scopeName,
grammar
);
stack = stack.push(
matchedRuleId,
linePos,
anchorPosition,
captureIndices[0].end === lineLength,
null,
nameScopesList,
nameScopesList
);
if (_rule instanceof BeginEndRule) {
const pushedRule = _rule;
handleCaptures(
grammar,
lineText,
isFirstLine,
stack,
lineTokens,
pushedRule.beginCaptures,
captureIndices
);
lineTokens.produce(stack, captureIndices[0].end);
anchorPosition = captureIndices[0].end;
const contentName = pushedRule.getContentName(
lineText.content,
captureIndices
);
const contentNameScopesList = nameScopesList.pushAttributed(
contentName,
grammar
);
stack = stack.withContentNameScopesList(contentNameScopesList);
if (pushedRule.endHasBackReferences) {
stack = stack.withEndRule(
pushedRule.getEndWithResolvedBackReferences(
lineText.content,
captureIndices
)
);
}
if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
stack = stack.pop();
lineTokens.produce(stack, lineLength);
STOP = true;
return;
}
} else if (_rule instanceof BeginWhileRule) {
const pushedRule = _rule;
handleCaptures(
grammar,
lineText,
isFirstLine,
stack,
lineTokens,
pushedRule.beginCaptures,
captureIndices
);
lineTokens.produce(stack, captureIndices[0].end);
anchorPosition = captureIndices[0].end;
const contentName = pushedRule.getContentName(
lineText.content,
captureIndices
);
const contentNameScopesList = nameScopesList.pushAttributed(
contentName,
grammar
);
stack = stack.withContentNameScopesList(contentNameScopesList);
if (pushedRule.whileHasBackReferences) {
stack = stack.withEndRule(
pushedRule.getWhileWithResolvedBackReferences(
lineText.content,
captureIndices
)
);
}
if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
stack = stack.pop();
lineTokens.produce(stack, lineLength);
STOP = true;
return;
}
} else {
const matchingRule = _rule;
handleCaptures(
grammar,
lineText,
isFirstLine,
stack,
lineTokens,
matchingRule.captures,
captureIndices
);
lineTokens.produce(stack, captureIndices[0].end);
stack = stack.pop();
if (!hasAdvanced) {
stack = stack.safePop();
lineTokens.produce(stack, lineLength);
STOP = true;
return;
}
}
}
if (captureIndices[0].end > linePos) {
linePos = captureIndices[0].end;
isFirstLine = false;
}
}
}
function _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens) {
let anchorPosition = stack.beginRuleCapturedEOL ? 0 : -1;
const whileRules = [];
for (let node = stack; node; node = node.pop()) {
const nodeRule = node.getRule(grammar);
if (nodeRule instanceof BeginWhileRule) {
whileRules.push({
rule: nodeRule,
stack: node
});
}
}
for (let whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) {
const { ruleScanner, findOptions } = prepareRuleWhileSearch(whileRule.rule, grammar, whileRule.stack.endRule, isFirstLine, linePos === anchorPosition);
const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
if (r) {
const matchedRuleId = r.ruleId;
if (matchedRuleId !== whileRuleId) {
stack = whileRule.stack.pop();
break;
}
if (r.captureIndices && r.captureIndices.length) {
lineTokens.produce(whileRule.stack, r.captureIndices[0].start);
handleCaptures(grammar, lineText, isFirstLine, whileRule.stack, lineTokens, whileRule.rule.whileCaptures, r.captureIndices);
lineTokens.produce(whileRule.stack, r.captureIndices[0].end);
anchorPosition = r.captureIndices[0].end;
if (r.captureIndices[0].end > linePos) {
linePos = r.captureIndices[0].end;
isFirstLine = false;
}
}
} else {
stack = whileRule.stack.pop();
break;
}
}
return { stack, linePos, anchorPosition, isFirstLine };
}
function matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
const matchResult = matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
const injections = grammar.getInjections();
if (injections.length === 0) {
return matchResult;
}
const injectionResult = matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
if (!injectionResult) {
return matchResult;
}
if (!matchResult) {
return injectionResult;
}
const matchResultScore = matchResult.captureIndices[0].start;
const injectionResultScore = injectionResult.captureIndices[0].start;
if (injectionResultScore < matchResultScore || injectionResult.priorityMatch && injectionResultScore === matchResultScore) {
return injectionResult;
}
return matchResult;
}
function matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
const rule = stack.getRule(grammar);
const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, stack.endRule, isFirstLine, linePos === anchorPosition);
const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
if (r) {
return {
captureIndices: r.captureIndices,
matchedRuleId: r.ruleId
};
}
return null;
}
function matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
let bestMatchRating = Number.MAX_VALUE;
let bestMatchCaptureIndices = null;
let bestMatchRuleId;
let bestMatchResultPriority = 0;
const scopes = stack.contentNameScopesList.getScopeNames();
for (let i = 0, len = injections.length; i < len; i++) {
const injection = injections[i];
if (!injection.matcher(scopes)) {
continue;
}
const rule = grammar.getRule(injection.ruleId);
const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, null, isFirstLine, linePos === anchorPosition);
const matchResult = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
if (!matchResult) {
continue;
}
const matchRating = matchResult.captureIndices[0].start;
if (matchRating >= bestMatchRating) {
continue;
}
bestMatchRating = matchRating;
bestMatchCaptureIndices = matchResult.captureIndices;
bestMatchRuleId = matchResult.ruleId;
bestMatchResultPriority = injection.priority;
if (bestMatchRating === linePos) {
break;
}
}
if (bestMatchCaptureIndices) {
return {
priorityMatch: bestMatchResultPriority === -1,
captureIndices: bestMatchCaptureIndices,
matchedRuleId: bestMatchRuleId
};
}
return null;
}
function prepareRuleSearch(rule, grammar, endRegexSource, allowA, allowG) {
const ruleScanner = rule.compileAG(grammar, endRegexSource, allowA, allowG);
return {
ruleScanner,
findOptions: 0
/* None */
};
}
function prepareRuleWhileSearch(rule, grammar, endRegexSource, allowA, allowG) {
const ruleScanner = rule.compileWhileAG(grammar, endRegexSource, allowA, allowG);
return {
ruleScanner,
findOptions: 0
/* None */
};
}
function handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, captures, captureIndices) {
if (captures.length === 0) {
return;
}
const lineTextContent = lineText.content;
const len = Math.min(captures.length, captureIndices.length);
const localStack = [];
const maxEnd = captureIndices[0].end;
for (let i = 0; i < len; i++) {
const captureRule = captures[i];
if (captureRule === null) {
continue;
}
const captureIndex = captureIndices[i];
if (captureIndex.length === 0) {
continue;
}
if (captureIndex.start > maxEnd) {
break;
}
while (localStack.length > 0 && localStack[localStack.length - 1].endPos <= captureIndex.start) {
lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
localStack.pop();
}
if (localStack.length > 0) {
lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, captureIndex.start);
} else {
lineTokens.produce(stack, captureIndex.start);
}
if (captureRule.retokenizeCapturedWithRuleId) {
const scopeName = captureRule.getName(lineTextContent, captureIndices);
const nameScopesList = stack.contentNameScopesList.pushAttributed(scopeName, grammar);
const contentName = captureRule.getContentName(lineTextContent, captureIndices);
const contentNameScopesList = nameScopesList.pushAttributed(contentName, grammar);
const stackClone = stack.push(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, -1, false, null, nameScopesList, contentNameScopesList);
const onigSubStr = grammar.createOnigString(lineTextContent.substring(0, captureIndex.end));
_tokenizeString(
grammar,
onigSubStr,
isFirstLine && captureIndex.start === 0,
captureIndex.start,
stackClone,
lineTokens,
false,
/* no time limit */
0
);
disposeOnigString(onigSubStr);
continue;
}
const captureRuleScopeName = captureRule.getName(lineTextContent, captureIndices);
if (captureRuleScopeName !== null) {
const base2 = localStack.length > 0 ? localStack[localStack.length - 1].scopes : stack.contentNameScopesList;
const captureRuleScopesList = base2.pushAttributed(captureRuleScopeName, grammar);
localStack.push(new LocalStackElement(captureRuleScopesList, captureIndex.end));
}
}
while (localStack.length > 0) {
lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
localStack.pop();
}
}
var LocalStackElement = class {
constructor(scopes, endPos) {
__publicField2(this, "scopes");
__publicField2(this, "endPos");
this.scopes = scopes;
this.endPos = endPos;
}
};
function createGrammar(scopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, onigLib) {
return new Grammar(
scopeName,
grammar,
initialLanguage,
embeddedLanguages,
tokenTypes,
balancedBracketSelectors,
grammarRepository,
onigLib
);
}
function collectInjections(result, selector, rule, ruleFactoryHelper, grammar) {
const matchers = createMatchers(selector, nameMatcher);
const ruleId = RuleFactory.getCompiledRuleId(rule, ruleFactoryHelper, grammar.repository);
for (const matcher of matchers) {
result.push({
debugSelector: selector,
matcher: matcher.matcher,
ruleId,
grammar,
priority: matcher.priority
});
}
}
function nameMatcher(identifers, scopes) {
if (scopes.length < identifers.length) {
return false;
}
let lastIndex = 0;
return identifers.every((identifier) => {
for (let i = lastIndex; i < scopes.length; i++) {
if (scopesAreMatching(scopes[i], identifier)) {
lastIndex = i + 1;
return true;
}
}
return false;
});
}
function scopesAreMatching(thisScopeName, scopeName) {
if (!thisScopeName) {
return false;
}
if (thisScopeName === scopeName) {
return true;
}
const len = scopeName.length;
return thisScopeName.length > len && thisScopeName.substr(0, len) === scopeName && thisScopeName[len] === ".";
}
var Grammar = class {
constructor(_rootScopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, _onigLib) {
__publicField2(this, "_rootId");
__publicField2(this, "_lastRuleId");
__publicField2(this, "_ruleId2desc");
__publicField2(this, "_includedGrammars");
__publicField2(this, "_grammarRepository");
__publicField2(this, "_grammar");
__publicField2(this, "_injections");
__publicField2(this, "_basicScopeAttributesProvider");
__publicField2(this, "_tokenTypeMatchers");
this._rootScopeName = _rootScopeName;
this.balancedBracketSelectors = balancedBracketSelectors;
this._onigLib = _onigLib;
this._basicScopeAttributesProvider = new BasicScopeAttributesProvider(
initialLanguage,
embeddedLanguages
);
this._rootId = -1;
this._lastRuleId = 0;
this._ruleId2desc = [null];
this._includedGrammars = {};
this._grammarRepository = grammarRepository;
this._grammar = initGrammar(grammar, null);
this._injections = null;
this._tokenTypeMatchers = [];
if (tokenTypes) {
for (const selector of Object.keys(tokenTypes)) {
const matchers = createMatchers(selector, nameMatcher);
for (const matcher of matchers) {
this._tokenTypeMatchers.push({
matcher: matcher.matcher,
type: tokenTypes[selector]
});
}
}
}
}
get themeProvider() {
return this._grammarRepository;
}
dispose() {
for (const rule of this._ruleId2desc) {
if (rule) {
rule.dispose();
}
}
}
createOnigScanner(sources) {
return this._onigLib.createOnigScanner(sources);
}
createOnigString(sources) {
return this._onigLib.createOnigString(sources);
}
getMetadataForScope(scope) {
return this._basicScopeAttributesProvider.getBasicScopeAttributes(scope);
}
_collectInjections() {
const grammarRepository = {
lookup: (scopeName2) => {
if (scopeName2 === this._rootScopeName) {
return this._grammar;
}
return this.getExternalGrammar(scopeName2);
},
injections: (scopeName2) => {
return this._grammarRepository.injections(scopeName2);
}
};
const result = [];
const scopeName = this._rootScopeName;
const grammar = grammarRepository.lookup(scopeName);
if (grammar) {
const rawInjections = grammar.injections;
if (rawInjections) {
for (let expression in rawInjections) {
collectInjections(
result,
expression,
rawInjections[expression],
this,
grammar
);
}
}
const injectionScopeNames = this._grammarRepository.injections(scopeName);
if (injectionScopeNames) {
injectionScopeNames.forEach((injectionScopeName) => {
const injectionGrammar = this.getExternalGrammar(injectionScopeName);
if (injectionGrammar) {
const selector = injectionGrammar.injectionSelector;
if (selector) {
collectInjections(
result,
selector,
injectionGrammar,
this,
injectionGrammar
);
}
}
});
}
}
result.sort((i1, i2) => i1.priority - i2.priority);
return result;
}
getInjections() {
if (this._injections === null) {
this._injections = this._collectInjections();
}
return this._injections;
}
registerRule(factory) {
const id = ++this._lastRuleId;
const result = factory(ruleIdFromNumber(id));
this._ruleId2desc[id] = result;
return result;
}
getRule(ruleId) {
return this._ruleId2desc[ruleIdToNumber(ruleId)];
}
getExternalGrammar(scopeName, repository) {
if (this._includedGrammars[scopeName]) {
return this._includedGrammars[scopeName];
} else if (this._grammarRepository) {
const rawIncludedGrammar = this._grammarRepository.lookup(scopeName);
if (rawIncludedGrammar) {
this._includedGrammars[scopeName] = initGrammar(
rawIncludedGrammar,
repository && repository.$base
);
return this._includedGrammars[scopeName];
}
}
return void 0;
}
tokenizeLine(lineText, prevState, timeLimit = 0) {
const r = this._tokenize(lineText, prevState, false, timeLimit);
return {
tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),
ruleStack: r.ruleStack,
stoppedEarly: r.stoppedEarly
};
}
tokenizeLine2(lineText, prevState, timeLimit = 0) {
const r = this._tokenize(lineText, prevState, true, timeLimit);
return {
tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),
ruleStack: r.ruleStack,
stoppedEarly: r.stoppedEarly
};
}
_tokenize(lineText, prevState, emitBinaryTokens, timeLimit) {
if (this._rootId === -1) {
this._rootId = RuleFactory.getCompiledRuleId(
this._grammar.repository.$self,
this,
this._grammar.repository
);
this.getInjections();
}
let isFirstLine;
if (!prevState || prevState === StateStackImpl.NULL) {
isFirstLine = true;
const rawDefaultMetadata = this._basicScopeAttributesProvider.getDefaultAttributes();
const defaultStyle = this.themeProvider.getDefaults();
const defaultMetadata = EncodedTokenMetadata.set(
0,
rawDefaultMetadata.languageId,
rawDefaultMetadata.tokenType,
null,
defaultStyle.fontStyle,
defaultStyle.foregroundId,
defaultStyle.backgroundId
);
const rootScopeName = this.getRule(this._rootId).getName(
null,
null
);
let scopeList;
if (rootScopeName) {
scopeList = AttributedScopeStack.createRootAndLookUpScopeName(
rootScopeName,
defaultMetadata,
this
);
} else {
scopeList = AttributedScopeStack.createRoot(
"unknown",
defaultMetadata
);
}
prevState = new StateStackImpl(
null,
this._rootId,
-1,
-1,
false,
null,
scopeList,
scopeList
);
} else {
isFirstLine = false;
prevState.reset();
}
lineText = lineText + "\n";
const onigLineText = this.createOnigString(lineText);
const lineLength = onigLineText.content.length;
const lineTokens = new LineTokens(
emitBinaryTokens,
lineText,
this._tokenTypeMatchers,
this.balancedBracketSelectors
);
const r = _tokenizeString(
this,
onigLineText,
isFirstLine,
0,
prevState,
lineTokens,
true,
timeLimit
);
disposeOnigString(onigLineText);
return {
lineLength,
lineTokens,
ruleStack: r.stack,
stoppedEarly: r.stoppedEarly
};
}
};
function initGrammar(grammar, base2) {
grammar = clone(grammar);
grammar.repository = grammar.repository || {};
grammar.repository.$self = {
$vscodeTextmateLocation: grammar.$vscodeTextmateLocation,
patterns: grammar.patterns,
name: grammar.scopeName
};
grammar.repository.$base = base2 || grammar.repository.$self;
return grammar;
}
var AttributedScopeStack = class _AttributedScopeStack {
/**
* Invariant:
* ```
* if (parent && !scopePath.extends(parent.scopePath)) {
* throw new Error();
* }
* ```
*/
constructor(parent, scopePath, tokenAttributes) {
this.parent = parent;
this.scopePath = scopePath;
this.tokenAttributes = tokenAttributes;
}
static fromExtension(namesScopeList, contentNameScopesList) {
let current = namesScopeList;
let scopeNames = (namesScopeList == null ? void 0 : namesScopeList.scopePath) ?? null;
for (const frame of contentNameScopesList) {
scopeNames = ScopeStack.push(scopeNames, frame.scopeNames);
current = new _AttributedScopeStack(current, scopeNames, frame.encodedTokenAttributes);
}
return current;
}
static createRoot(scopeName, tokenAttributes) {
return new _AttributedScopeStack(null, new ScopeStack(null, scopeName), tokenAttributes);
}
static createRootAndLookUpScopeName(scopeName, tokenAttributes, grammar) {
const rawRootMetadata = grammar.getMetadataForScope(scopeName);
const scopePath = new ScopeStack(null, scopeName);
const rootStyle = grammar.themeProvider.themeMatch(scopePath);
const resolvedTokenAttributes = _AttributedScopeStack.mergeAttributes(
tokenAttributes,
rawRootMetadata,
rootStyle
);
return new _AttributedScopeStack(null, scopePath, resolvedTokenAttributes);
}
get scopeName() {
return this.scopePath.scopeName;
}
toString() {
return this.getScopeNames().join(" ");
}
equals(other) {
return _AttributedScopeStack.equals(this, other);
}
static equals(a, b) {
do {
if (a === b) {
return true;
}
if (!a && !b) {
return true;
}
if (!a || !b) {
return false;
}
if (a.scopeName !== b.scopeName || a.tokenAttributes !== b.tokenAttributes) {
return false;
}
a = a.parent;
b = b.parent;
} while (true);
}
static mergeAttributes(existingTokenAttributes, basicScopeAttributes, styleAttributes) {
let fontStyle = -1;
let foreground = 0;
let background = 0;
if (styleAttributes !== null) {
fontStyle = styleAttributes.fontStyle;
foreground = styleAttributes.foregroundId;
background = styleAttributes.backgroundId;
}
return EncodedTokenMetadata.set(
existingTokenAttributes,
basicScopeAttributes.languageId,
basicScopeAttributes.tokenType,
null,
fontStyle,
foreground,
background
);
}
pushAttributed(scopePath, grammar) {
if (scopePath === null) {
return this;
}
if (scopePath.indexOf(" ") === -1) {
return _AttributedScopeStack._pushAttributed(this, scopePath, grammar);
}
const scopes = scopePath.split(/ /g);
let result = this;
for (const scope of scopes) {
result = _AttributedScopeStack._pushAttributed(result, scope, grammar);
}
return result;
}
static _pushAttributed(target, scopeName, grammar) {
const rawMetadata = grammar.getMetadataForScope(scopeName);
const newPath = target.scopePath.push(scopeName);
const scopeThemeMatchResult = grammar.themeProvider.themeMatch(newPath);
const metadata = _AttributedScopeStack.mergeAttributes(
target.tokenAttributes,
rawMetadata,
scopeThemeMatchResult
);
return new _AttributedScopeStack(target, newPath, metadata);
}
getScopeNames() {
return this.scopePath.getSegments();
}
getExtensionIfDefined(base2) {
var _a22;
const result = [];
let self2 = this;
while (self2 && self2 !== base2) {
result.push({
encodedTokenAttributes: self2.tokenAttributes,
scopeNames: self2.scopePath.getExtensionIfDefined(((_a22 = self2.parent) == null ? void 0 : _a22.scopePath) ?? null)
});
self2 = self2.parent;
}
return self2 === base2 ? result.reverse() : void 0;
}
};
var StateStackImpl = (_b = class {
/**
* Invariant:
* ```
* if (contentNameScopesList !== nameScopesList && contentNameScopesList?.parent !== nameScopesList) {
* throw new Error();
* }
* if (this.parent && !nameScopesList.extends(this.parent.contentNameScopesList)) {
* throw new Error();
* }
* ```
*/
constructor(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
__publicField2(this, "_stackElementBrand");
__publicField2(this, "_enterPos");
__publicField2(this, "_anchorPos");
__publicField2(this, "depth");
this.parent = parent;
this.ruleId = ruleId;
this.beginRuleCapturedEOL = beginRuleCapturedEOL;
this.endRule = endRule;
this.nameScopesList = nameScopesList;
this.contentNameScopesList = contentNameScopesList;
this.depth = this.parent ? this.parent.depth + 1 : 1;
this._enterPos = enterPos;
this._anchorPos = anchorPos;
}
equals(other) {
if (other === null) {
return false;
}
return _b._equals(this, other);
}
static _equals(a, b) {
if (a === b) {
return true;
}
if (!this._structuralEquals(a, b)) {
return false;
}
return AttributedScopeStack.equals(a.contentNameScopesList, b.contentNameScopesList);
}
/**
* A structural equals check. Does not take into account `scopes`.
*/
static _structuralEquals(a, b) {
do {
if (a === b) {
return true;
}
if (!a && !b) {
return true;
}
if (!a || !b) {
return false;
}
if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) {
return false;
}
a = a.parent;
b = b.parent;
} while (true);
}
clone() {
return this;
}
static _reset(el) {
while (el) {
el._enterPos = -1;
el._anchorPos = -1;
el = el.parent;
}
}
reset() {
_b._reset(this);
}
pop() {
return this.parent;
}
safePop() {
if (this.parent) {
return this.parent;
}
return this;
}
push(ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
return new _b(
this,
ruleId,
enterPos,
anchorPos,
beginRuleCapturedEOL,
endRule,
nameScopesList,
contentNameScopesList
);
}
getEnterPos() {
return this._enterPos;
}
getAnchorPos() {
return this._anchorPos;
}
getRule(grammar) {
return grammar.getRule(this.ruleId);
}
toString() {
const r = [];
this._writeString(r, 0);
return "[" + r.join(",") + "]";
}
_writeString(res, outIndex) {
var _a22, _b2;
if (this.parent) {
outIndex = this.parent._writeString(res, outIndex);
}
res[outIndex++] = `(${this.ruleId}, ${(_a22 = this.nameScopesList) == null ? void 0 : _a22.toString()}, ${(_b2 = this.contentNameScopesList) == null ? void 0 : _b2.toString()})`;
return outIndex;
}
withContentNameScopesList(contentNameScopeStack) {
if (this.contentNameScopesList === contentNameScopeStack) {
return this;
}
return this.parent.push(
this.ruleId,
this._enterPos,
this._anchorPos,
this.beginRuleCapturedEOL,
this.endRule,
this.nameScopesList,
contentNameScopeStack
);
}
withEndRule(endRule) {
if (this.endRule === endRule) {
return this;
}
return new _b(
this.parent,
this.ruleId,
this._enterPos,
this._anchorPos,
this.beginRuleCapturedEOL,
endRule,
this.nameScopesList,
this.contentNameScopesList
);
}
// Used to warn of endless loops
hasSameRuleAs(other) {
let el = this;
while (el && el._enterPos === other._enterPos) {
if (el.ruleId === other.ruleId) {
return true;
}
el = el.parent;
}
return false;
}
toStateStackFrame() {
var _a22, _b2, _c;
return {
ruleId: ruleIdToNumber(this.ruleId),
beginRuleCapturedEOL: this.beginRuleCapturedEOL,
endRule: this.endRule,
nameScopesList: ((_b2 = this.nameScopesList) == null ? void 0 : _b2.getExtensionIfDefined(((_a22 = this.parent) == null ? void 0 : _a22.nameScopesList) ?? null)) ?? [],
contentNameScopesList: ((_c = this.contentNameScopesList) == null ? void 0 : _c.getExtensionIfDefined(this.nameScopesList)) ?? []
};
}
static pushFrame(self2, frame) {
const namesScopeList = AttributedScopeStack.fromExtension((self2 == null ? void 0 : self2.nameScopesList) ?? null, frame.nameScopesList);
return new _b(
self2,
ruleIdFromNumber(frame.ruleId),
frame.enterPos ?? -1,
frame.anchorPos ?? -1,
frame.beginRuleCapturedEOL,
frame.endRule,
namesScopeList,
AttributedScopeStack.fromExtension(namesScopeList, frame.contentNameScopesList)
);
}
}, // TODO remove me
__publicField2(_b, "NULL", new _b(
null,
0,
0,
0,
false,
null,
null,
null
)), _b);
var BalancedBracketSelectors = class {
constructor(balancedBracketScopes, unbalancedBracketScopes) {
__publicField2(this, "balancedBracketScopes");
__publicField2(this, "unbalancedBracketScopes");
__publicField2(this, "allowAny", false);
this.balancedBracketScopes = balancedBracketScopes.flatMap(
(selector) => {
if (selector === "*") {
this.allowAny = true;
return [];
}
return createMatchers(selector, nameMatcher).map((m) => m.matcher);
}
);
this.unbalancedBracketScopes = unbalancedBracketScopes.flatMap(
(selector) => createMatchers(selector, nameMatcher).map((m) => m.matcher)
);
}
get matchesAlways() {
return this.allowAny && this.unbalancedBracketScopes.length === 0;
}
get matchesNever() {
return this.balancedBracketScopes.length === 0 && !this.allowAny;
}
match(scopes) {
for (const excluder of this.unbalancedBracketScopes) {
if (excluder(scopes)) {
return false;
}
}
for (const includer of this.balancedBracketScopes) {
if (includer(scopes)) {
return true;
}
}
return this.allowAny;
}
};
var LineTokens = class {
constructor(emitBinaryTokens, lineText, tokenTypeOverrides, balancedBracketSelectors) {
__publicField2(this, "_emitBinaryTokens");
__publicField2(this, "_lineText");
__publicField2(this, "_tokens");
__publicField2(this, "_binaryTokens");
__publicField2(this, "_lastTokenEndIndex");
__publicField2(this, "_tokenTypeOverrides");
this.balancedBracketSelectors = balancedBracketSelectors;
this._emitBinaryTokens = emitBinaryTokens;
this._tokenTypeOverrides = tokenTypeOverrides;
{
this._lineText = null;
}
this._tokens = [];
this._binaryTokens = [];
this._lastTokenEndIndex = 0;
}
produce(stack, endIndex) {
this.produceFromScopes(stack.contentNameScopesList, endIndex);
}
produceFromScopes(scopesList, endIndex) {
var _a22;
if (this._lastTokenEndIndex >= endIndex) {
return;
}
if (this._emitBinaryTokens) {
let metadata = (scopesList == null ? void 0 : scopesList.tokenAttributes) ?? 0;
let containsBalancedBrackets = false;
if ((_a22 = this.balancedBracketSelectors) == null ? void 0 : _a22.matchesAlways) {
containsBalancedBrackets = true;
}
if (this._tokenTypeOverrides.length > 0 || this.balancedBracketSelectors && !this.balancedBracketSelectors.matchesAlways && !this.balancedBracketSelectors.matchesNever) {
const scopes2 = (scopesList == null ? void 0 : scopesList.getScopeNames()) ?? [];
for (const tokenType of this._tokenTypeOverrides) {
if (tokenType.matcher(scopes2)) {
metadata = EncodedTokenMetadata.set(
metadata,
0,
toOptionalTokenType(tokenType.type),
null,
-1,
0,
0
);
}
}
if (this.balancedBracketSelectors) {
containsBalancedBrackets = this.balancedBracketSelectors.match(scopes2);
}
}
if (containsBalancedBrackets) {
metadata = EncodedTokenMetadata.set(
metadata,
0,
8,
containsBalancedBrackets,
-1,
0,
0
);
}
if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === metadata) {
this._lastTokenEndIndex = endIndex;
return;
}
this._binaryTokens.push(this._lastTokenEndIndex);
this._binaryTokens.push(metadata);
this._lastTokenEndIndex = endIndex;
return;
}
const scopes = (scopesList == null ? void 0 : scopesList.getScopeNames()) ?? [];
this._tokens.push({
startIndex: this._lastTokenEndIndex,
endIndex,
// value: lineText.substring(lastTokenEndIndex, endIndex),
scopes
});
this._lastTokenEndIndex = endIndex;
}
getResult(stack, lineLength) {
if (this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === lineLength - 1) {
this._tokens.pop();
}
if (this._tokens.length === 0) {
this._lastTokenEndIndex = -1;
this.produce(stack, lineLength);
this._tokens[this._tokens.length - 1].startIndex = 0;
}
return this._tokens;
}
getBinaryResult(stack, lineLength) {
if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === lineLength - 1) {
this._binaryTokens.pop();
this._binaryTokens.pop();
}
if (this._binaryTokens.length === 0) {
this._lastTokenEndIndex = -1;
this.produce(stack, lineLength);
this._binaryTokens[this._binaryTokens.length - 2] = 0;
}
const result = new Uint32Array(this._binaryTokens.length);
for (let i = 0, len = this._binaryTokens.length; i < len; i++) {
result[i] = this._binaryTokens[i];
}
return result;
}
};
var SyncRegistry = class {
constructor(theme, _onigLib) {
__publicField2(this, "_grammars", /* @__PURE__ */ new Map());
__publicField2(this, "_rawGrammars", /* @__PURE__ */ new Map());
__publicField2(this, "_injectionGrammars", /* @__PURE__ */ new Map());
__publicField2(this, "_theme");
this._onigLib = _onigLib;
this._theme = theme;
}
dispose() {
for (const grammar of this._grammars.values()) {
grammar.dispose();
}
}
setTheme(theme) {
this._theme = theme;
}
getColorMap() {
return this._theme.getColorMap();
}
/**
* Add `grammar` to registry and return a list of referenced scope names
*/
addGrammar(grammar, injectionScopeNames) {
this._rawGrammars.set(grammar.scopeName, grammar);
if (injectionScopeNames) {
this._injectionGrammars.set(grammar.scopeName, injectionScopeNames);
}
}
/**
* Lookup a raw grammar.
*/
lookup(scopeName) {
return this._rawGrammars.get(scopeName);
}
/**
* Returns the injections for the given grammar
*/
injections(targetScope) {
return this._injectionGrammars.get(targetScope);
}
/**
* Get the default theme settings
*/
getDefaults() {
return this._theme.getDefaults();
}
/**
* Match a scope in the theme.
*/
themeMatch(scopePath) {
return this._theme.match(scopePath);
}
/**
* Lookup a grammar.
*/
grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
if (!this._grammars.has(scopeName)) {
let rawGrammar = this._rawGrammars.get(scopeName);
if (!rawGrammar) {
return null;
}
this._grammars.set(scopeName, createGrammar(
scopeName,
rawGrammar,
initialLanguage,
embeddedLanguages,
tokenTypes,
balancedBracketSelectors,
this,
this._onigLib
));
}
return this._grammars.get(scopeName);
}
};
var Registry$1 = class Registry {
constructor(options) {
__publicField2(this, "_options");
__publicField2(this, "_syncRegistry");
__publicField2(this, "_ensureGrammarCache");
this._options = options;
this._syncRegistry = new SyncRegistry(
Theme.createFromRawTheme(options.theme, options.colorMap),
options.onigLib
);
this._ensureGrammarCache = /* @__PURE__ */ new Map();
}
dispose() {
this._syncRegistry.dispose();
}
/**
* Change the theme. Once called, no previous `ruleStack` should be used anymore.
*/
setTheme(theme, colorMap2) {
this._syncRegistry.setTheme(Theme.createFromRawTheme(theme, colorMap2));
}
/**
* Returns a lookup array for color ids.
*/
getColorMap() {
return this._syncRegistry.getColorMap();
}
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
* Please do not use language id 0.
*/
loadGrammarWithEmbeddedLanguages(initialScopeName, initialLanguage, embeddedLanguages) {
return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages });
}
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
* Please do not use language id 0.
*/
loadGrammarWithConfiguration(initialScopeName, initialLanguage, configuration) {
return this._loadGrammar(
initialScopeName,
initialLanguage,
configuration.embeddedLanguages,
configuration.tokenTypes,
new BalancedBracketSelectors(
configuration.balancedBracketSelectors || [],
configuration.unbalancedBracketSelectors || []
)
);
}
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
*/
loadGrammar(initialScopeName) {
return this._loadGrammar(initialScopeName, 0, null, null, null);
}
_loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
const dependencyProcessor = new ScopeDependencyProcessor(this._syncRegistry, initialScopeName);
while (dependencyProcessor.Q.length > 0) {
dependencyProcessor.Q.map((request) => this._loadSingleGrammar(request.scopeName));
dependencyProcessor.processQueue();
}
return this._grammarForScopeName(
initialScopeName,
initialLanguage,
embeddedLanguages,
tokenTypes,
balancedBracketSelectors
);
}
_loadSingleGrammar(scopeName) {
if (!this._ensureGrammarCache.has(scopeName)) {
this._doLoadSingleGrammar(scopeName);
this._ensureGrammarCache.set(scopeName, true);
}
}
_doLoadSingleGrammar(scopeName) {
const grammar = this._options.loadGrammar(scopeName);
if (grammar) {
const injections = typeof this._options.getInjections === "function" ? this._options.getInjections(scopeName) : void 0;
this._syncRegistry.addGrammar(grammar, injections);
}
}
/**
* Adds a rawGrammar.
*/
addGrammar(rawGrammar, injections = [], initialLanguage = 0, embeddedLanguages = null) {
this._syncRegistry.addGrammar(rawGrammar, injections);
return this._grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages);
}
/**
* Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
*/
_grammarForScopeName(scopeName, initialLanguage = 0, embeddedLanguages = null, tokenTypes = null, balancedBracketSelectors = null) {
return this._syncRegistry.grammarForScopeName(
scopeName,
initialLanguage,
embeddedLanguages,
tokenTypes,
balancedBracketSelectors
);
}
};
var INITIAL = StateStackImpl.NULL;
var defaultSubsetRegex = /["&'<>`]/g;
var surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
var controlCharactersRegex = (
// eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g
);
var regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g;
var subsetToRegexCache = /* @__PURE__ */ new WeakMap();
function core(value, options) {
value = value.replace(
options.subset ? charactersToExpressionCached(options.subset) : defaultSubsetRegex,
basic
);
if (options.subset || options.escapeOnly) {
return value;
}
return value.replace(surrogatePairsRegex, surrogate).replace(controlCharactersRegex, basic);
function surrogate(pair, index, all2) {
return options.format(
(pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536,
all2.charCodeAt(index + 2),
options
);
}
function basic(character, index, all2) {
return options.format(
character.charCodeAt(0),
all2.charCodeAt(index + 1),
options
);
}
}
function charactersToExpressionCached(subset) {
let cached = subsetToRegexCache.get(subset);
if (!cached) {
cached = charactersToExpression(subset);
subsetToRegexCache.set(subset, cached);
}
return cached;
}
function charactersToExpression(subset) {
const groups = [];
let index = -1;
while (++index < subset.length) {
groups.push(subset[index].replace(regexEscapeRegex, "\\$&"));
}
return new RegExp("(?:" + groups.join("|") + ")", "g");
}
var hexadecimalRegex = /[\dA-Fa-f]/;
function toHexadecimal(code3, next, omit) {
const value = "" + code3.toString(16).toUpperCase();
return omit && next && !hexadecimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
}
var decimalRegex = /\d/;
function toDecimal(code3, next, omit) {
const value = "" + String(code3);
return omit && next && !decimalRegex.test(String.fromCharCode(next)) ? value : value + ";";
}
var characterEntitiesLegacy = [
"AElig",
"AMP",
"Aacute",
"Acirc",
"Agrave",
"Aring",
"Atilde",
"Auml",
"COPY",
"Ccedil",
"ETH",
"Eacute",
"Ecirc",
"Egrave",
"Euml",
"GT",
"Iacute",
"Icirc",
"Igrave",
"Iuml",
"LT",
"Ntilde",
"Oacute",
"Ocirc",
"Ograve",
"Oslash",
"Otilde",
"Ouml",
"QUOT",
"REG",
"THORN",
"Uacute",
"Ucirc",
"Ugrave",
"Uuml",
"Yacute",
"aacute",
"acirc",
"acute",
"aelig",
"agrave",
"amp",
"aring",
"atilde",
"auml",
"brvbar",
"ccedil",
"cedil",
"cent",
"copy",
"curren",
"deg",
"divide",
"eacute",
"ecirc",
"egrave",
"eth",
"euml",
"frac12",
"frac14",
"frac34",
"gt",
"iacute",
"icirc",
"iexcl",
"igrave",
"iquest",
"iuml",
"laquo",
"lt",
"macr",
"micro",
"middot",
"nbsp",
"not",
"ntilde",
"oacute",
"ocirc",
"ograve",
"ordf",
"ordm",
"oslash",
"otilde",
"ouml",
"para",
"plusmn",
"pound",
"quot",
"raquo",
"reg",
"sect",
"shy",
"sup1",
"sup2",
"sup3",
"szlig",
"thorn",
"times",
"uacute",
"ucirc",
"ugrave",
"uml",
"uuml",
"yacute",
"yen",
"yuml"
];
var characterEntitiesHtml4 = {
nbsp: " ",
iexcl: "¡",
cent: "¢",
pound: "£",
curren: "¤",
yen: "¥",
brvbar: "¦",
sect: "§",
uml: "¨",
copy: "©",
ordf: "ª",
laquo: "«",
not: "¬",
shy: "",
reg: "®",
macr: "¯",
deg: "°",
plusmn: "±",
sup2: "²",
sup3: "³",
acute: "´",
micro: "µ",
para: "¶",
middot: "·",
cedil: "¸",
sup1: "¹",
ordm: "º",
raquo: "»",
frac14: "¼",
frac12: "½",
frac34: "¾",
iquest: "¿",
Agrave: "À",
Aacute: "Á",
Acirc: "Â",
Atilde: "Ã",
Auml: "Ä",
Aring: "Å",
AElig: "Æ",
Ccedil: "Ç",
Egrave: "È",
Eacute: "É",
Ecirc: "Ê",
Euml: "Ë",
Igrave: "Ì",
Iacute: "Í",
Icirc: "Î",
Iuml: "Ï",
ETH: "Ð",
Ntilde: "Ñ",
Ograve: "Ò",
Oacute: "Ó",
Ocirc: "Ô",
Otilde: "Õ",
Ouml: "Ö",
times: "×",
Oslash: "Ø",
Ugrave: "Ù",
Uacute: "Ú",
Ucirc: "Û",
Uuml: "Ü",
Yacute: "Ý",
THORN: "Þ",
szlig: "ß",
agrave: "à",
aacute: "á",
acirc: "â",
atilde: "ã",
auml: "ä",
aring: "å",
aelig: "æ",
ccedil: "ç",
egrave: "è",
eacute: "é",
ecirc: "ê",
euml: "ë",
igrave: "ì",
iacute: "í",
icirc: "î",
iuml: "ï",
eth: "ð",
ntilde: "ñ",
ograve: "ò",
oacute: "ó",
ocirc: "ô",
otilde: "õ",
ouml: "ö",
divide: "÷",
oslash: "ø",
ugrave: "ù",
uacute: "ú",
ucirc: "û",
uuml: "ü",
yacute: "ý",
thorn: "þ",
yuml: "ÿ",
fnof: "ƒ",
Alpha: "Α",
Beta: "Β",
Gamma: "Γ",
Delta: "Δ",
Epsilon: "Ε",
Zeta: "Ζ",
Eta: "Η",
Theta: "Θ",
Iota: "Ι",
Kappa: "Κ",
Lambda: "Λ",
Mu: "Μ",
Nu: "Ν",
Xi: "Ξ",
Omicron: "Ο",
Pi: "Π",
Rho: "Ρ",
Sigma: "Σ",
Tau: "Τ",
Upsilon: "Υ",
Phi: "Φ",
Chi: "Χ",
Psi: "Ψ",
Omega: "Ω",
alpha: "α",
beta: "β",
gamma: "γ",
delta: "δ",
epsilon: "ε",
zeta: "ζ",
eta: "η",
theta: "θ",
iota: "ι",
kappa: "κ",
lambda: "λ",
mu: "μ",
nu: "ν",
xi: "ξ",
omicron: "ο",
pi: "π",
rho: "ρ",
sigmaf: "ς",
sigma: "σ",
tau: "τ",
upsilon: "υ",
phi: "φ",
chi: "χ",
psi: "ψ",
omega: "ω",
thetasym: "ϑ",
upsih: "ϒ",
piv: "ϖ",
bull: "•",
hellip: "…",
prime: "′",
Prime: "″",
oline: "‾",
frasl: "⁄",
weierp: "℘",
image: "ℑ",
real: "ℜ",
trade: "™",
alefsym: "ℵ",
larr: "←",
uarr: "↑",
rarr: "→",
darr: "↓",
harr: "↔",
crarr: "↵",
lArr: "⇐",
uArr: "⇑",
rArr: "⇒",
dArr: "⇓",
hArr: "⇔",
forall: "∀",
part: "∂",
exist: "∃",
empty: "∅",
nabla: "∇",
isin: "∈",
notin: "∉",
ni: "∋",
prod: "∏",
sum: "∑",
minus: "−",
lowast: "∗",
radic: "√",
prop: "∝",
infin: "∞",
ang: "∠",
and: "∧",
or: "∨",
cap: "∩",
cup: "∪",
int: "∫",
there4: "∴",
sim: "∼",
cong: "≅",
asymp: "≈",
ne: "≠",
equiv: "≡",
le: "≤",
ge: "≥",
sub: "⊂",
sup: "⊃",
nsub: "⊄",
sube: "⊆",
supe: "⊇",
oplus: "⊕",
otimes: "⊗",
perp: "⊥",
sdot: "⋅",
lceil: "⌈",
rceil: "⌉",
lfloor: "⌊",
rfloor: "⌋",
lang: "〈",
rang: "〉",
loz: "◊",
spades: "♠",
clubs: "♣",
hearts: "♥",
diams: "♦",
quot: '"',
amp: "&",
lt: "<",
gt: ">",
OElig: "Œ",
oelig: "œ",
Scaron: "Š",
scaron: "š",
Yuml: "Ÿ",
circ: "ˆ",
tilde: "˜",
ensp: " ",
emsp: " ",
thinsp: " ",
zwnj: "",
zwj: "",
lrm: "",
rlm: "",
ndash: "–",
mdash: "—",
lsquo: "‘",
rsquo: "’",
sbquo: "‚",
ldquo: "“",
rdquo: "”",
bdquo: "„",
dagger: "†",
Dagger: "‡",
permil: "‰",
lsaquo: "‹",
rsaquo: "›",
euro: "€"
};
var dangerous = [
"cent",
"copy",
"divide",
"gt",
"lt",
"not",
"para",
"times"
];
var own$1 = {}.hasOwnProperty;
var characters = {};
var key;
for (key in characterEntitiesHtml4) {
if (own$1.call(characterEntitiesHtml4, key)) {
characters[characterEntitiesHtml4[key]] = key;
}
}
var notAlphanumericRegex = /[^\dA-Za-z]/;
function toNamed(code3, next, omit, attribute2) {
const character = String.fromCharCode(code3);
if (own$1.call(characters, character)) {
const name = characters[character];
const value = "&" + name;
if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute2 || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
return value;
}
return value + ";";
}
return "";
}
function formatSmart(code3, next, options) {
let numeric = toHexadecimal(code3, next, options.omitOptionalSemicolons);
let named;
if (options.useNamedReferences || options.useShortestReferences) {
named = toNamed(
code3,
next,
options.omitOptionalSemicolons,
options.attribute
);
}
if ((options.useShortestReferences || !named) && options.useShortestReferences) {
const decimal = toDecimal(code3, next, options.omitOptionalSemicolons);
if (decimal.length < numeric.length) {
numeric = decimal;
}
}
return named && (!options.useShortestReferences || named.length < numeric.length) ? named : numeric;
}
function stringifyEntities(value, options) {
return core(value, Object.assign({ format: formatSmart }, options));
}
var htmlCommentRegex = /^>|^->||--!>|"];
var commentEntitySubset = ["<", ">"];
function comment2(node, _1, _2, state) {
return state.settings.bogusComments ? "" + stringifyEntities(
node.value,
Object.assign({}, state.settings.characterReferences, {
subset: bogusCommentEntitySubset
})
) + ">" : "";
function encode2($0) {
return stringifyEntities(
$0,
Object.assign({}, state.settings.characterReferences, {
subset: commentEntitySubset
})
);
}
}
function doctype(_1, _2, _3, state) {
return "";
}
var re = /[ \t\n\f\r]/g;
function whitespace(thing) {
return typeof thing === "object" ? thing.type === "text" ? empty(thing.value) : false : empty(thing);
}
function empty(value) {
return value.replace(re, "") === "";
}
var siblingAfter = siblings(1);
var siblingBefore = siblings(-1);
var emptyChildren$1 = [];
function siblings(increment) {
return sibling;
function sibling(parent, index, includeWhitespace) {
const siblings2 = parent ? parent.children : emptyChildren$1;
let offset = (index || 0) + increment;
let next = siblings2[offset];
if (!includeWhitespace) {
while (next && whitespace(next)) {
offset += increment;
next = siblings2[offset];
}
}
return next;
}
}
var own = {}.hasOwnProperty;
function omission(handlers) {
return omit;
function omit(node, index, parent) {
return own.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
}
}
var closing = omission({
body: body$1,
caption: headOrColgroupOrCaption,
colgroup: headOrColgroupOrCaption,
dd,
dt: dt2,
head: headOrColgroupOrCaption,
html: html$1,
li,
optgroup,
option,
p,
rp: rubyElement,
rt: rubyElement,
tbody: tbody$1,
td: cells,
tfoot,
th: cells,
thead,
tr
});
function headOrColgroupOrCaption(_, index, parent) {
const next = siblingAfter(parent, index, true);
return !next || next.type !== "comment" && !(next.type === "text" && whitespace(next.value.charAt(0)));
}
function html$1(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type !== "comment";
}
function body$1(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type !== "comment";
}
function p(_, index, parent) {
const next = siblingAfter(parent, index);
return next ? next.type === "element" && (next.tagName === "address" || next.tagName === "article" || next.tagName === "aside" || next.tagName === "blockquote" || next.tagName === "details" || next.tagName === "div" || next.tagName === "dl" || next.tagName === "fieldset" || next.tagName === "figcaption" || next.tagName === "figure" || next.tagName === "footer" || next.tagName === "form" || next.tagName === "h1" || next.tagName === "h2" || next.tagName === "h3" || next.tagName === "h4" || next.tagName === "h5" || next.tagName === "h6" || next.tagName === "header" || next.tagName === "hgroup" || next.tagName === "hr" || next.tagName === "main" || next.tagName === "menu" || next.tagName === "nav" || next.tagName === "ol" || next.tagName === "p" || next.tagName === "pre" || next.tagName === "section" || next.tagName === "table" || next.tagName === "ul") : !parent || // Confusing parent.
!(parent.type === "element" && (parent.tagName === "a" || parent.tagName === "audio" || parent.tagName === "del" || parent.tagName === "ins" || parent.tagName === "map" || parent.tagName === "noscript" || parent.tagName === "video"));
}
function li(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && next.tagName === "li";
}
function dt2(_, index, parent) {
const next = siblingAfter(parent, index);
return Boolean(
next && next.type === "element" && (next.tagName === "dt" || next.tagName === "dd")
);
}
function dd(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && (next.tagName === "dt" || next.tagName === "dd");
}
function rubyElement(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && (next.tagName === "rp" || next.tagName === "rt");
}
function optgroup(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && next.tagName === "optgroup";
}
function option(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && (next.tagName === "option" || next.tagName === "optgroup");
}
function thead(_, index, parent) {
const next = siblingAfter(parent, index);
return Boolean(
next && next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot")
);
}
function tbody$1(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && (next.tagName === "tbody" || next.tagName === "tfoot");
}
function tfoot(_, index, parent) {
return !siblingAfter(parent, index);
}
function tr(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && next.tagName === "tr";
}
function cells(_, index, parent) {
const next = siblingAfter(parent, index);
return !next || next.type === "element" && (next.tagName === "td" || next.tagName === "th");
}
var opening = omission({
body,
colgroup,
head,
html: html2,
tbody
});
function html2(node) {
const head2 = siblingAfter(node, -1);
return !head2 || head2.type !== "comment";
}
function head(node) {
const seen = /* @__PURE__ */ new Set();
for (const child2 of node.children) {
if (child2.type === "element" && (child2.tagName === "base" || child2.tagName === "title")) {
if (seen.has(child2.tagName)) return false;
seen.add(child2.tagName);
}
}
const child = node.children[0];
return !child || child.type === "element";
}
function body(node) {
const head2 = siblingAfter(node, -1, true);
return !head2 || head2.type !== "comment" && !(head2.type === "text" && whitespace(head2.value.charAt(0))) && !(head2.type === "element" && (head2.tagName === "meta" || head2.tagName === "link" || head2.tagName === "script" || head2.tagName === "style" || head2.tagName === "template"));
}
function colgroup(node, index, parent) {
const previous = siblingBefore(parent, index);
const head2 = siblingAfter(node, -1, true);
if (parent && previous && previous.type === "element" && previous.tagName === "colgroup" && closing(previous, parent.children.indexOf(previous), parent)) {
return false;
}
return Boolean(head2 && head2.type === "element" && head2.tagName === "col");
}
function tbody(node, index, parent) {
const previous = siblingBefore(parent, index);
const head2 = siblingAfter(node, -1);
if (parent && previous && previous.type === "element" && (previous.tagName === "thead" || previous.tagName === "tbody") && closing(previous, parent.children.indexOf(previous), parent)) {
return false;
}
return Boolean(head2 && head2.type === "element" && head2.tagName === "tr");
}
var constants = {
// See: .
name: [
[" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")],
[`\0
\f\r "&'/<=>`.split(""), "\0 \n\f\r \"&'/<=>`".split("")]
],
// See: .
unquoted: [
[" \n\f\r &>".split(""), "\0 \n\f\r \"&'<=>`".split("")],
["\0 \n\f\r \"&'<=>`".split(""), "\0 \n\f\r \"&'<=>`".split("")]
],
// See: .
single: [
["&'".split(""), "\"&'`".split("")],
["\0&'".split(""), "\0\"&'`".split("")]
],
// See: .
double: [
['"&'.split(""), "\"&'`".split("")],
['\0"&'.split(""), "\0\"&'`".split("")]
]
};
function element(node, index, parent, state) {
const schema = state.schema;
const omit = schema.space === "svg" ? false : state.settings.omitOptionalTags;
let selfClosing = schema.space === "svg" ? state.settings.closeEmptyElements : state.settings.voids.includes(node.tagName.toLowerCase());
const parts = [];
let last;
if (schema.space === "html" && node.tagName === "svg") {
state.schema = svg;
}
const attributes = serializeAttributes(state, node.properties);
const content = state.all(
schema.space === "html" && node.tagName === "template" ? node.content : node
);
state.schema = schema;
if (content) selfClosing = false;
if (attributes || !omit || !opening(node, index, parent)) {
parts.push("<", node.tagName, attributes ? " " + attributes : "");
if (selfClosing && (schema.space === "svg" || state.settings.closeSelfClosing)) {
last = attributes.charAt(attributes.length - 1);
if (!state.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
parts.push(" ");
}
parts.push("/");
}
parts.push(">");
}
parts.push(content);
if (!selfClosing && (!omit || !closing(node, index, parent))) {
parts.push("" + node.tagName + ">");
}
return parts.join("");
}
function serializeAttributes(state, properties) {
const values = [];
let index = -1;
let key2;
if (properties) {
for (key2 in properties) {
if (properties[key2] !== null && properties[key2] !== void 0) {
const value = serializeAttribute(state, key2, properties[key2]);
if (value) values.push(value);
}
}
}
while (++index < values.length) {
const last = state.settings.tightAttributes ? values[index].charAt(values[index].length - 1) : void 0;
if (index !== values.length - 1 && last !== '"' && last !== "'") {
values[index] += " ";
}
}
return values.join("");
}
function serializeAttribute(state, key2, value) {
const info = find(state.schema, key2);
const x = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
const y = state.settings.allowDangerousCharacters ? 0 : 1;
let quote = state.quote;
let result;
if (info.overloadedBoolean && (value === info.attribute || value === "")) {
value = true;
} else if ((info.boolean || info.overloadedBoolean) && (typeof value !== "string" || value === info.attribute || value === "")) {
value = Boolean(value);
}
if (value === null || value === void 0 || value === false || typeof value === "number" && Number.isNaN(value)) {
return "";
}
const name = stringifyEntities(
info.attribute,
Object.assign({}, state.settings.characterReferences, {
// Always encode without parse errors in non-HTML.
subset: constants.name[x][y]
})
);
if (value === true) return name;
value = Array.isArray(value) ? (info.commaSeparated ? stringify$1 : stringify)(value, {
padLeft: !state.settings.tightCommaSeparatedLists
}) : String(value);
if (state.settings.collapseEmptyAttributes && !value) return name;
if (state.settings.preferUnquoted) {
result = stringifyEntities(
value,
Object.assign({}, state.settings.characterReferences, {
attribute: true,
subset: constants.unquoted[x][y]
})
);
}
if (result !== value) {
if (state.settings.quoteSmart && ccount(value, quote) > ccount(value, state.alternative)) {
quote = state.alternative;
}
result = quote + stringifyEntities(
value,
Object.assign({}, state.settings.characterReferences, {
// Always encode without parse errors in non-HTML.
subset: (quote === "'" ? constants.single : constants.double)[x][y],
attribute: true
})
) + quote;
}
return name + (result ? "=" + result : result);
}
var textEntitySubset = ["<", "&"];
function text2(node, _, parent, state) {
return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
node.value,
Object.assign({}, state.settings.characterReferences, {
subset: textEntitySubset
})
);
}
function raw(node, index, parent, state) {
return state.settings.allowDangerousHtml ? node.value : text2(node, index, parent, state);
}
function root2(node, _1, _2, state) {
return state.all(node);
}
var handle = zwitch("type", {
invalid,
unknown: unknown2,
handlers: { comment: comment2, doctype, element, raw, root: root2, text: text2 }
});
function invalid(node) {
throw new Error("Expected node, not `" + node + "`");
}
function unknown2(node_) {
const node = (
/** @type {Nodes} */
node_
);
throw new Error("Cannot compile unknown node `" + node.type + "`");
}
var emptyOptions = {};
var emptyCharacterReferences = {};
var emptyChildren = [];
function toHtml(tree, options) {
const options_ = options || emptyOptions;
const quote = options_.quote || '"';
const alternative = quote === '"' ? "'" : '"';
if (quote !== '"' && quote !== "'") {
throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
}
const state = {
one,
all,
settings: {
omitOptionalTags: options_.omitOptionalTags || false,
allowParseErrors: options_.allowParseErrors || false,
allowDangerousCharacters: options_.allowDangerousCharacters || false,
quoteSmart: options_.quoteSmart || false,
preferUnquoted: options_.preferUnquoted || false,
tightAttributes: options_.tightAttributes || false,
upperDoctype: options_.upperDoctype || false,
tightDoctype: options_.tightDoctype || false,
bogusComments: options_.bogusComments || false,
tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,
tightSelfClosing: options_.tightSelfClosing || false,
collapseEmptyAttributes: options_.collapseEmptyAttributes || false,
allowDangerousHtml: options_.allowDangerousHtml || false,
voids: options_.voids || htmlVoidElements,
characterReferences: options_.characterReferences || emptyCharacterReferences,
closeSelfClosing: options_.closeSelfClosing || false,
closeEmptyElements: options_.closeEmptyElements || false
},
schema: options_.space === "svg" ? svg : html,
quote,
alternative
};
return state.one(
Array.isArray(tree) ? { type: "root", children: tree } : tree,
void 0,
void 0
);
}
function one(node, index, parent) {
return handle(node, index, parent, this);
}
function all(parent) {
const results = [];
const children = parent && parent.children || emptyChildren;
let index = -1;
while (++index < children.length) {
results[index] = this.one(children[index], index, parent);
}
return results.join("");
}
function resolveColorReplacements(theme, options) {
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
const themeName = typeof theme === "string" ? theme : theme.name;
for (const [key2, value] of Object.entries((options == null ? void 0 : options.colorReplacements) || {})) {
if (typeof value === "string")
replacements[key2] = value;
else if (key2 === themeName)
Object.assign(replacements, value);
}
return replacements;
}
function applyColorReplacements(color, replacements) {
if (!color)
return color;
return (replacements == null ? void 0 : replacements[color == null ? void 0 : color.toLowerCase()]) || color;
}
function toArray(x) {
return Array.isArray(x) ? x : [x];
}
async function normalizeGetter(p2) {
return Promise.resolve(typeof p2 === "function" ? p2() : p2).then((r) => r.default || r);
}
function isPlainLang(lang) {
return !lang || ["plaintext", "txt", "text", "plain"].includes(lang);
}
function isSpecialLang(lang) {
return lang === "ansi" || isPlainLang(lang);
}
function isNoneTheme(theme) {
return theme === "none";
}
function isSpecialTheme(theme) {
return isNoneTheme(theme);
}
function addClassToHast(node, className) {
var _a22;
if (!className)
return node;
node.properties || (node.properties = {});
(_a22 = node.properties).class || (_a22.class = []);
if (typeof node.properties.class === "string")
node.properties.class = node.properties.class.split(/\s+/g);
if (!Array.isArray(node.properties.class))
node.properties.class = [];
const targets = Array.isArray(className) ? className : className.split(/\s+/g);
for (const c of targets) {
if (c && !node.properties.class.includes(c))
node.properties.class.push(c);
}
return node;
}
function splitLines(code3, preserveEnding = false) {
var _a22;
const parts = code3.split(/(\r?\n)/g);
let index = 0;
const lines = [];
for (let i = 0; i < parts.length; i += 2) {
const line = preserveEnding ? parts[i] + (parts[i + 1] || "") : parts[i];
lines.push([line, index]);
index += parts[i].length;
index += ((_a22 = parts[i + 1]) == null ? void 0 : _a22.length) || 0;
}
return lines;
}
function createPositionConverter(code3) {
const lines = splitLines(code3, true).map(([line]) => line);
function indexToPos(index) {
if (index === code3.length) {
return {
line: lines.length - 1,
character: lines[lines.length - 1].length
};
}
let character = index;
let line = 0;
for (const lineText of lines) {
if (character < lineText.length)
break;
character -= lineText.length;
line++;
}
return { line, character };
}
function posToIndex(line, character) {
let index = 0;
for (let i = 0; i < line; i++)
index += lines[i].length;
index += character;
return index;
}
return {
lines,
indexToPos,
posToIndex
};
}
var DEFAULT_COLOR_LIGHT_DARK = "light-dark()";
var COLOR_KEYS = ["color", "background-color"];
function splitToken(token, offsets) {
let lastOffset = 0;
const tokens = [];
for (const offset of offsets) {
if (offset > lastOffset) {
tokens.push({
...token,
content: token.content.slice(lastOffset, offset),
offset: token.offset + lastOffset
});
}
lastOffset = offset;
}
if (lastOffset < token.content.length) {
tokens.push({
...token,
content: token.content.slice(lastOffset),
offset: token.offset + lastOffset
});
}
return tokens;
}
function splitTokens(tokens, breakpoints) {
const sorted = Array.from(breakpoints instanceof Set ? breakpoints : new Set(breakpoints)).sort((a, b) => a - b);
if (!sorted.length)
return tokens;
return tokens.map((line) => {
return line.flatMap((token) => {
const breakpointsInToken = sorted.filter((i) => token.offset < i && i < token.offset + token.content.length).map((i) => i - token.offset).sort((a, b) => a - b);
if (!breakpointsInToken.length)
return token;
return splitToken(token, breakpointsInToken);
});
});
}
function flatTokenVariants(merged, variantsOrder, cssVariablePrefix, defaultColor, colorsRendering = "css-vars") {
const token = {
content: merged.content,
explanation: merged.explanation,
offset: merged.offset
};
const styles = variantsOrder.map((t) => getTokenStyleObject(merged.variants[t]));
const styleKeys = new Set(styles.flatMap((t) => Object.keys(t)));
const mergedStyles = {};
const varKey = (idx, key2) => {
const keyName = key2 === "color" ? "" : key2 === "background-color" ? "-bg" : `-${key2}`;
return cssVariablePrefix + variantsOrder[idx] + (key2 === "color" ? "" : keyName);
};
styles.forEach((cur, idx) => {
for (const key2 of styleKeys) {
const value = cur[key2] || "inherit";
if (idx === 0 && defaultColor && COLOR_KEYS.includes(key2)) {
if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && styles.length > 1) {
const lightIndex = variantsOrder.findIndex((t) => t === "light");
const darkIndex = variantsOrder.findIndex((t) => t === "dark");
if (lightIndex === -1 || darkIndex === -1)
throw new ShikiError$2('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
const lightValue = styles[lightIndex][key2] || "inherit";
const darkValue = styles[darkIndex][key2] || "inherit";
mergedStyles[key2] = `light-dark(${lightValue}, ${darkValue})`;
if (colorsRendering === "css-vars")
mergedStyles[varKey(idx, key2)] = value;
} else {
mergedStyles[key2] = value;
}
} else {
if (colorsRendering === "css-vars")
mergedStyles[varKey(idx, key2)] = value;
}
}
});
token.htmlStyle = mergedStyles;
return token;
}
function getTokenStyleObject(token) {
const styles = {};
if (token.color)
styles.color = token.color;
if (token.bgColor)
styles["background-color"] = token.bgColor;
if (token.fontStyle) {
if (token.fontStyle & FontStyle.Italic)
styles["font-style"] = "italic";
if (token.fontStyle & FontStyle.Bold)
styles["font-weight"] = "bold";
const decorations2 = [];
if (token.fontStyle & FontStyle.Underline)
decorations2.push("underline");
if (token.fontStyle & FontStyle.Strikethrough)
decorations2.push("line-through");
if (decorations2.length)
styles["text-decoration"] = decorations2.join(" ");
}
return styles;
}
function stringifyTokenStyle(token) {
if (typeof token === "string")
return token;
return Object.entries(token).map(([key2, value]) => `${key2}:${value}`).join(";");
}
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
function setLastGrammarStateToMap(keys, state) {
_grammarStateMap.set(keys, state);
}
function getLastGrammarStateFromMap(keys) {
return _grammarStateMap.get(keys);
}
var GrammarState = class _GrammarState {
constructor(...args) {
__publicField2(this, "_stacks", {});
__publicField2(this, "lang");
if (args.length === 2) {
const [stacksMap, lang] = args;
this.lang = lang;
this._stacks = stacksMap;
} else {
const [stack, lang, theme] = args;
this.lang = lang;
this._stacks = { [theme]: stack };
}
}
get themes() {
return Object.keys(this._stacks);
}
get theme() {
return this.themes[0];
}
get _stack() {
return this._stacks[this.theme];
}
/**
* Static method to create a initial grammar state.
*/
static initial(lang, themes) {
return new _GrammarState(
Object.fromEntries(toArray(themes).map((theme) => [theme, INITIAL])),
lang
);
}
/**
* Get the internal stack object.
* @internal
*/
getInternalStack(theme = this.theme) {
return this._stacks[theme];
}
getScopes(theme = this.theme) {
return getScopes(this._stacks[theme]);
}
toJSON() {
return {
lang: this.lang,
theme: this.theme,
themes: this.themes,
scopes: this.getScopes()
};
}
};
function getScopes(stack) {
const scopes = [];
const visited = /* @__PURE__ */ new Set();
function pushScope(stack2) {
var _a22;
if (visited.has(stack2))
return;
visited.add(stack2);
const name = (_a22 = stack2 == null ? void 0 : stack2.nameScopesList) == null ? void 0 : _a22.scopeName;
if (name)
scopes.push(name);
if (stack2.parent)
pushScope(stack2.parent);
}
pushScope(stack);
return scopes;
}
function getGrammarStack(state, theme) {
if (!(state instanceof GrammarState))
throw new ShikiError$2("Invalid grammar state");
return state.getInternalStack(theme);
}
function transformerDecorations() {
const map2 = /* @__PURE__ */ new WeakMap();
function getContext(shiki) {
if (!map2.has(shiki.meta)) {
let normalizePosition = function(p2) {
if (typeof p2 === "number") {
if (p2 < 0 || p2 > shiki.source.length)
throw new ShikiError$2(`Invalid decoration offset: ${p2}. Code length: ${shiki.source.length}`);
return {
...converter.indexToPos(p2),
offset: p2
};
} else {
const line = converter.lines[p2.line];
if (line === void 0)
throw new ShikiError$2(`Invalid decoration position ${JSON.stringify(p2)}. Lines length: ${converter.lines.length}`);
let character = p2.character;
if (character < 0)
character = line.length + character;
if (character < 0 || character > line.length)
throw new ShikiError$2(`Invalid decoration position ${JSON.stringify(p2)}. Line ${p2.line} length: ${line.length}`);
return {
...p2,
character,
offset: converter.posToIndex(p2.line, character)
};
}
};
const converter = createPositionConverter(shiki.source);
const decorations2 = (shiki.options.decorations || []).map((d) => ({
...d,
start: normalizePosition(d.start),
end: normalizePosition(d.end)
}));
verifyIntersections(decorations2);
map2.set(shiki.meta, {
decorations: decorations2,
converter,
source: shiki.source
});
}
return map2.get(shiki.meta);
}
return {
name: "shiki:decorations",
tokens(tokens) {
var _a22;
if (!((_a22 = this.options.decorations) == null ? void 0 : _a22.length))
return;
const ctx = getContext(this);
const breakpoints = ctx.decorations.flatMap((d) => [d.start.offset, d.end.offset]);
const splitted = splitTokens(tokens, breakpoints);
return splitted;
},
code(codeEl) {
var _a22;
if (!((_a22 = this.options.decorations) == null ? void 0 : _a22.length))
return;
const ctx = getContext(this);
const lines = Array.from(codeEl.children).filter((i) => i.type === "element" && i.tagName === "span");
if (lines.length !== ctx.converter.lines.length)
throw new ShikiError$2(`Number of lines in code element (${lines.length}) does not match the number of lines in the source (${ctx.converter.lines.length}). Failed to apply decorations.`);
function applyLineSection(line, start, end, decoration) {
const lineEl = lines[line];
let text22 = "";
let startIndex = -1;
let endIndex = -1;
if (start === 0)
startIndex = 0;
if (end === 0)
endIndex = 0;
if (end === Number.POSITIVE_INFINITY)
endIndex = lineEl.children.length;
if (startIndex === -1 || endIndex === -1) {
for (let i = 0; i < lineEl.children.length; i++) {
text22 += stringify2(lineEl.children[i]);
if (startIndex === -1 && text22.length === start)
startIndex = i + 1;
if (endIndex === -1 && text22.length === end)
endIndex = i + 1;
}
}
if (startIndex === -1)
throw new ShikiError$2(`Failed to find start index for decoration ${JSON.stringify(decoration.start)}`);
if (endIndex === -1)
throw new ShikiError$2(`Failed to find end index for decoration ${JSON.stringify(decoration.end)}`);
const children = lineEl.children.slice(startIndex, endIndex);
if (!decoration.alwaysWrap && children.length === lineEl.children.length) {
applyDecoration(lineEl, decoration, "line");
} else if (!decoration.alwaysWrap && children.length === 1 && children[0].type === "element") {
applyDecoration(children[0], decoration, "token");
} else {
const wrapper = {
type: "element",
tagName: "span",
properties: {},
children
};
applyDecoration(wrapper, decoration, "wrapper");
lineEl.children.splice(startIndex, children.length, wrapper);
}
}
function applyLine(line, decoration) {
lines[line] = applyDecoration(lines[line], decoration, "line");
}
function applyDecoration(el, decoration, type) {
var _a3;
const properties = decoration.properties || {};
const transform = decoration.transform || ((i) => i);
el.tagName = decoration.tagName || "span";
el.properties = {
...el.properties,
...properties,
class: el.properties.class
};
if ((_a3 = decoration.properties) == null ? void 0 : _a3.class)
addClassToHast(el, decoration.properties.class);
el = transform(el, type) || el;
return el;
}
const lineApplies = [];
const sorted = ctx.decorations.sort((a, b) => b.start.offset - a.start.offset || a.end.offset - b.end.offset);
for (const decoration of sorted) {
const { start, end } = decoration;
if (start.line === end.line) {
applyLineSection(start.line, start.character, end.character, decoration);
} else if (start.line < end.line) {
applyLineSection(start.line, start.character, Number.POSITIVE_INFINITY, decoration);
for (let i = start.line + 1; i < end.line; i++)
lineApplies.unshift(() => applyLine(i, decoration));
applyLineSection(end.line, 0, end.character, decoration);
}
}
lineApplies.forEach((i) => i());
}
};
}
function verifyIntersections(items) {
for (let i = 0; i < items.length; i++) {
const foo = items[i];
if (foo.start.offset > foo.end.offset)
throw new ShikiError$2(`Invalid decoration range: ${JSON.stringify(foo.start)} - ${JSON.stringify(foo.end)}`);
for (let j = i + 1; j < items.length; j++) {
const bar = items[j];
const isFooHasBarStart = foo.start.offset <= bar.start.offset && bar.start.offset < foo.end.offset;
const isFooHasBarEnd = foo.start.offset < bar.end.offset && bar.end.offset <= foo.end.offset;
const isBarHasFooStart = bar.start.offset <= foo.start.offset && foo.start.offset < bar.end.offset;
const isBarHasFooEnd = bar.start.offset < foo.end.offset && foo.end.offset <= bar.end.offset;
if (isFooHasBarStart || isFooHasBarEnd || isBarHasFooStart || isBarHasFooEnd) {
if (isFooHasBarStart && isFooHasBarEnd)
continue;
if (isBarHasFooStart && isBarHasFooEnd)
continue;
if (isBarHasFooStart && foo.start.offset === foo.end.offset)
continue;
if (isFooHasBarEnd && bar.start.offset === bar.end.offset)
continue;
throw new ShikiError$2(`Decorations ${JSON.stringify(foo.start)} and ${JSON.stringify(bar.start)} intersect.`);
}
}
}
}
function stringify2(el) {
if (el.type === "text")
return el.value;
if (el.type === "element")
return el.children.map(stringify2).join("");
return "";
}
var builtInTransformers = [
transformerDecorations()
];
function getTransformers(options) {
return [
...options.transformers || [],
...builtInTransformers
];
}
var namedColors = [
"black",
"red",
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white",
"brightBlack",
"brightRed",
"brightGreen",
"brightYellow",
"brightBlue",
"brightMagenta",
"brightCyan",
"brightWhite"
];
var decorations = {
1: "bold",
2: "dim",
3: "italic",
4: "underline",
7: "reverse",
8: "hidden",
9: "strikethrough"
};
function findSequence(value, position) {
const nextEscape = value.indexOf("\x1B", position);
if (nextEscape !== -1) {
if (value[nextEscape + 1] === "[") {
const nextClose = value.indexOf("m", nextEscape);
if (nextClose !== -1) {
return {
sequence: value.substring(nextEscape + 2, nextClose).split(";"),
startPosition: nextEscape,
position: nextClose + 1
};
}
}
}
return {
position: value.length
};
}
function parseColor(sequence) {
const colorMode = sequence.shift();
if (colorMode === "2") {
const rgb = sequence.splice(0, 3).map((x) => Number.parseInt(x));
if (rgb.length !== 3 || rgb.some((x) => Number.isNaN(x)))
return;
return {
type: "rgb",
rgb
};
} else if (colorMode === "5") {
const index = sequence.shift();
if (index) {
return { type: "table", index: Number(index) };
}
}
}
function parseSequence(sequence) {
const commands = [];
while (sequence.length > 0) {
const code3 = sequence.shift();
if (!code3)
continue;
const codeInt = Number.parseInt(code3);
if (Number.isNaN(codeInt))
continue;
if (codeInt === 0) {
commands.push({ type: "resetAll" });
} else if (codeInt <= 9) {
const decoration = decorations[codeInt];
if (decoration) {
commands.push({
type: "setDecoration",
value: decorations[codeInt]
});
}
} else if (codeInt <= 29) {
const decoration = decorations[codeInt - 20];
if (decoration) {
commands.push({
type: "resetDecoration",
value: decoration
});
if (decoration === "dim") {
commands.push({
type: "resetDecoration",
value: "bold"
});
}
}
} else if (codeInt <= 37) {
commands.push({
type: "setForegroundColor",
value: { type: "named", name: namedColors[codeInt - 30] }
});
} else if (codeInt === 38) {
const color = parseColor(sequence);
if (color) {
commands.push({
type: "setForegroundColor",
value: color
});
}
} else if (codeInt === 39) {
commands.push({
type: "resetForegroundColor"
});
} else if (codeInt <= 47) {
commands.push({
type: "setBackgroundColor",
value: { type: "named", name: namedColors[codeInt - 40] }
});
} else if (codeInt === 48) {
const color = parseColor(sequence);
if (color) {
commands.push({
type: "setBackgroundColor",
value: color
});
}
} else if (codeInt === 49) {
commands.push({
type: "resetBackgroundColor"
});
} else if (codeInt === 53) {
commands.push({
type: "setDecoration",
value: "overline"
});
} else if (codeInt === 55) {
commands.push({
type: "resetDecoration",
value: "overline"
});
} else if (codeInt >= 90 && codeInt <= 97) {
commands.push({
type: "setForegroundColor",
value: { type: "named", name: namedColors[codeInt - 90 + 8] }
});
} else if (codeInt >= 100 && codeInt <= 107) {
commands.push({
type: "setBackgroundColor",
value: { type: "named", name: namedColors[codeInt - 100 + 8] }
});
}
}
return commands;
}
function createAnsiSequenceParser() {
let foreground = null;
let background = null;
let decorations2 = /* @__PURE__ */ new Set();
return {
parse(value) {
const tokens = [];
let position = 0;
do {
const findResult = findSequence(value, position);
const text22 = findResult.sequence ? value.substring(position, findResult.startPosition) : value.substring(position);
if (text22.length > 0) {
tokens.push({
value: text22,
foreground,
background,
decorations: new Set(decorations2)
});
}
if (findResult.sequence) {
const commands = parseSequence(findResult.sequence);
for (const styleToken of commands) {
if (styleToken.type === "resetAll") {
foreground = null;
background = null;
decorations2.clear();
} else if (styleToken.type === "resetForegroundColor") {
foreground = null;
} else if (styleToken.type === "resetBackgroundColor") {
background = null;
} else if (styleToken.type === "resetDecoration") {
decorations2.delete(styleToken.value);
}
}
for (const styleToken of commands) {
if (styleToken.type === "setForegroundColor") {
foreground = styleToken.value;
} else if (styleToken.type === "setBackgroundColor") {
background = styleToken.value;
} else if (styleToken.type === "setDecoration") {
decorations2.add(styleToken.value);
}
}
}
position = findResult.position;
} while (position < value.length);
return tokens;
}
};
}
var defaultNamedColorsMap = {
black: "#000000",
red: "#bb0000",
green: "#00bb00",
yellow: "#bbbb00",
blue: "#0000bb",
magenta: "#ff00ff",
cyan: "#00bbbb",
white: "#eeeeee",
brightBlack: "#555555",
brightRed: "#ff5555",
brightGreen: "#00ff00",
brightYellow: "#ffff55",
brightBlue: "#5555ff",
brightMagenta: "#ff55ff",
brightCyan: "#55ffff",
brightWhite: "#ffffff"
};
function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
function namedColor(name) {
return namedColorsMap[name];
}
function rgbColor(rgb) {
return `#${rgb.map((x) => Math.max(0, Math.min(x, 255)).toString(16).padStart(2, "0")).join("")}`;
}
let colorTable;
function getColorTable() {
if (colorTable) {
return colorTable;
}
colorTable = [];
for (let i = 0; i < namedColors.length; i++) {
colorTable.push(namedColor(namedColors[i]));
}
let levels = [0, 95, 135, 175, 215, 255];
for (let r = 0; r < 6; r++) {
for (let g = 0; g < 6; g++) {
for (let b = 0; b < 6; b++) {
colorTable.push(rgbColor([levels[r], levels[g], levels[b]]));
}
}
}
let level = 8;
for (let i = 0; i < 24; i++, level += 10) {
colorTable.push(rgbColor([level, level, level]));
}
return colorTable;
}
function tableColor(index) {
return getColorTable()[index];
}
function value(color) {
switch (color.type) {
case "named":
return namedColor(color.name);
case "rgb":
return rgbColor(color.rgb);
case "table":
return tableColor(color.index);
}
}
return {
value
};
}
function tokenizeAnsiWithTheme(theme, fileContents, options) {
const colorReplacements = resolveColorReplacements(theme, options);
const lines = splitLines(fileContents);
const colorPalette = createColorPalette(
Object.fromEntries(
namedColors.map((name) => {
var _a22;
return [
name,
(_a22 = theme.colors) == null ? void 0 : _a22[`terminal.ansi${name[0].toUpperCase()}${name.substring(1)}`]
];
})
)
);
const parser = createAnsiSequenceParser();
return lines.map(
(line) => parser.parse(line[0]).map((token) => {
let color;
let bgColor;
if (token.decorations.has("reverse")) {
color = token.background ? colorPalette.value(token.background) : theme.bg;
bgColor = token.foreground ? colorPalette.value(token.foreground) : theme.fg;
} else {
color = token.foreground ? colorPalette.value(token.foreground) : theme.fg;
bgColor = token.background ? colorPalette.value(token.background) : void 0;
}
color = applyColorReplacements(color, colorReplacements);
bgColor = applyColorReplacements(bgColor, colorReplacements);
if (token.decorations.has("dim"))
color = dimColor(color);
let fontStyle = FontStyle.None;
if (token.decorations.has("bold"))
fontStyle |= FontStyle.Bold;
if (token.decorations.has("italic"))
fontStyle |= FontStyle.Italic;
if (token.decorations.has("underline"))
fontStyle |= FontStyle.Underline;
if (token.decorations.has("strikethrough"))
fontStyle |= FontStyle.Strikethrough;
return {
content: token.value,
offset: line[1],
// TODO: more accurate offset? might need to fork ansi-sequence-parser
color,
bgColor,
fontStyle
};
})
);
}
function dimColor(color) {
const hexMatch = color.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);
if (hexMatch) {
if (hexMatch[3]) {
const alpha = Math.round(Number.parseInt(hexMatch[3], 16) / 2).toString(16).padStart(2, "0");
return `#${hexMatch[1]}${hexMatch[2]}${alpha}`;
} else if (hexMatch[2]) {
return `#${hexMatch[1]}${hexMatch[2]}80`;
} else {
return `#${Array.from(hexMatch[1]).map((x) => `${x}${x}`).join("")}80`;
}
}
const cssVarMatch = color.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
if (cssVarMatch)
return `var(${cssVarMatch[1]}-dim)`;
return color;
}
function codeToTokensBase(internal, code3, options = {}) {
const {
lang = "text",
theme: themeName = internal.getLoadedThemes()[0]
} = options;
if (isPlainLang(lang) || isNoneTheme(themeName))
return splitLines(code3).map((line) => [{ content: line[0], offset: line[1] }]);
const { theme, colorMap: colorMap2 } = internal.setTheme(themeName);
if (lang === "ansi")
return tokenizeAnsiWithTheme(theme, code3, options);
const _grammar = internal.getLanguage(lang);
if (options.grammarState) {
if (options.grammarState.lang !== _grammar.name) {
throw new ShikiError$2(`Grammar state language "${options.grammarState.lang}" does not match highlight language "${_grammar.name}"`);
}
if (!options.grammarState.themes.includes(theme.name)) {
throw new ShikiError$2(`Grammar state themes "${options.grammarState.themes}" do not contain highlight theme "${theme.name}"`);
}
}
return tokenizeWithTheme(code3, _grammar, theme, colorMap2, options);
}
function getLastGrammarState(...args) {
if (args.length === 2) {
return getLastGrammarStateFromMap(args[1]);
}
const [internal, code3, options = {}] = args;
const {
lang = "text",
theme: themeName = internal.getLoadedThemes()[0]
} = options;
if (isPlainLang(lang) || isNoneTheme(themeName))
throw new ShikiError$2("Plain language does not have grammar state");
if (lang === "ansi")
throw new ShikiError$2("ANSI language does not have grammar state");
const { theme, colorMap: colorMap2 } = internal.setTheme(themeName);
const _grammar = internal.getLanguage(lang);
return new GrammarState(
_tokenizeWithTheme(code3, _grammar, theme, colorMap2, options).stateStack,
_grammar.name,
theme.name
);
}
function tokenizeWithTheme(code3, grammar, theme, colorMap2, options) {
const result = _tokenizeWithTheme(code3, grammar, theme, colorMap2, options);
const grammarState = new GrammarState(
_tokenizeWithTheme(code3, grammar, theme, colorMap2, options).stateStack,
grammar.name,
theme.name
);
setLastGrammarStateToMap(result.tokens, grammarState);
return result.tokens;
}
function _tokenizeWithTheme(code3, grammar, theme, colorMap2, options) {
const colorReplacements = resolveColorReplacements(theme, options);
const {
tokenizeMaxLineLength = 0,
tokenizeTimeLimit = 500
} = options;
const lines = splitLines(code3);
let stateStack = options.grammarState ? getGrammarStack(options.grammarState, theme.name) ?? INITIAL : options.grammarContextCode != null ? _tokenizeWithTheme(
options.grammarContextCode,
grammar,
theme,
colorMap2,
{
...options,
grammarState: void 0,
grammarContextCode: void 0
}
).stateStack : INITIAL;
let actual = [];
const final = [];
for (let i = 0, len = lines.length; i < len; i++) {
const [line, lineOffset] = lines[i];
if (line === "") {
actual = [];
final.push([]);
continue;
}
if (tokenizeMaxLineLength > 0 && line.length >= tokenizeMaxLineLength) {
actual = [];
final.push([{
content: line,
offset: lineOffset,
color: "",
fontStyle: 0
}]);
continue;
}
let resultWithScopes;
let tokensWithScopes;
let tokensWithScopesIndex;
if (options.includeExplanation) {
resultWithScopes = grammar.tokenizeLine(line, stateStack, tokenizeTimeLimit);
tokensWithScopes = resultWithScopes.tokens;
tokensWithScopesIndex = 0;
}
const result = grammar.tokenizeLine2(line, stateStack, tokenizeTimeLimit);
const tokensLength = result.tokens.length / 2;
for (let j = 0; j < tokensLength; j++) {
const startIndex = result.tokens[2 * j];
const nextStartIndex = j + 1 < tokensLength ? result.tokens[2 * j + 2] : line.length;
if (startIndex === nextStartIndex)
continue;
const metadata = result.tokens[2 * j + 1];
const color = applyColorReplacements(
colorMap2[EncodedTokenMetadata.getForeground(metadata)],
colorReplacements
);
const fontStyle = EncodedTokenMetadata.getFontStyle(metadata);
const token = {
content: line.substring(startIndex, nextStartIndex),
offset: lineOffset + startIndex,
color,
fontStyle
};
if (options.includeExplanation) {
const themeSettingsSelectors = [];
if (options.includeExplanation !== "scopeName") {
for (const setting of theme.settings) {
let selectors;
switch (typeof setting.scope) {
case "string":
selectors = setting.scope.split(/,/).map((scope) => scope.trim());
break;
case "object":
selectors = setting.scope;
break;
default:
continue;
}
themeSettingsSelectors.push({
settings: setting,
selectors: selectors.map((selector) => selector.split(/ /))
});
}
}
token.explanation = [];
let offset = 0;
while (startIndex + offset < nextStartIndex) {
const tokenWithScopes = tokensWithScopes[tokensWithScopesIndex];
const tokenWithScopesText = line.substring(
tokenWithScopes.startIndex,
tokenWithScopes.endIndex
);
offset += tokenWithScopesText.length;
token.explanation.push({
content: tokenWithScopesText,
scopes: options.includeExplanation === "scopeName" ? explainThemeScopesNameOnly(
tokenWithScopes.scopes
) : explainThemeScopesFull(
themeSettingsSelectors,
tokenWithScopes.scopes
)
});
tokensWithScopesIndex += 1;
}
}
actual.push(token);
}
final.push(actual);
actual = [];
stateStack = result.ruleStack;
}
return {
tokens: final,
stateStack
};
}
function explainThemeScopesNameOnly(scopes) {
return scopes.map((scope) => ({ scopeName: scope }));
}
function explainThemeScopesFull(themeSelectors, scopes) {
const result = [];
for (let i = 0, len = scopes.length; i < len; i++) {
const scope = scopes[i];
result[i] = {
scopeName: scope,
themeMatches: explainThemeScope(themeSelectors, scope, scopes.slice(0, i))
};
}
return result;
}
function matchesOne(selector, scope) {
return selector === scope || scope.substring(0, selector.length) === selector && scope[selector.length] === ".";
}
function matches(selectors, scope, parentScopes) {
if (!matchesOne(selectors[selectors.length - 1], scope))
return false;
let selectorParentIndex = selectors.length - 2;
let parentIndex = parentScopes.length - 1;
while (selectorParentIndex >= 0 && parentIndex >= 0) {
if (matchesOne(selectors[selectorParentIndex], parentScopes[parentIndex]))
selectorParentIndex -= 1;
parentIndex -= 1;
}
if (selectorParentIndex === -1)
return true;
return false;
}
function explainThemeScope(themeSettingsSelectors, scope, parentScopes) {
const result = [];
for (const { selectors, settings } of themeSettingsSelectors) {
for (const selectorPieces of selectors) {
if (matches(selectorPieces, scope, parentScopes)) {
result.push(settings);
break;
}
}
}
return result;
}
function codeToTokensWithThemes(internal, code3, options) {
const themes = Object.entries(options.themes).filter((i) => i[1]).map((i) => ({ color: i[0], theme: i[1] }));
const themedTokens = themes.map((t) => {
const tokens2 = codeToTokensBase(internal, code3, {
...options,
theme: t.theme
});
const state = getLastGrammarStateFromMap(tokens2);
const theme = typeof t.theme === "string" ? t.theme : t.theme.name;
return {
tokens: tokens2,
state,
theme
};
});
const tokens = syncThemesTokenization(
...themedTokens.map((i) => i.tokens)
);
const mergedTokens = tokens[0].map(
(line, lineIdx) => line.map((_token, tokenIdx) => {
const mergedToken = {
content: _token.content,
variants: {},
offset: _token.offset
};
if ("includeExplanation" in options && options.includeExplanation) {
mergedToken.explanation = _token.explanation;
}
tokens.forEach((t, themeIdx) => {
const {
content: _,
explanation: __,
offset: ___,
...styles
} = t[lineIdx][tokenIdx];
mergedToken.variants[themes[themeIdx].color] = styles;
});
return mergedToken;
})
);
const mergedGrammarState = themedTokens[0].state ? new GrammarState(
Object.fromEntries(themedTokens.map((s) => {
var _a22;
return [s.theme, (_a22 = s.state) == null ? void 0 : _a22.getInternalStack(s.theme)];
})),
themedTokens[0].state.lang
) : void 0;
if (mergedGrammarState)
setLastGrammarStateToMap(mergedTokens, mergedGrammarState);
return mergedTokens;
}
function syncThemesTokenization(...themes) {
const outThemes = themes.map(() => []);
const count = themes.length;
for (let i = 0; i < themes[0].length; i++) {
const lines = themes.map((t) => t[i]);
const outLines = outThemes.map(() => []);
outThemes.forEach((t, i2) => t.push(outLines[i2]));
const indexes = lines.map(() => 0);
const current = lines.map((l) => l[0]);
while (current.every((t) => t)) {
const minLength = Math.min(...current.map((t) => t.content.length));
for (let n = 0; n < count; n++) {
const token = current[n];
if (token.content.length === minLength) {
outLines[n].push(token);
indexes[n] += 1;
current[n] = lines[n][indexes[n]];
} else {
outLines[n].push({
...token,
content: token.content.slice(0, minLength)
});
current[n] = {
...token,
content: token.content.slice(minLength),
offset: token.offset + minLength
};
}
}
}
}
return outThemes;
}
function codeToTokens(internal, code3, options) {
let bg;
let fg;
let tokens;
let themeName;
let rootStyle;
let grammarState;
if ("themes" in options) {
const {
defaultColor = "light",
cssVariablePrefix = "--shiki-",
colorsRendering = "css-vars"
} = options;
const themes = Object.entries(options.themes).filter((i) => i[1]).map((i) => ({ color: i[0], theme: i[1] })).sort((a, b) => a.color === defaultColor ? -1 : b.color === defaultColor ? 1 : 0);
if (themes.length === 0)
throw new ShikiError$2("`themes` option must not be empty");
const themeTokens = codeToTokensWithThemes(
internal,
code3,
options
);
grammarState = getLastGrammarStateFromMap(themeTokens);
if (defaultColor && DEFAULT_COLOR_LIGHT_DARK !== defaultColor && !themes.find((t) => t.color === defaultColor))
throw new ShikiError$2(`\`themes\` option must contain the defaultColor key \`${defaultColor}\``);
const themeRegs = themes.map((t) => internal.getTheme(t.theme));
const themesOrder = themes.map((t) => t.color);
tokens = themeTokens.map((line) => line.map((token) => flatTokenVariants(token, themesOrder, cssVariablePrefix, defaultColor, colorsRendering)));
if (grammarState)
setLastGrammarStateToMap(tokens, grammarState);
const themeColorReplacements = themes.map((t) => resolveColorReplacements(t.theme, options));
fg = mapThemeColors(themes, themeRegs, themeColorReplacements, cssVariablePrefix, defaultColor, "fg", colorsRendering);
bg = mapThemeColors(themes, themeRegs, themeColorReplacements, cssVariablePrefix, defaultColor, "bg", colorsRendering);
themeName = `shiki-themes ${themeRegs.map((t) => t.name).join(" ")}`;
rootStyle = defaultColor ? void 0 : [fg, bg].join(";");
} else if ("theme" in options) {
const colorReplacements = resolveColorReplacements(options.theme, options);
tokens = codeToTokensBase(
internal,
code3,
options
);
const _theme = internal.getTheme(options.theme);
bg = applyColorReplacements(_theme.bg, colorReplacements);
fg = applyColorReplacements(_theme.fg, colorReplacements);
themeName = _theme.name;
grammarState = getLastGrammarStateFromMap(tokens);
} else {
throw new ShikiError$2("Invalid options, either `theme` or `themes` must be provided");
}
return {
tokens,
fg,
bg,
themeName,
rootStyle,
grammarState
};
}
function mapThemeColors(themes, themeRegs, themeColorReplacements, cssVariablePrefix, defaultColor, property, colorsRendering) {
return themes.map((t, idx) => {
const value = applyColorReplacements(themeRegs[idx][property], themeColorReplacements[idx]) || "inherit";
const cssVar = `${cssVariablePrefix + t.color}${property === "bg" ? "-bg" : ""}:${value}`;
if (idx === 0 && defaultColor) {
if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && themes.length > 1) {
const lightIndex = themes.findIndex((t2) => t2.color === "light");
const darkIndex = themes.findIndex((t2) => t2.color === "dark");
if (lightIndex === -1 || darkIndex === -1)
throw new ShikiError$2('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');
const lightValue = applyColorReplacements(themeRegs[lightIndex][property], themeColorReplacements[lightIndex]) || "inherit";
const darkValue = applyColorReplacements(themeRegs[darkIndex][property], themeColorReplacements[darkIndex]) || "inherit";
return `light-dark(${lightValue}, ${darkValue});${cssVar}`;
}
return value;
}
if (colorsRendering === "css-vars") {
return cssVar;
}
return null;
}).filter((i) => !!i).join(";");
}
function codeToHast(internal, code3, options, transformerContext = {
meta: {},
options,
codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
}) {
var _a22, _b2;
let input = code3;
for (const transformer of getTransformers(options))
input = ((_a22 = transformer.preprocess) == null ? void 0 : _a22.call(transformerContext, input, options)) || input;
let {
tokens,
fg,
bg,
themeName,
rootStyle,
grammarState
} = codeToTokens(internal, input, options);
const {
mergeWhitespaces = true,
mergeSameStyleTokens = false
} = options;
if (mergeWhitespaces === true)
tokens = mergeWhitespaceTokens(tokens);
else if (mergeWhitespaces === "never")
tokens = splitWhitespaceTokens(tokens);
if (mergeSameStyleTokens) {
tokens = mergeAdjacentStyledTokens(tokens);
}
const contextSource = {
...transformerContext,
get source() {
return input;
}
};
for (const transformer of getTransformers(options))
tokens = ((_b2 = transformer.tokens) == null ? void 0 : _b2.call(contextSource, tokens)) || tokens;
return tokensToHast(
tokens,
{
...options,
fg,
bg,
themeName,
rootStyle
},
contextSource,
grammarState
);
}
function tokensToHast(tokens, options, transformerContext, grammarState = getLastGrammarStateFromMap(tokens)) {
var _a22, _b2, _c;
const transformers = getTransformers(options);
const lines = [];
const root22 = {
type: "root",
children: []
};
const {
structure = "classic",
tabindex = "0"
} = options;
let preNode = {
type: "element",
tagName: "pre",
properties: {
class: `shiki ${options.themeName || ""}`,
style: options.rootStyle || `background-color:${options.bg};color:${options.fg}`,
...tabindex !== false && tabindex != null ? {
tabindex: tabindex.toString()
} : {},
...Object.fromEntries(
Array.from(
Object.entries(options.meta || {})
).filter(([key2]) => !key2.startsWith("_"))
)
},
children: []
};
let codeNode = {
type: "element",
tagName: "code",
properties: {},
children: lines
};
const lineNodes = [];
const context = {
...transformerContext,
structure,
addClassToHast,
get source() {
return transformerContext.source;
},
get tokens() {
return tokens;
},
get options() {
return options;
},
get root() {
return root22;
},
get pre() {
return preNode;
},
get code() {
return codeNode;
},
get lines() {
return lineNodes;
}
};
tokens.forEach((line, idx) => {
var _a3, _b3;
if (idx) {
if (structure === "inline")
root22.children.push({ type: "element", tagName: "br", properties: {}, children: [] });
else if (structure === "classic")
lines.push({ type: "text", value: "\n" });
}
let lineNode = {
type: "element",
tagName: "span",
properties: { class: "line" },
children: []
};
let col = 0;
for (const token of line) {
let tokenNode = {
type: "element",
tagName: "span",
properties: {
...token.htmlAttrs
},
children: [{ type: "text", value: token.content }]
};
const style = stringifyTokenStyle(token.htmlStyle || getTokenStyleObject(token));
if (style)
tokenNode.properties.style = style;
for (const transformer of transformers)
tokenNode = ((_a3 = transformer == null ? void 0 : transformer.span) == null ? void 0 : _a3.call(context, tokenNode, idx + 1, col, lineNode, token)) || tokenNode;
if (structure === "inline")
root22.children.push(tokenNode);
else if (structure === "classic")
lineNode.children.push(tokenNode);
col += token.content.length;
}
if (structure === "classic") {
for (const transformer of transformers)
lineNode = ((_b3 = transformer == null ? void 0 : transformer.line) == null ? void 0 : _b3.call(context, lineNode, idx + 1)) || lineNode;
lineNodes.push(lineNode);
lines.push(lineNode);
}
});
if (structure === "classic") {
for (const transformer of transformers)
codeNode = ((_a22 = transformer == null ? void 0 : transformer.code) == null ? void 0 : _a22.call(context, codeNode)) || codeNode;
preNode.children.push(codeNode);
for (const transformer of transformers)
preNode = ((_b2 = transformer == null ? void 0 : transformer.pre) == null ? void 0 : _b2.call(context, preNode)) || preNode;
root22.children.push(preNode);
}
let result = root22;
for (const transformer of transformers)
result = ((_c = transformer == null ? void 0 : transformer.root) == null ? void 0 : _c.call(context, result)) || result;
if (grammarState)
setLastGrammarStateToMap(result, grammarState);
return result;
}
function mergeWhitespaceTokens(tokens) {
return tokens.map((line) => {
const newLine = [];
let carryOnContent = "";
let firstOffset = 0;
line.forEach((token, idx) => {
const isDecorated = token.fontStyle && (token.fontStyle & FontStyle.Underline || token.fontStyle & FontStyle.Strikethrough);
const couldMerge = !isDecorated;
if (couldMerge && token.content.match(/^\s+$/) && line[idx + 1]) {
if (!firstOffset)
firstOffset = token.offset;
carryOnContent += token.content;
} else {
if (carryOnContent) {
if (couldMerge) {
newLine.push({
...token,
offset: firstOffset,
content: carryOnContent + token.content
});
} else {
newLine.push(
{
content: carryOnContent,
offset: firstOffset
},
token
);
}
firstOffset = 0;
carryOnContent = "";
} else {
newLine.push(token);
}
}
});
return newLine;
});
}
function splitWhitespaceTokens(tokens) {
return tokens.map((line) => {
return line.flatMap((token) => {
if (token.content.match(/^\s+$/))
return token;
const match2 = token.content.match(/^(\s*)(.*?)(\s*)$/);
if (!match2)
return token;
const [, leading, content, trailing] = match2;
if (!leading && !trailing)
return token;
const expanded = [{
...token,
offset: token.offset + leading.length,
content
}];
if (leading) {
expanded.unshift({
content: leading,
offset: token.offset
});
}
if (trailing) {
expanded.push({
content: trailing,
offset: token.offset + leading.length + content.length
});
}
return expanded;
});
});
}
function mergeAdjacentStyledTokens(tokens) {
return tokens.map((line) => {
const newLine = [];
for (const token of line) {
if (newLine.length === 0) {
newLine.push({ ...token });
continue;
}
const prevToken = newLine[newLine.length - 1];
const prevStyle = stringifyTokenStyle(prevToken.htmlStyle || getTokenStyleObject(prevToken));
const currentStyle = stringifyTokenStyle(token.htmlStyle || getTokenStyleObject(token));
const isPrevDecorated = prevToken.fontStyle && (prevToken.fontStyle & FontStyle.Underline || prevToken.fontStyle & FontStyle.Strikethrough);
const isDecorated = token.fontStyle && (token.fontStyle & FontStyle.Underline || token.fontStyle & FontStyle.Strikethrough);
if (!isPrevDecorated && !isDecorated && prevStyle === currentStyle) {
prevToken.content += token.content;
} else {
newLine.push({ ...token });
}
}
return newLine;
});
}
var hastToHtml = toHtml;
function codeToHtml(internal, code3, options) {
var _a22;
const context = {
meta: {},
options,
codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
};
let result = hastToHtml(codeToHast(internal, code3, options, context));
for (const transformer of getTransformers(options))
result = ((_a22 = transformer.postprocess) == null ? void 0 : _a22.call(context, result, options)) || result;
return result;
}
var VSCODE_FALLBACK_EDITOR_FG = { light: "#333333", dark: "#bbbbbb" };
var VSCODE_FALLBACK_EDITOR_BG = { light: "#fffffe", dark: "#1e1e1e" };
var RESOLVED_KEY = "__shiki_resolved";
function normalizeTheme(rawTheme) {
var _a22, _b2, _c, _d, _e;
if (rawTheme == null ? void 0 : rawTheme[RESOLVED_KEY])
return rawTheme;
const theme = {
...rawTheme
};
if (theme.tokenColors && !theme.settings) {
theme.settings = theme.tokenColors;
delete theme.tokenColors;
}
theme.type || (theme.type = "dark");
theme.colorReplacements = { ...theme.colorReplacements };
theme.settings || (theme.settings = []);
let { bg, fg } = theme;
if (!bg || !fg) {
const globalSetting = theme.settings ? theme.settings.find((s) => !s.name && !s.scope) : void 0;
if ((_a22 = globalSetting == null ? void 0 : globalSetting.settings) == null ? void 0 : _a22.foreground)
fg = globalSetting.settings.foreground;
if ((_b2 = globalSetting == null ? void 0 : globalSetting.settings) == null ? void 0 : _b2.background)
bg = globalSetting.settings.background;
if (!fg && ((_c = theme == null ? void 0 : theme.colors) == null ? void 0 : _c["editor.foreground"]))
fg = theme.colors["editor.foreground"];
if (!bg && ((_d = theme == null ? void 0 : theme.colors) == null ? void 0 : _d["editor.background"]))
bg = theme.colors["editor.background"];
if (!fg)
fg = theme.type === "light" ? VSCODE_FALLBACK_EDITOR_FG.light : VSCODE_FALLBACK_EDITOR_FG.dark;
if (!bg)
bg = theme.type === "light" ? VSCODE_FALLBACK_EDITOR_BG.light : VSCODE_FALLBACK_EDITOR_BG.dark;
theme.fg = fg;
theme.bg = bg;
}
if (!(theme.settings[0] && theme.settings[0].settings && !theme.settings[0].scope)) {
theme.settings.unshift({
settings: {
foreground: theme.fg,
background: theme.bg
}
});
}
let replacementCount = 0;
const replacementMap = /* @__PURE__ */ new Map();
function getReplacementColor(value) {
var _a3;
if (replacementMap.has(value))
return replacementMap.get(value);
replacementCount += 1;
const hex = `#${replacementCount.toString(16).padStart(8, "0").toLowerCase()}`;
if ((_a3 = theme.colorReplacements) == null ? void 0 : _a3[`#${hex}`])
return getReplacementColor(value);
replacementMap.set(value, hex);
return hex;
}
theme.settings = theme.settings.map((setting) => {
var _a3, _b3;
const replaceFg = ((_a3 = setting.settings) == null ? void 0 : _a3.foreground) && !setting.settings.foreground.startsWith("#");
const replaceBg = ((_b3 = setting.settings) == null ? void 0 : _b3.background) && !setting.settings.background.startsWith("#");
if (!replaceFg && !replaceBg)
return setting;
const clone2 = {
...setting,
settings: {
...setting.settings
}
};
if (replaceFg) {
const replacement = getReplacementColor(setting.settings.foreground);
theme.colorReplacements[replacement] = setting.settings.foreground;
clone2.settings.foreground = replacement;
}
if (replaceBg) {
const replacement = getReplacementColor(setting.settings.background);
theme.colorReplacements[replacement] = setting.settings.background;
clone2.settings.background = replacement;
}
return clone2;
});
for (const key2 of Object.keys(theme.colors || {})) {
if (key2 === "editor.foreground" || key2 === "editor.background" || key2.startsWith("terminal.ansi")) {
if (!((_e = theme.colors[key2]) == null ? void 0 : _e.startsWith("#"))) {
const replacement = getReplacementColor(theme.colors[key2]);
theme.colorReplacements[replacement] = theme.colors[key2];
theme.colors[key2] = replacement;
}
}
}
Object.defineProperty(theme, RESOLVED_KEY, {
enumerable: false,
writable: false,
value: true
});
return theme;
}
async function resolveLangs(langs) {
return Array.from(new Set((await Promise.all(
langs.filter((l) => !isSpecialLang(l)).map(async (lang) => await normalizeGetter(lang).then((r) => Array.isArray(r) ? r : [r]))
)).flat()));
}
async function resolveThemes(themes) {
const resolved = await Promise.all(
themes.map(
async (theme) => isSpecialTheme(theme) ? null : normalizeTheme(await normalizeGetter(theme))
)
);
return resolved.filter((i) => !!i);
}
var _emitDeprecation = 3;
function warnDeprecated(message, version = 3) {
if (version > _emitDeprecation)
return;
{
}
}
var ShikiError$1 = class ShikiError2 extends Error {
constructor(message) {
super(message);
this.name = "ShikiError";
}
};
var Registry2 = class extends Registry$1 {
constructor(_resolver, _themes, _langs, _alias = {}) {
super(_resolver);
__publicField2(this, "_resolvedThemes", /* @__PURE__ */ new Map());
__publicField2(this, "_resolvedGrammars", /* @__PURE__ */ new Map());
__publicField2(this, "_langMap", /* @__PURE__ */ new Map());
__publicField2(this, "_langGraph", /* @__PURE__ */ new Map());
__publicField2(this, "_textmateThemeCache", /* @__PURE__ */ new WeakMap());
__publicField2(this, "_loadedThemesCache", null);
__publicField2(this, "_loadedLanguagesCache", null);
this._resolver = _resolver;
this._themes = _themes;
this._langs = _langs;
this._alias = _alias;
this._themes.map((t) => this.loadTheme(t));
this.loadLanguages(this._langs);
}
getTheme(theme) {
if (typeof theme === "string")
return this._resolvedThemes.get(theme);
else
return this.loadTheme(theme);
}
loadTheme(theme) {
const _theme = normalizeTheme(theme);
if (_theme.name) {
this._resolvedThemes.set(_theme.name, _theme);
this._loadedThemesCache = null;
}
return _theme;
}
getLoadedThemes() {
if (!this._loadedThemesCache)
this._loadedThemesCache = [...this._resolvedThemes.keys()];
return this._loadedThemesCache;
}
// Override and re-implement this method to cache the textmate themes as `TextMateTheme.createFromRawTheme`
// is expensive. Themes can switch often especially for dual-theme support.
//
// The parent class also accepts `colorMap` as the second parameter, but since we don't use that,
// we omit here so it's easier to cache the themes.
setTheme(theme) {
let textmateTheme = this._textmateThemeCache.get(theme);
if (!textmateTheme) {
textmateTheme = Theme.createFromRawTheme(theme);
this._textmateThemeCache.set(theme, textmateTheme);
}
this._syncRegistry.setTheme(textmateTheme);
}
getGrammar(name) {
if (this._alias[name]) {
const resolved = /* @__PURE__ */ new Set([name]);
while (this._alias[name]) {
name = this._alias[name];
if (resolved.has(name))
throw new ShikiError$1(`Circular alias \`${Array.from(resolved).join(" -> ")} -> ${name}\``);
resolved.add(name);
}
}
return this._resolvedGrammars.get(name);
}
loadLanguage(lang) {
var _a22, _b2, _c, _d;
if (this.getGrammar(lang.name))
return;
const embeddedLazilyBy = new Set(
[...this._langMap.values()].filter((i) => {
var _a3;
return (_a3 = i.embeddedLangsLazy) == null ? void 0 : _a3.includes(lang.name);
})
);
this._resolver.addLanguage(lang);
const grammarConfig = {
balancedBracketSelectors: lang.balancedBracketSelectors || ["*"],
unbalancedBracketSelectors: lang.unbalancedBracketSelectors || []
};
this._syncRegistry._rawGrammars.set(lang.scopeName, lang);
const g = this.loadGrammarWithConfiguration(lang.scopeName, 1, grammarConfig);
g.name = lang.name;
this._resolvedGrammars.set(lang.name, g);
if (lang.aliases) {
lang.aliases.forEach((alias) => {
this._alias[alias] = lang.name;
});
}
this._loadedLanguagesCache = null;
if (embeddedLazilyBy.size) {
for (const e of embeddedLazilyBy) {
this._resolvedGrammars.delete(e.name);
this._loadedLanguagesCache = null;
(_b2 = (_a22 = this._syncRegistry) == null ? void 0 : _a22._injectionGrammars) == null ? void 0 : _b2.delete(e.scopeName);
(_d = (_c = this._syncRegistry) == null ? void 0 : _c._grammars) == null ? void 0 : _d.delete(e.scopeName);
this.loadLanguage(this._langMap.get(e.name));
}
}
}
dispose() {
super.dispose();
this._resolvedThemes.clear();
this._resolvedGrammars.clear();
this._langMap.clear();
this._langGraph.clear();
this._loadedThemesCache = null;
}
loadLanguages(langs) {
for (const lang of langs)
this.resolveEmbeddedLanguages(lang);
const langsGraphArray = Array.from(this._langGraph.entries());
const missingLangs = langsGraphArray.filter(([_, lang]) => !lang);
if (missingLangs.length) {
const dependents = langsGraphArray.filter(([_, lang]) => {
var _a22;
return lang && ((_a22 = lang.embeddedLangs) == null ? void 0 : _a22.some((l) => missingLangs.map(([name]) => name).includes(l)));
}).filter((lang) => !missingLangs.includes(lang));
throw new ShikiError$1(`Missing languages ${missingLangs.map(([name]) => `\`${name}\``).join(", ")}, required by ${dependents.map(([name]) => `\`${name}\``).join(", ")}`);
}
for (const [_, lang] of langsGraphArray)
this._resolver.addLanguage(lang);
for (const [_, lang] of langsGraphArray)
this.loadLanguage(lang);
}
getLoadedLanguages() {
if (!this._loadedLanguagesCache) {
this._loadedLanguagesCache = [
.../* @__PURE__ */ new Set([...this._resolvedGrammars.keys(), ...Object.keys(this._alias)])
];
}
return this._loadedLanguagesCache;
}
resolveEmbeddedLanguages(lang) {
this._langMap.set(lang.name, lang);
this._langGraph.set(lang.name, lang);
if (lang.embeddedLangs) {
for (const embeddedLang of lang.embeddedLangs)
this._langGraph.set(embeddedLang, this._langMap.get(embeddedLang));
}
}
};
var Resolver = class {
constructor(engine, langs) {
__publicField2(this, "_langs", /* @__PURE__ */ new Map());
__publicField2(this, "_scopeToLang", /* @__PURE__ */ new Map());
__publicField2(this, "_injections", /* @__PURE__ */ new Map());
__publicField2(this, "_onigLib");
this._onigLib = {
createOnigScanner: (patterns) => engine.createScanner(patterns),
createOnigString: (s) => engine.createString(s)
};
langs.forEach((i) => this.addLanguage(i));
}
get onigLib() {
return this._onigLib;
}
getLangRegistration(langIdOrAlias) {
return this._langs.get(langIdOrAlias);
}
loadGrammar(scopeName) {
return this._scopeToLang.get(scopeName);
}
addLanguage(l) {
this._langs.set(l.name, l);
if (l.aliases) {
l.aliases.forEach((a) => {
this._langs.set(a, l);
});
}
this._scopeToLang.set(l.scopeName, l);
if (l.injectTo) {
l.injectTo.forEach((i) => {
if (!this._injections.get(i))
this._injections.set(i, []);
this._injections.get(i).push(l.scopeName);
});
}
}
getInjections(scopeName) {
const scopeParts = scopeName.split(".");
let injections = [];
for (let i = 1; i <= scopeParts.length; i++) {
const subScopeName = scopeParts.slice(0, i).join(".");
injections = [...injections, ...this._injections.get(subScopeName) || []];
}
return injections;
}
};
var instancesCount = 0;
function createShikiInternalSync(options) {
instancesCount += 1;
if (options.warnings !== false && instancesCount >= 10 && instancesCount % 10 === 0)
;
let isDisposed = false;
if (!options.engine)
throw new ShikiError$1("`engine` option is required for synchronous mode");
const langs = (options.langs || []).flat(1);
const themes = (options.themes || []).flat(1).map(normalizeTheme);
const resolver = new Resolver(options.engine, langs);
const _registry = new Registry2(resolver, themes, langs, options.langAlias);
let _lastTheme;
function getLanguage(name) {
ensureNotDisposed();
const _lang = _registry.getGrammar(typeof name === "string" ? name : name.name);
if (!_lang)
throw new ShikiError$1(`Language \`${name}\` not found, you may need to load it first`);
return _lang;
}
function getTheme(name) {
if (name === "none")
return { bg: "", fg: "", name: "none", settings: [], type: "dark" };
ensureNotDisposed();
const _theme = _registry.getTheme(name);
if (!_theme)
throw new ShikiError$1(`Theme \`${name}\` not found, you may need to load it first`);
return _theme;
}
function setTheme(name) {
ensureNotDisposed();
const theme = getTheme(name);
if (_lastTheme !== name) {
_registry.setTheme(theme);
_lastTheme = name;
}
const colorMap2 = _registry.getColorMap();
return {
theme,
colorMap: colorMap2
};
}
function getLoadedThemes() {
ensureNotDisposed();
return _registry.getLoadedThemes();
}
function getLoadedLanguages() {
ensureNotDisposed();
return _registry.getLoadedLanguages();
}
function loadLanguageSync(...langs2) {
ensureNotDisposed();
_registry.loadLanguages(langs2.flat(1));
}
async function loadLanguage(...langs2) {
return loadLanguageSync(await resolveLangs(langs2));
}
function loadThemeSync(...themes2) {
ensureNotDisposed();
for (const theme of themes2.flat(1)) {
_registry.loadTheme(theme);
}
}
async function loadTheme(...themes2) {
ensureNotDisposed();
return loadThemeSync(await resolveThemes(themes2));
}
function ensureNotDisposed() {
if (isDisposed)
throw new ShikiError$1("Shiki instance has been disposed");
}
function dispose() {
if (isDisposed)
return;
isDisposed = true;
_registry.dispose();
instancesCount -= 1;
}
return {
setTheme,
getTheme,
getLanguage,
getLoadedThemes,
getLoadedLanguages,
loadLanguage,
loadLanguageSync,
loadTheme,
loadThemeSync,
dispose,
[Symbol.dispose]: dispose
};
}
async function createShikiInternal(options) {
if (!options.engine) {
warnDeprecated("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
}
const [
themes,
langs,
engine
] = await Promise.all([
resolveThemes(options.themes || []),
resolveLangs(options.langs || []),
options.engine
]);
return createShikiInternalSync({
...options,
themes,
langs,
engine
});
}
async function createHighlighterCore(options) {
const internal = await createShikiInternal(options);
return {
getLastGrammarState: (...args) => getLastGrammarState(internal, ...args),
codeToTokensBase: (code3, options2) => codeToTokensBase(internal, code3, options2),
codeToTokensWithThemes: (code3, options2) => codeToTokensWithThemes(internal, code3, options2),
codeToTokens: (code3, options2) => codeToTokens(internal, code3, options2),
codeToHast: (code3, options2) => codeToHast(internal, code3, options2),
codeToHtml: (code3, options2) => codeToHtml(internal, code3, options2),
getBundledLanguages: () => ({}),
getBundledThemes: () => ({}),
...internal,
getInternalContext: () => internal
};
}
function createdBundledHighlighter(options) {
const bundledLanguages = options.langs;
const bundledThemes = options.themes;
const engine = options.engine;
async function createHighlighter(options2) {
function resolveLang(lang) {
var _a22;
if (typeof lang === "string") {
if (isSpecialLang(lang))
return [];
lang = ((_a22 = options2.langAlias) == null ? void 0 : _a22[lang]) || lang;
const bundle = bundledLanguages[lang];
if (!bundle)
throw new ShikiError$2(`Language \`${lang}\` is not included in this bundle. You may want to load it from external source.`);
return bundle;
}
return lang;
}
function resolveTheme(theme) {
if (isSpecialTheme(theme))
return "none";
if (typeof theme === "string") {
const bundle = bundledThemes[theme];
if (!bundle)
throw new ShikiError$2(`Theme \`${theme}\` is not included in this bundle. You may want to load it from external source.`);
return bundle;
}
return theme;
}
const _themes = (options2.themes ?? []).map((i) => resolveTheme(i));
const langs = (options2.langs ?? []).map((i) => resolveLang(i));
const core2 = await createHighlighterCore({
engine: options2.engine ?? engine(),
...options2,
themes: _themes,
langs
});
return {
...core2,
loadLanguage(...langs2) {
return core2.loadLanguage(...langs2.map(resolveLang));
},
loadTheme(...themes) {
return core2.loadTheme(...themes.map(resolveTheme));
},
getBundledLanguages() {
return bundledLanguages;
},
getBundledThemes() {
return bundledThemes;
}
};
}
return createHighlighter;
}
function makeSingletonHighlighter(createHighlighter) {
let _shiki;
async function getSingletonHighlighter(options = {}) {
if (!_shiki) {
_shiki = createHighlighter({
...options,
themes: options.themes || [],
langs: options.langs || []
});
return _shiki;
} else {
const s = await _shiki;
await Promise.all([
s.loadTheme(...options.themes || []),
s.loadLanguage(...options.langs || [])
]);
return s;
}
}
return getSingletonHighlighter;
}
function createSingletonShorthands(createHighlighter, config2) {
const getSingletonHighlighter = makeSingletonHighlighter(createHighlighter);
async function get2(code3, options) {
var _a22;
const shiki = await getSingletonHighlighter({
langs: [options.lang],
themes: "theme" in options ? [options.theme] : Object.values(options.themes)
});
const langs = await ((_a22 = config2 == null ? void 0 : config2.guessEmbeddedLanguages) == null ? void 0 : _a22.call(config2, code3, options.lang, shiki));
if (langs) {
await shiki.loadLanguage(...langs);
}
return shiki;
}
return {
getSingletonHighlighter(options) {
return getSingletonHighlighter(options);
},
async codeToHtml(code3, options) {
const shiki = await get2(code3, options);
return shiki.codeToHtml(code3, options);
},
async codeToHast(code3, options) {
const shiki = await get2(code3, options);
return shiki.codeToHast(code3, options);
},
async codeToTokens(code3, options) {
const shiki = await get2(code3, options);
return shiki.codeToTokens(code3, options);
},
async codeToTokensBase(code3, options) {
const shiki = await get2(code3, options);
return shiki.codeToTokensBase(code3, options);
},
async codeToTokensWithThemes(code3, options) {
const shiki = await get2(code3, options);
return shiki.codeToTokensWithThemes(code3, options);
},
async getLastGrammarState(code3, options) {
const shiki = await getSingletonHighlighter({
langs: [options.lang],
themes: [options.theme]
});
return shiki.getLastGrammarState(code3, options);
}
};
}
var ShikiError3 = class extends Error {
constructor(message) {
super(message);
this.name = "ShikiError";
}
};
function getHeapMax() {
return 2147483648;
}
function _emscripten_get_now() {
return typeof performance !== "undefined" ? performance.now() : Date.now();
}
var alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple;
async function main(init) {
let wasmMemory;
let buffer;
const binding = {};
function updateGlobalBufferAndViews(buf) {
buffer = buf;
binding.HEAPU8 = new Uint8Array(buf);
binding.HEAPU32 = new Uint32Array(buf);
}
function _emscripten_memcpy_big(dest, src, num) {
binding.HEAPU8.copyWithin(dest, src, src + num);
}
function emscripten_realloc_buffer(size) {
try {
wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16);
updateGlobalBufferAndViews(wasmMemory.buffer);
return 1;
} catch {
}
}
function _emscripten_resize_heap(requestedSize) {
const oldSize = binding.HEAPU8.length;
requestedSize = requestedSize >>> 0;
const maxHeapSize = getHeapMax();
if (requestedSize > maxHeapSize)
return false;
for (let cutDown = 1; cutDown <= 4; cutDown *= 2) {
let overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
const newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
const replacement = emscripten_realloc_buffer(newSize);
if (replacement)
return true;
}
return false;
}
const UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead = 1024) {
const endIdx = idx + maxBytesToRead;
let endPtr = idx;
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
}
let str = "";
while (idx < endPtr) {
let u0 = heapOrArray[idx++];
if (!(u0 & 128)) {
str += String.fromCharCode(u0);
continue;
}
const u1 = heapOrArray[idx++] & 63;
if ((u0 & 224) === 192) {
str += String.fromCharCode((u0 & 31) << 6 | u1);
continue;
}
const u2 = heapOrArray[idx++] & 63;
if ((u0 & 240) === 224) {
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
} else {
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
}
if (u0 < 65536) {
str += String.fromCharCode(u0);
} else {
const ch = u0 - 65536;
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
}
}
return str;
}
function UTF8ToString(ptr, maxBytesToRead) {
return ptr ? UTF8ArrayToString(binding.HEAPU8, ptr, maxBytesToRead) : "";
}
const asmLibraryArg = {
emscripten_get_now: _emscripten_get_now,
emscripten_memcpy_big: _emscripten_memcpy_big,
emscripten_resize_heap: _emscripten_resize_heap,
fd_write: () => 0
};
async function createWasm() {
const info = {
env: asmLibraryArg,
wasi_snapshot_preview1: asmLibraryArg
};
const exports = await init(info);
wasmMemory = exports.memory;
updateGlobalBufferAndViews(wasmMemory.buffer);
Object.assign(binding, exports);
binding.UTF8ToString = UTF8ToString;
}
await createWasm();
return binding;
}
var __defProp22 = Object.defineProperty;
var __defNormalProp22 = (obj, key2, value) => key2 in obj ? __defProp22(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
var __publicField22 = (obj, key2, value) => __defNormalProp22(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
var onigBinding = null;
function throwLastOnigError(onigBinding2) {
throw new ShikiError3(onigBinding2.UTF8ToString(onigBinding2.getLastOnigError()));
}
var UtfString = class _UtfString {
constructor(str) {
__publicField22(this, "utf16Length");
__publicField22(this, "utf8Length");
__publicField22(this, "utf16Value");
__publicField22(this, "utf8Value");
__publicField22(this, "utf16OffsetToUtf8");
__publicField22(this, "utf8OffsetToUtf16");
const utf16Length = str.length;
const utf8Length = _UtfString._utf8ByteLength(str);
const computeIndicesMapping = utf8Length !== utf16Length;
const utf16OffsetToUtf8 = computeIndicesMapping ? new Uint32Array(utf16Length + 1) : null;
if (computeIndicesMapping)
utf16OffsetToUtf8[utf16Length] = utf8Length;
const utf8OffsetToUtf16 = computeIndicesMapping ? new Uint32Array(utf8Length + 1) : null;
if (computeIndicesMapping)
utf8OffsetToUtf16[utf8Length] = utf16Length;
const utf8Value = new Uint8Array(utf8Length);
let i8 = 0;
for (let i16 = 0; i16 < utf16Length; i16++) {
const charCode = str.charCodeAt(i16);
let codePoint = charCode;
let wasSurrogatePair = false;
if (charCode >= 55296 && charCode <= 56319) {
if (i16 + 1 < utf16Length) {
const nextCharCode = str.charCodeAt(i16 + 1);
if (nextCharCode >= 56320 && nextCharCode <= 57343) {
codePoint = (charCode - 55296 << 10) + 65536 | nextCharCode - 56320;
wasSurrogatePair = true;
}
}
}
if (computeIndicesMapping) {
utf16OffsetToUtf8[i16] = i8;
if (wasSurrogatePair)
utf16OffsetToUtf8[i16 + 1] = i8;
if (codePoint <= 127) {
utf8OffsetToUtf16[i8 + 0] = i16;
} else if (codePoint <= 2047) {
utf8OffsetToUtf16[i8 + 0] = i16;
utf8OffsetToUtf16[i8 + 1] = i16;
} else if (codePoint <= 65535) {
utf8OffsetToUtf16[i8 + 0] = i16;
utf8OffsetToUtf16[i8 + 1] = i16;
utf8OffsetToUtf16[i8 + 2] = i16;
} else {
utf8OffsetToUtf16[i8 + 0] = i16;
utf8OffsetToUtf16[i8 + 1] = i16;
utf8OffsetToUtf16[i8 + 2] = i16;
utf8OffsetToUtf16[i8 + 3] = i16;
}
}
if (codePoint <= 127) {
utf8Value[i8++] = codePoint;
} else if (codePoint <= 2047) {
utf8Value[i8++] = 192 | (codePoint & 1984) >>> 6;
utf8Value[i8++] = 128 | (codePoint & 63) >>> 0;
} else if (codePoint <= 65535) {
utf8Value[i8++] = 224 | (codePoint & 61440) >>> 12;
utf8Value[i8++] = 128 | (codePoint & 4032) >>> 6;
utf8Value[i8++] = 128 | (codePoint & 63) >>> 0;
} else {
utf8Value[i8++] = 240 | (codePoint & 1835008) >>> 18;
utf8Value[i8++] = 128 | (codePoint & 258048) >>> 12;
utf8Value[i8++] = 128 | (codePoint & 4032) >>> 6;
utf8Value[i8++] = 128 | (codePoint & 63) >>> 0;
}
if (wasSurrogatePair)
i16++;
}
this.utf16Length = utf16Length;
this.utf8Length = utf8Length;
this.utf16Value = str;
this.utf8Value = utf8Value;
this.utf16OffsetToUtf8 = utf16OffsetToUtf8;
this.utf8OffsetToUtf16 = utf8OffsetToUtf16;
}
static _utf8ByteLength(str) {
let result = 0;
for (let i = 0, len = str.length; i < len; i++) {
const charCode = str.charCodeAt(i);
let codepoint = charCode;
let wasSurrogatePair = false;
if (charCode >= 55296 && charCode <= 56319) {
if (i + 1 < len) {
const nextCharCode = str.charCodeAt(i + 1);
if (nextCharCode >= 56320 && nextCharCode <= 57343) {
codepoint = (charCode - 55296 << 10) + 65536 | nextCharCode - 56320;
wasSurrogatePair = true;
}
}
}
if (codepoint <= 127)
result += 1;
else if (codepoint <= 2047)
result += 2;
else if (codepoint <= 65535)
result += 3;
else
result += 4;
if (wasSurrogatePair)
i++;
}
return result;
}
createString(onigBinding2) {
const result = onigBinding2.omalloc(this.utf8Length);
onigBinding2.HEAPU8.set(this.utf8Value, result);
return result;
}
};
var _OnigString = class _OnigString2 {
constructor(str) {
__publicField22(this, "id", ++_OnigString2.LAST_ID);
__publicField22(this, "_onigBinding");
__publicField22(this, "content");
__publicField22(this, "utf16Length");
__publicField22(this, "utf8Length");
__publicField22(this, "utf16OffsetToUtf8");
__publicField22(this, "utf8OffsetToUtf16");
__publicField22(this, "ptr");
if (!onigBinding)
throw new ShikiError3("Must invoke loadWasm first.");
this._onigBinding = onigBinding;
this.content = str;
const utfString = new UtfString(str);
this.utf16Length = utfString.utf16Length;
this.utf8Length = utfString.utf8Length;
this.utf16OffsetToUtf8 = utfString.utf16OffsetToUtf8;
this.utf8OffsetToUtf16 = utfString.utf8OffsetToUtf16;
if (this.utf8Length < 1e4 && !_OnigString2._sharedPtrInUse) {
if (!_OnigString2._sharedPtr)
_OnigString2._sharedPtr = onigBinding.omalloc(1e4);
_OnigString2._sharedPtrInUse = true;
onigBinding.HEAPU8.set(utfString.utf8Value, _OnigString2._sharedPtr);
this.ptr = _OnigString2._sharedPtr;
} else {
this.ptr = utfString.createString(onigBinding);
}
}
convertUtf8OffsetToUtf16(utf8Offset) {
if (this.utf8OffsetToUtf16) {
if (utf8Offset < 0)
return 0;
if (utf8Offset > this.utf8Length)
return this.utf16Length;
return this.utf8OffsetToUtf16[utf8Offset];
}
return utf8Offset;
}
convertUtf16OffsetToUtf8(utf16Offset) {
if (this.utf16OffsetToUtf8) {
if (utf16Offset < 0)
return 0;
if (utf16Offset > this.utf16Length)
return this.utf8Length;
return this.utf16OffsetToUtf8[utf16Offset];
}
return utf16Offset;
}
dispose() {
if (this.ptr === _OnigString2._sharedPtr)
_OnigString2._sharedPtrInUse = false;
else
this._onigBinding.ofree(this.ptr);
}
};
__publicField22(_OnigString, "LAST_ID", 0);
__publicField22(_OnigString, "_sharedPtr", 0);
__publicField22(_OnigString, "_sharedPtrInUse", false);
var OnigString = _OnigString;
var OnigScanner = class {
constructor(patterns) {
__publicField22(this, "_onigBinding");
__publicField22(this, "_ptr");
if (!onigBinding)
throw new ShikiError3("Must invoke loadWasm first.");
const strPtrsArr = [];
const strLenArr = [];
for (let i = 0, len = patterns.length; i < len; i++) {
const utfString = new UtfString(patterns[i]);
strPtrsArr[i] = utfString.createString(onigBinding);
strLenArr[i] = utfString.utf8Length;
}
const strPtrsPtr = onigBinding.omalloc(4 * patterns.length);
onigBinding.HEAPU32.set(strPtrsArr, strPtrsPtr / 4);
const strLenPtr = onigBinding.omalloc(4 * patterns.length);
onigBinding.HEAPU32.set(strLenArr, strLenPtr / 4);
const scannerPtr = onigBinding.createOnigScanner(strPtrsPtr, strLenPtr, patterns.length);
for (let i = 0, len = patterns.length; i < len; i++)
onigBinding.ofree(strPtrsArr[i]);
onigBinding.ofree(strLenPtr);
onigBinding.ofree(strPtrsPtr);
if (scannerPtr === 0)
throwLastOnigError(onigBinding);
this._onigBinding = onigBinding;
this._ptr = scannerPtr;
}
dispose() {
this._onigBinding.freeOnigScanner(this._ptr);
}
findNextMatchSync(string, startPosition, arg) {
let options = 0;
if (typeof arg === "number") {
options = arg;
}
if (typeof string === "string") {
string = new OnigString(string);
const result = this._findNextMatchSync(string, startPosition, false, options);
string.dispose();
return result;
}
return this._findNextMatchSync(string, startPosition, false, options);
}
_findNextMatchSync(string, startPosition, debugCall, options) {
const onigBinding2 = this._onigBinding;
const resultPtr = onigBinding2.findNextOnigScannerMatch(this._ptr, string.id, string.ptr, string.utf8Length, string.convertUtf16OffsetToUtf8(startPosition), options);
if (resultPtr === 0) {
return null;
}
const HEAPU32 = onigBinding2.HEAPU32;
let offset = resultPtr / 4;
const index = HEAPU32[offset++];
const count = HEAPU32[offset++];
const captureIndices = [];
for (let i = 0; i < count; i++) {
const beg = string.convertUtf8OffsetToUtf16(HEAPU32[offset++]);
const end = string.convertUtf8OffsetToUtf16(HEAPU32[offset++]);
captureIndices[i] = {
start: beg,
end,
length: end - beg
};
}
return {
index,
captureIndices
};
}
};
function isInstantiatorOptionsObject(dataOrOptions) {
return typeof dataOrOptions.instantiator === "function";
}
function isInstantiatorModule(dataOrOptions) {
return typeof dataOrOptions.default === "function";
}
function isDataOptionsObject(dataOrOptions) {
return typeof dataOrOptions.data !== "undefined";
}
function isResponse(dataOrOptions) {
return typeof Response !== "undefined" && dataOrOptions instanceof Response;
}
function isArrayBuffer(data) {
var _a22;
return typeof ArrayBuffer !== "undefined" && (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) || typeof Buffer !== "undefined" && ((_a22 = Buffer.isBuffer) == null ? void 0 : _a22.call(Buffer, data)) || typeof SharedArrayBuffer !== "undefined" && data instanceof SharedArrayBuffer || typeof Uint32Array !== "undefined" && data instanceof Uint32Array;
}
var initPromise;
function loadWasm(options) {
if (initPromise)
return initPromise;
async function _load() {
onigBinding = await main(async (info) => {
let instance = options;
instance = await instance;
if (typeof instance === "function")
instance = await instance(info);
if (typeof instance === "function")
instance = await instance(info);
if (isInstantiatorOptionsObject(instance)) {
instance = await instance.instantiator(info);
} else if (isInstantiatorModule(instance)) {
instance = await instance.default(info);
} else {
if (isDataOptionsObject(instance))
instance = instance.data;
if (isResponse(instance)) {
if (typeof WebAssembly.instantiateStreaming === "function")
instance = await _makeResponseStreamingLoader(instance)(info);
else
instance = await _makeResponseNonStreamingLoader(instance)(info);
} else if (isArrayBuffer(instance)) {
instance = await _makeArrayBufferLoader(instance)(info);
} else if (instance instanceof WebAssembly.Module) {
instance = await _makeArrayBufferLoader(instance)(info);
} else if ("default" in instance && instance.default instanceof WebAssembly.Module) {
instance = await _makeArrayBufferLoader(instance.default)(info);
}
}
if ("instance" in instance)
instance = instance.instance;
if ("exports" in instance)
instance = instance.exports;
return instance;
});
}
initPromise = _load();
return initPromise;
}
function _makeArrayBufferLoader(data) {
return (importObject) => WebAssembly.instantiate(data, importObject);
}
function _makeResponseStreamingLoader(data) {
return (importObject) => WebAssembly.instantiateStreaming(data, importObject);
}
function _makeResponseNonStreamingLoader(data) {
return async (importObject) => {
const arrayBuffer = await data.arrayBuffer();
return WebAssembly.instantiate(arrayBuffer, importObject);
};
}
async function createOnigurumaEngine(options) {
if (options)
await loadWasm(options);
return {
createScanner(patterns) {
return new OnigScanner(patterns.map((p2) => typeof p2 === "string" ? p2 : p2.source));
},
createString(s) {
return new OnigString(s);
}
};
}
var _ShikiManager = class _ShikiManager2 {
constructor() {
__publicField2(this, "shikiInstance", null);
}
static getInstance() {
if (!_ShikiManager2.instance) {
_ShikiManager2.instance = new _ShikiManager2();
}
return _ShikiManager2.instance;
}
getShiki() {
if (this.shikiInstance) return this.shikiInstance;
const highlighterFactory = createdBundledHighlighter({
langs: languageLoaders,
themes: themeLoaders,
engine: () => createOnigurumaEngine(import("./wasm-DDgzZJey-2I2AXXYP.js"))
});
const {
codeToHtml: codeToHtml2,
codeToHast: codeToHast2,
codeToTokensBase: codeToTokensBase2,
codeToTokens: codeToTokens2,
codeToTokensWithThemes: codeToTokensWithThemes2,
getSingletonHighlighter,
getLastGrammarState: getLastGrammarState2
} = createSingletonShorthands(highlighterFactory);
this.shikiInstance = {
codeToHtml: codeToHtml2,
codeToHast: codeToHast2,
codeToTokensBase: codeToTokensBase2,
codeToTokens: codeToTokens2,
codeToTokensWithThemes: codeToTokensWithThemes2,
getSingletonHighlighter,
getLastGrammarState: getLastGrammarState2
};
return this.shikiInstance;
}
dispose() {
this.shikiInstance = null;
_ShikiManager2.instance = null;
}
};
__publicField2(_ShikiManager, "instance", null);
var ShikiManager = _ShikiManager;
var globalShikiInstance;
var globalShikiManager;
var referenceCount = 0;
var shikiIsCreated = ref(false);
var shikiInstance = ref();
var shikiManager = ref();
function useShiki() {
referenceCount++;
onUnmounted(() => {
var _a22;
referenceCount--;
if (referenceCount === 0) {
shikiIsCreated.value = false;
shikiInstance.value = void 0;
(_a22 = shikiManager.value) == null ? void 0 : _a22.dispose();
globalShikiManager == null ? void 0 : globalShikiManager.dispose();
globalShikiInstance = void 0;
globalShikiManager = void 0;
}
});
if (!globalShikiInstance) {
globalShikiManager = ShikiManager.getInstance();
globalShikiInstance = globalShikiManager.getShiki();
shikiManager.value = globalShikiManager;
shikiInstance.value = globalShikiInstance;
provide(GLOBAL_SHIKI_KEY, shikiInstance);
shikiIsCreated.value = true;
} else {
shikiManager.value = globalShikiManager;
shikiInstance.value = globalShikiInstance;
provide(GLOBAL_SHIKI_KEY, shikiInstance);
}
return globalShikiInstance;
}
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/ThoughtChain/index.js
var emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray(value);
var collapseProps = buildProps({
accordion: Boolean,
modelValue: {
type: definePropType([Array, String, Number]),
default: () => mutable([])
},
expandIconPosition: {
type: definePropType([String]),
default: "right"
},
beforeCollapse: {
type: definePropType(Function)
}
});
var collapseEmits = {
[UPDATE_MODEL_EVENT]: emitChangeFn,
[CHANGE_EVENT]: emitChangeFn
};
var collapseContextKey = Symbol("collapseContextKey");
var SCOPE2 = "ElCollapse";
var useCollapse = (props, emit) => {
const activeNames = ref(castArray(props.modelValue));
const setActiveNames = (_activeNames) => {
activeNames.value = _activeNames;
const value = props.accordion ? activeNames.value[0] : activeNames.value;
emit(UPDATE_MODEL_EVENT, value);
emit(CHANGE_EVENT, value);
};
const handleChange = (name) => {
if (props.accordion) {
setActiveNames([activeNames.value[0] === name ? "" : name]);
} else {
const _activeNames = [...activeNames.value];
const index = _activeNames.indexOf(name);
if (index > -1) {
_activeNames.splice(index, 1);
} else {
_activeNames.push(name);
}
setActiveNames(_activeNames);
}
};
const handleItemClick = async (name) => {
const { beforeCollapse } = props;
if (!beforeCollapse) {
handleChange(name);
return;
}
const shouldChange = beforeCollapse(name);
const isPromiseOrBool = [
isPromise(shouldChange),
isBoolean(shouldChange)
].includes(true);
if (!isPromiseOrBool) {
throwError(SCOPE2, "beforeCollapse must return type `Promise` or `boolean`");
}
if (isPromise(shouldChange)) {
shouldChange.then((result) => {
if (result !== false) {
handleChange(name);
}
}).catch((e) => {
});
} else if (shouldChange) {
handleChange(name);
}
};
watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
provide(collapseContextKey, {
activeNames,
handleItemClick
});
return {
activeNames,
setActiveNames
};
};
var useCollapseDOM = (props) => {
const ns = useNamespace("collapse");
const rootKls = computed(() => [
ns.b(),
ns.b(`icon-position-${props.expandIconPosition}`)
]);
return {
rootKls
};
};
var __default__$33 = defineComponent({
name: "ElCollapse"
});
var _sfc_main$48 = defineComponent({
...__default__$33,
props: collapseProps,
emits: collapseEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { activeNames, setActiveNames } = useCollapse(props, emit);
const { rootKls } = useCollapseDOM(props);
expose({
activeNames,
setActiveNames
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(rootKls))
}, [
renderSlot(_ctx.$slots, "default")
], 2);
};
}
});
var Collapse = _export_sfc(_sfc_main$48, [["__file", "collapse.vue"]]);
var __default__$23 = defineComponent({
name: "ElCollapseTransition"
});
var _sfc_main$38 = defineComponent({
...__default__$23,
setup(__props) {
const ns = useNamespace("collapse-transition");
const reset = (el) => {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
};
const on2 = {
beforeEnter(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
if (el.style.height)
el.dataset.elExistsHeight = el.style.height;
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
},
enter(el) {
requestAnimationFrame(() => {
el.dataset.oldOverflow = el.style.overflow;
if (el.dataset.elExistsHeight) {
el.style.maxHeight = el.dataset.elExistsHeight;
} else if (el.scrollHeight !== 0) {
el.style.maxHeight = `${el.scrollHeight}px`;
} else {
el.style.maxHeight = 0;
}
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
el.style.overflow = "hidden";
});
},
afterEnter(el) {
el.style.maxHeight = "";
el.style.overflow = el.dataset.oldOverflow;
},
enterCancelled(el) {
reset(el);
},
beforeLeave(el) {
if (!el.dataset)
el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldOverflow = el.style.overflow;
el.style.maxHeight = `${el.scrollHeight}px`;
el.style.overflow = "hidden";
},
leave(el) {
if (el.scrollHeight !== 0) {
el.style.maxHeight = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
}
},
afterLeave(el) {
reset(el);
},
leaveCancelled(el) {
reset(el);
}
};
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, mergeProps({
name: unref(ns).b()
}, toHandlers(on2)), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["name"]);
};
}
});
var CollapseTransition = _export_sfc(_sfc_main$38, [["__file", "collapse-transition.vue"]]);
var ElCollapseTransition = withInstall(CollapseTransition);
var collapseItemProps = buildProps({
title: {
type: String,
default: ""
},
name: {
type: definePropType([String, Number]),
default: void 0
},
icon: {
type: iconPropType,
default: arrow_right_default
},
disabled: Boolean
});
var useCollapseItem = (props) => {
const collapse = inject(collapseContextKey);
const { namespace } = useNamespace("collapse");
const focusing = ref(false);
const isClick = ref(false);
const idInjection = useIdInjection();
const id = computed(() => idInjection.current++);
const name = computed(() => {
var _a3;
return (_a3 = props.name) != null ? _a3 : `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
});
const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(unref(name)));
const handleFocus = () => {
setTimeout(() => {
if (!isClick.value) {
focusing.value = true;
} else {
isClick.value = false;
}
}, 50);
};
const handleHeaderClick = (e) => {
if (props.disabled)
return;
const target = e.target;
if (target == null ? void 0 : target.closest("input, textarea, select"))
return;
collapse == null ? void 0 : collapse.handleItemClick(unref(name));
focusing.value = false;
isClick.value = true;
};
const handleEnterClick = (e) => {
const target = e.target;
if (target == null ? void 0 : target.closest("input, textarea, select"))
return;
e.preventDefault();
collapse == null ? void 0 : collapse.handleItemClick(unref(name));
};
return {
focusing,
id,
isActive,
handleFocus,
handleHeaderClick,
handleEnterClick
};
};
var useCollapseItemDOM = (props, { focusing, isActive, id }) => {
const ns = useNamespace("collapse");
const rootKls = computed(() => [
ns.b("item"),
ns.is("active", unref(isActive)),
ns.is("disabled", props.disabled)
]);
const headKls = computed(() => [
ns.be("item", "header"),
ns.is("active", unref(isActive)),
{ focusing: unref(focusing) && !props.disabled }
]);
const arrowKls = computed(() => [
ns.be("item", "arrow"),
ns.is("active", unref(isActive))
]);
const itemTitleKls = computed(() => [ns.be("item", "title")]);
const itemWrapperKls = computed(() => ns.be("item", "wrap"));
const itemContentKls = computed(() => ns.be("item", "content"));
const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
return {
itemTitleKls,
arrowKls,
headKls,
rootKls,
itemWrapperKls,
itemContentKls,
scopedContentId,
scopedHeadId
};
};
var __default__$15 = defineComponent({
name: "ElCollapseItem"
});
var _sfc_main$28 = defineComponent({
...__default__$15,
props: collapseItemProps,
setup(__props, { expose }) {
const props = __props;
const {
focusing,
id,
isActive,
handleFocus,
handleHeaderClick,
handleEnterClick
} = useCollapseItem(props);
const {
arrowKls,
headKls,
rootKls,
itemTitleKls,
itemWrapperKls,
itemContentKls,
scopedContentId,
scopedHeadId
} = useCollapseItemDOM(props, { focusing, isActive, id });
expose({
isActive
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(unref(rootKls))
}, [
createBaseVNode("div", {
id: unref(scopedHeadId),
class: normalizeClass(unref(headKls)),
"aria-expanded": unref(isActive),
"aria-controls": unref(scopedContentId),
"aria-describedby": unref(scopedContentId),
tabindex: _ctx.disabled ? -1 : 0,
role: "button",
onClick: unref(handleHeaderClick),
onKeydown: withKeys(withModifiers(unref(handleEnterClick), ["stop"]), ["space", "enter"]),
onFocus: unref(handleFocus),
onBlur: ($event) => focusing.value = false
}, [
createBaseVNode("span", {
class: normalizeClass(unref(itemTitleKls))
}, [
renderSlot(_ctx.$slots, "title", { isActive: unref(isActive) }, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
], 2),
renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [
createVNode(unref(ElIcon), {
class: normalizeClass(unref(arrowKls))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
}, 8, ["class"])
])
], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
createVNode(unref(ElCollapseTransition), null, {
default: withCtx(() => [
withDirectives(createBaseVNode("div", {
id: unref(scopedContentId),
role: "region",
class: normalizeClass(unref(itemWrapperKls)),
"aria-hidden": !unref(isActive),
"aria-labelledby": unref(scopedHeadId)
}, [
createBaseVNode("div", {
class: normalizeClass(unref(itemContentKls))
}, [
renderSlot(_ctx.$slots, "default")
], 2)
], 10, ["id", "aria-hidden", "aria-labelledby"]), [
[vShow, unref(isActive)]
])
]),
_: 3
})
], 2);
};
}
});
var CollapseItem = _export_sfc(_sfc_main$28, [["__file", "collapse-item.vue"]]);
var ElCollapse = withInstall(Collapse, {
CollapseItem
});
var ElCollapseItem = withNoopInstall(CollapseItem);
var TIMELINE_INJECTION_KEY = "timeline";
var Timeline = defineComponent({
name: "ElTimeline",
setup(_, { slots }) {
const ns = useNamespace("timeline");
provide(TIMELINE_INJECTION_KEY, slots);
return () => {
return h("ul", { class: [ns.b()] }, [renderSlot(slots, "default")]);
};
}
});
var timelineItemProps = buildProps({
timestamp: {
type: String,
default: ""
},
hideTimestamp: Boolean,
center: Boolean,
placement: {
type: String,
values: ["top", "bottom"],
default: "bottom"
},
type: {
type: String,
values: ["primary", "success", "warning", "danger", "info"],
default: ""
},
color: {
type: String,
default: ""
},
size: {
type: String,
values: ["normal", "large"],
default: "normal"
},
icon: {
type: iconPropType
},
hollow: Boolean
});
var __default__9 = defineComponent({
name: "ElTimelineItem"
});
var _sfc_main$111 = defineComponent({
...__default__9,
props: timelineItemProps,
setup(__props) {
const props = __props;
const ns = useNamespace("timeline-item");
const defaultNodeKls = computed(() => [
ns.e("node"),
ns.em("node", props.size || ""),
ns.em("node", props.type || ""),
ns.is("hollow", props.hollow)
]);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("li", {
class: normalizeClass([unref(ns).b(), { [unref(ns).e("center")]: _ctx.center }])
}, [
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("tail"))
}, null, 2),
!_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(unref(defaultNodeKls)),
style: normalizeStyle({
backgroundColor: _ctx.color
})
}, [
_ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).e("icon"))
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)
], 6)) : createCommentVNode("v-if", true),
_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).e("dot"))
}, [
renderSlot(_ctx.$slots, "dot")
], 2)) : createCommentVNode("v-if", true),
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("wrapper"))
}, [
!_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
}, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
createBaseVNode("div", {
class: normalizeClass(unref(ns).e("content"))
}, [
renderSlot(_ctx.$slots, "default")
], 2),
!_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
}, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
], 2)
], 2);
};
}
});
var TimelineItem = _export_sfc(_sfc_main$111, [["__file", "timeline-item.vue"]]);
var ElTimeline = withInstall(Timeline, {
TimelineItem
});
var ElTimelineItem = withNoopInstall(TimelineItem);
var _hoisted_112 = { class: "el-thought-chain" };
var _hoisted_210 = { key: 0 };
var _sfc_main18 = defineComponent({
__name: "index",
props: {
thinkingItems: { default: () => [] },
rowKey: { default: "id" },
titleKey: { default: "title" },
thinkTitleKey: { default: "thinkTitle" },
thinkContentKey: { default: "thinkContent" },
statusKey: { default: "status" },
dotBackgroundColor: {},
dotSize: { default: "default" },
maxWidth: { default: "600px" },
lineGradient: { type: Boolean, default: false }
},
emits: ["handleExpand"],
setup(__props, { emit: __emit }) {
useCssVars((_ctx) => ({
"03c46b3e": dotMargin.value
}));
const props = __props;
const emits = __emit;
const defaultDotBackgroundColor = {
loading: "#e6a23c",
success: "#67c23a",
error: "#f56c6c"
};
const dotMargin = computed(() => {
switch (props.dotSize) {
case "small":
return "-4px 0 0 -7px";
case "large":
return "-11px 0 0 -15px";
default:
return "-8px 0 0 -11px";
}
});
const timelineRef = ref();
function getNodeBtnColor(item) {
const _type_ = getType(item);
if (_type_) {
return props.dotBackgroundColor ? props.dotBackgroundColor[_type_] : defaultDotBackgroundColor[_type_];
}
return "";
}
const getLineColor = computed(() => {
if (props.thinkingItems.length) {
const arr = props.thinkingItems.map((item) => {
const _type_ = getType(item);
if (_type_) {
return props.dotBackgroundColor ? props.dotBackgroundColor[_type_] : defaultDotBackgroundColor[_type_];
}
return "";
});
return arr;
}
return [];
});
const activeNamesComputed = computed(
() => props.thinkingItems.filter((item) => item.isCanExpand && item.isDefaultExpand).map((item) => String(getId(item)))
);
const defaultActiveNodes = ref([...activeNamesComputed.value]);
function handleExpand(item) {
emits("handleExpand", item);
}
function setRadialGradient(colors, ele) {
const length = ele.length;
Array.from(ele).forEach((item, index) => {
const line = item.children[0];
if (line) {
if (colors.length > 0) {
line.setAttribute(
"style",
`
border: none;
width:2px;
background: linear-gradient(to bottom, ${colors[index]} 0% , ${colors[index < length ? index + 1 : index]} 100%);`
);
} else {
line.setAttribute("style", ``);
}
}
});
}
function getEle() {
if (getLineColor.value && timelineRef.value && props.lineGradient) {
const ele = timelineRef.value.$el.children[0].children;
setRadialGradient(getLineColor.value, ele);
} else if (getLineColor.value && timelineRef.value && !props.lineGradient) {
const ele = timelineRef.value.$el.children[0].children;
setRadialGradient([], ele);
}
}
function isLoading(item) {
const status = getStatus(item);
return status === "loading";
}
function isError(item) {
const status = getStatus(item);
return status === "error";
}
function getId(item) {
return get(item, props.rowKey);
}
function getType(item) {
const status = getStatus(item);
return status ?? "success";
}
function getTitle(item) {
return get(item, props.titleKey) ?? "";
}
function getThinkTitle(item) {
return get(item, props.thinkTitleKey) ?? "";
}
function getThinkContent(item) {
return get(item, props.thinkContentKey) ?? "";
}
function getStatus(item) {
return get(item, props.statusKey);
}
watch(
() => activeNamesComputed.value,
(v) => {
defaultActiveNodes.value = [...v];
}
);
watch(
() => [getLineColor.value, props.lineGradient],
() => {
getEle();
}
);
onMounted(() => {
getEle();
});
return (_ctx, _cache) => {
const _component_el_collapse_item = ElCollapseItem;
const _component_el_collapse = ElCollapse;
const _component_el_icon = ElIcon;
const _component_el_button = ElButton;
const _component_el_timeline_item = ElTimelineItem;
const _component_el_timeline = ElTimeline;
return openBlock(), createElementBlock("div", _hoisted_112, [
createVNode(_component_el_timeline, {
ref_key: "timelineRef",
ref: timelineRef,
style: normalizeStyle({
maxWidth: `${_ctx.maxWidth}`
})
}, {
default: withCtx(() => [
createVNode(TransitionGroup, {
name: "thought-chain",
tag: "el-timeline-item"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(props.thinkingItems, (item) => {
return openBlock(), createBlock(_component_el_timeline_item, {
key: getId(item),
timestamp: getTitle(item),
"hide-timestamp": item.hideTitle,
placement: item.placement ?? "top"
}, {
dot: withCtx(() => [
createBaseVNode("div", {
class: normalizeClass({ "el-thought-chain-item-dot": !_ctx.$slots.icon }),
style: { "position": "relative" }
}, [
renderSlot(_ctx.$slots, "icon", { item }, () => [
createVNode(_component_el_button, {
circle: "",
loading: isLoading(item),
size: props.dotSize,
style: normalizeStyle({
"--custom-background-color": getNodeBtnColor(item),
"--custom-border-color": getNodeBtnColor(item),
backgroundColor: getNodeBtnColor(item),
borderColor: getNodeBtnColor(item)
})
}, {
loading: withCtx(() => [
createVNode(_component_el_icon, { class: "thought-chain-loading" }, {
default: withCtx(() => [
createVNode(unref(loading_default))
]),
_: 1
})
]),
icon: withCtx(() => [
!isLoading(item) ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
default: withCtx(() => [
isError(item) ? (openBlock(), createBlock(unref(close_default), { key: 0 })) : (openBlock(), createBlock(unref(check_default), { key: 1 }))
]),
_: 2
}, 1024)) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["loading", "size", "style"])
], true)
], 2)
]),
default: withCtx(() => [
!item.isCanExpand ? (openBlock(), createElementBlock("div", _hoisted_210, [
createVNode(unref(Typewriter), {
content: getThinkTitle(item),
"is-markdown": item.isMarkdown,
typing: item.typing
}, null, 8, ["content", "is-markdown", "typing"])
])) : !item.isDefaultExpand ? (openBlock(), createBlock(_component_el_collapse, {
key: 1,
onChange: ($event) => handleExpand(item)
}, {
default: withCtx(() => [
createVNode(_component_el_collapse_item, {
title: getThinkTitle(item)
}, {
default: withCtx(() => [
createVNode(unref(Typewriter), {
content: getThinkContent(item),
"is-markdown": item.isMarkdown,
typing: item.typing
}, null, 8, ["content", "is-markdown", "typing"])
]),
_: 2
}, 1032, ["title"])
]),
_: 2
}, 1032, ["onChange"])) : item.isDefaultExpand ? (openBlock(), createBlock(_component_el_collapse, {
key: 2,
modelValue: defaultActiveNodes.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => defaultActiveNodes.value = $event),
onChange: ($event) => handleExpand(item)
}, {
default: withCtx(() => [
createVNode(_component_el_collapse_item, {
title: getThinkTitle(item),
name: String(getId(item))
}, {
default: withCtx(() => [
createVNode(unref(Typewriter), {
content: getThinkContent(item),
"is-markdown": item.isMarkdown,
typing: item.typing
}, null, 8, ["content", "is-markdown", "typing"])
]),
_: 2
}, 1032, ["title", "name"])
]),
_: 2
}, 1032, ["modelValue", "onChange"])) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["timestamp", "hide-timestamp", "placement"]);
}), 128))
]),
_: 3
})
]),
_: 3
}, 8, ["style"])
]);
};
}
});
var ThoughtChain = _export_sfc2(_sfc_main18, [["__scopeId", "data-v-5de7a0b5"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/Welcome/index.js
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/style4.css";
import "D:/guoan/aiflowy-ui-admin/node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/el-image-viewer.css";
var _hoisted_113 = { class: "content-wrapper" };
var _hoisted_211 = {
key: 0,
class: "title-wrapper"
};
var _sfc_main19 = defineComponent({
__name: "index",
props: {
prefixCls: {},
rootClassName: {},
className: {},
style: {},
variant: { default: "filled" },
classNames: {},
styles: {},
icon: {},
title: {},
description: {},
extra: {},
direction: { default: "ltr" }
},
setup(__props) {
const props = __props;
const solts = useSlots();
const {
prefixCls,
className,
rootClassName,
variant,
direction,
classNames,
icon,
title,
extra,
description,
style,
styles
} = toRefs(props);
function getContainerClass() {
return [
prefixCls.value || "welcome",
className.value,
rootClassName.value,
`welcome-${variant.value}`,
{
"welcome-rtl": direction.value === "rtl"
}
];
}
const getIconClass = () => {
var _a3;
return (_a3 = classNames.value) == null ? void 0 : _a3.icon;
};
const getTitleClass = () => {
var _a3;
return (_a3 = classNames.value) == null ? void 0 : _a3.title;
};
const getExtraClass = () => {
var _a3;
return (_a3 = classNames.value) == null ? void 0 : _a3.extra;
};
const getDescriptionClass = () => {
var _a3;
return (_a3 = classNames.value) == null ? void 0 : _a3.description;
};
const hasIcon = computed(() => !!icon.value);
const hasTitleOrExtra = computed(() => !!title.value || !!extra.value);
const hasExtraOrSlot = computed(() => !!extra.value || !!solts.extra);
const hasDescription = computed(() => !!description.value);
const containerClass = computed(getContainerClass);
const iconClass = computed(getIconClass);
const titleClass = computed(getTitleClass);
const extraClass = computed(getExtraClass);
const descriptionClass = computed(getDescriptionClass);
return (_ctx, _cache) => {
var _a3, _b2, _c;
const _component_el_image = ElImage;
return openBlock(), createElementBlock("div", {
class: normalizeClass([unref(containerClass), "welcome-container"]),
style: normalizeStyle(unref(style))
}, [
renderSlot(_ctx.$slots, "image", {}, () => {
var _a22;
return [
unref(hasIcon) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(iconClass), "welcome-icon"]),
style: normalizeStyle((_a22 = unref(styles)) == null ? void 0 : _a22.icon)
}, [
createVNode(_component_el_image, {
src: unref(icon),
class: "icon-image"
}, null, 8, ["src"])
], 6)) : createCommentVNode("", true)
];
}, true),
createBaseVNode("div", _hoisted_113, [
unref(hasTitleOrExtra) ? (openBlock(), createElementBlock("div", _hoisted_211, [
unref(title) ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(titleClass), "welcome-title"]),
style: normalizeStyle((_a3 = unref(styles)) == null ? void 0 : _a3.title)
}, toDisplayString(unref(title)), 7)) : createCommentVNode("", true),
unref(hasExtraOrSlot) ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(extraClass), "welcome-extra"]),
style: normalizeStyle((_b2 = unref(styles)) == null ? void 0 : _b2.extra)
}, [
renderSlot(_ctx.$slots, "extra", {}, () => [
createTextVNode(toDisplayString(unref(extra)), 1)
], true)
], 6)) : createCommentVNode("", true)
])) : createCommentVNode("", true),
unref(hasDescription) ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(descriptionClass), "welcome-description"]),
style: normalizeStyle((_c = unref(styles)) == null ? void 0 : _c.description)
}, toDisplayString(unref(description)), 7)) : createCommentVNode("", true)
])
], 6);
};
}
});
var Welcome = _export_sfc2(_sfc_main19, [["__scopeId", "data-v-0813bb51"]]);
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index.vue_vue_type_script_setup_true_lang-QF5VL6Wr.js
var _hoisted_114 = { class: "elx-xmarkdown-container" };
var _sfc_main20 = defineComponent({
__name: "index",
props: mergeDefaults({
allowHtml: { type: Boolean },
enableCodeLineNumber: { type: Boolean },
enableLatex: { type: Boolean },
enableBreaks: { type: Boolean },
codeXRender: {},
codeXSlot: {},
codeHighlightTheme: {},
remarkPluginsAhead: {},
rehypePluginsAhead: {},
defaultThemeMode: {},
needViewCodeBtn: { type: Boolean },
secureViewCode: { type: Boolean },
viewCodeModalOptions: {},
mermaidConfig: {},
langs: {},
themes: {},
colorReplacements: {},
markdown: {},
customAttrs: {},
remarkPlugins: {},
rehypePlugins: {},
sanitize: { type: Boolean },
sanitizeOptions: {},
rehypeOptions: {}
}, DEFAULT_PROPS),
setup(__props) {
const props = __props;
const slots = useSlots();
const customComponents = useMarkdownContext();
const colorReplacementsComputed = computed(() => {
return props.colorReplacements;
});
const needViewCodeBtnComputed = computed(() => {
return props.needViewCodeBtn;
});
useShiki();
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_114, [
createVNode(unref(MarkdownRenderer), mergeProps(props, {
"color-replacements": unref(colorReplacementsComputed),
"need-view-code-btn": unref(needViewCodeBtnComputed)
}), createSlots({ _: 2 }, [
renderList(unref(customComponents), (slot, name) => {
return {
name,
fn: withCtx((slotProps) => [
(openBlock(), createBlock(resolveDynamicComponent(slot), normalizeProps(guardReactiveProps(slotProps)), null, 16))
])
};
}),
renderList(unref(slots), (_, name) => {
return {
name,
fn: withCtx((slotProps) => [
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
])
};
})
]), 1040, ["color-replacements", "need-view-code-btn"])
]);
};
}
});
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/index.vue_vue_type_script_setup_true_lang--mQmvbDZ.js
var _hoisted_115 = { class: "elx-xmarkdown-container" };
var _sfc_main21 = defineComponent({
__name: "index",
props: mergeDefaults({
allowHtml: { type: Boolean },
enableCodeLineNumber: { type: Boolean },
enableLatex: { type: Boolean },
enableBreaks: { type: Boolean },
codeXRender: {},
codeXSlot: {},
codeHighlightTheme: {},
remarkPluginsAhead: {},
rehypePluginsAhead: {},
defaultThemeMode: {},
needViewCodeBtn: { type: Boolean },
secureViewCode: { type: Boolean },
viewCodeModalOptions: {},
mermaidConfig: {},
langs: {},
themes: {},
colorReplacements: {},
markdown: {},
customAttrs: {},
remarkPlugins: {},
rehypePlugins: {},
sanitize: { type: Boolean },
sanitizeOptions: {},
rehypeOptions: {}
}, DEFAULT_PROPS),
setup(__props) {
const props = __props;
const slots = useSlots();
const customComponents = useMarkdownContext();
const colorReplacementsComputed = computed(() => {
return props.colorReplacements;
});
const needViewCodeBtnComputed = computed(() => {
return props.needViewCodeBtn;
});
useShiki();
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_115, [
createVNode(unref(MarkdownRendererAsync), mergeProps(props, {
"color-replacements": unref(colorReplacementsComputed),
"need-view-code-btn": unref(needViewCodeBtnComputed)
}), createSlots({ _: 2 }, [
renderList(unref(customComponents), (slot, name) => {
return {
name,
fn: withCtx((slotProps) => [
(openBlock(), createBlock(resolveDynamicComponent(slot), normalizeProps(guardReactiveProps(slotProps)), null, 16))
])
};
}),
renderList(unref(slots), (_, name) => {
return {
name,
fn: withCtx((slotProps) => [
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
])
};
})
]), 1040, ["color-replacements", "need-view-code-btn"])
]);
};
}
});
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/es/hooks/usePrism.js
var prism = { exports: {} };
var hasRequiredPrism;
function requirePrism() {
if (hasRequiredPrism) return prism.exports;
hasRequiredPrism = 1;
(function(module) {
var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
var Prism2 = function(_self2) {
var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
var uniqueId = 0;
var plainTextGrammar = {};
var _ = {
/**
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
* additional languages or plugins yourself.
*
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
*
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
* empty Prism object into the global scope before loading the Prism script like this:
*
* ```js
* window.Prism = window.Prism || {};
* Prism.manual = true;
* // add a new