12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850 |
- /**
- * @vue/runtime-dom v3.5.12
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
- * @license MIT
- **/
- import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
- export * from '@vue/runtime-core';
- import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, camelize as camelize$1, isPlainObject, hasOwn, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
- let policy = void 0;
- const tt = typeof window !== "undefined" && window.trustedTypes;
- if (tt) {
- try {
- policy = /* @__PURE__ */ tt.createPolicy("vue", {
- createHTML: (val) => val
- });
- } catch (e) {
- !!(process.env.NODE_ENV !== "production") && warn(`Error creating trusted types policy: ${e}`);
- }
- }
- const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
- const svgNS = "http://www.w3.org/2000/svg";
- const mathmlNS = "http://www.w3.org/1998/Math/MathML";
- const doc = typeof document !== "undefined" ? document : null;
- const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
- const nodeOps = {
- insert: (child, parent, anchor) => {
- parent.insertBefore(child, anchor || null);
- },
- remove: (child) => {
- const parent = child.parentNode;
- if (parent) {
- parent.removeChild(child);
- }
- },
- createElement: (tag, namespace, is, props) => {
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
- if (tag === "select" && props && props.multiple != null) {
- el.setAttribute("multiple", props.multiple);
- }
- return el;
- },
- createText: (text) => doc.createTextNode(text),
- createComment: (text) => doc.createComment(text),
- setText: (node, text) => {
- node.nodeValue = text;
- },
- setElementText: (el, text) => {
- el.textContent = text;
- },
- parentNode: (node) => node.parentNode,
- nextSibling: (node) => node.nextSibling,
- querySelector: (selector) => doc.querySelector(selector),
- setScopeId(el, id) {
- el.setAttribute(id, "");
- },
- // __UNSAFE__
- // Reason: innerHTML.
- // Static content here can only come from compiled templates.
- // As long as the user only uses trusted templates, this is safe.
- insertStaticContent(content, parent, anchor, namespace, start, end) {
- const before = anchor ? anchor.previousSibling : parent.lastChild;
- if (start && (start === end || start.nextSibling)) {
- while (true) {
- parent.insertBefore(start.cloneNode(true), anchor);
- if (start === end || !(start = start.nextSibling)) break;
- }
- } else {
- templateContainer.innerHTML = unsafeToTrustedHTML(
- namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
- );
- const template = templateContainer.content;
- if (namespace === "svg" || namespace === "mathml") {
- const wrapper = template.firstChild;
- while (wrapper.firstChild) {
- template.appendChild(wrapper.firstChild);
- }
- template.removeChild(wrapper);
- }
- parent.insertBefore(template, anchor);
- }
- return [
- // first
- before ? before.nextSibling : parent.firstChild,
- // last
- anchor ? anchor.previousSibling : parent.lastChild
- ];
- }
- };
- const TRANSITION = "transition";
- const ANIMATION = "animation";
- const vtcKey = Symbol("_vtc");
- const DOMTransitionPropsValidators = {
- name: String,
- type: String,
- css: {
- type: Boolean,
- default: true
- },
- duration: [String, Number, Object],
- enterFromClass: String,
- enterActiveClass: String,
- enterToClass: String,
- appearFromClass: String,
- appearActiveClass: String,
- appearToClass: String,
- leaveFromClass: String,
- leaveActiveClass: String,
- leaveToClass: String
- };
- const TransitionPropsValidators = /* @__PURE__ */ extend(
- {},
- BaseTransitionPropsValidators,
- DOMTransitionPropsValidators
- );
- const decorate$1 = (t) => {
- t.displayName = "Transition";
- t.props = TransitionPropsValidators;
- return t;
- };
- const Transition = /* @__PURE__ */ decorate$1(
- (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
- );
- const callHook = (hook, args = []) => {
- if (isArray(hook)) {
- hook.forEach((h2) => h2(...args));
- } else if (hook) {
- hook(...args);
- }
- };
- const hasExplicitCallback = (hook) => {
- return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
- };
- function resolveTransitionProps(rawProps) {
- const baseProps = {};
- for (const key in rawProps) {
- if (!(key in DOMTransitionPropsValidators)) {
- baseProps[key] = rawProps[key];
- }
- }
- if (rawProps.css === false) {
- return baseProps;
- }
- const {
- name = "v",
- type,
- duration,
- enterFromClass = `${name}-enter-from`,
- enterActiveClass = `${name}-enter-active`,
- enterToClass = `${name}-enter-to`,
- appearFromClass = enterFromClass,
- appearActiveClass = enterActiveClass,
- appearToClass = enterToClass,
- leaveFromClass = `${name}-leave-from`,
- leaveActiveClass = `${name}-leave-active`,
- leaveToClass = `${name}-leave-to`
- } = rawProps;
- const durations = normalizeDuration(duration);
- const enterDuration = durations && durations[0];
- const leaveDuration = durations && durations[1];
- const {
- onBeforeEnter,
- onEnter,
- onEnterCancelled,
- onLeave,
- onLeaveCancelled,
- onBeforeAppear = onBeforeEnter,
- onAppear = onEnter,
- onAppearCancelled = onEnterCancelled
- } = baseProps;
- const finishEnter = (el, isAppear, done) => {
- removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
- removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
- done && done();
- };
- const finishLeave = (el, done) => {
- el._isLeaving = false;
- removeTransitionClass(el, leaveFromClass);
- removeTransitionClass(el, leaveToClass);
- removeTransitionClass(el, leaveActiveClass);
- done && done();
- };
- const makeEnterHook = (isAppear) => {
- return (el, done) => {
- const hook = isAppear ? onAppear : onEnter;
- const resolve = () => finishEnter(el, isAppear, done);
- callHook(hook, [el, resolve]);
- nextFrame(() => {
- removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
- addTransitionClass(el, isAppear ? appearToClass : enterToClass);
- if (!hasExplicitCallback(hook)) {
- whenTransitionEnds(el, type, enterDuration, resolve);
- }
- });
- };
- };
- return extend(baseProps, {
- onBeforeEnter(el) {
- callHook(onBeforeEnter, [el]);
- addTransitionClass(el, enterFromClass);
- addTransitionClass(el, enterActiveClass);
- },
- onBeforeAppear(el) {
- callHook(onBeforeAppear, [el]);
- addTransitionClass(el, appearFromClass);
- addTransitionClass(el, appearActiveClass);
- },
- onEnter: makeEnterHook(false),
- onAppear: makeEnterHook(true),
- onLeave(el, done) {
- el._isLeaving = true;
- const resolve = () => finishLeave(el, done);
- addTransitionClass(el, leaveFromClass);
- addTransitionClass(el, leaveActiveClass);
- forceReflow();
- nextFrame(() => {
- if (!el._isLeaving) {
- return;
- }
- removeTransitionClass(el, leaveFromClass);
- addTransitionClass(el, leaveToClass);
- if (!hasExplicitCallback(onLeave)) {
- whenTransitionEnds(el, type, leaveDuration, resolve);
- }
- });
- callHook(onLeave, [el, resolve]);
- },
- onEnterCancelled(el) {
- finishEnter(el, false);
- callHook(onEnterCancelled, [el]);
- },
- onAppearCancelled(el) {
- finishEnter(el, true);
- callHook(onAppearCancelled, [el]);
- },
- onLeaveCancelled(el) {
- finishLeave(el);
- callHook(onLeaveCancelled, [el]);
- }
- });
- }
- function normalizeDuration(duration) {
- if (duration == null) {
- return null;
- } else if (isObject(duration)) {
- return [NumberOf(duration.enter), NumberOf(duration.leave)];
- } else {
- const n = NumberOf(duration);
- return [n, n];
- }
- }
- function NumberOf(val) {
- const res = toNumber(val);
- if (!!(process.env.NODE_ENV !== "production")) {
- assertNumber(res, "<transition> explicit duration");
- }
- return res;
- }
- function addTransitionClass(el, cls) {
- cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
- (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
- }
- function removeTransitionClass(el, cls) {
- cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
- const _vtc = el[vtcKey];
- if (_vtc) {
- _vtc.delete(cls);
- if (!_vtc.size) {
- el[vtcKey] = void 0;
- }
- }
- }
- function nextFrame(cb) {
- requestAnimationFrame(() => {
- requestAnimationFrame(cb);
- });
- }
- let endId = 0;
- function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
- const id = el._endId = ++endId;
- const resolveIfNotStale = () => {
- if (id === el._endId) {
- resolve();
- }
- };
- if (explicitTimeout != null) {
- return setTimeout(resolveIfNotStale, explicitTimeout);
- }
- const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
- if (!type) {
- return resolve();
- }
- const endEvent = type + "end";
- let ended = 0;
- const end = () => {
- el.removeEventListener(endEvent, onEnd);
- resolveIfNotStale();
- };
- const onEnd = (e) => {
- if (e.target === el && ++ended >= propCount) {
- end();
- }
- };
- setTimeout(() => {
- if (ended < propCount) {
- end();
- }
- }, timeout + 1);
- el.addEventListener(endEvent, onEnd);
- }
- function getTransitionInfo(el, expectedType) {
- const styles = window.getComputedStyle(el);
- const getStyleProperties = (key) => (styles[key] || "").split(", ");
- const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
- const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
- const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
- const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
- const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
- const animationTimeout = getTimeout(animationDelays, animationDurations);
- let type = null;
- let timeout = 0;
- let propCount = 0;
- if (expectedType === TRANSITION) {
- if (transitionTimeout > 0) {
- type = TRANSITION;
- timeout = transitionTimeout;
- propCount = transitionDurations.length;
- }
- } else if (expectedType === ANIMATION) {
- if (animationTimeout > 0) {
- type = ANIMATION;
- timeout = animationTimeout;
- propCount = animationDurations.length;
- }
- } else {
- timeout = Math.max(transitionTimeout, animationTimeout);
- type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
- propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
- }
- const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
- getStyleProperties(`${TRANSITION}Property`).toString()
- );
- return {
- type,
- timeout,
- propCount,
- hasTransform
- };
- }
- function getTimeout(delays, durations) {
- while (delays.length < durations.length) {
- delays = delays.concat(delays);
- }
- return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
- }
- function toMs(s) {
- if (s === "auto") return 0;
- return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
- }
- function forceReflow() {
- return document.body.offsetHeight;
- }
- function patchClass(el, value, isSVG) {
- const transitionClasses = el[vtcKey];
- if (transitionClasses) {
- value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
- }
- if (value == null) {
- el.removeAttribute("class");
- } else if (isSVG) {
- el.setAttribute("class", value);
- } else {
- el.className = value;
- }
- }
- const vShowOriginalDisplay = Symbol("_vod");
- const vShowHidden = Symbol("_vsh");
- const vShow = {
- beforeMount(el, { value }, { transition }) {
- el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
- if (transition && value) {
- transition.beforeEnter(el);
- } else {
- setDisplay(el, value);
- }
- },
- mounted(el, { value }, { transition }) {
- if (transition && value) {
- transition.enter(el);
- }
- },
- updated(el, { value, oldValue }, { transition }) {
- if (!value === !oldValue) return;
- if (transition) {
- if (value) {
- transition.beforeEnter(el);
- setDisplay(el, true);
- transition.enter(el);
- } else {
- transition.leave(el, () => {
- setDisplay(el, false);
- });
- }
- } else {
- setDisplay(el, value);
- }
- },
- beforeUnmount(el, { value }) {
- setDisplay(el, value);
- }
- };
- if (!!(process.env.NODE_ENV !== "production")) {
- vShow.name = "show";
- }
- function setDisplay(el, value) {
- el.style.display = value ? el[vShowOriginalDisplay] : "none";
- el[vShowHidden] = !value;
- }
- function initVShowForSSR() {
- vShow.getSSRProps = ({ value }) => {
- if (!value) {
- return { style: { display: "none" } };
- }
- };
- }
- const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
- function useCssVars(getter) {
- const instance = getCurrentInstance();
- if (!instance) {
- !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
- return;
- }
- const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
- Array.from(
- document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
- ).forEach((node) => setVarsOnNode(node, vars));
- };
- if (!!(process.env.NODE_ENV !== "production")) {
- instance.getCssVars = () => getter(instance.proxy);
- }
- const setVars = () => {
- const vars = getter(instance.proxy);
- if (instance.ce) {
- setVarsOnNode(instance.ce, vars);
- } else {
- setVarsOnVNode(instance.subTree, vars);
- }
- updateTeleports(vars);
- };
- onBeforeMount(() => {
- watchPostEffect(setVars);
- });
- onMounted(() => {
- const ob = new MutationObserver(setVars);
- ob.observe(instance.subTree.el.parentNode, { childList: true });
- onUnmounted(() => ob.disconnect());
- });
- }
- function setVarsOnVNode(vnode, vars) {
- if (vnode.shapeFlag & 128) {
- const suspense = vnode.suspense;
- vnode = suspense.activeBranch;
- if (suspense.pendingBranch && !suspense.isHydrating) {
- suspense.effects.push(() => {
- setVarsOnVNode(suspense.activeBranch, vars);
- });
- }
- }
- while (vnode.component) {
- vnode = vnode.component.subTree;
- }
- if (vnode.shapeFlag & 1 && vnode.el) {
- setVarsOnNode(vnode.el, vars);
- } else if (vnode.type === Fragment) {
- vnode.children.forEach((c) => setVarsOnVNode(c, vars));
- } else if (vnode.type === Static) {
- let { el, anchor } = vnode;
- while (el) {
- setVarsOnNode(el, vars);
- if (el === anchor) break;
- el = el.nextSibling;
- }
- }
- }
- function setVarsOnNode(el, vars) {
- if (el.nodeType === 1) {
- const style = el.style;
- let cssText = "";
- for (const key in vars) {
- style.setProperty(`--${key}`, vars[key]);
- cssText += `--${key}: ${vars[key]};`;
- }
- style[CSS_VAR_TEXT] = cssText;
- }
- }
- const displayRE = /(^|;)\s*display\s*:/;
- function patchStyle(el, prev, next) {
- const style = el.style;
- const isCssString = isString(next);
- let hasControlledDisplay = false;
- if (next && !isCssString) {
- if (prev) {
- if (!isString(prev)) {
- for (const key in prev) {
- if (next[key] == null) {
- setStyle(style, key, "");
- }
- }
- } else {
- for (const prevStyle of prev.split(";")) {
- const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
- if (next[key] == null) {
- setStyle(style, key, "");
- }
- }
- }
- }
- for (const key in next) {
- if (key === "display") {
- hasControlledDisplay = true;
- }
- setStyle(style, key, next[key]);
- }
- } else {
- if (isCssString) {
- if (prev !== next) {
- const cssVarText = style[CSS_VAR_TEXT];
- if (cssVarText) {
- next += ";" + cssVarText;
- }
- style.cssText = next;
- hasControlledDisplay = displayRE.test(next);
- }
- } else if (prev) {
- el.removeAttribute("style");
- }
- }
- if (vShowOriginalDisplay in el) {
- el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
- if (el[vShowHidden]) {
- style.display = "none";
- }
- }
- }
- const semicolonRE = /[^\\];\s*$/;
- const importantRE = /\s*!important$/;
- function setStyle(style, name, val) {
- if (isArray(val)) {
- val.forEach((v) => setStyle(style, name, v));
- } else {
- if (val == null) val = "";
- if (!!(process.env.NODE_ENV !== "production")) {
- if (semicolonRE.test(val)) {
- warn(
- `Unexpected semicolon at the end of '${name}' style value: '${val}'`
- );
- }
- }
- if (name.startsWith("--")) {
- style.setProperty(name, val);
- } else {
- const prefixed = autoPrefix(style, name);
- if (importantRE.test(val)) {
- style.setProperty(
- hyphenate(prefixed),
- val.replace(importantRE, ""),
- "important"
- );
- } else {
- style[prefixed] = val;
- }
- }
- }
- }
- const prefixes = ["Webkit", "Moz", "ms"];
- const prefixCache = {};
- function autoPrefix(style, rawName) {
- const cached = prefixCache[rawName];
- if (cached) {
- return cached;
- }
- let name = camelize(rawName);
- if (name !== "filter" && name in style) {
- return prefixCache[rawName] = name;
- }
- name = capitalize(name);
- for (let i = 0; i < prefixes.length; i++) {
- const prefixed = prefixes[i] + name;
- if (prefixed in style) {
- return prefixCache[rawName] = prefixed;
- }
- }
- return rawName;
- }
- const xlinkNS = "http://www.w3.org/1999/xlink";
- function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
- if (isSVG && key.startsWith("xlink:")) {
- if (value == null) {
- el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
- } else {
- el.setAttributeNS(xlinkNS, key, value);
- }
- } else {
- if (value == null || isBoolean && !includeBooleanAttr(value)) {
- el.removeAttribute(key);
- } else {
- el.setAttribute(
- key,
- isBoolean ? "" : isSymbol(value) ? String(value) : value
- );
- }
- }
- }
- function patchDOMProp(el, key, value, parentComponent, attrName) {
- if (key === "innerHTML" || key === "textContent") {
- if (value != null) {
- el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
- }
- return;
- }
- const tag = el.tagName;
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
- !tag.includes("-")) {
- const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
- const newValue = value == null ? (
- // #11647: value should be set as empty string for null and undefined,
- // but <input type="checkbox"> should be set as 'on'.
- el.type === "checkbox" ? "on" : ""
- ) : String(value);
- if (oldValue !== newValue || !("_value" in el)) {
- el.value = newValue;
- }
- if (value == null) {
- el.removeAttribute(key);
- }
- el._value = value;
- return;
- }
- let needRemove = false;
- if (value === "" || value == null) {
- const type = typeof el[key];
- if (type === "boolean") {
- value = includeBooleanAttr(value);
- } else if (value == null && type === "string") {
- value = "";
- needRemove = true;
- } else if (type === "number") {
- value = 0;
- needRemove = true;
- }
- }
- try {
- el[key] = value;
- } catch (e) {
- if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
- warn(
- `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
- e
- );
- }
- }
- needRemove && el.removeAttribute(attrName || key);
- }
- function addEventListener(el, event, handler, options) {
- el.addEventListener(event, handler, options);
- }
- function removeEventListener(el, event, handler, options) {
- el.removeEventListener(event, handler, options);
- }
- const veiKey = Symbol("_vei");
- function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
- const invokers = el[veiKey] || (el[veiKey] = {});
- const existingInvoker = invokers[rawName];
- if (nextValue && existingInvoker) {
- existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
- } else {
- const [name, options] = parseName(rawName);
- if (nextValue) {
- const invoker = invokers[rawName] = createInvoker(
- !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue,
- instance
- );
- addEventListener(el, name, invoker, options);
- } else if (existingInvoker) {
- removeEventListener(el, name, existingInvoker, options);
- invokers[rawName] = void 0;
- }
- }
- }
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
- function parseName(name) {
- let options;
- if (optionsModifierRE.test(name)) {
- options = {};
- let m;
- while (m = name.match(optionsModifierRE)) {
- name = name.slice(0, name.length - m[0].length);
- options[m[0].toLowerCase()] = true;
- }
- }
- const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
- return [event, options];
- }
- let cachedNow = 0;
- const p = /* @__PURE__ */ Promise.resolve();
- const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
- function createInvoker(initialValue, instance) {
- const invoker = (e) => {
- if (!e._vts) {
- e._vts = Date.now();
- } else if (e._vts <= invoker.attached) {
- return;
- }
- callWithAsyncErrorHandling(
- patchStopImmediatePropagation(e, invoker.value),
- instance,
- 5,
- [e]
- );
- };
- invoker.value = initialValue;
- invoker.attached = getNow();
- return invoker;
- }
- function sanitizeEventValue(value, propName) {
- if (isFunction(value) || isArray(value)) {
- return value;
- }
- warn(
- `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
- Expected function or array of functions, received type ${typeof value}.`
- );
- return NOOP;
- }
- function patchStopImmediatePropagation(e, value) {
- if (isArray(value)) {
- const originalStop = e.stopImmediatePropagation;
- e.stopImmediatePropagation = () => {
- originalStop.call(e);
- e._stopped = true;
- };
- return value.map(
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
- );
- } else {
- return value;
- }
- }
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
- const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
- const isSVG = namespace === "svg";
- if (key === "class") {
- patchClass(el, nextValue, isSVG);
- } else if (key === "style") {
- patchStyle(el, prevValue, nextValue);
- } else if (isOn(key)) {
- if (!isModelListener(key)) {
- patchEvent(el, key, prevValue, nextValue, parentComponent);
- }
- } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
- patchDOMProp(el, key, nextValue);
- if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
- patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
- }
- } else if (
- // #11081 force set props for possible async custom element
- el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
- ) {
- patchDOMProp(el, camelize$1(key), nextValue, parentComponent, key);
- } else {
- if (key === "true-value") {
- el._trueValue = nextValue;
- } else if (key === "false-value") {
- el._falseValue = nextValue;
- }
- patchAttr(el, key, nextValue, isSVG);
- }
- };
- function shouldSetAsProp(el, key, value, isSVG) {
- if (isSVG) {
- if (key === "innerHTML" || key === "textContent") {
- return true;
- }
- if (key in el && isNativeOn(key) && isFunction(value)) {
- return true;
- }
- return false;
- }
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
- return false;
- }
- if (key === "form") {
- return false;
- }
- if (key === "list" && el.tagName === "INPUT") {
- return false;
- }
- if (key === "type" && el.tagName === "TEXTAREA") {
- return false;
- }
- if (key === "width" || key === "height") {
- const tag = el.tagName;
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
- return false;
- }
- }
- if (isNativeOn(key) && isString(value)) {
- return false;
- }
- return key in el;
- }
- const REMOVAL = {};
- /*! #__NO_SIDE_EFFECTS__ */
- // @__NO_SIDE_EFFECTS__
- function defineCustomElement(options, extraOptions, _createApp) {
- const Comp = defineComponent(options, extraOptions);
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
- class VueCustomElement extends VueElement {
- constructor(initialProps) {
- super(Comp, initialProps, _createApp);
- }
- }
- VueCustomElement.def = Comp;
- return VueCustomElement;
- }
- /*! #__NO_SIDE_EFFECTS__ */
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
- return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
- };
- const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
- };
- class VueElement extends BaseClass {
- constructor(_def, _props = {}, _createApp = createApp) {
- super();
- this._def = _def;
- this._props = _props;
- this._createApp = _createApp;
- this._isVueCE = true;
- /**
- * @internal
- */
- this._instance = null;
- /**
- * @internal
- */
- this._app = null;
- /**
- * @internal
- */
- this._nonce = this._def.nonce;
- this._connected = false;
- this._resolved = false;
- this._numberProps = null;
- this._styleChildren = /* @__PURE__ */ new WeakSet();
- this._ob = null;
- if (this.shadowRoot && _createApp !== createApp) {
- this._root = this.shadowRoot;
- } else {
- if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
- warn(
- `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
- );
- }
- if (_def.shadowRoot !== false) {
- this.attachShadow({ mode: "open" });
- this._root = this.shadowRoot;
- } else {
- this._root = this;
- }
- }
- if (!this._def.__asyncLoader) {
- this._resolveProps(this._def);
- }
- }
- connectedCallback() {
- if (!this.isConnected) return;
- if (!this.shadowRoot) {
- this._parseSlots();
- }
- this._connected = true;
- let parent = this;
- while (parent = parent && (parent.parentNode || parent.host)) {
- if (parent instanceof VueElement) {
- this._parent = parent;
- break;
- }
- }
- if (!this._instance) {
- if (this._resolved) {
- this._setParent();
- this._update();
- } else {
- if (parent && parent._pendingResolve) {
- this._pendingResolve = parent._pendingResolve.then(() => {
- this._pendingResolve = void 0;
- this._resolveDef();
- });
- } else {
- this._resolveDef();
- }
- }
- }
- }
- _setParent(parent = this._parent) {
- if (parent) {
- this._instance.parent = parent._instance;
- this._instance.provides = parent._instance.provides;
- }
- }
- disconnectedCallback() {
- this._connected = false;
- nextTick(() => {
- if (!this._connected) {
- if (this._ob) {
- this._ob.disconnect();
- this._ob = null;
- }
- this._app && this._app.unmount();
- if (this._instance) this._instance.ce = void 0;
- this._app = this._instance = null;
- }
- });
- }
- /**
- * resolve inner component definition (handle possible async component)
- */
- _resolveDef() {
- if (this._pendingResolve) {
- return;
- }
- for (let i = 0; i < this.attributes.length; i++) {
- this._setAttr(this.attributes[i].name);
- }
- this._ob = new MutationObserver((mutations) => {
- for (const m of mutations) {
- this._setAttr(m.attributeName);
- }
- });
- this._ob.observe(this, { attributes: true });
- const resolve = (def, isAsync = false) => {
- this._resolved = true;
- this._pendingResolve = void 0;
- const { props, styles } = def;
- let numberProps;
- if (props && !isArray(props)) {
- for (const key in props) {
- const opt = props[key];
- if (opt === Number || opt && opt.type === Number) {
- if (key in this._props) {
- this._props[key] = toNumber(this._props[key]);
- }
- (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize$1(key)] = true;
- }
- }
- }
- this._numberProps = numberProps;
- if (isAsync) {
- this._resolveProps(def);
- }
- if (this.shadowRoot) {
- this._applyStyles(styles);
- } else if (!!(process.env.NODE_ENV !== "production") && styles) {
- warn(
- "Custom element style injection is not supported when using shadowRoot: false"
- );
- }
- this._mount(def);
- };
- const asyncDef = this._def.__asyncLoader;
- if (asyncDef) {
- this._pendingResolve = asyncDef().then(
- (def) => resolve(this._def = def, true)
- );
- } else {
- resolve(this._def);
- }
- }
- _mount(def) {
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
- def.name = "VueElement";
- }
- this._app = this._createApp(def);
- if (def.configureApp) {
- def.configureApp(this._app);
- }
- this._app._ceVNode = this._createVNode();
- this._app.mount(this._root);
- const exposed = this._instance && this._instance.exposed;
- if (!exposed) return;
- for (const key in exposed) {
- if (!hasOwn(this, key)) {
- Object.defineProperty(this, key, {
- // unwrap ref to be consistent with public instance behavior
- get: () => unref(exposed[key])
- });
- } else if (!!(process.env.NODE_ENV !== "production")) {
- warn(`Exposed property "${key}" already exists on custom element.`);
- }
- }
- }
- _resolveProps(def) {
- const { props } = def;
- const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
- for (const key of Object.keys(this)) {
- if (key[0] !== "_" && declaredPropKeys.includes(key)) {
- this._setProp(key, this[key]);
- }
- }
- for (const key of declaredPropKeys.map(camelize$1)) {
- Object.defineProperty(this, key, {
- get() {
- return this._getProp(key);
- },
- set(val) {
- this._setProp(key, val, true, true);
- }
- });
- }
- }
- _setAttr(key) {
- if (key.startsWith("data-v-")) return;
- const has = this.hasAttribute(key);
- let value = has ? this.getAttribute(key) : REMOVAL;
- const camelKey = camelize$1(key);
- if (has && this._numberProps && this._numberProps[camelKey]) {
- value = toNumber(value);
- }
- this._setProp(camelKey, value, false, true);
- }
- /**
- * @internal
- */
- _getProp(key) {
- return this._props[key];
- }
- /**
- * @internal
- */
- _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
- if (val !== this._props[key]) {
- if (val === REMOVAL) {
- delete this._props[key];
- } else {
- this._props[key] = val;
- if (key === "key" && this._app) {
- this._app._ceVNode.key = val;
- }
- }
- if (shouldUpdate && this._instance) {
- this._update();
- }
- if (shouldReflect) {
- if (val === true) {
- this.setAttribute(hyphenate(key), "");
- } else if (typeof val === "string" || typeof val === "number") {
- this.setAttribute(hyphenate(key), val + "");
- } else if (!val) {
- this.removeAttribute(hyphenate(key));
- }
- }
- }
- }
- _update() {
- render(this._createVNode(), this._root);
- }
- _createVNode() {
- const baseProps = {};
- if (!this.shadowRoot) {
- baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
- }
- const vnode = createVNode(this._def, extend(baseProps, this._props));
- if (!this._instance) {
- vnode.ce = (instance) => {
- this._instance = instance;
- instance.ce = this;
- instance.isCE = true;
- if (!!(process.env.NODE_ENV !== "production")) {
- instance.ceReload = (newStyles) => {
- if (this._styles) {
- this._styles.forEach((s) => this._root.removeChild(s));
- this._styles.length = 0;
- }
- this._applyStyles(newStyles);
- this._instance = null;
- this._update();
- };
- }
- const dispatch = (event, args) => {
- this.dispatchEvent(
- new CustomEvent(
- event,
- isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
- )
- );
- };
- instance.emit = (event, ...args) => {
- dispatch(event, args);
- if (hyphenate(event) !== event) {
- dispatch(hyphenate(event), args);
- }
- };
- this._setParent();
- };
- }
- return vnode;
- }
- _applyStyles(styles, owner) {
- if (!styles) return;
- if (owner) {
- if (owner === this._def || this._styleChildren.has(owner)) {
- return;
- }
- this._styleChildren.add(owner);
- }
- const nonce = this._nonce;
- for (let i = styles.length - 1; i >= 0; i--) {
- const s = document.createElement("style");
- if (nonce) s.setAttribute("nonce", nonce);
- s.textContent = styles[i];
- this.shadowRoot.prepend(s);
- if (!!(process.env.NODE_ENV !== "production")) {
- if (owner) {
- if (owner.__hmrId) {
- if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
- let entry = this._childStyles.get(owner.__hmrId);
- if (!entry) {
- this._childStyles.set(owner.__hmrId, entry = []);
- }
- entry.push(s);
- }
- } else {
- (this._styles || (this._styles = [])).push(s);
- }
- }
- }
- }
- /**
- * Only called when shadowRoot is false
- */
- _parseSlots() {
- const slots = this._slots = {};
- let n;
- while (n = this.firstChild) {
- const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
- (slots[slotName] || (slots[slotName] = [])).push(n);
- this.removeChild(n);
- }
- }
- /**
- * Only called when shadowRoot is false
- */
- _renderSlots() {
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
- const scopeId = this._instance.type.__scopeId;
- for (let i = 0; i < outlets.length; i++) {
- const o = outlets[i];
- const slotName = o.getAttribute("name") || "default";
- const content = this._slots[slotName];
- const parent = o.parentNode;
- if (content) {
- for (const n of content) {
- if (scopeId && n.nodeType === 1) {
- const id = scopeId + "-s";
- const walker = document.createTreeWalker(n, 1);
- n.setAttribute(id, "");
- let child;
- while (child = walker.nextNode()) {
- child.setAttribute(id, "");
- }
- }
- parent.insertBefore(n, o);
- }
- } else {
- while (o.firstChild) parent.insertBefore(o.firstChild, o);
- }
- parent.removeChild(o);
- }
- }
- /**
- * @internal
- */
- _injectChildStyle(comp) {
- this._applyStyles(comp.styles, comp);
- }
- /**
- * @internal
- */
- _removeChildStyle(comp) {
- if (!!(process.env.NODE_ENV !== "production")) {
- this._styleChildren.delete(comp);
- if (this._childStyles && comp.__hmrId) {
- const oldStyles = this._childStyles.get(comp.__hmrId);
- if (oldStyles) {
- oldStyles.forEach((s) => this._root.removeChild(s));
- oldStyles.length = 0;
- }
- }
- }
- }
- }
- function useHost(caller) {
- const instance = getCurrentInstance();
- const el = instance && instance.ce;
- if (el) {
- return el;
- } else if (!!(process.env.NODE_ENV !== "production")) {
- if (!instance) {
- warn(
- `${caller || "useHost"} called without an active component instance.`
- );
- } else {
- warn(
- `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
- );
- }
- }
- return null;
- }
- function useShadowRoot() {
- const el = !!(process.env.NODE_ENV !== "production") ? useHost("useShadowRoot") : useHost();
- return el && el.shadowRoot;
- }
- function useCssModule(name = "$style") {
- {
- const instance = getCurrentInstance();
- if (!instance) {
- !!(process.env.NODE_ENV !== "production") && warn(`useCssModule must be called inside setup()`);
- return EMPTY_OBJ;
- }
- const modules = instance.type.__cssModules;
- if (!modules) {
- !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS modules injected.`);
- return EMPTY_OBJ;
- }
- const mod = modules[name];
- if (!mod) {
- !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS module named "${name}".`);
- return EMPTY_OBJ;
- }
- return mod;
- }
- }
- const positionMap = /* @__PURE__ */ new WeakMap();
- const newPositionMap = /* @__PURE__ */ new WeakMap();
- const moveCbKey = Symbol("_moveCb");
- const enterCbKey = Symbol("_enterCb");
- const decorate = (t) => {
- delete t.props.mode;
- return t;
- };
- const TransitionGroupImpl = /* @__PURE__ */ decorate({
- name: "TransitionGroup",
- props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
- tag: String,
- moveClass: String
- }),
- setup(props, { slots }) {
- const instance = getCurrentInstance();
- const state = useTransitionState();
- let prevChildren;
- let children;
- onUpdated(() => {
- if (!prevChildren.length) {
- return;
- }
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
- if (!hasCSSTransform(
- prevChildren[0].el,
- instance.vnode.el,
- moveClass
- )) {
- return;
- }
- prevChildren.forEach(callPendingCbs);
- prevChildren.forEach(recordPosition);
- const movedChildren = prevChildren.filter(applyTranslation);
- forceReflow();
- movedChildren.forEach((c) => {
- const el = c.el;
- const style = el.style;
- addTransitionClass(el, moveClass);
- style.transform = style.webkitTransform = style.transitionDuration = "";
- const cb = el[moveCbKey] = (e) => {
- if (e && e.target !== el) {
- return;
- }
- if (!e || /transform$/.test(e.propertyName)) {
- el.removeEventListener("transitionend", cb);
- el[moveCbKey] = null;
- removeTransitionClass(el, moveClass);
- }
- };
- el.addEventListener("transitionend", cb);
- });
- });
- return () => {
- const rawProps = toRaw(props);
- const cssTransitionProps = resolveTransitionProps(rawProps);
- let tag = rawProps.tag || Fragment;
- prevChildren = [];
- if (children) {
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- if (child.el && child.el instanceof Element) {
- prevChildren.push(child);
- setTransitionHooks(
- child,
- resolveTransitionHooks(
- child,
- cssTransitionProps,
- state,
- instance
- )
- );
- positionMap.set(
- child,
- child.el.getBoundingClientRect()
- );
- }
- }
- }
- children = slots.default ? getTransitionRawChildren(slots.default()) : [];
- for (let i = 0; i < children.length; i++) {
- const child = children[i];
- if (child.key != null) {
- setTransitionHooks(
- child,
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
- );
- } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
- warn(`<TransitionGroup> children must be keyed.`);
- }
- }
- return createVNode(tag, null, children);
- };
- }
- });
- const TransitionGroup = TransitionGroupImpl;
- function callPendingCbs(c) {
- const el = c.el;
- if (el[moveCbKey]) {
- el[moveCbKey]();
- }
- if (el[enterCbKey]) {
- el[enterCbKey]();
- }
- }
- function recordPosition(c) {
- newPositionMap.set(c, c.el.getBoundingClientRect());
- }
- function applyTranslation(c) {
- const oldPos = positionMap.get(c);
- const newPos = newPositionMap.get(c);
- const dx = oldPos.left - newPos.left;
- const dy = oldPos.top - newPos.top;
- if (dx || dy) {
- const s = c.el.style;
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
- s.transitionDuration = "0s";
- return c;
- }
- }
- function hasCSSTransform(el, root, moveClass) {
- const clone = el.cloneNode();
- const _vtc = el[vtcKey];
- if (_vtc) {
- _vtc.forEach((cls) => {
- cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
- });
- }
- moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
- clone.style.display = "none";
- const container = root.nodeType === 1 ? root : root.parentNode;
- container.appendChild(clone);
- const { hasTransform } = getTransitionInfo(clone);
- container.removeChild(clone);
- return hasTransform;
- }
- const getModelAssigner = (vnode) => {
- const fn = vnode.props["onUpdate:modelValue"] || false;
- return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
- };
- function onCompositionStart(e) {
- e.target.composing = true;
- }
- function onCompositionEnd(e) {
- const target = e.target;
- if (target.composing) {
- target.composing = false;
- target.dispatchEvent(new Event("input"));
- }
- }
- const assignKey = Symbol("_assign");
- const vModelText = {
- created(el, { modifiers: { lazy, trim, number } }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- const castToNumber = number || vnode.props && vnode.props.type === "number";
- addEventListener(el, lazy ? "change" : "input", (e) => {
- if (e.target.composing) return;
- let domValue = el.value;
- if (trim) {
- domValue = domValue.trim();
- }
- if (castToNumber) {
- domValue = looseToNumber(domValue);
- }
- el[assignKey](domValue);
- });
- if (trim) {
- addEventListener(el, "change", () => {
- el.value = el.value.trim();
- });
- }
- if (!lazy) {
- addEventListener(el, "compositionstart", onCompositionStart);
- addEventListener(el, "compositionend", onCompositionEnd);
- addEventListener(el, "change", onCompositionEnd);
- }
- },
- // set value on mounted so it's after min/max for type="range"
- mounted(el, { value }) {
- el.value = value == null ? "" : value;
- },
- beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- if (el.composing) return;
- const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
- const newValue = value == null ? "" : value;
- if (elValue === newValue) {
- return;
- }
- if (document.activeElement === el && el.type !== "range") {
- if (lazy && value === oldValue) {
- return;
- }
- if (trim && el.value.trim() === newValue) {
- return;
- }
- }
- el.value = newValue;
- }
- };
- const vModelCheckbox = {
- // #4096 array checkboxes need to be deep traversed
- deep: true,
- created(el, _, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- addEventListener(el, "change", () => {
- const modelValue = el._modelValue;
- const elementValue = getValue(el);
- const checked = el.checked;
- const assign = el[assignKey];
- if (isArray(modelValue)) {
- const index = looseIndexOf(modelValue, elementValue);
- const found = index !== -1;
- if (checked && !found) {
- assign(modelValue.concat(elementValue));
- } else if (!checked && found) {
- const filtered = [...modelValue];
- filtered.splice(index, 1);
- assign(filtered);
- }
- } else if (isSet(modelValue)) {
- const cloned = new Set(modelValue);
- if (checked) {
- cloned.add(elementValue);
- } else {
- cloned.delete(elementValue);
- }
- assign(cloned);
- } else {
- assign(getCheckboxValue(el, checked));
- }
- });
- },
- // set initial checked on mount to wait for true-value/false-value
- mounted: setChecked,
- beforeUpdate(el, binding, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- setChecked(el, binding, vnode);
- }
- };
- function setChecked(el, { value, oldValue }, vnode) {
- el._modelValue = value;
- let checked;
- if (isArray(value)) {
- checked = looseIndexOf(value, vnode.props.value) > -1;
- } else if (isSet(value)) {
- checked = value.has(vnode.props.value);
- } else {
- if (value === oldValue) return;
- checked = looseEqual(value, getCheckboxValue(el, true));
- }
- if (el.checked !== checked) {
- el.checked = checked;
- }
- }
- const vModelRadio = {
- created(el, { value }, vnode) {
- el.checked = looseEqual(value, vnode.props.value);
- el[assignKey] = getModelAssigner(vnode);
- addEventListener(el, "change", () => {
- el[assignKey](getValue(el));
- });
- },
- beforeUpdate(el, { value, oldValue }, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- if (value !== oldValue) {
- el.checked = looseEqual(value, vnode.props.value);
- }
- }
- };
- const vModelSelect = {
- // <select multiple> value need to be deep traversed
- deep: true,
- created(el, { value, modifiers: { number } }, vnode) {
- const isSetModel = isSet(value);
- addEventListener(el, "change", () => {
- const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
- (o) => number ? looseToNumber(getValue(o)) : getValue(o)
- );
- el[assignKey](
- el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
- );
- el._assigning = true;
- nextTick(() => {
- el._assigning = false;
- });
- });
- el[assignKey] = getModelAssigner(vnode);
- },
- // set value in mounted & updated because <select> relies on its children
- // <option>s.
- mounted(el, { value }) {
- setSelected(el, value);
- },
- beforeUpdate(el, _binding, vnode) {
- el[assignKey] = getModelAssigner(vnode);
- },
- updated(el, { value }) {
- if (!el._assigning) {
- setSelected(el, value);
- }
- }
- };
- function setSelected(el, value) {
- const isMultiple = el.multiple;
- const isArrayValue = isArray(value);
- if (isMultiple && !isArrayValue && !isSet(value)) {
- !!(process.env.NODE_ENV !== "production") && warn(
- `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
- );
- return;
- }
- for (let i = 0, l = el.options.length; i < l; i++) {
- const option = el.options[i];
- const optionValue = getValue(option);
- if (isMultiple) {
- if (isArrayValue) {
- const optionType = typeof optionValue;
- if (optionType === "string" || optionType === "number") {
- option.selected = value.some((v) => String(v) === String(optionValue));
- } else {
- option.selected = looseIndexOf(value, optionValue) > -1;
- }
- } else {
- option.selected = value.has(optionValue);
- }
- } else if (looseEqual(getValue(option), value)) {
- if (el.selectedIndex !== i) el.selectedIndex = i;
- return;
- }
- }
- if (!isMultiple && el.selectedIndex !== -1) {
- el.selectedIndex = -1;
- }
- }
- function getValue(el) {
- return "_value" in el ? el._value : el.value;
- }
- function getCheckboxValue(el, checked) {
- const key = checked ? "_trueValue" : "_falseValue";
- return key in el ? el[key] : checked;
- }
- const vModelDynamic = {
- created(el, binding, vnode) {
- callModelHook(el, binding, vnode, null, "created");
- },
- mounted(el, binding, vnode) {
- callModelHook(el, binding, vnode, null, "mounted");
- },
- beforeUpdate(el, binding, vnode, prevVNode) {
- callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
- },
- updated(el, binding, vnode, prevVNode) {
- callModelHook(el, binding, vnode, prevVNode, "updated");
- }
- };
- function resolveDynamicModel(tagName, type) {
- switch (tagName) {
- case "SELECT":
- return vModelSelect;
- case "TEXTAREA":
- return vModelText;
- default:
- switch (type) {
- case "checkbox":
- return vModelCheckbox;
- case "radio":
- return vModelRadio;
- default:
- return vModelText;
- }
- }
- }
- function callModelHook(el, binding, vnode, prevVNode, hook) {
- const modelToUse = resolveDynamicModel(
- el.tagName,
- vnode.props && vnode.props.type
- );
- const fn = modelToUse[hook];
- fn && fn(el, binding, vnode, prevVNode);
- }
- function initVModelForSSR() {
- vModelText.getSSRProps = ({ value }) => ({ value });
- vModelRadio.getSSRProps = ({ value }, vnode) => {
- if (vnode.props && looseEqual(vnode.props.value, value)) {
- return { checked: true };
- }
- };
- vModelCheckbox.getSSRProps = ({ value }, vnode) => {
- if (isArray(value)) {
- if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
- return { checked: true };
- }
- } else if (isSet(value)) {
- if (vnode.props && value.has(vnode.props.value)) {
- return { checked: true };
- }
- } else if (value) {
- return { checked: true };
- }
- };
- vModelDynamic.getSSRProps = (binding, vnode) => {
- if (typeof vnode.type !== "string") {
- return;
- }
- const modelToUse = resolveDynamicModel(
- // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
- vnode.type.toUpperCase(),
- vnode.props && vnode.props.type
- );
- if (modelToUse.getSSRProps) {
- return modelToUse.getSSRProps(binding, vnode);
- }
- };
- }
- const systemModifiers = ["ctrl", "shift", "alt", "meta"];
- const modifierGuards = {
- stop: (e) => e.stopPropagation(),
- prevent: (e) => e.preventDefault(),
- self: (e) => e.target !== e.currentTarget,
- ctrl: (e) => !e.ctrlKey,
- shift: (e) => !e.shiftKey,
- alt: (e) => !e.altKey,
- meta: (e) => !e.metaKey,
- left: (e) => "button" in e && e.button !== 0,
- middle: (e) => "button" in e && e.button !== 1,
- right: (e) => "button" in e && e.button !== 2,
- exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
- };
- const withModifiers = (fn, modifiers) => {
- const cache = fn._withMods || (fn._withMods = {});
- const cacheKey = modifiers.join(".");
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
- for (let i = 0; i < modifiers.length; i++) {
- const guard = modifierGuards[modifiers[i]];
- if (guard && guard(event, modifiers)) return;
- }
- return fn(event, ...args);
- });
- };
- const keyNames = {
- esc: "escape",
- space: " ",
- up: "arrow-up",
- left: "arrow-left",
- right: "arrow-right",
- down: "arrow-down",
- delete: "backspace"
- };
- const withKeys = (fn, modifiers) => {
- const cache = fn._withKeys || (fn._withKeys = {});
- const cacheKey = modifiers.join(".");
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
- if (!("key" in event)) {
- return;
- }
- const eventKey = hyphenate(event.key);
- if (modifiers.some(
- (k) => k === eventKey || keyNames[k] === eventKey
- )) {
- return fn(event);
- }
- });
- };
- const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
- let renderer;
- let enabledHydration = false;
- function ensureRenderer() {
- return renderer || (renderer = createRenderer(rendererOptions));
- }
- function ensureHydrationRenderer() {
- renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
- enabledHydration = true;
- return renderer;
- }
- const render = (...args) => {
- ensureRenderer().render(...args);
- };
- const hydrate = (...args) => {
- ensureHydrationRenderer().hydrate(...args);
- };
- const createApp = (...args) => {
- const app = ensureRenderer().createApp(...args);
- if (!!(process.env.NODE_ENV !== "production")) {
- injectNativeTagCheck(app);
- injectCompilerOptionsCheck(app);
- }
- const { mount } = app;
- app.mount = (containerOrSelector) => {
- const container = normalizeContainer(containerOrSelector);
- if (!container) return;
- const component = app._component;
- if (!isFunction(component) && !component.render && !component.template) {
- component.template = container.innerHTML;
- }
- if (container.nodeType === 1) {
- container.textContent = "";
- }
- const proxy = mount(container, false, resolveRootNamespace(container));
- if (container instanceof Element) {
- container.removeAttribute("v-cloak");
- container.setAttribute("data-v-app", "");
- }
- return proxy;
- };
- return app;
- };
- const createSSRApp = (...args) => {
- const app = ensureHydrationRenderer().createApp(...args);
- if (!!(process.env.NODE_ENV !== "production")) {
- injectNativeTagCheck(app);
- injectCompilerOptionsCheck(app);
- }
- const { mount } = app;
- app.mount = (containerOrSelector) => {
- const container = normalizeContainer(containerOrSelector);
- if (container) {
- return mount(container, true, resolveRootNamespace(container));
- }
- };
- return app;
- };
- function resolveRootNamespace(container) {
- if (container instanceof SVGElement) {
- return "svg";
- }
- if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
- return "mathml";
- }
- }
- function injectNativeTagCheck(app) {
- Object.defineProperty(app.config, "isNativeTag", {
- value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
- writable: false
- });
- }
- function injectCompilerOptionsCheck(app) {
- if (isRuntimeOnly()) {
- const isCustomElement = app.config.isCustomElement;
- Object.defineProperty(app.config, "isCustomElement", {
- get() {
- return isCustomElement;
- },
- set() {
- warn(
- `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
- );
- }
- });
- const compilerOptions = app.config.compilerOptions;
- const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
- - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
- - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
- - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
- Object.defineProperty(app.config, "compilerOptions", {
- get() {
- warn(msg);
- return compilerOptions;
- },
- set() {
- warn(msg);
- }
- });
- }
- }
- function normalizeContainer(container) {
- if (isString(container)) {
- const res = document.querySelector(container);
- if (!!(process.env.NODE_ENV !== "production") && !res) {
- warn(
- `Failed to mount app: mount target selector "${container}" returned null.`
- );
- }
- return res;
- }
- if (!!(process.env.NODE_ENV !== "production") && window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
- warn(
- `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
- );
- }
- return container;
- }
- let ssrDirectiveInitialized = false;
- const initDirectivesForSSR = () => {
- if (!ssrDirectiveInitialized) {
- ssrDirectiveInitialized = true;
- initVModelForSSR();
- initVShowForSSR();
- }
- } ;
- export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
|