UNPKG

521 kBJavaScriptView Raw
1/**
2* vue v3.4.27
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6var Vue = (function (exports) {
7 'use strict';
8
9 /*! #__NO_SIDE_EFFECTS__ */
10 // @__NO_SIDE_EFFECTS__
11 function makeMap(str, expectsLowerCase) {
12 const set = new Set(str.split(","));
13 return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
14 }
15
16 const EMPTY_OBJ = Object.freeze({}) ;
17 const EMPTY_ARR = Object.freeze([]) ;
18 const NOOP = () => {
19 };
20 const NO = () => false;
21 const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
22 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
23 const isModelListener = (key) => key.startsWith("onUpdate:");
24 const extend = Object.assign;
25 const remove = (arr, el) => {
26 const i = arr.indexOf(el);
27 if (i > -1) {
28 arr.splice(i, 1);
29 }
30 };
31 const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
32 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
33 const isArray = Array.isArray;
34 const isMap = (val) => toTypeString(val) === "[object Map]";
35 const isSet = (val) => toTypeString(val) === "[object Set]";
36 const isDate = (val) => toTypeString(val) === "[object Date]";
37 const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
38 const isFunction = (val) => typeof val === "function";
39 const isString = (val) => typeof val === "string";
40 const isSymbol = (val) => typeof val === "symbol";
41 const isObject = (val) => val !== null && typeof val === "object";
42 const isPromise = (val) => {
43 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
44 };
45 const objectToString = Object.prototype.toString;
46 const toTypeString = (value) => objectToString.call(value);
47 const toRawType = (value) => {
48 return toTypeString(value).slice(8, -1);
49 };
50 const isPlainObject = (val) => toTypeString(val) === "[object Object]";
51 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
52 const isReservedProp = /* @__PURE__ */ makeMap(
53 // the leading comma is intentional so empty string "" is also included
54 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
55 );
56 const isBuiltInDirective = /* @__PURE__ */ makeMap(
57 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
58 );
59 const cacheStringFunction = (fn) => {
60 const cache = /* @__PURE__ */ Object.create(null);
61 return (str) => {
62 const hit = cache[str];
63 return hit || (cache[str] = fn(str));
64 };
65 };
66 const camelizeRE = /-(\w)/g;
67 const camelize = cacheStringFunction((str) => {
68 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
69 });
70 const hyphenateRE = /\B([A-Z])/g;
71 const hyphenate = cacheStringFunction(
72 (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
73 );
74 const capitalize = cacheStringFunction((str) => {
75 return str.charAt(0).toUpperCase() + str.slice(1);
76 });
77 const toHandlerKey = cacheStringFunction((str) => {
78 const s = str ? `on${capitalize(str)}` : ``;
79 return s;
80 });
81 const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
82 const invokeArrayFns = (fns, arg) => {
83 for (let i = 0; i < fns.length; i++) {
84 fns[i](arg);
85 }
86 };
87 const def = (obj, key, value, writable = false) => {
88 Object.defineProperty(obj, key, {
89 configurable: true,
90 enumerable: false,
91 writable,
92 value
93 });
94 };
95 const looseToNumber = (val) => {
96 const n = parseFloat(val);
97 return isNaN(n) ? val : n;
98 };
99 const toNumber = (val) => {
100 const n = isString(val) ? Number(val) : NaN;
101 return isNaN(n) ? val : n;
102 };
103 let _globalThis;
104 const getGlobalThis = () => {
105 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
106 };
107
108 const PatchFlagNames = {
109 [1]: `TEXT`,
110 [2]: `CLASS`,
111 [4]: `STYLE`,
112 [8]: `PROPS`,
113 [16]: `FULL_PROPS`,
114 [32]: `NEED_HYDRATION`,
115 [64]: `STABLE_FRAGMENT`,
116 [128]: `KEYED_FRAGMENT`,
117 [256]: `UNKEYED_FRAGMENT`,
118 [512]: `NEED_PATCH`,
119 [1024]: `DYNAMIC_SLOTS`,
120 [2048]: `DEV_ROOT_FRAGMENT`,
121 [-1]: `HOISTED`,
122 [-2]: `BAIL`
123 };
124
125 const slotFlagsText = {
126 [1]: "STABLE",
127 [2]: "DYNAMIC",
128 [3]: "FORWARDED"
129 };
130
131 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
132 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
133
134 const range = 2;
135 function generateCodeFrame(source, start = 0, end = source.length) {
136 let lines = source.split(/(\r?\n)/);
137 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
138 lines = lines.filter((_, idx) => idx % 2 === 0);
139 let count = 0;
140 const res = [];
141 for (let i = 0; i < lines.length; i++) {
142 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
143 if (count >= start) {
144 for (let j = i - range; j <= i + range || end > count; j++) {
145 if (j < 0 || j >= lines.length)
146 continue;
147 const line = j + 1;
148 res.push(
149 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
150 );
151 const lineLength = lines[j].length;
152 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
153 if (j === i) {
154 const pad = start - (count - (lineLength + newLineSeqLength));
155 const length = Math.max(
156 1,
157 end > count ? lineLength - pad : end - start
158 );
159 res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
160 } else if (j > i) {
161 if (end > count) {
162 const length = Math.max(Math.min(end - count, lineLength), 1);
163 res.push(` | ` + "^".repeat(length));
164 }
165 count += lineLength + newLineSeqLength;
166 }
167 }
168 break;
169 }
170 }
171 return res.join("\n");
172 }
173
174 function normalizeStyle(value) {
175 if (isArray(value)) {
176 const res = {};
177 for (let i = 0; i < value.length; i++) {
178 const item = value[i];
179 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
180 if (normalized) {
181 for (const key in normalized) {
182 res[key] = normalized[key];
183 }
184 }
185 }
186 return res;
187 } else if (isString(value) || isObject(value)) {
188 return value;
189 }
190 }
191 const listDelimiterRE = /;(?![^(]*\))/g;
192 const propertyDelimiterRE = /:([^]+)/;
193 const styleCommentRE = /\/\*[^]*?\*\//g;
194 function parseStringStyle(cssText) {
195 const ret = {};
196 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
197 if (item) {
198 const tmp = item.split(propertyDelimiterRE);
199 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
200 }
201 });
202 return ret;
203 }
204 function stringifyStyle(styles) {
205 let ret = "";
206 if (!styles || isString(styles)) {
207 return ret;
208 }
209 for (const key in styles) {
210 const value = styles[key];
211 if (isString(value) || typeof value === "number") {
212 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
213 ret += `${normalizedKey}:${value};`;
214 }
215 }
216 return ret;
217 }
218 function normalizeClass(value) {
219 let res = "";
220 if (isString(value)) {
221 res = value;
222 } else if (isArray(value)) {
223 for (let i = 0; i < value.length; i++) {
224 const normalized = normalizeClass(value[i]);
225 if (normalized) {
226 res += normalized + " ";
227 }
228 }
229 } else if (isObject(value)) {
230 for (const name in value) {
231 if (value[name]) {
232 res += name + " ";
233 }
234 }
235 }
236 return res.trim();
237 }
238 function normalizeProps(props) {
239 if (!props)
240 return null;
241 let { class: klass, style } = props;
242 if (klass && !isString(klass)) {
243 props.class = normalizeClass(klass);
244 }
245 if (style) {
246 props.style = normalizeStyle(style);
247 }
248 return props;
249 }
250
251 const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
252 const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
253 const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
254 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
255 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
256 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
257 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
258 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
259
260 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
261 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
262 const isBooleanAttr = /* @__PURE__ */ makeMap(
263 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
264 );
265 function includeBooleanAttr(value) {
266 return !!value || value === "";
267 }
268 const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
269 `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
270 );
271 const isKnownSvgAttr = /* @__PURE__ */ makeMap(
272 `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
273 );
274 function isRenderableAttrValue(value) {
275 if (value == null) {
276 return false;
277 }
278 const type = typeof value;
279 return type === "string" || type === "number" || type === "boolean";
280 }
281
282 function looseCompareArrays(a, b) {
283 if (a.length !== b.length)
284 return false;
285 let equal = true;
286 for (let i = 0; equal && i < a.length; i++) {
287 equal = looseEqual(a[i], b[i]);
288 }
289 return equal;
290 }
291 function looseEqual(a, b) {
292 if (a === b)
293 return true;
294 let aValidType = isDate(a);
295 let bValidType = isDate(b);
296 if (aValidType || bValidType) {
297 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
298 }
299 aValidType = isSymbol(a);
300 bValidType = isSymbol(b);
301 if (aValidType || bValidType) {
302 return a === b;
303 }
304 aValidType = isArray(a);
305 bValidType = isArray(b);
306 if (aValidType || bValidType) {
307 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
308 }
309 aValidType = isObject(a);
310 bValidType = isObject(b);
311 if (aValidType || bValidType) {
312 if (!aValidType || !bValidType) {
313 return false;
314 }
315 const aKeysCount = Object.keys(a).length;
316 const bKeysCount = Object.keys(b).length;
317 if (aKeysCount !== bKeysCount) {
318 return false;
319 }
320 for (const key in a) {
321 const aHasKey = a.hasOwnProperty(key);
322 const bHasKey = b.hasOwnProperty(key);
323 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
324 return false;
325 }
326 }
327 }
328 return String(a) === String(b);
329 }
330 function looseIndexOf(arr, val) {
331 return arr.findIndex((item) => looseEqual(item, val));
332 }
333
334 const toDisplayString = (val) => {
335 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
336 };
337 const replacer = (_key, val) => {
338 if (val && val.__v_isRef) {
339 return replacer(_key, val.value);
340 } else if (isMap(val)) {
341 return {
342 [`Map(${val.size})`]: [...val.entries()].reduce(
343 (entries, [key, val2], i) => {
344 entries[stringifySymbol(key, i) + " =>"] = val2;
345 return entries;
346 },
347 {}
348 )
349 };
350 } else if (isSet(val)) {
351 return {
352 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
353 };
354 } else if (isSymbol(val)) {
355 return stringifySymbol(val);
356 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
357 return String(val);
358 }
359 return val;
360 };
361 const stringifySymbol = (v, i = "") => {
362 var _a;
363 return (
364 // Symbol.description in es2019+ so we need to cast here to pass
365 // the lib: es2016 check
366 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
367 );
368 };
369
370 function warn$2(msg, ...args) {
371 console.warn(`[Vue warn] ${msg}`, ...args);
372 }
373
374 let activeEffectScope;
375 class EffectScope {
376 constructor(detached = false) {
377 this.detached = detached;
378 /**
379 * @internal
380 */
381 this._active = true;
382 /**
383 * @internal
384 */
385 this.effects = [];
386 /**
387 * @internal
388 */
389 this.cleanups = [];
390 this.parent = activeEffectScope;
391 if (!detached && activeEffectScope) {
392 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
393 this
394 ) - 1;
395 }
396 }
397 get active() {
398 return this._active;
399 }
400 run(fn) {
401 if (this._active) {
402 const currentEffectScope = activeEffectScope;
403 try {
404 activeEffectScope = this;
405 return fn();
406 } finally {
407 activeEffectScope = currentEffectScope;
408 }
409 } else {
410 warn$2(`cannot run an inactive effect scope.`);
411 }
412 }
413 /**
414 * This should only be called on non-detached scopes
415 * @internal
416 */
417 on() {
418 activeEffectScope = this;
419 }
420 /**
421 * This should only be called on non-detached scopes
422 * @internal
423 */
424 off() {
425 activeEffectScope = this.parent;
426 }
427 stop(fromParent) {
428 if (this._active) {
429 let i, l;
430 for (i = 0, l = this.effects.length; i < l; i++) {
431 this.effects[i].stop();
432 }
433 for (i = 0, l = this.cleanups.length; i < l; i++) {
434 this.cleanups[i]();
435 }
436 if (this.scopes) {
437 for (i = 0, l = this.scopes.length; i < l; i++) {
438 this.scopes[i].stop(true);
439 }
440 }
441 if (!this.detached && this.parent && !fromParent) {
442 const last = this.parent.scopes.pop();
443 if (last && last !== this) {
444 this.parent.scopes[this.index] = last;
445 last.index = this.index;
446 }
447 }
448 this.parent = void 0;
449 this._active = false;
450 }
451 }
452 }
453 function effectScope(detached) {
454 return new EffectScope(detached);
455 }
456 function recordEffectScope(effect, scope = activeEffectScope) {
457 if (scope && scope.active) {
458 scope.effects.push(effect);
459 }
460 }
461 function getCurrentScope() {
462 return activeEffectScope;
463 }
464 function onScopeDispose(fn) {
465 if (activeEffectScope) {
466 activeEffectScope.cleanups.push(fn);
467 } else {
468 warn$2(
469 `onScopeDispose() is called when there is no active effect scope to be associated with.`
470 );
471 }
472 }
473
474 let activeEffect;
475 class ReactiveEffect {
476 constructor(fn, trigger, scheduler, scope) {
477 this.fn = fn;
478 this.trigger = trigger;
479 this.scheduler = scheduler;
480 this.active = true;
481 this.deps = [];
482 /**
483 * @internal
484 */
485 this._dirtyLevel = 4;
486 /**
487 * @internal
488 */
489 this._trackId = 0;
490 /**
491 * @internal
492 */
493 this._runnings = 0;
494 /**
495 * @internal
496 */
497 this._shouldSchedule = false;
498 /**
499 * @internal
500 */
501 this._depsLength = 0;
502 recordEffectScope(this, scope);
503 }
504 get dirty() {
505 if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
506 this._dirtyLevel = 1;
507 pauseTracking();
508 for (let i = 0; i < this._depsLength; i++) {
509 const dep = this.deps[i];
510 if (dep.computed) {
511 triggerComputed(dep.computed);
512 if (this._dirtyLevel >= 4) {
513 break;
514 }
515 }
516 }
517 if (this._dirtyLevel === 1) {
518 this._dirtyLevel = 0;
519 }
520 resetTracking();
521 }
522 return this._dirtyLevel >= 4;
523 }
524 set dirty(v) {
525 this._dirtyLevel = v ? 4 : 0;
526 }
527 run() {
528 this._dirtyLevel = 0;
529 if (!this.active) {
530 return this.fn();
531 }
532 let lastShouldTrack = shouldTrack;
533 let lastEffect = activeEffect;
534 try {
535 shouldTrack = true;
536 activeEffect = this;
537 this._runnings++;
538 preCleanupEffect(this);
539 return this.fn();
540 } finally {
541 postCleanupEffect(this);
542 this._runnings--;
543 activeEffect = lastEffect;
544 shouldTrack = lastShouldTrack;
545 }
546 }
547 stop() {
548 if (this.active) {
549 preCleanupEffect(this);
550 postCleanupEffect(this);
551 this.onStop && this.onStop();
552 this.active = false;
553 }
554 }
555 }
556 function triggerComputed(computed) {
557 return computed.value;
558 }
559 function preCleanupEffect(effect2) {
560 effect2._trackId++;
561 effect2._depsLength = 0;
562 }
563 function postCleanupEffect(effect2) {
564 if (effect2.deps.length > effect2._depsLength) {
565 for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
566 cleanupDepEffect(effect2.deps[i], effect2);
567 }
568 effect2.deps.length = effect2._depsLength;
569 }
570 }
571 function cleanupDepEffect(dep, effect2) {
572 const trackId = dep.get(effect2);
573 if (trackId !== void 0 && effect2._trackId !== trackId) {
574 dep.delete(effect2);
575 if (dep.size === 0) {
576 dep.cleanup();
577 }
578 }
579 }
580 function effect(fn, options) {
581 if (fn.effect instanceof ReactiveEffect) {
582 fn = fn.effect.fn;
583 }
584 const _effect = new ReactiveEffect(fn, NOOP, () => {
585 if (_effect.dirty) {
586 _effect.run();
587 }
588 });
589 if (options) {
590 extend(_effect, options);
591 if (options.scope)
592 recordEffectScope(_effect, options.scope);
593 }
594 if (!options || !options.lazy) {
595 _effect.run();
596 }
597 const runner = _effect.run.bind(_effect);
598 runner.effect = _effect;
599 return runner;
600 }
601 function stop(runner) {
602 runner.effect.stop();
603 }
604 let shouldTrack = true;
605 let pauseScheduleStack = 0;
606 const trackStack = [];
607 function pauseTracking() {
608 trackStack.push(shouldTrack);
609 shouldTrack = false;
610 }
611 function resetTracking() {
612 const last = trackStack.pop();
613 shouldTrack = last === void 0 ? true : last;
614 }
615 function pauseScheduling() {
616 pauseScheduleStack++;
617 }
618 function resetScheduling() {
619 pauseScheduleStack--;
620 while (!pauseScheduleStack && queueEffectSchedulers.length) {
621 queueEffectSchedulers.shift()();
622 }
623 }
624 function trackEffect(effect2, dep, debuggerEventExtraInfo) {
625 var _a;
626 if (dep.get(effect2) !== effect2._trackId) {
627 dep.set(effect2, effect2._trackId);
628 const oldDep = effect2.deps[effect2._depsLength];
629 if (oldDep !== dep) {
630 if (oldDep) {
631 cleanupDepEffect(oldDep, effect2);
632 }
633 effect2.deps[effect2._depsLength++] = dep;
634 } else {
635 effect2._depsLength++;
636 }
637 {
638 (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
639 }
640 }
641 }
642 const queueEffectSchedulers = [];
643 function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
644 var _a;
645 pauseScheduling();
646 for (const effect2 of dep.keys()) {
647 let tracking;
648 if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
649 effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
650 effect2._dirtyLevel = dirtyLevel;
651 }
652 if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
653 {
654 (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
655 }
656 effect2.trigger();
657 if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
658 effect2._shouldSchedule = false;
659 if (effect2.scheduler) {
660 queueEffectSchedulers.push(effect2.scheduler);
661 }
662 }
663 }
664 }
665 resetScheduling();
666 }
667
668 const createDep = (cleanup, computed) => {
669 const dep = /* @__PURE__ */ new Map();
670 dep.cleanup = cleanup;
671 dep.computed = computed;
672 return dep;
673 };
674
675 const targetMap = /* @__PURE__ */ new WeakMap();
676 const ITERATE_KEY = Symbol("iterate" );
677 const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
678 function track(target, type, key) {
679 if (shouldTrack && activeEffect) {
680 let depsMap = targetMap.get(target);
681 if (!depsMap) {
682 targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
683 }
684 let dep = depsMap.get(key);
685 if (!dep) {
686 depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
687 }
688 trackEffect(
689 activeEffect,
690 dep,
691 {
692 target,
693 type,
694 key
695 }
696 );
697 }
698 }
699 function trigger(target, type, key, newValue, oldValue, oldTarget) {
700 const depsMap = targetMap.get(target);
701 if (!depsMap) {
702 return;
703 }
704 let deps = [];
705 if (type === "clear") {
706 deps = [...depsMap.values()];
707 } else if (key === "length" && isArray(target)) {
708 const newLength = Number(newValue);
709 depsMap.forEach((dep, key2) => {
710 if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
711 deps.push(dep);
712 }
713 });
714 } else {
715 if (key !== void 0) {
716 deps.push(depsMap.get(key));
717 }
718 switch (type) {
719 case "add":
720 if (!isArray(target)) {
721 deps.push(depsMap.get(ITERATE_KEY));
722 if (isMap(target)) {
723 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
724 }
725 } else if (isIntegerKey(key)) {
726 deps.push(depsMap.get("length"));
727 }
728 break;
729 case "delete":
730 if (!isArray(target)) {
731 deps.push(depsMap.get(ITERATE_KEY));
732 if (isMap(target)) {
733 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
734 }
735 }
736 break;
737 case "set":
738 if (isMap(target)) {
739 deps.push(depsMap.get(ITERATE_KEY));
740 }
741 break;
742 }
743 }
744 pauseScheduling();
745 for (const dep of deps) {
746 if (dep) {
747 triggerEffects(
748 dep,
749 4,
750 {
751 target,
752 type,
753 key,
754 newValue,
755 oldValue,
756 oldTarget
757 }
758 );
759 }
760 }
761 resetScheduling();
762 }
763 function getDepFromReactive(object, key) {
764 const depsMap = targetMap.get(object);
765 return depsMap && depsMap.get(key);
766 }
767
768 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
769 const builtInSymbols = new Set(
770 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
771 );
772 const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
773 function createArrayInstrumentations() {
774 const instrumentations = {};
775 ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
776 instrumentations[key] = function(...args) {
777 const arr = toRaw(this);
778 for (let i = 0, l = this.length; i < l; i++) {
779 track(arr, "get", i + "");
780 }
781 const res = arr[key](...args);
782 if (res === -1 || res === false) {
783 return arr[key](...args.map(toRaw));
784 } else {
785 return res;
786 }
787 };
788 });
789 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
790 instrumentations[key] = function(...args) {
791 pauseTracking();
792 pauseScheduling();
793 const res = toRaw(this)[key].apply(this, args);
794 resetScheduling();
795 resetTracking();
796 return res;
797 };
798 });
799 return instrumentations;
800 }
801 function hasOwnProperty(key) {
802 if (!isSymbol(key))
803 key = String(key);
804 const obj = toRaw(this);
805 track(obj, "has", key);
806 return obj.hasOwnProperty(key);
807 }
808 class BaseReactiveHandler {
809 constructor(_isReadonly = false, _isShallow = false) {
810 this._isReadonly = _isReadonly;
811 this._isShallow = _isShallow;
812 }
813 get(target, key, receiver) {
814 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
815 if (key === "__v_isReactive") {
816 return !isReadonly2;
817 } else if (key === "__v_isReadonly") {
818 return isReadonly2;
819 } else if (key === "__v_isShallow") {
820 return isShallow2;
821 } else if (key === "__v_raw") {
822 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
823 // this means the reciever is a user proxy of the reactive proxy
824 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
825 return target;
826 }
827 return;
828 }
829 const targetIsArray = isArray(target);
830 if (!isReadonly2) {
831 if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
832 return Reflect.get(arrayInstrumentations, key, receiver);
833 }
834 if (key === "hasOwnProperty") {
835 return hasOwnProperty;
836 }
837 }
838 const res = Reflect.get(target, key, receiver);
839 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
840 return res;
841 }
842 if (!isReadonly2) {
843 track(target, "get", key);
844 }
845 if (isShallow2) {
846 return res;
847 }
848 if (isRef(res)) {
849 return targetIsArray && isIntegerKey(key) ? res : res.value;
850 }
851 if (isObject(res)) {
852 return isReadonly2 ? readonly(res) : reactive(res);
853 }
854 return res;
855 }
856 }
857 class MutableReactiveHandler extends BaseReactiveHandler {
858 constructor(isShallow2 = false) {
859 super(false, isShallow2);
860 }
861 set(target, key, value, receiver) {
862 let oldValue = target[key];
863 if (!this._isShallow) {
864 const isOldValueReadonly = isReadonly(oldValue);
865 if (!isShallow(value) && !isReadonly(value)) {
866 oldValue = toRaw(oldValue);
867 value = toRaw(value);
868 }
869 if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
870 if (isOldValueReadonly) {
871 return false;
872 } else {
873 oldValue.value = value;
874 return true;
875 }
876 }
877 }
878 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
879 const result = Reflect.set(target, key, value, receiver);
880 if (target === toRaw(receiver)) {
881 if (!hadKey) {
882 trigger(target, "add", key, value);
883 } else if (hasChanged(value, oldValue)) {
884 trigger(target, "set", key, value, oldValue);
885 }
886 }
887 return result;
888 }
889 deleteProperty(target, key) {
890 const hadKey = hasOwn(target, key);
891 const oldValue = target[key];
892 const result = Reflect.deleteProperty(target, key);
893 if (result && hadKey) {
894 trigger(target, "delete", key, void 0, oldValue);
895 }
896 return result;
897 }
898 has(target, key) {
899 const result = Reflect.has(target, key);
900 if (!isSymbol(key) || !builtInSymbols.has(key)) {
901 track(target, "has", key);
902 }
903 return result;
904 }
905 ownKeys(target) {
906 track(
907 target,
908 "iterate",
909 isArray(target) ? "length" : ITERATE_KEY
910 );
911 return Reflect.ownKeys(target);
912 }
913 }
914 class ReadonlyReactiveHandler extends BaseReactiveHandler {
915 constructor(isShallow2 = false) {
916 super(true, isShallow2);
917 }
918 set(target, key) {
919 {
920 warn$2(
921 `Set operation on key "${String(key)}" failed: target is readonly.`,
922 target
923 );
924 }
925 return true;
926 }
927 deleteProperty(target, key) {
928 {
929 warn$2(
930 `Delete operation on key "${String(key)}" failed: target is readonly.`,
931 target
932 );
933 }
934 return true;
935 }
936 }
937 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
938 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
939 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
940 true
941 );
942 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
943
944 const toShallow = (value) => value;
945 const getProto = (v) => Reflect.getPrototypeOf(v);
946 function get(target, key, isReadonly = false, isShallow = false) {
947 target = target["__v_raw"];
948 const rawTarget = toRaw(target);
949 const rawKey = toRaw(key);
950 if (!isReadonly) {
951 if (hasChanged(key, rawKey)) {
952 track(rawTarget, "get", key);
953 }
954 track(rawTarget, "get", rawKey);
955 }
956 const { has: has2 } = getProto(rawTarget);
957 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
958 if (has2.call(rawTarget, key)) {
959 return wrap(target.get(key));
960 } else if (has2.call(rawTarget, rawKey)) {
961 return wrap(target.get(rawKey));
962 } else if (target !== rawTarget) {
963 target.get(key);
964 }
965 }
966 function has(key, isReadonly = false) {
967 const target = this["__v_raw"];
968 const rawTarget = toRaw(target);
969 const rawKey = toRaw(key);
970 if (!isReadonly) {
971 if (hasChanged(key, rawKey)) {
972 track(rawTarget, "has", key);
973 }
974 track(rawTarget, "has", rawKey);
975 }
976 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
977 }
978 function size(target, isReadonly = false) {
979 target = target["__v_raw"];
980 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
981 return Reflect.get(target, "size", target);
982 }
983 function add(value) {
984 value = toRaw(value);
985 const target = toRaw(this);
986 const proto = getProto(target);
987 const hadKey = proto.has.call(target, value);
988 if (!hadKey) {
989 target.add(value);
990 trigger(target, "add", value, value);
991 }
992 return this;
993 }
994 function set(key, value) {
995 value = toRaw(value);
996 const target = toRaw(this);
997 const { has: has2, get: get2 } = getProto(target);
998 let hadKey = has2.call(target, key);
999 if (!hadKey) {
1000 key = toRaw(key);
1001 hadKey = has2.call(target, key);
1002 } else {
1003 checkIdentityKeys(target, has2, key);
1004 }
1005 const oldValue = get2.call(target, key);
1006 target.set(key, value);
1007 if (!hadKey) {
1008 trigger(target, "add", key, value);
1009 } else if (hasChanged(value, oldValue)) {
1010 trigger(target, "set", key, value, oldValue);
1011 }
1012 return this;
1013 }
1014 function deleteEntry(key) {
1015 const target = toRaw(this);
1016 const { has: has2, get: get2 } = getProto(target);
1017 let hadKey = has2.call(target, key);
1018 if (!hadKey) {
1019 key = toRaw(key);
1020 hadKey = has2.call(target, key);
1021 } else {
1022 checkIdentityKeys(target, has2, key);
1023 }
1024 const oldValue = get2 ? get2.call(target, key) : void 0;
1025 const result = target.delete(key);
1026 if (hadKey) {
1027 trigger(target, "delete", key, void 0, oldValue);
1028 }
1029 return result;
1030 }
1031 function clear() {
1032 const target = toRaw(this);
1033 const hadItems = target.size !== 0;
1034 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
1035 const result = target.clear();
1036 if (hadItems) {
1037 trigger(target, "clear", void 0, void 0, oldTarget);
1038 }
1039 return result;
1040 }
1041 function createForEach(isReadonly, isShallow) {
1042 return function forEach(callback, thisArg) {
1043 const observed = this;
1044 const target = observed["__v_raw"];
1045 const rawTarget = toRaw(target);
1046 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1047 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
1048 return target.forEach((value, key) => {
1049 return callback.call(thisArg, wrap(value), wrap(key), observed);
1050 });
1051 };
1052 }
1053 function createIterableMethod(method, isReadonly, isShallow) {
1054 return function(...args) {
1055 const target = this["__v_raw"];
1056 const rawTarget = toRaw(target);
1057 const targetIsMap = isMap(rawTarget);
1058 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1059 const isKeyOnly = method === "keys" && targetIsMap;
1060 const innerIterator = target[method](...args);
1061 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1062 !isReadonly && track(
1063 rawTarget,
1064 "iterate",
1065 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1066 );
1067 return {
1068 // iterator protocol
1069 next() {
1070 const { value, done } = innerIterator.next();
1071 return done ? { value, done } : {
1072 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1073 done
1074 };
1075 },
1076 // iterable protocol
1077 [Symbol.iterator]() {
1078 return this;
1079 }
1080 };
1081 };
1082 }
1083 function createReadonlyMethod(type) {
1084 return function(...args) {
1085 {
1086 const key = args[0] ? `on key "${args[0]}" ` : ``;
1087 warn$2(
1088 `${capitalize(type)} operation ${key}failed: target is readonly.`,
1089 toRaw(this)
1090 );
1091 }
1092 return type === "delete" ? false : type === "clear" ? void 0 : this;
1093 };
1094 }
1095 function createInstrumentations() {
1096 const mutableInstrumentations2 = {
1097 get(key) {
1098 return get(this, key);
1099 },
1100 get size() {
1101 return size(this);
1102 },
1103 has,
1104 add,
1105 set,
1106 delete: deleteEntry,
1107 clear,
1108 forEach: createForEach(false, false)
1109 };
1110 const shallowInstrumentations2 = {
1111 get(key) {
1112 return get(this, key, false, true);
1113 },
1114 get size() {
1115 return size(this);
1116 },
1117 has,
1118 add,
1119 set,
1120 delete: deleteEntry,
1121 clear,
1122 forEach: createForEach(false, true)
1123 };
1124 const readonlyInstrumentations2 = {
1125 get(key) {
1126 return get(this, key, true);
1127 },
1128 get size() {
1129 return size(this, true);
1130 },
1131 has(key) {
1132 return has.call(this, key, true);
1133 },
1134 add: createReadonlyMethod("add"),
1135 set: createReadonlyMethod("set"),
1136 delete: createReadonlyMethod("delete"),
1137 clear: createReadonlyMethod("clear"),
1138 forEach: createForEach(true, false)
1139 };
1140 const shallowReadonlyInstrumentations2 = {
1141 get(key) {
1142 return get(this, key, true, true);
1143 },
1144 get size() {
1145 return size(this, true);
1146 },
1147 has(key) {
1148 return has.call(this, key, true);
1149 },
1150 add: createReadonlyMethod("add"),
1151 set: createReadonlyMethod("set"),
1152 delete: createReadonlyMethod("delete"),
1153 clear: createReadonlyMethod("clear"),
1154 forEach: createForEach(true, true)
1155 };
1156 const iteratorMethods = [
1157 "keys",
1158 "values",
1159 "entries",
1160 Symbol.iterator
1161 ];
1162 iteratorMethods.forEach((method) => {
1163 mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1164 readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1165 shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1166 shallowReadonlyInstrumentations2[method] = createIterableMethod(
1167 method,
1168 true,
1169 true
1170 );
1171 });
1172 return [
1173 mutableInstrumentations2,
1174 readonlyInstrumentations2,
1175 shallowInstrumentations2,
1176 shallowReadonlyInstrumentations2
1177 ];
1178 }
1179 const [
1180 mutableInstrumentations,
1181 readonlyInstrumentations,
1182 shallowInstrumentations,
1183 shallowReadonlyInstrumentations
1184 ] = /* @__PURE__ */ createInstrumentations();
1185 function createInstrumentationGetter(isReadonly, shallow) {
1186 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
1187 return (target, key, receiver) => {
1188 if (key === "__v_isReactive") {
1189 return !isReadonly;
1190 } else if (key === "__v_isReadonly") {
1191 return isReadonly;
1192 } else if (key === "__v_raw") {
1193 return target;
1194 }
1195 return Reflect.get(
1196 hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1197 key,
1198 receiver
1199 );
1200 };
1201 }
1202 const mutableCollectionHandlers = {
1203 get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1204 };
1205 const shallowCollectionHandlers = {
1206 get: /* @__PURE__ */ createInstrumentationGetter(false, true)
1207 };
1208 const readonlyCollectionHandlers = {
1209 get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1210 };
1211 const shallowReadonlyCollectionHandlers = {
1212 get: /* @__PURE__ */ createInstrumentationGetter(true, true)
1213 };
1214 function checkIdentityKeys(target, has2, key) {
1215 const rawKey = toRaw(key);
1216 if (rawKey !== key && has2.call(target, rawKey)) {
1217 const type = toRawType(target);
1218 warn$2(
1219 `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
1220 );
1221 }
1222 }
1223
1224 const reactiveMap = /* @__PURE__ */ new WeakMap();
1225 const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1226 const readonlyMap = /* @__PURE__ */ new WeakMap();
1227 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1228 function targetTypeMap(rawType) {
1229 switch (rawType) {
1230 case "Object":
1231 case "Array":
1232 return 1 /* COMMON */;
1233 case "Map":
1234 case "Set":
1235 case "WeakMap":
1236 case "WeakSet":
1237 return 2 /* COLLECTION */;
1238 default:
1239 return 0 /* INVALID */;
1240 }
1241 }
1242 function getTargetType(value) {
1243 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1244 }
1245 function reactive(target) {
1246 if (isReadonly(target)) {
1247 return target;
1248 }
1249 return createReactiveObject(
1250 target,
1251 false,
1252 mutableHandlers,
1253 mutableCollectionHandlers,
1254 reactiveMap
1255 );
1256 }
1257 function shallowReactive(target) {
1258 return createReactiveObject(
1259 target,
1260 false,
1261 shallowReactiveHandlers,
1262 shallowCollectionHandlers,
1263 shallowReactiveMap
1264 );
1265 }
1266 function readonly(target) {
1267 return createReactiveObject(
1268 target,
1269 true,
1270 readonlyHandlers,
1271 readonlyCollectionHandlers,
1272 readonlyMap
1273 );
1274 }
1275 function shallowReadonly(target) {
1276 return createReactiveObject(
1277 target,
1278 true,
1279 shallowReadonlyHandlers,
1280 shallowReadonlyCollectionHandlers,
1281 shallowReadonlyMap
1282 );
1283 }
1284 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1285 if (!isObject(target)) {
1286 {
1287 warn$2(`value cannot be made reactive: ${String(target)}`);
1288 }
1289 return target;
1290 }
1291 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1292 return target;
1293 }
1294 const existingProxy = proxyMap.get(target);
1295 if (existingProxy) {
1296 return existingProxy;
1297 }
1298 const targetType = getTargetType(target);
1299 if (targetType === 0 /* INVALID */) {
1300 return target;
1301 }
1302 const proxy = new Proxy(
1303 target,
1304 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1305 );
1306 proxyMap.set(target, proxy);
1307 return proxy;
1308 }
1309 function isReactive(value) {
1310 if (isReadonly(value)) {
1311 return isReactive(value["__v_raw"]);
1312 }
1313 return !!(value && value["__v_isReactive"]);
1314 }
1315 function isReadonly(value) {
1316 return !!(value && value["__v_isReadonly"]);
1317 }
1318 function isShallow(value) {
1319 return !!(value && value["__v_isShallow"]);
1320 }
1321 function isProxy(value) {
1322 return value ? !!value["__v_raw"] : false;
1323 }
1324 function toRaw(observed) {
1325 const raw = observed && observed["__v_raw"];
1326 return raw ? toRaw(raw) : observed;
1327 }
1328 function markRaw(value) {
1329 if (Object.isExtensible(value)) {
1330 def(value, "__v_skip", true);
1331 }
1332 return value;
1333 }
1334 const toReactive = (value) => isObject(value) ? reactive(value) : value;
1335 const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1336
1337 const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1338 class ComputedRefImpl {
1339 constructor(getter, _setter, isReadonly, isSSR) {
1340 this.getter = getter;
1341 this._setter = _setter;
1342 this.dep = void 0;
1343 this.__v_isRef = true;
1344 this["__v_isReadonly"] = false;
1345 this.effect = new ReactiveEffect(
1346 () => getter(this._value),
1347 () => triggerRefValue(
1348 this,
1349 this.effect._dirtyLevel === 2 ? 2 : 3
1350 )
1351 );
1352 this.effect.computed = this;
1353 this.effect.active = this._cacheable = !isSSR;
1354 this["__v_isReadonly"] = isReadonly;
1355 }
1356 get value() {
1357 const self = toRaw(this);
1358 if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1359 triggerRefValue(self, 4);
1360 }
1361 trackRefValue(self);
1362 if (self.effect._dirtyLevel >= 2) {
1363 if (this._warnRecursive) {
1364 warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1365
1366getter: `, this.getter);
1367 }
1368 triggerRefValue(self, 2);
1369 }
1370 return self._value;
1371 }
1372 set value(newValue) {
1373 this._setter(newValue);
1374 }
1375 // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1376 get _dirty() {
1377 return this.effect.dirty;
1378 }
1379 set _dirty(v) {
1380 this.effect.dirty = v;
1381 }
1382 // #endregion
1383 }
1384 function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1385 let getter;
1386 let setter;
1387 const onlyGetter = isFunction(getterOrOptions);
1388 if (onlyGetter) {
1389 getter = getterOrOptions;
1390 setter = () => {
1391 warn$2("Write operation failed: computed value is readonly");
1392 } ;
1393 } else {
1394 getter = getterOrOptions.get;
1395 setter = getterOrOptions.set;
1396 }
1397 const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1398 if (debugOptions && !isSSR) {
1399 cRef.effect.onTrack = debugOptions.onTrack;
1400 cRef.effect.onTrigger = debugOptions.onTrigger;
1401 }
1402 return cRef;
1403 }
1404
1405 function trackRefValue(ref2) {
1406 var _a;
1407 if (shouldTrack && activeEffect) {
1408 ref2 = toRaw(ref2);
1409 trackEffect(
1410 activeEffect,
1411 (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1412 () => ref2.dep = void 0,
1413 ref2 instanceof ComputedRefImpl ? ref2 : void 0
1414 ),
1415 {
1416 target: ref2,
1417 type: "get",
1418 key: "value"
1419 }
1420 );
1421 }
1422 }
1423 function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1424 ref2 = toRaw(ref2);
1425 const dep = ref2.dep;
1426 if (dep) {
1427 triggerEffects(
1428 dep,
1429 dirtyLevel,
1430 {
1431 target: ref2,
1432 type: "set",
1433 key: "value",
1434 newValue: newVal
1435 }
1436 );
1437 }
1438 }
1439 function isRef(r) {
1440 return !!(r && r.__v_isRef === true);
1441 }
1442 function ref(value) {
1443 return createRef(value, false);
1444 }
1445 function shallowRef(value) {
1446 return createRef(value, true);
1447 }
1448 function createRef(rawValue, shallow) {
1449 if (isRef(rawValue)) {
1450 return rawValue;
1451 }
1452 return new RefImpl(rawValue, shallow);
1453 }
1454 class RefImpl {
1455 constructor(value, __v_isShallow) {
1456 this.__v_isShallow = __v_isShallow;
1457 this.dep = void 0;
1458 this.__v_isRef = true;
1459 this._rawValue = __v_isShallow ? value : toRaw(value);
1460 this._value = __v_isShallow ? value : toReactive(value);
1461 }
1462 get value() {
1463 trackRefValue(this);
1464 return this._value;
1465 }
1466 set value(newVal) {
1467 const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1468 newVal = useDirectValue ? newVal : toRaw(newVal);
1469 if (hasChanged(newVal, this._rawValue)) {
1470 this._rawValue = newVal;
1471 this._value = useDirectValue ? newVal : toReactive(newVal);
1472 triggerRefValue(this, 4, newVal);
1473 }
1474 }
1475 }
1476 function triggerRef(ref2) {
1477 triggerRefValue(ref2, 4, ref2.value );
1478 }
1479 function unref(ref2) {
1480 return isRef(ref2) ? ref2.value : ref2;
1481 }
1482 function toValue(source) {
1483 return isFunction(source) ? source() : unref(source);
1484 }
1485 const shallowUnwrapHandlers = {
1486 get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1487 set: (target, key, value, receiver) => {
1488 const oldValue = target[key];
1489 if (isRef(oldValue) && !isRef(value)) {
1490 oldValue.value = value;
1491 return true;
1492 } else {
1493 return Reflect.set(target, key, value, receiver);
1494 }
1495 }
1496 };
1497 function proxyRefs(objectWithRefs) {
1498 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1499 }
1500 class CustomRefImpl {
1501 constructor(factory) {
1502 this.dep = void 0;
1503 this.__v_isRef = true;
1504 const { get, set } = factory(
1505 () => trackRefValue(this),
1506 () => triggerRefValue(this)
1507 );
1508 this._get = get;
1509 this._set = set;
1510 }
1511 get value() {
1512 return this._get();
1513 }
1514 set value(newVal) {
1515 this._set(newVal);
1516 }
1517 }
1518 function customRef(factory) {
1519 return new CustomRefImpl(factory);
1520 }
1521 function toRefs(object) {
1522 if (!isProxy(object)) {
1523 warn$2(`toRefs() expects a reactive object but received a plain one.`);
1524 }
1525 const ret = isArray(object) ? new Array(object.length) : {};
1526 for (const key in object) {
1527 ret[key] = propertyToRef(object, key);
1528 }
1529 return ret;
1530 }
1531 class ObjectRefImpl {
1532 constructor(_object, _key, _defaultValue) {
1533 this._object = _object;
1534 this._key = _key;
1535 this._defaultValue = _defaultValue;
1536 this.__v_isRef = true;
1537 }
1538 get value() {
1539 const val = this._object[this._key];
1540 return val === void 0 ? this._defaultValue : val;
1541 }
1542 set value(newVal) {
1543 this._object[this._key] = newVal;
1544 }
1545 get dep() {
1546 return getDepFromReactive(toRaw(this._object), this._key);
1547 }
1548 }
1549 class GetterRefImpl {
1550 constructor(_getter) {
1551 this._getter = _getter;
1552 this.__v_isRef = true;
1553 this.__v_isReadonly = true;
1554 }
1555 get value() {
1556 return this._getter();
1557 }
1558 }
1559 function toRef(source, key, defaultValue) {
1560 if (isRef(source)) {
1561 return source;
1562 } else if (isFunction(source)) {
1563 return new GetterRefImpl(source);
1564 } else if (isObject(source) && arguments.length > 1) {
1565 return propertyToRef(source, key, defaultValue);
1566 } else {
1567 return ref(source);
1568 }
1569 }
1570 function propertyToRef(source, key, defaultValue) {
1571 const val = source[key];
1572 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1573 }
1574
1575 const TrackOpTypes = {
1576 "GET": "get",
1577 "HAS": "has",
1578 "ITERATE": "iterate"
1579 };
1580 const TriggerOpTypes = {
1581 "SET": "set",
1582 "ADD": "add",
1583 "DELETE": "delete",
1584 "CLEAR": "clear"
1585 };
1586
1587 const stack$1 = [];
1588 function pushWarningContext(vnode) {
1589 stack$1.push(vnode);
1590 }
1591 function popWarningContext() {
1592 stack$1.pop();
1593 }
1594 function warn$1(msg, ...args) {
1595 pauseTracking();
1596 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1597 const appWarnHandler = instance && instance.appContext.config.warnHandler;
1598 const trace = getComponentTrace();
1599 if (appWarnHandler) {
1600 callWithErrorHandling(
1601 appWarnHandler,
1602 instance,
1603 11,
1604 [
1605 msg + args.map((a) => {
1606 var _a, _b;
1607 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1608 }).join(""),
1609 instance && instance.proxy,
1610 trace.map(
1611 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
1612 ).join("\n"),
1613 trace
1614 ]
1615 );
1616 } else {
1617 const warnArgs = [`[Vue warn]: ${msg}`, ...args];
1618 if (trace.length && // avoid spamming console during tests
1619 true) {
1620 warnArgs.push(`
1621`, ...formatTrace(trace));
1622 }
1623 console.warn(...warnArgs);
1624 }
1625 resetTracking();
1626 }
1627 function getComponentTrace() {
1628 let currentVNode = stack$1[stack$1.length - 1];
1629 if (!currentVNode) {
1630 return [];
1631 }
1632 const normalizedStack = [];
1633 while (currentVNode) {
1634 const last = normalizedStack[0];
1635 if (last && last.vnode === currentVNode) {
1636 last.recurseCount++;
1637 } else {
1638 normalizedStack.push({
1639 vnode: currentVNode,
1640 recurseCount: 0
1641 });
1642 }
1643 const parentInstance = currentVNode.component && currentVNode.component.parent;
1644 currentVNode = parentInstance && parentInstance.vnode;
1645 }
1646 return normalizedStack;
1647 }
1648 function formatTrace(trace) {
1649 const logs = [];
1650 trace.forEach((entry, i) => {
1651 logs.push(...i === 0 ? [] : [`
1652`], ...formatTraceEntry(entry));
1653 });
1654 return logs;
1655 }
1656 function formatTraceEntry({ vnode, recurseCount }) {
1657 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
1658 const isRoot = vnode.component ? vnode.component.parent == null : false;
1659 const open = ` at <${formatComponentName(
1660 vnode.component,
1661 vnode.type,
1662 isRoot
1663 )}`;
1664 const close = `>` + postfix;
1665 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
1666 }
1667 function formatProps(props) {
1668 const res = [];
1669 const keys = Object.keys(props);
1670 keys.slice(0, 3).forEach((key) => {
1671 res.push(...formatProp(key, props[key]));
1672 });
1673 if (keys.length > 3) {
1674 res.push(` ...`);
1675 }
1676 return res;
1677 }
1678 function formatProp(key, value, raw) {
1679 if (isString(value)) {
1680 value = JSON.stringify(value);
1681 return raw ? value : [`${key}=${value}`];
1682 } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
1683 return raw ? value : [`${key}=${value}`];
1684 } else if (isRef(value)) {
1685 value = formatProp(key, toRaw(value.value), true);
1686 return raw ? value : [`${key}=Ref<`, value, `>`];
1687 } else if (isFunction(value)) {
1688 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
1689 } else {
1690 value = toRaw(value);
1691 return raw ? value : [`${key}=`, value];
1692 }
1693 }
1694 function assertNumber(val, type) {
1695 if (val === void 0) {
1696 return;
1697 } else if (typeof val !== "number") {
1698 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
1699 } else if (isNaN(val)) {
1700 warn$1(`${type} is NaN - the duration expression might be incorrect.`);
1701 }
1702 }
1703
1704 const ErrorCodes = {
1705 "SETUP_FUNCTION": 0,
1706 "0": "SETUP_FUNCTION",
1707 "RENDER_FUNCTION": 1,
1708 "1": "RENDER_FUNCTION",
1709 "WATCH_GETTER": 2,
1710 "2": "WATCH_GETTER",
1711 "WATCH_CALLBACK": 3,
1712 "3": "WATCH_CALLBACK",
1713 "WATCH_CLEANUP": 4,
1714 "4": "WATCH_CLEANUP",
1715 "NATIVE_EVENT_HANDLER": 5,
1716 "5": "NATIVE_EVENT_HANDLER",
1717 "COMPONENT_EVENT_HANDLER": 6,
1718 "6": "COMPONENT_EVENT_HANDLER",
1719 "VNODE_HOOK": 7,
1720 "7": "VNODE_HOOK",
1721 "DIRECTIVE_HOOK": 8,
1722 "8": "DIRECTIVE_HOOK",
1723 "TRANSITION_HOOK": 9,
1724 "9": "TRANSITION_HOOK",
1725 "APP_ERROR_HANDLER": 10,
1726 "10": "APP_ERROR_HANDLER",
1727 "APP_WARN_HANDLER": 11,
1728 "11": "APP_WARN_HANDLER",
1729 "FUNCTION_REF": 12,
1730 "12": "FUNCTION_REF",
1731 "ASYNC_COMPONENT_LOADER": 13,
1732 "13": "ASYNC_COMPONENT_LOADER",
1733 "SCHEDULER": 14,
1734 "14": "SCHEDULER"
1735 };
1736 const ErrorTypeStrings$1 = {
1737 ["sp"]: "serverPrefetch hook",
1738 ["bc"]: "beforeCreate hook",
1739 ["c"]: "created hook",
1740 ["bm"]: "beforeMount hook",
1741 ["m"]: "mounted hook",
1742 ["bu"]: "beforeUpdate hook",
1743 ["u"]: "updated",
1744 ["bum"]: "beforeUnmount hook",
1745 ["um"]: "unmounted hook",
1746 ["a"]: "activated hook",
1747 ["da"]: "deactivated hook",
1748 ["ec"]: "errorCaptured hook",
1749 ["rtc"]: "renderTracked hook",
1750 ["rtg"]: "renderTriggered hook",
1751 [0]: "setup function",
1752 [1]: "render function",
1753 [2]: "watcher getter",
1754 [3]: "watcher callback",
1755 [4]: "watcher cleanup function",
1756 [5]: "native event handler",
1757 [6]: "component event handler",
1758 [7]: "vnode hook",
1759 [8]: "directive hook",
1760 [9]: "transition hook",
1761 [10]: "app errorHandler",
1762 [11]: "app warnHandler",
1763 [12]: "ref function",
1764 [13]: "async component loader",
1765 [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1766 };
1767 function callWithErrorHandling(fn, instance, type, args) {
1768 try {
1769 return args ? fn(...args) : fn();
1770 } catch (err) {
1771 handleError(err, instance, type);
1772 }
1773 }
1774 function callWithAsyncErrorHandling(fn, instance, type, args) {
1775 if (isFunction(fn)) {
1776 const res = callWithErrorHandling(fn, instance, type, args);
1777 if (res && isPromise(res)) {
1778 res.catch((err) => {
1779 handleError(err, instance, type);
1780 });
1781 }
1782 return res;
1783 }
1784 if (isArray(fn)) {
1785 const values = [];
1786 for (let i = 0; i < fn.length; i++) {
1787 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1788 }
1789 return values;
1790 } else {
1791 warn$1(
1792 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1793 );
1794 }
1795 }
1796 function handleError(err, instance, type, throwInDev = true) {
1797 const contextVNode = instance ? instance.vnode : null;
1798 if (instance) {
1799 let cur = instance.parent;
1800 const exposedInstance = instance.proxy;
1801 const errorInfo = ErrorTypeStrings$1[type] ;
1802 while (cur) {
1803 const errorCapturedHooks = cur.ec;
1804 if (errorCapturedHooks) {
1805 for (let i = 0; i < errorCapturedHooks.length; i++) {
1806 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
1807 return;
1808 }
1809 }
1810 }
1811 cur = cur.parent;
1812 }
1813 const appErrorHandler = instance.appContext.config.errorHandler;
1814 if (appErrorHandler) {
1815 pauseTracking();
1816 callWithErrorHandling(
1817 appErrorHandler,
1818 null,
1819 10,
1820 [err, exposedInstance, errorInfo]
1821 );
1822 resetTracking();
1823 return;
1824 }
1825 }
1826 logError(err, type, contextVNode, throwInDev);
1827 }
1828 function logError(err, type, contextVNode, throwInDev = true) {
1829 {
1830 const info = ErrorTypeStrings$1[type];
1831 if (contextVNode) {
1832 pushWarningContext(contextVNode);
1833 }
1834 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
1835 if (contextVNode) {
1836 popWarningContext();
1837 }
1838 if (throwInDev) {
1839 throw err;
1840 } else {
1841 console.error(err);
1842 }
1843 }
1844 }
1845
1846 let isFlushing = false;
1847 let isFlushPending = false;
1848 const queue = [];
1849 let flushIndex = 0;
1850 const pendingPostFlushCbs = [];
1851 let activePostFlushCbs = null;
1852 let postFlushIndex = 0;
1853 const resolvedPromise = /* @__PURE__ */ Promise.resolve();
1854 let currentFlushPromise = null;
1855 const RECURSION_LIMIT = 100;
1856 function nextTick(fn) {
1857 const p = currentFlushPromise || resolvedPromise;
1858 return fn ? p.then(this ? fn.bind(this) : fn) : p;
1859 }
1860 function findInsertionIndex(id) {
1861 let start = flushIndex + 1;
1862 let end = queue.length;
1863 while (start < end) {
1864 const middle = start + end >>> 1;
1865 const middleJob = queue[middle];
1866 const middleJobId = getId(middleJob);
1867 if (middleJobId < id || middleJobId === id && middleJob.pre) {
1868 start = middle + 1;
1869 } else {
1870 end = middle;
1871 }
1872 }
1873 return start;
1874 }
1875 function queueJob(job) {
1876 if (!queue.length || !queue.includes(
1877 job,
1878 isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1879 )) {
1880 if (job.id == null) {
1881 queue.push(job);
1882 } else {
1883 queue.splice(findInsertionIndex(job.id), 0, job);
1884 }
1885 queueFlush();
1886 }
1887 }
1888 function queueFlush() {
1889 if (!isFlushing && !isFlushPending) {
1890 isFlushPending = true;
1891 currentFlushPromise = resolvedPromise.then(flushJobs);
1892 }
1893 }
1894 function invalidateJob(job) {
1895 const i = queue.indexOf(job);
1896 if (i > flushIndex) {
1897 queue.splice(i, 1);
1898 }
1899 }
1900 function queuePostFlushCb(cb) {
1901 if (!isArray(cb)) {
1902 if (!activePostFlushCbs || !activePostFlushCbs.includes(
1903 cb,
1904 cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1905 )) {
1906 pendingPostFlushCbs.push(cb);
1907 }
1908 } else {
1909 pendingPostFlushCbs.push(...cb);
1910 }
1911 queueFlush();
1912 }
1913 function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1914 {
1915 seen = seen || /* @__PURE__ */ new Map();
1916 }
1917 for (; i < queue.length; i++) {
1918 const cb = queue[i];
1919 if (cb && cb.pre) {
1920 if (instance && cb.id !== instance.uid) {
1921 continue;
1922 }
1923 if (checkRecursiveUpdates(seen, cb)) {
1924 continue;
1925 }
1926 queue.splice(i, 1);
1927 i--;
1928 cb();
1929 }
1930 }
1931 }
1932 function flushPostFlushCbs(seen) {
1933 if (pendingPostFlushCbs.length) {
1934 const deduped = [...new Set(pendingPostFlushCbs)].sort(
1935 (a, b) => getId(a) - getId(b)
1936 );
1937 pendingPostFlushCbs.length = 0;
1938 if (activePostFlushCbs) {
1939 activePostFlushCbs.push(...deduped);
1940 return;
1941 }
1942 activePostFlushCbs = deduped;
1943 {
1944 seen = seen || /* @__PURE__ */ new Map();
1945 }
1946 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1947 if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1948 continue;
1949 }
1950 activePostFlushCbs[postFlushIndex]();
1951 }
1952 activePostFlushCbs = null;
1953 postFlushIndex = 0;
1954 }
1955 }
1956 const getId = (job) => job.id == null ? Infinity : job.id;
1957 const comparator = (a, b) => {
1958 const diff = getId(a) - getId(b);
1959 if (diff === 0) {
1960 if (a.pre && !b.pre)
1961 return -1;
1962 if (b.pre && !a.pre)
1963 return 1;
1964 }
1965 return diff;
1966 };
1967 function flushJobs(seen) {
1968 isFlushPending = false;
1969 isFlushing = true;
1970 {
1971 seen = seen || /* @__PURE__ */ new Map();
1972 }
1973 queue.sort(comparator);
1974 const check = (job) => checkRecursiveUpdates(seen, job) ;
1975 try {
1976 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1977 const job = queue[flushIndex];
1978 if (job && job.active !== false) {
1979 if (check(job)) {
1980 continue;
1981 }
1982 callWithErrorHandling(job, null, 14);
1983 }
1984 }
1985 } finally {
1986 flushIndex = 0;
1987 queue.length = 0;
1988 flushPostFlushCbs(seen);
1989 isFlushing = false;
1990 currentFlushPromise = null;
1991 if (queue.length || pendingPostFlushCbs.length) {
1992 flushJobs(seen);
1993 }
1994 }
1995 }
1996 function checkRecursiveUpdates(seen, fn) {
1997 if (!seen.has(fn)) {
1998 seen.set(fn, 1);
1999 } else {
2000 const count = seen.get(fn);
2001 if (count > RECURSION_LIMIT) {
2002 const instance = fn.ownerInstance;
2003 const componentName = instance && getComponentName(instance.type);
2004 handleError(
2005 `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2006 null,
2007 10
2008 );
2009 return true;
2010 } else {
2011 seen.set(fn, count + 1);
2012 }
2013 }
2014 }
2015
2016 let isHmrUpdating = false;
2017 const hmrDirtyComponents = /* @__PURE__ */ new Set();
2018 {
2019 getGlobalThis().__VUE_HMR_RUNTIME__ = {
2020 createRecord: tryWrap(createRecord),
2021 rerender: tryWrap(rerender),
2022 reload: tryWrap(reload)
2023 };
2024 }
2025 const map = /* @__PURE__ */ new Map();
2026 function registerHMR(instance) {
2027 const id = instance.type.__hmrId;
2028 let record = map.get(id);
2029 if (!record) {
2030 createRecord(id, instance.type);
2031 record = map.get(id);
2032 }
2033 record.instances.add(instance);
2034 }
2035 function unregisterHMR(instance) {
2036 map.get(instance.type.__hmrId).instances.delete(instance);
2037 }
2038 function createRecord(id, initialDef) {
2039 if (map.has(id)) {
2040 return false;
2041 }
2042 map.set(id, {
2043 initialDef: normalizeClassComponent(initialDef),
2044 instances: /* @__PURE__ */ new Set()
2045 });
2046 return true;
2047 }
2048 function normalizeClassComponent(component) {
2049 return isClassComponent(component) ? component.__vccOpts : component;
2050 }
2051 function rerender(id, newRender) {
2052 const record = map.get(id);
2053 if (!record) {
2054 return;
2055 }
2056 record.initialDef.render = newRender;
2057 [...record.instances].forEach((instance) => {
2058 if (newRender) {
2059 instance.render = newRender;
2060 normalizeClassComponent(instance.type).render = newRender;
2061 }
2062 instance.renderCache = [];
2063 isHmrUpdating = true;
2064 instance.effect.dirty = true;
2065 instance.update();
2066 isHmrUpdating = false;
2067 });
2068 }
2069 function reload(id, newComp) {
2070 const record = map.get(id);
2071 if (!record)
2072 return;
2073 newComp = normalizeClassComponent(newComp);
2074 updateComponentDef(record.initialDef, newComp);
2075 const instances = [...record.instances];
2076 for (const instance of instances) {
2077 const oldComp = normalizeClassComponent(instance.type);
2078 if (!hmrDirtyComponents.has(oldComp)) {
2079 if (oldComp !== record.initialDef) {
2080 updateComponentDef(oldComp, newComp);
2081 }
2082 hmrDirtyComponents.add(oldComp);
2083 }
2084 instance.appContext.propsCache.delete(instance.type);
2085 instance.appContext.emitsCache.delete(instance.type);
2086 instance.appContext.optionsCache.delete(instance.type);
2087 if (instance.ceReload) {
2088 hmrDirtyComponents.add(oldComp);
2089 instance.ceReload(newComp.styles);
2090 hmrDirtyComponents.delete(oldComp);
2091 } else if (instance.parent) {
2092 instance.parent.effect.dirty = true;
2093 queueJob(instance.parent.update);
2094 } else if (instance.appContext.reload) {
2095 instance.appContext.reload();
2096 } else if (typeof window !== "undefined") {
2097 window.location.reload();
2098 } else {
2099 console.warn(
2100 "[HMR] Root or manually mounted instance modified. Full reload required."
2101 );
2102 }
2103 }
2104 queuePostFlushCb(() => {
2105 for (const instance of instances) {
2106 hmrDirtyComponents.delete(
2107 normalizeClassComponent(instance.type)
2108 );
2109 }
2110 });
2111 }
2112 function updateComponentDef(oldComp, newComp) {
2113 extend(oldComp, newComp);
2114 for (const key in oldComp) {
2115 if (key !== "__file" && !(key in newComp)) {
2116 delete oldComp[key];
2117 }
2118 }
2119 }
2120 function tryWrap(fn) {
2121 return (id, arg) => {
2122 try {
2123 return fn(id, arg);
2124 } catch (e) {
2125 console.error(e);
2126 console.warn(
2127 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
2128 );
2129 }
2130 };
2131 }
2132
2133 let devtools$1;
2134 let buffer = [];
2135 let devtoolsNotInstalled = false;
2136 function emit$1(event, ...args) {
2137 if (devtools$1) {
2138 devtools$1.emit(event, ...args);
2139 } else if (!devtoolsNotInstalled) {
2140 buffer.push({ event, args });
2141 }
2142 }
2143 function setDevtoolsHook$1(hook, target) {
2144 var _a, _b;
2145 devtools$1 = hook;
2146 if (devtools$1) {
2147 devtools$1.enabled = true;
2148 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
2149 buffer = [];
2150 } else if (
2151 // handle late devtools injection - only do this if we are in an actual
2152 // browser environment to avoid the timer handle stalling test runner exit
2153 // (#4815)
2154 typeof window !== "undefined" && // some envs mock window but not fully
2155 window.HTMLElement && // also exclude jsdom
2156 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
2157 ) {
2158 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
2159 replay.push((newHook) => {
2160 setDevtoolsHook$1(newHook, target);
2161 });
2162 setTimeout(() => {
2163 if (!devtools$1) {
2164 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
2165 devtoolsNotInstalled = true;
2166 buffer = [];
2167 }
2168 }, 3e3);
2169 } else {
2170 devtoolsNotInstalled = true;
2171 buffer = [];
2172 }
2173 }
2174 function devtoolsInitApp(app, version) {
2175 emit$1("app:init" /* APP_INIT */, app, version, {
2176 Fragment,
2177 Text,
2178 Comment,
2179 Static
2180 });
2181 }
2182 function devtoolsUnmountApp(app) {
2183 emit$1("app:unmount" /* APP_UNMOUNT */, app);
2184 }
2185 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2186 "component:added" /* COMPONENT_ADDED */
2187 );
2188 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2189 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2190 "component:removed" /* COMPONENT_REMOVED */
2191 );
2192 const devtoolsComponentRemoved = (component) => {
2193 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
2194 !devtools$1.cleanupBuffer(component)) {
2195 _devtoolsComponentRemoved(component);
2196 }
2197 };
2198 /*! #__NO_SIDE_EFFECTS__ */
2199 // @__NO_SIDE_EFFECTS__
2200 function createDevtoolsComponentHook(hook) {
2201 return (component) => {
2202 emit$1(
2203 hook,
2204 component.appContext.app,
2205 component.uid,
2206 component.parent ? component.parent.uid : void 0,
2207 component
2208 );
2209 };
2210 }
2211 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2212 "perf:start" /* PERFORMANCE_START */
2213 );
2214 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2215 "perf:end" /* PERFORMANCE_END */
2216 );
2217 function createDevtoolsPerformanceHook(hook) {
2218 return (component, type, time) => {
2219 emit$1(hook, component.appContext.app, component.uid, component, type, time);
2220 };
2221 }
2222 function devtoolsComponentEmit(component, event, params) {
2223 emit$1(
2224 "component:emit" /* COMPONENT_EMIT */,
2225 component.appContext.app,
2226 component,
2227 event,
2228 params
2229 );
2230 }
2231
2232 function emit(instance, event, ...rawArgs) {
2233 if (instance.isUnmounted)
2234 return;
2235 const props = instance.vnode.props || EMPTY_OBJ;
2236 {
2237 const {
2238 emitsOptions,
2239 propsOptions: [propsOptions]
2240 } = instance;
2241 if (emitsOptions) {
2242 if (!(event in emitsOptions) && true) {
2243 if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
2244 warn$1(
2245 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
2246 );
2247 }
2248 } else {
2249 const validator = emitsOptions[event];
2250 if (isFunction(validator)) {
2251 const isValid = validator(...rawArgs);
2252 if (!isValid) {
2253 warn$1(
2254 `Invalid event arguments: event validation failed for event "${event}".`
2255 );
2256 }
2257 }
2258 }
2259 }
2260 }
2261 let args = rawArgs;
2262 const isModelListener = event.startsWith("update:");
2263 const modelArg = isModelListener && event.slice(7);
2264 if (modelArg && modelArg in props) {
2265 const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
2266 const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
2267 if (trim) {
2268 args = rawArgs.map((a) => isString(a) ? a.trim() : a);
2269 }
2270 if (number) {
2271 args = rawArgs.map(looseToNumber);
2272 }
2273 }
2274 {
2275 devtoolsComponentEmit(instance, event, args);
2276 }
2277 {
2278 const lowerCaseEvent = event.toLowerCase();
2279 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
2280 warn$1(
2281 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2282 instance,
2283 instance.type
2284 )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
2285 event
2286 )}" instead of "${event}".`
2287 );
2288 }
2289 }
2290 let handlerName;
2291 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
2292 props[handlerName = toHandlerKey(camelize(event))];
2293 if (!handler && isModelListener) {
2294 handler = props[handlerName = toHandlerKey(hyphenate(event))];
2295 }
2296 if (handler) {
2297 callWithAsyncErrorHandling(
2298 handler,
2299 instance,
2300 6,
2301 args
2302 );
2303 }
2304 const onceHandler = props[handlerName + `Once`];
2305 if (onceHandler) {
2306 if (!instance.emitted) {
2307 instance.emitted = {};
2308 } else if (instance.emitted[handlerName]) {
2309 return;
2310 }
2311 instance.emitted[handlerName] = true;
2312 callWithAsyncErrorHandling(
2313 onceHandler,
2314 instance,
2315 6,
2316 args
2317 );
2318 }
2319 }
2320 function normalizeEmitsOptions(comp, appContext, asMixin = false) {
2321 const cache = appContext.emitsCache;
2322 const cached = cache.get(comp);
2323 if (cached !== void 0) {
2324 return cached;
2325 }
2326 const raw = comp.emits;
2327 let normalized = {};
2328 let hasExtends = false;
2329 if (!isFunction(comp)) {
2330 const extendEmits = (raw2) => {
2331 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
2332 if (normalizedFromExtend) {
2333 hasExtends = true;
2334 extend(normalized, normalizedFromExtend);
2335 }
2336 };
2337 if (!asMixin && appContext.mixins.length) {
2338 appContext.mixins.forEach(extendEmits);
2339 }
2340 if (comp.extends) {
2341 extendEmits(comp.extends);
2342 }
2343 if (comp.mixins) {
2344 comp.mixins.forEach(extendEmits);
2345 }
2346 }
2347 if (!raw && !hasExtends) {
2348 if (isObject(comp)) {
2349 cache.set(comp, null);
2350 }
2351 return null;
2352 }
2353 if (isArray(raw)) {
2354 raw.forEach((key) => normalized[key] = null);
2355 } else {
2356 extend(normalized, raw);
2357 }
2358 if (isObject(comp)) {
2359 cache.set(comp, normalized);
2360 }
2361 return normalized;
2362 }
2363 function isEmitListener(options, key) {
2364 if (!options || !isOn(key)) {
2365 return false;
2366 }
2367 key = key.slice(2).replace(/Once$/, "");
2368 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
2369 }
2370
2371 let currentRenderingInstance = null;
2372 let currentScopeId = null;
2373 function setCurrentRenderingInstance(instance) {
2374 const prev = currentRenderingInstance;
2375 currentRenderingInstance = instance;
2376 currentScopeId = instance && instance.type.__scopeId || null;
2377 return prev;
2378 }
2379 function pushScopeId(id) {
2380 currentScopeId = id;
2381 }
2382 function popScopeId() {
2383 currentScopeId = null;
2384 }
2385 const withScopeId = (_id) => withCtx;
2386 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2387 if (!ctx)
2388 return fn;
2389 if (fn._n) {
2390 return fn;
2391 }
2392 const renderFnWithContext = (...args) => {
2393 if (renderFnWithContext._d) {
2394 setBlockTracking(-1);
2395 }
2396 const prevInstance = setCurrentRenderingInstance(ctx);
2397 let res;
2398 try {
2399 res = fn(...args);
2400 } finally {
2401 setCurrentRenderingInstance(prevInstance);
2402 if (renderFnWithContext._d) {
2403 setBlockTracking(1);
2404 }
2405 }
2406 {
2407 devtoolsComponentUpdated(ctx);
2408 }
2409 return res;
2410 };
2411 renderFnWithContext._n = true;
2412 renderFnWithContext._c = true;
2413 renderFnWithContext._d = true;
2414 return renderFnWithContext;
2415 }
2416
2417 let accessedAttrs = false;
2418 function markAttrsAccessed() {
2419 accessedAttrs = true;
2420 }
2421 function renderComponentRoot(instance) {
2422 const {
2423 type: Component,
2424 vnode,
2425 proxy,
2426 withProxy,
2427 propsOptions: [propsOptions],
2428 slots,
2429 attrs,
2430 emit,
2431 render,
2432 renderCache,
2433 props,
2434 data,
2435 setupState,
2436 ctx,
2437 inheritAttrs
2438 } = instance;
2439 const prev = setCurrentRenderingInstance(instance);
2440 let result;
2441 let fallthroughAttrs;
2442 {
2443 accessedAttrs = false;
2444 }
2445 try {
2446 if (vnode.shapeFlag & 4) {
2447 const proxyToUse = withProxy || proxy;
2448 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2449 get(target, key, receiver) {
2450 warn$1(
2451 `Property '${String(
2452 key
2453 )}' was accessed via 'this'. Avoid using 'this' in templates.`
2454 );
2455 return Reflect.get(target, key, receiver);
2456 }
2457 }) : proxyToUse;
2458 result = normalizeVNode(
2459 render.call(
2460 thisProxy,
2461 proxyToUse,
2462 renderCache,
2463 true ? shallowReadonly(props) : props,
2464 setupState,
2465 data,
2466 ctx
2467 )
2468 );
2469 fallthroughAttrs = attrs;
2470 } else {
2471 const render2 = Component;
2472 if (attrs === props) {
2473 markAttrsAccessed();
2474 }
2475 result = normalizeVNode(
2476 render2.length > 1 ? render2(
2477 true ? shallowReadonly(props) : props,
2478 true ? {
2479 get attrs() {
2480 markAttrsAccessed();
2481 return shallowReadonly(attrs);
2482 },
2483 slots,
2484 emit
2485 } : { attrs, slots, emit }
2486 ) : render2(
2487 true ? shallowReadonly(props) : props,
2488 null
2489 )
2490 );
2491 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
2492 }
2493 } catch (err) {
2494 blockStack.length = 0;
2495 handleError(err, instance, 1);
2496 result = createVNode(Comment);
2497 }
2498 let root = result;
2499 let setRoot = void 0;
2500 if (result.patchFlag > 0 && result.patchFlag & 2048) {
2501 [root, setRoot] = getChildRoot(result);
2502 }
2503 if (fallthroughAttrs && inheritAttrs !== false) {
2504 const keys = Object.keys(fallthroughAttrs);
2505 const { shapeFlag } = root;
2506 if (keys.length) {
2507 if (shapeFlag & (1 | 6)) {
2508 if (propsOptions && keys.some(isModelListener)) {
2509 fallthroughAttrs = filterModelListeners(
2510 fallthroughAttrs,
2511 propsOptions
2512 );
2513 }
2514 root = cloneVNode(root, fallthroughAttrs, false, true);
2515 } else if (!accessedAttrs && root.type !== Comment) {
2516 const allAttrs = Object.keys(attrs);
2517 const eventAttrs = [];
2518 const extraAttrs = [];
2519 for (let i = 0, l = allAttrs.length; i < l; i++) {
2520 const key = allAttrs[i];
2521 if (isOn(key)) {
2522 if (!isModelListener(key)) {
2523 eventAttrs.push(key[2].toLowerCase() + key.slice(3));
2524 }
2525 } else {
2526 extraAttrs.push(key);
2527 }
2528 }
2529 if (extraAttrs.length) {
2530 warn$1(
2531 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
2532 );
2533 }
2534 if (eventAttrs.length) {
2535 warn$1(
2536 `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
2537 );
2538 }
2539 }
2540 }
2541 }
2542 if (vnode.dirs) {
2543 if (!isElementRoot(root)) {
2544 warn$1(
2545 `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2546 );
2547 }
2548 root = cloneVNode(root, null, false, true);
2549 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2550 }
2551 if (vnode.transition) {
2552 if (!isElementRoot(root)) {
2553 warn$1(
2554 `Component inside <Transition> renders non-element root node that cannot be animated.`
2555 );
2556 }
2557 root.transition = vnode.transition;
2558 }
2559 if (setRoot) {
2560 setRoot(root);
2561 } else {
2562 result = root;
2563 }
2564 setCurrentRenderingInstance(prev);
2565 return result;
2566 }
2567 const getChildRoot = (vnode) => {
2568 const rawChildren = vnode.children;
2569 const dynamicChildren = vnode.dynamicChildren;
2570 const childRoot = filterSingleRoot(rawChildren, false);
2571 if (!childRoot) {
2572 return [vnode, void 0];
2573 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
2574 return getChildRoot(childRoot);
2575 }
2576 const index = rawChildren.indexOf(childRoot);
2577 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
2578 const setRoot = (updatedRoot) => {
2579 rawChildren[index] = updatedRoot;
2580 if (dynamicChildren) {
2581 if (dynamicIndex > -1) {
2582 dynamicChildren[dynamicIndex] = updatedRoot;
2583 } else if (updatedRoot.patchFlag > 0) {
2584 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
2585 }
2586 }
2587 };
2588 return [normalizeVNode(childRoot), setRoot];
2589 };
2590 function filterSingleRoot(children, recurse = true) {
2591 let singleRoot;
2592 for (let i = 0; i < children.length; i++) {
2593 const child = children[i];
2594 if (isVNode(child)) {
2595 if (child.type !== Comment || child.children === "v-if") {
2596 if (singleRoot) {
2597 return;
2598 } else {
2599 singleRoot = child;
2600 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
2601 return filterSingleRoot(singleRoot.children);
2602 }
2603 }
2604 }
2605 } else {
2606 return;
2607 }
2608 }
2609 return singleRoot;
2610 }
2611 const getFunctionalFallthrough = (attrs) => {
2612 let res;
2613 for (const key in attrs) {
2614 if (key === "class" || key === "style" || isOn(key)) {
2615 (res || (res = {}))[key] = attrs[key];
2616 }
2617 }
2618 return res;
2619 };
2620 const filterModelListeners = (attrs, props) => {
2621 const res = {};
2622 for (const key in attrs) {
2623 if (!isModelListener(key) || !(key.slice(9) in props)) {
2624 res[key] = attrs[key];
2625 }
2626 }
2627 return res;
2628 };
2629 const isElementRoot = (vnode) => {
2630 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
2631 };
2632 function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2633 const { props: prevProps, children: prevChildren, component } = prevVNode;
2634 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
2635 const emits = component.emitsOptions;
2636 if ((prevChildren || nextChildren) && isHmrUpdating) {
2637 return true;
2638 }
2639 if (nextVNode.dirs || nextVNode.transition) {
2640 return true;
2641 }
2642 if (optimized && patchFlag >= 0) {
2643 if (patchFlag & 1024) {
2644 return true;
2645 }
2646 if (patchFlag & 16) {
2647 if (!prevProps) {
2648 return !!nextProps;
2649 }
2650 return hasPropsChanged(prevProps, nextProps, emits);
2651 } else if (patchFlag & 8) {
2652 const dynamicProps = nextVNode.dynamicProps;
2653 for (let i = 0; i < dynamicProps.length; i++) {
2654 const key = dynamicProps[i];
2655 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
2656 return true;
2657 }
2658 }
2659 }
2660 } else {
2661 if (prevChildren || nextChildren) {
2662 if (!nextChildren || !nextChildren.$stable) {
2663 return true;
2664 }
2665 }
2666 if (prevProps === nextProps) {
2667 return false;
2668 }
2669 if (!prevProps) {
2670 return !!nextProps;
2671 }
2672 if (!nextProps) {
2673 return true;
2674 }
2675 return hasPropsChanged(prevProps, nextProps, emits);
2676 }
2677 return false;
2678 }
2679 function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2680 const nextKeys = Object.keys(nextProps);
2681 if (nextKeys.length !== Object.keys(prevProps).length) {
2682 return true;
2683 }
2684 for (let i = 0; i < nextKeys.length; i++) {
2685 const key = nextKeys[i];
2686 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
2687 return true;
2688 }
2689 }
2690 return false;
2691 }
2692 function updateHOCHostEl({ vnode, parent }, el) {
2693 while (parent) {
2694 const root = parent.subTree;
2695 if (root.suspense && root.suspense.activeBranch === vnode) {
2696 root.el = vnode.el;
2697 }
2698 if (root === vnode) {
2699 (vnode = parent.vnode).el = el;
2700 parent = parent.parent;
2701 } else {
2702 break;
2703 }
2704 }
2705 }
2706
2707 const COMPONENTS = "components";
2708 const DIRECTIVES = "directives";
2709 function resolveComponent(name, maybeSelfReference) {
2710 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2711 }
2712 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2713 function resolveDynamicComponent(component) {
2714 if (isString(component)) {
2715 return resolveAsset(COMPONENTS, component, false) || component;
2716 } else {
2717 return component || NULL_DYNAMIC_COMPONENT;
2718 }
2719 }
2720 function resolveDirective(name) {
2721 return resolveAsset(DIRECTIVES, name);
2722 }
2723 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2724 const instance = currentRenderingInstance || currentInstance;
2725 if (instance) {
2726 const Component = instance.type;
2727 if (type === COMPONENTS) {
2728 const selfName = getComponentName(
2729 Component,
2730 false
2731 );
2732 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2733 return Component;
2734 }
2735 }
2736 const res = (
2737 // local registration
2738 // check instance[type] first which is resolved for options API
2739 resolve(instance[type] || Component[type], name) || // global registration
2740 resolve(instance.appContext[type], name)
2741 );
2742 if (!res && maybeSelfReference) {
2743 return Component;
2744 }
2745 if (warnMissing && !res) {
2746 const extra = type === COMPONENTS ? `
2747If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
2748 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
2749 }
2750 return res;
2751 } else {
2752 warn$1(
2753 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
2754 );
2755 }
2756 }
2757 function resolve(registry, name) {
2758 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2759 }
2760
2761 const isSuspense = (type) => type.__isSuspense;
2762 let suspenseId = 0;
2763 const SuspenseImpl = {
2764 name: "Suspense",
2765 // In order to make Suspense tree-shakable, we need to avoid importing it
2766 // directly in the renderer. The renderer checks for the __isSuspense flag
2767 // on a vnode's type and calls the `process` method, passing in renderer
2768 // internals.
2769 __isSuspense: true,
2770 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2771 if (n1 == null) {
2772 mountSuspense(
2773 n2,
2774 container,
2775 anchor,
2776 parentComponent,
2777 parentSuspense,
2778 namespace,
2779 slotScopeIds,
2780 optimized,
2781 rendererInternals
2782 );
2783 } else {
2784 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2785 n2.suspense = n1.suspense;
2786 n2.suspense.vnode = n2;
2787 n2.el = n1.el;
2788 return;
2789 }
2790 patchSuspense(
2791 n1,
2792 n2,
2793 container,
2794 anchor,
2795 parentComponent,
2796 namespace,
2797 slotScopeIds,
2798 optimized,
2799 rendererInternals
2800 );
2801 }
2802 },
2803 hydrate: hydrateSuspense,
2804 create: createSuspenseBoundary,
2805 normalize: normalizeSuspenseChildren
2806 };
2807 const Suspense = SuspenseImpl ;
2808 function triggerEvent(vnode, name) {
2809 const eventListener = vnode.props && vnode.props[name];
2810 if (isFunction(eventListener)) {
2811 eventListener();
2812 }
2813 }
2814 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2815 const {
2816 p: patch,
2817 o: { createElement }
2818 } = rendererInternals;
2819 const hiddenContainer = createElement("div");
2820 const suspense = vnode.suspense = createSuspenseBoundary(
2821 vnode,
2822 parentSuspense,
2823 parentComponent,
2824 container,
2825 hiddenContainer,
2826 anchor,
2827 namespace,
2828 slotScopeIds,
2829 optimized,
2830 rendererInternals
2831 );
2832 patch(
2833 null,
2834 suspense.pendingBranch = vnode.ssContent,
2835 hiddenContainer,
2836 null,
2837 parentComponent,
2838 suspense,
2839 namespace,
2840 slotScopeIds
2841 );
2842 if (suspense.deps > 0) {
2843 triggerEvent(vnode, "onPending");
2844 triggerEvent(vnode, "onFallback");
2845 patch(
2846 null,
2847 vnode.ssFallback,
2848 container,
2849 anchor,
2850 parentComponent,
2851 null,
2852 // fallback tree will not have suspense context
2853 namespace,
2854 slotScopeIds
2855 );
2856 setActiveBranch(suspense, vnode.ssFallback);
2857 } else {
2858 suspense.resolve(false, true);
2859 }
2860 }
2861 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2862 const suspense = n2.suspense = n1.suspense;
2863 suspense.vnode = n2;
2864 n2.el = n1.el;
2865 const newBranch = n2.ssContent;
2866 const newFallback = n2.ssFallback;
2867 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
2868 if (pendingBranch) {
2869 suspense.pendingBranch = newBranch;
2870 if (isSameVNodeType(newBranch, pendingBranch)) {
2871 patch(
2872 pendingBranch,
2873 newBranch,
2874 suspense.hiddenContainer,
2875 null,
2876 parentComponent,
2877 suspense,
2878 namespace,
2879 slotScopeIds,
2880 optimized
2881 );
2882 if (suspense.deps <= 0) {
2883 suspense.resolve();
2884 } else if (isInFallback) {
2885 if (!isHydrating) {
2886 patch(
2887 activeBranch,
2888 newFallback,
2889 container,
2890 anchor,
2891 parentComponent,
2892 null,
2893 // fallback tree will not have suspense context
2894 namespace,
2895 slotScopeIds,
2896 optimized
2897 );
2898 setActiveBranch(suspense, newFallback);
2899 }
2900 }
2901 } else {
2902 suspense.pendingId = suspenseId++;
2903 if (isHydrating) {
2904 suspense.isHydrating = false;
2905 suspense.activeBranch = pendingBranch;
2906 } else {
2907 unmount(pendingBranch, parentComponent, suspense);
2908 }
2909 suspense.deps = 0;
2910 suspense.effects.length = 0;
2911 suspense.hiddenContainer = createElement("div");
2912 if (isInFallback) {
2913 patch(
2914 null,
2915 newBranch,
2916 suspense.hiddenContainer,
2917 null,
2918 parentComponent,
2919 suspense,
2920 namespace,
2921 slotScopeIds,
2922 optimized
2923 );
2924 if (suspense.deps <= 0) {
2925 suspense.resolve();
2926 } else {
2927 patch(
2928 activeBranch,
2929 newFallback,
2930 container,
2931 anchor,
2932 parentComponent,
2933 null,
2934 // fallback tree will not have suspense context
2935 namespace,
2936 slotScopeIds,
2937 optimized
2938 );
2939 setActiveBranch(suspense, newFallback);
2940 }
2941 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2942 patch(
2943 activeBranch,
2944 newBranch,
2945 container,
2946 anchor,
2947 parentComponent,
2948 suspense,
2949 namespace,
2950 slotScopeIds,
2951 optimized
2952 );
2953 suspense.resolve(true);
2954 } else {
2955 patch(
2956 null,
2957 newBranch,
2958 suspense.hiddenContainer,
2959 null,
2960 parentComponent,
2961 suspense,
2962 namespace,
2963 slotScopeIds,
2964 optimized
2965 );
2966 if (suspense.deps <= 0) {
2967 suspense.resolve();
2968 }
2969 }
2970 }
2971 } else {
2972 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2973 patch(
2974 activeBranch,
2975 newBranch,
2976 container,
2977 anchor,
2978 parentComponent,
2979 suspense,
2980 namespace,
2981 slotScopeIds,
2982 optimized
2983 );
2984 setActiveBranch(suspense, newBranch);
2985 } else {
2986 triggerEvent(n2, "onPending");
2987 suspense.pendingBranch = newBranch;
2988 if (newBranch.shapeFlag & 512) {
2989 suspense.pendingId = newBranch.component.suspenseId;
2990 } else {
2991 suspense.pendingId = suspenseId++;
2992 }
2993 patch(
2994 null,
2995 newBranch,
2996 suspense.hiddenContainer,
2997 null,
2998 parentComponent,
2999 suspense,
3000 namespace,
3001 slotScopeIds,
3002 optimized
3003 );
3004 if (suspense.deps <= 0) {
3005 suspense.resolve();
3006 } else {
3007 const { timeout, pendingId } = suspense;
3008 if (timeout > 0) {
3009 setTimeout(() => {
3010 if (suspense.pendingId === pendingId) {
3011 suspense.fallback(newFallback);
3012 }
3013 }, timeout);
3014 } else if (timeout === 0) {
3015 suspense.fallback(newFallback);
3016 }
3017 }
3018 }
3019 }
3020 }
3021 let hasWarned = false;
3022 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3023 if (!hasWarned) {
3024 hasWarned = true;
3025 console[console.info ? "info" : "log"](
3026 `<Suspense> is an experimental feature and its API will likely change.`
3027 );
3028 }
3029 const {
3030 p: patch,
3031 m: move,
3032 um: unmount,
3033 n: next,
3034 o: { parentNode, remove }
3035 } = rendererInternals;
3036 let parentSuspenseId;
3037 const isSuspensible = isVNodeSuspensible(vnode);
3038 if (isSuspensible) {
3039 if (parentSuspense && parentSuspense.pendingBranch) {
3040 parentSuspenseId = parentSuspense.pendingId;
3041 parentSuspense.deps++;
3042 }
3043 }
3044 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3045 {
3046 assertNumber(timeout, `Suspense timeout`);
3047 }
3048 const initialAnchor = anchor;
3049 const suspense = {
3050 vnode,
3051 parent: parentSuspense,
3052 parentComponent,
3053 namespace,
3054 container,
3055 hiddenContainer,
3056 deps: 0,
3057 pendingId: suspenseId++,
3058 timeout: typeof timeout === "number" ? timeout : -1,
3059 activeBranch: null,
3060 pendingBranch: null,
3061 isInFallback: !isHydrating,
3062 isHydrating,
3063 isUnmounted: false,
3064 effects: [],
3065 resolve(resume = false, sync = false) {
3066 {
3067 if (!resume && !suspense.pendingBranch) {
3068 throw new Error(
3069 `suspense.resolve() is called without a pending branch.`
3070 );
3071 }
3072 if (suspense.isUnmounted) {
3073 throw new Error(
3074 `suspense.resolve() is called on an already unmounted suspense boundary.`
3075 );
3076 }
3077 }
3078 const {
3079 vnode: vnode2,
3080 activeBranch,
3081 pendingBranch,
3082 pendingId,
3083 effects,
3084 parentComponent: parentComponent2,
3085 container: container2
3086 } = suspense;
3087 let delayEnter = false;
3088 if (suspense.isHydrating) {
3089 suspense.isHydrating = false;
3090 } else if (!resume) {
3091 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3092 if (delayEnter) {
3093 activeBranch.transition.afterLeave = () => {
3094 if (pendingId === suspense.pendingId) {
3095 move(
3096 pendingBranch,
3097 container2,
3098 anchor === initialAnchor ? next(activeBranch) : anchor,
3099 0
3100 );
3101 queuePostFlushCb(effects);
3102 }
3103 };
3104 }
3105 if (activeBranch) {
3106 if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3107 anchor = next(activeBranch);
3108 }
3109 unmount(activeBranch, parentComponent2, suspense, true);
3110 }
3111 if (!delayEnter) {
3112 move(pendingBranch, container2, anchor, 0);
3113 }
3114 }
3115 setActiveBranch(suspense, pendingBranch);
3116 suspense.pendingBranch = null;
3117 suspense.isInFallback = false;
3118 let parent = suspense.parent;
3119 let hasUnresolvedAncestor = false;
3120 while (parent) {
3121 if (parent.pendingBranch) {
3122 parent.effects.push(...effects);
3123 hasUnresolvedAncestor = true;
3124 break;
3125 }
3126 parent = parent.parent;
3127 }
3128 if (!hasUnresolvedAncestor && !delayEnter) {
3129 queuePostFlushCb(effects);
3130 }
3131 suspense.effects = [];
3132 if (isSuspensible) {
3133 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3134 parentSuspense.deps--;
3135 if (parentSuspense.deps === 0 && !sync) {
3136 parentSuspense.resolve();
3137 }
3138 }
3139 }
3140 triggerEvent(vnode2, "onResolve");
3141 },
3142 fallback(fallbackVNode) {
3143 if (!suspense.pendingBranch) {
3144 return;
3145 }
3146 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
3147 triggerEvent(vnode2, "onFallback");
3148 const anchor2 = next(activeBranch);
3149 const mountFallback = () => {
3150 if (!suspense.isInFallback) {
3151 return;
3152 }
3153 patch(
3154 null,
3155 fallbackVNode,
3156 container2,
3157 anchor2,
3158 parentComponent2,
3159 null,
3160 // fallback tree will not have suspense context
3161 namespace2,
3162 slotScopeIds,
3163 optimized
3164 );
3165 setActiveBranch(suspense, fallbackVNode);
3166 };
3167 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
3168 if (delayEnter) {
3169 activeBranch.transition.afterLeave = mountFallback;
3170 }
3171 suspense.isInFallback = true;
3172 unmount(
3173 activeBranch,
3174 parentComponent2,
3175 null,
3176 // no suspense so unmount hooks fire now
3177 true
3178 // shouldRemove
3179 );
3180 if (!delayEnter) {
3181 mountFallback();
3182 }
3183 },
3184 move(container2, anchor2, type) {
3185 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
3186 suspense.container = container2;
3187 },
3188 next() {
3189 return suspense.activeBranch && next(suspense.activeBranch);
3190 },
3191 registerDep(instance, setupRenderEffect) {
3192 const isInPendingSuspense = !!suspense.pendingBranch;
3193 if (isInPendingSuspense) {
3194 suspense.deps++;
3195 }
3196 const hydratedEl = instance.vnode.el;
3197 instance.asyncDep.catch((err) => {
3198 handleError(err, instance, 0);
3199 }).then((asyncSetupResult) => {
3200 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
3201 return;
3202 }
3203 instance.asyncResolved = true;
3204 const { vnode: vnode2 } = instance;
3205 {
3206 pushWarningContext(vnode2);
3207 }
3208 handleSetupResult(instance, asyncSetupResult, false);
3209 if (hydratedEl) {
3210 vnode2.el = hydratedEl;
3211 }
3212 const placeholder = !hydratedEl && instance.subTree.el;
3213 setupRenderEffect(
3214 instance,
3215 vnode2,
3216 // component may have been moved before resolve.
3217 // if this is not a hydration, instance.subTree will be the comment
3218 // placeholder.
3219 parentNode(hydratedEl || instance.subTree.el),
3220 // anchor will not be used if this is hydration, so only need to
3221 // consider the comment placeholder case.
3222 hydratedEl ? null : next(instance.subTree),
3223 suspense,
3224 namespace,
3225 optimized
3226 );
3227 if (placeholder) {
3228 remove(placeholder);
3229 }
3230 updateHOCHostEl(instance, vnode2.el);
3231 {
3232 popWarningContext();
3233 }
3234 if (isInPendingSuspense && --suspense.deps === 0) {
3235 suspense.resolve();
3236 }
3237 });
3238 },
3239 unmount(parentSuspense2, doRemove) {
3240 suspense.isUnmounted = true;
3241 if (suspense.activeBranch) {
3242 unmount(
3243 suspense.activeBranch,
3244 parentComponent,
3245 parentSuspense2,
3246 doRemove
3247 );
3248 }
3249 if (suspense.pendingBranch) {
3250 unmount(
3251 suspense.pendingBranch,
3252 parentComponent,
3253 parentSuspense2,
3254 doRemove
3255 );
3256 }
3257 }
3258 };
3259 return suspense;
3260 }
3261 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
3262 const suspense = vnode.suspense = createSuspenseBoundary(
3263 vnode,
3264 parentSuspense,
3265 parentComponent,
3266 node.parentNode,
3267 // eslint-disable-next-line no-restricted-globals
3268 document.createElement("div"),
3269 null,
3270 namespace,
3271 slotScopeIds,
3272 optimized,
3273 rendererInternals,
3274 true
3275 );
3276 const result = hydrateNode(
3277 node,
3278 suspense.pendingBranch = vnode.ssContent,
3279 parentComponent,
3280 suspense,
3281 slotScopeIds,
3282 optimized
3283 );
3284 if (suspense.deps === 0) {
3285 suspense.resolve(false, true);
3286 }
3287 return result;
3288 }
3289 function normalizeSuspenseChildren(vnode) {
3290 const { shapeFlag, children } = vnode;
3291 const isSlotChildren = shapeFlag & 32;
3292 vnode.ssContent = normalizeSuspenseSlot(
3293 isSlotChildren ? children.default : children
3294 );
3295 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
3296 }
3297 function normalizeSuspenseSlot(s) {
3298 let block;
3299 if (isFunction(s)) {
3300 const trackBlock = isBlockTreeEnabled && s._c;
3301 if (trackBlock) {
3302 s._d = false;
3303 openBlock();
3304 }
3305 s = s();
3306 if (trackBlock) {
3307 s._d = true;
3308 block = currentBlock;
3309 closeBlock();
3310 }
3311 }
3312 if (isArray(s)) {
3313 const singleChild = filterSingleRoot(s);
3314 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3315 warn$1(`<Suspense> slots expect a single root node.`);
3316 }
3317 s = singleChild;
3318 }
3319 s = normalizeVNode(s);
3320 if (block && !s.dynamicChildren) {
3321 s.dynamicChildren = block.filter((c) => c !== s);
3322 }
3323 return s;
3324 }
3325 function queueEffectWithSuspense(fn, suspense) {
3326 if (suspense && suspense.pendingBranch) {
3327 if (isArray(fn)) {
3328 suspense.effects.push(...fn);
3329 } else {
3330 suspense.effects.push(fn);
3331 }
3332 } else {
3333 queuePostFlushCb(fn);
3334 }
3335 }
3336 function setActiveBranch(suspense, branch) {
3337 suspense.activeBranch = branch;
3338 const { vnode, parentComponent } = suspense;
3339 let el = branch.el;
3340 while (!el && branch.component) {
3341 branch = branch.component.subTree;
3342 el = branch.el;
3343 }
3344 vnode.el = el;
3345 if (parentComponent && parentComponent.subTree === vnode) {
3346 parentComponent.vnode.el = el;
3347 updateHOCHostEl(parentComponent, el);
3348 }
3349 }
3350 function isVNodeSuspensible(vnode) {
3351 const suspensible = vnode.props && vnode.props.suspensible;
3352 return suspensible != null && suspensible !== false;
3353 }
3354
3355 const ssrContextKey = Symbol.for("v-scx");
3356 const useSSRContext = () => {
3357 {
3358 warn$1(`useSSRContext() is not supported in the global build.`);
3359 }
3360 };
3361
3362 function watchEffect(effect, options) {
3363 return doWatch(effect, null, options);
3364 }
3365 function watchPostEffect(effect, options) {
3366 return doWatch(
3367 effect,
3368 null,
3369 extend({}, options, { flush: "post" })
3370 );
3371 }
3372 function watchSyncEffect(effect, options) {
3373 return doWatch(
3374 effect,
3375 null,
3376 extend({}, options, { flush: "sync" })
3377 );
3378 }
3379 const INITIAL_WATCHER_VALUE = {};
3380 function watch(source, cb, options) {
3381 if (!isFunction(cb)) {
3382 warn$1(
3383 `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
3384 );
3385 }
3386 return doWatch(source, cb, options);
3387 }
3388 function doWatch(source, cb, {
3389 immediate,
3390 deep,
3391 flush,
3392 once,
3393 onTrack,
3394 onTrigger
3395 } = EMPTY_OBJ) {
3396 if (cb && once) {
3397 const _cb = cb;
3398 cb = (...args) => {
3399 _cb(...args);
3400 unwatch();
3401 };
3402 }
3403 if (deep !== void 0 && typeof deep === "number") {
3404 warn$1(
3405 `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
3406 );
3407 }
3408 if (!cb) {
3409 if (immediate !== void 0) {
3410 warn$1(
3411 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
3412 );
3413 }
3414 if (deep !== void 0) {
3415 warn$1(
3416 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
3417 );
3418 }
3419 if (once !== void 0) {
3420 warn$1(
3421 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
3422 );
3423 }
3424 }
3425 const warnInvalidSource = (s) => {
3426 warn$1(
3427 `Invalid watch source: `,
3428 s,
3429 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
3430 );
3431 };
3432 const instance = currentInstance;
3433 const reactiveGetter = (source2) => deep === true ? source2 : (
3434 // for deep: false, only traverse root-level properties
3435 traverse(source2, deep === false ? 1 : void 0)
3436 );
3437 let getter;
3438 let forceTrigger = false;
3439 let isMultiSource = false;
3440 if (isRef(source)) {
3441 getter = () => source.value;
3442 forceTrigger = isShallow(source);
3443 } else if (isReactive(source)) {
3444 getter = () => reactiveGetter(source);
3445 forceTrigger = true;
3446 } else if (isArray(source)) {
3447 isMultiSource = true;
3448 forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
3449 getter = () => source.map((s) => {
3450 if (isRef(s)) {
3451 return s.value;
3452 } else if (isReactive(s)) {
3453 return reactiveGetter(s);
3454 } else if (isFunction(s)) {
3455 return callWithErrorHandling(s, instance, 2);
3456 } else {
3457 warnInvalidSource(s);
3458 }
3459 });
3460 } else if (isFunction(source)) {
3461 if (cb) {
3462 getter = () => callWithErrorHandling(source, instance, 2);
3463 } else {
3464 getter = () => {
3465 if (cleanup) {
3466 cleanup();
3467 }
3468 return callWithAsyncErrorHandling(
3469 source,
3470 instance,
3471 3,
3472 [onCleanup]
3473 );
3474 };
3475 }
3476 } else {
3477 getter = NOOP;
3478 warnInvalidSource(source);
3479 }
3480 if (cb && deep) {
3481 const baseGetter = getter;
3482 getter = () => traverse(baseGetter());
3483 }
3484 let cleanup;
3485 let onCleanup = (fn) => {
3486 cleanup = effect.onStop = () => {
3487 callWithErrorHandling(fn, instance, 4);
3488 cleanup = effect.onStop = void 0;
3489 };
3490 };
3491 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3492 const job = () => {
3493 if (!effect.active || !effect.dirty) {
3494 return;
3495 }
3496 if (cb) {
3497 const newValue = effect.run();
3498 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
3499 if (cleanup) {
3500 cleanup();
3501 }
3502 callWithAsyncErrorHandling(cb, instance, 3, [
3503 newValue,
3504 // pass undefined as the old value when it's changed for the first time
3505 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
3506 onCleanup
3507 ]);
3508 oldValue = newValue;
3509 }
3510 } else {
3511 effect.run();
3512 }
3513 };
3514 job.allowRecurse = !!cb;
3515 let scheduler;
3516 if (flush === "sync") {
3517 scheduler = job;
3518 } else if (flush === "post") {
3519 scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
3520 } else {
3521 job.pre = true;
3522 if (instance)
3523 job.id = instance.uid;
3524 scheduler = () => queueJob(job);
3525 }
3526 const effect = new ReactiveEffect(getter, NOOP, scheduler);
3527 const scope = getCurrentScope();
3528 const unwatch = () => {
3529 effect.stop();
3530 if (scope) {
3531 remove(scope.effects, effect);
3532 }
3533 };
3534 {
3535 effect.onTrack = onTrack;
3536 effect.onTrigger = onTrigger;
3537 }
3538 if (cb) {
3539 if (immediate) {
3540 job();
3541 } else {
3542 oldValue = effect.run();
3543 }
3544 } else if (flush === "post") {
3545 queuePostRenderEffect(
3546 effect.run.bind(effect),
3547 instance && instance.suspense
3548 );
3549 } else {
3550 effect.run();
3551 }
3552 return unwatch;
3553 }
3554 function instanceWatch(source, value, options) {
3555 const publicThis = this.proxy;
3556 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
3557 let cb;
3558 if (isFunction(value)) {
3559 cb = value;
3560 } else {
3561 cb = value.handler;
3562 options = value;
3563 }
3564 const reset = setCurrentInstance(this);
3565 const res = doWatch(getter, cb.bind(publicThis), options);
3566 reset();
3567 return res;
3568 }
3569 function createPathGetter(ctx, path) {
3570 const segments = path.split(".");
3571 return () => {
3572 let cur = ctx;
3573 for (let i = 0; i < segments.length && cur; i++) {
3574 cur = cur[segments[i]];
3575 }
3576 return cur;
3577 };
3578 }
3579 function traverse(value, depth = Infinity, seen) {
3580 if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
3581 return value;
3582 }
3583 seen = seen || /* @__PURE__ */ new Set();
3584 if (seen.has(value)) {
3585 return value;
3586 }
3587 seen.add(value);
3588 depth--;
3589 if (isRef(value)) {
3590 traverse(value.value, depth, seen);
3591 } else if (isArray(value)) {
3592 for (let i = 0; i < value.length; i++) {
3593 traverse(value[i], depth, seen);
3594 }
3595 } else if (isSet(value) || isMap(value)) {
3596 value.forEach((v) => {
3597 traverse(v, depth, seen);
3598 });
3599 } else if (isPlainObject(value)) {
3600 for (const key in value) {
3601 traverse(value[key], depth, seen);
3602 }
3603 }
3604 return value;
3605 }
3606
3607 function validateDirectiveName(name) {
3608 if (isBuiltInDirective(name)) {
3609 warn$1("Do not use built-in directive ids as custom directive id: " + name);
3610 }
3611 }
3612 function withDirectives(vnode, directives) {
3613 if (currentRenderingInstance === null) {
3614 warn$1(`withDirectives can only be used inside render functions.`);
3615 return vnode;
3616 }
3617 const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3618 const bindings = vnode.dirs || (vnode.dirs = []);
3619 for (let i = 0; i < directives.length; i++) {
3620 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3621 if (dir) {
3622 if (isFunction(dir)) {
3623 dir = {
3624 mounted: dir,
3625 updated: dir
3626 };
3627 }
3628 if (dir.deep) {
3629 traverse(value);
3630 }
3631 bindings.push({
3632 dir,
3633 instance,
3634 value,
3635 oldValue: void 0,
3636 arg,
3637 modifiers
3638 });
3639 }
3640 }
3641 return vnode;
3642 }
3643 function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3644 const bindings = vnode.dirs;
3645 const oldBindings = prevVNode && prevVNode.dirs;
3646 for (let i = 0; i < bindings.length; i++) {
3647 const binding = bindings[i];
3648 if (oldBindings) {
3649 binding.oldValue = oldBindings[i].value;
3650 }
3651 let hook = binding.dir[name];
3652 if (hook) {
3653 pauseTracking();
3654 callWithAsyncErrorHandling(hook, instance, 8, [
3655 vnode.el,
3656 binding,
3657 vnode,
3658 prevVNode
3659 ]);
3660 resetTracking();
3661 }
3662 }
3663 }
3664
3665 const leaveCbKey = Symbol("_leaveCb");
3666 const enterCbKey$1 = Symbol("_enterCb");
3667 function useTransitionState() {
3668 const state = {
3669 isMounted: false,
3670 isLeaving: false,
3671 isUnmounting: false,
3672 leavingVNodes: /* @__PURE__ */ new Map()
3673 };
3674 onMounted(() => {
3675 state.isMounted = true;
3676 });
3677 onBeforeUnmount(() => {
3678 state.isUnmounting = true;
3679 });
3680 return state;
3681 }
3682 const TransitionHookValidator = [Function, Array];
3683 const BaseTransitionPropsValidators = {
3684 mode: String,
3685 appear: Boolean,
3686 persisted: Boolean,
3687 // enter
3688 onBeforeEnter: TransitionHookValidator,
3689 onEnter: TransitionHookValidator,
3690 onAfterEnter: TransitionHookValidator,
3691 onEnterCancelled: TransitionHookValidator,
3692 // leave
3693 onBeforeLeave: TransitionHookValidator,
3694 onLeave: TransitionHookValidator,
3695 onAfterLeave: TransitionHookValidator,
3696 onLeaveCancelled: TransitionHookValidator,
3697 // appear
3698 onBeforeAppear: TransitionHookValidator,
3699 onAppear: TransitionHookValidator,
3700 onAfterAppear: TransitionHookValidator,
3701 onAppearCancelled: TransitionHookValidator
3702 };
3703 const BaseTransitionImpl = {
3704 name: `BaseTransition`,
3705 props: BaseTransitionPropsValidators,
3706 setup(props, { slots }) {
3707 const instance = getCurrentInstance();
3708 const state = useTransitionState();
3709 return () => {
3710 const children = slots.default && getTransitionRawChildren(slots.default(), true);
3711 if (!children || !children.length) {
3712 return;
3713 }
3714 let child = children[0];
3715 if (children.length > 1) {
3716 let hasFound = false;
3717 for (const c of children) {
3718 if (c.type !== Comment) {
3719 if (hasFound) {
3720 warn$1(
3721 "<transition> can only be used on a single element or component. Use <transition-group> for lists."
3722 );
3723 break;
3724 }
3725 child = c;
3726 hasFound = true;
3727 }
3728 }
3729 }
3730 const rawProps = toRaw(props);
3731 const { mode } = rawProps;
3732 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3733 warn$1(`invalid <transition> mode: ${mode}`);
3734 }
3735 if (state.isLeaving) {
3736 return emptyPlaceholder(child);
3737 }
3738 const innerChild = getKeepAliveChild(child);
3739 if (!innerChild) {
3740 return emptyPlaceholder(child);
3741 }
3742 const enterHooks = resolveTransitionHooks(
3743 innerChild,
3744 rawProps,
3745 state,
3746 instance
3747 );
3748 setTransitionHooks(innerChild, enterHooks);
3749 const oldChild = instance.subTree;
3750 const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
3751 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
3752 const leavingHooks = resolveTransitionHooks(
3753 oldInnerChild,
3754 rawProps,
3755 state,
3756 instance
3757 );
3758 setTransitionHooks(oldInnerChild, leavingHooks);
3759 if (mode === "out-in" && innerChild.type !== Comment) {
3760 state.isLeaving = true;
3761 leavingHooks.afterLeave = () => {
3762 state.isLeaving = false;
3763 if (instance.update.active !== false) {
3764 instance.effect.dirty = true;
3765 instance.update();
3766 }
3767 };
3768 return emptyPlaceholder(child);
3769 } else if (mode === "in-out" && innerChild.type !== Comment) {
3770 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3771 const leavingVNodesCache = getLeavingNodesForType(
3772 state,
3773 oldInnerChild
3774 );
3775 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3776 el[leaveCbKey] = () => {
3777 earlyRemove();
3778 el[leaveCbKey] = void 0;
3779 delete enterHooks.delayedLeave;
3780 };
3781 enterHooks.delayedLeave = delayedLeave;
3782 };
3783 }
3784 }
3785 return child;
3786 };
3787 }
3788 };
3789 const BaseTransition = BaseTransitionImpl;
3790 function getLeavingNodesForType(state, vnode) {
3791 const { leavingVNodes } = state;
3792 let leavingVNodesCache = leavingVNodes.get(vnode.type);
3793 if (!leavingVNodesCache) {
3794 leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3795 leavingVNodes.set(vnode.type, leavingVNodesCache);
3796 }
3797 return leavingVNodesCache;
3798 }
3799 function resolveTransitionHooks(vnode, props, state, instance) {
3800 const {
3801 appear,
3802 mode,
3803 persisted = false,
3804 onBeforeEnter,
3805 onEnter,
3806 onAfterEnter,
3807 onEnterCancelled,
3808 onBeforeLeave,
3809 onLeave,
3810 onAfterLeave,
3811 onLeaveCancelled,
3812 onBeforeAppear,
3813 onAppear,
3814 onAfterAppear,
3815 onAppearCancelled
3816 } = props;
3817 const key = String(vnode.key);
3818 const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3819 const callHook = (hook, args) => {
3820 hook && callWithAsyncErrorHandling(
3821 hook,
3822 instance,
3823 9,
3824 args
3825 );
3826 };
3827 const callAsyncHook = (hook, args) => {
3828 const done = args[1];
3829 callHook(hook, args);
3830 if (isArray(hook)) {
3831 if (hook.every((hook2) => hook2.length <= 1))
3832 done();
3833 } else if (hook.length <= 1) {
3834 done();
3835 }
3836 };
3837 const hooks = {
3838 mode,
3839 persisted,
3840 beforeEnter(el) {
3841 let hook = onBeforeEnter;
3842 if (!state.isMounted) {
3843 if (appear) {
3844 hook = onBeforeAppear || onBeforeEnter;
3845 } else {
3846 return;
3847 }
3848 }
3849 if (el[leaveCbKey]) {
3850 el[leaveCbKey](
3851 true
3852 /* cancelled */
3853 );
3854 }
3855 const leavingVNode = leavingVNodesCache[key];
3856 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3857 leavingVNode.el[leaveCbKey]();
3858 }
3859 callHook(hook, [el]);
3860 },
3861 enter(el) {
3862 let hook = onEnter;
3863 let afterHook = onAfterEnter;
3864 let cancelHook = onEnterCancelled;
3865 if (!state.isMounted) {
3866 if (appear) {
3867 hook = onAppear || onEnter;
3868 afterHook = onAfterAppear || onAfterEnter;
3869 cancelHook = onAppearCancelled || onEnterCancelled;
3870 } else {
3871 return;
3872 }
3873 }
3874 let called = false;
3875 const done = el[enterCbKey$1] = (cancelled) => {
3876 if (called)
3877 return;
3878 called = true;
3879 if (cancelled) {
3880 callHook(cancelHook, [el]);
3881 } else {
3882 callHook(afterHook, [el]);
3883 }
3884 if (hooks.delayedLeave) {
3885 hooks.delayedLeave();
3886 }
3887 el[enterCbKey$1] = void 0;
3888 };
3889 if (hook) {
3890 callAsyncHook(hook, [el, done]);
3891 } else {
3892 done();
3893 }
3894 },
3895 leave(el, remove) {
3896 const key2 = String(vnode.key);
3897 if (el[enterCbKey$1]) {
3898 el[enterCbKey$1](
3899 true
3900 /* cancelled */
3901 );
3902 }
3903 if (state.isUnmounting) {
3904 return remove();
3905 }
3906 callHook(onBeforeLeave, [el]);
3907 let called = false;
3908 const done = el[leaveCbKey] = (cancelled) => {
3909 if (called)
3910 return;
3911 called = true;
3912 remove();
3913 if (cancelled) {
3914 callHook(onLeaveCancelled, [el]);
3915 } else {
3916 callHook(onAfterLeave, [el]);
3917 }
3918 el[leaveCbKey] = void 0;
3919 if (leavingVNodesCache[key2] === vnode) {
3920 delete leavingVNodesCache[key2];
3921 }
3922 };
3923 leavingVNodesCache[key2] = vnode;
3924 if (onLeave) {
3925 callAsyncHook(onLeave, [el, done]);
3926 } else {
3927 done();
3928 }
3929 },
3930 clone(vnode2) {
3931 return resolveTransitionHooks(vnode2, props, state, instance);
3932 }
3933 };
3934 return hooks;
3935 }
3936 function emptyPlaceholder(vnode) {
3937 if (isKeepAlive(vnode)) {
3938 vnode = cloneVNode(vnode);
3939 vnode.children = null;
3940 return vnode;
3941 }
3942 }
3943 function getKeepAliveChild(vnode) {
3944 if (!isKeepAlive(vnode)) {
3945 return vnode;
3946 }
3947 if (vnode.component) {
3948 return vnode.component.subTree;
3949 }
3950 const { shapeFlag, children } = vnode;
3951 if (children) {
3952 if (shapeFlag & 16) {
3953 return children[0];
3954 }
3955 if (shapeFlag & 32 && isFunction(children.default)) {
3956 return children.default();
3957 }
3958 }
3959 }
3960 function setTransitionHooks(vnode, hooks) {
3961 if (vnode.shapeFlag & 6 && vnode.component) {
3962 setTransitionHooks(vnode.component.subTree, hooks);
3963 } else if (vnode.shapeFlag & 128) {
3964 vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3965 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3966 } else {
3967 vnode.transition = hooks;
3968 }
3969 }
3970 function getTransitionRawChildren(children, keepComment = false, parentKey) {
3971 let ret = [];
3972 let keyedFragmentCount = 0;
3973 for (let i = 0; i < children.length; i++) {
3974 let child = children[i];
3975 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
3976 if (child.type === Fragment) {
3977 if (child.patchFlag & 128)
3978 keyedFragmentCount++;
3979 ret = ret.concat(
3980 getTransitionRawChildren(child.children, keepComment, key)
3981 );
3982 } else if (keepComment || child.type !== Comment) {
3983 ret.push(key != null ? cloneVNode(child, { key }) : child);
3984 }
3985 }
3986 if (keyedFragmentCount > 1) {
3987 for (let i = 0; i < ret.length; i++) {
3988 ret[i].patchFlag = -2;
3989 }
3990 }
3991 return ret;
3992 }
3993
3994 /*! #__NO_SIDE_EFFECTS__ */
3995 // @__NO_SIDE_EFFECTS__
3996 function defineComponent(options, extraOptions) {
3997 return isFunction(options) ? (
3998 // #8326: extend call and options.name access are considered side-effects
3999 // by Rollup, so we have to wrap it in a pure-annotated IIFE.
4000 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
4001 ) : options;
4002 }
4003
4004 const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4005 /*! #__NO_SIDE_EFFECTS__ */
4006 // @__NO_SIDE_EFFECTS__
4007 function defineAsyncComponent(source) {
4008 if (isFunction(source)) {
4009 source = { loader: source };
4010 }
4011 const {
4012 loader,
4013 loadingComponent,
4014 errorComponent,
4015 delay = 200,
4016 timeout,
4017 // undefined = never times out
4018 suspensible = true,
4019 onError: userOnError
4020 } = source;
4021 let pendingRequest = null;
4022 let resolvedComp;
4023 let retries = 0;
4024 const retry = () => {
4025 retries++;
4026 pendingRequest = null;
4027 return load();
4028 };
4029 const load = () => {
4030 let thisRequest;
4031 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4032 err = err instanceof Error ? err : new Error(String(err));
4033 if (userOnError) {
4034 return new Promise((resolve, reject) => {
4035 const userRetry = () => resolve(retry());
4036 const userFail = () => reject(err);
4037 userOnError(err, userRetry, userFail, retries + 1);
4038 });
4039 } else {
4040 throw err;
4041 }
4042 }).then((comp) => {
4043 if (thisRequest !== pendingRequest && pendingRequest) {
4044 return pendingRequest;
4045 }
4046 if (!comp) {
4047 warn$1(
4048 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
4049 );
4050 }
4051 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4052 comp = comp.default;
4053 }
4054 if (comp && !isObject(comp) && !isFunction(comp)) {
4055 throw new Error(`Invalid async component load result: ${comp}`);
4056 }
4057 resolvedComp = comp;
4058 return comp;
4059 }));
4060 };
4061 return defineComponent({
4062 name: "AsyncComponentWrapper",
4063 __asyncLoader: load,
4064 get __asyncResolved() {
4065 return resolvedComp;
4066 },
4067 setup() {
4068 const instance = currentInstance;
4069 if (resolvedComp) {
4070 return () => createInnerComp(resolvedComp, instance);
4071 }
4072 const onError = (err) => {
4073 pendingRequest = null;
4074 handleError(
4075 err,
4076 instance,
4077 13,
4078 !errorComponent
4079 );
4080 };
4081 if (suspensible && instance.suspense || false) {
4082 return load().then((comp) => {
4083 return () => createInnerComp(comp, instance);
4084 }).catch((err) => {
4085 onError(err);
4086 return () => errorComponent ? createVNode(errorComponent, {
4087 error: err
4088 }) : null;
4089 });
4090 }
4091 const loaded = ref(false);
4092 const error = ref();
4093 const delayed = ref(!!delay);
4094 if (delay) {
4095 setTimeout(() => {
4096 delayed.value = false;
4097 }, delay);
4098 }
4099 if (timeout != null) {
4100 setTimeout(() => {
4101 if (!loaded.value && !error.value) {
4102 const err = new Error(
4103 `Async component timed out after ${timeout}ms.`
4104 );
4105 onError(err);
4106 error.value = err;
4107 }
4108 }, timeout);
4109 }
4110 load().then(() => {
4111 loaded.value = true;
4112 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4113 instance.parent.effect.dirty = true;
4114 queueJob(instance.parent.update);
4115 }
4116 }).catch((err) => {
4117 onError(err);
4118 error.value = err;
4119 });
4120 return () => {
4121 if (loaded.value && resolvedComp) {
4122 return createInnerComp(resolvedComp, instance);
4123 } else if (error.value && errorComponent) {
4124 return createVNode(errorComponent, {
4125 error: error.value
4126 });
4127 } else if (loadingComponent && !delayed.value) {
4128 return createVNode(loadingComponent);
4129 }
4130 };
4131 }
4132 });
4133 }
4134 function createInnerComp(comp, parent) {
4135 const { ref: ref2, props, children, ce } = parent.vnode;
4136 const vnode = createVNode(comp, props, children);
4137 vnode.ref = ref2;
4138 vnode.ce = ce;
4139 delete parent.vnode.ce;
4140 return vnode;
4141 }
4142
4143 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4144 const KeepAliveImpl = {
4145 name: `KeepAlive`,
4146 // Marker for special handling inside the renderer. We are not using a ===
4147 // check directly on KeepAlive in the renderer, because importing it directly
4148 // would prevent it from being tree-shaken.
4149 __isKeepAlive: true,
4150 props: {
4151 include: [String, RegExp, Array],
4152 exclude: [String, RegExp, Array],
4153 max: [String, Number]
4154 },
4155 setup(props, { slots }) {
4156 const instance = getCurrentInstance();
4157 const sharedContext = instance.ctx;
4158 const cache = /* @__PURE__ */ new Map();
4159 const keys = /* @__PURE__ */ new Set();
4160 let current = null;
4161 {
4162 instance.__v_cache = cache;
4163 }
4164 const parentSuspense = instance.suspense;
4165 const {
4166 renderer: {
4167 p: patch,
4168 m: move,
4169 um: _unmount,
4170 o: { createElement }
4171 }
4172 } = sharedContext;
4173 const storageContainer = createElement("div");
4174 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4175 const instance2 = vnode.component;
4176 move(vnode, container, anchor, 0, parentSuspense);
4177 patch(
4178 instance2.vnode,
4179 vnode,
4180 container,
4181 anchor,
4182 instance2,
4183 parentSuspense,
4184 namespace,
4185 vnode.slotScopeIds,
4186 optimized
4187 );
4188 queuePostRenderEffect(() => {
4189 instance2.isDeactivated = false;
4190 if (instance2.a) {
4191 invokeArrayFns(instance2.a);
4192 }
4193 const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4194 if (vnodeHook) {
4195 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4196 }
4197 }, parentSuspense);
4198 {
4199 devtoolsComponentAdded(instance2);
4200 }
4201 };
4202 sharedContext.deactivate = (vnode) => {
4203 const instance2 = vnode.component;
4204 move(vnode, storageContainer, null, 1, parentSuspense);
4205 queuePostRenderEffect(() => {
4206 if (instance2.da) {
4207 invokeArrayFns(instance2.da);
4208 }
4209 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4210 if (vnodeHook) {
4211 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4212 }
4213 instance2.isDeactivated = true;
4214 }, parentSuspense);
4215 {
4216 devtoolsComponentAdded(instance2);
4217 }
4218 };
4219 function unmount(vnode) {
4220 resetShapeFlag(vnode);
4221 _unmount(vnode, instance, parentSuspense, true);
4222 }
4223 function pruneCache(filter) {
4224 cache.forEach((vnode, key) => {
4225 const name = getComponentName(vnode.type);
4226 if (name && (!filter || !filter(name))) {
4227 pruneCacheEntry(key);
4228 }
4229 });
4230 }
4231 function pruneCacheEntry(key) {
4232 const cached = cache.get(key);
4233 if (!current || !isSameVNodeType(cached, current)) {
4234 unmount(cached);
4235 } else if (current) {
4236 resetShapeFlag(current);
4237 }
4238 cache.delete(key);
4239 keys.delete(key);
4240 }
4241 watch(
4242 () => [props.include, props.exclude],
4243 ([include, exclude]) => {
4244 include && pruneCache((name) => matches(include, name));
4245 exclude && pruneCache((name) => !matches(exclude, name));
4246 },
4247 // prune post-render after `current` has been updated
4248 { flush: "post", deep: true }
4249 );
4250 let pendingCacheKey = null;
4251 const cacheSubtree = () => {
4252 if (pendingCacheKey != null) {
4253 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4254 }
4255 };
4256 onMounted(cacheSubtree);
4257 onUpdated(cacheSubtree);
4258 onBeforeUnmount(() => {
4259 cache.forEach((cached) => {
4260 const { subTree, suspense } = instance;
4261 const vnode = getInnerChild(subTree);
4262 if (cached.type === vnode.type && cached.key === vnode.key) {
4263 resetShapeFlag(vnode);
4264 const da = vnode.component.da;
4265 da && queuePostRenderEffect(da, suspense);
4266 return;
4267 }
4268 unmount(cached);
4269 });
4270 });
4271 return () => {
4272 pendingCacheKey = null;
4273 if (!slots.default) {
4274 return null;
4275 }
4276 const children = slots.default();
4277 const rawVNode = children[0];
4278 if (children.length > 1) {
4279 {
4280 warn$1(`KeepAlive should contain exactly one component child.`);
4281 }
4282 current = null;
4283 return children;
4284 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4285 current = null;
4286 return rawVNode;
4287 }
4288 let vnode = getInnerChild(rawVNode);
4289 const comp = vnode.type;
4290 const name = getComponentName(
4291 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4292 );
4293 const { include, exclude, max } = props;
4294 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4295 current = vnode;
4296 return rawVNode;
4297 }
4298 const key = vnode.key == null ? comp : vnode.key;
4299 const cachedVNode = cache.get(key);
4300 if (vnode.el) {
4301 vnode = cloneVNode(vnode);
4302 if (rawVNode.shapeFlag & 128) {
4303 rawVNode.ssContent = vnode;
4304 }
4305 }
4306 pendingCacheKey = key;
4307 if (cachedVNode) {
4308 vnode.el = cachedVNode.el;
4309 vnode.component = cachedVNode.component;
4310 if (vnode.transition) {
4311 setTransitionHooks(vnode, vnode.transition);
4312 }
4313 vnode.shapeFlag |= 512;
4314 keys.delete(key);
4315 keys.add(key);
4316 } else {
4317 keys.add(key);
4318 if (max && keys.size > parseInt(max, 10)) {
4319 pruneCacheEntry(keys.values().next().value);
4320 }
4321 }
4322 vnode.shapeFlag |= 256;
4323 current = vnode;
4324 return isSuspense(rawVNode.type) ? rawVNode : vnode;
4325 };
4326 }
4327 };
4328 const KeepAlive = KeepAliveImpl;
4329 function matches(pattern, name) {
4330 if (isArray(pattern)) {
4331 return pattern.some((p) => matches(p, name));
4332 } else if (isString(pattern)) {
4333 return pattern.split(",").includes(name);
4334 } else if (isRegExp(pattern)) {
4335 return pattern.test(name);
4336 }
4337 return false;
4338 }
4339 function onActivated(hook, target) {
4340 registerKeepAliveHook(hook, "a", target);
4341 }
4342 function onDeactivated(hook, target) {
4343 registerKeepAliveHook(hook, "da", target);
4344 }
4345 function registerKeepAliveHook(hook, type, target = currentInstance) {
4346 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4347 let current = target;
4348 while (current) {
4349 if (current.isDeactivated) {
4350 return;
4351 }
4352 current = current.parent;
4353 }
4354 return hook();
4355 });
4356 injectHook(type, wrappedHook, target);
4357 if (target) {
4358 let current = target.parent;
4359 while (current && current.parent) {
4360 if (isKeepAlive(current.parent.vnode)) {
4361 injectToKeepAliveRoot(wrappedHook, type, target, current);
4362 }
4363 current = current.parent;
4364 }
4365 }
4366 }
4367 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4368 const injected = injectHook(
4369 type,
4370 hook,
4371 keepAliveRoot,
4372 true
4373 /* prepend */
4374 );
4375 onUnmounted(() => {
4376 remove(keepAliveRoot[type], injected);
4377 }, target);
4378 }
4379 function resetShapeFlag(vnode) {
4380 vnode.shapeFlag &= ~256;
4381 vnode.shapeFlag &= ~512;
4382 }
4383 function getInnerChild(vnode) {
4384 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4385 }
4386
4387 function injectHook(type, hook, target = currentInstance, prepend = false) {
4388 if (target) {
4389 const hooks = target[type] || (target[type] = []);
4390 const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4391 if (target.isUnmounted) {
4392 return;
4393 }
4394 pauseTracking();
4395 const reset = setCurrentInstance(target);
4396 const res = callWithAsyncErrorHandling(hook, target, type, args);
4397 reset();
4398 resetTracking();
4399 return res;
4400 });
4401 if (prepend) {
4402 hooks.unshift(wrappedHook);
4403 } else {
4404 hooks.push(wrappedHook);
4405 }
4406 return wrappedHook;
4407 } else {
4408 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
4409 warn$1(
4410 `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
4411 );
4412 }
4413 }
4414 const createHook = (lifecycle) => (hook, target = currentInstance) => (
4415 // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4416 (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
4417 );
4418 const onBeforeMount = createHook("bm");
4419 const onMounted = createHook("m");
4420 const onBeforeUpdate = createHook("bu");
4421 const onUpdated = createHook("u");
4422 const onBeforeUnmount = createHook("bum");
4423 const onUnmounted = createHook("um");
4424 const onServerPrefetch = createHook("sp");
4425 const onRenderTriggered = createHook(
4426 "rtg"
4427 );
4428 const onRenderTracked = createHook(
4429 "rtc"
4430 );
4431 function onErrorCaptured(hook, target = currentInstance) {
4432 injectHook("ec", hook, target);
4433 }
4434
4435 function renderList(source, renderItem, cache, index) {
4436 let ret;
4437 const cached = cache && cache[index];
4438 if (isArray(source) || isString(source)) {
4439 ret = new Array(source.length);
4440 for (let i = 0, l = source.length; i < l; i++) {
4441 ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
4442 }
4443 } else if (typeof source === "number") {
4444 if (!Number.isInteger(source)) {
4445 warn$1(`The v-for range expect an integer value but got ${source}.`);
4446 }
4447 ret = new Array(source);
4448 for (let i = 0; i < source; i++) {
4449 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
4450 }
4451 } else if (isObject(source)) {
4452 if (source[Symbol.iterator]) {
4453 ret = Array.from(
4454 source,
4455 (item, i) => renderItem(item, i, void 0, cached && cached[i])
4456 );
4457 } else {
4458 const keys = Object.keys(source);
4459 ret = new Array(keys.length);
4460 for (let i = 0, l = keys.length; i < l; i++) {
4461 const key = keys[i];
4462 ret[i] = renderItem(source[key], key, i, cached && cached[i]);
4463 }
4464 }
4465 } else {
4466 ret = [];
4467 }
4468 if (cache) {
4469 cache[index] = ret;
4470 }
4471 return ret;
4472 }
4473
4474 function createSlots(slots, dynamicSlots) {
4475 for (let i = 0; i < dynamicSlots.length; i++) {
4476 const slot = dynamicSlots[i];
4477 if (isArray(slot)) {
4478 for (let j = 0; j < slot.length; j++) {
4479 slots[slot[j].name] = slot[j].fn;
4480 }
4481 } else if (slot) {
4482 slots[slot.name] = slot.key ? (...args) => {
4483 const res = slot.fn(...args);
4484 if (res)
4485 res.key = slot.key;
4486 return res;
4487 } : slot.fn;
4488 }
4489 }
4490 return slots;
4491 }
4492
4493 function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4494 if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
4495 if (name !== "default")
4496 props.name = name;
4497 return createVNode("slot", props, fallback && fallback());
4498 }
4499 let slot = slots[name];
4500 if (slot && slot.length > 1) {
4501 warn$1(
4502 `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
4503 );
4504 slot = () => [];
4505 }
4506 if (slot && slot._c) {
4507 slot._d = false;
4508 }
4509 openBlock();
4510 const validSlotContent = slot && ensureValidVNode(slot(props));
4511 const rendered = createBlock(
4512 Fragment,
4513 {
4514 key: props.key || // slot content array of a dynamic conditional slot may have a branch
4515 // key attached in the `createSlots` helper, respect that
4516 validSlotContent && validSlotContent.key || `_${name}`
4517 },
4518 validSlotContent || (fallback ? fallback() : []),
4519 validSlotContent && slots._ === 1 ? 64 : -2
4520 );
4521 if (!noSlotted && rendered.scopeId) {
4522 rendered.slotScopeIds = [rendered.scopeId + "-s"];
4523 }
4524 if (slot && slot._c) {
4525 slot._d = true;
4526 }
4527 return rendered;
4528 }
4529 function ensureValidVNode(vnodes) {
4530 return vnodes.some((child) => {
4531 if (!isVNode(child))
4532 return true;
4533 if (child.type === Comment)
4534 return false;
4535 if (child.type === Fragment && !ensureValidVNode(child.children))
4536 return false;
4537 return true;
4538 }) ? vnodes : null;
4539 }
4540
4541 function toHandlers(obj, preserveCaseIfNecessary) {
4542 const ret = {};
4543 if (!isObject(obj)) {
4544 warn$1(`v-on with no argument expects an object value.`);
4545 return ret;
4546 }
4547 for (const key in obj) {
4548 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
4549 }
4550 return ret;
4551 }
4552
4553 const getPublicInstance = (i) => {
4554 if (!i)
4555 return null;
4556 if (isStatefulComponent(i))
4557 return getExposeProxy(i) || i.proxy;
4558 return getPublicInstance(i.parent);
4559 };
4560 const publicPropertiesMap = (
4561 // Move PURE marker to new line to workaround compiler discarding it
4562 // due to type annotation
4563 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
4564 $: (i) => i,
4565 $el: (i) => i.vnode.el,
4566 $data: (i) => i.data,
4567 $props: (i) => shallowReadonly(i.props) ,
4568 $attrs: (i) => shallowReadonly(i.attrs) ,
4569 $slots: (i) => shallowReadonly(i.slots) ,
4570 $refs: (i) => shallowReadonly(i.refs) ,
4571 $parent: (i) => getPublicInstance(i.parent),
4572 $root: (i) => getPublicInstance(i.root),
4573 $emit: (i) => i.emit,
4574 $options: (i) => resolveMergedOptions(i) ,
4575 $forceUpdate: (i) => i.f || (i.f = () => {
4576 i.effect.dirty = true;
4577 queueJob(i.update);
4578 }),
4579 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
4580 $watch: (i) => instanceWatch.bind(i)
4581 })
4582 );
4583 const isReservedPrefix = (key) => key === "_" || key === "$";
4584 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4585 const PublicInstanceProxyHandlers = {
4586 get({ _: instance }, key) {
4587 if (key === "__v_skip") {
4588 return true;
4589 }
4590 const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4591 if (key === "__isVue") {
4592 return true;
4593 }
4594 let normalizedProps;
4595 if (key[0] !== "$") {
4596 const n = accessCache[key];
4597 if (n !== void 0) {
4598 switch (n) {
4599 case 1 /* SETUP */:
4600 return setupState[key];
4601 case 2 /* DATA */:
4602 return data[key];
4603 case 4 /* CONTEXT */:
4604 return ctx[key];
4605 case 3 /* PROPS */:
4606 return props[key];
4607 }
4608 } else if (hasSetupBinding(setupState, key)) {
4609 accessCache[key] = 1 /* SETUP */;
4610 return setupState[key];
4611 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4612 accessCache[key] = 2 /* DATA */;
4613 return data[key];
4614 } else if (
4615 // only cache other properties when instance has declared (thus stable)
4616 // props
4617 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
4618 ) {
4619 accessCache[key] = 3 /* PROPS */;
4620 return props[key];
4621 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4622 accessCache[key] = 4 /* CONTEXT */;
4623 return ctx[key];
4624 } else if (shouldCacheAccess) {
4625 accessCache[key] = 0 /* OTHER */;
4626 }
4627 }
4628 const publicGetter = publicPropertiesMap[key];
4629 let cssModule, globalProperties;
4630 if (publicGetter) {
4631 if (key === "$attrs") {
4632 track(instance.attrs, "get", "");
4633 markAttrsAccessed();
4634 } else if (key === "$slots") {
4635 track(instance, "get", key);
4636 }
4637 return publicGetter(instance);
4638 } else if (
4639 // css module (injected by vue-loader)
4640 (cssModule = type.__cssModules) && (cssModule = cssModule[key])
4641 ) {
4642 return cssModule;
4643 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4644 accessCache[key] = 4 /* CONTEXT */;
4645 return ctx[key];
4646 } else if (
4647 // global properties
4648 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
4649 ) {
4650 {
4651 return globalProperties[key];
4652 }
4653 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
4654 // to infinite warning loop
4655 key.indexOf("__v") !== 0)) {
4656 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
4657 warn$1(
4658 `Property ${JSON.stringify(
4659 key
4660 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
4661 );
4662 } else if (instance === currentRenderingInstance) {
4663 warn$1(
4664 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
4665 );
4666 }
4667 }
4668 },
4669 set({ _: instance }, key, value) {
4670 const { data, setupState, ctx } = instance;
4671 if (hasSetupBinding(setupState, key)) {
4672 setupState[key] = value;
4673 return true;
4674 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
4675 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
4676 return false;
4677 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4678 data[key] = value;
4679 return true;
4680 } else if (hasOwn(instance.props, key)) {
4681 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
4682 return false;
4683 }
4684 if (key[0] === "$" && key.slice(1) in instance) {
4685 warn$1(
4686 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
4687 );
4688 return false;
4689 } else {
4690 if (key in instance.appContext.config.globalProperties) {
4691 Object.defineProperty(ctx, key, {
4692 enumerable: true,
4693 configurable: true,
4694 value
4695 });
4696 } else {
4697 ctx[key] = value;
4698 }
4699 }
4700 return true;
4701 },
4702 has({
4703 _: { data, setupState, accessCache, ctx, appContext, propsOptions }
4704 }, key) {
4705 let normalizedProps;
4706 return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
4707 },
4708 defineProperty(target, key, descriptor) {
4709 if (descriptor.get != null) {
4710 target._.accessCache[key] = 0;
4711 } else if (hasOwn(descriptor, "value")) {
4712 this.set(target, key, descriptor.value, null);
4713 }
4714 return Reflect.defineProperty(target, key, descriptor);
4715 }
4716 };
4717 {
4718 PublicInstanceProxyHandlers.ownKeys = (target) => {
4719 warn$1(
4720 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
4721 );
4722 return Reflect.ownKeys(target);
4723 };
4724 }
4725 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
4726 {},
4727 PublicInstanceProxyHandlers,
4728 {
4729 get(target, key) {
4730 if (key === Symbol.unscopables) {
4731 return;
4732 }
4733 return PublicInstanceProxyHandlers.get(target, key, target);
4734 },
4735 has(_, key) {
4736 const has = key[0] !== "_" && !isGloballyAllowed(key);
4737 if (!has && PublicInstanceProxyHandlers.has(_, key)) {
4738 warn$1(
4739 `Property ${JSON.stringify(
4740 key
4741 )} should not start with _ which is a reserved prefix for Vue internals.`
4742 );
4743 }
4744 return has;
4745 }
4746 }
4747 );
4748 function createDevRenderContext(instance) {
4749 const target = {};
4750 Object.defineProperty(target, `_`, {
4751 configurable: true,
4752 enumerable: false,
4753 get: () => instance
4754 });
4755 Object.keys(publicPropertiesMap).forEach((key) => {
4756 Object.defineProperty(target, key, {
4757 configurable: true,
4758 enumerable: false,
4759 get: () => publicPropertiesMap[key](instance),
4760 // intercepted by the proxy so no need for implementation,
4761 // but needed to prevent set errors
4762 set: NOOP
4763 });
4764 });
4765 return target;
4766 }
4767 function exposePropsOnRenderContext(instance) {
4768 const {
4769 ctx,
4770 propsOptions: [propsOptions]
4771 } = instance;
4772 if (propsOptions) {
4773 Object.keys(propsOptions).forEach((key) => {
4774 Object.defineProperty(ctx, key, {
4775 enumerable: true,
4776 configurable: true,
4777 get: () => instance.props[key],
4778 set: NOOP
4779 });
4780 });
4781 }
4782 }
4783 function exposeSetupStateOnRenderContext(instance) {
4784 const { ctx, setupState } = instance;
4785 Object.keys(toRaw(setupState)).forEach((key) => {
4786 if (!setupState.__isScriptSetup) {
4787 if (isReservedPrefix(key[0])) {
4788 warn$1(
4789 `setup() return property ${JSON.stringify(
4790 key
4791 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
4792 );
4793 return;
4794 }
4795 Object.defineProperty(ctx, key, {
4796 enumerable: true,
4797 configurable: true,
4798 get: () => setupState[key],
4799 set: NOOP
4800 });
4801 }
4802 });
4803 }
4804
4805 const warnRuntimeUsage = (method) => warn$1(
4806 `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
4807 );
4808 function defineProps() {
4809 {
4810 warnRuntimeUsage(`defineProps`);
4811 }
4812 return null;
4813 }
4814 function defineEmits() {
4815 {
4816 warnRuntimeUsage(`defineEmits`);
4817 }
4818 return null;
4819 }
4820 function defineExpose(exposed) {
4821 {
4822 warnRuntimeUsage(`defineExpose`);
4823 }
4824 }
4825 function defineOptions(options) {
4826 {
4827 warnRuntimeUsage(`defineOptions`);
4828 }
4829 }
4830 function defineSlots() {
4831 {
4832 warnRuntimeUsage(`defineSlots`);
4833 }
4834 return null;
4835 }
4836 function defineModel() {
4837 {
4838 warnRuntimeUsage("defineModel");
4839 }
4840 }
4841 function withDefaults(props, defaults) {
4842 {
4843 warnRuntimeUsage(`withDefaults`);
4844 }
4845 return null;
4846 }
4847 function useSlots() {
4848 return getContext().slots;
4849 }
4850 function useAttrs() {
4851 return getContext().attrs;
4852 }
4853 function getContext() {
4854 const i = getCurrentInstance();
4855 if (!i) {
4856 warn$1(`useContext() called without active instance.`);
4857 }
4858 return i.setupContext || (i.setupContext = createSetupContext(i));
4859 }
4860 function normalizePropsOrEmits(props) {
4861 return isArray(props) ? props.reduce(
4862 (normalized, p) => (normalized[p] = null, normalized),
4863 {}
4864 ) : props;
4865 }
4866 function mergeDefaults(raw, defaults) {
4867 const props = normalizePropsOrEmits(raw);
4868 for (const key in defaults) {
4869 if (key.startsWith("__skip"))
4870 continue;
4871 let opt = props[key];
4872 if (opt) {
4873 if (isArray(opt) || isFunction(opt)) {
4874 opt = props[key] = { type: opt, default: defaults[key] };
4875 } else {
4876 opt.default = defaults[key];
4877 }
4878 } else if (opt === null) {
4879 opt = props[key] = { default: defaults[key] };
4880 } else {
4881 warn$1(`props default key "${key}" has no corresponding declaration.`);
4882 }
4883 if (opt && defaults[`__skip_${key}`]) {
4884 opt.skipFactory = true;
4885 }
4886 }
4887 return props;
4888 }
4889 function mergeModels(a, b) {
4890 if (!a || !b)
4891 return a || b;
4892 if (isArray(a) && isArray(b))
4893 return a.concat(b);
4894 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
4895 }
4896 function createPropsRestProxy(props, excludedKeys) {
4897 const ret = {};
4898 for (const key in props) {
4899 if (!excludedKeys.includes(key)) {
4900 Object.defineProperty(ret, key, {
4901 enumerable: true,
4902 get: () => props[key]
4903 });
4904 }
4905 }
4906 return ret;
4907 }
4908 function withAsyncContext(getAwaitable) {
4909 const ctx = getCurrentInstance();
4910 if (!ctx) {
4911 warn$1(
4912 `withAsyncContext called without active current instance. This is likely a bug.`
4913 );
4914 }
4915 let awaitable = getAwaitable();
4916 unsetCurrentInstance();
4917 if (isPromise(awaitable)) {
4918 awaitable = awaitable.catch((e) => {
4919 setCurrentInstance(ctx);
4920 throw e;
4921 });
4922 }
4923 return [awaitable, () => setCurrentInstance(ctx)];
4924 }
4925
4926 function createDuplicateChecker() {
4927 const cache = /* @__PURE__ */ Object.create(null);
4928 return (type, key) => {
4929 if (cache[key]) {
4930 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
4931 } else {
4932 cache[key] = type;
4933 }
4934 };
4935 }
4936 let shouldCacheAccess = true;
4937 function applyOptions(instance) {
4938 const options = resolveMergedOptions(instance);
4939 const publicThis = instance.proxy;
4940 const ctx = instance.ctx;
4941 shouldCacheAccess = false;
4942 if (options.beforeCreate) {
4943 callHook$1(options.beforeCreate, instance, "bc");
4944 }
4945 const {
4946 // state
4947 data: dataOptions,
4948 computed: computedOptions,
4949 methods,
4950 watch: watchOptions,
4951 provide: provideOptions,
4952 inject: injectOptions,
4953 // lifecycle
4954 created,
4955 beforeMount,
4956 mounted,
4957 beforeUpdate,
4958 updated,
4959 activated,
4960 deactivated,
4961 beforeDestroy,
4962 beforeUnmount,
4963 destroyed,
4964 unmounted,
4965 render,
4966 renderTracked,
4967 renderTriggered,
4968 errorCaptured,
4969 serverPrefetch,
4970 // public API
4971 expose,
4972 inheritAttrs,
4973 // assets
4974 components,
4975 directives,
4976 filters
4977 } = options;
4978 const checkDuplicateProperties = createDuplicateChecker() ;
4979 {
4980 const [propsOptions] = instance.propsOptions;
4981 if (propsOptions) {
4982 for (const key in propsOptions) {
4983 checkDuplicateProperties("Props" /* PROPS */, key);
4984 }
4985 }
4986 }
4987 if (injectOptions) {
4988 resolveInjections(injectOptions, ctx, checkDuplicateProperties);
4989 }
4990 if (methods) {
4991 for (const key in methods) {
4992 const methodHandler = methods[key];
4993 if (isFunction(methodHandler)) {
4994 {
4995 Object.defineProperty(ctx, key, {
4996 value: methodHandler.bind(publicThis),
4997 configurable: true,
4998 enumerable: true,
4999 writable: true
5000 });
5001 }
5002 {
5003 checkDuplicateProperties("Methods" /* METHODS */, key);
5004 }
5005 } else {
5006 warn$1(
5007 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
5008 );
5009 }
5010 }
5011 }
5012 if (dataOptions) {
5013 if (!isFunction(dataOptions)) {
5014 warn$1(
5015 `The data option must be a function. Plain object usage is no longer supported.`
5016 );
5017 }
5018 const data = dataOptions.call(publicThis, publicThis);
5019 if (isPromise(data)) {
5020 warn$1(
5021 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
5022 );
5023 }
5024 if (!isObject(data)) {
5025 warn$1(`data() should return an object.`);
5026 } else {
5027 instance.data = reactive(data);
5028 {
5029 for (const key in data) {
5030 checkDuplicateProperties("Data" /* DATA */, key);
5031 if (!isReservedPrefix(key[0])) {
5032 Object.defineProperty(ctx, key, {
5033 configurable: true,
5034 enumerable: true,
5035 get: () => data[key],
5036 set: NOOP
5037 });
5038 }
5039 }
5040 }
5041 }
5042 }
5043 shouldCacheAccess = true;
5044 if (computedOptions) {
5045 for (const key in computedOptions) {
5046 const opt = computedOptions[key];
5047 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
5048 if (get === NOOP) {
5049 warn$1(`Computed property "${key}" has no getter.`);
5050 }
5051 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
5052 warn$1(
5053 `Write operation failed: computed property "${key}" is readonly.`
5054 );
5055 } ;
5056 const c = computed({
5057 get,
5058 set
5059 });
5060 Object.defineProperty(ctx, key, {
5061 enumerable: true,
5062 configurable: true,
5063 get: () => c.value,
5064 set: (v) => c.value = v
5065 });
5066 {
5067 checkDuplicateProperties("Computed" /* COMPUTED */, key);
5068 }
5069 }
5070 }
5071 if (watchOptions) {
5072 for (const key in watchOptions) {
5073 createWatcher(watchOptions[key], ctx, publicThis, key);
5074 }
5075 }
5076 if (provideOptions) {
5077 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
5078 Reflect.ownKeys(provides).forEach((key) => {
5079 provide(key, provides[key]);
5080 });
5081 }
5082 if (created) {
5083 callHook$1(created, instance, "c");
5084 }
5085 function registerLifecycleHook(register, hook) {
5086 if (isArray(hook)) {
5087 hook.forEach((_hook) => register(_hook.bind(publicThis)));
5088 } else if (hook) {
5089 register(hook.bind(publicThis));
5090 }
5091 }
5092 registerLifecycleHook(onBeforeMount, beforeMount);
5093 registerLifecycleHook(onMounted, mounted);
5094 registerLifecycleHook(onBeforeUpdate, beforeUpdate);
5095 registerLifecycleHook(onUpdated, updated);
5096 registerLifecycleHook(onActivated, activated);
5097 registerLifecycleHook(onDeactivated, deactivated);
5098 registerLifecycleHook(onErrorCaptured, errorCaptured);
5099 registerLifecycleHook(onRenderTracked, renderTracked);
5100 registerLifecycleHook(onRenderTriggered, renderTriggered);
5101 registerLifecycleHook(onBeforeUnmount, beforeUnmount);
5102 registerLifecycleHook(onUnmounted, unmounted);
5103 registerLifecycleHook(onServerPrefetch, serverPrefetch);
5104 if (isArray(expose)) {
5105 if (expose.length) {
5106 const exposed = instance.exposed || (instance.exposed = {});
5107 expose.forEach((key) => {
5108 Object.defineProperty(exposed, key, {
5109 get: () => publicThis[key],
5110 set: (val) => publicThis[key] = val
5111 });
5112 });
5113 } else if (!instance.exposed) {
5114 instance.exposed = {};
5115 }
5116 }
5117 if (render && instance.render === NOOP) {
5118 instance.render = render;
5119 }
5120 if (inheritAttrs != null) {
5121 instance.inheritAttrs = inheritAttrs;
5122 }
5123 if (components)
5124 instance.components = components;
5125 if (directives)
5126 instance.directives = directives;
5127 }
5128 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5129 if (isArray(injectOptions)) {
5130 injectOptions = normalizeInject(injectOptions);
5131 }
5132 for (const key in injectOptions) {
5133 const opt = injectOptions[key];
5134 let injected;
5135 if (isObject(opt)) {
5136 if ("default" in opt) {
5137 injected = inject(
5138 opt.from || key,
5139 opt.default,
5140 true
5141 );
5142 } else {
5143 injected = inject(opt.from || key);
5144 }
5145 } else {
5146 injected = inject(opt);
5147 }
5148 if (isRef(injected)) {
5149 Object.defineProperty(ctx, key, {
5150 enumerable: true,
5151 configurable: true,
5152 get: () => injected.value,
5153 set: (v) => injected.value = v
5154 });
5155 } else {
5156 ctx[key] = injected;
5157 }
5158 {
5159 checkDuplicateProperties("Inject" /* INJECT */, key);
5160 }
5161 }
5162 }
5163 function callHook$1(hook, instance, type) {
5164 callWithAsyncErrorHandling(
5165 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
5166 instance,
5167 type
5168 );
5169 }
5170 function createWatcher(raw, ctx, publicThis, key) {
5171 const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5172 if (isString(raw)) {
5173 const handler = ctx[raw];
5174 if (isFunction(handler)) {
5175 watch(getter, handler);
5176 } else {
5177 warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5178 }
5179 } else if (isFunction(raw)) {
5180 watch(getter, raw.bind(publicThis));
5181 } else if (isObject(raw)) {
5182 if (isArray(raw)) {
5183 raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
5184 } else {
5185 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
5186 if (isFunction(handler)) {
5187 watch(getter, handler, raw);
5188 } else {
5189 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
5190 }
5191 }
5192 } else {
5193 warn$1(`Invalid watch option: "${key}"`, raw);
5194 }
5195 }
5196 function resolveMergedOptions(instance) {
5197 const base = instance.type;
5198 const { mixins, extends: extendsOptions } = base;
5199 const {
5200 mixins: globalMixins,
5201 optionsCache: cache,
5202 config: { optionMergeStrategies }
5203 } = instance.appContext;
5204 const cached = cache.get(base);
5205 let resolved;
5206 if (cached) {
5207 resolved = cached;
5208 } else if (!globalMixins.length && !mixins && !extendsOptions) {
5209 {
5210 resolved = base;
5211 }
5212 } else {
5213 resolved = {};
5214 if (globalMixins.length) {
5215 globalMixins.forEach(
5216 (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
5217 );
5218 }
5219 mergeOptions(resolved, base, optionMergeStrategies);
5220 }
5221 if (isObject(base)) {
5222 cache.set(base, resolved);
5223 }
5224 return resolved;
5225 }
5226 function mergeOptions(to, from, strats, asMixin = false) {
5227 const { mixins, extends: extendsOptions } = from;
5228 if (extendsOptions) {
5229 mergeOptions(to, extendsOptions, strats, true);
5230 }
5231 if (mixins) {
5232 mixins.forEach(
5233 (m) => mergeOptions(to, m, strats, true)
5234 );
5235 }
5236 for (const key in from) {
5237 if (asMixin && key === "expose") {
5238 warn$1(
5239 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
5240 );
5241 } else {
5242 const strat = internalOptionMergeStrats[key] || strats && strats[key];
5243 to[key] = strat ? strat(to[key], from[key]) : from[key];
5244 }
5245 }
5246 return to;
5247 }
5248 const internalOptionMergeStrats = {
5249 data: mergeDataFn,
5250 props: mergeEmitsOrPropsOptions,
5251 emits: mergeEmitsOrPropsOptions,
5252 // objects
5253 methods: mergeObjectOptions,
5254 computed: mergeObjectOptions,
5255 // lifecycle
5256 beforeCreate: mergeAsArray$1,
5257 created: mergeAsArray$1,
5258 beforeMount: mergeAsArray$1,
5259 mounted: mergeAsArray$1,
5260 beforeUpdate: mergeAsArray$1,
5261 updated: mergeAsArray$1,
5262 beforeDestroy: mergeAsArray$1,
5263 beforeUnmount: mergeAsArray$1,
5264 destroyed: mergeAsArray$1,
5265 unmounted: mergeAsArray$1,
5266 activated: mergeAsArray$1,
5267 deactivated: mergeAsArray$1,
5268 errorCaptured: mergeAsArray$1,
5269 serverPrefetch: mergeAsArray$1,
5270 // assets
5271 components: mergeObjectOptions,
5272 directives: mergeObjectOptions,
5273 // watch
5274 watch: mergeWatchOptions,
5275 // provide / inject
5276 provide: mergeDataFn,
5277 inject: mergeInject
5278 };
5279 function mergeDataFn(to, from) {
5280 if (!from) {
5281 return to;
5282 }
5283 if (!to) {
5284 return from;
5285 }
5286 return function mergedDataFn() {
5287 return (extend)(
5288 isFunction(to) ? to.call(this, this) : to,
5289 isFunction(from) ? from.call(this, this) : from
5290 );
5291 };
5292 }
5293 function mergeInject(to, from) {
5294 return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
5295 }
5296 function normalizeInject(raw) {
5297 if (isArray(raw)) {
5298 const res = {};
5299 for (let i = 0; i < raw.length; i++) {
5300 res[raw[i]] = raw[i];
5301 }
5302 return res;
5303 }
5304 return raw;
5305 }
5306 function mergeAsArray$1(to, from) {
5307 return to ? [...new Set([].concat(to, from))] : from;
5308 }
5309 function mergeObjectOptions(to, from) {
5310 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5311 }
5312 function mergeEmitsOrPropsOptions(to, from) {
5313 if (to) {
5314 if (isArray(to) && isArray(from)) {
5315 return [.../* @__PURE__ */ new Set([...to, ...from])];
5316 }
5317 return extend(
5318 /* @__PURE__ */ Object.create(null),
5319 normalizePropsOrEmits(to),
5320 normalizePropsOrEmits(from != null ? from : {})
5321 );
5322 } else {
5323 return from;
5324 }
5325 }
5326 function mergeWatchOptions(to, from) {
5327 if (!to)
5328 return from;
5329 if (!from)
5330 return to;
5331 const merged = extend(/* @__PURE__ */ Object.create(null), to);
5332 for (const key in from) {
5333 merged[key] = mergeAsArray$1(to[key], from[key]);
5334 }
5335 return merged;
5336 }
5337
5338 function createAppContext() {
5339 return {
5340 app: null,
5341 config: {
5342 isNativeTag: NO,
5343 performance: false,
5344 globalProperties: {},
5345 optionMergeStrategies: {},
5346 errorHandler: void 0,
5347 warnHandler: void 0,
5348 compilerOptions: {}
5349 },
5350 mixins: [],
5351 components: {},
5352 directives: {},
5353 provides: /* @__PURE__ */ Object.create(null),
5354 optionsCache: /* @__PURE__ */ new WeakMap(),
5355 propsCache: /* @__PURE__ */ new WeakMap(),
5356 emitsCache: /* @__PURE__ */ new WeakMap()
5357 };
5358 }
5359 let uid$1 = 0;
5360 function createAppAPI(render, hydrate) {
5361 return function createApp(rootComponent, rootProps = null) {
5362 if (!isFunction(rootComponent)) {
5363 rootComponent = extend({}, rootComponent);
5364 }
5365 if (rootProps != null && !isObject(rootProps)) {
5366 warn$1(`root props passed to app.mount() must be an object.`);
5367 rootProps = null;
5368 }
5369 const context = createAppContext();
5370 const installedPlugins = /* @__PURE__ */ new WeakSet();
5371 let isMounted = false;
5372 const app = context.app = {
5373 _uid: uid$1++,
5374 _component: rootComponent,
5375 _props: rootProps,
5376 _container: null,
5377 _context: context,
5378 _instance: null,
5379 version,
5380 get config() {
5381 return context.config;
5382 },
5383 set config(v) {
5384 {
5385 warn$1(
5386 `app.config cannot be replaced. Modify individual options instead.`
5387 );
5388 }
5389 },
5390 use(plugin, ...options) {
5391 if (installedPlugins.has(plugin)) {
5392 warn$1(`Plugin has already been applied to target app.`);
5393 } else if (plugin && isFunction(plugin.install)) {
5394 installedPlugins.add(plugin);
5395 plugin.install(app, ...options);
5396 } else if (isFunction(plugin)) {
5397 installedPlugins.add(plugin);
5398 plugin(app, ...options);
5399 } else {
5400 warn$1(
5401 `A plugin must either be a function or an object with an "install" function.`
5402 );
5403 }
5404 return app;
5405 },
5406 mixin(mixin) {
5407 {
5408 if (!context.mixins.includes(mixin)) {
5409 context.mixins.push(mixin);
5410 } else {
5411 warn$1(
5412 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
5413 );
5414 }
5415 }
5416 return app;
5417 },
5418 component(name, component) {
5419 {
5420 validateComponentName(name, context.config);
5421 }
5422 if (!component) {
5423 return context.components[name];
5424 }
5425 if (context.components[name]) {
5426 warn$1(`Component "${name}" has already been registered in target app.`);
5427 }
5428 context.components[name] = component;
5429 return app;
5430 },
5431 directive(name, directive) {
5432 {
5433 validateDirectiveName(name);
5434 }
5435 if (!directive) {
5436 return context.directives[name];
5437 }
5438 if (context.directives[name]) {
5439 warn$1(`Directive "${name}" has already been registered in target app.`);
5440 }
5441 context.directives[name] = directive;
5442 return app;
5443 },
5444 mount(rootContainer, isHydrate, namespace) {
5445 if (!isMounted) {
5446 if (rootContainer.__vue_app__) {
5447 warn$1(
5448 `There is already an app instance mounted on the host container.
5449 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
5450 );
5451 }
5452 const vnode = createVNode(rootComponent, rootProps);
5453 vnode.appContext = context;
5454 if (namespace === true) {
5455 namespace = "svg";
5456 } else if (namespace === false) {
5457 namespace = void 0;
5458 }
5459 {
5460 context.reload = () => {
5461 render(
5462 cloneVNode(vnode),
5463 rootContainer,
5464 namespace
5465 );
5466 };
5467 }
5468 if (isHydrate && hydrate) {
5469 hydrate(vnode, rootContainer);
5470 } else {
5471 render(vnode, rootContainer, namespace);
5472 }
5473 isMounted = true;
5474 app._container = rootContainer;
5475 rootContainer.__vue_app__ = app;
5476 {
5477 app._instance = vnode.component;
5478 devtoolsInitApp(app, version);
5479 }
5480 return getExposeProxy(vnode.component) || vnode.component.proxy;
5481 } else {
5482 warn$1(
5483 `App has already been mounted.
5484If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
5485 );
5486 }
5487 },
5488 unmount() {
5489 if (isMounted) {
5490 render(null, app._container);
5491 {
5492 app._instance = null;
5493 devtoolsUnmountApp(app);
5494 }
5495 delete app._container.__vue_app__;
5496 } else {
5497 warn$1(`Cannot unmount an app that is not mounted.`);
5498 }
5499 },
5500 provide(key, value) {
5501 if (key in context.provides) {
5502 warn$1(
5503 `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
5504 );
5505 }
5506 context.provides[key] = value;
5507 return app;
5508 },
5509 runWithContext(fn) {
5510 const lastApp = currentApp;
5511 currentApp = app;
5512 try {
5513 return fn();
5514 } finally {
5515 currentApp = lastApp;
5516 }
5517 }
5518 };
5519 return app;
5520 };
5521 }
5522 let currentApp = null;
5523
5524 function provide(key, value) {
5525 if (!currentInstance) {
5526 {
5527 warn$1(`provide() can only be used inside setup().`);
5528 }
5529 } else {
5530 let provides = currentInstance.provides;
5531 const parentProvides = currentInstance.parent && currentInstance.parent.provides;
5532 if (parentProvides === provides) {
5533 provides = currentInstance.provides = Object.create(parentProvides);
5534 }
5535 provides[key] = value;
5536 }
5537 }
5538 function inject(key, defaultValue, treatDefaultAsFactory = false) {
5539 const instance = currentInstance || currentRenderingInstance;
5540 if (instance || currentApp) {
5541 const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5542 if (provides && key in provides) {
5543 return provides[key];
5544 } else if (arguments.length > 1) {
5545 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
5546 } else {
5547 warn$1(`injection "${String(key)}" not found.`);
5548 }
5549 } else {
5550 warn$1(`inject() can only be used inside setup() or functional components.`);
5551 }
5552 }
5553 function hasInjectionContext() {
5554 return !!(currentInstance || currentRenderingInstance || currentApp);
5555 }
5556
5557 const internalObjectProto = {};
5558 const createInternalObject = () => Object.create(internalObjectProto);
5559 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5560
5561 function initProps(instance, rawProps, isStateful, isSSR = false) {
5562 const props = {};
5563 const attrs = createInternalObject();
5564 instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5565 setFullProps(instance, rawProps, props, attrs);
5566 for (const key in instance.propsOptions[0]) {
5567 if (!(key in props)) {
5568 props[key] = void 0;
5569 }
5570 }
5571 {
5572 validateProps(rawProps || {}, props, instance);
5573 }
5574 if (isStateful) {
5575 instance.props = isSSR ? props : shallowReactive(props);
5576 } else {
5577 if (!instance.type.props) {
5578 instance.props = attrs;
5579 } else {
5580 instance.props = props;
5581 }
5582 }
5583 instance.attrs = attrs;
5584 }
5585 function isInHmrContext(instance) {
5586 while (instance) {
5587 if (instance.type.__hmrId)
5588 return true;
5589 instance = instance.parent;
5590 }
5591 }
5592 function updateProps(instance, rawProps, rawPrevProps, optimized) {
5593 const {
5594 props,
5595 attrs,
5596 vnode: { patchFlag }
5597 } = instance;
5598 const rawCurrentProps = toRaw(props);
5599 const [options] = instance.propsOptions;
5600 let hasAttrsChanged = false;
5601 if (
5602 // always force full diff in dev
5603 // - #1942 if hmr is enabled with sfc component
5604 // - vite#872 non-sfc component used by sfc component
5605 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
5606 ) {
5607 if (patchFlag & 8) {
5608 const propsToUpdate = instance.vnode.dynamicProps;
5609 for (let i = 0; i < propsToUpdate.length; i++) {
5610 let key = propsToUpdate[i];
5611 if (isEmitListener(instance.emitsOptions, key)) {
5612 continue;
5613 }
5614 const value = rawProps[key];
5615 if (options) {
5616 if (hasOwn(attrs, key)) {
5617 if (value !== attrs[key]) {
5618 attrs[key] = value;
5619 hasAttrsChanged = true;
5620 }
5621 } else {
5622 const camelizedKey = camelize(key);
5623 props[camelizedKey] = resolvePropValue(
5624 options,
5625 rawCurrentProps,
5626 camelizedKey,
5627 value,
5628 instance,
5629 false
5630 );
5631 }
5632 } else {
5633 if (value !== attrs[key]) {
5634 attrs[key] = value;
5635 hasAttrsChanged = true;
5636 }
5637 }
5638 }
5639 }
5640 } else {
5641 if (setFullProps(instance, rawProps, props, attrs)) {
5642 hasAttrsChanged = true;
5643 }
5644 let kebabKey;
5645 for (const key in rawCurrentProps) {
5646 if (!rawProps || // for camelCase
5647 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5648 // and converted to camelCase (#955)
5649 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5650 if (options) {
5651 if (rawPrevProps && // for camelCase
5652 (rawPrevProps[key] !== void 0 || // for kebab-case
5653 rawPrevProps[kebabKey] !== void 0)) {
5654 props[key] = resolvePropValue(
5655 options,
5656 rawCurrentProps,
5657 key,
5658 void 0,
5659 instance,
5660 true
5661 );
5662 }
5663 } else {
5664 delete props[key];
5665 }
5666 }
5667 }
5668 if (attrs !== rawCurrentProps) {
5669 for (const key in attrs) {
5670 if (!rawProps || !hasOwn(rawProps, key) && true) {
5671 delete attrs[key];
5672 hasAttrsChanged = true;
5673 }
5674 }
5675 }
5676 }
5677 if (hasAttrsChanged) {
5678 trigger(instance.attrs, "set", "");
5679 }
5680 {
5681 validateProps(rawProps || {}, props, instance);
5682 }
5683 }
5684 function setFullProps(instance, rawProps, props, attrs) {
5685 const [options, needCastKeys] = instance.propsOptions;
5686 let hasAttrsChanged = false;
5687 let rawCastValues;
5688 if (rawProps) {
5689 for (let key in rawProps) {
5690 if (isReservedProp(key)) {
5691 continue;
5692 }
5693 const value = rawProps[key];
5694 let camelKey;
5695 if (options && hasOwn(options, camelKey = camelize(key))) {
5696 if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5697 props[camelKey] = value;
5698 } else {
5699 (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5700 }
5701 } else if (!isEmitListener(instance.emitsOptions, key)) {
5702 if (!(key in attrs) || value !== attrs[key]) {
5703 attrs[key] = value;
5704 hasAttrsChanged = true;
5705 }
5706 }
5707 }
5708 }
5709 if (needCastKeys) {
5710 const rawCurrentProps = toRaw(props);
5711 const castValues = rawCastValues || EMPTY_OBJ;
5712 for (let i = 0; i < needCastKeys.length; i++) {
5713 const key = needCastKeys[i];
5714 props[key] = resolvePropValue(
5715 options,
5716 rawCurrentProps,
5717 key,
5718 castValues[key],
5719 instance,
5720 !hasOwn(castValues, key)
5721 );
5722 }
5723 }
5724 return hasAttrsChanged;
5725 }
5726 function resolvePropValue(options, props, key, value, instance, isAbsent) {
5727 const opt = options[key];
5728 if (opt != null) {
5729 const hasDefault = hasOwn(opt, "default");
5730 if (hasDefault && value === void 0) {
5731 const defaultValue = opt.default;
5732 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5733 const { propsDefaults } = instance;
5734 if (key in propsDefaults) {
5735 value = propsDefaults[key];
5736 } else {
5737 const reset = setCurrentInstance(instance);
5738 value = propsDefaults[key] = defaultValue.call(
5739 null,
5740 props
5741 );
5742 reset();
5743 }
5744 } else {
5745 value = defaultValue;
5746 }
5747 }
5748 if (opt[0 /* shouldCast */]) {
5749 if (isAbsent && !hasDefault) {
5750 value = false;
5751 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
5752 value = true;
5753 }
5754 }
5755 }
5756 return value;
5757 }
5758 function normalizePropsOptions(comp, appContext, asMixin = false) {
5759 const cache = appContext.propsCache;
5760 const cached = cache.get(comp);
5761 if (cached) {
5762 return cached;
5763 }
5764 const raw = comp.props;
5765 const normalized = {};
5766 const needCastKeys = [];
5767 let hasExtends = false;
5768 if (!isFunction(comp)) {
5769 const extendProps = (raw2) => {
5770 hasExtends = true;
5771 const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5772 extend(normalized, props);
5773 if (keys)
5774 needCastKeys.push(...keys);
5775 };
5776 if (!asMixin && appContext.mixins.length) {
5777 appContext.mixins.forEach(extendProps);
5778 }
5779 if (comp.extends) {
5780 extendProps(comp.extends);
5781 }
5782 if (comp.mixins) {
5783 comp.mixins.forEach(extendProps);
5784 }
5785 }
5786 if (!raw && !hasExtends) {
5787 if (isObject(comp)) {
5788 cache.set(comp, EMPTY_ARR);
5789 }
5790 return EMPTY_ARR;
5791 }
5792 if (isArray(raw)) {
5793 for (let i = 0; i < raw.length; i++) {
5794 if (!isString(raw[i])) {
5795 warn$1(`props must be strings when using array syntax.`, raw[i]);
5796 }
5797 const normalizedKey = camelize(raw[i]);
5798 if (validatePropName(normalizedKey)) {
5799 normalized[normalizedKey] = EMPTY_OBJ;
5800 }
5801 }
5802 } else if (raw) {
5803 if (!isObject(raw)) {
5804 warn$1(`invalid props options`, raw);
5805 }
5806 for (const key in raw) {
5807 const normalizedKey = camelize(key);
5808 if (validatePropName(normalizedKey)) {
5809 const opt = raw[key];
5810 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5811 if (prop) {
5812 const booleanIndex = getTypeIndex(Boolean, prop.type);
5813 const stringIndex = getTypeIndex(String, prop.type);
5814 prop[0 /* shouldCast */] = booleanIndex > -1;
5815 prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
5816 if (booleanIndex > -1 || hasOwn(prop, "default")) {
5817 needCastKeys.push(normalizedKey);
5818 }
5819 }
5820 }
5821 }
5822 }
5823 const res = [normalized, needCastKeys];
5824 if (isObject(comp)) {
5825 cache.set(comp, res);
5826 }
5827 return res;
5828 }
5829 function validatePropName(key) {
5830 if (key[0] !== "$" && !isReservedProp(key)) {
5831 return true;
5832 } else {
5833 warn$1(`Invalid prop name: "${key}" is a reserved property.`);
5834 }
5835 return false;
5836 }
5837 function getType(ctor) {
5838 if (ctor === null) {
5839 return "null";
5840 }
5841 if (typeof ctor === "function") {
5842 return ctor.name || "";
5843 } else if (typeof ctor === "object") {
5844 const name = ctor.constructor && ctor.constructor.name;
5845 return name || "";
5846 }
5847 return "";
5848 }
5849 function isSameType(a, b) {
5850 return getType(a) === getType(b);
5851 }
5852 function getTypeIndex(type, expectedTypes) {
5853 if (isArray(expectedTypes)) {
5854 return expectedTypes.findIndex((t) => isSameType(t, type));
5855 } else if (isFunction(expectedTypes)) {
5856 return isSameType(expectedTypes, type) ? 0 : -1;
5857 }
5858 return -1;
5859 }
5860 function validateProps(rawProps, props, instance) {
5861 const resolvedValues = toRaw(props);
5862 const options = instance.propsOptions[0];
5863 for (const key in options) {
5864 let opt = options[key];
5865 if (opt == null)
5866 continue;
5867 validateProp(
5868 key,
5869 resolvedValues[key],
5870 opt,
5871 shallowReadonly(resolvedValues) ,
5872 !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
5873 );
5874 }
5875 }
5876 function validateProp(name, value, prop, props, isAbsent) {
5877 const { type, required, validator, skipCheck } = prop;
5878 if (required && isAbsent) {
5879 warn$1('Missing required prop: "' + name + '"');
5880 return;
5881 }
5882 if (value == null && !required) {
5883 return;
5884 }
5885 if (type != null && type !== true && !skipCheck) {
5886 let isValid = false;
5887 const types = isArray(type) ? type : [type];
5888 const expectedTypes = [];
5889 for (let i = 0; i < types.length && !isValid; i++) {
5890 const { valid, expectedType } = assertType(value, types[i]);
5891 expectedTypes.push(expectedType || "");
5892 isValid = valid;
5893 }
5894 if (!isValid) {
5895 warn$1(getInvalidTypeMessage(name, value, expectedTypes));
5896 return;
5897 }
5898 }
5899 if (validator && !validator(value, props)) {
5900 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
5901 }
5902 }
5903 const isSimpleType = /* @__PURE__ */ makeMap(
5904 "String,Number,Boolean,Function,Symbol,BigInt"
5905 );
5906 function assertType(value, type) {
5907 let valid;
5908 const expectedType = getType(type);
5909 if (isSimpleType(expectedType)) {
5910 const t = typeof value;
5911 valid = t === expectedType.toLowerCase();
5912 if (!valid && t === "object") {
5913 valid = value instanceof type;
5914 }
5915 } else if (expectedType === "Object") {
5916 valid = isObject(value);
5917 } else if (expectedType === "Array") {
5918 valid = isArray(value);
5919 } else if (expectedType === "null") {
5920 valid = value === null;
5921 } else {
5922 valid = value instanceof type;
5923 }
5924 return {
5925 valid,
5926 expectedType
5927 };
5928 }
5929 function getInvalidTypeMessage(name, value, expectedTypes) {
5930 if (expectedTypes.length === 0) {
5931 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
5932 }
5933 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5934 const expectedType = expectedTypes[0];
5935 const receivedType = toRawType(value);
5936 const expectedValue = styleValue(value, expectedType);
5937 const receivedValue = styleValue(value, receivedType);
5938 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5939 message += ` with value ${expectedValue}`;
5940 }
5941 message += `, got ${receivedType} `;
5942 if (isExplicable(receivedType)) {
5943 message += `with value ${receivedValue}.`;
5944 }
5945 return message;
5946 }
5947 function styleValue(value, type) {
5948 if (type === "String") {
5949 return `"${value}"`;
5950 } else if (type === "Number") {
5951 return `${Number(value)}`;
5952 } else {
5953 return `${value}`;
5954 }
5955 }
5956 function isExplicable(type) {
5957 const explicitTypes = ["string", "number", "boolean"];
5958 return explicitTypes.some((elem) => type.toLowerCase() === elem);
5959 }
5960 function isBoolean(...args) {
5961 return args.some((elem) => elem.toLowerCase() === "boolean");
5962 }
5963
5964 const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5965 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5966 const normalizeSlot = (key, rawSlot, ctx) => {
5967 if (rawSlot._n) {
5968 return rawSlot;
5969 }
5970 const normalized = withCtx((...args) => {
5971 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
5972 warn$1(
5973 `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
5974 );
5975 }
5976 return normalizeSlotValue(rawSlot(...args));
5977 }, ctx);
5978 normalized._c = false;
5979 return normalized;
5980 };
5981 const normalizeObjectSlots = (rawSlots, slots, instance) => {
5982 const ctx = rawSlots._ctx;
5983 for (const key in rawSlots) {
5984 if (isInternalKey(key))
5985 continue;
5986 const value = rawSlots[key];
5987 if (isFunction(value)) {
5988 slots[key] = normalizeSlot(key, value, ctx);
5989 } else if (value != null) {
5990 {
5991 warn$1(
5992 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
5993 );
5994 }
5995 const normalized = normalizeSlotValue(value);
5996 slots[key] = () => normalized;
5997 }
5998 }
5999 };
6000 const normalizeVNodeSlots = (instance, children) => {
6001 if (!isKeepAlive(instance.vnode) && true) {
6002 warn$1(
6003 `Non-function value encountered for default slot. Prefer function slots for better performance.`
6004 );
6005 }
6006 const normalized = normalizeSlotValue(children);
6007 instance.slots.default = () => normalized;
6008 };
6009 const initSlots = (instance, children) => {
6010 const slots = instance.slots = createInternalObject();
6011 if (instance.vnode.shapeFlag & 32) {
6012 const type = children._;
6013 if (type) {
6014 extend(slots, children);
6015 def(slots, "_", type, true);
6016 } else {
6017 normalizeObjectSlots(children, slots);
6018 }
6019 } else if (children) {
6020 normalizeVNodeSlots(instance, children);
6021 }
6022 };
6023 const updateSlots = (instance, children, optimized) => {
6024 const { vnode, slots } = instance;
6025 let needDeletionCheck = true;
6026 let deletionComparisonTarget = EMPTY_OBJ;
6027 if (vnode.shapeFlag & 32) {
6028 const type = children._;
6029 if (type) {
6030 if (isHmrUpdating) {
6031 extend(slots, children);
6032 trigger(instance, "set", "$slots");
6033 } else if (optimized && type === 1) {
6034 needDeletionCheck = false;
6035 } else {
6036 extend(slots, children);
6037 if (!optimized && type === 1) {
6038 delete slots._;
6039 }
6040 }
6041 } else {
6042 needDeletionCheck = !children.$stable;
6043 normalizeObjectSlots(children, slots);
6044 }
6045 deletionComparisonTarget = children;
6046 } else if (children) {
6047 normalizeVNodeSlots(instance, children);
6048 deletionComparisonTarget = { default: 1 };
6049 }
6050 if (needDeletionCheck) {
6051 for (const key in slots) {
6052 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
6053 delete slots[key];
6054 }
6055 }
6056 }
6057 };
6058
6059 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6060 if (isArray(rawRef)) {
6061 rawRef.forEach(
6062 (r, i) => setRef(
6063 r,
6064 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
6065 parentSuspense,
6066 vnode,
6067 isUnmount
6068 )
6069 );
6070 return;
6071 }
6072 if (isAsyncWrapper(vnode) && !isUnmount) {
6073 return;
6074 }
6075 const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
6076 const value = isUnmount ? null : refValue;
6077 const { i: owner, r: ref } = rawRef;
6078 if (!owner) {
6079 warn$1(
6080 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
6081 );
6082 return;
6083 }
6084 const oldRef = oldRawRef && oldRawRef.r;
6085 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
6086 const setupState = owner.setupState;
6087 if (oldRef != null && oldRef !== ref) {
6088 if (isString(oldRef)) {
6089 refs[oldRef] = null;
6090 if (hasOwn(setupState, oldRef)) {
6091 setupState[oldRef] = null;
6092 }
6093 } else if (isRef(oldRef)) {
6094 oldRef.value = null;
6095 }
6096 }
6097 if (isFunction(ref)) {
6098 callWithErrorHandling(ref, owner, 12, [value, refs]);
6099 } else {
6100 const _isString = isString(ref);
6101 const _isRef = isRef(ref);
6102 if (_isString || _isRef) {
6103 const doSet = () => {
6104 if (rawRef.f) {
6105 const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
6106 if (isUnmount) {
6107 isArray(existing) && remove(existing, refValue);
6108 } else {
6109 if (!isArray(existing)) {
6110 if (_isString) {
6111 refs[ref] = [refValue];
6112 if (hasOwn(setupState, ref)) {
6113 setupState[ref] = refs[ref];
6114 }
6115 } else {
6116 ref.value = [refValue];
6117 if (rawRef.k)
6118 refs[rawRef.k] = ref.value;
6119 }
6120 } else if (!existing.includes(refValue)) {
6121 existing.push(refValue);
6122 }
6123 }
6124 } else if (_isString) {
6125 refs[ref] = value;
6126 if (hasOwn(setupState, ref)) {
6127 setupState[ref] = value;
6128 }
6129 } else if (_isRef) {
6130 ref.value = value;
6131 if (rawRef.k)
6132 refs[rawRef.k] = value;
6133 } else {
6134 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6135 }
6136 };
6137 if (value) {
6138 doSet.id = -1;
6139 queuePostRenderEffect(doSet, parentSuspense);
6140 } else {
6141 doSet();
6142 }
6143 } else {
6144 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6145 }
6146 }
6147 }
6148
6149 let hasMismatch = false;
6150 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
6151 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
6152 const getContainerType = (container) => {
6153 if (isSVGContainer(container))
6154 return "svg";
6155 if (isMathMLContainer(container))
6156 return "mathml";
6157 return void 0;
6158 };
6159 const isComment = (node) => node.nodeType === 8 /* COMMENT */;
6160 function createHydrationFunctions(rendererInternals) {
6161 const {
6162 mt: mountComponent,
6163 p: patch,
6164 o: {
6165 patchProp,
6166 createText,
6167 nextSibling,
6168 parentNode,
6169 remove,
6170 insert,
6171 createComment
6172 }
6173 } = rendererInternals;
6174 const hydrate = (vnode, container) => {
6175 if (!container.hasChildNodes()) {
6176 warn$1(
6177 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
6178 );
6179 patch(null, vnode, container);
6180 flushPostFlushCbs();
6181 container._vnode = vnode;
6182 return;
6183 }
6184 hasMismatch = false;
6185 hydrateNode(container.firstChild, vnode, null, null, null);
6186 flushPostFlushCbs();
6187 container._vnode = vnode;
6188 if (hasMismatch && true) {
6189 console.error(`Hydration completed but contains mismatches.`);
6190 }
6191 };
6192 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6193 optimized = optimized || !!vnode.dynamicChildren;
6194 const isFragmentStart = isComment(node) && node.data === "[";
6195 const onMismatch = () => handleMismatch(
6196 node,
6197 vnode,
6198 parentComponent,
6199 parentSuspense,
6200 slotScopeIds,
6201 isFragmentStart
6202 );
6203 const { type, ref, shapeFlag, patchFlag } = vnode;
6204 let domType = node.nodeType;
6205 vnode.el = node;
6206 {
6207 if (!("__vnode" in node)) {
6208 Object.defineProperty(node, "__vnode", {
6209 value: vnode,
6210 enumerable: false
6211 });
6212 }
6213 if (!("__vueParentComponent" in node)) {
6214 Object.defineProperty(node, "__vueParentComponent", {
6215 value: parentComponent,
6216 enumerable: false
6217 });
6218 }
6219 }
6220 if (patchFlag === -2) {
6221 optimized = false;
6222 vnode.dynamicChildren = null;
6223 }
6224 let nextNode = null;
6225 switch (type) {
6226 case Text:
6227 if (domType !== 3 /* TEXT */) {
6228 if (vnode.children === "") {
6229 insert(vnode.el = createText(""), parentNode(node), node);
6230 nextNode = node;
6231 } else {
6232 nextNode = onMismatch();
6233 }
6234 } else {
6235 if (node.data !== vnode.children) {
6236 hasMismatch = true;
6237 warn$1(
6238 `Hydration text mismatch in`,
6239 node.parentNode,
6240 `
6241 - rendered on server: ${JSON.stringify(
6242 node.data
6243 )}
6244 - expected on client: ${JSON.stringify(vnode.children)}`
6245 );
6246 node.data = vnode.children;
6247 }
6248 nextNode = nextSibling(node);
6249 }
6250 break;
6251 case Comment:
6252 if (isTemplateNode(node)) {
6253 nextNode = nextSibling(node);
6254 replaceNode(
6255 vnode.el = node.content.firstChild,
6256 node,
6257 parentComponent
6258 );
6259 } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6260 nextNode = onMismatch();
6261 } else {
6262 nextNode = nextSibling(node);
6263 }
6264 break;
6265 case Static:
6266 if (isFragmentStart) {
6267 node = nextSibling(node);
6268 domType = node.nodeType;
6269 }
6270 if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
6271 nextNode = node;
6272 const needToAdoptContent = !vnode.children.length;
6273 for (let i = 0; i < vnode.staticCount; i++) {
6274 if (needToAdoptContent)
6275 vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
6276 if (i === vnode.staticCount - 1) {
6277 vnode.anchor = nextNode;
6278 }
6279 nextNode = nextSibling(nextNode);
6280 }
6281 return isFragmentStart ? nextSibling(nextNode) : nextNode;
6282 } else {
6283 onMismatch();
6284 }
6285 break;
6286 case Fragment:
6287 if (!isFragmentStart) {
6288 nextNode = onMismatch();
6289 } else {
6290 nextNode = hydrateFragment(
6291 node,
6292 vnode,
6293 parentComponent,
6294 parentSuspense,
6295 slotScopeIds,
6296 optimized
6297 );
6298 }
6299 break;
6300 default:
6301 if (shapeFlag & 1) {
6302 if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6303 nextNode = onMismatch();
6304 } else {
6305 nextNode = hydrateElement(
6306 node,
6307 vnode,
6308 parentComponent,
6309 parentSuspense,
6310 slotScopeIds,
6311 optimized
6312 );
6313 }
6314 } else if (shapeFlag & 6) {
6315 vnode.slotScopeIds = slotScopeIds;
6316 const container = parentNode(node);
6317 if (isFragmentStart) {
6318 nextNode = locateClosingAnchor(node);
6319 } else if (isComment(node) && node.data === "teleport start") {
6320 nextNode = locateClosingAnchor(node, node.data, "teleport end");
6321 } else {
6322 nextNode = nextSibling(node);
6323 }
6324 mountComponent(
6325 vnode,
6326 container,
6327 null,
6328 parentComponent,
6329 parentSuspense,
6330 getContainerType(container),
6331 optimized
6332 );
6333 if (isAsyncWrapper(vnode)) {
6334 let subTree;
6335 if (isFragmentStart) {
6336 subTree = createVNode(Fragment);
6337 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
6338 } else {
6339 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
6340 }
6341 subTree.el = node;
6342 vnode.component.subTree = subTree;
6343 }
6344 } else if (shapeFlag & 64) {
6345 if (domType !== 8 /* COMMENT */) {
6346 nextNode = onMismatch();
6347 } else {
6348 nextNode = vnode.type.hydrate(
6349 node,
6350 vnode,
6351 parentComponent,
6352 parentSuspense,
6353 slotScopeIds,
6354 optimized,
6355 rendererInternals,
6356 hydrateChildren
6357 );
6358 }
6359 } else if (shapeFlag & 128) {
6360 nextNode = vnode.type.hydrate(
6361 node,
6362 vnode,
6363 parentComponent,
6364 parentSuspense,
6365 getContainerType(parentNode(node)),
6366 slotScopeIds,
6367 optimized,
6368 rendererInternals,
6369 hydrateNode
6370 );
6371 } else {
6372 warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
6373 }
6374 }
6375 if (ref != null) {
6376 setRef(ref, null, parentSuspense, vnode);
6377 }
6378 return nextNode;
6379 };
6380 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6381 optimized = optimized || !!vnode.dynamicChildren;
6382 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6383 const forcePatch = type === "input" || type === "option";
6384 {
6385 if (dirs) {
6386 invokeDirectiveHook(vnode, null, parentComponent, "created");
6387 }
6388 let needCallTransitionHooks = false;
6389 if (isTemplateNode(el)) {
6390 needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6391 const content = el.content.firstChild;
6392 if (needCallTransitionHooks) {
6393 transition.beforeEnter(content);
6394 }
6395 replaceNode(content, el, parentComponent);
6396 vnode.el = el = content;
6397 }
6398 if (shapeFlag & 16 && // skip if element has innerHTML / textContent
6399 !(props && (props.innerHTML || props.textContent))) {
6400 let next = hydrateChildren(
6401 el.firstChild,
6402 vnode,
6403 el,
6404 parentComponent,
6405 parentSuspense,
6406 slotScopeIds,
6407 optimized
6408 );
6409 let hasWarned = false;
6410 while (next) {
6411 hasMismatch = true;
6412 if (!hasWarned) {
6413 warn$1(
6414 `Hydration children mismatch on`,
6415 el,
6416 `
6417Server rendered element contains more child nodes than client vdom.`
6418 );
6419 hasWarned = true;
6420 }
6421 const cur = next;
6422 next = next.nextSibling;
6423 remove(cur);
6424 }
6425 } else if (shapeFlag & 8) {
6426 if (el.textContent !== vnode.children) {
6427 hasMismatch = true;
6428 warn$1(
6429 `Hydration text content mismatch on`,
6430 el,
6431 `
6432 - rendered on server: ${el.textContent}
6433 - expected on client: ${vnode.children}`
6434 );
6435 el.textContent = vnode.children;
6436 }
6437 }
6438 if (props) {
6439 {
6440 for (const key in props) {
6441 if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
6442 hasMismatch = true;
6443 }
6444 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6445 key[0] === ".") {
6446 patchProp(
6447 el,
6448 key,
6449 null,
6450 props[key],
6451 void 0,
6452 void 0,
6453 parentComponent
6454 );
6455 }
6456 }
6457 }
6458 }
6459 let vnodeHooks;
6460 if (vnodeHooks = props && props.onVnodeBeforeMount) {
6461 invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6462 }
6463 if (dirs) {
6464 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6465 }
6466 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6467 queueEffectWithSuspense(() => {
6468 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6469 needCallTransitionHooks && transition.enter(el);
6470 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6471 }, parentSuspense);
6472 }
6473 }
6474 return el.nextSibling;
6475 };
6476 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6477 optimized = optimized || !!parentVNode.dynamicChildren;
6478 const children = parentVNode.children;
6479 const l = children.length;
6480 let hasWarned = false;
6481 for (let i = 0; i < l; i++) {
6482 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
6483 if (node) {
6484 node = hydrateNode(
6485 node,
6486 vnode,
6487 parentComponent,
6488 parentSuspense,
6489 slotScopeIds,
6490 optimized
6491 );
6492 } else if (vnode.type === Text && !vnode.children) {
6493 continue;
6494 } else {
6495 hasMismatch = true;
6496 if (!hasWarned) {
6497 warn$1(
6498 `Hydration children mismatch on`,
6499 container,
6500 `
6501Server rendered element contains fewer child nodes than client vdom.`
6502 );
6503 hasWarned = true;
6504 }
6505 patch(
6506 null,
6507 vnode,
6508 container,
6509 null,
6510 parentComponent,
6511 parentSuspense,
6512 getContainerType(container),
6513 slotScopeIds
6514 );
6515 }
6516 }
6517 return node;
6518 };
6519 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6520 const { slotScopeIds: fragmentSlotScopeIds } = vnode;
6521 if (fragmentSlotScopeIds) {
6522 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
6523 }
6524 const container = parentNode(node);
6525 const next = hydrateChildren(
6526 nextSibling(node),
6527 vnode,
6528 container,
6529 parentComponent,
6530 parentSuspense,
6531 slotScopeIds,
6532 optimized
6533 );
6534 if (next && isComment(next) && next.data === "]") {
6535 return nextSibling(vnode.anchor = next);
6536 } else {
6537 hasMismatch = true;
6538 insert(vnode.anchor = createComment(`]`), container, next);
6539 return next;
6540 }
6541 };
6542 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
6543 hasMismatch = true;
6544 warn$1(
6545 `Hydration node mismatch:
6546- rendered on server:`,
6547 node,
6548 node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
6549 `
6550- expected on client:`,
6551 vnode.type
6552 );
6553 vnode.el = null;
6554 if (isFragment) {
6555 const end = locateClosingAnchor(node);
6556 while (true) {
6557 const next2 = nextSibling(node);
6558 if (next2 && next2 !== end) {
6559 remove(next2);
6560 } else {
6561 break;
6562 }
6563 }
6564 }
6565 const next = nextSibling(node);
6566 const container = parentNode(node);
6567 remove(node);
6568 patch(
6569 null,
6570 vnode,
6571 container,
6572 next,
6573 parentComponent,
6574 parentSuspense,
6575 getContainerType(container),
6576 slotScopeIds
6577 );
6578 return next;
6579 };
6580 const locateClosingAnchor = (node, open = "[", close = "]") => {
6581 let match = 0;
6582 while (node) {
6583 node = nextSibling(node);
6584 if (node && isComment(node)) {
6585 if (node.data === open)
6586 match++;
6587 if (node.data === close) {
6588 if (match === 0) {
6589 return nextSibling(node);
6590 } else {
6591 match--;
6592 }
6593 }
6594 }
6595 }
6596 return node;
6597 };
6598 const replaceNode = (newNode, oldNode, parentComponent) => {
6599 const parentNode2 = oldNode.parentNode;
6600 if (parentNode2) {
6601 parentNode2.replaceChild(newNode, oldNode);
6602 }
6603 let parent = parentComponent;
6604 while (parent) {
6605 if (parent.vnode.el === oldNode) {
6606 parent.vnode.el = parent.subTree.el = newNode;
6607 }
6608 parent = parent.parent;
6609 }
6610 };
6611 const isTemplateNode = (node) => {
6612 return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6613 };
6614 return [hydrate, hydrateNode];
6615 }
6616 function propHasMismatch(el, key, clientValue, vnode, instance) {
6617 var _a;
6618 let mismatchType;
6619 let mismatchKey;
6620 let actual;
6621 let expected;
6622 if (key === "class") {
6623 actual = el.getAttribute("class");
6624 expected = normalizeClass(clientValue);
6625 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6626 mismatchType = mismatchKey = `class`;
6627 }
6628 } else if (key === "style") {
6629 actual = el.getAttribute("style") || "";
6630 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6631 const actualMap = toStyleMap(actual);
6632 const expectedMap = toStyleMap(expected);
6633 if (vnode.dirs) {
6634 for (const { dir, value } of vnode.dirs) {
6635 if (dir.name === "show" && !value) {
6636 expectedMap.set("display", "none");
6637 }
6638 }
6639 }
6640 const root = instance == null ? void 0 : instance.subTree;
6641 if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
6642 const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
6643 for (const key2 in cssVars) {
6644 expectedMap.set(`--${key2}`, String(cssVars[key2]));
6645 }
6646 }
6647 if (!isMapEqual(actualMap, expectedMap)) {
6648 mismatchType = mismatchKey = "style";
6649 }
6650 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6651 if (isBooleanAttr(key)) {
6652 actual = el.hasAttribute(key);
6653 expected = includeBooleanAttr(clientValue);
6654 } else if (clientValue == null) {
6655 actual = el.hasAttribute(key);
6656 expected = false;
6657 } else {
6658 if (el.hasAttribute(key)) {
6659 actual = el.getAttribute(key);
6660 } else if (key === "value" && el.tagName === "TEXTAREA") {
6661 actual = el.value;
6662 } else {
6663 actual = false;
6664 }
6665 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
6666 }
6667 if (actual !== expected) {
6668 mismatchType = `attribute`;
6669 mismatchKey = key;
6670 }
6671 }
6672 if (mismatchType) {
6673 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6674 const preSegment = `Hydration ${mismatchType} mismatch on`;
6675 const postSegment = `
6676 - rendered on server: ${format(actual)}
6677 - expected on client: ${format(expected)}
6678 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6679 You should fix the source of the mismatch.`;
6680 {
6681 warn$1(preSegment, el, postSegment);
6682 }
6683 return true;
6684 }
6685 return false;
6686 }
6687 function toClassSet(str) {
6688 return new Set(str.trim().split(/\s+/));
6689 }
6690 function isSetEqual(a, b) {
6691 if (a.size !== b.size) {
6692 return false;
6693 }
6694 for (const s of a) {
6695 if (!b.has(s)) {
6696 return false;
6697 }
6698 }
6699 return true;
6700 }
6701 function toStyleMap(str) {
6702 const styleMap = /* @__PURE__ */ new Map();
6703 for (const item of str.split(";")) {
6704 let [key, value] = item.split(":");
6705 key = key == null ? void 0 : key.trim();
6706 value = value == null ? void 0 : value.trim();
6707 if (key && value) {
6708 styleMap.set(key, value);
6709 }
6710 }
6711 return styleMap;
6712 }
6713 function isMapEqual(a, b) {
6714 if (a.size !== b.size) {
6715 return false;
6716 }
6717 for (const [key, value] of a) {
6718 if (value !== b.get(key)) {
6719 return false;
6720 }
6721 }
6722 return true;
6723 }
6724
6725 let supported;
6726 let perf;
6727 function startMeasure(instance, type) {
6728 if (instance.appContext.config.performance && isSupported()) {
6729 perf.mark(`vue-${type}-${instance.uid}`);
6730 }
6731 {
6732 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6733 }
6734 }
6735 function endMeasure(instance, type) {
6736 if (instance.appContext.config.performance && isSupported()) {
6737 const startTag = `vue-${type}-${instance.uid}`;
6738 const endTag = startTag + `:end`;
6739 perf.mark(endTag);
6740 perf.measure(
6741 `<${formatComponentName(instance, instance.type)}> ${type}`,
6742 startTag,
6743 endTag
6744 );
6745 perf.clearMarks(startTag);
6746 perf.clearMarks(endTag);
6747 }
6748 {
6749 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6750 }
6751 }
6752 function isSupported() {
6753 if (supported !== void 0) {
6754 return supported;
6755 }
6756 if (typeof window !== "undefined" && window.performance) {
6757 supported = true;
6758 perf = window.performance;
6759 } else {
6760 supported = false;
6761 }
6762 return supported;
6763 }
6764
6765 const queuePostRenderEffect = queueEffectWithSuspense ;
6766 function createRenderer(options) {
6767 return baseCreateRenderer(options);
6768 }
6769 function createHydrationRenderer(options) {
6770 return baseCreateRenderer(options, createHydrationFunctions);
6771 }
6772 function baseCreateRenderer(options, createHydrationFns) {
6773 const target = getGlobalThis();
6774 target.__VUE__ = true;
6775 {
6776 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6777 }
6778 const {
6779 insert: hostInsert,
6780 remove: hostRemove,
6781 patchProp: hostPatchProp,
6782 createElement: hostCreateElement,
6783 createText: hostCreateText,
6784 createComment: hostCreateComment,
6785 setText: hostSetText,
6786 setElementText: hostSetElementText,
6787 parentNode: hostParentNode,
6788 nextSibling: hostNextSibling,
6789 setScopeId: hostSetScopeId = NOOP,
6790 insertStaticContent: hostInsertStaticContent
6791 } = options;
6792 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
6793 if (n1 === n2) {
6794 return;
6795 }
6796 if (n1 && !isSameVNodeType(n1, n2)) {
6797 anchor = getNextHostNode(n1);
6798 unmount(n1, parentComponent, parentSuspense, true);
6799 n1 = null;
6800 }
6801 if (n2.patchFlag === -2) {
6802 optimized = false;
6803 n2.dynamicChildren = null;
6804 }
6805 const { type, ref, shapeFlag } = n2;
6806 switch (type) {
6807 case Text:
6808 processText(n1, n2, container, anchor);
6809 break;
6810 case Comment:
6811 processCommentNode(n1, n2, container, anchor);
6812 break;
6813 case Static:
6814 if (n1 == null) {
6815 mountStaticNode(n2, container, anchor, namespace);
6816 } else {
6817 patchStaticNode(n1, n2, container, namespace);
6818 }
6819 break;
6820 case Fragment:
6821 processFragment(
6822 n1,
6823 n2,
6824 container,
6825 anchor,
6826 parentComponent,
6827 parentSuspense,
6828 namespace,
6829 slotScopeIds,
6830 optimized
6831 );
6832 break;
6833 default:
6834 if (shapeFlag & 1) {
6835 processElement(
6836 n1,
6837 n2,
6838 container,
6839 anchor,
6840 parentComponent,
6841 parentSuspense,
6842 namespace,
6843 slotScopeIds,
6844 optimized
6845 );
6846 } else if (shapeFlag & 6) {
6847 processComponent(
6848 n1,
6849 n2,
6850 container,
6851 anchor,
6852 parentComponent,
6853 parentSuspense,
6854 namespace,
6855 slotScopeIds,
6856 optimized
6857 );
6858 } else if (shapeFlag & 64) {
6859 type.process(
6860 n1,
6861 n2,
6862 container,
6863 anchor,
6864 parentComponent,
6865 parentSuspense,
6866 namespace,
6867 slotScopeIds,
6868 optimized,
6869 internals
6870 );
6871 } else if (shapeFlag & 128) {
6872 type.process(
6873 n1,
6874 n2,
6875 container,
6876 anchor,
6877 parentComponent,
6878 parentSuspense,
6879 namespace,
6880 slotScopeIds,
6881 optimized,
6882 internals
6883 );
6884 } else {
6885 warn$1("Invalid VNode type:", type, `(${typeof type})`);
6886 }
6887 }
6888 if (ref != null && parentComponent) {
6889 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6890 }
6891 };
6892 const processText = (n1, n2, container, anchor) => {
6893 if (n1 == null) {
6894 hostInsert(
6895 n2.el = hostCreateText(n2.children),
6896 container,
6897 anchor
6898 );
6899 } else {
6900 const el = n2.el = n1.el;
6901 if (n2.children !== n1.children) {
6902 hostSetText(el, n2.children);
6903 }
6904 }
6905 };
6906 const processCommentNode = (n1, n2, container, anchor) => {
6907 if (n1 == null) {
6908 hostInsert(
6909 n2.el = hostCreateComment(n2.children || ""),
6910 container,
6911 anchor
6912 );
6913 } else {
6914 n2.el = n1.el;
6915 }
6916 };
6917 const mountStaticNode = (n2, container, anchor, namespace) => {
6918 [n2.el, n2.anchor] = hostInsertStaticContent(
6919 n2.children,
6920 container,
6921 anchor,
6922 namespace,
6923 n2.el,
6924 n2.anchor
6925 );
6926 };
6927 const patchStaticNode = (n1, n2, container, namespace) => {
6928 if (n2.children !== n1.children) {
6929 const anchor = hostNextSibling(n1.anchor);
6930 removeStaticNode(n1);
6931 [n2.el, n2.anchor] = hostInsertStaticContent(
6932 n2.children,
6933 container,
6934 anchor,
6935 namespace
6936 );
6937 } else {
6938 n2.el = n1.el;
6939 n2.anchor = n1.anchor;
6940 }
6941 };
6942 const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
6943 let next;
6944 while (el && el !== anchor) {
6945 next = hostNextSibling(el);
6946 hostInsert(el, container, nextSibling);
6947 el = next;
6948 }
6949 hostInsert(anchor, container, nextSibling);
6950 };
6951 const removeStaticNode = ({ el, anchor }) => {
6952 let next;
6953 while (el && el !== anchor) {
6954 next = hostNextSibling(el);
6955 hostRemove(el);
6956 el = next;
6957 }
6958 hostRemove(anchor);
6959 };
6960 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6961 if (n2.type === "svg") {
6962 namespace = "svg";
6963 } else if (n2.type === "math") {
6964 namespace = "mathml";
6965 }
6966 if (n1 == null) {
6967 mountElement(
6968 n2,
6969 container,
6970 anchor,
6971 parentComponent,
6972 parentSuspense,
6973 namespace,
6974 slotScopeIds,
6975 optimized
6976 );
6977 } else {
6978 patchElement(
6979 n1,
6980 n2,
6981 parentComponent,
6982 parentSuspense,
6983 namespace,
6984 slotScopeIds,
6985 optimized
6986 );
6987 }
6988 };
6989 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6990 let el;
6991 let vnodeHook;
6992 const { props, shapeFlag, transition, dirs } = vnode;
6993 el = vnode.el = hostCreateElement(
6994 vnode.type,
6995 namespace,
6996 props && props.is,
6997 props
6998 );
6999 if (shapeFlag & 8) {
7000 hostSetElementText(el, vnode.children);
7001 } else if (shapeFlag & 16) {
7002 mountChildren(
7003 vnode.children,
7004 el,
7005 null,
7006 parentComponent,
7007 parentSuspense,
7008 resolveChildrenNamespace(vnode, namespace),
7009 slotScopeIds,
7010 optimized
7011 );
7012 }
7013 if (dirs) {
7014 invokeDirectiveHook(vnode, null, parentComponent, "created");
7015 }
7016 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
7017 if (props) {
7018 for (const key in props) {
7019 if (key !== "value" && !isReservedProp(key)) {
7020 hostPatchProp(
7021 el,
7022 key,
7023 null,
7024 props[key],
7025 namespace,
7026 vnode.children,
7027 parentComponent,
7028 parentSuspense,
7029 unmountChildren
7030 );
7031 }
7032 }
7033 if ("value" in props) {
7034 hostPatchProp(el, "value", null, props.value, namespace);
7035 }
7036 if (vnodeHook = props.onVnodeBeforeMount) {
7037 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7038 }
7039 }
7040 {
7041 Object.defineProperty(el, "__vnode", {
7042 value: vnode,
7043 enumerable: false
7044 });
7045 Object.defineProperty(el, "__vueParentComponent", {
7046 value: parentComponent,
7047 enumerable: false
7048 });
7049 }
7050 if (dirs) {
7051 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7052 }
7053 const needCallTransitionHooks = needTransition(parentSuspense, transition);
7054 if (needCallTransitionHooks) {
7055 transition.beforeEnter(el);
7056 }
7057 hostInsert(el, container, anchor);
7058 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7059 queuePostRenderEffect(() => {
7060 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7061 needCallTransitionHooks && transition.enter(el);
7062 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7063 }, parentSuspense);
7064 }
7065 };
7066 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
7067 if (scopeId) {
7068 hostSetScopeId(el, scopeId);
7069 }
7070 if (slotScopeIds) {
7071 for (let i = 0; i < slotScopeIds.length; i++) {
7072 hostSetScopeId(el, slotScopeIds[i]);
7073 }
7074 }
7075 if (parentComponent) {
7076 let subTree = parentComponent.subTree;
7077 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7078 subTree = filterSingleRoot(subTree.children) || subTree;
7079 }
7080 if (vnode === subTree) {
7081 const parentVNode = parentComponent.vnode;
7082 setScopeId(
7083 el,
7084 parentVNode,
7085 parentVNode.scopeId,
7086 parentVNode.slotScopeIds,
7087 parentComponent.parent
7088 );
7089 }
7090 }
7091 };
7092 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
7093 for (let i = start; i < children.length; i++) {
7094 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
7095 patch(
7096 null,
7097 child,
7098 container,
7099 anchor,
7100 parentComponent,
7101 parentSuspense,
7102 namespace,
7103 slotScopeIds,
7104 optimized
7105 );
7106 }
7107 };
7108 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7109 const el = n2.el = n1.el;
7110 let { patchFlag, dynamicChildren, dirs } = n2;
7111 patchFlag |= n1.patchFlag & 16;
7112 const oldProps = n1.props || EMPTY_OBJ;
7113 const newProps = n2.props || EMPTY_OBJ;
7114 let vnodeHook;
7115 parentComponent && toggleRecurse(parentComponent, false);
7116 if (vnodeHook = newProps.onVnodeBeforeUpdate) {
7117 invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7118 }
7119 if (dirs) {
7120 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7121 }
7122 parentComponent && toggleRecurse(parentComponent, true);
7123 if (isHmrUpdating) {
7124 patchFlag = 0;
7125 optimized = false;
7126 dynamicChildren = null;
7127 }
7128 if (dynamicChildren) {
7129 patchBlockChildren(
7130 n1.dynamicChildren,
7131 dynamicChildren,
7132 el,
7133 parentComponent,
7134 parentSuspense,
7135 resolveChildrenNamespace(n2, namespace),
7136 slotScopeIds
7137 );
7138 {
7139 traverseStaticChildren(n1, n2);
7140 }
7141 } else if (!optimized) {
7142 patchChildren(
7143 n1,
7144 n2,
7145 el,
7146 null,
7147 parentComponent,
7148 parentSuspense,
7149 resolveChildrenNamespace(n2, namespace),
7150 slotScopeIds,
7151 false
7152 );
7153 }
7154 if (patchFlag > 0) {
7155 if (patchFlag & 16) {
7156 patchProps(
7157 el,
7158 n2,
7159 oldProps,
7160 newProps,
7161 parentComponent,
7162 parentSuspense,
7163 namespace
7164 );
7165 } else {
7166 if (patchFlag & 2) {
7167 if (oldProps.class !== newProps.class) {
7168 hostPatchProp(el, "class", null, newProps.class, namespace);
7169 }
7170 }
7171 if (patchFlag & 4) {
7172 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
7173 }
7174 if (patchFlag & 8) {
7175 const propsToUpdate = n2.dynamicProps;
7176 for (let i = 0; i < propsToUpdate.length; i++) {
7177 const key = propsToUpdate[i];
7178 const prev = oldProps[key];
7179 const next = newProps[key];
7180 if (next !== prev || key === "value") {
7181 hostPatchProp(
7182 el,
7183 key,
7184 prev,
7185 next,
7186 namespace,
7187 n1.children,
7188 parentComponent,
7189 parentSuspense,
7190 unmountChildren
7191 );
7192 }
7193 }
7194 }
7195 }
7196 if (patchFlag & 1) {
7197 if (n1.children !== n2.children) {
7198 hostSetElementText(el, n2.children);
7199 }
7200 }
7201 } else if (!optimized && dynamicChildren == null) {
7202 patchProps(
7203 el,
7204 n2,
7205 oldProps,
7206 newProps,
7207 parentComponent,
7208 parentSuspense,
7209 namespace
7210 );
7211 }
7212 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7213 queuePostRenderEffect(() => {
7214 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7215 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7216 }, parentSuspense);
7217 }
7218 };
7219 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
7220 for (let i = 0; i < newChildren.length; i++) {
7221 const oldVNode = oldChildren[i];
7222 const newVNode = newChildren[i];
7223 const container = (
7224 // oldVNode may be an errored async setup() component inside Suspense
7225 // which will not have a mounted element
7226 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
7227 // of the Fragment itself so it can move its children.
7228 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
7229 // which also requires the correct parent container
7230 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
7231 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
7232 // In other cases, the parent container is not actually used so we
7233 // just pass the block element here to avoid a DOM parentNode call.
7234 fallbackContainer
7235 )
7236 );
7237 patch(
7238 oldVNode,
7239 newVNode,
7240 container,
7241 null,
7242 parentComponent,
7243 parentSuspense,
7244 namespace,
7245 slotScopeIds,
7246 true
7247 );
7248 }
7249 };
7250 const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
7251 if (oldProps !== newProps) {
7252 if (oldProps !== EMPTY_OBJ) {
7253 for (const key in oldProps) {
7254 if (!isReservedProp(key) && !(key in newProps)) {
7255 hostPatchProp(
7256 el,
7257 key,
7258 oldProps[key],
7259 null,
7260 namespace,
7261 vnode.children,
7262 parentComponent,
7263 parentSuspense,
7264 unmountChildren
7265 );
7266 }
7267 }
7268 }
7269 for (const key in newProps) {
7270 if (isReservedProp(key))
7271 continue;
7272 const next = newProps[key];
7273 const prev = oldProps[key];
7274 if (next !== prev && key !== "value") {
7275 hostPatchProp(
7276 el,
7277 key,
7278 prev,
7279 next,
7280 namespace,
7281 vnode.children,
7282 parentComponent,
7283 parentSuspense,
7284 unmountChildren
7285 );
7286 }
7287 }
7288 if ("value" in newProps) {
7289 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
7290 }
7291 }
7292 };
7293 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7294 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
7295 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
7296 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
7297 if (
7298 // #5523 dev root fragment may inherit directives
7299 isHmrUpdating || patchFlag & 2048
7300 ) {
7301 patchFlag = 0;
7302 optimized = false;
7303 dynamicChildren = null;
7304 }
7305 if (fragmentSlotScopeIds) {
7306 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
7307 }
7308 if (n1 == null) {
7309 hostInsert(fragmentStartAnchor, container, anchor);
7310 hostInsert(fragmentEndAnchor, container, anchor);
7311 mountChildren(
7312 // #10007
7313 // such fragment like `<></>` will be compiled into
7314 // a fragment which doesn't have a children.
7315 // In this case fallback to an empty array
7316 n2.children || [],
7317 container,
7318 fragmentEndAnchor,
7319 parentComponent,
7320 parentSuspense,
7321 namespace,
7322 slotScopeIds,
7323 optimized
7324 );
7325 } else {
7326 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
7327 // of renderSlot() with no valid children
7328 n1.dynamicChildren) {
7329 patchBlockChildren(
7330 n1.dynamicChildren,
7331 dynamicChildren,
7332 container,
7333 parentComponent,
7334 parentSuspense,
7335 namespace,
7336 slotScopeIds
7337 );
7338 {
7339 traverseStaticChildren(n1, n2);
7340 }
7341 } else {
7342 patchChildren(
7343 n1,
7344 n2,
7345 container,
7346 fragmentEndAnchor,
7347 parentComponent,
7348 parentSuspense,
7349 namespace,
7350 slotScopeIds,
7351 optimized
7352 );
7353 }
7354 }
7355 };
7356 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7357 n2.slotScopeIds = slotScopeIds;
7358 if (n1 == null) {
7359 if (n2.shapeFlag & 512) {
7360 parentComponent.ctx.activate(
7361 n2,
7362 container,
7363 anchor,
7364 namespace,
7365 optimized
7366 );
7367 } else {
7368 mountComponent(
7369 n2,
7370 container,
7371 anchor,
7372 parentComponent,
7373 parentSuspense,
7374 namespace,
7375 optimized
7376 );
7377 }
7378 } else {
7379 updateComponent(n1, n2, optimized);
7380 }
7381 };
7382 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
7383 const instance = (initialVNode.component = createComponentInstance(
7384 initialVNode,
7385 parentComponent,
7386 parentSuspense
7387 ));
7388 if (instance.type.__hmrId) {
7389 registerHMR(instance);
7390 }
7391 {
7392 pushWarningContext(initialVNode);
7393 startMeasure(instance, `mount`);
7394 }
7395 if (isKeepAlive(initialVNode)) {
7396 instance.ctx.renderer = internals;
7397 }
7398 {
7399 {
7400 startMeasure(instance, `init`);
7401 }
7402 setupComponent(instance);
7403 {
7404 endMeasure(instance, `init`);
7405 }
7406 }
7407 if (instance.asyncDep) {
7408 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
7409 if (!initialVNode.el) {
7410 const placeholder = instance.subTree = createVNode(Comment);
7411 processCommentNode(null, placeholder, container, anchor);
7412 }
7413 } else {
7414 setupRenderEffect(
7415 instance,
7416 initialVNode,
7417 container,
7418 anchor,
7419 parentSuspense,
7420 namespace,
7421 optimized
7422 );
7423 }
7424 {
7425 popWarningContext();
7426 endMeasure(instance, `mount`);
7427 }
7428 };
7429 const updateComponent = (n1, n2, optimized) => {
7430 const instance = n2.component = n1.component;
7431 if (shouldUpdateComponent(n1, n2, optimized)) {
7432 if (instance.asyncDep && !instance.asyncResolved) {
7433 {
7434 pushWarningContext(n2);
7435 }
7436 updateComponentPreRender(instance, n2, optimized);
7437 {
7438 popWarningContext();
7439 }
7440 return;
7441 } else {
7442 instance.next = n2;
7443 invalidateJob(instance.update);
7444 instance.effect.dirty = true;
7445 instance.update();
7446 }
7447 } else {
7448 n2.el = n1.el;
7449 instance.vnode = n2;
7450 }
7451 };
7452 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7453 const componentUpdateFn = () => {
7454 if (!instance.isMounted) {
7455 let vnodeHook;
7456 const { el, props } = initialVNode;
7457 const { bm, m, parent } = instance;
7458 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
7459 toggleRecurse(instance, false);
7460 if (bm) {
7461 invokeArrayFns(bm);
7462 }
7463 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
7464 invokeVNodeHook(vnodeHook, parent, initialVNode);
7465 }
7466 toggleRecurse(instance, true);
7467 if (el && hydrateNode) {
7468 const hydrateSubTree = () => {
7469 {
7470 startMeasure(instance, `render`);
7471 }
7472 instance.subTree = renderComponentRoot(instance);
7473 {
7474 endMeasure(instance, `render`);
7475 }
7476 {
7477 startMeasure(instance, `hydrate`);
7478 }
7479 hydrateNode(
7480 el,
7481 instance.subTree,
7482 instance,
7483 parentSuspense,
7484 null
7485 );
7486 {
7487 endMeasure(instance, `hydrate`);
7488 }
7489 };
7490 if (isAsyncWrapperVNode) {
7491 initialVNode.type.__asyncLoader().then(
7492 // note: we are moving the render call into an async callback,
7493 // which means it won't track dependencies - but it's ok because
7494 // a server-rendered async wrapper is already in resolved state
7495 // and it will never need to change.
7496 () => !instance.isUnmounted && hydrateSubTree()
7497 );
7498 } else {
7499 hydrateSubTree();
7500 }
7501 } else {
7502 {
7503 startMeasure(instance, `render`);
7504 }
7505 const subTree = instance.subTree = renderComponentRoot(instance);
7506 {
7507 endMeasure(instance, `render`);
7508 }
7509 {
7510 startMeasure(instance, `patch`);
7511 }
7512 patch(
7513 null,
7514 subTree,
7515 container,
7516 anchor,
7517 instance,
7518 parentSuspense,
7519 namespace
7520 );
7521 {
7522 endMeasure(instance, `patch`);
7523 }
7524 initialVNode.el = subTree.el;
7525 }
7526 if (m) {
7527 queuePostRenderEffect(m, parentSuspense);
7528 }
7529 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7530 const scopedInitialVNode = initialVNode;
7531 queuePostRenderEffect(
7532 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7533 parentSuspense
7534 );
7535 }
7536 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7537 instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7538 }
7539 instance.isMounted = true;
7540 {
7541 devtoolsComponentAdded(instance);
7542 }
7543 initialVNode = container = anchor = null;
7544 } else {
7545 let { next, bu, u, parent, vnode } = instance;
7546 {
7547 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
7548 if (nonHydratedAsyncRoot) {
7549 if (next) {
7550 next.el = vnode.el;
7551 updateComponentPreRender(instance, next, optimized);
7552 }
7553 nonHydratedAsyncRoot.asyncDep.then(() => {
7554 if (!instance.isUnmounted) {
7555 componentUpdateFn();
7556 }
7557 });
7558 return;
7559 }
7560 }
7561 let originNext = next;
7562 let vnodeHook;
7563 {
7564 pushWarningContext(next || instance.vnode);
7565 }
7566 toggleRecurse(instance, false);
7567 if (next) {
7568 next.el = vnode.el;
7569 updateComponentPreRender(instance, next, optimized);
7570 } else {
7571 next = vnode;
7572 }
7573 if (bu) {
7574 invokeArrayFns(bu);
7575 }
7576 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
7577 invokeVNodeHook(vnodeHook, parent, next, vnode);
7578 }
7579 toggleRecurse(instance, true);
7580 {
7581 startMeasure(instance, `render`);
7582 }
7583 const nextTree = renderComponentRoot(instance);
7584 {
7585 endMeasure(instance, `render`);
7586 }
7587 const prevTree = instance.subTree;
7588 instance.subTree = nextTree;
7589 {
7590 startMeasure(instance, `patch`);
7591 }
7592 patch(
7593 prevTree,
7594 nextTree,
7595 // parent may have changed if it's in a teleport
7596 hostParentNode(prevTree.el),
7597 // anchor may have changed if it's in a fragment
7598 getNextHostNode(prevTree),
7599 instance,
7600 parentSuspense,
7601 namespace
7602 );
7603 {
7604 endMeasure(instance, `patch`);
7605 }
7606 next.el = nextTree.el;
7607 if (originNext === null) {
7608 updateHOCHostEl(instance, nextTree.el);
7609 }
7610 if (u) {
7611 queuePostRenderEffect(u, parentSuspense);
7612 }
7613 if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7614 queuePostRenderEffect(
7615 () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7616 parentSuspense
7617 );
7618 }
7619 {
7620 devtoolsComponentUpdated(instance);
7621 }
7622 {
7623 popWarningContext();
7624 }
7625 }
7626 };
7627 const effect = instance.effect = new ReactiveEffect(
7628 componentUpdateFn,
7629 NOOP,
7630 () => queueJob(update),
7631 instance.scope
7632 // track it in component's effect scope
7633 );
7634 const update = instance.update = () => {
7635 if (effect.dirty) {
7636 effect.run();
7637 }
7638 };
7639 update.id = instance.uid;
7640 toggleRecurse(instance, true);
7641 {
7642 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7643 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7644 update.ownerInstance = instance;
7645 }
7646 update();
7647 };
7648 const updateComponentPreRender = (instance, nextVNode, optimized) => {
7649 nextVNode.component = instance;
7650 const prevProps = instance.vnode.props;
7651 instance.vnode = nextVNode;
7652 instance.next = null;
7653 updateProps(instance, nextVNode.props, prevProps, optimized);
7654 updateSlots(instance, nextVNode.children, optimized);
7655 pauseTracking();
7656 flushPreFlushCbs(instance);
7657 resetTracking();
7658 };
7659 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7660 const c1 = n1 && n1.children;
7661 const prevShapeFlag = n1 ? n1.shapeFlag : 0;
7662 const c2 = n2.children;
7663 const { patchFlag, shapeFlag } = n2;
7664 if (patchFlag > 0) {
7665 if (patchFlag & 128) {
7666 patchKeyedChildren(
7667 c1,
7668 c2,
7669 container,
7670 anchor,
7671 parentComponent,
7672 parentSuspense,
7673 namespace,
7674 slotScopeIds,
7675 optimized
7676 );
7677 return;
7678 } else if (patchFlag & 256) {
7679 patchUnkeyedChildren(
7680 c1,
7681 c2,
7682 container,
7683 anchor,
7684 parentComponent,
7685 parentSuspense,
7686 namespace,
7687 slotScopeIds,
7688 optimized
7689 );
7690 return;
7691 }
7692 }
7693 if (shapeFlag & 8) {
7694 if (prevShapeFlag & 16) {
7695 unmountChildren(c1, parentComponent, parentSuspense);
7696 }
7697 if (c2 !== c1) {
7698 hostSetElementText(container, c2);
7699 }
7700 } else {
7701 if (prevShapeFlag & 16) {
7702 if (shapeFlag & 16) {
7703 patchKeyedChildren(
7704 c1,
7705 c2,
7706 container,
7707 anchor,
7708 parentComponent,
7709 parentSuspense,
7710 namespace,
7711 slotScopeIds,
7712 optimized
7713 );
7714 } else {
7715 unmountChildren(c1, parentComponent, parentSuspense, true);
7716 }
7717 } else {
7718 if (prevShapeFlag & 8) {
7719 hostSetElementText(container, "");
7720 }
7721 if (shapeFlag & 16) {
7722 mountChildren(
7723 c2,
7724 container,
7725 anchor,
7726 parentComponent,
7727 parentSuspense,
7728 namespace,
7729 slotScopeIds,
7730 optimized
7731 );
7732 }
7733 }
7734 }
7735 };
7736 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7737 c1 = c1 || EMPTY_ARR;
7738 c2 = c2 || EMPTY_ARR;
7739 const oldLength = c1.length;
7740 const newLength = c2.length;
7741 const commonLength = Math.min(oldLength, newLength);
7742 let i;
7743 for (i = 0; i < commonLength; i++) {
7744 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7745 patch(
7746 c1[i],
7747 nextChild,
7748 container,
7749 null,
7750 parentComponent,
7751 parentSuspense,
7752 namespace,
7753 slotScopeIds,
7754 optimized
7755 );
7756 }
7757 if (oldLength > newLength) {
7758 unmountChildren(
7759 c1,
7760 parentComponent,
7761 parentSuspense,
7762 true,
7763 false,
7764 commonLength
7765 );
7766 } else {
7767 mountChildren(
7768 c2,
7769 container,
7770 anchor,
7771 parentComponent,
7772 parentSuspense,
7773 namespace,
7774 slotScopeIds,
7775 optimized,
7776 commonLength
7777 );
7778 }
7779 };
7780 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7781 let i = 0;
7782 const l2 = c2.length;
7783 let e1 = c1.length - 1;
7784 let e2 = l2 - 1;
7785 while (i <= e1 && i <= e2) {
7786 const n1 = c1[i];
7787 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7788 if (isSameVNodeType(n1, n2)) {
7789 patch(
7790 n1,
7791 n2,
7792 container,
7793 null,
7794 parentComponent,
7795 parentSuspense,
7796 namespace,
7797 slotScopeIds,
7798 optimized
7799 );
7800 } else {
7801 break;
7802 }
7803 i++;
7804 }
7805 while (i <= e1 && i <= e2) {
7806 const n1 = c1[e1];
7807 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
7808 if (isSameVNodeType(n1, n2)) {
7809 patch(
7810 n1,
7811 n2,
7812 container,
7813 null,
7814 parentComponent,
7815 parentSuspense,
7816 namespace,
7817 slotScopeIds,
7818 optimized
7819 );
7820 } else {
7821 break;
7822 }
7823 e1--;
7824 e2--;
7825 }
7826 if (i > e1) {
7827 if (i <= e2) {
7828 const nextPos = e2 + 1;
7829 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
7830 while (i <= e2) {
7831 patch(
7832 null,
7833 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
7834 container,
7835 anchor,
7836 parentComponent,
7837 parentSuspense,
7838 namespace,
7839 slotScopeIds,
7840 optimized
7841 );
7842 i++;
7843 }
7844 }
7845 } else if (i > e2) {
7846 while (i <= e1) {
7847 unmount(c1[i], parentComponent, parentSuspense, true);
7848 i++;
7849 }
7850 } else {
7851 const s1 = i;
7852 const s2 = i;
7853 const keyToNewIndexMap = /* @__PURE__ */ new Map();
7854 for (i = s2; i <= e2; i++) {
7855 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7856 if (nextChild.key != null) {
7857 if (keyToNewIndexMap.has(nextChild.key)) {
7858 warn$1(
7859 `Duplicate keys found during update:`,
7860 JSON.stringify(nextChild.key),
7861 `Make sure keys are unique.`
7862 );
7863 }
7864 keyToNewIndexMap.set(nextChild.key, i);
7865 }
7866 }
7867 let j;
7868 let patched = 0;
7869 const toBePatched = e2 - s2 + 1;
7870 let moved = false;
7871 let maxNewIndexSoFar = 0;
7872 const newIndexToOldIndexMap = new Array(toBePatched);
7873 for (i = 0; i < toBePatched; i++)
7874 newIndexToOldIndexMap[i] = 0;
7875 for (i = s1; i <= e1; i++) {
7876 const prevChild = c1[i];
7877 if (patched >= toBePatched) {
7878 unmount(prevChild, parentComponent, parentSuspense, true);
7879 continue;
7880 }
7881 let newIndex;
7882 if (prevChild.key != null) {
7883 newIndex = keyToNewIndexMap.get(prevChild.key);
7884 } else {
7885 for (j = s2; j <= e2; j++) {
7886 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
7887 newIndex = j;
7888 break;
7889 }
7890 }
7891 }
7892 if (newIndex === void 0) {
7893 unmount(prevChild, parentComponent, parentSuspense, true);
7894 } else {
7895 newIndexToOldIndexMap[newIndex - s2] = i + 1;
7896 if (newIndex >= maxNewIndexSoFar) {
7897 maxNewIndexSoFar = newIndex;
7898 } else {
7899 moved = true;
7900 }
7901 patch(
7902 prevChild,
7903 c2[newIndex],
7904 container,
7905 null,
7906 parentComponent,
7907 parentSuspense,
7908 namespace,
7909 slotScopeIds,
7910 optimized
7911 );
7912 patched++;
7913 }
7914 }
7915 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
7916 j = increasingNewIndexSequence.length - 1;
7917 for (i = toBePatched - 1; i >= 0; i--) {
7918 const nextIndex = s2 + i;
7919 const nextChild = c2[nextIndex];
7920 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7921 if (newIndexToOldIndexMap[i] === 0) {
7922 patch(
7923 null,
7924 nextChild,
7925 container,
7926 anchor,
7927 parentComponent,
7928 parentSuspense,
7929 namespace,
7930 slotScopeIds,
7931 optimized
7932 );
7933 } else if (moved) {
7934 if (j < 0 || i !== increasingNewIndexSequence[j]) {
7935 move(nextChild, container, anchor, 2);
7936 } else {
7937 j--;
7938 }
7939 }
7940 }
7941 }
7942 };
7943 const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
7944 const { el, type, transition, children, shapeFlag } = vnode;
7945 if (shapeFlag & 6) {
7946 move(vnode.component.subTree, container, anchor, moveType);
7947 return;
7948 }
7949 if (shapeFlag & 128) {
7950 vnode.suspense.move(container, anchor, moveType);
7951 return;
7952 }
7953 if (shapeFlag & 64) {
7954 type.move(vnode, container, anchor, internals);
7955 return;
7956 }
7957 if (type === Fragment) {
7958 hostInsert(el, container, anchor);
7959 for (let i = 0; i < children.length; i++) {
7960 move(children[i], container, anchor, moveType);
7961 }
7962 hostInsert(vnode.anchor, container, anchor);
7963 return;
7964 }
7965 if (type === Static) {
7966 moveStaticNode(vnode, container, anchor);
7967 return;
7968 }
7969 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7970 if (needTransition2) {
7971 if (moveType === 0) {
7972 transition.beforeEnter(el);
7973 hostInsert(el, container, anchor);
7974 queuePostRenderEffect(() => transition.enter(el), parentSuspense);
7975 } else {
7976 const { leave, delayLeave, afterLeave } = transition;
7977 const remove2 = () => hostInsert(el, container, anchor);
7978 const performLeave = () => {
7979 leave(el, () => {
7980 remove2();
7981 afterLeave && afterLeave();
7982 });
7983 };
7984 if (delayLeave) {
7985 delayLeave(el, remove2, performLeave);
7986 } else {
7987 performLeave();
7988 }
7989 }
7990 } else {
7991 hostInsert(el, container, anchor);
7992 }
7993 };
7994 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
7995 const {
7996 type,
7997 props,
7998 ref,
7999 children,
8000 dynamicChildren,
8001 shapeFlag,
8002 patchFlag,
8003 dirs
8004 } = vnode;
8005 if (ref != null) {
8006 setRef(ref, null, parentSuspense, vnode, true);
8007 }
8008 if (shapeFlag & 256) {
8009 parentComponent.ctx.deactivate(vnode);
8010 return;
8011 }
8012 const shouldInvokeDirs = shapeFlag & 1 && dirs;
8013 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
8014 let vnodeHook;
8015 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
8016 invokeVNodeHook(vnodeHook, parentComponent, vnode);
8017 }
8018 if (shapeFlag & 6) {
8019 unmountComponent(vnode.component, parentSuspense, doRemove);
8020 } else {
8021 if (shapeFlag & 128) {
8022 vnode.suspense.unmount(parentSuspense, doRemove);
8023 return;
8024 }
8025 if (shouldInvokeDirs) {
8026 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
8027 }
8028 if (shapeFlag & 64) {
8029 vnode.type.remove(
8030 vnode,
8031 parentComponent,
8032 parentSuspense,
8033 optimized,
8034 internals,
8035 doRemove
8036 );
8037 } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
8038 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
8039 unmountChildren(
8040 dynamicChildren,
8041 parentComponent,
8042 parentSuspense,
8043 false,
8044 true
8045 );
8046 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
8047 unmountChildren(children, parentComponent, parentSuspense);
8048 }
8049 if (doRemove) {
8050 remove(vnode);
8051 }
8052 }
8053 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
8054 queuePostRenderEffect(() => {
8055 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8056 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8057 }, parentSuspense);
8058 }
8059 };
8060 const remove = (vnode) => {
8061 const { type, el, anchor, transition } = vnode;
8062 if (type === Fragment) {
8063 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
8064 vnode.children.forEach((child) => {
8065 if (child.type === Comment) {
8066 hostRemove(child.el);
8067 } else {
8068 remove(child);
8069 }
8070 });
8071 } else {
8072 removeFragment(el, anchor);
8073 }
8074 return;
8075 }
8076 if (type === Static) {
8077 removeStaticNode(vnode);
8078 return;
8079 }
8080 const performRemove = () => {
8081 hostRemove(el);
8082 if (transition && !transition.persisted && transition.afterLeave) {
8083 transition.afterLeave();
8084 }
8085 };
8086 if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8087 const { leave, delayLeave } = transition;
8088 const performLeave = () => leave(el, performRemove);
8089 if (delayLeave) {
8090 delayLeave(vnode.el, performRemove, performLeave);
8091 } else {
8092 performLeave();
8093 }
8094 } else {
8095 performRemove();
8096 }
8097 };
8098 const removeFragment = (cur, end) => {
8099 let next;
8100 while (cur !== end) {
8101 next = hostNextSibling(cur);
8102 hostRemove(cur);
8103 cur = next;
8104 }
8105 hostRemove(end);
8106 };
8107 const unmountComponent = (instance, parentSuspense, doRemove) => {
8108 if (instance.type.__hmrId) {
8109 unregisterHMR(instance);
8110 }
8111 const { bum, scope, update, subTree, um } = instance;
8112 if (bum) {
8113 invokeArrayFns(bum);
8114 }
8115 scope.stop();
8116 if (update) {
8117 update.active = false;
8118 unmount(subTree, instance, parentSuspense, doRemove);
8119 }
8120 if (um) {
8121 queuePostRenderEffect(um, parentSuspense);
8122 }
8123 queuePostRenderEffect(() => {
8124 instance.isUnmounted = true;
8125 }, parentSuspense);
8126 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8127 parentSuspense.deps--;
8128 if (parentSuspense.deps === 0) {
8129 parentSuspense.resolve();
8130 }
8131 }
8132 {
8133 devtoolsComponentRemoved(instance);
8134 }
8135 };
8136 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8137 for (let i = start; i < children.length; i++) {
8138 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
8139 }
8140 };
8141 const getNextHostNode = (vnode) => {
8142 if (vnode.shapeFlag & 6) {
8143 return getNextHostNode(vnode.component.subTree);
8144 }
8145 if (vnode.shapeFlag & 128) {
8146 return vnode.suspense.next();
8147 }
8148 return hostNextSibling(vnode.anchor || vnode.el);
8149 };
8150 let isFlushing = false;
8151 const render = (vnode, container, namespace) => {
8152 if (vnode == null) {
8153 if (container._vnode) {
8154 unmount(container._vnode, null, null, true);
8155 }
8156 } else {
8157 patch(
8158 container._vnode || null,
8159 vnode,
8160 container,
8161 null,
8162 null,
8163 null,
8164 namespace
8165 );
8166 }
8167 if (!isFlushing) {
8168 isFlushing = true;
8169 flushPreFlushCbs();
8170 flushPostFlushCbs();
8171 isFlushing = false;
8172 }
8173 container._vnode = vnode;
8174 };
8175 const internals = {
8176 p: patch,
8177 um: unmount,
8178 m: move,
8179 r: remove,
8180 mt: mountComponent,
8181 mc: mountChildren,
8182 pc: patchChildren,
8183 pbc: patchBlockChildren,
8184 n: getNextHostNode,
8185 o: options
8186 };
8187 let hydrate;
8188 let hydrateNode;
8189 if (createHydrationFns) {
8190 [hydrate, hydrateNode] = createHydrationFns(
8191 internals
8192 );
8193 }
8194 return {
8195 render,
8196 hydrate,
8197 createApp: createAppAPI(render, hydrate)
8198 };
8199 }
8200 function resolveChildrenNamespace({ type, props }, currentNamespace) {
8201 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8202 }
8203 function toggleRecurse({ effect, update }, allowed) {
8204 effect.allowRecurse = update.allowRecurse = allowed;
8205 }
8206 function needTransition(parentSuspense, transition) {
8207 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8208 }
8209 function traverseStaticChildren(n1, n2, shallow = false) {
8210 const ch1 = n1.children;
8211 const ch2 = n2.children;
8212 if (isArray(ch1) && isArray(ch2)) {
8213 for (let i = 0; i < ch1.length; i++) {
8214 const c1 = ch1[i];
8215 let c2 = ch2[i];
8216 if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
8217 if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
8218 c2 = ch2[i] = cloneIfMounted(ch2[i]);
8219 c2.el = c1.el;
8220 }
8221 if (!shallow)
8222 traverseStaticChildren(c1, c2);
8223 }
8224 if (c2.type === Text) {
8225 c2.el = c1.el;
8226 }
8227 if (c2.type === Comment && !c2.el) {
8228 c2.el = c1.el;
8229 }
8230 }
8231 }
8232 }
8233 function getSequence(arr) {
8234 const p = arr.slice();
8235 const result = [0];
8236 let i, j, u, v, c;
8237 const len = arr.length;
8238 for (i = 0; i < len; i++) {
8239 const arrI = arr[i];
8240 if (arrI !== 0) {
8241 j = result[result.length - 1];
8242 if (arr[j] < arrI) {
8243 p[i] = j;
8244 result.push(i);
8245 continue;
8246 }
8247 u = 0;
8248 v = result.length - 1;
8249 while (u < v) {
8250 c = u + v >> 1;
8251 if (arr[result[c]] < arrI) {
8252 u = c + 1;
8253 } else {
8254 v = c;
8255 }
8256 }
8257 if (arrI < arr[result[u]]) {
8258 if (u > 0) {
8259 p[i] = result[u - 1];
8260 }
8261 result[u] = i;
8262 }
8263 }
8264 }
8265 u = result.length;
8266 v = result[u - 1];
8267 while (u-- > 0) {
8268 result[u] = v;
8269 v = p[v];
8270 }
8271 return result;
8272 }
8273 function locateNonHydratedAsyncRoot(instance) {
8274 const subComponent = instance.subTree.component;
8275 if (subComponent) {
8276 if (subComponent.asyncDep && !subComponent.asyncResolved) {
8277 return subComponent;
8278 } else {
8279 return locateNonHydratedAsyncRoot(subComponent);
8280 }
8281 }
8282 }
8283
8284 const isTeleport = (type) => type.__isTeleport;
8285 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
8286 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
8287 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
8288 const resolveTarget = (props, select) => {
8289 const targetSelector = props && props.to;
8290 if (isString(targetSelector)) {
8291 if (!select) {
8292 warn$1(
8293 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
8294 );
8295 return null;
8296 } else {
8297 const target = select(targetSelector);
8298 if (!target) {
8299 warn$1(
8300 `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
8301 );
8302 }
8303 return target;
8304 }
8305 } else {
8306 if (!targetSelector && !isTeleportDisabled(props)) {
8307 warn$1(`Invalid Teleport target: ${targetSelector}`);
8308 }
8309 return targetSelector;
8310 }
8311 };
8312 const TeleportImpl = {
8313 name: "Teleport",
8314 __isTeleport: true,
8315 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
8316 const {
8317 mc: mountChildren,
8318 pc: patchChildren,
8319 pbc: patchBlockChildren,
8320 o: { insert, querySelector, createText, createComment }
8321 } = internals;
8322 const disabled = isTeleportDisabled(n2.props);
8323 let { shapeFlag, children, dynamicChildren } = n2;
8324 if (isHmrUpdating) {
8325 optimized = false;
8326 dynamicChildren = null;
8327 }
8328 if (n1 == null) {
8329 const placeholder = n2.el = createComment("teleport start") ;
8330 const mainAnchor = n2.anchor = createComment("teleport end") ;
8331 insert(placeholder, container, anchor);
8332 insert(mainAnchor, container, anchor);
8333 const target = n2.target = resolveTarget(n2.props, querySelector);
8334 const targetAnchor = n2.targetAnchor = createText("");
8335 if (target) {
8336 insert(targetAnchor, target);
8337 if (namespace === "svg" || isTargetSVG(target)) {
8338 namespace = "svg";
8339 } else if (namespace === "mathml" || isTargetMathML(target)) {
8340 namespace = "mathml";
8341 }
8342 } else if (!disabled) {
8343 warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
8344 }
8345 const mount = (container2, anchor2) => {
8346 if (shapeFlag & 16) {
8347 mountChildren(
8348 children,
8349 container2,
8350 anchor2,
8351 parentComponent,
8352 parentSuspense,
8353 namespace,
8354 slotScopeIds,
8355 optimized
8356 );
8357 }
8358 };
8359 if (disabled) {
8360 mount(container, mainAnchor);
8361 } else if (target) {
8362 mount(target, targetAnchor);
8363 }
8364 } else {
8365 n2.el = n1.el;
8366 const mainAnchor = n2.anchor = n1.anchor;
8367 const target = n2.target = n1.target;
8368 const targetAnchor = n2.targetAnchor = n1.targetAnchor;
8369 const wasDisabled = isTeleportDisabled(n1.props);
8370 const currentContainer = wasDisabled ? container : target;
8371 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
8372 if (namespace === "svg" || isTargetSVG(target)) {
8373 namespace = "svg";
8374 } else if (namespace === "mathml" || isTargetMathML(target)) {
8375 namespace = "mathml";
8376 }
8377 if (dynamicChildren) {
8378 patchBlockChildren(
8379 n1.dynamicChildren,
8380 dynamicChildren,
8381 currentContainer,
8382 parentComponent,
8383 parentSuspense,
8384 namespace,
8385 slotScopeIds
8386 );
8387 traverseStaticChildren(n1, n2, true);
8388 } else if (!optimized) {
8389 patchChildren(
8390 n1,
8391 n2,
8392 currentContainer,
8393 currentAnchor,
8394 parentComponent,
8395 parentSuspense,
8396 namespace,
8397 slotScopeIds,
8398 false
8399 );
8400 }
8401 if (disabled) {
8402 if (!wasDisabled) {
8403 moveTeleport(
8404 n2,
8405 container,
8406 mainAnchor,
8407 internals,
8408 1
8409 );
8410 } else {
8411 if (n2.props && n1.props && n2.props.to !== n1.props.to) {
8412 n2.props.to = n1.props.to;
8413 }
8414 }
8415 } else {
8416 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
8417 const nextTarget = n2.target = resolveTarget(
8418 n2.props,
8419 querySelector
8420 );
8421 if (nextTarget) {
8422 moveTeleport(
8423 n2,
8424 nextTarget,
8425 null,
8426 internals,
8427 0
8428 );
8429 } else {
8430 warn$1(
8431 "Invalid Teleport target on update:",
8432 target,
8433 `(${typeof target})`
8434 );
8435 }
8436 } else if (wasDisabled) {
8437 moveTeleport(
8438 n2,
8439 target,
8440 targetAnchor,
8441 internals,
8442 1
8443 );
8444 }
8445 }
8446 }
8447 updateCssVars(n2);
8448 },
8449 remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8450 const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8451 if (target) {
8452 hostRemove(targetAnchor);
8453 }
8454 doRemove && hostRemove(anchor);
8455 if (shapeFlag & 16) {
8456 const shouldRemove = doRemove || !isTeleportDisabled(props);
8457 for (let i = 0; i < children.length; i++) {
8458 const child = children[i];
8459 unmount(
8460 child,
8461 parentComponent,
8462 parentSuspense,
8463 shouldRemove,
8464 !!child.dynamicChildren
8465 );
8466 }
8467 }
8468 },
8469 move: moveTeleport,
8470 hydrate: hydrateTeleport
8471 };
8472 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
8473 if (moveType === 0) {
8474 insert(vnode.targetAnchor, container, parentAnchor);
8475 }
8476 const { el, anchor, shapeFlag, children, props } = vnode;
8477 const isReorder = moveType === 2;
8478 if (isReorder) {
8479 insert(el, container, parentAnchor);
8480 }
8481 if (!isReorder || isTeleportDisabled(props)) {
8482 if (shapeFlag & 16) {
8483 for (let i = 0; i < children.length; i++) {
8484 move(
8485 children[i],
8486 container,
8487 parentAnchor,
8488 2
8489 );
8490 }
8491 }
8492 }
8493 if (isReorder) {
8494 insert(anchor, container, parentAnchor);
8495 }
8496 }
8497 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
8498 o: { nextSibling, parentNode, querySelector }
8499 }, hydrateChildren) {
8500 const target = vnode.target = resolveTarget(
8501 vnode.props,
8502 querySelector
8503 );
8504 if (target) {
8505 const targetNode = target._lpa || target.firstChild;
8506 if (vnode.shapeFlag & 16) {
8507 if (isTeleportDisabled(vnode.props)) {
8508 vnode.anchor = hydrateChildren(
8509 nextSibling(node),
8510 vnode,
8511 parentNode(node),
8512 parentComponent,
8513 parentSuspense,
8514 slotScopeIds,
8515 optimized
8516 );
8517 vnode.targetAnchor = targetNode;
8518 } else {
8519 vnode.anchor = nextSibling(node);
8520 let targetAnchor = targetNode;
8521 while (targetAnchor) {
8522 targetAnchor = nextSibling(targetAnchor);
8523 if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
8524 vnode.targetAnchor = targetAnchor;
8525 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
8526 break;
8527 }
8528 }
8529 hydrateChildren(
8530 targetNode,
8531 vnode,
8532 target,
8533 parentComponent,
8534 parentSuspense,
8535 slotScopeIds,
8536 optimized
8537 );
8538 }
8539 }
8540 updateCssVars(vnode);
8541 }
8542 return vnode.anchor && nextSibling(vnode.anchor);
8543 }
8544 const Teleport = TeleportImpl;
8545 function updateCssVars(vnode) {
8546 const ctx = vnode.ctx;
8547 if (ctx && ctx.ut) {
8548 let node = vnode.children[0].el;
8549 while (node && node !== vnode.targetAnchor) {
8550 if (node.nodeType === 1)
8551 node.setAttribute("data-v-owner", ctx.uid);
8552 node = node.nextSibling;
8553 }
8554 ctx.ut();
8555 }
8556 }
8557
8558 const Fragment = Symbol.for("v-fgt");
8559 const Text = Symbol.for("v-txt");
8560 const Comment = Symbol.for("v-cmt");
8561 const Static = Symbol.for("v-stc");
8562 const blockStack = [];
8563 let currentBlock = null;
8564 function openBlock(disableTracking = false) {
8565 blockStack.push(currentBlock = disableTracking ? null : []);
8566 }
8567 function closeBlock() {
8568 blockStack.pop();
8569 currentBlock = blockStack[blockStack.length - 1] || null;
8570 }
8571 let isBlockTreeEnabled = 1;
8572 function setBlockTracking(value) {
8573 isBlockTreeEnabled += value;
8574 }
8575 function setupBlock(vnode) {
8576 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
8577 closeBlock();
8578 if (isBlockTreeEnabled > 0 && currentBlock) {
8579 currentBlock.push(vnode);
8580 }
8581 return vnode;
8582 }
8583 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
8584 return setupBlock(
8585 createBaseVNode(
8586 type,
8587 props,
8588 children,
8589 patchFlag,
8590 dynamicProps,
8591 shapeFlag,
8592 true
8593 )
8594 );
8595 }
8596 function createBlock(type, props, children, patchFlag, dynamicProps) {
8597 return setupBlock(
8598 createVNode(
8599 type,
8600 props,
8601 children,
8602 patchFlag,
8603 dynamicProps,
8604 true
8605 )
8606 );
8607 }
8608 function isVNode(value) {
8609 return value ? value.__v_isVNode === true : false;
8610 }
8611 function isSameVNodeType(n1, n2) {
8612 if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
8613 n1.shapeFlag &= ~256;
8614 n2.shapeFlag &= ~512;
8615 return false;
8616 }
8617 return n1.type === n2.type && n1.key === n2.key;
8618 }
8619 let vnodeArgsTransformer;
8620 function transformVNodeArgs(transformer) {
8621 vnodeArgsTransformer = transformer;
8622 }
8623 const createVNodeWithArgsTransform = (...args) => {
8624 return _createVNode(
8625 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8626 );
8627 };
8628 const normalizeKey = ({ key }) => key != null ? key : null;
8629 const normalizeRef = ({
8630 ref,
8631 ref_key,
8632 ref_for
8633 }) => {
8634 if (typeof ref === "number") {
8635 ref = "" + ref;
8636 }
8637 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
8638 };
8639 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
8640 const vnode = {
8641 __v_isVNode: true,
8642 __v_skip: true,
8643 type,
8644 props,
8645 key: props && normalizeKey(props),
8646 ref: props && normalizeRef(props),
8647 scopeId: currentScopeId,
8648 slotScopeIds: null,
8649 children,
8650 component: null,
8651 suspense: null,
8652 ssContent: null,
8653 ssFallback: null,
8654 dirs: null,
8655 transition: null,
8656 el: null,
8657 anchor: null,
8658 target: null,
8659 targetAnchor: null,
8660 staticCount: 0,
8661 shapeFlag,
8662 patchFlag,
8663 dynamicProps,
8664 dynamicChildren: null,
8665 appContext: null,
8666 ctx: currentRenderingInstance
8667 };
8668 if (needFullChildrenNormalization) {
8669 normalizeChildren(vnode, children);
8670 if (shapeFlag & 128) {
8671 type.normalize(vnode);
8672 }
8673 } else if (children) {
8674 vnode.shapeFlag |= isString(children) ? 8 : 16;
8675 }
8676 if (vnode.key !== vnode.key) {
8677 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
8678 }
8679 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
8680 !isBlockNode && // has current parent block
8681 currentBlock && // presence of a patch flag indicates this node needs patching on updates.
8682 // component nodes also should always be patched, because even if the
8683 // component doesn't need to update, it needs to persist the instance on to
8684 // the next vnode so that it can be properly unmounted later.
8685 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
8686 // vnode should not be considered dynamic due to handler caching.
8687 vnode.patchFlag !== 32) {
8688 currentBlock.push(vnode);
8689 }
8690 return vnode;
8691 }
8692 const createVNode = createVNodeWithArgsTransform ;
8693 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
8694 if (!type || type === NULL_DYNAMIC_COMPONENT) {
8695 if (!type) {
8696 warn$1(`Invalid vnode type when creating vnode: ${type}.`);
8697 }
8698 type = Comment;
8699 }
8700 if (isVNode(type)) {
8701 const cloned = cloneVNode(
8702 type,
8703 props,
8704 true
8705 /* mergeRef: true */
8706 );
8707 if (children) {
8708 normalizeChildren(cloned, children);
8709 }
8710 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
8711 if (cloned.shapeFlag & 6) {
8712 currentBlock[currentBlock.indexOf(type)] = cloned;
8713 } else {
8714 currentBlock.push(cloned);
8715 }
8716 }
8717 cloned.patchFlag |= -2;
8718 return cloned;
8719 }
8720 if (isClassComponent(type)) {
8721 type = type.__vccOpts;
8722 }
8723 if (props) {
8724 props = guardReactiveProps(props);
8725 let { class: klass, style } = props;
8726 if (klass && !isString(klass)) {
8727 props.class = normalizeClass(klass);
8728 }
8729 if (isObject(style)) {
8730 if (isProxy(style) && !isArray(style)) {
8731 style = extend({}, style);
8732 }
8733 props.style = normalizeStyle(style);
8734 }
8735 }
8736 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
8737 if (shapeFlag & 4 && isProxy(type)) {
8738 type = toRaw(type);
8739 warn$1(
8740 `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
8741 `
8742Component that was made reactive: `,
8743 type
8744 );
8745 }
8746 return createBaseVNode(
8747 type,
8748 props,
8749 children,
8750 patchFlag,
8751 dynamicProps,
8752 shapeFlag,
8753 isBlockNode,
8754 true
8755 );
8756 }
8757 function guardReactiveProps(props) {
8758 if (!props)
8759 return null;
8760 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
8761 }
8762 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
8763 const { props, ref, patchFlag, children, transition } = vnode;
8764 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
8765 const cloned = {
8766 __v_isVNode: true,
8767 __v_skip: true,
8768 type: vnode.type,
8769 props: mergedProps,
8770 key: mergedProps && normalizeKey(mergedProps),
8771 ref: extraProps && extraProps.ref ? (
8772 // #2078 in the case of <component :is="vnode" ref="extra"/>
8773 // if the vnode itself already has a ref, cloneVNode will need to merge
8774 // the refs so the single vnode can be set on multiple refs
8775 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
8776 ) : ref,
8777 scopeId: vnode.scopeId,
8778 slotScopeIds: vnode.slotScopeIds,
8779 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
8780 target: vnode.target,
8781 targetAnchor: vnode.targetAnchor,
8782 staticCount: vnode.staticCount,
8783 shapeFlag: vnode.shapeFlag,
8784 // if the vnode is cloned with extra props, we can no longer assume its
8785 // existing patch flag to be reliable and need to add the FULL_PROPS flag.
8786 // note: preserve flag for fragments since they use the flag for children
8787 // fast paths only.
8788 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
8789 dynamicProps: vnode.dynamicProps,
8790 dynamicChildren: vnode.dynamicChildren,
8791 appContext: vnode.appContext,
8792 dirs: vnode.dirs,
8793 transition,
8794 // These should technically only be non-null on mounted VNodes. However,
8795 // they *should* be copied for kept-alive vnodes. So we just always copy
8796 // them since them being non-null during a mount doesn't affect the logic as
8797 // they will simply be overwritten.
8798 component: vnode.component,
8799 suspense: vnode.suspense,
8800 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
8801 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
8802 el: vnode.el,
8803 anchor: vnode.anchor,
8804 ctx: vnode.ctx,
8805 ce: vnode.ce
8806 };
8807 if (transition && cloneTransition) {
8808 cloned.transition = transition.clone(cloned);
8809 }
8810 return cloned;
8811 }
8812 function deepCloneVNode(vnode) {
8813 const cloned = cloneVNode(vnode);
8814 if (isArray(vnode.children)) {
8815 cloned.children = vnode.children.map(deepCloneVNode);
8816 }
8817 return cloned;
8818 }
8819 function createTextVNode(text = " ", flag = 0) {
8820 return createVNode(Text, null, text, flag);
8821 }
8822 function createStaticVNode(content, numberOfNodes) {
8823 const vnode = createVNode(Static, null, content);
8824 vnode.staticCount = numberOfNodes;
8825 return vnode;
8826 }
8827 function createCommentVNode(text = "", asBlock = false) {
8828 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
8829 }
8830 function normalizeVNode(child) {
8831 if (child == null || typeof child === "boolean") {
8832 return createVNode(Comment);
8833 } else if (isArray(child)) {
8834 return createVNode(
8835 Fragment,
8836 null,
8837 // #3666, avoid reference pollution when reusing vnode
8838 child.slice()
8839 );
8840 } else if (typeof child === "object") {
8841 return cloneIfMounted(child);
8842 } else {
8843 return createVNode(Text, null, String(child));
8844 }
8845 }
8846 function cloneIfMounted(child) {
8847 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
8848 }
8849 function normalizeChildren(vnode, children) {
8850 let type = 0;
8851 const { shapeFlag } = vnode;
8852 if (children == null) {
8853 children = null;
8854 } else if (isArray(children)) {
8855 type = 16;
8856 } else if (typeof children === "object") {
8857 if (shapeFlag & (1 | 64)) {
8858 const slot = children.default;
8859 if (slot) {
8860 slot._c && (slot._d = false);
8861 normalizeChildren(vnode, slot());
8862 slot._c && (slot._d = true);
8863 }
8864 return;
8865 } else {
8866 type = 32;
8867 const slotFlag = children._;
8868 if (!slotFlag && !isInternalObject(children)) {
8869 children._ctx = currentRenderingInstance;
8870 } else if (slotFlag === 3 && currentRenderingInstance) {
8871 if (currentRenderingInstance.slots._ === 1) {
8872 children._ = 1;
8873 } else {
8874 children._ = 2;
8875 vnode.patchFlag |= 1024;
8876 }
8877 }
8878 }
8879 } else if (isFunction(children)) {
8880 children = { default: children, _ctx: currentRenderingInstance };
8881 type = 32;
8882 } else {
8883 children = String(children);
8884 if (shapeFlag & 64) {
8885 type = 16;
8886 children = [createTextVNode(children)];
8887 } else {
8888 type = 8;
8889 }
8890 }
8891 vnode.children = children;
8892 vnode.shapeFlag |= type;
8893 }
8894 function mergeProps(...args) {
8895 const ret = {};
8896 for (let i = 0; i < args.length; i++) {
8897 const toMerge = args[i];
8898 for (const key in toMerge) {
8899 if (key === "class") {
8900 if (ret.class !== toMerge.class) {
8901 ret.class = normalizeClass([ret.class, toMerge.class]);
8902 }
8903 } else if (key === "style") {
8904 ret.style = normalizeStyle([ret.style, toMerge.style]);
8905 } else if (isOn(key)) {
8906 const existing = ret[key];
8907 const incoming = toMerge[key];
8908 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
8909 ret[key] = existing ? [].concat(existing, incoming) : incoming;
8910 }
8911 } else if (key !== "") {
8912 ret[key] = toMerge[key];
8913 }
8914 }
8915 }
8916 return ret;
8917 }
8918 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8919 callWithAsyncErrorHandling(hook, instance, 7, [
8920 vnode,
8921 prevVNode
8922 ]);
8923 }
8924
8925 const emptyAppContext = createAppContext();
8926 let uid = 0;
8927 function createComponentInstance(vnode, parent, suspense) {
8928 const type = vnode.type;
8929 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
8930 const instance = {
8931 uid: uid++,
8932 vnode,
8933 type,
8934 parent,
8935 appContext,
8936 root: null,
8937 // to be immediately set
8938 next: null,
8939 subTree: null,
8940 // will be set synchronously right after creation
8941 effect: null,
8942 update: null,
8943 // will be set synchronously right after creation
8944 scope: new EffectScope(
8945 true
8946 /* detached */
8947 ),
8948 render: null,
8949 proxy: null,
8950 exposed: null,
8951 exposeProxy: null,
8952 withProxy: null,
8953 provides: parent ? parent.provides : Object.create(appContext.provides),
8954 accessCache: null,
8955 renderCache: [],
8956 // local resolved assets
8957 components: null,
8958 directives: null,
8959 // resolved props and emits options
8960 propsOptions: normalizePropsOptions(type, appContext),
8961 emitsOptions: normalizeEmitsOptions(type, appContext),
8962 // emit
8963 emit: null,
8964 // to be set immediately
8965 emitted: null,
8966 // props default value
8967 propsDefaults: EMPTY_OBJ,
8968 // inheritAttrs
8969 inheritAttrs: type.inheritAttrs,
8970 // state
8971 ctx: EMPTY_OBJ,
8972 data: EMPTY_OBJ,
8973 props: EMPTY_OBJ,
8974 attrs: EMPTY_OBJ,
8975 slots: EMPTY_OBJ,
8976 refs: EMPTY_OBJ,
8977 setupState: EMPTY_OBJ,
8978 setupContext: null,
8979 attrsProxy: null,
8980 slotsProxy: null,
8981 // suspense related
8982 suspense,
8983 suspenseId: suspense ? suspense.pendingId : 0,
8984 asyncDep: null,
8985 asyncResolved: false,
8986 // lifecycle hooks
8987 // not using enums here because it results in computed properties
8988 isMounted: false,
8989 isUnmounted: false,
8990 isDeactivated: false,
8991 bc: null,
8992 c: null,
8993 bm: null,
8994 m: null,
8995 bu: null,
8996 u: null,
8997 um: null,
8998 bum: null,
8999 da: null,
9000 a: null,
9001 rtg: null,
9002 rtc: null,
9003 ec: null,
9004 sp: null
9005 };
9006 {
9007 instance.ctx = createDevRenderContext(instance);
9008 }
9009 instance.root = parent ? parent.root : instance;
9010 instance.emit = emit.bind(null, instance);
9011 if (vnode.ce) {
9012 vnode.ce(instance);
9013 }
9014 return instance;
9015 }
9016 let currentInstance = null;
9017 const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9018 let internalSetCurrentInstance;
9019 let setInSSRSetupState;
9020 {
9021 internalSetCurrentInstance = (i) => {
9022 currentInstance = i;
9023 };
9024 setInSSRSetupState = (v) => {
9025 isInSSRComponentSetup = v;
9026 };
9027 }
9028 const setCurrentInstance = (instance) => {
9029 const prev = currentInstance;
9030 internalSetCurrentInstance(instance);
9031 instance.scope.on();
9032 return () => {
9033 instance.scope.off();
9034 internalSetCurrentInstance(prev);
9035 };
9036 };
9037 const unsetCurrentInstance = () => {
9038 currentInstance && currentInstance.scope.off();
9039 internalSetCurrentInstance(null);
9040 };
9041 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
9042 function validateComponentName(name, { isNativeTag }) {
9043 if (isBuiltInTag(name) || isNativeTag(name)) {
9044 warn$1(
9045 "Do not use built-in or reserved HTML elements as component id: " + name
9046 );
9047 }
9048 }
9049 function isStatefulComponent(instance) {
9050 return instance.vnode.shapeFlag & 4;
9051 }
9052 let isInSSRComponentSetup = false;
9053 function setupComponent(instance, isSSR = false) {
9054 isSSR && setInSSRSetupState(isSSR);
9055 const { props, children } = instance.vnode;
9056 const isStateful = isStatefulComponent(instance);
9057 initProps(instance, props, isStateful, isSSR);
9058 initSlots(instance, children);
9059 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
9060 isSSR && setInSSRSetupState(false);
9061 return setupResult;
9062 }
9063 function setupStatefulComponent(instance, isSSR) {
9064 var _a;
9065 const Component = instance.type;
9066 {
9067 if (Component.name) {
9068 validateComponentName(Component.name, instance.appContext.config);
9069 }
9070 if (Component.components) {
9071 const names = Object.keys(Component.components);
9072 for (let i = 0; i < names.length; i++) {
9073 validateComponentName(names[i], instance.appContext.config);
9074 }
9075 }
9076 if (Component.directives) {
9077 const names = Object.keys(Component.directives);
9078 for (let i = 0; i < names.length; i++) {
9079 validateDirectiveName(names[i]);
9080 }
9081 }
9082 if (Component.compilerOptions && isRuntimeOnly()) {
9083 warn$1(
9084 `"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
9085 );
9086 }
9087 }
9088 instance.accessCache = /* @__PURE__ */ Object.create(null);
9089 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9090 {
9091 exposePropsOnRenderContext(instance);
9092 }
9093 const { setup } = Component;
9094 if (setup) {
9095 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9096 const reset = setCurrentInstance(instance);
9097 pauseTracking();
9098 const setupResult = callWithErrorHandling(
9099 setup,
9100 instance,
9101 0,
9102 [
9103 shallowReadonly(instance.props) ,
9104 setupContext
9105 ]
9106 );
9107 resetTracking();
9108 reset();
9109 if (isPromise(setupResult)) {
9110 setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9111 if (isSSR) {
9112 return setupResult.then((resolvedResult) => {
9113 handleSetupResult(instance, resolvedResult, isSSR);
9114 }).catch((e) => {
9115 handleError(e, instance, 0);
9116 });
9117 } else {
9118 instance.asyncDep = setupResult;
9119 if (!instance.suspense) {
9120 const name = (_a = Component.name) != null ? _a : "Anonymous";
9121 warn$1(
9122 `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
9123 );
9124 }
9125 }
9126 } else {
9127 handleSetupResult(instance, setupResult, isSSR);
9128 }
9129 } else {
9130 finishComponentSetup(instance, isSSR);
9131 }
9132 }
9133 function handleSetupResult(instance, setupResult, isSSR) {
9134 if (isFunction(setupResult)) {
9135 {
9136 instance.render = setupResult;
9137 }
9138 } else if (isObject(setupResult)) {
9139 if (isVNode(setupResult)) {
9140 warn$1(
9141 `setup() should not return VNodes directly - return a render function instead.`
9142 );
9143 }
9144 {
9145 instance.devtoolsRawSetupState = setupResult;
9146 }
9147 instance.setupState = proxyRefs(setupResult);
9148 {
9149 exposeSetupStateOnRenderContext(instance);
9150 }
9151 } else if (setupResult !== void 0) {
9152 warn$1(
9153 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
9154 );
9155 }
9156 finishComponentSetup(instance, isSSR);
9157 }
9158 let compile$1;
9159 let installWithProxy;
9160 function registerRuntimeCompiler(_compile) {
9161 compile$1 = _compile;
9162 installWithProxy = (i) => {
9163 if (i.render._rc) {
9164 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
9165 }
9166 };
9167 }
9168 const isRuntimeOnly = () => !compile$1;
9169 function finishComponentSetup(instance, isSSR, skipOptions) {
9170 const Component = instance.type;
9171 if (!instance.render) {
9172 if (!isSSR && compile$1 && !Component.render) {
9173 const template = Component.template || resolveMergedOptions(instance).template;
9174 if (template) {
9175 {
9176 startMeasure(instance, `compile`);
9177 }
9178 const { isCustomElement, compilerOptions } = instance.appContext.config;
9179 const { delimiters, compilerOptions: componentCompilerOptions } = Component;
9180 const finalCompilerOptions = extend(
9181 extend(
9182 {
9183 isCustomElement,
9184 delimiters
9185 },
9186 compilerOptions
9187 ),
9188 componentCompilerOptions
9189 );
9190 Component.render = compile$1(template, finalCompilerOptions);
9191 {
9192 endMeasure(instance, `compile`);
9193 }
9194 }
9195 }
9196 instance.render = Component.render || NOOP;
9197 if (installWithProxy) {
9198 installWithProxy(instance);
9199 }
9200 }
9201 {
9202 const reset = setCurrentInstance(instance);
9203 pauseTracking();
9204 try {
9205 applyOptions(instance);
9206 } finally {
9207 resetTracking();
9208 reset();
9209 }
9210 }
9211 if (!Component.render && instance.render === NOOP && !isSSR) {
9212 if (!compile$1 && Component.template) {
9213 warn$1(
9214 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
9215 );
9216 } else {
9217 warn$1(`Component is missing template or render function.`);
9218 }
9219 }
9220 }
9221 const attrsProxyHandlers = {
9222 get(target, key) {
9223 markAttrsAccessed();
9224 track(target, "get", "");
9225 return target[key];
9226 },
9227 set() {
9228 warn$1(`setupContext.attrs is readonly.`);
9229 return false;
9230 },
9231 deleteProperty() {
9232 warn$1(`setupContext.attrs is readonly.`);
9233 return false;
9234 }
9235 } ;
9236 function getSlotsProxy(instance) {
9237 return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9238 get(target, key) {
9239 track(instance, "get", "$slots");
9240 return target[key];
9241 }
9242 }));
9243 }
9244 function createSetupContext(instance) {
9245 const expose = (exposed) => {
9246 {
9247 if (instance.exposed) {
9248 warn$1(`expose() should be called only once per setup().`);
9249 }
9250 if (exposed != null) {
9251 let exposedType = typeof exposed;
9252 if (exposedType === "object") {
9253 if (isArray(exposed)) {
9254 exposedType = "array";
9255 } else if (isRef(exposed)) {
9256 exposedType = "ref";
9257 }
9258 }
9259 if (exposedType !== "object") {
9260 warn$1(
9261 `expose() should be passed a plain object, received ${exposedType}.`
9262 );
9263 }
9264 }
9265 }
9266 instance.exposed = exposed || {};
9267 };
9268 {
9269 let attrsProxy;
9270 return Object.freeze({
9271 get attrs() {
9272 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9273 },
9274 get slots() {
9275 return getSlotsProxy(instance);
9276 },
9277 get emit() {
9278 return (event, ...args) => instance.emit(event, ...args);
9279 },
9280 expose
9281 });
9282 }
9283 }
9284 function getExposeProxy(instance) {
9285 if (instance.exposed) {
9286 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
9287 get(target, key) {
9288 if (key in target) {
9289 return target[key];
9290 } else if (key in publicPropertiesMap) {
9291 return publicPropertiesMap[key](instance);
9292 }
9293 },
9294 has(target, key) {
9295 return key in target || key in publicPropertiesMap;
9296 }
9297 }));
9298 }
9299 }
9300 const classifyRE = /(?:^|[-_])(\w)/g;
9301 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
9302 function getComponentName(Component, includeInferred = true) {
9303 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
9304 }
9305 function formatComponentName(instance, Component, isRoot = false) {
9306 let name = getComponentName(Component);
9307 if (!name && Component.__file) {
9308 const match = Component.__file.match(/([^/\\]+)\.\w+$/);
9309 if (match) {
9310 name = match[1];
9311 }
9312 }
9313 if (!name && instance && instance.parent) {
9314 const inferFromRegistry = (registry) => {
9315 for (const key in registry) {
9316 if (registry[key] === Component) {
9317 return key;
9318 }
9319 }
9320 };
9321 name = inferFromRegistry(
9322 instance.components || instance.parent.type.components
9323 ) || inferFromRegistry(instance.appContext.components);
9324 }
9325 return name ? classify(name) : isRoot ? `App` : `Anonymous`;
9326 }
9327 function isClassComponent(value) {
9328 return isFunction(value) && "__vccOpts" in value;
9329 }
9330
9331 const computed = (getterOrOptions, debugOptions) => {
9332 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9333 {
9334 const i = getCurrentInstance();
9335 if (i && i.appContext.config.warnRecursiveComputed) {
9336 c._warnRecursive = true;
9337 }
9338 }
9339 return c;
9340 };
9341
9342 function useModel(props, name, options = EMPTY_OBJ) {
9343 const i = getCurrentInstance();
9344 if (!i) {
9345 warn$1(`useModel() called without active instance.`);
9346 return ref();
9347 }
9348 if (!i.propsOptions[0][name]) {
9349 warn$1(`useModel() called with prop "${name}" which is not declared.`);
9350 return ref();
9351 }
9352 const camelizedName = camelize(name);
9353 const hyphenatedName = hyphenate(name);
9354 const res = customRef((track, trigger) => {
9355 let localValue;
9356 watchSyncEffect(() => {
9357 const propValue = props[name];
9358 if (hasChanged(localValue, propValue)) {
9359 localValue = propValue;
9360 trigger();
9361 }
9362 });
9363 return {
9364 get() {
9365 track();
9366 return options.get ? options.get(localValue) : localValue;
9367 },
9368 set(value) {
9369 const rawProps = i.vnode.props;
9370 if (!(rawProps && // check if parent has passed v-model
9371 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9372 localValue = value;
9373 trigger();
9374 }
9375 i.emit(`update:${name}`, options.set ? options.set(value) : value);
9376 }
9377 };
9378 });
9379 const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9380 res[Symbol.iterator] = () => {
9381 let i2 = 0;
9382 return {
9383 next() {
9384 if (i2 < 2) {
9385 return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9386 } else {
9387 return { done: true };
9388 }
9389 }
9390 };
9391 };
9392 return res;
9393 }
9394
9395 function h(type, propsOrChildren, children) {
9396 const l = arguments.length;
9397 if (l === 2) {
9398 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
9399 if (isVNode(propsOrChildren)) {
9400 return createVNode(type, null, [propsOrChildren]);
9401 }
9402 return createVNode(type, propsOrChildren);
9403 } else {
9404 return createVNode(type, null, propsOrChildren);
9405 }
9406 } else {
9407 if (l > 3) {
9408 children = Array.prototype.slice.call(arguments, 2);
9409 } else if (l === 3 && isVNode(children)) {
9410 children = [children];
9411 }
9412 return createVNode(type, propsOrChildren, children);
9413 }
9414 }
9415
9416 function initCustomFormatter() {
9417 if (typeof window === "undefined") {
9418 return;
9419 }
9420 const vueStyle = { style: "color:#3ba776" };
9421 const numberStyle = { style: "color:#1677ff" };
9422 const stringStyle = { style: "color:#f5222d" };
9423 const keywordStyle = { style: "color:#eb2f96" };
9424 const formatter = {
9425 header(obj) {
9426 if (!isObject(obj)) {
9427 return null;
9428 }
9429 if (obj.__isVue) {
9430 return ["div", vueStyle, `VueInstance`];
9431 } else if (isRef(obj)) {
9432 return [
9433 "div",
9434 {},
9435 ["span", vueStyle, genRefFlag(obj)],
9436 "<",
9437 formatValue(obj.value),
9438 `>`
9439 ];
9440 } else if (isReactive(obj)) {
9441 return [
9442 "div",
9443 {},
9444 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
9445 "<",
9446 formatValue(obj),
9447 `>${isReadonly(obj) ? ` (readonly)` : ``}`
9448 ];
9449 } else if (isReadonly(obj)) {
9450 return [
9451 "div",
9452 {},
9453 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
9454 "<",
9455 formatValue(obj),
9456 ">"
9457 ];
9458 }
9459 return null;
9460 },
9461 hasBody(obj) {
9462 return obj && obj.__isVue;
9463 },
9464 body(obj) {
9465 if (obj && obj.__isVue) {
9466 return [
9467 "div",
9468 {},
9469 ...formatInstance(obj.$)
9470 ];
9471 }
9472 }
9473 };
9474 function formatInstance(instance) {
9475 const blocks = [];
9476 if (instance.type.props && instance.props) {
9477 blocks.push(createInstanceBlock("props", toRaw(instance.props)));
9478 }
9479 if (instance.setupState !== EMPTY_OBJ) {
9480 blocks.push(createInstanceBlock("setup", instance.setupState));
9481 }
9482 if (instance.data !== EMPTY_OBJ) {
9483 blocks.push(createInstanceBlock("data", toRaw(instance.data)));
9484 }
9485 const computed = extractKeys(instance, "computed");
9486 if (computed) {
9487 blocks.push(createInstanceBlock("computed", computed));
9488 }
9489 const injected = extractKeys(instance, "inject");
9490 if (injected) {
9491 blocks.push(createInstanceBlock("injected", injected));
9492 }
9493 blocks.push([
9494 "div",
9495 {},
9496 [
9497 "span",
9498 {
9499 style: keywordStyle.style + ";opacity:0.66"
9500 },
9501 "$ (internal): "
9502 ],
9503 ["object", { object: instance }]
9504 ]);
9505 return blocks;
9506 }
9507 function createInstanceBlock(type, target) {
9508 target = extend({}, target);
9509 if (!Object.keys(target).length) {
9510 return ["span", {}];
9511 }
9512 return [
9513 "div",
9514 { style: "line-height:1.25em;margin-bottom:0.6em" },
9515 [
9516 "div",
9517 {
9518 style: "color:#476582"
9519 },
9520 type
9521 ],
9522 [
9523 "div",
9524 {
9525 style: "padding-left:1.25em"
9526 },
9527 ...Object.keys(target).map((key) => {
9528 return [
9529 "div",
9530 {},
9531 ["span", keywordStyle, key + ": "],
9532 formatValue(target[key], false)
9533 ];
9534 })
9535 ]
9536 ];
9537 }
9538 function formatValue(v, asRaw = true) {
9539 if (typeof v === "number") {
9540 return ["span", numberStyle, v];
9541 } else if (typeof v === "string") {
9542 return ["span", stringStyle, JSON.stringify(v)];
9543 } else if (typeof v === "boolean") {
9544 return ["span", keywordStyle, v];
9545 } else if (isObject(v)) {
9546 return ["object", { object: asRaw ? toRaw(v) : v }];
9547 } else {
9548 return ["span", stringStyle, String(v)];
9549 }
9550 }
9551 function extractKeys(instance, type) {
9552 const Comp = instance.type;
9553 if (isFunction(Comp)) {
9554 return;
9555 }
9556 const extracted = {};
9557 for (const key in instance.ctx) {
9558 if (isKeyOfType(Comp, key, type)) {
9559 extracted[key] = instance.ctx[key];
9560 }
9561 }
9562 return extracted;
9563 }
9564 function isKeyOfType(Comp, key, type) {
9565 const opts = Comp[type];
9566 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
9567 return true;
9568 }
9569 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
9570 return true;
9571 }
9572 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
9573 return true;
9574 }
9575 }
9576 function genRefFlag(v) {
9577 if (isShallow(v)) {
9578 return `ShallowRef`;
9579 }
9580 if (v.effect) {
9581 return `ComputedRef`;
9582 }
9583 return `Ref`;
9584 }
9585 if (window.devtoolsFormatters) {
9586 window.devtoolsFormatters.push(formatter);
9587 } else {
9588 window.devtoolsFormatters = [formatter];
9589 }
9590 }
9591
9592 function withMemo(memo, render, cache, index) {
9593 const cached = cache[index];
9594 if (cached && isMemoSame(cached, memo)) {
9595 return cached;
9596 }
9597 const ret = render();
9598 ret.memo = memo.slice();
9599 return cache[index] = ret;
9600 }
9601 function isMemoSame(cached, memo) {
9602 const prev = cached.memo;
9603 if (prev.length != memo.length) {
9604 return false;
9605 }
9606 for (let i = 0; i < prev.length; i++) {
9607 if (hasChanged(prev[i], memo[i])) {
9608 return false;
9609 }
9610 }
9611 if (isBlockTreeEnabled > 0 && currentBlock) {
9612 currentBlock.push(cached);
9613 }
9614 return true;
9615 }
9616
9617 const version = "3.4.27";
9618 const warn = warn$1 ;
9619 const ErrorTypeStrings = ErrorTypeStrings$1 ;
9620 const devtools = devtools$1 ;
9621 const setDevtoolsHook = setDevtoolsHook$1 ;
9622 const ssrUtils = null;
9623 const resolveFilter = null;
9624 const compatUtils = null;
9625 const DeprecationTypes = null;
9626
9627 const svgNS = "http://www.w3.org/2000/svg";
9628 const mathmlNS = "http://www.w3.org/1998/Math/MathML";
9629 const doc = typeof document !== "undefined" ? document : null;
9630 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
9631 const nodeOps = {
9632 insert: (child, parent, anchor) => {
9633 parent.insertBefore(child, anchor || null);
9634 },
9635 remove: (child) => {
9636 const parent = child.parentNode;
9637 if (parent) {
9638 parent.removeChild(child);
9639 }
9640 },
9641 createElement: (tag, namespace, is, props) => {
9642 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
9643 if (tag === "select" && props && props.multiple != null) {
9644 el.setAttribute("multiple", props.multiple);
9645 }
9646 return el;
9647 },
9648 createText: (text) => doc.createTextNode(text),
9649 createComment: (text) => doc.createComment(text),
9650 setText: (node, text) => {
9651 node.nodeValue = text;
9652 },
9653 setElementText: (el, text) => {
9654 el.textContent = text;
9655 },
9656 parentNode: (node) => node.parentNode,
9657 nextSibling: (node) => node.nextSibling,
9658 querySelector: (selector) => doc.querySelector(selector),
9659 setScopeId(el, id) {
9660 el.setAttribute(id, "");
9661 },
9662 // __UNSAFE__
9663 // Reason: innerHTML.
9664 // Static content here can only come from compiled templates.
9665 // As long as the user only uses trusted templates, this is safe.
9666 insertStaticContent(content, parent, anchor, namespace, start, end) {
9667 const before = anchor ? anchor.previousSibling : parent.lastChild;
9668 if (start && (start === end || start.nextSibling)) {
9669 while (true) {
9670 parent.insertBefore(start.cloneNode(true), anchor);
9671 if (start === end || !(start = start.nextSibling))
9672 break;
9673 }
9674 } else {
9675 templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
9676 const template = templateContainer.content;
9677 if (namespace === "svg" || namespace === "mathml") {
9678 const wrapper = template.firstChild;
9679 while (wrapper.firstChild) {
9680 template.appendChild(wrapper.firstChild);
9681 }
9682 template.removeChild(wrapper);
9683 }
9684 parent.insertBefore(template, anchor);
9685 }
9686 return [
9687 // first
9688 before ? before.nextSibling : parent.firstChild,
9689 // last
9690 anchor ? anchor.previousSibling : parent.lastChild
9691 ];
9692 }
9693 };
9694
9695 const TRANSITION$1 = "transition";
9696 const ANIMATION = "animation";
9697 const vtcKey = Symbol("_vtc");
9698 const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
9699 Transition.displayName = "Transition";
9700 const DOMTransitionPropsValidators = {
9701 name: String,
9702 type: String,
9703 css: {
9704 type: Boolean,
9705 default: true
9706 },
9707 duration: [String, Number, Object],
9708 enterFromClass: String,
9709 enterActiveClass: String,
9710 enterToClass: String,
9711 appearFromClass: String,
9712 appearActiveClass: String,
9713 appearToClass: String,
9714 leaveFromClass: String,
9715 leaveActiveClass: String,
9716 leaveToClass: String
9717 };
9718 const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
9719 {},
9720 BaseTransitionPropsValidators,
9721 DOMTransitionPropsValidators
9722 );
9723 const callHook = (hook, args = []) => {
9724 if (isArray(hook)) {
9725 hook.forEach((h2) => h2(...args));
9726 } else if (hook) {
9727 hook(...args);
9728 }
9729 };
9730 const hasExplicitCallback = (hook) => {
9731 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
9732 };
9733 function resolveTransitionProps(rawProps) {
9734 const baseProps = {};
9735 for (const key in rawProps) {
9736 if (!(key in DOMTransitionPropsValidators)) {
9737 baseProps[key] = rawProps[key];
9738 }
9739 }
9740 if (rawProps.css === false) {
9741 return baseProps;
9742 }
9743 const {
9744 name = "v",
9745 type,
9746 duration,
9747 enterFromClass = `${name}-enter-from`,
9748 enterActiveClass = `${name}-enter-active`,
9749 enterToClass = `${name}-enter-to`,
9750 appearFromClass = enterFromClass,
9751 appearActiveClass = enterActiveClass,
9752 appearToClass = enterToClass,
9753 leaveFromClass = `${name}-leave-from`,
9754 leaveActiveClass = `${name}-leave-active`,
9755 leaveToClass = `${name}-leave-to`
9756 } = rawProps;
9757 const durations = normalizeDuration(duration);
9758 const enterDuration = durations && durations[0];
9759 const leaveDuration = durations && durations[1];
9760 const {
9761 onBeforeEnter,
9762 onEnter,
9763 onEnterCancelled,
9764 onLeave,
9765 onLeaveCancelled,
9766 onBeforeAppear = onBeforeEnter,
9767 onAppear = onEnter,
9768 onAppearCancelled = onEnterCancelled
9769 } = baseProps;
9770 const finishEnter = (el, isAppear, done) => {
9771 removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
9772 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
9773 done && done();
9774 };
9775 const finishLeave = (el, done) => {
9776 el._isLeaving = false;
9777 removeTransitionClass(el, leaveFromClass);
9778 removeTransitionClass(el, leaveToClass);
9779 removeTransitionClass(el, leaveActiveClass);
9780 done && done();
9781 };
9782 const makeEnterHook = (isAppear) => {
9783 return (el, done) => {
9784 const hook = isAppear ? onAppear : onEnter;
9785 const resolve = () => finishEnter(el, isAppear, done);
9786 callHook(hook, [el, resolve]);
9787 nextFrame(() => {
9788 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
9789 addTransitionClass(el, isAppear ? appearToClass : enterToClass);
9790 if (!hasExplicitCallback(hook)) {
9791 whenTransitionEnds(el, type, enterDuration, resolve);
9792 }
9793 });
9794 };
9795 };
9796 return extend(baseProps, {
9797 onBeforeEnter(el) {
9798 callHook(onBeforeEnter, [el]);
9799 addTransitionClass(el, enterFromClass);
9800 addTransitionClass(el, enterActiveClass);
9801 },
9802 onBeforeAppear(el) {
9803 callHook(onBeforeAppear, [el]);
9804 addTransitionClass(el, appearFromClass);
9805 addTransitionClass(el, appearActiveClass);
9806 },
9807 onEnter: makeEnterHook(false),
9808 onAppear: makeEnterHook(true),
9809 onLeave(el, done) {
9810 el._isLeaving = true;
9811 const resolve = () => finishLeave(el, done);
9812 addTransitionClass(el, leaveFromClass);
9813 addTransitionClass(el, leaveActiveClass);
9814 forceReflow();
9815 nextFrame(() => {
9816 if (!el._isLeaving) {
9817 return;
9818 }
9819 removeTransitionClass(el, leaveFromClass);
9820 addTransitionClass(el, leaveToClass);
9821 if (!hasExplicitCallback(onLeave)) {
9822 whenTransitionEnds(el, type, leaveDuration, resolve);
9823 }
9824 });
9825 callHook(onLeave, [el, resolve]);
9826 },
9827 onEnterCancelled(el) {
9828 finishEnter(el, false);
9829 callHook(onEnterCancelled, [el]);
9830 },
9831 onAppearCancelled(el) {
9832 finishEnter(el, true);
9833 callHook(onAppearCancelled, [el]);
9834 },
9835 onLeaveCancelled(el) {
9836 finishLeave(el);
9837 callHook(onLeaveCancelled, [el]);
9838 }
9839 });
9840 }
9841 function normalizeDuration(duration) {
9842 if (duration == null) {
9843 return null;
9844 } else if (isObject(duration)) {
9845 return [NumberOf(duration.enter), NumberOf(duration.leave)];
9846 } else {
9847 const n = NumberOf(duration);
9848 return [n, n];
9849 }
9850 }
9851 function NumberOf(val) {
9852 const res = toNumber(val);
9853 {
9854 assertNumber(res, "<transition> explicit duration");
9855 }
9856 return res;
9857 }
9858 function addTransitionClass(el, cls) {
9859 cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
9860 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
9861 }
9862 function removeTransitionClass(el, cls) {
9863 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
9864 const _vtc = el[vtcKey];
9865 if (_vtc) {
9866 _vtc.delete(cls);
9867 if (!_vtc.size) {
9868 el[vtcKey] = void 0;
9869 }
9870 }
9871 }
9872 function nextFrame(cb) {
9873 requestAnimationFrame(() => {
9874 requestAnimationFrame(cb);
9875 });
9876 }
9877 let endId = 0;
9878 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
9879 const id = el._endId = ++endId;
9880 const resolveIfNotStale = () => {
9881 if (id === el._endId) {
9882 resolve();
9883 }
9884 };
9885 if (explicitTimeout) {
9886 return setTimeout(resolveIfNotStale, explicitTimeout);
9887 }
9888 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
9889 if (!type) {
9890 return resolve();
9891 }
9892 const endEvent = type + "end";
9893 let ended = 0;
9894 const end = () => {
9895 el.removeEventListener(endEvent, onEnd);
9896 resolveIfNotStale();
9897 };
9898 const onEnd = (e) => {
9899 if (e.target === el && ++ended >= propCount) {
9900 end();
9901 }
9902 };
9903 setTimeout(() => {
9904 if (ended < propCount) {
9905 end();
9906 }
9907 }, timeout + 1);
9908 el.addEventListener(endEvent, onEnd);
9909 }
9910 function getTransitionInfo(el, expectedType) {
9911 const styles = window.getComputedStyle(el);
9912 const getStyleProperties = (key) => (styles[key] || "").split(", ");
9913 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
9914 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
9915 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
9916 const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
9917 const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
9918 const animationTimeout = getTimeout(animationDelays, animationDurations);
9919 let type = null;
9920 let timeout = 0;
9921 let propCount = 0;
9922 if (expectedType === TRANSITION$1) {
9923 if (transitionTimeout > 0) {
9924 type = TRANSITION$1;
9925 timeout = transitionTimeout;
9926 propCount = transitionDurations.length;
9927 }
9928 } else if (expectedType === ANIMATION) {
9929 if (animationTimeout > 0) {
9930 type = ANIMATION;
9931 timeout = animationTimeout;
9932 propCount = animationDurations.length;
9933 }
9934 } else {
9935 timeout = Math.max(transitionTimeout, animationTimeout);
9936 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
9937 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
9938 }
9939 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
9940 getStyleProperties(`${TRANSITION$1}Property`).toString()
9941 );
9942 return {
9943 type,
9944 timeout,
9945 propCount,
9946 hasTransform
9947 };
9948 }
9949 function getTimeout(delays, durations) {
9950 while (delays.length < durations.length) {
9951 delays = delays.concat(delays);
9952 }
9953 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
9954 }
9955 function toMs(s) {
9956 if (s === "auto")
9957 return 0;
9958 return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
9959 }
9960 function forceReflow() {
9961 return document.body.offsetHeight;
9962 }
9963
9964 function patchClass(el, value, isSVG) {
9965 const transitionClasses = el[vtcKey];
9966 if (transitionClasses) {
9967 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
9968 }
9969 if (value == null) {
9970 el.removeAttribute("class");
9971 } else if (isSVG) {
9972 el.setAttribute("class", value);
9973 } else {
9974 el.className = value;
9975 }
9976 }
9977
9978 const vShowOriginalDisplay = Symbol("_vod");
9979 const vShowHidden = Symbol("_vsh");
9980 const vShow = {
9981 beforeMount(el, { value }, { transition }) {
9982 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
9983 if (transition && value) {
9984 transition.beforeEnter(el);
9985 } else {
9986 setDisplay(el, value);
9987 }
9988 },
9989 mounted(el, { value }, { transition }) {
9990 if (transition && value) {
9991 transition.enter(el);
9992 }
9993 },
9994 updated(el, { value, oldValue }, { transition }) {
9995 if (!value === !oldValue)
9996 return;
9997 if (transition) {
9998 if (value) {
9999 transition.beforeEnter(el);
10000 setDisplay(el, true);
10001 transition.enter(el);
10002 } else {
10003 transition.leave(el, () => {
10004 setDisplay(el, false);
10005 });
10006 }
10007 } else {
10008 setDisplay(el, value);
10009 }
10010 },
10011 beforeUnmount(el, { value }) {
10012 setDisplay(el, value);
10013 }
10014 };
10015 {
10016 vShow.name = "show";
10017 }
10018 function setDisplay(el, value) {
10019 el.style.display = value ? el[vShowOriginalDisplay] : "none";
10020 el[vShowHidden] = !value;
10021 }
10022
10023 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
10024 function useCssVars(getter) {
10025 const instance = getCurrentInstance();
10026 if (!instance) {
10027 warn(`useCssVars is called without current active component instance.`);
10028 return;
10029 }
10030 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10031 Array.from(
10032 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10033 ).forEach((node) => setVarsOnNode(node, vars));
10034 };
10035 {
10036 instance.getCssVars = () => getter(instance.proxy);
10037 }
10038 const setVars = () => {
10039 const vars = getter(instance.proxy);
10040 setVarsOnVNode(instance.subTree, vars);
10041 updateTeleports(vars);
10042 };
10043 onMounted(() => {
10044 watchPostEffect(setVars);
10045 const ob = new MutationObserver(setVars);
10046 ob.observe(instance.subTree.el.parentNode, { childList: true });
10047 onUnmounted(() => ob.disconnect());
10048 });
10049 }
10050 function setVarsOnVNode(vnode, vars) {
10051 if (vnode.shapeFlag & 128) {
10052 const suspense = vnode.suspense;
10053 vnode = suspense.activeBranch;
10054 if (suspense.pendingBranch && !suspense.isHydrating) {
10055 suspense.effects.push(() => {
10056 setVarsOnVNode(suspense.activeBranch, vars);
10057 });
10058 }
10059 }
10060 while (vnode.component) {
10061 vnode = vnode.component.subTree;
10062 }
10063 if (vnode.shapeFlag & 1 && vnode.el) {
10064 setVarsOnNode(vnode.el, vars);
10065 } else if (vnode.type === Fragment) {
10066 vnode.children.forEach((c) => setVarsOnVNode(c, vars));
10067 } else if (vnode.type === Static) {
10068 let { el, anchor } = vnode;
10069 while (el) {
10070 setVarsOnNode(el, vars);
10071 if (el === anchor)
10072 break;
10073 el = el.nextSibling;
10074 }
10075 }
10076 }
10077 function setVarsOnNode(el, vars) {
10078 if (el.nodeType === 1) {
10079 const style = el.style;
10080 let cssText = "";
10081 for (const key in vars) {
10082 style.setProperty(`--${key}`, vars[key]);
10083 cssText += `--${key}: ${vars[key]};`;
10084 }
10085 style[CSS_VAR_TEXT] = cssText;
10086 }
10087 }
10088
10089 const displayRE = /(^|;)\s*display\s*:/;
10090 function patchStyle(el, prev, next) {
10091 const style = el.style;
10092 const isCssString = isString(next);
10093 let hasControlledDisplay = false;
10094 if (next && !isCssString) {
10095 if (prev) {
10096 if (!isString(prev)) {
10097 for (const key in prev) {
10098 if (next[key] == null) {
10099 setStyle(style, key, "");
10100 }
10101 }
10102 } else {
10103 for (const prevStyle of prev.split(";")) {
10104 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
10105 if (next[key] == null) {
10106 setStyle(style, key, "");
10107 }
10108 }
10109 }
10110 }
10111 for (const key in next) {
10112 if (key === "display") {
10113 hasControlledDisplay = true;
10114 }
10115 setStyle(style, key, next[key]);
10116 }
10117 } else {
10118 if (isCssString) {
10119 if (prev !== next) {
10120 const cssVarText = style[CSS_VAR_TEXT];
10121 if (cssVarText) {
10122 next += ";" + cssVarText;
10123 }
10124 style.cssText = next;
10125 hasControlledDisplay = displayRE.test(next);
10126 }
10127 } else if (prev) {
10128 el.removeAttribute("style");
10129 }
10130 }
10131 if (vShowOriginalDisplay in el) {
10132 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
10133 if (el[vShowHidden]) {
10134 style.display = "none";
10135 }
10136 }
10137 }
10138 const semicolonRE = /[^\\];\s*$/;
10139 const importantRE = /\s*!important$/;
10140 function setStyle(style, name, val) {
10141 if (isArray(val)) {
10142 val.forEach((v) => setStyle(style, name, v));
10143 } else {
10144 if (val == null)
10145 val = "";
10146 {
10147 if (semicolonRE.test(val)) {
10148 warn(
10149 `Unexpected semicolon at the end of '${name}' style value: '${val}'`
10150 );
10151 }
10152 }
10153 if (name.startsWith("--")) {
10154 style.setProperty(name, val);
10155 } else {
10156 const prefixed = autoPrefix(style, name);
10157 if (importantRE.test(val)) {
10158 style.setProperty(
10159 hyphenate(prefixed),
10160 val.replace(importantRE, ""),
10161 "important"
10162 );
10163 } else {
10164 style[prefixed] = val;
10165 }
10166 }
10167 }
10168 }
10169 const prefixes = ["Webkit", "Moz", "ms"];
10170 const prefixCache = {};
10171 function autoPrefix(style, rawName) {
10172 const cached = prefixCache[rawName];
10173 if (cached) {
10174 return cached;
10175 }
10176 let name = camelize(rawName);
10177 if (name !== "filter" && name in style) {
10178 return prefixCache[rawName] = name;
10179 }
10180 name = capitalize(name);
10181 for (let i = 0; i < prefixes.length; i++) {
10182 const prefixed = prefixes[i] + name;
10183 if (prefixed in style) {
10184 return prefixCache[rawName] = prefixed;
10185 }
10186 }
10187 return rawName;
10188 }
10189
10190 const xlinkNS = "http://www.w3.org/1999/xlink";
10191 function patchAttr(el, key, value, isSVG, instance) {
10192 if (isSVG && key.startsWith("xlink:")) {
10193 if (value == null) {
10194 el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
10195 } else {
10196 el.setAttributeNS(xlinkNS, key, value);
10197 }
10198 } else {
10199 const isBoolean = isSpecialBooleanAttr(key);
10200 if (value == null || isBoolean && !includeBooleanAttr(value)) {
10201 el.removeAttribute(key);
10202 } else {
10203 el.setAttribute(key, isBoolean ? "" : value);
10204 }
10205 }
10206 }
10207
10208 function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
10209 if (key === "innerHTML" || key === "textContent") {
10210 if (prevChildren) {
10211 unmountChildren(prevChildren, parentComponent, parentSuspense);
10212 }
10213 el[key] = value == null ? "" : value;
10214 return;
10215 }
10216 const tag = el.tagName;
10217 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10218 !tag.includes("-")) {
10219 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10220 const newValue = value == null ? "" : value;
10221 if (oldValue !== newValue || !("_value" in el)) {
10222 el.value = newValue;
10223 }
10224 if (value == null) {
10225 el.removeAttribute(key);
10226 }
10227 el._value = value;
10228 return;
10229 }
10230 let needRemove = false;
10231 if (value === "" || value == null) {
10232 const type = typeof el[key];
10233 if (type === "boolean") {
10234 value = includeBooleanAttr(value);
10235 } else if (value == null && type === "string") {
10236 value = "";
10237 needRemove = true;
10238 } else if (type === "number") {
10239 value = 0;
10240 needRemove = true;
10241 }
10242 }
10243 try {
10244 el[key] = value;
10245 } catch (e) {
10246 if (!needRemove) {
10247 warn(
10248 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
10249 e
10250 );
10251 }
10252 }
10253 needRemove && el.removeAttribute(key);
10254 }
10255
10256 function addEventListener(el, event, handler, options) {
10257 el.addEventListener(event, handler, options);
10258 }
10259 function removeEventListener(el, event, handler, options) {
10260 el.removeEventListener(event, handler, options);
10261 }
10262 const veiKey = Symbol("_vei");
10263 function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10264 const invokers = el[veiKey] || (el[veiKey] = {});
10265 const existingInvoker = invokers[rawName];
10266 if (nextValue && existingInvoker) {
10267 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10268 } else {
10269 const [name, options] = parseName(rawName);
10270 if (nextValue) {
10271 const invoker = invokers[rawName] = createInvoker(
10272 sanitizeEventValue(nextValue, rawName) ,
10273 instance
10274 );
10275 addEventListener(el, name, invoker, options);
10276 } else if (existingInvoker) {
10277 removeEventListener(el, name, existingInvoker, options);
10278 invokers[rawName] = void 0;
10279 }
10280 }
10281 }
10282 const optionsModifierRE = /(?:Once|Passive|Capture)$/;
10283 function parseName(name) {
10284 let options;
10285 if (optionsModifierRE.test(name)) {
10286 options = {};
10287 let m;
10288 while (m = name.match(optionsModifierRE)) {
10289 name = name.slice(0, name.length - m[0].length);
10290 options[m[0].toLowerCase()] = true;
10291 }
10292 }
10293 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
10294 return [event, options];
10295 }
10296 let cachedNow = 0;
10297 const p = /* @__PURE__ */ Promise.resolve();
10298 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
10299 function createInvoker(initialValue, instance) {
10300 const invoker = (e) => {
10301 if (!e._vts) {
10302 e._vts = Date.now();
10303 } else if (e._vts <= invoker.attached) {
10304 return;
10305 }
10306 callWithAsyncErrorHandling(
10307 patchStopImmediatePropagation(e, invoker.value),
10308 instance,
10309 5,
10310 [e]
10311 );
10312 };
10313 invoker.value = initialValue;
10314 invoker.attached = getNow();
10315 return invoker;
10316 }
10317 function sanitizeEventValue(value, propName) {
10318 if (isFunction(value) || isArray(value)) {
10319 return value;
10320 }
10321 warn(
10322 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10323Expected function or array of functions, received type ${typeof value}.`
10324 );
10325 return NOOP;
10326 }
10327 function patchStopImmediatePropagation(e, value) {
10328 if (isArray(value)) {
10329 const originalStop = e.stopImmediatePropagation;
10330 e.stopImmediatePropagation = () => {
10331 originalStop.call(e);
10332 e._stopped = true;
10333 };
10334 return value.map(
10335 (fn) => (e2) => !e2._stopped && fn && fn(e2)
10336 );
10337 } else {
10338 return value;
10339 }
10340 }
10341
10342 const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
10343 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
10344 const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
10345 const isSVG = namespace === "svg";
10346 if (key === "class") {
10347 patchClass(el, nextValue, isSVG);
10348 } else if (key === "style") {
10349 patchStyle(el, prevValue, nextValue);
10350 } else if (isOn(key)) {
10351 if (!isModelListener(key)) {
10352 patchEvent(el, key, prevValue, nextValue, parentComponent);
10353 }
10354 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
10355 patchDOMProp(
10356 el,
10357 key,
10358 nextValue,
10359 prevChildren,
10360 parentComponent,
10361 parentSuspense,
10362 unmountChildren
10363 );
10364 } else {
10365 if (key === "true-value") {
10366 el._trueValue = nextValue;
10367 } else if (key === "false-value") {
10368 el._falseValue = nextValue;
10369 }
10370 patchAttr(el, key, nextValue, isSVG);
10371 }
10372 };
10373 function shouldSetAsProp(el, key, value, isSVG) {
10374 if (isSVG) {
10375 if (key === "innerHTML" || key === "textContent") {
10376 return true;
10377 }
10378 if (key in el && isNativeOn(key) && isFunction(value)) {
10379 return true;
10380 }
10381 return false;
10382 }
10383 if (key === "spellcheck" || key === "draggable" || key === "translate") {
10384 return false;
10385 }
10386 if (key === "form") {
10387 return false;
10388 }
10389 if (key === "list" && el.tagName === "INPUT") {
10390 return false;
10391 }
10392 if (key === "type" && el.tagName === "TEXTAREA") {
10393 return false;
10394 }
10395 if (key === "width" || key === "height") {
10396 const tag = el.tagName;
10397 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
10398 return false;
10399 }
10400 }
10401 if (isNativeOn(key) && isString(value)) {
10402 return false;
10403 }
10404 return key in el;
10405 }
10406
10407 /*! #__NO_SIDE_EFFECTS__ */
10408 // @__NO_SIDE_EFFECTS__
10409 function defineCustomElement(options, hydrate2) {
10410 const Comp = defineComponent(options);
10411 class VueCustomElement extends VueElement {
10412 constructor(initialProps) {
10413 super(Comp, initialProps, hydrate2);
10414 }
10415 }
10416 VueCustomElement.def = Comp;
10417 return VueCustomElement;
10418 }
10419 /*! #__NO_SIDE_EFFECTS__ */
10420 const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
10421 return /* @__PURE__ */ defineCustomElement(options, hydrate);
10422 };
10423 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10424 };
10425 class VueElement extends BaseClass {
10426 constructor(_def, _props = {}, hydrate2) {
10427 super();
10428 this._def = _def;
10429 this._props = _props;
10430 /**
10431 * @internal
10432 */
10433 this._instance = null;
10434 this._connected = false;
10435 this._resolved = false;
10436 this._numberProps = null;
10437 this._ob = null;
10438 if (this.shadowRoot && hydrate2) {
10439 hydrate2(this._createVNode(), this.shadowRoot);
10440 } else {
10441 if (this.shadowRoot) {
10442 warn(
10443 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
10444 );
10445 }
10446 this.attachShadow({ mode: "open" });
10447 if (!this._def.__asyncLoader) {
10448 this._resolveProps(this._def);
10449 }
10450 }
10451 }
10452 connectedCallback() {
10453 this._connected = true;
10454 if (!this._instance) {
10455 if (this._resolved) {
10456 this._update();
10457 } else {
10458 this._resolveDef();
10459 }
10460 }
10461 }
10462 disconnectedCallback() {
10463 this._connected = false;
10464 if (this._ob) {
10465 this._ob.disconnect();
10466 this._ob = null;
10467 }
10468 nextTick(() => {
10469 if (!this._connected) {
10470 render(null, this.shadowRoot);
10471 this._instance = null;
10472 }
10473 });
10474 }
10475 /**
10476 * resolve inner component definition (handle possible async component)
10477 */
10478 _resolveDef() {
10479 this._resolved = true;
10480 for (let i = 0; i < this.attributes.length; i++) {
10481 this._setAttr(this.attributes[i].name);
10482 }
10483 this._ob = new MutationObserver((mutations) => {
10484 for (const m of mutations) {
10485 this._setAttr(m.attributeName);
10486 }
10487 });
10488 this._ob.observe(this, { attributes: true });
10489 const resolve = (def, isAsync = false) => {
10490 const { props, styles } = def;
10491 let numberProps;
10492 if (props && !isArray(props)) {
10493 for (const key in props) {
10494 const opt = props[key];
10495 if (opt === Number || opt && opt.type === Number) {
10496 if (key in this._props) {
10497 this._props[key] = toNumber(this._props[key]);
10498 }
10499 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
10500 }
10501 }
10502 }
10503 this._numberProps = numberProps;
10504 if (isAsync) {
10505 this._resolveProps(def);
10506 }
10507 this._applyStyles(styles);
10508 this._update();
10509 };
10510 const asyncDef = this._def.__asyncLoader;
10511 if (asyncDef) {
10512 asyncDef().then((def) => resolve(def, true));
10513 } else {
10514 resolve(this._def);
10515 }
10516 }
10517 _resolveProps(def) {
10518 const { props } = def;
10519 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10520 for (const key of Object.keys(this)) {
10521 if (key[0] !== "_" && declaredPropKeys.includes(key)) {
10522 this._setProp(key, this[key], true, false);
10523 }
10524 }
10525 for (const key of declaredPropKeys.map(camelize)) {
10526 Object.defineProperty(this, key, {
10527 get() {
10528 return this._getProp(key);
10529 },
10530 set(val) {
10531 this._setProp(key, val);
10532 }
10533 });
10534 }
10535 }
10536 _setAttr(key) {
10537 let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10538 const camelKey = camelize(key);
10539 if (this._numberProps && this._numberProps[camelKey]) {
10540 value = toNumber(value);
10541 }
10542 this._setProp(camelKey, value, false);
10543 }
10544 /**
10545 * @internal
10546 */
10547 _getProp(key) {
10548 return this._props[key];
10549 }
10550 /**
10551 * @internal
10552 */
10553 _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
10554 if (val !== this._props[key]) {
10555 this._props[key] = val;
10556 if (shouldUpdate && this._instance) {
10557 this._update();
10558 }
10559 if (shouldReflect) {
10560 if (val === true) {
10561 this.setAttribute(hyphenate(key), "");
10562 } else if (typeof val === "string" || typeof val === "number") {
10563 this.setAttribute(hyphenate(key), val + "");
10564 } else if (!val) {
10565 this.removeAttribute(hyphenate(key));
10566 }
10567 }
10568 }
10569 }
10570 _update() {
10571 render(this._createVNode(), this.shadowRoot);
10572 }
10573 _createVNode() {
10574 const vnode = createVNode(this._def, extend({}, this._props));
10575 if (!this._instance) {
10576 vnode.ce = (instance) => {
10577 this._instance = instance;
10578 instance.isCE = true;
10579 {
10580 instance.ceReload = (newStyles) => {
10581 if (this._styles) {
10582 this._styles.forEach((s) => this.shadowRoot.removeChild(s));
10583 this._styles.length = 0;
10584 }
10585 this._applyStyles(newStyles);
10586 this._instance = null;
10587 this._update();
10588 };
10589 }
10590 const dispatch = (event, args) => {
10591 this.dispatchEvent(
10592 new CustomEvent(event, {
10593 detail: args
10594 })
10595 );
10596 };
10597 instance.emit = (event, ...args) => {
10598 dispatch(event, args);
10599 if (hyphenate(event) !== event) {
10600 dispatch(hyphenate(event), args);
10601 }
10602 };
10603 let parent = this;
10604 while (parent = parent && (parent.parentNode || parent.host)) {
10605 if (parent instanceof VueElement) {
10606 instance.parent = parent._instance;
10607 instance.provides = parent._instance.provides;
10608 break;
10609 }
10610 }
10611 };
10612 }
10613 return vnode;
10614 }
10615 _applyStyles(styles) {
10616 if (styles) {
10617 styles.forEach((css) => {
10618 const s = document.createElement("style");
10619 s.textContent = css;
10620 this.shadowRoot.appendChild(s);
10621 {
10622 (this._styles || (this._styles = [])).push(s);
10623 }
10624 });
10625 }
10626 }
10627 }
10628
10629 function useCssModule(name = "$style") {
10630 {
10631 {
10632 warn(`useCssModule() is not supported in the global build.`);
10633 }
10634 return EMPTY_OBJ;
10635 }
10636 }
10637
10638 const positionMap = /* @__PURE__ */ new WeakMap();
10639 const newPositionMap = /* @__PURE__ */ new WeakMap();
10640 const moveCbKey = Symbol("_moveCb");
10641 const enterCbKey = Symbol("_enterCb");
10642 const TransitionGroupImpl = {
10643 name: "TransitionGroup",
10644 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
10645 tag: String,
10646 moveClass: String
10647 }),
10648 setup(props, { slots }) {
10649 const instance = getCurrentInstance();
10650 const state = useTransitionState();
10651 let prevChildren;
10652 let children;
10653 onUpdated(() => {
10654 if (!prevChildren.length) {
10655 return;
10656 }
10657 const moveClass = props.moveClass || `${props.name || "v"}-move`;
10658 if (!hasCSSTransform(
10659 prevChildren[0].el,
10660 instance.vnode.el,
10661 moveClass
10662 )) {
10663 return;
10664 }
10665 prevChildren.forEach(callPendingCbs);
10666 prevChildren.forEach(recordPosition);
10667 const movedChildren = prevChildren.filter(applyTranslation);
10668 forceReflow();
10669 movedChildren.forEach((c) => {
10670 const el = c.el;
10671 const style = el.style;
10672 addTransitionClass(el, moveClass);
10673 style.transform = style.webkitTransform = style.transitionDuration = "";
10674 const cb = el[moveCbKey] = (e) => {
10675 if (e && e.target !== el) {
10676 return;
10677 }
10678 if (!e || /transform$/.test(e.propertyName)) {
10679 el.removeEventListener("transitionend", cb);
10680 el[moveCbKey] = null;
10681 removeTransitionClass(el, moveClass);
10682 }
10683 };
10684 el.addEventListener("transitionend", cb);
10685 });
10686 });
10687 return () => {
10688 const rawProps = toRaw(props);
10689 const cssTransitionProps = resolveTransitionProps(rawProps);
10690 let tag = rawProps.tag || Fragment;
10691 prevChildren = [];
10692 if (children) {
10693 for (let i = 0; i < children.length; i++) {
10694 const child = children[i];
10695 if (child.el && child.el instanceof Element) {
10696 prevChildren.push(child);
10697 setTransitionHooks(
10698 child,
10699 resolveTransitionHooks(
10700 child,
10701 cssTransitionProps,
10702 state,
10703 instance
10704 )
10705 );
10706 positionMap.set(
10707 child,
10708 child.el.getBoundingClientRect()
10709 );
10710 }
10711 }
10712 }
10713 children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10714 for (let i = 0; i < children.length; i++) {
10715 const child = children[i];
10716 if (child.key != null) {
10717 setTransitionHooks(
10718 child,
10719 resolveTransitionHooks(child, cssTransitionProps, state, instance)
10720 );
10721 } else {
10722 warn(`<TransitionGroup> children must be keyed.`);
10723 }
10724 }
10725 return createVNode(tag, null, children);
10726 };
10727 }
10728 };
10729 const removeMode = (props) => delete props.mode;
10730 /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
10731 const TransitionGroup = TransitionGroupImpl;
10732 function callPendingCbs(c) {
10733 const el = c.el;
10734 if (el[moveCbKey]) {
10735 el[moveCbKey]();
10736 }
10737 if (el[enterCbKey]) {
10738 el[enterCbKey]();
10739 }
10740 }
10741 function recordPosition(c) {
10742 newPositionMap.set(c, c.el.getBoundingClientRect());
10743 }
10744 function applyTranslation(c) {
10745 const oldPos = positionMap.get(c);
10746 const newPos = newPositionMap.get(c);
10747 const dx = oldPos.left - newPos.left;
10748 const dy = oldPos.top - newPos.top;
10749 if (dx || dy) {
10750 const s = c.el.style;
10751 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
10752 s.transitionDuration = "0s";
10753 return c;
10754 }
10755 }
10756 function hasCSSTransform(el, root, moveClass) {
10757 const clone = el.cloneNode();
10758 const _vtc = el[vtcKey];
10759 if (_vtc) {
10760 _vtc.forEach((cls) => {
10761 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
10762 });
10763 }
10764 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
10765 clone.style.display = "none";
10766 const container = root.nodeType === 1 ? root : root.parentNode;
10767 container.appendChild(clone);
10768 const { hasTransform } = getTransitionInfo(clone);
10769 container.removeChild(clone);
10770 return hasTransform;
10771 }
10772
10773 const getModelAssigner = (vnode) => {
10774 const fn = vnode.props["onUpdate:modelValue"] || false;
10775 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
10776 };
10777 function onCompositionStart(e) {
10778 e.target.composing = true;
10779 }
10780 function onCompositionEnd(e) {
10781 const target = e.target;
10782 if (target.composing) {
10783 target.composing = false;
10784 target.dispatchEvent(new Event("input"));
10785 }
10786 }
10787 const assignKey = Symbol("_assign");
10788 const vModelText = {
10789 created(el, { modifiers: { lazy, trim, number } }, vnode) {
10790 el[assignKey] = getModelAssigner(vnode);
10791 const castToNumber = number || vnode.props && vnode.props.type === "number";
10792 addEventListener(el, lazy ? "change" : "input", (e) => {
10793 if (e.target.composing)
10794 return;
10795 let domValue = el.value;
10796 if (trim) {
10797 domValue = domValue.trim();
10798 }
10799 if (castToNumber) {
10800 domValue = looseToNumber(domValue);
10801 }
10802 el[assignKey](domValue);
10803 });
10804 if (trim) {
10805 addEventListener(el, "change", () => {
10806 el.value = el.value.trim();
10807 });
10808 }
10809 if (!lazy) {
10810 addEventListener(el, "compositionstart", onCompositionStart);
10811 addEventListener(el, "compositionend", onCompositionEnd);
10812 addEventListener(el, "change", onCompositionEnd);
10813 }
10814 },
10815 // set value on mounted so it's after min/max for type="range"
10816 mounted(el, { value }) {
10817 el.value = value == null ? "" : value;
10818 },
10819 beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
10820 el[assignKey] = getModelAssigner(vnode);
10821 if (el.composing)
10822 return;
10823 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10824 const newValue = value == null ? "" : value;
10825 if (elValue === newValue) {
10826 return;
10827 }
10828 if (document.activeElement === el && el.type !== "range") {
10829 if (lazy) {
10830 return;
10831 }
10832 if (trim && el.value.trim() === newValue) {
10833 return;
10834 }
10835 }
10836 el.value = newValue;
10837 }
10838 };
10839 const vModelCheckbox = {
10840 // #4096 array checkboxes need to be deep traversed
10841 deep: true,
10842 created(el, _, vnode) {
10843 el[assignKey] = getModelAssigner(vnode);
10844 addEventListener(el, "change", () => {
10845 const modelValue = el._modelValue;
10846 const elementValue = getValue(el);
10847 const checked = el.checked;
10848 const assign = el[assignKey];
10849 if (isArray(modelValue)) {
10850 const index = looseIndexOf(modelValue, elementValue);
10851 const found = index !== -1;
10852 if (checked && !found) {
10853 assign(modelValue.concat(elementValue));
10854 } else if (!checked && found) {
10855 const filtered = [...modelValue];
10856 filtered.splice(index, 1);
10857 assign(filtered);
10858 }
10859 } else if (isSet(modelValue)) {
10860 const cloned = new Set(modelValue);
10861 if (checked) {
10862 cloned.add(elementValue);
10863 } else {
10864 cloned.delete(elementValue);
10865 }
10866 assign(cloned);
10867 } else {
10868 assign(getCheckboxValue(el, checked));
10869 }
10870 });
10871 },
10872 // set initial checked on mount to wait for true-value/false-value
10873 mounted: setChecked,
10874 beforeUpdate(el, binding, vnode) {
10875 el[assignKey] = getModelAssigner(vnode);
10876 setChecked(el, binding, vnode);
10877 }
10878 };
10879 function setChecked(el, { value, oldValue }, vnode) {
10880 el._modelValue = value;
10881 if (isArray(value)) {
10882 el.checked = looseIndexOf(value, vnode.props.value) > -1;
10883 } else if (isSet(value)) {
10884 el.checked = value.has(vnode.props.value);
10885 } else if (value !== oldValue) {
10886 el.checked = looseEqual(value, getCheckboxValue(el, true));
10887 }
10888 }
10889 const vModelRadio = {
10890 created(el, { value }, vnode) {
10891 el.checked = looseEqual(value, vnode.props.value);
10892 el[assignKey] = getModelAssigner(vnode);
10893 addEventListener(el, "change", () => {
10894 el[assignKey](getValue(el));
10895 });
10896 },
10897 beforeUpdate(el, { value, oldValue }, vnode) {
10898 el[assignKey] = getModelAssigner(vnode);
10899 if (value !== oldValue) {
10900 el.checked = looseEqual(value, vnode.props.value);
10901 }
10902 }
10903 };
10904 const vModelSelect = {
10905 // <select multiple> value need to be deep traversed
10906 deep: true,
10907 created(el, { value, modifiers: { number } }, vnode) {
10908 const isSetModel = isSet(value);
10909 addEventListener(el, "change", () => {
10910 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
10911 (o) => number ? looseToNumber(getValue(o)) : getValue(o)
10912 );
10913 el[assignKey](
10914 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
10915 );
10916 el._assigning = true;
10917 nextTick(() => {
10918 el._assigning = false;
10919 });
10920 });
10921 el[assignKey] = getModelAssigner(vnode);
10922 },
10923 // set value in mounted & updated because <select> relies on its children
10924 // <option>s.
10925 mounted(el, { value, modifiers: { number } }) {
10926 setSelected(el, value);
10927 },
10928 beforeUpdate(el, _binding, vnode) {
10929 el[assignKey] = getModelAssigner(vnode);
10930 },
10931 updated(el, { value, modifiers: { number } }) {
10932 if (!el._assigning) {
10933 setSelected(el, value);
10934 }
10935 }
10936 };
10937 function setSelected(el, value, number) {
10938 const isMultiple = el.multiple;
10939 const isArrayValue = isArray(value);
10940 if (isMultiple && !isArrayValue && !isSet(value)) {
10941 warn(
10942 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
10943 );
10944 return;
10945 }
10946 for (let i = 0, l = el.options.length; i < l; i++) {
10947 const option = el.options[i];
10948 const optionValue = getValue(option);
10949 if (isMultiple) {
10950 if (isArrayValue) {
10951 const optionType = typeof optionValue;
10952 if (optionType === "string" || optionType === "number") {
10953 option.selected = value.some((v) => String(v) === String(optionValue));
10954 } else {
10955 option.selected = looseIndexOf(value, optionValue) > -1;
10956 }
10957 } else {
10958 option.selected = value.has(optionValue);
10959 }
10960 } else if (looseEqual(getValue(option), value)) {
10961 if (el.selectedIndex !== i)
10962 el.selectedIndex = i;
10963 return;
10964 }
10965 }
10966 if (!isMultiple && el.selectedIndex !== -1) {
10967 el.selectedIndex = -1;
10968 }
10969 }
10970 function getValue(el) {
10971 return "_value" in el ? el._value : el.value;
10972 }
10973 function getCheckboxValue(el, checked) {
10974 const key = checked ? "_trueValue" : "_falseValue";
10975 return key in el ? el[key] : checked;
10976 }
10977 const vModelDynamic = {
10978 created(el, binding, vnode) {
10979 callModelHook(el, binding, vnode, null, "created");
10980 },
10981 mounted(el, binding, vnode) {
10982 callModelHook(el, binding, vnode, null, "mounted");
10983 },
10984 beforeUpdate(el, binding, vnode, prevVNode) {
10985 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
10986 },
10987 updated(el, binding, vnode, prevVNode) {
10988 callModelHook(el, binding, vnode, prevVNode, "updated");
10989 }
10990 };
10991 function resolveDynamicModel(tagName, type) {
10992 switch (tagName) {
10993 case "SELECT":
10994 return vModelSelect;
10995 case "TEXTAREA":
10996 return vModelText;
10997 default:
10998 switch (type) {
10999 case "checkbox":
11000 return vModelCheckbox;
11001 case "radio":
11002 return vModelRadio;
11003 default:
11004 return vModelText;
11005 }
11006 }
11007 }
11008 function callModelHook(el, binding, vnode, prevVNode, hook) {
11009 const modelToUse = resolveDynamicModel(
11010 el.tagName,
11011 vnode.props && vnode.props.type
11012 );
11013 const fn = modelToUse[hook];
11014 fn && fn(el, binding, vnode, prevVNode);
11015 }
11016
11017 const systemModifiers = ["ctrl", "shift", "alt", "meta"];
11018 const modifierGuards = {
11019 stop: (e) => e.stopPropagation(),
11020 prevent: (e) => e.preventDefault(),
11021 self: (e) => e.target !== e.currentTarget,
11022 ctrl: (e) => !e.ctrlKey,
11023 shift: (e) => !e.shiftKey,
11024 alt: (e) => !e.altKey,
11025 meta: (e) => !e.metaKey,
11026 left: (e) => "button" in e && e.button !== 0,
11027 middle: (e) => "button" in e && e.button !== 1,
11028 right: (e) => "button" in e && e.button !== 2,
11029 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
11030 };
11031 const withModifiers = (fn, modifiers) => {
11032 const cache = fn._withMods || (fn._withMods = {});
11033 const cacheKey = modifiers.join(".");
11034 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
11035 for (let i = 0; i < modifiers.length; i++) {
11036 const guard = modifierGuards[modifiers[i]];
11037 if (guard && guard(event, modifiers))
11038 return;
11039 }
11040 return fn(event, ...args);
11041 });
11042 };
11043 const keyNames = {
11044 esc: "escape",
11045 space: " ",
11046 up: "arrow-up",
11047 left: "arrow-left",
11048 right: "arrow-right",
11049 down: "arrow-down",
11050 delete: "backspace"
11051 };
11052 const withKeys = (fn, modifiers) => {
11053 const cache = fn._withKeys || (fn._withKeys = {});
11054 const cacheKey = modifiers.join(".");
11055 return cache[cacheKey] || (cache[cacheKey] = (event) => {
11056 if (!("key" in event)) {
11057 return;
11058 }
11059 const eventKey = hyphenate(event.key);
11060 if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
11061 return fn(event);
11062 }
11063 });
11064 };
11065
11066 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
11067 let renderer;
11068 let enabledHydration = false;
11069 function ensureRenderer() {
11070 return renderer || (renderer = createRenderer(rendererOptions));
11071 }
11072 function ensureHydrationRenderer() {
11073 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
11074 enabledHydration = true;
11075 return renderer;
11076 }
11077 const render = (...args) => {
11078 ensureRenderer().render(...args);
11079 };
11080 const hydrate = (...args) => {
11081 ensureHydrationRenderer().hydrate(...args);
11082 };
11083 const createApp = (...args) => {
11084 const app = ensureRenderer().createApp(...args);
11085 {
11086 injectNativeTagCheck(app);
11087 injectCompilerOptionsCheck(app);
11088 }
11089 const { mount } = app;
11090 app.mount = (containerOrSelector) => {
11091 const container = normalizeContainer(containerOrSelector);
11092 if (!container)
11093 return;
11094 const component = app._component;
11095 if (!isFunction(component) && !component.render && !component.template) {
11096 component.template = container.innerHTML;
11097 }
11098 container.innerHTML = "";
11099 const proxy = mount(container, false, resolveRootNamespace(container));
11100 if (container instanceof Element) {
11101 container.removeAttribute("v-cloak");
11102 container.setAttribute("data-v-app", "");
11103 }
11104 return proxy;
11105 };
11106 return app;
11107 };
11108 const createSSRApp = (...args) => {
11109 const app = ensureHydrationRenderer().createApp(...args);
11110 {
11111 injectNativeTagCheck(app);
11112 injectCompilerOptionsCheck(app);
11113 }
11114 const { mount } = app;
11115 app.mount = (containerOrSelector) => {
11116 const container = normalizeContainer(containerOrSelector);
11117 if (container) {
11118 return mount(container, true, resolveRootNamespace(container));
11119 }
11120 };
11121 return app;
11122 };
11123 function resolveRootNamespace(container) {
11124 if (container instanceof SVGElement) {
11125 return "svg";
11126 }
11127 if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
11128 return "mathml";
11129 }
11130 }
11131 function injectNativeTagCheck(app) {
11132 Object.defineProperty(app.config, "isNativeTag", {
11133 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
11134 writable: false
11135 });
11136 }
11137 function injectCompilerOptionsCheck(app) {
11138 if (isRuntimeOnly()) {
11139 const isCustomElement = app.config.isCustomElement;
11140 Object.defineProperty(app.config, "isCustomElement", {
11141 get() {
11142 return isCustomElement;
11143 },
11144 set() {
11145 warn(
11146 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
11147 );
11148 }
11149 });
11150 const compilerOptions = app.config.compilerOptions;
11151 const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
11152- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
11153- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
11154- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
11155 Object.defineProperty(app.config, "compilerOptions", {
11156 get() {
11157 warn(msg);
11158 return compilerOptions;
11159 },
11160 set() {
11161 warn(msg);
11162 }
11163 });
11164 }
11165 }
11166 function normalizeContainer(container) {
11167 if (isString(container)) {
11168 const res = document.querySelector(container);
11169 if (!res) {
11170 warn(
11171 `Failed to mount app: mount target selector "${container}" returned null.`
11172 );
11173 }
11174 return res;
11175 }
11176 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
11177 warn(
11178 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
11179 );
11180 }
11181 return container;
11182 }
11183 const initDirectivesForSSR = NOOP;
11184
11185 function initDev() {
11186 {
11187 {
11188 console.info(
11189 `You are running a development build of Vue.
11190Make sure to use the production build (*.prod.js) when deploying for production.`
11191 );
11192 }
11193 initCustomFormatter();
11194 }
11195 }
11196
11197 const FRAGMENT = Symbol(`Fragment` );
11198 const TELEPORT = Symbol(`Teleport` );
11199 const SUSPENSE = Symbol(`Suspense` );
11200 const KEEP_ALIVE = Symbol(`KeepAlive` );
11201 const BASE_TRANSITION = Symbol(`BaseTransition` );
11202 const OPEN_BLOCK = Symbol(`openBlock` );
11203 const CREATE_BLOCK = Symbol(`createBlock` );
11204 const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
11205 const CREATE_VNODE = Symbol(`createVNode` );
11206 const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
11207 const CREATE_COMMENT = Symbol(`createCommentVNode` );
11208 const CREATE_TEXT = Symbol(`createTextVNode` );
11209 const CREATE_STATIC = Symbol(`createStaticVNode` );
11210 const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
11211 const RESOLVE_DYNAMIC_COMPONENT = Symbol(
11212 `resolveDynamicComponent`
11213 );
11214 const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
11215 const RESOLVE_FILTER = Symbol(`resolveFilter` );
11216 const WITH_DIRECTIVES = Symbol(`withDirectives` );
11217 const RENDER_LIST = Symbol(`renderList` );
11218 const RENDER_SLOT = Symbol(`renderSlot` );
11219 const CREATE_SLOTS = Symbol(`createSlots` );
11220 const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
11221 const MERGE_PROPS = Symbol(`mergeProps` );
11222 const NORMALIZE_CLASS = Symbol(`normalizeClass` );
11223 const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
11224 const NORMALIZE_PROPS = Symbol(`normalizeProps` );
11225 const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
11226 const TO_HANDLERS = Symbol(`toHandlers` );
11227 const CAMELIZE = Symbol(`camelize` );
11228 const CAPITALIZE = Symbol(`capitalize` );
11229 const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
11230 const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
11231 const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
11232 const POP_SCOPE_ID = Symbol(`popScopeId` );
11233 const WITH_CTX = Symbol(`withCtx` );
11234 const UNREF = Symbol(`unref` );
11235 const IS_REF = Symbol(`isRef` );
11236 const WITH_MEMO = Symbol(`withMemo` );
11237 const IS_MEMO_SAME = Symbol(`isMemoSame` );
11238 const helperNameMap = {
11239 [FRAGMENT]: `Fragment`,
11240 [TELEPORT]: `Teleport`,
11241 [SUSPENSE]: `Suspense`,
11242 [KEEP_ALIVE]: `KeepAlive`,
11243 [BASE_TRANSITION]: `BaseTransition`,
11244 [OPEN_BLOCK]: `openBlock`,
11245 [CREATE_BLOCK]: `createBlock`,
11246 [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
11247 [CREATE_VNODE]: `createVNode`,
11248 [CREATE_ELEMENT_VNODE]: `createElementVNode`,
11249 [CREATE_COMMENT]: `createCommentVNode`,
11250 [CREATE_TEXT]: `createTextVNode`,
11251 [CREATE_STATIC]: `createStaticVNode`,
11252 [RESOLVE_COMPONENT]: `resolveComponent`,
11253 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
11254 [RESOLVE_DIRECTIVE]: `resolveDirective`,
11255 [RESOLVE_FILTER]: `resolveFilter`,
11256 [WITH_DIRECTIVES]: `withDirectives`,
11257 [RENDER_LIST]: `renderList`,
11258 [RENDER_SLOT]: `renderSlot`,
11259 [CREATE_SLOTS]: `createSlots`,
11260 [TO_DISPLAY_STRING]: `toDisplayString`,
11261 [MERGE_PROPS]: `mergeProps`,
11262 [NORMALIZE_CLASS]: `normalizeClass`,
11263 [NORMALIZE_STYLE]: `normalizeStyle`,
11264 [NORMALIZE_PROPS]: `normalizeProps`,
11265 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
11266 [TO_HANDLERS]: `toHandlers`,
11267 [CAMELIZE]: `camelize`,
11268 [CAPITALIZE]: `capitalize`,
11269 [TO_HANDLER_KEY]: `toHandlerKey`,
11270 [SET_BLOCK_TRACKING]: `setBlockTracking`,
11271 [PUSH_SCOPE_ID]: `pushScopeId`,
11272 [POP_SCOPE_ID]: `popScopeId`,
11273 [WITH_CTX]: `withCtx`,
11274 [UNREF]: `unref`,
11275 [IS_REF]: `isRef`,
11276 [WITH_MEMO]: `withMemo`,
11277 [IS_MEMO_SAME]: `isMemoSame`
11278 };
11279 function registerRuntimeHelpers(helpers) {
11280 Object.getOwnPropertySymbols(helpers).forEach((s) => {
11281 helperNameMap[s] = helpers[s];
11282 });
11283 }
11284
11285 const locStub = {
11286 start: { line: 1, column: 1, offset: 0 },
11287 end: { line: 1, column: 1, offset: 0 },
11288 source: ""
11289 };
11290 function createRoot(children, source = "") {
11291 return {
11292 type: 0,
11293 source,
11294 children,
11295 helpers: /* @__PURE__ */ new Set(),
11296 components: [],
11297 directives: [],
11298 hoists: [],
11299 imports: [],
11300 cached: 0,
11301 temps: 0,
11302 codegenNode: void 0,
11303 loc: locStub
11304 };
11305 }
11306 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
11307 if (context) {
11308 if (isBlock) {
11309 context.helper(OPEN_BLOCK);
11310 context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
11311 } else {
11312 context.helper(getVNodeHelper(context.inSSR, isComponent));
11313 }
11314 if (directives) {
11315 context.helper(WITH_DIRECTIVES);
11316 }
11317 }
11318 return {
11319 type: 13,
11320 tag,
11321 props,
11322 children,
11323 patchFlag,
11324 dynamicProps,
11325 directives,
11326 isBlock,
11327 disableTracking,
11328 isComponent,
11329 loc
11330 };
11331 }
11332 function createArrayExpression(elements, loc = locStub) {
11333 return {
11334 type: 17,
11335 loc,
11336 elements
11337 };
11338 }
11339 function createObjectExpression(properties, loc = locStub) {
11340 return {
11341 type: 15,
11342 loc,
11343 properties
11344 };
11345 }
11346 function createObjectProperty(key, value) {
11347 return {
11348 type: 16,
11349 loc: locStub,
11350 key: isString(key) ? createSimpleExpression(key, true) : key,
11351 value
11352 };
11353 }
11354 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
11355 return {
11356 type: 4,
11357 loc,
11358 content,
11359 isStatic,
11360 constType: isStatic ? 3 : constType
11361 };
11362 }
11363 function createCompoundExpression(children, loc = locStub) {
11364 return {
11365 type: 8,
11366 loc,
11367 children
11368 };
11369 }
11370 function createCallExpression(callee, args = [], loc = locStub) {
11371 return {
11372 type: 14,
11373 loc,
11374 callee,
11375 arguments: args
11376 };
11377 }
11378 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
11379 return {
11380 type: 18,
11381 params,
11382 returns,
11383 newline,
11384 isSlot,
11385 loc
11386 };
11387 }
11388 function createConditionalExpression(test, consequent, alternate, newline = true) {
11389 return {
11390 type: 19,
11391 test,
11392 consequent,
11393 alternate,
11394 newline,
11395 loc: locStub
11396 };
11397 }
11398 function createCacheExpression(index, value, isVNode = false) {
11399 return {
11400 type: 20,
11401 index,
11402 value,
11403 isVNode,
11404 loc: locStub
11405 };
11406 }
11407 function createBlockStatement(body) {
11408 return {
11409 type: 21,
11410 body,
11411 loc: locStub
11412 };
11413 }
11414 function getVNodeHelper(ssr, isComponent) {
11415 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
11416 }
11417 function getVNodeBlockHelper(ssr, isComponent) {
11418 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
11419 }
11420 function convertToBlock(node, { helper, removeHelper, inSSR }) {
11421 if (!node.isBlock) {
11422 node.isBlock = true;
11423 removeHelper(getVNodeHelper(inSSR, node.isComponent));
11424 helper(OPEN_BLOCK);
11425 helper(getVNodeBlockHelper(inSSR, node.isComponent));
11426 }
11427 }
11428
11429 const defaultDelimitersOpen = new Uint8Array([123, 123]);
11430 const defaultDelimitersClose = new Uint8Array([125, 125]);
11431 function isTagStartChar(c) {
11432 return c >= 97 && c <= 122 || c >= 65 && c <= 90;
11433 }
11434 function isWhitespace(c) {
11435 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
11436 }
11437 function isEndOfTagSection(c) {
11438 return c === 47 || c === 62 || isWhitespace(c);
11439 }
11440 function toCharCodes(str) {
11441 const ret = new Uint8Array(str.length);
11442 for (let i = 0; i < str.length; i++) {
11443 ret[i] = str.charCodeAt(i);
11444 }
11445 return ret;
11446 }
11447 const Sequences = {
11448 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
11449 // CDATA[
11450 CdataEnd: new Uint8Array([93, 93, 62]),
11451 // ]]>
11452 CommentEnd: new Uint8Array([45, 45, 62]),
11453 // `-->`
11454 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
11455 // `<\/script`
11456 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
11457 // `</style`
11458 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
11459 // `</title`
11460 TextareaEnd: new Uint8Array([
11461 60,
11462 47,
11463 116,
11464 101,
11465 120,
11466 116,
11467 97,
11468 114,
11469 101,
11470 97
11471 ])
11472 // `</textarea
11473 };
11474 class Tokenizer {
11475 constructor(stack, cbs) {
11476 this.stack = stack;
11477 this.cbs = cbs;
11478 /** The current state the tokenizer is in. */
11479 this.state = 1;
11480 /** The read buffer. */
11481 this.buffer = "";
11482 /** The beginning of the section that is currently being read. */
11483 this.sectionStart = 0;
11484 /** The index within the buffer that we are currently looking at. */
11485 this.index = 0;
11486 /** The start of the last entity. */
11487 this.entityStart = 0;
11488 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
11489 this.baseState = 1;
11490 /** For special parsing behavior inside of script and style tags. */
11491 this.inRCDATA = false;
11492 /** For disabling RCDATA tags handling */
11493 this.inXML = false;
11494 /** For disabling interpolation parsing in v-pre */
11495 this.inVPre = false;
11496 /** Record newline positions for fast line / column calculation */
11497 this.newlines = [];
11498 this.mode = 0;
11499 this.delimiterOpen = defaultDelimitersOpen;
11500 this.delimiterClose = defaultDelimitersClose;
11501 this.delimiterIndex = -1;
11502 this.currentSequence = void 0;
11503 this.sequenceIndex = 0;
11504 }
11505 get inSFCRoot() {
11506 return this.mode === 2 && this.stack.length === 0;
11507 }
11508 reset() {
11509 this.state = 1;
11510 this.mode = 0;
11511 this.buffer = "";
11512 this.sectionStart = 0;
11513 this.index = 0;
11514 this.baseState = 1;
11515 this.inRCDATA = false;
11516 this.currentSequence = void 0;
11517 this.newlines.length = 0;
11518 this.delimiterOpen = defaultDelimitersOpen;
11519 this.delimiterClose = defaultDelimitersClose;
11520 }
11521 /**
11522 * Generate Position object with line / column information using recorded
11523 * newline positions. We know the index is always going to be an already
11524 * processed index, so all the newlines up to this index should have been
11525 * recorded.
11526 */
11527 getPos(index) {
11528 let line = 1;
11529 let column = index + 1;
11530 for (let i = this.newlines.length - 1; i >= 0; i--) {
11531 const newlineIndex = this.newlines[i];
11532 if (index > newlineIndex) {
11533 line = i + 2;
11534 column = index - newlineIndex;
11535 break;
11536 }
11537 }
11538 return {
11539 column,
11540 line,
11541 offset: index
11542 };
11543 }
11544 peek() {
11545 return this.buffer.charCodeAt(this.index + 1);
11546 }
11547 stateText(c) {
11548 if (c === 60) {
11549 if (this.index > this.sectionStart) {
11550 this.cbs.ontext(this.sectionStart, this.index);
11551 }
11552 this.state = 5;
11553 this.sectionStart = this.index;
11554 } else if (!this.inVPre && c === this.delimiterOpen[0]) {
11555 this.state = 2;
11556 this.delimiterIndex = 0;
11557 this.stateInterpolationOpen(c);
11558 }
11559 }
11560 stateInterpolationOpen(c) {
11561 if (c === this.delimiterOpen[this.delimiterIndex]) {
11562 if (this.delimiterIndex === this.delimiterOpen.length - 1) {
11563 const start = this.index + 1 - this.delimiterOpen.length;
11564 if (start > this.sectionStart) {
11565 this.cbs.ontext(this.sectionStart, start);
11566 }
11567 this.state = 3;
11568 this.sectionStart = start;
11569 } else {
11570 this.delimiterIndex++;
11571 }
11572 } else if (this.inRCDATA) {
11573 this.state = 32;
11574 this.stateInRCDATA(c);
11575 } else {
11576 this.state = 1;
11577 this.stateText(c);
11578 }
11579 }
11580 stateInterpolation(c) {
11581 if (c === this.delimiterClose[0]) {
11582 this.state = 4;
11583 this.delimiterIndex = 0;
11584 this.stateInterpolationClose(c);
11585 }
11586 }
11587 stateInterpolationClose(c) {
11588 if (c === this.delimiterClose[this.delimiterIndex]) {
11589 if (this.delimiterIndex === this.delimiterClose.length - 1) {
11590 this.cbs.oninterpolation(this.sectionStart, this.index + 1);
11591 if (this.inRCDATA) {
11592 this.state = 32;
11593 } else {
11594 this.state = 1;
11595 }
11596 this.sectionStart = this.index + 1;
11597 } else {
11598 this.delimiterIndex++;
11599 }
11600 } else {
11601 this.state = 3;
11602 this.stateInterpolation(c);
11603 }
11604 }
11605 stateSpecialStartSequence(c) {
11606 const isEnd = this.sequenceIndex === this.currentSequence.length;
11607 const isMatch = isEnd ? (
11608 // If we are at the end of the sequence, make sure the tag name has ended
11609 isEndOfTagSection(c)
11610 ) : (
11611 // Otherwise, do a case-insensitive comparison
11612 (c | 32) === this.currentSequence[this.sequenceIndex]
11613 );
11614 if (!isMatch) {
11615 this.inRCDATA = false;
11616 } else if (!isEnd) {
11617 this.sequenceIndex++;
11618 return;
11619 }
11620 this.sequenceIndex = 0;
11621 this.state = 6;
11622 this.stateInTagName(c);
11623 }
11624 /** Look for an end tag. For <title> and <textarea>, also decode entities. */
11625 stateInRCDATA(c) {
11626 if (this.sequenceIndex === this.currentSequence.length) {
11627 if (c === 62 || isWhitespace(c)) {
11628 const endOfText = this.index - this.currentSequence.length;
11629 if (this.sectionStart < endOfText) {
11630 const actualIndex = this.index;
11631 this.index = endOfText;
11632 this.cbs.ontext(this.sectionStart, endOfText);
11633 this.index = actualIndex;
11634 }
11635 this.sectionStart = endOfText + 2;
11636 this.stateInClosingTagName(c);
11637 this.inRCDATA = false;
11638 return;
11639 }
11640 this.sequenceIndex = 0;
11641 }
11642 if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
11643 this.sequenceIndex += 1;
11644 } else if (this.sequenceIndex === 0) {
11645 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
11646 if (c === this.delimiterOpen[0]) {
11647 this.state = 2;
11648 this.delimiterIndex = 0;
11649 this.stateInterpolationOpen(c);
11650 }
11651 } else if (this.fastForwardTo(60)) {
11652 this.sequenceIndex = 1;
11653 }
11654 } else {
11655 this.sequenceIndex = Number(c === 60);
11656 }
11657 }
11658 stateCDATASequence(c) {
11659 if (c === Sequences.Cdata[this.sequenceIndex]) {
11660 if (++this.sequenceIndex === Sequences.Cdata.length) {
11661 this.state = 28;
11662 this.currentSequence = Sequences.CdataEnd;
11663 this.sequenceIndex = 0;
11664 this.sectionStart = this.index + 1;
11665 }
11666 } else {
11667 this.sequenceIndex = 0;
11668 this.state = 23;
11669 this.stateInDeclaration(c);
11670 }
11671 }
11672 /**
11673 * When we wait for one specific character, we can speed things up
11674 * by skipping through the buffer until we find it.
11675 *
11676 * @returns Whether the character was found.
11677 */
11678 fastForwardTo(c) {
11679 while (++this.index < this.buffer.length) {
11680 const cc = this.buffer.charCodeAt(this.index);
11681 if (cc === 10) {
11682 this.newlines.push(this.index);
11683 }
11684 if (cc === c) {
11685 return true;
11686 }
11687 }
11688 this.index = this.buffer.length - 1;
11689 return false;
11690 }
11691 /**
11692 * Comments and CDATA end with `-->` and `]]>`.
11693 *
11694 * Their common qualities are:
11695 * - Their end sequences have a distinct character they start with.
11696 * - That character is then repeated, so we have to check multiple repeats.
11697 * - All characters but the start character of the sequence can be skipped.
11698 */
11699 stateInCommentLike(c) {
11700 if (c === this.currentSequence[this.sequenceIndex]) {
11701 if (++this.sequenceIndex === this.currentSequence.length) {
11702 if (this.currentSequence === Sequences.CdataEnd) {
11703 this.cbs.oncdata(this.sectionStart, this.index - 2);
11704 } else {
11705 this.cbs.oncomment(this.sectionStart, this.index - 2);
11706 }
11707 this.sequenceIndex = 0;
11708 this.sectionStart = this.index + 1;
11709 this.state = 1;
11710 }
11711 } else if (this.sequenceIndex === 0) {
11712 if (this.fastForwardTo(this.currentSequence[0])) {
11713 this.sequenceIndex = 1;
11714 }
11715 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
11716 this.sequenceIndex = 0;
11717 }
11718 }
11719 startSpecial(sequence, offset) {
11720 this.enterRCDATA(sequence, offset);
11721 this.state = 31;
11722 }
11723 enterRCDATA(sequence, offset) {
11724 this.inRCDATA = true;
11725 this.currentSequence = sequence;
11726 this.sequenceIndex = offset;
11727 }
11728 stateBeforeTagName(c) {
11729 if (c === 33) {
11730 this.state = 22;
11731 this.sectionStart = this.index + 1;
11732 } else if (c === 63) {
11733 this.state = 24;
11734 this.sectionStart = this.index + 1;
11735 } else if (isTagStartChar(c)) {
11736 this.sectionStart = this.index;
11737 if (this.mode === 0) {
11738 this.state = 6;
11739 } else if (this.inSFCRoot) {
11740 this.state = 34;
11741 } else if (!this.inXML) {
11742 if (c === 116) {
11743 this.state = 30;
11744 } else {
11745 this.state = c === 115 ? 29 : 6;
11746 }
11747 } else {
11748 this.state = 6;
11749 }
11750 } else if (c === 47) {
11751 this.state = 8;
11752 } else {
11753 this.state = 1;
11754 this.stateText(c);
11755 }
11756 }
11757 stateInTagName(c) {
11758 if (isEndOfTagSection(c)) {
11759 this.handleTagName(c);
11760 }
11761 }
11762 stateInSFCRootTagName(c) {
11763 if (isEndOfTagSection(c)) {
11764 const tag = this.buffer.slice(this.sectionStart, this.index);
11765 if (tag !== "template") {
11766 this.enterRCDATA(toCharCodes(`</` + tag), 0);
11767 }
11768 this.handleTagName(c);
11769 }
11770 }
11771 handleTagName(c) {
11772 this.cbs.onopentagname(this.sectionStart, this.index);
11773 this.sectionStart = -1;
11774 this.state = 11;
11775 this.stateBeforeAttrName(c);
11776 }
11777 stateBeforeClosingTagName(c) {
11778 if (isWhitespace(c)) ; else if (c === 62) {
11779 {
11780 this.cbs.onerr(14, this.index);
11781 }
11782 this.state = 1;
11783 this.sectionStart = this.index + 1;
11784 } else {
11785 this.state = isTagStartChar(c) ? 9 : 27;
11786 this.sectionStart = this.index;
11787 }
11788 }
11789 stateInClosingTagName(c) {
11790 if (c === 62 || isWhitespace(c)) {
11791 this.cbs.onclosetag(this.sectionStart, this.index);
11792 this.sectionStart = -1;
11793 this.state = 10;
11794 this.stateAfterClosingTagName(c);
11795 }
11796 }
11797 stateAfterClosingTagName(c) {
11798 if (c === 62) {
11799 this.state = 1;
11800 this.sectionStart = this.index + 1;
11801 }
11802 }
11803 stateBeforeAttrName(c) {
11804 if (c === 62) {
11805 this.cbs.onopentagend(this.index);
11806 if (this.inRCDATA) {
11807 this.state = 32;
11808 } else {
11809 this.state = 1;
11810 }
11811 this.sectionStart = this.index + 1;
11812 } else if (c === 47) {
11813 this.state = 7;
11814 if (this.peek() !== 62) {
11815 this.cbs.onerr(22, this.index);
11816 }
11817 } else if (c === 60 && this.peek() === 47) {
11818 this.cbs.onopentagend(this.index);
11819 this.state = 5;
11820 this.sectionStart = this.index;
11821 } else if (!isWhitespace(c)) {
11822 if (c === 61) {
11823 this.cbs.onerr(
11824 19,
11825 this.index
11826 );
11827 }
11828 this.handleAttrStart(c);
11829 }
11830 }
11831 handleAttrStart(c) {
11832 if (c === 118 && this.peek() === 45) {
11833 this.state = 13;
11834 this.sectionStart = this.index;
11835 } else if (c === 46 || c === 58 || c === 64 || c === 35) {
11836 this.cbs.ondirname(this.index, this.index + 1);
11837 this.state = 14;
11838 this.sectionStart = this.index + 1;
11839 } else {
11840 this.state = 12;
11841 this.sectionStart = this.index;
11842 }
11843 }
11844 stateInSelfClosingTag(c) {
11845 if (c === 62) {
11846 this.cbs.onselfclosingtag(this.index);
11847 this.state = 1;
11848 this.sectionStart = this.index + 1;
11849 this.inRCDATA = false;
11850 } else if (!isWhitespace(c)) {
11851 this.state = 11;
11852 this.stateBeforeAttrName(c);
11853 }
11854 }
11855 stateInAttrName(c) {
11856 if (c === 61 || isEndOfTagSection(c)) {
11857 this.cbs.onattribname(this.sectionStart, this.index);
11858 this.handleAttrNameEnd(c);
11859 } else if (c === 34 || c === 39 || c === 60) {
11860 this.cbs.onerr(
11861 17,
11862 this.index
11863 );
11864 }
11865 }
11866 stateInDirName(c) {
11867 if (c === 61 || isEndOfTagSection(c)) {
11868 this.cbs.ondirname(this.sectionStart, this.index);
11869 this.handleAttrNameEnd(c);
11870 } else if (c === 58) {
11871 this.cbs.ondirname(this.sectionStart, this.index);
11872 this.state = 14;
11873 this.sectionStart = this.index + 1;
11874 } else if (c === 46) {
11875 this.cbs.ondirname(this.sectionStart, this.index);
11876 this.state = 16;
11877 this.sectionStart = this.index + 1;
11878 }
11879 }
11880 stateInDirArg(c) {
11881 if (c === 61 || isEndOfTagSection(c)) {
11882 this.cbs.ondirarg(this.sectionStart, this.index);
11883 this.handleAttrNameEnd(c);
11884 } else if (c === 91) {
11885 this.state = 15;
11886 } else if (c === 46) {
11887 this.cbs.ondirarg(this.sectionStart, this.index);
11888 this.state = 16;
11889 this.sectionStart = this.index + 1;
11890 }
11891 }
11892 stateInDynamicDirArg(c) {
11893 if (c === 93) {
11894 this.state = 14;
11895 } else if (c === 61 || isEndOfTagSection(c)) {
11896 this.cbs.ondirarg(this.sectionStart, this.index + 1);
11897 this.handleAttrNameEnd(c);
11898 {
11899 this.cbs.onerr(
11900 27,
11901 this.index
11902 );
11903 }
11904 }
11905 }
11906 stateInDirModifier(c) {
11907 if (c === 61 || isEndOfTagSection(c)) {
11908 this.cbs.ondirmodifier(this.sectionStart, this.index);
11909 this.handleAttrNameEnd(c);
11910 } else if (c === 46) {
11911 this.cbs.ondirmodifier(this.sectionStart, this.index);
11912 this.sectionStart = this.index + 1;
11913 }
11914 }
11915 handleAttrNameEnd(c) {
11916 this.sectionStart = this.index;
11917 this.state = 17;
11918 this.cbs.onattribnameend(this.index);
11919 this.stateAfterAttrName(c);
11920 }
11921 stateAfterAttrName(c) {
11922 if (c === 61) {
11923 this.state = 18;
11924 } else if (c === 47 || c === 62) {
11925 this.cbs.onattribend(0, this.sectionStart);
11926 this.sectionStart = -1;
11927 this.state = 11;
11928 this.stateBeforeAttrName(c);
11929 } else if (!isWhitespace(c)) {
11930 this.cbs.onattribend(0, this.sectionStart);
11931 this.handleAttrStart(c);
11932 }
11933 }
11934 stateBeforeAttrValue(c) {
11935 if (c === 34) {
11936 this.state = 19;
11937 this.sectionStart = this.index + 1;
11938 } else if (c === 39) {
11939 this.state = 20;
11940 this.sectionStart = this.index + 1;
11941 } else if (!isWhitespace(c)) {
11942 this.sectionStart = this.index;
11943 this.state = 21;
11944 this.stateInAttrValueNoQuotes(c);
11945 }
11946 }
11947 handleInAttrValue(c, quote) {
11948 if (c === quote || this.fastForwardTo(quote)) {
11949 this.cbs.onattribdata(this.sectionStart, this.index);
11950 this.sectionStart = -1;
11951 this.cbs.onattribend(
11952 quote === 34 ? 3 : 2,
11953 this.index + 1
11954 );
11955 this.state = 11;
11956 }
11957 }
11958 stateInAttrValueDoubleQuotes(c) {
11959 this.handleInAttrValue(c, 34);
11960 }
11961 stateInAttrValueSingleQuotes(c) {
11962 this.handleInAttrValue(c, 39);
11963 }
11964 stateInAttrValueNoQuotes(c) {
11965 if (isWhitespace(c) || c === 62) {
11966 this.cbs.onattribdata(this.sectionStart, this.index);
11967 this.sectionStart = -1;
11968 this.cbs.onattribend(1, this.index);
11969 this.state = 11;
11970 this.stateBeforeAttrName(c);
11971 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
11972 this.cbs.onerr(
11973 18,
11974 this.index
11975 );
11976 } else ;
11977 }
11978 stateBeforeDeclaration(c) {
11979 if (c === 91) {
11980 this.state = 26;
11981 this.sequenceIndex = 0;
11982 } else {
11983 this.state = c === 45 ? 25 : 23;
11984 }
11985 }
11986 stateInDeclaration(c) {
11987 if (c === 62 || this.fastForwardTo(62)) {
11988 this.state = 1;
11989 this.sectionStart = this.index + 1;
11990 }
11991 }
11992 stateInProcessingInstruction(c) {
11993 if (c === 62 || this.fastForwardTo(62)) {
11994 this.cbs.onprocessinginstruction(this.sectionStart, this.index);
11995 this.state = 1;
11996 this.sectionStart = this.index + 1;
11997 }
11998 }
11999 stateBeforeComment(c) {
12000 if (c === 45) {
12001 this.state = 28;
12002 this.currentSequence = Sequences.CommentEnd;
12003 this.sequenceIndex = 2;
12004 this.sectionStart = this.index + 1;
12005 } else {
12006 this.state = 23;
12007 }
12008 }
12009 stateInSpecialComment(c) {
12010 if (c === 62 || this.fastForwardTo(62)) {
12011 this.cbs.oncomment(this.sectionStart, this.index);
12012 this.state = 1;
12013 this.sectionStart = this.index + 1;
12014 }
12015 }
12016 stateBeforeSpecialS(c) {
12017 if (c === Sequences.ScriptEnd[3]) {
12018 this.startSpecial(Sequences.ScriptEnd, 4);
12019 } else if (c === Sequences.StyleEnd[3]) {
12020 this.startSpecial(Sequences.StyleEnd, 4);
12021 } else {
12022 this.state = 6;
12023 this.stateInTagName(c);
12024 }
12025 }
12026 stateBeforeSpecialT(c) {
12027 if (c === Sequences.TitleEnd[3]) {
12028 this.startSpecial(Sequences.TitleEnd, 4);
12029 } else if (c === Sequences.TextareaEnd[3]) {
12030 this.startSpecial(Sequences.TextareaEnd, 4);
12031 } else {
12032 this.state = 6;
12033 this.stateInTagName(c);
12034 }
12035 }
12036 startEntity() {
12037 }
12038 stateInEntity() {
12039 }
12040 /**
12041 * Iterates through the buffer, calling the function corresponding to the current state.
12042 *
12043 * States that are more likely to be hit are higher up, as a performance improvement.
12044 */
12045 parse(input) {
12046 this.buffer = input;
12047 while (this.index < this.buffer.length) {
12048 const c = this.buffer.charCodeAt(this.index);
12049 if (c === 10) {
12050 this.newlines.push(this.index);
12051 }
12052 switch (this.state) {
12053 case 1: {
12054 this.stateText(c);
12055 break;
12056 }
12057 case 2: {
12058 this.stateInterpolationOpen(c);
12059 break;
12060 }
12061 case 3: {
12062 this.stateInterpolation(c);
12063 break;
12064 }
12065 case 4: {
12066 this.stateInterpolationClose(c);
12067 break;
12068 }
12069 case 31: {
12070 this.stateSpecialStartSequence(c);
12071 break;
12072 }
12073 case 32: {
12074 this.stateInRCDATA(c);
12075 break;
12076 }
12077 case 26: {
12078 this.stateCDATASequence(c);
12079 break;
12080 }
12081 case 19: {
12082 this.stateInAttrValueDoubleQuotes(c);
12083 break;
12084 }
12085 case 12: {
12086 this.stateInAttrName(c);
12087 break;
12088 }
12089 case 13: {
12090 this.stateInDirName(c);
12091 break;
12092 }
12093 case 14: {
12094 this.stateInDirArg(c);
12095 break;
12096 }
12097 case 15: {
12098 this.stateInDynamicDirArg(c);
12099 break;
12100 }
12101 case 16: {
12102 this.stateInDirModifier(c);
12103 break;
12104 }
12105 case 28: {
12106 this.stateInCommentLike(c);
12107 break;
12108 }
12109 case 27: {
12110 this.stateInSpecialComment(c);
12111 break;
12112 }
12113 case 11: {
12114 this.stateBeforeAttrName(c);
12115 break;
12116 }
12117 case 6: {
12118 this.stateInTagName(c);
12119 break;
12120 }
12121 case 34: {
12122 this.stateInSFCRootTagName(c);
12123 break;
12124 }
12125 case 9: {
12126 this.stateInClosingTagName(c);
12127 break;
12128 }
12129 case 5: {
12130 this.stateBeforeTagName(c);
12131 break;
12132 }
12133 case 17: {
12134 this.stateAfterAttrName(c);
12135 break;
12136 }
12137 case 20: {
12138 this.stateInAttrValueSingleQuotes(c);
12139 break;
12140 }
12141 case 18: {
12142 this.stateBeforeAttrValue(c);
12143 break;
12144 }
12145 case 8: {
12146 this.stateBeforeClosingTagName(c);
12147 break;
12148 }
12149 case 10: {
12150 this.stateAfterClosingTagName(c);
12151 break;
12152 }
12153 case 29: {
12154 this.stateBeforeSpecialS(c);
12155 break;
12156 }
12157 case 30: {
12158 this.stateBeforeSpecialT(c);
12159 break;
12160 }
12161 case 21: {
12162 this.stateInAttrValueNoQuotes(c);
12163 break;
12164 }
12165 case 7: {
12166 this.stateInSelfClosingTag(c);
12167 break;
12168 }
12169 case 23: {
12170 this.stateInDeclaration(c);
12171 break;
12172 }
12173 case 22: {
12174 this.stateBeforeDeclaration(c);
12175 break;
12176 }
12177 case 25: {
12178 this.stateBeforeComment(c);
12179 break;
12180 }
12181 case 24: {
12182 this.stateInProcessingInstruction(c);
12183 break;
12184 }
12185 case 33: {
12186 this.stateInEntity();
12187 break;
12188 }
12189 }
12190 this.index++;
12191 }
12192 this.cleanup();
12193 this.finish();
12194 }
12195 /**
12196 * Remove data that has already been consumed from the buffer.
12197 */
12198 cleanup() {
12199 if (this.sectionStart !== this.index) {
12200 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
12201 this.cbs.ontext(this.sectionStart, this.index);
12202 this.sectionStart = this.index;
12203 } else if (this.state === 19 || this.state === 20 || this.state === 21) {
12204 this.cbs.onattribdata(this.sectionStart, this.index);
12205 this.sectionStart = this.index;
12206 }
12207 }
12208 }
12209 finish() {
12210 this.handleTrailingData();
12211 this.cbs.onend();
12212 }
12213 /** Handle any trailing data. */
12214 handleTrailingData() {
12215 const endIndex = this.buffer.length;
12216 if (this.sectionStart >= endIndex) {
12217 return;
12218 }
12219 if (this.state === 28) {
12220 if (this.currentSequence === Sequences.CdataEnd) {
12221 this.cbs.oncdata(this.sectionStart, endIndex);
12222 } else {
12223 this.cbs.oncomment(this.sectionStart, endIndex);
12224 }
12225 } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
12226 this.cbs.ontext(this.sectionStart, endIndex);
12227 }
12228 }
12229 emitCodePoint(cp, consumed) {
12230 }
12231 }
12232
12233 function defaultOnError(error) {
12234 throw error;
12235 }
12236 function defaultOnWarn(msg) {
12237 console.warn(`[Vue warn] ${msg.message}`);
12238 }
12239 function createCompilerError(code, loc, messages, additionalMessage) {
12240 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
12241 const error = new SyntaxError(String(msg));
12242 error.code = code;
12243 error.loc = loc;
12244 return error;
12245 }
12246 const errorMessages = {
12247 // parse errors
12248 [0]: "Illegal comment.",
12249 [1]: "CDATA section is allowed only in XML context.",
12250 [2]: "Duplicate attribute.",
12251 [3]: "End tag cannot have attributes.",
12252 [4]: "Illegal '/' in tags.",
12253 [5]: "Unexpected EOF in tag.",
12254 [6]: "Unexpected EOF in CDATA section.",
12255 [7]: "Unexpected EOF in comment.",
12256 [8]: "Unexpected EOF in script.",
12257 [9]: "Unexpected EOF in tag.",
12258 [10]: "Incorrectly closed comment.",
12259 [11]: "Incorrectly opened comment.",
12260 [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12261 [13]: "Attribute value was expected.",
12262 [14]: "End tag name was expected.",
12263 [15]: "Whitespace was expected.",
12264 [16]: "Unexpected '<!--' in comment.",
12265 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12266 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12267 [19]: "Attribute name cannot start with '='.",
12268 [21]: "'<?' is allowed only in XML context.",
12269 [20]: `Unexpected null character.`,
12270 [22]: "Illegal '/' in tags.",
12271 // Vue-specific parse errors
12272 [23]: "Invalid end tag.",
12273 [24]: "Element is missing end tag.",
12274 [25]: "Interpolation end sign was not found.",
12275 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12276 [26]: "Legal directive name was expected.",
12277 // transform errors
12278 [28]: `v-if/v-else-if is missing expression.`,
12279 [29]: `v-if/else branches must use unique keys.`,
12280 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12281 [31]: `v-for is missing expression.`,
12282 [32]: `v-for has invalid expression.`,
12283 [33]: `<template v-for> key should be placed on the <template> tag.`,
12284 [34]: `v-bind is missing expression.`,
12285 [52]: `v-bind with same-name shorthand only allows static argument.`,
12286 [35]: `v-on is missing expression.`,
12287 [36]: `Unexpected custom directive on <slot> outlet.`,
12288 [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
12289 [38]: `Duplicate slot names found. `,
12290 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12291 [40]: `v-slot can only be used on components or <template> tags.`,
12292 [41]: `v-model is missing expression.`,
12293 [42]: `v-model value must be a valid JavaScript member expression.`,
12294 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12295 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12296Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12297 [45]: `Error parsing JavaScript expression: `,
12298 [46]: `<KeepAlive> expects exactly one child component.`,
12299 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
12300 // generic errors
12301 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12302 [48]: `ES module mode is not supported in this build of compiler.`,
12303 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12304 [50]: `"scopeId" option is only supported in module mode.`,
12305 // just to fulfill types
12306 [53]: ``
12307 };
12308
12309 const isStaticExp = (p) => p.type === 4 && p.isStatic;
12310 function isCoreComponent(tag) {
12311 switch (tag) {
12312 case "Teleport":
12313 case "teleport":
12314 return TELEPORT;
12315 case "Suspense":
12316 case "suspense":
12317 return SUSPENSE;
12318 case "KeepAlive":
12319 case "keep-alive":
12320 return KEEP_ALIVE;
12321 case "BaseTransition":
12322 case "base-transition":
12323 return BASE_TRANSITION;
12324 }
12325 }
12326 const nonIdentifierRE = /^\d|[^\$\w]/;
12327 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
12328 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
12329 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
12330 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
12331 const isMemberExpressionBrowser = (path) => {
12332 path = path.trim().replace(whitespaceRE, (s) => s.trim());
12333 let state = 0 /* inMemberExp */;
12334 let stateStack = [];
12335 let currentOpenBracketCount = 0;
12336 let currentOpenParensCount = 0;
12337 let currentStringType = null;
12338 for (let i = 0; i < path.length; i++) {
12339 const char = path.charAt(i);
12340 switch (state) {
12341 case 0 /* inMemberExp */:
12342 if (char === "[") {
12343 stateStack.push(state);
12344 state = 1 /* inBrackets */;
12345 currentOpenBracketCount++;
12346 } else if (char === "(") {
12347 stateStack.push(state);
12348 state = 2 /* inParens */;
12349 currentOpenParensCount++;
12350 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
12351 return false;
12352 }
12353 break;
12354 case 1 /* inBrackets */:
12355 if (char === `'` || char === `"` || char === "`") {
12356 stateStack.push(state);
12357 state = 3 /* inString */;
12358 currentStringType = char;
12359 } else if (char === `[`) {
12360 currentOpenBracketCount++;
12361 } else if (char === `]`) {
12362 if (!--currentOpenBracketCount) {
12363 state = stateStack.pop();
12364 }
12365 }
12366 break;
12367 case 2 /* inParens */:
12368 if (char === `'` || char === `"` || char === "`") {
12369 stateStack.push(state);
12370 state = 3 /* inString */;
12371 currentStringType = char;
12372 } else if (char === `(`) {
12373 currentOpenParensCount++;
12374 } else if (char === `)`) {
12375 if (i === path.length - 1) {
12376 return false;
12377 }
12378 if (!--currentOpenParensCount) {
12379 state = stateStack.pop();
12380 }
12381 }
12382 break;
12383 case 3 /* inString */:
12384 if (char === currentStringType) {
12385 state = stateStack.pop();
12386 currentStringType = null;
12387 }
12388 break;
12389 }
12390 }
12391 return !currentOpenBracketCount && !currentOpenParensCount;
12392 };
12393 const isMemberExpression = isMemberExpressionBrowser ;
12394 function assert(condition, msg) {
12395 if (!condition) {
12396 throw new Error(msg || `unexpected compiler condition`);
12397 }
12398 }
12399 function findDir(node, name, allowEmpty = false) {
12400 for (let i = 0; i < node.props.length; i++) {
12401 const p = node.props[i];
12402 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
12403 return p;
12404 }
12405 }
12406 }
12407 function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
12408 for (let i = 0; i < node.props.length; i++) {
12409 const p = node.props[i];
12410 if (p.type === 6) {
12411 if (dynamicOnly)
12412 continue;
12413 if (p.name === name && (p.value || allowEmpty)) {
12414 return p;
12415 }
12416 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
12417 return p;
12418 }
12419 }
12420 }
12421 function isStaticArgOf(arg, name) {
12422 return !!(arg && isStaticExp(arg) && arg.content === name);
12423 }
12424 function hasDynamicKeyVBind(node) {
12425 return node.props.some(
12426 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
12427 p.arg.type !== 4 || // v-bind:[_ctx.foo]
12428 !p.arg.isStatic)
12429 // v-bind:[foo]
12430 );
12431 }
12432 function isText$1(node) {
12433 return node.type === 5 || node.type === 2;
12434 }
12435 function isVSlot(p) {
12436 return p.type === 7 && p.name === "slot";
12437 }
12438 function isTemplateNode(node) {
12439 return node.type === 1 && node.tagType === 3;
12440 }
12441 function isSlotOutlet(node) {
12442 return node.type === 1 && node.tagType === 2;
12443 }
12444 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
12445 function getUnnormalizedProps(props, callPath = []) {
12446 if (props && !isString(props) && props.type === 14) {
12447 const callee = props.callee;
12448 if (!isString(callee) && propsHelperSet.has(callee)) {
12449 return getUnnormalizedProps(
12450 props.arguments[0],
12451 callPath.concat(props)
12452 );
12453 }
12454 }
12455 return [props, callPath];
12456 }
12457 function injectProp(node, prop, context) {
12458 let propsWithInjection;
12459 let props = node.type === 13 ? node.props : node.arguments[2];
12460 let callPath = [];
12461 let parentCall;
12462 if (props && !isString(props) && props.type === 14) {
12463 const ret = getUnnormalizedProps(props);
12464 props = ret[0];
12465 callPath = ret[1];
12466 parentCall = callPath[callPath.length - 1];
12467 }
12468 if (props == null || isString(props)) {
12469 propsWithInjection = createObjectExpression([prop]);
12470 } else if (props.type === 14) {
12471 const first = props.arguments[0];
12472 if (!isString(first) && first.type === 15) {
12473 if (!hasProp(prop, first)) {
12474 first.properties.unshift(prop);
12475 }
12476 } else {
12477 if (props.callee === TO_HANDLERS) {
12478 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
12479 createObjectExpression([prop]),
12480 props
12481 ]);
12482 } else {
12483 props.arguments.unshift(createObjectExpression([prop]));
12484 }
12485 }
12486 !propsWithInjection && (propsWithInjection = props);
12487 } else if (props.type === 15) {
12488 if (!hasProp(prop, props)) {
12489 props.properties.unshift(prop);
12490 }
12491 propsWithInjection = props;
12492 } else {
12493 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
12494 createObjectExpression([prop]),
12495 props
12496 ]);
12497 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
12498 parentCall = callPath[callPath.length - 2];
12499 }
12500 }
12501 if (node.type === 13) {
12502 if (parentCall) {
12503 parentCall.arguments[0] = propsWithInjection;
12504 } else {
12505 node.props = propsWithInjection;
12506 }
12507 } else {
12508 if (parentCall) {
12509 parentCall.arguments[0] = propsWithInjection;
12510 } else {
12511 node.arguments[2] = propsWithInjection;
12512 }
12513 }
12514 }
12515 function hasProp(prop, props) {
12516 let result = false;
12517 if (prop.key.type === 4) {
12518 const propKeyName = prop.key.content;
12519 result = props.properties.some(
12520 (p) => p.key.type === 4 && p.key.content === propKeyName
12521 );
12522 }
12523 return result;
12524 }
12525 function toValidAssetId(name, type) {
12526 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
12527 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
12528 })}`;
12529 }
12530 function getMemoedVNodeCall(node) {
12531 if (node.type === 14 && node.callee === WITH_MEMO) {
12532 return node.arguments[1].returns;
12533 } else {
12534 return node;
12535 }
12536 }
12537 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
12538
12539 const defaultParserOptions = {
12540 parseMode: "base",
12541 ns: 0,
12542 delimiters: [`{{`, `}}`],
12543 getNamespace: () => 0,
12544 isVoidTag: NO,
12545 isPreTag: NO,
12546 isCustomElement: NO,
12547 onError: defaultOnError,
12548 onWarn: defaultOnWarn,
12549 comments: true,
12550 prefixIdentifiers: false
12551 };
12552 let currentOptions = defaultParserOptions;
12553 let currentRoot = null;
12554 let currentInput = "";
12555 let currentOpenTag = null;
12556 let currentProp = null;
12557 let currentAttrValue = "";
12558 let currentAttrStartIndex = -1;
12559 let currentAttrEndIndex = -1;
12560 let inPre = 0;
12561 let inVPre = false;
12562 let currentVPreBoundary = null;
12563 const stack = [];
12564 const tokenizer = new Tokenizer(stack, {
12565 onerr: emitError,
12566 ontext(start, end) {
12567 onText(getSlice(start, end), start, end);
12568 },
12569 ontextentity(char, start, end) {
12570 onText(char, start, end);
12571 },
12572 oninterpolation(start, end) {
12573 if (inVPre) {
12574 return onText(getSlice(start, end), start, end);
12575 }
12576 let innerStart = start + tokenizer.delimiterOpen.length;
12577 let innerEnd = end - tokenizer.delimiterClose.length;
12578 while (isWhitespace(currentInput.charCodeAt(innerStart))) {
12579 innerStart++;
12580 }
12581 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
12582 innerEnd--;
12583 }
12584 let exp = getSlice(innerStart, innerEnd);
12585 if (exp.includes("&")) {
12586 {
12587 exp = currentOptions.decodeEntities(exp, false);
12588 }
12589 }
12590 addNode({
12591 type: 5,
12592 content: createExp(exp, false, getLoc(innerStart, innerEnd)),
12593 loc: getLoc(start, end)
12594 });
12595 },
12596 onopentagname(start, end) {
12597 const name = getSlice(start, end);
12598 currentOpenTag = {
12599 type: 1,
12600 tag: name,
12601 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
12602 tagType: 0,
12603 // will be refined on tag close
12604 props: [],
12605 children: [],
12606 loc: getLoc(start - 1, end),
12607 codegenNode: void 0
12608 };
12609 },
12610 onopentagend(end) {
12611 endOpenTag(end);
12612 },
12613 onclosetag(start, end) {
12614 const name = getSlice(start, end);
12615 if (!currentOptions.isVoidTag(name)) {
12616 let found = false;
12617 for (let i = 0; i < stack.length; i++) {
12618 const e = stack[i];
12619 if (e.tag.toLowerCase() === name.toLowerCase()) {
12620 found = true;
12621 if (i > 0) {
12622 emitError(24, stack[0].loc.start.offset);
12623 }
12624 for (let j = 0; j <= i; j++) {
12625 const el = stack.shift();
12626 onCloseTag(el, end, j < i);
12627 }
12628 break;
12629 }
12630 }
12631 if (!found) {
12632 emitError(23, backTrack(start, 60));
12633 }
12634 }
12635 },
12636 onselfclosingtag(end) {
12637 const name = currentOpenTag.tag;
12638 currentOpenTag.isSelfClosing = true;
12639 endOpenTag(end);
12640 if (stack[0] && stack[0].tag === name) {
12641 onCloseTag(stack.shift(), end);
12642 }
12643 },
12644 onattribname(start, end) {
12645 currentProp = {
12646 type: 6,
12647 name: getSlice(start, end),
12648 nameLoc: getLoc(start, end),
12649 value: void 0,
12650 loc: getLoc(start)
12651 };
12652 },
12653 ondirname(start, end) {
12654 const raw = getSlice(start, end);
12655 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
12656 if (!inVPre && name === "") {
12657 emitError(26, start);
12658 }
12659 if (inVPre || name === "") {
12660 currentProp = {
12661 type: 6,
12662 name: raw,
12663 nameLoc: getLoc(start, end),
12664 value: void 0,
12665 loc: getLoc(start)
12666 };
12667 } else {
12668 currentProp = {
12669 type: 7,
12670 name,
12671 rawName: raw,
12672 exp: void 0,
12673 arg: void 0,
12674 modifiers: raw === "." ? ["prop"] : [],
12675 loc: getLoc(start)
12676 };
12677 if (name === "pre") {
12678 inVPre = tokenizer.inVPre = true;
12679 currentVPreBoundary = currentOpenTag;
12680 const props = currentOpenTag.props;
12681 for (let i = 0; i < props.length; i++) {
12682 if (props[i].type === 7) {
12683 props[i] = dirToAttr(props[i]);
12684 }
12685 }
12686 }
12687 }
12688 },
12689 ondirarg(start, end) {
12690 if (start === end)
12691 return;
12692 const arg = getSlice(start, end);
12693 if (inVPre) {
12694 currentProp.name += arg;
12695 setLocEnd(currentProp.nameLoc, end);
12696 } else {
12697 const isStatic = arg[0] !== `[`;
12698 currentProp.arg = createExp(
12699 isStatic ? arg : arg.slice(1, -1),
12700 isStatic,
12701 getLoc(start, end),
12702 isStatic ? 3 : 0
12703 );
12704 }
12705 },
12706 ondirmodifier(start, end) {
12707 const mod = getSlice(start, end);
12708 if (inVPre) {
12709 currentProp.name += "." + mod;
12710 setLocEnd(currentProp.nameLoc, end);
12711 } else if (currentProp.name === "slot") {
12712 const arg = currentProp.arg;
12713 if (arg) {
12714 arg.content += "." + mod;
12715 setLocEnd(arg.loc, end);
12716 }
12717 } else {
12718 currentProp.modifiers.push(mod);
12719 }
12720 },
12721 onattribdata(start, end) {
12722 currentAttrValue += getSlice(start, end);
12723 if (currentAttrStartIndex < 0)
12724 currentAttrStartIndex = start;
12725 currentAttrEndIndex = end;
12726 },
12727 onattribentity(char, start, end) {
12728 currentAttrValue += char;
12729 if (currentAttrStartIndex < 0)
12730 currentAttrStartIndex = start;
12731 currentAttrEndIndex = end;
12732 },
12733 onattribnameend(end) {
12734 const start = currentProp.loc.start.offset;
12735 const name = getSlice(start, end);
12736 if (currentProp.type === 7) {
12737 currentProp.rawName = name;
12738 }
12739 if (currentOpenTag.props.some(
12740 (p) => (p.type === 7 ? p.rawName : p.name) === name
12741 )) {
12742 emitError(2, start);
12743 }
12744 },
12745 onattribend(quote, end) {
12746 if (currentOpenTag && currentProp) {
12747 setLocEnd(currentProp.loc, end);
12748 if (quote !== 0) {
12749 if (currentAttrValue.includes("&")) {
12750 currentAttrValue = currentOptions.decodeEntities(
12751 currentAttrValue,
12752 true
12753 );
12754 }
12755 if (currentProp.type === 6) {
12756 if (currentProp.name === "class") {
12757 currentAttrValue = condense(currentAttrValue).trim();
12758 }
12759 if (quote === 1 && !currentAttrValue) {
12760 emitError(13, end);
12761 }
12762 currentProp.value = {
12763 type: 2,
12764 content: currentAttrValue,
12765 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
12766 };
12767 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
12768 tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
12769 }
12770 } else {
12771 let expParseMode = 0 /* Normal */;
12772 currentProp.exp = createExp(
12773 currentAttrValue,
12774 false,
12775 getLoc(currentAttrStartIndex, currentAttrEndIndex),
12776 0,
12777 expParseMode
12778 );
12779 if (currentProp.name === "for") {
12780 currentProp.forParseResult = parseForExpression(currentProp.exp);
12781 }
12782 }
12783 }
12784 if (currentProp.type !== 7 || currentProp.name !== "pre") {
12785 currentOpenTag.props.push(currentProp);
12786 }
12787 }
12788 currentAttrValue = "";
12789 currentAttrStartIndex = currentAttrEndIndex = -1;
12790 },
12791 oncomment(start, end) {
12792 if (currentOptions.comments) {
12793 addNode({
12794 type: 3,
12795 content: getSlice(start, end),
12796 loc: getLoc(start - 4, end + 3)
12797 });
12798 }
12799 },
12800 onend() {
12801 const end = currentInput.length;
12802 if (tokenizer.state !== 1) {
12803 switch (tokenizer.state) {
12804 case 5:
12805 case 8:
12806 emitError(5, end);
12807 break;
12808 case 3:
12809 case 4:
12810 emitError(
12811 25,
12812 tokenizer.sectionStart
12813 );
12814 break;
12815 case 28:
12816 if (tokenizer.currentSequence === Sequences.CdataEnd) {
12817 emitError(6, end);
12818 } else {
12819 emitError(7, end);
12820 }
12821 break;
12822 case 6:
12823 case 7:
12824 case 9:
12825 case 11:
12826 case 12:
12827 case 13:
12828 case 14:
12829 case 15:
12830 case 16:
12831 case 17:
12832 case 18:
12833 case 19:
12834 case 20:
12835 case 21:
12836 emitError(9, end);
12837 break;
12838 }
12839 }
12840 for (let index = 0; index < stack.length; index++) {
12841 onCloseTag(stack[index], end - 1);
12842 emitError(24, stack[index].loc.start.offset);
12843 }
12844 },
12845 oncdata(start, end) {
12846 if (stack[0].ns !== 0) {
12847 onText(getSlice(start, end), start, end);
12848 } else {
12849 emitError(1, start - 9);
12850 }
12851 },
12852 onprocessinginstruction(start) {
12853 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
12854 emitError(
12855 21,
12856 start - 1
12857 );
12858 }
12859 }
12860 });
12861 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
12862 const stripParensRE = /^\(|\)$/g;
12863 function parseForExpression(input) {
12864 const loc = input.loc;
12865 const exp = input.content;
12866 const inMatch = exp.match(forAliasRE);
12867 if (!inMatch)
12868 return;
12869 const [, LHS, RHS] = inMatch;
12870 const createAliasExpression = (content, offset, asParam = false) => {
12871 const start = loc.start.offset + offset;
12872 const end = start + content.length;
12873 return createExp(
12874 content,
12875 false,
12876 getLoc(start, end),
12877 0,
12878 asParam ? 1 /* Params */ : 0 /* Normal */
12879 );
12880 };
12881 const result = {
12882 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
12883 value: void 0,
12884 key: void 0,
12885 index: void 0,
12886 finalized: false
12887 };
12888 let valueContent = LHS.trim().replace(stripParensRE, "").trim();
12889 const trimmedOffset = LHS.indexOf(valueContent);
12890 const iteratorMatch = valueContent.match(forIteratorRE);
12891 if (iteratorMatch) {
12892 valueContent = valueContent.replace(forIteratorRE, "").trim();
12893 const keyContent = iteratorMatch[1].trim();
12894 let keyOffset;
12895 if (keyContent) {
12896 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
12897 result.key = createAliasExpression(keyContent, keyOffset, true);
12898 }
12899 if (iteratorMatch[2]) {
12900 const indexContent = iteratorMatch[2].trim();
12901 if (indexContent) {
12902 result.index = createAliasExpression(
12903 indexContent,
12904 exp.indexOf(
12905 indexContent,
12906 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
12907 ),
12908 true
12909 );
12910 }
12911 }
12912 }
12913 if (valueContent) {
12914 result.value = createAliasExpression(valueContent, trimmedOffset, true);
12915 }
12916 return result;
12917 }
12918 function getSlice(start, end) {
12919 return currentInput.slice(start, end);
12920 }
12921 function endOpenTag(end) {
12922 if (tokenizer.inSFCRoot) {
12923 currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
12924 }
12925 addNode(currentOpenTag);
12926 const { tag, ns } = currentOpenTag;
12927 if (ns === 0 && currentOptions.isPreTag(tag)) {
12928 inPre++;
12929 }
12930 if (currentOptions.isVoidTag(tag)) {
12931 onCloseTag(currentOpenTag, end);
12932 } else {
12933 stack.unshift(currentOpenTag);
12934 if (ns === 1 || ns === 2) {
12935 tokenizer.inXML = true;
12936 }
12937 }
12938 currentOpenTag = null;
12939 }
12940 function onText(content, start, end) {
12941 {
12942 const tag = stack[0] && stack[0].tag;
12943 if (tag !== "script" && tag !== "style" && content.includes("&")) {
12944 content = currentOptions.decodeEntities(content, false);
12945 }
12946 }
12947 const parent = stack[0] || currentRoot;
12948 const lastNode = parent.children[parent.children.length - 1];
12949 if (lastNode && lastNode.type === 2) {
12950 lastNode.content += content;
12951 setLocEnd(lastNode.loc, end);
12952 } else {
12953 parent.children.push({
12954 type: 2,
12955 content,
12956 loc: getLoc(start, end)
12957 });
12958 }
12959 }
12960 function onCloseTag(el, end, isImplied = false) {
12961 if (isImplied) {
12962 setLocEnd(el.loc, backTrack(end, 60));
12963 } else {
12964 setLocEnd(el.loc, lookAhead(end, 62) + 1);
12965 }
12966 if (tokenizer.inSFCRoot) {
12967 if (el.children.length) {
12968 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
12969 } else {
12970 el.innerLoc.end = extend({}, el.innerLoc.start);
12971 }
12972 el.innerLoc.source = getSlice(
12973 el.innerLoc.start.offset,
12974 el.innerLoc.end.offset
12975 );
12976 }
12977 const { tag, ns } = el;
12978 if (!inVPre) {
12979 if (tag === "slot") {
12980 el.tagType = 2;
12981 } else if (isFragmentTemplate(el)) {
12982 el.tagType = 3;
12983 } else if (isComponent(el)) {
12984 el.tagType = 1;
12985 }
12986 }
12987 if (!tokenizer.inRCDATA) {
12988 el.children = condenseWhitespace(el.children, el.tag);
12989 }
12990 if (ns === 0 && currentOptions.isPreTag(tag)) {
12991 inPre--;
12992 }
12993 if (currentVPreBoundary === el) {
12994 inVPre = tokenizer.inVPre = false;
12995 currentVPreBoundary = null;
12996 }
12997 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
12998 tokenizer.inXML = false;
12999 }
13000 }
13001 function lookAhead(index, c) {
13002 let i = index;
13003 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13004 i++;
13005 return i;
13006 }
13007 function backTrack(index, c) {
13008 let i = index;
13009 while (currentInput.charCodeAt(i) !== c && i >= 0)
13010 i--;
13011 return i;
13012 }
13013 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
13014 function isFragmentTemplate({ tag, props }) {
13015 if (tag === "template") {
13016 for (let i = 0; i < props.length; i++) {
13017 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
13018 return true;
13019 }
13020 }
13021 }
13022 return false;
13023 }
13024 function isComponent({ tag, props }) {
13025 if (currentOptions.isCustomElement(tag)) {
13026 return false;
13027 }
13028 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13029 return true;
13030 }
13031 for (let i = 0; i < props.length; i++) {
13032 const p = props[i];
13033 if (p.type === 6) {
13034 if (p.name === "is" && p.value) {
13035 if (p.value.content.startsWith("vue:")) {
13036 return true;
13037 }
13038 }
13039 }
13040 }
13041 return false;
13042 }
13043 function isUpperCase(c) {
13044 return c > 64 && c < 91;
13045 }
13046 const windowsNewlineRE = /\r\n/g;
13047 function condenseWhitespace(nodes, tag) {
13048 const shouldCondense = currentOptions.whitespace !== "preserve";
13049 let removedWhitespace = false;
13050 for (let i = 0; i < nodes.length; i++) {
13051 const node = nodes[i];
13052 if (node.type === 2) {
13053 if (!inPre) {
13054 if (isAllWhitespace(node.content)) {
13055 const prev = nodes[i - 1] && nodes[i - 1].type;
13056 const next = nodes[i + 1] && nodes[i + 1].type;
13057 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
13058 removedWhitespace = true;
13059 nodes[i] = null;
13060 } else {
13061 node.content = " ";
13062 }
13063 } else if (shouldCondense) {
13064 node.content = condense(node.content);
13065 }
13066 } else {
13067 node.content = node.content.replace(windowsNewlineRE, "\n");
13068 }
13069 }
13070 }
13071 if (inPre && tag && currentOptions.isPreTag(tag)) {
13072 const first = nodes[0];
13073 if (first && first.type === 2) {
13074 first.content = first.content.replace(/^\r?\n/, "");
13075 }
13076 }
13077 return removedWhitespace ? nodes.filter(Boolean) : nodes;
13078 }
13079 function isAllWhitespace(str) {
13080 for (let i = 0; i < str.length; i++) {
13081 if (!isWhitespace(str.charCodeAt(i))) {
13082 return false;
13083 }
13084 }
13085 return true;
13086 }
13087 function hasNewlineChar(str) {
13088 for (let i = 0; i < str.length; i++) {
13089 const c = str.charCodeAt(i);
13090 if (c === 10 || c === 13) {
13091 return true;
13092 }
13093 }
13094 return false;
13095 }
13096 function condense(str) {
13097 let ret = "";
13098 let prevCharIsWhitespace = false;
13099 for (let i = 0; i < str.length; i++) {
13100 if (isWhitespace(str.charCodeAt(i))) {
13101 if (!prevCharIsWhitespace) {
13102 ret += " ";
13103 prevCharIsWhitespace = true;
13104 }
13105 } else {
13106 ret += str[i];
13107 prevCharIsWhitespace = false;
13108 }
13109 }
13110 return ret;
13111 }
13112 function addNode(node) {
13113 (stack[0] || currentRoot).children.push(node);
13114 }
13115 function getLoc(start, end) {
13116 return {
13117 start: tokenizer.getPos(start),
13118 // @ts-expect-error allow late attachment
13119 end: end == null ? end : tokenizer.getPos(end),
13120 // @ts-expect-error allow late attachment
13121 source: end == null ? end : getSlice(start, end)
13122 };
13123 }
13124 function setLocEnd(loc, end) {
13125 loc.end = tokenizer.getPos(end);
13126 loc.source = getSlice(loc.start.offset, end);
13127 }
13128 function dirToAttr(dir) {
13129 const attr = {
13130 type: 6,
13131 name: dir.rawName,
13132 nameLoc: getLoc(
13133 dir.loc.start.offset,
13134 dir.loc.start.offset + dir.rawName.length
13135 ),
13136 value: void 0,
13137 loc: dir.loc
13138 };
13139 if (dir.exp) {
13140 const loc = dir.exp.loc;
13141 if (loc.end.offset < dir.loc.end.offset) {
13142 loc.start.offset--;
13143 loc.start.column--;
13144 loc.end.offset++;
13145 loc.end.column++;
13146 }
13147 attr.value = {
13148 type: 2,
13149 content: dir.exp.content,
13150 loc
13151 };
13152 }
13153 return attr;
13154 }
13155 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
13156 const exp = createSimpleExpression(content, isStatic, loc, constType);
13157 return exp;
13158 }
13159 function emitError(code, index, message) {
13160 currentOptions.onError(
13161 createCompilerError(code, getLoc(index, index), void 0, message)
13162 );
13163 }
13164 function reset() {
13165 tokenizer.reset();
13166 currentOpenTag = null;
13167 currentProp = null;
13168 currentAttrValue = "";
13169 currentAttrStartIndex = -1;
13170 currentAttrEndIndex = -1;
13171 stack.length = 0;
13172 }
13173 function baseParse(input, options) {
13174 reset();
13175 currentInput = input;
13176 currentOptions = extend({}, defaultParserOptions);
13177 if (options) {
13178 let key;
13179 for (key in options) {
13180 if (options[key] != null) {
13181 currentOptions[key] = options[key];
13182 }
13183 }
13184 }
13185 {
13186 if (!currentOptions.decodeEntities) {
13187 throw new Error(
13188 `[@vue/compiler-core] decodeEntities option is required in browser builds.`
13189 );
13190 }
13191 }
13192 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
13193 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
13194 const delimiters = options && options.delimiters;
13195 if (delimiters) {
13196 tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
13197 tokenizer.delimiterClose = toCharCodes(delimiters[1]);
13198 }
13199 const root = currentRoot = createRoot([], input);
13200 tokenizer.parse(currentInput);
13201 root.loc = getLoc(0, input.length);
13202 root.children = condenseWhitespace(root.children);
13203 currentRoot = null;
13204 return root;
13205 }
13206
13207 function hoistStatic(root, context) {
13208 walk(
13209 root,
13210 context,
13211 // Root node is unfortunately non-hoistable due to potential parent
13212 // fallthrough attributes.
13213 isSingleElementRoot(root, root.children[0])
13214 );
13215 }
13216 function isSingleElementRoot(root, child) {
13217 const { children } = root;
13218 return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
13219 }
13220 function walk(node, context, doNotHoistNode = false) {
13221 const { children } = node;
13222 const originalCount = children.length;
13223 let hoistedCount = 0;
13224 for (let i = 0; i < children.length; i++) {
13225 const child = children[i];
13226 if (child.type === 1 && child.tagType === 0) {
13227 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
13228 if (constantType > 0) {
13229 if (constantType >= 2) {
13230 child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
13231 child.codegenNode = context.hoist(child.codegenNode);
13232 hoistedCount++;
13233 continue;
13234 }
13235 } else {
13236 const codegenNode = child.codegenNode;
13237 if (codegenNode.type === 13) {
13238 const flag = getPatchFlag(codegenNode);
13239 if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13240 const props = getNodeProps(child);
13241 if (props) {
13242 codegenNode.props = context.hoist(props);
13243 }
13244 }
13245 if (codegenNode.dynamicProps) {
13246 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
13247 }
13248 }
13249 }
13250 }
13251 if (child.type === 1) {
13252 const isComponent = child.tagType === 1;
13253 if (isComponent) {
13254 context.scopes.vSlot++;
13255 }
13256 walk(child, context);
13257 if (isComponent) {
13258 context.scopes.vSlot--;
13259 }
13260 } else if (child.type === 11) {
13261 walk(child, context, child.children.length === 1);
13262 } else if (child.type === 9) {
13263 for (let i2 = 0; i2 < child.branches.length; i2++) {
13264 walk(
13265 child.branches[i2],
13266 context,
13267 child.branches[i2].children.length === 1
13268 );
13269 }
13270 }
13271 }
13272 if (hoistedCount && context.transformHoist) {
13273 context.transformHoist(children, context, node);
13274 }
13275 if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
13276 const hoisted = context.hoist(
13277 createArrayExpression(node.codegenNode.children)
13278 );
13279 if (context.hmr) {
13280 hoisted.content = `[...${hoisted.content}]`;
13281 }
13282 node.codegenNode.children = hoisted;
13283 }
13284 }
13285 function getConstantType(node, context) {
13286 const { constantCache } = context;
13287 switch (node.type) {
13288 case 1:
13289 if (node.tagType !== 0) {
13290 return 0;
13291 }
13292 const cached = constantCache.get(node);
13293 if (cached !== void 0) {
13294 return cached;
13295 }
13296 const codegenNode = node.codegenNode;
13297 if (codegenNode.type !== 13) {
13298 return 0;
13299 }
13300 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
13301 return 0;
13302 }
13303 const flag = getPatchFlag(codegenNode);
13304 if (!flag) {
13305 let returnType2 = 3;
13306 const generatedPropsType = getGeneratedPropsConstantType(node, context);
13307 if (generatedPropsType === 0) {
13308 constantCache.set(node, 0);
13309 return 0;
13310 }
13311 if (generatedPropsType < returnType2) {
13312 returnType2 = generatedPropsType;
13313 }
13314 for (let i = 0; i < node.children.length; i++) {
13315 const childType = getConstantType(node.children[i], context);
13316 if (childType === 0) {
13317 constantCache.set(node, 0);
13318 return 0;
13319 }
13320 if (childType < returnType2) {
13321 returnType2 = childType;
13322 }
13323 }
13324 if (returnType2 > 1) {
13325 for (let i = 0; i < node.props.length; i++) {
13326 const p = node.props[i];
13327 if (p.type === 7 && p.name === "bind" && p.exp) {
13328 const expType = getConstantType(p.exp, context);
13329 if (expType === 0) {
13330 constantCache.set(node, 0);
13331 return 0;
13332 }
13333 if (expType < returnType2) {
13334 returnType2 = expType;
13335 }
13336 }
13337 }
13338 }
13339 if (codegenNode.isBlock) {
13340 for (let i = 0; i < node.props.length; i++) {
13341 const p = node.props[i];
13342 if (p.type === 7) {
13343 constantCache.set(node, 0);
13344 return 0;
13345 }
13346 }
13347 context.removeHelper(OPEN_BLOCK);
13348 context.removeHelper(
13349 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
13350 );
13351 codegenNode.isBlock = false;
13352 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
13353 }
13354 constantCache.set(node, returnType2);
13355 return returnType2;
13356 } else {
13357 constantCache.set(node, 0);
13358 return 0;
13359 }
13360 case 2:
13361 case 3:
13362 return 3;
13363 case 9:
13364 case 11:
13365 case 10:
13366 return 0;
13367 case 5:
13368 case 12:
13369 return getConstantType(node.content, context);
13370 case 4:
13371 return node.constType;
13372 case 8:
13373 let returnType = 3;
13374 for (let i = 0; i < node.children.length; i++) {
13375 const child = node.children[i];
13376 if (isString(child) || isSymbol(child)) {
13377 continue;
13378 }
13379 const childType = getConstantType(child, context);
13380 if (childType === 0) {
13381 return 0;
13382 } else if (childType < returnType) {
13383 returnType = childType;
13384 }
13385 }
13386 return returnType;
13387 default:
13388 return 0;
13389 }
13390 }
13391 const allowHoistedHelperSet = /* @__PURE__ */ new Set([
13392 NORMALIZE_CLASS,
13393 NORMALIZE_STYLE,
13394 NORMALIZE_PROPS,
13395 GUARD_REACTIVE_PROPS
13396 ]);
13397 function getConstantTypeOfHelperCall(value, context) {
13398 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
13399 const arg = value.arguments[0];
13400 if (arg.type === 4) {
13401 return getConstantType(arg, context);
13402 } else if (arg.type === 14) {
13403 return getConstantTypeOfHelperCall(arg, context);
13404 }
13405 }
13406 return 0;
13407 }
13408 function getGeneratedPropsConstantType(node, context) {
13409 let returnType = 3;
13410 const props = getNodeProps(node);
13411 if (props && props.type === 15) {
13412 const { properties } = props;
13413 for (let i = 0; i < properties.length; i++) {
13414 const { key, value } = properties[i];
13415 const keyType = getConstantType(key, context);
13416 if (keyType === 0) {
13417 return keyType;
13418 }
13419 if (keyType < returnType) {
13420 returnType = keyType;
13421 }
13422 let valueType;
13423 if (value.type === 4) {
13424 valueType = getConstantType(value, context);
13425 } else if (value.type === 14) {
13426 valueType = getConstantTypeOfHelperCall(value, context);
13427 } else {
13428 valueType = 0;
13429 }
13430 if (valueType === 0) {
13431 return valueType;
13432 }
13433 if (valueType < returnType) {
13434 returnType = valueType;
13435 }
13436 }
13437 }
13438 return returnType;
13439 }
13440 function getNodeProps(node) {
13441 const codegenNode = node.codegenNode;
13442 if (codegenNode.type === 13) {
13443 return codegenNode.props;
13444 }
13445 }
13446 function getPatchFlag(node) {
13447 const flag = node.patchFlag;
13448 return flag ? parseInt(flag, 10) : void 0;
13449 }
13450
13451 function createTransformContext(root, {
13452 filename = "",
13453 prefixIdentifiers = false,
13454 hoistStatic: hoistStatic2 = false,
13455 hmr = false,
13456 cacheHandlers = false,
13457 nodeTransforms = [],
13458 directiveTransforms = {},
13459 transformHoist = null,
13460 isBuiltInComponent = NOOP,
13461 isCustomElement = NOOP,
13462 expressionPlugins = [],
13463 scopeId = null,
13464 slotted = true,
13465 ssr = false,
13466 inSSR = false,
13467 ssrCssVars = ``,
13468 bindingMetadata = EMPTY_OBJ,
13469 inline = false,
13470 isTS = false,
13471 onError = defaultOnError,
13472 onWarn = defaultOnWarn,
13473 compatConfig
13474 }) {
13475 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
13476 const context = {
13477 // options
13478 filename,
13479 selfName: nameMatch && capitalize(camelize(nameMatch[1])),
13480 prefixIdentifiers,
13481 hoistStatic: hoistStatic2,
13482 hmr,
13483 cacheHandlers,
13484 nodeTransforms,
13485 directiveTransforms,
13486 transformHoist,
13487 isBuiltInComponent,
13488 isCustomElement,
13489 expressionPlugins,
13490 scopeId,
13491 slotted,
13492 ssr,
13493 inSSR,
13494 ssrCssVars,
13495 bindingMetadata,
13496 inline,
13497 isTS,
13498 onError,
13499 onWarn,
13500 compatConfig,
13501 // state
13502 root,
13503 helpers: /* @__PURE__ */ new Map(),
13504 components: /* @__PURE__ */ new Set(),
13505 directives: /* @__PURE__ */ new Set(),
13506 hoists: [],
13507 imports: [],
13508 constantCache: /* @__PURE__ */ new WeakMap(),
13509 temps: 0,
13510 cached: 0,
13511 identifiers: /* @__PURE__ */ Object.create(null),
13512 scopes: {
13513 vFor: 0,
13514 vSlot: 0,
13515 vPre: 0,
13516 vOnce: 0
13517 },
13518 parent: null,
13519 grandParent: null,
13520 currentNode: root,
13521 childIndex: 0,
13522 inVOnce: false,
13523 // methods
13524 helper(name) {
13525 const count = context.helpers.get(name) || 0;
13526 context.helpers.set(name, count + 1);
13527 return name;
13528 },
13529 removeHelper(name) {
13530 const count = context.helpers.get(name);
13531 if (count) {
13532 const currentCount = count - 1;
13533 if (!currentCount) {
13534 context.helpers.delete(name);
13535 } else {
13536 context.helpers.set(name, currentCount);
13537 }
13538 }
13539 },
13540 helperString(name) {
13541 return `_${helperNameMap[context.helper(name)]}`;
13542 },
13543 replaceNode(node) {
13544 {
13545 if (!context.currentNode) {
13546 throw new Error(`Node being replaced is already removed.`);
13547 }
13548 if (!context.parent) {
13549 throw new Error(`Cannot replace root node.`);
13550 }
13551 }
13552 context.parent.children[context.childIndex] = context.currentNode = node;
13553 },
13554 removeNode(node) {
13555 if (!context.parent) {
13556 throw new Error(`Cannot remove root node.`);
13557 }
13558 const list = context.parent.children;
13559 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
13560 if (removalIndex < 0) {
13561 throw new Error(`node being removed is not a child of current parent`);
13562 }
13563 if (!node || node === context.currentNode) {
13564 context.currentNode = null;
13565 context.onNodeRemoved();
13566 } else {
13567 if (context.childIndex > removalIndex) {
13568 context.childIndex--;
13569 context.onNodeRemoved();
13570 }
13571 }
13572 context.parent.children.splice(removalIndex, 1);
13573 },
13574 onNodeRemoved: NOOP,
13575 addIdentifiers(exp) {
13576 },
13577 removeIdentifiers(exp) {
13578 },
13579 hoist(exp) {
13580 if (isString(exp))
13581 exp = createSimpleExpression(exp);
13582 context.hoists.push(exp);
13583 const identifier = createSimpleExpression(
13584 `_hoisted_${context.hoists.length}`,
13585 false,
13586 exp.loc,
13587 2
13588 );
13589 identifier.hoisted = exp;
13590 return identifier;
13591 },
13592 cache(exp, isVNode = false) {
13593 return createCacheExpression(context.cached++, exp, isVNode);
13594 }
13595 };
13596 return context;
13597 }
13598 function transform(root, options) {
13599 const context = createTransformContext(root, options);
13600 traverseNode(root, context);
13601 if (options.hoistStatic) {
13602 hoistStatic(root, context);
13603 }
13604 if (!options.ssr) {
13605 createRootCodegen(root, context);
13606 }
13607 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
13608 root.components = [...context.components];
13609 root.directives = [...context.directives];
13610 root.imports = context.imports;
13611 root.hoists = context.hoists;
13612 root.temps = context.temps;
13613 root.cached = context.cached;
13614 root.transformed = true;
13615 }
13616 function createRootCodegen(root, context) {
13617 const { helper } = context;
13618 const { children } = root;
13619 if (children.length === 1) {
13620 const child = children[0];
13621 if (isSingleElementRoot(root, child) && child.codegenNode) {
13622 const codegenNode = child.codegenNode;
13623 if (codegenNode.type === 13) {
13624 convertToBlock(codegenNode, context);
13625 }
13626 root.codegenNode = codegenNode;
13627 } else {
13628 root.codegenNode = child;
13629 }
13630 } else if (children.length > 1) {
13631 let patchFlag = 64;
13632 let patchFlagText = PatchFlagNames[64];
13633 if (children.filter((c) => c.type !== 3).length === 1) {
13634 patchFlag |= 2048;
13635 patchFlagText += `, ${PatchFlagNames[2048]}`;
13636 }
13637 root.codegenNode = createVNodeCall(
13638 context,
13639 helper(FRAGMENT),
13640 void 0,
13641 root.children,
13642 patchFlag + (` /* ${patchFlagText} */` ),
13643 void 0,
13644 void 0,
13645 true,
13646 void 0,
13647 false
13648 );
13649 } else ;
13650 }
13651 function traverseChildren(parent, context) {
13652 let i = 0;
13653 const nodeRemoved = () => {
13654 i--;
13655 };
13656 for (; i < parent.children.length; i++) {
13657 const child = parent.children[i];
13658 if (isString(child))
13659 continue;
13660 context.grandParent = context.parent;
13661 context.parent = parent;
13662 context.childIndex = i;
13663 context.onNodeRemoved = nodeRemoved;
13664 traverseNode(child, context);
13665 }
13666 }
13667 function traverseNode(node, context) {
13668 context.currentNode = node;
13669 const { nodeTransforms } = context;
13670 const exitFns = [];
13671 for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
13672 const onExit = nodeTransforms[i2](node, context);
13673 if (onExit) {
13674 if (isArray(onExit)) {
13675 exitFns.push(...onExit);
13676 } else {
13677 exitFns.push(onExit);
13678 }
13679 }
13680 if (!context.currentNode) {
13681 return;
13682 } else {
13683 node = context.currentNode;
13684 }
13685 }
13686 switch (node.type) {
13687 case 3:
13688 if (!context.ssr) {
13689 context.helper(CREATE_COMMENT);
13690 }
13691 break;
13692 case 5:
13693 if (!context.ssr) {
13694 context.helper(TO_DISPLAY_STRING);
13695 }
13696 break;
13697 case 9:
13698 for (let i2 = 0; i2 < node.branches.length; i2++) {
13699 traverseNode(node.branches[i2], context);
13700 }
13701 break;
13702 case 10:
13703 case 11:
13704 case 1:
13705 case 0:
13706 traverseChildren(node, context);
13707 break;
13708 }
13709 context.currentNode = node;
13710 let i = exitFns.length;
13711 while (i--) {
13712 exitFns[i]();
13713 }
13714 }
13715 function createStructuralDirectiveTransform(name, fn) {
13716 const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
13717 return (node, context) => {
13718 if (node.type === 1) {
13719 const { props } = node;
13720 if (node.tagType === 3 && props.some(isVSlot)) {
13721 return;
13722 }
13723 const exitFns = [];
13724 for (let i = 0; i < props.length; i++) {
13725 const prop = props[i];
13726 if (prop.type === 7 && matches(prop.name)) {
13727 props.splice(i, 1);
13728 i--;
13729 const onExit = fn(node, prop, context);
13730 if (onExit)
13731 exitFns.push(onExit);
13732 }
13733 }
13734 return exitFns;
13735 }
13736 };
13737 }
13738
13739 const PURE_ANNOTATION = `/*#__PURE__*/`;
13740 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
13741 function createCodegenContext(ast, {
13742 mode = "function",
13743 prefixIdentifiers = mode === "module",
13744 sourceMap = false,
13745 filename = `template.vue.html`,
13746 scopeId = null,
13747 optimizeImports = false,
13748 runtimeGlobalName = `Vue`,
13749 runtimeModuleName = `vue`,
13750 ssrRuntimeModuleName = "vue/server-renderer",
13751 ssr = false,
13752 isTS = false,
13753 inSSR = false
13754 }) {
13755 const context = {
13756 mode,
13757 prefixIdentifiers,
13758 sourceMap,
13759 filename,
13760 scopeId,
13761 optimizeImports,
13762 runtimeGlobalName,
13763 runtimeModuleName,
13764 ssrRuntimeModuleName,
13765 ssr,
13766 isTS,
13767 inSSR,
13768 source: ast.source,
13769 code: ``,
13770 column: 1,
13771 line: 1,
13772 offset: 0,
13773 indentLevel: 0,
13774 pure: false,
13775 map: void 0,
13776 helper(key) {
13777 return `_${helperNameMap[key]}`;
13778 },
13779 push(code, newlineIndex = -2 /* None */, node) {
13780 context.code += code;
13781 },
13782 indent() {
13783 newline(++context.indentLevel);
13784 },
13785 deindent(withoutNewLine = false) {
13786 if (withoutNewLine) {
13787 --context.indentLevel;
13788 } else {
13789 newline(--context.indentLevel);
13790 }
13791 },
13792 newline() {
13793 newline(context.indentLevel);
13794 }
13795 };
13796 function newline(n) {
13797 context.push("\n" + ` `.repeat(n), 0 /* Start */);
13798 }
13799 return context;
13800 }
13801 function generate(ast, options = {}) {
13802 const context = createCodegenContext(ast, options);
13803 if (options.onContextCreated)
13804 options.onContextCreated(context);
13805 const {
13806 mode,
13807 push,
13808 prefixIdentifiers,
13809 indent,
13810 deindent,
13811 newline,
13812 scopeId,
13813 ssr
13814 } = context;
13815 const helpers = Array.from(ast.helpers);
13816 const hasHelpers = helpers.length > 0;
13817 const useWithBlock = !prefixIdentifiers && mode !== "module";
13818 const preambleContext = context;
13819 {
13820 genFunctionPreamble(ast, preambleContext);
13821 }
13822 const functionName = ssr ? `ssrRender` : `render`;
13823 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
13824 const signature = args.join(", ");
13825 {
13826 push(`function ${functionName}(${signature}) {`);
13827 }
13828 indent();
13829 if (useWithBlock) {
13830 push(`with (_ctx) {`);
13831 indent();
13832 if (hasHelpers) {
13833 push(
13834 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
13835`,
13836 -1 /* End */
13837 );
13838 newline();
13839 }
13840 }
13841 if (ast.components.length) {
13842 genAssets(ast.components, "component", context);
13843 if (ast.directives.length || ast.temps > 0) {
13844 newline();
13845 }
13846 }
13847 if (ast.directives.length) {
13848 genAssets(ast.directives, "directive", context);
13849 if (ast.temps > 0) {
13850 newline();
13851 }
13852 }
13853 if (ast.temps > 0) {
13854 push(`let `);
13855 for (let i = 0; i < ast.temps; i++) {
13856 push(`${i > 0 ? `, ` : ``}_temp${i}`);
13857 }
13858 }
13859 if (ast.components.length || ast.directives.length || ast.temps) {
13860 push(`
13861`, 0 /* Start */);
13862 newline();
13863 }
13864 if (!ssr) {
13865 push(`return `);
13866 }
13867 if (ast.codegenNode) {
13868 genNode(ast.codegenNode, context);
13869 } else {
13870 push(`null`);
13871 }
13872 if (useWithBlock) {
13873 deindent();
13874 push(`}`);
13875 }
13876 deindent();
13877 push(`}`);
13878 return {
13879 ast,
13880 code: context.code,
13881 preamble: ``,
13882 map: context.map ? context.map.toJSON() : void 0
13883 };
13884 }
13885 function genFunctionPreamble(ast, context) {
13886 const {
13887 ssr,
13888 prefixIdentifiers,
13889 push,
13890 newline,
13891 runtimeModuleName,
13892 runtimeGlobalName,
13893 ssrRuntimeModuleName
13894 } = context;
13895 const VueBinding = runtimeGlobalName;
13896 const helpers = Array.from(ast.helpers);
13897 if (helpers.length > 0) {
13898 {
13899 push(`const _Vue = ${VueBinding}
13900`, -1 /* End */);
13901 if (ast.hoists.length) {
13902 const staticHelpers = [
13903 CREATE_VNODE,
13904 CREATE_ELEMENT_VNODE,
13905 CREATE_COMMENT,
13906 CREATE_TEXT,
13907 CREATE_STATIC
13908 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
13909 push(`const { ${staticHelpers} } = _Vue
13910`, -1 /* End */);
13911 }
13912 }
13913 }
13914 genHoists(ast.hoists, context);
13915 newline();
13916 push(`return `);
13917 }
13918 function genAssets(assets, type, { helper, push, newline, isTS }) {
13919 const resolver = helper(
13920 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
13921 );
13922 for (let i = 0; i < assets.length; i++) {
13923 let id = assets[i];
13924 const maybeSelfReference = id.endsWith("__self");
13925 if (maybeSelfReference) {
13926 id = id.slice(0, -6);
13927 }
13928 push(
13929 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
13930 );
13931 if (i < assets.length - 1) {
13932 newline();
13933 }
13934 }
13935 }
13936 function genHoists(hoists, context) {
13937 if (!hoists.length) {
13938 return;
13939 }
13940 context.pure = true;
13941 const { push, newline, helper, scopeId, mode } = context;
13942 newline();
13943 for (let i = 0; i < hoists.length; i++) {
13944 const exp = hoists[i];
13945 if (exp) {
13946 push(
13947 `const _hoisted_${i + 1} = ${``}`
13948 );
13949 genNode(exp, context);
13950 newline();
13951 }
13952 }
13953 context.pure = false;
13954 }
13955 function isText(n) {
13956 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
13957 }
13958 function genNodeListAsArray(nodes, context) {
13959 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
13960 context.push(`[`);
13961 multilines && context.indent();
13962 genNodeList(nodes, context, multilines);
13963 multilines && context.deindent();
13964 context.push(`]`);
13965 }
13966 function genNodeList(nodes, context, multilines = false, comma = true) {
13967 const { push, newline } = context;
13968 for (let i = 0; i < nodes.length; i++) {
13969 const node = nodes[i];
13970 if (isString(node)) {
13971 push(node, -3 /* Unknown */);
13972 } else if (isArray(node)) {
13973 genNodeListAsArray(node, context);
13974 } else {
13975 genNode(node, context);
13976 }
13977 if (i < nodes.length - 1) {
13978 if (multilines) {
13979 comma && push(",");
13980 newline();
13981 } else {
13982 comma && push(", ");
13983 }
13984 }
13985 }
13986 }
13987 function genNode(node, context) {
13988 if (isString(node)) {
13989 context.push(node, -3 /* Unknown */);
13990 return;
13991 }
13992 if (isSymbol(node)) {
13993 context.push(context.helper(node));
13994 return;
13995 }
13996 switch (node.type) {
13997 case 1:
13998 case 9:
13999 case 11:
14000 assert(
14001 node.codegenNode != null,
14002 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
14003 );
14004 genNode(node.codegenNode, context);
14005 break;
14006 case 2:
14007 genText(node, context);
14008 break;
14009 case 4:
14010 genExpression(node, context);
14011 break;
14012 case 5:
14013 genInterpolation(node, context);
14014 break;
14015 case 12:
14016 genNode(node.codegenNode, context);
14017 break;
14018 case 8:
14019 genCompoundExpression(node, context);
14020 break;
14021 case 3:
14022 genComment(node, context);
14023 break;
14024 case 13:
14025 genVNodeCall(node, context);
14026 break;
14027 case 14:
14028 genCallExpression(node, context);
14029 break;
14030 case 15:
14031 genObjectExpression(node, context);
14032 break;
14033 case 17:
14034 genArrayExpression(node, context);
14035 break;
14036 case 18:
14037 genFunctionExpression(node, context);
14038 break;
14039 case 19:
14040 genConditionalExpression(node, context);
14041 break;
14042 case 20:
14043 genCacheExpression(node, context);
14044 break;
14045 case 21:
14046 genNodeList(node.body, context, true, false);
14047 break;
14048 case 22:
14049 break;
14050 case 23:
14051 break;
14052 case 24:
14053 break;
14054 case 25:
14055 break;
14056 case 26:
14057 break;
14058 case 10:
14059 break;
14060 default:
14061 {
14062 assert(false, `unhandled codegen node type: ${node.type}`);
14063 const exhaustiveCheck = node;
14064 return exhaustiveCheck;
14065 }
14066 }
14067 }
14068 function genText(node, context) {
14069 context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
14070 }
14071 function genExpression(node, context) {
14072 const { content, isStatic } = node;
14073 context.push(
14074 isStatic ? JSON.stringify(content) : content,
14075 -3 /* Unknown */,
14076 node
14077 );
14078 }
14079 function genInterpolation(node, context) {
14080 const { push, helper, pure } = context;
14081 if (pure)
14082 push(PURE_ANNOTATION);
14083 push(`${helper(TO_DISPLAY_STRING)}(`);
14084 genNode(node.content, context);
14085 push(`)`);
14086 }
14087 function genCompoundExpression(node, context) {
14088 for (let i = 0; i < node.children.length; i++) {
14089 const child = node.children[i];
14090 if (isString(child)) {
14091 context.push(child, -3 /* Unknown */);
14092 } else {
14093 genNode(child, context);
14094 }
14095 }
14096 }
14097 function genExpressionAsPropertyKey(node, context) {
14098 const { push } = context;
14099 if (node.type === 8) {
14100 push(`[`);
14101 genCompoundExpression(node, context);
14102 push(`]`);
14103 } else if (node.isStatic) {
14104 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
14105 push(text, -2 /* None */, node);
14106 } else {
14107 push(`[${node.content}]`, -3 /* Unknown */, node);
14108 }
14109 }
14110 function genComment(node, context) {
14111 const { push, helper, pure } = context;
14112 if (pure) {
14113 push(PURE_ANNOTATION);
14114 }
14115 push(
14116 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
14117 -3 /* Unknown */,
14118 node
14119 );
14120 }
14121 function genVNodeCall(node, context) {
14122 const { push, helper, pure } = context;
14123 const {
14124 tag,
14125 props,
14126 children,
14127 patchFlag,
14128 dynamicProps,
14129 directives,
14130 isBlock,
14131 disableTracking,
14132 isComponent
14133 } = node;
14134 if (directives) {
14135 push(helper(WITH_DIRECTIVES) + `(`);
14136 }
14137 if (isBlock) {
14138 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
14139 }
14140 if (pure) {
14141 push(PURE_ANNOTATION);
14142 }
14143 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
14144 push(helper(callHelper) + `(`, -2 /* None */, node);
14145 genNodeList(
14146 genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
14147 context
14148 );
14149 push(`)`);
14150 if (isBlock) {
14151 push(`)`);
14152 }
14153 if (directives) {
14154 push(`, `);
14155 genNode(directives, context);
14156 push(`)`);
14157 }
14158 }
14159 function genNullableArgs(args) {
14160 let i = args.length;
14161 while (i--) {
14162 if (args[i] != null)
14163 break;
14164 }
14165 return args.slice(0, i + 1).map((arg) => arg || `null`);
14166 }
14167 function genCallExpression(node, context) {
14168 const { push, helper, pure } = context;
14169 const callee = isString(node.callee) ? node.callee : helper(node.callee);
14170 if (pure) {
14171 push(PURE_ANNOTATION);
14172 }
14173 push(callee + `(`, -2 /* None */, node);
14174 genNodeList(node.arguments, context);
14175 push(`)`);
14176 }
14177 function genObjectExpression(node, context) {
14178 const { push, indent, deindent, newline } = context;
14179 const { properties } = node;
14180 if (!properties.length) {
14181 push(`{}`, -2 /* None */, node);
14182 return;
14183 }
14184 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
14185 push(multilines ? `{` : `{ `);
14186 multilines && indent();
14187 for (let i = 0; i < properties.length; i++) {
14188 const { key, value } = properties[i];
14189 genExpressionAsPropertyKey(key, context);
14190 push(`: `);
14191 genNode(value, context);
14192 if (i < properties.length - 1) {
14193 push(`,`);
14194 newline();
14195 }
14196 }
14197 multilines && deindent();
14198 push(multilines ? `}` : ` }`);
14199 }
14200 function genArrayExpression(node, context) {
14201 genNodeListAsArray(node.elements, context);
14202 }
14203 function genFunctionExpression(node, context) {
14204 const { push, indent, deindent } = context;
14205 const { params, returns, body, newline, isSlot } = node;
14206 if (isSlot) {
14207 push(`_${helperNameMap[WITH_CTX]}(`);
14208 }
14209 push(`(`, -2 /* None */, node);
14210 if (isArray(params)) {
14211 genNodeList(params, context);
14212 } else if (params) {
14213 genNode(params, context);
14214 }
14215 push(`) => `);
14216 if (newline || body) {
14217 push(`{`);
14218 indent();
14219 }
14220 if (returns) {
14221 if (newline) {
14222 push(`return `);
14223 }
14224 if (isArray(returns)) {
14225 genNodeListAsArray(returns, context);
14226 } else {
14227 genNode(returns, context);
14228 }
14229 } else if (body) {
14230 genNode(body, context);
14231 }
14232 if (newline || body) {
14233 deindent();
14234 push(`}`);
14235 }
14236 if (isSlot) {
14237 push(`)`);
14238 }
14239 }
14240 function genConditionalExpression(node, context) {
14241 const { test, consequent, alternate, newline: needNewline } = node;
14242 const { push, indent, deindent, newline } = context;
14243 if (test.type === 4) {
14244 const needsParens = !isSimpleIdentifier(test.content);
14245 needsParens && push(`(`);
14246 genExpression(test, context);
14247 needsParens && push(`)`);
14248 } else {
14249 push(`(`);
14250 genNode(test, context);
14251 push(`)`);
14252 }
14253 needNewline && indent();
14254 context.indentLevel++;
14255 needNewline || push(` `);
14256 push(`? `);
14257 genNode(consequent, context);
14258 context.indentLevel--;
14259 needNewline && newline();
14260 needNewline || push(` `);
14261 push(`: `);
14262 const isNested = alternate.type === 19;
14263 if (!isNested) {
14264 context.indentLevel++;
14265 }
14266 genNode(alternate, context);
14267 if (!isNested) {
14268 context.indentLevel--;
14269 }
14270 needNewline && deindent(
14271 true
14272 /* without newline */
14273 );
14274 }
14275 function genCacheExpression(node, context) {
14276 const { push, helper, indent, deindent, newline } = context;
14277 push(`_cache[${node.index}] || (`);
14278 if (node.isVNode) {
14279 indent();
14280 push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
14281 newline();
14282 }
14283 push(`_cache[${node.index}] = `);
14284 genNode(node.value, context);
14285 if (node.isVNode) {
14286 push(`,`);
14287 newline();
14288 push(`${helper(SET_BLOCK_TRACKING)}(1),`);
14289 newline();
14290 push(`_cache[${node.index}]`);
14291 deindent();
14292 }
14293 push(`)`);
14294 }
14295
14296 const prohibitedKeywordRE = new RegExp(
14297 "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
14298 );
14299 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
14300 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
14301 const exp = node.content;
14302 if (!exp.trim()) {
14303 return;
14304 }
14305 try {
14306 new Function(
14307 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
14308 );
14309 } catch (e) {
14310 let message = e.message;
14311 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
14312 if (keywordMatch) {
14313 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
14314 }
14315 context.onError(
14316 createCompilerError(
14317 45,
14318 node.loc,
14319 void 0,
14320 message
14321 )
14322 );
14323 }
14324 }
14325
14326 const transformExpression = (node, context) => {
14327 if (node.type === 5) {
14328 node.content = processExpression(
14329 node.content,
14330 context
14331 );
14332 } else if (node.type === 1) {
14333 for (let i = 0; i < node.props.length; i++) {
14334 const dir = node.props[i];
14335 if (dir.type === 7 && dir.name !== "for") {
14336 const exp = dir.exp;
14337 const arg = dir.arg;
14338 if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
14339 dir.exp = processExpression(
14340 exp,
14341 context,
14342 // slot args must be processed as function params
14343 dir.name === "slot"
14344 );
14345 }
14346 if (arg && arg.type === 4 && !arg.isStatic) {
14347 dir.arg = processExpression(arg, context);
14348 }
14349 }
14350 }
14351 }
14352 };
14353 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
14354 {
14355 {
14356 validateBrowserExpression(node, context, asParams, asRawStatements);
14357 }
14358 return node;
14359 }
14360 }
14361
14362 const transformIf = createStructuralDirectiveTransform(
14363 /^(if|else|else-if)$/,
14364 (node, dir, context) => {
14365 return processIf(node, dir, context, (ifNode, branch, isRoot) => {
14366 const siblings = context.parent.children;
14367 let i = siblings.indexOf(ifNode);
14368 let key = 0;
14369 while (i-- >= 0) {
14370 const sibling = siblings[i];
14371 if (sibling && sibling.type === 9) {
14372 key += sibling.branches.length;
14373 }
14374 }
14375 return () => {
14376 if (isRoot) {
14377 ifNode.codegenNode = createCodegenNodeForBranch(
14378 branch,
14379 key,
14380 context
14381 );
14382 } else {
14383 const parentCondition = getParentCondition(ifNode.codegenNode);
14384 parentCondition.alternate = createCodegenNodeForBranch(
14385 branch,
14386 key + ifNode.branches.length - 1,
14387 context
14388 );
14389 }
14390 };
14391 });
14392 }
14393 );
14394 function processIf(node, dir, context, processCodegen) {
14395 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
14396 const loc = dir.exp ? dir.exp.loc : node.loc;
14397 context.onError(
14398 createCompilerError(28, dir.loc)
14399 );
14400 dir.exp = createSimpleExpression(`true`, false, loc);
14401 }
14402 if (dir.exp) {
14403 validateBrowserExpression(dir.exp, context);
14404 }
14405 if (dir.name === "if") {
14406 const branch = createIfBranch(node, dir);
14407 const ifNode = {
14408 type: 9,
14409 loc: node.loc,
14410 branches: [branch]
14411 };
14412 context.replaceNode(ifNode);
14413 if (processCodegen) {
14414 return processCodegen(ifNode, branch, true);
14415 }
14416 } else {
14417 const siblings = context.parent.children;
14418 const comments = [];
14419 let i = siblings.indexOf(node);
14420 while (i-- >= -1) {
14421 const sibling = siblings[i];
14422 if (sibling && sibling.type === 3) {
14423 context.removeNode(sibling);
14424 comments.unshift(sibling);
14425 continue;
14426 }
14427 if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
14428 context.removeNode(sibling);
14429 continue;
14430 }
14431 if (sibling && sibling.type === 9) {
14432 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
14433 context.onError(
14434 createCompilerError(30, node.loc)
14435 );
14436 }
14437 context.removeNode();
14438 const branch = createIfBranch(node, dir);
14439 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
14440 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
14441 branch.children = [...comments, ...branch.children];
14442 }
14443 {
14444 const key = branch.userKey;
14445 if (key) {
14446 sibling.branches.forEach(({ userKey }) => {
14447 if (isSameKey(userKey, key)) {
14448 context.onError(
14449 createCompilerError(
14450 29,
14451 branch.userKey.loc
14452 )
14453 );
14454 }
14455 });
14456 }
14457 }
14458 sibling.branches.push(branch);
14459 const onExit = processCodegen && processCodegen(sibling, branch, false);
14460 traverseNode(branch, context);
14461 if (onExit)
14462 onExit();
14463 context.currentNode = null;
14464 } else {
14465 context.onError(
14466 createCompilerError(30, node.loc)
14467 );
14468 }
14469 break;
14470 }
14471 }
14472 }
14473 function createIfBranch(node, dir) {
14474 const isTemplateIf = node.tagType === 3;
14475 return {
14476 type: 10,
14477 loc: node.loc,
14478 condition: dir.name === "else" ? void 0 : dir.exp,
14479 children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
14480 userKey: findProp(node, `key`),
14481 isTemplateIf
14482 };
14483 }
14484 function createCodegenNodeForBranch(branch, keyIndex, context) {
14485 if (branch.condition) {
14486 return createConditionalExpression(
14487 branch.condition,
14488 createChildrenCodegenNode(branch, keyIndex, context),
14489 // make sure to pass in asBlock: true so that the comment node call
14490 // closes the current block.
14491 createCallExpression(context.helper(CREATE_COMMENT), [
14492 '"v-if"' ,
14493 "true"
14494 ])
14495 );
14496 } else {
14497 return createChildrenCodegenNode(branch, keyIndex, context);
14498 }
14499 }
14500 function createChildrenCodegenNode(branch, keyIndex, context) {
14501 const { helper } = context;
14502 const keyProperty = createObjectProperty(
14503 `key`,
14504 createSimpleExpression(
14505 `${keyIndex}`,
14506 false,
14507 locStub,
14508 2
14509 )
14510 );
14511 const { children } = branch;
14512 const firstChild = children[0];
14513 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
14514 if (needFragmentWrapper) {
14515 if (children.length === 1 && firstChild.type === 11) {
14516 const vnodeCall = firstChild.codegenNode;
14517 injectProp(vnodeCall, keyProperty, context);
14518 return vnodeCall;
14519 } else {
14520 let patchFlag = 64;
14521 let patchFlagText = PatchFlagNames[64];
14522 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
14523 patchFlag |= 2048;
14524 patchFlagText += `, ${PatchFlagNames[2048]}`;
14525 }
14526 return createVNodeCall(
14527 context,
14528 helper(FRAGMENT),
14529 createObjectExpression([keyProperty]),
14530 children,
14531 patchFlag + (` /* ${patchFlagText} */` ),
14532 void 0,
14533 void 0,
14534 true,
14535 false,
14536 false,
14537 branch.loc
14538 );
14539 }
14540 } else {
14541 const ret = firstChild.codegenNode;
14542 const vnodeCall = getMemoedVNodeCall(ret);
14543 if (vnodeCall.type === 13) {
14544 convertToBlock(vnodeCall, context);
14545 }
14546 injectProp(vnodeCall, keyProperty, context);
14547 return ret;
14548 }
14549 }
14550 function isSameKey(a, b) {
14551 if (!a || a.type !== b.type) {
14552 return false;
14553 }
14554 if (a.type === 6) {
14555 if (a.value.content !== b.value.content) {
14556 return false;
14557 }
14558 } else {
14559 const exp = a.exp;
14560 const branchExp = b.exp;
14561 if (exp.type !== branchExp.type) {
14562 return false;
14563 }
14564 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
14565 return false;
14566 }
14567 }
14568 return true;
14569 }
14570 function getParentCondition(node) {
14571 while (true) {
14572 if (node.type === 19) {
14573 if (node.alternate.type === 19) {
14574 node = node.alternate;
14575 } else {
14576 return node;
14577 }
14578 } else if (node.type === 20) {
14579 node = node.value;
14580 }
14581 }
14582 }
14583
14584 const transformFor = createStructuralDirectiveTransform(
14585 "for",
14586 (node, dir, context) => {
14587 const { helper, removeHelper } = context;
14588 return processFor(node, dir, context, (forNode) => {
14589 const renderExp = createCallExpression(helper(RENDER_LIST), [
14590 forNode.source
14591 ]);
14592 const isTemplate = isTemplateNode(node);
14593 const memo = findDir(node, "memo");
14594 const keyProp = findProp(node, `key`);
14595 const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
14596 const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
14597 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
14598 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
14599 forNode.codegenNode = createVNodeCall(
14600 context,
14601 helper(FRAGMENT),
14602 void 0,
14603 renderExp,
14604 fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ),
14605 void 0,
14606 void 0,
14607 true,
14608 !isStableFragment,
14609 false,
14610 node.loc
14611 );
14612 return () => {
14613 let childBlock;
14614 const { children } = forNode;
14615 if (isTemplate) {
14616 node.children.some((c) => {
14617 if (c.type === 1) {
14618 const key = findProp(c, "key");
14619 if (key) {
14620 context.onError(
14621 createCompilerError(
14622 33,
14623 key.loc
14624 )
14625 );
14626 return true;
14627 }
14628 }
14629 });
14630 }
14631 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
14632 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
14633 if (slotOutlet) {
14634 childBlock = slotOutlet.codegenNode;
14635 if (isTemplate && keyProperty) {
14636 injectProp(childBlock, keyProperty, context);
14637 }
14638 } else if (needFragmentWrapper) {
14639 childBlock = createVNodeCall(
14640 context,
14641 helper(FRAGMENT),
14642 keyProperty ? createObjectExpression([keyProperty]) : void 0,
14643 node.children,
14644 64 + (` /* ${PatchFlagNames[64]} */` ),
14645 void 0,
14646 void 0,
14647 true,
14648 void 0,
14649 false
14650 );
14651 } else {
14652 childBlock = children[0].codegenNode;
14653 if (isTemplate && keyProperty) {
14654 injectProp(childBlock, keyProperty, context);
14655 }
14656 if (childBlock.isBlock !== !isStableFragment) {
14657 if (childBlock.isBlock) {
14658 removeHelper(OPEN_BLOCK);
14659 removeHelper(
14660 getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
14661 );
14662 } else {
14663 removeHelper(
14664 getVNodeHelper(context.inSSR, childBlock.isComponent)
14665 );
14666 }
14667 }
14668 childBlock.isBlock = !isStableFragment;
14669 if (childBlock.isBlock) {
14670 helper(OPEN_BLOCK);
14671 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14672 } else {
14673 helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14674 }
14675 }
14676 if (memo) {
14677 const loop = createFunctionExpression(
14678 createForLoopParams(forNode.parseResult, [
14679 createSimpleExpression(`_cached`)
14680 ])
14681 );
14682 loop.body = createBlockStatement([
14683 createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
14684 createCompoundExpression([
14685 `if (_cached`,
14686 ...keyExp ? [` && _cached.key === `, keyExp] : [],
14687 ` && ${context.helperString(
14688 IS_MEMO_SAME
14689 )}(_cached, _memo)) return _cached`
14690 ]),
14691 createCompoundExpression([`const _item = `, childBlock]),
14692 createSimpleExpression(`_item.memo = _memo`),
14693 createSimpleExpression(`return _item`)
14694 ]);
14695 renderExp.arguments.push(
14696 loop,
14697 createSimpleExpression(`_cache`),
14698 createSimpleExpression(String(context.cached++))
14699 );
14700 } else {
14701 renderExp.arguments.push(
14702 createFunctionExpression(
14703 createForLoopParams(forNode.parseResult),
14704 childBlock,
14705 true
14706 )
14707 );
14708 }
14709 };
14710 });
14711 }
14712 );
14713 function processFor(node, dir, context, processCodegen) {
14714 if (!dir.exp) {
14715 context.onError(
14716 createCompilerError(31, dir.loc)
14717 );
14718 return;
14719 }
14720 const parseResult = dir.forParseResult;
14721 if (!parseResult) {
14722 context.onError(
14723 createCompilerError(32, dir.loc)
14724 );
14725 return;
14726 }
14727 finalizeForParseResult(parseResult, context);
14728 const { addIdentifiers, removeIdentifiers, scopes } = context;
14729 const { source, value, key, index } = parseResult;
14730 const forNode = {
14731 type: 11,
14732 loc: dir.loc,
14733 source,
14734 valueAlias: value,
14735 keyAlias: key,
14736 objectIndexAlias: index,
14737 parseResult,
14738 children: isTemplateNode(node) ? node.children : [node]
14739 };
14740 context.replaceNode(forNode);
14741 scopes.vFor++;
14742 const onExit = processCodegen && processCodegen(forNode);
14743 return () => {
14744 scopes.vFor--;
14745 if (onExit)
14746 onExit();
14747 };
14748 }
14749 function finalizeForParseResult(result, context) {
14750 if (result.finalized)
14751 return;
14752 {
14753 validateBrowserExpression(result.source, context);
14754 if (result.key) {
14755 validateBrowserExpression(
14756 result.key,
14757 context,
14758 true
14759 );
14760 }
14761 if (result.index) {
14762 validateBrowserExpression(
14763 result.index,
14764 context,
14765 true
14766 );
14767 }
14768 if (result.value) {
14769 validateBrowserExpression(
14770 result.value,
14771 context,
14772 true
14773 );
14774 }
14775 }
14776 result.finalized = true;
14777 }
14778 function createForLoopParams({ value, key, index }, memoArgs = []) {
14779 return createParamsList([value, key, index, ...memoArgs]);
14780 }
14781 function createParamsList(args) {
14782 let i = args.length;
14783 while (i--) {
14784 if (args[i])
14785 break;
14786 }
14787 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
14788 }
14789
14790 const defaultFallback = createSimpleExpression(`undefined`, false);
14791 const trackSlotScopes = (node, context) => {
14792 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
14793 const vSlot = findDir(node, "slot");
14794 if (vSlot) {
14795 vSlot.exp;
14796 context.scopes.vSlot++;
14797 return () => {
14798 context.scopes.vSlot--;
14799 };
14800 }
14801 }
14802 };
14803 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
14804 props,
14805 children,
14806 false,
14807 true,
14808 children.length ? children[0].loc : loc
14809 );
14810 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14811 context.helper(WITH_CTX);
14812 const { children, loc } = node;
14813 const slotsProperties = [];
14814 const dynamicSlots = [];
14815 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
14816 const onComponentSlot = findDir(node, "slot", true);
14817 if (onComponentSlot) {
14818 const { arg, exp } = onComponentSlot;
14819 if (arg && !isStaticExp(arg)) {
14820 hasDynamicSlots = true;
14821 }
14822 slotsProperties.push(
14823 createObjectProperty(
14824 arg || createSimpleExpression("default", true),
14825 buildSlotFn(exp, void 0, children, loc)
14826 )
14827 );
14828 }
14829 let hasTemplateSlots = false;
14830 let hasNamedDefaultSlot = false;
14831 const implicitDefaultChildren = [];
14832 const seenSlotNames = /* @__PURE__ */ new Set();
14833 let conditionalBranchIndex = 0;
14834 for (let i = 0; i < children.length; i++) {
14835 const slotElement = children[i];
14836 let slotDir;
14837 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
14838 if (slotElement.type !== 3) {
14839 implicitDefaultChildren.push(slotElement);
14840 }
14841 continue;
14842 }
14843 if (onComponentSlot) {
14844 context.onError(
14845 createCompilerError(37, slotDir.loc)
14846 );
14847 break;
14848 }
14849 hasTemplateSlots = true;
14850 const { children: slotChildren, loc: slotLoc } = slotElement;
14851 const {
14852 arg: slotName = createSimpleExpression(`default`, true),
14853 exp: slotProps,
14854 loc: dirLoc
14855 } = slotDir;
14856 let staticSlotName;
14857 if (isStaticExp(slotName)) {
14858 staticSlotName = slotName ? slotName.content : `default`;
14859 } else {
14860 hasDynamicSlots = true;
14861 }
14862 const vFor = findDir(slotElement, "for");
14863 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
14864 let vIf;
14865 let vElse;
14866 if (vIf = findDir(slotElement, "if")) {
14867 hasDynamicSlots = true;
14868 dynamicSlots.push(
14869 createConditionalExpression(
14870 vIf.exp,
14871 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
14872 defaultFallback
14873 )
14874 );
14875 } else if (vElse = findDir(
14876 slotElement,
14877 /^else(-if)?$/,
14878 true
14879 /* allowEmpty */
14880 )) {
14881 let j = i;
14882 let prev;
14883 while (j--) {
14884 prev = children[j];
14885 if (prev.type !== 3) {
14886 break;
14887 }
14888 }
14889 if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
14890 children.splice(i, 1);
14891 i--;
14892 let conditional = dynamicSlots[dynamicSlots.length - 1];
14893 while (conditional.alternate.type === 19) {
14894 conditional = conditional.alternate;
14895 }
14896 conditional.alternate = vElse.exp ? createConditionalExpression(
14897 vElse.exp,
14898 buildDynamicSlot(
14899 slotName,
14900 slotFunction,
14901 conditionalBranchIndex++
14902 ),
14903 defaultFallback
14904 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
14905 } else {
14906 context.onError(
14907 createCompilerError(30, vElse.loc)
14908 );
14909 }
14910 } else if (vFor) {
14911 hasDynamicSlots = true;
14912 const parseResult = vFor.forParseResult;
14913 if (parseResult) {
14914 finalizeForParseResult(parseResult, context);
14915 dynamicSlots.push(
14916 createCallExpression(context.helper(RENDER_LIST), [
14917 parseResult.source,
14918 createFunctionExpression(
14919 createForLoopParams(parseResult),
14920 buildDynamicSlot(slotName, slotFunction),
14921 true
14922 )
14923 ])
14924 );
14925 } else {
14926 context.onError(
14927 createCompilerError(
14928 32,
14929 vFor.loc
14930 )
14931 );
14932 }
14933 } else {
14934 if (staticSlotName) {
14935 if (seenSlotNames.has(staticSlotName)) {
14936 context.onError(
14937 createCompilerError(
14938 38,
14939 dirLoc
14940 )
14941 );
14942 continue;
14943 }
14944 seenSlotNames.add(staticSlotName);
14945 if (staticSlotName === "default") {
14946 hasNamedDefaultSlot = true;
14947 }
14948 }
14949 slotsProperties.push(createObjectProperty(slotName, slotFunction));
14950 }
14951 }
14952 if (!onComponentSlot) {
14953 const buildDefaultSlotProperty = (props, children2) => {
14954 const fn = buildSlotFn(props, void 0, children2, loc);
14955 return createObjectProperty(`default`, fn);
14956 };
14957 if (!hasTemplateSlots) {
14958 slotsProperties.push(buildDefaultSlotProperty(void 0, children));
14959 } else if (implicitDefaultChildren.length && // #3766
14960 // with whitespace: 'preserve', whitespaces between slots will end up in
14961 // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
14962 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
14963 if (hasNamedDefaultSlot) {
14964 context.onError(
14965 createCompilerError(
14966 39,
14967 implicitDefaultChildren[0].loc
14968 )
14969 );
14970 } else {
14971 slotsProperties.push(
14972 buildDefaultSlotProperty(void 0, implicitDefaultChildren)
14973 );
14974 }
14975 }
14976 }
14977 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
14978 let slots = createObjectExpression(
14979 slotsProperties.concat(
14980 createObjectProperty(
14981 `_`,
14982 // 2 = compiled but dynamic = can skip normalization, but must run diff
14983 // 1 = compiled and static = can skip normalization AND diff as optimized
14984 createSimpleExpression(
14985 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
14986 false
14987 )
14988 )
14989 ),
14990 loc
14991 );
14992 if (dynamicSlots.length) {
14993 slots = createCallExpression(context.helper(CREATE_SLOTS), [
14994 slots,
14995 createArrayExpression(dynamicSlots)
14996 ]);
14997 }
14998 return {
14999 slots,
15000 hasDynamicSlots
15001 };
15002 }
15003 function buildDynamicSlot(name, fn, index) {
15004 const props = [
15005 createObjectProperty(`name`, name),
15006 createObjectProperty(`fn`, fn)
15007 ];
15008 if (index != null) {
15009 props.push(
15010 createObjectProperty(`key`, createSimpleExpression(String(index), true))
15011 );
15012 }
15013 return createObjectExpression(props);
15014 }
15015 function hasForwardedSlots(children) {
15016 for (let i = 0; i < children.length; i++) {
15017 const child = children[i];
15018 switch (child.type) {
15019 case 1:
15020 if (child.tagType === 2 || hasForwardedSlots(child.children)) {
15021 return true;
15022 }
15023 break;
15024 case 9:
15025 if (hasForwardedSlots(child.branches))
15026 return true;
15027 break;
15028 case 10:
15029 case 11:
15030 if (hasForwardedSlots(child.children))
15031 return true;
15032 break;
15033 }
15034 }
15035 return false;
15036 }
15037 function isNonWhitespaceContent(node) {
15038 if (node.type !== 2 && node.type !== 12)
15039 return true;
15040 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
15041 }
15042
15043 const directiveImportMap = /* @__PURE__ */ new WeakMap();
15044 const transformElement = (node, context) => {
15045 return function postTransformElement() {
15046 node = context.currentNode;
15047 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
15048 return;
15049 }
15050 const { tag, props } = node;
15051 const isComponent = node.tagType === 1;
15052 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
15053 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
15054 let vnodeProps;
15055 let vnodeChildren;
15056 let vnodePatchFlag;
15057 let patchFlag = 0;
15058 let vnodeDynamicProps;
15059 let dynamicPropNames;
15060 let vnodeDirectives;
15061 let shouldUseBlock = (
15062 // dynamic component may resolve to plain elements
15063 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
15064 // updates inside get proper isSVG flag at runtime. (#639, #643)
15065 // This is technically web-specific, but splitting the logic out of core
15066 // leads to too much unnecessary complexity.
15067 (tag === "svg" || tag === "foreignObject")
15068 );
15069 if (props.length > 0) {
15070 const propsBuildResult = buildProps(
15071 node,
15072 context,
15073 void 0,
15074 isComponent,
15075 isDynamicComponent
15076 );
15077 vnodeProps = propsBuildResult.props;
15078 patchFlag = propsBuildResult.patchFlag;
15079 dynamicPropNames = propsBuildResult.dynamicPropNames;
15080 const directives = propsBuildResult.directives;
15081 vnodeDirectives = directives && directives.length ? createArrayExpression(
15082 directives.map((dir) => buildDirectiveArgs(dir, context))
15083 ) : void 0;
15084 if (propsBuildResult.shouldUseBlock) {
15085 shouldUseBlock = true;
15086 }
15087 }
15088 if (node.children.length > 0) {
15089 if (vnodeTag === KEEP_ALIVE) {
15090 shouldUseBlock = true;
15091 patchFlag |= 1024;
15092 if (node.children.length > 1) {
15093 context.onError(
15094 createCompilerError(46, {
15095 start: node.children[0].loc.start,
15096 end: node.children[node.children.length - 1].loc.end,
15097 source: ""
15098 })
15099 );
15100 }
15101 }
15102 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
15103 vnodeTag !== TELEPORT && // explained above.
15104 vnodeTag !== KEEP_ALIVE;
15105 if (shouldBuildAsSlots) {
15106 const { slots, hasDynamicSlots } = buildSlots(node, context);
15107 vnodeChildren = slots;
15108 if (hasDynamicSlots) {
15109 patchFlag |= 1024;
15110 }
15111 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
15112 const child = node.children[0];
15113 const type = child.type;
15114 const hasDynamicTextChild = type === 5 || type === 8;
15115 if (hasDynamicTextChild && getConstantType(child, context) === 0) {
15116 patchFlag |= 1;
15117 }
15118 if (hasDynamicTextChild || type === 2) {
15119 vnodeChildren = child;
15120 } else {
15121 vnodeChildren = node.children;
15122 }
15123 } else {
15124 vnodeChildren = node.children;
15125 }
15126 }
15127 if (patchFlag !== 0) {
15128 {
15129 if (patchFlag < 0) {
15130 vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
15131 } else {
15132 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
15133 vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
15134 }
15135 }
15136 if (dynamicPropNames && dynamicPropNames.length) {
15137 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15138 }
15139 }
15140 node.codegenNode = createVNodeCall(
15141 context,
15142 vnodeTag,
15143 vnodeProps,
15144 vnodeChildren,
15145 vnodePatchFlag,
15146 vnodeDynamicProps,
15147 vnodeDirectives,
15148 !!shouldUseBlock,
15149 false,
15150 isComponent,
15151 node.loc
15152 );
15153 };
15154 };
15155 function resolveComponentType(node, context, ssr = false) {
15156 let { tag } = node;
15157 const isExplicitDynamic = isComponentTag(tag);
15158 const isProp = findProp(
15159 node,
15160 "is",
15161 false,
15162 true
15163 /* allow empty */
15164 );
15165 if (isProp) {
15166 if (isExplicitDynamic || false) {
15167 let exp;
15168 if (isProp.type === 6) {
15169 exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15170 } else {
15171 exp = isProp.exp;
15172 if (!exp) {
15173 exp = createSimpleExpression(`is`, false, isProp.loc);
15174 }
15175 }
15176 if (exp) {
15177 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15178 exp
15179 ]);
15180 }
15181 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
15182 tag = isProp.value.content.slice(4);
15183 }
15184 }
15185 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
15186 if (builtIn) {
15187 if (!ssr)
15188 context.helper(builtIn);
15189 return builtIn;
15190 }
15191 context.helper(RESOLVE_COMPONENT);
15192 context.components.add(tag);
15193 return toValidAssetId(tag, `component`);
15194 }
15195 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
15196 const { tag, loc: elementLoc, children } = node;
15197 let properties = [];
15198 const mergeArgs = [];
15199 const runtimeDirectives = [];
15200 const hasChildren = children.length > 0;
15201 let shouldUseBlock = false;
15202 let patchFlag = 0;
15203 let hasRef = false;
15204 let hasClassBinding = false;
15205 let hasStyleBinding = false;
15206 let hasHydrationEventBinding = false;
15207 let hasDynamicKeys = false;
15208 let hasVnodeHook = false;
15209 const dynamicPropNames = [];
15210 const pushMergeArg = (arg) => {
15211 if (properties.length) {
15212 mergeArgs.push(
15213 createObjectExpression(dedupeProperties(properties), elementLoc)
15214 );
15215 properties = [];
15216 }
15217 if (arg)
15218 mergeArgs.push(arg);
15219 };
15220 const pushRefVForMarker = () => {
15221 if (context.scopes.vFor > 0) {
15222 properties.push(
15223 createObjectProperty(
15224 createSimpleExpression("ref_for", true),
15225 createSimpleExpression("true")
15226 )
15227 );
15228 }
15229 };
15230 const analyzePatchFlag = ({ key, value }) => {
15231 if (isStaticExp(key)) {
15232 const name = key.content;
15233 const isEventHandler = isOn(name);
15234 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
15235 // dedicated fast path.
15236 name.toLowerCase() !== "onclick" && // omit v-model handlers
15237 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
15238 !isReservedProp(name)) {
15239 hasHydrationEventBinding = true;
15240 }
15241 if (isEventHandler && isReservedProp(name)) {
15242 hasVnodeHook = true;
15243 }
15244 if (isEventHandler && value.type === 14) {
15245 value = value.arguments[0];
15246 }
15247 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
15248 return;
15249 }
15250 if (name === "ref") {
15251 hasRef = true;
15252 } else if (name === "class") {
15253 hasClassBinding = true;
15254 } else if (name === "style") {
15255 hasStyleBinding = true;
15256 } else if (name !== "key" && !dynamicPropNames.includes(name)) {
15257 dynamicPropNames.push(name);
15258 }
15259 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
15260 dynamicPropNames.push(name);
15261 }
15262 } else {
15263 hasDynamicKeys = true;
15264 }
15265 };
15266 for (let i = 0; i < props.length; i++) {
15267 const prop = props[i];
15268 if (prop.type === 6) {
15269 const { loc, name, nameLoc, value } = prop;
15270 let isStatic = true;
15271 if (name === "ref") {
15272 hasRef = true;
15273 pushRefVForMarker();
15274 }
15275 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
15276 continue;
15277 }
15278 properties.push(
15279 createObjectProperty(
15280 createSimpleExpression(name, true, nameLoc),
15281 createSimpleExpression(
15282 value ? value.content : "",
15283 isStatic,
15284 value ? value.loc : loc
15285 )
15286 )
15287 );
15288 } else {
15289 const { name, arg, exp, loc, modifiers } = prop;
15290 const isVBind = name === "bind";
15291 const isVOn = name === "on";
15292 if (name === "slot") {
15293 if (!isComponent) {
15294 context.onError(
15295 createCompilerError(40, loc)
15296 );
15297 }
15298 continue;
15299 }
15300 if (name === "once" || name === "memo") {
15301 continue;
15302 }
15303 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
15304 continue;
15305 }
15306 if (isVOn && ssr) {
15307 continue;
15308 }
15309 if (
15310 // #938: elements with dynamic keys should be forced into blocks
15311 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
15312 // before children
15313 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
15314 ) {
15315 shouldUseBlock = true;
15316 }
15317 if (isVBind && isStaticArgOf(arg, "ref")) {
15318 pushRefVForMarker();
15319 }
15320 if (!arg && (isVBind || isVOn)) {
15321 hasDynamicKeys = true;
15322 if (exp) {
15323 if (isVBind) {
15324 pushRefVForMarker();
15325 pushMergeArg();
15326 mergeArgs.push(exp);
15327 } else {
15328 pushMergeArg({
15329 type: 14,
15330 loc,
15331 callee: context.helper(TO_HANDLERS),
15332 arguments: isComponent ? [exp] : [exp, `true`]
15333 });
15334 }
15335 } else {
15336 context.onError(
15337 createCompilerError(
15338 isVBind ? 34 : 35,
15339 loc
15340 )
15341 );
15342 }
15343 continue;
15344 }
15345 if (isVBind && modifiers.includes("prop")) {
15346 patchFlag |= 32;
15347 }
15348 const directiveTransform = context.directiveTransforms[name];
15349 if (directiveTransform) {
15350 const { props: props2, needRuntime } = directiveTransform(prop, node, context);
15351 !ssr && props2.forEach(analyzePatchFlag);
15352 if (isVOn && arg && !isStaticExp(arg)) {
15353 pushMergeArg(createObjectExpression(props2, elementLoc));
15354 } else {
15355 properties.push(...props2);
15356 }
15357 if (needRuntime) {
15358 runtimeDirectives.push(prop);
15359 if (isSymbol(needRuntime)) {
15360 directiveImportMap.set(prop, needRuntime);
15361 }
15362 }
15363 } else if (!isBuiltInDirective(name)) {
15364 runtimeDirectives.push(prop);
15365 if (hasChildren) {
15366 shouldUseBlock = true;
15367 }
15368 }
15369 }
15370 }
15371 let propsExpression = void 0;
15372 if (mergeArgs.length) {
15373 pushMergeArg();
15374 if (mergeArgs.length > 1) {
15375 propsExpression = createCallExpression(
15376 context.helper(MERGE_PROPS),
15377 mergeArgs,
15378 elementLoc
15379 );
15380 } else {
15381 propsExpression = mergeArgs[0];
15382 }
15383 } else if (properties.length) {
15384 propsExpression = createObjectExpression(
15385 dedupeProperties(properties),
15386 elementLoc
15387 );
15388 }
15389 if (hasDynamicKeys) {
15390 patchFlag |= 16;
15391 } else {
15392 if (hasClassBinding && !isComponent) {
15393 patchFlag |= 2;
15394 }
15395 if (hasStyleBinding && !isComponent) {
15396 patchFlag |= 4;
15397 }
15398 if (dynamicPropNames.length) {
15399 patchFlag |= 8;
15400 }
15401 if (hasHydrationEventBinding) {
15402 patchFlag |= 32;
15403 }
15404 }
15405 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
15406 patchFlag |= 512;
15407 }
15408 if (!context.inSSR && propsExpression) {
15409 switch (propsExpression.type) {
15410 case 15:
15411 let classKeyIndex = -1;
15412 let styleKeyIndex = -1;
15413 let hasDynamicKey = false;
15414 for (let i = 0; i < propsExpression.properties.length; i++) {
15415 const key = propsExpression.properties[i].key;
15416 if (isStaticExp(key)) {
15417 if (key.content === "class") {
15418 classKeyIndex = i;
15419 } else if (key.content === "style") {
15420 styleKeyIndex = i;
15421 }
15422 } else if (!key.isHandlerKey) {
15423 hasDynamicKey = true;
15424 }
15425 }
15426 const classProp = propsExpression.properties[classKeyIndex];
15427 const styleProp = propsExpression.properties[styleKeyIndex];
15428 if (!hasDynamicKey) {
15429 if (classProp && !isStaticExp(classProp.value)) {
15430 classProp.value = createCallExpression(
15431 context.helper(NORMALIZE_CLASS),
15432 [classProp.value]
15433 );
15434 }
15435 if (styleProp && // the static style is compiled into an object,
15436 // so use `hasStyleBinding` to ensure that it is a dynamic style binding
15437 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
15438 // v-bind:style with static literal object
15439 styleProp.value.type === 17)) {
15440 styleProp.value = createCallExpression(
15441 context.helper(NORMALIZE_STYLE),
15442 [styleProp.value]
15443 );
15444 }
15445 } else {
15446 propsExpression = createCallExpression(
15447 context.helper(NORMALIZE_PROPS),
15448 [propsExpression]
15449 );
15450 }
15451 break;
15452 case 14:
15453 break;
15454 default:
15455 propsExpression = createCallExpression(
15456 context.helper(NORMALIZE_PROPS),
15457 [
15458 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
15459 propsExpression
15460 ])
15461 ]
15462 );
15463 break;
15464 }
15465 }
15466 return {
15467 props: propsExpression,
15468 directives: runtimeDirectives,
15469 patchFlag,
15470 dynamicPropNames,
15471 shouldUseBlock
15472 };
15473 }
15474 function dedupeProperties(properties) {
15475 const knownProps = /* @__PURE__ */ new Map();
15476 const deduped = [];
15477 for (let i = 0; i < properties.length; i++) {
15478 const prop = properties[i];
15479 if (prop.key.type === 8 || !prop.key.isStatic) {
15480 deduped.push(prop);
15481 continue;
15482 }
15483 const name = prop.key.content;
15484 const existing = knownProps.get(name);
15485 if (existing) {
15486 if (name === "style" || name === "class" || isOn(name)) {
15487 mergeAsArray(existing, prop);
15488 }
15489 } else {
15490 knownProps.set(name, prop);
15491 deduped.push(prop);
15492 }
15493 }
15494 return deduped;
15495 }
15496 function mergeAsArray(existing, incoming) {
15497 if (existing.value.type === 17) {
15498 existing.value.elements.push(incoming.value);
15499 } else {
15500 existing.value = createArrayExpression(
15501 [existing.value, incoming.value],
15502 existing.loc
15503 );
15504 }
15505 }
15506 function buildDirectiveArgs(dir, context) {
15507 const dirArgs = [];
15508 const runtime = directiveImportMap.get(dir);
15509 if (runtime) {
15510 dirArgs.push(context.helperString(runtime));
15511 } else {
15512 {
15513 context.helper(RESOLVE_DIRECTIVE);
15514 context.directives.add(dir.name);
15515 dirArgs.push(toValidAssetId(dir.name, `directive`));
15516 }
15517 }
15518 const { loc } = dir;
15519 if (dir.exp)
15520 dirArgs.push(dir.exp);
15521 if (dir.arg) {
15522 if (!dir.exp) {
15523 dirArgs.push(`void 0`);
15524 }
15525 dirArgs.push(dir.arg);
15526 }
15527 if (Object.keys(dir.modifiers).length) {
15528 if (!dir.arg) {
15529 if (!dir.exp) {
15530 dirArgs.push(`void 0`);
15531 }
15532 dirArgs.push(`void 0`);
15533 }
15534 const trueExpression = createSimpleExpression(`true`, false, loc);
15535 dirArgs.push(
15536 createObjectExpression(
15537 dir.modifiers.map(
15538 (modifier) => createObjectProperty(modifier, trueExpression)
15539 ),
15540 loc
15541 )
15542 );
15543 }
15544 return createArrayExpression(dirArgs, dir.loc);
15545 }
15546 function stringifyDynamicPropNames(props) {
15547 let propsNamesString = `[`;
15548 for (let i = 0, l = props.length; i < l; i++) {
15549 propsNamesString += JSON.stringify(props[i]);
15550 if (i < l - 1)
15551 propsNamesString += ", ";
15552 }
15553 return propsNamesString + `]`;
15554 }
15555 function isComponentTag(tag) {
15556 return tag === "component" || tag === "Component";
15557 }
15558
15559 const transformSlotOutlet = (node, context) => {
15560 if (isSlotOutlet(node)) {
15561 const { children, loc } = node;
15562 const { slotName, slotProps } = processSlotOutlet(node, context);
15563 const slotArgs = [
15564 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
15565 slotName,
15566 "{}",
15567 "undefined",
15568 "true"
15569 ];
15570 let expectedLen = 2;
15571 if (slotProps) {
15572 slotArgs[2] = slotProps;
15573 expectedLen = 3;
15574 }
15575 if (children.length) {
15576 slotArgs[3] = createFunctionExpression([], children, false, false, loc);
15577 expectedLen = 4;
15578 }
15579 if (context.scopeId && !context.slotted) {
15580 expectedLen = 5;
15581 }
15582 slotArgs.splice(expectedLen);
15583 node.codegenNode = createCallExpression(
15584 context.helper(RENDER_SLOT),
15585 slotArgs,
15586 loc
15587 );
15588 }
15589 };
15590 function processSlotOutlet(node, context) {
15591 let slotName = `"default"`;
15592 let slotProps = void 0;
15593 const nonNameProps = [];
15594 for (let i = 0; i < node.props.length; i++) {
15595 const p = node.props[i];
15596 if (p.type === 6) {
15597 if (p.value) {
15598 if (p.name === "name") {
15599 slotName = JSON.stringify(p.value.content);
15600 } else {
15601 p.name = camelize(p.name);
15602 nonNameProps.push(p);
15603 }
15604 }
15605 } else {
15606 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
15607 if (p.exp) {
15608 slotName = p.exp;
15609 } else if (p.arg && p.arg.type === 4) {
15610 const name = camelize(p.arg.content);
15611 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
15612 }
15613 } else {
15614 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
15615 p.arg.content = camelize(p.arg.content);
15616 }
15617 nonNameProps.push(p);
15618 }
15619 }
15620 }
15621 if (nonNameProps.length > 0) {
15622 const { props, directives } = buildProps(
15623 node,
15624 context,
15625 nonNameProps,
15626 false,
15627 false
15628 );
15629 slotProps = props;
15630 if (directives.length) {
15631 context.onError(
15632 createCompilerError(
15633 36,
15634 directives[0].loc
15635 )
15636 );
15637 }
15638 }
15639 return {
15640 slotName,
15641 slotProps
15642 };
15643 }
15644
15645 const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
15646 const transformOn$1 = (dir, node, context, augmentor) => {
15647 const { loc, modifiers, arg } = dir;
15648 if (!dir.exp && !modifiers.length) {
15649 context.onError(createCompilerError(35, loc));
15650 }
15651 let eventName;
15652 if (arg.type === 4) {
15653 if (arg.isStatic) {
15654 let rawName = arg.content;
15655 if (rawName.startsWith("vnode")) {
15656 context.onError(createCompilerError(51, arg.loc));
15657 }
15658 if (rawName.startsWith("vue:")) {
15659 rawName = `vnode-${rawName.slice(4)}`;
15660 }
15661 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
15662 // for non-element and vnode lifecycle event listeners, auto convert
15663 // it to camelCase. See issue #2249
15664 toHandlerKey(camelize(rawName))
15665 ) : (
15666 // preserve case for plain element listeners that have uppercase
15667 // letters, as these may be custom elements' custom events
15668 `on:${rawName}`
15669 );
15670 eventName = createSimpleExpression(eventString, true, arg.loc);
15671 } else {
15672 eventName = createCompoundExpression([
15673 `${context.helperString(TO_HANDLER_KEY)}(`,
15674 arg,
15675 `)`
15676 ]);
15677 }
15678 } else {
15679 eventName = arg;
15680 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
15681 eventName.children.push(`)`);
15682 }
15683 let exp = dir.exp;
15684 if (exp && !exp.content.trim()) {
15685 exp = void 0;
15686 }
15687 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
15688 if (exp) {
15689 const isMemberExp = isMemberExpression(exp.content);
15690 const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
15691 const hasMultipleStatements = exp.content.includes(`;`);
15692 {
15693 validateBrowserExpression(
15694 exp,
15695 context,
15696 false,
15697 hasMultipleStatements
15698 );
15699 }
15700 if (isInlineStatement || shouldCache && isMemberExp) {
15701 exp = createCompoundExpression([
15702 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
15703 exp,
15704 hasMultipleStatements ? `}` : `)`
15705 ]);
15706 }
15707 }
15708 let ret = {
15709 props: [
15710 createObjectProperty(
15711 eventName,
15712 exp || createSimpleExpression(`() => {}`, false, loc)
15713 )
15714 ]
15715 };
15716 if (augmentor) {
15717 ret = augmentor(ret);
15718 }
15719 if (shouldCache) {
15720 ret.props[0].value = context.cache(ret.props[0].value);
15721 }
15722 ret.props.forEach((p) => p.key.isHandlerKey = true);
15723 return ret;
15724 };
15725
15726 const transformBind = (dir, _node, context) => {
15727 const { modifiers, loc } = dir;
15728 const arg = dir.arg;
15729 let { exp } = dir;
15730 if (exp && exp.type === 4 && !exp.content.trim()) {
15731 {
15732 exp = void 0;
15733 }
15734 }
15735 if (!exp) {
15736 if (arg.type !== 4 || !arg.isStatic) {
15737 context.onError(
15738 createCompilerError(
15739 52,
15740 arg.loc
15741 )
15742 );
15743 return {
15744 props: [
15745 createObjectProperty(arg, createSimpleExpression("", true, loc))
15746 ]
15747 };
15748 }
15749 const propName = camelize(arg.content);
15750 exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
15751 }
15752 if (arg.type !== 4) {
15753 arg.children.unshift(`(`);
15754 arg.children.push(`) || ""`);
15755 } else if (!arg.isStatic) {
15756 arg.content = `${arg.content} || ""`;
15757 }
15758 if (modifiers.includes("camel")) {
15759 if (arg.type === 4) {
15760 if (arg.isStatic) {
15761 arg.content = camelize(arg.content);
15762 } else {
15763 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
15764 }
15765 } else {
15766 arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
15767 arg.children.push(`)`);
15768 }
15769 }
15770 if (!context.inSSR) {
15771 if (modifiers.includes("prop")) {
15772 injectPrefix(arg, ".");
15773 }
15774 if (modifiers.includes("attr")) {
15775 injectPrefix(arg, "^");
15776 }
15777 }
15778 return {
15779 props: [createObjectProperty(arg, exp)]
15780 };
15781 };
15782 const injectPrefix = (arg, prefix) => {
15783 if (arg.type === 4) {
15784 if (arg.isStatic) {
15785 arg.content = prefix + arg.content;
15786 } else {
15787 arg.content = `\`${prefix}\${${arg.content}}\``;
15788 }
15789 } else {
15790 arg.children.unshift(`'${prefix}' + (`);
15791 arg.children.push(`)`);
15792 }
15793 };
15794
15795 const transformText = (node, context) => {
15796 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
15797 return () => {
15798 const children = node.children;
15799 let currentContainer = void 0;
15800 let hasText = false;
15801 for (let i = 0; i < children.length; i++) {
15802 const child = children[i];
15803 if (isText$1(child)) {
15804 hasText = true;
15805 for (let j = i + 1; j < children.length; j++) {
15806 const next = children[j];
15807 if (isText$1(next)) {
15808 if (!currentContainer) {
15809 currentContainer = children[i] = createCompoundExpression(
15810 [child],
15811 child.loc
15812 );
15813 }
15814 currentContainer.children.push(` + `, next);
15815 children.splice(j, 1);
15816 j--;
15817 } else {
15818 currentContainer = void 0;
15819 break;
15820 }
15821 }
15822 }
15823 }
15824 if (!hasText || // if this is a plain element with a single text child, leave it
15825 // as-is since the runtime has dedicated fast path for this by directly
15826 // setting textContent of the element.
15827 // for component root it's always normalized anyway.
15828 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
15829 // custom directives can potentially add DOM elements arbitrarily,
15830 // we need to avoid setting textContent of the element at runtime
15831 // to avoid accidentally overwriting the DOM elements added
15832 // by the user through custom directives.
15833 !node.props.find(
15834 (p) => p.type === 7 && !context.directiveTransforms[p.name]
15835 ) && // in compat mode, <template> tags with no special directives
15836 // will be rendered as a fragment so its children must be
15837 // converted into vnodes.
15838 true)) {
15839 return;
15840 }
15841 for (let i = 0; i < children.length; i++) {
15842 const child = children[i];
15843 if (isText$1(child) || child.type === 8) {
15844 const callArgs = [];
15845 if (child.type !== 2 || child.content !== " ") {
15846 callArgs.push(child);
15847 }
15848 if (!context.ssr && getConstantType(child, context) === 0) {
15849 callArgs.push(
15850 1 + (` /* ${PatchFlagNames[1]} */` )
15851 );
15852 }
15853 children[i] = {
15854 type: 12,
15855 content: child,
15856 loc: child.loc,
15857 codegenNode: createCallExpression(
15858 context.helper(CREATE_TEXT),
15859 callArgs
15860 )
15861 };
15862 }
15863 }
15864 };
15865 }
15866 };
15867
15868 const seen$1 = /* @__PURE__ */ new WeakSet();
15869 const transformOnce = (node, context) => {
15870 if (node.type === 1 && findDir(node, "once", true)) {
15871 if (seen$1.has(node) || context.inVOnce || context.inSSR) {
15872 return;
15873 }
15874 seen$1.add(node);
15875 context.inVOnce = true;
15876 context.helper(SET_BLOCK_TRACKING);
15877 return () => {
15878 context.inVOnce = false;
15879 const cur = context.currentNode;
15880 if (cur.codegenNode) {
15881 cur.codegenNode = context.cache(
15882 cur.codegenNode,
15883 true
15884 /* isVNode */
15885 );
15886 }
15887 };
15888 }
15889 };
15890
15891 const transformModel$1 = (dir, node, context) => {
15892 const { exp, arg } = dir;
15893 if (!exp) {
15894 context.onError(
15895 createCompilerError(41, dir.loc)
15896 );
15897 return createTransformProps();
15898 }
15899 const rawExp = exp.loc.source;
15900 const expString = exp.type === 4 ? exp.content : rawExp;
15901 const bindingType = context.bindingMetadata[rawExp];
15902 if (bindingType === "props" || bindingType === "props-aliased") {
15903 context.onError(createCompilerError(44, exp.loc));
15904 return createTransformProps();
15905 }
15906 const maybeRef = false;
15907 if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
15908 context.onError(
15909 createCompilerError(42, exp.loc)
15910 );
15911 return createTransformProps();
15912 }
15913 const propName = arg ? arg : createSimpleExpression("modelValue", true);
15914 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
15915 let assignmentExp;
15916 const eventArg = context.isTS ? `($event: any)` : `$event`;
15917 {
15918 assignmentExp = createCompoundExpression([
15919 `${eventArg} => ((`,
15920 exp,
15921 `) = $event)`
15922 ]);
15923 }
15924 const props = [
15925 // modelValue: foo
15926 createObjectProperty(propName, dir.exp),
15927 // "onUpdate:modelValue": $event => (foo = $event)
15928 createObjectProperty(eventName, assignmentExp)
15929 ];
15930 if (dir.modifiers.length && node.tagType === 1) {
15931 const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
15932 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
15933 props.push(
15934 createObjectProperty(
15935 modifiersKey,
15936 createSimpleExpression(
15937 `{ ${modifiers} }`,
15938 false,
15939 dir.loc,
15940 2
15941 )
15942 )
15943 );
15944 }
15945 return createTransformProps(props);
15946 };
15947 function createTransformProps(props = []) {
15948 return { props };
15949 }
15950
15951 const seen = /* @__PURE__ */ new WeakSet();
15952 const transformMemo = (node, context) => {
15953 if (node.type === 1) {
15954 const dir = findDir(node, "memo");
15955 if (!dir || seen.has(node)) {
15956 return;
15957 }
15958 seen.add(node);
15959 return () => {
15960 const codegenNode = node.codegenNode || context.currentNode.codegenNode;
15961 if (codegenNode && codegenNode.type === 13) {
15962 if (node.tagType !== 1) {
15963 convertToBlock(codegenNode, context);
15964 }
15965 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
15966 dir.exp,
15967 createFunctionExpression(void 0, codegenNode),
15968 `_cache`,
15969 String(context.cached++)
15970 ]);
15971 }
15972 };
15973 }
15974 };
15975
15976 function getBaseTransformPreset(prefixIdentifiers) {
15977 return [
15978 [
15979 transformOnce,
15980 transformIf,
15981 transformMemo,
15982 transformFor,
15983 ...[],
15984 ...[transformExpression] ,
15985 transformSlotOutlet,
15986 transformElement,
15987 trackSlotScopes,
15988 transformText
15989 ],
15990 {
15991 on: transformOn$1,
15992 bind: transformBind,
15993 model: transformModel$1
15994 }
15995 ];
15996 }
15997 function baseCompile(source, options = {}) {
15998 const onError = options.onError || defaultOnError;
15999 const isModuleMode = options.mode === "module";
16000 {
16001 if (options.prefixIdentifiers === true) {
16002 onError(createCompilerError(47));
16003 } else if (isModuleMode) {
16004 onError(createCompilerError(48));
16005 }
16006 }
16007 const prefixIdentifiers = false;
16008 if (options.cacheHandlers) {
16009 onError(createCompilerError(49));
16010 }
16011 if (options.scopeId && !isModuleMode) {
16012 onError(createCompilerError(50));
16013 }
16014 const resolvedOptions = extend({}, options, {
16015 prefixIdentifiers
16016 });
16017 const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
16018 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
16019 transform(
16020 ast,
16021 extend({}, resolvedOptions, {
16022 nodeTransforms: [
16023 ...nodeTransforms,
16024 ...options.nodeTransforms || []
16025 // user transforms
16026 ],
16027 directiveTransforms: extend(
16028 {},
16029 directiveTransforms,
16030 options.directiveTransforms || {}
16031 // user transforms
16032 )
16033 })
16034 );
16035 return generate(ast, resolvedOptions);
16036 }
16037
16038 const noopDirectiveTransform = () => ({ props: [] });
16039
16040 const V_MODEL_RADIO = Symbol(`vModelRadio` );
16041 const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
16042 const V_MODEL_TEXT = Symbol(`vModelText` );
16043 const V_MODEL_SELECT = Symbol(`vModelSelect` );
16044 const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
16045 const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
16046 const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
16047 const V_SHOW = Symbol(`vShow` );
16048 const TRANSITION = Symbol(`Transition` );
16049 const TRANSITION_GROUP = Symbol(`TransitionGroup` );
16050 registerRuntimeHelpers({
16051 [V_MODEL_RADIO]: `vModelRadio`,
16052 [V_MODEL_CHECKBOX]: `vModelCheckbox`,
16053 [V_MODEL_TEXT]: `vModelText`,
16054 [V_MODEL_SELECT]: `vModelSelect`,
16055 [V_MODEL_DYNAMIC]: `vModelDynamic`,
16056 [V_ON_WITH_MODIFIERS]: `withModifiers`,
16057 [V_ON_WITH_KEYS]: `withKeys`,
16058 [V_SHOW]: `vShow`,
16059 [TRANSITION]: `Transition`,
16060 [TRANSITION_GROUP]: `TransitionGroup`
16061 });
16062
16063 let decoder;
16064 function decodeHtmlBrowser(raw, asAttr = false) {
16065 if (!decoder) {
16066 decoder = document.createElement("div");
16067 }
16068 if (asAttr) {
16069 decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
16070 return decoder.children[0].getAttribute("foo");
16071 } else {
16072 decoder.innerHTML = raw;
16073 return decoder.textContent;
16074 }
16075 }
16076
16077 const parserOptions = {
16078 parseMode: "html",
16079 isVoidTag,
16080 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
16081 isPreTag: (tag) => tag === "pre",
16082 decodeEntities: decodeHtmlBrowser ,
16083 isBuiltInComponent: (tag) => {
16084 if (tag === "Transition" || tag === "transition") {
16085 return TRANSITION;
16086 } else if (tag === "TransitionGroup" || tag === "transition-group") {
16087 return TRANSITION_GROUP;
16088 }
16089 },
16090 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
16091 getNamespace(tag, parent, rootNamespace) {
16092 let ns = parent ? parent.ns : rootNamespace;
16093 if (parent && ns === 2) {
16094 if (parent.tag === "annotation-xml") {
16095 if (tag === "svg") {
16096 return 1;
16097 }
16098 if (parent.props.some(
16099 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
16100 )) {
16101 ns = 0;
16102 }
16103 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
16104 ns = 0;
16105 }
16106 } else if (parent && ns === 1) {
16107 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
16108 ns = 0;
16109 }
16110 }
16111 if (ns === 0) {
16112 if (tag === "svg") {
16113 return 1;
16114 }
16115 if (tag === "math") {
16116 return 2;
16117 }
16118 }
16119 return ns;
16120 }
16121 };
16122
16123 const transformStyle = (node) => {
16124 if (node.type === 1) {
16125 node.props.forEach((p, i) => {
16126 if (p.type === 6 && p.name === "style" && p.value) {
16127 node.props[i] = {
16128 type: 7,
16129 name: `bind`,
16130 arg: createSimpleExpression(`style`, true, p.loc),
16131 exp: parseInlineCSS(p.value.content, p.loc),
16132 modifiers: [],
16133 loc: p.loc
16134 };
16135 }
16136 });
16137 }
16138 };
16139 const parseInlineCSS = (cssText, loc) => {
16140 const normalized = parseStringStyle(cssText);
16141 return createSimpleExpression(
16142 JSON.stringify(normalized),
16143 false,
16144 loc,
16145 3
16146 );
16147 };
16148
16149 function createDOMCompilerError(code, loc) {
16150 return createCompilerError(
16151 code,
16152 loc,
16153 DOMErrorMessages
16154 );
16155 }
16156 const DOMErrorMessages = {
16157 [53]: `v-html is missing expression.`,
16158 [54]: `v-html will override element children.`,
16159 [55]: `v-text is missing expression.`,
16160 [56]: `v-text will override element children.`,
16161 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
16162 [58]: `v-model argument is not supported on plain elements.`,
16163 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
16164 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
16165 [61]: `v-show is missing expression.`,
16166 [62]: `<Transition> expects exactly one child element or component.`,
16167 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
16168 };
16169
16170 const transformVHtml = (dir, node, context) => {
16171 const { exp, loc } = dir;
16172 if (!exp) {
16173 context.onError(
16174 createDOMCompilerError(53, loc)
16175 );
16176 }
16177 if (node.children.length) {
16178 context.onError(
16179 createDOMCompilerError(54, loc)
16180 );
16181 node.children.length = 0;
16182 }
16183 return {
16184 props: [
16185 createObjectProperty(
16186 createSimpleExpression(`innerHTML`, true, loc),
16187 exp || createSimpleExpression("", true)
16188 )
16189 ]
16190 };
16191 };
16192
16193 const transformVText = (dir, node, context) => {
16194 const { exp, loc } = dir;
16195 if (!exp) {
16196 context.onError(
16197 createDOMCompilerError(55, loc)
16198 );
16199 }
16200 if (node.children.length) {
16201 context.onError(
16202 createDOMCompilerError(56, loc)
16203 );
16204 node.children.length = 0;
16205 }
16206 return {
16207 props: [
16208 createObjectProperty(
16209 createSimpleExpression(`textContent`, true),
16210 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
16211 context.helperString(TO_DISPLAY_STRING),
16212 [exp],
16213 loc
16214 ) : createSimpleExpression("", true)
16215 )
16216 ]
16217 };
16218 };
16219
16220 const transformModel = (dir, node, context) => {
16221 const baseResult = transformModel$1(dir, node, context);
16222 if (!baseResult.props.length || node.tagType === 1) {
16223 return baseResult;
16224 }
16225 if (dir.arg) {
16226 context.onError(
16227 createDOMCompilerError(
16228 58,
16229 dir.arg.loc
16230 )
16231 );
16232 }
16233 function checkDuplicatedValue() {
16234 const value = findDir(node, "bind");
16235 if (value && isStaticArgOf(value.arg, "value")) {
16236 context.onError(
16237 createDOMCompilerError(
16238 60,
16239 value.loc
16240 )
16241 );
16242 }
16243 }
16244 const { tag } = node;
16245 const isCustomElement = context.isCustomElement(tag);
16246 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
16247 let directiveToUse = V_MODEL_TEXT;
16248 let isInvalidType = false;
16249 if (tag === "input" || isCustomElement) {
16250 const type = findProp(node, `type`);
16251 if (type) {
16252 if (type.type === 7) {
16253 directiveToUse = V_MODEL_DYNAMIC;
16254 } else if (type.value) {
16255 switch (type.value.content) {
16256 case "radio":
16257 directiveToUse = V_MODEL_RADIO;
16258 break;
16259 case "checkbox":
16260 directiveToUse = V_MODEL_CHECKBOX;
16261 break;
16262 case "file":
16263 isInvalidType = true;
16264 context.onError(
16265 createDOMCompilerError(
16266 59,
16267 dir.loc
16268 )
16269 );
16270 break;
16271 default:
16272 checkDuplicatedValue();
16273 break;
16274 }
16275 }
16276 } else if (hasDynamicKeyVBind(node)) {
16277 directiveToUse = V_MODEL_DYNAMIC;
16278 } else {
16279 checkDuplicatedValue();
16280 }
16281 } else if (tag === "select") {
16282 directiveToUse = V_MODEL_SELECT;
16283 } else {
16284 checkDuplicatedValue();
16285 }
16286 if (!isInvalidType) {
16287 baseResult.needRuntime = context.helper(directiveToUse);
16288 }
16289 } else {
16290 context.onError(
16291 createDOMCompilerError(
16292 57,
16293 dir.loc
16294 )
16295 );
16296 }
16297 baseResult.props = baseResult.props.filter(
16298 (p) => !(p.key.type === 4 && p.key.content === "modelValue")
16299 );
16300 return baseResult;
16301 };
16302
16303 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
16304 const isNonKeyModifier = /* @__PURE__ */ makeMap(
16305 // event propagation management
16306 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
16307 );
16308 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
16309 const isKeyboardEvent = /* @__PURE__ */ makeMap(
16310 `onkeyup,onkeydown,onkeypress`,
16311 true
16312 );
16313 const resolveModifiers = (key, modifiers, context, loc) => {
16314 const keyModifiers = [];
16315 const nonKeyModifiers = [];
16316 const eventOptionModifiers = [];
16317 for (let i = 0; i < modifiers.length; i++) {
16318 const modifier = modifiers[i];
16319 if (isEventOptionModifier(modifier)) {
16320 eventOptionModifiers.push(modifier);
16321 } else {
16322 if (maybeKeyModifier(modifier)) {
16323 if (isStaticExp(key)) {
16324 if (isKeyboardEvent(key.content)) {
16325 keyModifiers.push(modifier);
16326 } else {
16327 nonKeyModifiers.push(modifier);
16328 }
16329 } else {
16330 keyModifiers.push(modifier);
16331 nonKeyModifiers.push(modifier);
16332 }
16333 } else {
16334 if (isNonKeyModifier(modifier)) {
16335 nonKeyModifiers.push(modifier);
16336 } else {
16337 keyModifiers.push(modifier);
16338 }
16339 }
16340 }
16341 }
16342 return {
16343 keyModifiers,
16344 nonKeyModifiers,
16345 eventOptionModifiers
16346 };
16347 };
16348 const transformClick = (key, event) => {
16349 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
16350 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
16351 `(`,
16352 key,
16353 `) === "onClick" ? "${event}" : (`,
16354 key,
16355 `)`
16356 ]) : key;
16357 };
16358 const transformOn = (dir, node, context) => {
16359 return transformOn$1(dir, node, context, (baseResult) => {
16360 const { modifiers } = dir;
16361 if (!modifiers.length)
16362 return baseResult;
16363 let { key, value: handlerExp } = baseResult.props[0];
16364 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
16365 if (nonKeyModifiers.includes("right")) {
16366 key = transformClick(key, `onContextmenu`);
16367 }
16368 if (nonKeyModifiers.includes("middle")) {
16369 key = transformClick(key, `onMouseup`);
16370 }
16371 if (nonKeyModifiers.length) {
16372 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
16373 handlerExp,
16374 JSON.stringify(nonKeyModifiers)
16375 ]);
16376 }
16377 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
16378 (!isStaticExp(key) || isKeyboardEvent(key.content))) {
16379 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
16380 handlerExp,
16381 JSON.stringify(keyModifiers)
16382 ]);
16383 }
16384 if (eventOptionModifiers.length) {
16385 const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
16386 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
16387 }
16388 return {
16389 props: [createObjectProperty(key, handlerExp)]
16390 };
16391 });
16392 };
16393
16394 const transformShow = (dir, node, context) => {
16395 const { exp, loc } = dir;
16396 if (!exp) {
16397 context.onError(
16398 createDOMCompilerError(61, loc)
16399 );
16400 }
16401 return {
16402 props: [],
16403 needRuntime: context.helper(V_SHOW)
16404 };
16405 };
16406
16407 const transformTransition = (node, context) => {
16408 if (node.type === 1 && node.tagType === 1) {
16409 const component = context.isBuiltInComponent(node.tag);
16410 if (component === TRANSITION) {
16411 return () => {
16412 if (!node.children.length) {
16413 return;
16414 }
16415 if (hasMultipleChildren(node)) {
16416 context.onError(
16417 createDOMCompilerError(
16418 62,
16419 {
16420 start: node.children[0].loc.start,
16421 end: node.children[node.children.length - 1].loc.end,
16422 source: ""
16423 }
16424 )
16425 );
16426 }
16427 const child = node.children[0];
16428 if (child.type === 1) {
16429 for (const p of child.props) {
16430 if (p.type === 7 && p.name === "show") {
16431 node.props.push({
16432 type: 6,
16433 name: "persisted",
16434 nameLoc: node.loc,
16435 value: void 0,
16436 loc: node.loc
16437 });
16438 }
16439 }
16440 }
16441 };
16442 }
16443 }
16444 };
16445 function hasMultipleChildren(node) {
16446 const children = node.children = node.children.filter(
16447 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
16448 );
16449 const child = children[0];
16450 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
16451 }
16452
16453 const ignoreSideEffectTags = (node, context) => {
16454 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
16455 context.onError(
16456 createDOMCompilerError(
16457 63,
16458 node.loc
16459 )
16460 );
16461 context.removeNode();
16462 }
16463 };
16464
16465 const DOMNodeTransforms = [
16466 transformStyle,
16467 ...[transformTransition]
16468 ];
16469 const DOMDirectiveTransforms = {
16470 cloak: noopDirectiveTransform,
16471 html: transformVHtml,
16472 text: transformVText,
16473 model: transformModel,
16474 // override compiler-core
16475 on: transformOn,
16476 // override compiler-core
16477 show: transformShow
16478 };
16479 function compile(src, options = {}) {
16480 return baseCompile(
16481 src,
16482 extend({}, parserOptions, options, {
16483 nodeTransforms: [
16484 // ignore <script> and <tag>
16485 // this is not put inside DOMNodeTransforms because that list is used
16486 // by compiler-ssr to generate vnode fallback branches
16487 ignoreSideEffectTags,
16488 ...DOMNodeTransforms,
16489 ...options.nodeTransforms || []
16490 ],
16491 directiveTransforms: extend(
16492 {},
16493 DOMDirectiveTransforms,
16494 options.directiveTransforms || {}
16495 ),
16496 transformHoist: null
16497 })
16498 );
16499 }
16500
16501 {
16502 initDev();
16503 }
16504 const compileCache = /* @__PURE__ */ new WeakMap();
16505 function getCache(options) {
16506 let c = compileCache.get(options != null ? options : EMPTY_OBJ);
16507 if (!c) {
16508 c = /* @__PURE__ */ Object.create(null);
16509 compileCache.set(options != null ? options : EMPTY_OBJ, c);
16510 }
16511 return c;
16512 }
16513 function compileToFunction(template, options) {
16514 if (!isString(template)) {
16515 if (template.nodeType) {
16516 template = template.innerHTML;
16517 } else {
16518 warn(`invalid template option: `, template);
16519 return NOOP;
16520 }
16521 }
16522 const key = template;
16523 const cache = getCache(options);
16524 const cached = cache[key];
16525 if (cached) {
16526 return cached;
16527 }
16528 if (template[0] === "#") {
16529 const el = document.querySelector(template);
16530 if (!el) {
16531 warn(`Template element not found or is empty: ${template}`);
16532 }
16533 template = el ? el.innerHTML : ``;
16534 }
16535 const opts = extend(
16536 {
16537 hoistStatic: true,
16538 onError: onError ,
16539 onWarn: (e) => onError(e, true)
16540 },
16541 options
16542 );
16543 if (!opts.isCustomElement && typeof customElements !== "undefined") {
16544 opts.isCustomElement = (tag) => !!customElements.get(tag);
16545 }
16546 const { code } = compile(template, opts);
16547 function onError(err, asWarning = false) {
16548 const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
16549 const codeFrame = err.loc && generateCodeFrame(
16550 template,
16551 err.loc.start.offset,
16552 err.loc.end.offset
16553 );
16554 warn(codeFrame ? `${message}
16555${codeFrame}` : message);
16556 }
16557 const render = new Function(code)() ;
16558 render._rc = true;
16559 return cache[key] = render;
16560 }
16561 registerRuntimeCompiler(compileToFunction);
16562
16563 exports.BaseTransition = BaseTransition;
16564 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
16565 exports.Comment = Comment;
16566 exports.DeprecationTypes = DeprecationTypes;
16567 exports.EffectScope = EffectScope;
16568 exports.ErrorCodes = ErrorCodes;
16569 exports.ErrorTypeStrings = ErrorTypeStrings;
16570 exports.Fragment = Fragment;
16571 exports.KeepAlive = KeepAlive;
16572 exports.ReactiveEffect = ReactiveEffect;
16573 exports.Static = Static;
16574 exports.Suspense = Suspense;
16575 exports.Teleport = Teleport;
16576 exports.Text = Text;
16577 exports.TrackOpTypes = TrackOpTypes;
16578 exports.Transition = Transition;
16579 exports.TransitionGroup = TransitionGroup;
16580 exports.TriggerOpTypes = TriggerOpTypes;
16581 exports.VueElement = VueElement;
16582 exports.assertNumber = assertNumber;
16583 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
16584 exports.callWithErrorHandling = callWithErrorHandling;
16585 exports.camelize = camelize;
16586 exports.capitalize = capitalize;
16587 exports.cloneVNode = cloneVNode;
16588 exports.compatUtils = compatUtils;
16589 exports.compile = compileToFunction;
16590 exports.computed = computed;
16591 exports.createApp = createApp;
16592 exports.createBlock = createBlock;
16593 exports.createCommentVNode = createCommentVNode;
16594 exports.createElementBlock = createElementBlock;
16595 exports.createElementVNode = createBaseVNode;
16596 exports.createHydrationRenderer = createHydrationRenderer;
16597 exports.createPropsRestProxy = createPropsRestProxy;
16598 exports.createRenderer = createRenderer;
16599 exports.createSSRApp = createSSRApp;
16600 exports.createSlots = createSlots;
16601 exports.createStaticVNode = createStaticVNode;
16602 exports.createTextVNode = createTextVNode;
16603 exports.createVNode = createVNode;
16604 exports.customRef = customRef;
16605 exports.defineAsyncComponent = defineAsyncComponent;
16606 exports.defineComponent = defineComponent;
16607 exports.defineCustomElement = defineCustomElement;
16608 exports.defineEmits = defineEmits;
16609 exports.defineExpose = defineExpose;
16610 exports.defineModel = defineModel;
16611 exports.defineOptions = defineOptions;
16612 exports.defineProps = defineProps;
16613 exports.defineSSRCustomElement = defineSSRCustomElement;
16614 exports.defineSlots = defineSlots;
16615 exports.devtools = devtools;
16616 exports.effect = effect;
16617 exports.effectScope = effectScope;
16618 exports.getCurrentInstance = getCurrentInstance;
16619 exports.getCurrentScope = getCurrentScope;
16620 exports.getTransitionRawChildren = getTransitionRawChildren;
16621 exports.guardReactiveProps = guardReactiveProps;
16622 exports.h = h;
16623 exports.handleError = handleError;
16624 exports.hasInjectionContext = hasInjectionContext;
16625 exports.hydrate = hydrate;
16626 exports.initCustomFormatter = initCustomFormatter;
16627 exports.initDirectivesForSSR = initDirectivesForSSR;
16628 exports.inject = inject;
16629 exports.isMemoSame = isMemoSame;
16630 exports.isProxy = isProxy;
16631 exports.isReactive = isReactive;
16632 exports.isReadonly = isReadonly;
16633 exports.isRef = isRef;
16634 exports.isRuntimeOnly = isRuntimeOnly;
16635 exports.isShallow = isShallow;
16636 exports.isVNode = isVNode;
16637 exports.markRaw = markRaw;
16638 exports.mergeDefaults = mergeDefaults;
16639 exports.mergeModels = mergeModels;
16640 exports.mergeProps = mergeProps;
16641 exports.nextTick = nextTick;
16642 exports.normalizeClass = normalizeClass;
16643 exports.normalizeProps = normalizeProps;
16644 exports.normalizeStyle = normalizeStyle;
16645 exports.onActivated = onActivated;
16646 exports.onBeforeMount = onBeforeMount;
16647 exports.onBeforeUnmount = onBeforeUnmount;
16648 exports.onBeforeUpdate = onBeforeUpdate;
16649 exports.onDeactivated = onDeactivated;
16650 exports.onErrorCaptured = onErrorCaptured;
16651 exports.onMounted = onMounted;
16652 exports.onRenderTracked = onRenderTracked;
16653 exports.onRenderTriggered = onRenderTriggered;
16654 exports.onScopeDispose = onScopeDispose;
16655 exports.onServerPrefetch = onServerPrefetch;
16656 exports.onUnmounted = onUnmounted;
16657 exports.onUpdated = onUpdated;
16658 exports.openBlock = openBlock;
16659 exports.popScopeId = popScopeId;
16660 exports.provide = provide;
16661 exports.proxyRefs = proxyRefs;
16662 exports.pushScopeId = pushScopeId;
16663 exports.queuePostFlushCb = queuePostFlushCb;
16664 exports.reactive = reactive;
16665 exports.readonly = readonly;
16666 exports.ref = ref;
16667 exports.registerRuntimeCompiler = registerRuntimeCompiler;
16668 exports.render = render;
16669 exports.renderList = renderList;
16670 exports.renderSlot = renderSlot;
16671 exports.resolveComponent = resolveComponent;
16672 exports.resolveDirective = resolveDirective;
16673 exports.resolveDynamicComponent = resolveDynamicComponent;
16674 exports.resolveFilter = resolveFilter;
16675 exports.resolveTransitionHooks = resolveTransitionHooks;
16676 exports.setBlockTracking = setBlockTracking;
16677 exports.setDevtoolsHook = setDevtoolsHook;
16678 exports.setTransitionHooks = setTransitionHooks;
16679 exports.shallowReactive = shallowReactive;
16680 exports.shallowReadonly = shallowReadonly;
16681 exports.shallowRef = shallowRef;
16682 exports.ssrContextKey = ssrContextKey;
16683 exports.ssrUtils = ssrUtils;
16684 exports.stop = stop;
16685 exports.toDisplayString = toDisplayString;
16686 exports.toHandlerKey = toHandlerKey;
16687 exports.toHandlers = toHandlers;
16688 exports.toRaw = toRaw;
16689 exports.toRef = toRef;
16690 exports.toRefs = toRefs;
16691 exports.toValue = toValue;
16692 exports.transformVNodeArgs = transformVNodeArgs;
16693 exports.triggerRef = triggerRef;
16694 exports.unref = unref;
16695 exports.useAttrs = useAttrs;
16696 exports.useCssModule = useCssModule;
16697 exports.useCssVars = useCssVars;
16698 exports.useModel = useModel;
16699 exports.useSSRContext = useSSRContext;
16700 exports.useSlots = useSlots;
16701 exports.useTransitionState = useTransitionState;
16702 exports.vModelCheckbox = vModelCheckbox;
16703 exports.vModelDynamic = vModelDynamic;
16704 exports.vModelRadio = vModelRadio;
16705 exports.vModelSelect = vModelSelect;
16706 exports.vModelText = vModelText;
16707 exports.vShow = vShow;
16708 exports.version = version;
16709 exports.warn = warn;
16710 exports.watch = watch;
16711 exports.watchEffect = watchEffect;
16712 exports.watchPostEffect = watchPostEffect;
16713 exports.watchSyncEffect = watchSyncEffect;
16714 exports.withAsyncContext = withAsyncContext;
16715 exports.withCtx = withCtx;
16716 exports.withDefaults = withDefaults;
16717 exports.withDirectives = withDirectives;
16718 exports.withKeys = withKeys;
16719 exports.withMemo = withMemo;
16720 exports.withModifiers = withModifiers;
16721 exports.withScopeId = withScopeId;
16722
16723 return exports;
16724
16725})({});