1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var extendStatics = function(d, b) {
|
18 | extendStatics = Object.setPrototypeOf ||
|
19 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
20 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
21 | return extendStatics(d, b);
|
22 | };
|
23 |
|
24 | function __extends(d, b) {
|
25 | if (typeof b !== "function" && b !== null)
|
26 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
27 | extendStatics(d, b);
|
28 | function __() { this.constructor = d; }
|
29 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30 | }
|
31 |
|
32 | var __assign = function() {
|
33 | __assign = Object.assign || function __assign(t) {
|
34 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
35 | s = arguments[i];
|
36 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
37 | }
|
38 | return t;
|
39 | };
|
40 | return __assign.apply(this, arguments);
|
41 | };
|
42 |
|
43 | function __values(o) {
|
44 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
45 | if (m) return m.call(o);
|
46 | if (o && typeof o.length === "number") return {
|
47 | next: function () {
|
48 | if (o && i >= o.length) o = void 0;
|
49 | return { value: o && o[i++], done: !o };
|
50 | }
|
51 | };
|
52 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
53 | }
|
54 |
|
55 | function __read(o, n) {
|
56 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
57 | if (!m) return o;
|
58 | var i = m.call(o), r, ar = [], e;
|
59 | try {
|
60 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
61 | }
|
62 | catch (error) { e = { error: error }; }
|
63 | finally {
|
64 | try {
|
65 | if (r && !r.done && (m = i["return"])) m.call(i);
|
66 | }
|
67 | finally { if (e) throw e.error; }
|
68 | }
|
69 | return ar;
|
70 | }
|
71 |
|
72 | function __spreadArray(to, from, pack) {
|
73 | if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
74 | if (ar || !(i in from)) {
|
75 | if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
76 | ar[i] = from[i];
|
77 | }
|
78 | }
|
79 | return to.concat(ar || Array.prototype.slice.call(from));
|
80 | }
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | function warn$1(message) {
|
89 | var _a;
|
90 | warn(message, (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy);
|
91 | }
|
92 |
|
93 | var activeEffectScope;
|
94 | var effectScopeStack = [];
|
95 | var EffectScopeImpl = (function () {
|
96 | function EffectScopeImpl(vm) {
|
97 | this.active = true;
|
98 | this.effects = [];
|
99 | this.cleanups = [];
|
100 | this.vm = vm;
|
101 | }
|
102 | EffectScopeImpl.prototype.run = function (fn) {
|
103 | if (this.active) {
|
104 | try {
|
105 | this.on();
|
106 | return fn();
|
107 | }
|
108 | finally {
|
109 | this.off();
|
110 | }
|
111 | }
|
112 | else if ((process.env.NODE_ENV !== 'production')) {
|
113 | warn$1("cannot run an inactive effect scope.");
|
114 | }
|
115 | return;
|
116 | };
|
117 | EffectScopeImpl.prototype.on = function () {
|
118 | if (this.active) {
|
119 | effectScopeStack.push(this);
|
120 | activeEffectScope = this;
|
121 | }
|
122 | };
|
123 | EffectScopeImpl.prototype.off = function () {
|
124 | if (this.active) {
|
125 | effectScopeStack.pop();
|
126 | activeEffectScope = effectScopeStack[effectScopeStack.length - 1];
|
127 | }
|
128 | };
|
129 | EffectScopeImpl.prototype.stop = function () {
|
130 | if (this.active) {
|
131 | this.vm.$destroy();
|
132 | this.effects.forEach(function (e) { return e.stop(); });
|
133 | this.cleanups.forEach(function (cleanup) { return cleanup(); });
|
134 | this.active = false;
|
135 | }
|
136 | };
|
137 | return EffectScopeImpl;
|
138 | }());
|
139 | var EffectScope = (function (_super) {
|
140 | __extends(EffectScope, _super);
|
141 | function EffectScope(detached) {
|
142 | if (detached === void 0) { detached = false; }
|
143 | var _this = this;
|
144 | var vm = undefined;
|
145 | withCurrentInstanceTrackingDisabled(function () {
|
146 | vm = defineComponentInstance(getVueConstructor());
|
147 | });
|
148 | _this = _super.call(this, vm) || this;
|
149 | if (!detached) {
|
150 | recordEffectScope(_this);
|
151 | }
|
152 | return _this;
|
153 | }
|
154 | return EffectScope;
|
155 | }(EffectScopeImpl));
|
156 | function recordEffectScope(effect, scope) {
|
157 | var _a;
|
158 | scope = scope || activeEffectScope;
|
159 | if (scope && scope.active) {
|
160 | scope.effects.push(effect);
|
161 | return;
|
162 | }
|
163 |
|
164 | var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy;
|
165 | vm && vm.$on('hook:destroyed', function () { return effect.stop(); });
|
166 | }
|
167 | function effectScope(detached) {
|
168 | return new EffectScope(detached);
|
169 | }
|
170 | function getCurrentScope() {
|
171 | return activeEffectScope;
|
172 | }
|
173 | function onScopeDispose(fn) {
|
174 | if (activeEffectScope) {
|
175 | activeEffectScope.cleanups.push(fn);
|
176 | }
|
177 | else if ((process.env.NODE_ENV !== 'production')) {
|
178 | warn$1("onScopeDispose() is called when there is no active effect scope" +
|
179 | " to be associated with.");
|
180 | }
|
181 | }
|
182 |
|
183 |
|
184 |
|
185 | function getCurrentScopeVM() {
|
186 | var _a, _b;
|
187 | return ((_a = getCurrentScope()) === null || _a === void 0 ? void 0 : _a.vm) || ((_b = getCurrentInstance()) === null || _b === void 0 ? void 0 : _b.proxy);
|
188 | }
|
189 |
|
190 |
|
191 |
|
192 | function bindCurrentScopeToVM(vm) {
|
193 | if (!vm.scope) {
|
194 | var scope_1 = new EffectScopeImpl(vm.proxy);
|
195 | vm.scope = scope_1;
|
196 | vm.proxy.$on('hook:destroyed', function () { return scope_1.stop(); });
|
197 | }
|
198 | return vm.scope;
|
199 | }
|
200 |
|
201 | var vueDependency = undefined;
|
202 | try {
|
203 | var requiredVue = require('vue');
|
204 | if (requiredVue && isVue(requiredVue)) {
|
205 | vueDependency = requiredVue;
|
206 | }
|
207 | else if (requiredVue &&
|
208 | 'default' in requiredVue &&
|
209 | isVue(requiredVue.default)) {
|
210 | vueDependency = requiredVue.default;
|
211 | }
|
212 | }
|
213 | catch (_a) {
|
214 |
|
215 | }
|
216 | var vueConstructor = null;
|
217 | var currentInstance = null;
|
218 | var currentInstanceTracking = true;
|
219 | var PluginInstalledFlag = '__composition_api_installed__';
|
220 | function isVue(obj) {
|
221 | return obj && isFunction(obj) && obj.name === 'Vue';
|
222 | }
|
223 | function isVueRegistered(Vue) {
|
224 |
|
225 | return vueConstructor && hasOwn(Vue, PluginInstalledFlag);
|
226 | }
|
227 | function getVueConstructor() {
|
228 | if ((process.env.NODE_ENV !== 'production')) {
|
229 | assert(vueConstructor, "must call Vue.use(VueCompositionAPI) before using any function.");
|
230 | }
|
231 | return vueConstructor;
|
232 | }
|
233 |
|
234 | function getRegisteredVueOrDefault() {
|
235 | var constructor = vueConstructor || vueDependency;
|
236 | if ((process.env.NODE_ENV !== 'production')) {
|
237 | assert(constructor, "No vue dependency found.");
|
238 | }
|
239 | return constructor;
|
240 | }
|
241 | function setVueConstructor(Vue) {
|
242 |
|
243 | if ((process.env.NODE_ENV !== 'production') && vueConstructor && Vue.__proto__ !== vueConstructor.__proto__) {
|
244 | warn('[vue-composition-api] another instance of Vue installed');
|
245 | }
|
246 | vueConstructor = Vue;
|
247 | Object.defineProperty(Vue, PluginInstalledFlag, {
|
248 | configurable: true,
|
249 | writable: true,
|
250 | value: true,
|
251 | });
|
252 | }
|
253 |
|
254 |
|
255 |
|
256 |
|
257 | function withCurrentInstanceTrackingDisabled(fn) {
|
258 | var prev = currentInstanceTracking;
|
259 | currentInstanceTracking = false;
|
260 | try {
|
261 | fn();
|
262 | }
|
263 | finally {
|
264 | currentInstanceTracking = prev;
|
265 | }
|
266 | }
|
267 | function setCurrentInstance(instance) {
|
268 | if (!currentInstanceTracking)
|
269 | return;
|
270 | var prev = currentInstance;
|
271 | prev === null || prev === void 0 ? void 0 : prev.scope.off();
|
272 | currentInstance = instance;
|
273 | currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope.on();
|
274 | }
|
275 | function getCurrentInstance() {
|
276 | return currentInstance;
|
277 | }
|
278 | var instanceMapCache = new WeakMap();
|
279 | function toVue3ComponentInstance(vm) {
|
280 | if (instanceMapCache.has(vm)) {
|
281 | return instanceMapCache.get(vm);
|
282 | }
|
283 | var instance = {
|
284 | proxy: vm,
|
285 | update: vm.$forceUpdate,
|
286 | type: vm.$options,
|
287 | uid: vm._uid,
|
288 |
|
289 | emit: vm.$emit.bind(vm),
|
290 | parent: null,
|
291 | root: null,
|
292 | };
|
293 | bindCurrentScopeToVM(instance);
|
294 |
|
295 | var instanceProps = [
|
296 | 'data',
|
297 | 'props',
|
298 | 'attrs',
|
299 | 'refs',
|
300 | 'vnode',
|
301 | 'slots',
|
302 | ];
|
303 | instanceProps.forEach(function (prop) {
|
304 | proxy(instance, prop, {
|
305 | get: function () {
|
306 | return vm["$".concat(prop)];
|
307 | },
|
308 | });
|
309 | });
|
310 | proxy(instance, 'isMounted', {
|
311 | get: function () {
|
312 |
|
313 | return vm._isMounted;
|
314 | },
|
315 | });
|
316 | proxy(instance, 'isUnmounted', {
|
317 | get: function () {
|
318 |
|
319 | return vm._isDestroyed;
|
320 | },
|
321 | });
|
322 | proxy(instance, 'isDeactivated', {
|
323 | get: function () {
|
324 |
|
325 | return vm._inactive;
|
326 | },
|
327 | });
|
328 | proxy(instance, 'emitted', {
|
329 | get: function () {
|
330 |
|
331 | return vm._events;
|
332 | },
|
333 | });
|
334 | instanceMapCache.set(vm, instance);
|
335 | if (vm.$parent) {
|
336 | instance.parent = toVue3ComponentInstance(vm.$parent);
|
337 | }
|
338 | if (vm.$root) {
|
339 | instance.root = toVue3ComponentInstance(vm.$root);
|
340 | }
|
341 | return instance;
|
342 | }
|
343 |
|
344 | var toString = function (x) { return Object.prototype.toString.call(x); };
|
345 | function isNative(Ctor) {
|
346 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
|
347 | }
|
348 | var hasSymbol = typeof Symbol !== 'undefined' &&
|
349 | isNative(Symbol) &&
|
350 | typeof Reflect !== 'undefined' &&
|
351 | isNative(Reflect.ownKeys);
|
352 | var noopFn = function (_) { return _; };
|
353 | function proxy(target, key, _a) {
|
354 | var get = _a.get, set = _a.set;
|
355 | Object.defineProperty(target, key, {
|
356 | enumerable: true,
|
357 | configurable: true,
|
358 | get: get || noopFn,
|
359 | set: set || noopFn,
|
360 | });
|
361 | }
|
362 | function def(obj, key, val, enumerable) {
|
363 | Object.defineProperty(obj, key, {
|
364 | value: val,
|
365 | enumerable: !!enumerable,
|
366 | writable: true,
|
367 | configurable: true,
|
368 | });
|
369 | }
|
370 | function hasOwn(obj, key) {
|
371 | return Object.hasOwnProperty.call(obj, key);
|
372 | }
|
373 | function assert(condition, msg) {
|
374 | if (!condition) {
|
375 | throw new Error("[vue-composition-api] ".concat(msg));
|
376 | }
|
377 | }
|
378 | function isPrimitive(value) {
|
379 | return (typeof value === 'string' ||
|
380 | typeof value === 'number' ||
|
381 |
|
382 | typeof value === 'symbol' ||
|
383 | typeof value === 'boolean');
|
384 | }
|
385 | function isArray(x) {
|
386 | return Array.isArray(x);
|
387 | }
|
388 | var objectToString = Object.prototype.toString;
|
389 | var toTypeString = function (value) {
|
390 | return objectToString.call(value);
|
391 | };
|
392 | var isMap = function (val) {
|
393 | return toTypeString(val) === '[object Map]';
|
394 | };
|
395 | var isSet = function (val) {
|
396 | return toTypeString(val) === '[object Set]';
|
397 | };
|
398 | var MAX_VALID_ARRAY_LENGTH = 4294967295;
|
399 | function isValidArrayIndex(val) {
|
400 | var n = parseFloat(String(val));
|
401 | return (n >= 0 &&
|
402 | Math.floor(n) === n &&
|
403 | isFinite(val) &&
|
404 | n <= MAX_VALID_ARRAY_LENGTH);
|
405 | }
|
406 | function isObject(val) {
|
407 | return val !== null && typeof val === 'object';
|
408 | }
|
409 | function isPlainObject(x) {
|
410 | return toString(x) === '[object Object]';
|
411 | }
|
412 | function isFunction(x) {
|
413 | return typeof x === 'function';
|
414 | }
|
415 | function isUndef(v) {
|
416 | return v === undefined || v === null;
|
417 | }
|
418 | function warn(msg, vm) {
|
419 | var Vue = getRegisteredVueOrDefault();
|
420 | if (!Vue || !Vue.util)
|
421 | console.warn("[vue-composition-api] ".concat(msg));
|
422 | else
|
423 | Vue.util.warn(msg, vm);
|
424 | }
|
425 | function logError(err, vm, info) {
|
426 | if ((process.env.NODE_ENV !== 'production')) {
|
427 | warn("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
|
428 | }
|
429 | if (typeof window !== 'undefined' && typeof console !== 'undefined') {
|
430 | console.error(err);
|
431 | }
|
432 | else {
|
433 | throw err;
|
434 | }
|
435 | }
|
436 |
|
437 |
|
438 |
|
439 |
|
440 | function isSame(value1, value2) {
|
441 | if (value1 === value2) {
|
442 | return value1 !== 0 || 1 / value1 === 1 / value2;
|
443 | }
|
444 | else {
|
445 | return value1 !== value1 && value2 !== value2;
|
446 | }
|
447 | }
|
448 |
|
449 | function getCurrentInstanceForFn(hook, target) {
|
450 | target = target || getCurrentInstance();
|
451 | if ((process.env.NODE_ENV !== 'production') && !target) {
|
452 | warn("".concat(hook, " is called when there is no active component instance to be ") +
|
453 | "associated with. " +
|
454 | "Lifecycle injection APIs can only be used during execution of setup().");
|
455 | }
|
456 | return target;
|
457 | }
|
458 | function defineComponentInstance(Ctor, options) {
|
459 | if (options === void 0) { options = {}; }
|
460 | var silent = Ctor.config.silent;
|
461 | Ctor.config.silent = true;
|
462 | var vm = new Ctor(options);
|
463 | Ctor.config.silent = silent;
|
464 | return vm;
|
465 | }
|
466 | function isComponentInstance(obj) {
|
467 | var Vue = getVueConstructor();
|
468 | return Vue && obj instanceof Vue;
|
469 | }
|
470 | function createSlotProxy(vm, slotName) {
|
471 | return (function () {
|
472 | var args = [];
|
473 | for (var _i = 0; _i < arguments.length; _i++) {
|
474 | args[_i] = arguments[_i];
|
475 | }
|
476 | if (!vm.$scopedSlots[slotName]) {
|
477 | if ((process.env.NODE_ENV !== 'production'))
|
478 | return warn("slots.".concat(slotName, "() got called outside of the \"render()\" scope"), vm);
|
479 | return;
|
480 | }
|
481 | return vm.$scopedSlots[slotName].apply(vm, args);
|
482 | });
|
483 | }
|
484 | function resolveSlots(slots, normalSlots) {
|
485 | var res;
|
486 | if (!slots) {
|
487 | res = {};
|
488 | }
|
489 | else if (slots._normalized) {
|
490 |
|
491 | return slots._normalized;
|
492 | }
|
493 | else {
|
494 | res = {};
|
495 | for (var key in slots) {
|
496 | if (slots[key] && key[0] !== '$') {
|
497 | res[key] = true;
|
498 | }
|
499 | }
|
500 | }
|
501 |
|
502 | for (var key in normalSlots) {
|
503 | if (!(key in res)) {
|
504 | res[key] = true;
|
505 | }
|
506 | }
|
507 | return res;
|
508 | }
|
509 | var vueInternalClasses;
|
510 | var getVueInternalClasses = function () {
|
511 | if (!vueInternalClasses) {
|
512 | var vm = defineComponentInstance(getVueConstructor(), {
|
513 | computed: {
|
514 | value: function () {
|
515 | return 0;
|
516 | },
|
517 | },
|
518 | });
|
519 |
|
520 | var Watcher = vm._computedWatchers.value.constructor;
|
521 |
|
522 | var Dep = vm._data.__ob__.dep.constructor;
|
523 | vueInternalClasses = {
|
524 | Watcher: Watcher,
|
525 | Dep: Dep,
|
526 | };
|
527 | vm.$destroy();
|
528 | }
|
529 | return vueInternalClasses;
|
530 | };
|
531 |
|
532 | function createSymbol(name) {
|
533 | return hasSymbol ? Symbol.for(name) : name;
|
534 | }
|
535 | var WatcherPreFlushQueueKey = createSymbol('composition-api.preFlushQueue');
|
536 | var WatcherPostFlushQueueKey = createSymbol('composition-api.postFlushQueue');
|
537 |
|
538 | var RefKey = 'composition-api.refKey';
|
539 |
|
540 | var accessModifiedSet = new WeakMap();
|
541 | var rawSet = new WeakMap();
|
542 | var readonlySet = new WeakMap();
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | function set$1(target, key, val) {
|
550 | var Vue = getVueConstructor();
|
551 |
|
552 | var _a = Vue.util, warn = _a.warn, defineReactive = _a.defineReactive;
|
553 | if ((process.env.NODE_ENV !== 'production') && (isUndef(target) || isPrimitive(target))) {
|
554 | warn("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
|
555 | }
|
556 | var ob = target.__ob__;
|
557 | function ssrMockReactivity() {
|
558 |
|
559 | if (ob && isObject(val) && !hasOwn(val, '__ob__')) {
|
560 | mockReactivityDeep(val);
|
561 | }
|
562 | }
|
563 | if (isArray(target)) {
|
564 | if (isValidArrayIndex(key)) {
|
565 | target.length = Math.max(target.length, key);
|
566 | target.splice(key, 1, val);
|
567 | ssrMockReactivity();
|
568 | return val;
|
569 | }
|
570 | else if (key === 'length' && val !== target.length) {
|
571 | target.length = val;
|
572 | ob === null || ob === void 0 ? void 0 : ob.dep.notify();
|
573 | return val;
|
574 | }
|
575 | }
|
576 | if (key in target && !(key in Object.prototype)) {
|
577 | target[key] = val;
|
578 | ssrMockReactivity();
|
579 | return val;
|
580 | }
|
581 | if (target._isVue || (ob && ob.vmCount)) {
|
582 | (process.env.NODE_ENV !== 'production') &&
|
583 | warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
|
584 | 'at runtime - declare it upfront in the data option.');
|
585 | return val;
|
586 | }
|
587 | if (!ob) {
|
588 | target[key] = val;
|
589 | return val;
|
590 | }
|
591 | defineReactive(ob.value, key, val);
|
592 |
|
593 | defineAccessControl(target, key, val);
|
594 | ssrMockReactivity();
|
595 | ob.dep.notify();
|
596 | return val;
|
597 | }
|
598 |
|
599 | var _isForceTrigger = false;
|
600 | function isForceTrigger() {
|
601 | return _isForceTrigger;
|
602 | }
|
603 | function setForceTrigger(v) {
|
604 | _isForceTrigger = v;
|
605 | }
|
606 |
|
607 | var RefImpl = (function () {
|
608 | function RefImpl(_a) {
|
609 | var get = _a.get, set = _a.set;
|
610 | proxy(this, 'value', {
|
611 | get: get,
|
612 | set: set,
|
613 | });
|
614 | }
|
615 | return RefImpl;
|
616 | }());
|
617 | function createRef(options, isReadonly, isComputed) {
|
618 | if (isReadonly === void 0) { isReadonly = false; }
|
619 | if (isComputed === void 0) { isComputed = false; }
|
620 | var r = new RefImpl(options);
|
621 |
|
622 | if (isComputed)
|
623 | r.effect = true;
|
624 |
|
625 |
|
626 |
|
627 | var sealed = Object.seal(r);
|
628 | if (isReadonly)
|
629 | readonlySet.set(sealed, true);
|
630 | return sealed;
|
631 | }
|
632 | function ref(raw) {
|
633 | var _a;
|
634 | if (isRef(raw)) {
|
635 | return raw;
|
636 | }
|
637 | var value = reactive((_a = {}, _a[RefKey] = raw, _a));
|
638 | return createRef({
|
639 | get: function () { return value[RefKey]; },
|
640 | set: function (v) { return (value[RefKey] = v); },
|
641 | });
|
642 | }
|
643 | function isRef(value) {
|
644 | return value instanceof RefImpl;
|
645 | }
|
646 | function unref(ref) {
|
647 | return isRef(ref) ? ref.value : ref;
|
648 | }
|
649 | function toRefs(obj) {
|
650 | if ((process.env.NODE_ENV !== 'production') && !isReactive(obj)) {
|
651 | warn("toRefs() expects a reactive object but received a plain one.");
|
652 | }
|
653 | if (!isPlainObject(obj))
|
654 | return obj;
|
655 | var ret = {};
|
656 | for (var key in obj) {
|
657 | ret[key] = toRef(obj, key);
|
658 | }
|
659 | return ret;
|
660 | }
|
661 | function customRef(factory) {
|
662 | var version = ref(0);
|
663 | return createRef(factory(function () { return void version.value; }, function () {
|
664 | ++version.value;
|
665 | }));
|
666 | }
|
667 | function toRef(object, key) {
|
668 | if (!(key in object))
|
669 | set$1(object, key, undefined);
|
670 | var v = object[key];
|
671 | if (isRef(v))
|
672 | return v;
|
673 | return createRef({
|
674 | get: function () { return object[key]; },
|
675 | set: function (v) { return (object[key] = v); },
|
676 | });
|
677 | }
|
678 | function shallowRef(raw) {
|
679 | var _a;
|
680 | if (isRef(raw)) {
|
681 | return raw;
|
682 | }
|
683 | var value = shallowReactive((_a = {}, _a[RefKey] = raw, _a));
|
684 | return createRef({
|
685 | get: function () { return value[RefKey]; },
|
686 | set: function (v) { return (value[RefKey] = v); },
|
687 | });
|
688 | }
|
689 | function triggerRef(value) {
|
690 | if (!isRef(value))
|
691 | return;
|
692 | setForceTrigger(true);
|
693 | value.value = value.value;
|
694 | setForceTrigger(false);
|
695 | }
|
696 | function proxyRefs(objectWithRefs) {
|
697 | var _a, e_1, _b;
|
698 | if (isReactive(objectWithRefs)) {
|
699 | return objectWithRefs;
|
700 | }
|
701 | var value = reactive((_a = {}, _a[RefKey] = objectWithRefs, _a));
|
702 | def(value, RefKey, value[RefKey], false);
|
703 | var _loop_1 = function (key) {
|
704 | proxy(value, key, {
|
705 | get: function () {
|
706 | if (isRef(value[RefKey][key])) {
|
707 | return value[RefKey][key].value;
|
708 | }
|
709 | return value[RefKey][key];
|
710 | },
|
711 | set: function (v) {
|
712 | if (isRef(value[RefKey][key])) {
|
713 | return (value[RefKey][key].value = unref(v));
|
714 | }
|
715 | value[RefKey][key] = unref(v);
|
716 | },
|
717 | });
|
718 | };
|
719 | try {
|
720 | for (var _c = __values(Object.keys(objectWithRefs)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
721 | var key = _d.value;
|
722 | _loop_1(key);
|
723 | }
|
724 | }
|
725 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
726 | finally {
|
727 | try {
|
728 | if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
729 | }
|
730 | finally { if (e_1) throw e_1.error; }
|
731 | }
|
732 | return value;
|
733 | }
|
734 |
|
735 | var SKIPFLAG = '__v_skip';
|
736 | function isRaw(obj) {
|
737 | var _a;
|
738 | return Boolean(obj &&
|
739 | hasOwn(obj, '__ob__') &&
|
740 | typeof obj.__ob__ === 'object' &&
|
741 | ((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a[SKIPFLAG]));
|
742 | }
|
743 | function isReactive(obj) {
|
744 | var _a;
|
745 | return Boolean(obj &&
|
746 | hasOwn(obj, '__ob__') &&
|
747 | typeof obj.__ob__ === 'object' &&
|
748 | !((_a = obj.__ob__) === null || _a === void 0 ? void 0 : _a[SKIPFLAG]));
|
749 | }
|
750 |
|
751 |
|
752 |
|
753 |
|
754 | function setupAccessControl(target) {
|
755 | if (!isPlainObject(target) ||
|
756 | isRaw(target) ||
|
757 | isArray(target) ||
|
758 | isRef(target) ||
|
759 | isComponentInstance(target) ||
|
760 | accessModifiedSet.has(target))
|
761 | return;
|
762 | accessModifiedSet.set(target, true);
|
763 | var keys = Object.keys(target);
|
764 | for (var i = 0; i < keys.length; i++) {
|
765 | defineAccessControl(target, keys[i]);
|
766 | }
|
767 | }
|
768 |
|
769 |
|
770 |
|
771 | function defineAccessControl(target, key, val) {
|
772 | if (key === '__ob__')
|
773 | return;
|
774 | if (isRaw(target[key]))
|
775 | return;
|
776 | var getter;
|
777 | var setter;
|
778 | var property = Object.getOwnPropertyDescriptor(target, key);
|
779 | if (property) {
|
780 | if (property.configurable === false) {
|
781 | return;
|
782 | }
|
783 | getter = property.get;
|
784 | setter = property.set;
|
785 | if ((!getter || setter) &&
|
786 | arguments.length === 2) {
|
787 | val = target[key];
|
788 | }
|
789 | }
|
790 | setupAccessControl(val);
|
791 | proxy(target, key, {
|
792 | get: function getterHandler() {
|
793 | var value = getter ? getter.call(target) : val;
|
794 |
|
795 | if (key !== RefKey && isRef(value)) {
|
796 | return value.value;
|
797 | }
|
798 | else {
|
799 | return value;
|
800 | }
|
801 | },
|
802 | set: function setterHandler(newVal) {
|
803 | if (getter && !setter)
|
804 | return;
|
805 |
|
806 |
|
807 |
|
808 | if (key !== RefKey && isRef(val) && !isRef(newVal)) {
|
809 | val.value = newVal;
|
810 | }
|
811 | else if (setter) {
|
812 | setter.call(target, newVal);
|
813 | val = newVal;
|
814 | }
|
815 | else {
|
816 | val = newVal;
|
817 | }
|
818 | setupAccessControl(newVal);
|
819 | },
|
820 | });
|
821 | }
|
822 | function observe(obj) {
|
823 | var Vue = getRegisteredVueOrDefault();
|
824 | var observed;
|
825 | if (Vue.observable) {
|
826 | observed = Vue.observable(obj);
|
827 | }
|
828 | else {
|
829 | var vm = defineComponentInstance(Vue, {
|
830 | data: {
|
831 | $$state: obj,
|
832 | },
|
833 | });
|
834 | observed = vm._data.$$state;
|
835 | }
|
836 |
|
837 | if (!hasOwn(observed, '__ob__')) {
|
838 | mockReactivityDeep(observed);
|
839 | }
|
840 | return observed;
|
841 | }
|
842 |
|
843 |
|
844 |
|
845 | function mockReactivityDeep(obj, seen) {
|
846 | var e_1, _a;
|
847 | if (seen === void 0) { seen = new Set(); }
|
848 | if (seen.has(obj) || hasOwn(obj, '__ob__') || !Object.isExtensible(obj))
|
849 | return;
|
850 | def(obj, '__ob__', mockObserver(obj));
|
851 | seen.add(obj);
|
852 | try {
|
853 | for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
854 | var key = _c.value;
|
855 | var value = obj[key];
|
856 | if (!(isPlainObject(value) || isArray(value)) ||
|
857 | isRaw(value) ||
|
858 | !Object.isExtensible(value)) {
|
859 | continue;
|
860 | }
|
861 | mockReactivityDeep(value, seen);
|
862 | }
|
863 | }
|
864 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
865 | finally {
|
866 | try {
|
867 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
868 | }
|
869 | finally { if (e_1) throw e_1.error; }
|
870 | }
|
871 | }
|
872 | function mockObserver(value) {
|
873 | if (value === void 0) { value = {}; }
|
874 | return {
|
875 | value: value,
|
876 | dep: {
|
877 | notify: noopFn,
|
878 | depend: noopFn,
|
879 | addSub: noopFn,
|
880 | removeSub: noopFn,
|
881 | },
|
882 | };
|
883 | }
|
884 | function createObserver() {
|
885 | return observe({}).__ob__;
|
886 | }
|
887 | function shallowReactive(obj) {
|
888 | var e_2, _a;
|
889 | if (!isObject(obj)) {
|
890 | if ((process.env.NODE_ENV !== 'production')) {
|
891 | warn('"shallowReactive()" must be called on an object.');
|
892 | }
|
893 | return obj;
|
894 | }
|
895 | if (!(isPlainObject(obj) || isArray(obj)) ||
|
896 | isRaw(obj) ||
|
897 | !Object.isExtensible(obj)) {
|
898 | return obj;
|
899 | }
|
900 | var observed = observe(isArray(obj) ? [] : {});
|
901 | var ob = observed.__ob__;
|
902 | var _loop_1 = function (key) {
|
903 | var val = obj[key];
|
904 | var getter;
|
905 | var setter;
|
906 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
907 | if (property) {
|
908 | if (property.configurable === false) {
|
909 | return "continue";
|
910 | }
|
911 | getter = property.get;
|
912 | setter = property.set;
|
913 | }
|
914 | proxy(observed, key, {
|
915 | get: function getterHandler() {
|
916 | var _a;
|
917 | (_a = ob.dep) === null || _a === void 0 ? void 0 : _a.depend();
|
918 | return val;
|
919 | },
|
920 | set: function setterHandler(newVal) {
|
921 | var _a;
|
922 | if (getter && !setter)
|
923 | return;
|
924 | if (!isForceTrigger() && val === newVal)
|
925 | return;
|
926 | if (setter) {
|
927 | setter.call(obj, newVal);
|
928 | }
|
929 | else {
|
930 | val = newVal;
|
931 | }
|
932 | (_a = ob.dep) === null || _a === void 0 ? void 0 : _a.notify();
|
933 | },
|
934 | });
|
935 | };
|
936 | try {
|
937 | for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
938 | var key = _c.value;
|
939 | _loop_1(key);
|
940 | }
|
941 | }
|
942 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
943 | finally {
|
944 | try {
|
945 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
946 | }
|
947 | finally { if (e_2) throw e_2.error; }
|
948 | }
|
949 | return observed;
|
950 | }
|
951 |
|
952 |
|
953 |
|
954 | function reactive(obj) {
|
955 | if (!isObject(obj)) {
|
956 | if ((process.env.NODE_ENV !== 'production')) {
|
957 | warn('"reactive()" must be called on an object.');
|
958 | }
|
959 | return obj;
|
960 | }
|
961 | if (!(isPlainObject(obj) || isArray(obj)) ||
|
962 | isRaw(obj) ||
|
963 | !Object.isExtensible(obj)) {
|
964 | return obj;
|
965 | }
|
966 | var observed = observe(obj);
|
967 | setupAccessControl(observed);
|
968 | return observed;
|
969 | }
|
970 |
|
971 |
|
972 |
|
973 | function markRaw(obj) {
|
974 | if (!(isPlainObject(obj) || isArray(obj)) || !Object.isExtensible(obj)) {
|
975 | return obj;
|
976 | }
|
977 |
|
978 | var ob = createObserver();
|
979 | ob[SKIPFLAG] = true;
|
980 | def(obj, '__ob__', ob);
|
981 |
|
982 | rawSet.set(obj, true);
|
983 | return obj;
|
984 | }
|
985 | function toRaw(observed) {
|
986 | var _a;
|
987 | if (isRaw(observed) || !Object.isExtensible(observed)) {
|
988 | return observed;
|
989 | }
|
990 | return ((_a = observed === null || observed === void 0 ? void 0 : observed.__ob__) === null || _a === void 0 ? void 0 : _a.value) || observed;
|
991 | }
|
992 |
|
993 | function isReadonly(obj) {
|
994 | return readonlySet.has(obj);
|
995 | }
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 | function readonly(target) {
|
1003 | if ((process.env.NODE_ENV !== 'production') && !isObject(target)) {
|
1004 | warn("value cannot be made reactive: ".concat(String(target)));
|
1005 | }
|
1006 | else {
|
1007 | readonlySet.set(target, true);
|
1008 | }
|
1009 | return target;
|
1010 | }
|
1011 | function shallowReadonly(obj) {
|
1012 | var e_1, _a;
|
1013 | if (!isObject(obj)) {
|
1014 | if ((process.env.NODE_ENV !== 'production')) {
|
1015 | warn("value cannot be made reactive: ".concat(String(obj)));
|
1016 | }
|
1017 | return obj;
|
1018 | }
|
1019 | if (!(isPlainObject(obj) || isArray(obj)) ||
|
1020 | (!Object.isExtensible(obj) && !isRef(obj))) {
|
1021 | return obj;
|
1022 | }
|
1023 | var readonlyObj = isRef(obj)
|
1024 | ? new RefImpl({})
|
1025 | : isReactive(obj)
|
1026 | ? observe({})
|
1027 | : {};
|
1028 | var source = reactive({});
|
1029 | var ob = source.__ob__;
|
1030 | var _loop_1 = function (key) {
|
1031 | var val = obj[key];
|
1032 | var getter;
|
1033 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1034 | if (property) {
|
1035 | if (property.configurable === false && !isRef(obj)) {
|
1036 | return "continue";
|
1037 | }
|
1038 | getter = property.get;
|
1039 | }
|
1040 | proxy(readonlyObj, key, {
|
1041 | get: function getterHandler() {
|
1042 | var value = getter ? getter.call(obj) : val;
|
1043 | ob.dep.depend();
|
1044 | return value;
|
1045 | },
|
1046 | set: function (v) {
|
1047 | if ((process.env.NODE_ENV !== 'production')) {
|
1048 | warn("Set operation on key \"".concat(key, "\" failed: target is readonly."));
|
1049 | }
|
1050 | },
|
1051 | });
|
1052 | };
|
1053 | try {
|
1054 | for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1055 | var key = _c.value;
|
1056 | _loop_1(key);
|
1057 | }
|
1058 | }
|
1059 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
1060 | finally {
|
1061 | try {
|
1062 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1063 | }
|
1064 | finally { if (e_1) throw e_1.error; }
|
1065 | }
|
1066 | readonlySet.set(readonlyObj, true);
|
1067 | return readonlyObj;
|
1068 | }
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | function del(target, key) {
|
1074 | var Vue = getVueConstructor();
|
1075 | var warn = Vue.util.warn;
|
1076 | if ((process.env.NODE_ENV !== 'production') && (isUndef(target) || isPrimitive(target))) {
|
1077 | warn("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
|
1078 | }
|
1079 | if (isArray(target) && isValidArrayIndex(key)) {
|
1080 | target.splice(key, 1);
|
1081 | return;
|
1082 | }
|
1083 | var ob = target.__ob__;
|
1084 | if (target._isVue || (ob && ob.vmCount)) {
|
1085 | (process.env.NODE_ENV !== 'production') &&
|
1086 | warn('Avoid deleting properties on a Vue instance or its root $data ' +
|
1087 | '- just set it to null.');
|
1088 | return;
|
1089 | }
|
1090 | if (!hasOwn(target, key)) {
|
1091 | return;
|
1092 | }
|
1093 | delete target[key];
|
1094 | if (!ob) {
|
1095 | return;
|
1096 | }
|
1097 | ob.dep.notify();
|
1098 | }
|
1099 |
|
1100 | var genName = function (name) { return "on".concat(name[0].toUpperCase() + name.slice(1)); };
|
1101 | function createLifeCycle(lifeCyclehook) {
|
1102 | return function (callback, target) {
|
1103 | var instance = getCurrentInstanceForFn(genName(lifeCyclehook), target);
|
1104 | return (instance &&
|
1105 | injectHookOption(getVueConstructor(), instance, lifeCyclehook, callback));
|
1106 | };
|
1107 | }
|
1108 | function injectHookOption(Vue, instance, hook, val) {
|
1109 | var options = instance.proxy.$options;
|
1110 | var mergeFn = Vue.config.optionMergeStrategies[hook];
|
1111 | var wrappedHook = wrapHookCall(instance, val);
|
1112 | options[hook] = mergeFn(options[hook], wrappedHook);
|
1113 | return wrappedHook;
|
1114 | }
|
1115 | function wrapHookCall(instance, fn) {
|
1116 | return function () {
|
1117 | var args = [];
|
1118 | for (var _i = 0; _i < arguments.length; _i++) {
|
1119 | args[_i] = arguments[_i];
|
1120 | }
|
1121 | var prev = getCurrentInstance();
|
1122 | setCurrentInstance(instance);
|
1123 | try {
|
1124 | return fn.apply(void 0, __spreadArray([], __read(args), false));
|
1125 | }
|
1126 | finally {
|
1127 | setCurrentInstance(prev);
|
1128 | }
|
1129 | };
|
1130 | }
|
1131 | var onBeforeMount = createLifeCycle('beforeMount');
|
1132 | var onMounted = createLifeCycle('mounted');
|
1133 | var onBeforeUpdate = createLifeCycle('beforeUpdate');
|
1134 | var onUpdated = createLifeCycle('updated');
|
1135 | var onBeforeUnmount = createLifeCycle('beforeDestroy');
|
1136 | var onUnmounted = createLifeCycle('destroyed');
|
1137 | var onErrorCaptured = createLifeCycle('errorCaptured');
|
1138 | var onActivated = createLifeCycle('activated');
|
1139 | var onDeactivated = createLifeCycle('deactivated');
|
1140 | var onServerPrefetch = createLifeCycle('serverPrefetch');
|
1141 |
|
1142 | var fallbackVM;
|
1143 | function flushPreQueue() {
|
1144 | flushQueue(this, WatcherPreFlushQueueKey);
|
1145 | }
|
1146 | function flushPostQueue() {
|
1147 | flushQueue(this, WatcherPostFlushQueueKey);
|
1148 | }
|
1149 | function hasWatchEnv(vm) {
|
1150 | return vm[WatcherPreFlushQueueKey] !== undefined;
|
1151 | }
|
1152 | function installWatchEnv(vm) {
|
1153 | vm[WatcherPreFlushQueueKey] = [];
|
1154 | vm[WatcherPostFlushQueueKey] = [];
|
1155 | vm.$on('hook:beforeUpdate', flushPreQueue);
|
1156 | vm.$on('hook:updated', flushPostQueue);
|
1157 | }
|
1158 | function getWatcherOption(options) {
|
1159 | return __assign({
|
1160 | immediate: false,
|
1161 | deep: false,
|
1162 | flush: 'pre',
|
1163 | }, options);
|
1164 | }
|
1165 | function getWatchEffectOption(options) {
|
1166 | return __assign({
|
1167 | flush: 'pre',
|
1168 | }, options);
|
1169 | }
|
1170 | function getWatcherVM() {
|
1171 | var vm = getCurrentScopeVM();
|
1172 | if (!vm) {
|
1173 | if (!fallbackVM) {
|
1174 | fallbackVM = defineComponentInstance(getVueConstructor());
|
1175 | }
|
1176 | vm = fallbackVM;
|
1177 | }
|
1178 | else if (!hasWatchEnv(vm)) {
|
1179 | installWatchEnv(vm);
|
1180 | }
|
1181 | return vm;
|
1182 | }
|
1183 | function flushQueue(vm, key) {
|
1184 | var queue = vm[key];
|
1185 | for (var index = 0; index < queue.length; index++) {
|
1186 | queue[index]();
|
1187 | }
|
1188 | queue.length = 0;
|
1189 | }
|
1190 | function queueFlushJob(vm, fn, mode) {
|
1191 |
|
1192 | var fallbackFlush = function () {
|
1193 | vm.$nextTick(function () {
|
1194 | if (vm[WatcherPreFlushQueueKey].length) {
|
1195 | flushQueue(vm, WatcherPreFlushQueueKey);
|
1196 | }
|
1197 | if (vm[WatcherPostFlushQueueKey].length) {
|
1198 | flushQueue(vm, WatcherPostFlushQueueKey);
|
1199 | }
|
1200 | });
|
1201 | };
|
1202 | switch (mode) {
|
1203 | case 'pre':
|
1204 | fallbackFlush();
|
1205 | vm[WatcherPreFlushQueueKey].push(fn);
|
1206 | break;
|
1207 | case 'post':
|
1208 | fallbackFlush();
|
1209 | vm[WatcherPostFlushQueueKey].push(fn);
|
1210 | break;
|
1211 | default:
|
1212 | assert(false, "flush must be one of [\"post\", \"pre\", \"sync\"], but got ".concat(mode));
|
1213 | break;
|
1214 | }
|
1215 | }
|
1216 | function createVueWatcher(vm, getter, callback, options) {
|
1217 | var index = vm._watchers.length;
|
1218 |
|
1219 | vm.$watch(getter, callback, {
|
1220 | immediate: options.immediateInvokeCallback,
|
1221 | deep: options.deep,
|
1222 | lazy: options.noRun,
|
1223 | sync: options.sync,
|
1224 | before: options.before,
|
1225 | });
|
1226 | return vm._watchers[index];
|
1227 | }
|
1228 |
|
1229 |
|
1230 | function patchWatcherTeardown(watcher, runCleanup) {
|
1231 | var _teardown = watcher.teardown;
|
1232 | watcher.teardown = function () {
|
1233 | var args = [];
|
1234 | for (var _i = 0; _i < arguments.length; _i++) {
|
1235 | args[_i] = arguments[_i];
|
1236 | }
|
1237 | _teardown.apply(watcher, args);
|
1238 | runCleanup();
|
1239 | };
|
1240 | }
|
1241 | function createWatcher(vm, source, cb, options) {
|
1242 | var _a;
|
1243 | if ((process.env.NODE_ENV !== 'production') && !cb) {
|
1244 | if (options.immediate !== undefined) {
|
1245 | warn("watch() \"immediate\" option is only respected when using the " +
|
1246 | "watch(source, callback, options?) signature.");
|
1247 | }
|
1248 | if (options.deep !== undefined) {
|
1249 | warn("watch() \"deep\" option is only respected when using the " +
|
1250 | "watch(source, callback, options?) signature.");
|
1251 | }
|
1252 | }
|
1253 | var flushMode = options.flush;
|
1254 | var isSync = flushMode === 'sync';
|
1255 | var cleanup;
|
1256 | var registerCleanup = function (fn) {
|
1257 | cleanup = function () {
|
1258 | try {
|
1259 | fn();
|
1260 | }
|
1261 | catch (
|
1262 |
|
1263 | error) {
|
1264 | logError(error, vm, 'onCleanup()');
|
1265 | }
|
1266 | };
|
1267 | };
|
1268 |
|
1269 | var runCleanup = function () {
|
1270 | if (cleanup) {
|
1271 | cleanup();
|
1272 | cleanup = null;
|
1273 | }
|
1274 | };
|
1275 | var createScheduler = function (fn) {
|
1276 | if (isSync ||
|
1277 | vm ===
|
1278 | fallbackVM) {
|
1279 | return fn;
|
1280 | }
|
1281 | return (function () {
|
1282 | var args = [];
|
1283 | for (var _i = 0; _i < arguments.length; _i++) {
|
1284 | args[_i] = arguments[_i];
|
1285 | }
|
1286 | return queueFlushJob(vm, function () {
|
1287 | fn.apply(void 0, __spreadArray([], __read(args), false));
|
1288 | }, flushMode);
|
1289 | });
|
1290 | };
|
1291 |
|
1292 | if (cb === null) {
|
1293 | var running_1 = false;
|
1294 | var getter_1 = function () {
|
1295 |
|
1296 | if (running_1) {
|
1297 | return;
|
1298 | }
|
1299 | try {
|
1300 | running_1 = true;
|
1301 | source(registerCleanup);
|
1302 | }
|
1303 | finally {
|
1304 | running_1 = false;
|
1305 | }
|
1306 | };
|
1307 | var watcher_1 = createVueWatcher(vm, getter_1, noopFn, {
|
1308 | deep: options.deep || false,
|
1309 | sync: isSync,
|
1310 | before: runCleanup,
|
1311 | });
|
1312 | patchWatcherTeardown(watcher_1, runCleanup);
|
1313 |
|
1314 | watcher_1.lazy = false;
|
1315 | var originGet = watcher_1.get.bind(watcher_1);
|
1316 |
|
1317 | watcher_1.get = createScheduler(originGet);
|
1318 | return function () {
|
1319 | watcher_1.teardown();
|
1320 | };
|
1321 | }
|
1322 | var deep = options.deep;
|
1323 | var isMultiSource = false;
|
1324 | var getter;
|
1325 | if (isRef(source)) {
|
1326 | getter = function () { return source.value; };
|
1327 | }
|
1328 | else if (isReactive(source)) {
|
1329 | getter = function () { return source; };
|
1330 | deep = true;
|
1331 | }
|
1332 | else if (isArray(source)) {
|
1333 | isMultiSource = true;
|
1334 | getter = function () {
|
1335 | return source.map(function (s) {
|
1336 | if (isRef(s)) {
|
1337 | return s.value;
|
1338 | }
|
1339 | else if (isReactive(s)) {
|
1340 | return traverse(s);
|
1341 | }
|
1342 | else if (isFunction(s)) {
|
1343 | return s();
|
1344 | }
|
1345 | else {
|
1346 | (process.env.NODE_ENV !== 'production') &&
|
1347 | warn("Invalid watch source: ".concat(JSON.stringify(s), ".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types."), vm);
|
1348 | return noopFn;
|
1349 | }
|
1350 | });
|
1351 | };
|
1352 | }
|
1353 | else if (isFunction(source)) {
|
1354 | getter = source;
|
1355 | }
|
1356 | else {
|
1357 | getter = noopFn;
|
1358 | (process.env.NODE_ENV !== 'production') &&
|
1359 | warn("Invalid watch source: ".concat(JSON.stringify(source), ".\n A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types."), vm);
|
1360 | }
|
1361 | if (deep) {
|
1362 | var baseGetter_1 = getter;
|
1363 | getter = function () { return traverse(baseGetter_1()); };
|
1364 | }
|
1365 | var applyCb = function (n, o) {
|
1366 | if (!deep &&
|
1367 | isMultiSource &&
|
1368 | n.every(function (v, i) { return isSame(v, o[i]); }))
|
1369 | return;
|
1370 |
|
1371 | runCleanup();
|
1372 | return cb(n, o, registerCleanup);
|
1373 | };
|
1374 | var callback = createScheduler(applyCb);
|
1375 | if (options.immediate) {
|
1376 | var originalCallback_1 = callback;
|
1377 |
|
1378 |
|
1379 | var shiftCallback_1 = function (n, o) {
|
1380 | shiftCallback_1 = originalCallback_1;
|
1381 |
|
1382 | return applyCb(n, isArray(n) ? [] : o);
|
1383 | };
|
1384 | callback = function (n, o) {
|
1385 | return shiftCallback_1(n, o);
|
1386 | };
|
1387 | }
|
1388 |
|
1389 | var stop = vm.$watch(getter, callback, {
|
1390 | immediate: options.immediate,
|
1391 | deep: deep,
|
1392 | sync: isSync,
|
1393 | });
|
1394 |
|
1395 | var watcher = vm._watchers[vm._watchers.length - 1];
|
1396 |
|
1397 |
|
1398 | if (isReactive(watcher.value) && ((_a = watcher.value.__ob__) === null || _a === void 0 ? void 0 : _a.dep) && deep) {
|
1399 | watcher.value.__ob__.dep.addSub({
|
1400 | update: function () {
|
1401 |
|
1402 |
|
1403 | watcher.run();
|
1404 | },
|
1405 | });
|
1406 | }
|
1407 | patchWatcherTeardown(watcher, runCleanup);
|
1408 | return function () {
|
1409 | stop();
|
1410 | };
|
1411 | }
|
1412 | function watchEffect(effect, options) {
|
1413 | var opts = getWatchEffectOption(options);
|
1414 | var vm = getWatcherVM();
|
1415 | return createWatcher(vm, effect, null, opts);
|
1416 | }
|
1417 | function watchPostEffect(effect) {
|
1418 | return watchEffect(effect, { flush: 'post' });
|
1419 | }
|
1420 | function watchSyncEffect(effect) {
|
1421 | return watchEffect(effect, { flush: 'sync' });
|
1422 | }
|
1423 |
|
1424 | function watch(source, cb, options) {
|
1425 | var callback = null;
|
1426 | if (isFunction(cb)) {
|
1427 |
|
1428 | callback = cb;
|
1429 | }
|
1430 | else {
|
1431 |
|
1432 | if ((process.env.NODE_ENV !== 'production')) {
|
1433 | warn("`watch(fn, options?)` signature has been moved to a separate API. " +
|
1434 | "Use `watchEffect(fn, options?)` instead. `watch` now only " +
|
1435 | "supports `watch(source, cb, options?) signature.");
|
1436 | }
|
1437 | options = cb;
|
1438 | callback = null;
|
1439 | }
|
1440 | var opts = getWatcherOption(options);
|
1441 | var vm = getWatcherVM();
|
1442 | return createWatcher(vm, source, callback, opts);
|
1443 | }
|
1444 | function traverse(value, seen) {
|
1445 | if (seen === void 0) { seen = new Set(); }
|
1446 | if (!isObject(value) || seen.has(value) || rawSet.has(value)) {
|
1447 | return value;
|
1448 | }
|
1449 | seen.add(value);
|
1450 | if (isRef(value)) {
|
1451 | traverse(value.value, seen);
|
1452 | }
|
1453 | else if (isArray(value)) {
|
1454 | for (var i = 0; i < value.length; i++) {
|
1455 | traverse(value[i], seen);
|
1456 | }
|
1457 | }
|
1458 | else if (isSet(value) || isMap(value)) {
|
1459 | value.forEach(function (v) {
|
1460 | traverse(v, seen);
|
1461 | });
|
1462 | }
|
1463 | else if (isPlainObject(value)) {
|
1464 | for (var key in value) {
|
1465 | traverse(value[key], seen);
|
1466 | }
|
1467 | }
|
1468 | return value;
|
1469 | }
|
1470 |
|
1471 |
|
1472 | function computed(getterOrOptions) {
|
1473 | var vm = getCurrentScopeVM();
|
1474 | var getter;
|
1475 | var setter;
|
1476 | if (isFunction(getterOrOptions)) {
|
1477 | getter = getterOrOptions;
|
1478 | }
|
1479 | else {
|
1480 | getter = getterOrOptions.get;
|
1481 | setter = getterOrOptions.set;
|
1482 | }
|
1483 | var computedSetter;
|
1484 | var computedGetter;
|
1485 | if (vm && !vm.$isServer) {
|
1486 | var _a = getVueInternalClasses(), Watcher_1 = _a.Watcher, Dep_1 = _a.Dep;
|
1487 | var watcher_1;
|
1488 | computedGetter = function () {
|
1489 | if (!watcher_1) {
|
1490 | watcher_1 = new Watcher_1(vm, getter, noopFn, { lazy: true });
|
1491 | }
|
1492 | if (watcher_1.dirty) {
|
1493 | watcher_1.evaluate();
|
1494 | }
|
1495 | if (Dep_1.target) {
|
1496 | watcher_1.depend();
|
1497 | }
|
1498 | return watcher_1.value;
|
1499 | };
|
1500 | computedSetter = function (v) {
|
1501 | if ((process.env.NODE_ENV !== 'production') && !setter) {
|
1502 | warn('Write operation failed: computed value is readonly.', vm);
|
1503 | return;
|
1504 | }
|
1505 | if (setter) {
|
1506 | setter(v);
|
1507 | }
|
1508 | };
|
1509 | }
|
1510 | else {
|
1511 |
|
1512 | var computedHost_1 = defineComponentInstance(getVueConstructor(), {
|
1513 | computed: {
|
1514 | $$state: {
|
1515 | get: getter,
|
1516 | set: setter,
|
1517 | },
|
1518 | },
|
1519 | });
|
1520 | vm && vm.$on('hook:destroyed', function () { return computedHost_1.$destroy(); });
|
1521 | computedGetter = function () { return computedHost_1.$$state; };
|
1522 | computedSetter = function (v) {
|
1523 | if ((process.env.NODE_ENV !== 'production') && !setter) {
|
1524 | warn('Write operation failed: computed value is readonly.', vm);
|
1525 | return;
|
1526 | }
|
1527 | computedHost_1.$$state = v;
|
1528 | };
|
1529 | }
|
1530 | return createRef({
|
1531 | get: computedGetter,
|
1532 | set: computedSetter,
|
1533 | }, !setter, true);
|
1534 | }
|
1535 |
|
1536 | var NOT_FOUND = {};
|
1537 | function resolveInject(provideKey, vm) {
|
1538 | var source = vm;
|
1539 | while (source) {
|
1540 | if (source._provided && hasOwn(source._provided, provideKey)) {
|
1541 | return source._provided[provideKey];
|
1542 | }
|
1543 | source = source.$parent;
|
1544 | }
|
1545 | return NOT_FOUND;
|
1546 | }
|
1547 | function provide(key, value) {
|
1548 | var _a;
|
1549 | var vm = (_a = getCurrentInstanceForFn('provide')) === null || _a === void 0 ? void 0 : _a.proxy;
|
1550 | if (!vm)
|
1551 | return;
|
1552 | if (!vm._provided) {
|
1553 | var provideCache_1 = {};
|
1554 | proxy(vm, '_provided', {
|
1555 | get: function () { return provideCache_1; },
|
1556 | set: function (v) { return Object.assign(provideCache_1, v); },
|
1557 | });
|
1558 | }
|
1559 | vm._provided[key] = value;
|
1560 | }
|
1561 | function inject(key, defaultValue, treatDefaultAsFactory) {
|
1562 | var _a;
|
1563 | if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
|
1564 | var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy;
|
1565 | if (!vm) {
|
1566 | (process.env.NODE_ENV !== 'production') &&
|
1567 | warn("inject() can only be used inside setup() or functional components.");
|
1568 | return;
|
1569 | }
|
1570 | if (!key) {
|
1571 | (process.env.NODE_ENV !== 'production') && warn("injection \"".concat(String(key), "\" not found."), vm);
|
1572 | return defaultValue;
|
1573 | }
|
1574 | var val = resolveInject(key, vm);
|
1575 | if (val !== NOT_FOUND) {
|
1576 | return val;
|
1577 | }
|
1578 | else if (arguments.length > 1) {
|
1579 | return treatDefaultAsFactory && isFunction(defaultValue)
|
1580 | ? defaultValue()
|
1581 | : defaultValue;
|
1582 | }
|
1583 | else if ((process.env.NODE_ENV !== 'production')) {
|
1584 | warn("Injection \"".concat(String(key), "\" not found."), vm);
|
1585 | }
|
1586 | }
|
1587 |
|
1588 | var EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
|
1589 | ? Object.freeze({})
|
1590 | : {};
|
1591 | var useCssModule = function (name) {
|
1592 | var _a;
|
1593 | if (name === void 0) { name = '$style'; }
|
1594 | var instance = getCurrentInstance();
|
1595 | if (!instance) {
|
1596 | (process.env.NODE_ENV !== 'production') && warn("useCssModule must be called inside setup()");
|
1597 | return EMPTY_OBJ;
|
1598 | }
|
1599 | var mod = (_a = instance.proxy) === null || _a === void 0 ? void 0 : _a[name];
|
1600 | if (!mod) {
|
1601 | (process.env.NODE_ENV !== 'production') &&
|
1602 | warn("Current instance does not have CSS module named \"".concat(name, "\"."));
|
1603 | return EMPTY_OBJ;
|
1604 | }
|
1605 | return mod;
|
1606 | };
|
1607 |
|
1608 |
|
1609 |
|
1610 | var useCSSModule = useCssModule;
|
1611 |
|
1612 | function createApp(rootComponent, rootProps) {
|
1613 | if (rootProps === void 0) { rootProps = undefined; }
|
1614 | var V = getVueConstructor();
|
1615 | var mountedVM = undefined;
|
1616 | var provide = {};
|
1617 | var app = {
|
1618 | config: V.config,
|
1619 | use: V.use.bind(V),
|
1620 | mixin: V.mixin.bind(V),
|
1621 | component: V.component.bind(V),
|
1622 | provide: function (key, value) {
|
1623 | provide[key] = value;
|
1624 | return this;
|
1625 | },
|
1626 | directive: function (name, dir) {
|
1627 | if (dir) {
|
1628 | V.directive(name, dir);
|
1629 | return app;
|
1630 | }
|
1631 | else {
|
1632 | return V.directive(name);
|
1633 | }
|
1634 | },
|
1635 | mount: function (el, hydrating) {
|
1636 | if (!mountedVM) {
|
1637 | mountedVM = new V(__assign(__assign({ propsData: rootProps }, rootComponent), { provide: __assign(__assign({}, provide), rootComponent.provide) }));
|
1638 | mountedVM.$mount(el, hydrating);
|
1639 | return mountedVM;
|
1640 | }
|
1641 | else {
|
1642 | if ((process.env.NODE_ENV !== 'production')) {
|
1643 | warn("App has already been mounted.\n" +
|
1644 | "If you want to remount the same app, move your app creation logic " +
|
1645 | "into a factory function and create fresh app instances for each " +
|
1646 | "mount - e.g. `const createMyApp = () => createApp(App)`");
|
1647 | }
|
1648 | return mountedVM;
|
1649 | }
|
1650 | },
|
1651 | unmount: function () {
|
1652 | if (mountedVM) {
|
1653 | mountedVM.$destroy();
|
1654 | mountedVM = undefined;
|
1655 | }
|
1656 | else if ((process.env.NODE_ENV !== 'production')) {
|
1657 | warn("Cannot unmount an app that is not mounted.");
|
1658 | }
|
1659 | },
|
1660 | };
|
1661 | return app;
|
1662 | }
|
1663 |
|
1664 | var nextTick = function nextTick() {
|
1665 | var _a;
|
1666 | var args = [];
|
1667 | for (var _i = 0; _i < arguments.length; _i++) {
|
1668 | args[_i] = arguments[_i];
|
1669 | }
|
1670 | return (_a = getVueConstructor()) === null || _a === void 0 ? void 0 : _a.nextTick.apply(this, args);
|
1671 | };
|
1672 |
|
1673 | var fallbackCreateElement;
|
1674 | var createElement = function createElement() {
|
1675 | var _a;
|
1676 | var args = [];
|
1677 | for (var _i = 0; _i < arguments.length; _i++) {
|
1678 | args[_i] = arguments[_i];
|
1679 | }
|
1680 | var instance = (this === null || this === void 0 ? void 0 : this.proxy) || ((_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy);
|
1681 | if (!instance) {
|
1682 | (process.env.NODE_ENV !== 'production') &&
|
1683 | warn('`createElement()` has been called outside of render function.');
|
1684 | if (!fallbackCreateElement) {
|
1685 | fallbackCreateElement = defineComponentInstance(getVueConstructor()).$createElement;
|
1686 | }
|
1687 | return fallbackCreateElement.apply(fallbackCreateElement, args);
|
1688 | }
|
1689 | return instance.$createElement.apply(instance, args);
|
1690 | };
|
1691 |
|
1692 | function useSlots() {
|
1693 | return getContext().slots;
|
1694 | }
|
1695 | function useAttrs() {
|
1696 | return getContext().attrs;
|
1697 | }
|
1698 | function getContext() {
|
1699 | var i = getCurrentInstance();
|
1700 | if ((process.env.NODE_ENV !== 'production') && !i) {
|
1701 | warn("useContext() called without active instance.");
|
1702 | }
|
1703 | return i.setupContext;
|
1704 | }
|
1705 |
|
1706 | function set(vm, key, value) {
|
1707 | var state = (vm.__composition_api_state__ =
|
1708 | vm.__composition_api_state__ || {});
|
1709 | state[key] = value;
|
1710 | }
|
1711 | function get(vm, key) {
|
1712 | return (vm.__composition_api_state__ || {})[key];
|
1713 | }
|
1714 | var vmStateManager = {
|
1715 | set: set,
|
1716 | get: get,
|
1717 | };
|
1718 |
|
1719 | function asVmProperty(vm, propName, propValue) {
|
1720 | var props = vm.$options.props;
|
1721 | if (!(propName in vm) && !(props && hasOwn(props, propName))) {
|
1722 | if (isRef(propValue)) {
|
1723 | proxy(vm, propName, {
|
1724 | get: function () { return propValue.value; },
|
1725 | set: function (val) {
|
1726 | propValue.value = val;
|
1727 | },
|
1728 | });
|
1729 | }
|
1730 | else {
|
1731 | proxy(vm, propName, {
|
1732 | get: function () {
|
1733 | if (isReactive(propValue)) {
|
1734 | propValue.__ob__.dep.depend();
|
1735 | }
|
1736 | return propValue;
|
1737 | },
|
1738 | set: function (val) {
|
1739 | propValue = val;
|
1740 | },
|
1741 | });
|
1742 | }
|
1743 | if ((process.env.NODE_ENV !== 'production')) {
|
1744 |
|
1745 |
|
1746 | vm.$nextTick(function () {
|
1747 | if (Object.keys(vm._data).indexOf(propName) !== -1) {
|
1748 | return;
|
1749 | }
|
1750 | if (isRef(propValue)) {
|
1751 | proxy(vm._data, propName, {
|
1752 | get: function () { return propValue.value; },
|
1753 | set: function (val) {
|
1754 | propValue.value = val;
|
1755 | },
|
1756 | });
|
1757 | }
|
1758 | else {
|
1759 | proxy(vm._data, propName, {
|
1760 | get: function () { return propValue; },
|
1761 | set: function (val) {
|
1762 | propValue = val;
|
1763 | },
|
1764 | });
|
1765 | }
|
1766 | });
|
1767 | }
|
1768 | }
|
1769 | else if ((process.env.NODE_ENV !== 'production')) {
|
1770 | if (props && hasOwn(props, propName)) {
|
1771 | warn("The setup binding property \"".concat(propName, "\" is already declared as a prop."), vm);
|
1772 | }
|
1773 | else {
|
1774 | warn("The setup binding property \"".concat(propName, "\" is already declared."), vm);
|
1775 | }
|
1776 | }
|
1777 | }
|
1778 | function updateTemplateRef(vm) {
|
1779 | var rawBindings = vmStateManager.get(vm, 'rawBindings') || {};
|
1780 | if (!rawBindings || !Object.keys(rawBindings).length)
|
1781 | return;
|
1782 | var refs = vm.$refs;
|
1783 | var oldRefKeys = vmStateManager.get(vm, 'refs') || [];
|
1784 | for (var index = 0; index < oldRefKeys.length; index++) {
|
1785 | var key = oldRefKeys[index];
|
1786 | var setupValue = rawBindings[key];
|
1787 | if (!refs[key] && setupValue && isRef(setupValue)) {
|
1788 | setupValue.value = null;
|
1789 | }
|
1790 | }
|
1791 | var newKeys = Object.keys(refs);
|
1792 | var validNewKeys = [];
|
1793 | for (var index = 0; index < newKeys.length; index++) {
|
1794 | var key = newKeys[index];
|
1795 | var setupValue = rawBindings[key];
|
1796 | if (refs[key] && setupValue && isRef(setupValue)) {
|
1797 | setupValue.value = refs[key];
|
1798 | validNewKeys.push(key);
|
1799 | }
|
1800 | }
|
1801 | vmStateManager.set(vm, 'refs', validNewKeys);
|
1802 | }
|
1803 | function afterRender(vm) {
|
1804 | var stack = [vm._vnode];
|
1805 | while (stack.length) {
|
1806 | var vnode = stack.pop();
|
1807 | if (vnode) {
|
1808 | if (vnode.context)
|
1809 | updateTemplateRef(vnode.context);
|
1810 | if (vnode.children) {
|
1811 | for (var i = 0; i < vnode.children.length; ++i) {
|
1812 | stack.push(vnode.children[i]);
|
1813 | }
|
1814 | }
|
1815 | }
|
1816 | }
|
1817 | }
|
1818 | function updateVmAttrs(vm, ctx) {
|
1819 | var e_1, _a;
|
1820 | if (!vm) {
|
1821 | return;
|
1822 | }
|
1823 | var attrBindings = vmStateManager.get(vm, 'attrBindings');
|
1824 | if (!attrBindings && !ctx) {
|
1825 |
|
1826 | return;
|
1827 | }
|
1828 | if (!attrBindings) {
|
1829 | var observedData = reactive({});
|
1830 | attrBindings = { ctx: ctx, data: observedData };
|
1831 | vmStateManager.set(vm, 'attrBindings', attrBindings);
|
1832 | proxy(ctx, 'attrs', {
|
1833 | get: function () {
|
1834 | return attrBindings === null || attrBindings === void 0 ? void 0 : attrBindings.data;
|
1835 | },
|
1836 | set: function () {
|
1837 | (process.env.NODE_ENV !== 'production') &&
|
1838 | warn("Cannot assign to '$attrs' because it is a read-only property", vm);
|
1839 | },
|
1840 | });
|
1841 | }
|
1842 | var source = vm.$attrs;
|
1843 | var _loop_1 = function (attr) {
|
1844 | if (!hasOwn(attrBindings.data, attr)) {
|
1845 | proxy(attrBindings.data, attr, {
|
1846 | get: function () {
|
1847 |
|
1848 | return vm.$attrs[attr];
|
1849 | },
|
1850 | });
|
1851 | }
|
1852 | };
|
1853 | try {
|
1854 | for (var _b = __values(Object.keys(source)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1855 | var attr = _c.value;
|
1856 | _loop_1(attr);
|
1857 | }
|
1858 | }
|
1859 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
1860 | finally {
|
1861 | try {
|
1862 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1863 | }
|
1864 | finally { if (e_1) throw e_1.error; }
|
1865 | }
|
1866 | }
|
1867 | function resolveScopedSlots(vm, slotsProxy) {
|
1868 | var parentVNode = vm.$options._parentVnode;
|
1869 | if (!parentVNode)
|
1870 | return;
|
1871 | var prevSlots = vmStateManager.get(vm, 'slots') || [];
|
1872 | var curSlots = resolveSlots(parentVNode.data.scopedSlots, vm.$slots);
|
1873 |
|
1874 | for (var index = 0; index < prevSlots.length; index++) {
|
1875 | var key = prevSlots[index];
|
1876 | if (!curSlots[key]) {
|
1877 | delete slotsProxy[key];
|
1878 | }
|
1879 | }
|
1880 |
|
1881 | var slotNames = Object.keys(curSlots);
|
1882 | for (var index = 0; index < slotNames.length; index++) {
|
1883 | var key = slotNames[index];
|
1884 | if (!slotsProxy[key]) {
|
1885 | slotsProxy[key] = createSlotProxy(vm, key);
|
1886 | }
|
1887 | }
|
1888 | vmStateManager.set(vm, 'slots', slotNames);
|
1889 | }
|
1890 | function activateCurrentInstance(instance, fn, onError) {
|
1891 | var preVm = getCurrentInstance();
|
1892 | setCurrentInstance(instance);
|
1893 | try {
|
1894 | return fn(instance);
|
1895 | }
|
1896 | catch (
|
1897 |
|
1898 | err) {
|
1899 | if (onError) {
|
1900 | onError(err);
|
1901 | }
|
1902 | else {
|
1903 | throw err;
|
1904 | }
|
1905 | }
|
1906 | finally {
|
1907 | setCurrentInstance(preVm);
|
1908 | }
|
1909 | }
|
1910 |
|
1911 | function mixin(Vue) {
|
1912 | Vue.mixin({
|
1913 | beforeCreate: functionApiInit,
|
1914 | mounted: function () {
|
1915 | afterRender(this);
|
1916 | },
|
1917 | beforeUpdate: function () {
|
1918 | updateVmAttrs(this);
|
1919 | },
|
1920 | updated: function () {
|
1921 | afterRender(this);
|
1922 | },
|
1923 | });
|
1924 | |
1925 |
|
1926 |
|
1927 | function functionApiInit() {
|
1928 | var vm = this;
|
1929 | var $options = vm.$options;
|
1930 | var setup = $options.setup, render = $options.render;
|
1931 | if (render) {
|
1932 |
|
1933 | $options.render = function () {
|
1934 | var _this = this;
|
1935 | var args = [];
|
1936 | for (var _i = 0; _i < arguments.length; _i++) {
|
1937 | args[_i] = arguments[_i];
|
1938 | }
|
1939 | return activateCurrentInstance(toVue3ComponentInstance(vm), function () {
|
1940 | return render.apply(_this, args);
|
1941 | });
|
1942 | };
|
1943 | }
|
1944 | if (!setup) {
|
1945 | return;
|
1946 | }
|
1947 | if (!isFunction(setup)) {
|
1948 | if ((process.env.NODE_ENV !== 'production')) {
|
1949 | warn('The "setup" option should be a function that returns a object in component definitions.', vm);
|
1950 | }
|
1951 | return;
|
1952 | }
|
1953 | var data = $options.data;
|
1954 |
|
1955 | $options.data = function wrappedData() {
|
1956 | initSetup(vm, vm.$props);
|
1957 | return isFunction(data)
|
1958 | ? data.call(vm, vm)
|
1959 | : data || {};
|
1960 | };
|
1961 | }
|
1962 | function initSetup(vm, props) {
|
1963 | if (props === void 0) { props = {}; }
|
1964 | var setup = vm.$options.setup;
|
1965 | var ctx = createSetupContext(vm);
|
1966 | var instance = toVue3ComponentInstance(vm);
|
1967 | instance.setupContext = ctx;
|
1968 |
|
1969 | def(props, '__ob__', createObserver());
|
1970 |
|
1971 | resolveScopedSlots(vm, ctx.slots);
|
1972 | var binding;
|
1973 | activateCurrentInstance(instance, function () {
|
1974 |
|
1975 | binding = setup(props, ctx);
|
1976 | });
|
1977 | if (!binding)
|
1978 | return;
|
1979 | if (isFunction(binding)) {
|
1980 |
|
1981 | var bindingFunc_1 = binding;
|
1982 |
|
1983 | vm.$options.render = function () {
|
1984 | resolveScopedSlots(vm, ctx.slots);
|
1985 | return activateCurrentInstance(instance, function () { return bindingFunc_1(); });
|
1986 | };
|
1987 | return;
|
1988 | }
|
1989 | else if (isObject(binding)) {
|
1990 | if (isReactive(binding)) {
|
1991 | binding = toRefs(binding);
|
1992 | }
|
1993 | vmStateManager.set(vm, 'rawBindings', binding);
|
1994 | var bindingObj_1 = binding;
|
1995 | Object.keys(bindingObj_1).forEach(function (name) {
|
1996 | var bindingValue = bindingObj_1[name];
|
1997 | if (!isRef(bindingValue)) {
|
1998 | if (!isReactive(bindingValue)) {
|
1999 | if (isFunction(bindingValue)) {
|
2000 | var copy_1 = bindingValue;
|
2001 | bindingValue = bindingValue.bind(vm);
|
2002 | Object.keys(copy_1).forEach(function (ele) {
|
2003 | bindingValue[ele] = copy_1[ele];
|
2004 | });
|
2005 | }
|
2006 | else if (!isObject(bindingValue)) {
|
2007 | bindingValue = ref(bindingValue);
|
2008 | }
|
2009 | else if (hasReactiveArrayChild(bindingValue)) {
|
2010 |
|
2011 |
|
2012 | customReactive(bindingValue);
|
2013 | }
|
2014 | }
|
2015 | else if (isArray(bindingValue)) {
|
2016 | bindingValue = ref(bindingValue);
|
2017 | }
|
2018 | }
|
2019 | asVmProperty(vm, name, bindingValue);
|
2020 | });
|
2021 | return;
|
2022 | }
|
2023 | if ((process.env.NODE_ENV !== 'production')) {
|
2024 | assert(false, "\"setup\" must return a \"Object\" or a \"Function\", got \"".concat(Object.prototype.toString
|
2025 | .call(binding)
|
2026 | .slice(8, -1), "\""));
|
2027 | }
|
2028 | }
|
2029 | function customReactive(target, seen) {
|
2030 | if (seen === void 0) { seen = new Set(); }
|
2031 | if (seen.has(target))
|
2032 | return;
|
2033 | if (!isPlainObject(target) ||
|
2034 | isRef(target) ||
|
2035 | isReactive(target) ||
|
2036 | isRaw(target))
|
2037 | return;
|
2038 | var Vue = getVueConstructor();
|
2039 |
|
2040 | var defineReactive = Vue.util.defineReactive;
|
2041 | Object.keys(target).forEach(function (k) {
|
2042 | var val = target[k];
|
2043 | defineReactive(target, k, val);
|
2044 | if (val) {
|
2045 | seen.add(val);
|
2046 | customReactive(val, seen);
|
2047 | }
|
2048 | return;
|
2049 | });
|
2050 | }
|
2051 | function hasReactiveArrayChild(target, visited) {
|
2052 | if (visited === void 0) { visited = new Map(); }
|
2053 | if (visited.has(target)) {
|
2054 | return visited.get(target);
|
2055 | }
|
2056 | visited.set(target, false);
|
2057 | if (isArray(target) && isReactive(target)) {
|
2058 | visited.set(target, true);
|
2059 | return true;
|
2060 | }
|
2061 | if (!isPlainObject(target) || isRaw(target) || isRef(target)) {
|
2062 | return false;
|
2063 | }
|
2064 | return Object.keys(target).some(function (x) {
|
2065 | return hasReactiveArrayChild(target[x], visited);
|
2066 | });
|
2067 | }
|
2068 | function createSetupContext(vm) {
|
2069 | var ctx = { slots: {} };
|
2070 | var propsPlain = [
|
2071 | 'root',
|
2072 | 'parent',
|
2073 | 'refs',
|
2074 | 'listeners',
|
2075 | 'isServer',
|
2076 | 'ssrContext',
|
2077 | ];
|
2078 | var methodReturnVoid = ['emit'];
|
2079 | propsPlain.forEach(function (key) {
|
2080 | var srcKey = "$".concat(key);
|
2081 | proxy(ctx, key, {
|
2082 | get: function () { return vm[srcKey]; },
|
2083 | set: function () {
|
2084 | (process.env.NODE_ENV !== 'production') &&
|
2085 | warn("Cannot assign to '".concat(key, "' because it is a read-only property"), vm);
|
2086 | },
|
2087 | });
|
2088 | });
|
2089 | updateVmAttrs(vm, ctx);
|
2090 | methodReturnVoid.forEach(function (key) {
|
2091 | var srcKey = "$".concat(key);
|
2092 | proxy(ctx, key, {
|
2093 | get: function () {
|
2094 | return function () {
|
2095 | var args = [];
|
2096 | for (var _i = 0; _i < arguments.length; _i++) {
|
2097 | args[_i] = arguments[_i];
|
2098 | }
|
2099 | var fn = vm[srcKey];
|
2100 | fn.apply(vm, args);
|
2101 | };
|
2102 | },
|
2103 | });
|
2104 | });
|
2105 | if (process.env.NODE_ENV === 'test') {
|
2106 | ctx._vm = vm;
|
2107 | }
|
2108 | return ctx;
|
2109 | }
|
2110 | }
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 | function mergeData(from, to) {
|
2116 | if (!from)
|
2117 | return to;
|
2118 | if (!to)
|
2119 | return from;
|
2120 | var key;
|
2121 | var toVal;
|
2122 | var fromVal;
|
2123 | var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);
|
2124 | for (var i = 0; i < keys.length; i++) {
|
2125 | key = keys[i];
|
2126 |
|
2127 | if (key === '__ob__')
|
2128 | continue;
|
2129 | toVal = to[key];
|
2130 | fromVal = from[key];
|
2131 | if (!hasOwn(to, key)) {
|
2132 | to[key] = fromVal;
|
2133 | }
|
2134 | else if (toVal !== fromVal &&
|
2135 | isPlainObject(toVal) &&
|
2136 | !isRef(toVal) &&
|
2137 | isPlainObject(fromVal) &&
|
2138 | !isRef(fromVal)) {
|
2139 | mergeData(fromVal, toVal);
|
2140 | }
|
2141 | }
|
2142 | return to;
|
2143 | }
|
2144 | function install(Vue) {
|
2145 | if (isVueRegistered(Vue)) {
|
2146 | if ((process.env.NODE_ENV !== 'production')) {
|
2147 | warn('[vue-composition-api] already installed. Vue.use(VueCompositionAPI) should be called only once.');
|
2148 | }
|
2149 | return;
|
2150 | }
|
2151 | if ((process.env.NODE_ENV !== 'production')) {
|
2152 | if (Vue.version) {
|
2153 | if (Vue.version[0] !== '2' || Vue.version[1] !== '.') {
|
2154 | warn("[vue-composition-api] only works with Vue 2, v".concat(Vue.version, " found."));
|
2155 | }
|
2156 | }
|
2157 | else {
|
2158 | warn('[vue-composition-api] no Vue version found');
|
2159 | }
|
2160 | }
|
2161 | Vue.config.optionMergeStrategies.setup = function (parent, child) {
|
2162 | return function mergedSetupFn(props, context) {
|
2163 | return mergeData(isFunction(parent) ? parent(props, context) || {} : undefined, isFunction(child) ? child(props, context) || {} : undefined);
|
2164 | };
|
2165 | };
|
2166 | setVueConstructor(Vue);
|
2167 | mixin(Vue);
|
2168 | }
|
2169 | var Plugin = {
|
2170 | install: function (Vue) { return install(Vue); },
|
2171 | };
|
2172 |
|
2173 |
|
2174 | function defineComponent(options) {
|
2175 | return options;
|
2176 | }
|
2177 |
|
2178 | function defineAsyncComponent(source) {
|
2179 | if (isFunction(source)) {
|
2180 | source = { loader: source };
|
2181 | }
|
2182 | var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout,
|
2183 | _b = source.suspensible,
|
2184 | suspensible = _b === void 0 ? false : _b,
|
2185 | userOnError = source.onError;
|
2186 | if ((process.env.NODE_ENV !== 'production') && suspensible) {
|
2187 | warn("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
|
2188 | }
|
2189 | var pendingRequest = null;
|
2190 | var retries = 0;
|
2191 | var retry = function () {
|
2192 | retries++;
|
2193 | pendingRequest = null;
|
2194 | return load();
|
2195 | };
|
2196 | var load = function () {
|
2197 | var thisRequest;
|
2198 | return (pendingRequest ||
|
2199 | (thisRequest = pendingRequest =
|
2200 | loader()
|
2201 | .catch(function (err) {
|
2202 | err = err instanceof Error ? err : new Error(String(err));
|
2203 | if (userOnError) {
|
2204 | return new Promise(function (resolve, reject) {
|
2205 | var userRetry = function () { return resolve(retry()); };
|
2206 | var userFail = function () { return reject(err); };
|
2207 | userOnError(err, userRetry, userFail, retries + 1);
|
2208 | });
|
2209 | }
|
2210 | else {
|
2211 | throw err;
|
2212 | }
|
2213 | })
|
2214 | .then(function (comp) {
|
2215 | if (thisRequest !== pendingRequest && pendingRequest) {
|
2216 | return pendingRequest;
|
2217 | }
|
2218 | if ((process.env.NODE_ENV !== 'production') && !comp) {
|
2219 | warn("Async component loader resolved to undefined. " +
|
2220 | "If you are using retry(), make sure to return its return value.");
|
2221 | }
|
2222 |
|
2223 | if (comp &&
|
2224 | (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
|
2225 | comp = comp.default;
|
2226 | }
|
2227 | if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
|
2228 | throw new Error("Invalid async component load result: ".concat(comp));
|
2229 | }
|
2230 | return comp;
|
2231 | })));
|
2232 | };
|
2233 | return function () {
|
2234 | var component = load();
|
2235 | return {
|
2236 | component: component,
|
2237 | delay: delay,
|
2238 | timeout: timeout,
|
2239 | error: errorComponent,
|
2240 | loading: loadingComponent,
|
2241 | };
|
2242 | };
|
2243 | }
|
2244 |
|
2245 | var version = "1.7.2";
|
2246 |
|
2247 | if (typeof window !== 'undefined' && window.Vue) {
|
2248 | window.Vue.use(Plugin);
|
2249 | }
|
2250 |
|
2251 | export { EffectScope, computed, createApp, createRef, customRef, Plugin as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, createElement as h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set$1 as set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCSSModule, useCssModule, useSlots, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect };
|