@vertexvis/doc-viewer-vue 0.24.5-canary.5 → 1.0.0-testing.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,2871 +2,34 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var runtime = require('@stencil/vue-output-target/runtime');
5
6
  var loader = require('@vertexvis/doc-viewer/loader');
6
7
 
7
- function makeMap(str, expectsLowerCase) {
8
- const map = /* @__PURE__ */ Object.create(null);
9
- const list = str.split(",");
10
- for (let i = 0; i < list.length; i++) {
11
- map[list[i]] = true;
12
- }
13
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
14
- }
15
-
16
- const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
17
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
18
- const NOOP = () => {
19
- };
20
- const NO = () => false;
21
- const onRE = /^on[^a-z]/;
22
- const isOn = (key) => onRE.test(key);
23
- const extend = Object.assign;
24
- const remove = (arr, el) => {
25
- const i = arr.indexOf(el);
26
- if (i > -1) {
27
- arr.splice(i, 1);
28
- }
29
- };
30
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
31
- const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
32
- const isArray = Array.isArray;
33
- const isMap = (val) => toTypeString(val) === "[object Map]";
34
- const isSet = (val) => toTypeString(val) === "[object Set]";
35
- const isFunction = (val) => typeof val === "function";
36
- const isString = (val) => typeof val === "string";
37
- const isSymbol = (val) => typeof val === "symbol";
38
- const isObject = (val) => val !== null && typeof val === "object";
39
- const isPromise = (val) => {
40
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
41
- };
42
- const objectToString = Object.prototype.toString;
43
- const toTypeString = (value) => objectToString.call(value);
44
- const toRawType = (value) => {
45
- return toTypeString(value).slice(8, -1);
46
- };
47
- const isPlainObject = (val) => toTypeString(val) === "[object Object]";
48
- const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
49
- const cacheStringFunction = (fn) => {
50
- const cache = /* @__PURE__ */ Object.create(null);
51
- return (str) => {
52
- const hit = cache[str];
53
- return hit || (cache[str] = fn(str));
54
- };
55
- };
56
- const capitalize = cacheStringFunction(
57
- (str) => str.charAt(0).toUpperCase() + str.slice(1)
58
- );
59
- const toHandlerKey = cacheStringFunction(
60
- (str) => str ? `on${capitalize(str)}` : ``
61
- );
62
- const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
63
- const def = (obj, key, value) => {
64
- Object.defineProperty(obj, key, {
65
- configurable: true,
66
- enumerable: false,
67
- value
68
- });
69
- };
70
- let _globalThis;
71
- const getGlobalThis = () => {
72
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
73
- };
74
-
75
- function normalizeStyle(value) {
76
- if (isArray(value)) {
77
- const res = {};
78
- for (let i = 0; i < value.length; i++) {
79
- const item = value[i];
80
- const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
81
- if (normalized) {
82
- for (const key in normalized) {
83
- res[key] = normalized[key];
84
- }
85
- }
86
- }
87
- return res;
88
- } else if (isString(value)) {
89
- return value;
90
- } else if (isObject(value)) {
91
- return value;
92
- }
93
- }
94
- const listDelimiterRE = /;(?![^(]*\))/g;
95
- const propertyDelimiterRE = /:([^]+)/;
96
- const styleCommentRE = /\/\*[^]*?\*\//g;
97
- function parseStringStyle(cssText) {
98
- const ret = {};
99
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
100
- if (item) {
101
- const tmp = item.split(propertyDelimiterRE);
102
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
103
- }
104
- });
105
- return ret;
106
- }
107
- function normalizeClass(value) {
108
- let res = "";
109
- if (isString(value)) {
110
- res = value;
111
- } else if (isArray(value)) {
112
- for (let i = 0; i < value.length; i++) {
113
- const normalized = normalizeClass(value[i]);
114
- if (normalized) {
115
- res += normalized + " ";
116
- }
117
- }
118
- } else if (isObject(value)) {
119
- for (const name in value) {
120
- if (value[name]) {
121
- res += name + " ";
122
- }
123
- }
124
- }
125
- return res.trim();
126
- }
127
-
128
- function warn$1(msg, ...args) {
129
- console.warn(`[Vue warn] ${msg}`, ...args);
130
- }
131
-
132
- let activeEffectScope;
133
- function recordEffectScope(effect, scope = activeEffectScope) {
134
- if (scope && scope.active) {
135
- scope.effects.push(effect);
136
- }
137
- }
138
- function getCurrentScope() {
139
- return activeEffectScope;
140
- }
141
-
142
- const createDep = (effects) => {
143
- const dep = new Set(effects);
144
- dep.w = 0;
145
- dep.n = 0;
146
- return dep;
147
- };
148
- const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
149
- const newTracked = (dep) => (dep.n & trackOpBit) > 0;
150
- const initDepMarkers = ({ deps }) => {
151
- if (deps.length) {
152
- for (let i = 0; i < deps.length; i++) {
153
- deps[i].w |= trackOpBit;
154
- }
155
- }
156
- };
157
- const finalizeDepMarkers = (effect) => {
158
- const { deps } = effect;
159
- if (deps.length) {
160
- let ptr = 0;
161
- for (let i = 0; i < deps.length; i++) {
162
- const dep = deps[i];
163
- if (wasTracked(dep) && !newTracked(dep)) {
164
- dep.delete(effect);
165
- } else {
166
- deps[ptr++] = dep;
167
- }
168
- dep.w &= ~trackOpBit;
169
- dep.n &= ~trackOpBit;
170
- }
171
- deps.length = ptr;
172
- }
173
- };
174
-
175
- const targetMap = /* @__PURE__ */ new WeakMap();
176
- let effectTrackDepth = 0;
177
- let trackOpBit = 1;
178
- const maxMarkerBits = 30;
179
- let activeEffect;
180
- const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
181
- const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
182
- class ReactiveEffect {
183
- constructor(fn, scheduler = null, scope) {
184
- this.fn = fn;
185
- this.scheduler = scheduler;
186
- this.active = true;
187
- this.deps = [];
188
- this.parent = void 0;
189
- recordEffectScope(this, scope);
190
- }
191
- run() {
192
- if (!this.active) {
193
- return this.fn();
194
- }
195
- let parent = activeEffect;
196
- let lastShouldTrack = shouldTrack;
197
- while (parent) {
198
- if (parent === this) {
199
- return;
200
- }
201
- parent = parent.parent;
202
- }
203
- try {
204
- this.parent = activeEffect;
205
- activeEffect = this;
206
- shouldTrack = true;
207
- trackOpBit = 1 << ++effectTrackDepth;
208
- if (effectTrackDepth <= maxMarkerBits) {
209
- initDepMarkers(this);
210
- } else {
211
- cleanupEffect(this);
212
- }
213
- return this.fn();
214
- } finally {
215
- if (effectTrackDepth <= maxMarkerBits) {
216
- finalizeDepMarkers(this);
217
- }
218
- trackOpBit = 1 << --effectTrackDepth;
219
- activeEffect = this.parent;
220
- shouldTrack = lastShouldTrack;
221
- this.parent = void 0;
222
- if (this.deferStop) {
223
- this.stop();
224
- }
225
- }
226
- }
227
- stop() {
228
- if (activeEffect === this) {
229
- this.deferStop = true;
230
- } else if (this.active) {
231
- cleanupEffect(this);
232
- if (this.onStop) {
233
- this.onStop();
234
- }
235
- this.active = false;
236
- }
237
- }
238
- }
239
- function cleanupEffect(effect2) {
240
- const { deps } = effect2;
241
- if (deps.length) {
242
- for (let i = 0; i < deps.length; i++) {
243
- deps[i].delete(effect2);
244
- }
245
- deps.length = 0;
246
- }
247
- }
248
- let shouldTrack = true;
249
- const trackStack = [];
250
- function pauseTracking() {
251
- trackStack.push(shouldTrack);
252
- shouldTrack = false;
253
- }
254
- function resetTracking() {
255
- const last = trackStack.pop();
256
- shouldTrack = last === void 0 ? true : last;
257
- }
258
- function track(target, type, key) {
259
- if (shouldTrack && activeEffect) {
260
- let depsMap = targetMap.get(target);
261
- if (!depsMap) {
262
- targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
263
- }
264
- let dep = depsMap.get(key);
265
- if (!dep) {
266
- depsMap.set(key, dep = createDep());
267
- }
268
- const eventInfo = !!(process.env.NODE_ENV !== "production") ? { effect: activeEffect, target, type, key } : void 0;
269
- trackEffects(dep, eventInfo);
270
- }
271
- }
272
- function trackEffects(dep, debuggerEventExtraInfo) {
273
- let shouldTrack2 = false;
274
- if (effectTrackDepth <= maxMarkerBits) {
275
- if (!newTracked(dep)) {
276
- dep.n |= trackOpBit;
277
- shouldTrack2 = !wasTracked(dep);
278
- }
279
- } else {
280
- shouldTrack2 = !dep.has(activeEffect);
281
- }
282
- if (shouldTrack2) {
283
- dep.add(activeEffect);
284
- activeEffect.deps.push(dep);
285
- if (!!(process.env.NODE_ENV !== "production") && activeEffect.onTrack) {
286
- activeEffect.onTrack(
287
- extend(
288
- {
289
- effect: activeEffect
290
- },
291
- debuggerEventExtraInfo
292
- )
293
- );
294
- }
295
- }
296
- }
297
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
298
- const depsMap = targetMap.get(target);
299
- if (!depsMap) {
300
- return;
301
- }
302
- let deps = [];
303
- if (type === "clear") {
304
- deps = [...depsMap.values()];
305
- } else if (key === "length" && isArray(target)) {
306
- const newLength = Number(newValue);
307
- depsMap.forEach((dep, key2) => {
308
- if (key2 === "length" || key2 >= newLength) {
309
- deps.push(dep);
310
- }
311
- });
312
- } else {
313
- if (key !== void 0) {
314
- deps.push(depsMap.get(key));
315
- }
316
- switch (type) {
317
- case "add":
318
- if (!isArray(target)) {
319
- deps.push(depsMap.get(ITERATE_KEY));
320
- if (isMap(target)) {
321
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
322
- }
323
- } else if (isIntegerKey(key)) {
324
- deps.push(depsMap.get("length"));
325
- }
326
- break;
327
- case "delete":
328
- if (!isArray(target)) {
329
- deps.push(depsMap.get(ITERATE_KEY));
330
- if (isMap(target)) {
331
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
332
- }
333
- }
334
- break;
335
- case "set":
336
- if (isMap(target)) {
337
- deps.push(depsMap.get(ITERATE_KEY));
338
- }
339
- break;
340
- }
341
- }
342
- const eventInfo = !!(process.env.NODE_ENV !== "production") ? { target, type, key, newValue, oldValue, oldTarget } : void 0;
343
- if (deps.length === 1) {
344
- if (deps[0]) {
345
- if (!!(process.env.NODE_ENV !== "production")) {
346
- triggerEffects(deps[0], eventInfo);
347
- } else {
348
- triggerEffects(deps[0]);
349
- }
350
- }
351
- } else {
352
- const effects = [];
353
- for (const dep of deps) {
354
- if (dep) {
355
- effects.push(...dep);
356
- }
357
- }
358
- if (!!(process.env.NODE_ENV !== "production")) {
359
- triggerEffects(createDep(effects), eventInfo);
360
- } else {
361
- triggerEffects(createDep(effects));
362
- }
363
- }
364
- }
365
- function triggerEffects(dep, debuggerEventExtraInfo) {
366
- const effects = isArray(dep) ? dep : [...dep];
367
- for (const effect2 of effects) {
368
- if (effect2.computed) {
369
- triggerEffect(effect2, debuggerEventExtraInfo);
370
- }
371
- }
372
- for (const effect2 of effects) {
373
- if (!effect2.computed) {
374
- triggerEffect(effect2, debuggerEventExtraInfo);
375
- }
376
- }
377
- }
378
- function triggerEffect(effect2, debuggerEventExtraInfo) {
379
- if (effect2 !== activeEffect || effect2.allowRecurse) {
380
- if (!!(process.env.NODE_ENV !== "production") && effect2.onTrigger) {
381
- effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
382
- }
383
- if (effect2.scheduler) {
384
- effect2.scheduler();
385
- } else {
386
- effect2.run();
387
- }
388
- }
389
- }
390
-
391
- const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
392
- const builtInSymbols = new Set(
393
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
394
- );
395
- const get$1 = /* @__PURE__ */ createGetter();
396
- const readonlyGet = /* @__PURE__ */ createGetter(true);
397
- const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
398
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
399
- function createArrayInstrumentations() {
400
- const instrumentations = {};
401
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
402
- instrumentations[key] = function(...args) {
403
- const arr = toRaw(this);
404
- for (let i = 0, l = this.length; i < l; i++) {
405
- track(arr, "get", i + "");
406
- }
407
- const res = arr[key](...args);
408
- if (res === -1 || res === false) {
409
- return arr[key](...args.map(toRaw));
410
- } else {
411
- return res;
412
- }
413
- };
414
- });
415
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
416
- instrumentations[key] = function(...args) {
417
- pauseTracking();
418
- const res = toRaw(this)[key].apply(this, args);
419
- resetTracking();
420
- return res;
421
- };
422
- });
423
- return instrumentations;
424
- }
425
- function hasOwnProperty(key) {
426
- const obj = toRaw(this);
427
- track(obj, "has", key);
428
- return obj.hasOwnProperty(key);
429
- }
430
- function createGetter(isReadonly2 = false, shallow = false) {
431
- return function get2(target, key, receiver) {
432
- if (key === "__v_isReactive") {
433
- return !isReadonly2;
434
- } else if (key === "__v_isReadonly") {
435
- return isReadonly2;
436
- } else if (key === "__v_isShallow") {
437
- return shallow;
438
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
439
- return target;
440
- }
441
- const targetIsArray = isArray(target);
442
- if (!isReadonly2) {
443
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
444
- return Reflect.get(arrayInstrumentations, key, receiver);
445
- }
446
- if (key === "hasOwnProperty") {
447
- return hasOwnProperty;
448
- }
449
- }
450
- const res = Reflect.get(target, key, receiver);
451
- if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
452
- return res;
453
- }
454
- if (!isReadonly2) {
455
- track(target, "get", key);
456
- }
457
- if (shallow) {
458
- return res;
459
- }
460
- if (isRef(res)) {
461
- return targetIsArray && isIntegerKey(key) ? res : res.value;
462
- }
463
- if (isObject(res)) {
464
- return isReadonly2 ? readonly(res) : reactive(res);
465
- }
466
- return res;
467
- };
468
- }
469
- const set$1 = /* @__PURE__ */ createSetter();
470
- function createSetter(shallow = false) {
471
- return function set2(target, key, value, receiver) {
472
- let oldValue = target[key];
473
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
474
- return false;
475
- }
476
- if (!shallow) {
477
- if (!isShallow$1(value) && !isReadonly(value)) {
478
- oldValue = toRaw(oldValue);
479
- value = toRaw(value);
480
- }
481
- if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
482
- oldValue.value = value;
483
- return true;
484
- }
485
- }
486
- const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
487
- const result = Reflect.set(target, key, value, receiver);
488
- if (target === toRaw(receiver)) {
489
- if (!hadKey) {
490
- trigger(target, "add", key, value);
491
- } else if (hasChanged(value, oldValue)) {
492
- trigger(target, "set", key, value, oldValue);
493
- }
494
- }
495
- return result;
496
- };
497
- }
498
- function deleteProperty(target, key) {
499
- const hadKey = hasOwn(target, key);
500
- const oldValue = target[key];
501
- const result = Reflect.deleteProperty(target, key);
502
- if (result && hadKey) {
503
- trigger(target, "delete", key, void 0, oldValue);
504
- }
505
- return result;
506
- }
507
- function has$1(target, key) {
508
- const result = Reflect.has(target, key);
509
- if (!isSymbol(key) || !builtInSymbols.has(key)) {
510
- track(target, "has", key);
511
- }
512
- return result;
513
- }
514
- function ownKeys(target) {
515
- track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
516
- return Reflect.ownKeys(target);
517
- }
518
- const mutableHandlers = {
519
- get: get$1,
520
- set: set$1,
521
- deleteProperty,
522
- has: has$1,
523
- ownKeys
524
- };
525
- const readonlyHandlers = {
526
- get: readonlyGet,
527
- set(target, key) {
528
- if (!!(process.env.NODE_ENV !== "production")) {
529
- warn$1(
530
- `Set operation on key "${String(key)}" failed: target is readonly.`,
531
- target
532
- );
533
- }
534
- return true;
535
- },
536
- deleteProperty(target, key) {
537
- if (!!(process.env.NODE_ENV !== "production")) {
538
- warn$1(
539
- `Delete operation on key "${String(key)}" failed: target is readonly.`,
540
- target
541
- );
542
- }
543
- return true;
544
- }
545
- };
546
- const shallowReadonlyHandlers = /* @__PURE__ */ extend(
547
- {},
548
- readonlyHandlers,
549
- {
550
- get: shallowReadonlyGet
551
- }
552
- );
553
-
554
- const toShallow = (value) => value;
555
- const getProto = (v) => Reflect.getPrototypeOf(v);
556
- function get(target, key, isReadonly = false, isShallow = false) {
557
- target = target["__v_raw"];
558
- const rawTarget = toRaw(target);
559
- const rawKey = toRaw(key);
560
- if (!isReadonly) {
561
- if (key !== rawKey) {
562
- track(rawTarget, "get", key);
563
- }
564
- track(rawTarget, "get", rawKey);
565
- }
566
- const { has: has2 } = getProto(rawTarget);
567
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
568
- if (has2.call(rawTarget, key)) {
569
- return wrap(target.get(key));
570
- } else if (has2.call(rawTarget, rawKey)) {
571
- return wrap(target.get(rawKey));
572
- } else if (target !== rawTarget) {
573
- target.get(key);
574
- }
575
- }
576
- function has(key, isReadonly = false) {
577
- const target = this["__v_raw"];
578
- const rawTarget = toRaw(target);
579
- const rawKey = toRaw(key);
580
- if (!isReadonly) {
581
- if (key !== rawKey) {
582
- track(rawTarget, "has", key);
583
- }
584
- track(rawTarget, "has", rawKey);
585
- }
586
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
587
- }
588
- function size(target, isReadonly = false) {
589
- target = target["__v_raw"];
590
- !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
591
- return Reflect.get(target, "size", target);
592
- }
593
- function add(value) {
594
- value = toRaw(value);
595
- const target = toRaw(this);
596
- const proto = getProto(target);
597
- const hadKey = proto.has.call(target, value);
598
- if (!hadKey) {
599
- target.add(value);
600
- trigger(target, "add", value, value);
601
- }
602
- return this;
603
- }
604
- function set(key, value) {
605
- value = toRaw(value);
606
- const target = toRaw(this);
607
- const { has: has2, get: get2 } = getProto(target);
608
- let hadKey = has2.call(target, key);
609
- if (!hadKey) {
610
- key = toRaw(key);
611
- hadKey = has2.call(target, key);
612
- } else if (!!(process.env.NODE_ENV !== "production")) {
613
- checkIdentityKeys(target, has2, key);
614
- }
615
- const oldValue = get2.call(target, key);
616
- target.set(key, value);
617
- if (!hadKey) {
618
- trigger(target, "add", key, value);
619
- } else if (hasChanged(value, oldValue)) {
620
- trigger(target, "set", key, value, oldValue);
621
- }
622
- return this;
623
- }
624
- function deleteEntry(key) {
625
- const target = toRaw(this);
626
- const { has: has2, get: get2 } = getProto(target);
627
- let hadKey = has2.call(target, key);
628
- if (!hadKey) {
629
- key = toRaw(key);
630
- hadKey = has2.call(target, key);
631
- } else if (!!(process.env.NODE_ENV !== "production")) {
632
- checkIdentityKeys(target, has2, key);
633
- }
634
- const oldValue = get2 ? get2.call(target, key) : void 0;
635
- const result = target.delete(key);
636
- if (hadKey) {
637
- trigger(target, "delete", key, void 0, oldValue);
638
- }
639
- return result;
640
- }
641
- function clear() {
642
- const target = toRaw(this);
643
- const hadItems = target.size !== 0;
644
- const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
645
- const result = target.clear();
646
- if (hadItems) {
647
- trigger(target, "clear", void 0, void 0, oldTarget);
648
- }
649
- return result;
650
- }
651
- function createForEach(isReadonly, isShallow) {
652
- return function forEach(callback, thisArg) {
653
- const observed = this;
654
- const target = observed["__v_raw"];
655
- const rawTarget = toRaw(target);
656
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
657
- !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
658
- return target.forEach((value, key) => {
659
- return callback.call(thisArg, wrap(value), wrap(key), observed);
660
- });
661
- };
662
- }
663
- function createIterableMethod(method, isReadonly, isShallow) {
664
- return function(...args) {
665
- const target = this["__v_raw"];
666
- const rawTarget = toRaw(target);
667
- const targetIsMap = isMap(rawTarget);
668
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
669
- const isKeyOnly = method === "keys" && targetIsMap;
670
- const innerIterator = target[method](...args);
671
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
672
- !isReadonly && track(
673
- rawTarget,
674
- "iterate",
675
- isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
676
- );
677
- return {
678
- // iterator protocol
679
- next() {
680
- const { value, done } = innerIterator.next();
681
- return done ? { value, done } : {
682
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
683
- done
684
- };
685
- },
686
- // iterable protocol
687
- [Symbol.iterator]() {
688
- return this;
689
- }
690
- };
691
- };
692
- }
693
- function createReadonlyMethod(type) {
694
- return function(...args) {
695
- if (!!(process.env.NODE_ENV !== "production")) {
696
- const key = args[0] ? `on key "${args[0]}" ` : ``;
697
- console.warn(
698
- `${capitalize(type)} operation ${key}failed: target is readonly.`,
699
- toRaw(this)
700
- );
701
- }
702
- return type === "delete" ? false : this;
703
- };
704
- }
705
- function createInstrumentations() {
706
- const mutableInstrumentations2 = {
707
- get(key) {
708
- return get(this, key);
709
- },
710
- get size() {
711
- return size(this);
712
- },
713
- has,
714
- add,
715
- set,
716
- delete: deleteEntry,
717
- clear,
718
- forEach: createForEach(false, false)
719
- };
720
- const shallowInstrumentations2 = {
721
- get(key) {
722
- return get(this, key, false, true);
723
- },
724
- get size() {
725
- return size(this);
726
- },
727
- has,
728
- add,
729
- set,
730
- delete: deleteEntry,
731
- clear,
732
- forEach: createForEach(false, true)
733
- };
734
- const readonlyInstrumentations2 = {
735
- get(key) {
736
- return get(this, key, true);
737
- },
738
- get size() {
739
- return size(this, true);
740
- },
741
- has(key) {
742
- return has.call(this, key, true);
743
- },
744
- add: createReadonlyMethod("add"),
745
- set: createReadonlyMethod("set"),
746
- delete: createReadonlyMethod("delete"),
747
- clear: createReadonlyMethod("clear"),
748
- forEach: createForEach(true, false)
749
- };
750
- const shallowReadonlyInstrumentations2 = {
751
- get(key) {
752
- return get(this, key, true, true);
753
- },
754
- get size() {
755
- return size(this, true);
756
- },
757
- has(key) {
758
- return has.call(this, key, true);
759
- },
760
- add: createReadonlyMethod("add"),
761
- set: createReadonlyMethod("set"),
762
- delete: createReadonlyMethod("delete"),
763
- clear: createReadonlyMethod("clear"),
764
- forEach: createForEach(true, true)
765
- };
766
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
767
- iteratorMethods.forEach((method) => {
768
- mutableInstrumentations2[method] = createIterableMethod(
769
- method,
770
- false,
771
- false
772
- );
773
- readonlyInstrumentations2[method] = createIterableMethod(
774
- method,
775
- true,
776
- false
777
- );
778
- shallowInstrumentations2[method] = createIterableMethod(
779
- method,
780
- false,
781
- true
782
- );
783
- shallowReadonlyInstrumentations2[method] = createIterableMethod(
784
- method,
785
- true,
786
- true
787
- );
788
- });
789
- return [
790
- mutableInstrumentations2,
791
- readonlyInstrumentations2,
792
- shallowInstrumentations2,
793
- shallowReadonlyInstrumentations2
794
- ];
795
- }
796
- const [
797
- mutableInstrumentations,
798
- readonlyInstrumentations,
799
- shallowInstrumentations,
800
- shallowReadonlyInstrumentations
801
- ] = /* @__PURE__ */ createInstrumentations();
802
- function createInstrumentationGetter(isReadonly, shallow) {
803
- const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
804
- return (target, key, receiver) => {
805
- if (key === "__v_isReactive") {
806
- return !isReadonly;
807
- } else if (key === "__v_isReadonly") {
808
- return isReadonly;
809
- } else if (key === "__v_raw") {
810
- return target;
811
- }
812
- return Reflect.get(
813
- hasOwn(instrumentations, key) && key in target ? instrumentations : target,
814
- key,
815
- receiver
816
- );
817
- };
818
- }
819
- const mutableCollectionHandlers = {
820
- get: /* @__PURE__ */ createInstrumentationGetter(false, false)
821
- };
822
- const readonlyCollectionHandlers = {
823
- get: /* @__PURE__ */ createInstrumentationGetter(true, false)
824
- };
825
- const shallowReadonlyCollectionHandlers = {
826
- get: /* @__PURE__ */ createInstrumentationGetter(true, true)
827
- };
828
- function checkIdentityKeys(target, has2, key) {
829
- const rawKey = toRaw(key);
830
- if (rawKey !== key && has2.call(target, rawKey)) {
831
- const type = toRawType(target);
832
- console.warn(
833
- `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
834
- );
835
- }
836
- }
837
-
838
- const reactiveMap = /* @__PURE__ */ new WeakMap();
839
- const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
840
- const readonlyMap = /* @__PURE__ */ new WeakMap();
841
- const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
842
- function targetTypeMap(rawType) {
843
- switch (rawType) {
844
- case "Object":
845
- case "Array":
846
- return 1 /* COMMON */;
847
- case "Map":
848
- case "Set":
849
- case "WeakMap":
850
- case "WeakSet":
851
- return 2 /* COLLECTION */;
852
- default:
853
- return 0 /* INVALID */;
854
- }
855
- }
856
- function getTargetType(value) {
857
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
858
- }
859
- function reactive(target) {
860
- if (isReadonly(target)) {
861
- return target;
862
- }
863
- return createReactiveObject(
864
- target,
865
- false,
866
- mutableHandlers,
867
- mutableCollectionHandlers,
868
- reactiveMap
869
- );
870
- }
871
- function readonly(target) {
872
- return createReactiveObject(
873
- target,
874
- true,
875
- readonlyHandlers,
876
- readonlyCollectionHandlers,
877
- readonlyMap
878
- );
879
- }
880
- function shallowReadonly(target) {
881
- return createReactiveObject(
882
- target,
883
- true,
884
- shallowReadonlyHandlers,
885
- shallowReadonlyCollectionHandlers,
886
- shallowReadonlyMap
887
- );
888
- }
889
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
890
- if (!isObject(target)) {
891
- if (!!(process.env.NODE_ENV !== "production")) {
892
- console.warn(`value cannot be made reactive: ${String(target)}`);
893
- }
894
- return target;
895
- }
896
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
897
- return target;
898
- }
899
- const existingProxy = proxyMap.get(target);
900
- if (existingProxy) {
901
- return existingProxy;
902
- }
903
- const targetType = getTargetType(target);
904
- if (targetType === 0 /* INVALID */) {
905
- return target;
906
- }
907
- const proxy = new Proxy(
908
- target,
909
- targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
910
- );
911
- proxyMap.set(target, proxy);
912
- return proxy;
913
- }
914
- function isReactive(value) {
915
- if (isReadonly(value)) {
916
- return isReactive(value["__v_raw"]);
917
- }
918
- return !!(value && value["__v_isReactive"]);
919
- }
920
- function isReadonly(value) {
921
- return !!(value && value["__v_isReadonly"]);
922
- }
923
- function isShallow$1(value) {
924
- return !!(value && value["__v_isShallow"]);
925
- }
926
- function isProxy(value) {
927
- return isReactive(value) || isReadonly(value);
928
- }
929
- function toRaw(observed) {
930
- const raw = observed && observed["__v_raw"];
931
- return raw ? toRaw(raw) : observed;
932
- }
933
- function markRaw(value) {
934
- def(value, "__v_skip", true);
935
- return value;
936
- }
937
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
938
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
939
-
940
- function trackRefValue(ref2) {
941
- if (shouldTrack && activeEffect) {
942
- ref2 = toRaw(ref2);
943
- if (!!(process.env.NODE_ENV !== "production")) {
944
- trackEffects(ref2.dep || (ref2.dep = createDep()), {
945
- target: ref2,
946
- type: "get",
947
- key: "value"
948
- });
949
- } else {
950
- trackEffects(ref2.dep || (ref2.dep = createDep()));
951
- }
952
- }
953
- }
954
- function triggerRefValue(ref2, newVal) {
955
- ref2 = toRaw(ref2);
956
- const dep = ref2.dep;
957
- if (dep) {
958
- if (!!(process.env.NODE_ENV !== "production")) {
959
- triggerEffects(dep, {
960
- target: ref2,
961
- type: "set",
962
- key: "value",
963
- newValue: newVal
964
- });
965
- } else {
966
- triggerEffects(dep);
967
- }
968
- }
969
- }
970
- function isRef(r) {
971
- return !!(r && r.__v_isRef === true);
972
- }
973
- function ref(value) {
974
- return createRef(value, false);
975
- }
976
- function createRef(rawValue, shallow) {
977
- if (isRef(rawValue)) {
978
- return rawValue;
979
- }
980
- return new RefImpl(rawValue, shallow);
981
- }
982
- class RefImpl {
983
- constructor(value, __v_isShallow) {
984
- this.__v_isShallow = __v_isShallow;
985
- this.dep = void 0;
986
- this.__v_isRef = true;
987
- this._rawValue = __v_isShallow ? value : toRaw(value);
988
- this._value = __v_isShallow ? value : toReactive(value);
989
- }
990
- get value() {
991
- trackRefValue(this);
992
- return this._value;
993
- }
994
- set value(newVal) {
995
- const useDirectValue = this.__v_isShallow || isShallow$1(newVal) || isReadonly(newVal);
996
- newVal = useDirectValue ? newVal : toRaw(newVal);
997
- if (hasChanged(newVal, this._rawValue)) {
998
- this._rawValue = newVal;
999
- this._value = useDirectValue ? newVal : toReactive(newVal);
1000
- triggerRefValue(this, newVal);
1001
- }
1002
- }
1003
- }
1004
- function unref(ref2) {
1005
- return isRef(ref2) ? ref2.value : ref2;
1006
- }
1007
- const shallowUnwrapHandlers = {
1008
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1009
- set: (target, key, value, receiver) => {
1010
- const oldValue = target[key];
1011
- if (isRef(oldValue) && !isRef(value)) {
1012
- oldValue.value = value;
1013
- return true;
1014
- } else {
1015
- return Reflect.set(target, key, value, receiver);
1016
- }
1017
- }
1018
- };
1019
- function proxyRefs(objectWithRefs) {
1020
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1021
- }
1022
-
1023
- const stack = [];
1024
- function pushWarningContext(vnode) {
1025
- stack.push(vnode);
1026
- }
1027
- function popWarningContext() {
1028
- stack.pop();
1029
- }
1030
- function warn(msg, ...args) {
1031
- if (!!!(process.env.NODE_ENV !== "production"))
1032
- return;
1033
- pauseTracking();
1034
- const instance = stack.length ? stack[stack.length - 1].component : null;
1035
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
1036
- const trace = getComponentTrace();
1037
- if (appWarnHandler) {
1038
- callWithErrorHandling(
1039
- appWarnHandler,
1040
- instance,
1041
- 11,
1042
- [
1043
- msg + args.join(""),
1044
- instance && instance.proxy,
1045
- trace.map(
1046
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
1047
- ).join("\n"),
1048
- trace
1049
- ]
1050
- );
1051
- } else {
1052
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
1053
- if (trace.length && // avoid spamming console during tests
1054
- true) {
1055
- warnArgs.push(`
1056
- `, ...formatTrace(trace));
1057
- }
1058
- console.warn(...warnArgs);
1059
- }
1060
- resetTracking();
1061
- }
1062
- function getComponentTrace() {
1063
- let currentVNode = stack[stack.length - 1];
1064
- if (!currentVNode) {
1065
- return [];
1066
- }
1067
- const normalizedStack = [];
1068
- while (currentVNode) {
1069
- const last = normalizedStack[0];
1070
- if (last && last.vnode === currentVNode) {
1071
- last.recurseCount++;
1072
- } else {
1073
- normalizedStack.push({
1074
- vnode: currentVNode,
1075
- recurseCount: 0
1076
- });
1077
- }
1078
- const parentInstance = currentVNode.component && currentVNode.component.parent;
1079
- currentVNode = parentInstance && parentInstance.vnode;
1080
- }
1081
- return normalizedStack;
1082
- }
1083
- function formatTrace(trace) {
1084
- const logs = [];
1085
- trace.forEach((entry, i) => {
1086
- logs.push(...i === 0 ? [] : [`
1087
- `], ...formatTraceEntry(entry));
1088
- });
1089
- return logs;
1090
- }
1091
- function formatTraceEntry({ vnode, recurseCount }) {
1092
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
1093
- const isRoot = vnode.component ? vnode.component.parent == null : false;
1094
- const open = ` at <${formatComponentName(
1095
- vnode.component,
1096
- vnode.type,
1097
- isRoot
1098
- )}`;
1099
- const close = `>` + postfix;
1100
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
1101
- }
1102
- function formatProps(props) {
1103
- const res = [];
1104
- const keys = Object.keys(props);
1105
- keys.slice(0, 3).forEach((key) => {
1106
- res.push(...formatProp(key, props[key]));
1107
- });
1108
- if (keys.length > 3) {
1109
- res.push(` ...`);
1110
- }
1111
- return res;
1112
- }
1113
- function formatProp(key, value, raw) {
1114
- if (isString(value)) {
1115
- value = JSON.stringify(value);
1116
- return raw ? value : [`${key}=${value}`];
1117
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
1118
- return raw ? value : [`${key}=${value}`];
1119
- } else if (isRef(value)) {
1120
- value = formatProp(key, toRaw(value.value), true);
1121
- return raw ? value : [`${key}=Ref<`, value, `>`];
1122
- } else if (isFunction(value)) {
1123
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1124
- } else {
1125
- value = toRaw(value);
1126
- return raw ? value : [`${key}=`, value];
1127
- }
1128
- }
1129
-
1130
- const ErrorTypeStrings = {
1131
- ["sp"]: "serverPrefetch hook",
1132
- ["bc"]: "beforeCreate hook",
1133
- ["c"]: "created hook",
1134
- ["bm"]: "beforeMount hook",
1135
- ["m"]: "mounted hook",
1136
- ["bu"]: "beforeUpdate hook",
1137
- ["u"]: "updated",
1138
- ["bum"]: "beforeUnmount hook",
1139
- ["um"]: "unmounted hook",
1140
- ["a"]: "activated hook",
1141
- ["da"]: "deactivated hook",
1142
- ["ec"]: "errorCaptured hook",
1143
- ["rtc"]: "renderTracked hook",
1144
- ["rtg"]: "renderTriggered hook",
1145
- [0]: "setup function",
1146
- [1]: "render function",
1147
- [2]: "watcher getter",
1148
- [3]: "watcher callback",
1149
- [4]: "watcher cleanup function",
1150
- [5]: "native event handler",
1151
- [6]: "component event handler",
1152
- [7]: "vnode hook",
1153
- [8]: "directive hook",
1154
- [9]: "transition hook",
1155
- [10]: "app errorHandler",
1156
- [11]: "app warnHandler",
1157
- [12]: "ref function",
1158
- [13]: "async component loader",
1159
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
1160
- };
1161
- function callWithErrorHandling(fn, instance, type, args) {
1162
- let res;
1163
- try {
1164
- res = args ? fn(...args) : fn();
1165
- } catch (err) {
1166
- handleError(err, instance, type);
1167
- }
1168
- return res;
1169
- }
1170
- function callWithAsyncErrorHandling(fn, instance, type, args) {
1171
- if (isFunction(fn)) {
1172
- const res = callWithErrorHandling(fn, instance, type, args);
1173
- if (res && isPromise(res)) {
1174
- res.catch((err) => {
1175
- handleError(err, instance, type);
1176
- });
1177
- }
1178
- return res;
1179
- }
1180
- const values = [];
1181
- for (let i = 0; i < fn.length; i++) {
1182
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1183
- }
1184
- return values;
1185
- }
1186
- function handleError(err, instance, type, throwInDev = true) {
1187
- const contextVNode = instance ? instance.vnode : null;
1188
- if (instance) {
1189
- let cur = instance.parent;
1190
- const exposedInstance = instance.proxy;
1191
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : type;
1192
- while (cur) {
1193
- const errorCapturedHooks = cur.ec;
1194
- if (errorCapturedHooks) {
1195
- for (let i = 0; i < errorCapturedHooks.length; i++) {
1196
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1197
- return;
1198
- }
1199
- }
1200
- }
1201
- cur = cur.parent;
1202
- }
1203
- const appErrorHandler = instance.appContext.config.errorHandler;
1204
- if (appErrorHandler) {
1205
- callWithErrorHandling(
1206
- appErrorHandler,
1207
- null,
1208
- 10,
1209
- [err, exposedInstance, errorInfo]
1210
- );
1211
- return;
1212
- }
1213
- }
1214
- logError(err, type, contextVNode, throwInDev);
1215
- }
1216
- function logError(err, type, contextVNode, throwInDev = true) {
1217
- if (!!(process.env.NODE_ENV !== "production")) {
1218
- const info = ErrorTypeStrings[type];
1219
- if (contextVNode) {
1220
- pushWarningContext(contextVNode);
1221
- }
1222
- warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1223
- if (contextVNode) {
1224
- popWarningContext();
1225
- }
1226
- if (throwInDev) {
1227
- throw err;
1228
- } else {
1229
- console.error(err);
1230
- }
1231
- } else {
1232
- console.error(err);
1233
- }
1234
- }
1235
-
1236
- let isFlushing = false;
1237
- let isFlushPending = false;
1238
- const queue = [];
1239
- let flushIndex = 0;
1240
- const pendingPostFlushCbs = [];
1241
- let activePostFlushCbs = null;
1242
- let postFlushIndex = 0;
1243
- const resolvedPromise = /* @__PURE__ */ Promise.resolve();
1244
- let currentFlushPromise = null;
1245
- const RECURSION_LIMIT = 100;
1246
- function nextTick(fn) {
1247
- const p = currentFlushPromise || resolvedPromise;
1248
- return fn ? p.then(this ? fn.bind(this) : fn) : p;
1249
- }
1250
- function findInsertionIndex(id) {
1251
- let start = flushIndex + 1;
1252
- let end = queue.length;
1253
- while (start < end) {
1254
- const middle = start + end >>> 1;
1255
- const middleJobId = getId(queue[middle]);
1256
- middleJobId < id ? start = middle + 1 : end = middle;
1257
- }
1258
- return start;
1259
- }
1260
- function queueJob(job) {
1261
- if (!queue.length || !queue.includes(
1262
- job,
1263
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1264
- )) {
1265
- if (job.id == null) {
1266
- queue.push(job);
1267
- } else {
1268
- queue.splice(findInsertionIndex(job.id), 0, job);
1269
- }
1270
- queueFlush();
1271
- }
1272
- }
1273
- function queueFlush() {
1274
- if (!isFlushing && !isFlushPending) {
1275
- isFlushPending = true;
1276
- currentFlushPromise = resolvedPromise.then(flushJobs);
1277
- }
1278
- }
1279
- function queuePostFlushCb(cb) {
1280
- if (!isArray(cb)) {
1281
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1282
- cb,
1283
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1284
- )) {
1285
- pendingPostFlushCbs.push(cb);
1286
- }
1287
- } else {
1288
- pendingPostFlushCbs.push(...cb);
1289
- }
1290
- queueFlush();
1291
- }
1292
- function flushPostFlushCbs(seen) {
1293
- if (pendingPostFlushCbs.length) {
1294
- const deduped = [...new Set(pendingPostFlushCbs)];
1295
- pendingPostFlushCbs.length = 0;
1296
- if (activePostFlushCbs) {
1297
- activePostFlushCbs.push(...deduped);
1298
- return;
1299
- }
1300
- activePostFlushCbs = deduped;
1301
- if (!!(process.env.NODE_ENV !== "production")) {
1302
- seen = seen || /* @__PURE__ */ new Map();
1303
- }
1304
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1305
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1306
- if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1307
- continue;
1308
- }
1309
- activePostFlushCbs[postFlushIndex]();
1310
- }
1311
- activePostFlushCbs = null;
1312
- postFlushIndex = 0;
1313
- }
1314
- }
1315
- const getId = (job) => job.id == null ? Infinity : job.id;
1316
- const comparator = (a, b) => {
1317
- const diff = getId(a) - getId(b);
1318
- if (diff === 0) {
1319
- if (a.pre && !b.pre)
1320
- return -1;
1321
- if (b.pre && !a.pre)
1322
- return 1;
1323
- }
1324
- return diff;
1325
- };
1326
- function flushJobs(seen) {
1327
- isFlushPending = false;
1328
- isFlushing = true;
1329
- if (!!(process.env.NODE_ENV !== "production")) {
1330
- seen = seen || /* @__PURE__ */ new Map();
1331
- }
1332
- queue.sort(comparator);
1333
- const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
1334
- try {
1335
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1336
- const job = queue[flushIndex];
1337
- if (job && job.active !== false) {
1338
- if (!!(process.env.NODE_ENV !== "production") && check(job)) {
1339
- continue;
1340
- }
1341
- callWithErrorHandling(job, null, 14);
1342
- }
1343
- }
1344
- } finally {
1345
- flushIndex = 0;
1346
- queue.length = 0;
1347
- flushPostFlushCbs(seen);
1348
- isFlushing = false;
1349
- currentFlushPromise = null;
1350
- if (queue.length || pendingPostFlushCbs.length) {
1351
- flushJobs(seen);
1352
- }
1353
- }
1354
- }
1355
- function checkRecursiveUpdates(seen, fn) {
1356
- if (!seen.has(fn)) {
1357
- seen.set(fn, 1);
1358
- } else {
1359
- const count = seen.get(fn);
1360
- if (count > RECURSION_LIMIT) {
1361
- const instance = fn.ownerInstance;
1362
- const componentName = instance && getComponentName(instance.type);
1363
- warn(
1364
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
1365
- );
1366
- return true;
1367
- } else {
1368
- seen.set(fn, count + 1);
1369
- }
1370
- }
1371
- }
1372
- const hmrDirtyComponents = /* @__PURE__ */ new Set();
1373
- if (!!(process.env.NODE_ENV !== "production")) {
1374
- getGlobalThis().__VUE_HMR_RUNTIME__ = {
1375
- createRecord: tryWrap(createRecord),
1376
- rerender: tryWrap(rerender),
1377
- reload: tryWrap(reload)
1378
- };
1379
- }
1380
- const map = /* @__PURE__ */ new Map();
1381
- function createRecord(id, initialDef) {
1382
- if (map.has(id)) {
1383
- return false;
1384
- }
1385
- map.set(id, {
1386
- initialDef: normalizeClassComponent(initialDef),
1387
- instances: /* @__PURE__ */ new Set()
1388
- });
1389
- return true;
1390
- }
1391
- function normalizeClassComponent(component) {
1392
- return isClassComponent(component) ? component.__vccOpts : component;
1393
- }
1394
- function rerender(id, newRender) {
1395
- const record = map.get(id);
1396
- if (!record) {
1397
- return;
1398
- }
1399
- record.initialDef.render = newRender;
1400
- [...record.instances].forEach((instance) => {
1401
- if (newRender) {
1402
- instance.render = newRender;
1403
- normalizeClassComponent(instance.type).render = newRender;
1404
- }
1405
- instance.renderCache = [];
1406
- instance.update();
1407
- });
1408
- }
1409
- function reload(id, newComp) {
1410
- const record = map.get(id);
1411
- if (!record)
1412
- return;
1413
- newComp = normalizeClassComponent(newComp);
1414
- updateComponentDef(record.initialDef, newComp);
1415
- const instances = [...record.instances];
1416
- for (const instance of instances) {
1417
- const oldComp = normalizeClassComponent(instance.type);
1418
- if (!hmrDirtyComponents.has(oldComp)) {
1419
- if (oldComp !== record.initialDef) {
1420
- updateComponentDef(oldComp, newComp);
1421
- }
1422
- hmrDirtyComponents.add(oldComp);
1423
- }
1424
- instance.appContext.propsCache.delete(instance.type);
1425
- instance.appContext.emitsCache.delete(instance.type);
1426
- instance.appContext.optionsCache.delete(instance.type);
1427
- if (instance.ceReload) {
1428
- hmrDirtyComponents.add(oldComp);
1429
- instance.ceReload(newComp.styles);
1430
- hmrDirtyComponents.delete(oldComp);
1431
- } else if (instance.parent) {
1432
- queueJob(instance.parent.update);
1433
- } else if (instance.appContext.reload) {
1434
- instance.appContext.reload();
1435
- } else if (typeof window !== "undefined") {
1436
- window.location.reload();
1437
- } else {
1438
- console.warn(
1439
- "[HMR] Root or manually mounted instance modified. Full reload required."
1440
- );
1441
- }
1442
- }
1443
- queuePostFlushCb(() => {
1444
- for (const instance of instances) {
1445
- hmrDirtyComponents.delete(
1446
- normalizeClassComponent(instance.type)
1447
- );
1448
- }
1449
- });
1450
- }
1451
- function updateComponentDef(oldComp, newComp) {
1452
- extend(oldComp, newComp);
1453
- for (const key in oldComp) {
1454
- if (key !== "__file" && !(key in newComp)) {
1455
- delete oldComp[key];
1456
- }
1457
- }
1458
- }
1459
- function tryWrap(fn) {
1460
- return (id, arg) => {
1461
- try {
1462
- return fn(id, arg);
1463
- } catch (e) {
1464
- console.error(e);
1465
- console.warn(
1466
- `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
1467
- );
1468
- }
1469
- };
1470
- }
1471
-
1472
- let currentRenderingInstance = null;
1473
- let currentScopeId = null;
1474
- function markAttrsAccessed() {
1475
- }
1476
-
1477
- const isSuspense = (type) => type.__isSuspense;
1478
- function queueEffectWithSuspense(fn, suspense) {
1479
- if (suspense && suspense.pendingBranch) {
1480
- if (isArray(fn)) {
1481
- suspense.effects.push(...fn);
1482
- } else {
1483
- suspense.effects.push(fn);
1484
- }
1485
- } else {
1486
- queuePostFlushCb(fn);
1487
- }
1488
- }
1489
- const INITIAL_WATCHER_VALUE = {};
1490
- function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
1491
- var _a;
1492
- if (!!(process.env.NODE_ENV !== "production") && !cb) {
1493
- if (immediate !== void 0) {
1494
- warn(
1495
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
1496
- );
1497
- }
1498
- if (deep !== void 0) {
1499
- warn(
1500
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
1501
- );
1502
- }
1503
- }
1504
- const warnInvalidSource = (s) => {
1505
- warn(
1506
- `Invalid watch source: `,
1507
- s,
1508
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1509
- );
1510
- };
1511
- const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
1512
- let getter;
1513
- let forceTrigger = false;
1514
- let isMultiSource = false;
1515
- if (isRef(source)) {
1516
- getter = () => source.value;
1517
- forceTrigger = isShallow$1(source);
1518
- } else if (isReactive(source)) {
1519
- getter = () => source;
1520
- deep = true;
1521
- } else if (isArray(source)) {
1522
- isMultiSource = true;
1523
- forceTrigger = source.some((s) => isReactive(s) || isShallow$1(s));
1524
- getter = () => source.map((s) => {
1525
- if (isRef(s)) {
1526
- return s.value;
1527
- } else if (isReactive(s)) {
1528
- return traverse(s);
1529
- } else if (isFunction(s)) {
1530
- return callWithErrorHandling(s, instance, 2);
1531
- } else {
1532
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(s);
1533
- }
1534
- });
1535
- } else if (isFunction(source)) {
1536
- if (cb) {
1537
- getter = () => callWithErrorHandling(source, instance, 2);
1538
- } else {
1539
- getter = () => {
1540
- if (instance && instance.isUnmounted) {
1541
- return;
1542
- }
1543
- if (cleanup) {
1544
- cleanup();
1545
- }
1546
- return callWithAsyncErrorHandling(
1547
- source,
1548
- instance,
1549
- 3,
1550
- [onCleanup]
1551
- );
1552
- };
1553
- }
1554
- } else {
1555
- getter = NOOP;
1556
- !!(process.env.NODE_ENV !== "production") && warnInvalidSource(source);
1557
- }
1558
- if (cb && deep) {
1559
- const baseGetter = getter;
1560
- getter = () => traverse(baseGetter());
1561
- }
1562
- let cleanup;
1563
- let onCleanup = (fn) => {
1564
- cleanup = effect.onStop = () => {
1565
- callWithErrorHandling(fn, instance, 4);
1566
- };
1567
- };
1568
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1569
- const job = () => {
1570
- if (!effect.active) {
1571
- return;
1572
- }
1573
- if (cb) {
1574
- const newValue = effect.run();
1575
- if (deep || forceTrigger || (isMultiSource ? newValue.some(
1576
- (v, i) => hasChanged(v, oldValue[i])
1577
- ) : hasChanged(newValue, oldValue)) || false) {
1578
- if (cleanup) {
1579
- cleanup();
1580
- }
1581
- callWithAsyncErrorHandling(cb, instance, 3, [
1582
- newValue,
1583
- // pass undefined as the old value when it's changed for the first time
1584
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1585
- onCleanup
1586
- ]);
1587
- oldValue = newValue;
1588
- }
1589
- } else {
1590
- effect.run();
1591
- }
1592
- };
1593
- job.allowRecurse = !!cb;
1594
- let scheduler;
1595
- if (flush === "sync") {
1596
- scheduler = job;
1597
- } else if (flush === "post") {
1598
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1599
- } else {
1600
- job.pre = true;
1601
- if (instance)
1602
- job.id = instance.uid;
1603
- scheduler = () => queueJob(job);
1604
- }
1605
- const effect = new ReactiveEffect(getter, scheduler);
1606
- if (!!(process.env.NODE_ENV !== "production")) {
1607
- effect.onTrack = onTrack;
1608
- effect.onTrigger = onTrigger;
1609
- }
1610
- if (cb) {
1611
- if (immediate) {
1612
- job();
1613
- } else {
1614
- oldValue = effect.run();
1615
- }
1616
- } else if (flush === "post") {
1617
- queuePostRenderEffect(
1618
- effect.run.bind(effect),
1619
- instance && instance.suspense
1620
- );
1621
- } else {
1622
- effect.run();
1623
- }
1624
- const unwatch = () => {
1625
- effect.stop();
1626
- if (instance && instance.scope) {
1627
- remove(instance.scope.effects, effect);
1628
- }
1629
- };
1630
- return unwatch;
1631
- }
1632
- function instanceWatch(source, value, options) {
1633
- const publicThis = this.proxy;
1634
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
1635
- let cb;
1636
- if (isFunction(value)) {
1637
- cb = value;
1638
- } else {
1639
- cb = value.handler;
1640
- options = value;
1641
- }
1642
- const cur = currentInstance;
1643
- setCurrentInstance(this);
1644
- const res = doWatch(getter, cb.bind(publicThis), options);
1645
- if (cur) {
1646
- setCurrentInstance(cur);
1647
- } else {
1648
- unsetCurrentInstance();
1649
- }
1650
- return res;
1651
- }
1652
- function createPathGetter(ctx, path) {
1653
- const segments = path.split(".");
1654
- return () => {
1655
- let cur = ctx;
1656
- for (let i = 0; i < segments.length && cur; i++) {
1657
- cur = cur[segments[i]];
1658
- }
1659
- return cur;
1660
- };
1661
- }
1662
- function traverse(value, seen) {
1663
- if (!isObject(value) || value["__v_skip"]) {
1664
- return value;
1665
- }
1666
- seen = seen || /* @__PURE__ */ new Set();
1667
- if (seen.has(value)) {
1668
- return value;
1669
- }
1670
- seen.add(value);
1671
- if (isRef(value)) {
1672
- traverse(value.value, seen);
1673
- } else if (isArray(value)) {
1674
- for (let i = 0; i < value.length; i++) {
1675
- traverse(value[i], seen);
1676
- }
1677
- } else if (isSet(value) || isMap(value)) {
1678
- value.forEach((v) => {
1679
- traverse(v, seen);
1680
- });
1681
- } else if (isPlainObject(value)) {
1682
- for (const key in value) {
1683
- traverse(value[key], seen);
1684
- }
1685
- }
1686
- return value;
1687
- }
1688
- function withDirectives(vnode, directives) {
1689
- {
1690
- !!(process.env.NODE_ENV !== "production") && warn(`withDirectives can only be used inside render functions.`);
1691
- return vnode;
1692
- }
1693
- }
1694
-
1695
- function defineComponent(options, extraOptions) {
1696
- return isFunction(options) ? (
1697
- // #8326: extend call and options.name access are considered side-effects
1698
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1699
- /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
1700
- ) : options;
1701
- }
1702
-
1703
- function injectHook(type, hook, target = currentInstance, prepend = false) {
1704
- if (target) {
1705
- const hooks = target[type] || (target[type] = []);
1706
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1707
- if (target.isUnmounted) {
1708
- return;
1709
- }
1710
- pauseTracking();
1711
- setCurrentInstance(target);
1712
- const res = callWithAsyncErrorHandling(hook, target, type, args);
1713
- unsetCurrentInstance();
1714
- resetTracking();
1715
- return res;
1716
- });
1717
- if (prepend) {
1718
- hooks.unshift(wrappedHook);
1719
- } else {
1720
- hooks.push(wrappedHook);
1721
- }
1722
- return wrappedHook;
1723
- } else if (!!(process.env.NODE_ENV !== "production")) {
1724
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
1725
- warn(
1726
- `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
1727
- );
1728
- }
1729
- }
1730
- const createHook = (lifecycle) => (hook, target = currentInstance) => (
1731
- // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
1732
- injectHook(lifecycle, (...args) => hook(...args), target)
1733
- );
1734
- const onMounted = createHook("m");
1735
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1736
-
1737
- const getPublicInstance = (i) => {
1738
- if (!i)
1739
- return null;
1740
- if (isStatefulComponent(i))
1741
- return getExposeProxy(i) || i.proxy;
1742
- return getPublicInstance(i.parent);
1743
- };
1744
- const publicPropertiesMap = (
1745
- // Move PURE marker to new line to workaround compiler discarding it
1746
- // due to type annotation
1747
- /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
1748
- $: (i) => i,
1749
- $el: (i) => i.vnode.el,
1750
- $data: (i) => i.data,
1751
- $props: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.props) : i.props,
1752
- $attrs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.attrs) : i.attrs,
1753
- $slots: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.slots) : i.slots,
1754
- $refs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.refs) : i.refs,
1755
- $parent: (i) => getPublicInstance(i.parent),
1756
- $root: (i) => getPublicInstance(i.root),
1757
- $emit: (i) => i.emit,
1758
- $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
1759
- $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
1760
- $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
1761
- $watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
1762
- })
1763
- );
1764
- const isReservedPrefix = (key) => key === "_" || key === "$";
1765
- const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
1766
- const PublicInstanceProxyHandlers = {
1767
- get({ _: instance }, key) {
1768
- const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
1769
- if (!!(process.env.NODE_ENV !== "production") && key === "__isVue") {
1770
- return true;
1771
- }
1772
- let normalizedProps;
1773
- if (key[0] !== "$") {
1774
- const n = accessCache[key];
1775
- if (n !== void 0) {
1776
- switch (n) {
1777
- case 1 /* SETUP */:
1778
- return setupState[key];
1779
- case 2 /* DATA */:
1780
- return data[key];
1781
- case 4 /* CONTEXT */:
1782
- return ctx[key];
1783
- case 3 /* PROPS */:
1784
- return props[key];
1785
- }
1786
- } else if (hasSetupBinding(setupState, key)) {
1787
- accessCache[key] = 1 /* SETUP */;
1788
- return setupState[key];
1789
- } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
1790
- accessCache[key] = 2 /* DATA */;
1791
- return data[key];
1792
- } else if (
1793
- // only cache other properties when instance has declared (thus stable)
1794
- // props
1795
- (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
1796
- ) {
1797
- accessCache[key] = 3 /* PROPS */;
1798
- return props[key];
1799
- } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
1800
- accessCache[key] = 4 /* CONTEXT */;
1801
- return ctx[key];
1802
- } else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
1803
- accessCache[key] = 0 /* OTHER */;
1804
- }
1805
- }
1806
- const publicGetter = publicPropertiesMap[key];
1807
- let cssModule, globalProperties;
1808
- if (publicGetter) {
1809
- if (key === "$attrs") {
1810
- track(instance, "get", key);
1811
- !!(process.env.NODE_ENV !== "production") && markAttrsAccessed();
1812
- } else if (!!(process.env.NODE_ENV !== "production") && key === "$slots") {
1813
- track(instance, "get", key);
1814
- }
1815
- return publicGetter(instance);
1816
- } else if (
1817
- // css module (injected by vue-loader)
1818
- (cssModule = type.__cssModules) && (cssModule = cssModule[key])
1819
- ) {
1820
- return cssModule;
1821
- } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
1822
- accessCache[key] = 4 /* CONTEXT */;
1823
- return ctx[key];
1824
- } else if (
1825
- // global properties
1826
- globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
1827
- ) {
1828
- {
1829
- return globalProperties[key];
1830
- }
1831
- } else if (!!(process.env.NODE_ENV !== "production") && currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
1832
- // to infinite warning loop
1833
- key.indexOf("__v") !== 0)) {
1834
- if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
1835
- warn(
1836
- `Property ${JSON.stringify(
1837
- key
1838
- )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
1839
- );
1840
- } else if (instance === currentRenderingInstance) {
1841
- warn(
1842
- `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
1843
- );
1844
- }
1845
- }
1846
- },
1847
- set({ _: instance }, key, value) {
1848
- const { data, setupState, ctx } = instance;
1849
- if (hasSetupBinding(setupState, key)) {
1850
- setupState[key] = value;
1851
- return true;
1852
- } else if (!!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup && hasOwn(setupState, key)) {
1853
- warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
1854
- return false;
1855
- } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
1856
- data[key] = value;
1857
- return true;
1858
- } else if (hasOwn(instance.props, key)) {
1859
- !!(process.env.NODE_ENV !== "production") && warn(`Attempting to mutate prop "${key}". Props are readonly.`);
1860
- return false;
1861
- }
1862
- if (key[0] === "$" && key.slice(1) in instance) {
1863
- !!(process.env.NODE_ENV !== "production") && warn(
1864
- `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
1865
- );
1866
- return false;
1867
- } else {
1868
- if (!!(process.env.NODE_ENV !== "production") && key in instance.appContext.config.globalProperties) {
1869
- Object.defineProperty(ctx, key, {
1870
- enumerable: true,
1871
- configurable: true,
1872
- value
1873
- });
1874
- } else {
1875
- ctx[key] = value;
1876
- }
1877
- }
1878
- return true;
1879
- },
1880
- has({
1881
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
1882
- }, key) {
1883
- let normalizedProps;
1884
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
1885
- },
1886
- defineProperty(target, key, descriptor) {
1887
- if (descriptor.get != null) {
1888
- target._.accessCache[key] = 0;
1889
- } else if (hasOwn(descriptor, "value")) {
1890
- this.set(target, key, descriptor.value, null);
1891
- }
1892
- return Reflect.defineProperty(target, key, descriptor);
1893
- }
1894
- };
1895
- if (!!(process.env.NODE_ENV !== "production") && true) {
1896
- PublicInstanceProxyHandlers.ownKeys = (target) => {
1897
- warn(
1898
- `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
1899
- );
1900
- return Reflect.ownKeys(target);
1901
- };
1902
- }
1903
- function normalizePropsOrEmits(props) {
1904
- return isArray(props) ? props.reduce(
1905
- (normalized, p) => (normalized[p] = null, normalized),
1906
- {}
1907
- ) : props;
1908
- }
1909
- let shouldCacheAccess = true;
1910
- function resolveMergedOptions(instance) {
1911
- const base = instance.type;
1912
- const { mixins, extends: extendsOptions } = base;
1913
- const {
1914
- mixins: globalMixins,
1915
- optionsCache: cache,
1916
- config: { optionMergeStrategies }
1917
- } = instance.appContext;
1918
- const cached = cache.get(base);
1919
- let resolved;
1920
- if (cached) {
1921
- resolved = cached;
1922
- } else if (!globalMixins.length && !mixins && !extendsOptions) {
1923
- {
1924
- resolved = base;
1925
- }
1926
- } else {
1927
- resolved = {};
1928
- if (globalMixins.length) {
1929
- globalMixins.forEach(
1930
- (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
1931
- );
1932
- }
1933
- mergeOptions(resolved, base, optionMergeStrategies);
1934
- }
1935
- if (isObject(base)) {
1936
- cache.set(base, resolved);
1937
- }
1938
- return resolved;
1939
- }
1940
- function mergeOptions(to, from, strats, asMixin = false) {
1941
- const { mixins, extends: extendsOptions } = from;
1942
- if (extendsOptions) {
1943
- mergeOptions(to, extendsOptions, strats, true);
1944
- }
1945
- if (mixins) {
1946
- mixins.forEach(
1947
- (m) => mergeOptions(to, m, strats, true)
1948
- );
1949
- }
1950
- for (const key in from) {
1951
- if (asMixin && key === "expose") {
1952
- !!(process.env.NODE_ENV !== "production") && warn(
1953
- `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
1954
- );
1955
- } else {
1956
- const strat = internalOptionMergeStrats[key] || strats && strats[key];
1957
- to[key] = strat ? strat(to[key], from[key]) : from[key];
1958
- }
1959
- }
1960
- return to;
1961
- }
1962
- const internalOptionMergeStrats = {
1963
- data: mergeDataFn,
1964
- props: mergeEmitsOrPropsOptions,
1965
- emits: mergeEmitsOrPropsOptions,
1966
- // objects
1967
- methods: mergeObjectOptions,
1968
- computed: mergeObjectOptions,
1969
- // lifecycle
1970
- beforeCreate: mergeAsArray,
1971
- created: mergeAsArray,
1972
- beforeMount: mergeAsArray,
1973
- mounted: mergeAsArray,
1974
- beforeUpdate: mergeAsArray,
1975
- updated: mergeAsArray,
1976
- beforeDestroy: mergeAsArray,
1977
- beforeUnmount: mergeAsArray,
1978
- destroyed: mergeAsArray,
1979
- unmounted: mergeAsArray,
1980
- activated: mergeAsArray,
1981
- deactivated: mergeAsArray,
1982
- errorCaptured: mergeAsArray,
1983
- serverPrefetch: mergeAsArray,
1984
- // assets
1985
- components: mergeObjectOptions,
1986
- directives: mergeObjectOptions,
1987
- // watch
1988
- watch: mergeWatchOptions,
1989
- // provide / inject
1990
- provide: mergeDataFn,
1991
- inject: mergeInject
1992
- };
1993
- function mergeDataFn(to, from) {
1994
- if (!from) {
1995
- return to;
1996
- }
1997
- if (!to) {
1998
- return from;
1999
- }
2000
- return function mergedDataFn() {
2001
- return (extend)(
2002
- isFunction(to) ? to.call(this, this) : to,
2003
- isFunction(from) ? from.call(this, this) : from
2004
- );
2005
- };
2006
- }
2007
- function mergeInject(to, from) {
2008
- return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
2009
- }
2010
- function normalizeInject(raw) {
2011
- if (isArray(raw)) {
2012
- const res = {};
2013
- for (let i = 0; i < raw.length; i++) {
2014
- res[raw[i]] = raw[i];
2015
- }
2016
- return res;
2017
- }
2018
- return raw;
2019
- }
2020
- function mergeAsArray(to, from) {
2021
- return to ? [...new Set([].concat(to, from))] : from;
2022
- }
2023
- function mergeObjectOptions(to, from) {
2024
- return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
2025
- }
2026
- function mergeEmitsOrPropsOptions(to, from) {
2027
- if (to) {
2028
- if (isArray(to) && isArray(from)) {
2029
- return [.../* @__PURE__ */ new Set([...to, ...from])];
2030
- }
2031
- return extend(
2032
- /* @__PURE__ */ Object.create(null),
2033
- normalizePropsOrEmits(to),
2034
- normalizePropsOrEmits(from != null ? from : {})
2035
- );
2036
- } else {
2037
- return from;
2038
- }
2039
- }
2040
- function mergeWatchOptions(to, from) {
2041
- if (!to)
2042
- return from;
2043
- if (!from)
2044
- return to;
2045
- const merged = extend(/* @__PURE__ */ Object.create(null), to);
2046
- for (const key in from) {
2047
- merged[key] = mergeAsArray(to[key], from[key]);
2048
- }
2049
- return merged;
2050
- }
2051
-
2052
- function createAppContext() {
2053
- return {
2054
- app: null,
2055
- config: {
2056
- isNativeTag: NO,
2057
- performance: false,
2058
- globalProperties: {},
2059
- optionMergeStrategies: {},
2060
- errorHandler: void 0,
2061
- warnHandler: void 0,
2062
- compilerOptions: {}
2063
- },
2064
- mixins: [],
2065
- components: {},
2066
- directives: {},
2067
- provides: /* @__PURE__ */ Object.create(null),
2068
- optionsCache: /* @__PURE__ */ new WeakMap(),
2069
- propsCache: /* @__PURE__ */ new WeakMap(),
2070
- emitsCache: /* @__PURE__ */ new WeakMap()
2071
- };
2072
- }
2073
- let currentApp = null;
2074
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
2075
- const instance = currentInstance || currentRenderingInstance;
2076
- if (instance || currentApp) {
2077
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2078
- if (provides && key in provides) {
2079
- return provides[key];
2080
- } else if (arguments.length > 1) {
2081
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
2082
- } else if (!!(process.env.NODE_ENV !== "production")) {
2083
- warn(`injection "${String(key)}" not found.`);
2084
- }
2085
- } else if (!!(process.env.NODE_ENV !== "production")) {
2086
- warn(`inject() can only be used inside setup() or functional components.`);
2087
- }
2088
- }
2089
-
2090
- const queuePostRenderEffect = queueEffectWithSuspense ;
2091
-
2092
- const isTeleport = (type) => type.__isTeleport;
2093
-
2094
- const Fragment = Symbol.for("v-fgt");
2095
- const Text = Symbol.for("v-txt");
2096
- const Comment = Symbol.for("v-cmt");
2097
- let currentBlock = null;
2098
- function isVNode(value) {
2099
- return value ? value.__v_isVNode === true : false;
2100
- }
2101
- const createVNodeWithArgsTransform = (...args) => {
2102
- return _createVNode(
2103
- ...args
2104
- );
2105
- };
2106
- const InternalObjectKey = `__vInternal`;
2107
- const normalizeKey = ({ key }) => key != null ? key : null;
2108
- const normalizeRef = ({
2109
- ref,
2110
- ref_key,
2111
- ref_for
2112
- }) => {
2113
- if (typeof ref === "number") {
2114
- ref = "" + ref;
2115
- }
2116
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
2117
- };
2118
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
2119
- const vnode = {
2120
- __v_isVNode: true,
2121
- __v_skip: true,
2122
- type,
2123
- props,
2124
- key: props && normalizeKey(props),
2125
- ref: props && normalizeRef(props),
2126
- scopeId: currentScopeId,
2127
- slotScopeIds: null,
2128
- children,
2129
- component: null,
2130
- suspense: null,
2131
- ssContent: null,
2132
- ssFallback: null,
2133
- dirs: null,
2134
- transition: null,
2135
- el: null,
2136
- anchor: null,
2137
- target: null,
2138
- targetAnchor: null,
2139
- staticCount: 0,
2140
- shapeFlag,
2141
- patchFlag,
2142
- dynamicProps,
2143
- dynamicChildren: null,
2144
- appContext: null,
2145
- ctx: currentRenderingInstance
2146
- };
2147
- if (needFullChildrenNormalization) {
2148
- normalizeChildren(vnode, children);
2149
- if (shapeFlag & 128) {
2150
- type.normalize(vnode);
2151
- }
2152
- } else if (children) {
2153
- vnode.shapeFlag |= isString(children) ? 8 : 16;
2154
- }
2155
- if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
2156
- warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
2157
- }
2158
- if (// avoid a block node from tracking itself
2159
- !isBlockNode && // has current parent block
2160
- currentBlock && // presence of a patch flag indicates this node needs patching on updates.
2161
- // component nodes also should always be patched, because even if the
2162
- // component doesn't need to update, it needs to persist the instance on to
2163
- // the next vnode so that it can be properly unmounted later.
2164
- (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
2165
- // vnode should not be considered dynamic due to handler caching.
2166
- vnode.patchFlag !== 32) {
2167
- currentBlock.push(vnode);
2168
- }
2169
- return vnode;
2170
- }
2171
- const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
2172
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
2173
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
2174
- if (!!(process.env.NODE_ENV !== "production") && !type) {
2175
- warn(`Invalid vnode type when creating vnode: ${type}.`);
2176
- }
2177
- type = Comment;
2178
- }
2179
- if (isVNode(type)) {
2180
- const cloned = cloneVNode(
2181
- type,
2182
- props,
2183
- true
2184
- /* mergeRef: true */
2185
- );
2186
- if (children) {
2187
- normalizeChildren(cloned, children);
2188
- }
2189
- if (!isBlockNode && currentBlock) {
2190
- if (cloned.shapeFlag & 6) {
2191
- currentBlock[currentBlock.indexOf(type)] = cloned;
2192
- } else {
2193
- currentBlock.push(cloned);
2194
- }
2195
- }
2196
- cloned.patchFlag |= -2;
2197
- return cloned;
2198
- }
2199
- if (isClassComponent(type)) {
2200
- type = type.__vccOpts;
2201
- }
2202
- if (props) {
2203
- props = guardReactiveProps(props);
2204
- let { class: klass, style } = props;
2205
- if (klass && !isString(klass)) {
2206
- props.class = normalizeClass(klass);
2207
- }
2208
- if (isObject(style)) {
2209
- if (isProxy(style) && !isArray(style)) {
2210
- style = extend({}, style);
2211
- }
2212
- props.style = normalizeStyle(style);
2213
- }
2214
- }
2215
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
2216
- if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
2217
- type = toRaw(type);
2218
- warn(
2219
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
2220
- `
2221
- Component that was made reactive: `,
2222
- type
2223
- );
2224
- }
2225
- return createBaseVNode(
2226
- type,
2227
- props,
2228
- children,
2229
- patchFlag,
2230
- dynamicProps,
2231
- shapeFlag,
2232
- isBlockNode,
2233
- true
2234
- );
2235
- }
2236
- function guardReactiveProps(props) {
2237
- if (!props)
2238
- return null;
2239
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
2240
- }
2241
- function cloneVNode(vnode, extraProps, mergeRef = false) {
2242
- const { props, ref, patchFlag, children } = vnode;
2243
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
2244
- const cloned = {
2245
- __v_isVNode: true,
2246
- __v_skip: true,
2247
- type: vnode.type,
2248
- props: mergedProps,
2249
- key: mergedProps && normalizeKey(mergedProps),
2250
- ref: extraProps && extraProps.ref ? (
2251
- // #2078 in the case of <component :is="vnode" ref="extra"/>
2252
- // if the vnode itself already has a ref, cloneVNode will need to merge
2253
- // the refs so the single vnode can be set on multiple refs
2254
- mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
2255
- ) : ref,
2256
- scopeId: vnode.scopeId,
2257
- slotScopeIds: vnode.slotScopeIds,
2258
- children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
2259
- target: vnode.target,
2260
- targetAnchor: vnode.targetAnchor,
2261
- staticCount: vnode.staticCount,
2262
- shapeFlag: vnode.shapeFlag,
2263
- // if the vnode is cloned with extra props, we can no longer assume its
2264
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
2265
- // note: preserve flag for fragments since they use the flag for children
2266
- // fast paths only.
2267
- patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
2268
- dynamicProps: vnode.dynamicProps,
2269
- dynamicChildren: vnode.dynamicChildren,
2270
- appContext: vnode.appContext,
2271
- dirs: vnode.dirs,
2272
- transition: vnode.transition,
2273
- // These should technically only be non-null on mounted VNodes. However,
2274
- // they *should* be copied for kept-alive vnodes. So we just always copy
2275
- // them since them being non-null during a mount doesn't affect the logic as
2276
- // they will simply be overwritten.
2277
- component: vnode.component,
2278
- suspense: vnode.suspense,
2279
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
2280
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
2281
- el: vnode.el,
2282
- anchor: vnode.anchor,
2283
- ctx: vnode.ctx,
2284
- ce: vnode.ce
2285
- };
2286
- return cloned;
2287
- }
2288
- function deepCloneVNode(vnode) {
2289
- const cloned = cloneVNode(vnode);
2290
- if (isArray(vnode.children)) {
2291
- cloned.children = vnode.children.map(deepCloneVNode);
2292
- }
2293
- return cloned;
2294
- }
2295
- function createTextVNode(text = " ", flag = 0) {
2296
- return createVNode(Text, null, text, flag);
2297
- }
2298
- function normalizeChildren(vnode, children) {
2299
- let type = 0;
2300
- const { shapeFlag } = vnode;
2301
- if (children == null) {
2302
- children = null;
2303
- } else if (isArray(children)) {
2304
- type = 16;
2305
- } else if (typeof children === "object") {
2306
- if (shapeFlag & (1 | 64)) {
2307
- const slot = children.default;
2308
- if (slot) {
2309
- slot._c && (slot._d = false);
2310
- normalizeChildren(vnode, slot());
2311
- slot._c && (slot._d = true);
2312
- }
2313
- return;
2314
- } else {
2315
- type = 32;
2316
- const slotFlag = children._;
2317
- if (!slotFlag && !(InternalObjectKey in children)) {
2318
- children._ctx = currentRenderingInstance;
2319
- } else if (slotFlag === 3 && currentRenderingInstance) {
2320
- if (currentRenderingInstance.slots._ === 1) {
2321
- children._ = 1;
2322
- } else {
2323
- children._ = 2;
2324
- vnode.patchFlag |= 1024;
2325
- }
2326
- }
2327
- }
2328
- } else if (isFunction(children)) {
2329
- children = { default: children, _ctx: currentRenderingInstance };
2330
- type = 32;
2331
- } else {
2332
- children = String(children);
2333
- if (shapeFlag & 64) {
2334
- type = 16;
2335
- children = [createTextVNode(children)];
2336
- } else {
2337
- type = 8;
2338
- }
2339
- }
2340
- vnode.children = children;
2341
- vnode.shapeFlag |= type;
2342
- }
2343
- function mergeProps(...args) {
2344
- const ret = {};
2345
- for (let i = 0; i < args.length; i++) {
2346
- const toMerge = args[i];
2347
- for (const key in toMerge) {
2348
- if (key === "class") {
2349
- if (ret.class !== toMerge.class) {
2350
- ret.class = normalizeClass([ret.class, toMerge.class]);
2351
- }
2352
- } else if (key === "style") {
2353
- ret.style = normalizeStyle([ret.style, toMerge.style]);
2354
- } else if (isOn(key)) {
2355
- const existing = ret[key];
2356
- const incoming = toMerge[key];
2357
- if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
2358
- ret[key] = existing ? [].concat(existing, incoming) : incoming;
2359
- }
2360
- } else if (key !== "") {
2361
- ret[key] = toMerge[key];
2362
- }
2363
- }
2364
- }
2365
- return ret;
2366
- }
2367
-
2368
- createAppContext();
2369
- let currentInstance = null;
2370
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
2371
- let internalSetCurrentInstance;
2372
- let globalCurrentInstanceSetters;
2373
- let settersKey = "__VUE_INSTANCE_SETTERS__";
2374
- {
2375
- if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
2376
- globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
2377
- }
2378
- globalCurrentInstanceSetters.push((i) => currentInstance = i);
2379
- internalSetCurrentInstance = (instance) => {
2380
- if (globalCurrentInstanceSetters.length > 1) {
2381
- globalCurrentInstanceSetters.forEach((s) => s(instance));
2382
- } else {
2383
- globalCurrentInstanceSetters[0](instance);
2384
- }
2385
- };
2386
- }
2387
- const setCurrentInstance = (instance) => {
2388
- internalSetCurrentInstance(instance);
2389
- instance.scope.on();
2390
- };
2391
- const unsetCurrentInstance = () => {
2392
- currentInstance && currentInstance.scope.off();
2393
- internalSetCurrentInstance(null);
2394
- };
2395
- function isStatefulComponent(instance) {
2396
- return instance.vnode.shapeFlag & 4;
2397
- }
2398
- function getExposeProxy(instance) {
2399
- if (instance.exposed) {
2400
- return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
2401
- get(target, key) {
2402
- if (key in target) {
2403
- return target[key];
2404
- } else if (key in publicPropertiesMap) {
2405
- return publicPropertiesMap[key](instance);
2406
- }
2407
- },
2408
- has(target, key) {
2409
- return key in target || key in publicPropertiesMap;
2410
- }
2411
- }));
2412
- }
2413
- }
2414
- const classifyRE = /(?:^|[-_])(\w)/g;
2415
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
2416
- function getComponentName(Component, includeInferred = true) {
2417
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
2418
- }
2419
- function formatComponentName(instance, Component, isRoot = false) {
2420
- let name = getComponentName(Component);
2421
- if (!name && Component.__file) {
2422
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
2423
- if (match) {
2424
- name = match[1];
2425
- }
2426
- }
2427
- if (!name && instance && instance.parent) {
2428
- const inferFromRegistry = (registry) => {
2429
- for (const key in registry) {
2430
- if (registry[key] === Component) {
2431
- return key;
2432
- }
2433
- }
2434
- };
2435
- name = inferFromRegistry(
2436
- instance.components || instance.parent.type.components
2437
- ) || inferFromRegistry(instance.appContext.components);
2438
- }
2439
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
2440
- }
2441
- function isClassComponent(value) {
2442
- return isFunction(value) && "__vccOpts" in value;
2443
- }
2444
-
2445
- function h(type, propsOrChildren, children) {
2446
- const l = arguments.length;
2447
- if (l === 2) {
2448
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
2449
- if (isVNode(propsOrChildren)) {
2450
- return createVNode(type, null, [propsOrChildren]);
2451
- }
2452
- return createVNode(type, propsOrChildren);
2453
- } else {
2454
- return createVNode(type, null, propsOrChildren);
2455
- }
2456
- } else {
2457
- if (l > 3) {
2458
- children = Array.prototype.slice.call(arguments, 2);
2459
- } else if (l === 3 && isVNode(children)) {
2460
- children = [children];
2461
- }
2462
- return createVNode(type, propsOrChildren, children);
2463
- }
2464
- }
2465
-
2466
- function isShallow(value) {
2467
- return !!(value && value["__v_isShallow"]);
2468
- }
2469
-
2470
- function initCustomFormatter() {
2471
- if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
2472
- return;
2473
- }
2474
- const vueStyle = { style: "color:#3ba776" };
2475
- const numberStyle = { style: "color:#0b1bc9" };
2476
- const stringStyle = { style: "color:#b62e24" };
2477
- const keywordStyle = { style: "color:#9d288c" };
2478
- const formatter = {
2479
- header(obj) {
2480
- if (!isObject(obj)) {
2481
- return null;
2482
- }
2483
- if (obj.__isVue) {
2484
- return ["div", vueStyle, `VueInstance`];
2485
- } else if (isRef(obj)) {
2486
- return [
2487
- "div",
2488
- {},
2489
- ["span", vueStyle, genRefFlag(obj)],
2490
- "<",
2491
- formatValue(obj.value),
2492
- `>`
2493
- ];
2494
- } else if (isReactive(obj)) {
2495
- return [
2496
- "div",
2497
- {},
2498
- ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
2499
- "<",
2500
- formatValue(obj),
2501
- `>${isReadonly(obj) ? ` (readonly)` : ``}`
2502
- ];
2503
- } else if (isReadonly(obj)) {
2504
- return [
2505
- "div",
2506
- {},
2507
- ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
2508
- "<",
2509
- formatValue(obj),
2510
- ">"
2511
- ];
2512
- }
2513
- return null;
2514
- },
2515
- hasBody(obj) {
2516
- return obj && obj.__isVue;
2517
- },
2518
- body(obj) {
2519
- if (obj && obj.__isVue) {
2520
- return [
2521
- "div",
2522
- {},
2523
- ...formatInstance(obj.$)
2524
- ];
2525
- }
2526
- }
2527
- };
2528
- function formatInstance(instance) {
2529
- const blocks = [];
2530
- if (instance.type.props && instance.props) {
2531
- blocks.push(createInstanceBlock("props", toRaw(instance.props)));
2532
- }
2533
- if (instance.setupState !== EMPTY_OBJ) {
2534
- blocks.push(createInstanceBlock("setup", instance.setupState));
2535
- }
2536
- if (instance.data !== EMPTY_OBJ) {
2537
- blocks.push(createInstanceBlock("data", toRaw(instance.data)));
2538
- }
2539
- const computed = extractKeys(instance, "computed");
2540
- if (computed) {
2541
- blocks.push(createInstanceBlock("computed", computed));
2542
- }
2543
- const injected = extractKeys(instance, "inject");
2544
- if (injected) {
2545
- blocks.push(createInstanceBlock("injected", injected));
2546
- }
2547
- blocks.push([
2548
- "div",
2549
- {},
2550
- [
2551
- "span",
2552
- {
2553
- style: keywordStyle.style + ";opacity:0.66"
2554
- },
2555
- "$ (internal): "
2556
- ],
2557
- ["object", { object: instance }]
2558
- ]);
2559
- return blocks;
2560
- }
2561
- function createInstanceBlock(type, target) {
2562
- target = extend({}, target);
2563
- if (!Object.keys(target).length) {
2564
- return ["span", {}];
2565
- }
2566
- return [
2567
- "div",
2568
- { style: "line-height:1.25em;margin-bottom:0.6em" },
2569
- [
2570
- "div",
2571
- {
2572
- style: "color:#476582"
2573
- },
2574
- type
2575
- ],
2576
- [
2577
- "div",
2578
- {
2579
- style: "padding-left:1.25em"
2580
- },
2581
- ...Object.keys(target).map((key) => {
2582
- return [
2583
- "div",
2584
- {},
2585
- ["span", keywordStyle, key + ": "],
2586
- formatValue(target[key], false)
2587
- ];
2588
- })
2589
- ]
2590
- ];
2591
- }
2592
- function formatValue(v, asRaw = true) {
2593
- if (typeof v === "number") {
2594
- return ["span", numberStyle, v];
2595
- } else if (typeof v === "string") {
2596
- return ["span", stringStyle, JSON.stringify(v)];
2597
- } else if (typeof v === "boolean") {
2598
- return ["span", keywordStyle, v];
2599
- } else if (isObject(v)) {
2600
- return ["object", { object: asRaw ? toRaw(v) : v }];
2601
- } else {
2602
- return ["span", stringStyle, String(v)];
2603
- }
2604
- }
2605
- function extractKeys(instance, type) {
2606
- const Comp = instance.type;
2607
- if (isFunction(Comp)) {
2608
- return;
2609
- }
2610
- const extracted = {};
2611
- for (const key in instance.ctx) {
2612
- if (isKeyOfType(Comp, key, type)) {
2613
- extracted[key] = instance.ctx[key];
2614
- }
2615
- }
2616
- return extracted;
2617
- }
2618
- function isKeyOfType(Comp, key, type) {
2619
- const opts = Comp[type];
2620
- if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
2621
- return true;
2622
- }
2623
- if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
2624
- return true;
2625
- }
2626
- if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
2627
- return true;
2628
- }
2629
- }
2630
- function genRefFlag(v) {
2631
- if (isShallow(v)) {
2632
- return `ShallowRef`;
2633
- }
2634
- if (v.effect) {
2635
- return `ComputedRef`;
2636
- }
2637
- return `Ref`;
2638
- }
2639
- if (window.devtoolsFormatters) {
2640
- window.devtoolsFormatters.push(formatter);
2641
- } else {
2642
- window.devtoolsFormatters = [formatter];
2643
- }
2644
- }
2645
-
2646
- function initDev() {
2647
- {
2648
- initCustomFormatter();
2649
- }
2650
- }
2651
-
2652
- if (!!(process.env.NODE_ENV !== "production")) {
2653
- initDev();
2654
- }
2655
-
2656
- const UPDATE_VALUE_EVENT = 'update:modelValue';
2657
- const MODEL_VALUE = 'modelValue';
2658
- const ROUTER_LINK_VALUE = 'routerLink';
2659
- const NAV_MANAGER = 'navManager';
2660
- const ROUTER_PROP_PREFIX = 'router';
2661
- const ARIA_PROP_PREFIX = 'aria';
2662
- /**
2663
- * Starting in Vue 3.1.0, all properties are
2664
- * added as keys to the props object, even if
2665
- * they are not being used. In order to correctly
2666
- * account for both value props and v-model props,
2667
- * we need to check if the key exists for Vue <3.1.0
2668
- * and then check if it is not undefined for Vue >= 3.1.0.
2669
- * See https://github.com/vuejs/vue-next/issues/3889
2670
- */
2671
- const EMPTY_PROP = Symbol();
2672
- const DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };
2673
- const getComponentClasses = (classes) => {
2674
- return classes?.split(' ') || [];
2675
- };
2676
- const syncElementClasses = (ref, componentClasses, defaultClasses = []) => {
2677
- if (ref?.value) {
2678
- const element = ref.value;
2679
- // makes sure vue classes are on the actual element
2680
- componentClasses.forEach((c) => {
2681
- if (!!c && !element.classList.contains(c)) {
2682
- element.classList.add(c);
2683
- }
2684
- });
2685
- }
2686
- return [...Array.from(ref.value?.classList || []), ...defaultClasses].filter((c, i, self) => {
2687
- return !componentClasses.has(c) && self.indexOf(c) === i;
2688
- });
2689
- };
2690
- /**
2691
- * Create a callback to define a Vue component wrapper around a Web Component.
2692
- *
2693
- * @prop name - The component tag name (i.e. `ion-button`)
2694
- * @prop componentProps - An array of properties on the
2695
- * component. These usually match up with the @Prop definitions
2696
- * in each component's TSX file.
2697
- * @prop emitProps - An array of for event listener on the Component.
2698
- * these usually match up with the @Event definitions
2699
- * in each compont's TSX file.
2700
- * @prop customElement - An option custom element instance to pass
2701
- * to customElements.define. Only set if `includeImportCustomElements: true` in your config.
2702
- * @prop modelProp - The prop that v-model binds to (i.e. value)
2703
- * @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
2704
- * @prop modelUpdateEventAttribute - Property to read value from when the value changes.
2705
- */
2706
- const defineContainer = (name, defineCustomElement, componentProps = [], emitProps = [], modelProp, modelUpdateEvent, modelUpdateEventAttribute, transformTagFn) => {
2707
- /**
2708
- * Create a Vue component wrapper around a Web Component.
2709
- * Note: The `props` here are not all properties on a component.
2710
- * They refer to whatever properties are set on an instance of a component.
2711
- */
2712
- if (defineCustomElement !== undefined) {
2713
- defineCustomElement();
2714
- }
2715
- const emits = emitProps;
2716
- const props = [ROUTER_LINK_VALUE, ...componentProps].reduce((acc, prop) => {
2717
- acc[prop] = DEFAULT_EMPTY_PROP;
2718
- return acc;
2719
- }, {});
2720
- if (modelProp) {
2721
- emits.push(UPDATE_VALUE_EVENT);
2722
- props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
2723
- }
2724
- return defineComponent((props, { attrs, slots, emit }) => {
2725
- let modelPropValue = modelProp ? props[modelProp] : undefined;
2726
- const containerRef = ref();
2727
- const classes = new Set(getComponentClasses(attrs.class));
2728
- onMounted(() => {
2729
- /**
2730
- * we register the event emmiter for @Event definitions
2731
- * so we can use @event
2732
- */
2733
- emitProps.forEach((eventName) => {
2734
- containerRef.value?.addEventListener(eventName, (e) => {
2735
- emit(eventName, e);
2736
- });
2737
- });
2738
- });
2739
- const currentInstance = getCurrentInstance();
2740
- const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER];
2741
- const navManager = hasRouter ? inject(NAV_MANAGER) : undefined;
2742
- const handleRouterLink = (ev) => {
2743
- const { routerLink } = props;
2744
- if (routerLink === EMPTY_PROP)
2745
- return;
2746
- if (navManager !== undefined) {
2747
- /**
2748
- * This prevents the browser from
2749
- * performing a page reload when pressing
2750
- * an Ionic component with routerLink.
2751
- * The page reload interferes with routing
2752
- * and causes ion-back-button to disappear
2753
- * since the local history is wiped on reload.
2754
- */
2755
- ev.preventDefault();
2756
- let navigationPayload = { event: ev };
2757
- for (const key in props) {
2758
- const value = props[key];
2759
- if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {
2760
- navigationPayload[key] = value;
2761
- }
2762
- }
2763
- navManager.navigate(navigationPayload);
2764
- }
2765
- else {
2766
- console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');
2767
- }
2768
- };
2769
- return () => {
2770
- modelPropValue = props[modelProp];
2771
- getComponentClasses(attrs.class).forEach((value) => {
2772
- classes.add(value);
2773
- });
2774
- // @ts-expect-error
2775
- const oldClick = props.onClick;
2776
- const handleClick = (ev) => {
2777
- if (oldClick !== undefined) {
2778
- oldClick(ev);
2779
- }
2780
- if (!ev.defaultPrevented) {
2781
- handleRouterLink(ev);
2782
- }
2783
- };
2784
- const propsToAdd = {
2785
- ref: containerRef,
2786
- class: syncElementClasses(containerRef, classes),
2787
- onClick: handleClick,
2788
- };
2789
- /**
2790
- * We can use Object.entries here
2791
- * to avoid the hasOwnProperty check,
2792
- * but that would require 2 iterations
2793
- * where as this only requires 1.
2794
- */
2795
- for (const key in props) {
2796
- const value = props[key];
2797
- if ((props.hasOwnProperty(key) && value !== EMPTY_PROP) || key.startsWith(ARIA_PROP_PREFIX)) {
2798
- propsToAdd[key] = value;
2799
- }
2800
- /**
2801
- * register event handlers on the component
2802
- */
2803
- const eventHandlerKey = 'on' + key.slice(0, 1).toUpperCase() + key.slice(1);
2804
- const eventHandler = attrs[eventHandlerKey];
2805
- if (containerRef.value && attrs.hasOwnProperty(eventHandlerKey) && 'addEventListener' in containerRef.value) {
2806
- containerRef.value.addEventListener(key, eventHandler);
2807
- }
2808
- }
2809
- if (modelProp) {
2810
- /**
2811
- * If form value property was set using v-model
2812
- * then we should use that value.
2813
- * Otherwise, check to see if form value property
2814
- * was set as a static value (i.e. no v-model).
2815
- */
2816
- if (props[MODEL_VALUE] !== EMPTY_PROP) {
2817
- propsToAdd[modelProp] = props[MODEL_VALUE];
2818
- }
2819
- else if (modelPropValue !== EMPTY_PROP) {
2820
- propsToAdd[modelProp] = modelPropValue;
2821
- }
2822
- }
2823
- // If router link is defined, add href to props
2824
- // in order to properly render an anchor tag inside
2825
- // of components that should become activatable and
2826
- // focusable with router link.
2827
- if (ROUTER_LINK_VALUE in props && props[ROUTER_LINK_VALUE] !== EMPTY_PROP) {
2828
- propsToAdd.href = props[ROUTER_LINK_VALUE];
2829
- }
2830
- /**
2831
- * vModelDirective is only needed on components that support v-model.
2832
- * As a result, we conditionally call withDirectives with v-model components.
2833
- */
2834
- const tagName = transformTagFn ? transformTagFn(name) : name;
2835
- const node = h(tagName, propsToAdd, slots.default && slots.default());
2836
- return modelProp === undefined ? node : withDirectives(node);
2837
- };
2838
- }, {
2839
- name,
2840
- props,
2841
- emits,
2842
- });
2843
- };
2844
-
2845
- /* eslint-disable */
2846
- const VertexDocumentViewer = defineContainer('vertex-document-viewer', undefined, [
2847
- 'src',
2848
- 'documentId',
2849
- 'provider',
2850
- 'interactionMode',
2851
- 'documentState',
2852
- 'layers',
2853
- 'config',
2854
- 'resizeDebounce',
2855
- 'documentReady',
2856
- 'documentStateChanged',
2857
- 'pageLoaded',
2858
- 'pageDrawn'
2859
- ], [
2860
- 'documentReady',
2861
- 'documentStateChanged',
2862
- 'pageLoaded',
2863
- 'pageDrawn'
8
+ /* eslint-disable */
9
+ const VertexDocumentViewer = /*@__PURE__*/ runtime.defineContainer('vertex-document-viewer', undefined, [
10
+ 'src',
11
+ 'documentId',
12
+ 'provider',
13
+ 'interactionMode',
14
+ 'documentState',
15
+ 'layers',
16
+ 'config',
17
+ 'resizeDebounce',
18
+ 'documentReady',
19
+ 'documentStateChanged',
20
+ 'pageLoaded',
21
+ 'pageDrawn'
22
+ ], [
23
+ 'documentReady',
24
+ 'documentStateChanged',
25
+ 'pageLoaded',
26
+ 'pageDrawn'
2864
27
  ]);
2865
28
 
2866
- const VertexDocumentViewerPlugin = {
2867
- async install() {
2868
- loader.defineCustomElements();
2869
- },
29
+ const VertexDocumentViewerPlugin = {
30
+ async install() {
31
+ loader.defineCustomElements();
32
+ },
2870
33
  };
2871
34
 
2872
35
  exports.VertexDocumentViewer = VertexDocumentViewer;