How to use normalizeSuspenseSlot method in Playwright Internal

Best JavaScript code snippet using playwright-internal

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

note-generate-code.js

Source: note-generate-code.js Github

copy
1const FRAGMENT = Symbol( `Fragment` );
2const TELEPORT = Symbol( `Teleport` );
3const SUSPENSE = Symbol( `Suspense` );
4const KEEP_ALIVE = Symbol( `KeepAlive` );
5const BASE_TRANSITION = Symbol( `BaseTransition` );
6const OPEN_BLOCK = Symbol( `openBlock` );
7const CREATE_BLOCK = Symbol( `createBlock` );
8const CREATE_VNODE = Symbol( `createVNode` );
9const CREATE_COMMENT = Symbol( `createCommentVNode` );
10const CREATE_TEXT = Symbol( `createTextVNode` );
11const CREATE_STATIC = Symbol( `createStaticVNode` );
12const RESOLVE_COMPONENT = Symbol( `resolveComponent` );
13const RESOLVE_DYNAMIC_COMPONENT = Symbol( `resolveDynamicComponent` );
14const RESOLVE_DIRECTIVE = Symbol( `resolveDirective` );
15const WITH_DIRECTIVES = Symbol( `withDirectives` );
16const RENDER_LIST = Symbol( `renderList` );
17const RENDER_SLOT = Symbol( `renderSlot` );
18const CREATE_SLOTS = Symbol( `createSlots` );
19const TO_DISPLAY_STRING = Symbol( `toDisplayString` );
20const MERGE_PROPS = Symbol( `mergeProps` );
21const TO_HANDLERS = Symbol( `toHandlers` );
22const CAMELIZE = Symbol( `camelize` );
23const CAPITALIZE = Symbol( `capitalize` );
24const SET_BLOCK_TRACKING = Symbol( `setBlockTracking` );
25const PUSH_SCOPE_ID = Symbol( `pushScopeId` );
26const POP_SCOPE_ID = Symbol( `popScopeId` );
27const WITH_SCOPE_ID = Symbol( `withScopeId` );
28const WITH_CTX = Symbol( `withCtx` );
29
30const helperNameMap = {
31    [FRAGMENT]: `Fragment`,
32    [TELEPORT]: `Teleport`,
33    [SUSPENSE]: `Suspense`,
34    [KEEP_ALIVE]: `KeepAlive`,
35    [BASE_TRANSITION]: `BaseTransition`,
36    [OPEN_BLOCK]: `openBlock`,
37    [CREATE_BLOCK]: `createBlock`,
38    [CREATE_VNODE]: `_createVNode`,
39    [CREATE_COMMENT]: `createCommentVNode`,
40    [CREATE_TEXT]: `createTextVNode`,
41    [CREATE_STATIC]: `createStaticVNode`,
42    [RESOLVE_COMPONENT]: `resolveComponent`,
43    [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
44    [RESOLVE_DIRECTIVE]: `resolveDirective`,
45    [WITH_DIRECTIVES]: `withDirectives`,
46    [RENDER_LIST]: `renderList`,
47    [RENDER_SLOT]: `renderSlot`,
48    [CREATE_SLOTS]: `createSlots`,
49    [TO_DISPLAY_STRING]: `toDisplayString`,
50    [MERGE_PROPS]: `mergeProps`,
51    [TO_HANDLERS]: `toHandlers`,
52    [CAMELIZE]: `camelize`,
53    [CAPITALIZE]: `capitalize`,
54    [SET_BLOCK_TRACKING]: `setBlockTracking`,
55    [PUSH_SCOPE_ID]: `pushScopeId`,
56    [POP_SCOPE_ID]: `popScopeId`,
57    [WITH_SCOPE_ID]: `withScopeId`,
58    [WITH_CTX]: `withCtx`
59};
60
61const vnode = {
62    __v_isVNode: true,
63    ["__v_skip" /* SKIP */]: true,
64    type,
65    props,
66    key: props && normalizeKey(props),
67    ref: props && normalizeRef(props),
68    scopeId: currentScopeId,
69    children: null,
70    component: null,
71    suspense: null,
72    ssContent: null,
73    ssFallback: null,
74    dirs: null,
75    transition: null,
76    el: null,
77    anchor: null,
78    target: null,
79    targetAnchor: null,
80    staticCount: 0,
81    shapeFlag,
82    patchFlag,
83    dynamicProps,
84    dynamicChildren: null,
85    appContext: null
86};
87/*
88* vnode shapeFlag: 
89* 基本部分:0;1 ELEMENT; 2 FUNCTIONAL_COMPONENT; 4 STATEFUL_COMPONENT; 64 TELEPORT; 128 SUSPENSE
90* 附加部分:0; 8 parent not TELEPORT,children is string; 16 children is array or string and parent not teleport; 32 SLOTS_CHILDREN (chidlren is object && paren not (ELEMENT|TELEPORT)), children is function
91*
92*/
93const shapeFlag = isString(type)
94? 1 /* ELEMENT */
95:  isSuspense(type)
96    ? 128 /* SUSPENSE */
97    : isTeleport(type)
98        ? 64 /* TELEPORT */
99        : isObject(type)
100            ? 4 /* STATEFUL_COMPONENT */
101            : isFunction(type)
102                ? 2 /* FUNCTIONAL_COMPONENT */
103                : 0;
104
105function baseCompile(template, options = {}) {
106    const onError = options.onError || defaultOnError;
107    const isModuleMode = options.mode === 'module';
108    /* istanbul ignore if */
109    {
110        if (options.prefixIdentifiers === true) {
111            onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
112        }
113        else if (isModuleMode) {
114            onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
115        }
116    }
117    const prefixIdentifiers = !true ;
118    if ( options.cacheHandlers) {
119        onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
120    }
121    if (options.scopeId && !isModuleMode) {
122        onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
123    }
124    const ast = isString(template) ? baseParse(template, options) : template;
125    const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
126    transform(ast, extend({}, options, {
127        prefixIdentifiers,
128        nodeTransforms: [
129            ...nodeTransforms,
130            ...(options.nodeTransforms || []) // user transforms
131        ],
132        directiveTransforms: extend({}, directiveTransforms, options.directiveTransforms || {} // user transforms
133        )
134    }));
135    return generate(ast, extend({}, options, {
136        prefixIdentifiers
137    }));
138}
139
140function generate(ast, options = {}) {
141    const context = createCodegenContext(ast, options);
142    if (options.onContextCreated)
143        options.onContextCreated(context);
144    // 默认:mode = 'function'
145    // prefixIdentifiers = mode === 'module'
146    const { mode, push, prefixIdentifiers, indent, deindent, newline, scopeId, ssr } = context;
147    const hasHelpers = ast.helpers.length > 0;
148    const useWithBlock = !prefixIdentifiers && mode !== 'module';
149    // preambles
150    {
151        genFunctionPreamble(ast, context);
152    }
153    // binding optimizations
154    const optimizeSources = options.bindingMetadata
155        ? `, $props, $setup, $data, $options`
156        : ``;
157    // enter render function
158
159    // 1. 普通
160    // function render(_ctx, _cache, $props, $setup, $data, $options){。。。}
161    if (!ssr) {
162        push(`function render(_ctx, _cache${optimizeSources}) {`);
163    }
164    // 2. ssr
165    // function ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options){。。。}
166    else {
167        push(`function ssrRender(_ctx, _push, _parent, _attrs${optimizeSources}) {`);
168    }
169    indent();
170    // 默认:mode = 'function'
171    if (useWithBlock) {
172        push(`with (_ctx) {`);
173        indent();
174        // function mode const declarations should be inside with block
175        // also they should be renamed to avoid collision with user properties
176        if (hasHelpers) {
177            push(`const { ${ast.helpers
178                .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
179                .join(', ')} } = _Vue`);
180            push(`\n`);
181            newline();
182        }
183    }
184    // generate asset resolution statements
185    if (ast.components.length) {
186        genAssets(ast.components, 'component', context);
187        if (ast.directives.length || ast.temps > 0) {
188            newline();
189        }
190    }
191    if (ast.directives.length) {
192        genAssets(ast.directives, 'directive', context);
193        if (ast.temps > 0) {
194            newline();
195        }
196    }
197    if (ast.temps > 0) {
198        push(`let `);
199        for (let i = 0; i < ast.temps; i++) {
200            push(`${i > 0 ? `, ` : ``}_temp${i}`);
201        }
202    }
203    if (ast.components.length || ast.directives.length || ast.temps) {
204        push(`\n`);
205        newline();
206    }
207    // generate the VNode tree expression
208    if (!ssr) {
209        push(`return `);
210    }
211    if (ast.codegenNode) {
212        genNode(ast.codegenNode, context);
213    }
214    else {
215        push(`null`);
216    }
217    if (useWithBlock) {
218        deindent();
219        push(`}`);
220    }
221    deindent();
222    push(`}`);
223    return {
224        ast,
225        code: context.code,
226        // SourceMapGenerator does have toJSON() method but it's not in the types
227        map: context.map ? context.map.toJSON() : undefined
228    };
229}
230
231    const PURE_ANNOTATION = `/*#__PURE__*/`;
232    function createCodegenContext(ast, { 
233        mode = 'function', 
234        prefixIdentifiers = mode === 'module', 
235        sourceMap = false, 
236        filename = `template.vue.html`, 
237        scopeId = null, 
238        optimizeImports = false, 
239        runtimeGlobalName = `Vue`, 
240        runtimeModuleName = `vue`, 
241        ssr = false 
242    }) {
243        const context = {
244            mode,
245            prefixIdentifiers,
246            sourceMap,
247            filename,
248            scopeId,
249            optimizeImports,
250            runtimeGlobalName,
251            runtimeModuleName,
252            ssr,
253            source: ast.loc.source,
254            code: ``,
255            column: 1,
256            line: 1,
257            offset: 0,
258            indentLevel: 0,
259            pure: false,
260            map: undefined,
261            helper(key) {
262                return `_${helperNameMap[key]}`;
263            },
264            push(code, node) {
265                context.code += code;
266            },
267            indent() {
268                newline(++context.indentLevel);
269            },
270            deindent(withoutNewLine = false) {
271                if (withoutNewLine) {
272                    --context.indentLevel;
273                }
274                else {
275                    newline(--context.indentLevel);
276                }
277            },
278            newline() {
279                newline(context.indentLevel);
280            }
281        };
282        function newline(n) {
283            context.push('\n' + `  `.repeat(n));
284        }
285        return context;
286    }
287
288    function genFunctionPreamble(ast, context) {
289        const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
290        const VueBinding =  runtimeGlobalName;
291        const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
292        // Generate const declaration for helpers
293        // In prefix mode, we place the const declaration at top so it's done
294        // only once; But if we not prefixing, we place the declaration inside the
295        // with block so it doesn't incur the `in` check cost for every helper access.
296        if (ast.helpers.length > 0) {
297            {
298                // "with" mode.
299                // save Vue in a separate variable to avoid collision
300                push(`const _Vue = ${VueBinding}\n`);
301                // in "with" mode, helpers are declared inside the with block to avoid
302                // has check cost, but hoists are lifted out of the function - we need
303                // to provide the helper here.
304                if (ast.hoists.length) {
305                    const staticHelpers = [
306                        CREATE_VNODE,
307                        CREATE_COMMENT,
308                        CREATE_TEXT,
309                        CREATE_STATIC
310                    ]
311                        .filter(helper => ast.helpers.includes(helper))
312                        .map(aliasHelper)
313                        .join(', ');
314                    push(`const { ${staticHelpers} } = _Vue\n`);
315                }
316            }
317        }
318        genHoists(ast.hoists, context);
319        newline();
320        push(`return `);
321    }
322
323    function genAssets(assets, type, { helper, push, newline }) {
324        const resolver = helper(type === 'component' ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE);
325        for (let i = 0; i < assets.length; i++) {
326            const id = assets[i];
327            push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)})`);
328            if (i < assets.length - 1) {
329                newline();
330            }
331        }
332    }
333
334
335    function genNode(node, context) {
336        if (isString(node)) {
337            context.push(node);
338            return;
339        }
340        if (isSymbol(node)) {
341            context.push(context.helper(node));
342            return;
343        }
344        switch (node.type) {
345            case 1 /* ELEMENT */:
346            case 9 /* IF */:
347            case 11 /* FOR */:
348                
349                    assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
350                        `Apply appropriate transforms first.`);
351                genNode(node.codegenNode, context);
352                break;
353            case 2 /* TEXT */:
354                genText(node, context);
355                break;
356            case 4 /* SIMPLE_EXPRESSION */:
357                genExpression(node, context);
358                break;
359            case 5 /* INTERPOLATION */:
360                genInterpolation(node, context);
361                break;
362            case 12 /* TEXT_CALL */:
363                genNode(node.codegenNode, context);
364                break;
365            case 8 /* COMPOUND_EXPRESSION */:
366                genCompoundExpression(node, context);
367                break;
368            case 3 /* COMMENT */:
369                genComment(node, context);
370                break;
371            /**
372             * 
373             * 1.root, children > 1; 
374             * 2. children.length !== 1 || firstChild.type !== 1  ELEMENT  && (children.length !== 1 || firstChild.type !== 11 fornode )
375             * 3.fornode
376             * 4.postTransformElement
377             */
378            case 13 /* VNODE_CALL */:
379                genVNodeCall(node, context);
380                break;
381            case 14 /* JS_CALL_EXPRESSION */:
382                genCallExpression(node, context);
383                break;
384            case 15 /* JS_OBJECT_EXPRESSION */:
385                genObjectExpression(node, context);
386                break;
387            case 17 /* JS_ARRAY_EXPRESSION */:
388                genArrayExpression(node, context);
389                break;
390            case 18 /* JS_FUNCTION_EXPRESSION */:
391                genFunctionExpression(node, context);
392                break;
393            case 19 /* JS_CONDITIONAL_EXPRESSION */:
394                genConditionalExpression(node, context);
395                break;
396            case 20 /* JS_CACHE_EXPRESSION */:
397                genCacheExpression(node, context);
398                break;
399            // SSR only types
400            case 21 /* JS_BLOCK_STATEMENT */:
401                break;
402            case 22 /* JS_TEMPLATE_LITERAL */:
403                break;
404            case 23 /* JS_IF_STATEMENT */:
405                break;
406            case 24 /* JS_ASSIGNMENT_EXPRESSION */:
407                break;
408            case 25 /* JS_SEQUENCE_EXPRESSION */:
409                break;
410            case 26 /* JS_RETURN_STATEMENT */:
411                break;
412            /* istanbul ignore next */
413            case 10 /* IF_BRANCH */:
414                // noop
415                break;
416            default:
417                {
418                    assert(false, `unhandled codegen node type: ${node.type}`);
419                    // make sure we exhaust all possible types
420                    const exhaustiveCheck = node;
421                    return exhaustiveCheck;
422                }
423        }
424    }
425
426            function genText(node, context) {
427                context.push(JSON.stringify(node.content), node);
428            }
429            function genExpression(node, context) {
430                const { content, isStatic } = node;
431                context.push(isStatic ? JSON.stringify(content) : content, node);
432            }
433            function genInterpolation(node, context) {
434                const { push, helper, pure } = context;
435                if (pure)
436                    push(PURE_ANNOTATION);
437                push(`${helper(TO_DISPLAY_STRING)}(`);
438                genNode(node.content, context);
439                push(`)`);
440            }
441            function genCompoundExpression(node, context) {
442                for (let i = 0; i < node.children.length; i++) {
443                    const child = node.children[i];
444                    if (isString(child)) {
445                        context.push(child);
446                    }
447                    else {
448                        genNode(child, context);
449                    }
450                }
451            }
452            function genExpressionAsPropertyKey(node, context) {
453                const { push } = context;
454                if (node.type === 8 /* COMPOUND_EXPRESSION */) {
455                    push(`[`);
456                    genCompoundExpression(node, context);
457                    push(`]`);
458                }
459                else if (node.isStatic) {
460                    // only quote keys if necessary
461                    const text = isSimpleIdentifier(node.content)
462                        ? node.content
463                        : JSON.stringify(node.content);
464                    push(text, node);
465                }
466                else {
467                    push(`[${node.content}]`, node);
468                }
469            }
470            function genComment(node, context) {
471                {
472                    const { push, helper, pure } = context;
473                    if (pure) {
474                        push(PURE_ANNOTATION);
475                    }
476                    push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
477                }
478            }
479            function genVNodeCall(node, context) {
480                const { push, helper, pure } = context;
481                const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking } = node;
482                if (directives) {
483                    push(helper(WITH_DIRECTIVES) + `(`);
484                }
485                if (isBlock) {
486                    push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
487                }
488                if (pure) {
489                    push(PURE_ANNOTATION);
490                }
491                push(helper(isBlock ? CREATE_BLOCK : CREATE_VNODE) + `(`, node);
492                genNodeList(genNullableArgs([tag, props, children, patchFlag, dynamicProps]), context);
493                push(`)`);
494                if (isBlock) {
495                    push(`)`);
496                }
497                if (directives) {
498                    push(`, `);
499                    genNode(directives, context);
500                    push(`)`);
501                }
502            }
503                    /**
504                     * Adds directives to a VNode.
505                     */
506                    function withDirectives(vnode, directives) {
507                        const internalInstance = currentRenderingInstance;
508                        if (internalInstance === null) {
509                            warn(`withDirectives can only be used inside render functions.`);
510                            return vnode;
511                        }
512                        const instance = internalInstance.proxy;
513                        const bindings = vnode.dirs || (vnode.dirs = []);
514                        for (let i = 0; i < directives.length; i++) {
515                            let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
516                            if (isFunction(dir)) {
517                                dir = {
518                                    mounted: dir,
519                                    updated: dir
520                                };
521                            }
522                            bindings.push({
523                                dir,
524                                instance,
525                                value,
526                                oldValue: void 0,
527                                arg,
528                                modifiers
529                            });
530                        }
531                        return vnode;
532                    }
533
534                    /**
535                     * Create a block root vnode. Takes the same exact arguments as `createVNode`.
536                     * A block root keeps track of dynamic nodes within the block in the
537                     * `dynamicChildren` array.
538                     *
539                     * @private
540                     */
541                    function createBlock(type, props, children, patchFlag, dynamicProps) {
542                        const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);
543                        // save current block children on the block vnode
544                        vnode.dynamicChildren = currentBlock || EMPTY_ARR;
545                        // close block
546                        closeBlock();
547                        // a block is always going to be patched, so track it as a child of its
548                        // parent block
549                        if (shouldTrack$1 > 0 && currentBlock) {
550                            currentBlock.push(vnode);
551                        }
552                        return vnode;
553                    }
554
555                    const createVNodeWithArgsTransform = (...args) => {
556                        return _createVNode(...(vnodeArgsTransformer
557                            ? vnodeArgsTransformer(args, currentRenderingInstance)
558                            : args));
559                    };
560
561                    function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
562                        if (!type || type === NULL_DYNAMIC_COMPONENT) {
563                            if ( !type) {
564                                warn(`Invalid vnode type when creating vnode: ${type}.`);
565                            }
566                            type = Comment;
567                        }
568                        if (isVNode(type)) {
569                            // createVNode receiving an existing vnode. This happens in cases like
570                            // <component :is="vnode"/>
571                            // #2078 make sure to merge refs during the clone instead of overwriting it
572                            const cloned = cloneVNode(type, props, true /* mergeRef: true */);
573                            if (children) {
574                                normalizeChildren(cloned, children);
575                            }
576                            return cloned;
577                        }
578                        // class component normalization.
579                        if (isClassComponent(type)) {
580                            type = type.__vccOpts;
581                        }
582                        // class & style normalization.
583                        if (props) {
584                            // for reactive or proxy objects, we need to clone it to enable mutation.
585                            if (isProxy(props) || InternalObjectKey in props) {
586                                props = extend({}, props);
587                            }
588                            let { class: klass, style } = props;
589                            if (klass && !isString(klass)) {
590                                props.class = normalizeClass(klass);
591                            }
592                            if (isObject(style)) {
593                                // reactive state objects need to be cloned since they are likely to be
594                                // mutated
595                                if (isProxy(style) && !isArray(style)) {
596                                    style = extend({}, style);
597                                }
598                                props.style = normalizeStyle(style);
599                            }
600                        }
601                        // encode the vnode type information into a bitmap
602                        const shapeFlag = isString(type)
603                            ? 1 /* ELEMENT */
604                            :  isSuspense(type)
605                                ? 128 /* SUSPENSE */
606                                : isTeleport(type)
607                                    ? 64 /* TELEPORT */
608                                    : isObject(type)
609                                        ? 4 /* STATEFUL_COMPONENT */
610                                        : isFunction(type)
611                                            ? 2 /* FUNCTIONAL_COMPONENT */
612                                            : 0;
613                        if ( shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
614                            type = toRaw(type);
615                            warn(`Vue received a Component which was made a reactive object. This can ` +
616                                `lead to unnecessary performance overhead, and should be avoided by ` +
617                                `marking the component with \`markRaw\` or using \`shallowRef\` ` +
618                                `instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
619                        }
620                        const vnode = {
621                            __v_isVNode: true,
622                            ["__v_skip" /* SKIP */]: true,
623                            type,
624                            props,
625                            key: props && normalizeKey(props),
626                            ref: props && normalizeRef(props),
627                            scopeId: currentScopeId,
628                            children: null,
629                            component: null,
630                            suspense: null,
631                            ssContent: null,
632                            ssFallback: null,
633                            dirs: null,
634                            transition: null,
635                            el: null,
636                            anchor: null,
637                            target: null,
638                            targetAnchor: null,
639                            staticCount: 0,
640                            shapeFlag,
641                            patchFlag,
642                            dynamicProps,
643                            dynamicChildren: null,
644                            appContext: null
645                        };
646                        // validate key
647                        if ( vnode.key !== vnode.key) {
648                            warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
649                        }
650                        normalizeChildren(vnode, children);
651                        // normalize suspense children
652                        if ( shapeFlag & 128 /* SUSPENSE */) {
653                            const { content, fallback } = normalizeSuspenseChildren(vnode);
654                            vnode.ssContent = content;
655                            vnode.ssFallback = fallback;
656                        }
657                        if (shouldTrack$1 > 0 &&
658                            // avoid a block node from tracking itself
659                            !isBlockNode &&
660                            // has current parent block
661                            currentBlock &&
662                            // presence of a patch flag indicates this node needs patching on updates.
663                            // component nodes also should always be patched, because even if the
664                            // component doesn't need to update, it needs to persist the instance on to
665                            // the next vnode so that it can be properly unmounted later.
666                            (patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
667                            // the EVENTS flag is only for hydration and if it is the only flag, the
668                            // vnode should not be considered dynamic due to handler caching.
669                            patchFlag !== 32 /* HYDRATE_EVENTS */) {
670                            currentBlock.push(vnode);
671                        }
672                        return vnode;
673                    }
674
675                        function normalizeChildren(vnode, children) {
676                            let type = 0;
677                            const { shapeFlag } = vnode;
678                            if (children == null) {
679                                children = null;
680                            }
681                            else if (isArray(children)) {
682                                type = 16 /* ARRAY_CHILDREN */;
683                            }
684                            else if (typeof children === 'object') {
685                                if (shapeFlag & 1 /* ELEMENT */ || shapeFlag & 64 /* TELEPORT */) {
686                                    // Normalize slot to plain children for plain element and Teleport
687                                    const slot = children.default;
688                                    if (slot) {
689                                        // _c marker is added by withCtx() indicating this is a compiled slot
690                                        slot._c && setCompiledSlotRendering(1);
691                                        normalizeChildren(vnode, slot());
692                                        slot._c && setCompiledSlotRendering(-1);
693                                    }
694                                    return;
695                                }
696                                else {
697                                    type = 32 /* SLOTS_CHILDREN */;
698                                    const slotFlag = children._;
699                                    if (!slotFlag && !(InternalObjectKey in children)) {
700                                        children._ctx = currentRenderingInstance;
701                                    }
702                                    else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
703                                        // a child component receives forwarded slots from the parent.
704                                        // its slot type is determined by its parent's slot type.
705                                        if (currentRenderingInstance.vnode.patchFlag & 1024 /* DYNAMIC_SLOTS */) {
706                                            children._ = 2 /* DYNAMIC */;
707                                            vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
708                                        }
709                                        else {
710                                            children._ = 1 /* STABLE */;
711                                        }
712                                    }
713                                }
714                            }
715                            else if (isFunction(children)) {
716                                children = { default: children, _ctx: currentRenderingInstance };
717                                type = 32 /* SLOTS_CHILDREN */;
718                            }
719                            else {
720                                children = String(children);
721                                // force teleport children to array so it can be moved around
722                                if (shapeFlag & 64 /* TELEPORT */) {
723                                    type = 16 /* ARRAY_CHILDREN */;
724                                    children = [createTextVNode(children)];
725                                }
726                                else {
727                                    type = 8 /* TEXT_CHILDREN */;
728                                }
729                            }
730                            vnode.children = children;
731                            vnode.shapeFlag |= type;
732                        }
733
734                        function normalizeSuspenseChildren(vnode) {
735                            const { shapeFlag, children } = vnode;
736                            let content;
737                            let fallback;
738                            if (shapeFlag & 32 /* SLOTS_CHILDREN */) {
739                                content = normalizeSuspenseSlot(children.default);
740                                fallback = normalizeSuspenseSlot(children.fallback);
741                            }
742                            else {
743                                content = normalizeSuspenseSlot(children);
744                                fallback = normalizeVNode(null);
745                            }
746                            return {
747                                content,
748                                fallback
749                            };
750                        }
751                            function normalizeVNode(child) {
752                                if (child == null || typeof child === 'boolean') {
753                                    // empty placeholder
754                                    return createVNode(Comment);
755                                }
756                                else if (isArray(child)) {
757                                    // fragment
758                                    return createVNode(Fragment, null, child);
759                                }
760                                else if (typeof child === 'object') {
761                                    // already vnode, this should be the most common since compiled templates
762                                    // always produce all-vnode children arrays
763                                    return child.el === null ? child : cloneVNode(child);
764                                }
765                                else {
766                                    // strings and numbers
767                                    return createVNode(Text, null, String(child));
768                                }
769                            }
770                            function normalizeSuspenseSlot(s) {
771                                if (isFunction(s)) {
772                                    s = s();
773                                }
774                                if (isArray(s)) {
775                                    const singleChild = filterSingleRoot(s);
776                                    if ( !singleChild) {
777                                        warn(`<Suspense> slots expect a single root node.`);
778                                    }
779                                    s = singleChild;
780                                }
781                                return normalizeVNode(s);
782                            }
783                           function filterSingleRoot(children) {
784                               const filtered = children.filter(child => {
785                                   return !(isVNode(child) &&
786                                       child.type === Comment &&
787                                       child.children !== 'v-if');
788                               });
789                               return filtered.length === 1 && isVNode(filtered[0]) ? filtered[0] : null;
790                           }
791
792            function genNodeList(nodes, context, multilines = false, comma = true) {
793                const { push, newline } = context;
794                for (let i = 0; i < nodes.length; i++) {
795                    const node = nodes[i];
796                    if (isString(node)) {
797                        push(node);
798                    }
799                    else if (isArray(node)) {
800                        genNodeListAsArray(node, context);
801                    }
802                    else {
803                        genNode(node, context);
804                    }
805                    if (i < nodes.length - 1) {
806                        if (multilines) {
807                            comma && push(',');
808                            newline();
809                        }
810                        else {
811                            comma && push(', ');
812                        }
813                    }
814                }
815            }
816            function genNullableArgs(args) {
817                let i = args.length;
818                while (i--) {
819                    if (args[i] != null)
820                        break;
821                }
822                return args.slice(0, i + 1).map(arg => arg || `null`);
823            }
824            // JavaScript
825            function genCallExpression(node, context) {
826                const { push, helper, pure } = context;
827                const callee = isString(node.callee) ? node.callee : helper(node.callee);
828                if (pure) {
829                    push(PURE_ANNOTATION);
830                }
831                push(callee + `(`, node);
832                genNodeList(node.arguments, context);
833                push(`)`);
834            }
835            function genObjectExpression(node, context) {
836                const { push, indent, deindent, newline } = context;
837                const { properties } = node;
838                if (!properties.length) {
839                    push(`{}`, node);
840                    return;
841                }
842                const multilines = properties.length > 1 ||
843                    (
844                        properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
845                push(multilines ? `{` : `{ `);
846                multilines && indent();
847                for (let i = 0; i < properties.length; i++) {
848                    const { key, value } = properties[i];
849                    // key
850                    genExpressionAsPropertyKey(key, context);
851                    push(`: `);
852                    // value
853                    genNode(value, context);
854                    if (i < properties.length - 1) {
855                        // will only reach this if it's multilines
856                        push(`,`);
857                        newline();
858                    }
859                }
860                multilines && deindent();
861                push(multilines ? `}` : ` }`);
862            }
863            function genArrayExpression(node, context) {
864                genNodeListAsArray(node.elements, context);
865            }
866                function genNodeListAsArray(nodes, context) {
867                    const multilines = nodes.length > 3 ||
868                        ( nodes.some(n => isArray(n) || !isText$1(n)));
869                    context.push(`[`);
870                    multilines && context.indent();
871                    genNodeList(nodes, context, multilines);
872                    multilines && context.deindent();
873                    context.push(`]`);
874                }
875            function genFunctionExpression(node, context) {
876                const { push, indent, deindent, scopeId, mode } = context;
877                const { params, returns, body, newline, isSlot } = node;
878                if (isSlot) {
879                    push(`_${helperNameMap[WITH_CTX]}(`);
880                }
881                push(`(`, node);
882                if (isArray(params)) {
883                    genNodeList(params, context);
884                }
885                else if (params) {
886                    genNode(params, context);
887                }
888                push(`) => `);
889                if (newline || body) {
890                    push(`{`);
891                    indent();
892                }
893                if (returns) {
894                    if (newline) {
895                        push(`return `);
896                    }
897                    if (isArray(returns)) {
898                        genNodeListAsArray(returns, context);
899                    }
900                    else {
901                        genNode(returns, context);
902                    }
903                }
904                else if (body) {
905                    genNode(body, context);
906                }
907                if (newline || body) {
908                    deindent();
909                    push(`}`);
910                }
911                if ( isSlot) {
912                    push(`)`);
913                }
914            }
915            function genConditionalExpression(node, context) {
916                const { test, consequent, alternate, newline: needNewline } = node;
917                const { push, indent, deindent, newline } = context;
918                if (test.type === 4 /* SIMPLE_EXPRESSION */) {
919                    const needsParens = !isSimpleIdentifier(test.content);
920                    needsParens && push(`(`);
921                    genExpression(test, context);
922                    needsParens && push(`)`);
923                }
924                else {
925                    push(`(`);
926                    genNode(test, context);
927                    push(`)`);
928                }
929                needNewline && indent();
930                context.indentLevel++;
931                needNewline || push(` `);
932                push(`? `);
933                genNode(consequent, context);
934                context.indentLevel--;
935                needNewline && newline();
936                needNewline || push(` `);
937                push(`: `);
938                const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
939                if (!isNested) {
940                    context.indentLevel++;
941                }
942                genNode(alternate, context);
943                if (!isNested) {
944                    context.indentLevel--;
945                }
946                needNewline && deindent(true /* without newline */);
947            }
948            function genCacheExpression(node, context) {
949                const { push, helper, indent, deindent, newline } = context;
950                push(`_cache[${node.index}] || (`);
951                if (node.isVNode) {
952                    indent();
953                    push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
954                    newline();
955                }
956                push(`_cache[${node.index}] = `);
957                genNode(node.value, context);
958                if (node.isVNode) {
959                    push(`,`);
960                    newline();
961                    push(`${helper(SET_BLOCK_TRACKING)}(1),`);
962                    newline();
963                    push(`_cache[${node.index}]`);
964                    deindent();
965                }
966                push(`)`);
967            }
968/**
969 * block tracking 机制
970 */
971
972// Since v-if and v-for are the two possible ways node structure can dynamically
973// change, once we consider v-if branches and each v-for fragment a block, we
974// can divide a template into nested blocks, and within each block the node
975// structure would be stable. This allows us to skip most children diffing
976// and only worry about the dynamic nodes (indicated by patch flags).
977const blockStack = [];
978let currentBlock = null;
979/**
980 * Open a block.
981 * This must be called before `createBlock`. It cannot be part of `createBlock`
982 * because the children of the block are evaluated before `createBlock` itself
983 * is called. The generated code typically looks like this:
984 *
985 * ```js
986 * function render() {
987 *   return (openBlock(),createBlock('div', null, [...]))
988 * }
989 * ```
990 * disableTracking is true when creating a v-for fragment block, since a v-for
991 * fragment always diffs its children.
992 *
993 * @private
994 */
995function openBlock(disableTracking = false) {
996    blockStack.push((currentBlock = disableTracking ? null : []));
997}
998function closeBlock() {
999    blockStack.pop();
1000    currentBlock = blockStack[blockStack.length - 1] || null;
1001}
1002
1003/**
1004 * Create a block root vnode. Takes the same exact arguments as `createVNode`.
1005 * A block root keeps track of dynamic nodes within the block in the
1006 * `dynamicChildren` array.
1007 *
1008 * @private
1009 */
1010// createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false)
1011function createBlock(type, props, children, patchFlag, dynamicProps) {
1012    const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);
1013    // save current block children on the block vnode
1014    vnode.dynamicChildren = currentBlock || EMPTY_ARR;
1015    // close block
1016    closeBlock();
1017    // a block is always going to be patched, so track it as a child of its
1018    // parent block
1019    if (shouldTrack$1 > 0 && currentBlock) {
1020        currentBlock.push(vnode);
1021    }
1022    return vnode;
1023}
1024
1025
1026// Whether we should be tracking dynamic child nodes inside a block.
1027// Only tracks when this value is > 0
1028// We are not using a simple boolean because this value may need to be
1029// incremented/decremented by nested usage of v-once (see below)
1030let shouldTrack$1 = 1;
1031/**
1032 * Block tracking sometimes needs to be disabled, for example during the
1033 * creation of a tree that needs to be cached by v-once. The compiler generates
1034 * code like this:
1035 *
1036 * ``` js
1037 * _cache[1] || (
1038 *   setBlockTracking(-1),
1039 *   _cache[1] = createVNode(...),
1040 *   setBlockTracking(1),
1041 *   _cache[1]
1042 * )
1043 * ```
1044 *
1045 * @private
1046 */
1047function setBlockTracking(value) {
1048    shouldTrack$1 += value;
1049}
1050
1051
1052var runtimeDom = /*#__PURE__*/Object.freeze({
1053    __proto__: null,
1054    render: render,
1055    hydrate: hydrate,
1056    createApp: createApp,
1057    createSSRApp: createSSRApp,
1058    useCssModule: useCssModule,
1059    useCssVars: useCssVars,
1060    Transition: Transition,
1061    TransitionGroup: TransitionGroup,
1062    vModelText: vModelText,
1063    vModelCheckbox: vModelCheckbox,
1064    vModelRadio: vModelRadio,
1065    vModelSelect: vModelSelect,
1066    vModelDynamic: vModelDynamic,
1067    withModifiers: withModifiers,
1068    withKeys: withKeys,
1069    vShow: vShow,
1070    reactive: reactive,
1071    ref: ref,
1072    readonly: readonly,
1073    unref: unref,
1074    proxyRefs: proxyRefs,
1075    isRef: isRef,
1076    toRef: toRef,
1077    toRefs: toRefs,
1078    isProxy: isProxy,
1079    isReactive: isReactive,
1080    isReadonly: isReadonly,
1081    customRef: customRef,
1082    triggerRef: triggerRef,
1083    shallowRef: shallowRef,
1084    shallowReactive: shallowReactive,
1085    shallowReadonly: shallowReadonly,
1086    markRaw: markRaw,
1087    toRaw: toRaw,
1088    computed: computed$1,
1089    watch: watch,
1090    watchEffect: watchEffect,
1091    onBeforeMount: onBeforeMount,
1092    onMounted: onMounted,
1093    onBeforeUpdate: onBeforeUpdate,
1094    onUpdated: onUpdated,
1095    onBeforeUnmount: onBeforeUnmount,
1096    onUnmounted: onUnmounted,
1097    onActivated: onActivated,
1098    onDeactivated: onDeactivated,
1099    onRenderTracked: onRenderTracked,
1100    onRenderTriggered: onRenderTriggered,
1101    onErrorCaptured: onErrorCaptured,
1102    provide: provide,
1103    inject: inject,
1104    nextTick: nextTick,
1105    defineComponent: defineComponent,
1106    defineAsyncComponent: defineAsyncComponent,
1107    getCurrentInstance: getCurrentInstance,
1108    h: h,
1109    createVNode: createVNode,
1110    cloneVNode: cloneVNode,
1111    mergeProps: mergeProps,
1112    isVNode: isVNode,
1113    Fragment: Fragment,
1114    Text: Text,
1115    Comment: Comment,
1116    Static: Static,
1117    Teleport: Teleport,
1118    Suspense: Suspense,
1119    KeepAlive: KeepAlive,
1120    BaseTransition: BaseTransition,
1121    withDirectives: withDirectives,
1122    useSSRContext: useSSRContext,
1123    ssrContextKey: ssrContextKey,
1124    createRenderer: createRenderer,
1125    createHydrationRenderer: createHydrationRenderer,
1126    queuePostFlushCb: queuePostFlushCb,
1127    warn: warn,
1128    handleError: handleError,
1129    callWithErrorHandling: callWithErrorHandling,
1130    callWithAsyncErrorHandling: callWithAsyncErrorHandling,
1131    resolveComponent: resolveComponent,
1132    resolveDirective: resolveDirective,
1133    resolveDynamicComponent: resolveDynamicComponent,
1134    registerRuntimeCompiler: registerRuntimeCompiler,
1135    useTransitionState: useTransitionState,
1136    resolveTransitionHooks: resolveTransitionHooks,
1137    setTransitionHooks: setTransitionHooks,
1138    getTransitionRawChildren: getTransitionRawChildren,
1139    get devtools () { return devtools; },
1140    setDevtoolsHook: setDevtoolsHook,
1141    withCtx: withCtx,
1142    renderList: renderList,
1143    toHandlers: toHandlers,
1144    renderSlot: renderSlot,
1145    createSlots: createSlots,
1146    pushScopeId: pushScopeId,
1147    popScopeId: popScopeId,
1148    withScopeId: withScopeId,
1149    openBlock: openBlock,
1150    createBlock: createBlock,
1151    setBlockTracking: setBlockTracking,
1152    createTextVNode: createTextVNode,
1153    createCommentVNode: createCommentVNode,
1154    createStaticVNode: createStaticVNode,
1155    toDisplayString: toDisplayString,
1156    camelize: camelize,
1157    capitalize: capitalize,
1158    transformVNodeArgs: transformVNodeArgs,
1159    version: version,
1160    ssrUtils: ssrUtils
1161  });
1162function compileToFunction(template, options) {
1163    if (!isString(template)) {
1164        if (template.nodeType) {
1165            template = template.innerHTML;
1166        }
1167        else {
1168             warn(`invalid template option: `, template);
1169            return NOOP;
1170        }
1171    }
1172    const key = template;
1173    const cached = compileCache[key];
1174    if (cached) {
1175        return cached;
1176    }
1177    if (template[0] === '#') {
1178        const el = document.querySelector(template);
1179        if ( !el) {
1180            warn(`Template element not found or is empty: ${template}`);
1181        }
1182        // __UNSAFE__
1183        // Reason: potential execution of JS expressions in in-DOM template.
1184        // The user must make sure the in-DOM template is trusted. If it's rendered
1185        // by the server, the template should not contain any user data.
1186        template = el ? el.innerHTML : ``;
1187    }
1188    const { code } = compile$1(template, extend({
1189        hoistStatic: true,
1190        onError(err) {
1191            {
1192                const message = `Template compilation error: ${err.message}`;
1193                const codeFrame = err.loc &&
1194                    generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
1195                warn(codeFrame ? `${message}\n${codeFrame}` : message);
1196            }
1197        }
1198    }, options));
1199    // The wildcard import results in a huge object with every export
1200    // with keys that cannot be mangled, and can be quite heavy size-wise.
1201    // In the global build we know `Vue` is available globally so we can avoid
1202    // the wildcard object.
1203    const render = ( new Function('Vue', code)(runtimeDom));
1204    render._rc = true;
1205    return (compileCache[key] = render);
1206}
Full Screen

browser.js

Source: browser.js Github

copy
1(function () {
2  'use strict';
3
4  var script = {
5    components: { },
6    props: {},
7    data: function() {
8      return {};
9    },
10    computed: {},
11    watch: {},
12    created: function() {},
13    mounted: function() {},
14    methods: {},
15  };
16
17  /**
18   * Make a map and return a function for checking if a key
19   * is in that map.
20   * IMPORTANT: all calls of this function must be prefixed with
21   * \/\*#\_\_PURE\_\_\*\/
22   * So that rollup can tree-shake them if necessary.
23   */
24  function makeMap(str, expectsLowerCase) {
25      const map = Object.create(null);
26      const list = str.split(',');
27      for (let i = 0; i < list.length; i++) {
28          map[list[i]] = true;
29      }
30      return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
31  }
32
33  const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
34      'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
35      'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
36  const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
37
38  function normalizeStyle(value) {
39      if (isArray(value)) {
40          const res = {};
41          for (let i = 0; i < value.length; i++) {
42              const item = value[i];
43              const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
44              if (normalized) {
45                  for (const key in normalized) {
46                      res[key] = normalized[key];
47                  }
48              }
49          }
50          return res;
51      }
52      else if (isObject(value)) {
53          return value;
54      }
55  }
56  const listDelimiterRE = /;(?![^(]*\))/g;
57  const propertyDelimiterRE = /:(.+)/;
58  function parseStringStyle(cssText) {
59      const ret = {};
60      cssText.split(listDelimiterRE).forEach(item => {
61          if (item) {
62              const tmp = item.split(propertyDelimiterRE);
63              tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
64          }
65      });
66      return ret;
67  }
68  function normalizeClass(value) {
69      let res = '';
70      if (isString(value)) {
71          res = value;
72      }
73      else if (isArray(value)) {
74          for (let i = 0; i < value.length; i++) {
75              const normalized = normalizeClass(value[i]);
76              if (normalized) {
77                  res += normalized + ' ';
78              }
79          }
80      }
81      else if (isObject(value)) {
82          for (const name in value) {
83              if (value[name]) {
84                  res += name + ' ';
85              }
86          }
87      }
88      return res.trim();
89  }
90  const EMPTY_OBJ = {};
91  const EMPTY_ARR = [];
92  const NOOP = () => { };
93  const onRE = /^on[^a-z]/;
94  const isOn = (key) => onRE.test(key);
95  const extend = Object.assign;
96  const remove = (arr, el) => {
97      const i = arr.indexOf(el);
98      if (i > -1) {
99          arr.splice(i, 1);
100      }
101  };
102  const hasOwnProperty = Object.prototype.hasOwnProperty;
103  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
104  const isArray = Array.isArray;
105  const isMap = (val) => toTypeString(val) === '[object Map]';
106  const isSet = (val) => toTypeString(val) === '[object Set]';
107  const isFunction = (val) => typeof val === 'function';
108  const isString = (val) => typeof val === 'string';
109  const isSymbol = (val) => typeof val === 'symbol';
110  const isObject = (val) => val !== null && typeof val === 'object';
111  const isPromise = (val) => {
112      return isObject(val) && isFunction(val.then) && isFunction(val.catch);
113  };
114  const objectToString = Object.prototype.toString;
115  const toTypeString = (value) => objectToString.call(value);
116  const toRawType = (value) => {
117      // extract "RawType" from strings like "[object RawType]"
118      return toTypeString(value).slice(8, -1);
119  };
120  const isIntegerKey = (key) => isString(key) &&
121      key !== 'NaN' &&
122      key[0] !== '-' &&
123      '' + parseInt(key, 10) === key;
124  // compare whether a value has changed, accounting for NaN.
125  const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
126
127  const targetMap = new WeakMap();
128  const effectStack = [];
129  let activeEffect;
130  const ITERATE_KEY = Symbol('');
131  const MAP_KEY_ITERATE_KEY = Symbol('');
132  function isEffect(fn) {
133      return fn && fn._isEffect === true;
134  }
135  function effect(fn, options = EMPTY_OBJ) {
136      if (isEffect(fn)) {
137          fn = fn.raw;
138      }
139      const effect = createReactiveEffect(fn, options);
140      if (!options.lazy) {
141          effect();
142      }
143      return effect;
144  }
145  function stop(effect) {
146      if (effect.active) {
147          cleanup(effect);
148          if (effect.options.onStop) {
149              effect.options.onStop();
150          }
151          effect.active = false;
152      }
153  }
154  let uid = 0;
155  function createReactiveEffect(fn, options) {
156      const effect = function reactiveEffect() {
157          if (!effect.active) {
158              return options.scheduler ? undefined : fn();
159          }
160          if (!effectStack.includes(effect)) {
161              cleanup(effect);
162              try {
163                  enableTracking();
164                  effectStack.push(effect);
165                  activeEffect = effect;
166                  return fn();
167              }
168              finally {
169                  effectStack.pop();
170                  resetTracking();
171                  activeEffect = effectStack[effectStack.length - 1];
172              }
173          }
174      };
175      effect.id = uid++;
176      effect.allowRecurse = !!options.allowRecurse;
177      effect._isEffect = true;
178      effect.active = true;
179      effect.raw = fn;
180      effect.deps = [];
181      effect.options = options;
182      return effect;
183  }
184  function cleanup(effect) {
185      const { deps } = effect;
186      if (deps.length) {
187          for (let i = 0; i < deps.length; i++) {
188              deps[i].delete(effect);
189          }
190          deps.length = 0;
191      }
192  }
193  let shouldTrack = true;
194  const trackStack = [];
195  function pauseTracking() {
196      trackStack.push(shouldTrack);
197      shouldTrack = false;
198  }
199  function enableTracking() {
200      trackStack.push(shouldTrack);
201      shouldTrack = true;
202  }
203  function resetTracking() {
204      const last = trackStack.pop();
205      shouldTrack = last === undefined ? true : last;
206  }
207  function track(target, type, key) {
208      if (!shouldTrack || activeEffect === undefined) {
209          return;
210      }
211      let depsMap = targetMap.get(target);
212      if (!depsMap) {
213          targetMap.set(target, (depsMap = new Map()));
214      }
215      let dep = depsMap.get(key);
216      if (!dep) {
217          depsMap.set(key, (dep = new Set()));
218      }
219      if (!dep.has(activeEffect)) {
220          dep.add(activeEffect);
221          activeEffect.deps.push(dep);
222      }
223  }
224  function trigger(target, type, key, newValue, oldValue, oldTarget) {
225      const depsMap = targetMap.get(target);
226      if (!depsMap) {
227          // never been tracked
228          return;
229      }
230      const effects = new Set();
231      const add = (effectsToAdd) => {
232          if (effectsToAdd) {
233              effectsToAdd.forEach(effect => {
234                  if (effect !== activeEffect || effect.allowRecurse) {
235                      effects.add(effect);
236                  }
237              });
238          }
239      };
240      if (type === "clear" /* CLEAR */) {
241          // collection being cleared
242          // trigger all effects for target
243          depsMap.forEach(add);
244      }
245      else if (key === 'length' && isArray(target)) {
246          depsMap.forEach((dep, key) => {
247              if (key === 'length' || key >= newValue) {
248                  add(dep);
249              }
250          });
251      }
252      else {
253          // schedule runs for SET | ADD | DELETE
254          if (key !== void 0) {
255              add(depsMap.get(key));
256          }
257          // also run for iteration key on ADD | DELETE | Map.SET
258          switch (type) {
259              case "add" /* ADD */:
260                  if (!isArray(target)) {
261                      add(depsMap.get(ITERATE_KEY));
262                      if (isMap(target)) {
263                          add(depsMap.get(MAP_KEY_ITERATE_KEY));
264                      }
265                  }
266                  else if (isIntegerKey(key)) {
267                      // new index added to array -> length changes
268                      add(depsMap.get('length'));
269                  }
270                  break;
271              case "delete" /* DELETE */:
272                  if (!isArray(target)) {
273                      add(depsMap.get(ITERATE_KEY));
274                      if (isMap(target)) {
275                          add(depsMap.get(MAP_KEY_ITERATE_KEY));
276                      }
277                  }
278                  break;
279              case "set" /* SET */:
280                  if (isMap(target)) {
281                      add(depsMap.get(ITERATE_KEY));
282                  }
283                  break;
284          }
285      }
286      const run = (effect) => {
287          if (effect.options.scheduler) {
288              effect.options.scheduler(effect);
289          }
290          else {
291              effect();
292          }
293      };
294      effects.forEach(run);
295  }
296
297  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
298  const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
299      .map(key => Symbol[key])
300      .filter(isSymbol));
301  const get = /*#__PURE__*/ createGetter();
302  const shallowGet = /*#__PURE__*/ createGetter(false, true);
303  const readonlyGet = /*#__PURE__*/ createGetter(true);
304  const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
305  const arrayInstrumentations = {};
306  ['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
307      const method = Array.prototype[key];
308      arrayInstrumentations[key] = function (...args) {
309          const arr = toRaw(this);
310          for (let i = 0, l = this.length; i < l; i++) {
311              track(arr, "get" /* GET */, i + '');
312          }
313          // we run the method using the original args first (which may be reactive)
314          const res = method.apply(arr, args);
315          if (res === -1 || res === false) {
316              // if that didn't work, run it again using raw values.
317              return method.apply(arr, args.map(toRaw));
318          }
319          else {
320              return res;
321          }
322      };
323  });
324  ['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
325      const method = Array.prototype[key];
326      arrayInstrumentations[key] = function (...args) {
327          pauseTracking();
328          const res = method.apply(this, args);
329          resetTracking();
330          return res;
331      };
332  });
333  function createGetter(isReadonly = false, shallow = false) {
334      return function get(target, key, receiver) {
335          if (key === "__v_isReactive" /* IS_REACTIVE */) {
336              return !isReadonly;
337          }
338          else if (key === "__v_isReadonly" /* IS_READONLY */) {
339              return isReadonly;
340          }
341          else if (key === "__v_raw" /* RAW */ &&
342              receiver ===
343                  (isReadonly
344                      ? shallow
345                          ? shallowReadonlyMap
346                          : readonlyMap
347                      : shallow
348                          ? shallowReactiveMap
349                          : reactiveMap).get(target)) {
350              return target;
351          }
352          const targetIsArray = isArray(target);
353          if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
354              return Reflect.get(arrayInstrumentations, key, receiver);
355          }
356          const res = Reflect.get(target, key, receiver);
357          if (isSymbol(key)
358              ? builtInSymbols.has(key)
359              : isNonTrackableKeys(key)) {
360              return res;
361          }
362          if (!isReadonly) {
363              track(target, "get" /* GET */, key);
364          }
365          if (shallow) {
366              return res;
367          }
368          if (isRef(res)) {
369              // ref unwrapping - does not apply for Array + integer key.
370              const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
371              return shouldUnwrap ? res.value : res;
372          }
373          if (isObject(res)) {
374              // Convert returned value into a proxy as well. we do the isObject check
375              // here to avoid invalid value warning. Also need to lazy access readonly
376              // and reactive here to avoid circular dependency.
377              return isReadonly ? readonly(res) : reactive(res);
378          }
379          return res;
380      };
381  }
382  const set = /*#__PURE__*/ createSetter();
383  const shallowSet = /*#__PURE__*/ createSetter(true);
384  function createSetter(shallow = false) {
385      return function set(target, key, value, receiver) {
386          let oldValue = target[key];
387          if (!shallow) {
388              value = toRaw(value);
389              oldValue = toRaw(oldValue);
390              if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
391                  oldValue.value = value;
392                  return true;
393              }
394          }
395          const hadKey = isArray(target) && isIntegerKey(key)
396              ? Number(key) < target.length
397              : hasOwn(target, key);
398          const result = Reflect.set(target, key, value, receiver);
399          // don't trigger if target is something up in the prototype chain of original
400          if (target === toRaw(receiver)) {
401              if (!hadKey) {
402                  trigger(target, "add" /* ADD */, key, value);
403              }
404              else if (hasChanged(value, oldValue)) {
405                  trigger(target, "set" /* SET */, key, value);
406              }
407          }
408          return result;
409      };
410  }
411  function deleteProperty(target, key) {
412      const hadKey = hasOwn(target, key);
413      target[key];
414      const result = Reflect.deleteProperty(target, key);
415      if (result && hadKey) {
416          trigger(target, "delete" /* DELETE */, key, undefined);
417      }
418      return result;
419  }
420  function has(target, key) {
421      const result = Reflect.has(target, key);
422      if (!isSymbol(key) || !builtInSymbols.has(key)) {
423          track(target, "has" /* HAS */, key);
424      }
425      return result;
426  }
427  function ownKeys(target) {
428      track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
429      return Reflect.ownKeys(target);
430  }
431  const mutableHandlers = {
432      get,
433      set,
434      deleteProperty,
435      has,
436      ownKeys
437  };
438  const readonlyHandlers = {
439      get: readonlyGet,
440      set(target, key) {
441          return true;
442      },
443      deleteProperty(target, key) {
444          return true;
445      }
446  };
447  extend({}, mutableHandlers, {
448      get: shallowGet,
449      set: shallowSet
450  });
451  // Props handlers are special in the sense that it should not unwrap top-level
452  // refs (in order to allow refs to be explicitly passed down), but should
453  // retain the reactivity of the normal readonly object.
454  extend({}, readonlyHandlers, {
455      get: shallowReadonlyGet
456  });
457
458  const toReactive = (value) => isObject(value) ? reactive(value) : value;
459  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
460  const toShallow = (value) => value;
461  const getProto = (v) => Reflect.getPrototypeOf(v);
462  function get$1(target, key, isReadonly = false, isShallow = false) {
463      // #1772: readonly(reactive(Map)) should return readonly + reactive version
464      // of the value
465      target = target["__v_raw" /* RAW */];
466      const rawTarget = toRaw(target);
467      const rawKey = toRaw(key);
468      if (key !== rawKey) {
469          !isReadonly && track(rawTarget, "get" /* GET */, key);
470      }
471      !isReadonly && track(rawTarget, "get" /* GET */, rawKey);
472      const { has } = getProto(rawTarget);
473      const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
474      if (has.call(rawTarget, key)) {
475          return wrap(target.get(key));
476      }
477      else if (has.call(rawTarget, rawKey)) {
478          return wrap(target.get(rawKey));
479      }
480  }
481  function has$1(key, isReadonly = false) {
482      const target = this["__v_raw" /* RAW */];
483      const rawTarget = toRaw(target);
484      const rawKey = toRaw(key);
485      if (key !== rawKey) {
486          !isReadonly && track(rawTarget, "has" /* HAS */, key);
487      }
488      !isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
489      return key === rawKey
490          ? target.has(key)
491          : target.has(key) || target.has(rawKey);
492  }
493  function size(target, isReadonly = false) {
494      target = target["__v_raw" /* RAW */];
495      !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
496      return Reflect.get(target, 'size', target);
497  }
498  function add(value) {
499      value = toRaw(value);
500      const target = toRaw(this);
501      const proto = getProto(target);
502      const hadKey = proto.has.call(target, value);
503      if (!hadKey) {
504          target.add(value);
505          trigger(target, "add" /* ADD */, value, value);
506      }
507      return this;
508  }
509  function set$1(key, value) {
510      value = toRaw(value);
511      const target = toRaw(this);
512      const { has, get } = getProto(target);
513      let hadKey = has.call(target, key);
514      if (!hadKey) {
515          key = toRaw(key);
516          hadKey = has.call(target, key);
517      }
518      const oldValue = get.call(target, key);
519      target.set(key, value);
520      if (!hadKey) {
521          trigger(target, "add" /* ADD */, key, value);
522      }
523      else if (hasChanged(value, oldValue)) {
524          trigger(target, "set" /* SET */, key, value);
525      }
526      return this;
527  }
528  function deleteEntry(key) {
529      const target = toRaw(this);
530      const { has, get } = getProto(target);
531      let hadKey = has.call(target, key);
532      if (!hadKey) {
533          key = toRaw(key);
534          hadKey = has.call(target, key);
535      }
536      get ? get.call(target, key) : undefined;
537      // forward the operation before queueing reactions
538      const result = target.delete(key);
539      if (hadKey) {
540          trigger(target, "delete" /* DELETE */, key, undefined);
541      }
542      return result;
543  }
544  function clear() {
545      const target = toRaw(this);
546      const hadItems = target.size !== 0;
547      // forward the operation before queueing reactions
548      const result = target.clear();
549      if (hadItems) {
550          trigger(target, "clear" /* CLEAR */, undefined, undefined);
551      }
552      return result;
553  }
554  function createForEach(isReadonly, isShallow) {
555      return function forEach(callback, thisArg) {
556          const observed = this;
557          const target = observed["__v_raw" /* RAW */];
558          const rawTarget = toRaw(target);
559          const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
560          !isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
561          return target.forEach((value, key) => {
562              // important: make sure the callback is
563              // 1. invoked with the reactive map as `this` and 3rd arg
564              // 2. the value received should be a corresponding reactive/readonly.
565              return callback.call(thisArg, wrap(value), wrap(key), observed);
566          });
567      };
568  }
569  function createIterableMethod(method, isReadonly, isShallow) {
570      return function (...args) {
571          const target = this["__v_raw" /* RAW */];
572          const rawTarget = toRaw(target);
573          const targetIsMap = isMap(rawTarget);
574          const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
575          const isKeyOnly = method === 'keys' && targetIsMap;
576          const innerIterator = target[method](...args);
577          const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
578          !isReadonly &&
579              track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
580          // return a wrapped iterator which returns observed versions of the
581          // values emitted from the real iterator
582          return {
583              // iterator protocol
584              next() {
585                  const { value, done } = innerIterator.next();
586                  return done
587                      ? { value, done }
588                      : {
589                          value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
590                          done
591                      };
592              },
593              // iterable protocol
594              [Symbol.iterator]() {
595                  return this;
596              }
597          };
598      };
599  }
600  function createReadonlyMethod(type) {
601      return function (...args) {
602          return type === "delete" /* DELETE */ ? false : this;
603      };
604  }
605  const mutableInstrumentations = {
606      get(key) {
607          return get$1(this, key);
608      },
609      get size() {
610          return size(this);
611      },
612      has: has$1,
613      add,
614      set: set$1,
615      delete: deleteEntry,
616      clear,
617      forEach: createForEach(false, false)
618  };
619  const shallowInstrumentations = {
620      get(key) {
621          return get$1(this, key, false, true);
622      },
623      get size() {
624          return size(this);
625      },
626      has: has$1,
627      add,
628      set: set$1,
629      delete: deleteEntry,
630      clear,
631      forEach: createForEach(false, true)
632  };
633  const readonlyInstrumentations = {
634      get(key) {
635          return get$1(this, key, true);
636      },
637      get size() {
638          return size(this, true);
639      },
640      has(key) {
641          return has$1.call(this, key, true);
642      },
643      add: createReadonlyMethod("add" /* ADD */),
644      set: createReadonlyMethod("set" /* SET */),
645      delete: createReadonlyMethod("delete" /* DELETE */),
646      clear: createReadonlyMethod("clear" /* CLEAR */),
647      forEach: createForEach(true, false)
648  };
649  const shallowReadonlyInstrumentations = {
650      get(key) {
651          return get$1(this, key, true, true);
652      },
653      get size() {
654          return size(this, true);
655      },
656      has(key) {
657          return has$1.call(this, key, true);
658      },
659      add: createReadonlyMethod("add" /* ADD */),
660      set: createReadonlyMethod("set" /* SET */),
661      delete: createReadonlyMethod("delete" /* DELETE */),
662      clear: createReadonlyMethod("clear" /* CLEAR */),
663      forEach: createForEach(true, true)
664  };
665  const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
666  iteratorMethods.forEach(method => {
667      mutableInstrumentations[method] = createIterableMethod(method, false, false);
668      readonlyInstrumentations[method] = createIterableMethod(method, true, false);
669      shallowInstrumentations[method] = createIterableMethod(method, false, true);
670      shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
671  });
672  function createInstrumentationGetter(isReadonly, shallow) {
673      const instrumentations = shallow
674          ? isReadonly
675              ? shallowReadonlyInstrumentations
676              : shallowInstrumentations
677          : isReadonly
678              ? readonlyInstrumentations
679              : mutableInstrumentations;
680      return (target, key, receiver) => {
681          if (key === "__v_isReactive" /* IS_REACTIVE */) {
682              return !isReadonly;
683          }
684          else if (key === "__v_isReadonly" /* IS_READONLY */) {
685              return isReadonly;
686          }
687          else if (key === "__v_raw" /* RAW */) {
688              return target;
689          }
690          return Reflect.get(hasOwn(instrumentations, key) && key in target
691              ? instrumentations
692              : target, key, receiver);
693      };
694  }
695  const mutableCollectionHandlers = {
696      get: createInstrumentationGetter(false, false)
697  };
698  const readonlyCollectionHandlers = {
699      get: createInstrumentationGetter(true, false)
700  };
701
702  const reactiveMap = new WeakMap();
703  const shallowReactiveMap = new WeakMap();
704  const readonlyMap = new WeakMap();
705  const shallowReadonlyMap = new WeakMap();
706  function targetTypeMap(rawType) {
707      switch (rawType) {
708          case 'Object':
709          case 'Array':
710              return 1 /* COMMON */;
711          case 'Map':
712          case 'Set':
713          case 'WeakMap':
714          case 'WeakSet':
715              return 2 /* COLLECTION */;
716          default:
717              return 0 /* INVALID */;
718      }
719  }
720  function getTargetType(value) {
721      return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
722          ? 0 /* INVALID */
723          : targetTypeMap(toRawType(value));
724  }
725  function reactive(target) {
726      // if trying to observe a readonly proxy, return the readonly version.
727      if (target && target["__v_isReadonly" /* IS_READONLY */]) {
728          return target;
729      }
730      return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
731  }
732  /**
733   * Creates a readonly copy of the original object. Note the returned copy is not
734   * made reactive, but `readonly` can be called on an already reactive object.
735   */
736  function readonly(target) {
737      return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
738  }
739  function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
740      if (!isObject(target)) {
741          return target;
742      }
743      // target is already a Proxy, return it.
744      // exception: calling readonly() on a reactive object
745      if (target["__v_raw" /* RAW */] &&
746          !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
747          return target;
748      }
749      // target already has corresponding Proxy
750      const existingProxy = proxyMap.get(target);
751      if (existingProxy) {
752          return existingProxy;
753      }
754      // only a whitelist of value types can be observed.
755      const targetType = getTargetType(target);
756      if (targetType === 0 /* INVALID */) {
757          return target;
758      }
759      const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
760      proxyMap.set(target, proxy);
761      return proxy;
762  }
763  function isReactive(value) {
764      if (isReadonly(value)) {
765          return isReactive(value["__v_raw" /* RAW */]);
766      }
767      return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
768  }
769  function isReadonly(value) {
770      return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
771  }
772  function isProxy(value) {
773      return isReactive(value) || isReadonly(value);
774  }
775  function toRaw(observed) {
776      return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
777  }
778  function isRef(r) {
779      return Boolean(r && r.__v_isRef === true);
780  }
781
782  function callWithErrorHandling(fn, instance, type, args) {
783      let res;
784      try {
785          res = args ? fn(...args) : fn();
786      }
787      catch (err) {
788          handleError(err, instance, type);
789      }
790      return res;
791  }
792  function callWithAsyncErrorHandling(fn, instance, type, args) {
793      if (isFunction(fn)) {
794          const res = callWithErrorHandling(fn, instance, type, args);
795          if (res && isPromise(res)) {
796              res.catch(err => {
797                  handleError(err, instance, type);
798              });
799          }
800          return res;
801      }
802      const values = [];
803      for (let i = 0; i < fn.length; i++) {
804          values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
805      }
806      return values;
807  }
808  function handleError(err, instance, type, throwInDev = true) {
809      const contextVNode = instance ? instance.vnode : null;
810      if (instance) {
811          let cur = instance.parent;
812          // the exposed instance is the render proxy to keep it consistent with 2.x
813          const exposedInstance = instance.proxy;
814          // in production the hook receives only the error code
815          const errorInfo = type;
816          while (cur) {
817              const errorCapturedHooks = cur.ec;
818              if (errorCapturedHooks) {
819                  for (let i = 0; i < errorCapturedHooks.length; i++) {
820                      if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
821                          return;
822                      }
823                  }
824              }
825              cur = cur.parent;
826          }
827          // app-level handling
828          const appErrorHandler = instance.appContext.config.errorHandler;
829          if (appErrorHandler) {
830              callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
831              return;
832          }
833      }
834      logError(err, type, contextVNode, throwInDev);
835  }
836  function logError(err, type, contextVNode, throwInDev = true) {
837      {
838          // recover in prod to reduce the impact on end-user
839          console.error(err);
840      }
841  }
842
843  let isFlushing = false;
844  let isFlushPending = false;
845  const queue = [];
846  let flushIndex = 0;
847  const pendingPreFlushCbs = [];
848  let activePreFlushCbs = null;
849  let preFlushIndex = 0;
850  const pendingPostFlushCbs = [];
851  let activePostFlushCbs = null;
852  let postFlushIndex = 0;
853  const resolvedPromise = Promise.resolve();
854  let currentFlushPromise = null;
855  let currentPreFlushParentJob = null;
856  const RECURSION_LIMIT = 100;
857  function nextTick(fn) {
858      const p = currentFlushPromise || resolvedPromise;
859      return fn ? p.then(this ? fn.bind(this) : fn) : p;
860  }
861  // #2768
862  // Use binary-search to find a suitable position in the queue,
863  // so that the queue maintains the increasing order of job's id,
864  // which can prevent the job from being skipped and also can avoid repeated patching.
865  function findInsertionIndex(job) {
866      // the start index should be `flushIndex + 1`
867      let start = flushIndex + 1;
868      let end = queue.length;
869      const jobId = getId(job);
870      while (start < end) {
871          const middle = (start + end) >>> 1;
872          const middleJobId = getId(queue[middle]);
873          middleJobId < jobId ? (start = middle + 1) : (end = middle);
874      }
875      return start;
876  }
877  function queueJob(job) {
878      // the dedupe search uses the startIndex argument of Array.includes()
879      // by default the search index includes the current job that is being run
880      // so it cannot recursively trigger itself again.
881      // if the job is a watch() callback, the search will start with a +1 index to
882      // allow it recursively trigger itself - it is the user's responsibility to
883      // ensure it doesn't end up in an infinite loop.
884      if ((!queue.length ||
885          !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
886          job !== currentPreFlushParentJob) {
887          const pos = findInsertionIndex(job);
888          if (pos > -1) {
889              queue.splice(pos, 0, job);
890          }
891          else {
892              queue.push(job);
893          }
894          queueFlush();
895      }
896  }
897  function queueFlush() {
898      if (!isFlushing && !isFlushPending) {
899          isFlushPending = true;
900          currentFlushPromise = resolvedPromise.then(flushJobs);
901      }
902  }
903  function queueCb(cb, activeQueue, pendingQueue, index) {
904      if (!isArray(cb)) {
905          if (!activeQueue ||
906              !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
907              pendingQueue.push(cb);
908          }
909      }
910      else {
911          // if cb is an array, it is a component lifecycle hook which can only be
912          // triggered by a job, which is already deduped in the main queue, so
913          // we can skip duplicate check here to improve perf
914          pendingQueue.push(...cb);
915      }
916      queueFlush();
917  }
918  function queuePreFlushCb(cb) {
919      queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
920  }
921  function queuePostFlushCb(cb) {
922      queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
923  }
924  function flushPreFlushCbs(seen, parentJob = null) {
925      if (pendingPreFlushCbs.length) {
926          currentPreFlushParentJob = parentJob;
927          activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
928          pendingPreFlushCbs.length = 0;
929          for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
930              activePreFlushCbs[preFlushIndex]();
931          }
932          activePreFlushCbs = null;
933          preFlushIndex = 0;
934          currentPreFlushParentJob = null;
935          // recursively flush until it drains
936          flushPreFlushCbs(seen, parentJob);
937      }
938  }
939  function flushPostFlushCbs(seen) {
940      if (pendingPostFlushCbs.length) {
941          const deduped = [...new Set(pendingPostFlushCbs)];
942          pendingPostFlushCbs.length = 0;
943          // #1947 already has active queue, nested flushPostFlushCbs call
944          if (activePostFlushCbs) {
945              activePostFlushCbs.push(...deduped);
946              return;
947          }
948          activePostFlushCbs = deduped;
949          activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
950          for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
951              activePostFlushCbs[postFlushIndex]();
952          }
953          activePostFlushCbs = null;
954          postFlushIndex = 0;
955      }
956  }
957  const getId = (job) => job.id == null ? Infinity : job.id;
958  function flushJobs(seen) {
959      isFlushPending = false;
960      isFlushing = true;
961      flushPreFlushCbs(seen);
962      // Sort queue before flush.
963      // This ensures that:
964      // 1. Components are updated from parent to child. (because parent is always
965      //    created before the child so its render effect will have smaller
966      //    priority number)
967      // 2. If a component is unmounted during a parent component's update,
968      //    its update can be skipped.
969      queue.sort((a, b) => getId(a) - getId(b));
970      try {
971          for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
972              const job = queue[flushIndex];
973              if (job) {
974                  if (("production" !== 'production')) ;
975                  callWithErrorHandling(job, null, 14 /* SCHEDULER */);
976              }
977          }
978      }
979      finally {
980          flushIndex = 0;
981          queue.length = 0;
982          flushPostFlushCbs();
983          isFlushing = false;
984          currentFlushPromise = null;
985          // some postFlushCb queued jobs!
986          // keep flushing until it drains.
987          if (queue.length || pendingPostFlushCbs.length) {
988              flushJobs(seen);
989          }
990      }
991  }
992  function checkRecursiveUpdates(seen, fn) {
993      if (!seen.has(fn)) {
994          seen.set(fn, 1);
995      }
996      else {
997          const count = seen.get(fn);
998          if (count > RECURSION_LIMIT) {
999              throw new Error(`Maximum recursive updates exceeded. ` +
1000                  `This means you have a reactive effect that is mutating its own ` +
1001                  `dependencies and thus recursively triggering itself. Possible sources ` +
1002                  `include component template, render function, updated hook or ` +
1003                  `watcher source function.`);
1004          }
1005          else {
1006              seen.set(fn, count + 1);
1007          }
1008      }
1009  }
1010
1011  let isRenderingCompiledSlot = 0;
1012  const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);
1013
1014  /**
1015   * mark the current rendering instance for asset resolution (e.g.
1016   * resolveComponent, resolveDirective) during render
1017   */
1018  let currentRenderingInstance = null;
1019  let currentScopeId = null;
1020  function filterSingleRoot(children) {
1021      let singleRoot;
1022      for (let i = 0; i < children.length; i++) {
1023          const child = children[i];
1024          if (isVNode(child)) {
1025              // ignore user comment
1026              if (child.type !== Comment || child.children === 'v-if') {
1027                  if (singleRoot) {
1028                      // has more than 1 non-comment child, return now
1029                      return;
1030                  }
1031                  else {
1032                      singleRoot = child;
1033                  }
1034              }
1035          }
1036          else {
1037              return;
1038          }
1039      }
1040      return singleRoot;
1041  }
1042
1043  const isSuspense = (type) => type.__isSuspense;
1044  function normalizeSuspenseChildren(vnode) {
1045      const { shapeFlag, children } = vnode;
1046      let content;
1047      let fallback;
1048      if (shapeFlag & 32 /* SLOTS_CHILDREN */) {
1049          content = normalizeSuspenseSlot(children.default);
1050          fallback = normalizeSuspenseSlot(children.fallback);
1051      }
1052      else {
1053          content = normalizeSuspenseSlot(children);
1054          fallback = normalizeVNode(null);
1055      }
1056      return {
1057          content,
1058          fallback
1059      };
1060  }
1061  function normalizeSuspenseSlot(s) {
1062      if (isFunction(s)) {
1063          s = s();
1064      }
1065      if (isArray(s)) {
1066          const singleChild = filterSingleRoot(s);
1067          s = singleChild;
1068      }
1069      return normalizeVNode(s);
1070  }
1071  function queueEffectWithSuspense(fn, suspense) {
1072      if (suspense && suspense.pendingBranch) {
1073          if (isArray(fn)) {
1074              suspense.effects.push(...fn);
1075          }
1076          else {
1077              suspense.effects.push(fn);
1078          }
1079      }
1080      else {
1081          queuePostFlushCb(fn);
1082      }
1083  }
1084  // initial value for watchers to trigger on undefined initial values
1085  const INITIAL_WATCHER_VALUE = {};
1086  function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ, instance = currentInstance) {
1087      let getter;
1088      let forceTrigger = false;
1089      if (isRef(source)) {
1090          getter = () => source.value;
1091          forceTrigger = !!source._shallow;
1092      }
1093      else if (isReactive(source)) {
1094          getter = () => source;
1095          deep = true;
1096      }
1097      else if (isArray(source)) {
1098          getter = () => source.map(s => {
1099              if (isRef(s)) {
1100                  return s.value;
1101              }
1102              else if (isReactive(s)) {
1103                  return traverse(s);
1104              }
1105              else if (isFunction(s)) {
1106                  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */, [
1107                      instance && instance.proxy
1108                  ]);
1109              }
1110              else ;
1111          });
1112      }
1113      else if (isFunction(source)) {
1114          if (cb) {
1115              // getter with cb
1116              getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */, [
1117                  instance && instance.proxy
1118              ]);
1119          }
1120          else {
1121              // no cb -> simple effect
1122              getter = () => {
1123                  if (instance && instance.isUnmounted) {
1124                      return;
1125                  }
1126                  if (cleanup) {
1127                      cleanup();
1128                  }
1129                  return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onInvalidate]);
1130              };
1131          }
1132      }
1133      else {
1134          getter = NOOP;
1135      }
1136      if (cb && deep) {
1137          const baseGetter = getter;
1138          getter = () => traverse(baseGetter());
1139      }
1140      let cleanup;
1141      let onInvalidate = (fn) => {
1142          cleanup = runner.options.onStop = () => {
1143              callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
1144          };
1145      };
1146      let oldValue = isArray(source) ? [] : INITIAL_WATCHER_VALUE;
1147      const job = () => {
1148          if (!runner.active) {
1149              return;
1150          }
1151          if (cb) {
1152              // watch(source, cb)
1153              const newValue = runner();
1154              if (deep || forceTrigger || hasChanged(newValue, oldValue)) {
1155                  // cleanup before running cb again
1156                  if (cleanup) {
1157                      cleanup();
1158                  }
1159                  callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
1160                      newValue,
1161                      // pass undefined as the old value when it's changed for the first time
1162                      oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
1163                      onInvalidate
1164                  ]);
1165                  oldValue = newValue;
1166              }
1167          }
1168          else {
1169              // watchEffect
1170              runner();
1171          }
1172      };
1173      // important: mark the job as a watcher callback so that scheduler knows
1174      // it is allowed to self-trigger (#1727)
1175      job.allowRecurse = !!cb;
1176      let scheduler;
1177      if (flush === 'sync') {
1178          scheduler = job;
1179      }
1180      else if (flush === 'post') {
1181          scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1182      }
1183      else {
1184          // default: 'pre'
1185          scheduler = () => {
1186              if (!instance || instance.isMounted) {
1187                  queuePreFlushCb(job);
1188              }
1189              else {
1190                  // with 'pre' option, the first call must happen before
1191                  // the component is mounted so it is called synchronously.
1192                  job();
1193              }
1194          };
1195      }
1196      const runner = effect(getter, {
1197          lazy: true,
1198          onTrack,
1199          onTrigger,
1200          scheduler
1201      });
1202      recordInstanceBoundEffect(runner, instance);
1203      // initial run
1204      if (cb) {
1205          if (immediate) {
1206              job();
1207          }
1208          else {
1209              oldValue = runner();
1210          }
1211      }
1212      else if (flush === 'post') {
1213          queuePostRenderEffect(runner, instance && instance.suspense);
1214      }
1215      else {
1216          runner();
1217      }
1218      return () => {
1219          stop(runner);
1220          if (instance) {
1221              remove(instance.effects, runner);
1222          }
1223      };
1224  }
1225  // this.$watch
1226  function instanceWatch(source, cb, options) {
1227      const publicThis = this.proxy;
1228      const getter = isString(source)
1229          ? () => publicThis[source]
1230          : source.bind(publicThis);
1231      return doWatch(getter, cb.bind(publicThis), options, this);
1232  }
1233  function traverse(value, seen = new Set()) {
1234      if (!isObject(value) || seen.has(value)) {
1235          return value;
1236      }
1237      seen.add(value);
1238      if (isRef(value)) {
1239          traverse(value.value, seen);
1240      }
1241      else if (isArray(value)) {
1242          for (let i = 0; i < value.length; i++) {
1243              traverse(value[i], seen);
1244          }
1245      }
1246      else if (isSet(value) || isMap(value)) {
1247          value.forEach((v) => {
1248              traverse(v, seen);
1249          });
1250      }
1251      else {
1252          for (const key in value) {
1253              traverse(value[key], seen);
1254          }
1255      }
1256      return value;
1257  }
1258  const queuePostRenderEffect = queueEffectWithSuspense
1259      ;
1260
1261  const isTeleport = (type) => type.__isTeleport;
1262  const NULL_DYNAMIC_COMPONENT = Symbol();
1263
1264  const Fragment = Symbol(undefined);
1265  const Text = Symbol(undefined);
1266  const Comment = Symbol(undefined);
1267  // Since v-if and v-for are the two possible ways node structure can dynamically
1268  // change, once we consider v-if branches and each v-for fragment a block, we
1269  // can divide a template into nested blocks, and within each block the node
1270  // structure would be stable. This allows us to skip most children diffing
1271  // and only worry about the dynamic nodes (indicated by patch flags).
1272  const blockStack = [];
1273  let currentBlock = null;
1274  /**
1275   * Open a block.
1276   * This must be called before `createBlock`. It cannot be part of `createBlock`
1277   * because the children of the block are evaluated before `createBlock` itself
1278   * is called. The generated code typically looks like this:
1279   *
1280   * ```js
1281   * function render() {
1282   *   return (openBlock(),createBlock('div', null, [...]))
1283   * }
1284   * ```
1285   * disableTracking is true when creating a v-for fragment block, since a v-for
1286   * fragment always diffs its children.
1287   *
1288   * @private

1289   */
1290  function openBlock(disableTracking = false) {
1291      blockStack.push((currentBlock = disableTracking ? null : []));
1292  }
1293  function closeBlock() {
1294      blockStack.pop();
1295      currentBlock = blockStack[blockStack.length - 1] || null;
1296  }
1297  /**
1298   * Create a block root vnode. Takes the same exact arguments as `createVNode`.
1299   * A block root keeps track of dynamic nodes within the block in the
1300   * `dynamicChildren` array.
1301   *
1302   * @private

1303   */
1304  function createBlock(type, props, children, patchFlag, dynamicProps) {
1305      const vnode = createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */);
1306      // save current block children on the block vnode
1307      vnode.dynamicChildren = currentBlock || EMPTY_ARR;
1308      // close block
1309      closeBlock();
1310      // a block is always going to be patched, so track it as a child of its
1311      // parent block
1312      if (currentBlock) {
1313          currentBlock.push(vnode);
1314      }
1315      return vnode;
1316  }
1317  function isVNode(value) {
1318      return value ? value.__v_isVNode === true : false;
1319  }
1320  const InternalObjectKey = `__vInternal`;
1321  const normalizeKey = ({ key }) => key != null ? key : null;
1322  const normalizeRef = ({ ref }) => {
1323      return (ref != null
1324          ? isString(ref) || isRef(ref) || isFunction(ref)
1325              ? { i: currentRenderingInstance, r: ref }
1326              : ref
1327          : null);
1328  };
1329  const createVNode = (_createVNode);
1330  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
1331      if (!type || type === NULL_DYNAMIC_COMPONENT) {
1332          type = Comment;
1333      }
1334      if (isVNode(type)) {
1335          // createVNode receiving an existing vnode. This happens in cases like
1336          // <component :is="vnode"/>
1337          // #2078 make sure to merge refs during the clone instead of overwriting it
1338          const cloned = cloneVNode(type, props, true /* mergeRef: true */);
1339          if (children) {
1340              normalizeChildren(cloned, children);
1341          }
1342          return cloned;
1343      }
1344      // class component normalization.
1345      if (isClassComponent(type)) {
1346          type = type.__vccOpts;
1347      }
1348      // class & style normalization.
1349      if (props) {
1350          // for reactive or proxy objects, we need to clone it to enable mutation.
1351          if (isProxy(props) || InternalObjectKey in props) {
1352              props = extend({}, props);
1353          }
1354          let { class: klass, style } = props;
1355          if (klass && !isString(klass)) {
1356              props.class = normalizeClass(klass);
1357          }
1358          if (isObject(style)) {
1359              // reactive state objects need to be cloned since they are likely to be
1360              // mutated
1361              if (isProxy(style) && !isArray(style)) {
1362                  style = extend({}, style);
1363              }
1364              props.style = normalizeStyle(style);
1365          }
1366      }
1367      // encode the vnode type information into a bitmap
1368      const shapeFlag = isString(type)
1369          ? 1 /* ELEMENT */
1370          : isSuspense(type)
1371              ? 128 /* SUSPENSE */
1372              : isTeleport(type)
1373                  ? 64 /* TELEPORT */
1374                  : isObject(type)
1375                      ? 4 /* STATEFUL_COMPONENT */
1376                      : isFunction(type)
1377                          ? 2 /* FUNCTIONAL_COMPONENT */
1378                          : 0;
1379      const vnode = {
1380          __v_isVNode: true,
1381          ["__v_skip" /* SKIP */]: true,
1382          type,
1383          props,
1384          key: props && normalizeKey(props),
1385          ref: props && normalizeRef(props),
1386          scopeId: currentScopeId,
1387          slotScopeIds: null,
1388          children: null,
1389          component: null,
1390          suspense: null,
1391          ssContent: null,
1392          ssFallback: null,
1393          dirs: null,
1394          transition: null,
1395          el: null,
1396          anchor: null,
1397          target: null,
1398          targetAnchor: null,
1399          staticCount: 0,
1400          shapeFlag,
1401          patchFlag,
1402          dynamicProps,
1403          dynamicChildren: null,
1404          appContext: null
1405      };
1406      normalizeChildren(vnode, children);
1407      // normalize suspense children
1408      if (shapeFlag & 128 /* SUSPENSE */) {
1409          const { content, fallback } = normalizeSuspenseChildren(vnode);
1410          vnode.ssContent = content;
1411          vnode.ssFallback = fallback;
1412      }
1413      if (// avoid a block node from tracking itself
1414          !isBlockNode &&
1415          // has current parent block
1416          currentBlock &&
1417          // presence of a patch flag indicates this node needs patching on updates.
1418          // component nodes also should always be patched, because even if the
1419          // component doesn't need to update, it needs to persist the instance on to
1420          // the next vnode so that it can be properly unmounted later.
1421          (patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
1422          // the EVENTS flag is only for hydration and if it is the only flag, the
1423          // vnode should not be considered dynamic due to handler caching.
1424          patchFlag !== 32 /* HYDRATE_EVENTS */) {
1425          currentBlock.push(vnode);
1426      }
1427      return vnode;
1428  }
1429  function cloneVNode(vnode, extraProps, mergeRef = false) {
1430      // This is intentionally NOT using spread or extend to avoid the runtime
1431      // key enumeration cost.
1432      const { props, ref, patchFlag, children } = vnode;
1433      const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
1434      return {
1435          __v_isVNode: true,
1436          ["__v_skip" /* SKIP */]: true,
1437          type: vnode.type,
1438          props: mergedProps,
1439          key: mergedProps && normalizeKey(mergedProps),
1440          ref: extraProps && extraProps.ref
1441              ? // #2078 in the case of <component :is="vnode" ref="extra"/>
1442                  // if the vnode itself already has a ref, cloneVNode will need to merge
1443                  // the refs so the single vnode can be set on multiple refs
1444                  mergeRef && ref
1445                      ? isArray(ref)
1446                          ? ref.concat(normalizeRef(extraProps))
1447                          : [ref, normalizeRef(extraProps)]
1448                      : normalizeRef(extraProps)
1449              : ref,
1450          scopeId: vnode.scopeId,
1451          slotScopeIds: vnode.slotScopeIds,
1452          children: children,
1453          target: vnode.target,
1454          targetAnchor: vnode.targetAnchor,
1455          staticCount: vnode.staticCount,
1456          shapeFlag: vnode.shapeFlag,
1457          // if the vnode is cloned with extra props, we can no longer assume its
1458          // existing patch flag to be reliable and need to add the FULL_PROPS flag.
1459          // note: perserve flag for fragments since they use the flag for children
1460          // fast paths only.
1461          patchFlag: extraProps && vnode.type !== Fragment
1462              ? patchFlag === -1 // hoisted node
1463                  ? 16 /* FULL_PROPS */
1464                  : patchFlag | 16 /* FULL_PROPS */
1465              : patchFlag,
1466          dynamicProps: vnode.dynamicProps,
1467          dynamicChildren: vnode.dynamicChildren,
1468          appContext: vnode.appContext,
1469          dirs: vnode.dirs,
1470          transition: vnode.transition,
1471          // These should technically only be non-null on mounted VNodes. However,
1472          // they *should* be copied for kept-alive vnodes. So we just always copy
1473          // them since them being non-null during a mount doesn't affect the logic as
1474          // they will simply be overwritten.
1475          component: vnode.component,
1476          suspense: vnode.suspense,
1477          ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
1478          ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
1479          el: vnode.el,
1480          anchor: vnode.anchor
1481      };
1482  }
1483  /**
1484   * @private

1485   */
1486  function createTextVNode(text = ' ', flag = 0) {
1487      return createVNode(Text, null, text, flag);
1488  }
1489  function normalizeVNode(child) {
1490      if (child == null || typeof child === 'boolean') {
1491          // empty placeholder
1492          return createVNode(Comment);
1493      }
1494      else if (isArray(child)) {
1495          // fragment
1496          return createVNode(Fragment, null, child);
1497      }
1498      else if (typeof child === 'object') {
1499          // already vnode, this should be the most common since compiled templates
1500          // always produce all-vnode children arrays
1501          return child.el === null ? child : cloneVNode(child);
1502      }
1503      else {
1504          // strings and numbers
1505          return createVNode(Text, null, String(child));
1506      }
1507  }
1508  function normalizeChildren(vnode, children) {
1509      let type = 0;
1510      const { shapeFlag } = vnode;
1511      if (children == null) {
1512          children = null;
1513      }
1514      else if (isArray(children)) {
1515          type = 16 /* ARRAY_CHILDREN */;
1516      }
1517      else if (typeof children === 'object') {
1518          if (shapeFlag & 1 /* ELEMENT */ || shapeFlag & 64 /* TELEPORT */) {
1519              // Normalize slot to plain children for plain element and Teleport
1520              const slot = children.default;
1521              if (slot) {
1522                  // _c marker is added by withCtx() indicating this is a compiled slot
1523                  slot._c && setCompiledSlotRendering(1);
1524                  normalizeChildren(vnode, slot());
1525                  slot._c && setCompiledSlotRendering(-1);
1526              }
1527              return;
1528          }
1529          else {
1530              type = 32 /* SLOTS_CHILDREN */;
1531              const slotFlag = children._;
1532              if (!slotFlag && !(InternalObjectKey in children)) {
1533                  children._ctx = currentRenderingInstance;
1534              }
1535              else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
1536                  // a child component receives forwarded slots from the parent.
1537                  // its slot type is determined by its parent's slot type.
1538                  if (currentRenderingInstance.vnode.patchFlag & 1024 /* DYNAMIC_SLOTS */) {
1539                      children._ = 2 /* DYNAMIC */;
1540                      vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
1541                  }
1542                  else {
1543                      children._ = 1 /* STABLE */;
1544                  }
1545              }
1546          }
1547      }
1548      else if (isFunction(children)) {
1549          children = { default: children, _ctx: currentRenderingInstance };
1550          type = 32 /* SLOTS_CHILDREN */;
1551      }
1552      else {
1553          children = String(children);
1554          // force teleport children to array so it can be moved around
1555          if (shapeFlag & 64 /* TELEPORT */) {
1556              type = 16 /* ARRAY_CHILDREN */;
1557              children = [createTextVNode(children)];
1558          }
1559          else {
1560              type = 8 /* TEXT_CHILDREN */;
1561          }
1562      }
1563      vnode.children = children;
1564      vnode.shapeFlag |= type;
1565  }
1566  function mergeProps(...args) {
1567      const ret = extend({}, args[0]);
1568      for (let i = 1; i < args.length; i++) {
1569          const toMerge = args[i];
1570          for (const key in toMerge) {
1571              if (key === 'class') {
1572                  if (ret.class !== toMerge.class) {
1573                      ret.class = normalizeClass([ret.class, toMerge.class]);
1574                  }
1575              }
1576              else if (key === 'style') {
1577                  ret.style = normalizeStyle([ret.style, toMerge.style]);
1578              }
1579              else if (isOn(key)) {
1580                  const existing = ret[key];
1581                  const incoming = toMerge[key];
1582                  if (existing !== incoming) {
1583                      ret[key] = existing
1584                          ? [].concat(existing, toMerge[key])
1585                          : incoming;
1586                  }
1587              }
1588              else if (key !== '') {
1589                  ret[key] = toMerge[key];
1590              }
1591          }
1592      }
1593      return ret;
1594  }
1595  let shouldCacheAccess = true;
1596  function resolveMergedOptions(instance) {
1597      const raw = instance.type;
1598      const { __merged, mixins, extends: extendsOptions } = raw;
1599      if (__merged)
1600          return __merged;
1601      const globalMixins = instance.appContext.mixins;
1602      if (!globalMixins.length && !mixins && !extendsOptions)
1603          return raw;
1604      const options = {};
1605      globalMixins.forEach(m => mergeOptions(options, m, instance));
1606      mergeOptions(options, raw, instance);
1607      return (raw.__merged = options);
1608  }
1609  function mergeOptions(to, from, instance) {
1610      const strats = instance.appContext.config.optionMergeStrategies;
1611      const { mixins, extends: extendsOptions } = from;
1612      extendsOptions && mergeOptions(to, extendsOptions, instance);
1613      mixins &&
1614          mixins.forEach((m) => mergeOptions(to, m, instance));
1615      for (const key in from) {
1616          if (strats && hasOwn(strats, key)) {
1617              to[key] = strats[key](to[key], from[key], instance.proxy, key);
1618          }
1619          else {
1620              to[key] = from[key];
1621          }
1622      }
1623  }
1624
1625  /**
1626   * #2437 In Vue 3, functional components do not have a public instance proxy but
1627   * they exist in the internal parent chain. For code that relies on traversing
1628   * public $parent chains, skip functional ones and go to the parent instead.
1629   */
1630  const getPublicInstance = (i) => {
1631      if (!i)
1632          return null;
1633      if (isStatefulComponent(i))
1634          return i.exposed ? i.exposed : i.proxy;
1635      return getPublicInstance(i.parent);
1636  };
1637  const publicPropertiesMap = extend(Object.create(null), {
1638      $: i => i,
1639      $el: i => i.vnode.el,
1640      $data: i => i.data,
1641      $props: i => (i.props),
1642      $attrs: i => (i.attrs),
1643      $slots: i => (i.slots),
1644      $refs: i => (i.refs),
1645      $parent: i => getPublicInstance(i.parent),
1646      $root: i => getPublicInstance(i.root),
1647      $emit: i => i.emit,
1648      $options: i => (__VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type),
1649      $forceUpdate: i => () => queueJob(i.update),
1650      $nextTick: i => nextTick.bind(i.proxy),
1651      $watch: i => (__VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
1652  });
1653  const PublicInstanceProxyHandlers = {
1654      get({ _: instance }, key) {
1655          const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
1656          // let @vue/reactivity know it should never observe Vue public instances.
1657          if (key === "__v_skip" /* SKIP */) {
1658              return true;
1659          }
1660          // data / props / ctx
1661          // This getter gets called for every property access on the render context
1662          // during render and is a major hotspot. The most expensive part of this
1663          // is the multiple hasOwn() calls. It's much faster to do a simple property
1664          // access on a plain object, so we use an accessCache object (with null
1665          // prototype) to memoize what access type a key corresponds to.
1666          let normalizedProps;
1667          if (key[0] !== '$') {
1668              const n = accessCache[key];
1669              if (n !== undefined) {
1670                  switch (n) {