@shijiu/jsview-vue 0.9.264 → 0.9.270

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1596 @@
1
+ import { camelize, warn, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, getCurrentInstance, watchPostEffect, onMounted, onUnmounted, Fragment, Static, h, BaseTransition, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, createRenderer, isRuntimeOnly, createHydrationRenderer } from '@vue/runtime-core';
2
+ export * from '@vue/runtime-core';
3
+ import { isString, isArray, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isOn, isModelListener, isFunction, camelize as camelize$1, toNumber, extend, EMPTY_OBJ, isObject, invokeArrayFns, looseIndexOf, isSet, looseEqual, isHTMLTag, isSVGTag } from '@vue/shared';
4
+
5
+ const svgNS = 'http://www.w3.org/2000/svg';
6
+ const doc = (typeof document !== 'undefined' ? document : null);
7
+ const staticTemplateCache = new Map();
8
+ const nodeOps = {
9
+ insert: (child, parent, anchor) => {
10
+ parent.insertBefore(child, anchor || null);
11
+ },
12
+ remove: child => {
13
+ const parent = child.parentNode;
14
+ if (parent) {
15
+ parent.removeChild(child);
16
+ }
17
+ },
18
+ createElement: (tag, isSVG, is, props) => {
19
+ const el = isSVG
20
+ ? doc.createElementNS(svgNS, tag)
21
+ : doc.createElement(tag, is ? { is } : undefined);
22
+ if (tag === 'select' && props && props.multiple != null) {
23
+ el.setAttribute('multiple', props.multiple);
24
+ }
25
+ return el;
26
+ },
27
+ createText: text => doc.createTextNode(text),
28
+ createComment: text => doc.createComment(text),
29
+ setText: (node, text) => {
30
+ node.nodeValue = text;
31
+ },
32
+ setElementText: (el, text) => {
33
+ el.textContent = text;
34
+ },
35
+ parentNode: node => node.parentNode,
36
+ nextSibling: node => node.nextSibling,
37
+ querySelector: selector => doc.querySelector(selector),
38
+ setScopeId(el, id) {
39
+ el.setAttribute(id, '');
40
+ },
41
+ cloneNode_JSV_REMOVED(el) {
42
  // QCode Removed
43
+ const cloned = el.cloneNode(true);
44
+ // #3072
45
+ // - in `patchDOMProp`, we store the actual value in the `el._value` property.
46
+ // - normally, elements using `:value` bindings will not be hoisted, but if
47
+ // the bound value is a constant, e.g. `:value="true"` - they do get
48
+ // hoisted.
49
+ // - in production, hoisted nodes are cloned when subsequent inserts, but
50
+ // cloneNode() does not copy the custom property we attached.
51
+ // - This may need to account for other custom DOM properties we attach to
52
+ // elements in addition to `_value` in the future.
53
+ if (`_value` in el) {
54
+ cloned._value = el._value;
55
+ }
56
+ return cloned;
57
+ },
58
+ // __UNSAFE__
59
+ // Reason: innerHTML.
60
+ // Static content here can only come from compiled templates.
61
+ // As long as the user only uses trusted templates, this is safe.
62
+ insertStaticContent(content, parent, anchor, isSVG) {
63
+ // <parent> before | first ... last | anchor </parent>
64
+ const before = anchor ? anchor.previousSibling : parent.lastChild;
65
+ let template = staticTemplateCache.get(content);
66
+ if (!template) {
67
+ const t = doc.createElement('template');
68
+ t.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
69
+ template = t.content;
70
+ if (isSVG) {
71
+ // remove outer svg wrapper
72
+ const wrapper = template.firstChild;
73
+ while (wrapper.firstChild) {
74
+ template.appendChild(wrapper.firstChild);
75
+ }
76
+ template.removeChild(wrapper);
77
+ }
78
+ staticTemplateCache.set(content, template);
79
+ }
80
+ parent.insertBefore(template.cloneNode(true), anchor);
81
+ return [
82
+ // first
83
+ before ? before.nextSibling : parent.firstChild,
84
+ // last
85
+ anchor ? anchor.previousSibling : parent.lastChild
86
+ ];
87
+ }
88
+ };
89
+
90
+ // compiler should normalize class + :class bindings on the same element
91
+ // into a single binding ['staticClass', dynamic]
92
+ function patchClass(el, value, isSVG) {
93
+ // directly setting className should be faster than setAttribute in theory
94
+ // if this is an element during a transition, take the temporary transition
95
+ // classes into account.
96
+ const transitionClasses = el._vtc;
97
+ if (transitionClasses) {
98
+ value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(' ');
99
+ }
100
+ if (value == null) {
101
+ el.removeAttribute('class');
102
+ }
103
+ else if (isSVG) {
104
+ el.setAttribute('class', value);
105
+ }
106
+ else {
107
+ el.className = value;
108
+ }
109
+ }
110
+
111
+ function patchStyle(el, prev, next) {
112
+ const style = el.style;
113
+ if (!next) {
114
+ el.removeAttribute('style');
115
+ }
116
+ else if (isString(next)) {
117
+ if (prev !== next) {
118
+ const current = style.display;
119
+ style.cssText = next;
120
+ // indicates that the `display` of the element is controlled by `v-show`,
121
+ // so we always keep the current `display` value regardless of the `style` value,
122
+ // thus handing over control to `v-show`.
123
+ if ('_vod' in el) {
124
+ style.display = current;
125
+ }
126
+ }
127
+ }
128
+ else {
129
+ for (const key in next) {
130
+ setStyle(style, key, next[key]);
131
+ }
132
+ if (prev && !isString(prev)) {
133
+ for (const key in prev) {
134
+ if (next[key] == null) {
135
+ setStyle(style, key, '');
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ const importantRE = /\s*!important$/;
142
+ function setStyle(style, name, val) {
143
+ if (isArray(val)) {
144
+ val.forEach(v => setStyle(style, name, v));
145
+ }
146
+ else {
147
+ if (name.startsWith('--')) {
148
+ // custom property definition
149
+ style.setProperty(name, val);
150
+ }
151
+ else {
152
+ const prefixed = autoPrefix(style, name);
153
+ if (importantRE.test(val)) {
154
+ // !important
155
+ style.setProperty(hyphenate(prefixed), val.replace(importantRE, ''), 'important');
156
+ }
157
+ else {
158
+ style[prefixed] = val;
159
+ }
160
+ }
161
+ }
162
+ }
163
+ const prefixes = ['Webkit', 'Moz', 'ms'];
164
+ const prefixCache = {};
165
+ function autoPrefix(style, rawName) {
166
+ const cached = prefixCache[rawName];
167
+ if (cached) {
168
+ return cached;
169
+ }
170
+ let name = camelize(rawName);
171
+ if (name !== 'filter' && name in style) {
172
+ return (prefixCache[rawName] = name);
173
+ }
174
+ name = capitalize(name);
175
+ for (let i = 0; i < prefixes.length; i++) {
176
+ const prefixed = prefixes[i] + name;
177
+ if (prefixed in style) {
178
+ return (prefixCache[rawName] = prefixed);
179
+ }
180
+ }
181
+ return rawName;
182
+ }
183
+
184
+ const xlinkNS = 'http://www.w3.org/1999/xlink';
185
+ function patchAttr(el, key, value, isSVG, instance) {
186
+ if (isSVG && key.startsWith('xlink:')) {
187
+ if (value == null) {
188
+ el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
189
+ }
190
+ else {
191
+ el.setAttributeNS(xlinkNS, key, value);
192
+ }
193
+ }
194
+ else {
195
+ // note we are only checking boolean attributes that don't have a
196
+ // corresponding dom prop of the same name here.
197
+ const isBoolean = isSpecialBooleanAttr(key);
198
+ if (value == null || (isBoolean && !includeBooleanAttr(value))) {
199
+ el.removeAttribute(key);
200
+ }
201
+ else {
202
+ el.setAttribute(key, isBoolean ? '' : value);
203
+ }
204
+ }
205
+ }
206
+
207
+ // __UNSAFE__
208
+ // functions. The user is responsible for using them with only trusted content.
209
+ function patchDOMProp(el, key, value,
210
+ // the following args are passed only due to potential innerHTML/textContent
211
+ // overriding existing VNodes, in which case the old tree must be properly
212
+ // unmounted.
213
+ prevChildren, parentComponent, parentSuspense, unmountChildren) {
214
+ if (key === 'innerHTML' || key === 'textContent') {
215
+ if (prevChildren) {
216
+ unmountChildren(prevChildren, parentComponent, parentSuspense);
217
+ }
218
+ el[key] = value == null ? '' : value;
219
+ return;
220
+ }
221
+ if (key === 'value' && el.tagName !== 'PROGRESS') {
222
+ // store value as _value as well since
223
+ // non-string values will be stringified.
224
+ el._value = value;
225
+ const newValue = value == null ? '' : value;
226
+ if (el.value !== newValue) {
227
+ el.value = newValue;
228
+ }
229
+ if (value == null) {
230
+ el.removeAttribute(key);
231
+ }
232
+ return;
233
+ }
234
+ if (value === '' || value == null) {
235
+ const type = typeof el[key];
236
+ if (type === 'boolean') {
237
+ // e.g. <select multiple> compiles to { multiple: '' }
238
+ el[key] = includeBooleanAttr(value);
239
+ return;
240
+ }
241
+ else if (value == null && type === 'string') {
242
+ // e.g. <div :id="null">
243
+ el[key] = '';
244
+ el.removeAttribute(key);
245
+ return;
246
+ }
247
+ else if (type === 'number') {
248
+ // e.g. <img :width="null">
249
+ // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
250
+ try {
251
+ el[key] = 0;
252
+ }
253
+ catch (_a) { }
254
+ el.removeAttribute(key);
255
+ return;
256
+ }
257
+ }
258
+ // some properties perform value validation and throw
259
+ try {
260
+ el[key] = value;
261
+ }
262
+ catch (e) {
263
+ if ((process.env.NODE_ENV !== 'production')) {
264
+ warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
265
+ `value ${value} is invalid.`, e);
266
+ }
267
+ }
268
+ }
269
+
270
+ // Async edge case fix requires storing an event listener's attach timestamp.
271
+ let _getNow = Date.now;
272
+ let skipTimestampCheck = false;
273
+ if (typeof window !== 'undefined') {
274
+ // Determine what event timestamp the browser is using. Annoyingly, the
275
+ // timestamp can either be hi-res (relative to page load) or low-res
276
+ // (relative to UNIX epoch), so in order to compare time we have to use the
277
+ // same timestamp type when saving the flush timestamp.
278
+ if (_getNow() > document.createEvent('Event').timeStamp) {
279
+ // if the low-res timestamp which is bigger than the event timestamp
280
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
281
+ // and we need to use the hi-res version for event listeners as well.
282
+ _getNow = () => performance.now();
283
+ }
284
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
285
+ // and does not fire microtasks in between event propagation, so safe to exclude.
286
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
287
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
288
+ }
289
+ // To avoid the overhead of repeatedly calling performance.now(), we cache
290
+ // and use the same timestamp for all event listeners attached in the same tick.
291
+ let cachedNow = 0;
292
+ const p = Promise.resolve();
293
+ const reset = () => {
294
+ cachedNow = 0;
295
+ };
296
+ const getNow = () => cachedNow || (p.then(reset), (cachedNow = _getNow()));
297
+ function addEventListener(el, event, handler, options) {
298
+ el.addEventListener(event, handler, options);
299
+ }
300
+ function removeEventListener(el, event, handler, options) {
301
+ el.removeEventListener(event, handler, options);
302
+ }
303
+ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
304
+ // vei = vue event invokers
305
+ const invokers = el._vei || (el._vei = {});
306
+ const existingInvoker = invokers[rawName];
307
+ if (nextValue && existingInvoker) {
308
+ // patch
309
+ existingInvoker.value = nextValue;
310
+ }
311
+ else {
312
+ const [name, options] = parseName(rawName);
313
+ if (nextValue) {
314
+ // add
315
+ const invoker = (invokers[rawName] = createInvoker(nextValue, instance));
316
+ addEventListener(el, name, invoker, options);
317
+ }
318
+ else if (existingInvoker) {
319
+ // remove
320
+ removeEventListener(el, name, existingInvoker, options);
321
+ invokers[rawName] = undefined;
322
+ }
323
+ }
324
+ }
325
+ const optionsModifierRE = /(?:Once|Passive|Capture)$/;
326
+ function parseName(name) {
327
+ let options;
328
+ if (optionsModifierRE.test(name)) {
329
+ options = {};
330
+ let m;
331
+ while ((m = name.match(optionsModifierRE))) {
332
+ name = name.slice(0, name.length - m[0].length);
333
+ options[m[0].toLowerCase()] = true;
334
+ }
335
+ }
336
+ return [hyphenate(name.slice(2)), options];
337
+ }
338
+ function createInvoker(initialValue, instance) {
339
+ const invoker = (e) => {
340
+ // async edge case #6566: inner click event triggers patch, event handler
341
+ // attached to outer element during patch, and triggered again. This
342
+ // happens because browsers fire microtask ticks between event propagation.
343
+ // the solution is simple: we save the timestamp when a handler is attached,
344
+ // and the handler would only fire if the event passed to it was fired
345
+ // AFTER it was attached.
346
+ const timeStamp = e.timeStamp || _getNow();
347
+ if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
348
+ callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
349
+ }
350
+ };
351
+ invoker.value = initialValue;
352
+ invoker.attached = getNow();
353
+ return invoker;
354
+ }
355
+ function patchStopImmediatePropagation(e, value) {
356
+ if (isArray(value)) {
357
+ const originalStop = e.stopImmediatePropagation;
358
+ e.stopImmediatePropagation = () => {
359
+ originalStop.call(e);
360
+ e._stopped = true;
361
+ };
362
+ return value.map(fn => (e) => !e._stopped && fn(e));
363
+ }
364
+ else {
365
+ return value;
366
+ }
367
+ }
368
+
369
+ const nativeOnRE = /^on[a-z]/;
370
+ const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
371
+ if (key === 'class') {
372
+ patchClass(el, nextValue, isSVG);
373
+ }
374
+ else if (key === 'style') {
375
+ patchStyle(el, prevValue, nextValue);
376
+ }
377
+ else if (isOn(key)) {
378
+ // ignore v-model listeners
379
+ if (!isModelListener(key)) {
380
+ patchEvent(el, key, prevValue, nextValue, parentComponent);
381
+ }
382
+ }
383
+ else if (key[0] === '.'
384
+ ? ((key = key.slice(1)), true)
385
+ : key[0] === '^'
386
+ ? ((key = key.slice(1)), false)
387
+ : shouldSetAsProp(el, key, nextValue, isSVG)) {
388
+ patchDOMProp(el, key, nextValue, prevChildren, parentComponent, parentSuspense, unmountChildren);
389
+ }
390
+ else {
391
+ // special case for <input v-model type="checkbox"> with
392
+ // :true-value & :false-value
393
+ // store value as dom properties since non-string values will be
394
+ // stringified.
395
+ if (key === 'true-value') {
396
+ el._trueValue = nextValue;
397
+ }
398
+ else if (key === 'false-value') {
399
+ el._falseValue = nextValue;
400
+ }
401
+ patchAttr(el, key, nextValue, isSVG);
402
+ }
403
+ };
404
+ function shouldSetAsProp(el, key, value, isSVG) {
405
+ if (isSVG) {
406
+ // most keys must be set as attribute on svg elements to work
407
+ // ...except innerHTML & textContent
408
+ if (key === 'innerHTML' || key === 'textContent') {
409
+ return true;
410
+ }
411
+ // or native onclick with function values
412
+ if (key in el && nativeOnRE.test(key) && isFunction(value)) {
413
+ return true;
414
+ }
415
+ return false;
416
+ }
417
+ // spellcheck and draggable are numerated attrs, however their
418
+ // corresponding DOM properties are actually booleans - this leads to
419
+ // setting it with a string "false" value leading it to be coerced to
420
+ // `true`, so we need to always treat them as attributes.
421
+ // Note that `contentEditable` doesn't have this problem: its DOM
422
+ // property is also enumerated string values.
423
+ if (key === 'spellcheck' || key === 'draggable') {
424
+ return false;
425
+ }
426
+ // #1787, #2840 form property on form elements is readonly and must be set as
427
+ // attribute.
428
+ if (key === 'form') {
429
+ return false;
430
+ }
431
+ // #1526 <input list> must be set as attribute
432
+ if (key === 'list' && el.tagName === 'INPUT') {
433
+ return false;
434
+ }
435
+ // #2766 <textarea type> must be set as attribute
436
+ if (key === 'type' && el.tagName === 'TEXTAREA') {
437
+ return false;
438
+ }
439
+ // native onclick with string value, must be set as attribute
440
+ if (nativeOnRE.test(key) && isString(value)) {
441
+ return false;
442
+ }
443
+ return key in el;
444
+ }
445
+
446
+ function defineCustomElement(options, hydate) {
447
+ const Comp = defineComponent(options);
448
+ class VueCustomElement extends VueElement {
449
+ constructor(initialProps) {
450
+ super(Comp, initialProps, hydate);
451
+ }
452
+ }
453
+ VueCustomElement.def = Comp;
454
+ return VueCustomElement;
455
+ }
456
+ const defineSSRCustomElement = ((options) => {
457
+ // @ts-ignore
458
+ return defineCustomElement(options, hydrate);
459
+ });
460
+ const BaseClass = (typeof HTMLElement !== 'undefined' ? HTMLElement : class {
461
+ });
462
+ class VueElement extends BaseClass {
463
+ constructor(_def, _props = {}, hydrate) {
464
+ super();
465
+ this._def = _def;
466
+ this._props = _props;
467
+ /**
468
+ * @internal
469
+ */
470
+ this._instance = null;
471
+ this._connected = false;
472
+ this._resolved = false;
473
+ if (this.shadowRoot && hydrate) {
474
+ hydrate(this._createVNode(), this.shadowRoot);
475
+ }
476
+ else {
477
+ if ((process.env.NODE_ENV !== 'production') && this.shadowRoot) {
478
+ warn(`Custom element has pre-rendered declarative shadow root but is not ` +
479
+ `defined as hydratable. Use \`defineSSRCustomElement\`.`);
480
+ }
481
+ this.attachShadow({ mode: 'open' });
482
+ }
483
+ // set initial attrs
484
+ for (let i = 0; i < this.attributes.length; i++) {
485
+ this._setAttr(this.attributes[i].name);
486
+ }
487
+ // watch future attr changes
488
+ const observer = new MutationObserver(mutations => {
489
+ for (const m of mutations) {
490
+ this._setAttr(m.attributeName);
491
+ }
492
+ });
493
+ observer.observe(this, { attributes: true });
494
+ }
495
+ connectedCallback() {
496
+ this._connected = true;
497
+ if (!this._instance) {
498
+ this._resolveDef();
499
+ render(this._createVNode(), this.shadowRoot);
500
+ }
501
+ }
502
+ disconnectedCallback() {
503
+ this._connected = false;
504
+ nextTick(() => {
505
+ if (!this._connected) {
506
+ render(null, this.shadowRoot);
507
+ this._instance = null;
508
+ }
509
+ });
510
+ }
511
+ /**
512
+ * resolve inner component definition (handle possible async component)
513
+ */
514
+ _resolveDef() {
515
+ if (this._resolved) {
516
+ return;
517
+ }
518
+ const resolve = (def) => {
519
+ this._resolved = true;
520
+ // check if there are props set pre-upgrade or connect
521
+ for (const key of Object.keys(this)) {
522
+ if (key[0] !== '_') {
523
+ this._setProp(key, this[key]);
524
+ }
525
+ }
526
+ const { props, styles } = def;
527
+ // defining getter/setters on prototype
528
+ const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
529
+ for (const key of rawKeys.map(camelize$1)) {
530
+ Object.defineProperty(this, key, {
531
+ get() {
532
+ return this._getProp(key);
533
+ },
534
+ set(val) {
535
+ this._setProp(key, val);
536
+ }
537
+ });
538
+ }
539
+ this._applyStyles(styles);
540
+ };
541
+ const asyncDef = this._def.__asyncLoader;
542
+ if (asyncDef) {
543
+ asyncDef().then(resolve);
544
+ }
545
+ else {
546
+ resolve(this._def);
547
+ }
548
+ }
549
+ _setAttr(key) {
550
+ this._setProp(camelize$1(key), toNumber(this.getAttribute(key)), false);
551
+ }
552
+ /**
553
+ * @internal
554
+ */
555
+ _getProp(key) {
556
+ return this._props[key];
557
+ }
558
+ /**
559
+ * @internal
560
+ */
561
+ _setProp(key, val, shouldReflect = true) {
562
+ if (val !== this._props[key]) {
563
+ this._props[key] = val;
564
+ if (this._instance) {
565
+ render(this._createVNode(), this.shadowRoot);
566
+ }
567
+ // reflect
568
+ if (shouldReflect) {
569
+ if (val === true) {
570
+ this.setAttribute(hyphenate(key), '');
571
+ }
572
+ else if (typeof val === 'string' || typeof val === 'number') {
573
+ this.setAttribute(hyphenate(key), val + '');
574
+ }
575
+ else if (!val) {
576
+ this.removeAttribute(hyphenate(key));
577
+ }
578
+ }
579
+ }
580
+ }
581
+ _createVNode() {
582
+ const vnode = createVNode(this._def, extend({}, this._props));
583
+ if (!this._instance) {
584
+ vnode.ce = instance => {
585
+ this._instance = instance;
586
+ instance.isCE = true;
587
+ // HMR
588
+ if ((process.env.NODE_ENV !== 'production')) {
589
+ instance.ceReload = newStyles => {
590
+ // alawys reset styles
591
+ if (this._styles) {
592
+ this._styles.forEach(s => this.shadowRoot.removeChild(s));
593
+ this._styles.length = 0;
594
+ }
595
+ this._applyStyles(newStyles);
596
+ // if this is an async component, ceReload is called from the inner
597
+ // component so no need to reload the async wrapper
598
+ if (!this._def.__asyncLoader) {
599
+ // reload
600
+ this._instance = null;
601
+ render(this._createVNode(), this.shadowRoot);
602
+ }
603
+ };
604
+ }
605
+ // intercept emit
606
+ instance.emit = (event, ...args) => {
607
+ this.dispatchEvent(new CustomEvent(event, {
608
+ detail: args
609
+ }));
610
+ };
611
+ // locate nearest Vue custom element parent for provide/inject
612
+ let parent = this;
613
+ while ((parent =
614
+ parent && (parent.parentNode || parent.host))) {
615
+ if (parent instanceof VueElement) {
616
+ instance.parent = parent._instance;
617
+ break;
618
+ }
619
+ }
620
+ };
621
+ }
622
+ return vnode;
623
+ }
624
+ _applyStyles(styles) {
625
+ if (styles) {
626
+ styles.forEach(css => {
627
+ const s = document.createElement('style');
628
+ s.textContent = css;
629
+ this.shadowRoot.appendChild(s);
630
+ // record for HMR
631
+ if ((process.env.NODE_ENV !== 'production')) {
632
+ (this._styles || (this._styles = [])).push(s);
633
+ }
634
+ });
635
+ }
636
+ }
637
+ }
638
+
639
+ function useCssModule(name = '$style') {
640
+ /* istanbul ignore else */
641
+ {
642
+ const instance = getCurrentInstance();
643
+ if (!instance) {
644
+ (process.env.NODE_ENV !== 'production') && warn(`useCssModule must be called inside setup()`);
645
+ return EMPTY_OBJ;
646
+ }
647
+ const modules = instance.type.__cssModules;
648
+ if (!modules) {
649
+ (process.env.NODE_ENV !== 'production') && warn(`Current instance does not have CSS modules injected.`);
650
+ return EMPTY_OBJ;
651
+ }
652
+ const mod = modules[name];
653
+ if (!mod) {
654
+ (process.env.NODE_ENV !== 'production') &&
655
+ warn(`Current instance does not have CSS module named "${name}".`);
656
+ return EMPTY_OBJ;
657
+ }
658
+ return mod;
659
+ }
660
+ }
661
+
662
+ /**
663
+ * Runtime helper for SFC's CSS variable injection feature.
664
+ * @private
665
+ */
666
+ function useCssVars(getter) {
667
+ const instance = getCurrentInstance();
668
+ /* istanbul ignore next */
669
+ if (!instance) {
670
+ (process.env.NODE_ENV !== 'production') &&
671
+ warn(`useCssVars is called without current active component instance.`);
672
+ return;
673
+ }
674
+ const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
675
+ watchPostEffect(setVars);
676
+ onMounted(() => {
677
+ const ob = new MutationObserver(setVars);
678
+ ob.observe(instance.subTree.el.parentNode, { childList: true });
679
+ onUnmounted(() => ob.disconnect());
680
+ });
681
+ }
682
+ function setVarsOnVNode(vnode, vars) {
683
+ if (vnode.shapeFlag & 128 /* SUSPENSE */) {
684
+ const suspense = vnode.suspense;
685
+ vnode = suspense.activeBranch;
686
+ if (suspense.pendingBranch && !suspense.isHydrating) {
687
+ suspense.effects.push(() => {
688
+ setVarsOnVNode(suspense.activeBranch, vars);
689
+ });
690
+ }
691
+ }
692
+ // drill down HOCs until it's a non-component vnode
693
+ while (vnode.component) {
694
+ vnode = vnode.component.subTree;
695
+ }
696
+ if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
697
+ setVarsOnNode(vnode.el, vars);
698
+ }
699
+ else if (vnode.type === Fragment) {
700
+ vnode.children.forEach(c => setVarsOnVNode(c, vars));
701
+ }
702
+ else if (vnode.type === Static) {
703
+ let { el, anchor } = vnode;
704
+ while (el) {
705
+ setVarsOnNode(el, vars);
706
+ if (el === anchor)
707
+ break;
708
+ el = el.nextSibling;
709
+ }
710
+ }
711
+ }
712
+ function setVarsOnNode(el, vars) {
713
+ if (el.nodeType === 1) {
714
+ const style = el.style;
715
+ for (const key in vars) {
716
+ style.setProperty(`--${key}`, vars[key]);
717
+ }
718
+ }
719
+ }
720
+
721
+ const TRANSITION = 'transition';
722
+ const ANIMATION = 'animation';
723
+ // DOM Transition is a higher-order-component based on the platform-agnostic
724
+ // base Transition component, with DOM-specific logic.
725
+ const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
726
+ Transition.displayName = 'Transition';
727
+ const DOMTransitionPropsValidators = {
728
+ name: String,
729
+ type: String,
730
+ css: {
731
+ type: Boolean,
732
+ default: true
733
+ },
734
+ duration: [String, Number, Object],
735
+ enterFromClass: String,
736
+ enterActiveClass: String,
737
+ enterToClass: String,
738
+ appearFromClass: String,
739
+ appearActiveClass: String,
740
+ appearToClass: String,
741
+ leaveFromClass: String,
742
+ leaveActiveClass: String,
743
+ leaveToClass: String
744
+ };
745
+ const TransitionPropsValidators = (Transition.props =
746
+ /*#__PURE__*/ extend({}, BaseTransition.props, DOMTransitionPropsValidators));
747
+ /**
748
+ * #3227 Incoming hooks may be merged into arrays when wrapping Transition
749
+ * with custom HOCs.
750
+ */
751
+ const callHook = (hook, args = []) => {
752
+ if (isArray(hook)) {
753
+ hook.forEach(h => h(...args));
754
+ }
755
+ else if (hook) {
756
+ hook(...args);
757
+ }
758
+ };
759
+ /**
760
+ * Check if a hook expects a callback (2nd arg), which means the user
761
+ * intends to explicitly control the end of the transition.
762
+ */
763
+ const hasExplicitCallback = (hook) => {
764
+ return hook
765
+ ? isArray(hook)
766
+ ? hook.some(h => h.length > 1)
767
+ : hook.length > 1
768
+ : false;
769
+ };
770
+ function resolveTransitionProps(rawProps) {
771
+ const baseProps = {};
772
+ for (const key in rawProps) {
773
+ if (!(key in DOMTransitionPropsValidators)) {
774
+ baseProps[key] = rawProps[key];
775
+ }
776
+ }
777
+ if (rawProps.css === false) {
778
+ return baseProps;
779
+ }
780
+ 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;
781
+ const durations = normalizeDuration(duration);
782
+ const enterDuration = durations && durations[0];
783
+ const leaveDuration = durations && durations[1];
784
+ const { onBeforeEnter, onEnter, onEnterCancelled, onLeave, onLeaveCancelled, onBeforeAppear = onBeforeEnter, onAppear = onEnter, onAppearCancelled = onEnterCancelled } = baseProps;
785
+ const finishEnter = (el, isAppear, done) => {
786
+ removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
787
+ removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
788
+ done && done();
789
+ };
790
+ const finishLeave = (el, done) => {
791
+ removeTransitionClass(el, leaveToClass);
792
+ removeTransitionClass(el, leaveActiveClass);
793
+ done && done();
794
+ };
795
+ const makeEnterHook = (isAppear) => {
796
+ return (el, done) => {
797
+ const hook = isAppear ? onAppear : onEnter;
798
+ const resolve = () => finishEnter(el, isAppear, done);
799
+ callHook(hook, [el, resolve]);
800
+ nextFrame(() => {
801
+ removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
802
+ addTransitionClass(el, isAppear ? appearToClass : enterToClass);
803
+ if (!hasExplicitCallback(hook)) {
804
+ whenTransitionEnds(el, type, enterDuration, resolve);
805
+ }
806
+ });
807
+ };
808
+ };
809
+ return extend(baseProps, {
810
+ onBeforeEnter(el) {
811
+ callHook(onBeforeEnter, [el]);
812
+ addTransitionClass(el, enterFromClass);
813
+ addTransitionClass(el, enterActiveClass);
814
+ },
815
+ onBeforeAppear(el) {
816
+ callHook(onBeforeAppear, [el]);
817
+ addTransitionClass(el, appearFromClass);
818
+ addTransitionClass(el, appearActiveClass);
819
+ },
820
+ onEnter: makeEnterHook(false),
821
+ onAppear: makeEnterHook(true),
822
+ onLeave(el, done) {
823
+ const resolve = () => finishLeave(el, done);
824
+ addTransitionClass(el, leaveFromClass);
825
+ // force reflow so *-leave-from classes immediately take effect (#2593)
826
+ forceReflow();
827
+ addTransitionClass(el, leaveActiveClass);
828
+ nextFrame(() => {
829
+ removeTransitionClass(el, leaveFromClass);
830
+ addTransitionClass(el, leaveToClass);
831
+ if (!hasExplicitCallback(onLeave)) {
832
+ whenTransitionEnds(el, type, leaveDuration, resolve);
833
+ }
834
+ });
835
+ callHook(onLeave, [el, resolve]);
836
+ },
837
+ onEnterCancelled(el) {
838
+ finishEnter(el, false);
839
+ callHook(onEnterCancelled, [el]);
840
+ },
841
+ onAppearCancelled(el) {
842
+ finishEnter(el, true);
843
+ callHook(onAppearCancelled, [el]);
844
+ },
845
+ onLeaveCancelled(el) {
846
+ finishLeave(el);
847
+ callHook(onLeaveCancelled, [el]);
848
+ }
849
+ });
850
+ }
851
+ function normalizeDuration(duration) {
852
+ if (duration == null) {
853
+ return null;
854
+ }
855
+ else if (isObject(duration)) {
856
+ return [NumberOf(duration.enter), NumberOf(duration.leave)];
857
+ }
858
+ else {
859
+ const n = NumberOf(duration);
860
+ return [n, n];
861
+ }
862
+ }
863
+ function NumberOf(val) {
864
+ const res = toNumber(val);
865
+ if ((process.env.NODE_ENV !== 'production'))
866
+ validateDuration(res);
867
+ return res;
868
+ }
869
+ function validateDuration(val) {
870
+ if (typeof val !== 'number') {
871
+ warn(`<transition> explicit duration is not a valid number - ` +
872
+ `got ${JSON.stringify(val)}.`);
873
+ }
874
+ else if (isNaN(val)) {
875
+ warn(`<transition> explicit duration is NaN - ` +
876
+ 'the duration expression might be incorrect.');
877
+ }
878
+ }
879
+ function addTransitionClass(el, cls) {
880
+ cls.split(/\s+/).forEach(c => c && el.classList.add(c));
881
+ (el._vtc ||
882
+ (el._vtc = new Set())).add(cls);
883
+ }
884
+ function removeTransitionClass(el, cls) {
885
+ cls.split(/\s+/).forEach(c => c && el.classList.remove(c));
886
+ const { _vtc } = el;
887
+ if (_vtc) {
888
+ _vtc.delete(cls);
889
+ if (!_vtc.size) {
890
+ el._vtc = undefined;
891
+ }
892
+ }
893
+ }
894
+ function nextFrame(cb) {
895
+ requestAnimationFrame(() => {
896
+ requestAnimationFrame(cb);
897
+ });
898
+ }
899
+ let endId = 0;
900
+ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
901
+ const id = (el._endId = ++endId);
902
+ const resolveIfNotStale = () => {
903
+ if (id === el._endId) {
904
+ resolve();
905
+ }
906
+ };
907
+ if (explicitTimeout) {
908
+ return setTimeout(resolveIfNotStale, explicitTimeout);
909
+ }
910
+ const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
911
+ if (!type) {
912
+ return resolve();
913
+ }
914
+ const endEvent = type + 'end';
915
+ let ended = 0;
916
+ const end = () => {
917
+ el.removeEventListener(endEvent, onEnd);
918
+ resolveIfNotStale();
919
+ };
920
+ const onEnd = (e) => {
921
+ if (e.target === el && ++ended >= propCount) {
922
+ end();
923
+ }
924
+ };
925
+ setTimeout(() => {
926
+ if (ended < propCount) {
927
+ end();
928
+ }
929
+ }, timeout + 1);
930
+ el.addEventListener(endEvent, onEnd);
931
+ }
932
+ function getTransitionInfo(el, expectedType) {
933
+ const styles = window.getComputedStyle(el);
934
+ // JSDOM may return undefined for transition properties
935
+ const getStyleProperties = (key) => (styles[key] || '').split(', ');
936
+ const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
937
+ const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
938
+ const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
939
+ const animationDelays = getStyleProperties(ANIMATION + 'Delay');
940
+ const animationDurations = getStyleProperties(ANIMATION + 'Duration');
941
+ const animationTimeout = getTimeout(animationDelays, animationDurations);
942
+ let type = null;
943
+ let timeout = 0;
944
+ let propCount = 0;
945
+ /* istanbul ignore if */
946
+ if (expectedType === TRANSITION) {
947
+ if (transitionTimeout > 0) {
948
+ type = TRANSITION;
949
+ timeout = transitionTimeout;
950
+ propCount = transitionDurations.length;
951
+ }
952
+ }
953
+ else if (expectedType === ANIMATION) {
954
+ if (animationTimeout > 0) {
955
+ type = ANIMATION;
956
+ timeout = animationTimeout;
957
+ propCount = animationDurations.length;
958
+ }
959
+ }
960
+ else {
961
+ timeout = Math.max(transitionTimeout, animationTimeout);
962
+ type =
963
+ timeout > 0
964
+ ? transitionTimeout > animationTimeout
965
+ ? TRANSITION
966
+ : ANIMATION
967
+ : null;
968
+ propCount = type
969
+ ? type === TRANSITION
970
+ ? transitionDurations.length
971
+ : animationDurations.length
972
+ : 0;
973
+ }
974
+ const hasTransform = type === TRANSITION &&
975
+ /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
976
+ return {
977
+ type,
978
+ timeout,
979
+ propCount,
980
+ hasTransform
981
+ };
982
+ }
983
+ function getTimeout(delays, durations) {
984
+ while (delays.length < durations.length) {
985
+ delays = delays.concat(delays);
986
+ }
987
+ return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
988
+ }
989
+ // Old versions of Chromium (below 61.0.3163.100) formats floating pointer
990
+ // numbers in a locale-dependent way, using a comma instead of a dot.
991
+ // If comma is not replaced with a dot, the input will be rounded down
992
+ // (i.e. acting as a floor function) causing unexpected behaviors
993
+ function toMs(s) {
994
+ return Number(s.slice(0, -1).replace(',', '.')) * 1000;
995
+ }
996
+ // synchronously force layout to put elements into a certain state
997
+ function forceReflow() {
998
+ return document.body.offsetHeight;
999
+ }
1000
+
1001
+ const positionMap = new WeakMap();
1002
+ const newPositionMap = new WeakMap();
1003
+ const TransitionGroupImpl = {
1004
+ name: 'TransitionGroup',
1005
+ props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
1006
+ tag: String,
1007
+ moveClass: String
1008
+ }),
1009
+ setup(props, { slots }) {
1010
+ const instance = getCurrentInstance();
1011
+ const state = useTransitionState();
1012
+ let prevChildren;
1013
+ let children;
1014
+ onUpdated(() => {
1015
+ // children is guaranteed to exist after initial render
1016
+ if (!prevChildren.length) {
1017
+ return;
1018
+ }
1019
+ const moveClass = props.moveClass || `${props.name || 'v'}-move`;
1020
+ if (!hasCSSTransform(prevChildren[0].el, instance.vnode.el, moveClass)) {
1021
+ return;
1022
+ }
1023
+ // we divide the work into three loops to avoid mixing DOM reads and writes
1024
+ // in each iteration - which helps prevent layout thrashing.
1025
+ prevChildren.forEach(callPendingCbs);
1026
+ prevChildren.forEach(recordPosition);
1027
+ const movedChildren = prevChildren.filter(applyTranslation);
1028
+ // force reflow to put everything in position
1029
+ forceReflow();
1030
+ movedChildren.forEach(c => {
1031
+ const el = c.el;
1032
+ const style = el.style;
1033
+ addTransitionClass(el, moveClass);
1034
+ style.transform = style.webkitTransform = style.transitionDuration = '';
1035
+ const cb = (el._moveCb = (e) => {
1036
+ if (e && e.target !== el) {
1037
+ return;
1038
+ }
1039
+ if (!e || /transform$/.test(e.propertyName)) {
1040
+ el.removeEventListener('transitionend', cb);
1041
+ el._moveCb = null;
1042
+ removeTransitionClass(el, moveClass);
1043
+ }
1044
+ });
1045
+ el.addEventListener('transitionend', cb);
1046
+ });
1047
+ });
1048
+ return () => {
1049
+ const rawProps = toRaw(props);
1050
+ const cssTransitionProps = resolveTransitionProps(rawProps);
1051
+ let tag = rawProps.tag || Fragment;
1052
+ prevChildren = children;
1053
+ children = slots.default ? getTransitionRawChildren(slots.default()) : [];
1054
+ for (let i = 0; i < children.length; i++) {
1055
+ const child = children[i];
1056
+ if (child.key != null) {
1057
+ setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
1058
+ }
1059
+ else if ((process.env.NODE_ENV !== 'production')) {
1060
+ warn(`<TransitionGroup> children must be keyed.`);
1061
+ }
1062
+ }
1063
+ if (prevChildren) {
1064
+ for (let i = 0; i < prevChildren.length; i++) {
1065
+ const child = prevChildren[i];
1066
+ setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
1067
+ positionMap.set(child, child.el.getBoundingClientRect());
1068
+ }
1069
+ }
1070
+ return createVNode(tag, null, children);
1071
+ };
1072
+ }
1073
+ };
1074
+ const TransitionGroup = TransitionGroupImpl;
1075
+ function callPendingCbs(c) {
1076
+ const el = c.el;
1077
+ if (el._moveCb) {
1078
+ el._moveCb();
1079
+ }
1080
+ if (el._enterCb) {
1081
+ el._enterCb();
1082
+ }
1083
+ }
1084
+ function recordPosition(c) {
1085
+ newPositionMap.set(c, c.el.getBoundingClientRect());
1086
+ }
1087
+ function applyTranslation(c) {
1088
+ const oldPos = positionMap.get(c);
1089
+ const newPos = newPositionMap.get(c);
1090
+ const dx = oldPos.left - newPos.left;
1091
+ const dy = oldPos.top - newPos.top;
1092
+ if (dx || dy) {
1093
+ const s = c.el.style;
1094
+ s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
1095
+ s.transitionDuration = '0s';
1096
+ return c;
1097
+ }
1098
+ }
1099
+ function hasCSSTransform(el, root, moveClass) {
1100
+ // Detect whether an element with the move class applied has
1101
+ // CSS transitions. Since the element may be inside an entering
1102
+ // transition at this very moment, we make a clone of it and remove
1103
+ // all other transition classes applied to ensure only the move class
1104
+ // is applied.
1105
+ const clone = el.cloneNode();
1106
+ if (el._vtc) {
1107
+ el._vtc.forEach(cls => {
1108
+ cls.split(/\s+/).forEach(c => c && clone.classList.remove(c));
1109
+ });
1110
+ }
1111
+ moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c));
1112
+ clone.style.display = 'none';
1113
+ const container = (root.nodeType === 1 ? root : root.parentNode);
1114
+ container.appendChild(clone);
1115
+ const { hasTransform } = getTransitionInfo(clone);
1116
+ container.removeChild(clone);
1117
+ return hasTransform;
1118
+ }
1119
+
1120
+ const getModelAssigner = (vnode) => {
1121
+ const fn = vnode.props['onUpdate:modelValue'];
1122
+ return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
1123
+ };
1124
+ function onCompositionStart(e) {
1125
+ e.target.composing = true;
1126
+ }
1127
+ function onCompositionEnd(e) {
1128
+ const target = e.target;
1129
+ if (target.composing) {
1130
+ target.composing = false;
1131
+ trigger(target, 'input');
1132
+ }
1133
+ }
1134
+ function trigger(el, type) {
1135
+ const e = document.createEvent('HTMLEvents');
1136
+ e.initEvent(type, true, true);
1137
+ el.dispatchEvent(e);
1138
+ }
1139
+ // We are exporting the v-model runtime directly as vnode hooks so that it can
1140
+ // be tree-shaken in case v-model is never used.
1141
+ const vModelText = {
1142
+ created(el, { modifiers: { lazy, trim, number } }, vnode) {
1143
+ el._assign = getModelAssigner(vnode);
1144
+ const castToNumber = number || (vnode.props && vnode.props.type === 'number');
1145
+ addEventListener(el, lazy ? 'change' : 'input', e => {
1146
+ if (e.target.composing)
1147
+ return;
1148
+ let domValue = el.value;
1149
+ if (trim) {
1150
+ domValue = domValue.trim();
1151
+ }
1152
+ else if (castToNumber) {
1153
+ domValue = toNumber(domValue);
1154
+ }
1155
+ el._assign(domValue);
1156
+ });
1157
+ if (trim) {
1158
+ addEventListener(el, 'change', () => {
1159
+ el.value = el.value.trim();
1160
+ });
1161
+ }
1162
+ if (!lazy) {
1163
+ addEventListener(el, 'compositionstart', onCompositionStart);
1164
+ addEventListener(el, 'compositionend', onCompositionEnd);
1165
+ // Safari < 10.2 & UIWebView doesn't fire compositionend when
1166
+ // switching focus before confirming composition choice
1167
+ // this also fixes the issue where some browsers e.g. iOS Chrome
1168
+ // fires "change" instead of "input" on autocomplete.
1169
+ addEventListener(el, 'change', onCompositionEnd);
1170
+ }
1171
+ },
1172
+ // set value on mounted so it's after min/max for type="range"
1173
+ mounted(el, { value }) {
1174
+ el.value = value == null ? '' : value;
1175
+ },
1176
+ beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
1177
+ el._assign = getModelAssigner(vnode);
1178
+ // avoid clearing unresolved text. #2302
1179
+ if (el.composing)
1180
+ return;
1181
+ if (document.activeElement === el) {
1182
+ if (lazy) {
1183
+ return;
1184
+ }
1185
+ if (trim && el.value.trim() === value) {
1186
+ return;
1187
+ }
1188
+ if ((number || el.type === 'number') && toNumber(el.value) === value) {
1189
+ return;
1190
+ }
1191
+ }
1192
+ const newValue = value == null ? '' : value;
1193
+ if (el.value !== newValue) {
1194
+ el.value = newValue;
1195
+ }
1196
+ }
1197
+ };
1198
+ const vModelCheckbox = {
1199
+ // #4096 array checkboxes need to be deep traversed
1200
+ deep: true,
1201
+ created(el, _, vnode) {
1202
+ el._assign = getModelAssigner(vnode);
1203
+ addEventListener(el, 'change', () => {
1204
+ const modelValue = el._modelValue;
1205
+ const elementValue = getValue(el);
1206
+ const checked = el.checked;
1207
+ const assign = el._assign;
1208
+ if (isArray(modelValue)) {
1209
+ const index = looseIndexOf(modelValue, elementValue);
1210
+ const found = index !== -1;
1211
+ if (checked && !found) {
1212
+ assign(modelValue.concat(elementValue));
1213
+ }
1214
+ else if (!checked && found) {
1215
+ const filtered = [...modelValue];
1216
+ filtered.splice(index, 1);
1217
+ assign(filtered);
1218
+ }
1219
+ }
1220
+ else if (isSet(modelValue)) {
1221
+ const cloned = new Set(modelValue);
1222
+ if (checked) {
1223
+ cloned.add(elementValue);
1224
+ }
1225
+ else {
1226
+ cloned.delete(elementValue);
1227
+ }
1228
+ assign(cloned);
1229
+ }
1230
+ else {
1231
+ assign(getCheckboxValue(el, checked));
1232
+ }
1233
+ });
1234
+ },
1235
+ // set initial checked on mount to wait for true-value/false-value
1236
+ mounted: setChecked,
1237
+ beforeUpdate(el, binding, vnode) {
1238
+ el._assign = getModelAssigner(vnode);
1239
+ setChecked(el, binding, vnode);
1240
+ }
1241
+ };
1242
+ function setChecked(el, { value, oldValue }, vnode) {
1243
+ el._modelValue = value;
1244
+ if (isArray(value)) {
1245
+ el.checked = looseIndexOf(value, vnode.props.value) > -1;
1246
+ }
1247
+ else if (isSet(value)) {
1248
+ el.checked = value.has(vnode.props.value);
1249
+ }
1250
+ else if (value !== oldValue) {
1251
+ el.checked = looseEqual(value, getCheckboxValue(el, true));
1252
+ }
1253
+ }
1254
+ const vModelRadio = {
1255
+ created(el, { value }, vnode) {
1256
+ el.checked = looseEqual(value, vnode.props.value);
1257
+ el._assign = getModelAssigner(vnode);
1258
+ addEventListener(el, 'change', () => {
1259
+ el._assign(getValue(el));
1260
+ });
1261
+ },
1262
+ beforeUpdate(el, { value, oldValue }, vnode) {
1263
+ el._assign = getModelAssigner(vnode);
1264
+ if (value !== oldValue) {
1265
+ el.checked = looseEqual(value, vnode.props.value);
1266
+ }
1267
+ }
1268
+ };
1269
+ const vModelSelect = {
1270
+ // <select multiple> value need to be deep traversed
1271
+ deep: true,
1272
+ created(el, { value, modifiers: { number } }, vnode) {
1273
+ const isSetModel = isSet(value);
1274
+ addEventListener(el, 'change', () => {
1275
+ const selectedVal = Array.prototype.filter
1276
+ .call(el.options, (o) => o.selected)
1277
+ .map((o) => number ? toNumber(getValue(o)) : getValue(o));
1278
+ el._assign(el.multiple
1279
+ ? isSetModel
1280
+ ? new Set(selectedVal)
1281
+ : selectedVal
1282
+ : selectedVal[0]);
1283
+ });
1284
+ el._assign = getModelAssigner(vnode);
1285
+ },
1286
+ // set value in mounted & updated because <select> relies on its children
1287
+ // <option>s.
1288
+ mounted(el, { value }) {
1289
+ setSelected(el, value);
1290
+ },
1291
+ beforeUpdate(el, _binding, vnode) {
1292
+ el._assign = getModelAssigner(vnode);
1293
+ },
1294
+ updated(el, { value }) {
1295
+ setSelected(el, value);
1296
+ }
1297
+ };
1298
+ function setSelected(el, value) {
1299
+ const isMultiple = el.multiple;
1300
+ if (isMultiple && !isArray(value) && !isSet(value)) {
1301
+ (process.env.NODE_ENV !== 'production') &&
1302
+ warn(`<select multiple v-model> expects an Array or Set value for its binding, ` +
1303
+ `but got ${Object.prototype.toString.call(value).slice(8, -1)}.`);
1304
+ return;
1305
+ }
1306
+ for (let i = 0, l = el.options.length; i < l; i++) {
1307
+ const option = el.options[i];
1308
+ const optionValue = getValue(option);
1309
+ if (isMultiple) {
1310
+ if (isArray(value)) {
1311
+ option.selected = looseIndexOf(value, optionValue) > -1;
1312
+ }
1313
+ else {
1314
+ option.selected = value.has(optionValue);
1315
+ }
1316
+ }
1317
+ else {
1318
+ if (looseEqual(getValue(option), value)) {
1319
+ if (el.selectedIndex !== i)
1320
+ el.selectedIndex = i;
1321
+ return;
1322
+ }
1323
+ }
1324
+ }
1325
+ if (!isMultiple && el.selectedIndex !== -1) {
1326
+ el.selectedIndex = -1;
1327
+ }
1328
+ }
1329
+ // retrieve raw value set via :value bindings
1330
+ function getValue(el) {
1331
+ return '_value' in el ? el._value : el.value;
1332
+ }
1333
+ // retrieve raw value for true-value and false-value set via :true-value or :false-value bindings
1334
+ function getCheckboxValue(el, checked) {
1335
+ const key = checked ? '_trueValue' : '_falseValue';
1336
+ return key in el ? el[key] : checked;
1337
+ }
1338
+ const vModelDynamic = {
1339
+ created(el, binding, vnode) {
1340
+ callModelHook(el, binding, vnode, null, 'created');
1341
+ },
1342
+ mounted(el, binding, vnode) {
1343
+ callModelHook(el, binding, vnode, null, 'mounted');
1344
+ },
1345
+ beforeUpdate(el, binding, vnode, prevVNode) {
1346
+ callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate');
1347
+ },
1348
+ updated(el, binding, vnode, prevVNode) {
1349
+ callModelHook(el, binding, vnode, prevVNode, 'updated');
1350
+ }
1351
+ };
1352
+ function callModelHook(el, binding, vnode, prevVNode, hook) {
1353
+ let modelToUse;
1354
+ switch (el.tagName) {
1355
+ case 'SELECT':
1356
+ modelToUse = vModelSelect;
1357
+ break;
1358
+ case 'TEXTAREA':
1359
+ modelToUse = vModelText;
1360
+ break;
1361
+ default:
1362
+ switch (vnode.props && vnode.props.type) {
1363
+ case 'checkbox':
1364
+ modelToUse = vModelCheckbox;
1365
+ break;
1366
+ case 'radio':
1367
+ modelToUse = vModelRadio;
1368
+ break;
1369
+ default:
1370
+ modelToUse = vModelText;
1371
+ }
1372
+ }
1373
+ const fn = modelToUse[hook];
1374
+ fn && fn(el, binding, vnode, prevVNode);
1375
+ }
1376
+
1377
+ const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
1378
+ const modifierGuards = {
1379
+ stop: e => e.stopPropagation(),
1380
+ prevent: e => e.preventDefault(),
1381
+ self: e => e.target !== e.currentTarget,
1382
+ ctrl: e => !e.ctrlKey,
1383
+ shift: e => !e.shiftKey,
1384
+ alt: e => !e.altKey,
1385
+ meta: e => !e.metaKey,
1386
+ left: e => 'button' in e && e.button !== 0,
1387
+ middle: e => 'button' in e && e.button !== 1,
1388
+ right: e => 'button' in e && e.button !== 2,
1389
+ exact: (e, modifiers) => systemModifiers.some(m => e[`${m}Key`] && !modifiers.includes(m))
1390
+ };
1391
+ /**
1392
+ * @private
1393
+ */
1394
+ const withModifiers = (fn, modifiers) => {
1395
+ return (event, ...args) => {
1396
+ for (let i = 0; i < modifiers.length; i++) {
1397
+ const guard = modifierGuards[modifiers[i]];
1398
+ if (guard && guard(event, modifiers))
1399
+ return;
1400
+ }
1401
+ return fn(event, ...args);
1402
+ };
1403
+ };
1404
+ // Kept for 2.x compat.
1405
+ // Note: IE11 compat for `spacebar` and `del` is removed for now.
1406
+ const keyNames = {
1407
+ esc: 'escape',
1408
+ space: ' ',
1409
+ up: 'arrow-up',
1410
+ left: 'arrow-left',
1411
+ right: 'arrow-right',
1412
+ down: 'arrow-down',
1413
+ delete: 'backspace'
1414
+ };
1415
+ /**
1416
+ * @private
1417
+ */
1418
+ const withKeys = (fn, modifiers) => {
1419
+ return (event) => {
1420
+ if (!('key' in event)) {
1421
+ return;
1422
+ }
1423
+ const eventKey = hyphenate(event.key);
1424
+ if (modifiers.some(k => k === eventKey || keyNames[k] === eventKey)) {
1425
+ return fn(event);
1426
+ }
1427
+ };
1428
+ };
1429
+
1430
+ const vShow = {
1431
+ beforeMount(el, { value }, { transition }) {
1432
+ el._vod = el.style.display === 'none' ? '' : el.style.display;
1433
+ if (transition && value) {
1434
+ transition.beforeEnter(el);
1435
+ }
1436
+ else {
1437
+ setDisplay(el, value);
1438
+ }
1439
+ },
1440
+ mounted(el, { value }, { transition }) {
1441
+ if (transition && value) {
1442
+ transition.enter(el);
1443
+ }
1444
+ },
1445
+ updated(el, { value, oldValue }, { transition }) {
1446
+ if (!value === !oldValue)
1447
+ return;
1448
+ if (transition) {
1449
+ if (value) {
1450
+ transition.beforeEnter(el);
1451
+ setDisplay(el, true);
1452
+ transition.enter(el);
1453
+ }
1454
+ else {
1455
+ transition.leave(el, () => {
1456
+ setDisplay(el, false);
1457
+ });
1458
+ }
1459
+ }
1460
+ else {
1461
+ setDisplay(el, value);
1462
+ }
1463
+ },
1464
+ beforeUnmount(el, { value }) {
1465
+ setDisplay(el, value);
1466
+ }
1467
+ };
1468
+ function setDisplay(el, value) {
1469
+ el.style.display = value ? el._vod : 'none';
1470
+ }
1471
+
1472
+ const rendererOptions = extend({ patchProp }, nodeOps);
1473
+ // lazy create the renderer - this makes core renderer logic tree-shakable
1474
+ // in case the user only imports reactivity utilities from Vue.
1475
+ let renderer;
1476
+ let enabledHydration = false;
1477
+ function ensureRenderer() {
1478
+ return (renderer ||
1479
+ (renderer = createRenderer(rendererOptions)));
1480
+ }
1481
+ function ensureHydrationRenderer() {
1482
+ renderer = enabledHydration
1483
+ ? renderer
1484
+ : createHydrationRenderer(rendererOptions);
1485
+ enabledHydration = true;
1486
+ return renderer;
1487
+ }
1488
+ // use explicit type casts here to avoid import() calls in rolled-up d.ts
1489
+ const render = ((...args) => {
1490
+ ensureRenderer().render(...args);
1491
+ });
1492
+ const hydrate = ((...args) => {
1493
+ ensureHydrationRenderer().hydrate(...args);
1494
+ });
1495
+ const createApp = ((...args) => {
1496
+ const app = ensureRenderer().createApp(...args);
1497
+ if ((process.env.NODE_ENV !== 'production')) {
1498
+ injectNativeTagCheck(app);
1499
+ injectCompilerOptionsCheck(app);
1500
+ }
1501
+ const { mount } = app;
1502
+ app.mount = (containerOrSelector) => {
1503
+ const container = normalizeContainer(containerOrSelector);
1504
+ if (!container)
1505
+ return;
1506
+ const component = app._component;
1507
+ if (!isFunction(component) && !component.render && !component.template) {
1508
+ // __UNSAFE__
1509
+ // Reason: potential execution of JS expressions in in-DOM template.
1510
+ // The user must make sure the in-DOM template is trusted. If it's
1511
+ // rendered by the server, the template should not contain any user data.
1512
+ component.template = container.innerHTML;
1513
+ }
1514
+ // clear content before mounting
1515
+ container.innerHTML = '';
1516
+ const proxy = mount(container, false, container instanceof SVGElement);
1517
+ if (container instanceof Element) {
1518
+ container.removeAttribute('v-cloak');
1519
+ container.setAttribute('data-v-app', '');
1520
+ }
1521
+ return proxy;
1522
+ };
1523
+ return app;
1524
+ });
1525
+ const createSSRApp = ((...args) => {
1526
+ const app = ensureHydrationRenderer().createApp(...args);
1527
+ if ((process.env.NODE_ENV !== 'production')) {
1528
+ injectNativeTagCheck(app);
1529
+ injectCompilerOptionsCheck(app);
1530
+ }
1531
+ const { mount } = app;
1532
+ app.mount = (containerOrSelector) => {
1533
+ const container = normalizeContainer(containerOrSelector);
1534
+ if (container) {
1535
+ return mount(container, true, container instanceof SVGElement);
1536
+ }
1537
+ };
1538
+ return app;
1539
+ });
1540
+ function injectNativeTagCheck(app) {
1541
+ // Inject `isNativeTag`
1542
+ // this is used for component name validation (dev only)
1543
+ Object.defineProperty(app.config, 'isNativeTag', {
1544
+ value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
1545
+ writable: false
1546
+ });
1547
+ }
1548
+ // dev only
1549
+ function injectCompilerOptionsCheck(app) {
1550
+ if (isRuntimeOnly()) {
1551
+ const isCustomElement = app.config.isCustomElement;
1552
+ Object.defineProperty(app.config, 'isCustomElement', {
1553
+ get() {
1554
+ return isCustomElement;
1555
+ },
1556
+ set() {
1557
+ warn(`The \`isCustomElement\` config option is deprecated. Use ` +
1558
+ `\`compilerOptions.isCustomElement\` instead.`);
1559
+ }
1560
+ });
1561
+ const compilerOptions = app.config.compilerOptions;
1562
+ const msg = `The \`compilerOptions\` config option is only respected when using ` +
1563
+ `a build of Vue.js that includes the runtime compiler (aka "full build"). ` +
1564
+ `Since you are using the runtime-only build, \`compilerOptions\` ` +
1565
+ `must be passed to \`@vue/compiler-dom\` in the build setup instead.\n` +
1566
+ `- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.\n` +
1567
+ `- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n` +
1568
+ `- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom`;
1569
+ Object.defineProperty(app.config, 'compilerOptions', {
1570
+ get() {
1571
+ warn(msg);
1572
+ return compilerOptions;
1573
+ },
1574
+ set() {
1575
+ warn(msg);
1576
+ }
1577
+ });
1578
+ }
1579
+ }
1580
+ function normalizeContainer(container) {
1581
+ if (isString(container)) {
1582
+ const res = document.querySelector(container);
1583
+ if ((process.env.NODE_ENV !== 'production') && !res) {
1584
+ warn(`Failed to mount app: mount target selector "${container}" returned null.`);
1585
+ }
1586
+ return res;
1587
+ }
1588
+ if ((process.env.NODE_ENV !== 'production') &&
1589
+ window.ShadowRoot &&
1590
+ container instanceof window.ShadowRoot &&
1591
+ container.mode === 'closed') {
1592
+ warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
1593
+ }
1594
+ return container;
1595
+ }
1596
+
1597
+ export { Transition, TransitionGroup, VueElement, createApp, createSSRApp, defineCustomElement, defineSSRCustomElement, hydrate, render, useCssModule, useCssVars, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, withKeys, withModifiers };