source: node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js

Last change on this file was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago

Initial commit

  • Property mode set to 100644
File size: 56.2 KB
RevLine 
[57e58a3]1/**
2* @vue/runtime-dom v3.5.13
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeUpdate, queuePostFlushCb, onMounted, watch, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
7export * from '@vue/runtime-core';
8import { extend, isObject, toNumber, isArray, NOOP, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, isOn, isModelListener, camelize as camelize$1, isPlainObject, hasOwn, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
9
10let policy = void 0;
11const tt = typeof window !== "undefined" && window.trustedTypes;
12if (tt) {
13 try {
14 policy = /* @__PURE__ */ tt.createPolicy("vue", {
15 createHTML: (val) => val
16 });
17 } catch (e) {
18 !!(process.env.NODE_ENV !== "production") && warn(`Error creating trusted types policy: ${e}`);
19 }
20}
21const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
22const svgNS = "http://www.w3.org/2000/svg";
23const mathmlNS = "http://www.w3.org/1998/Math/MathML";
24const doc = typeof document !== "undefined" ? document : null;
25const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
26const nodeOps = {
27 insert: (child, parent, anchor) => {
28 parent.insertBefore(child, anchor || null);
29 },
30 remove: (child) => {
31 const parent = child.parentNode;
32 if (parent) {
33 parent.removeChild(child);
34 }
35 },
36 createElement: (tag, namespace, is, props) => {
37 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
38 if (tag === "select" && props && props.multiple != null) {
39 el.setAttribute("multiple", props.multiple);
40 }
41 return el;
42 },
43 createText: (text) => doc.createTextNode(text),
44 createComment: (text) => doc.createComment(text),
45 setText: (node, text) => {
46 node.nodeValue = text;
47 },
48 setElementText: (el, text) => {
49 el.textContent = text;
50 },
51 parentNode: (node) => node.parentNode,
52 nextSibling: (node) => node.nextSibling,
53 querySelector: (selector) => doc.querySelector(selector),
54 setScopeId(el, id) {
55 el.setAttribute(id, "");
56 },
57 // __UNSAFE__
58 // Reason: innerHTML.
59 // Static content here can only come from compiled templates.
60 // As long as the user only uses trusted templates, this is safe.
61 insertStaticContent(content, parent, anchor, namespace, start, end) {
62 const before = anchor ? anchor.previousSibling : parent.lastChild;
63 if (start && (start === end || start.nextSibling)) {
64 while (true) {
65 parent.insertBefore(start.cloneNode(true), anchor);
66 if (start === end || !(start = start.nextSibling)) break;
67 }
68 } else {
69 templateContainer.innerHTML = unsafeToTrustedHTML(
70 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
71 );
72 const template = templateContainer.content;
73 if (namespace === "svg" || namespace === "mathml") {
74 const wrapper = template.firstChild;
75 while (wrapper.firstChild) {
76 template.appendChild(wrapper.firstChild);
77 }
78 template.removeChild(wrapper);
79 }
80 parent.insertBefore(template, anchor);
81 }
82 return [
83 // first
84 before ? before.nextSibling : parent.firstChild,
85 // last
86 anchor ? anchor.previousSibling : parent.lastChild
87 ];
88 }
89};
90
91const TRANSITION = "transition";
92const ANIMATION = "animation";
93const vtcKey = Symbol("_vtc");
94const DOMTransitionPropsValidators = {
95 name: String,
96 type: String,
97 css: {
98 type: Boolean,
99 default: true
100 },
101 duration: [String, Number, Object],
102 enterFromClass: String,
103 enterActiveClass: String,
104 enterToClass: String,
105 appearFromClass: String,
106 appearActiveClass: String,
107 appearToClass: String,
108 leaveFromClass: String,
109 leaveActiveClass: String,
110 leaveToClass: String
111};
112const TransitionPropsValidators = /* @__PURE__ */ extend(
113 {},
114 BaseTransitionPropsValidators,
115 DOMTransitionPropsValidators
116);
117const decorate$1 = (t) => {
118 t.displayName = "Transition";
119 t.props = TransitionPropsValidators;
120 return t;
121};
122const Transition = /* @__PURE__ */ decorate$1(
123 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
124);
125const callHook = (hook, args = []) => {
126 if (isArray(hook)) {
127 hook.forEach((h2) => h2(...args));
128 } else if (hook) {
129 hook(...args);
130 }
131};
132const hasExplicitCallback = (hook) => {
133 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
134};
135function resolveTransitionProps(rawProps) {
136 const baseProps = {};
137 for (const key in rawProps) {
138 if (!(key in DOMTransitionPropsValidators)) {
139 baseProps[key] = rawProps[key];
140 }
141 }
142 if (rawProps.css === false) {
143 return baseProps;
144 }
145 const {
146 name = "v",
147 type,
148 duration,
149 enterFromClass = `${name}-enter-from`,
150 enterActiveClass = `${name}-enter-active`,
151 enterToClass = `${name}-enter-to`,
152 appearFromClass = enterFromClass,
153 appearActiveClass = enterActiveClass,
154 appearToClass = enterToClass,
155 leaveFromClass = `${name}-leave-from`,
156 leaveActiveClass = `${name}-leave-active`,
157 leaveToClass = `${name}-leave-to`
158 } = rawProps;
159 const durations = normalizeDuration(duration);
160 const enterDuration = durations && durations[0];
161 const leaveDuration = durations && durations[1];
162 const {
163 onBeforeEnter,
164 onEnter,
165 onEnterCancelled,
166 onLeave,
167 onLeaveCancelled,
168 onBeforeAppear = onBeforeEnter,
169 onAppear = onEnter,
170 onAppearCancelled = onEnterCancelled
171 } = baseProps;
172 const finishEnter = (el, isAppear, done, isCancelled) => {
173 el._enterCancelled = isCancelled;
174 removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
175 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
176 done && done();
177 };
178 const finishLeave = (el, done) => {
179 el._isLeaving = false;
180 removeTransitionClass(el, leaveFromClass);
181 removeTransitionClass(el, leaveToClass);
182 removeTransitionClass(el, leaveActiveClass);
183 done && done();
184 };
185 const makeEnterHook = (isAppear) => {
186 return (el, done) => {
187 const hook = isAppear ? onAppear : onEnter;
188 const resolve = () => finishEnter(el, isAppear, done);
189 callHook(hook, [el, resolve]);
190 nextFrame(() => {
191 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
192 addTransitionClass(el, isAppear ? appearToClass : enterToClass);
193 if (!hasExplicitCallback(hook)) {
194 whenTransitionEnds(el, type, enterDuration, resolve);
195 }
196 });
197 };
198 };
199 return extend(baseProps, {
200 onBeforeEnter(el) {
201 callHook(onBeforeEnter, [el]);
202 addTransitionClass(el, enterFromClass);
203 addTransitionClass(el, enterActiveClass);
204 },
205 onBeforeAppear(el) {
206 callHook(onBeforeAppear, [el]);
207 addTransitionClass(el, appearFromClass);
208 addTransitionClass(el, appearActiveClass);
209 },
210 onEnter: makeEnterHook(false),
211 onAppear: makeEnterHook(true),
212 onLeave(el, done) {
213 el._isLeaving = true;
214 const resolve = () => finishLeave(el, done);
215 addTransitionClass(el, leaveFromClass);
216 if (!el._enterCancelled) {
217 forceReflow();
218 addTransitionClass(el, leaveActiveClass);
219 } else {
220 addTransitionClass(el, leaveActiveClass);
221 forceReflow();
222 }
223 nextFrame(() => {
224 if (!el._isLeaving) {
225 return;
226 }
227 removeTransitionClass(el, leaveFromClass);
228 addTransitionClass(el, leaveToClass);
229 if (!hasExplicitCallback(onLeave)) {
230 whenTransitionEnds(el, type, leaveDuration, resolve);
231 }
232 });
233 callHook(onLeave, [el, resolve]);
234 },
235 onEnterCancelled(el) {
236 finishEnter(el, false, void 0, true);
237 callHook(onEnterCancelled, [el]);
238 },
239 onAppearCancelled(el) {
240 finishEnter(el, true, void 0, true);
241 callHook(onAppearCancelled, [el]);
242 },
243 onLeaveCancelled(el) {
244 finishLeave(el);
245 callHook(onLeaveCancelled, [el]);
246 }
247 });
248}
249function normalizeDuration(duration) {
250 if (duration == null) {
251 return null;
252 } else if (isObject(duration)) {
253 return [NumberOf(duration.enter), NumberOf(duration.leave)];
254 } else {
255 const n = NumberOf(duration);
256 return [n, n];
257 }
258}
259function NumberOf(val) {
260 const res = toNumber(val);
261 if (!!(process.env.NODE_ENV !== "production")) {
262 assertNumber(res, "<transition> explicit duration");
263 }
264 return res;
265}
266function addTransitionClass(el, cls) {
267 cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
268 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
269}
270function removeTransitionClass(el, cls) {
271 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
272 const _vtc = el[vtcKey];
273 if (_vtc) {
274 _vtc.delete(cls);
275 if (!_vtc.size) {
276 el[vtcKey] = void 0;
277 }
278 }
279}
280function nextFrame(cb) {
281 requestAnimationFrame(() => {
282 requestAnimationFrame(cb);
283 });
284}
285let endId = 0;
286function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
287 const id = el._endId = ++endId;
288 const resolveIfNotStale = () => {
289 if (id === el._endId) {
290 resolve();
291 }
292 };
293 if (explicitTimeout != null) {
294 return setTimeout(resolveIfNotStale, explicitTimeout);
295 }
296 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
297 if (!type) {
298 return resolve();
299 }
300 const endEvent = type + "end";
301 let ended = 0;
302 const end = () => {
303 el.removeEventListener(endEvent, onEnd);
304 resolveIfNotStale();
305 };
306 const onEnd = (e) => {
307 if (e.target === el && ++ended >= propCount) {
308 end();
309 }
310 };
311 setTimeout(() => {
312 if (ended < propCount) {
313 end();
314 }
315 }, timeout + 1);
316 el.addEventListener(endEvent, onEnd);
317}
318function getTransitionInfo(el, expectedType) {
319 const styles = window.getComputedStyle(el);
320 const getStyleProperties = (key) => (styles[key] || "").split(", ");
321 const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
322 const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
323 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
324 const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
325 const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
326 const animationTimeout = getTimeout(animationDelays, animationDurations);
327 let type = null;
328 let timeout = 0;
329 let propCount = 0;
330 if (expectedType === TRANSITION) {
331 if (transitionTimeout > 0) {
332 type = TRANSITION;
333 timeout = transitionTimeout;
334 propCount = transitionDurations.length;
335 }
336 } else if (expectedType === ANIMATION) {
337 if (animationTimeout > 0) {
338 type = ANIMATION;
339 timeout = animationTimeout;
340 propCount = animationDurations.length;
341 }
342 } else {
343 timeout = Math.max(transitionTimeout, animationTimeout);
344 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
345 propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
346 }
347 const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
348 getStyleProperties(`${TRANSITION}Property`).toString()
349 );
350 return {
351 type,
352 timeout,
353 propCount,
354 hasTransform
355 };
356}
357function getTimeout(delays, durations) {
358 while (delays.length < durations.length) {
359 delays = delays.concat(delays);
360 }
361 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
362}
363function toMs(s) {
364 if (s === "auto") return 0;
365 return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
366}
367function forceReflow() {
368 return document.body.offsetHeight;
369}
370
371function patchClass(el, value, isSVG) {
372 const transitionClasses = el[vtcKey];
373 if (transitionClasses) {
374 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
375 }
376 if (value == null) {
377 el.removeAttribute("class");
378 } else if (isSVG) {
379 el.setAttribute("class", value);
380 } else {
381 el.className = value;
382 }
383}
384
385const vShowOriginalDisplay = Symbol("_vod");
386const vShowHidden = Symbol("_vsh");
387const vShow = {
388 beforeMount(el, { value }, { transition }) {
389 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
390 if (transition && value) {
391 transition.beforeEnter(el);
392 } else {
393 setDisplay(el, value);
394 }
395 },
396 mounted(el, { value }, { transition }) {
397 if (transition && value) {
398 transition.enter(el);
399 }
400 },
401 updated(el, { value, oldValue }, { transition }) {
402 if (!value === !oldValue) return;
403 if (transition) {
404 if (value) {
405 transition.beforeEnter(el);
406 setDisplay(el, true);
407 transition.enter(el);
408 } else {
409 transition.leave(el, () => {
410 setDisplay(el, false);
411 });
412 }
413 } else {
414 setDisplay(el, value);
415 }
416 },
417 beforeUnmount(el, { value }) {
418 setDisplay(el, value);
419 }
420};
421if (!!(process.env.NODE_ENV !== "production")) {
422 vShow.name = "show";
423}
424function setDisplay(el, value) {
425 el.style.display = value ? el[vShowOriginalDisplay] : "none";
426 el[vShowHidden] = !value;
427}
428function initVShowForSSR() {
429 vShow.getSSRProps = ({ value }) => {
430 if (!value) {
431 return { style: { display: "none" } };
432 }
433 };
434}
435
436const CSS_VAR_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? "CSS_VAR_TEXT" : "");
437function useCssVars(getter) {
438 const instance = getCurrentInstance();
439 if (!instance) {
440 !!(process.env.NODE_ENV !== "production") && warn(`useCssVars is called without current active component instance.`);
441 return;
442 }
443 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
444 Array.from(
445 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
446 ).forEach((node) => setVarsOnNode(node, vars));
447 };
448 if (!!(process.env.NODE_ENV !== "production")) {
449 instance.getCssVars = () => getter(instance.proxy);
450 }
451 const setVars = () => {
452 const vars = getter(instance.proxy);
453 if (instance.ce) {
454 setVarsOnNode(instance.ce, vars);
455 } else {
456 setVarsOnVNode(instance.subTree, vars);
457 }
458 updateTeleports(vars);
459 };
460 onBeforeUpdate(() => {
461 queuePostFlushCb(setVars);
462 });
463 onMounted(() => {
464 watch(setVars, NOOP, { flush: "post" });
465 const ob = new MutationObserver(setVars);
466 ob.observe(instance.subTree.el.parentNode, { childList: true });
467 onUnmounted(() => ob.disconnect());
468 });
469}
470function setVarsOnVNode(vnode, vars) {
471 if (vnode.shapeFlag & 128) {
472 const suspense = vnode.suspense;
473 vnode = suspense.activeBranch;
474 if (suspense.pendingBranch && !suspense.isHydrating) {
475 suspense.effects.push(() => {
476 setVarsOnVNode(suspense.activeBranch, vars);
477 });
478 }
479 }
480 while (vnode.component) {
481 vnode = vnode.component.subTree;
482 }
483 if (vnode.shapeFlag & 1 && vnode.el) {
484 setVarsOnNode(vnode.el, vars);
485 } else if (vnode.type === Fragment) {
486 vnode.children.forEach((c) => setVarsOnVNode(c, vars));
487 } else if (vnode.type === Static) {
488 let { el, anchor } = vnode;
489 while (el) {
490 setVarsOnNode(el, vars);
491 if (el === anchor) break;
492 el = el.nextSibling;
493 }
494 }
495}
496function setVarsOnNode(el, vars) {
497 if (el.nodeType === 1) {
498 const style = el.style;
499 let cssText = "";
500 for (const key in vars) {
501 style.setProperty(`--${key}`, vars[key]);
502 cssText += `--${key}: ${vars[key]};`;
503 }
504 style[CSS_VAR_TEXT] = cssText;
505 }
506}
507
508const displayRE = /(^|;)\s*display\s*:/;
509function patchStyle(el, prev, next) {
510 const style = el.style;
511 const isCssString = isString(next);
512 let hasControlledDisplay = false;
513 if (next && !isCssString) {
514 if (prev) {
515 if (!isString(prev)) {
516 for (const key in prev) {
517 if (next[key] == null) {
518 setStyle(style, key, "");
519 }
520 }
521 } else {
522 for (const prevStyle of prev.split(";")) {
523 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
524 if (next[key] == null) {
525 setStyle(style, key, "");
526 }
527 }
528 }
529 }
530 for (const key in next) {
531 if (key === "display") {
532 hasControlledDisplay = true;
533 }
534 setStyle(style, key, next[key]);
535 }
536 } else {
537 if (isCssString) {
538 if (prev !== next) {
539 const cssVarText = style[CSS_VAR_TEXT];
540 if (cssVarText) {
541 next += ";" + cssVarText;
542 }
543 style.cssText = next;
544 hasControlledDisplay = displayRE.test(next);
545 }
546 } else if (prev) {
547 el.removeAttribute("style");
548 }
549 }
550 if (vShowOriginalDisplay in el) {
551 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
552 if (el[vShowHidden]) {
553 style.display = "none";
554 }
555 }
556}
557const semicolonRE = /[^\\];\s*$/;
558const importantRE = /\s*!important$/;
559function setStyle(style, name, val) {
560 if (isArray(val)) {
561 val.forEach((v) => setStyle(style, name, v));
562 } else {
563 if (val == null) val = "";
564 if (!!(process.env.NODE_ENV !== "production")) {
565 if (semicolonRE.test(val)) {
566 warn(
567 `Unexpected semicolon at the end of '${name}' style value: '${val}'`
568 );
569 }
570 }
571 if (name.startsWith("--")) {
572 style.setProperty(name, val);
573 } else {
574 const prefixed = autoPrefix(style, name);
575 if (importantRE.test(val)) {
576 style.setProperty(
577 hyphenate(prefixed),
578 val.replace(importantRE, ""),
579 "important"
580 );
581 } else {
582 style[prefixed] = val;
583 }
584 }
585 }
586}
587const prefixes = ["Webkit", "Moz", "ms"];
588const prefixCache = {};
589function autoPrefix(style, rawName) {
590 const cached = prefixCache[rawName];
591 if (cached) {
592 return cached;
593 }
594 let name = camelize(rawName);
595 if (name !== "filter" && name in style) {
596 return prefixCache[rawName] = name;
597 }
598 name = capitalize(name);
599 for (let i = 0; i < prefixes.length; i++) {
600 const prefixed = prefixes[i] + name;
601 if (prefixed in style) {
602 return prefixCache[rawName] = prefixed;
603 }
604 }
605 return rawName;
606}
607
608const xlinkNS = "http://www.w3.org/1999/xlink";
609function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
610 if (isSVG && key.startsWith("xlink:")) {
611 if (value == null) {
612 el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
613 } else {
614 el.setAttributeNS(xlinkNS, key, value);
615 }
616 } else {
617 if (value == null || isBoolean && !includeBooleanAttr(value)) {
618 el.removeAttribute(key);
619 } else {
620 el.setAttribute(
621 key,
622 isBoolean ? "" : isSymbol(value) ? String(value) : value
623 );
624 }
625 }
626}
627
628function patchDOMProp(el, key, value, parentComponent, attrName) {
629 if (key === "innerHTML" || key === "textContent") {
630 if (value != null) {
631 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
632 }
633 return;
634 }
635 const tag = el.tagName;
636 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
637 !tag.includes("-")) {
638 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
639 const newValue = value == null ? (
640 // #11647: value should be set as empty string for null and undefined,
641 // but <input type="checkbox"> should be set as 'on'.
642 el.type === "checkbox" ? "on" : ""
643 ) : String(value);
644 if (oldValue !== newValue || !("_value" in el)) {
645 el.value = newValue;
646 }
647 if (value == null) {
648 el.removeAttribute(key);
649 }
650 el._value = value;
651 return;
652 }
653 let needRemove = false;
654 if (value === "" || value == null) {
655 const type = typeof el[key];
656 if (type === "boolean") {
657 value = includeBooleanAttr(value);
658 } else if (value == null && type === "string") {
659 value = "";
660 needRemove = true;
661 } else if (type === "number") {
662 value = 0;
663 needRemove = true;
664 }
665 }
666 try {
667 el[key] = value;
668 } catch (e) {
669 if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
670 warn(
671 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
672 e
673 );
674 }
675 }
676 needRemove && el.removeAttribute(attrName || key);
677}
678
679function addEventListener(el, event, handler, options) {
680 el.addEventListener(event, handler, options);
681}
682function removeEventListener(el, event, handler, options) {
683 el.removeEventListener(event, handler, options);
684}
685const veiKey = Symbol("_vei");
686function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
687 const invokers = el[veiKey] || (el[veiKey] = {});
688 const existingInvoker = invokers[rawName];
689 if (nextValue && existingInvoker) {
690 existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
691 } else {
692 const [name, options] = parseName(rawName);
693 if (nextValue) {
694 const invoker = invokers[rawName] = createInvoker(
695 !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue,
696 instance
697 );
698 addEventListener(el, name, invoker, options);
699 } else if (existingInvoker) {
700 removeEventListener(el, name, existingInvoker, options);
701 invokers[rawName] = void 0;
702 }
703 }
704}
705const optionsModifierRE = /(?:Once|Passive|Capture)$/;
706function parseName(name) {
707 let options;
708 if (optionsModifierRE.test(name)) {
709 options = {};
710 let m;
711 while (m = name.match(optionsModifierRE)) {
712 name = name.slice(0, name.length - m[0].length);
713 options[m[0].toLowerCase()] = true;
714 }
715 }
716 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
717 return [event, options];
718}
719let cachedNow = 0;
720const p = /* @__PURE__ */ Promise.resolve();
721const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
722function createInvoker(initialValue, instance) {
723 const invoker = (e) => {
724 if (!e._vts) {
725 e._vts = Date.now();
726 } else if (e._vts <= invoker.attached) {
727 return;
728 }
729 callWithAsyncErrorHandling(
730 patchStopImmediatePropagation(e, invoker.value),
731 instance,
732 5,
733 [e]
734 );
735 };
736 invoker.value = initialValue;
737 invoker.attached = getNow();
738 return invoker;
739}
740function sanitizeEventValue(value, propName) {
741 if (isFunction(value) || isArray(value)) {
742 return value;
743 }
744 warn(
745 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
746Expected function or array of functions, received type ${typeof value}.`
747 );
748 return NOOP;
749}
750function patchStopImmediatePropagation(e, value) {
751 if (isArray(value)) {
752 const originalStop = e.stopImmediatePropagation;
753 e.stopImmediatePropagation = () => {
754 originalStop.call(e);
755 e._stopped = true;
756 };
757 return value.map(
758 (fn) => (e2) => !e2._stopped && fn && fn(e2)
759 );
760 } else {
761 return value;
762 }
763}
764
765const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
766key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
767const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
768 const isSVG = namespace === "svg";
769 if (key === "class") {
770 patchClass(el, nextValue, isSVG);
771 } else if (key === "style") {
772 patchStyle(el, prevValue, nextValue);
773 } else if (isOn(key)) {
774 if (!isModelListener(key)) {
775 patchEvent(el, key, prevValue, nextValue, parentComponent);
776 }
777 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
778 patchDOMProp(el, key, nextValue);
779 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
780 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
781 }
782 } else if (
783 // #11081 force set props for possible async custom element
784 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
785 ) {
786 patchDOMProp(el, camelize$1(key), nextValue, parentComponent, key);
787 } else {
788 if (key === "true-value") {
789 el._trueValue = nextValue;
790 } else if (key === "false-value") {
791 el._falseValue = nextValue;
792 }
793 patchAttr(el, key, nextValue, isSVG);
794 }
795};
796function shouldSetAsProp(el, key, value, isSVG) {
797 if (isSVG) {
798 if (key === "innerHTML" || key === "textContent") {
799 return true;
800 }
801 if (key in el && isNativeOn(key) && isFunction(value)) {
802 return true;
803 }
804 return false;
805 }
806 if (key === "spellcheck" || key === "draggable" || key === "translate") {
807 return false;
808 }
809 if (key === "form") {
810 return false;
811 }
812 if (key === "list" && el.tagName === "INPUT") {
813 return false;
814 }
815 if (key === "type" && el.tagName === "TEXTAREA") {
816 return false;
817 }
818 if (key === "width" || key === "height") {
819 const tag = el.tagName;
820 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
821 return false;
822 }
823 }
824 if (isNativeOn(key) && isString(value)) {
825 return false;
826 }
827 return key in el;
828}
829
830const REMOVAL = {};
831/*! #__NO_SIDE_EFFECTS__ */
832// @__NO_SIDE_EFFECTS__
833function defineCustomElement(options, extraOptions, _createApp) {
834 const Comp = defineComponent(options, extraOptions);
835 if (isPlainObject(Comp)) extend(Comp, extraOptions);
836 class VueCustomElement extends VueElement {
837 constructor(initialProps) {
838 super(Comp, initialProps, _createApp);
839 }
840 }
841 VueCustomElement.def = Comp;
842 return VueCustomElement;
843}
844/*! #__NO_SIDE_EFFECTS__ */
845const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
846 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
847};
848const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
849};
850class VueElement extends BaseClass {
851 constructor(_def, _props = {}, _createApp = createApp) {
852 super();
853 this._def = _def;
854 this._props = _props;
855 this._createApp = _createApp;
856 this._isVueCE = true;
857 /**
858 * @internal
859 */
860 this._instance = null;
861 /**
862 * @internal
863 */
864 this._app = null;
865 /**
866 * @internal
867 */
868 this._nonce = this._def.nonce;
869 this._connected = false;
870 this._resolved = false;
871 this._numberProps = null;
872 this._styleChildren = /* @__PURE__ */ new WeakSet();
873 this._ob = null;
874 if (this.shadowRoot && _createApp !== createApp) {
875 this._root = this.shadowRoot;
876 } else {
877 if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
878 warn(
879 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
880 );
881 }
882 if (_def.shadowRoot !== false) {
883 this.attachShadow({ mode: "open" });
884 this._root = this.shadowRoot;
885 } else {
886 this._root = this;
887 }
888 }
889 if (!this._def.__asyncLoader) {
890 this._resolveProps(this._def);
891 }
892 }
893 connectedCallback() {
894 if (!this.isConnected) return;
895 if (!this.shadowRoot) {
896 this._parseSlots();
897 }
898 this._connected = true;
899 let parent = this;
900 while (parent = parent && (parent.parentNode || parent.host)) {
901 if (parent instanceof VueElement) {
902 this._parent = parent;
903 break;
904 }
905 }
906 if (!this._instance) {
907 if (this._resolved) {
908 this._setParent();
909 this._update();
910 } else {
911 if (parent && parent._pendingResolve) {
912 this._pendingResolve = parent._pendingResolve.then(() => {
913 this._pendingResolve = void 0;
914 this._resolveDef();
915 });
916 } else {
917 this._resolveDef();
918 }
919 }
920 }
921 }
922 _setParent(parent = this._parent) {
923 if (parent) {
924 this._instance.parent = parent._instance;
925 this._instance.provides = parent._instance.provides;
926 }
927 }
928 disconnectedCallback() {
929 this._connected = false;
930 nextTick(() => {
931 if (!this._connected) {
932 if (this._ob) {
933 this._ob.disconnect();
934 this._ob = null;
935 }
936 this._app && this._app.unmount();
937 if (this._instance) this._instance.ce = void 0;
938 this._app = this._instance = null;
939 }
940 });
941 }
942 /**
943 * resolve inner component definition (handle possible async component)
944 */
945 _resolveDef() {
946 if (this._pendingResolve) {
947 return;
948 }
949 for (let i = 0; i < this.attributes.length; i++) {
950 this._setAttr(this.attributes[i].name);
951 }
952 this._ob = new MutationObserver((mutations) => {
953 for (const m of mutations) {
954 this._setAttr(m.attributeName);
955 }
956 });
957 this._ob.observe(this, { attributes: true });
958 const resolve = (def, isAsync = false) => {
959 this._resolved = true;
960 this._pendingResolve = void 0;
961 const { props, styles } = def;
962 let numberProps;
963 if (props && !isArray(props)) {
964 for (const key in props) {
965 const opt = props[key];
966 if (opt === Number || opt && opt.type === Number) {
967 if (key in this._props) {
968 this._props[key] = toNumber(this._props[key]);
969 }
970 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize$1(key)] = true;
971 }
972 }
973 }
974 this._numberProps = numberProps;
975 if (isAsync) {
976 this._resolveProps(def);
977 }
978 if (this.shadowRoot) {
979 this._applyStyles(styles);
980 } else if (!!(process.env.NODE_ENV !== "production") && styles) {
981 warn(
982 "Custom element style injection is not supported when using shadowRoot: false"
983 );
984 }
985 this._mount(def);
986 };
987 const asyncDef = this._def.__asyncLoader;
988 if (asyncDef) {
989 this._pendingResolve = asyncDef().then(
990 (def) => resolve(this._def = def, true)
991 );
992 } else {
993 resolve(this._def);
994 }
995 }
996 _mount(def) {
997 if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
998 def.name = "VueElement";
999 }
1000 this._app = this._createApp(def);
1001 if (def.configureApp) {
1002 def.configureApp(this._app);
1003 }
1004 this._app._ceVNode = this._createVNode();
1005 this._app.mount(this._root);
1006 const exposed = this._instance && this._instance.exposed;
1007 if (!exposed) return;
1008 for (const key in exposed) {
1009 if (!hasOwn(this, key)) {
1010 Object.defineProperty(this, key, {
1011 // unwrap ref to be consistent with public instance behavior
1012 get: () => unref(exposed[key])
1013 });
1014 } else if (!!(process.env.NODE_ENV !== "production")) {
1015 warn(`Exposed property "${key}" already exists on custom element.`);
1016 }
1017 }
1018 }
1019 _resolveProps(def) {
1020 const { props } = def;
1021 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
1022 for (const key of Object.keys(this)) {
1023 if (key[0] !== "_" && declaredPropKeys.includes(key)) {
1024 this._setProp(key, this[key]);
1025 }
1026 }
1027 for (const key of declaredPropKeys.map(camelize$1)) {
1028 Object.defineProperty(this, key, {
1029 get() {
1030 return this._getProp(key);
1031 },
1032 set(val) {
1033 this._setProp(key, val, true, true);
1034 }
1035 });
1036 }
1037 }
1038 _setAttr(key) {
1039 if (key.startsWith("data-v-")) return;
1040 const has = this.hasAttribute(key);
1041 let value = has ? this.getAttribute(key) : REMOVAL;
1042 const camelKey = camelize$1(key);
1043 if (has && this._numberProps && this._numberProps[camelKey]) {
1044 value = toNumber(value);
1045 }
1046 this._setProp(camelKey, value, false, true);
1047 }
1048 /**
1049 * @internal
1050 */
1051 _getProp(key) {
1052 return this._props[key];
1053 }
1054 /**
1055 * @internal
1056 */
1057 _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
1058 if (val !== this._props[key]) {
1059 if (val === REMOVAL) {
1060 delete this._props[key];
1061 } else {
1062 this._props[key] = val;
1063 if (key === "key" && this._app) {
1064 this._app._ceVNode.key = val;
1065 }
1066 }
1067 if (shouldUpdate && this._instance) {
1068 this._update();
1069 }
1070 if (shouldReflect) {
1071 const ob = this._ob;
1072 ob && ob.disconnect();
1073 if (val === true) {
1074 this.setAttribute(hyphenate(key), "");
1075 } else if (typeof val === "string" || typeof val === "number") {
1076 this.setAttribute(hyphenate(key), val + "");
1077 } else if (!val) {
1078 this.removeAttribute(hyphenate(key));
1079 }
1080 ob && ob.observe(this, { attributes: true });
1081 }
1082 }
1083 }
1084 _update() {
1085 render(this._createVNode(), this._root);
1086 }
1087 _createVNode() {
1088 const baseProps = {};
1089 if (!this.shadowRoot) {
1090 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
1091 }
1092 const vnode = createVNode(this._def, extend(baseProps, this._props));
1093 if (!this._instance) {
1094 vnode.ce = (instance) => {
1095 this._instance = instance;
1096 instance.ce = this;
1097 instance.isCE = true;
1098 if (!!(process.env.NODE_ENV !== "production")) {
1099 instance.ceReload = (newStyles) => {
1100 if (this._styles) {
1101 this._styles.forEach((s) => this._root.removeChild(s));
1102 this._styles.length = 0;
1103 }
1104 this._applyStyles(newStyles);
1105 this._instance = null;
1106 this._update();
1107 };
1108 }
1109 const dispatch = (event, args) => {
1110 this.dispatchEvent(
1111 new CustomEvent(
1112 event,
1113 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
1114 )
1115 );
1116 };
1117 instance.emit = (event, ...args) => {
1118 dispatch(event, args);
1119 if (hyphenate(event) !== event) {
1120 dispatch(hyphenate(event), args);
1121 }
1122 };
1123 this._setParent();
1124 };
1125 }
1126 return vnode;
1127 }
1128 _applyStyles(styles, owner) {
1129 if (!styles) return;
1130 if (owner) {
1131 if (owner === this._def || this._styleChildren.has(owner)) {
1132 return;
1133 }
1134 this._styleChildren.add(owner);
1135 }
1136 const nonce = this._nonce;
1137 for (let i = styles.length - 1; i >= 0; i--) {
1138 const s = document.createElement("style");
1139 if (nonce) s.setAttribute("nonce", nonce);
1140 s.textContent = styles[i];
1141 this.shadowRoot.prepend(s);
1142 if (!!(process.env.NODE_ENV !== "production")) {
1143 if (owner) {
1144 if (owner.__hmrId) {
1145 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
1146 let entry = this._childStyles.get(owner.__hmrId);
1147 if (!entry) {
1148 this._childStyles.set(owner.__hmrId, entry = []);
1149 }
1150 entry.push(s);
1151 }
1152 } else {
1153 (this._styles || (this._styles = [])).push(s);
1154 }
1155 }
1156 }
1157 }
1158 /**
1159 * Only called when shadowRoot is false
1160 */
1161 _parseSlots() {
1162 const slots = this._slots = {};
1163 let n;
1164 while (n = this.firstChild) {
1165 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
1166 (slots[slotName] || (slots[slotName] = [])).push(n);
1167 this.removeChild(n);
1168 }
1169 }
1170 /**
1171 * Only called when shadowRoot is false
1172 */
1173 _renderSlots() {
1174 const outlets = (this._teleportTarget || this).querySelectorAll("slot");
1175 const scopeId = this._instance.type.__scopeId;
1176 for (let i = 0; i < outlets.length; i++) {
1177 const o = outlets[i];
1178 const slotName = o.getAttribute("name") || "default";
1179 const content = this._slots[slotName];
1180 const parent = o.parentNode;
1181 if (content) {
1182 for (const n of content) {
1183 if (scopeId && n.nodeType === 1) {
1184 const id = scopeId + "-s";
1185 const walker = document.createTreeWalker(n, 1);
1186 n.setAttribute(id, "");
1187 let child;
1188 while (child = walker.nextNode()) {
1189 child.setAttribute(id, "");
1190 }
1191 }
1192 parent.insertBefore(n, o);
1193 }
1194 } else {
1195 while (o.firstChild) parent.insertBefore(o.firstChild, o);
1196 }
1197 parent.removeChild(o);
1198 }
1199 }
1200 /**
1201 * @internal
1202 */
1203 _injectChildStyle(comp) {
1204 this._applyStyles(comp.styles, comp);
1205 }
1206 /**
1207 * @internal
1208 */
1209 _removeChildStyle(comp) {
1210 if (!!(process.env.NODE_ENV !== "production")) {
1211 this._styleChildren.delete(comp);
1212 if (this._childStyles && comp.__hmrId) {
1213 const oldStyles = this._childStyles.get(comp.__hmrId);
1214 if (oldStyles) {
1215 oldStyles.forEach((s) => this._root.removeChild(s));
1216 oldStyles.length = 0;
1217 }
1218 }
1219 }
1220 }
1221}
1222function useHost(caller) {
1223 const instance = getCurrentInstance();
1224 const el = instance && instance.ce;
1225 if (el) {
1226 return el;
1227 } else if (!!(process.env.NODE_ENV !== "production")) {
1228 if (!instance) {
1229 warn(
1230 `${caller || "useHost"} called without an active component instance.`
1231 );
1232 } else {
1233 warn(
1234 `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
1235 );
1236 }
1237 }
1238 return null;
1239}
1240function useShadowRoot() {
1241 const el = !!(process.env.NODE_ENV !== "production") ? useHost("useShadowRoot") : useHost();
1242 return el && el.shadowRoot;
1243}
1244
1245function useCssModule(name = "$style") {
1246 {
1247 const instance = getCurrentInstance();
1248 if (!instance) {
1249 !!(process.env.NODE_ENV !== "production") && warn(`useCssModule must be called inside setup()`);
1250 return EMPTY_OBJ;
1251 }
1252 const modules = instance.type.__cssModules;
1253 if (!modules) {
1254 !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS modules injected.`);
1255 return EMPTY_OBJ;
1256 }
1257 const mod = modules[name];
1258 if (!mod) {
1259 !!(process.env.NODE_ENV !== "production") && warn(`Current instance does not have CSS module named "${name}".`);
1260 return EMPTY_OBJ;
1261 }
1262 return mod;
1263 }
1264}
1265
1266const positionMap = /* @__PURE__ */ new WeakMap();
1267const newPositionMap = /* @__PURE__ */ new WeakMap();
1268const moveCbKey = Symbol("_moveCb");
1269const enterCbKey = Symbol("_enterCb");
1270const decorate = (t) => {
1271 delete t.props.mode;
1272 return t;
1273};
1274const TransitionGroupImpl = /* @__PURE__ */ decorate({
1275 name: "TransitionGroup",
1276 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
1277 tag: String,
1278 moveClass: String
1279 }),
1280 setup(props, { slots }) {
1281 const instance = getCurrentInstance();
1282 const state = useTransitionState();
1283 let prevChildren;
1284 let children;
1285 onUpdated(() => {
1286 if (!prevChildren.length) {
1287 return;
1288 }
1289 const moveClass = props.moveClass || `${props.name || "v"}-move`;
1290 if (!hasCSSTransform(
1291 prevChildren[0].el,
1292 instance.vnode.el,
1293 moveClass
1294 )) {
1295 return;
1296 }
1297 prevChildren.forEach(callPendingCbs);
1298 prevChildren.forEach(recordPosition);
1299 const movedChildren = prevChildren.filter(applyTranslation);
1300 forceReflow();
1301 movedChildren.forEach((c) => {
1302 const el = c.el;
1303 const style = el.style;
1304 addTransitionClass(el, moveClass);
1305 style.transform = style.webkitTransform = style.transitionDuration = "";
1306 const cb = el[moveCbKey] = (e) => {
1307 if (e && e.target !== el) {
1308 return;
1309 }
1310 if (!e || /transform$/.test(e.propertyName)) {
1311 el.removeEventListener("transitionend", cb);
1312 el[moveCbKey] = null;
1313 removeTransitionClass(el, moveClass);
1314 }
1315 };
1316 el.addEventListener("transitionend", cb);
1317 });
1318 });
1319 return () => {
1320 const rawProps = toRaw(props);
1321 const cssTransitionProps = resolveTransitionProps(rawProps);
1322 let tag = rawProps.tag || Fragment;
1323 prevChildren = [];
1324 if (children) {
1325 for (let i = 0; i < children.length; i++) {
1326 const child = children[i];
1327 if (child.el && child.el instanceof Element) {
1328 prevChildren.push(child);
1329 setTransitionHooks(
1330 child,
1331 resolveTransitionHooks(
1332 child,
1333 cssTransitionProps,
1334 state,
1335 instance
1336 )
1337 );
1338 positionMap.set(
1339 child,
1340 child.el.getBoundingClientRect()
1341 );
1342 }
1343 }
1344 }
1345 children = slots.default ? getTransitionRawChildren(slots.default()) : [];
1346 for (let i = 0; i < children.length; i++) {
1347 const child = children[i];
1348 if (child.key != null) {
1349 setTransitionHooks(
1350 child,
1351 resolveTransitionHooks(child, cssTransitionProps, state, instance)
1352 );
1353 } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
1354 warn(`<TransitionGroup> children must be keyed.`);
1355 }
1356 }
1357 return createVNode(tag, null, children);
1358 };
1359 }
1360});
1361const TransitionGroup = TransitionGroupImpl;
1362function callPendingCbs(c) {
1363 const el = c.el;
1364 if (el[moveCbKey]) {
1365 el[moveCbKey]();
1366 }
1367 if (el[enterCbKey]) {
1368 el[enterCbKey]();
1369 }
1370}
1371function recordPosition(c) {
1372 newPositionMap.set(c, c.el.getBoundingClientRect());
1373}
1374function applyTranslation(c) {
1375 const oldPos = positionMap.get(c);
1376 const newPos = newPositionMap.get(c);
1377 const dx = oldPos.left - newPos.left;
1378 const dy = oldPos.top - newPos.top;
1379 if (dx || dy) {
1380 const s = c.el.style;
1381 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
1382 s.transitionDuration = "0s";
1383 return c;
1384 }
1385}
1386function hasCSSTransform(el, root, moveClass) {
1387 const clone = el.cloneNode();
1388 const _vtc = el[vtcKey];
1389 if (_vtc) {
1390 _vtc.forEach((cls) => {
1391 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
1392 });
1393 }
1394 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
1395 clone.style.display = "none";
1396 const container = root.nodeType === 1 ? root : root.parentNode;
1397 container.appendChild(clone);
1398 const { hasTransform } = getTransitionInfo(clone);
1399 container.removeChild(clone);
1400 return hasTransform;
1401}
1402
1403const getModelAssigner = (vnode) => {
1404 const fn = vnode.props["onUpdate:modelValue"] || false;
1405 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
1406};
1407function onCompositionStart(e) {
1408 e.target.composing = true;
1409}
1410function onCompositionEnd(e) {
1411 const target = e.target;
1412 if (target.composing) {
1413 target.composing = false;
1414 target.dispatchEvent(new Event("input"));
1415 }
1416}
1417const assignKey = Symbol("_assign");
1418const vModelText = {
1419 created(el, { modifiers: { lazy, trim, number } }, vnode) {
1420 el[assignKey] = getModelAssigner(vnode);
1421 const castToNumber = number || vnode.props && vnode.props.type === "number";
1422 addEventListener(el, lazy ? "change" : "input", (e) => {
1423 if (e.target.composing) return;
1424 let domValue = el.value;
1425 if (trim) {
1426 domValue = domValue.trim();
1427 }
1428 if (castToNumber) {
1429 domValue = looseToNumber(domValue);
1430 }
1431 el[assignKey](domValue);
1432 });
1433 if (trim) {
1434 addEventListener(el, "change", () => {
1435 el.value = el.value.trim();
1436 });
1437 }
1438 if (!lazy) {
1439 addEventListener(el, "compositionstart", onCompositionStart);
1440 addEventListener(el, "compositionend", onCompositionEnd);
1441 addEventListener(el, "change", onCompositionEnd);
1442 }
1443 },
1444 // set value on mounted so it's after min/max for type="range"
1445 mounted(el, { value }) {
1446 el.value = value == null ? "" : value;
1447 },
1448 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1449 el[assignKey] = getModelAssigner(vnode);
1450 if (el.composing) return;
1451 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
1452 const newValue = value == null ? "" : value;
1453 if (elValue === newValue) {
1454 return;
1455 }
1456 if (document.activeElement === el && el.type !== "range") {
1457 if (lazy && value === oldValue) {
1458 return;
1459 }
1460 if (trim && el.value.trim() === newValue) {
1461 return;
1462 }
1463 }
1464 el.value = newValue;
1465 }
1466};
1467const vModelCheckbox = {
1468 // #4096 array checkboxes need to be deep traversed
1469 deep: true,
1470 created(el, _, vnode) {
1471 el[assignKey] = getModelAssigner(vnode);
1472 addEventListener(el, "change", () => {
1473 const modelValue = el._modelValue;
1474 const elementValue = getValue(el);
1475 const checked = el.checked;
1476 const assign = el[assignKey];
1477 if (isArray(modelValue)) {
1478 const index = looseIndexOf(modelValue, elementValue);
1479 const found = index !== -1;
1480 if (checked && !found) {
1481 assign(modelValue.concat(elementValue));
1482 } else if (!checked && found) {
1483 const filtered = [...modelValue];
1484 filtered.splice(index, 1);
1485 assign(filtered);
1486 }
1487 } else if (isSet(modelValue)) {
1488 const cloned = new Set(modelValue);
1489 if (checked) {
1490 cloned.add(elementValue);
1491 } else {
1492 cloned.delete(elementValue);
1493 }
1494 assign(cloned);
1495 } else {
1496 assign(getCheckboxValue(el, checked));
1497 }
1498 });
1499 },
1500 // set initial checked on mount to wait for true-value/false-value
1501 mounted: setChecked,
1502 beforeUpdate(el, binding, vnode) {
1503 el[assignKey] = getModelAssigner(vnode);
1504 setChecked(el, binding, vnode);
1505 }
1506};
1507function setChecked(el, { value, oldValue }, vnode) {
1508 el._modelValue = value;
1509 let checked;
1510 if (isArray(value)) {
1511 checked = looseIndexOf(value, vnode.props.value) > -1;
1512 } else if (isSet(value)) {
1513 checked = value.has(vnode.props.value);
1514 } else {
1515 if (value === oldValue) return;
1516 checked = looseEqual(value, getCheckboxValue(el, true));
1517 }
1518 if (el.checked !== checked) {
1519 el.checked = checked;
1520 }
1521}
1522const vModelRadio = {
1523 created(el, { value }, vnode) {
1524 el.checked = looseEqual(value, vnode.props.value);
1525 el[assignKey] = getModelAssigner(vnode);
1526 addEventListener(el, "change", () => {
1527 el[assignKey](getValue(el));
1528 });
1529 },
1530 beforeUpdate(el, { value, oldValue }, vnode) {
1531 el[assignKey] = getModelAssigner(vnode);
1532 if (value !== oldValue) {
1533 el.checked = looseEqual(value, vnode.props.value);
1534 }
1535 }
1536};
1537const vModelSelect = {
1538 // <select multiple> value need to be deep traversed
1539 deep: true,
1540 created(el, { value, modifiers: { number } }, vnode) {
1541 const isSetModel = isSet(value);
1542 addEventListener(el, "change", () => {
1543 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
1544 (o) => number ? looseToNumber(getValue(o)) : getValue(o)
1545 );
1546 el[assignKey](
1547 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
1548 );
1549 el._assigning = true;
1550 nextTick(() => {
1551 el._assigning = false;
1552 });
1553 });
1554 el[assignKey] = getModelAssigner(vnode);
1555 },
1556 // set value in mounted & updated because <select> relies on its children
1557 // <option>s.
1558 mounted(el, { value }) {
1559 setSelected(el, value);
1560 },
1561 beforeUpdate(el, _binding, vnode) {
1562 el[assignKey] = getModelAssigner(vnode);
1563 },
1564 updated(el, { value }) {
1565 if (!el._assigning) {
1566 setSelected(el, value);
1567 }
1568 }
1569};
1570function setSelected(el, value) {
1571 const isMultiple = el.multiple;
1572 const isArrayValue = isArray(value);
1573 if (isMultiple && !isArrayValue && !isSet(value)) {
1574 !!(process.env.NODE_ENV !== "production") && warn(
1575 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
1576 );
1577 return;
1578 }
1579 for (let i = 0, l = el.options.length; i < l; i++) {
1580 const option = el.options[i];
1581 const optionValue = getValue(option);
1582 if (isMultiple) {
1583 if (isArrayValue) {
1584 const optionType = typeof optionValue;
1585 if (optionType === "string" || optionType === "number") {
1586 option.selected = value.some((v) => String(v) === String(optionValue));
1587 } else {
1588 option.selected = looseIndexOf(value, optionValue) > -1;
1589 }
1590 } else {
1591 option.selected = value.has(optionValue);
1592 }
1593 } else if (looseEqual(getValue(option), value)) {
1594 if (el.selectedIndex !== i) el.selectedIndex = i;
1595 return;
1596 }
1597 }
1598 if (!isMultiple && el.selectedIndex !== -1) {
1599 el.selectedIndex = -1;
1600 }
1601}
1602function getValue(el) {
1603 return "_value" in el ? el._value : el.value;
1604}
1605function getCheckboxValue(el, checked) {
1606 const key = checked ? "_trueValue" : "_falseValue";
1607 return key in el ? el[key] : checked;
1608}
1609const vModelDynamic = {
1610 created(el, binding, vnode) {
1611 callModelHook(el, binding, vnode, null, "created");
1612 },
1613 mounted(el, binding, vnode) {
1614 callModelHook(el, binding, vnode, null, "mounted");
1615 },
1616 beforeUpdate(el, binding, vnode, prevVNode) {
1617 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
1618 },
1619 updated(el, binding, vnode, prevVNode) {
1620 callModelHook(el, binding, vnode, prevVNode, "updated");
1621 }
1622};
1623function resolveDynamicModel(tagName, type) {
1624 switch (tagName) {
1625 case "SELECT":
1626 return vModelSelect;
1627 case "TEXTAREA":
1628 return vModelText;
1629 default:
1630 switch (type) {
1631 case "checkbox":
1632 return vModelCheckbox;
1633 case "radio":
1634 return vModelRadio;
1635 default:
1636 return vModelText;
1637 }
1638 }
1639}
1640function callModelHook(el, binding, vnode, prevVNode, hook) {
1641 const modelToUse = resolveDynamicModel(
1642 el.tagName,
1643 vnode.props && vnode.props.type
1644 );
1645 const fn = modelToUse[hook];
1646 fn && fn(el, binding, vnode, prevVNode);
1647}
1648function initVModelForSSR() {
1649 vModelText.getSSRProps = ({ value }) => ({ value });
1650 vModelRadio.getSSRProps = ({ value }, vnode) => {
1651 if (vnode.props && looseEqual(vnode.props.value, value)) {
1652 return { checked: true };
1653 }
1654 };
1655 vModelCheckbox.getSSRProps = ({ value }, vnode) => {
1656 if (isArray(value)) {
1657 if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
1658 return { checked: true };
1659 }
1660 } else if (isSet(value)) {
1661 if (vnode.props && value.has(vnode.props.value)) {
1662 return { checked: true };
1663 }
1664 } else if (value) {
1665 return { checked: true };
1666 }
1667 };
1668 vModelDynamic.getSSRProps = (binding, vnode) => {
1669 if (typeof vnode.type !== "string") {
1670 return;
1671 }
1672 const modelToUse = resolveDynamicModel(
1673 // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
1674 vnode.type.toUpperCase(),
1675 vnode.props && vnode.props.type
1676 );
1677 if (modelToUse.getSSRProps) {
1678 return modelToUse.getSSRProps(binding, vnode);
1679 }
1680 };
1681}
1682
1683const systemModifiers = ["ctrl", "shift", "alt", "meta"];
1684const modifierGuards = {
1685 stop: (e) => e.stopPropagation(),
1686 prevent: (e) => e.preventDefault(),
1687 self: (e) => e.target !== e.currentTarget,
1688 ctrl: (e) => !e.ctrlKey,
1689 shift: (e) => !e.shiftKey,
1690 alt: (e) => !e.altKey,
1691 meta: (e) => !e.metaKey,
1692 left: (e) => "button" in e && e.button !== 0,
1693 middle: (e) => "button" in e && e.button !== 1,
1694 right: (e) => "button" in e && e.button !== 2,
1695 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
1696};
1697const withModifiers = (fn, modifiers) => {
1698 const cache = fn._withMods || (fn._withMods = {});
1699 const cacheKey = modifiers.join(".");
1700 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1701 for (let i = 0; i < modifiers.length; i++) {
1702 const guard = modifierGuards[modifiers[i]];
1703 if (guard && guard(event, modifiers)) return;
1704 }
1705 return fn(event, ...args);
1706 });
1707};
1708const keyNames = {
1709 esc: "escape",
1710 space: " ",
1711 up: "arrow-up",
1712 left: "arrow-left",
1713 right: "arrow-right",
1714 down: "arrow-down",
1715 delete: "backspace"
1716};
1717const withKeys = (fn, modifiers) => {
1718 const cache = fn._withKeys || (fn._withKeys = {});
1719 const cacheKey = modifiers.join(".");
1720 return cache[cacheKey] || (cache[cacheKey] = (event) => {
1721 if (!("key" in event)) {
1722 return;
1723 }
1724 const eventKey = hyphenate(event.key);
1725 if (modifiers.some(
1726 (k) => k === eventKey || keyNames[k] === eventKey
1727 )) {
1728 return fn(event);
1729 }
1730 });
1731};
1732
1733const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
1734let renderer;
1735let enabledHydration = false;
1736function ensureRenderer() {
1737 return renderer || (renderer = createRenderer(rendererOptions));
1738}
1739function ensureHydrationRenderer() {
1740 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
1741 enabledHydration = true;
1742 return renderer;
1743}
1744const render = (...args) => {
1745 ensureRenderer().render(...args);
1746};
1747const hydrate = (...args) => {
1748 ensureHydrationRenderer().hydrate(...args);
1749};
1750const createApp = (...args) => {
1751 const app = ensureRenderer().createApp(...args);
1752 if (!!(process.env.NODE_ENV !== "production")) {
1753 injectNativeTagCheck(app);
1754 injectCompilerOptionsCheck(app);
1755 }
1756 const { mount } = app;
1757 app.mount = (containerOrSelector) => {
1758 const container = normalizeContainer(containerOrSelector);
1759 if (!container) return;
1760 const component = app._component;
1761 if (!isFunction(component) && !component.render && !component.template) {
1762 component.template = container.innerHTML;
1763 }
1764 if (container.nodeType === 1) {
1765 container.textContent = "";
1766 }
1767 const proxy = mount(container, false, resolveRootNamespace(container));
1768 if (container instanceof Element) {
1769 container.removeAttribute("v-cloak");
1770 container.setAttribute("data-v-app", "");
1771 }
1772 return proxy;
1773 };
1774 return app;
1775};
1776const createSSRApp = (...args) => {
1777 const app = ensureHydrationRenderer().createApp(...args);
1778 if (!!(process.env.NODE_ENV !== "production")) {
1779 injectNativeTagCheck(app);
1780 injectCompilerOptionsCheck(app);
1781 }
1782 const { mount } = app;
1783 app.mount = (containerOrSelector) => {
1784 const container = normalizeContainer(containerOrSelector);
1785 if (container) {
1786 return mount(container, true, resolveRootNamespace(container));
1787 }
1788 };
1789 return app;
1790};
1791function resolveRootNamespace(container) {
1792 if (container instanceof SVGElement) {
1793 return "svg";
1794 }
1795 if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
1796 return "mathml";
1797 }
1798}
1799function injectNativeTagCheck(app) {
1800 Object.defineProperty(app.config, "isNativeTag", {
1801 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
1802 writable: false
1803 });
1804}
1805function injectCompilerOptionsCheck(app) {
1806 if (isRuntimeOnly()) {
1807 const isCustomElement = app.config.isCustomElement;
1808 Object.defineProperty(app.config, "isCustomElement", {
1809 get() {
1810 return isCustomElement;
1811 },
1812 set() {
1813 warn(
1814 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
1815 );
1816 }
1817 });
1818 const compilerOptions = app.config.compilerOptions;
1819 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.
1820- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
1821- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
1822- 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`;
1823 Object.defineProperty(app.config, "compilerOptions", {
1824 get() {
1825 warn(msg);
1826 return compilerOptions;
1827 },
1828 set() {
1829 warn(msg);
1830 }
1831 });
1832 }
1833}
1834function normalizeContainer(container) {
1835 if (isString(container)) {
1836 const res = document.querySelector(container);
1837 if (!!(process.env.NODE_ENV !== "production") && !res) {
1838 warn(
1839 `Failed to mount app: mount target selector "${container}" returned null.`
1840 );
1841 }
1842 return res;
1843 }
1844 if (!!(process.env.NODE_ENV !== "production") && window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
1845 warn(
1846 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
1847 );
1848 }
1849 return container;
1850}
1851let ssrDirectiveInitialized = false;
1852const initDirectivesForSSR = () => {
1853 if (!ssrDirectiveInitialized) {
1854 ssrDirectiveInitialized = true;
1855 initVModelForSSR();
1856 initVShowForSSR();
1857 }
1858} ;
1859
1860export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, initDirectivesForSSR, render, useCssModule, useCssVars, useHost, useShadowRoot, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };
Note: See TracBrowser for help on using the repository browser.