UNPKG

532 kBJavaScriptView Raw
1/**
2* vue v3.5.13
3* (c) 2018-present Yuxi (Evan) You and Vue contributors
4* @license MIT
5**/
6/*! #__NO_SIDE_EFFECTS__ */
7// @__NO_SIDE_EFFECTS__
8function makeMap(str) {
9 const map = /* @__PURE__ */ Object.create(null);
10 for (const key of str.split(",")) map[key] = 1;
11 return (val) => val in map;
12}
13
14const EMPTY_OBJ = Object.freeze({}) ;
15const EMPTY_ARR = Object.freeze([]) ;
16const NOOP = () => {
17};
18const NO = () => false;
19const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
20(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
21const isModelListener = (key) => key.startsWith("onUpdate:");
22const extend = Object.assign;
23const remove = (arr, el) => {
24 const i = arr.indexOf(el);
25 if (i > -1) {
26 arr.splice(i, 1);
27 }
28};
29const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
30const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
31const isArray = Array.isArray;
32const isMap = (val) => toTypeString(val) === "[object Map]";
33const isSet = (val) => toTypeString(val) === "[object Set]";
34const isDate = (val) => toTypeString(val) === "[object Date]";
35const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
36const isFunction = (val) => typeof val === "function";
37const isString = (val) => typeof val === "string";
38const isSymbol = (val) => typeof val === "symbol";
39const isObject = (val) => val !== null && typeof val === "object";
40const isPromise = (val) => {
41 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
42};
43const objectToString = Object.prototype.toString;
44const toTypeString = (value) => objectToString.call(value);
45const toRawType = (value) => {
46 return toTypeString(value).slice(8, -1);
47};
48const isPlainObject = (val) => toTypeString(val) === "[object Object]";
49const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
50const isReservedProp = /* @__PURE__ */ makeMap(
51 // the leading comma is intentional so empty string "" is also included
52 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
53);
54const isBuiltInDirective = /* @__PURE__ */ makeMap(
55 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
56);
57const cacheStringFunction = (fn) => {
58 const cache = /* @__PURE__ */ Object.create(null);
59 return (str) => {
60 const hit = cache[str];
61 return hit || (cache[str] = fn(str));
62 };
63};
64const camelizeRE = /-(\w)/g;
65const camelize = cacheStringFunction(
66 (str) => {
67 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
68 }
69);
70const hyphenateRE = /\B([A-Z])/g;
71const hyphenate = cacheStringFunction(
72 (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
73);
74const capitalize = cacheStringFunction((str) => {
75 return str.charAt(0).toUpperCase() + str.slice(1);
76});
77const toHandlerKey = cacheStringFunction(
78 (str) => {
79 const s = str ? `on${capitalize(str)}` : ``;
80 return s;
81 }
82);
83const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
84const invokeArrayFns = (fns, ...arg) => {
85 for (let i = 0; i < fns.length; i++) {
86 fns[i](...arg);
87 }
88};
89const def = (obj, key, value, writable = false) => {
90 Object.defineProperty(obj, key, {
91 configurable: true,
92 enumerable: false,
93 writable,
94 value
95 });
96};
97const looseToNumber = (val) => {
98 const n = parseFloat(val);
99 return isNaN(n) ? val : n;
100};
101const toNumber = (val) => {
102 const n = isString(val) ? Number(val) : NaN;
103 return isNaN(n) ? val : n;
104};
105let _globalThis;
106const getGlobalThis = () => {
107 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
108};
109function genCacheKey(source, options) {
110 return source + JSON.stringify(
111 options,
112 (_, val) => typeof val === "function" ? val.toString() : val
113 );
114}
115
116const PatchFlagNames = {
117 [1]: `TEXT`,
118 [2]: `CLASS`,
119 [4]: `STYLE`,
120 [8]: `PROPS`,
121 [16]: `FULL_PROPS`,
122 [32]: `NEED_HYDRATION`,
123 [64]: `STABLE_FRAGMENT`,
124 [128]: `KEYED_FRAGMENT`,
125 [256]: `UNKEYED_FRAGMENT`,
126 [512]: `NEED_PATCH`,
127 [1024]: `DYNAMIC_SLOTS`,
128 [2048]: `DEV_ROOT_FRAGMENT`,
129 [-1]: `HOISTED`,
130 [-2]: `BAIL`
131};
132
133const slotFlagsText = {
134 [1]: "STABLE",
135 [2]: "DYNAMIC",
136 [3]: "FORWARDED"
137};
138
139const 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,Symbol";
140const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
141
142const range = 2;
143function generateCodeFrame(source, start = 0, end = source.length) {
144 start = Math.max(0, Math.min(start, source.length));
145 end = Math.max(0, Math.min(end, source.length));
146 if (start > end) return "";
147 let lines = source.split(/(\r?\n)/);
148 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
149 lines = lines.filter((_, idx) => idx % 2 === 0);
150 let count = 0;
151 const res = [];
152 for (let i = 0; i < lines.length; i++) {
153 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
154 if (count >= start) {
155 for (let j = i - range; j <= i + range || end > count; j++) {
156 if (j < 0 || j >= lines.length) continue;
157 const line = j + 1;
158 res.push(
159 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
160 );
161 const lineLength = lines[j].length;
162 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
163 if (j === i) {
164 const pad = start - (count - (lineLength + newLineSeqLength));
165 const length = Math.max(
166 1,
167 end > count ? lineLength - pad : end - start
168 );
169 res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
170 } else if (j > i) {
171 if (end > count) {
172 const length = Math.max(Math.min(end - count, lineLength), 1);
173 res.push(` | ` + "^".repeat(length));
174 }
175 count += lineLength + newLineSeqLength;
176 }
177 }
178 break;
179 }
180 }
181 return res.join("\n");
182}
183
184function normalizeStyle(value) {
185 if (isArray(value)) {
186 const res = {};
187 for (let i = 0; i < value.length; i++) {
188 const item = value[i];
189 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
190 if (normalized) {
191 for (const key in normalized) {
192 res[key] = normalized[key];
193 }
194 }
195 }
196 return res;
197 } else if (isString(value) || isObject(value)) {
198 return value;
199 }
200}
201const listDelimiterRE = /;(?![^(]*\))/g;
202const propertyDelimiterRE = /:([^]+)/;
203const styleCommentRE = /\/\*[^]*?\*\//g;
204function parseStringStyle(cssText) {
205 const ret = {};
206 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
207 if (item) {
208 const tmp = item.split(propertyDelimiterRE);
209 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
210 }
211 });
212 return ret;
213}
214function stringifyStyle(styles) {
215 if (!styles) return "";
216 if (isString(styles)) return styles;
217 let ret = "";
218 for (const key in styles) {
219 const value = styles[key];
220 if (isString(value) || typeof value === "number") {
221 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
222 ret += `${normalizedKey}:${value};`;
223 }
224 }
225 return ret;
226}
227function normalizeClass(value) {
228 let res = "";
229 if (isString(value)) {
230 res = value;
231 } else if (isArray(value)) {
232 for (let i = 0; i < value.length; i++) {
233 const normalized = normalizeClass(value[i]);
234 if (normalized) {
235 res += normalized + " ";
236 }
237 }
238 } else if (isObject(value)) {
239 for (const name in value) {
240 if (value[name]) {
241 res += name + " ";
242 }
243 }
244 }
245 return res.trim();
246}
247function normalizeProps(props) {
248 if (!props) return null;
249 let { class: klass, style } = props;
250 if (klass && !isString(klass)) {
251 props.class = normalizeClass(klass);
252 }
253 if (style) {
254 props.style = normalizeStyle(style);
255 }
256 return props;
257}
258
259const 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";
260const 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";
261const 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";
262const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
263const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
264const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
265const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
266const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
267
268const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
269const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
270const isBooleanAttr = /* @__PURE__ */ makeMap(
271 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
272);
273function includeBooleanAttr(value) {
274 return !!value || value === "";
275}
276const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
277 `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`
278);
279const isKnownSvgAttr = /* @__PURE__ */ makeMap(
280 `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`
281);
282function isRenderableAttrValue(value) {
283 if (value == null) {
284 return false;
285 }
286 const type = typeof value;
287 return type === "string" || type === "number" || type === "boolean";
288}
289
290const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
291function getEscapedCssVarName(key, doubleEscape) {
292 return key.replace(
293 cssVarNameEscapeSymbolsRE,
294 (s) => `\\${s}`
295 );
296}
297
298function looseCompareArrays(a, b) {
299 if (a.length !== b.length) return false;
300 let equal = true;
301 for (let i = 0; equal && i < a.length; i++) {
302 equal = looseEqual(a[i], b[i]);
303 }
304 return equal;
305}
306function looseEqual(a, b) {
307 if (a === b) return true;
308 let aValidType = isDate(a);
309 let bValidType = isDate(b);
310 if (aValidType || bValidType) {
311 return aValidType && bValidType ? a.getTime() === b.getTime() : false;
312 }
313 aValidType = isSymbol(a);
314 bValidType = isSymbol(b);
315 if (aValidType || bValidType) {
316 return a === b;
317 }
318 aValidType = isArray(a);
319 bValidType = isArray(b);
320 if (aValidType || bValidType) {
321 return aValidType && bValidType ? looseCompareArrays(a, b) : false;
322 }
323 aValidType = isObject(a);
324 bValidType = isObject(b);
325 if (aValidType || bValidType) {
326 if (!aValidType || !bValidType) {
327 return false;
328 }
329 const aKeysCount = Object.keys(a).length;
330 const bKeysCount = Object.keys(b).length;
331 if (aKeysCount !== bKeysCount) {
332 return false;
333 }
334 for (const key in a) {
335 const aHasKey = a.hasOwnProperty(key);
336 const bHasKey = b.hasOwnProperty(key);
337 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
338 return false;
339 }
340 }
341 }
342 return String(a) === String(b);
343}
344function looseIndexOf(arr, val) {
345 return arr.findIndex((item) => looseEqual(item, val));
346}
347
348const isRef$1 = (val) => {
349 return !!(val && val["__v_isRef"] === true);
350};
351const toDisplayString = (val) => {
352 return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
353};
354const replacer = (_key, val) => {
355 if (isRef$1(val)) {
356 return replacer(_key, val.value);
357 } else if (isMap(val)) {
358 return {
359 [`Map(${val.size})`]: [...val.entries()].reduce(
360 (entries, [key, val2], i) => {
361 entries[stringifySymbol(key, i) + " =>"] = val2;
362 return entries;
363 },
364 {}
365 )
366 };
367 } else if (isSet(val)) {
368 return {
369 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
370 };
371 } else if (isSymbol(val)) {
372 return stringifySymbol(val);
373 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
374 return String(val);
375 }
376 return val;
377};
378const stringifySymbol = (v, i = "") => {
379 var _a;
380 return (
381 // Symbol.description in es2019+ so we need to cast here to pass
382 // the lib: es2016 check
383 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
384 );
385};
386
387function warn$2(msg, ...args) {
388 console.warn(`[Vue warn] ${msg}`, ...args);
389}
390
391let activeEffectScope;
392class EffectScope {
393 constructor(detached = false) {
394 this.detached = detached;
395 /**
396 * @internal
397 */
398 this._active = true;
399 /**
400 * @internal
401 */
402 this.effects = [];
403 /**
404 * @internal
405 */
406 this.cleanups = [];
407 this._isPaused = false;
408 this.parent = activeEffectScope;
409 if (!detached && activeEffectScope) {
410 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
411 this
412 ) - 1;
413 }
414 }
415 get active() {
416 return this._active;
417 }
418 pause() {
419 if (this._active) {
420 this._isPaused = true;
421 let i, l;
422 if (this.scopes) {
423 for (i = 0, l = this.scopes.length; i < l; i++) {
424 this.scopes[i].pause();
425 }
426 }
427 for (i = 0, l = this.effects.length; i < l; i++) {
428 this.effects[i].pause();
429 }
430 }
431 }
432 /**
433 * Resumes the effect scope, including all child scopes and effects.
434 */
435 resume() {
436 if (this._active) {
437 if (this._isPaused) {
438 this._isPaused = false;
439 let i, l;
440 if (this.scopes) {
441 for (i = 0, l = this.scopes.length; i < l; i++) {
442 this.scopes[i].resume();
443 }
444 }
445 for (i = 0, l = this.effects.length; i < l; i++) {
446 this.effects[i].resume();
447 }
448 }
449 }
450 }
451 run(fn) {
452 if (this._active) {
453 const currentEffectScope = activeEffectScope;
454 try {
455 activeEffectScope = this;
456 return fn();
457 } finally {
458 activeEffectScope = currentEffectScope;
459 }
460 } else {
461 warn$2(`cannot run an inactive effect scope.`);
462 }
463 }
464 /**
465 * This should only be called on non-detached scopes
466 * @internal
467 */
468 on() {
469 activeEffectScope = this;
470 }
471 /**
472 * This should only be called on non-detached scopes
473 * @internal
474 */
475 off() {
476 activeEffectScope = this.parent;
477 }
478 stop(fromParent) {
479 if (this._active) {
480 this._active = false;
481 let i, l;
482 for (i = 0, l = this.effects.length; i < l; i++) {
483 this.effects[i].stop();
484 }
485 this.effects.length = 0;
486 for (i = 0, l = this.cleanups.length; i < l; i++) {
487 this.cleanups[i]();
488 }
489 this.cleanups.length = 0;
490 if (this.scopes) {
491 for (i = 0, l = this.scopes.length; i < l; i++) {
492 this.scopes[i].stop(true);
493 }
494 this.scopes.length = 0;
495 }
496 if (!this.detached && this.parent && !fromParent) {
497 const last = this.parent.scopes.pop();
498 if (last && last !== this) {
499 this.parent.scopes[this.index] = last;
500 last.index = this.index;
501 }
502 }
503 this.parent = void 0;
504 }
505 }
506}
507function effectScope(detached) {
508 return new EffectScope(detached);
509}
510function getCurrentScope() {
511 return activeEffectScope;
512}
513function onScopeDispose(fn, failSilently = false) {
514 if (activeEffectScope) {
515 activeEffectScope.cleanups.push(fn);
516 } else if (!failSilently) {
517 warn$2(
518 `onScopeDispose() is called when there is no active effect scope to be associated with.`
519 );
520 }
521}
522
523let activeSub;
524const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
525class ReactiveEffect {
526 constructor(fn) {
527 this.fn = fn;
528 /**
529 * @internal
530 */
531 this.deps = void 0;
532 /**
533 * @internal
534 */
535 this.depsTail = void 0;
536 /**
537 * @internal
538 */
539 this.flags = 1 | 4;
540 /**
541 * @internal
542 */
543 this.next = void 0;
544 /**
545 * @internal
546 */
547 this.cleanup = void 0;
548 this.scheduler = void 0;
549 if (activeEffectScope && activeEffectScope.active) {
550 activeEffectScope.effects.push(this);
551 }
552 }
553 pause() {
554 this.flags |= 64;
555 }
556 resume() {
557 if (this.flags & 64) {
558 this.flags &= ~64;
559 if (pausedQueueEffects.has(this)) {
560 pausedQueueEffects.delete(this);
561 this.trigger();
562 }
563 }
564 }
565 /**
566 * @internal
567 */
568 notify() {
569 if (this.flags & 2 && !(this.flags & 32)) {
570 return;
571 }
572 if (!(this.flags & 8)) {
573 batch(this);
574 }
575 }
576 run() {
577 if (!(this.flags & 1)) {
578 return this.fn();
579 }
580 this.flags |= 2;
581 cleanupEffect(this);
582 prepareDeps(this);
583 const prevEffect = activeSub;
584 const prevShouldTrack = shouldTrack;
585 activeSub = this;
586 shouldTrack = true;
587 try {
588 return this.fn();
589 } finally {
590 if (activeSub !== this) {
591 warn$2(
592 "Active effect was not restored correctly - this is likely a Vue internal bug."
593 );
594 }
595 cleanupDeps(this);
596 activeSub = prevEffect;
597 shouldTrack = prevShouldTrack;
598 this.flags &= ~2;
599 }
600 }
601 stop() {
602 if (this.flags & 1) {
603 for (let link = this.deps; link; link = link.nextDep) {
604 removeSub(link);
605 }
606 this.deps = this.depsTail = void 0;
607 cleanupEffect(this);
608 this.onStop && this.onStop();
609 this.flags &= ~1;
610 }
611 }
612 trigger() {
613 if (this.flags & 64) {
614 pausedQueueEffects.add(this);
615 } else if (this.scheduler) {
616 this.scheduler();
617 } else {
618 this.runIfDirty();
619 }
620 }
621 /**
622 * @internal
623 */
624 runIfDirty() {
625 if (isDirty(this)) {
626 this.run();
627 }
628 }
629 get dirty() {
630 return isDirty(this);
631 }
632}
633let batchDepth = 0;
634let batchedSub;
635let batchedComputed;
636function batch(sub, isComputed = false) {
637 sub.flags |= 8;
638 if (isComputed) {
639 sub.next = batchedComputed;
640 batchedComputed = sub;
641 return;
642 }
643 sub.next = batchedSub;
644 batchedSub = sub;
645}
646function startBatch() {
647 batchDepth++;
648}
649function endBatch() {
650 if (--batchDepth > 0) {
651 return;
652 }
653 if (batchedComputed) {
654 let e = batchedComputed;
655 batchedComputed = void 0;
656 while (e) {
657 const next = e.next;
658 e.next = void 0;
659 e.flags &= ~8;
660 e = next;
661 }
662 }
663 let error;
664 while (batchedSub) {
665 let e = batchedSub;
666 batchedSub = void 0;
667 while (e) {
668 const next = e.next;
669 e.next = void 0;
670 e.flags &= ~8;
671 if (e.flags & 1) {
672 try {
673 ;
674 e.trigger();
675 } catch (err) {
676 if (!error) error = err;
677 }
678 }
679 e = next;
680 }
681 }
682 if (error) throw error;
683}
684function prepareDeps(sub) {
685 for (let link = sub.deps; link; link = link.nextDep) {
686 link.version = -1;
687 link.prevActiveLink = link.dep.activeLink;
688 link.dep.activeLink = link;
689 }
690}
691function cleanupDeps(sub) {
692 let head;
693 let tail = sub.depsTail;
694 let link = tail;
695 while (link) {
696 const prev = link.prevDep;
697 if (link.version === -1) {
698 if (link === tail) tail = prev;
699 removeSub(link);
700 removeDep(link);
701 } else {
702 head = link;
703 }
704 link.dep.activeLink = link.prevActiveLink;
705 link.prevActiveLink = void 0;
706 link = prev;
707 }
708 sub.deps = head;
709 sub.depsTail = tail;
710}
711function isDirty(sub) {
712 for (let link = sub.deps; link; link = link.nextDep) {
713 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
714 return true;
715 }
716 }
717 if (sub._dirty) {
718 return true;
719 }
720 return false;
721}
722function refreshComputed(computed) {
723 if (computed.flags & 4 && !(computed.flags & 16)) {
724 return;
725 }
726 computed.flags &= ~16;
727 if (computed.globalVersion === globalVersion) {
728 return;
729 }
730 computed.globalVersion = globalVersion;
731 const dep = computed.dep;
732 computed.flags |= 2;
733 if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
734 computed.flags &= ~2;
735 return;
736 }
737 const prevSub = activeSub;
738 const prevShouldTrack = shouldTrack;
739 activeSub = computed;
740 shouldTrack = true;
741 try {
742 prepareDeps(computed);
743 const value = computed.fn(computed._value);
744 if (dep.version === 0 || hasChanged(value, computed._value)) {
745 computed._value = value;
746 dep.version++;
747 }
748 } catch (err) {
749 dep.version++;
750 throw err;
751 } finally {
752 activeSub = prevSub;
753 shouldTrack = prevShouldTrack;
754 cleanupDeps(computed);
755 computed.flags &= ~2;
756 }
757}
758function removeSub(link, soft = false) {
759 const { dep, prevSub, nextSub } = link;
760 if (prevSub) {
761 prevSub.nextSub = nextSub;
762 link.prevSub = void 0;
763 }
764 if (nextSub) {
765 nextSub.prevSub = prevSub;
766 link.nextSub = void 0;
767 }
768 if (dep.subsHead === link) {
769 dep.subsHead = nextSub;
770 }
771 if (dep.subs === link) {
772 dep.subs = prevSub;
773 if (!prevSub && dep.computed) {
774 dep.computed.flags &= ~4;
775 for (let l = dep.computed.deps; l; l = l.nextDep) {
776 removeSub(l, true);
777 }
778 }
779 }
780 if (!soft && !--dep.sc && dep.map) {
781 dep.map.delete(dep.key);
782 }
783}
784function removeDep(link) {
785 const { prevDep, nextDep } = link;
786 if (prevDep) {
787 prevDep.nextDep = nextDep;
788 link.prevDep = void 0;
789 }
790 if (nextDep) {
791 nextDep.prevDep = prevDep;
792 link.nextDep = void 0;
793 }
794}
795function effect(fn, options) {
796 if (fn.effect instanceof ReactiveEffect) {
797 fn = fn.effect.fn;
798 }
799 const e = new ReactiveEffect(fn);
800 if (options) {
801 extend(e, options);
802 }
803 try {
804 e.run();
805 } catch (err) {
806 e.stop();
807 throw err;
808 }
809 const runner = e.run.bind(e);
810 runner.effect = e;
811 return runner;
812}
813function stop(runner) {
814 runner.effect.stop();
815}
816let shouldTrack = true;
817const trackStack = [];
818function pauseTracking() {
819 trackStack.push(shouldTrack);
820 shouldTrack = false;
821}
822function resetTracking() {
823 const last = trackStack.pop();
824 shouldTrack = last === void 0 ? true : last;
825}
826function cleanupEffect(e) {
827 const { cleanup } = e;
828 e.cleanup = void 0;
829 if (cleanup) {
830 const prevSub = activeSub;
831 activeSub = void 0;
832 try {
833 cleanup();
834 } finally {
835 activeSub = prevSub;
836 }
837 }
838}
839
840let globalVersion = 0;
841class Link {
842 constructor(sub, dep) {
843 this.sub = sub;
844 this.dep = dep;
845 this.version = dep.version;
846 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
847 }
848}
849class Dep {
850 constructor(computed) {
851 this.computed = computed;
852 this.version = 0;
853 /**
854 * Link between this dep and the current active effect
855 */
856 this.activeLink = void 0;
857 /**
858 * Doubly linked list representing the subscribing effects (tail)
859 */
860 this.subs = void 0;
861 /**
862 * For object property deps cleanup
863 */
864 this.map = void 0;
865 this.key = void 0;
866 /**
867 * Subscriber counter
868 */
869 this.sc = 0;
870 {
871 this.subsHead = void 0;
872 }
873 }
874 track(debugInfo) {
875 if (!activeSub || !shouldTrack || activeSub === this.computed) {
876 return;
877 }
878 let link = this.activeLink;
879 if (link === void 0 || link.sub !== activeSub) {
880 link = this.activeLink = new Link(activeSub, this);
881 if (!activeSub.deps) {
882 activeSub.deps = activeSub.depsTail = link;
883 } else {
884 link.prevDep = activeSub.depsTail;
885 activeSub.depsTail.nextDep = link;
886 activeSub.depsTail = link;
887 }
888 addSub(link);
889 } else if (link.version === -1) {
890 link.version = this.version;
891 if (link.nextDep) {
892 const next = link.nextDep;
893 next.prevDep = link.prevDep;
894 if (link.prevDep) {
895 link.prevDep.nextDep = next;
896 }
897 link.prevDep = activeSub.depsTail;
898 link.nextDep = void 0;
899 activeSub.depsTail.nextDep = link;
900 activeSub.depsTail = link;
901 if (activeSub.deps === link) {
902 activeSub.deps = next;
903 }
904 }
905 }
906 if (activeSub.onTrack) {
907 activeSub.onTrack(
908 extend(
909 {
910 effect: activeSub
911 },
912 debugInfo
913 )
914 );
915 }
916 return link;
917 }
918 trigger(debugInfo) {
919 this.version++;
920 globalVersion++;
921 this.notify(debugInfo);
922 }
923 notify(debugInfo) {
924 startBatch();
925 try {
926 if (true) {
927 for (let head = this.subsHead; head; head = head.nextSub) {
928 if (head.sub.onTrigger && !(head.sub.flags & 8)) {
929 head.sub.onTrigger(
930 extend(
931 {
932 effect: head.sub
933 },
934 debugInfo
935 )
936 );
937 }
938 }
939 }
940 for (let link = this.subs; link; link = link.prevSub) {
941 if (link.sub.notify()) {
942 ;
943 link.sub.dep.notify();
944 }
945 }
946 } finally {
947 endBatch();
948 }
949 }
950}
951function addSub(link) {
952 link.dep.sc++;
953 if (link.sub.flags & 4) {
954 const computed = link.dep.computed;
955 if (computed && !link.dep.subs) {
956 computed.flags |= 4 | 16;
957 for (let l = computed.deps; l; l = l.nextDep) {
958 addSub(l);
959 }
960 }
961 const currentTail = link.dep.subs;
962 if (currentTail !== link) {
963 link.prevSub = currentTail;
964 if (currentTail) currentTail.nextSub = link;
965 }
966 if (link.dep.subsHead === void 0) {
967 link.dep.subsHead = link;
968 }
969 link.dep.subs = link;
970 }
971}
972const targetMap = /* @__PURE__ */ new WeakMap();
973const ITERATE_KEY = Symbol(
974 "Object iterate"
975);
976const MAP_KEY_ITERATE_KEY = Symbol(
977 "Map keys iterate"
978);
979const ARRAY_ITERATE_KEY = Symbol(
980 "Array iterate"
981);
982function track(target, type, key) {
983 if (shouldTrack && activeSub) {
984 let depsMap = targetMap.get(target);
985 if (!depsMap) {
986 targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
987 }
988 let dep = depsMap.get(key);
989 if (!dep) {
990 depsMap.set(key, dep = new Dep());
991 dep.map = depsMap;
992 dep.key = key;
993 }
994 {
995 dep.track({
996 target,
997 type,
998 key
999 });
1000 }
1001 }
1002}
1003function trigger(target, type, key, newValue, oldValue, oldTarget) {
1004 const depsMap = targetMap.get(target);
1005 if (!depsMap) {
1006 globalVersion++;
1007 return;
1008 }
1009 const run = (dep) => {
1010 if (dep) {
1011 {
1012 dep.trigger({
1013 target,
1014 type,
1015 key,
1016 newValue,
1017 oldValue,
1018 oldTarget
1019 });
1020 }
1021 }
1022 };
1023 startBatch();
1024 if (type === "clear") {
1025 depsMap.forEach(run);
1026 } else {
1027 const targetIsArray = isArray(target);
1028 const isArrayIndex = targetIsArray && isIntegerKey(key);
1029 if (targetIsArray && key === "length") {
1030 const newLength = Number(newValue);
1031 depsMap.forEach((dep, key2) => {
1032 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
1033 run(dep);
1034 }
1035 });
1036 } else {
1037 if (key !== void 0 || depsMap.has(void 0)) {
1038 run(depsMap.get(key));
1039 }
1040 if (isArrayIndex) {
1041 run(depsMap.get(ARRAY_ITERATE_KEY));
1042 }
1043 switch (type) {
1044 case "add":
1045 if (!targetIsArray) {
1046 run(depsMap.get(ITERATE_KEY));
1047 if (isMap(target)) {
1048 run(depsMap.get(MAP_KEY_ITERATE_KEY));
1049 }
1050 } else if (isArrayIndex) {
1051 run(depsMap.get("length"));
1052 }
1053 break;
1054 case "delete":
1055 if (!targetIsArray) {
1056 run(depsMap.get(ITERATE_KEY));
1057 if (isMap(target)) {
1058 run(depsMap.get(MAP_KEY_ITERATE_KEY));
1059 }
1060 }
1061 break;
1062 case "set":
1063 if (isMap(target)) {
1064 run(depsMap.get(ITERATE_KEY));
1065 }
1066 break;
1067 }
1068 }
1069 }
1070 endBatch();
1071}
1072function getDepFromReactive(object, key) {
1073 const depMap = targetMap.get(object);
1074 return depMap && depMap.get(key);
1075}
1076
1077function reactiveReadArray(array) {
1078 const raw = toRaw(array);
1079 if (raw === array) return raw;
1080 track(raw, "iterate", ARRAY_ITERATE_KEY);
1081 return isShallow(array) ? raw : raw.map(toReactive);
1082}
1083function shallowReadArray(arr) {
1084 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
1085 return arr;
1086}
1087const arrayInstrumentations = {
1088 __proto__: null,
1089 [Symbol.iterator]() {
1090 return iterator(this, Symbol.iterator, toReactive);
1091 },
1092 concat(...args) {
1093 return reactiveReadArray(this).concat(
1094 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1095 );
1096 },
1097 entries() {
1098 return iterator(this, "entries", (value) => {
1099 value[1] = toReactive(value[1]);
1100 return value;
1101 });
1102 },
1103 every(fn, thisArg) {
1104 return apply(this, "every", fn, thisArg, void 0, arguments);
1105 },
1106 filter(fn, thisArg) {
1107 return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
1108 },
1109 find(fn, thisArg) {
1110 return apply(this, "find", fn, thisArg, toReactive, arguments);
1111 },
1112 findIndex(fn, thisArg) {
1113 return apply(this, "findIndex", fn, thisArg, void 0, arguments);
1114 },
1115 findLast(fn, thisArg) {
1116 return apply(this, "findLast", fn, thisArg, toReactive, arguments);
1117 },
1118 findLastIndex(fn, thisArg) {
1119 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
1120 },
1121 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1122 forEach(fn, thisArg) {
1123 return apply(this, "forEach", fn, thisArg, void 0, arguments);
1124 },
1125 includes(...args) {
1126 return searchProxy(this, "includes", args);
1127 },
1128 indexOf(...args) {
1129 return searchProxy(this, "indexOf", args);
1130 },
1131 join(separator) {
1132 return reactiveReadArray(this).join(separator);
1133 },
1134 // keys() iterator only reads `length`, no optimisation required
1135 lastIndexOf(...args) {
1136 return searchProxy(this, "lastIndexOf", args);
1137 },
1138 map(fn, thisArg) {
1139 return apply(this, "map", fn, thisArg, void 0, arguments);
1140 },
1141 pop() {
1142 return noTracking(this, "pop");
1143 },
1144 push(...args) {
1145 return noTracking(this, "push", args);
1146 },
1147 reduce(fn, ...args) {
1148 return reduce(this, "reduce", fn, args);
1149 },
1150 reduceRight(fn, ...args) {
1151 return reduce(this, "reduceRight", fn, args);
1152 },
1153 shift() {
1154 return noTracking(this, "shift");
1155 },
1156 // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1157 some(fn, thisArg) {
1158 return apply(this, "some", fn, thisArg, void 0, arguments);
1159 },
1160 splice(...args) {
1161 return noTracking(this, "splice", args);
1162 },
1163 toReversed() {
1164 return reactiveReadArray(this).toReversed();
1165 },
1166 toSorted(comparer) {
1167 return reactiveReadArray(this).toSorted(comparer);
1168 },
1169 toSpliced(...args) {
1170 return reactiveReadArray(this).toSpliced(...args);
1171 },
1172 unshift(...args) {
1173 return noTracking(this, "unshift", args);
1174 },
1175 values() {
1176 return iterator(this, "values", toReactive);
1177 }
1178};
1179function iterator(self, method, wrapValue) {
1180 const arr = shallowReadArray(self);
1181 const iter = arr[method]();
1182 if (arr !== self && !isShallow(self)) {
1183 iter._next = iter.next;
1184 iter.next = () => {
1185 const result = iter._next();
1186 if (result.value) {
1187 result.value = wrapValue(result.value);
1188 }
1189 return result;
1190 };
1191 }
1192 return iter;
1193}
1194const arrayProto = Array.prototype;
1195function apply(self, method, fn, thisArg, wrappedRetFn, args) {
1196 const arr = shallowReadArray(self);
1197 const needsWrap = arr !== self && !isShallow(self);
1198 const methodFn = arr[method];
1199 if (methodFn !== arrayProto[method]) {
1200 const result2 = methodFn.apply(self, args);
1201 return needsWrap ? toReactive(result2) : result2;
1202 }
1203 let wrappedFn = fn;
1204 if (arr !== self) {
1205 if (needsWrap) {
1206 wrappedFn = function(item, index) {
1207 return fn.call(this, toReactive(item), index, self);
1208 };
1209 } else if (fn.length > 2) {
1210 wrappedFn = function(item, index) {
1211 return fn.call(this, item, index, self);
1212 };
1213 }
1214 }
1215 const result = methodFn.call(arr, wrappedFn, thisArg);
1216 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1217}
1218function reduce(self, method, fn, args) {
1219 const arr = shallowReadArray(self);
1220 let wrappedFn = fn;
1221 if (arr !== self) {
1222 if (!isShallow(self)) {
1223 wrappedFn = function(acc, item, index) {
1224 return fn.call(this, acc, toReactive(item), index, self);
1225 };
1226 } else if (fn.length > 3) {
1227 wrappedFn = function(acc, item, index) {
1228 return fn.call(this, acc, item, index, self);
1229 };
1230 }
1231 }
1232 return arr[method](wrappedFn, ...args);
1233}
1234function searchProxy(self, method, args) {
1235 const arr = toRaw(self);
1236 track(arr, "iterate", ARRAY_ITERATE_KEY);
1237 const res = arr[method](...args);
1238 if ((res === -1 || res === false) && isProxy(args[0])) {
1239 args[0] = toRaw(args[0]);
1240 return arr[method](...args);
1241 }
1242 return res;
1243}
1244function noTracking(self, method, args = []) {
1245 pauseTracking();
1246 startBatch();
1247 const res = toRaw(self)[method].apply(self, args);
1248 endBatch();
1249 resetTracking();
1250 return res;
1251}
1252
1253const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
1254const builtInSymbols = new Set(
1255 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
1256);
1257function hasOwnProperty(key) {
1258 if (!isSymbol(key)) key = String(key);
1259 const obj = toRaw(this);
1260 track(obj, "has", key);
1261 return obj.hasOwnProperty(key);
1262}
1263class BaseReactiveHandler {
1264 constructor(_isReadonly = false, _isShallow = false) {
1265 this._isReadonly = _isReadonly;
1266 this._isShallow = _isShallow;
1267 }
1268 get(target, key, receiver) {
1269 if (key === "__v_skip") return target["__v_skip"];
1270 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
1271 if (key === "__v_isReactive") {
1272 return !isReadonly2;
1273 } else if (key === "__v_isReadonly") {
1274 return isReadonly2;
1275 } else if (key === "__v_isShallow") {
1276 return isShallow2;
1277 } else if (key === "__v_raw") {
1278 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1279 // this means the receiver is a user proxy of the reactive proxy
1280 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1281 return target;
1282 }
1283 return;
1284 }
1285 const targetIsArray = isArray(target);
1286 if (!isReadonly2) {
1287 let fn;
1288 if (targetIsArray && (fn = arrayInstrumentations[key])) {
1289 return fn;
1290 }
1291 if (key === "hasOwnProperty") {
1292 return hasOwnProperty;
1293 }
1294 }
1295 const res = Reflect.get(
1296 target,
1297 key,
1298 // if this is a proxy wrapping a ref, return methods using the raw ref
1299 // as receiver so that we don't have to call `toRaw` on the ref in all
1300 // its class methods
1301 isRef(target) ? target : receiver
1302 );
1303 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1304 return res;
1305 }
1306 if (!isReadonly2) {
1307 track(target, "get", key);
1308 }
1309 if (isShallow2) {
1310 return res;
1311 }
1312 if (isRef(res)) {
1313 return targetIsArray && isIntegerKey(key) ? res : res.value;
1314 }
1315 if (isObject(res)) {
1316 return isReadonly2 ? readonly(res) : reactive(res);
1317 }
1318 return res;
1319 }
1320}
1321class MutableReactiveHandler extends BaseReactiveHandler {
1322 constructor(isShallow2 = false) {
1323 super(false, isShallow2);
1324 }
1325 set(target, key, value, receiver) {
1326 let oldValue = target[key];
1327 if (!this._isShallow) {
1328 const isOldValueReadonly = isReadonly(oldValue);
1329 if (!isShallow(value) && !isReadonly(value)) {
1330 oldValue = toRaw(oldValue);
1331 value = toRaw(value);
1332 }
1333 if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1334 if (isOldValueReadonly) {
1335 return false;
1336 } else {
1337 oldValue.value = value;
1338 return true;
1339 }
1340 }
1341 }
1342 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
1343 const result = Reflect.set(
1344 target,
1345 key,
1346 value,
1347 isRef(target) ? target : receiver
1348 );
1349 if (target === toRaw(receiver)) {
1350 if (!hadKey) {
1351 trigger(target, "add", key, value);
1352 } else if (hasChanged(value, oldValue)) {
1353 trigger(target, "set", key, value, oldValue);
1354 }
1355 }
1356 return result;
1357 }
1358 deleteProperty(target, key) {
1359 const hadKey = hasOwn(target, key);
1360 const oldValue = target[key];
1361 const result = Reflect.deleteProperty(target, key);
1362 if (result && hadKey) {
1363 trigger(target, "delete", key, void 0, oldValue);
1364 }
1365 return result;
1366 }
1367 has(target, key) {
1368 const result = Reflect.has(target, key);
1369 if (!isSymbol(key) || !builtInSymbols.has(key)) {
1370 track(target, "has", key);
1371 }
1372 return result;
1373 }
1374 ownKeys(target) {
1375 track(
1376 target,
1377 "iterate",
1378 isArray(target) ? "length" : ITERATE_KEY
1379 );
1380 return Reflect.ownKeys(target);
1381 }
1382}
1383class ReadonlyReactiveHandler extends BaseReactiveHandler {
1384 constructor(isShallow2 = false) {
1385 super(true, isShallow2);
1386 }
1387 set(target, key) {
1388 {
1389 warn$2(
1390 `Set operation on key "${String(key)}" failed: target is readonly.`,
1391 target
1392 );
1393 }
1394 return true;
1395 }
1396 deleteProperty(target, key) {
1397 {
1398 warn$2(
1399 `Delete operation on key "${String(key)}" failed: target is readonly.`,
1400 target
1401 );
1402 }
1403 return true;
1404 }
1405}
1406const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1407const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1408const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1409const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1410
1411const toShallow = (value) => value;
1412const getProto = (v) => Reflect.getPrototypeOf(v);
1413function createIterableMethod(method, isReadonly2, isShallow2) {
1414 return function(...args) {
1415 const target = this["__v_raw"];
1416 const rawTarget = toRaw(target);
1417 const targetIsMap = isMap(rawTarget);
1418 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
1419 const isKeyOnly = method === "keys" && targetIsMap;
1420 const innerIterator = target[method](...args);
1421 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
1422 !isReadonly2 && track(
1423 rawTarget,
1424 "iterate",
1425 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
1426 );
1427 return {
1428 // iterator protocol
1429 next() {
1430 const { value, done } = innerIterator.next();
1431 return done ? { value, done } : {
1432 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
1433 done
1434 };
1435 },
1436 // iterable protocol
1437 [Symbol.iterator]() {
1438 return this;
1439 }
1440 };
1441 };
1442}
1443function createReadonlyMethod(type) {
1444 return function(...args) {
1445 {
1446 const key = args[0] ? `on key "${args[0]}" ` : ``;
1447 warn$2(
1448 `${capitalize(type)} operation ${key}failed: target is readonly.`,
1449 toRaw(this)
1450 );
1451 }
1452 return type === "delete" ? false : type === "clear" ? void 0 : this;
1453 };
1454}
1455function createInstrumentations(readonly, shallow) {
1456 const instrumentations = {
1457 get(key) {
1458 const target = this["__v_raw"];
1459 const rawTarget = toRaw(target);
1460 const rawKey = toRaw(key);
1461 if (!readonly) {
1462 if (hasChanged(key, rawKey)) {
1463 track(rawTarget, "get", key);
1464 }
1465 track(rawTarget, "get", rawKey);
1466 }
1467 const { has } = getProto(rawTarget);
1468 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1469 if (has.call(rawTarget, key)) {
1470 return wrap(target.get(key));
1471 } else if (has.call(rawTarget, rawKey)) {
1472 return wrap(target.get(rawKey));
1473 } else if (target !== rawTarget) {
1474 target.get(key);
1475 }
1476 },
1477 get size() {
1478 const target = this["__v_raw"];
1479 !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1480 return Reflect.get(target, "size", target);
1481 },
1482 has(key) {
1483 const target = this["__v_raw"];
1484 const rawTarget = toRaw(target);
1485 const rawKey = toRaw(key);
1486 if (!readonly) {
1487 if (hasChanged(key, rawKey)) {
1488 track(rawTarget, "has", key);
1489 }
1490 track(rawTarget, "has", rawKey);
1491 }
1492 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
1493 },
1494 forEach(callback, thisArg) {
1495 const observed = this;
1496 const target = observed["__v_raw"];
1497 const rawTarget = toRaw(target);
1498 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
1499 !readonly && track(rawTarget, "iterate", ITERATE_KEY);
1500 return target.forEach((value, key) => {
1501 return callback.call(thisArg, wrap(value), wrap(key), observed);
1502 });
1503 }
1504 };
1505 extend(
1506 instrumentations,
1507 readonly ? {
1508 add: createReadonlyMethod("add"),
1509 set: createReadonlyMethod("set"),
1510 delete: createReadonlyMethod("delete"),
1511 clear: createReadonlyMethod("clear")
1512 } : {
1513 add(value) {
1514 if (!shallow && !isShallow(value) && !isReadonly(value)) {
1515 value = toRaw(value);
1516 }
1517 const target = toRaw(this);
1518 const proto = getProto(target);
1519 const hadKey = proto.has.call(target, value);
1520 if (!hadKey) {
1521 target.add(value);
1522 trigger(target, "add", value, value);
1523 }
1524 return this;
1525 },
1526 set(key, value) {
1527 if (!shallow && !isShallow(value) && !isReadonly(value)) {
1528 value = toRaw(value);
1529 }
1530 const target = toRaw(this);
1531 const { has, get } = getProto(target);
1532 let hadKey = has.call(target, key);
1533 if (!hadKey) {
1534 key = toRaw(key);
1535 hadKey = has.call(target, key);
1536 } else {
1537 checkIdentityKeys(target, has, key);
1538 }
1539 const oldValue = get.call(target, key);
1540 target.set(key, value);
1541 if (!hadKey) {
1542 trigger(target, "add", key, value);
1543 } else if (hasChanged(value, oldValue)) {
1544 trigger(target, "set", key, value, oldValue);
1545 }
1546 return this;
1547 },
1548 delete(key) {
1549 const target = toRaw(this);
1550 const { has, get } = getProto(target);
1551 let hadKey = has.call(target, key);
1552 if (!hadKey) {
1553 key = toRaw(key);
1554 hadKey = has.call(target, key);
1555 } else {
1556 checkIdentityKeys(target, has, key);
1557 }
1558 const oldValue = get ? get.call(target, key) : void 0;
1559 const result = target.delete(key);
1560 if (hadKey) {
1561 trigger(target, "delete", key, void 0, oldValue);
1562 }
1563 return result;
1564 },
1565 clear() {
1566 const target = toRaw(this);
1567 const hadItems = target.size !== 0;
1568 const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
1569 const result = target.clear();
1570 if (hadItems) {
1571 trigger(
1572 target,
1573 "clear",
1574 void 0,
1575 void 0,
1576 oldTarget
1577 );
1578 }
1579 return result;
1580 }
1581 }
1582 );
1583 const iteratorMethods = [
1584 "keys",
1585 "values",
1586 "entries",
1587 Symbol.iterator
1588 ];
1589 iteratorMethods.forEach((method) => {
1590 instrumentations[method] = createIterableMethod(method, readonly, shallow);
1591 });
1592 return instrumentations;
1593}
1594function createInstrumentationGetter(isReadonly2, shallow) {
1595 const instrumentations = createInstrumentations(isReadonly2, shallow);
1596 return (target, key, receiver) => {
1597 if (key === "__v_isReactive") {
1598 return !isReadonly2;
1599 } else if (key === "__v_isReadonly") {
1600 return isReadonly2;
1601 } else if (key === "__v_raw") {
1602 return target;
1603 }
1604 return Reflect.get(
1605 hasOwn(instrumentations, key) && key in target ? instrumentations : target,
1606 key,
1607 receiver
1608 );
1609 };
1610}
1611const mutableCollectionHandlers = {
1612 get: /* @__PURE__ */ createInstrumentationGetter(false, false)
1613};
1614const shallowCollectionHandlers = {
1615 get: /* @__PURE__ */ createInstrumentationGetter(false, true)
1616};
1617const readonlyCollectionHandlers = {
1618 get: /* @__PURE__ */ createInstrumentationGetter(true, false)
1619};
1620const shallowReadonlyCollectionHandlers = {
1621 get: /* @__PURE__ */ createInstrumentationGetter(true, true)
1622};
1623function checkIdentityKeys(target, has, key) {
1624 const rawKey = toRaw(key);
1625 if (rawKey !== key && has.call(target, rawKey)) {
1626 const type = toRawType(target);
1627 warn$2(
1628 `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.`
1629 );
1630 }
1631}
1632
1633const reactiveMap = /* @__PURE__ */ new WeakMap();
1634const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1635const readonlyMap = /* @__PURE__ */ new WeakMap();
1636const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
1637function targetTypeMap(rawType) {
1638 switch (rawType) {
1639 case "Object":
1640 case "Array":
1641 return 1 /* COMMON */;
1642 case "Map":
1643 case "Set":
1644 case "WeakMap":
1645 case "WeakSet":
1646 return 2 /* COLLECTION */;
1647 default:
1648 return 0 /* INVALID */;
1649 }
1650}
1651function getTargetType(value) {
1652 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1653}
1654function reactive(target) {
1655 if (isReadonly(target)) {
1656 return target;
1657 }
1658 return createReactiveObject(
1659 target,
1660 false,
1661 mutableHandlers,
1662 mutableCollectionHandlers,
1663 reactiveMap
1664 );
1665}
1666function shallowReactive(target) {
1667 return createReactiveObject(
1668 target,
1669 false,
1670 shallowReactiveHandlers,
1671 shallowCollectionHandlers,
1672 shallowReactiveMap
1673 );
1674}
1675function readonly(target) {
1676 return createReactiveObject(
1677 target,
1678 true,
1679 readonlyHandlers,
1680 readonlyCollectionHandlers,
1681 readonlyMap
1682 );
1683}
1684function shallowReadonly(target) {
1685 return createReactiveObject(
1686 target,
1687 true,
1688 shallowReadonlyHandlers,
1689 shallowReadonlyCollectionHandlers,
1690 shallowReadonlyMap
1691 );
1692}
1693function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1694 if (!isObject(target)) {
1695 {
1696 warn$2(
1697 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
1698 target
1699 )}`
1700 );
1701 }
1702 return target;
1703 }
1704 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1705 return target;
1706 }
1707 const existingProxy = proxyMap.get(target);
1708 if (existingProxy) {
1709 return existingProxy;
1710 }
1711 const targetType = getTargetType(target);
1712 if (targetType === 0 /* INVALID */) {
1713 return target;
1714 }
1715 const proxy = new Proxy(
1716 target,
1717 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
1718 );
1719 proxyMap.set(target, proxy);
1720 return proxy;
1721}
1722function isReactive(value) {
1723 if (isReadonly(value)) {
1724 return isReactive(value["__v_raw"]);
1725 }
1726 return !!(value && value["__v_isReactive"]);
1727}
1728function isReadonly(value) {
1729 return !!(value && value["__v_isReadonly"]);
1730}
1731function isShallow(value) {
1732 return !!(value && value["__v_isShallow"]);
1733}
1734function isProxy(value) {
1735 return value ? !!value["__v_raw"] : false;
1736}
1737function toRaw(observed) {
1738 const raw = observed && observed["__v_raw"];
1739 return raw ? toRaw(raw) : observed;
1740}
1741function markRaw(value) {
1742 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1743 def(value, "__v_skip", true);
1744 }
1745 return value;
1746}
1747const toReactive = (value) => isObject(value) ? reactive(value) : value;
1748const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1749
1750function isRef(r) {
1751 return r ? r["__v_isRef"] === true : false;
1752}
1753function ref(value) {
1754 return createRef(value, false);
1755}
1756function shallowRef(value) {
1757 return createRef(value, true);
1758}
1759function createRef(rawValue, shallow) {
1760 if (isRef(rawValue)) {
1761 return rawValue;
1762 }
1763 return new RefImpl(rawValue, shallow);
1764}
1765class RefImpl {
1766 constructor(value, isShallow2) {
1767 this.dep = new Dep();
1768 this["__v_isRef"] = true;
1769 this["__v_isShallow"] = false;
1770 this._rawValue = isShallow2 ? value : toRaw(value);
1771 this._value = isShallow2 ? value : toReactive(value);
1772 this["__v_isShallow"] = isShallow2;
1773 }
1774 get value() {
1775 {
1776 this.dep.track({
1777 target: this,
1778 type: "get",
1779 key: "value"
1780 });
1781 }
1782 return this._value;
1783 }
1784 set value(newValue) {
1785 const oldValue = this._rawValue;
1786 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1787 newValue = useDirectValue ? newValue : toRaw(newValue);
1788 if (hasChanged(newValue, oldValue)) {
1789 this._rawValue = newValue;
1790 this._value = useDirectValue ? newValue : toReactive(newValue);
1791 {
1792 this.dep.trigger({
1793 target: this,
1794 type: "set",
1795 key: "value",
1796 newValue,
1797 oldValue
1798 });
1799 }
1800 }
1801 }
1802}
1803function triggerRef(ref2) {
1804 if (ref2.dep) {
1805 {
1806 ref2.dep.trigger({
1807 target: ref2,
1808 type: "set",
1809 key: "value",
1810 newValue: ref2._value
1811 });
1812 }
1813 }
1814}
1815function unref(ref2) {
1816 return isRef(ref2) ? ref2.value : ref2;
1817}
1818function toValue(source) {
1819 return isFunction(source) ? source() : unref(source);
1820}
1821const shallowUnwrapHandlers = {
1822 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1823 set: (target, key, value, receiver) => {
1824 const oldValue = target[key];
1825 if (isRef(oldValue) && !isRef(value)) {
1826 oldValue.value = value;
1827 return true;
1828 } else {
1829 return Reflect.set(target, key, value, receiver);
1830 }
1831 }
1832};
1833function proxyRefs(objectWithRefs) {
1834 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1835}
1836class CustomRefImpl {
1837 constructor(factory) {
1838 this["__v_isRef"] = true;
1839 this._value = void 0;
1840 const dep = this.dep = new Dep();
1841 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1842 this._get = get;
1843 this._set = set;
1844 }
1845 get value() {
1846 return this._value = this._get();
1847 }
1848 set value(newVal) {
1849 this._set(newVal);
1850 }
1851}
1852function customRef(factory) {
1853 return new CustomRefImpl(factory);
1854}
1855function toRefs(object) {
1856 if (!isProxy(object)) {
1857 warn$2(`toRefs() expects a reactive object but received a plain one.`);
1858 }
1859 const ret = isArray(object) ? new Array(object.length) : {};
1860 for (const key in object) {
1861 ret[key] = propertyToRef(object, key);
1862 }
1863 return ret;
1864}
1865class ObjectRefImpl {
1866 constructor(_object, _key, _defaultValue) {
1867 this._object = _object;
1868 this._key = _key;
1869 this._defaultValue = _defaultValue;
1870 this["__v_isRef"] = true;
1871 this._value = void 0;
1872 }
1873 get value() {
1874 const val = this._object[this._key];
1875 return this._value = val === void 0 ? this._defaultValue : val;
1876 }
1877 set value(newVal) {
1878 this._object[this._key] = newVal;
1879 }
1880 get dep() {
1881 return getDepFromReactive(toRaw(this._object), this._key);
1882 }
1883}
1884class GetterRefImpl {
1885 constructor(_getter) {
1886 this._getter = _getter;
1887 this["__v_isRef"] = true;
1888 this["__v_isReadonly"] = true;
1889 this._value = void 0;
1890 }
1891 get value() {
1892 return this._value = this._getter();
1893 }
1894}
1895function toRef(source, key, defaultValue) {
1896 if (isRef(source)) {
1897 return source;
1898 } else if (isFunction(source)) {
1899 return new GetterRefImpl(source);
1900 } else if (isObject(source) && arguments.length > 1) {
1901 return propertyToRef(source, key, defaultValue);
1902 } else {
1903 return ref(source);
1904 }
1905}
1906function propertyToRef(source, key, defaultValue) {
1907 const val = source[key];
1908 return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1909}
1910
1911class ComputedRefImpl {
1912 constructor(fn, setter, isSSR) {
1913 this.fn = fn;
1914 this.setter = setter;
1915 /**
1916 * @internal
1917 */
1918 this._value = void 0;
1919 /**
1920 * @internal
1921 */
1922 this.dep = new Dep(this);
1923 /**
1924 * @internal
1925 */
1926 this.__v_isRef = true;
1927 // TODO isolatedDeclarations "__v_isReadonly"
1928 // A computed is also a subscriber that tracks other deps
1929 /**
1930 * @internal
1931 */
1932 this.deps = void 0;
1933 /**
1934 * @internal
1935 */
1936 this.depsTail = void 0;
1937 /**
1938 * @internal
1939 */
1940 this.flags = 16;
1941 /**
1942 * @internal
1943 */
1944 this.globalVersion = globalVersion - 1;
1945 /**
1946 * @internal
1947 */
1948 this.next = void 0;
1949 // for backwards compat
1950 this.effect = this;
1951 this["__v_isReadonly"] = !setter;
1952 this.isSSR = isSSR;
1953 }
1954 /**
1955 * @internal
1956 */
1957 notify() {
1958 this.flags |= 16;
1959 if (!(this.flags & 8) && // avoid infinite self recursion
1960 activeSub !== this) {
1961 batch(this, true);
1962 return true;
1963 }
1964 }
1965 get value() {
1966 const link = this.dep.track({
1967 target: this,
1968 type: "get",
1969 key: "value"
1970 }) ;
1971 refreshComputed(this);
1972 if (link) {
1973 link.version = this.dep.version;
1974 }
1975 return this._value;
1976 }
1977 set value(newValue) {
1978 if (this.setter) {
1979 this.setter(newValue);
1980 } else {
1981 warn$2("Write operation failed: computed value is readonly");
1982 }
1983 }
1984}
1985function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1986 let getter;
1987 let setter;
1988 if (isFunction(getterOrOptions)) {
1989 getter = getterOrOptions;
1990 } else {
1991 getter = getterOrOptions.get;
1992 setter = getterOrOptions.set;
1993 }
1994 const cRef = new ComputedRefImpl(getter, setter, isSSR);
1995 if (debugOptions && !isSSR) {
1996 cRef.onTrack = debugOptions.onTrack;
1997 cRef.onTrigger = debugOptions.onTrigger;
1998 }
1999 return cRef;
2000}
2001
2002const TrackOpTypes = {
2003 "GET": "get",
2004 "HAS": "has",
2005 "ITERATE": "iterate"
2006};
2007const TriggerOpTypes = {
2008 "SET": "set",
2009 "ADD": "add",
2010 "DELETE": "delete",
2011 "CLEAR": "clear"
2012};
2013
2014const INITIAL_WATCHER_VALUE = {};
2015const cleanupMap = /* @__PURE__ */ new WeakMap();
2016let activeWatcher = void 0;
2017function getCurrentWatcher() {
2018 return activeWatcher;
2019}
2020function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
2021 if (owner) {
2022 let cleanups = cleanupMap.get(owner);
2023 if (!cleanups) cleanupMap.set(owner, cleanups = []);
2024 cleanups.push(cleanupFn);
2025 } else if (!failSilently) {
2026 warn$2(
2027 `onWatcherCleanup() was called when there was no active watcher to associate with.`
2028 );
2029 }
2030}
2031function watch$1(source, cb, options = EMPTY_OBJ) {
2032 const { immediate, deep, once, scheduler, augmentJob, call } = options;
2033 const warnInvalidSource = (s) => {
2034 (options.onWarn || warn$2)(
2035 `Invalid watch source: `,
2036 s,
2037 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2038 );
2039 };
2040 const reactiveGetter = (source2) => {
2041 if (deep) return source2;
2042 if (isShallow(source2) || deep === false || deep === 0)
2043 return traverse(source2, 1);
2044 return traverse(source2);
2045 };
2046 let effect;
2047 let getter;
2048 let cleanup;
2049 let boundCleanup;
2050 let forceTrigger = false;
2051 let isMultiSource = false;
2052 if (isRef(source)) {
2053 getter = () => source.value;
2054 forceTrigger = isShallow(source);
2055 } else if (isReactive(source)) {
2056 getter = () => reactiveGetter(source);
2057 forceTrigger = true;
2058 } else if (isArray(source)) {
2059 isMultiSource = true;
2060 forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2061 getter = () => source.map((s) => {
2062 if (isRef(s)) {
2063 return s.value;
2064 } else if (isReactive(s)) {
2065 return reactiveGetter(s);
2066 } else if (isFunction(s)) {
2067 return call ? call(s, 2) : s();
2068 } else {
2069 warnInvalidSource(s);
2070 }
2071 });
2072 } else if (isFunction(source)) {
2073 if (cb) {
2074 getter = call ? () => call(source, 2) : source;
2075 } else {
2076 getter = () => {
2077 if (cleanup) {
2078 pauseTracking();
2079 try {
2080 cleanup();
2081 } finally {
2082 resetTracking();
2083 }
2084 }
2085 const currentEffect = activeWatcher;
2086 activeWatcher = effect;
2087 try {
2088 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
2089 } finally {
2090 activeWatcher = currentEffect;
2091 }
2092 };
2093 }
2094 } else {
2095 getter = NOOP;
2096 warnInvalidSource(source);
2097 }
2098 if (cb && deep) {
2099 const baseGetter = getter;
2100 const depth = deep === true ? Infinity : deep;
2101 getter = () => traverse(baseGetter(), depth);
2102 }
2103 const scope = getCurrentScope();
2104 const watchHandle = () => {
2105 effect.stop();
2106 if (scope && scope.active) {
2107 remove(scope.effects, effect);
2108 }
2109 };
2110 if (once && cb) {
2111 const _cb = cb;
2112 cb = (...args) => {
2113 _cb(...args);
2114 watchHandle();
2115 };
2116 }
2117 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2118 const job = (immediateFirstRun) => {
2119 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2120 return;
2121 }
2122 if (cb) {
2123 const newValue = effect.run();
2124 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2125 if (cleanup) {
2126 cleanup();
2127 }
2128 const currentWatcher = activeWatcher;
2129 activeWatcher = effect;
2130 try {
2131 const args = [
2132 newValue,
2133 // pass undefined as the old value when it's changed for the first time
2134 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2135 boundCleanup
2136 ];
2137 call ? call(cb, 3, args) : (
2138 // @ts-expect-error
2139 cb(...args)
2140 );
2141 oldValue = newValue;
2142 } finally {
2143 activeWatcher = currentWatcher;
2144 }
2145 }
2146 } else {
2147 effect.run();
2148 }
2149 };
2150 if (augmentJob) {
2151 augmentJob(job);
2152 }
2153 effect = new ReactiveEffect(getter);
2154 effect.scheduler = scheduler ? () => scheduler(job, false) : job;
2155 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
2156 cleanup = effect.onStop = () => {
2157 const cleanups = cleanupMap.get(effect);
2158 if (cleanups) {
2159 if (call) {
2160 call(cleanups, 4);
2161 } else {
2162 for (const cleanup2 of cleanups) cleanup2();
2163 }
2164 cleanupMap.delete(effect);
2165 }
2166 };
2167 {
2168 effect.onTrack = options.onTrack;
2169 effect.onTrigger = options.onTrigger;
2170 }
2171 if (cb) {
2172 if (immediate) {
2173 job(true);
2174 } else {
2175 oldValue = effect.run();
2176 }
2177 } else if (scheduler) {
2178 scheduler(job.bind(null, true), true);
2179 } else {
2180 effect.run();
2181 }
2182 watchHandle.pause = effect.pause.bind(effect);
2183 watchHandle.resume = effect.resume.bind(effect);
2184 watchHandle.stop = watchHandle;
2185 return watchHandle;
2186}
2187function traverse(value, depth = Infinity, seen) {
2188 if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2189 return value;
2190 }
2191 seen = seen || /* @__PURE__ */ new Set();
2192 if (seen.has(value)) {
2193 return value;
2194 }
2195 seen.add(value);
2196 depth--;
2197 if (isRef(value)) {
2198 traverse(value.value, depth, seen);
2199 } else if (isArray(value)) {
2200 for (let i = 0; i < value.length; i++) {
2201 traverse(value[i], depth, seen);
2202 }
2203 } else if (isSet(value) || isMap(value)) {
2204 value.forEach((v) => {
2205 traverse(v, depth, seen);
2206 });
2207 } else if (isPlainObject(value)) {
2208 for (const key in value) {
2209 traverse(value[key], depth, seen);
2210 }
2211 for (const key of Object.getOwnPropertySymbols(value)) {
2212 if (Object.prototype.propertyIsEnumerable.call(value, key)) {
2213 traverse(value[key], depth, seen);
2214 }
2215 }
2216 }
2217 return value;
2218}
2219
2220const stack$1 = [];
2221function pushWarningContext(vnode) {
2222 stack$1.push(vnode);
2223}
2224function popWarningContext() {
2225 stack$1.pop();
2226}
2227let isWarning = false;
2228function warn$1(msg, ...args) {
2229 if (isWarning) return;
2230 isWarning = true;
2231 pauseTracking();
2232 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
2233 const appWarnHandler = instance && instance.appContext.config.warnHandler;
2234 const trace = getComponentTrace();
2235 if (appWarnHandler) {
2236 callWithErrorHandling(
2237 appWarnHandler,
2238 instance,
2239 11,
2240 [
2241 // eslint-disable-next-line no-restricted-syntax
2242 msg + args.map((a) => {
2243 var _a, _b;
2244 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2245 }).join(""),
2246 instance && instance.proxy,
2247 trace.map(
2248 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2249 ).join("\n"),
2250 trace
2251 ]
2252 );
2253 } else {
2254 const warnArgs = [`[Vue warn]: ${msg}`, ...args];
2255 if (trace.length && // avoid spamming console during tests
2256 true) {
2257 warnArgs.push(`
2258`, ...formatTrace(trace));
2259 }
2260 console.warn(...warnArgs);
2261 }
2262 resetTracking();
2263 isWarning = false;
2264}
2265function getComponentTrace() {
2266 let currentVNode = stack$1[stack$1.length - 1];
2267 if (!currentVNode) {
2268 return [];
2269 }
2270 const normalizedStack = [];
2271 while (currentVNode) {
2272 const last = normalizedStack[0];
2273 if (last && last.vnode === currentVNode) {
2274 last.recurseCount++;
2275 } else {
2276 normalizedStack.push({
2277 vnode: currentVNode,
2278 recurseCount: 0
2279 });
2280 }
2281 const parentInstance = currentVNode.component && currentVNode.component.parent;
2282 currentVNode = parentInstance && parentInstance.vnode;
2283 }
2284 return normalizedStack;
2285}
2286function formatTrace(trace) {
2287 const logs = [];
2288 trace.forEach((entry, i) => {
2289 logs.push(...i === 0 ? [] : [`
2290`], ...formatTraceEntry(entry));
2291 });
2292 return logs;
2293}
2294function formatTraceEntry({ vnode, recurseCount }) {
2295 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2296 const isRoot = vnode.component ? vnode.component.parent == null : false;
2297 const open = ` at <${formatComponentName(
2298 vnode.component,
2299 vnode.type,
2300 isRoot
2301 )}`;
2302 const close = `>` + postfix;
2303 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2304}
2305function formatProps(props) {
2306 const res = [];
2307 const keys = Object.keys(props);
2308 keys.slice(0, 3).forEach((key) => {
2309 res.push(...formatProp(key, props[key]));
2310 });
2311 if (keys.length > 3) {
2312 res.push(` ...`);
2313 }
2314 return res;
2315}
2316function formatProp(key, value, raw) {
2317 if (isString(value)) {
2318 value = JSON.stringify(value);
2319 return raw ? value : [`${key}=${value}`];
2320 } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
2321 return raw ? value : [`${key}=${value}`];
2322 } else if (isRef(value)) {
2323 value = formatProp(key, toRaw(value.value), true);
2324 return raw ? value : [`${key}=Ref<`, value, `>`];
2325 } else if (isFunction(value)) {
2326 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
2327 } else {
2328 value = toRaw(value);
2329 return raw ? value : [`${key}=`, value];
2330 }
2331}
2332function assertNumber(val, type) {
2333 if (val === void 0) {
2334 return;
2335 } else if (typeof val !== "number") {
2336 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
2337 } else if (isNaN(val)) {
2338 warn$1(`${type} is NaN - the duration expression might be incorrect.`);
2339 }
2340}
2341
2342const ErrorCodes = {
2343 "SETUP_FUNCTION": 0,
2344 "0": "SETUP_FUNCTION",
2345 "RENDER_FUNCTION": 1,
2346 "1": "RENDER_FUNCTION",
2347 "NATIVE_EVENT_HANDLER": 5,
2348 "5": "NATIVE_EVENT_HANDLER",
2349 "COMPONENT_EVENT_HANDLER": 6,
2350 "6": "COMPONENT_EVENT_HANDLER",
2351 "VNODE_HOOK": 7,
2352 "7": "VNODE_HOOK",
2353 "DIRECTIVE_HOOK": 8,
2354 "8": "DIRECTIVE_HOOK",
2355 "TRANSITION_HOOK": 9,
2356 "9": "TRANSITION_HOOK",
2357 "APP_ERROR_HANDLER": 10,
2358 "10": "APP_ERROR_HANDLER",
2359 "APP_WARN_HANDLER": 11,
2360 "11": "APP_WARN_HANDLER",
2361 "FUNCTION_REF": 12,
2362 "12": "FUNCTION_REF",
2363 "ASYNC_COMPONENT_LOADER": 13,
2364 "13": "ASYNC_COMPONENT_LOADER",
2365 "SCHEDULER": 14,
2366 "14": "SCHEDULER",
2367 "COMPONENT_UPDATE": 15,
2368 "15": "COMPONENT_UPDATE",
2369 "APP_UNMOUNT_CLEANUP": 16,
2370 "16": "APP_UNMOUNT_CLEANUP"
2371};
2372const ErrorTypeStrings$1 = {
2373 ["sp"]: "serverPrefetch hook",
2374 ["bc"]: "beforeCreate hook",
2375 ["c"]: "created hook",
2376 ["bm"]: "beforeMount hook",
2377 ["m"]: "mounted hook",
2378 ["bu"]: "beforeUpdate hook",
2379 ["u"]: "updated",
2380 ["bum"]: "beforeUnmount hook",
2381 ["um"]: "unmounted hook",
2382 ["a"]: "activated hook",
2383 ["da"]: "deactivated hook",
2384 ["ec"]: "errorCaptured hook",
2385 ["rtc"]: "renderTracked hook",
2386 ["rtg"]: "renderTriggered hook",
2387 [0]: "setup function",
2388 [1]: "render function",
2389 [2]: "watcher getter",
2390 [3]: "watcher callback",
2391 [4]: "watcher cleanup function",
2392 [5]: "native event handler",
2393 [6]: "component event handler",
2394 [7]: "vnode hook",
2395 [8]: "directive hook",
2396 [9]: "transition hook",
2397 [10]: "app errorHandler",
2398 [11]: "app warnHandler",
2399 [12]: "ref function",
2400 [13]: "async component loader",
2401 [14]: "scheduler flush",
2402 [15]: "component update",
2403 [16]: "app unmount cleanup function"
2404};
2405function callWithErrorHandling(fn, instance, type, args) {
2406 try {
2407 return args ? fn(...args) : fn();
2408 } catch (err) {
2409 handleError(err, instance, type);
2410 }
2411}
2412function callWithAsyncErrorHandling(fn, instance, type, args) {
2413 if (isFunction(fn)) {
2414 const res = callWithErrorHandling(fn, instance, type, args);
2415 if (res && isPromise(res)) {
2416 res.catch((err) => {
2417 handleError(err, instance, type);
2418 });
2419 }
2420 return res;
2421 }
2422 if (isArray(fn)) {
2423 const values = [];
2424 for (let i = 0; i < fn.length; i++) {
2425 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
2426 }
2427 return values;
2428 } else {
2429 warn$1(
2430 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
2431 );
2432 }
2433}
2434function handleError(err, instance, type, throwInDev = true) {
2435 const contextVNode = instance ? instance.vnode : null;
2436 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2437 if (instance) {
2438 let cur = instance.parent;
2439 const exposedInstance = instance.proxy;
2440 const errorInfo = ErrorTypeStrings$1[type] ;
2441 while (cur) {
2442 const errorCapturedHooks = cur.ec;
2443 if (errorCapturedHooks) {
2444 for (let i = 0; i < errorCapturedHooks.length; i++) {
2445 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
2446 return;
2447 }
2448 }
2449 }
2450 cur = cur.parent;
2451 }
2452 if (errorHandler) {
2453 pauseTracking();
2454 callWithErrorHandling(errorHandler, null, 10, [
2455 err,
2456 exposedInstance,
2457 errorInfo
2458 ]);
2459 resetTracking();
2460 return;
2461 }
2462 }
2463 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2464}
2465function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2466 {
2467 const info = ErrorTypeStrings$1[type];
2468 if (contextVNode) {
2469 pushWarningContext(contextVNode);
2470 }
2471 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2472 if (contextVNode) {
2473 popWarningContext();
2474 }
2475 if (throwInDev) {
2476 throw err;
2477 } else {
2478 console.error(err);
2479 }
2480 }
2481}
2482
2483const queue = [];
2484let flushIndex = -1;
2485const pendingPostFlushCbs = [];
2486let activePostFlushCbs = null;
2487let postFlushIndex = 0;
2488const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2489let currentFlushPromise = null;
2490const RECURSION_LIMIT = 100;
2491function nextTick(fn) {
2492 const p = currentFlushPromise || resolvedPromise;
2493 return fn ? p.then(this ? fn.bind(this) : fn) : p;
2494}
2495function findInsertionIndex(id) {
2496 let start = flushIndex + 1;
2497 let end = queue.length;
2498 while (start < end) {
2499 const middle = start + end >>> 1;
2500 const middleJob = queue[middle];
2501 const middleJobId = getId(middleJob);
2502 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2503 start = middle + 1;
2504 } else {
2505 end = middle;
2506 }
2507 }
2508 return start;
2509}
2510function queueJob(job) {
2511 if (!(job.flags & 1)) {
2512 const jobId = getId(job);
2513 const lastJob = queue[queue.length - 1];
2514 if (!lastJob || // fast path when the job id is larger than the tail
2515 !(job.flags & 2) && jobId >= getId(lastJob)) {
2516 queue.push(job);
2517 } else {
2518 queue.splice(findInsertionIndex(jobId), 0, job);
2519 }
2520 job.flags |= 1;
2521 queueFlush();
2522 }
2523}
2524function queueFlush() {
2525 if (!currentFlushPromise) {
2526 currentFlushPromise = resolvedPromise.then(flushJobs);
2527 }
2528}
2529function queuePostFlushCb(cb) {
2530 if (!isArray(cb)) {
2531 if (activePostFlushCbs && cb.id === -1) {
2532 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2533 } else if (!(cb.flags & 1)) {
2534 pendingPostFlushCbs.push(cb);
2535 cb.flags |= 1;
2536 }
2537 } else {
2538 pendingPostFlushCbs.push(...cb);
2539 }
2540 queueFlush();
2541}
2542function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2543 {
2544 seen = seen || /* @__PURE__ */ new Map();
2545 }
2546 for (; i < queue.length; i++) {
2547 const cb = queue[i];
2548 if (cb && cb.flags & 2) {
2549 if (instance && cb.id !== instance.uid) {
2550 continue;
2551 }
2552 if (checkRecursiveUpdates(seen, cb)) {
2553 continue;
2554 }
2555 queue.splice(i, 1);
2556 i--;
2557 if (cb.flags & 4) {
2558 cb.flags &= ~1;
2559 }
2560 cb();
2561 if (!(cb.flags & 4)) {
2562 cb.flags &= ~1;
2563 }
2564 }
2565 }
2566}
2567function flushPostFlushCbs(seen) {
2568 if (pendingPostFlushCbs.length) {
2569 const deduped = [...new Set(pendingPostFlushCbs)].sort(
2570 (a, b) => getId(a) - getId(b)
2571 );
2572 pendingPostFlushCbs.length = 0;
2573 if (activePostFlushCbs) {
2574 activePostFlushCbs.push(...deduped);
2575 return;
2576 }
2577 activePostFlushCbs = deduped;
2578 {
2579 seen = seen || /* @__PURE__ */ new Map();
2580 }
2581 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2582 const cb = activePostFlushCbs[postFlushIndex];
2583 if (checkRecursiveUpdates(seen, cb)) {
2584 continue;
2585 }
2586 if (cb.flags & 4) {
2587 cb.flags &= ~1;
2588 }
2589 if (!(cb.flags & 8)) cb();
2590 cb.flags &= ~1;
2591 }
2592 activePostFlushCbs = null;
2593 postFlushIndex = 0;
2594 }
2595}
2596const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2597function flushJobs(seen) {
2598 {
2599 seen = seen || /* @__PURE__ */ new Map();
2600 }
2601 const check = (job) => checkRecursiveUpdates(seen, job) ;
2602 try {
2603 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2604 const job = queue[flushIndex];
2605 if (job && !(job.flags & 8)) {
2606 if (check(job)) {
2607 continue;
2608 }
2609 if (job.flags & 4) {
2610 job.flags &= ~1;
2611 }
2612 callWithErrorHandling(
2613 job,
2614 job.i,
2615 job.i ? 15 : 14
2616 );
2617 if (!(job.flags & 4)) {
2618 job.flags &= ~1;
2619 }
2620 }
2621 }
2622 } finally {
2623 for (; flushIndex < queue.length; flushIndex++) {
2624 const job = queue[flushIndex];
2625 if (job) {
2626 job.flags &= ~1;
2627 }
2628 }
2629 flushIndex = -1;
2630 queue.length = 0;
2631 flushPostFlushCbs(seen);
2632 currentFlushPromise = null;
2633 if (queue.length || pendingPostFlushCbs.length) {
2634 flushJobs(seen);
2635 }
2636 }
2637}
2638function checkRecursiveUpdates(seen, fn) {
2639 const count = seen.get(fn) || 0;
2640 if (count > RECURSION_LIMIT) {
2641 const instance = fn.i;
2642 const componentName = instance && getComponentName(instance.type);
2643 handleError(
2644 `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.`,
2645 null,
2646 10
2647 );
2648 return true;
2649 }
2650 seen.set(fn, count + 1);
2651 return false;
2652}
2653
2654let isHmrUpdating = false;
2655const hmrDirtyComponents = /* @__PURE__ */ new Map();
2656{
2657 getGlobalThis().__VUE_HMR_RUNTIME__ = {
2658 createRecord: tryWrap(createRecord),
2659 rerender: tryWrap(rerender),
2660 reload: tryWrap(reload)
2661 };
2662}
2663const map = /* @__PURE__ */ new Map();
2664function registerHMR(instance) {
2665 const id = instance.type.__hmrId;
2666 let record = map.get(id);
2667 if (!record) {
2668 createRecord(id, instance.type);
2669 record = map.get(id);
2670 }
2671 record.instances.add(instance);
2672}
2673function unregisterHMR(instance) {
2674 map.get(instance.type.__hmrId).instances.delete(instance);
2675}
2676function createRecord(id, initialDef) {
2677 if (map.has(id)) {
2678 return false;
2679 }
2680 map.set(id, {
2681 initialDef: normalizeClassComponent(initialDef),
2682 instances: /* @__PURE__ */ new Set()
2683 });
2684 return true;
2685}
2686function normalizeClassComponent(component) {
2687 return isClassComponent(component) ? component.__vccOpts : component;
2688}
2689function rerender(id, newRender) {
2690 const record = map.get(id);
2691 if (!record) {
2692 return;
2693 }
2694 record.initialDef.render = newRender;
2695 [...record.instances].forEach((instance) => {
2696 if (newRender) {
2697 instance.render = newRender;
2698 normalizeClassComponent(instance.type).render = newRender;
2699 }
2700 instance.renderCache = [];
2701 isHmrUpdating = true;
2702 instance.update();
2703 isHmrUpdating = false;
2704 });
2705}
2706function reload(id, newComp) {
2707 const record = map.get(id);
2708 if (!record) return;
2709 newComp = normalizeClassComponent(newComp);
2710 updateComponentDef(record.initialDef, newComp);
2711 const instances = [...record.instances];
2712 for (let i = 0; i < instances.length; i++) {
2713 const instance = instances[i];
2714 const oldComp = normalizeClassComponent(instance.type);
2715 let dirtyInstances = hmrDirtyComponents.get(oldComp);
2716 if (!dirtyInstances) {
2717 if (oldComp !== record.initialDef) {
2718 updateComponentDef(oldComp, newComp);
2719 }
2720 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2721 }
2722 dirtyInstances.add(instance);
2723 instance.appContext.propsCache.delete(instance.type);
2724 instance.appContext.emitsCache.delete(instance.type);
2725 instance.appContext.optionsCache.delete(instance.type);
2726 if (instance.ceReload) {
2727 dirtyInstances.add(instance);
2728 instance.ceReload(newComp.styles);
2729 dirtyInstances.delete(instance);
2730 } else if (instance.parent) {
2731 queueJob(() => {
2732 isHmrUpdating = true;
2733 instance.parent.update();
2734 isHmrUpdating = false;
2735 dirtyInstances.delete(instance);
2736 });
2737 } else if (instance.appContext.reload) {
2738 instance.appContext.reload();
2739 } else if (typeof window !== "undefined") {
2740 window.location.reload();
2741 } else {
2742 console.warn(
2743 "[HMR] Root or manually mounted instance modified. Full reload required."
2744 );
2745 }
2746 if (instance.root.ce && instance !== instance.root) {
2747 instance.root.ce._removeChildStyle(oldComp);
2748 }
2749 }
2750 queuePostFlushCb(() => {
2751 hmrDirtyComponents.clear();
2752 });
2753}
2754function updateComponentDef(oldComp, newComp) {
2755 extend(oldComp, newComp);
2756 for (const key in oldComp) {
2757 if (key !== "__file" && !(key in newComp)) {
2758 delete oldComp[key];
2759 }
2760 }
2761}
2762function tryWrap(fn) {
2763 return (id, arg) => {
2764 try {
2765 return fn(id, arg);
2766 } catch (e) {
2767 console.error(e);
2768 console.warn(
2769 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
2770 );
2771 }
2772 };
2773}
2774
2775let devtools$1;
2776let buffer = [];
2777let devtoolsNotInstalled = false;
2778function emit$1(event, ...args) {
2779 if (devtools$1) {
2780 devtools$1.emit(event, ...args);
2781 } else if (!devtoolsNotInstalled) {
2782 buffer.push({ event, args });
2783 }
2784}
2785function setDevtoolsHook$1(hook, target) {
2786 var _a, _b;
2787 devtools$1 = hook;
2788 if (devtools$1) {
2789 devtools$1.enabled = true;
2790 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
2791 buffer = [];
2792 } else if (
2793 // handle late devtools injection - only do this if we are in an actual
2794 // browser environment to avoid the timer handle stalling test runner exit
2795 // (#4815)
2796 typeof window !== "undefined" && // some envs mock window but not fully
2797 window.HTMLElement && // also exclude jsdom
2798 // eslint-disable-next-line no-restricted-syntax
2799 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
2800 ) {
2801 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
2802 replay.push((newHook) => {
2803 setDevtoolsHook$1(newHook, target);
2804 });
2805 setTimeout(() => {
2806 if (!devtools$1) {
2807 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
2808 devtoolsNotInstalled = true;
2809 buffer = [];
2810 }
2811 }, 3e3);
2812 } else {
2813 devtoolsNotInstalled = true;
2814 buffer = [];
2815 }
2816}
2817function devtoolsInitApp(app, version) {
2818 emit$1("app:init" /* APP_INIT */, app, version, {
2819 Fragment,
2820 Text,
2821 Comment,
2822 Static
2823 });
2824}
2825function devtoolsUnmountApp(app) {
2826 emit$1("app:unmount" /* APP_UNMOUNT */, app);
2827}
2828const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2829const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2830const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2831 "component:removed" /* COMPONENT_REMOVED */
2832);
2833const devtoolsComponentRemoved = (component) => {
2834 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
2835 !devtools$1.cleanupBuffer(component)) {
2836 _devtoolsComponentRemoved(component);
2837 }
2838};
2839/*! #__NO_SIDE_EFFECTS__ */
2840// @__NO_SIDE_EFFECTS__
2841function createDevtoolsComponentHook(hook) {
2842 return (component) => {
2843 emit$1(
2844 hook,
2845 component.appContext.app,
2846 component.uid,
2847 component.parent ? component.parent.uid : void 0,
2848 component
2849 );
2850 };
2851}
2852const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2853const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2854function createDevtoolsPerformanceHook(hook) {
2855 return (component, type, time) => {
2856 emit$1(hook, component.appContext.app, component.uid, component, type, time);
2857 };
2858}
2859function devtoolsComponentEmit(component, event, params) {
2860 emit$1(
2861 "component:emit" /* COMPONENT_EMIT */,
2862 component.appContext.app,
2863 component,
2864 event,
2865 params
2866 );
2867}
2868
2869let currentRenderingInstance = null;
2870let currentScopeId = null;
2871function setCurrentRenderingInstance(instance) {
2872 const prev = currentRenderingInstance;
2873 currentRenderingInstance = instance;
2874 currentScopeId = instance && instance.type.__scopeId || null;
2875 return prev;
2876}
2877function pushScopeId(id) {
2878 currentScopeId = id;
2879}
2880function popScopeId() {
2881 currentScopeId = null;
2882}
2883const withScopeId = (_id) => withCtx;
2884function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2885 if (!ctx) return fn;
2886 if (fn._n) {
2887 return fn;
2888 }
2889 const renderFnWithContext = (...args) => {
2890 if (renderFnWithContext._d) {
2891 setBlockTracking(-1);
2892 }
2893 const prevInstance = setCurrentRenderingInstance(ctx);
2894 let res;
2895 try {
2896 res = fn(...args);
2897 } finally {
2898 setCurrentRenderingInstance(prevInstance);
2899 if (renderFnWithContext._d) {
2900 setBlockTracking(1);
2901 }
2902 }
2903 {
2904 devtoolsComponentUpdated(ctx);
2905 }
2906 return res;
2907 };
2908 renderFnWithContext._n = true;
2909 renderFnWithContext._c = true;
2910 renderFnWithContext._d = true;
2911 return renderFnWithContext;
2912}
2913
2914function validateDirectiveName(name) {
2915 if (isBuiltInDirective(name)) {
2916 warn$1("Do not use built-in directive ids as custom directive id: " + name);
2917 }
2918}
2919function withDirectives(vnode, directives) {
2920 if (currentRenderingInstance === null) {
2921 warn$1(`withDirectives can only be used inside render functions.`);
2922 return vnode;
2923 }
2924 const instance = getComponentPublicInstance(currentRenderingInstance);
2925 const bindings = vnode.dirs || (vnode.dirs = []);
2926 for (let i = 0; i < directives.length; i++) {
2927 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2928 if (dir) {
2929 if (isFunction(dir)) {
2930 dir = {
2931 mounted: dir,
2932 updated: dir
2933 };
2934 }
2935 if (dir.deep) {
2936 traverse(value);
2937 }
2938 bindings.push({
2939 dir,
2940 instance,
2941 value,
2942 oldValue: void 0,
2943 arg,
2944 modifiers
2945 });
2946 }
2947 }
2948 return vnode;
2949}
2950function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2951 const bindings = vnode.dirs;
2952 const oldBindings = prevVNode && prevVNode.dirs;
2953 for (let i = 0; i < bindings.length; i++) {
2954 const binding = bindings[i];
2955 if (oldBindings) {
2956 binding.oldValue = oldBindings[i].value;
2957 }
2958 let hook = binding.dir[name];
2959 if (hook) {
2960 pauseTracking();
2961 callWithAsyncErrorHandling(hook, instance, 8, [
2962 vnode.el,
2963 binding,
2964 vnode,
2965 prevVNode
2966 ]);
2967 resetTracking();
2968 }
2969 }
2970}
2971
2972const TeleportEndKey = Symbol("_vte");
2973const isTeleport = (type) => type.__isTeleport;
2974const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
2975const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
2976const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
2977const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
2978const resolveTarget = (props, select) => {
2979 const targetSelector = props && props.to;
2980 if (isString(targetSelector)) {
2981 if (!select) {
2982 warn$1(
2983 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
2984 );
2985 return null;
2986 } else {
2987 const target = select(targetSelector);
2988 if (!target && !isTeleportDisabled(props)) {
2989 warn$1(
2990 `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.`
2991 );
2992 }
2993 return target;
2994 }
2995 } else {
2996 if (!targetSelector && !isTeleportDisabled(props)) {
2997 warn$1(`Invalid Teleport target: ${targetSelector}`);
2998 }
2999 return targetSelector;
3000 }
3001};
3002const TeleportImpl = {
3003 name: "Teleport",
3004 __isTeleport: true,
3005 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3006 const {
3007 mc: mountChildren,
3008 pc: patchChildren,
3009 pbc: patchBlockChildren,
3010 o: { insert, querySelector, createText, createComment }
3011 } = internals;
3012 const disabled = isTeleportDisabled(n2.props);
3013 let { shapeFlag, children, dynamicChildren } = n2;
3014 if (isHmrUpdating) {
3015 optimized = false;
3016 dynamicChildren = null;
3017 }
3018 if (n1 == null) {
3019 const placeholder = n2.el = createComment("teleport start") ;
3020 const mainAnchor = n2.anchor = createComment("teleport end") ;
3021 insert(placeholder, container, anchor);
3022 insert(mainAnchor, container, anchor);
3023 const mount = (container2, anchor2) => {
3024 if (shapeFlag & 16) {
3025 if (parentComponent && parentComponent.isCE) {
3026 parentComponent.ce._teleportTarget = container2;
3027 }
3028 mountChildren(
3029 children,
3030 container2,
3031 anchor2,
3032 parentComponent,
3033 parentSuspense,
3034 namespace,
3035 slotScopeIds,
3036 optimized
3037 );
3038 }
3039 };
3040 const mountToTarget = () => {
3041 const target = n2.target = resolveTarget(n2.props, querySelector);
3042 const targetAnchor = prepareAnchor(target, n2, createText, insert);
3043 if (target) {
3044 if (namespace !== "svg" && isTargetSVG(target)) {
3045 namespace = "svg";
3046 } else if (namespace !== "mathml" && isTargetMathML(target)) {
3047 namespace = "mathml";
3048 }
3049 if (!disabled) {
3050 mount(target, targetAnchor);
3051 updateCssVars(n2, false);
3052 }
3053 } else if (!disabled) {
3054 warn$1(
3055 "Invalid Teleport target on mount:",
3056 target,
3057 `(${typeof target})`
3058 );
3059 }
3060 };
3061 if (disabled) {
3062 mount(container, mainAnchor);
3063 updateCssVars(n2, true);
3064 }
3065 if (isTeleportDeferred(n2.props)) {
3066 queuePostRenderEffect(() => {
3067 mountToTarget();
3068 n2.el.__isMounted = true;
3069 }, parentSuspense);
3070 } else {
3071 mountToTarget();
3072 }
3073 } else {
3074 if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
3075 queuePostRenderEffect(() => {
3076 TeleportImpl.process(
3077 n1,
3078 n2,
3079 container,
3080 anchor,
3081 parentComponent,
3082 parentSuspense,
3083 namespace,
3084 slotScopeIds,
3085 optimized,
3086 internals
3087 );
3088 delete n1.el.__isMounted;
3089 }, parentSuspense);
3090 return;
3091 }
3092 n2.el = n1.el;
3093 n2.targetStart = n1.targetStart;
3094 const mainAnchor = n2.anchor = n1.anchor;
3095 const target = n2.target = n1.target;
3096 const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3097 const wasDisabled = isTeleportDisabled(n1.props);
3098 const currentContainer = wasDisabled ? container : target;
3099 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
3100 if (namespace === "svg" || isTargetSVG(target)) {
3101 namespace = "svg";
3102 } else if (namespace === "mathml" || isTargetMathML(target)) {
3103 namespace = "mathml";
3104 }
3105 if (dynamicChildren) {
3106 patchBlockChildren(
3107 n1.dynamicChildren,
3108 dynamicChildren,
3109 currentContainer,
3110 parentComponent,
3111 parentSuspense,
3112 namespace,
3113 slotScopeIds
3114 );
3115 traverseStaticChildren(n1, n2, true);
3116 } else if (!optimized) {
3117 patchChildren(
3118 n1,
3119 n2,
3120 currentContainer,
3121 currentAnchor,
3122 parentComponent,
3123 parentSuspense,
3124 namespace,
3125 slotScopeIds,
3126 false
3127 );
3128 }
3129 if (disabled) {
3130 if (!wasDisabled) {
3131 moveTeleport(
3132 n2,
3133 container,
3134 mainAnchor,
3135 internals,
3136 1
3137 );
3138 } else {
3139 if (n2.props && n1.props && n2.props.to !== n1.props.to) {
3140 n2.props.to = n1.props.to;
3141 }
3142 }
3143 } else {
3144 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3145 const nextTarget = n2.target = resolveTarget(
3146 n2.props,
3147 querySelector
3148 );
3149 if (nextTarget) {
3150 moveTeleport(
3151 n2,
3152 nextTarget,
3153 null,
3154 internals,
3155 0
3156 );
3157 } else {
3158 warn$1(
3159 "Invalid Teleport target on update:",
3160 target,
3161 `(${typeof target})`
3162 );
3163 }
3164 } else if (wasDisabled) {
3165 moveTeleport(
3166 n2,
3167 target,
3168 targetAnchor,
3169 internals,
3170 1
3171 );
3172 }
3173 }
3174 updateCssVars(n2, disabled);
3175 }
3176 },
3177 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3178 const {
3179 shapeFlag,
3180 children,
3181 anchor,
3182 targetStart,
3183 targetAnchor,
3184 target,
3185 props
3186 } = vnode;
3187 if (target) {
3188 hostRemove(targetStart);
3189 hostRemove(targetAnchor);
3190 }
3191 doRemove && hostRemove(anchor);
3192 if (shapeFlag & 16) {
3193 const shouldRemove = doRemove || !isTeleportDisabled(props);
3194 for (let i = 0; i < children.length; i++) {
3195 const child = children[i];
3196 unmount(
3197 child,
3198 parentComponent,
3199 parentSuspense,
3200 shouldRemove,
3201 !!child.dynamicChildren
3202 );
3203 }
3204 }
3205 },
3206 move: moveTeleport,
3207 hydrate: hydrateTeleport
3208};
3209function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3210 if (moveType === 0) {
3211 insert(vnode.targetAnchor, container, parentAnchor);
3212 }
3213 const { el, anchor, shapeFlag, children, props } = vnode;
3214 const isReorder = moveType === 2;
3215 if (isReorder) {
3216 insert(el, container, parentAnchor);
3217 }
3218 if (!isReorder || isTeleportDisabled(props)) {
3219 if (shapeFlag & 16) {
3220 for (let i = 0; i < children.length; i++) {
3221 move(
3222 children[i],
3223 container,
3224 parentAnchor,
3225 2
3226 );
3227 }
3228 }
3229 }
3230 if (isReorder) {
3231 insert(anchor, container, parentAnchor);
3232 }
3233}
3234function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3235 o: { nextSibling, parentNode, querySelector, insert, createText }
3236}, hydrateChildren) {
3237 const target = vnode.target = resolveTarget(
3238 vnode.props,
3239 querySelector
3240 );
3241 if (target) {
3242 const disabled = isTeleportDisabled(vnode.props);
3243 const targetNode = target._lpa || target.firstChild;
3244 if (vnode.shapeFlag & 16) {
3245 if (disabled) {
3246 vnode.anchor = hydrateChildren(
3247 nextSibling(node),
3248 vnode,
3249 parentNode(node),
3250 parentComponent,
3251 parentSuspense,
3252 slotScopeIds,
3253 optimized
3254 );
3255 vnode.targetStart = targetNode;
3256 vnode.targetAnchor = targetNode && nextSibling(targetNode);
3257 } else {
3258 vnode.anchor = nextSibling(node);
3259 let targetAnchor = targetNode;
3260 while (targetAnchor) {
3261 if (targetAnchor && targetAnchor.nodeType === 8) {
3262 if (targetAnchor.data === "teleport start anchor") {
3263 vnode.targetStart = targetAnchor;
3264 } else if (targetAnchor.data === "teleport anchor") {
3265 vnode.targetAnchor = targetAnchor;
3266 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3267 break;
3268 }
3269 }
3270 targetAnchor = nextSibling(targetAnchor);
3271 }
3272 if (!vnode.targetAnchor) {
3273 prepareAnchor(target, vnode, createText, insert);
3274 }
3275 hydrateChildren(
3276 targetNode && nextSibling(targetNode),
3277 vnode,
3278 target,
3279 parentComponent,
3280 parentSuspense,
3281 slotScopeIds,
3282 optimized
3283 );
3284 }
3285 }
3286 updateCssVars(vnode, disabled);
3287 }
3288 return vnode.anchor && nextSibling(vnode.anchor);
3289}
3290const Teleport = TeleportImpl;
3291function updateCssVars(vnode, isDisabled) {
3292 const ctx = vnode.ctx;
3293 if (ctx && ctx.ut) {
3294 let node, anchor;
3295 if (isDisabled) {
3296 node = vnode.el;
3297 anchor = vnode.anchor;
3298 } else {
3299 node = vnode.targetStart;
3300 anchor = vnode.targetAnchor;
3301 }
3302 while (node && node !== anchor) {
3303 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
3304 node = node.nextSibling;
3305 }
3306 ctx.ut();
3307 }
3308}
3309function prepareAnchor(target, vnode, createText, insert) {
3310 const targetStart = vnode.targetStart = createText("");
3311 const targetAnchor = vnode.targetAnchor = createText("");
3312 targetStart[TeleportEndKey] = targetAnchor;
3313 if (target) {
3314 insert(targetStart, target);
3315 insert(targetAnchor, target);
3316 }
3317 return targetAnchor;
3318}
3319
3320const leaveCbKey = Symbol("_leaveCb");
3321const enterCbKey$1 = Symbol("_enterCb");
3322function useTransitionState() {
3323 const state = {
3324 isMounted: false,
3325 isLeaving: false,
3326 isUnmounting: false,
3327 leavingVNodes: /* @__PURE__ */ new Map()
3328 };
3329 onMounted(() => {
3330 state.isMounted = true;
3331 });
3332 onBeforeUnmount(() => {
3333 state.isUnmounting = true;
3334 });
3335 return state;
3336}
3337const TransitionHookValidator = [Function, Array];
3338const BaseTransitionPropsValidators = {
3339 mode: String,
3340 appear: Boolean,
3341 persisted: Boolean,
3342 // enter
3343 onBeforeEnter: TransitionHookValidator,
3344 onEnter: TransitionHookValidator,
3345 onAfterEnter: TransitionHookValidator,
3346 onEnterCancelled: TransitionHookValidator,
3347 // leave
3348 onBeforeLeave: TransitionHookValidator,
3349 onLeave: TransitionHookValidator,
3350 onAfterLeave: TransitionHookValidator,
3351 onLeaveCancelled: TransitionHookValidator,
3352 // appear
3353 onBeforeAppear: TransitionHookValidator,
3354 onAppear: TransitionHookValidator,
3355 onAfterAppear: TransitionHookValidator,
3356 onAppearCancelled: TransitionHookValidator
3357};
3358const recursiveGetSubtree = (instance) => {
3359 const subTree = instance.subTree;
3360 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
3361};
3362const BaseTransitionImpl = {
3363 name: `BaseTransition`,
3364 props: BaseTransitionPropsValidators,
3365 setup(props, { slots }) {
3366 const instance = getCurrentInstance();
3367 const state = useTransitionState();
3368 return () => {
3369 const children = slots.default && getTransitionRawChildren(slots.default(), true);
3370 if (!children || !children.length) {
3371 return;
3372 }
3373 const child = findNonCommentChild(children);
3374 const rawProps = toRaw(props);
3375 const { mode } = rawProps;
3376 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3377 warn$1(`invalid <transition> mode: ${mode}`);
3378 }
3379 if (state.isLeaving) {
3380 return emptyPlaceholder(child);
3381 }
3382 const innerChild = getInnerChild$1(child);
3383 if (!innerChild) {
3384 return emptyPlaceholder(child);
3385 }
3386 let enterHooks = resolveTransitionHooks(
3387 innerChild,
3388 rawProps,
3389 state,
3390 instance,
3391 // #11061, ensure enterHooks is fresh after clone
3392 (hooks) => enterHooks = hooks
3393 );
3394 if (innerChild.type !== Comment) {
3395 setTransitionHooks(innerChild, enterHooks);
3396 }
3397 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3398 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3399 let leavingHooks = resolveTransitionHooks(
3400 oldInnerChild,
3401 rawProps,
3402 state,
3403 instance
3404 );
3405 setTransitionHooks(oldInnerChild, leavingHooks);
3406 if (mode === "out-in" && innerChild.type !== Comment) {
3407 state.isLeaving = true;
3408 leavingHooks.afterLeave = () => {
3409 state.isLeaving = false;
3410 if (!(instance.job.flags & 8)) {
3411 instance.update();
3412 }
3413 delete leavingHooks.afterLeave;
3414 oldInnerChild = void 0;
3415 };
3416 return emptyPlaceholder(child);
3417 } else if (mode === "in-out" && innerChild.type !== Comment) {
3418 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3419 const leavingVNodesCache = getLeavingNodesForType(
3420 state,
3421 oldInnerChild
3422 );
3423 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3424 el[leaveCbKey] = () => {
3425 earlyRemove();
3426 el[leaveCbKey] = void 0;
3427 delete enterHooks.delayedLeave;
3428 oldInnerChild = void 0;
3429 };
3430 enterHooks.delayedLeave = () => {
3431 delayedLeave();
3432 delete enterHooks.delayedLeave;
3433 oldInnerChild = void 0;
3434 };
3435 };
3436 } else {
3437 oldInnerChild = void 0;
3438 }
3439 } else if (oldInnerChild) {
3440 oldInnerChild = void 0;
3441 }
3442 return child;
3443 };
3444 }
3445};
3446function findNonCommentChild(children) {
3447 let child = children[0];
3448 if (children.length > 1) {
3449 let hasFound = false;
3450 for (const c of children) {
3451 if (c.type !== Comment) {
3452 if (hasFound) {
3453 warn$1(
3454 "<transition> can only be used on a single element or component. Use <transition-group> for lists."
3455 );
3456 break;
3457 }
3458 child = c;
3459 hasFound = true;
3460 }
3461 }
3462 }
3463 return child;
3464}
3465const BaseTransition = BaseTransitionImpl;
3466function getLeavingNodesForType(state, vnode) {
3467 const { leavingVNodes } = state;
3468 let leavingVNodesCache = leavingVNodes.get(vnode.type);
3469 if (!leavingVNodesCache) {
3470 leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3471 leavingVNodes.set(vnode.type, leavingVNodesCache);
3472 }
3473 return leavingVNodesCache;
3474}
3475function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3476 const {
3477 appear,
3478 mode,
3479 persisted = false,
3480 onBeforeEnter,
3481 onEnter,
3482 onAfterEnter,
3483 onEnterCancelled,
3484 onBeforeLeave,
3485 onLeave,
3486 onAfterLeave,
3487 onLeaveCancelled,
3488 onBeforeAppear,
3489 onAppear,
3490 onAfterAppear,
3491 onAppearCancelled
3492 } = props;
3493 const key = String(vnode.key);
3494 const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3495 const callHook = (hook, args) => {
3496 hook && callWithAsyncErrorHandling(
3497 hook,
3498 instance,
3499 9,
3500 args
3501 );
3502 };
3503 const callAsyncHook = (hook, args) => {
3504 const done = args[1];
3505 callHook(hook, args);
3506 if (isArray(hook)) {
3507 if (hook.every((hook2) => hook2.length <= 1)) done();
3508 } else if (hook.length <= 1) {
3509 done();
3510 }
3511 };
3512 const hooks = {
3513 mode,
3514 persisted,
3515 beforeEnter(el) {
3516 let hook = onBeforeEnter;
3517 if (!state.isMounted) {
3518 if (appear) {
3519 hook = onBeforeAppear || onBeforeEnter;
3520 } else {
3521 return;
3522 }
3523 }
3524 if (el[leaveCbKey]) {
3525 el[leaveCbKey](
3526 true
3527 /* cancelled */
3528 );
3529 }
3530 const leavingVNode = leavingVNodesCache[key];
3531 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3532 leavingVNode.el[leaveCbKey]();
3533 }
3534 callHook(hook, [el]);
3535 },
3536 enter(el) {
3537 let hook = onEnter;
3538 let afterHook = onAfterEnter;
3539 let cancelHook = onEnterCancelled;
3540 if (!state.isMounted) {
3541 if (appear) {
3542 hook = onAppear || onEnter;
3543 afterHook = onAfterAppear || onAfterEnter;
3544 cancelHook = onAppearCancelled || onEnterCancelled;
3545 } else {
3546 return;
3547 }
3548 }
3549 let called = false;
3550 const done = el[enterCbKey$1] = (cancelled) => {
3551 if (called) return;
3552 called = true;
3553 if (cancelled) {
3554 callHook(cancelHook, [el]);
3555 } else {
3556 callHook(afterHook, [el]);
3557 }
3558 if (hooks.delayedLeave) {
3559 hooks.delayedLeave();
3560 }
3561 el[enterCbKey$1] = void 0;
3562 };
3563 if (hook) {
3564 callAsyncHook(hook, [el, done]);
3565 } else {
3566 done();
3567 }
3568 },
3569 leave(el, remove) {
3570 const key2 = String(vnode.key);
3571 if (el[enterCbKey$1]) {
3572 el[enterCbKey$1](
3573 true
3574 /* cancelled */
3575 );
3576 }
3577 if (state.isUnmounting) {
3578 return remove();
3579 }
3580 callHook(onBeforeLeave, [el]);
3581 let called = false;
3582 const done = el[leaveCbKey] = (cancelled) => {
3583 if (called) return;
3584 called = true;
3585 remove();
3586 if (cancelled) {
3587 callHook(onLeaveCancelled, [el]);
3588 } else {
3589 callHook(onAfterLeave, [el]);
3590 }
3591 el[leaveCbKey] = void 0;
3592 if (leavingVNodesCache[key2] === vnode) {
3593 delete leavingVNodesCache[key2];
3594 }
3595 };
3596 leavingVNodesCache[key2] = vnode;
3597 if (onLeave) {
3598 callAsyncHook(onLeave, [el, done]);
3599 } else {
3600 done();
3601 }
3602 },
3603 clone(vnode2) {
3604 const hooks2 = resolveTransitionHooks(
3605 vnode2,
3606 props,
3607 state,
3608 instance,
3609 postClone
3610 );
3611 if (postClone) postClone(hooks2);
3612 return hooks2;
3613 }
3614 };
3615 return hooks;
3616}
3617function emptyPlaceholder(vnode) {
3618 if (isKeepAlive(vnode)) {
3619 vnode = cloneVNode(vnode);
3620 vnode.children = null;
3621 return vnode;
3622 }
3623}
3624function getInnerChild$1(vnode) {
3625 if (!isKeepAlive(vnode)) {
3626 if (isTeleport(vnode.type) && vnode.children) {
3627 return findNonCommentChild(vnode.children);
3628 }
3629 return vnode;
3630 }
3631 if (vnode.component) {
3632 return vnode.component.subTree;
3633 }
3634 const { shapeFlag, children } = vnode;
3635 if (children) {
3636 if (shapeFlag & 16) {
3637 return children[0];
3638 }
3639 if (shapeFlag & 32 && isFunction(children.default)) {
3640 return children.default();
3641 }
3642 }
3643}
3644function setTransitionHooks(vnode, hooks) {
3645 if (vnode.shapeFlag & 6 && vnode.component) {
3646 vnode.transition = hooks;
3647 setTransitionHooks(vnode.component.subTree, hooks);
3648 } else if (vnode.shapeFlag & 128) {
3649 vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3650 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3651 } else {
3652 vnode.transition = hooks;
3653 }
3654}
3655function getTransitionRawChildren(children, keepComment = false, parentKey) {
3656 let ret = [];
3657 let keyedFragmentCount = 0;
3658 for (let i = 0; i < children.length; i++) {
3659 let child = children[i];
3660 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
3661 if (child.type === Fragment) {
3662 if (child.patchFlag & 128) keyedFragmentCount++;
3663 ret = ret.concat(
3664 getTransitionRawChildren(child.children, keepComment, key)
3665 );
3666 } else if (keepComment || child.type !== Comment) {
3667 ret.push(key != null ? cloneVNode(child, { key }) : child);
3668 }
3669 }
3670 if (keyedFragmentCount > 1) {
3671 for (let i = 0; i < ret.length; i++) {
3672 ret[i].patchFlag = -2;
3673 }
3674 }
3675 return ret;
3676}
3677
3678/*! #__NO_SIDE_EFFECTS__ */
3679// @__NO_SIDE_EFFECTS__
3680function defineComponent(options, extraOptions) {
3681 return isFunction(options) ? (
3682 // #8236: extend call and options.name access are considered side-effects
3683 // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3684 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3685 ) : options;
3686}
3687
3688function useId() {
3689 const i = getCurrentInstance();
3690 if (i) {
3691 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3692 } else {
3693 warn$1(
3694 `useId() is called when there is no active component instance to be associated with.`
3695 );
3696 }
3697 return "";
3698}
3699function markAsyncBoundary(instance) {
3700 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3701}
3702
3703const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3704function useTemplateRef(key) {
3705 const i = getCurrentInstance();
3706 const r = shallowRef(null);
3707 if (i) {
3708 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3709 let desc;
3710 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3711 warn$1(`useTemplateRef('${key}') already exists.`);
3712 } else {
3713 Object.defineProperty(refs, key, {
3714 enumerable: true,
3715 get: () => r.value,
3716 set: (val) => r.value = val
3717 });
3718 }
3719 } else {
3720 warn$1(
3721 `useTemplateRef() is called when there is no active component instance to be associated with.`
3722 );
3723 }
3724 const ret = readonly(r) ;
3725 {
3726 knownTemplateRefs.add(ret);
3727 }
3728 return ret;
3729}
3730
3731function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3732 if (isArray(rawRef)) {
3733 rawRef.forEach(
3734 (r, i) => setRef(
3735 r,
3736 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
3737 parentSuspense,
3738 vnode,
3739 isUnmount
3740 )
3741 );
3742 return;
3743 }
3744 if (isAsyncWrapper(vnode) && !isUnmount) {
3745 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
3746 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
3747 }
3748 return;
3749 }
3750 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
3751 const value = isUnmount ? null : refValue;
3752 const { i: owner, r: ref } = rawRef;
3753 if (!owner) {
3754 warn$1(
3755 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
3756 );
3757 return;
3758 }
3759 const oldRef = oldRawRef && oldRawRef.r;
3760 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3761 const setupState = owner.setupState;
3762 const rawSetupState = toRaw(setupState);
3763 const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3764 {
3765 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3766 warn$1(
3767 `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
3768 );
3769 }
3770 if (knownTemplateRefs.has(rawSetupState[key])) {
3771 return false;
3772 }
3773 }
3774 return hasOwn(rawSetupState, key);
3775 };
3776 if (oldRef != null && oldRef !== ref) {
3777 if (isString(oldRef)) {
3778 refs[oldRef] = null;
3779 if (canSetSetupRef(oldRef)) {
3780 setupState[oldRef] = null;
3781 }
3782 } else if (isRef(oldRef)) {
3783 oldRef.value = null;
3784 }
3785 }
3786 if (isFunction(ref)) {
3787 callWithErrorHandling(ref, owner, 12, [value, refs]);
3788 } else {
3789 const _isString = isString(ref);
3790 const _isRef = isRef(ref);
3791 if (_isString || _isRef) {
3792 const doSet = () => {
3793 if (rawRef.f) {
3794 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3795 if (isUnmount) {
3796 isArray(existing) && remove(existing, refValue);
3797 } else {
3798 if (!isArray(existing)) {
3799 if (_isString) {
3800 refs[ref] = [refValue];
3801 if (canSetSetupRef(ref)) {
3802 setupState[ref] = refs[ref];
3803 }
3804 } else {
3805 ref.value = [refValue];
3806 if (rawRef.k) refs[rawRef.k] = ref.value;
3807 }
3808 } else if (!existing.includes(refValue)) {
3809 existing.push(refValue);
3810 }
3811 }
3812 } else if (_isString) {
3813 refs[ref] = value;
3814 if (canSetSetupRef(ref)) {
3815 setupState[ref] = value;
3816 }
3817 } else if (_isRef) {
3818 ref.value = value;
3819 if (rawRef.k) refs[rawRef.k] = value;
3820 } else {
3821 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3822 }
3823 };
3824 if (value) {
3825 doSet.id = -1;
3826 queuePostRenderEffect(doSet, parentSuspense);
3827 } else {
3828 doSet();
3829 }
3830 } else {
3831 warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3832 }
3833 }
3834}
3835
3836let hasLoggedMismatchError = false;
3837const logMismatchError = () => {
3838 if (hasLoggedMismatchError) {
3839 return;
3840 }
3841 console.error("Hydration completed but contains mismatches.");
3842 hasLoggedMismatchError = true;
3843};
3844const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3845const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3846const getContainerType = (container) => {
3847 if (container.nodeType !== 1) return void 0;
3848 if (isSVGContainer(container)) return "svg";
3849 if (isMathMLContainer(container)) return "mathml";
3850 return void 0;
3851};
3852const isComment = (node) => node.nodeType === 8;
3853function createHydrationFunctions(rendererInternals) {
3854 const {
3855 mt: mountComponent,
3856 p: patch,
3857 o: {
3858 patchProp,
3859 createText,
3860 nextSibling,
3861 parentNode,
3862 remove,
3863 insert,
3864 createComment
3865 }
3866 } = rendererInternals;
3867 const hydrate = (vnode, container) => {
3868 if (!container.hasChildNodes()) {
3869 warn$1(
3870 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
3871 );
3872 patch(null, vnode, container);
3873 flushPostFlushCbs();
3874 container._vnode = vnode;
3875 return;
3876 }
3877 hydrateNode(container.firstChild, vnode, null, null, null);
3878 flushPostFlushCbs();
3879 container._vnode = vnode;
3880 };
3881 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
3882 optimized = optimized || !!vnode.dynamicChildren;
3883 const isFragmentStart = isComment(node) && node.data === "[";
3884 const onMismatch = () => handleMismatch(
3885 node,
3886 vnode,
3887 parentComponent,
3888 parentSuspense,
3889 slotScopeIds,
3890 isFragmentStart
3891 );
3892 const { type, ref, shapeFlag, patchFlag } = vnode;
3893 let domType = node.nodeType;
3894 vnode.el = node;
3895 {
3896 def(node, "__vnode", vnode, true);
3897 def(node, "__vueParentComponent", parentComponent, true);
3898 }
3899 if (patchFlag === -2) {
3900 optimized = false;
3901 vnode.dynamicChildren = null;
3902 }
3903 let nextNode = null;
3904 switch (type) {
3905 case Text:
3906 if (domType !== 3) {
3907 if (vnode.children === "") {
3908 insert(vnode.el = createText(""), parentNode(node), node);
3909 nextNode = node;
3910 } else {
3911 nextNode = onMismatch();
3912 }
3913 } else {
3914 if (node.data !== vnode.children) {
3915 warn$1(
3916 `Hydration text mismatch in`,
3917 node.parentNode,
3918 `
3919 - rendered on server: ${JSON.stringify(
3920 node.data
3921 )}
3922 - expected on client: ${JSON.stringify(vnode.children)}`
3923 );
3924 logMismatchError();
3925 node.data = vnode.children;
3926 }
3927 nextNode = nextSibling(node);
3928 }
3929 break;
3930 case Comment:
3931 if (isTemplateNode(node)) {
3932 nextNode = nextSibling(node);
3933 replaceNode(
3934 vnode.el = node.content.firstChild,
3935 node,
3936 parentComponent
3937 );
3938 } else if (domType !== 8 || isFragmentStart) {
3939 nextNode = onMismatch();
3940 } else {
3941 nextNode = nextSibling(node);
3942 }
3943 break;
3944 case Static:
3945 if (isFragmentStart) {
3946 node = nextSibling(node);
3947 domType = node.nodeType;
3948 }
3949 if (domType === 1 || domType === 3) {
3950 nextNode = node;
3951 const needToAdoptContent = !vnode.children.length;
3952 for (let i = 0; i < vnode.staticCount; i++) {
3953 if (needToAdoptContent)
3954 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
3955 if (i === vnode.staticCount - 1) {
3956 vnode.anchor = nextNode;
3957 }
3958 nextNode = nextSibling(nextNode);
3959 }
3960 return isFragmentStart ? nextSibling(nextNode) : nextNode;
3961 } else {
3962 onMismatch();
3963 }
3964 break;
3965 case Fragment:
3966 if (!isFragmentStart) {
3967 nextNode = onMismatch();
3968 } else {
3969 nextNode = hydrateFragment(
3970 node,
3971 vnode,
3972 parentComponent,
3973 parentSuspense,
3974 slotScopeIds,
3975 optimized
3976 );
3977 }
3978 break;
3979 default:
3980 if (shapeFlag & 1) {
3981 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
3982 nextNode = onMismatch();
3983 } else {
3984 nextNode = hydrateElement(
3985 node,
3986 vnode,
3987 parentComponent,
3988 parentSuspense,
3989 slotScopeIds,
3990 optimized
3991 );
3992 }
3993 } else if (shapeFlag & 6) {
3994 vnode.slotScopeIds = slotScopeIds;
3995 const container = parentNode(node);
3996 if (isFragmentStart) {
3997 nextNode = locateClosingAnchor(node);
3998 } else if (isComment(node) && node.data === "teleport start") {
3999 nextNode = locateClosingAnchor(node, node.data, "teleport end");
4000 } else {
4001 nextNode = nextSibling(node);
4002 }
4003 mountComponent(
4004 vnode,
4005 container,
4006 null,
4007 parentComponent,
4008 parentSuspense,
4009 getContainerType(container),
4010 optimized
4011 );
4012 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4013 let subTree;
4014 if (isFragmentStart) {
4015 subTree = createVNode(Fragment);
4016 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4017 } else {
4018 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4019 }
4020 subTree.el = node;
4021 vnode.component.subTree = subTree;
4022 }
4023 } else if (shapeFlag & 64) {
4024 if (domType !== 8) {
4025 nextNode = onMismatch();
4026 } else {
4027 nextNode = vnode.type.hydrate(
4028 node,
4029 vnode,
4030 parentComponent,
4031 parentSuspense,
4032 slotScopeIds,
4033 optimized,
4034 rendererInternals,
4035 hydrateChildren
4036 );
4037 }
4038 } else if (shapeFlag & 128) {
4039 nextNode = vnode.type.hydrate(
4040 node,
4041 vnode,
4042 parentComponent,
4043 parentSuspense,
4044 getContainerType(parentNode(node)),
4045 slotScopeIds,
4046 optimized,
4047 rendererInternals,
4048 hydrateNode
4049 );
4050 } else {
4051 warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
4052 }
4053 }
4054 if (ref != null) {
4055 setRef(ref, null, parentSuspense, vnode);
4056 }
4057 return nextNode;
4058 };
4059 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4060 optimized = optimized || !!vnode.dynamicChildren;
4061 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4062 const forcePatch = type === "input" || type === "option";
4063 {
4064 if (dirs) {
4065 invokeDirectiveHook(vnode, null, parentComponent, "created");
4066 }
4067 let needCallTransitionHooks = false;
4068 if (isTemplateNode(el)) {
4069 needCallTransitionHooks = needTransition(
4070 null,
4071 // no need check parentSuspense in hydration
4072 transition
4073 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
4074 const content = el.content.firstChild;
4075 if (needCallTransitionHooks) {
4076 transition.beforeEnter(content);
4077 }
4078 replaceNode(content, el, parentComponent);
4079 vnode.el = el = content;
4080 }
4081 if (shapeFlag & 16 && // skip if element has innerHTML / textContent
4082 !(props && (props.innerHTML || props.textContent))) {
4083 let next = hydrateChildren(
4084 el.firstChild,
4085 vnode,
4086 el,
4087 parentComponent,
4088 parentSuspense,
4089 slotScopeIds,
4090 optimized
4091 );
4092 let hasWarned = false;
4093 while (next) {
4094 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4095 if (!hasWarned) {
4096 warn$1(
4097 `Hydration children mismatch on`,
4098 el,
4099 `
4100Server rendered element contains more child nodes than client vdom.`
4101 );
4102 hasWarned = true;
4103 }
4104 logMismatchError();
4105 }
4106 const cur = next;
4107 next = next.nextSibling;
4108 remove(cur);
4109 }
4110 } else if (shapeFlag & 8) {
4111 let clientText = vnode.children;
4112 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4113 clientText = clientText.slice(1);
4114 }
4115 if (el.textContent !== clientText) {
4116 if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4117 warn$1(
4118 `Hydration text content mismatch on`,
4119 el,
4120 `
4121 - rendered on server: ${el.textContent}
4122 - expected on client: ${vnode.children}`
4123 );
4124 logMismatchError();
4125 }
4126 el.textContent = vnode.children;
4127 }
4128 }
4129 if (props) {
4130 {
4131 const isCustomElement = el.tagName.includes("-");
4132 for (const key in props) {
4133 if (// #11189 skip if this node has directives that have created hooks
4134 // as it could have mutated the DOM in any possible way
4135 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
4136 logMismatchError();
4137 }
4138 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4139 key[0] === "." || isCustomElement) {
4140 patchProp(el, key, null, props[key], void 0, parentComponent);
4141 }
4142 }
4143 }
4144 }
4145 let vnodeHooks;
4146 if (vnodeHooks = props && props.onVnodeBeforeMount) {
4147 invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4148 }
4149 if (dirs) {
4150 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4151 }
4152 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4153 queueEffectWithSuspense(() => {
4154 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4155 needCallTransitionHooks && transition.enter(el);
4156 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4157 }, parentSuspense);
4158 }
4159 }
4160 return el.nextSibling;
4161 };
4162 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4163 optimized = optimized || !!parentVNode.dynamicChildren;
4164 const children = parentVNode.children;
4165 const l = children.length;
4166 let hasWarned = false;
4167 for (let i = 0; i < l; i++) {
4168 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4169 const isText = vnode.type === Text;
4170 if (node) {
4171 if (isText && !optimized) {
4172 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
4173 insert(
4174 createText(
4175 node.data.slice(vnode.children.length)
4176 ),
4177 container,
4178 nextSibling(node)
4179 );
4180 node.data = vnode.children;
4181 }
4182 }
4183 node = hydrateNode(
4184 node,
4185 vnode,
4186 parentComponent,
4187 parentSuspense,
4188 slotScopeIds,
4189 optimized
4190 );
4191 } else if (isText && !vnode.children) {
4192 insert(vnode.el = createText(""), container);
4193 } else {
4194 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4195 if (!hasWarned) {
4196 warn$1(
4197 `Hydration children mismatch on`,
4198 container,
4199 `
4200Server rendered element contains fewer child nodes than client vdom.`
4201 );
4202 hasWarned = true;
4203 }
4204 logMismatchError();
4205 }
4206 patch(
4207 null,
4208 vnode,
4209 container,
4210 null,
4211 parentComponent,
4212 parentSuspense,
4213 getContainerType(container),
4214 slotScopeIds
4215 );
4216 }
4217 }
4218 return node;
4219 };
4220 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4221 const { slotScopeIds: fragmentSlotScopeIds } = vnode;
4222 if (fragmentSlotScopeIds) {
4223 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
4224 }
4225 const container = parentNode(node);
4226 const next = hydrateChildren(
4227 nextSibling(node),
4228 vnode,
4229 container,
4230 parentComponent,
4231 parentSuspense,
4232 slotScopeIds,
4233 optimized
4234 );
4235 if (next && isComment(next) && next.data === "]") {
4236 return nextSibling(vnode.anchor = next);
4237 } else {
4238 logMismatchError();
4239 insert(vnode.anchor = createComment(`]`), container, next);
4240 return next;
4241 }
4242 };
4243 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4244 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4245 warn$1(
4246 `Hydration node mismatch:
4247- rendered on server:`,
4248 node,
4249 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
4250 `
4251- expected on client:`,
4252 vnode.type
4253 );
4254 logMismatchError();
4255 }
4256 vnode.el = null;
4257 if (isFragment) {
4258 const end = locateClosingAnchor(node);
4259 while (true) {
4260 const next2 = nextSibling(node);
4261 if (next2 && next2 !== end) {
4262 remove(next2);
4263 } else {
4264 break;
4265 }
4266 }
4267 }
4268 const next = nextSibling(node);
4269 const container = parentNode(node);
4270 remove(node);
4271 patch(
4272 null,
4273 vnode,
4274 container,
4275 next,
4276 parentComponent,
4277 parentSuspense,
4278 getContainerType(container),
4279 slotScopeIds
4280 );
4281 if (parentComponent) {
4282 parentComponent.vnode.el = vnode.el;
4283 updateHOCHostEl(parentComponent, vnode.el);
4284 }
4285 return next;
4286 };
4287 const locateClosingAnchor = (node, open = "[", close = "]") => {
4288 let match = 0;
4289 while (node) {
4290 node = nextSibling(node);
4291 if (node && isComment(node)) {
4292 if (node.data === open) match++;
4293 if (node.data === close) {
4294 if (match === 0) {
4295 return nextSibling(node);
4296 } else {
4297 match--;
4298 }
4299 }
4300 }
4301 }
4302 return node;
4303 };
4304 const replaceNode = (newNode, oldNode, parentComponent) => {
4305 const parentNode2 = oldNode.parentNode;
4306 if (parentNode2) {
4307 parentNode2.replaceChild(newNode, oldNode);
4308 }
4309 let parent = parentComponent;
4310 while (parent) {
4311 if (parent.vnode.el === oldNode) {
4312 parent.vnode.el = parent.subTree.el = newNode;
4313 }
4314 parent = parent.parent;
4315 }
4316 };
4317 const isTemplateNode = (node) => {
4318 return node.nodeType === 1 && node.tagName === "TEMPLATE";
4319 };
4320 return [hydrate, hydrateNode];
4321}
4322function propHasMismatch(el, key, clientValue, vnode, instance) {
4323 let mismatchType;
4324 let mismatchKey;
4325 let actual;
4326 let expected;
4327 if (key === "class") {
4328 actual = el.getAttribute("class");
4329 expected = normalizeClass(clientValue);
4330 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
4331 mismatchType = 2 /* CLASS */;
4332 mismatchKey = `class`;
4333 }
4334 } else if (key === "style") {
4335 actual = el.getAttribute("style") || "";
4336 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
4337 const actualMap = toStyleMap(actual);
4338 const expectedMap = toStyleMap(expected);
4339 if (vnode.dirs) {
4340 for (const { dir, value } of vnode.dirs) {
4341 if (dir.name === "show" && !value) {
4342 expectedMap.set("display", "none");
4343 }
4344 }
4345 }
4346 if (instance) {
4347 resolveCssVars(instance, vnode, expectedMap);
4348 }
4349 if (!isMapEqual(actualMap, expectedMap)) {
4350 mismatchType = 3 /* STYLE */;
4351 mismatchKey = "style";
4352 }
4353 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4354 if (isBooleanAttr(key)) {
4355 actual = el.hasAttribute(key);
4356 expected = includeBooleanAttr(clientValue);
4357 } else if (clientValue == null) {
4358 actual = el.hasAttribute(key);
4359 expected = false;
4360 } else {
4361 if (el.hasAttribute(key)) {
4362 actual = el.getAttribute(key);
4363 } else if (key === "value" && el.tagName === "TEXTAREA") {
4364 actual = el.value;
4365 } else {
4366 actual = false;
4367 }
4368 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
4369 }
4370 if (actual !== expected) {
4371 mismatchType = 4 /* ATTRIBUTE */;
4372 mismatchKey = key;
4373 }
4374 }
4375 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
4376 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
4377 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
4378 const postSegment = `
4379 - rendered on server: ${format(actual)}
4380 - expected on client: ${format(expected)}
4381 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
4382 You should fix the source of the mismatch.`;
4383 {
4384 warn$1(preSegment, el, postSegment);
4385 }
4386 return true;
4387 }
4388 return false;
4389}
4390function toClassSet(str) {
4391 return new Set(str.trim().split(/\s+/));
4392}
4393function isSetEqual(a, b) {
4394 if (a.size !== b.size) {
4395 return false;
4396 }
4397 for (const s of a) {
4398 if (!b.has(s)) {
4399 return false;
4400 }
4401 }
4402 return true;
4403}
4404function toStyleMap(str) {
4405 const styleMap = /* @__PURE__ */ new Map();
4406 for (const item of str.split(";")) {
4407 let [key, value] = item.split(":");
4408 key = key.trim();
4409 value = value && value.trim();
4410 if (key && value) {
4411 styleMap.set(key, value);
4412 }
4413 }
4414 return styleMap;
4415}
4416function isMapEqual(a, b) {
4417 if (a.size !== b.size) {
4418 return false;
4419 }
4420 for (const [key, value] of a) {
4421 if (value !== b.get(key)) {
4422 return false;
4423 }
4424 }
4425 return true;
4426}
4427function resolveCssVars(instance, vnode, expectedMap) {
4428 const root = instance.subTree;
4429 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
4430 const cssVars = instance.getCssVars();
4431 for (const key in cssVars) {
4432 expectedMap.set(
4433 `--${getEscapedCssVarName(key)}`,
4434 String(cssVars[key])
4435 );
4436 }
4437 }
4438 if (vnode === root && instance.parent) {
4439 resolveCssVars(instance.parent, instance.vnode, expectedMap);
4440 }
4441}
4442const allowMismatchAttr = "data-allow-mismatch";
4443const MismatchTypeString = {
4444 [0 /* TEXT */]: "text",
4445 [1 /* CHILDREN */]: "children",
4446 [2 /* CLASS */]: "class",
4447 [3 /* STYLE */]: "style",
4448 [4 /* ATTRIBUTE */]: "attribute"
4449};
4450function isMismatchAllowed(el, allowedType) {
4451 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
4452 while (el && !el.hasAttribute(allowMismatchAttr)) {
4453 el = el.parentElement;
4454 }
4455 }
4456 const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4457 if (allowedAttr == null) {
4458 return false;
4459 } else if (allowedAttr === "") {
4460 return true;
4461 } else {
4462 const list = allowedAttr.split(",");
4463 if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4464 return true;
4465 }
4466 return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
4467 }
4468}
4469
4470const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
4471const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
4472const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4473 const id = requestIdleCallback(hydrate, { timeout });
4474 return () => cancelIdleCallback(id);
4475};
4476function elementIsVisibleInViewport(el) {
4477 const { top, left, bottom, right } = el.getBoundingClientRect();
4478 const { innerHeight, innerWidth } = window;
4479 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4480}
4481const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4482 const ob = new IntersectionObserver((entries) => {
4483 for (const e of entries) {
4484 if (!e.isIntersecting) continue;
4485 ob.disconnect();
4486 hydrate();
4487 break;
4488 }
4489 }, opts);
4490 forEach((el) => {
4491 if (!(el instanceof Element)) return;
4492 if (elementIsVisibleInViewport(el)) {
4493 hydrate();
4494 ob.disconnect();
4495 return false;
4496 }
4497 ob.observe(el);
4498 });
4499 return () => ob.disconnect();
4500};
4501const hydrateOnMediaQuery = (query) => (hydrate) => {
4502 if (query) {
4503 const mql = matchMedia(query);
4504 if (mql.matches) {
4505 hydrate();
4506 } else {
4507 mql.addEventListener("change", hydrate, { once: true });
4508 return () => mql.removeEventListener("change", hydrate);
4509 }
4510 }
4511};
4512const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
4513 if (isString(interactions)) interactions = [interactions];
4514 let hasHydrated = false;
4515 const doHydrate = (e) => {
4516 if (!hasHydrated) {
4517 hasHydrated = true;
4518 teardown();
4519 hydrate();
4520 e.target.dispatchEvent(new e.constructor(e.type, e));
4521 }
4522 };
4523 const teardown = () => {
4524 forEach((el) => {
4525 for (const i of interactions) {
4526 el.removeEventListener(i, doHydrate);
4527 }
4528 });
4529 };
4530 forEach((el) => {
4531 for (const i of interactions) {
4532 el.addEventListener(i, doHydrate, { once: true });
4533 }
4534 });
4535 return teardown;
4536};
4537function forEachElement(node, cb) {
4538 if (isComment(node) && node.data === "[") {
4539 let depth = 1;
4540 let next = node.nextSibling;
4541 while (next) {
4542 if (next.nodeType === 1) {
4543 const result = cb(next);
4544 if (result === false) {
4545 break;
4546 }
4547 } else if (isComment(next)) {
4548 if (next.data === "]") {
4549 if (--depth === 0) break;
4550 } else if (next.data === "[") {
4551 depth++;
4552 }
4553 }
4554 next = next.nextSibling;
4555 }
4556 } else {
4557 cb(node);
4558 }
4559}
4560
4561const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4562/*! #__NO_SIDE_EFFECTS__ */
4563// @__NO_SIDE_EFFECTS__
4564function defineAsyncComponent(source) {
4565 if (isFunction(source)) {
4566 source = { loader: source };
4567 }
4568 const {
4569 loader,
4570 loadingComponent,
4571 errorComponent,
4572 delay = 200,
4573 hydrate: hydrateStrategy,
4574 timeout,
4575 // undefined = never times out
4576 suspensible = true,
4577 onError: userOnError
4578 } = source;
4579 let pendingRequest = null;
4580 let resolvedComp;
4581 let retries = 0;
4582 const retry = () => {
4583 retries++;
4584 pendingRequest = null;
4585 return load();
4586 };
4587 const load = () => {
4588 let thisRequest;
4589 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4590 err = err instanceof Error ? err : new Error(String(err));
4591 if (userOnError) {
4592 return new Promise((resolve, reject) => {
4593 const userRetry = () => resolve(retry());
4594 const userFail = () => reject(err);
4595 userOnError(err, userRetry, userFail, retries + 1);
4596 });
4597 } else {
4598 throw err;
4599 }
4600 }).then((comp) => {
4601 if (thisRequest !== pendingRequest && pendingRequest) {
4602 return pendingRequest;
4603 }
4604 if (!comp) {
4605 warn$1(
4606 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
4607 );
4608 }
4609 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4610 comp = comp.default;
4611 }
4612 if (comp && !isObject(comp) && !isFunction(comp)) {
4613 throw new Error(`Invalid async component load result: ${comp}`);
4614 }
4615 resolvedComp = comp;
4616 return comp;
4617 }));
4618 };
4619 return defineComponent({
4620 name: "AsyncComponentWrapper",
4621 __asyncLoader: load,
4622 __asyncHydrate(el, instance, hydrate) {
4623 const doHydrate = hydrateStrategy ? () => {
4624 const teardown = hydrateStrategy(
4625 hydrate,
4626 (cb) => forEachElement(el, cb)
4627 );
4628 if (teardown) {
4629 (instance.bum || (instance.bum = [])).push(teardown);
4630 }
4631 } : hydrate;
4632 if (resolvedComp) {
4633 doHydrate();
4634 } else {
4635 load().then(() => !instance.isUnmounted && doHydrate());
4636 }
4637 },
4638 get __asyncResolved() {
4639 return resolvedComp;
4640 },
4641 setup() {
4642 const instance = currentInstance;
4643 markAsyncBoundary(instance);
4644 if (resolvedComp) {
4645 return () => createInnerComp(resolvedComp, instance);
4646 }
4647 const onError = (err) => {
4648 pendingRequest = null;
4649 handleError(
4650 err,
4651 instance,
4652 13,
4653 !errorComponent
4654 );
4655 };
4656 if (suspensible && instance.suspense || isInSSRComponentSetup) {
4657 return load().then((comp) => {
4658 return () => createInnerComp(comp, instance);
4659 }).catch((err) => {
4660 onError(err);
4661 return () => errorComponent ? createVNode(errorComponent, {
4662 error: err
4663 }) : null;
4664 });
4665 }
4666 const loaded = ref(false);
4667 const error = ref();
4668 const delayed = ref(!!delay);
4669 if (delay) {
4670 setTimeout(() => {
4671 delayed.value = false;
4672 }, delay);
4673 }
4674 if (timeout != null) {
4675 setTimeout(() => {
4676 if (!loaded.value && !error.value) {
4677 const err = new Error(
4678 `Async component timed out after ${timeout}ms.`
4679 );
4680 onError(err);
4681 error.value = err;
4682 }
4683 }, timeout);
4684 }
4685 load().then(() => {
4686 loaded.value = true;
4687 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4688 instance.parent.update();
4689 }
4690 }).catch((err) => {
4691 onError(err);
4692 error.value = err;
4693 });
4694 return () => {
4695 if (loaded.value && resolvedComp) {
4696 return createInnerComp(resolvedComp, instance);
4697 } else if (error.value && errorComponent) {
4698 return createVNode(errorComponent, {
4699 error: error.value
4700 });
4701 } else if (loadingComponent && !delayed.value) {
4702 return createVNode(loadingComponent);
4703 }
4704 };
4705 }
4706 });
4707}
4708function createInnerComp(comp, parent) {
4709 const { ref: ref2, props, children, ce } = parent.vnode;
4710 const vnode = createVNode(comp, props, children);
4711 vnode.ref = ref2;
4712 vnode.ce = ce;
4713 delete parent.vnode.ce;
4714 return vnode;
4715}
4716
4717const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4718const KeepAliveImpl = {
4719 name: `KeepAlive`,
4720 // Marker for special handling inside the renderer. We are not using a ===
4721 // check directly on KeepAlive in the renderer, because importing it directly
4722 // would prevent it from being tree-shaken.
4723 __isKeepAlive: true,
4724 props: {
4725 include: [String, RegExp, Array],
4726 exclude: [String, RegExp, Array],
4727 max: [String, Number]
4728 },
4729 setup(props, { slots }) {
4730 const instance = getCurrentInstance();
4731 const sharedContext = instance.ctx;
4732 if (!sharedContext.renderer) {
4733 return () => {
4734 const children = slots.default && slots.default();
4735 return children && children.length === 1 ? children[0] : children;
4736 };
4737 }
4738 const cache = /* @__PURE__ */ new Map();
4739 const keys = /* @__PURE__ */ new Set();
4740 let current = null;
4741 {
4742 instance.__v_cache = cache;
4743 }
4744 const parentSuspense = instance.suspense;
4745 const {
4746 renderer: {
4747 p: patch,
4748 m: move,
4749 um: _unmount,
4750 o: { createElement }
4751 }
4752 } = sharedContext;
4753 const storageContainer = createElement("div");
4754 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4755 const instance2 = vnode.component;
4756 move(vnode, container, anchor, 0, parentSuspense);
4757 patch(
4758 instance2.vnode,
4759 vnode,
4760 container,
4761 anchor,
4762 instance2,
4763 parentSuspense,
4764 namespace,
4765 vnode.slotScopeIds,
4766 optimized
4767 );
4768 queuePostRenderEffect(() => {
4769 instance2.isDeactivated = false;
4770 if (instance2.a) {
4771 invokeArrayFns(instance2.a);
4772 }
4773 const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4774 if (vnodeHook) {
4775 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4776 }
4777 }, parentSuspense);
4778 {
4779 devtoolsComponentAdded(instance2);
4780 }
4781 };
4782 sharedContext.deactivate = (vnode) => {
4783 const instance2 = vnode.component;
4784 invalidateMount(instance2.m);
4785 invalidateMount(instance2.a);
4786 move(vnode, storageContainer, null, 1, parentSuspense);
4787 queuePostRenderEffect(() => {
4788 if (instance2.da) {
4789 invokeArrayFns(instance2.da);
4790 }
4791 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4792 if (vnodeHook) {
4793 invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4794 }
4795 instance2.isDeactivated = true;
4796 }, parentSuspense);
4797 {
4798 devtoolsComponentAdded(instance2);
4799 }
4800 };
4801 function unmount(vnode) {
4802 resetShapeFlag(vnode);
4803 _unmount(vnode, instance, parentSuspense, true);
4804 }
4805 function pruneCache(filter) {
4806 cache.forEach((vnode, key) => {
4807 const name = getComponentName(vnode.type);
4808 if (name && !filter(name)) {
4809 pruneCacheEntry(key);
4810 }
4811 });
4812 }
4813 function pruneCacheEntry(key) {
4814 const cached = cache.get(key);
4815 if (cached && (!current || !isSameVNodeType(cached, current))) {
4816 unmount(cached);
4817 } else if (current) {
4818 resetShapeFlag(current);
4819 }
4820 cache.delete(key);
4821 keys.delete(key);
4822 }
4823 watch(
4824 () => [props.include, props.exclude],
4825 ([include, exclude]) => {
4826 include && pruneCache((name) => matches(include, name));
4827 exclude && pruneCache((name) => !matches(exclude, name));
4828 },
4829 // prune post-render after `current` has been updated
4830 { flush: "post", deep: true }
4831 );
4832 let pendingCacheKey = null;
4833 const cacheSubtree = () => {
4834 if (pendingCacheKey != null) {
4835 if (isSuspense(instance.subTree.type)) {
4836 queuePostRenderEffect(() => {
4837 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4838 }, instance.subTree.suspense);
4839 } else {
4840 cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4841 }
4842 }
4843 };
4844 onMounted(cacheSubtree);
4845 onUpdated(cacheSubtree);
4846 onBeforeUnmount(() => {
4847 cache.forEach((cached) => {
4848 const { subTree, suspense } = instance;
4849 const vnode = getInnerChild(subTree);
4850 if (cached.type === vnode.type && cached.key === vnode.key) {
4851 resetShapeFlag(vnode);
4852 const da = vnode.component.da;
4853 da && queuePostRenderEffect(da, suspense);
4854 return;
4855 }
4856 unmount(cached);
4857 });
4858 });
4859 return () => {
4860 pendingCacheKey = null;
4861 if (!slots.default) {
4862 return current = null;
4863 }
4864 const children = slots.default();
4865 const rawVNode = children[0];
4866 if (children.length > 1) {
4867 {
4868 warn$1(`KeepAlive should contain exactly one component child.`);
4869 }
4870 current = null;
4871 return children;
4872 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4873 current = null;
4874 return rawVNode;
4875 }
4876 let vnode = getInnerChild(rawVNode);
4877 if (vnode.type === Comment) {
4878 current = null;
4879 return vnode;
4880 }
4881 const comp = vnode.type;
4882 const name = getComponentName(
4883 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4884 );
4885 const { include, exclude, max } = props;
4886 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4887 vnode.shapeFlag &= ~256;
4888 current = vnode;
4889 return rawVNode;
4890 }
4891 const key = vnode.key == null ? comp : vnode.key;
4892 const cachedVNode = cache.get(key);
4893 if (vnode.el) {
4894 vnode = cloneVNode(vnode);
4895 if (rawVNode.shapeFlag & 128) {
4896 rawVNode.ssContent = vnode;
4897 }
4898 }
4899 pendingCacheKey = key;
4900 if (cachedVNode) {
4901 vnode.el = cachedVNode.el;
4902 vnode.component = cachedVNode.component;
4903 if (vnode.transition) {
4904 setTransitionHooks(vnode, vnode.transition);
4905 }
4906 vnode.shapeFlag |= 512;
4907 keys.delete(key);
4908 keys.add(key);
4909 } else {
4910 keys.add(key);
4911 if (max && keys.size > parseInt(max, 10)) {
4912 pruneCacheEntry(keys.values().next().value);
4913 }
4914 }
4915 vnode.shapeFlag |= 256;
4916 current = vnode;
4917 return isSuspense(rawVNode.type) ? rawVNode : vnode;
4918 };
4919 }
4920};
4921const KeepAlive = KeepAliveImpl;
4922function matches(pattern, name) {
4923 if (isArray(pattern)) {
4924 return pattern.some((p) => matches(p, name));
4925 } else if (isString(pattern)) {
4926 return pattern.split(",").includes(name);
4927 } else if (isRegExp(pattern)) {
4928 pattern.lastIndex = 0;
4929 return pattern.test(name);
4930 }
4931 return false;
4932}
4933function onActivated(hook, target) {
4934 registerKeepAliveHook(hook, "a", target);
4935}
4936function onDeactivated(hook, target) {
4937 registerKeepAliveHook(hook, "da", target);
4938}
4939function registerKeepAliveHook(hook, type, target = currentInstance) {
4940 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4941 let current = target;
4942 while (current) {
4943 if (current.isDeactivated) {
4944 return;
4945 }
4946 current = current.parent;
4947 }
4948 return hook();
4949 });
4950 injectHook(type, wrappedHook, target);
4951 if (target) {
4952 let current = target.parent;
4953 while (current && current.parent) {
4954 if (isKeepAlive(current.parent.vnode)) {
4955 injectToKeepAliveRoot(wrappedHook, type, target, current);
4956 }
4957 current = current.parent;
4958 }
4959 }
4960}
4961function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4962 const injected = injectHook(
4963 type,
4964 hook,
4965 keepAliveRoot,
4966 true
4967 /* prepend */
4968 );
4969 onUnmounted(() => {
4970 remove(keepAliveRoot[type], injected);
4971 }, target);
4972}
4973function resetShapeFlag(vnode) {
4974 vnode.shapeFlag &= ~256;
4975 vnode.shapeFlag &= ~512;
4976}
4977function getInnerChild(vnode) {
4978 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4979}
4980
4981function injectHook(type, hook, target = currentInstance, prepend = false) {
4982 if (target) {
4983 const hooks = target[type] || (target[type] = []);
4984 const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
4985 pauseTracking();
4986 const reset = setCurrentInstance(target);
4987 const res = callWithAsyncErrorHandling(hook, target, type, args);
4988 reset();
4989 resetTracking();
4990 return res;
4991 });
4992 if (prepend) {
4993 hooks.unshift(wrappedHook);
4994 } else {
4995 hooks.push(wrappedHook);
4996 }
4997 return wrappedHook;
4998 } else {
4999 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
5000 warn$1(
5001 `${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.` )
5002 );
5003 }
5004}
5005const createHook = (lifecycle) => (hook, target = currentInstance) => {
5006 if (!isInSSRComponentSetup || lifecycle === "sp") {
5007 injectHook(lifecycle, (...args) => hook(...args), target);
5008 }
5009};
5010const onBeforeMount = createHook("bm");
5011const onMounted = createHook("m");
5012const onBeforeUpdate = createHook(
5013 "bu"
5014);
5015const onUpdated = createHook("u");
5016const onBeforeUnmount = createHook(
5017 "bum"
5018);
5019const onUnmounted = createHook("um");
5020const onServerPrefetch = createHook(
5021 "sp"
5022);
5023const onRenderTriggered = createHook("rtg");
5024const onRenderTracked = createHook("rtc");
5025function onErrorCaptured(hook, target = currentInstance) {
5026 injectHook("ec", hook, target);
5027}
5028
5029const COMPONENTS = "components";
5030const DIRECTIVES = "directives";
5031function resolveComponent(name, maybeSelfReference) {
5032 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
5033}
5034const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
5035function resolveDynamicComponent(component) {
5036 if (isString(component)) {
5037 return resolveAsset(COMPONENTS, component, false) || component;
5038 } else {
5039 return component || NULL_DYNAMIC_COMPONENT;
5040 }
5041}
5042function resolveDirective(name) {
5043 return resolveAsset(DIRECTIVES, name);
5044}
5045function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
5046 const instance = currentRenderingInstance || currentInstance;
5047 if (instance) {
5048 const Component = instance.type;
5049 if (type === COMPONENTS) {
5050 const selfName = getComponentName(
5051 Component,
5052 false
5053 );
5054 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
5055 return Component;
5056 }
5057 }
5058 const res = (
5059 // local registration
5060 // check instance[type] first which is resolved for options API
5061 resolve(instance[type] || Component[type], name) || // global registration
5062 resolve(instance.appContext[type], name)
5063 );
5064 if (!res && maybeSelfReference) {
5065 return Component;
5066 }
5067 if (warnMissing && !res) {
5068 const extra = type === COMPONENTS ? `
5069If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
5070 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
5071 }
5072 return res;
5073 } else {
5074 warn$1(
5075 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
5076 );
5077 }
5078}
5079function resolve(registry, name) {
5080 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
5081}
5082
5083function renderList(source, renderItem, cache, index) {
5084 let ret;
5085 const cached = cache && cache[index];
5086 const sourceIsArray = isArray(source);
5087 if (sourceIsArray || isString(source)) {
5088 const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5089 let needsWrap = false;
5090 if (sourceIsReactiveArray) {
5091 needsWrap = !isShallow(source);
5092 source = shallowReadArray(source);
5093 }
5094 ret = new Array(source.length);
5095 for (let i = 0, l = source.length; i < l; i++) {
5096 ret[i] = renderItem(
5097 needsWrap ? toReactive(source[i]) : source[i],
5098 i,
5099 void 0,
5100 cached && cached[i]
5101 );
5102 }
5103 } else if (typeof source === "number") {
5104 if (!Number.isInteger(source)) {
5105 warn$1(`The v-for range expect an integer value but got ${source}.`);
5106 }
5107 ret = new Array(source);
5108 for (let i = 0; i < source; i++) {
5109 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
5110 }
5111 } else if (isObject(source)) {
5112 if (source[Symbol.iterator]) {
5113 ret = Array.from(
5114 source,
5115 (item, i) => renderItem(item, i, void 0, cached && cached[i])
5116 );
5117 } else {
5118 const keys = Object.keys(source);
5119 ret = new Array(keys.length);
5120 for (let i = 0, l = keys.length; i < l; i++) {
5121 const key = keys[i];
5122 ret[i] = renderItem(source[key], key, i, cached && cached[i]);
5123 }
5124 }
5125 } else {
5126 ret = [];
5127 }
5128 if (cache) {
5129 cache[index] = ret;
5130 }
5131 return ret;
5132}
5133
5134function createSlots(slots, dynamicSlots) {
5135 for (let i = 0; i < dynamicSlots.length; i++) {
5136 const slot = dynamicSlots[i];
5137 if (isArray(slot)) {
5138 for (let j = 0; j < slot.length; j++) {
5139 slots[slot[j].name] = slot[j].fn;
5140 }
5141 } else if (slot) {
5142 slots[slot.name] = slot.key ? (...args) => {
5143 const res = slot.fn(...args);
5144 if (res) res.key = slot.key;
5145 return res;
5146 } : slot.fn;
5147 }
5148 }
5149 return slots;
5150}
5151
5152function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5153 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5154 if (name !== "default") props.name = name;
5155 return openBlock(), createBlock(
5156 Fragment,
5157 null,
5158 [createVNode("slot", props, fallback && fallback())],
5159 64
5160 );
5161 }
5162 let slot = slots[name];
5163 if (slot && slot.length > 1) {
5164 warn$1(
5165 `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.`
5166 );
5167 slot = () => [];
5168 }
5169 if (slot && slot._c) {
5170 slot._d = false;
5171 }
5172 openBlock();
5173 const validSlotContent = slot && ensureValidVNode(slot(props));
5174 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5175 // key attached in the `createSlots` helper, respect that
5176 validSlotContent && validSlotContent.key;
5177 const rendered = createBlock(
5178 Fragment,
5179 {
5180 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
5181 (!validSlotContent && fallback ? "_fb" : "")
5182 },
5183 validSlotContent || (fallback ? fallback() : []),
5184 validSlotContent && slots._ === 1 ? 64 : -2
5185 );
5186 if (!noSlotted && rendered.scopeId) {
5187 rendered.slotScopeIds = [rendered.scopeId + "-s"];
5188 }
5189 if (slot && slot._c) {
5190 slot._d = true;
5191 }
5192 return rendered;
5193}
5194function ensureValidVNode(vnodes) {
5195 return vnodes.some((child) => {
5196 if (!isVNode(child)) return true;
5197 if (child.type === Comment) return false;
5198 if (child.type === Fragment && !ensureValidVNode(child.children))
5199 return false;
5200 return true;
5201 }) ? vnodes : null;
5202}
5203
5204function toHandlers(obj, preserveCaseIfNecessary) {
5205 const ret = {};
5206 if (!isObject(obj)) {
5207 warn$1(`v-on with no argument expects an object value.`);
5208 return ret;
5209 }
5210 for (const key in obj) {
5211 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
5212 }
5213 return ret;
5214}
5215
5216const getPublicInstance = (i) => {
5217 if (!i) return null;
5218 if (isStatefulComponent(i)) return getComponentPublicInstance(i);
5219 return getPublicInstance(i.parent);
5220};
5221const publicPropertiesMap = (
5222 // Move PURE marker to new line to workaround compiler discarding it
5223 // due to type annotation
5224 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
5225 $: (i) => i,
5226 $el: (i) => i.vnode.el,
5227 $data: (i) => i.data,
5228 $props: (i) => shallowReadonly(i.props) ,
5229 $attrs: (i) => shallowReadonly(i.attrs) ,
5230 $slots: (i) => shallowReadonly(i.slots) ,
5231 $refs: (i) => shallowReadonly(i.refs) ,
5232 $parent: (i) => getPublicInstance(i.parent),
5233 $root: (i) => getPublicInstance(i.root),
5234 $host: (i) => i.ce,
5235 $emit: (i) => i.emit,
5236 $options: (i) => resolveMergedOptions(i) ,
5237 $forceUpdate: (i) => i.f || (i.f = () => {
5238 queueJob(i.update);
5239 }),
5240 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
5241 $watch: (i) => instanceWatch.bind(i)
5242 })
5243);
5244const isReservedPrefix = (key) => key === "_" || key === "$";
5245const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
5246const PublicInstanceProxyHandlers = {
5247 get({ _: instance }, key) {
5248 if (key === "__v_skip") {
5249 return true;
5250 }
5251 const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
5252 if (key === "__isVue") {
5253 return true;
5254 }
5255 let normalizedProps;
5256 if (key[0] !== "$") {
5257 const n = accessCache[key];
5258 if (n !== void 0) {
5259 switch (n) {
5260 case 1 /* SETUP */:
5261 return setupState[key];
5262 case 2 /* DATA */:
5263 return data[key];
5264 case 4 /* CONTEXT */:
5265 return ctx[key];
5266 case 3 /* PROPS */:
5267 return props[key];
5268 }
5269 } else if (hasSetupBinding(setupState, key)) {
5270 accessCache[key] = 1 /* SETUP */;
5271 return setupState[key];
5272 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
5273 accessCache[key] = 2 /* DATA */;
5274 return data[key];
5275 } else if (
5276 // only cache other properties when instance has declared (thus stable)
5277 // props
5278 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
5279 ) {
5280 accessCache[key] = 3 /* PROPS */;
5281 return props[key];
5282 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
5283 accessCache[key] = 4 /* CONTEXT */;
5284 return ctx[key];
5285 } else if (shouldCacheAccess) {
5286 accessCache[key] = 0 /* OTHER */;
5287 }
5288 }
5289 const publicGetter = publicPropertiesMap[key];
5290 let cssModule, globalProperties;
5291 if (publicGetter) {
5292 if (key === "$attrs") {
5293 track(instance.attrs, "get", "");
5294 markAttrsAccessed();
5295 } else if (key === "$slots") {
5296 track(instance, "get", key);
5297 }
5298 return publicGetter(instance);
5299 } else if (
5300 // css module (injected by vue-loader)
5301 (cssModule = type.__cssModules) && (cssModule = cssModule[key])
5302 ) {
5303 return cssModule;
5304 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
5305 accessCache[key] = 4 /* CONTEXT */;
5306 return ctx[key];
5307 } else if (
5308 // global properties
5309 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
5310 ) {
5311 {
5312 return globalProperties[key];
5313 }
5314 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
5315 // to infinite warning loop
5316 key.indexOf("__v") !== 0)) {
5317 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
5318 warn$1(
5319 `Property ${JSON.stringify(
5320 key
5321 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
5322 );
5323 } else if (instance === currentRenderingInstance) {
5324 warn$1(
5325 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
5326 );
5327 }
5328 }
5329 },
5330 set({ _: instance }, key, value) {
5331 const { data, setupState, ctx } = instance;
5332 if (hasSetupBinding(setupState, key)) {
5333 setupState[key] = value;
5334 return true;
5335 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
5336 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
5337 return false;
5338 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
5339 data[key] = value;
5340 return true;
5341 } else if (hasOwn(instance.props, key)) {
5342 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
5343 return false;
5344 }
5345 if (key[0] === "$" && key.slice(1) in instance) {
5346 warn$1(
5347 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
5348 );
5349 return false;
5350 } else {
5351 if (key in instance.appContext.config.globalProperties) {
5352 Object.defineProperty(ctx, key, {
5353 enumerable: true,
5354 configurable: true,
5355 value
5356 });
5357 } else {
5358 ctx[key] = value;
5359 }
5360 }
5361 return true;
5362 },
5363 has({
5364 _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5365 }, key) {
5366 let normalizedProps;
5367 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);
5368 },
5369 defineProperty(target, key, descriptor) {
5370 if (descriptor.get != null) {
5371 target._.accessCache[key] = 0;
5372 } else if (hasOwn(descriptor, "value")) {
5373 this.set(target, key, descriptor.value, null);
5374 }
5375 return Reflect.defineProperty(target, key, descriptor);
5376 }
5377};
5378{
5379 PublicInstanceProxyHandlers.ownKeys = (target) => {
5380 warn$1(
5381 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
5382 );
5383 return Reflect.ownKeys(target);
5384 };
5385}
5386const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
5387 get(target, key) {
5388 if (key === Symbol.unscopables) {
5389 return;
5390 }
5391 return PublicInstanceProxyHandlers.get(target, key, target);
5392 },
5393 has(_, key) {
5394 const has = key[0] !== "_" && !isGloballyAllowed(key);
5395 if (!has && PublicInstanceProxyHandlers.has(_, key)) {
5396 warn$1(
5397 `Property ${JSON.stringify(
5398 key
5399 )} should not start with _ which is a reserved prefix for Vue internals.`
5400 );
5401 }
5402 return has;
5403 }
5404});
5405function createDevRenderContext(instance) {
5406 const target = {};
5407 Object.defineProperty(target, `_`, {
5408 configurable: true,
5409 enumerable: false,
5410 get: () => instance
5411 });
5412 Object.keys(publicPropertiesMap).forEach((key) => {
5413 Object.defineProperty(target, key, {
5414 configurable: true,
5415 enumerable: false,
5416 get: () => publicPropertiesMap[key](instance),
5417 // intercepted by the proxy so no need for implementation,
5418 // but needed to prevent set errors
5419 set: NOOP
5420 });
5421 });
5422 return target;
5423}
5424function exposePropsOnRenderContext(instance) {
5425 const {
5426 ctx,
5427 propsOptions: [propsOptions]
5428 } = instance;
5429 if (propsOptions) {
5430 Object.keys(propsOptions).forEach((key) => {
5431 Object.defineProperty(ctx, key, {
5432 enumerable: true,
5433 configurable: true,
5434 get: () => instance.props[key],
5435 set: NOOP
5436 });
5437 });
5438 }
5439}
5440function exposeSetupStateOnRenderContext(instance) {
5441 const { ctx, setupState } = instance;
5442 Object.keys(toRaw(setupState)).forEach((key) => {
5443 if (!setupState.__isScriptSetup) {
5444 if (isReservedPrefix(key[0])) {
5445 warn$1(
5446 `setup() return property ${JSON.stringify(
5447 key
5448 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
5449 );
5450 return;
5451 }
5452 Object.defineProperty(ctx, key, {
5453 enumerable: true,
5454 configurable: true,
5455 get: () => setupState[key],
5456 set: NOOP
5457 });
5458 }
5459 });
5460}
5461
5462const warnRuntimeUsage = (method) => warn$1(
5463 `${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.`
5464);
5465function defineProps() {
5466 {
5467 warnRuntimeUsage(`defineProps`);
5468 }
5469 return null;
5470}
5471function defineEmits() {
5472 {
5473 warnRuntimeUsage(`defineEmits`);
5474 }
5475 return null;
5476}
5477function defineExpose(exposed) {
5478 {
5479 warnRuntimeUsage(`defineExpose`);
5480 }
5481}
5482function defineOptions(options) {
5483 {
5484 warnRuntimeUsage(`defineOptions`);
5485 }
5486}
5487function defineSlots() {
5488 {
5489 warnRuntimeUsage(`defineSlots`);
5490 }
5491 return null;
5492}
5493function defineModel() {
5494 {
5495 warnRuntimeUsage("defineModel");
5496 }
5497}
5498function withDefaults(props, defaults) {
5499 {
5500 warnRuntimeUsage(`withDefaults`);
5501 }
5502 return null;
5503}
5504function useSlots() {
5505 return getContext().slots;
5506}
5507function useAttrs() {
5508 return getContext().attrs;
5509}
5510function getContext() {
5511 const i = getCurrentInstance();
5512 if (!i) {
5513 warn$1(`useContext() called without active instance.`);
5514 }
5515 return i.setupContext || (i.setupContext = createSetupContext(i));
5516}
5517function normalizePropsOrEmits(props) {
5518 return isArray(props) ? props.reduce(
5519 (normalized, p) => (normalized[p] = null, normalized),
5520 {}
5521 ) : props;
5522}
5523function mergeDefaults(raw, defaults) {
5524 const props = normalizePropsOrEmits(raw);
5525 for (const key in defaults) {
5526 if (key.startsWith("__skip")) continue;
5527 let opt = props[key];
5528 if (opt) {
5529 if (isArray(opt) || isFunction(opt)) {
5530 opt = props[key] = { type: opt, default: defaults[key] };
5531 } else {
5532 opt.default = defaults[key];
5533 }
5534 } else if (opt === null) {
5535 opt = props[key] = { default: defaults[key] };
5536 } else {
5537 warn$1(`props default key "${key}" has no corresponding declaration.`);
5538 }
5539 if (opt && defaults[`__skip_${key}`]) {
5540 opt.skipFactory = true;
5541 }
5542 }
5543 return props;
5544}
5545function mergeModels(a, b) {
5546 if (!a || !b) return a || b;
5547 if (isArray(a) && isArray(b)) return a.concat(b);
5548 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5549}
5550function createPropsRestProxy(props, excludedKeys) {
5551 const ret = {};
5552 for (const key in props) {
5553 if (!excludedKeys.includes(key)) {
5554 Object.defineProperty(ret, key, {
5555 enumerable: true,
5556 get: () => props[key]
5557 });
5558 }
5559 }
5560 return ret;
5561}
5562function withAsyncContext(getAwaitable) {
5563 const ctx = getCurrentInstance();
5564 if (!ctx) {
5565 warn$1(
5566 `withAsyncContext called without active current instance. This is likely a bug.`
5567 );
5568 }
5569 let awaitable = getAwaitable();
5570 unsetCurrentInstance();
5571 if (isPromise(awaitable)) {
5572 awaitable = awaitable.catch((e) => {
5573 setCurrentInstance(ctx);
5574 throw e;
5575 });
5576 }
5577 return [awaitable, () => setCurrentInstance(ctx)];
5578}
5579
5580function createDuplicateChecker() {
5581 const cache = /* @__PURE__ */ Object.create(null);
5582 return (type, key) => {
5583 if (cache[key]) {
5584 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
5585 } else {
5586 cache[key] = type;
5587 }
5588 };
5589}
5590let shouldCacheAccess = true;
5591function applyOptions(instance) {
5592 const options = resolveMergedOptions(instance);
5593 const publicThis = instance.proxy;
5594 const ctx = instance.ctx;
5595 shouldCacheAccess = false;
5596 if (options.beforeCreate) {
5597 callHook$1(options.beforeCreate, instance, "bc");
5598 }
5599 const {
5600 // state
5601 data: dataOptions,
5602 computed: computedOptions,
5603 methods,
5604 watch: watchOptions,
5605 provide: provideOptions,
5606 inject: injectOptions,
5607 // lifecycle
5608 created,
5609 beforeMount,
5610 mounted,
5611 beforeUpdate,
5612 updated,
5613 activated,
5614 deactivated,
5615 beforeDestroy,
5616 beforeUnmount,
5617 destroyed,
5618 unmounted,
5619 render,
5620 renderTracked,
5621 renderTriggered,
5622 errorCaptured,
5623 serverPrefetch,
5624 // public API
5625 expose,
5626 inheritAttrs,
5627 // assets
5628 components,
5629 directives,
5630 filters
5631 } = options;
5632 const checkDuplicateProperties = createDuplicateChecker() ;
5633 {
5634 const [propsOptions] = instance.propsOptions;
5635 if (propsOptions) {
5636 for (const key in propsOptions) {
5637 checkDuplicateProperties("Props" /* PROPS */, key);
5638 }
5639 }
5640 }
5641 if (injectOptions) {
5642 resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5643 }
5644 if (methods) {
5645 for (const key in methods) {
5646 const methodHandler = methods[key];
5647 if (isFunction(methodHandler)) {
5648 {
5649 Object.defineProperty(ctx, key, {
5650 value: methodHandler.bind(publicThis),
5651 configurable: true,
5652 enumerable: true,
5653 writable: true
5654 });
5655 }
5656 {
5657 checkDuplicateProperties("Methods" /* METHODS */, key);
5658 }
5659 } else {
5660 warn$1(
5661 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
5662 );
5663 }
5664 }
5665 }
5666 if (dataOptions) {
5667 if (!isFunction(dataOptions)) {
5668 warn$1(
5669 `The data option must be a function. Plain object usage is no longer supported.`
5670 );
5671 }
5672 const data = dataOptions.call(publicThis, publicThis);
5673 if (isPromise(data)) {
5674 warn$1(
5675 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
5676 );
5677 }
5678 if (!isObject(data)) {
5679 warn$1(`data() should return an object.`);
5680 } else {
5681 instance.data = reactive(data);
5682 {
5683 for (const key in data) {
5684 checkDuplicateProperties("Data" /* DATA */, key);
5685 if (!isReservedPrefix(key[0])) {
5686 Object.defineProperty(ctx, key, {
5687 configurable: true,
5688 enumerable: true,
5689 get: () => data[key],
5690 set: NOOP
5691 });
5692 }
5693 }
5694 }
5695 }
5696 }
5697 shouldCacheAccess = true;
5698 if (computedOptions) {
5699 for (const key in computedOptions) {
5700 const opt = computedOptions[key];
5701 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
5702 if (get === NOOP) {
5703 warn$1(`Computed property "${key}" has no getter.`);
5704 }
5705 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
5706 warn$1(
5707 `Write operation failed: computed property "${key}" is readonly.`
5708 );
5709 } ;
5710 const c = computed({
5711 get,
5712 set
5713 });
5714 Object.defineProperty(ctx, key, {
5715 enumerable: true,
5716 configurable: true,
5717 get: () => c.value,
5718 set: (v) => c.value = v
5719 });
5720 {
5721 checkDuplicateProperties("Computed" /* COMPUTED */, key);
5722 }
5723 }
5724 }
5725 if (watchOptions) {
5726 for (const key in watchOptions) {
5727 createWatcher(watchOptions[key], ctx, publicThis, key);
5728 }
5729 }
5730 if (provideOptions) {
5731 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
5732 Reflect.ownKeys(provides).forEach((key) => {
5733 provide(key, provides[key]);
5734 });
5735 }
5736 if (created) {
5737 callHook$1(created, instance, "c");
5738 }
5739 function registerLifecycleHook(register, hook) {
5740 if (isArray(hook)) {
5741 hook.forEach((_hook) => register(_hook.bind(publicThis)));
5742 } else if (hook) {
5743 register(hook.bind(publicThis));
5744 }
5745 }
5746 registerLifecycleHook(onBeforeMount, beforeMount);
5747 registerLifecycleHook(onMounted, mounted);
5748 registerLifecycleHook(onBeforeUpdate, beforeUpdate);
5749 registerLifecycleHook(onUpdated, updated);
5750 registerLifecycleHook(onActivated, activated);
5751 registerLifecycleHook(onDeactivated, deactivated);
5752 registerLifecycleHook(onErrorCaptured, errorCaptured);
5753 registerLifecycleHook(onRenderTracked, renderTracked);
5754 registerLifecycleHook(onRenderTriggered, renderTriggered);
5755 registerLifecycleHook(onBeforeUnmount, beforeUnmount);
5756 registerLifecycleHook(onUnmounted, unmounted);
5757 registerLifecycleHook(onServerPrefetch, serverPrefetch);
5758 if (isArray(expose)) {
5759 if (expose.length) {
5760 const exposed = instance.exposed || (instance.exposed = {});
5761 expose.forEach((key) => {
5762 Object.defineProperty(exposed, key, {
5763 get: () => publicThis[key],
5764 set: (val) => publicThis[key] = val
5765 });
5766 });
5767 } else if (!instance.exposed) {
5768 instance.exposed = {};
5769 }
5770 }
5771 if (render && instance.render === NOOP) {
5772 instance.render = render;
5773 }
5774 if (inheritAttrs != null) {
5775 instance.inheritAttrs = inheritAttrs;
5776 }
5777 if (components) instance.components = components;
5778 if (directives) instance.directives = directives;
5779 if (serverPrefetch) {
5780 markAsyncBoundary(instance);
5781 }
5782}
5783function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5784 if (isArray(injectOptions)) {
5785 injectOptions = normalizeInject(injectOptions);
5786 }
5787 for (const key in injectOptions) {
5788 const opt = injectOptions[key];
5789 let injected;
5790 if (isObject(opt)) {
5791 if ("default" in opt) {
5792 injected = inject(
5793 opt.from || key,
5794 opt.default,
5795 true
5796 );
5797 } else {
5798 injected = inject(opt.from || key);
5799 }
5800 } else {
5801 injected = inject(opt);
5802 }
5803 if (isRef(injected)) {
5804 Object.defineProperty(ctx, key, {
5805 enumerable: true,
5806 configurable: true,
5807 get: () => injected.value,
5808 set: (v) => injected.value = v
5809 });
5810 } else {
5811 ctx[key] = injected;
5812 }
5813 {
5814 checkDuplicateProperties("Inject" /* INJECT */, key);
5815 }
5816 }
5817}
5818function callHook$1(hook, instance, type) {
5819 callWithAsyncErrorHandling(
5820 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
5821 instance,
5822 type
5823 );
5824}
5825function createWatcher(raw, ctx, publicThis, key) {
5826 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
5827 if (isString(raw)) {
5828 const handler = ctx[raw];
5829 if (isFunction(handler)) {
5830 {
5831 watch(getter, handler);
5832 }
5833 } else {
5834 warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
5835 }
5836 } else if (isFunction(raw)) {
5837 {
5838 watch(getter, raw.bind(publicThis));
5839 }
5840 } else if (isObject(raw)) {
5841 if (isArray(raw)) {
5842 raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
5843 } else {
5844 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
5845 if (isFunction(handler)) {
5846 watch(getter, handler, raw);
5847 } else {
5848 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
5849 }
5850 }
5851 } else {
5852 warn$1(`Invalid watch option: "${key}"`, raw);
5853 }
5854}
5855function resolveMergedOptions(instance) {
5856 const base = instance.type;
5857 const { mixins, extends: extendsOptions } = base;
5858 const {
5859 mixins: globalMixins,
5860 optionsCache: cache,
5861 config: { optionMergeStrategies }
5862 } = instance.appContext;
5863 const cached = cache.get(base);
5864 let resolved;
5865 if (cached) {
5866 resolved = cached;
5867 } else if (!globalMixins.length && !mixins && !extendsOptions) {
5868 {
5869 resolved = base;
5870 }
5871 } else {
5872 resolved = {};
5873 if (globalMixins.length) {
5874 globalMixins.forEach(
5875 (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
5876 );
5877 }
5878 mergeOptions(resolved, base, optionMergeStrategies);
5879 }
5880 if (isObject(base)) {
5881 cache.set(base, resolved);
5882 }
5883 return resolved;
5884}
5885function mergeOptions(to, from, strats, asMixin = false) {
5886 const { mixins, extends: extendsOptions } = from;
5887 if (extendsOptions) {
5888 mergeOptions(to, extendsOptions, strats, true);
5889 }
5890 if (mixins) {
5891 mixins.forEach(
5892 (m) => mergeOptions(to, m, strats, true)
5893 );
5894 }
5895 for (const key in from) {
5896 if (asMixin && key === "expose") {
5897 warn$1(
5898 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
5899 );
5900 } else {
5901 const strat = internalOptionMergeStrats[key] || strats && strats[key];
5902 to[key] = strat ? strat(to[key], from[key]) : from[key];
5903 }
5904 }
5905 return to;
5906}
5907const internalOptionMergeStrats = {
5908 data: mergeDataFn,
5909 props: mergeEmitsOrPropsOptions,
5910 emits: mergeEmitsOrPropsOptions,
5911 // objects
5912 methods: mergeObjectOptions,
5913 computed: mergeObjectOptions,
5914 // lifecycle
5915 beforeCreate: mergeAsArray$1,
5916 created: mergeAsArray$1,
5917 beforeMount: mergeAsArray$1,
5918 mounted: mergeAsArray$1,
5919 beforeUpdate: mergeAsArray$1,
5920 updated: mergeAsArray$1,
5921 beforeDestroy: mergeAsArray$1,
5922 beforeUnmount: mergeAsArray$1,
5923 destroyed: mergeAsArray$1,
5924 unmounted: mergeAsArray$1,
5925 activated: mergeAsArray$1,
5926 deactivated: mergeAsArray$1,
5927 errorCaptured: mergeAsArray$1,
5928 serverPrefetch: mergeAsArray$1,
5929 // assets
5930 components: mergeObjectOptions,
5931 directives: mergeObjectOptions,
5932 // watch
5933 watch: mergeWatchOptions,
5934 // provide / inject
5935 provide: mergeDataFn,
5936 inject: mergeInject
5937};
5938function mergeDataFn(to, from) {
5939 if (!from) {
5940 return to;
5941 }
5942 if (!to) {
5943 return from;
5944 }
5945 return function mergedDataFn() {
5946 return (extend)(
5947 isFunction(to) ? to.call(this, this) : to,
5948 isFunction(from) ? from.call(this, this) : from
5949 );
5950 };
5951}
5952function mergeInject(to, from) {
5953 return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
5954}
5955function normalizeInject(raw) {
5956 if (isArray(raw)) {
5957 const res = {};
5958 for (let i = 0; i < raw.length; i++) {
5959 res[raw[i]] = raw[i];
5960 }
5961 return res;
5962 }
5963 return raw;
5964}
5965function mergeAsArray$1(to, from) {
5966 return to ? [...new Set([].concat(to, from))] : from;
5967}
5968function mergeObjectOptions(to, from) {
5969 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5970}
5971function mergeEmitsOrPropsOptions(to, from) {
5972 if (to) {
5973 if (isArray(to) && isArray(from)) {
5974 return [.../* @__PURE__ */ new Set([...to, ...from])];
5975 }
5976 return extend(
5977 /* @__PURE__ */ Object.create(null),
5978 normalizePropsOrEmits(to),
5979 normalizePropsOrEmits(from != null ? from : {})
5980 );
5981 } else {
5982 return from;
5983 }
5984}
5985function mergeWatchOptions(to, from) {
5986 if (!to) return from;
5987 if (!from) return to;
5988 const merged = extend(/* @__PURE__ */ Object.create(null), to);
5989 for (const key in from) {
5990 merged[key] = mergeAsArray$1(to[key], from[key]);
5991 }
5992 return merged;
5993}
5994
5995function createAppContext() {
5996 return {
5997 app: null,
5998 config: {
5999 isNativeTag: NO,
6000 performance: false,
6001 globalProperties: {},
6002 optionMergeStrategies: {},
6003 errorHandler: void 0,
6004 warnHandler: void 0,
6005 compilerOptions: {}
6006 },
6007 mixins: [],
6008 components: {},
6009 directives: {},
6010 provides: /* @__PURE__ */ Object.create(null),
6011 optionsCache: /* @__PURE__ */ new WeakMap(),
6012 propsCache: /* @__PURE__ */ new WeakMap(),
6013 emitsCache: /* @__PURE__ */ new WeakMap()
6014 };
6015}
6016let uid$1 = 0;
6017function createAppAPI(render, hydrate) {
6018 return function createApp(rootComponent, rootProps = null) {
6019 if (!isFunction(rootComponent)) {
6020 rootComponent = extend({}, rootComponent);
6021 }
6022 if (rootProps != null && !isObject(rootProps)) {
6023 warn$1(`root props passed to app.mount() must be an object.`);
6024 rootProps = null;
6025 }
6026 const context = createAppContext();
6027 const installedPlugins = /* @__PURE__ */ new WeakSet();
6028 const pluginCleanupFns = [];
6029 let isMounted = false;
6030 const app = context.app = {
6031 _uid: uid$1++,
6032 _component: rootComponent,
6033 _props: rootProps,
6034 _container: null,
6035 _context: context,
6036 _instance: null,
6037 version,
6038 get config() {
6039 return context.config;
6040 },
6041 set config(v) {
6042 {
6043 warn$1(
6044 `app.config cannot be replaced. Modify individual options instead.`
6045 );
6046 }
6047 },
6048 use(plugin, ...options) {
6049 if (installedPlugins.has(plugin)) {
6050 warn$1(`Plugin has already been applied to target app.`);
6051 } else if (plugin && isFunction(plugin.install)) {
6052 installedPlugins.add(plugin);
6053 plugin.install(app, ...options);
6054 } else if (isFunction(plugin)) {
6055 installedPlugins.add(plugin);
6056 plugin(app, ...options);
6057 } else {
6058 warn$1(
6059 `A plugin must either be a function or an object with an "install" function.`
6060 );
6061 }
6062 return app;
6063 },
6064 mixin(mixin) {
6065 {
6066 if (!context.mixins.includes(mixin)) {
6067 context.mixins.push(mixin);
6068 } else {
6069 warn$1(
6070 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6071 );
6072 }
6073 }
6074 return app;
6075 },
6076 component(name, component) {
6077 {
6078 validateComponentName(name, context.config);
6079 }
6080 if (!component) {
6081 return context.components[name];
6082 }
6083 if (context.components[name]) {
6084 warn$1(`Component "${name}" has already been registered in target app.`);
6085 }
6086 context.components[name] = component;
6087 return app;
6088 },
6089 directive(name, directive) {
6090 {
6091 validateDirectiveName(name);
6092 }
6093 if (!directive) {
6094 return context.directives[name];
6095 }
6096 if (context.directives[name]) {
6097 warn$1(`Directive "${name}" has already been registered in target app.`);
6098 }
6099 context.directives[name] = directive;
6100 return app;
6101 },
6102 mount(rootContainer, isHydrate, namespace) {
6103 if (!isMounted) {
6104 if (rootContainer.__vue_app__) {
6105 warn$1(
6106 `There is already an app instance mounted on the host container.
6107 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6108 );
6109 }
6110 const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
6111 vnode.appContext = context;
6112 if (namespace === true) {
6113 namespace = "svg";
6114 } else if (namespace === false) {
6115 namespace = void 0;
6116 }
6117 {
6118 context.reload = () => {
6119 render(
6120 cloneVNode(vnode),
6121 rootContainer,
6122 namespace
6123 );
6124 };
6125 }
6126 if (isHydrate && hydrate) {
6127 hydrate(vnode, rootContainer);
6128 } else {
6129 render(vnode, rootContainer, namespace);
6130 }
6131 isMounted = true;
6132 app._container = rootContainer;
6133 rootContainer.__vue_app__ = app;
6134 {
6135 app._instance = vnode.component;
6136 devtoolsInitApp(app, version);
6137 }
6138 return getComponentPublicInstance(vnode.component);
6139 } else {
6140 warn$1(
6141 `App has already been mounted.
6142If 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)\``
6143 );
6144 }
6145 },
6146 onUnmount(cleanupFn) {
6147 if (typeof cleanupFn !== "function") {
6148 warn$1(
6149 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
6150 );
6151 }
6152 pluginCleanupFns.push(cleanupFn);
6153 },
6154 unmount() {
6155 if (isMounted) {
6156 callWithAsyncErrorHandling(
6157 pluginCleanupFns,
6158 app._instance,
6159 16
6160 );
6161 render(null, app._container);
6162 {
6163 app._instance = null;
6164 devtoolsUnmountApp(app);
6165 }
6166 delete app._container.__vue_app__;
6167 } else {
6168 warn$1(`Cannot unmount an app that is not mounted.`);
6169 }
6170 },
6171 provide(key, value) {
6172 if (key in context.provides) {
6173 warn$1(
6174 `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6175 );
6176 }
6177 context.provides[key] = value;
6178 return app;
6179 },
6180 runWithContext(fn) {
6181 const lastApp = currentApp;
6182 currentApp = app;
6183 try {
6184 return fn();
6185 } finally {
6186 currentApp = lastApp;
6187 }
6188 }
6189 };
6190 return app;
6191 };
6192}
6193let currentApp = null;
6194
6195function provide(key, value) {
6196 if (!currentInstance) {
6197 {
6198 warn$1(`provide() can only be used inside setup().`);
6199 }
6200 } else {
6201 let provides = currentInstance.provides;
6202 const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6203 if (parentProvides === provides) {
6204 provides = currentInstance.provides = Object.create(parentProvides);
6205 }
6206 provides[key] = value;
6207 }
6208}
6209function inject(key, defaultValue, treatDefaultAsFactory = false) {
6210 const instance = currentInstance || currentRenderingInstance;
6211 if (instance || currentApp) {
6212 const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6213 if (provides && key in provides) {
6214 return provides[key];
6215 } else if (arguments.length > 1) {
6216 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6217 } else {
6218 warn$1(`injection "${String(key)}" not found.`);
6219 }
6220 } else {
6221 warn$1(`inject() can only be used inside setup() or functional components.`);
6222 }
6223}
6224function hasInjectionContext() {
6225 return !!(currentInstance || currentRenderingInstance || currentApp);
6226}
6227
6228const internalObjectProto = {};
6229const createInternalObject = () => Object.create(internalObjectProto);
6230const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
6231
6232function initProps(instance, rawProps, isStateful, isSSR = false) {
6233 const props = {};
6234 const attrs = createInternalObject();
6235 instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6236 setFullProps(instance, rawProps, props, attrs);
6237 for (const key in instance.propsOptions[0]) {
6238 if (!(key in props)) {
6239 props[key] = void 0;
6240 }
6241 }
6242 {
6243 validateProps(rawProps || {}, props, instance);
6244 }
6245 if (isStateful) {
6246 instance.props = isSSR ? props : shallowReactive(props);
6247 } else {
6248 if (!instance.type.props) {
6249 instance.props = attrs;
6250 } else {
6251 instance.props = props;
6252 }
6253 }
6254 instance.attrs = attrs;
6255}
6256function isInHmrContext(instance) {
6257 while (instance) {
6258 if (instance.type.__hmrId) return true;
6259 instance = instance.parent;
6260 }
6261}
6262function updateProps(instance, rawProps, rawPrevProps, optimized) {
6263 const {
6264 props,
6265 attrs,
6266 vnode: { patchFlag }
6267 } = instance;
6268 const rawCurrentProps = toRaw(props);
6269 const [options] = instance.propsOptions;
6270 let hasAttrsChanged = false;
6271 if (
6272 // always force full diff in dev
6273 // - #1942 if hmr is enabled with sfc component
6274 // - vite#872 non-sfc component used by sfc component
6275 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6276 ) {
6277 if (patchFlag & 8) {
6278 const propsToUpdate = instance.vnode.dynamicProps;
6279 for (let i = 0; i < propsToUpdate.length; i++) {
6280 let key = propsToUpdate[i];
6281 if (isEmitListener(instance.emitsOptions, key)) {
6282 continue;
6283 }
6284 const value = rawProps[key];
6285 if (options) {
6286 if (hasOwn(attrs, key)) {
6287 if (value !== attrs[key]) {
6288 attrs[key] = value;
6289 hasAttrsChanged = true;
6290 }
6291 } else {
6292 const camelizedKey = camelize(key);
6293 props[camelizedKey] = resolvePropValue(
6294 options,
6295 rawCurrentProps,
6296 camelizedKey,
6297 value,
6298 instance,
6299 false
6300 );
6301 }
6302 } else {
6303 if (value !== attrs[key]) {
6304 attrs[key] = value;
6305 hasAttrsChanged = true;
6306 }
6307 }
6308 }
6309 }
6310 } else {
6311 if (setFullProps(instance, rawProps, props, attrs)) {
6312 hasAttrsChanged = true;
6313 }
6314 let kebabKey;
6315 for (const key in rawCurrentProps) {
6316 if (!rawProps || // for camelCase
6317 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6318 // and converted to camelCase (#955)
6319 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6320 if (options) {
6321 if (rawPrevProps && // for camelCase
6322 (rawPrevProps[key] !== void 0 || // for kebab-case
6323 rawPrevProps[kebabKey] !== void 0)) {
6324 props[key] = resolvePropValue(
6325 options,
6326 rawCurrentProps,
6327 key,
6328 void 0,
6329 instance,
6330 true
6331 );
6332 }
6333 } else {
6334 delete props[key];
6335 }
6336 }
6337 }
6338 if (attrs !== rawCurrentProps) {
6339 for (const key in attrs) {
6340 if (!rawProps || !hasOwn(rawProps, key) && true) {
6341 delete attrs[key];
6342 hasAttrsChanged = true;
6343 }
6344 }
6345 }
6346 }
6347 if (hasAttrsChanged) {
6348 trigger(instance.attrs, "set", "");
6349 }
6350 {
6351 validateProps(rawProps || {}, props, instance);
6352 }
6353}
6354function setFullProps(instance, rawProps, props, attrs) {
6355 const [options, needCastKeys] = instance.propsOptions;
6356 let hasAttrsChanged = false;
6357 let rawCastValues;
6358 if (rawProps) {
6359 for (let key in rawProps) {
6360 if (isReservedProp(key)) {
6361 continue;
6362 }
6363 const value = rawProps[key];
6364 let camelKey;
6365 if (options && hasOwn(options, camelKey = camelize(key))) {
6366 if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6367 props[camelKey] = value;
6368 } else {
6369 (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6370 }
6371 } else if (!isEmitListener(instance.emitsOptions, key)) {
6372 if (!(key in attrs) || value !== attrs[key]) {
6373 attrs[key] = value;
6374 hasAttrsChanged = true;
6375 }
6376 }
6377 }
6378 }
6379 if (needCastKeys) {
6380 const rawCurrentProps = toRaw(props);
6381 const castValues = rawCastValues || EMPTY_OBJ;
6382 for (let i = 0; i < needCastKeys.length; i++) {
6383 const key = needCastKeys[i];
6384 props[key] = resolvePropValue(
6385 options,
6386 rawCurrentProps,
6387 key,
6388 castValues[key],
6389 instance,
6390 !hasOwn(castValues, key)
6391 );
6392 }
6393 }
6394 return hasAttrsChanged;
6395}
6396function resolvePropValue(options, props, key, value, instance, isAbsent) {
6397 const opt = options[key];
6398 if (opt != null) {
6399 const hasDefault = hasOwn(opt, "default");
6400 if (hasDefault && value === void 0) {
6401 const defaultValue = opt.default;
6402 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6403 const { propsDefaults } = instance;
6404 if (key in propsDefaults) {
6405 value = propsDefaults[key];
6406 } else {
6407 const reset = setCurrentInstance(instance);
6408 value = propsDefaults[key] = defaultValue.call(
6409 null,
6410 props
6411 );
6412 reset();
6413 }
6414 } else {
6415 value = defaultValue;
6416 }
6417 if (instance.ce) {
6418 instance.ce._setProp(key, value);
6419 }
6420 }
6421 if (opt[0 /* shouldCast */]) {
6422 if (isAbsent && !hasDefault) {
6423 value = false;
6424 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6425 value = true;
6426 }
6427 }
6428 }
6429 return value;
6430}
6431const mixinPropsCache = /* @__PURE__ */ new WeakMap();
6432function normalizePropsOptions(comp, appContext, asMixin = false) {
6433 const cache = asMixin ? mixinPropsCache : appContext.propsCache;
6434 const cached = cache.get(comp);
6435 if (cached) {
6436 return cached;
6437 }
6438 const raw = comp.props;
6439 const normalized = {};
6440 const needCastKeys = [];
6441 let hasExtends = false;
6442 if (!isFunction(comp)) {
6443 const extendProps = (raw2) => {
6444 hasExtends = true;
6445 const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6446 extend(normalized, props);
6447 if (keys) needCastKeys.push(...keys);
6448 };
6449 if (!asMixin && appContext.mixins.length) {
6450 appContext.mixins.forEach(extendProps);
6451 }
6452 if (comp.extends) {
6453 extendProps(comp.extends);
6454 }
6455 if (comp.mixins) {
6456 comp.mixins.forEach(extendProps);
6457 }
6458 }
6459 if (!raw && !hasExtends) {
6460 if (isObject(comp)) {
6461 cache.set(comp, EMPTY_ARR);
6462 }
6463 return EMPTY_ARR;
6464 }
6465 if (isArray(raw)) {
6466 for (let i = 0; i < raw.length; i++) {
6467 if (!isString(raw[i])) {
6468 warn$1(`props must be strings when using array syntax.`, raw[i]);
6469 }
6470 const normalizedKey = camelize(raw[i]);
6471 if (validatePropName(normalizedKey)) {
6472 normalized[normalizedKey] = EMPTY_OBJ;
6473 }
6474 }
6475 } else if (raw) {
6476 if (!isObject(raw)) {
6477 warn$1(`invalid props options`, raw);
6478 }
6479 for (const key in raw) {
6480 const normalizedKey = camelize(key);
6481 if (validatePropName(normalizedKey)) {
6482 const opt = raw[key];
6483 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6484 const propType = prop.type;
6485 let shouldCast = false;
6486 let shouldCastTrue = true;
6487 if (isArray(propType)) {
6488 for (let index = 0; index < propType.length; ++index) {
6489 const type = propType[index];
6490 const typeName = isFunction(type) && type.name;
6491 if (typeName === "Boolean") {
6492 shouldCast = true;
6493 break;
6494 } else if (typeName === "String") {
6495 shouldCastTrue = false;
6496 }
6497 }
6498 } else {
6499 shouldCast = isFunction(propType) && propType.name === "Boolean";
6500 }
6501 prop[0 /* shouldCast */] = shouldCast;
6502 prop[1 /* shouldCastTrue */] = shouldCastTrue;
6503 if (shouldCast || hasOwn(prop, "default")) {
6504 needCastKeys.push(normalizedKey);
6505 }
6506 }
6507 }
6508 }
6509 const res = [normalized, needCastKeys];
6510 if (isObject(comp)) {
6511 cache.set(comp, res);
6512 }
6513 return res;
6514}
6515function validatePropName(key) {
6516 if (key[0] !== "$" && !isReservedProp(key)) {
6517 return true;
6518 } else {
6519 warn$1(`Invalid prop name: "${key}" is a reserved property.`);
6520 }
6521 return false;
6522}
6523function getType(ctor) {
6524 if (ctor === null) {
6525 return "null";
6526 }
6527 if (typeof ctor === "function") {
6528 return ctor.name || "";
6529 } else if (typeof ctor === "object") {
6530 const name = ctor.constructor && ctor.constructor.name;
6531 return name || "";
6532 }
6533 return "";
6534}
6535function validateProps(rawProps, props, instance) {
6536 const resolvedValues = toRaw(props);
6537 const options = instance.propsOptions[0];
6538 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
6539 for (const key in options) {
6540 let opt = options[key];
6541 if (opt == null) continue;
6542 validateProp(
6543 key,
6544 resolvedValues[key],
6545 opt,
6546 shallowReadonly(resolvedValues) ,
6547 !camelizePropsKey.includes(key)
6548 );
6549 }
6550}
6551function validateProp(name, value, prop, props, isAbsent) {
6552 const { type, required, validator, skipCheck } = prop;
6553 if (required && isAbsent) {
6554 warn$1('Missing required prop: "' + name + '"');
6555 return;
6556 }
6557 if (value == null && !required) {
6558 return;
6559 }
6560 if (type != null && type !== true && !skipCheck) {
6561 let isValid = false;
6562 const types = isArray(type) ? type : [type];
6563 const expectedTypes = [];
6564 for (let i = 0; i < types.length && !isValid; i++) {
6565 const { valid, expectedType } = assertType(value, types[i]);
6566 expectedTypes.push(expectedType || "");
6567 isValid = valid;
6568 }
6569 if (!isValid) {
6570 warn$1(getInvalidTypeMessage(name, value, expectedTypes));
6571 return;
6572 }
6573 }
6574 if (validator && !validator(value, props)) {
6575 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
6576 }
6577}
6578const isSimpleType = /* @__PURE__ */ makeMap(
6579 "String,Number,Boolean,Function,Symbol,BigInt"
6580);
6581function assertType(value, type) {
6582 let valid;
6583 const expectedType = getType(type);
6584 if (expectedType === "null") {
6585 valid = value === null;
6586 } else if (isSimpleType(expectedType)) {
6587 const t = typeof value;
6588 valid = t === expectedType.toLowerCase();
6589 if (!valid && t === "object") {
6590 valid = value instanceof type;
6591 }
6592 } else if (expectedType === "Object") {
6593 valid = isObject(value);
6594 } else if (expectedType === "Array") {
6595 valid = isArray(value);
6596 } else {
6597 valid = value instanceof type;
6598 }
6599 return {
6600 valid,
6601 expectedType
6602 };
6603}
6604function getInvalidTypeMessage(name, value, expectedTypes) {
6605 if (expectedTypes.length === 0) {
6606 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
6607 }
6608 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6609 const expectedType = expectedTypes[0];
6610 const receivedType = toRawType(value);
6611 const expectedValue = styleValue(value, expectedType);
6612 const receivedValue = styleValue(value, receivedType);
6613 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6614 message += ` with value ${expectedValue}`;
6615 }
6616 message += `, got ${receivedType} `;
6617 if (isExplicable(receivedType)) {
6618 message += `with value ${receivedValue}.`;
6619 }
6620 return message;
6621}
6622function styleValue(value, type) {
6623 if (type === "String") {
6624 return `"${value}"`;
6625 } else if (type === "Number") {
6626 return `${Number(value)}`;
6627 } else {
6628 return `${value}`;
6629 }
6630}
6631function isExplicable(type) {
6632 const explicitTypes = ["string", "number", "boolean"];
6633 return explicitTypes.some((elem) => type.toLowerCase() === elem);
6634}
6635function isBoolean(...args) {
6636 return args.some((elem) => elem.toLowerCase() === "boolean");
6637}
6638
6639const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6640const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6641const normalizeSlot = (key, rawSlot, ctx) => {
6642 if (rawSlot._n) {
6643 return rawSlot;
6644 }
6645 const normalized = withCtx((...args) => {
6646 if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
6647 warn$1(
6648 `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.`
6649 );
6650 }
6651 return normalizeSlotValue(rawSlot(...args));
6652 }, ctx);
6653 normalized._c = false;
6654 return normalized;
6655};
6656const normalizeObjectSlots = (rawSlots, slots, instance) => {
6657 const ctx = rawSlots._ctx;
6658 for (const key in rawSlots) {
6659 if (isInternalKey(key)) continue;
6660 const value = rawSlots[key];
6661 if (isFunction(value)) {
6662 slots[key] = normalizeSlot(key, value, ctx);
6663 } else if (value != null) {
6664 {
6665 warn$1(
6666 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6667 );
6668 }
6669 const normalized = normalizeSlotValue(value);
6670 slots[key] = () => normalized;
6671 }
6672 }
6673};
6674const normalizeVNodeSlots = (instance, children) => {
6675 if (!isKeepAlive(instance.vnode) && true) {
6676 warn$1(
6677 `Non-function value encountered for default slot. Prefer function slots for better performance.`
6678 );
6679 }
6680 const normalized = normalizeSlotValue(children);
6681 instance.slots.default = () => normalized;
6682};
6683const assignSlots = (slots, children, optimized) => {
6684 for (const key in children) {
6685 if (optimized || key !== "_") {
6686 slots[key] = children[key];
6687 }
6688 }
6689};
6690const initSlots = (instance, children, optimized) => {
6691 const slots = instance.slots = createInternalObject();
6692 if (instance.vnode.shapeFlag & 32) {
6693 const type = children._;
6694 if (type) {
6695 assignSlots(slots, children, optimized);
6696 if (optimized) {
6697 def(slots, "_", type, true);
6698 }
6699 } else {
6700 normalizeObjectSlots(children, slots);
6701 }
6702 } else if (children) {
6703 normalizeVNodeSlots(instance, children);
6704 }
6705};
6706const updateSlots = (instance, children, optimized) => {
6707 const { vnode, slots } = instance;
6708 let needDeletionCheck = true;
6709 let deletionComparisonTarget = EMPTY_OBJ;
6710 if (vnode.shapeFlag & 32) {
6711 const type = children._;
6712 if (type) {
6713 if (isHmrUpdating) {
6714 assignSlots(slots, children, optimized);
6715 trigger(instance, "set", "$slots");
6716 } else if (optimized && type === 1) {
6717 needDeletionCheck = false;
6718 } else {
6719 assignSlots(slots, children, optimized);
6720 }
6721 } else {
6722 needDeletionCheck = !children.$stable;
6723 normalizeObjectSlots(children, slots);
6724 }
6725 deletionComparisonTarget = children;
6726 } else if (children) {
6727 normalizeVNodeSlots(instance, children);
6728 deletionComparisonTarget = { default: 1 };
6729 }
6730 if (needDeletionCheck) {
6731 for (const key in slots) {
6732 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
6733 delete slots[key];
6734 }
6735 }
6736 }
6737};
6738
6739let supported;
6740let perf;
6741function startMeasure(instance, type) {
6742 if (instance.appContext.config.performance && isSupported()) {
6743 perf.mark(`vue-${type}-${instance.uid}`);
6744 }
6745 {
6746 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6747 }
6748}
6749function endMeasure(instance, type) {
6750 if (instance.appContext.config.performance && isSupported()) {
6751 const startTag = `vue-${type}-${instance.uid}`;
6752 const endTag = startTag + `:end`;
6753 perf.mark(endTag);
6754 perf.measure(
6755 `<${formatComponentName(instance, instance.type)}> ${type}`,
6756 startTag,
6757 endTag
6758 );
6759 perf.clearMarks(startTag);
6760 perf.clearMarks(endTag);
6761 }
6762 {
6763 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6764 }
6765}
6766function isSupported() {
6767 if (supported !== void 0) {
6768 return supported;
6769 }
6770 if (typeof window !== "undefined" && window.performance) {
6771 supported = true;
6772 perf = window.performance;
6773 } else {
6774 supported = false;
6775 }
6776 return supported;
6777}
6778
6779const queuePostRenderEffect = queueEffectWithSuspense ;
6780function createRenderer(options) {
6781 return baseCreateRenderer(options);
6782}
6783function createHydrationRenderer(options) {
6784 return baseCreateRenderer(options, createHydrationFunctions);
6785}
6786function baseCreateRenderer(options, createHydrationFns) {
6787 const target = getGlobalThis();
6788 target.__VUE__ = true;
6789 {
6790 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6791 }
6792 const {
6793 insert: hostInsert,
6794 remove: hostRemove,
6795 patchProp: hostPatchProp,
6796 createElement: hostCreateElement,
6797 createText: hostCreateText,
6798 createComment: hostCreateComment,
6799 setText: hostSetText,
6800 setElementText: hostSetElementText,
6801 parentNode: hostParentNode,
6802 nextSibling: hostNextSibling,
6803 setScopeId: hostSetScopeId = NOOP,
6804 insertStaticContent: hostInsertStaticContent
6805 } = options;
6806 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
6807 if (n1 === n2) {
6808 return;
6809 }
6810 if (n1 && !isSameVNodeType(n1, n2)) {
6811 anchor = getNextHostNode(n1);
6812 unmount(n1, parentComponent, parentSuspense, true);
6813 n1 = null;
6814 }
6815 if (n2.patchFlag === -2) {
6816 optimized = false;
6817 n2.dynamicChildren = null;
6818 }
6819 const { type, ref, shapeFlag } = n2;
6820 switch (type) {
6821 case Text:
6822 processText(n1, n2, container, anchor);
6823 break;
6824 case Comment:
6825 processCommentNode(n1, n2, container, anchor);
6826 break;
6827 case Static:
6828 if (n1 == null) {
6829 mountStaticNode(n2, container, anchor, namespace);
6830 } else {
6831 patchStaticNode(n1, n2, container, namespace);
6832 }
6833 break;
6834 case Fragment:
6835 processFragment(
6836 n1,
6837 n2,
6838 container,
6839 anchor,
6840 parentComponent,
6841 parentSuspense,
6842 namespace,
6843 slotScopeIds,
6844 optimized
6845 );
6846 break;
6847 default:
6848 if (shapeFlag & 1) {
6849 processElement(
6850 n1,
6851 n2,
6852 container,
6853 anchor,
6854 parentComponent,
6855 parentSuspense,
6856 namespace,
6857 slotScopeIds,
6858 optimized
6859 );
6860 } else if (shapeFlag & 6) {
6861 processComponent(
6862 n1,
6863 n2,
6864 container,
6865 anchor,
6866 parentComponent,
6867 parentSuspense,
6868 namespace,
6869 slotScopeIds,
6870 optimized
6871 );
6872 } else if (shapeFlag & 64) {
6873 type.process(
6874 n1,
6875 n2,
6876 container,
6877 anchor,
6878 parentComponent,
6879 parentSuspense,
6880 namespace,
6881 slotScopeIds,
6882 optimized,
6883 internals
6884 );
6885 } else if (shapeFlag & 128) {
6886 type.process(
6887 n1,
6888 n2,
6889 container,
6890 anchor,
6891 parentComponent,
6892 parentSuspense,
6893 namespace,
6894 slotScopeIds,
6895 optimized,
6896 internals
6897 );
6898 } else {
6899 warn$1("Invalid VNode type:", type, `(${typeof type})`);
6900 }
6901 }
6902 if (ref != null && parentComponent) {
6903 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6904 }
6905 };
6906 const processText = (n1, n2, container, anchor) => {
6907 if (n1 == null) {
6908 hostInsert(
6909 n2.el = hostCreateText(n2.children),
6910 container,
6911 anchor
6912 );
6913 } else {
6914 const el = n2.el = n1.el;
6915 if (n2.children !== n1.children) {
6916 hostSetText(el, n2.children);
6917 }
6918 }
6919 };
6920 const processCommentNode = (n1, n2, container, anchor) => {
6921 if (n1 == null) {
6922 hostInsert(
6923 n2.el = hostCreateComment(n2.children || ""),
6924 container,
6925 anchor
6926 );
6927 } else {
6928 n2.el = n1.el;
6929 }
6930 };
6931 const mountStaticNode = (n2, container, anchor, namespace) => {
6932 [n2.el, n2.anchor] = hostInsertStaticContent(
6933 n2.children,
6934 container,
6935 anchor,
6936 namespace,
6937 n2.el,
6938 n2.anchor
6939 );
6940 };
6941 const patchStaticNode = (n1, n2, container, namespace) => {
6942 if (n2.children !== n1.children) {
6943 const anchor = hostNextSibling(n1.anchor);
6944 removeStaticNode(n1);
6945 [n2.el, n2.anchor] = hostInsertStaticContent(
6946 n2.children,
6947 container,
6948 anchor,
6949 namespace
6950 );
6951 } else {
6952 n2.el = n1.el;
6953 n2.anchor = n1.anchor;
6954 }
6955 };
6956 const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
6957 let next;
6958 while (el && el !== anchor) {
6959 next = hostNextSibling(el);
6960 hostInsert(el, container, nextSibling);
6961 el = next;
6962 }
6963 hostInsert(anchor, container, nextSibling);
6964 };
6965 const removeStaticNode = ({ el, anchor }) => {
6966 let next;
6967 while (el && el !== anchor) {
6968 next = hostNextSibling(el);
6969 hostRemove(el);
6970 el = next;
6971 }
6972 hostRemove(anchor);
6973 };
6974 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6975 if (n2.type === "svg") {
6976 namespace = "svg";
6977 } else if (n2.type === "math") {
6978 namespace = "mathml";
6979 }
6980 if (n1 == null) {
6981 mountElement(
6982 n2,
6983 container,
6984 anchor,
6985 parentComponent,
6986 parentSuspense,
6987 namespace,
6988 slotScopeIds,
6989 optimized
6990 );
6991 } else {
6992 patchElement(
6993 n1,
6994 n2,
6995 parentComponent,
6996 parentSuspense,
6997 namespace,
6998 slotScopeIds,
6999 optimized
7000 );
7001 }
7002 };
7003 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7004 let el;
7005 let vnodeHook;
7006 const { props, shapeFlag, transition, dirs } = vnode;
7007 el = vnode.el = hostCreateElement(
7008 vnode.type,
7009 namespace,
7010 props && props.is,
7011 props
7012 );
7013 if (shapeFlag & 8) {
7014 hostSetElementText(el, vnode.children);
7015 } else if (shapeFlag & 16) {
7016 mountChildren(
7017 vnode.children,
7018 el,
7019 null,
7020 parentComponent,
7021 parentSuspense,
7022 resolveChildrenNamespace(vnode, namespace),
7023 slotScopeIds,
7024 optimized
7025 );
7026 }
7027 if (dirs) {
7028 invokeDirectiveHook(vnode, null, parentComponent, "created");
7029 }
7030 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
7031 if (props) {
7032 for (const key in props) {
7033 if (key !== "value" && !isReservedProp(key)) {
7034 hostPatchProp(el, key, null, props[key], namespace, parentComponent);
7035 }
7036 }
7037 if ("value" in props) {
7038 hostPatchProp(el, "value", null, props.value, namespace);
7039 }
7040 if (vnodeHook = props.onVnodeBeforeMount) {
7041 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7042 }
7043 }
7044 {
7045 def(el, "__vnode", vnode, true);
7046 def(el, "__vueParentComponent", parentComponent, true);
7047 }
7048 if (dirs) {
7049 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7050 }
7051 const needCallTransitionHooks = needTransition(parentSuspense, transition);
7052 if (needCallTransitionHooks) {
7053 transition.beforeEnter(el);
7054 }
7055 hostInsert(el, container, anchor);
7056 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7057 queuePostRenderEffect(() => {
7058 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7059 needCallTransitionHooks && transition.enter(el);
7060 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7061 }, parentSuspense);
7062 }
7063 };
7064 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
7065 if (scopeId) {
7066 hostSetScopeId(el, scopeId);
7067 }
7068 if (slotScopeIds) {
7069 for (let i = 0; i < slotScopeIds.length; i++) {
7070 hostSetScopeId(el, slotScopeIds[i]);
7071 }
7072 }
7073 if (parentComponent) {
7074 let subTree = parentComponent.subTree;
7075 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7076 subTree = filterSingleRoot(subTree.children) || subTree;
7077 }
7078 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
7079 const parentVNode = parentComponent.vnode;
7080 setScopeId(
7081 el,
7082 parentVNode,
7083 parentVNode.scopeId,
7084 parentVNode.slotScopeIds,
7085 parentComponent.parent
7086 );
7087 }
7088 }
7089 };
7090 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
7091 for (let i = start; i < children.length; i++) {
7092 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
7093 patch(
7094 null,
7095 child,
7096 container,
7097 anchor,
7098 parentComponent,
7099 parentSuspense,
7100 namespace,
7101 slotScopeIds,
7102 optimized
7103 );
7104 }
7105 };
7106 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7107 const el = n2.el = n1.el;
7108 {
7109 el.__vnode = n2;
7110 }
7111 let { patchFlag, dynamicChildren, dirs } = n2;
7112 patchFlag |= n1.patchFlag & 16;
7113 const oldProps = n1.props || EMPTY_OBJ;
7114 const newProps = n2.props || EMPTY_OBJ;
7115 let vnodeHook;
7116 parentComponent && toggleRecurse(parentComponent, false);
7117 if (vnodeHook = newProps.onVnodeBeforeUpdate) {
7118 invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7119 }
7120 if (dirs) {
7121 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7122 }
7123 parentComponent && toggleRecurse(parentComponent, true);
7124 if (isHmrUpdating) {
7125 patchFlag = 0;
7126 optimized = false;
7127 dynamicChildren = null;
7128 }
7129 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
7130 hostSetElementText(el, "");
7131 }
7132 if (dynamicChildren) {
7133 patchBlockChildren(
7134 n1.dynamicChildren,
7135 dynamicChildren,
7136 el,
7137 parentComponent,
7138 parentSuspense,
7139 resolveChildrenNamespace(n2, namespace),
7140 slotScopeIds
7141 );
7142 {
7143 traverseStaticChildren(n1, n2);
7144 }
7145 } else if (!optimized) {
7146 patchChildren(
7147 n1,
7148 n2,
7149 el,
7150 null,
7151 parentComponent,
7152 parentSuspense,
7153 resolveChildrenNamespace(n2, namespace),
7154 slotScopeIds,
7155 false
7156 );
7157 }
7158 if (patchFlag > 0) {
7159 if (patchFlag & 16) {
7160 patchProps(el, oldProps, newProps, parentComponent, namespace);
7161 } else {
7162 if (patchFlag & 2) {
7163 if (oldProps.class !== newProps.class) {
7164 hostPatchProp(el, "class", null, newProps.class, namespace);
7165 }
7166 }
7167 if (patchFlag & 4) {
7168 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
7169 }
7170 if (patchFlag & 8) {
7171 const propsToUpdate = n2.dynamicProps;
7172 for (let i = 0; i < propsToUpdate.length; i++) {
7173 const key = propsToUpdate[i];
7174 const prev = oldProps[key];
7175 const next = newProps[key];
7176 if (next !== prev || key === "value") {
7177 hostPatchProp(el, key, prev, next, namespace, parentComponent);
7178 }
7179 }
7180 }
7181 }
7182 if (patchFlag & 1) {
7183 if (n1.children !== n2.children) {
7184 hostSetElementText(el, n2.children);
7185 }
7186 }
7187 } else if (!optimized && dynamicChildren == null) {
7188 patchProps(el, oldProps, newProps, parentComponent, namespace);
7189 }
7190 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
7191 queuePostRenderEffect(() => {
7192 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7193 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7194 }, parentSuspense);
7195 }
7196 };
7197 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
7198 for (let i = 0; i < newChildren.length; i++) {
7199 const oldVNode = oldChildren[i];
7200 const newVNode = newChildren[i];
7201 const container = (
7202 // oldVNode may be an errored async setup() component inside Suspense
7203 // which will not have a mounted element
7204 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
7205 // of the Fragment itself so it can move its children.
7206 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
7207 // which also requires the correct parent container
7208 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
7209 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
7210 // In other cases, the parent container is not actually used so we
7211 // just pass the block element here to avoid a DOM parentNode call.
7212 fallbackContainer
7213 )
7214 );
7215 patch(
7216 oldVNode,
7217 newVNode,
7218 container,
7219 null,
7220 parentComponent,
7221 parentSuspense,
7222 namespace,
7223 slotScopeIds,
7224 true
7225 );
7226 }
7227 };
7228 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
7229 if (oldProps !== newProps) {
7230 if (oldProps !== EMPTY_OBJ) {
7231 for (const key in oldProps) {
7232 if (!isReservedProp(key) && !(key in newProps)) {
7233 hostPatchProp(
7234 el,
7235 key,
7236 oldProps[key],
7237 null,
7238 namespace,
7239 parentComponent
7240 );
7241 }
7242 }
7243 }
7244 for (const key in newProps) {
7245 if (isReservedProp(key)) continue;
7246 const next = newProps[key];
7247 const prev = oldProps[key];
7248 if (next !== prev && key !== "value") {
7249 hostPatchProp(el, key, prev, next, namespace, parentComponent);
7250 }
7251 }
7252 if ("value" in newProps) {
7253 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
7254 }
7255 }
7256 };
7257 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7258 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
7259 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
7260 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
7261 if (
7262 // #5523 dev root fragment may inherit directives
7263 isHmrUpdating || patchFlag & 2048
7264 ) {
7265 patchFlag = 0;
7266 optimized = false;
7267 dynamicChildren = null;
7268 }
7269 if (fragmentSlotScopeIds) {
7270 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
7271 }
7272 if (n1 == null) {
7273 hostInsert(fragmentStartAnchor, container, anchor);
7274 hostInsert(fragmentEndAnchor, container, anchor);
7275 mountChildren(
7276 // #10007
7277 // such fragment like `<></>` will be compiled into
7278 // a fragment which doesn't have a children.
7279 // In this case fallback to an empty array
7280 n2.children || [],
7281 container,
7282 fragmentEndAnchor,
7283 parentComponent,
7284 parentSuspense,
7285 namespace,
7286 slotScopeIds,
7287 optimized
7288 );
7289 } else {
7290 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
7291 // of renderSlot() with no valid children
7292 n1.dynamicChildren) {
7293 patchBlockChildren(
7294 n1.dynamicChildren,
7295 dynamicChildren,
7296 container,
7297 parentComponent,
7298 parentSuspense,
7299 namespace,
7300 slotScopeIds
7301 );
7302 {
7303 traverseStaticChildren(n1, n2);
7304 }
7305 } else {
7306 patchChildren(
7307 n1,
7308 n2,
7309 container,
7310 fragmentEndAnchor,
7311 parentComponent,
7312 parentSuspense,
7313 namespace,
7314 slotScopeIds,
7315 optimized
7316 );
7317 }
7318 }
7319 };
7320 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7321 n2.slotScopeIds = slotScopeIds;
7322 if (n1 == null) {
7323 if (n2.shapeFlag & 512) {
7324 parentComponent.ctx.activate(
7325 n2,
7326 container,
7327 anchor,
7328 namespace,
7329 optimized
7330 );
7331 } else {
7332 mountComponent(
7333 n2,
7334 container,
7335 anchor,
7336 parentComponent,
7337 parentSuspense,
7338 namespace,
7339 optimized
7340 );
7341 }
7342 } else {
7343 updateComponent(n1, n2, optimized);
7344 }
7345 };
7346 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
7347 const instance = (initialVNode.component = createComponentInstance(
7348 initialVNode,
7349 parentComponent,
7350 parentSuspense
7351 ));
7352 if (instance.type.__hmrId) {
7353 registerHMR(instance);
7354 }
7355 {
7356 pushWarningContext(initialVNode);
7357 startMeasure(instance, `mount`);
7358 }
7359 if (isKeepAlive(initialVNode)) {
7360 instance.ctx.renderer = internals;
7361 }
7362 {
7363 {
7364 startMeasure(instance, `init`);
7365 }
7366 setupComponent(instance, false, optimized);
7367 {
7368 endMeasure(instance, `init`);
7369 }
7370 }
7371 if (instance.asyncDep) {
7372 if (isHmrUpdating) initialVNode.el = null;
7373 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
7374 if (!initialVNode.el) {
7375 const placeholder = instance.subTree = createVNode(Comment);
7376 processCommentNode(null, placeholder, container, anchor);
7377 }
7378 } else {
7379 setupRenderEffect(
7380 instance,
7381 initialVNode,
7382 container,
7383 anchor,
7384 parentSuspense,
7385 namespace,
7386 optimized
7387 );
7388 }
7389 {
7390 popWarningContext();
7391 endMeasure(instance, `mount`);
7392 }
7393 };
7394 const updateComponent = (n1, n2, optimized) => {
7395 const instance = n2.component = n1.component;
7396 if (shouldUpdateComponent(n1, n2, optimized)) {
7397 if (instance.asyncDep && !instance.asyncResolved) {
7398 {
7399 pushWarningContext(n2);
7400 }
7401 updateComponentPreRender(instance, n2, optimized);
7402 {
7403 popWarningContext();
7404 }
7405 return;
7406 } else {
7407 instance.next = n2;
7408 instance.update();
7409 }
7410 } else {
7411 n2.el = n1.el;
7412 instance.vnode = n2;
7413 }
7414 };
7415 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
7416 const componentUpdateFn = () => {
7417 if (!instance.isMounted) {
7418 let vnodeHook;
7419 const { el, props } = initialVNode;
7420 const { bm, m, parent, root, type } = instance;
7421 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
7422 toggleRecurse(instance, false);
7423 if (bm) {
7424 invokeArrayFns(bm);
7425 }
7426 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
7427 invokeVNodeHook(vnodeHook, parent, initialVNode);
7428 }
7429 toggleRecurse(instance, true);
7430 if (el && hydrateNode) {
7431 const hydrateSubTree = () => {
7432 {
7433 startMeasure(instance, `render`);
7434 }
7435 instance.subTree = renderComponentRoot(instance);
7436 {
7437 endMeasure(instance, `render`);
7438 }
7439 {
7440 startMeasure(instance, `hydrate`);
7441 }
7442 hydrateNode(
7443 el,
7444 instance.subTree,
7445 instance,
7446 parentSuspense,
7447 null
7448 );
7449 {
7450 endMeasure(instance, `hydrate`);
7451 }
7452 };
7453 if (isAsyncWrapperVNode && type.__asyncHydrate) {
7454 type.__asyncHydrate(
7455 el,
7456 instance,
7457 hydrateSubTree
7458 );
7459 } else {
7460 hydrateSubTree();
7461 }
7462 } else {
7463 if (root.ce) {
7464 root.ce._injectChildStyle(type);
7465 }
7466 {
7467 startMeasure(instance, `render`);
7468 }
7469 const subTree = instance.subTree = renderComponentRoot(instance);
7470 {
7471 endMeasure(instance, `render`);
7472 }
7473 {
7474 startMeasure(instance, `patch`);
7475 }
7476 patch(
7477 null,
7478 subTree,
7479 container,
7480 anchor,
7481 instance,
7482 parentSuspense,
7483 namespace
7484 );
7485 {
7486 endMeasure(instance, `patch`);
7487 }
7488 initialVNode.el = subTree.el;
7489 }
7490 if (m) {
7491 queuePostRenderEffect(m, parentSuspense);
7492 }
7493 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
7494 const scopedInitialVNode = initialVNode;
7495 queuePostRenderEffect(
7496 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
7497 parentSuspense
7498 );
7499 }
7500 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
7501 instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7502 }
7503 instance.isMounted = true;
7504 {
7505 devtoolsComponentAdded(instance);
7506 }
7507 initialVNode = container = anchor = null;
7508 } else {
7509 let { next, bu, u, parent, vnode } = instance;
7510 {
7511 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
7512 if (nonHydratedAsyncRoot) {
7513 if (next) {
7514 next.el = vnode.el;
7515 updateComponentPreRender(instance, next, optimized);
7516 }
7517 nonHydratedAsyncRoot.asyncDep.then(() => {
7518 if (!instance.isUnmounted) {
7519 componentUpdateFn();
7520 }
7521 });
7522 return;
7523 }
7524 }
7525 let originNext = next;
7526 let vnodeHook;
7527 {
7528 pushWarningContext(next || instance.vnode);
7529 }
7530 toggleRecurse(instance, false);
7531 if (next) {
7532 next.el = vnode.el;
7533 updateComponentPreRender(instance, next, optimized);
7534 } else {
7535 next = vnode;
7536 }
7537 if (bu) {
7538 invokeArrayFns(bu);
7539 }
7540 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
7541 invokeVNodeHook(vnodeHook, parent, next, vnode);
7542 }
7543 toggleRecurse(instance, true);
7544 {
7545 startMeasure(instance, `render`);
7546 }
7547 const nextTree = renderComponentRoot(instance);
7548 {
7549 endMeasure(instance, `render`);
7550 }
7551 const prevTree = instance.subTree;
7552 instance.subTree = nextTree;
7553 {
7554 startMeasure(instance, `patch`);
7555 }
7556 patch(
7557 prevTree,
7558 nextTree,
7559 // parent may have changed if it's in a teleport
7560 hostParentNode(prevTree.el),
7561 // anchor may have changed if it's in a fragment
7562 getNextHostNode(prevTree),
7563 instance,
7564 parentSuspense,
7565 namespace
7566 );
7567 {
7568 endMeasure(instance, `patch`);
7569 }
7570 next.el = nextTree.el;
7571 if (originNext === null) {
7572 updateHOCHostEl(instance, nextTree.el);
7573 }
7574 if (u) {
7575 queuePostRenderEffect(u, parentSuspense);
7576 }
7577 if (vnodeHook = next.props && next.props.onVnodeUpdated) {
7578 queuePostRenderEffect(
7579 () => invokeVNodeHook(vnodeHook, parent, next, vnode),
7580 parentSuspense
7581 );
7582 }
7583 {
7584 devtoolsComponentUpdated(instance);
7585 }
7586 {
7587 popWarningContext();
7588 }
7589 }
7590 };
7591 instance.scope.on();
7592 const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
7593 instance.scope.off();
7594 const update = instance.update = effect.run.bind(effect);
7595 const job = instance.job = effect.runIfDirty.bind(effect);
7596 job.i = instance;
7597 job.id = instance.uid;
7598 effect.scheduler = () => queueJob(job);
7599 toggleRecurse(instance, true);
7600 {
7601 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
7602 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
7603 }
7604 update();
7605 };
7606 const updateComponentPreRender = (instance, nextVNode, optimized) => {
7607 nextVNode.component = instance;
7608 const prevProps = instance.vnode.props;
7609 instance.vnode = nextVNode;
7610 instance.next = null;
7611 updateProps(instance, nextVNode.props, prevProps, optimized);
7612 updateSlots(instance, nextVNode.children, optimized);
7613 pauseTracking();
7614 flushPreFlushCbs(instance);
7615 resetTracking();
7616 };
7617 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
7618 const c1 = n1 && n1.children;
7619 const prevShapeFlag = n1 ? n1.shapeFlag : 0;
7620 const c2 = n2.children;
7621 const { patchFlag, shapeFlag } = n2;
7622 if (patchFlag > 0) {
7623 if (patchFlag & 128) {
7624 patchKeyedChildren(
7625 c1,
7626 c2,
7627 container,
7628 anchor,
7629 parentComponent,
7630 parentSuspense,
7631 namespace,
7632 slotScopeIds,
7633 optimized
7634 );
7635 return;
7636 } else if (patchFlag & 256) {
7637 patchUnkeyedChildren(
7638 c1,
7639 c2,
7640 container,
7641 anchor,
7642 parentComponent,
7643 parentSuspense,
7644 namespace,
7645 slotScopeIds,
7646 optimized
7647 );
7648 return;
7649 }
7650 }
7651 if (shapeFlag & 8) {
7652 if (prevShapeFlag & 16) {
7653 unmountChildren(c1, parentComponent, parentSuspense);
7654 }
7655 if (c2 !== c1) {
7656 hostSetElementText(container, c2);
7657 }
7658 } else {
7659 if (prevShapeFlag & 16) {
7660 if (shapeFlag & 16) {
7661 patchKeyedChildren(
7662 c1,
7663 c2,
7664 container,
7665 anchor,
7666 parentComponent,
7667 parentSuspense,
7668 namespace,
7669 slotScopeIds,
7670 optimized
7671 );
7672 } else {
7673 unmountChildren(c1, parentComponent, parentSuspense, true);
7674 }
7675 } else {
7676 if (prevShapeFlag & 8) {
7677 hostSetElementText(container, "");
7678 }
7679 if (shapeFlag & 16) {
7680 mountChildren(
7681 c2,
7682 container,
7683 anchor,
7684 parentComponent,
7685 parentSuspense,
7686 namespace,
7687 slotScopeIds,
7688 optimized
7689 );
7690 }
7691 }
7692 }
7693 };
7694 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7695 c1 = c1 || EMPTY_ARR;
7696 c2 = c2 || EMPTY_ARR;
7697 const oldLength = c1.length;
7698 const newLength = c2.length;
7699 const commonLength = Math.min(oldLength, newLength);
7700 let i;
7701 for (i = 0; i < commonLength; i++) {
7702 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7703 patch(
7704 c1[i],
7705 nextChild,
7706 container,
7707 null,
7708 parentComponent,
7709 parentSuspense,
7710 namespace,
7711 slotScopeIds,
7712 optimized
7713 );
7714 }
7715 if (oldLength > newLength) {
7716 unmountChildren(
7717 c1,
7718 parentComponent,
7719 parentSuspense,
7720 true,
7721 false,
7722 commonLength
7723 );
7724 } else {
7725 mountChildren(
7726 c2,
7727 container,
7728 anchor,
7729 parentComponent,
7730 parentSuspense,
7731 namespace,
7732 slotScopeIds,
7733 optimized,
7734 commonLength
7735 );
7736 }
7737 };
7738 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7739 let i = 0;
7740 const l2 = c2.length;
7741 let e1 = c1.length - 1;
7742 let e2 = l2 - 1;
7743 while (i <= e1 && i <= e2) {
7744 const n1 = c1[i];
7745 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7746 if (isSameVNodeType(n1, n2)) {
7747 patch(
7748 n1,
7749 n2,
7750 container,
7751 null,
7752 parentComponent,
7753 parentSuspense,
7754 namespace,
7755 slotScopeIds,
7756 optimized
7757 );
7758 } else {
7759 break;
7760 }
7761 i++;
7762 }
7763 while (i <= e1 && i <= e2) {
7764 const n1 = c1[e1];
7765 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
7766 if (isSameVNodeType(n1, n2)) {
7767 patch(
7768 n1,
7769 n2,
7770 container,
7771 null,
7772 parentComponent,
7773 parentSuspense,
7774 namespace,
7775 slotScopeIds,
7776 optimized
7777 );
7778 } else {
7779 break;
7780 }
7781 e1--;
7782 e2--;
7783 }
7784 if (i > e1) {
7785 if (i <= e2) {
7786 const nextPos = e2 + 1;
7787 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
7788 while (i <= e2) {
7789 patch(
7790 null,
7791 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
7792 container,
7793 anchor,
7794 parentComponent,
7795 parentSuspense,
7796 namespace,
7797 slotScopeIds,
7798 optimized
7799 );
7800 i++;
7801 }
7802 }
7803 } else if (i > e2) {
7804 while (i <= e1) {
7805 unmount(c1[i], parentComponent, parentSuspense, true);
7806 i++;
7807 }
7808 } else {
7809 const s1 = i;
7810 const s2 = i;
7811 const keyToNewIndexMap = /* @__PURE__ */ new Map();
7812 for (i = s2; i <= e2; i++) {
7813 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
7814 if (nextChild.key != null) {
7815 if (keyToNewIndexMap.has(nextChild.key)) {
7816 warn$1(
7817 `Duplicate keys found during update:`,
7818 JSON.stringify(nextChild.key),
7819 `Make sure keys are unique.`
7820 );
7821 }
7822 keyToNewIndexMap.set(nextChild.key, i);
7823 }
7824 }
7825 let j;
7826 let patched = 0;
7827 const toBePatched = e2 - s2 + 1;
7828 let moved = false;
7829 let maxNewIndexSoFar = 0;
7830 const newIndexToOldIndexMap = new Array(toBePatched);
7831 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
7832 for (i = s1; i <= e1; i++) {
7833 const prevChild = c1[i];
7834 if (patched >= toBePatched) {
7835 unmount(prevChild, parentComponent, parentSuspense, true);
7836 continue;
7837 }
7838 let newIndex;
7839 if (prevChild.key != null) {
7840 newIndex = keyToNewIndexMap.get(prevChild.key);
7841 } else {
7842 for (j = s2; j <= e2; j++) {
7843 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
7844 newIndex = j;
7845 break;
7846 }
7847 }
7848 }
7849 if (newIndex === void 0) {
7850 unmount(prevChild, parentComponent, parentSuspense, true);
7851 } else {
7852 newIndexToOldIndexMap[newIndex - s2] = i + 1;
7853 if (newIndex >= maxNewIndexSoFar) {
7854 maxNewIndexSoFar = newIndex;
7855 } else {
7856 moved = true;
7857 }
7858 patch(
7859 prevChild,
7860 c2[newIndex],
7861 container,
7862 null,
7863 parentComponent,
7864 parentSuspense,
7865 namespace,
7866 slotScopeIds,
7867 optimized
7868 );
7869 patched++;
7870 }
7871 }
7872 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
7873 j = increasingNewIndexSequence.length - 1;
7874 for (i = toBePatched - 1; i >= 0; i--) {
7875 const nextIndex = s2 + i;
7876 const nextChild = c2[nextIndex];
7877 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7878 if (newIndexToOldIndexMap[i] === 0) {
7879 patch(
7880 null,
7881 nextChild,
7882 container,
7883 anchor,
7884 parentComponent,
7885 parentSuspense,
7886 namespace,
7887 slotScopeIds,
7888 optimized
7889 );
7890 } else if (moved) {
7891 if (j < 0 || i !== increasingNewIndexSequence[j]) {
7892 move(nextChild, container, anchor, 2);
7893 } else {
7894 j--;
7895 }
7896 }
7897 }
7898 }
7899 };
7900 const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
7901 const { el, type, transition, children, shapeFlag } = vnode;
7902 if (shapeFlag & 6) {
7903 move(vnode.component.subTree, container, anchor, moveType);
7904 return;
7905 }
7906 if (shapeFlag & 128) {
7907 vnode.suspense.move(container, anchor, moveType);
7908 return;
7909 }
7910 if (shapeFlag & 64) {
7911 type.move(vnode, container, anchor, internals);
7912 return;
7913 }
7914 if (type === Fragment) {
7915 hostInsert(el, container, anchor);
7916 for (let i = 0; i < children.length; i++) {
7917 move(children[i], container, anchor, moveType);
7918 }
7919 hostInsert(vnode.anchor, container, anchor);
7920 return;
7921 }
7922 if (type === Static) {
7923 moveStaticNode(vnode, container, anchor);
7924 return;
7925 }
7926 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7927 if (needTransition2) {
7928 if (moveType === 0) {
7929 transition.beforeEnter(el);
7930 hostInsert(el, container, anchor);
7931 queuePostRenderEffect(() => transition.enter(el), parentSuspense);
7932 } else {
7933 const { leave, delayLeave, afterLeave } = transition;
7934 const remove2 = () => hostInsert(el, container, anchor);
7935 const performLeave = () => {
7936 leave(el, () => {
7937 remove2();
7938 afterLeave && afterLeave();
7939 });
7940 };
7941 if (delayLeave) {
7942 delayLeave(el, remove2, performLeave);
7943 } else {
7944 performLeave();
7945 }
7946 }
7947 } else {
7948 hostInsert(el, container, anchor);
7949 }
7950 };
7951 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
7952 const {
7953 type,
7954 props,
7955 ref,
7956 children,
7957 dynamicChildren,
7958 shapeFlag,
7959 patchFlag,
7960 dirs,
7961 cacheIndex
7962 } = vnode;
7963 if (patchFlag === -2) {
7964 optimized = false;
7965 }
7966 if (ref != null) {
7967 setRef(ref, null, parentSuspense, vnode, true);
7968 }
7969 if (cacheIndex != null) {
7970 parentComponent.renderCache[cacheIndex] = void 0;
7971 }
7972 if (shapeFlag & 256) {
7973 parentComponent.ctx.deactivate(vnode);
7974 return;
7975 }
7976 const shouldInvokeDirs = shapeFlag & 1 && dirs;
7977 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
7978 let vnodeHook;
7979 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
7980 invokeVNodeHook(vnodeHook, parentComponent, vnode);
7981 }
7982 if (shapeFlag & 6) {
7983 unmountComponent(vnode.component, parentSuspense, doRemove);
7984 } else {
7985 if (shapeFlag & 128) {
7986 vnode.suspense.unmount(parentSuspense, doRemove);
7987 return;
7988 }
7989 if (shouldInvokeDirs) {
7990 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
7991 }
7992 if (shapeFlag & 64) {
7993 vnode.type.remove(
7994 vnode,
7995 parentComponent,
7996 parentSuspense,
7997 internals,
7998 doRemove
7999 );
8000 } else if (dynamicChildren && // #5154
8001 // when v-once is used inside a block, setBlockTracking(-1) marks the
8002 // parent block with hasOnce: true
8003 // so that it doesn't take the fast path during unmount - otherwise
8004 // components nested in v-once are never unmounted.
8005 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
8006 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
8007 unmountChildren(
8008 dynamicChildren,
8009 parentComponent,
8010 parentSuspense,
8011 false,
8012 true
8013 );
8014 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
8015 unmountChildren(children, parentComponent, parentSuspense);
8016 }
8017 if (doRemove) {
8018 remove(vnode);
8019 }
8020 }
8021 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
8022 queuePostRenderEffect(() => {
8023 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8024 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8025 }, parentSuspense);
8026 }
8027 };
8028 const remove = (vnode) => {
8029 const { type, el, anchor, transition } = vnode;
8030 if (type === Fragment) {
8031 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
8032 vnode.children.forEach((child) => {
8033 if (child.type === Comment) {
8034 hostRemove(child.el);
8035 } else {
8036 remove(child);
8037 }
8038 });
8039 } else {
8040 removeFragment(el, anchor);
8041 }
8042 return;
8043 }
8044 if (type === Static) {
8045 removeStaticNode(vnode);
8046 return;
8047 }
8048 const performRemove = () => {
8049 hostRemove(el);
8050 if (transition && !transition.persisted && transition.afterLeave) {
8051 transition.afterLeave();
8052 }
8053 };
8054 if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8055 const { leave, delayLeave } = transition;
8056 const performLeave = () => leave(el, performRemove);
8057 if (delayLeave) {
8058 delayLeave(vnode.el, performRemove, performLeave);
8059 } else {
8060 performLeave();
8061 }
8062 } else {
8063 performRemove();
8064 }
8065 };
8066 const removeFragment = (cur, end) => {
8067 let next;
8068 while (cur !== end) {
8069 next = hostNextSibling(cur);
8070 hostRemove(cur);
8071 cur = next;
8072 }
8073 hostRemove(end);
8074 };
8075 const unmountComponent = (instance, parentSuspense, doRemove) => {
8076 if (instance.type.__hmrId) {
8077 unregisterHMR(instance);
8078 }
8079 const { bum, scope, job, subTree, um, m, a } = instance;
8080 invalidateMount(m);
8081 invalidateMount(a);
8082 if (bum) {
8083 invokeArrayFns(bum);
8084 }
8085 scope.stop();
8086 if (job) {
8087 job.flags |= 8;
8088 unmount(subTree, instance, parentSuspense, doRemove);
8089 }
8090 if (um) {
8091 queuePostRenderEffect(um, parentSuspense);
8092 }
8093 queuePostRenderEffect(() => {
8094 instance.isUnmounted = true;
8095 }, parentSuspense);
8096 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8097 parentSuspense.deps--;
8098 if (parentSuspense.deps === 0) {
8099 parentSuspense.resolve();
8100 }
8101 }
8102 {
8103 devtoolsComponentRemoved(instance);
8104 }
8105 };
8106 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8107 for (let i = start; i < children.length; i++) {
8108 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
8109 }
8110 };
8111 const getNextHostNode = (vnode) => {
8112 if (vnode.shapeFlag & 6) {
8113 return getNextHostNode(vnode.component.subTree);
8114 }
8115 if (vnode.shapeFlag & 128) {
8116 return vnode.suspense.next();
8117 }
8118 const el = hostNextSibling(vnode.anchor || vnode.el);
8119 const teleportEnd = el && el[TeleportEndKey];
8120 return teleportEnd ? hostNextSibling(teleportEnd) : el;
8121 };
8122 let isFlushing = false;
8123 const render = (vnode, container, namespace) => {
8124 if (vnode == null) {
8125 if (container._vnode) {
8126 unmount(container._vnode, null, null, true);
8127 }
8128 } else {
8129 patch(
8130 container._vnode || null,
8131 vnode,
8132 container,
8133 null,
8134 null,
8135 null,
8136 namespace
8137 );
8138 }
8139 container._vnode = vnode;
8140 if (!isFlushing) {
8141 isFlushing = true;
8142 flushPreFlushCbs();
8143 flushPostFlushCbs();
8144 isFlushing = false;
8145 }
8146 };
8147 const internals = {
8148 p: patch,
8149 um: unmount,
8150 m: move,
8151 r: remove,
8152 mt: mountComponent,
8153 mc: mountChildren,
8154 pc: patchChildren,
8155 pbc: patchBlockChildren,
8156 n: getNextHostNode,
8157 o: options
8158 };
8159 let hydrate;
8160 let hydrateNode;
8161 if (createHydrationFns) {
8162 [hydrate, hydrateNode] = createHydrationFns(
8163 internals
8164 );
8165 }
8166 return {
8167 render,
8168 hydrate,
8169 createApp: createAppAPI(render, hydrate)
8170 };
8171}
8172function resolveChildrenNamespace({ type, props }, currentNamespace) {
8173 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
8174}
8175function toggleRecurse({ effect, job }, allowed) {
8176 if (allowed) {
8177 effect.flags |= 32;
8178 job.flags |= 4;
8179 } else {
8180 effect.flags &= ~32;
8181 job.flags &= ~4;
8182 }
8183}
8184function needTransition(parentSuspense, transition) {
8185 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8186}
8187function traverseStaticChildren(n1, n2, shallow = false) {
8188 const ch1 = n1.children;
8189 const ch2 = n2.children;
8190 if (isArray(ch1) && isArray(ch2)) {
8191 for (let i = 0; i < ch1.length; i++) {
8192 const c1 = ch1[i];
8193 let c2 = ch2[i];
8194 if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
8195 if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
8196 c2 = ch2[i] = cloneIfMounted(ch2[i]);
8197 c2.el = c1.el;
8198 }
8199 if (!shallow && c2.patchFlag !== -2)
8200 traverseStaticChildren(c1, c2);
8201 }
8202 if (c2.type === Text) {
8203 c2.el = c1.el;
8204 }
8205 if (c2.type === Comment && !c2.el) {
8206 c2.el = c1.el;
8207 }
8208 }
8209 }
8210}
8211function getSequence(arr) {
8212 const p = arr.slice();
8213 const result = [0];
8214 let i, j, u, v, c;
8215 const len = arr.length;
8216 for (i = 0; i < len; i++) {
8217 const arrI = arr[i];
8218 if (arrI !== 0) {
8219 j = result[result.length - 1];
8220 if (arr[j] < arrI) {
8221 p[i] = j;
8222 result.push(i);
8223 continue;
8224 }
8225 u = 0;
8226 v = result.length - 1;
8227 while (u < v) {
8228 c = u + v >> 1;
8229 if (arr[result[c]] < arrI) {
8230 u = c + 1;
8231 } else {
8232 v = c;
8233 }
8234 }
8235 if (arrI < arr[result[u]]) {
8236 if (u > 0) {
8237 p[i] = result[u - 1];
8238 }
8239 result[u] = i;
8240 }
8241 }
8242 }
8243 u = result.length;
8244 v = result[u - 1];
8245 while (u-- > 0) {
8246 result[u] = v;
8247 v = p[v];
8248 }
8249 return result;
8250}
8251function locateNonHydratedAsyncRoot(instance) {
8252 const subComponent = instance.subTree.component;
8253 if (subComponent) {
8254 if (subComponent.asyncDep && !subComponent.asyncResolved) {
8255 return subComponent;
8256 } else {
8257 return locateNonHydratedAsyncRoot(subComponent);
8258 }
8259 }
8260}
8261function invalidateMount(hooks) {
8262 if (hooks) {
8263 for (let i = 0; i < hooks.length; i++)
8264 hooks[i].flags |= 8;
8265 }
8266}
8267
8268const ssrContextKey = Symbol.for("v-scx");
8269const useSSRContext = () => {
8270 {
8271 const ctx = inject(ssrContextKey);
8272 if (!ctx) {
8273 warn$1(
8274 `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
8275 );
8276 }
8277 return ctx;
8278 }
8279};
8280
8281function watchEffect(effect, options) {
8282 return doWatch(effect, null, options);
8283}
8284function watchPostEffect(effect, options) {
8285 return doWatch(
8286 effect,
8287 null,
8288 extend({}, options, { flush: "post" })
8289 );
8290}
8291function watchSyncEffect(effect, options) {
8292 return doWatch(
8293 effect,
8294 null,
8295 extend({}, options, { flush: "sync" })
8296 );
8297}
8298function watch(source, cb, options) {
8299 if (!isFunction(cb)) {
8300 warn$1(
8301 `\`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.`
8302 );
8303 }
8304 return doWatch(source, cb, options);
8305}
8306function doWatch(source, cb, options = EMPTY_OBJ) {
8307 const { immediate, deep, flush, once } = options;
8308 if (!cb) {
8309 if (immediate !== void 0) {
8310 warn$1(
8311 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
8312 );
8313 }
8314 if (deep !== void 0) {
8315 warn$1(
8316 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
8317 );
8318 }
8319 if (once !== void 0) {
8320 warn$1(
8321 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
8322 );
8323 }
8324 }
8325 const baseWatchOptions = extend({}, options);
8326 baseWatchOptions.onWarn = warn$1;
8327 const runsImmediately = cb && immediate || !cb && flush !== "post";
8328 let ssrCleanup;
8329 if (isInSSRComponentSetup) {
8330 if (flush === "sync") {
8331 const ctx = useSSRContext();
8332 ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
8333 } else if (!runsImmediately) {
8334 const watchStopHandle = () => {
8335 };
8336 watchStopHandle.stop = NOOP;
8337 watchStopHandle.resume = NOOP;
8338 watchStopHandle.pause = NOOP;
8339 return watchStopHandle;
8340 }
8341 }
8342 const instance = currentInstance;
8343 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
8344 let isPre = false;
8345 if (flush === "post") {
8346 baseWatchOptions.scheduler = (job) => {
8347 queuePostRenderEffect(job, instance && instance.suspense);
8348 };
8349 } else if (flush !== "sync") {
8350 isPre = true;
8351 baseWatchOptions.scheduler = (job, isFirstRun) => {
8352 if (isFirstRun) {
8353 job();
8354 } else {
8355 queueJob(job);
8356 }
8357 };
8358 }
8359 baseWatchOptions.augmentJob = (job) => {
8360 if (cb) {
8361 job.flags |= 4;
8362 }
8363 if (isPre) {
8364 job.flags |= 2;
8365 if (instance) {
8366 job.id = instance.uid;
8367 job.i = instance;
8368 }
8369 }
8370 };
8371 const watchHandle = watch$1(source, cb, baseWatchOptions);
8372 if (isInSSRComponentSetup) {
8373 if (ssrCleanup) {
8374 ssrCleanup.push(watchHandle);
8375 } else if (runsImmediately) {
8376 watchHandle();
8377 }
8378 }
8379 return watchHandle;
8380}
8381function instanceWatch(source, value, options) {
8382 const publicThis = this.proxy;
8383 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
8384 let cb;
8385 if (isFunction(value)) {
8386 cb = value;
8387 } else {
8388 cb = value.handler;
8389 options = value;
8390 }
8391 const reset = setCurrentInstance(this);
8392 const res = doWatch(getter, cb.bind(publicThis), options);
8393 reset();
8394 return res;
8395}
8396function createPathGetter(ctx, path) {
8397 const segments = path.split(".");
8398 return () => {
8399 let cur = ctx;
8400 for (let i = 0; i < segments.length && cur; i++) {
8401 cur = cur[segments[i]];
8402 }
8403 return cur;
8404 };
8405}
8406
8407function useModel(props, name, options = EMPTY_OBJ) {
8408 const i = getCurrentInstance();
8409 if (!i) {
8410 warn$1(`useModel() called without active instance.`);
8411 return ref();
8412 }
8413 const camelizedName = camelize(name);
8414 if (!i.propsOptions[0][camelizedName]) {
8415 warn$1(`useModel() called with prop "${name}" which is not declared.`);
8416 return ref();
8417 }
8418 const hyphenatedName = hyphenate(name);
8419 const modifiers = getModelModifiers(props, camelizedName);
8420 const res = customRef((track, trigger) => {
8421 let localValue;
8422 let prevSetValue = EMPTY_OBJ;
8423 let prevEmittedValue;
8424 watchSyncEffect(() => {
8425 const propValue = props[camelizedName];
8426 if (hasChanged(localValue, propValue)) {
8427 localValue = propValue;
8428 trigger();
8429 }
8430 });
8431 return {
8432 get() {
8433 track();
8434 return options.get ? options.get(localValue) : localValue;
8435 },
8436 set(value) {
8437 const emittedValue = options.set ? options.set(value) : value;
8438 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
8439 return;
8440 }
8441 const rawProps = i.vnode.props;
8442 if (!(rawProps && // check if parent has passed v-model
8443 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8444 localValue = value;
8445 trigger();
8446 }
8447 i.emit(`update:${name}`, emittedValue);
8448 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8449 trigger();
8450 }
8451 prevSetValue = value;
8452 prevEmittedValue = emittedValue;
8453 }
8454 };
8455 });
8456 res[Symbol.iterator] = () => {
8457 let i2 = 0;
8458 return {
8459 next() {
8460 if (i2 < 2) {
8461 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
8462 } else {
8463 return { done: true };
8464 }
8465 }
8466 };
8467 };
8468 return res;
8469}
8470const getModelModifiers = (props, modelName) => {
8471 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
8472};
8473
8474function emit(instance, event, ...rawArgs) {
8475 if (instance.isUnmounted) return;
8476 const props = instance.vnode.props || EMPTY_OBJ;
8477 {
8478 const {
8479 emitsOptions,
8480 propsOptions: [propsOptions]
8481 } = instance;
8482 if (emitsOptions) {
8483 if (!(event in emitsOptions) && true) {
8484 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
8485 warn$1(
8486 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
8487 );
8488 }
8489 } else {
8490 const validator = emitsOptions[event];
8491 if (isFunction(validator)) {
8492 const isValid = validator(...rawArgs);
8493 if (!isValid) {
8494 warn$1(
8495 `Invalid event arguments: event validation failed for event "${event}".`
8496 );
8497 }
8498 }
8499 }
8500 }
8501 }
8502 let args = rawArgs;
8503 const isModelListener = event.startsWith("update:");
8504 const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8505 if (modifiers) {
8506 if (modifiers.trim) {
8507 args = rawArgs.map((a) => isString(a) ? a.trim() : a);
8508 }
8509 if (modifiers.number) {
8510 args = rawArgs.map(looseToNumber);
8511 }
8512 }
8513 {
8514 devtoolsComponentEmit(instance, event, args);
8515 }
8516 {
8517 const lowerCaseEvent = event.toLowerCase();
8518 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
8519 warn$1(
8520 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
8521 instance,
8522 instance.type
8523 )} 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(
8524 event
8525 )}" instead of "${event}".`
8526 );
8527 }
8528 }
8529 let handlerName;
8530 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
8531 props[handlerName = toHandlerKey(camelize(event))];
8532 if (!handler && isModelListener) {
8533 handler = props[handlerName = toHandlerKey(hyphenate(event))];
8534 }
8535 if (handler) {
8536 callWithAsyncErrorHandling(
8537 handler,
8538 instance,
8539 6,
8540 args
8541 );
8542 }
8543 const onceHandler = props[handlerName + `Once`];
8544 if (onceHandler) {
8545 if (!instance.emitted) {
8546 instance.emitted = {};
8547 } else if (instance.emitted[handlerName]) {
8548 return;
8549 }
8550 instance.emitted[handlerName] = true;
8551 callWithAsyncErrorHandling(
8552 onceHandler,
8553 instance,
8554 6,
8555 args
8556 );
8557 }
8558}
8559function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8560 const cache = appContext.emitsCache;
8561 const cached = cache.get(comp);
8562 if (cached !== void 0) {
8563 return cached;
8564 }
8565 const raw = comp.emits;
8566 let normalized = {};
8567 let hasExtends = false;
8568 if (!isFunction(comp)) {
8569 const extendEmits = (raw2) => {
8570 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
8571 if (normalizedFromExtend) {
8572 hasExtends = true;
8573 extend(normalized, normalizedFromExtend);
8574 }
8575 };
8576 if (!asMixin && appContext.mixins.length) {
8577 appContext.mixins.forEach(extendEmits);
8578 }
8579 if (comp.extends) {
8580 extendEmits(comp.extends);
8581 }
8582 if (comp.mixins) {
8583 comp.mixins.forEach(extendEmits);
8584 }
8585 }
8586 if (!raw && !hasExtends) {
8587 if (isObject(comp)) {
8588 cache.set(comp, null);
8589 }
8590 return null;
8591 }
8592 if (isArray(raw)) {
8593 raw.forEach((key) => normalized[key] = null);
8594 } else {
8595 extend(normalized, raw);
8596 }
8597 if (isObject(comp)) {
8598 cache.set(comp, normalized);
8599 }
8600 return normalized;
8601}
8602function isEmitListener(options, key) {
8603 if (!options || !isOn(key)) {
8604 return false;
8605 }
8606 key = key.slice(2).replace(/Once$/, "");
8607 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
8608}
8609
8610let accessedAttrs = false;
8611function markAttrsAccessed() {
8612 accessedAttrs = true;
8613}
8614function renderComponentRoot(instance) {
8615 const {
8616 type: Component,
8617 vnode,
8618 proxy,
8619 withProxy,
8620 propsOptions: [propsOptions],
8621 slots,
8622 attrs,
8623 emit,
8624 render,
8625 renderCache,
8626 props,
8627 data,
8628 setupState,
8629 ctx,
8630 inheritAttrs
8631 } = instance;
8632 const prev = setCurrentRenderingInstance(instance);
8633 let result;
8634 let fallthroughAttrs;
8635 {
8636 accessedAttrs = false;
8637 }
8638 try {
8639 if (vnode.shapeFlag & 4) {
8640 const proxyToUse = withProxy || proxy;
8641 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
8642 get(target, key, receiver) {
8643 warn$1(
8644 `Property '${String(
8645 key
8646 )}' was accessed via 'this'. Avoid using 'this' in templates.`
8647 );
8648 return Reflect.get(target, key, receiver);
8649 }
8650 }) : proxyToUse;
8651 result = normalizeVNode(
8652 render.call(
8653 thisProxy,
8654 proxyToUse,
8655 renderCache,
8656 true ? shallowReadonly(props) : props,
8657 setupState,
8658 data,
8659 ctx
8660 )
8661 );
8662 fallthroughAttrs = attrs;
8663 } else {
8664 const render2 = Component;
8665 if (attrs === props) {
8666 markAttrsAccessed();
8667 }
8668 result = normalizeVNode(
8669 render2.length > 1 ? render2(
8670 true ? shallowReadonly(props) : props,
8671 true ? {
8672 get attrs() {
8673 markAttrsAccessed();
8674 return shallowReadonly(attrs);
8675 },
8676 slots,
8677 emit
8678 } : { attrs, slots, emit }
8679 ) : render2(
8680 true ? shallowReadonly(props) : props,
8681 null
8682 )
8683 );
8684 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
8685 }
8686 } catch (err) {
8687 blockStack.length = 0;
8688 handleError(err, instance, 1);
8689 result = createVNode(Comment);
8690 }
8691 let root = result;
8692 let setRoot = void 0;
8693 if (result.patchFlag > 0 && result.patchFlag & 2048) {
8694 [root, setRoot] = getChildRoot(result);
8695 }
8696 if (fallthroughAttrs && inheritAttrs !== false) {
8697 const keys = Object.keys(fallthroughAttrs);
8698 const { shapeFlag } = root;
8699 if (keys.length) {
8700 if (shapeFlag & (1 | 6)) {
8701 if (propsOptions && keys.some(isModelListener)) {
8702 fallthroughAttrs = filterModelListeners(
8703 fallthroughAttrs,
8704 propsOptions
8705 );
8706 }
8707 root = cloneVNode(root, fallthroughAttrs, false, true);
8708 } else if (!accessedAttrs && root.type !== Comment) {
8709 const allAttrs = Object.keys(attrs);
8710 const eventAttrs = [];
8711 const extraAttrs = [];
8712 for (let i = 0, l = allAttrs.length; i < l; i++) {
8713 const key = allAttrs[i];
8714 if (isOn(key)) {
8715 if (!isModelListener(key)) {
8716 eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8717 }
8718 } else {
8719 extraAttrs.push(key);
8720 }
8721 }
8722 if (extraAttrs.length) {
8723 warn$1(
8724 `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8725 );
8726 }
8727 if (eventAttrs.length) {
8728 warn$1(
8729 `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.`
8730 );
8731 }
8732 }
8733 }
8734 }
8735 if (vnode.dirs) {
8736 if (!isElementRoot(root)) {
8737 warn$1(
8738 `Runtime directive used on component with non-element root node. The directives will not function as intended.`
8739 );
8740 }
8741 root = cloneVNode(root, null, false, true);
8742 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8743 }
8744 if (vnode.transition) {
8745 if (!isElementRoot(root)) {
8746 warn$1(
8747 `Component inside <Transition> renders non-element root node that cannot be animated.`
8748 );
8749 }
8750 setTransitionHooks(root, vnode.transition);
8751 }
8752 if (setRoot) {
8753 setRoot(root);
8754 } else {
8755 result = root;
8756 }
8757 setCurrentRenderingInstance(prev);
8758 return result;
8759}
8760const getChildRoot = (vnode) => {
8761 const rawChildren = vnode.children;
8762 const dynamicChildren = vnode.dynamicChildren;
8763 const childRoot = filterSingleRoot(rawChildren, false);
8764 if (!childRoot) {
8765 return [vnode, void 0];
8766 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
8767 return getChildRoot(childRoot);
8768 }
8769 const index = rawChildren.indexOf(childRoot);
8770 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
8771 const setRoot = (updatedRoot) => {
8772 rawChildren[index] = updatedRoot;
8773 if (dynamicChildren) {
8774 if (dynamicIndex > -1) {
8775 dynamicChildren[dynamicIndex] = updatedRoot;
8776 } else if (updatedRoot.patchFlag > 0) {
8777 vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
8778 }
8779 }
8780 };
8781 return [normalizeVNode(childRoot), setRoot];
8782};
8783function filterSingleRoot(children, recurse = true) {
8784 let singleRoot;
8785 for (let i = 0; i < children.length; i++) {
8786 const child = children[i];
8787 if (isVNode(child)) {
8788 if (child.type !== Comment || child.children === "v-if") {
8789 if (singleRoot) {
8790 return;
8791 } else {
8792 singleRoot = child;
8793 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
8794 return filterSingleRoot(singleRoot.children);
8795 }
8796 }
8797 }
8798 } else {
8799 return;
8800 }
8801 }
8802 return singleRoot;
8803}
8804const getFunctionalFallthrough = (attrs) => {
8805 let res;
8806 for (const key in attrs) {
8807 if (key === "class" || key === "style" || isOn(key)) {
8808 (res || (res = {}))[key] = attrs[key];
8809 }
8810 }
8811 return res;
8812};
8813const filterModelListeners = (attrs, props) => {
8814 const res = {};
8815 for (const key in attrs) {
8816 if (!isModelListener(key) || !(key.slice(9) in props)) {
8817 res[key] = attrs[key];
8818 }
8819 }
8820 return res;
8821};
8822const isElementRoot = (vnode) => {
8823 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
8824};
8825function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
8826 const { props: prevProps, children: prevChildren, component } = prevVNode;
8827 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
8828 const emits = component.emitsOptions;
8829 if ((prevChildren || nextChildren) && isHmrUpdating) {
8830 return true;
8831 }
8832 if (nextVNode.dirs || nextVNode.transition) {
8833 return true;
8834 }
8835 if (optimized && patchFlag >= 0) {
8836 if (patchFlag & 1024) {
8837 return true;
8838 }
8839 if (patchFlag & 16) {
8840 if (!prevProps) {
8841 return !!nextProps;
8842 }
8843 return hasPropsChanged(prevProps, nextProps, emits);
8844 } else if (patchFlag & 8) {
8845 const dynamicProps = nextVNode.dynamicProps;
8846 for (let i = 0; i < dynamicProps.length; i++) {
8847 const key = dynamicProps[i];
8848 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8849 return true;
8850 }
8851 }
8852 }
8853 } else {
8854 if (prevChildren || nextChildren) {
8855 if (!nextChildren || !nextChildren.$stable) {
8856 return true;
8857 }
8858 }
8859 if (prevProps === nextProps) {
8860 return false;
8861 }
8862 if (!prevProps) {
8863 return !!nextProps;
8864 }
8865 if (!nextProps) {
8866 return true;
8867 }
8868 return hasPropsChanged(prevProps, nextProps, emits);
8869 }
8870 return false;
8871}
8872function hasPropsChanged(prevProps, nextProps, emitsOptions) {
8873 const nextKeys = Object.keys(nextProps);
8874 if (nextKeys.length !== Object.keys(prevProps).length) {
8875 return true;
8876 }
8877 for (let i = 0; i < nextKeys.length; i++) {
8878 const key = nextKeys[i];
8879 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8880 return true;
8881 }
8882 }
8883 return false;
8884}
8885function updateHOCHostEl({ vnode, parent }, el) {
8886 while (parent) {
8887 const root = parent.subTree;
8888 if (root.suspense && root.suspense.activeBranch === vnode) {
8889 root.el = vnode.el;
8890 }
8891 if (root === vnode) {
8892 (vnode = parent.vnode).el = el;
8893 parent = parent.parent;
8894 } else {
8895 break;
8896 }
8897 }
8898}
8899
8900const isSuspense = (type) => type.__isSuspense;
8901let suspenseId = 0;
8902const SuspenseImpl = {
8903 name: "Suspense",
8904 // In order to make Suspense tree-shakable, we need to avoid importing it
8905 // directly in the renderer. The renderer checks for the __isSuspense flag
8906 // on a vnode's type and calls the `process` method, passing in renderer
8907 // internals.
8908 __isSuspense: true,
8909 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
8910 if (n1 == null) {
8911 mountSuspense(
8912 n2,
8913 container,
8914 anchor,
8915 parentComponent,
8916 parentSuspense,
8917 namespace,
8918 slotScopeIds,
8919 optimized,
8920 rendererInternals
8921 );
8922 } else {
8923 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
8924 n2.suspense = n1.suspense;
8925 n2.suspense.vnode = n2;
8926 n2.el = n1.el;
8927 return;
8928 }
8929 patchSuspense(
8930 n1,
8931 n2,
8932 container,
8933 anchor,
8934 parentComponent,
8935 namespace,
8936 slotScopeIds,
8937 optimized,
8938 rendererInternals
8939 );
8940 }
8941 },
8942 hydrate: hydrateSuspense,
8943 normalize: normalizeSuspenseChildren
8944};
8945const Suspense = SuspenseImpl ;
8946function triggerEvent(vnode, name) {
8947 const eventListener = vnode.props && vnode.props[name];
8948 if (isFunction(eventListener)) {
8949 eventListener();
8950 }
8951}
8952function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
8953 const {
8954 p: patch,
8955 o: { createElement }
8956 } = rendererInternals;
8957 const hiddenContainer = createElement("div");
8958 const suspense = vnode.suspense = createSuspenseBoundary(
8959 vnode,
8960 parentSuspense,
8961 parentComponent,
8962 container,
8963 hiddenContainer,
8964 anchor,
8965 namespace,
8966 slotScopeIds,
8967 optimized,
8968 rendererInternals
8969 );
8970 patch(
8971 null,
8972 suspense.pendingBranch = vnode.ssContent,
8973 hiddenContainer,
8974 null,
8975 parentComponent,
8976 suspense,
8977 namespace,
8978 slotScopeIds
8979 );
8980 if (suspense.deps > 0) {
8981 triggerEvent(vnode, "onPending");
8982 triggerEvent(vnode, "onFallback");
8983 patch(
8984 null,
8985 vnode.ssFallback,
8986 container,
8987 anchor,
8988 parentComponent,
8989 null,
8990 // fallback tree will not have suspense context
8991 namespace,
8992 slotScopeIds
8993 );
8994 setActiveBranch(suspense, vnode.ssFallback);
8995 } else {
8996 suspense.resolve(false, true);
8997 }
8998}
8999function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
9000 const suspense = n2.suspense = n1.suspense;
9001 suspense.vnode = n2;
9002 n2.el = n1.el;
9003 const newBranch = n2.ssContent;
9004 const newFallback = n2.ssFallback;
9005 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
9006 if (pendingBranch) {
9007 suspense.pendingBranch = newBranch;
9008 if (isSameVNodeType(newBranch, pendingBranch)) {
9009 patch(
9010 pendingBranch,
9011 newBranch,
9012 suspense.hiddenContainer,
9013 null,
9014 parentComponent,
9015 suspense,
9016 namespace,
9017 slotScopeIds,
9018 optimized
9019 );
9020 if (suspense.deps <= 0) {
9021 suspense.resolve();
9022 } else if (isInFallback) {
9023 if (!isHydrating) {
9024 patch(
9025 activeBranch,
9026 newFallback,
9027 container,
9028 anchor,
9029 parentComponent,
9030 null,
9031 // fallback tree will not have suspense context
9032 namespace,
9033 slotScopeIds,
9034 optimized
9035 );
9036 setActiveBranch(suspense, newFallback);
9037 }
9038 }
9039 } else {
9040 suspense.pendingId = suspenseId++;
9041 if (isHydrating) {
9042 suspense.isHydrating = false;
9043 suspense.activeBranch = pendingBranch;
9044 } else {
9045 unmount(pendingBranch, parentComponent, suspense);
9046 }
9047 suspense.deps = 0;
9048 suspense.effects.length = 0;
9049 suspense.hiddenContainer = createElement("div");
9050 if (isInFallback) {
9051 patch(
9052 null,
9053 newBranch,
9054 suspense.hiddenContainer,
9055 null,
9056 parentComponent,
9057 suspense,
9058 namespace,
9059 slotScopeIds,
9060 optimized
9061 );
9062 if (suspense.deps <= 0) {
9063 suspense.resolve();
9064 } else {
9065 patch(
9066 activeBranch,
9067 newFallback,
9068 container,
9069 anchor,
9070 parentComponent,
9071 null,
9072 // fallback tree will not have suspense context
9073 namespace,
9074 slotScopeIds,
9075 optimized
9076 );
9077 setActiveBranch(suspense, newFallback);
9078 }
9079 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9080 patch(
9081 activeBranch,
9082 newBranch,
9083 container,
9084 anchor,
9085 parentComponent,
9086 suspense,
9087 namespace,
9088 slotScopeIds,
9089 optimized
9090 );
9091 suspense.resolve(true);
9092 } else {
9093 patch(
9094 null,
9095 newBranch,
9096 suspense.hiddenContainer,
9097 null,
9098 parentComponent,
9099 suspense,
9100 namespace,
9101 slotScopeIds,
9102 optimized
9103 );
9104 if (suspense.deps <= 0) {
9105 suspense.resolve();
9106 }
9107 }
9108 }
9109 } else {
9110 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9111 patch(
9112 activeBranch,
9113 newBranch,
9114 container,
9115 anchor,
9116 parentComponent,
9117 suspense,
9118 namespace,
9119 slotScopeIds,
9120 optimized
9121 );
9122 setActiveBranch(suspense, newBranch);
9123 } else {
9124 triggerEvent(n2, "onPending");
9125 suspense.pendingBranch = newBranch;
9126 if (newBranch.shapeFlag & 512) {
9127 suspense.pendingId = newBranch.component.suspenseId;
9128 } else {
9129 suspense.pendingId = suspenseId++;
9130 }
9131 patch(
9132 null,
9133 newBranch,
9134 suspense.hiddenContainer,
9135 null,
9136 parentComponent,
9137 suspense,
9138 namespace,
9139 slotScopeIds,
9140 optimized
9141 );
9142 if (suspense.deps <= 0) {
9143 suspense.resolve();
9144 } else {
9145 const { timeout, pendingId } = suspense;
9146 if (timeout > 0) {
9147 setTimeout(() => {
9148 if (suspense.pendingId === pendingId) {
9149 suspense.fallback(newFallback);
9150 }
9151 }, timeout);
9152 } else if (timeout === 0) {
9153 suspense.fallback(newFallback);
9154 }
9155 }
9156 }
9157 }
9158}
9159let hasWarned = false;
9160function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
9161 if (!hasWarned) {
9162 hasWarned = true;
9163 console[console.info ? "info" : "log"](
9164 `<Suspense> is an experimental feature and its API will likely change.`
9165 );
9166 }
9167 const {
9168 p: patch,
9169 m: move,
9170 um: unmount,
9171 n: next,
9172 o: { parentNode, remove }
9173 } = rendererInternals;
9174 let parentSuspenseId;
9175 const isSuspensible = isVNodeSuspensible(vnode);
9176 if (isSuspensible) {
9177 if (parentSuspense && parentSuspense.pendingBranch) {
9178 parentSuspenseId = parentSuspense.pendingId;
9179 parentSuspense.deps++;
9180 }
9181 }
9182 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
9183 {
9184 assertNumber(timeout, `Suspense timeout`);
9185 }
9186 const initialAnchor = anchor;
9187 const suspense = {
9188 vnode,
9189 parent: parentSuspense,
9190 parentComponent,
9191 namespace,
9192 container,
9193 hiddenContainer,
9194 deps: 0,
9195 pendingId: suspenseId++,
9196 timeout: typeof timeout === "number" ? timeout : -1,
9197 activeBranch: null,
9198 pendingBranch: null,
9199 isInFallback: !isHydrating,
9200 isHydrating,
9201 isUnmounted: false,
9202 effects: [],
9203 resolve(resume = false, sync = false) {
9204 {
9205 if (!resume && !suspense.pendingBranch) {
9206 throw new Error(
9207 `suspense.resolve() is called without a pending branch.`
9208 );
9209 }
9210 if (suspense.isUnmounted) {
9211 throw new Error(
9212 `suspense.resolve() is called on an already unmounted suspense boundary.`
9213 );
9214 }
9215 }
9216 const {
9217 vnode: vnode2,
9218 activeBranch,
9219 pendingBranch,
9220 pendingId,
9221 effects,
9222 parentComponent: parentComponent2,
9223 container: container2
9224 } = suspense;
9225 let delayEnter = false;
9226 if (suspense.isHydrating) {
9227 suspense.isHydrating = false;
9228 } else if (!resume) {
9229 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
9230 if (delayEnter) {
9231 activeBranch.transition.afterLeave = () => {
9232 if (pendingId === suspense.pendingId) {
9233 move(
9234 pendingBranch,
9235 container2,
9236 anchor === initialAnchor ? next(activeBranch) : anchor,
9237 0
9238 );
9239 queuePostFlushCb(effects);
9240 }
9241 };
9242 }
9243 if (activeBranch) {
9244 if (parentNode(activeBranch.el) === container2) {
9245 anchor = next(activeBranch);
9246 }
9247 unmount(activeBranch, parentComponent2, suspense, true);
9248 }
9249 if (!delayEnter) {
9250 move(pendingBranch, container2, anchor, 0);
9251 }
9252 }
9253 setActiveBranch(suspense, pendingBranch);
9254 suspense.pendingBranch = null;
9255 suspense.isInFallback = false;
9256 let parent = suspense.parent;
9257 let hasUnresolvedAncestor = false;
9258 while (parent) {
9259 if (parent.pendingBranch) {
9260 parent.effects.push(...effects);
9261 hasUnresolvedAncestor = true;
9262 break;
9263 }
9264 parent = parent.parent;
9265 }
9266 if (!hasUnresolvedAncestor && !delayEnter) {
9267 queuePostFlushCb(effects);
9268 }
9269 suspense.effects = [];
9270 if (isSuspensible) {
9271 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
9272 parentSuspense.deps--;
9273 if (parentSuspense.deps === 0 && !sync) {
9274 parentSuspense.resolve();
9275 }
9276 }
9277 }
9278 triggerEvent(vnode2, "onResolve");
9279 },
9280 fallback(fallbackVNode) {
9281 if (!suspense.pendingBranch) {
9282 return;
9283 }
9284 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
9285 triggerEvent(vnode2, "onFallback");
9286 const anchor2 = next(activeBranch);
9287 const mountFallback = () => {
9288 if (!suspense.isInFallback) {
9289 return;
9290 }
9291 patch(
9292 null,
9293 fallbackVNode,
9294 container2,
9295 anchor2,
9296 parentComponent2,
9297 null,
9298 // fallback tree will not have suspense context
9299 namespace2,
9300 slotScopeIds,
9301 optimized
9302 );
9303 setActiveBranch(suspense, fallbackVNode);
9304 };
9305 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
9306 if (delayEnter) {
9307 activeBranch.transition.afterLeave = mountFallback;
9308 }
9309 suspense.isInFallback = true;
9310 unmount(
9311 activeBranch,
9312 parentComponent2,
9313 null,
9314 // no suspense so unmount hooks fire now
9315 true
9316 // shouldRemove
9317 );
9318 if (!delayEnter) {
9319 mountFallback();
9320 }
9321 },
9322 move(container2, anchor2, type) {
9323 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
9324 suspense.container = container2;
9325 },
9326 next() {
9327 return suspense.activeBranch && next(suspense.activeBranch);
9328 },
9329 registerDep(instance, setupRenderEffect, optimized2) {
9330 const isInPendingSuspense = !!suspense.pendingBranch;
9331 if (isInPendingSuspense) {
9332 suspense.deps++;
9333 }
9334 const hydratedEl = instance.vnode.el;
9335 instance.asyncDep.catch((err) => {
9336 handleError(err, instance, 0);
9337 }).then((asyncSetupResult) => {
9338 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
9339 return;
9340 }
9341 instance.asyncResolved = true;
9342 const { vnode: vnode2 } = instance;
9343 {
9344 pushWarningContext(vnode2);
9345 }
9346 handleSetupResult(instance, asyncSetupResult, false);
9347 if (hydratedEl) {
9348 vnode2.el = hydratedEl;
9349 }
9350 const placeholder = !hydratedEl && instance.subTree.el;
9351 setupRenderEffect(
9352 instance,
9353 vnode2,
9354 // component may have been moved before resolve.
9355 // if this is not a hydration, instance.subTree will be the comment
9356 // placeholder.
9357 parentNode(hydratedEl || instance.subTree.el),
9358 // anchor will not be used if this is hydration, so only need to
9359 // consider the comment placeholder case.
9360 hydratedEl ? null : next(instance.subTree),
9361 suspense,
9362 namespace,
9363 optimized2
9364 );
9365 if (placeholder) {
9366 remove(placeholder);
9367 }
9368 updateHOCHostEl(instance, vnode2.el);
9369 {
9370 popWarningContext();
9371 }
9372 if (isInPendingSuspense && --suspense.deps === 0) {
9373 suspense.resolve();
9374 }
9375 });
9376 },
9377 unmount(parentSuspense2, doRemove) {
9378 suspense.isUnmounted = true;
9379 if (suspense.activeBranch) {
9380 unmount(
9381 suspense.activeBranch,
9382 parentComponent,
9383 parentSuspense2,
9384 doRemove
9385 );
9386 }
9387 if (suspense.pendingBranch) {
9388 unmount(
9389 suspense.pendingBranch,
9390 parentComponent,
9391 parentSuspense2,
9392 doRemove
9393 );
9394 }
9395 }
9396 };
9397 return suspense;
9398}
9399function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
9400 const suspense = vnode.suspense = createSuspenseBoundary(
9401 vnode,
9402 parentSuspense,
9403 parentComponent,
9404 node.parentNode,
9405 // eslint-disable-next-line no-restricted-globals
9406 document.createElement("div"),
9407 null,
9408 namespace,
9409 slotScopeIds,
9410 optimized,
9411 rendererInternals,
9412 true
9413 );
9414 const result = hydrateNode(
9415 node,
9416 suspense.pendingBranch = vnode.ssContent,
9417 parentComponent,
9418 suspense,
9419 slotScopeIds,
9420 optimized
9421 );
9422 if (suspense.deps === 0) {
9423 suspense.resolve(false, true);
9424 }
9425 return result;
9426}
9427function normalizeSuspenseChildren(vnode) {
9428 const { shapeFlag, children } = vnode;
9429 const isSlotChildren = shapeFlag & 32;
9430 vnode.ssContent = normalizeSuspenseSlot(
9431 isSlotChildren ? children.default : children
9432 );
9433 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
9434}
9435function normalizeSuspenseSlot(s) {
9436 let block;
9437 if (isFunction(s)) {
9438 const trackBlock = isBlockTreeEnabled && s._c;
9439 if (trackBlock) {
9440 s._d = false;
9441 openBlock();
9442 }
9443 s = s();
9444 if (trackBlock) {
9445 s._d = true;
9446 block = currentBlock;
9447 closeBlock();
9448 }
9449 }
9450 if (isArray(s)) {
9451 const singleChild = filterSingleRoot(s);
9452 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
9453 warn$1(`<Suspense> slots expect a single root node.`);
9454 }
9455 s = singleChild;
9456 }
9457 s = normalizeVNode(s);
9458 if (block && !s.dynamicChildren) {
9459 s.dynamicChildren = block.filter((c) => c !== s);
9460 }
9461 return s;
9462}
9463function queueEffectWithSuspense(fn, suspense) {
9464 if (suspense && suspense.pendingBranch) {
9465 if (isArray(fn)) {
9466 suspense.effects.push(...fn);
9467 } else {
9468 suspense.effects.push(fn);
9469 }
9470 } else {
9471 queuePostFlushCb(fn);
9472 }
9473}
9474function setActiveBranch(suspense, branch) {
9475 suspense.activeBranch = branch;
9476 const { vnode, parentComponent } = suspense;
9477 let el = branch.el;
9478 while (!el && branch.component) {
9479 branch = branch.component.subTree;
9480 el = branch.el;
9481 }
9482 vnode.el = el;
9483 if (parentComponent && parentComponent.subTree === vnode) {
9484 parentComponent.vnode.el = el;
9485 updateHOCHostEl(parentComponent, el);
9486 }
9487}
9488function isVNodeSuspensible(vnode) {
9489 const suspensible = vnode.props && vnode.props.suspensible;
9490 return suspensible != null && suspensible !== false;
9491}
9492
9493const Fragment = Symbol.for("v-fgt");
9494const Text = Symbol.for("v-txt");
9495const Comment = Symbol.for("v-cmt");
9496const Static = Symbol.for("v-stc");
9497const blockStack = [];
9498let currentBlock = null;
9499function openBlock(disableTracking = false) {
9500 blockStack.push(currentBlock = disableTracking ? null : []);
9501}
9502function closeBlock() {
9503 blockStack.pop();
9504 currentBlock = blockStack[blockStack.length - 1] || null;
9505}
9506let isBlockTreeEnabled = 1;
9507function setBlockTracking(value, inVOnce = false) {
9508 isBlockTreeEnabled += value;
9509 if (value < 0 && currentBlock && inVOnce) {
9510 currentBlock.hasOnce = true;
9511 }
9512}
9513function setupBlock(vnode) {
9514 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
9515 closeBlock();
9516 if (isBlockTreeEnabled > 0 && currentBlock) {
9517 currentBlock.push(vnode);
9518 }
9519 return vnode;
9520}
9521function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
9522 return setupBlock(
9523 createBaseVNode(
9524 type,
9525 props,
9526 children,
9527 patchFlag,
9528 dynamicProps,
9529 shapeFlag,
9530 true
9531 )
9532 );
9533}
9534function createBlock(type, props, children, patchFlag, dynamicProps) {
9535 return setupBlock(
9536 createVNode(
9537 type,
9538 props,
9539 children,
9540 patchFlag,
9541 dynamicProps,
9542 true
9543 )
9544 );
9545}
9546function isVNode(value) {
9547 return value ? value.__v_isVNode === true : false;
9548}
9549function isSameVNodeType(n1, n2) {
9550 if (n2.shapeFlag & 6 && n1.component) {
9551 const dirtyInstances = hmrDirtyComponents.get(n2.type);
9552 if (dirtyInstances && dirtyInstances.has(n1.component)) {
9553 n1.shapeFlag &= ~256;
9554 n2.shapeFlag &= ~512;
9555 return false;
9556 }
9557 }
9558 return n1.type === n2.type && n1.key === n2.key;
9559}
9560let vnodeArgsTransformer;
9561function transformVNodeArgs(transformer) {
9562 vnodeArgsTransformer = transformer;
9563}
9564const createVNodeWithArgsTransform = (...args) => {
9565 return _createVNode(
9566 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
9567 );
9568};
9569const normalizeKey = ({ key }) => key != null ? key : null;
9570const normalizeRef = ({
9571 ref,
9572 ref_key,
9573 ref_for
9574}) => {
9575 if (typeof ref === "number") {
9576 ref = "" + ref;
9577 }
9578 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
9579};
9580function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
9581 const vnode = {
9582 __v_isVNode: true,
9583 __v_skip: true,
9584 type,
9585 props,
9586 key: props && normalizeKey(props),
9587 ref: props && normalizeRef(props),
9588 scopeId: currentScopeId,
9589 slotScopeIds: null,
9590 children,
9591 component: null,
9592 suspense: null,
9593 ssContent: null,
9594 ssFallback: null,
9595 dirs: null,
9596 transition: null,
9597 el: null,
9598 anchor: null,
9599 target: null,
9600 targetStart: null,
9601 targetAnchor: null,
9602 staticCount: 0,
9603 shapeFlag,
9604 patchFlag,
9605 dynamicProps,
9606 dynamicChildren: null,
9607 appContext: null,
9608 ctx: currentRenderingInstance
9609 };
9610 if (needFullChildrenNormalization) {
9611 normalizeChildren(vnode, children);
9612 if (shapeFlag & 128) {
9613 type.normalize(vnode);
9614 }
9615 } else if (children) {
9616 vnode.shapeFlag |= isString(children) ? 8 : 16;
9617 }
9618 if (vnode.key !== vnode.key) {
9619 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9620 }
9621 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
9622 !isBlockNode && // has current parent block
9623 currentBlock && // presence of a patch flag indicates this node needs patching on updates.
9624 // component nodes also should always be patched, because even if the
9625 // component doesn't need to update, it needs to persist the instance on to
9626 // the next vnode so that it can be properly unmounted later.
9627 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
9628 // vnode should not be considered dynamic due to handler caching.
9629 vnode.patchFlag !== 32) {
9630 currentBlock.push(vnode);
9631 }
9632 return vnode;
9633}
9634const createVNode = createVNodeWithArgsTransform ;
9635function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9636 if (!type || type === NULL_DYNAMIC_COMPONENT) {
9637 if (!type) {
9638 warn$1(`Invalid vnode type when creating vnode: ${type}.`);
9639 }
9640 type = Comment;
9641 }
9642 if (isVNode(type)) {
9643 const cloned = cloneVNode(
9644 type,
9645 props,
9646 true
9647 /* mergeRef: true */
9648 );
9649 if (children) {
9650 normalizeChildren(cloned, children);
9651 }
9652 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
9653 if (cloned.shapeFlag & 6) {
9654 currentBlock[currentBlock.indexOf(type)] = cloned;
9655 } else {
9656 currentBlock.push(cloned);
9657 }
9658 }
9659 cloned.patchFlag = -2;
9660 return cloned;
9661 }
9662 if (isClassComponent(type)) {
9663 type = type.__vccOpts;
9664 }
9665 if (props) {
9666 props = guardReactiveProps(props);
9667 let { class: klass, style } = props;
9668 if (klass && !isString(klass)) {
9669 props.class = normalizeClass(klass);
9670 }
9671 if (isObject(style)) {
9672 if (isProxy(style) && !isArray(style)) {
9673 style = extend({}, style);
9674 }
9675 props.style = normalizeStyle(style);
9676 }
9677 }
9678 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
9679 if (shapeFlag & 4 && isProxy(type)) {
9680 type = toRaw(type);
9681 warn$1(
9682 `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\`.`,
9683 `
9684Component that was made reactive: `,
9685 type
9686 );
9687 }
9688 return createBaseVNode(
9689 type,
9690 props,
9691 children,
9692 patchFlag,
9693 dynamicProps,
9694 shapeFlag,
9695 isBlockNode,
9696 true
9697 );
9698}
9699function guardReactiveProps(props) {
9700 if (!props) return null;
9701 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
9702}
9703function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
9704 const { props, ref, patchFlag, children, transition } = vnode;
9705 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
9706 const cloned = {
9707 __v_isVNode: true,
9708 __v_skip: true,
9709 type: vnode.type,
9710 props: mergedProps,
9711 key: mergedProps && normalizeKey(mergedProps),
9712 ref: extraProps && extraProps.ref ? (
9713 // #2078 in the case of <component :is="vnode" ref="extra"/>
9714 // if the vnode itself already has a ref, cloneVNode will need to merge
9715 // the refs so the single vnode can be set on multiple refs
9716 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
9717 ) : ref,
9718 scopeId: vnode.scopeId,
9719 slotScopeIds: vnode.slotScopeIds,
9720 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
9721 target: vnode.target,
9722 targetStart: vnode.targetStart,
9723 targetAnchor: vnode.targetAnchor,
9724 staticCount: vnode.staticCount,
9725 shapeFlag: vnode.shapeFlag,
9726 // if the vnode is cloned with extra props, we can no longer assume its
9727 // existing patch flag to be reliable and need to add the FULL_PROPS flag.
9728 // note: preserve flag for fragments since they use the flag for children
9729 // fast paths only.
9730 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
9731 dynamicProps: vnode.dynamicProps,
9732 dynamicChildren: vnode.dynamicChildren,
9733 appContext: vnode.appContext,
9734 dirs: vnode.dirs,
9735 transition,
9736 // These should technically only be non-null on mounted VNodes. However,
9737 // they *should* be copied for kept-alive vnodes. So we just always copy
9738 // them since them being non-null during a mount doesn't affect the logic as
9739 // they will simply be overwritten.
9740 component: vnode.component,
9741 suspense: vnode.suspense,
9742 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9743 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9744 el: vnode.el,
9745 anchor: vnode.anchor,
9746 ctx: vnode.ctx,
9747 ce: vnode.ce
9748 };
9749 if (transition && cloneTransition) {
9750 setTransitionHooks(
9751 cloned,
9752 transition.clone(cloned)
9753 );
9754 }
9755 return cloned;
9756}
9757function deepCloneVNode(vnode) {
9758 const cloned = cloneVNode(vnode);
9759 if (isArray(vnode.children)) {
9760 cloned.children = vnode.children.map(deepCloneVNode);
9761 }
9762 return cloned;
9763}
9764function createTextVNode(text = " ", flag = 0) {
9765 return createVNode(Text, null, text, flag);
9766}
9767function createStaticVNode(content, numberOfNodes) {
9768 const vnode = createVNode(Static, null, content);
9769 vnode.staticCount = numberOfNodes;
9770 return vnode;
9771}
9772function createCommentVNode(text = "", asBlock = false) {
9773 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
9774}
9775function normalizeVNode(child) {
9776 if (child == null || typeof child === "boolean") {
9777 return createVNode(Comment);
9778 } else if (isArray(child)) {
9779 return createVNode(
9780 Fragment,
9781 null,
9782 // #3666, avoid reference pollution when reusing vnode
9783 child.slice()
9784 );
9785 } else if (isVNode(child)) {
9786 return cloneIfMounted(child);
9787 } else {
9788 return createVNode(Text, null, String(child));
9789 }
9790}
9791function cloneIfMounted(child) {
9792 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
9793}
9794function normalizeChildren(vnode, children) {
9795 let type = 0;
9796 const { shapeFlag } = vnode;
9797 if (children == null) {
9798 children = null;
9799 } else if (isArray(children)) {
9800 type = 16;
9801 } else if (typeof children === "object") {
9802 if (shapeFlag & (1 | 64)) {
9803 const slot = children.default;
9804 if (slot) {
9805 slot._c && (slot._d = false);
9806 normalizeChildren(vnode, slot());
9807 slot._c && (slot._d = true);
9808 }
9809 return;
9810 } else {
9811 type = 32;
9812 const slotFlag = children._;
9813 if (!slotFlag && !isInternalObject(children)) {
9814 children._ctx = currentRenderingInstance;
9815 } else if (slotFlag === 3 && currentRenderingInstance) {
9816 if (currentRenderingInstance.slots._ === 1) {
9817 children._ = 1;
9818 } else {
9819 children._ = 2;
9820 vnode.patchFlag |= 1024;
9821 }
9822 }
9823 }
9824 } else if (isFunction(children)) {
9825 children = { default: children, _ctx: currentRenderingInstance };
9826 type = 32;
9827 } else {
9828 children = String(children);
9829 if (shapeFlag & 64) {
9830 type = 16;
9831 children = [createTextVNode(children)];
9832 } else {
9833 type = 8;
9834 }
9835 }
9836 vnode.children = children;
9837 vnode.shapeFlag |= type;
9838}
9839function mergeProps(...args) {
9840 const ret = {};
9841 for (let i = 0; i < args.length; i++) {
9842 const toMerge = args[i];
9843 for (const key in toMerge) {
9844 if (key === "class") {
9845 if (ret.class !== toMerge.class) {
9846 ret.class = normalizeClass([ret.class, toMerge.class]);
9847 }
9848 } else if (key === "style") {
9849 ret.style = normalizeStyle([ret.style, toMerge.style]);
9850 } else if (isOn(key)) {
9851 const existing = ret[key];
9852 const incoming = toMerge[key];
9853 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
9854 ret[key] = existing ? [].concat(existing, incoming) : incoming;
9855 }
9856 } else if (key !== "") {
9857 ret[key] = toMerge[key];
9858 }
9859 }
9860 }
9861 return ret;
9862}
9863function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
9864 callWithAsyncErrorHandling(hook, instance, 7, [
9865 vnode,
9866 prevVNode
9867 ]);
9868}
9869
9870const emptyAppContext = createAppContext();
9871let uid = 0;
9872function createComponentInstance(vnode, parent, suspense) {
9873 const type = vnode.type;
9874 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
9875 const instance = {
9876 uid: uid++,
9877 vnode,
9878 type,
9879 parent,
9880 appContext,
9881 root: null,
9882 // to be immediately set
9883 next: null,
9884 subTree: null,
9885 // will be set synchronously right after creation
9886 effect: null,
9887 update: null,
9888 // will be set synchronously right after creation
9889 job: null,
9890 scope: new EffectScope(
9891 true
9892 /* detached */
9893 ),
9894 render: null,
9895 proxy: null,
9896 exposed: null,
9897 exposeProxy: null,
9898 withProxy: null,
9899 provides: parent ? parent.provides : Object.create(appContext.provides),
9900 ids: parent ? parent.ids : ["", 0, 0],
9901 accessCache: null,
9902 renderCache: [],
9903 // local resolved assets
9904 components: null,
9905 directives: null,
9906 // resolved props and emits options
9907 propsOptions: normalizePropsOptions(type, appContext),
9908 emitsOptions: normalizeEmitsOptions(type, appContext),
9909 // emit
9910 emit: null,
9911 // to be set immediately
9912 emitted: null,
9913 // props default value
9914 propsDefaults: EMPTY_OBJ,
9915 // inheritAttrs
9916 inheritAttrs: type.inheritAttrs,
9917 // state
9918 ctx: EMPTY_OBJ,
9919 data: EMPTY_OBJ,
9920 props: EMPTY_OBJ,
9921 attrs: EMPTY_OBJ,
9922 slots: EMPTY_OBJ,
9923 refs: EMPTY_OBJ,
9924 setupState: EMPTY_OBJ,
9925 setupContext: null,
9926 // suspense related
9927 suspense,
9928 suspenseId: suspense ? suspense.pendingId : 0,
9929 asyncDep: null,
9930 asyncResolved: false,
9931 // lifecycle hooks
9932 // not using enums here because it results in computed properties
9933 isMounted: false,
9934 isUnmounted: false,
9935 isDeactivated: false,
9936 bc: null,
9937 c: null,
9938 bm: null,
9939 m: null,
9940 bu: null,
9941 u: null,
9942 um: null,
9943 bum: null,
9944 da: null,
9945 a: null,
9946 rtg: null,
9947 rtc: null,
9948 ec: null,
9949 sp: null
9950 };
9951 {
9952 instance.ctx = createDevRenderContext(instance);
9953 }
9954 instance.root = parent ? parent.root : instance;
9955 instance.emit = emit.bind(null, instance);
9956 if (vnode.ce) {
9957 vnode.ce(instance);
9958 }
9959 return instance;
9960}
9961let currentInstance = null;
9962const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9963let internalSetCurrentInstance;
9964let setInSSRSetupState;
9965{
9966 const g = getGlobalThis();
9967 const registerGlobalSetter = (key, setter) => {
9968 let setters;
9969 if (!(setters = g[key])) setters = g[key] = [];
9970 setters.push(setter);
9971 return (v) => {
9972 if (setters.length > 1) setters.forEach((set) => set(v));
9973 else setters[0](v);
9974 };
9975 };
9976 internalSetCurrentInstance = registerGlobalSetter(
9977 `__VUE_INSTANCE_SETTERS__`,
9978 (v) => currentInstance = v
9979 );
9980 setInSSRSetupState = registerGlobalSetter(
9981 `__VUE_SSR_SETTERS__`,
9982 (v) => isInSSRComponentSetup = v
9983 );
9984}
9985const setCurrentInstance = (instance) => {
9986 const prev = currentInstance;
9987 internalSetCurrentInstance(instance);
9988 instance.scope.on();
9989 return () => {
9990 instance.scope.off();
9991 internalSetCurrentInstance(prev);
9992 };
9993};
9994const unsetCurrentInstance = () => {
9995 currentInstance && currentInstance.scope.off();
9996 internalSetCurrentInstance(null);
9997};
9998const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
9999function validateComponentName(name, { isNativeTag }) {
10000 if (isBuiltInTag(name) || isNativeTag(name)) {
10001 warn$1(
10002 "Do not use built-in or reserved HTML elements as component id: " + name
10003 );
10004 }
10005}
10006function isStatefulComponent(instance) {
10007 return instance.vnode.shapeFlag & 4;
10008}
10009let isInSSRComponentSetup = false;
10010function setupComponent(instance, isSSR = false, optimized = false) {
10011 isSSR && setInSSRSetupState(isSSR);
10012 const { props, children } = instance.vnode;
10013 const isStateful = isStatefulComponent(instance);
10014 initProps(instance, props, isStateful, isSSR);
10015 initSlots(instance, children, optimized);
10016 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
10017 isSSR && setInSSRSetupState(false);
10018 return setupResult;
10019}
10020function setupStatefulComponent(instance, isSSR) {
10021 var _a;
10022 const Component = instance.type;
10023 {
10024 if (Component.name) {
10025 validateComponentName(Component.name, instance.appContext.config);
10026 }
10027 if (Component.components) {
10028 const names = Object.keys(Component.components);
10029 for (let i = 0; i < names.length; i++) {
10030 validateComponentName(names[i], instance.appContext.config);
10031 }
10032 }
10033 if (Component.directives) {
10034 const names = Object.keys(Component.directives);
10035 for (let i = 0; i < names.length; i++) {
10036 validateDirectiveName(names[i]);
10037 }
10038 }
10039 if (Component.compilerOptions && isRuntimeOnly()) {
10040 warn$1(
10041 `"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.`
10042 );
10043 }
10044 }
10045 instance.accessCache = /* @__PURE__ */ Object.create(null);
10046 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
10047 {
10048 exposePropsOnRenderContext(instance);
10049 }
10050 const { setup } = Component;
10051 if (setup) {
10052 pauseTracking();
10053 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10054 const reset = setCurrentInstance(instance);
10055 const setupResult = callWithErrorHandling(
10056 setup,
10057 instance,
10058 0,
10059 [
10060 shallowReadonly(instance.props) ,
10061 setupContext
10062 ]
10063 );
10064 const isAsyncSetup = isPromise(setupResult);
10065 resetTracking();
10066 reset();
10067 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
10068 markAsyncBoundary(instance);
10069 }
10070 if (isAsyncSetup) {
10071 setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10072 if (isSSR) {
10073 return setupResult.then((resolvedResult) => {
10074 handleSetupResult(instance, resolvedResult, isSSR);
10075 }).catch((e) => {
10076 handleError(e, instance, 0);
10077 });
10078 } else {
10079 instance.asyncDep = setupResult;
10080 if (!instance.suspense) {
10081 const name = (_a = Component.name) != null ? _a : "Anonymous";
10082 warn$1(
10083 `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.`
10084 );
10085 }
10086 }
10087 } else {
10088 handleSetupResult(instance, setupResult, isSSR);
10089 }
10090 } else {
10091 finishComponentSetup(instance, isSSR);
10092 }
10093}
10094function handleSetupResult(instance, setupResult, isSSR) {
10095 if (isFunction(setupResult)) {
10096 if (instance.type.__ssrInlineRender) {
10097 instance.ssrRender = setupResult;
10098 } else {
10099 instance.render = setupResult;
10100 }
10101 } else if (isObject(setupResult)) {
10102 if (isVNode(setupResult)) {
10103 warn$1(
10104 `setup() should not return VNodes directly - return a render function instead.`
10105 );
10106 }
10107 {
10108 instance.devtoolsRawSetupState = setupResult;
10109 }
10110 instance.setupState = proxyRefs(setupResult);
10111 {
10112 exposeSetupStateOnRenderContext(instance);
10113 }
10114 } else if (setupResult !== void 0) {
10115 warn$1(
10116 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
10117 );
10118 }
10119 finishComponentSetup(instance, isSSR);
10120}
10121let compile$1;
10122let installWithProxy;
10123function registerRuntimeCompiler(_compile) {
10124 compile$1 = _compile;
10125 installWithProxy = (i) => {
10126 if (i.render._rc) {
10127 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
10128 }
10129 };
10130}
10131const isRuntimeOnly = () => !compile$1;
10132function finishComponentSetup(instance, isSSR, skipOptions) {
10133 const Component = instance.type;
10134 if (!instance.render) {
10135 if (!isSSR && compile$1 && !Component.render) {
10136 const template = Component.template || resolveMergedOptions(instance).template;
10137 if (template) {
10138 {
10139 startMeasure(instance, `compile`);
10140 }
10141 const { isCustomElement, compilerOptions } = instance.appContext.config;
10142 const { delimiters, compilerOptions: componentCompilerOptions } = Component;
10143 const finalCompilerOptions = extend(
10144 extend(
10145 {
10146 isCustomElement,
10147 delimiters
10148 },
10149 compilerOptions
10150 ),
10151 componentCompilerOptions
10152 );
10153 Component.render = compile$1(template, finalCompilerOptions);
10154 {
10155 endMeasure(instance, `compile`);
10156 }
10157 }
10158 }
10159 instance.render = Component.render || NOOP;
10160 if (installWithProxy) {
10161 installWithProxy(instance);
10162 }
10163 }
10164 {
10165 const reset = setCurrentInstance(instance);
10166 pauseTracking();
10167 try {
10168 applyOptions(instance);
10169 } finally {
10170 resetTracking();
10171 reset();
10172 }
10173 }
10174 if (!Component.render && instance.render === NOOP && !isSSR) {
10175 if (!compile$1 && Component.template) {
10176 warn$1(
10177 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
10178 );
10179 } else {
10180 warn$1(`Component is missing template or render function: `, Component);
10181 }
10182 }
10183}
10184const attrsProxyHandlers = {
10185 get(target, key) {
10186 markAttrsAccessed();
10187 track(target, "get", "");
10188 return target[key];
10189 },
10190 set() {
10191 warn$1(`setupContext.attrs is readonly.`);
10192 return false;
10193 },
10194 deleteProperty() {
10195 warn$1(`setupContext.attrs is readonly.`);
10196 return false;
10197 }
10198} ;
10199function getSlotsProxy(instance) {
10200 return new Proxy(instance.slots, {
10201 get(target, key) {
10202 track(instance, "get", "$slots");
10203 return target[key];
10204 }
10205 });
10206}
10207function createSetupContext(instance) {
10208 const expose = (exposed) => {
10209 {
10210 if (instance.exposed) {
10211 warn$1(`expose() should be called only once per setup().`);
10212 }
10213 if (exposed != null) {
10214 let exposedType = typeof exposed;
10215 if (exposedType === "object") {
10216 if (isArray(exposed)) {
10217 exposedType = "array";
10218 } else if (isRef(exposed)) {
10219 exposedType = "ref";
10220 }
10221 }
10222 if (exposedType !== "object") {
10223 warn$1(
10224 `expose() should be passed a plain object, received ${exposedType}.`
10225 );
10226 }
10227 }
10228 }
10229 instance.exposed = exposed || {};
10230 };
10231 {
10232 let attrsProxy;
10233 let slotsProxy;
10234 return Object.freeze({
10235 get attrs() {
10236 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
10237 },
10238 get slots() {
10239 return slotsProxy || (slotsProxy = getSlotsProxy(instance));
10240 },
10241 get emit() {
10242 return (event, ...args) => instance.emit(event, ...args);
10243 },
10244 expose
10245 });
10246 }
10247}
10248function getComponentPublicInstance(instance) {
10249 if (instance.exposed) {
10250 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
10251 get(target, key) {
10252 if (key in target) {
10253 return target[key];
10254 } else if (key in publicPropertiesMap) {
10255 return publicPropertiesMap[key](instance);
10256 }
10257 },
10258 has(target, key) {
10259 return key in target || key in publicPropertiesMap;
10260 }
10261 }));
10262 } else {
10263 return instance.proxy;
10264 }
10265}
10266const classifyRE = /(?:^|[-_])(\w)/g;
10267const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
10268function getComponentName(Component, includeInferred = true) {
10269 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
10270}
10271function formatComponentName(instance, Component, isRoot = false) {
10272 let name = getComponentName(Component);
10273 if (!name && Component.__file) {
10274 const match = Component.__file.match(/([^/\\]+)\.\w+$/);
10275 if (match) {
10276 name = match[1];
10277 }
10278 }
10279 if (!name && instance && instance.parent) {
10280 const inferFromRegistry = (registry) => {
10281 for (const key in registry) {
10282 if (registry[key] === Component) {
10283 return key;
10284 }
10285 }
10286 };
10287 name = inferFromRegistry(
10288 instance.components || instance.parent.type.components
10289 ) || inferFromRegistry(instance.appContext.components);
10290 }
10291 return name ? classify(name) : isRoot ? `App` : `Anonymous`;
10292}
10293function isClassComponent(value) {
10294 return isFunction(value) && "__vccOpts" in value;
10295}
10296
10297const computed = (getterOrOptions, debugOptions) => {
10298 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10299 {
10300 const i = getCurrentInstance();
10301 if (i && i.appContext.config.warnRecursiveComputed) {
10302 c._warnRecursive = true;
10303 }
10304 }
10305 return c;
10306};
10307
10308function h(type, propsOrChildren, children) {
10309 const l = arguments.length;
10310 if (l === 2) {
10311 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10312 if (isVNode(propsOrChildren)) {
10313 return createVNode(type, null, [propsOrChildren]);
10314 }
10315 return createVNode(type, propsOrChildren);
10316 } else {
10317 return createVNode(type, null, propsOrChildren);
10318 }
10319 } else {
10320 if (l > 3) {
10321 children = Array.prototype.slice.call(arguments, 2);
10322 } else if (l === 3 && isVNode(children)) {
10323 children = [children];
10324 }
10325 return createVNode(type, propsOrChildren, children);
10326 }
10327}
10328
10329function initCustomFormatter() {
10330 if (typeof window === "undefined") {
10331 return;
10332 }
10333 const vueStyle = { style: "color:#3ba776" };
10334 const numberStyle = { style: "color:#1677ff" };
10335 const stringStyle = { style: "color:#f5222d" };
10336 const keywordStyle = { style: "color:#eb2f96" };
10337 const formatter = {
10338 __vue_custom_formatter: true,
10339 header(obj) {
10340 if (!isObject(obj)) {
10341 return null;
10342 }
10343 if (obj.__isVue) {
10344 return ["div", vueStyle, `VueInstance`];
10345 } else if (isRef(obj)) {
10346 return [
10347 "div",
10348 {},
10349 ["span", vueStyle, genRefFlag(obj)],
10350 "<",
10351 // avoid debugger accessing value affecting behavior
10352 formatValue("_value" in obj ? obj._value : obj),
10353 `>`
10354 ];
10355 } else if (isReactive(obj)) {
10356 return [
10357 "div",
10358 {},
10359 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
10360 "<",
10361 formatValue(obj),
10362 `>${isReadonly(obj) ? ` (readonly)` : ``}`
10363 ];
10364 } else if (isReadonly(obj)) {
10365 return [
10366 "div",
10367 {},
10368 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
10369 "<",
10370 formatValue(obj),
10371 ">"
10372 ];
10373 }
10374 return null;
10375 },
10376 hasBody(obj) {
10377 return obj && obj.__isVue;
10378 },
10379 body(obj) {
10380 if (obj && obj.__isVue) {
10381 return [
10382 "div",
10383 {},
10384 ...formatInstance(obj.$)
10385 ];
10386 }
10387 }
10388 };
10389 function formatInstance(instance) {
10390 const blocks = [];
10391 if (instance.type.props && instance.props) {
10392 blocks.push(createInstanceBlock("props", toRaw(instance.props)));
10393 }
10394 if (instance.setupState !== EMPTY_OBJ) {
10395 blocks.push(createInstanceBlock("setup", instance.setupState));
10396 }
10397 if (instance.data !== EMPTY_OBJ) {
10398 blocks.push(createInstanceBlock("data", toRaw(instance.data)));
10399 }
10400 const computed = extractKeys(instance, "computed");
10401 if (computed) {
10402 blocks.push(createInstanceBlock("computed", computed));
10403 }
10404 const injected = extractKeys(instance, "inject");
10405 if (injected) {
10406 blocks.push(createInstanceBlock("injected", injected));
10407 }
10408 blocks.push([
10409 "div",
10410 {},
10411 [
10412 "span",
10413 {
10414 style: keywordStyle.style + ";opacity:0.66"
10415 },
10416 "$ (internal): "
10417 ],
10418 ["object", { object: instance }]
10419 ]);
10420 return blocks;
10421 }
10422 function createInstanceBlock(type, target) {
10423 target = extend({}, target);
10424 if (!Object.keys(target).length) {
10425 return ["span", {}];
10426 }
10427 return [
10428 "div",
10429 { style: "line-height:1.25em;margin-bottom:0.6em" },
10430 [
10431 "div",
10432 {
10433 style: "color:#476582"
10434 },
10435 type
10436 ],
10437 [
10438 "div",
10439 {
10440 style: "padding-left:1.25em"
10441 },
10442 ...Object.keys(target).map((key) => {
10443 return [
10444 "div",
10445 {},
10446 ["span", keywordStyle, key + ": "],
10447 formatValue(target[key], false)
10448 ];
10449 })
10450 ]
10451 ];
10452 }
10453 function formatValue(v, asRaw = true) {
10454 if (typeof v === "number") {
10455 return ["span", numberStyle, v];
10456 } else if (typeof v === "string") {
10457 return ["span", stringStyle, JSON.stringify(v)];
10458 } else if (typeof v === "boolean") {
10459 return ["span", keywordStyle, v];
10460 } else if (isObject(v)) {
10461 return ["object", { object: asRaw ? toRaw(v) : v }];
10462 } else {
10463 return ["span", stringStyle, String(v)];
10464 }
10465 }
10466 function extractKeys(instance, type) {
10467 const Comp = instance.type;
10468 if (isFunction(Comp)) {
10469 return;
10470 }
10471 const extracted = {};
10472 for (const key in instance.ctx) {
10473 if (isKeyOfType(Comp, key, type)) {
10474 extracted[key] = instance.ctx[key];
10475 }
10476 }
10477 return extracted;
10478 }
10479 function isKeyOfType(Comp, key, type) {
10480 const opts = Comp[type];
10481 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
10482 return true;
10483 }
10484 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
10485 return true;
10486 }
10487 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
10488 return true;
10489 }
10490 }
10491 function genRefFlag(v) {
10492 if (isShallow(v)) {
10493 return `ShallowRef`;
10494 }
10495 if (v.effect) {
10496 return `ComputedRef`;
10497 }
10498 return `Ref`;
10499 }
10500 if (window.devtoolsFormatters) {
10501 window.devtoolsFormatters.push(formatter);
10502 } else {
10503 window.devtoolsFormatters = [formatter];
10504 }
10505}
10506
10507function withMemo(memo, render, cache, index) {
10508 const cached = cache[index];
10509 if (cached && isMemoSame(cached, memo)) {
10510 return cached;
10511 }
10512 const ret = render();
10513 ret.memo = memo.slice();
10514 ret.cacheIndex = index;
10515 return cache[index] = ret;
10516}
10517function isMemoSame(cached, memo) {
10518 const prev = cached.memo;
10519 if (prev.length != memo.length) {
10520 return false;
10521 }
10522 for (let i = 0; i < prev.length; i++) {
10523 if (hasChanged(prev[i], memo[i])) {
10524 return false;
10525 }
10526 }
10527 if (isBlockTreeEnabled > 0 && currentBlock) {
10528 currentBlock.push(cached);
10529 }
10530 return true;
10531}
10532
10533const version = "3.5.13";
10534const warn = warn$1 ;
10535const ErrorTypeStrings = ErrorTypeStrings$1 ;
10536const devtools = devtools$1 ;
10537const setDevtoolsHook = setDevtoolsHook$1 ;
10538const _ssrUtils = {
10539 createComponentInstance,
10540 setupComponent,
10541 renderComponentRoot,
10542 setCurrentRenderingInstance,
10543 isVNode: isVNode,
10544 normalizeVNode,
10545 getComponentPublicInstance,
10546 ensureValidVNode,
10547 pushWarningContext,
10548 popWarningContext
10549};
10550const ssrUtils = _ssrUtils ;
10551const resolveFilter = null;
10552const compatUtils = null;
10553const DeprecationTypes = null;
10554
10555let policy = void 0;
10556const tt = typeof window !== "undefined" && window.trustedTypes;
10557if (tt) {
10558 try {
10559 policy = /* @__PURE__ */ tt.createPolicy("vue", {
10560 createHTML: (val) => val
10561 });
10562 } catch (e) {
10563 warn(`Error creating trusted types policy: ${e}`);
10564 }
10565}
10566const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
10567const svgNS = "http://www.w3.org/2000/svg";
10568const mathmlNS = "http://www.w3.org/1998/Math/MathML";
10569const doc = typeof document !== "undefined" ? document : null;
10570const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
10571const nodeOps = {
10572 insert: (child, parent, anchor) => {
10573 parent.insertBefore(child, anchor || null);
10574 },
10575 remove: (child) => {
10576 const parent = child.parentNode;
10577 if (parent) {
10578 parent.removeChild(child);
10579 }
10580 },
10581 createElement: (tag, namespace, is, props) => {
10582 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
10583 if (tag === "select" && props && props.multiple != null) {
10584 el.setAttribute("multiple", props.multiple);
10585 }
10586 return el;
10587 },
10588 createText: (text) => doc.createTextNode(text),
10589 createComment: (text) => doc.createComment(text),
10590 setText: (node, text) => {
10591 node.nodeValue = text;
10592 },
10593 setElementText: (el, text) => {
10594 el.textContent = text;
10595 },
10596 parentNode: (node) => node.parentNode,
10597 nextSibling: (node) => node.nextSibling,
10598 querySelector: (selector) => doc.querySelector(selector),
10599 setScopeId(el, id) {
10600 el.setAttribute(id, "");
10601 },
10602 // __UNSAFE__
10603 // Reason: innerHTML.
10604 // Static content here can only come from compiled templates.
10605 // As long as the user only uses trusted templates, this is safe.
10606 insertStaticContent(content, parent, anchor, namespace, start, end) {
10607 const before = anchor ? anchor.previousSibling : parent.lastChild;
10608 if (start && (start === end || start.nextSibling)) {
10609 while (true) {
10610 parent.insertBefore(start.cloneNode(true), anchor);
10611 if (start === end || !(start = start.nextSibling)) break;
10612 }
10613 } else {
10614 templateContainer.innerHTML = unsafeToTrustedHTML(
10615 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
10616 );
10617 const template = templateContainer.content;
10618 if (namespace === "svg" || namespace === "mathml") {
10619 const wrapper = template.firstChild;
10620 while (wrapper.firstChild) {
10621 template.appendChild(wrapper.firstChild);
10622 }
10623 template.removeChild(wrapper);
10624 }
10625 parent.insertBefore(template, anchor);
10626 }
10627 return [
10628 // first
10629 before ? before.nextSibling : parent.firstChild,
10630 // last
10631 anchor ? anchor.previousSibling : parent.lastChild
10632 ];
10633 }
10634};
10635
10636const TRANSITION$1 = "transition";
10637const ANIMATION = "animation";
10638const vtcKey = Symbol("_vtc");
10639const DOMTransitionPropsValidators = {
10640 name: String,
10641 type: String,
10642 css: {
10643 type: Boolean,
10644 default: true
10645 },
10646 duration: [String, Number, Object],
10647 enterFromClass: String,
10648 enterActiveClass: String,
10649 enterToClass: String,
10650 appearFromClass: String,
10651 appearActiveClass: String,
10652 appearToClass: String,
10653 leaveFromClass: String,
10654 leaveActiveClass: String,
10655 leaveToClass: String
10656};
10657const TransitionPropsValidators = /* @__PURE__ */ extend(
10658 {},
10659 BaseTransitionPropsValidators,
10660 DOMTransitionPropsValidators
10661);
10662const decorate$1 = (t) => {
10663 t.displayName = "Transition";
10664 t.props = TransitionPropsValidators;
10665 return t;
10666};
10667const Transition = /* @__PURE__ */ decorate$1(
10668 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10669);
10670const callHook = (hook, args = []) => {
10671 if (isArray(hook)) {
10672 hook.forEach((h2) => h2(...args));
10673 } else if (hook) {
10674 hook(...args);
10675 }
10676};
10677const hasExplicitCallback = (hook) => {
10678 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
10679};
10680function resolveTransitionProps(rawProps) {
10681 const baseProps = {};
10682 for (const key in rawProps) {
10683 if (!(key in DOMTransitionPropsValidators)) {
10684 baseProps[key] = rawProps[key];
10685 }
10686 }
10687 if (rawProps.css === false) {
10688 return baseProps;
10689 }
10690 const {
10691 name = "v",
10692 type,
10693 duration,
10694 enterFromClass = `${name}-enter-from`,
10695 enterActiveClass = `${name}-enter-active`,
10696 enterToClass = `${name}-enter-to`,
10697 appearFromClass = enterFromClass,
10698 appearActiveClass = enterActiveClass,
10699 appearToClass = enterToClass,
10700 leaveFromClass = `${name}-leave-from`,
10701 leaveActiveClass = `${name}-leave-active`,
10702 leaveToClass = `${name}-leave-to`
10703 } = rawProps;
10704 const durations = normalizeDuration(duration);
10705 const enterDuration = durations && durations[0];
10706 const leaveDuration = durations && durations[1];
10707 const {
10708 onBeforeEnter,
10709 onEnter,
10710 onEnterCancelled,
10711 onLeave,
10712 onLeaveCancelled,
10713 onBeforeAppear = onBeforeEnter,
10714 onAppear = onEnter,
10715 onAppearCancelled = onEnterCancelled
10716 } = baseProps;
10717 const finishEnter = (el, isAppear, done, isCancelled) => {
10718 el._enterCancelled = isCancelled;
10719 removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
10720 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
10721 done && done();
10722 };
10723 const finishLeave = (el, done) => {
10724 el._isLeaving = false;
10725 removeTransitionClass(el, leaveFromClass);
10726 removeTransitionClass(el, leaveToClass);
10727 removeTransitionClass(el, leaveActiveClass);
10728 done && done();
10729 };
10730 const makeEnterHook = (isAppear) => {
10731 return (el, done) => {
10732 const hook = isAppear ? onAppear : onEnter;
10733 const resolve = () => finishEnter(el, isAppear, done);
10734 callHook(hook, [el, resolve]);
10735 nextFrame(() => {
10736 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
10737 addTransitionClass(el, isAppear ? appearToClass : enterToClass);
10738 if (!hasExplicitCallback(hook)) {
10739 whenTransitionEnds(el, type, enterDuration, resolve);
10740 }
10741 });
10742 };
10743 };
10744 return extend(baseProps, {
10745 onBeforeEnter(el) {
10746 callHook(onBeforeEnter, [el]);
10747 addTransitionClass(el, enterFromClass);
10748 addTransitionClass(el, enterActiveClass);
10749 },
10750 onBeforeAppear(el) {
10751 callHook(onBeforeAppear, [el]);
10752 addTransitionClass(el, appearFromClass);
10753 addTransitionClass(el, appearActiveClass);
10754 },
10755 onEnter: makeEnterHook(false),
10756 onAppear: makeEnterHook(true),
10757 onLeave(el, done) {
10758 el._isLeaving = true;
10759 const resolve = () => finishLeave(el, done);
10760 addTransitionClass(el, leaveFromClass);
10761 if (!el._enterCancelled) {
10762 forceReflow();
10763 addTransitionClass(el, leaveActiveClass);
10764 } else {
10765 addTransitionClass(el, leaveActiveClass);
10766 forceReflow();
10767 }
10768 nextFrame(() => {
10769 if (!el._isLeaving) {
10770 return;
10771 }
10772 removeTransitionClass(el, leaveFromClass);
10773 addTransitionClass(el, leaveToClass);
10774 if (!hasExplicitCallback(onLeave)) {
10775 whenTransitionEnds(el, type, leaveDuration, resolve);
10776 }
10777 });
10778 callHook(onLeave, [el, resolve]);
10779 },
10780 onEnterCancelled(el) {
10781 finishEnter(el, false, void 0, true);
10782 callHook(onEnterCancelled, [el]);
10783 },
10784 onAppearCancelled(el) {
10785 finishEnter(el, true, void 0, true);
10786 callHook(onAppearCancelled, [el]);
10787 },
10788 onLeaveCancelled(el) {
10789 finishLeave(el);
10790 callHook(onLeaveCancelled, [el]);
10791 }
10792 });
10793}
10794function normalizeDuration(duration) {
10795 if (duration == null) {
10796 return null;
10797 } else if (isObject(duration)) {
10798 return [NumberOf(duration.enter), NumberOf(duration.leave)];
10799 } else {
10800 const n = NumberOf(duration);
10801 return [n, n];
10802 }
10803}
10804function NumberOf(val) {
10805 const res = toNumber(val);
10806 {
10807 assertNumber(res, "<transition> explicit duration");
10808 }
10809 return res;
10810}
10811function addTransitionClass(el, cls) {
10812 cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
10813 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
10814}
10815function removeTransitionClass(el, cls) {
10816 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
10817 const _vtc = el[vtcKey];
10818 if (_vtc) {
10819 _vtc.delete(cls);
10820 if (!_vtc.size) {
10821 el[vtcKey] = void 0;
10822 }
10823 }
10824}
10825function nextFrame(cb) {
10826 requestAnimationFrame(() => {
10827 requestAnimationFrame(cb);
10828 });
10829}
10830let endId = 0;
10831function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
10832 const id = el._endId = ++endId;
10833 const resolveIfNotStale = () => {
10834 if (id === el._endId) {
10835 resolve();
10836 }
10837 };
10838 if (explicitTimeout != null) {
10839 return setTimeout(resolveIfNotStale, explicitTimeout);
10840 }
10841 const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
10842 if (!type) {
10843 return resolve();
10844 }
10845 const endEvent = type + "end";
10846 let ended = 0;
10847 const end = () => {
10848 el.removeEventListener(endEvent, onEnd);
10849 resolveIfNotStale();
10850 };
10851 const onEnd = (e) => {
10852 if (e.target === el && ++ended >= propCount) {
10853 end();
10854 }
10855 };
10856 setTimeout(() => {
10857 if (ended < propCount) {
10858 end();
10859 }
10860 }, timeout + 1);
10861 el.addEventListener(endEvent, onEnd);
10862}
10863function getTransitionInfo(el, expectedType) {
10864 const styles = window.getComputedStyle(el);
10865 const getStyleProperties = (key) => (styles[key] || "").split(", ");
10866 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`);
10867 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`);
10868 const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
10869 const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
10870 const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
10871 const animationTimeout = getTimeout(animationDelays, animationDurations);
10872 let type = null;
10873 let timeout = 0;
10874 let propCount = 0;
10875 if (expectedType === TRANSITION$1) {
10876 if (transitionTimeout > 0) {
10877 type = TRANSITION$1;
10878 timeout = transitionTimeout;
10879 propCount = transitionDurations.length;
10880 }
10881 } else if (expectedType === ANIMATION) {
10882 if (animationTimeout > 0) {
10883 type = ANIMATION;
10884 timeout = animationTimeout;
10885 propCount = animationDurations.length;
10886 }
10887 } else {
10888 timeout = Math.max(transitionTimeout, animationTimeout);
10889 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
10890 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
10891 }
10892 const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
10893 getStyleProperties(`${TRANSITION$1}Property`).toString()
10894 );
10895 return {
10896 type,
10897 timeout,
10898 propCount,
10899 hasTransform
10900 };
10901}
10902function getTimeout(delays, durations) {
10903 while (delays.length < durations.length) {
10904 delays = delays.concat(delays);
10905 }
10906 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
10907}
10908function toMs(s) {
10909 if (s === "auto") return 0;
10910 return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10911}
10912function forceReflow() {
10913 return document.body.offsetHeight;
10914}
10915
10916function patchClass(el, value, isSVG) {
10917 const transitionClasses = el[vtcKey];
10918 if (transitionClasses) {
10919 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
10920 }
10921 if (value == null) {
10922 el.removeAttribute("class");
10923 } else if (isSVG) {
10924 el.setAttribute("class", value);
10925 } else {
10926 el.className = value;
10927 }
10928}
10929
10930const vShowOriginalDisplay = Symbol("_vod");
10931const vShowHidden = Symbol("_vsh");
10932const vShow = {
10933 beforeMount(el, { value }, { transition }) {
10934 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10935 if (transition && value) {
10936 transition.beforeEnter(el);
10937 } else {
10938 setDisplay(el, value);
10939 }
10940 },
10941 mounted(el, { value }, { transition }) {
10942 if (transition && value) {
10943 transition.enter(el);
10944 }
10945 },
10946 updated(el, { value, oldValue }, { transition }) {
10947 if (!value === !oldValue) return;
10948 if (transition) {
10949 if (value) {
10950 transition.beforeEnter(el);
10951 setDisplay(el, true);
10952 transition.enter(el);
10953 } else {
10954 transition.leave(el, () => {
10955 setDisplay(el, false);
10956 });
10957 }
10958 } else {
10959 setDisplay(el, value);
10960 }
10961 },
10962 beforeUnmount(el, { value }) {
10963 setDisplay(el, value);
10964 }
10965};
10966{
10967 vShow.name = "show";
10968}
10969function setDisplay(el, value) {
10970 el.style.display = value ? el[vShowOriginalDisplay] : "none";
10971 el[vShowHidden] = !value;
10972}
10973function initVShowForSSR() {
10974 vShow.getSSRProps = ({ value }) => {
10975 if (!value) {
10976 return { style: { display: "none" } };
10977 }
10978 };
10979}
10980
10981const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
10982function useCssVars(getter) {
10983 const instance = getCurrentInstance();
10984 if (!instance) {
10985 warn(`useCssVars is called without current active component instance.`);
10986 return;
10987 }
10988 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
10989 Array.from(
10990 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
10991 ).forEach((node) => setVarsOnNode(node, vars));
10992 };
10993 {
10994 instance.getCssVars = () => getter(instance.proxy);
10995 }
10996 const setVars = () => {
10997 const vars = getter(instance.proxy);
10998 if (instance.ce) {
10999 setVarsOnNode(instance.ce, vars);
11000 } else {
11001 setVarsOnVNode(instance.subTree, vars);
11002 }
11003 updateTeleports(vars);
11004 };
11005 onBeforeUpdate(() => {
11006 queuePostFlushCb(setVars);
11007 });
11008 onMounted(() => {
11009 watch(setVars, NOOP, { flush: "post" });
11010 const ob = new MutationObserver(setVars);
11011 ob.observe(instance.subTree.el.parentNode, { childList: true });
11012 onUnmounted(() => ob.disconnect());
11013 });
11014}
11015function setVarsOnVNode(vnode, vars) {
11016 if (vnode.shapeFlag & 128) {
11017 const suspense = vnode.suspense;
11018 vnode = suspense.activeBranch;
11019 if (suspense.pendingBranch && !suspense.isHydrating) {
11020 suspense.effects.push(() => {
11021 setVarsOnVNode(suspense.activeBranch, vars);
11022 });
11023 }
11024 }
11025 while (vnode.component) {
11026 vnode = vnode.component.subTree;
11027 }
11028 if (vnode.shapeFlag & 1 && vnode.el) {
11029 setVarsOnNode(vnode.el, vars);
11030 } else if (vnode.type === Fragment) {
11031 vnode.children.forEach((c) => setVarsOnVNode(c, vars));
11032 } else if (vnode.type === Static) {
11033 let { el, anchor } = vnode;
11034 while (el) {
11035 setVarsOnNode(el, vars);
11036 if (el === anchor) break;
11037 el = el.nextSibling;
11038 }
11039 }
11040}
11041function setVarsOnNode(el, vars) {
11042 if (el.nodeType === 1) {
11043 const style = el.style;
11044 let cssText = "";
11045 for (const key in vars) {
11046 style.setProperty(`--${key}`, vars[key]);
11047 cssText += `--${key}: ${vars[key]};`;
11048 }
11049 style[CSS_VAR_TEXT] = cssText;
11050 }
11051}
11052
11053const displayRE = /(^|;)\s*display\s*:/;
11054function patchStyle(el, prev, next) {
11055 const style = el.style;
11056 const isCssString = isString(next);
11057 let hasControlledDisplay = false;
11058 if (next && !isCssString) {
11059 if (prev) {
11060 if (!isString(prev)) {
11061 for (const key in prev) {
11062 if (next[key] == null) {
11063 setStyle(style, key, "");
11064 }
11065 }
11066 } else {
11067 for (const prevStyle of prev.split(";")) {
11068 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11069 if (next[key] == null) {
11070 setStyle(style, key, "");
11071 }
11072 }
11073 }
11074 }
11075 for (const key in next) {
11076 if (key === "display") {
11077 hasControlledDisplay = true;
11078 }
11079 setStyle(style, key, next[key]);
11080 }
11081 } else {
11082 if (isCssString) {
11083 if (prev !== next) {
11084 const cssVarText = style[CSS_VAR_TEXT];
11085 if (cssVarText) {
11086 next += ";" + cssVarText;
11087 }
11088 style.cssText = next;
11089 hasControlledDisplay = displayRE.test(next);
11090 }
11091 } else if (prev) {
11092 el.removeAttribute("style");
11093 }
11094 }
11095 if (vShowOriginalDisplay in el) {
11096 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11097 if (el[vShowHidden]) {
11098 style.display = "none";
11099 }
11100 }
11101}
11102const semicolonRE = /[^\\];\s*$/;
11103const importantRE = /\s*!important$/;
11104function setStyle(style, name, val) {
11105 if (isArray(val)) {
11106 val.forEach((v) => setStyle(style, name, v));
11107 } else {
11108 if (val == null) val = "";
11109 {
11110 if (semicolonRE.test(val)) {
11111 warn(
11112 `Unexpected semicolon at the end of '${name}' style value: '${val}'`
11113 );
11114 }
11115 }
11116 if (name.startsWith("--")) {
11117 style.setProperty(name, val);
11118 } else {
11119 const prefixed = autoPrefix(style, name);
11120 if (importantRE.test(val)) {
11121 style.setProperty(
11122 hyphenate(prefixed),
11123 val.replace(importantRE, ""),
11124 "important"
11125 );
11126 } else {
11127 style[prefixed] = val;
11128 }
11129 }
11130 }
11131}
11132const prefixes = ["Webkit", "Moz", "ms"];
11133const prefixCache = {};
11134function autoPrefix(style, rawName) {
11135 const cached = prefixCache[rawName];
11136 if (cached) {
11137 return cached;
11138 }
11139 let name = camelize(rawName);
11140 if (name !== "filter" && name in style) {
11141 return prefixCache[rawName] = name;
11142 }
11143 name = capitalize(name);
11144 for (let i = 0; i < prefixes.length; i++) {
11145 const prefixed = prefixes[i] + name;
11146 if (prefixed in style) {
11147 return prefixCache[rawName] = prefixed;
11148 }
11149 }
11150 return rawName;
11151}
11152
11153const xlinkNS = "http://www.w3.org/1999/xlink";
11154function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
11155 if (isSVG && key.startsWith("xlink:")) {
11156 if (value == null) {
11157 el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
11158 } else {
11159 el.setAttributeNS(xlinkNS, key, value);
11160 }
11161 } else {
11162 if (value == null || isBoolean && !includeBooleanAttr(value)) {
11163 el.removeAttribute(key);
11164 } else {
11165 el.setAttribute(
11166 key,
11167 isBoolean ? "" : isSymbol(value) ? String(value) : value
11168 );
11169 }
11170 }
11171}
11172
11173function patchDOMProp(el, key, value, parentComponent, attrName) {
11174 if (key === "innerHTML" || key === "textContent") {
11175 if (value != null) {
11176 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
11177 }
11178 return;
11179 }
11180 const tag = el.tagName;
11181 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11182 !tag.includes("-")) {
11183 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11184 const newValue = value == null ? (
11185 // #11647: value should be set as empty string for null and undefined,
11186 // but <input type="checkbox"> should be set as 'on'.
11187 el.type === "checkbox" ? "on" : ""
11188 ) : String(value);
11189 if (oldValue !== newValue || !("_value" in el)) {
11190 el.value = newValue;
11191 }
11192 if (value == null) {
11193 el.removeAttribute(key);
11194 }
11195 el._value = value;
11196 return;
11197 }
11198 let needRemove = false;
11199 if (value === "" || value == null) {
11200 const type = typeof el[key];
11201 if (type === "boolean") {
11202 value = includeBooleanAttr(value);
11203 } else if (value == null && type === "string") {
11204 value = "";
11205 needRemove = true;
11206 } else if (type === "number") {
11207 value = 0;
11208 needRemove = true;
11209 }
11210 }
11211 try {
11212 el[key] = value;
11213 } catch (e) {
11214 if (!needRemove) {
11215 warn(
11216 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
11217 e
11218 );
11219 }
11220 }
11221 needRemove && el.removeAttribute(attrName || key);
11222}
11223
11224function addEventListener(el, event, handler, options) {
11225 el.addEventListener(event, handler, options);
11226}
11227function removeEventListener(el, event, handler, options) {
11228 el.removeEventListener(event, handler, options);
11229}
11230const veiKey = Symbol("_vei");
11231function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
11232 const invokers = el[veiKey] || (el[veiKey] = {});
11233 const existingInvoker = invokers[rawName];
11234 if (nextValue && existingInvoker) {
11235 existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
11236 } else {
11237 const [name, options] = parseName(rawName);
11238 if (nextValue) {
11239 const invoker = invokers[rawName] = createInvoker(
11240 sanitizeEventValue(nextValue, rawName) ,
11241 instance
11242 );
11243 addEventListener(el, name, invoker, options);
11244 } else if (existingInvoker) {
11245 removeEventListener(el, name, existingInvoker, options);
11246 invokers[rawName] = void 0;
11247 }
11248 }
11249}
11250const optionsModifierRE = /(?:Once|Passive|Capture)$/;
11251function parseName(name) {
11252 let options;
11253 if (optionsModifierRE.test(name)) {
11254 options = {};
11255 let m;
11256 while (m = name.match(optionsModifierRE)) {
11257 name = name.slice(0, name.length - m[0].length);
11258 options[m[0].toLowerCase()] = true;
11259 }
11260 }
11261 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
11262 return [event, options];
11263}
11264let cachedNow = 0;
11265const p = /* @__PURE__ */ Promise.resolve();
11266const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
11267function createInvoker(initialValue, instance) {
11268 const invoker = (e) => {
11269 if (!e._vts) {
11270 e._vts = Date.now();
11271 } else if (e._vts <= invoker.attached) {
11272 return;
11273 }
11274 callWithAsyncErrorHandling(
11275 patchStopImmediatePropagation(e, invoker.value),
11276 instance,
11277 5,
11278 [e]
11279 );
11280 };
11281 invoker.value = initialValue;
11282 invoker.attached = getNow();
11283 return invoker;
11284}
11285function sanitizeEventValue(value, propName) {
11286 if (isFunction(value) || isArray(value)) {
11287 return value;
11288 }
11289 warn(
11290 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
11291Expected function or array of functions, received type ${typeof value}.`
11292 );
11293 return NOOP;
11294}
11295function patchStopImmediatePropagation(e, value) {
11296 if (isArray(value)) {
11297 const originalStop = e.stopImmediatePropagation;
11298 e.stopImmediatePropagation = () => {
11299 originalStop.call(e);
11300 e._stopped = true;
11301 };
11302 return value.map(
11303 (fn) => (e2) => !e2._stopped && fn && fn(e2)
11304 );
11305 } else {
11306 return value;
11307 }
11308}
11309
11310const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11311key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11312const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
11313 const isSVG = namespace === "svg";
11314 if (key === "class") {
11315 patchClass(el, nextValue, isSVG);
11316 } else if (key === "style") {
11317 patchStyle(el, prevValue, nextValue);
11318 } else if (isOn(key)) {
11319 if (!isModelListener(key)) {
11320 patchEvent(el, key, prevValue, nextValue, parentComponent);
11321 }
11322 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
11323 patchDOMProp(el, key, nextValue);
11324 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
11325 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
11326 }
11327 } else if (
11328 // #11081 force set props for possible async custom element
11329 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
11330 ) {
11331 patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
11332 } else {
11333 if (key === "true-value") {
11334 el._trueValue = nextValue;
11335 } else if (key === "false-value") {
11336 el._falseValue = nextValue;
11337 }
11338 patchAttr(el, key, nextValue, isSVG);
11339 }
11340};
11341function shouldSetAsProp(el, key, value, isSVG) {
11342 if (isSVG) {
11343 if (key === "innerHTML" || key === "textContent") {
11344 return true;
11345 }
11346 if (key in el && isNativeOn(key) && isFunction(value)) {
11347 return true;
11348 }
11349 return false;
11350 }
11351 if (key === "spellcheck" || key === "draggable" || key === "translate") {
11352 return false;
11353 }
11354 if (key === "form") {
11355 return false;
11356 }
11357 if (key === "list" && el.tagName === "INPUT") {
11358 return false;
11359 }
11360 if (key === "type" && el.tagName === "TEXTAREA") {
11361 return false;
11362 }
11363 if (key === "width" || key === "height") {
11364 const tag = el.tagName;
11365 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
11366 return false;
11367 }
11368 }
11369 if (isNativeOn(key) && isString(value)) {
11370 return false;
11371 }
11372 return key in el;
11373}
11374
11375const REMOVAL = {};
11376/*! #__NO_SIDE_EFFECTS__ */
11377// @__NO_SIDE_EFFECTS__
11378function defineCustomElement(options, extraOptions, _createApp) {
11379 const Comp = defineComponent(options, extraOptions);
11380 if (isPlainObject(Comp)) extend(Comp, extraOptions);
11381 class VueCustomElement extends VueElement {
11382 constructor(initialProps) {
11383 super(Comp, initialProps, _createApp);
11384 }
11385 }
11386 VueCustomElement.def = Comp;
11387 return VueCustomElement;
11388}
11389/*! #__NO_SIDE_EFFECTS__ */
11390const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11391 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11392};
11393const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11394};
11395class VueElement extends BaseClass {
11396 constructor(_def, _props = {}, _createApp = createApp) {
11397 super();
11398 this._def = _def;
11399 this._props = _props;
11400 this._createApp = _createApp;
11401 this._isVueCE = true;
11402 /**
11403 * @internal
11404 */
11405 this._instance = null;
11406 /**
11407 * @internal
11408 */
11409 this._app = null;
11410 /**
11411 * @internal
11412 */
11413 this._nonce = this._def.nonce;
11414 this._connected = false;
11415 this._resolved = false;
11416 this._numberProps = null;
11417 this._styleChildren = /* @__PURE__ */ new WeakSet();
11418 this._ob = null;
11419 if (this.shadowRoot && _createApp !== createApp) {
11420 this._root = this.shadowRoot;
11421 } else {
11422 if (this.shadowRoot) {
11423 warn(
11424 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
11425 );
11426 }
11427 if (_def.shadowRoot !== false) {
11428 this.attachShadow({ mode: "open" });
11429 this._root = this.shadowRoot;
11430 } else {
11431 this._root = this;
11432 }
11433 }
11434 if (!this._def.__asyncLoader) {
11435 this._resolveProps(this._def);
11436 }
11437 }
11438 connectedCallback() {
11439 if (!this.isConnected) return;
11440 if (!this.shadowRoot) {
11441 this._parseSlots();
11442 }
11443 this._connected = true;
11444 let parent = this;
11445 while (parent = parent && (parent.parentNode || parent.host)) {
11446 if (parent instanceof VueElement) {
11447 this._parent = parent;
11448 break;
11449 }
11450 }
11451 if (!this._instance) {
11452 if (this._resolved) {
11453 this._setParent();
11454 this._update();
11455 } else {
11456 if (parent && parent._pendingResolve) {
11457 this._pendingResolve = parent._pendingResolve.then(() => {
11458 this._pendingResolve = void 0;
11459 this._resolveDef();
11460 });
11461 } else {
11462 this._resolveDef();
11463 }
11464 }
11465 }
11466 }
11467 _setParent(parent = this._parent) {
11468 if (parent) {
11469 this._instance.parent = parent._instance;
11470 this._instance.provides = parent._instance.provides;
11471 }
11472 }
11473 disconnectedCallback() {
11474 this._connected = false;
11475 nextTick(() => {
11476 if (!this._connected) {
11477 if (this._ob) {
11478 this._ob.disconnect();
11479 this._ob = null;
11480 }
11481 this._app && this._app.unmount();
11482 if (this._instance) this._instance.ce = void 0;
11483 this._app = this._instance = null;
11484 }
11485 });
11486 }
11487 /**
11488 * resolve inner component definition (handle possible async component)
11489 */
11490 _resolveDef() {
11491 if (this._pendingResolve) {
11492 return;
11493 }
11494 for (let i = 0; i < this.attributes.length; i++) {
11495 this._setAttr(this.attributes[i].name);
11496 }
11497 this._ob = new MutationObserver((mutations) => {
11498 for (const m of mutations) {
11499 this._setAttr(m.attributeName);
11500 }
11501 });
11502 this._ob.observe(this, { attributes: true });
11503 const resolve = (def, isAsync = false) => {
11504 this._resolved = true;
11505 this._pendingResolve = void 0;
11506 const { props, styles } = def;
11507 let numberProps;
11508 if (props && !isArray(props)) {
11509 for (const key in props) {
11510 const opt = props[key];
11511 if (opt === Number || opt && opt.type === Number) {
11512 if (key in this._props) {
11513 this._props[key] = toNumber(this._props[key]);
11514 }
11515 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
11516 }
11517 }
11518 }
11519 this._numberProps = numberProps;
11520 if (isAsync) {
11521 this._resolveProps(def);
11522 }
11523 if (this.shadowRoot) {
11524 this._applyStyles(styles);
11525 } else if (styles) {
11526 warn(
11527 "Custom element style injection is not supported when using shadowRoot: false"
11528 );
11529 }
11530 this._mount(def);
11531 };
11532 const asyncDef = this._def.__asyncLoader;
11533 if (asyncDef) {
11534 this._pendingResolve = asyncDef().then(
11535 (def) => resolve(this._def = def, true)
11536 );
11537 } else {
11538 resolve(this._def);
11539 }
11540 }
11541 _mount(def) {
11542 if (!def.name) {
11543 def.name = "VueElement";
11544 }
11545 this._app = this._createApp(def);
11546 if (def.configureApp) {
11547 def.configureApp(this._app);
11548 }
11549 this._app._ceVNode = this._createVNode();
11550 this._app.mount(this._root);
11551 const exposed = this._instance && this._instance.exposed;
11552 if (!exposed) return;
11553 for (const key in exposed) {
11554 if (!hasOwn(this, key)) {
11555 Object.defineProperty(this, key, {
11556 // unwrap ref to be consistent with public instance behavior
11557 get: () => unref(exposed[key])
11558 });
11559 } else {
11560 warn(`Exposed property "${key}" already exists on custom element.`);
11561 }
11562 }
11563 }
11564 _resolveProps(def) {
11565 const { props } = def;
11566 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
11567 for (const key of Object.keys(this)) {
11568 if (key[0] !== "_" && declaredPropKeys.includes(key)) {
11569 this._setProp(key, this[key]);
11570 }
11571 }
11572 for (const key of declaredPropKeys.map(camelize)) {
11573 Object.defineProperty(this, key, {
11574 get() {
11575 return this._getProp(key);
11576 },
11577 set(val) {
11578 this._setProp(key, val, true, true);
11579 }
11580 });
11581 }
11582 }
11583 _setAttr(key) {
11584 if (key.startsWith("data-v-")) return;
11585 const has = this.hasAttribute(key);
11586 let value = has ? this.getAttribute(key) : REMOVAL;
11587 const camelKey = camelize(key);
11588 if (has && this._numberProps && this._numberProps[camelKey]) {
11589 value = toNumber(value);
11590 }
11591 this._setProp(camelKey, value, false, true);
11592 }
11593 /**
11594 * @internal
11595 */
11596 _getProp(key) {
11597 return this._props[key];
11598 }
11599 /**
11600 * @internal
11601 */
11602 _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11603 if (val !== this._props[key]) {
11604 if (val === REMOVAL) {
11605 delete this._props[key];
11606 } else {
11607 this._props[key] = val;
11608 if (key === "key" && this._app) {
11609 this._app._ceVNode.key = val;
11610 }
11611 }
11612 if (shouldUpdate && this._instance) {
11613 this._update();
11614 }
11615 if (shouldReflect) {
11616 const ob = this._ob;
11617 ob && ob.disconnect();
11618 if (val === true) {
11619 this.setAttribute(hyphenate(key), "");
11620 } else if (typeof val === "string" || typeof val === "number") {
11621 this.setAttribute(hyphenate(key), val + "");
11622 } else if (!val) {
11623 this.removeAttribute(hyphenate(key));
11624 }
11625 ob && ob.observe(this, { attributes: true });
11626 }
11627 }
11628 }
11629 _update() {
11630 render(this._createVNode(), this._root);
11631 }
11632 _createVNode() {
11633 const baseProps = {};
11634 if (!this.shadowRoot) {
11635 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11636 }
11637 const vnode = createVNode(this._def, extend(baseProps, this._props));
11638 if (!this._instance) {
11639 vnode.ce = (instance) => {
11640 this._instance = instance;
11641 instance.ce = this;
11642 instance.isCE = true;
11643 {
11644 instance.ceReload = (newStyles) => {
11645 if (this._styles) {
11646 this._styles.forEach((s) => this._root.removeChild(s));
11647 this._styles.length = 0;
11648 }
11649 this._applyStyles(newStyles);
11650 this._instance = null;
11651 this._update();
11652 };
11653 }
11654 const dispatch = (event, args) => {
11655 this.dispatchEvent(
11656 new CustomEvent(
11657 event,
11658 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11659 )
11660 );
11661 };
11662 instance.emit = (event, ...args) => {
11663 dispatch(event, args);
11664 if (hyphenate(event) !== event) {
11665 dispatch(hyphenate(event), args);
11666 }
11667 };
11668 this._setParent();
11669 };
11670 }
11671 return vnode;
11672 }
11673 _applyStyles(styles, owner) {
11674 if (!styles) return;
11675 if (owner) {
11676 if (owner === this._def || this._styleChildren.has(owner)) {
11677 return;
11678 }
11679 this._styleChildren.add(owner);
11680 }
11681 const nonce = this._nonce;
11682 for (let i = styles.length - 1; i >= 0; i--) {
11683 const s = document.createElement("style");
11684 if (nonce) s.setAttribute("nonce", nonce);
11685 s.textContent = styles[i];
11686 this.shadowRoot.prepend(s);
11687 {
11688 if (owner) {
11689 if (owner.__hmrId) {
11690 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
11691 let entry = this._childStyles.get(owner.__hmrId);
11692 if (!entry) {
11693 this._childStyles.set(owner.__hmrId, entry = []);
11694 }
11695 entry.push(s);
11696 }
11697 } else {
11698 (this._styles || (this._styles = [])).push(s);
11699 }
11700 }
11701 }
11702 }
11703 /**
11704 * Only called when shadowRoot is false
11705 */
11706 _parseSlots() {
11707 const slots = this._slots = {};
11708 let n;
11709 while (n = this.firstChild) {
11710 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
11711 (slots[slotName] || (slots[slotName] = [])).push(n);
11712 this.removeChild(n);
11713 }
11714 }
11715 /**
11716 * Only called when shadowRoot is false
11717 */
11718 _renderSlots() {
11719 const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11720 const scopeId = this._instance.type.__scopeId;
11721 for (let i = 0; i < outlets.length; i++) {
11722 const o = outlets[i];
11723 const slotName = o.getAttribute("name") || "default";
11724 const content = this._slots[slotName];
11725 const parent = o.parentNode;
11726 if (content) {
11727 for (const n of content) {
11728 if (scopeId && n.nodeType === 1) {
11729 const id = scopeId + "-s";
11730 const walker = document.createTreeWalker(n, 1);
11731 n.setAttribute(id, "");
11732 let child;
11733 while (child = walker.nextNode()) {
11734 child.setAttribute(id, "");
11735 }
11736 }
11737 parent.insertBefore(n, o);
11738 }
11739 } else {
11740 while (o.firstChild) parent.insertBefore(o.firstChild, o);
11741 }
11742 parent.removeChild(o);
11743 }
11744 }
11745 /**
11746 * @internal
11747 */
11748 _injectChildStyle(comp) {
11749 this._applyStyles(comp.styles, comp);
11750 }
11751 /**
11752 * @internal
11753 */
11754 _removeChildStyle(comp) {
11755 {
11756 this._styleChildren.delete(comp);
11757 if (this._childStyles && comp.__hmrId) {
11758 const oldStyles = this._childStyles.get(comp.__hmrId);
11759 if (oldStyles) {
11760 oldStyles.forEach((s) => this._root.removeChild(s));
11761 oldStyles.length = 0;
11762 }
11763 }
11764 }
11765 }
11766}
11767function useHost(caller) {
11768 const instance = getCurrentInstance();
11769 const el = instance && instance.ce;
11770 if (el) {
11771 return el;
11772 } else {
11773 if (!instance) {
11774 warn(
11775 `${caller || "useHost"} called without an active component instance.`
11776 );
11777 } else {
11778 warn(
11779 `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
11780 );
11781 }
11782 }
11783 return null;
11784}
11785function useShadowRoot() {
11786 const el = useHost("useShadowRoot") ;
11787 return el && el.shadowRoot;
11788}
11789
11790function useCssModule(name = "$style") {
11791 {
11792 const instance = getCurrentInstance();
11793 if (!instance) {
11794 warn(`useCssModule must be called inside setup()`);
11795 return EMPTY_OBJ;
11796 }
11797 const modules = instance.type.__cssModules;
11798 if (!modules) {
11799 warn(`Current instance does not have CSS modules injected.`);
11800 return EMPTY_OBJ;
11801 }
11802 const mod = modules[name];
11803 if (!mod) {
11804 warn(`Current instance does not have CSS module named "${name}".`);
11805 return EMPTY_OBJ;
11806 }
11807 return mod;
11808 }
11809}
11810
11811const positionMap = /* @__PURE__ */ new WeakMap();
11812const newPositionMap = /* @__PURE__ */ new WeakMap();
11813const moveCbKey = Symbol("_moveCb");
11814const enterCbKey = Symbol("_enterCb");
11815const decorate = (t) => {
11816 delete t.props.mode;
11817 return t;
11818};
11819const TransitionGroupImpl = /* @__PURE__ */ decorate({
11820 name: "TransitionGroup",
11821 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11822 tag: String,
11823 moveClass: String
11824 }),
11825 setup(props, { slots }) {
11826 const instance = getCurrentInstance();
11827 const state = useTransitionState();
11828 let prevChildren;
11829 let children;
11830 onUpdated(() => {
11831 if (!prevChildren.length) {
11832 return;
11833 }
11834 const moveClass = props.moveClass || `${props.name || "v"}-move`;
11835 if (!hasCSSTransform(
11836 prevChildren[0].el,
11837 instance.vnode.el,
11838 moveClass
11839 )) {
11840 return;
11841 }
11842 prevChildren.forEach(callPendingCbs);
11843 prevChildren.forEach(recordPosition);
11844 const movedChildren = prevChildren.filter(applyTranslation);
11845 forceReflow();
11846 movedChildren.forEach((c) => {
11847 const el = c.el;
11848 const style = el.style;
11849 addTransitionClass(el, moveClass);
11850 style.transform = style.webkitTransform = style.transitionDuration = "";
11851 const cb = el[moveCbKey] = (e) => {
11852 if (e && e.target !== el) {
11853 return;
11854 }
11855 if (!e || /transform$/.test(e.propertyName)) {
11856 el.removeEventListener("transitionend", cb);
11857 el[moveCbKey] = null;
11858 removeTransitionClass(el, moveClass);
11859 }
11860 };
11861 el.addEventListener("transitionend", cb);
11862 });
11863 });
11864 return () => {
11865 const rawProps = toRaw(props);
11866 const cssTransitionProps = resolveTransitionProps(rawProps);
11867 let tag = rawProps.tag || Fragment;
11868 prevChildren = [];
11869 if (children) {
11870 for (let i = 0; i < children.length; i++) {
11871 const child = children[i];
11872 if (child.el && child.el instanceof Element) {
11873 prevChildren.push(child);
11874 setTransitionHooks(
11875 child,
11876 resolveTransitionHooks(
11877 child,
11878 cssTransitionProps,
11879 state,
11880 instance
11881 )
11882 );
11883 positionMap.set(
11884 child,
11885 child.el.getBoundingClientRect()
11886 );
11887 }
11888 }
11889 }
11890 children = slots.default ? getTransitionRawChildren(slots.default()) : [];
11891 for (let i = 0; i < children.length; i++) {
11892 const child = children[i];
11893 if (child.key != null) {
11894 setTransitionHooks(
11895 child,
11896 resolveTransitionHooks(child, cssTransitionProps, state, instance)
11897 );
11898 } else if (child.type !== Text) {
11899 warn(`<TransitionGroup> children must be keyed.`);
11900 }
11901 }
11902 return createVNode(tag, null, children);
11903 };
11904 }
11905});
11906const TransitionGroup = TransitionGroupImpl;
11907function callPendingCbs(c) {
11908 const el = c.el;
11909 if (el[moveCbKey]) {
11910 el[moveCbKey]();
11911 }
11912 if (el[enterCbKey]) {
11913 el[enterCbKey]();
11914 }
11915}
11916function recordPosition(c) {
11917 newPositionMap.set(c, c.el.getBoundingClientRect());
11918}
11919function applyTranslation(c) {
11920 const oldPos = positionMap.get(c);
11921 const newPos = newPositionMap.get(c);
11922 const dx = oldPos.left - newPos.left;
11923 const dy = oldPos.top - newPos.top;
11924 if (dx || dy) {
11925 const s = c.el.style;
11926 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
11927 s.transitionDuration = "0s";
11928 return c;
11929 }
11930}
11931function hasCSSTransform(el, root, moveClass) {
11932 const clone = el.cloneNode();
11933 const _vtc = el[vtcKey];
11934 if (_vtc) {
11935 _vtc.forEach((cls) => {
11936 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
11937 });
11938 }
11939 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
11940 clone.style.display = "none";
11941 const container = root.nodeType === 1 ? root : root.parentNode;
11942 container.appendChild(clone);
11943 const { hasTransform } = getTransitionInfo(clone);
11944 container.removeChild(clone);
11945 return hasTransform;
11946}
11947
11948const getModelAssigner = (vnode) => {
11949 const fn = vnode.props["onUpdate:modelValue"] || false;
11950 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
11951};
11952function onCompositionStart(e) {
11953 e.target.composing = true;
11954}
11955function onCompositionEnd(e) {
11956 const target = e.target;
11957 if (target.composing) {
11958 target.composing = false;
11959 target.dispatchEvent(new Event("input"));
11960 }
11961}
11962const assignKey = Symbol("_assign");
11963const vModelText = {
11964 created(el, { modifiers: { lazy, trim, number } }, vnode) {
11965 el[assignKey] = getModelAssigner(vnode);
11966 const castToNumber = number || vnode.props && vnode.props.type === "number";
11967 addEventListener(el, lazy ? "change" : "input", (e) => {
11968 if (e.target.composing) return;
11969 let domValue = el.value;
11970 if (trim) {
11971 domValue = domValue.trim();
11972 }
11973 if (castToNumber) {
11974 domValue = looseToNumber(domValue);
11975 }
11976 el[assignKey](domValue);
11977 });
11978 if (trim) {
11979 addEventListener(el, "change", () => {
11980 el.value = el.value.trim();
11981 });
11982 }
11983 if (!lazy) {
11984 addEventListener(el, "compositionstart", onCompositionStart);
11985 addEventListener(el, "compositionend", onCompositionEnd);
11986 addEventListener(el, "change", onCompositionEnd);
11987 }
11988 },
11989 // set value on mounted so it's after min/max for type="range"
11990 mounted(el, { value }) {
11991 el.value = value == null ? "" : value;
11992 },
11993 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11994 el[assignKey] = getModelAssigner(vnode);
11995 if (el.composing) return;
11996 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
11997 const newValue = value == null ? "" : value;
11998 if (elValue === newValue) {
11999 return;
12000 }
12001 if (document.activeElement === el && el.type !== "range") {
12002 if (lazy && value === oldValue) {
12003 return;
12004 }
12005 if (trim && el.value.trim() === newValue) {
12006 return;
12007 }
12008 }
12009 el.value = newValue;
12010 }
12011};
12012const vModelCheckbox = {
12013 // #4096 array checkboxes need to be deep traversed
12014 deep: true,
12015 created(el, _, vnode) {
12016 el[assignKey] = getModelAssigner(vnode);
12017 addEventListener(el, "change", () => {
12018 const modelValue = el._modelValue;
12019 const elementValue = getValue(el);
12020 const checked = el.checked;
12021 const assign = el[assignKey];
12022 if (isArray(modelValue)) {
12023 const index = looseIndexOf(modelValue, elementValue);
12024 const found = index !== -1;
12025 if (checked && !found) {
12026 assign(modelValue.concat(elementValue));
12027 } else if (!checked && found) {
12028 const filtered = [...modelValue];
12029 filtered.splice(index, 1);
12030 assign(filtered);
12031 }
12032 } else if (isSet(modelValue)) {
12033 const cloned = new Set(modelValue);
12034 if (checked) {
12035 cloned.add(elementValue);
12036 } else {
12037 cloned.delete(elementValue);
12038 }
12039 assign(cloned);
12040 } else {
12041 assign(getCheckboxValue(el, checked));
12042 }
12043 });
12044 },
12045 // set initial checked on mount to wait for true-value/false-value
12046 mounted: setChecked,
12047 beforeUpdate(el, binding, vnode) {
12048 el[assignKey] = getModelAssigner(vnode);
12049 setChecked(el, binding, vnode);
12050 }
12051};
12052function setChecked(el, { value, oldValue }, vnode) {
12053 el._modelValue = value;
12054 let checked;
12055 if (isArray(value)) {
12056 checked = looseIndexOf(value, vnode.props.value) > -1;
12057 } else if (isSet(value)) {
12058 checked = value.has(vnode.props.value);
12059 } else {
12060 if (value === oldValue) return;
12061 checked = looseEqual(value, getCheckboxValue(el, true));
12062 }
12063 if (el.checked !== checked) {
12064 el.checked = checked;
12065 }
12066}
12067const vModelRadio = {
12068 created(el, { value }, vnode) {
12069 el.checked = looseEqual(value, vnode.props.value);
12070 el[assignKey] = getModelAssigner(vnode);
12071 addEventListener(el, "change", () => {
12072 el[assignKey](getValue(el));
12073 });
12074 },
12075 beforeUpdate(el, { value, oldValue }, vnode) {
12076 el[assignKey] = getModelAssigner(vnode);
12077 if (value !== oldValue) {
12078 el.checked = looseEqual(value, vnode.props.value);
12079 }
12080 }
12081};
12082const vModelSelect = {
12083 // <select multiple> value need to be deep traversed
12084 deep: true,
12085 created(el, { value, modifiers: { number } }, vnode) {
12086 const isSetModel = isSet(value);
12087 addEventListener(el, "change", () => {
12088 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
12089 (o) => number ? looseToNumber(getValue(o)) : getValue(o)
12090 );
12091 el[assignKey](
12092 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12093 );
12094 el._assigning = true;
12095 nextTick(() => {
12096 el._assigning = false;
12097 });
12098 });
12099 el[assignKey] = getModelAssigner(vnode);
12100 },
12101 // set value in mounted & updated because <select> relies on its children
12102 // <option>s.
12103 mounted(el, { value }) {
12104 setSelected(el, value);
12105 },
12106 beforeUpdate(el, _binding, vnode) {
12107 el[assignKey] = getModelAssigner(vnode);
12108 },
12109 updated(el, { value }) {
12110 if (!el._assigning) {
12111 setSelected(el, value);
12112 }
12113 }
12114};
12115function setSelected(el, value) {
12116 const isMultiple = el.multiple;
12117 const isArrayValue = isArray(value);
12118 if (isMultiple && !isArrayValue && !isSet(value)) {
12119 warn(
12120 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12121 );
12122 return;
12123 }
12124 for (let i = 0, l = el.options.length; i < l; i++) {
12125 const option = el.options[i];
12126 const optionValue = getValue(option);
12127 if (isMultiple) {
12128 if (isArrayValue) {
12129 const optionType = typeof optionValue;
12130 if (optionType === "string" || optionType === "number") {
12131 option.selected = value.some((v) => String(v) === String(optionValue));
12132 } else {
12133 option.selected = looseIndexOf(value, optionValue) > -1;
12134 }
12135 } else {
12136 option.selected = value.has(optionValue);
12137 }
12138 } else if (looseEqual(getValue(option), value)) {
12139 if (el.selectedIndex !== i) el.selectedIndex = i;
12140 return;
12141 }
12142 }
12143 if (!isMultiple && el.selectedIndex !== -1) {
12144 el.selectedIndex = -1;
12145 }
12146}
12147function getValue(el) {
12148 return "_value" in el ? el._value : el.value;
12149}
12150function getCheckboxValue(el, checked) {
12151 const key = checked ? "_trueValue" : "_falseValue";
12152 return key in el ? el[key] : checked;
12153}
12154const vModelDynamic = {
12155 created(el, binding, vnode) {
12156 callModelHook(el, binding, vnode, null, "created");
12157 },
12158 mounted(el, binding, vnode) {
12159 callModelHook(el, binding, vnode, null, "mounted");
12160 },
12161 beforeUpdate(el, binding, vnode, prevVNode) {
12162 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
12163 },
12164 updated(el, binding, vnode, prevVNode) {
12165 callModelHook(el, binding, vnode, prevVNode, "updated");
12166 }
12167};
12168function resolveDynamicModel(tagName, type) {
12169 switch (tagName) {
12170 case "SELECT":
12171 return vModelSelect;
12172 case "TEXTAREA":
12173 return vModelText;
12174 default:
12175 switch (type) {
12176 case "checkbox":
12177 return vModelCheckbox;
12178 case "radio":
12179 return vModelRadio;
12180 default:
12181 return vModelText;
12182 }
12183 }
12184}
12185function callModelHook(el, binding, vnode, prevVNode, hook) {
12186 const modelToUse = resolveDynamicModel(
12187 el.tagName,
12188 vnode.props && vnode.props.type
12189 );
12190 const fn = modelToUse[hook];
12191 fn && fn(el, binding, vnode, prevVNode);
12192}
12193function initVModelForSSR() {
12194 vModelText.getSSRProps = ({ value }) => ({ value });
12195 vModelRadio.getSSRProps = ({ value }, vnode) => {
12196 if (vnode.props && looseEqual(vnode.props.value, value)) {
12197 return { checked: true };
12198 }
12199 };
12200 vModelCheckbox.getSSRProps = ({ value }, vnode) => {
12201 if (isArray(value)) {
12202 if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
12203 return { checked: true };
12204 }
12205 } else if (isSet(value)) {
12206 if (vnode.props && value.has(vnode.props.value)) {
12207 return { checked: true };
12208 }
12209 } else if (value) {
12210 return { checked: true };
12211 }
12212 };
12213 vModelDynamic.getSSRProps = (binding, vnode) => {
12214 if (typeof vnode.type !== "string") {
12215 return;
12216 }
12217 const modelToUse = resolveDynamicModel(
12218 // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
12219 vnode.type.toUpperCase(),
12220 vnode.props && vnode.props.type
12221 );
12222 if (modelToUse.getSSRProps) {
12223 return modelToUse.getSSRProps(binding, vnode);
12224 }
12225 };
12226}
12227
12228const systemModifiers = ["ctrl", "shift", "alt", "meta"];
12229const modifierGuards = {
12230 stop: (e) => e.stopPropagation(),
12231 prevent: (e) => e.preventDefault(),
12232 self: (e) => e.target !== e.currentTarget,
12233 ctrl: (e) => !e.ctrlKey,
12234 shift: (e) => !e.shiftKey,
12235 alt: (e) => !e.altKey,
12236 meta: (e) => !e.metaKey,
12237 left: (e) => "button" in e && e.button !== 0,
12238 middle: (e) => "button" in e && e.button !== 1,
12239 right: (e) => "button" in e && e.button !== 2,
12240 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12241};
12242const withModifiers = (fn, modifiers) => {
12243 const cache = fn._withMods || (fn._withMods = {});
12244 const cacheKey = modifiers.join(".");
12245 return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12246 for (let i = 0; i < modifiers.length; i++) {
12247 const guard = modifierGuards[modifiers[i]];
12248 if (guard && guard(event, modifiers)) return;
12249 }
12250 return fn(event, ...args);
12251 });
12252};
12253const keyNames = {
12254 esc: "escape",
12255 space: " ",
12256 up: "arrow-up",
12257 left: "arrow-left",
12258 right: "arrow-right",
12259 down: "arrow-down",
12260 delete: "backspace"
12261};
12262const withKeys = (fn, modifiers) => {
12263 const cache = fn._withKeys || (fn._withKeys = {});
12264 const cacheKey = modifiers.join(".");
12265 return cache[cacheKey] || (cache[cacheKey] = (event) => {
12266 if (!("key" in event)) {
12267 return;
12268 }
12269 const eventKey = hyphenate(event.key);
12270 if (modifiers.some(
12271 (k) => k === eventKey || keyNames[k] === eventKey
12272 )) {
12273 return fn(event);
12274 }
12275 });
12276};
12277
12278const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
12279let renderer;
12280let enabledHydration = false;
12281function ensureRenderer() {
12282 return renderer || (renderer = createRenderer(rendererOptions));
12283}
12284function ensureHydrationRenderer() {
12285 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
12286 enabledHydration = true;
12287 return renderer;
12288}
12289const render = (...args) => {
12290 ensureRenderer().render(...args);
12291};
12292const hydrate = (...args) => {
12293 ensureHydrationRenderer().hydrate(...args);
12294};
12295const createApp = (...args) => {
12296 const app = ensureRenderer().createApp(...args);
12297 {
12298 injectNativeTagCheck(app);
12299 injectCompilerOptionsCheck(app);
12300 }
12301 const { mount } = app;
12302 app.mount = (containerOrSelector) => {
12303 const container = normalizeContainer(containerOrSelector);
12304 if (!container) return;
12305 const component = app._component;
12306 if (!isFunction(component) && !component.render && !component.template) {
12307 component.template = container.innerHTML;
12308 }
12309 if (container.nodeType === 1) {
12310 container.textContent = "";
12311 }
12312 const proxy = mount(container, false, resolveRootNamespace(container));
12313 if (container instanceof Element) {
12314 container.removeAttribute("v-cloak");
12315 container.setAttribute("data-v-app", "");
12316 }
12317 return proxy;
12318 };
12319 return app;
12320};
12321const createSSRApp = (...args) => {
12322 const app = ensureHydrationRenderer().createApp(...args);
12323 {
12324 injectNativeTagCheck(app);
12325 injectCompilerOptionsCheck(app);
12326 }
12327 const { mount } = app;
12328 app.mount = (containerOrSelector) => {
12329 const container = normalizeContainer(containerOrSelector);
12330 if (container) {
12331 return mount(container, true, resolveRootNamespace(container));
12332 }
12333 };
12334 return app;
12335};
12336function resolveRootNamespace(container) {
12337 if (container instanceof SVGElement) {
12338 return "svg";
12339 }
12340 if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
12341 return "mathml";
12342 }
12343}
12344function injectNativeTagCheck(app) {
12345 Object.defineProperty(app.config, "isNativeTag", {
12346 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
12347 writable: false
12348 });
12349}
12350function injectCompilerOptionsCheck(app) {
12351 if (isRuntimeOnly()) {
12352 const isCustomElement = app.config.isCustomElement;
12353 Object.defineProperty(app.config, "isCustomElement", {
12354 get() {
12355 return isCustomElement;
12356 },
12357 set() {
12358 warn(
12359 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
12360 );
12361 }
12362 });
12363 const compilerOptions = app.config.compilerOptions;
12364 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.
12365- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
12366- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
12367- 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`;
12368 Object.defineProperty(app.config, "compilerOptions", {
12369 get() {
12370 warn(msg);
12371 return compilerOptions;
12372 },
12373 set() {
12374 warn(msg);
12375 }
12376 });
12377 }
12378}
12379function normalizeContainer(container) {
12380 if (isString(container)) {
12381 const res = document.querySelector(container);
12382 if (!res) {
12383 warn(
12384 `Failed to mount app: mount target selector "${container}" returned null.`
12385 );
12386 }
12387 return res;
12388 }
12389 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
12390 warn(
12391 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
12392 );
12393 }
12394 return container;
12395}
12396let ssrDirectiveInitialized = false;
12397const initDirectivesForSSR = () => {
12398 if (!ssrDirectiveInitialized) {
12399 ssrDirectiveInitialized = true;
12400 initVModelForSSR();
12401 initVShowForSSR();
12402 }
12403} ;
12404
12405var runtimeDom = /*#__PURE__*/Object.freeze({
12406 __proto__: null,
12407 BaseTransition: BaseTransition,
12408 BaseTransitionPropsValidators: BaseTransitionPropsValidators,
12409 Comment: Comment,
12410 DeprecationTypes: DeprecationTypes,
12411 EffectScope: EffectScope,
12412 ErrorCodes: ErrorCodes,
12413 ErrorTypeStrings: ErrorTypeStrings,
12414 Fragment: Fragment,
12415 KeepAlive: KeepAlive,
12416 ReactiveEffect: ReactiveEffect,
12417 Static: Static,
12418 Suspense: Suspense,
12419 Teleport: Teleport,
12420 Text: Text,
12421 TrackOpTypes: TrackOpTypes,
12422 Transition: Transition,
12423 TransitionGroup: TransitionGroup,
12424 TriggerOpTypes: TriggerOpTypes,
12425 VueElement: VueElement,
12426 assertNumber: assertNumber,
12427 callWithAsyncErrorHandling: callWithAsyncErrorHandling,
12428 callWithErrorHandling: callWithErrorHandling,
12429 camelize: camelize,
12430 capitalize: capitalize,
12431 cloneVNode: cloneVNode,
12432 compatUtils: compatUtils,
12433 computed: computed,
12434 createApp: createApp,
12435 createBlock: createBlock,
12436 createCommentVNode: createCommentVNode,
12437 createElementBlock: createElementBlock,
12438 createElementVNode: createBaseVNode,
12439 createHydrationRenderer: createHydrationRenderer,
12440 createPropsRestProxy: createPropsRestProxy,
12441 createRenderer: createRenderer,
12442 createSSRApp: createSSRApp,
12443 createSlots: createSlots,
12444 createStaticVNode: createStaticVNode,
12445 createTextVNode: createTextVNode,
12446 createVNode: createVNode,
12447 customRef: customRef,
12448 defineAsyncComponent: defineAsyncComponent,
12449 defineComponent: defineComponent,
12450 defineCustomElement: defineCustomElement,
12451 defineEmits: defineEmits,
12452 defineExpose: defineExpose,
12453 defineModel: defineModel,
12454 defineOptions: defineOptions,
12455 defineProps: defineProps,
12456 defineSSRCustomElement: defineSSRCustomElement,
12457 defineSlots: defineSlots,
12458 devtools: devtools,
12459 effect: effect,
12460 effectScope: effectScope,
12461 getCurrentInstance: getCurrentInstance,
12462 getCurrentScope: getCurrentScope,
12463 getCurrentWatcher: getCurrentWatcher,
12464 getTransitionRawChildren: getTransitionRawChildren,
12465 guardReactiveProps: guardReactiveProps,
12466 h: h,
12467 handleError: handleError,
12468 hasInjectionContext: hasInjectionContext,
12469 hydrate: hydrate,
12470 hydrateOnIdle: hydrateOnIdle,
12471 hydrateOnInteraction: hydrateOnInteraction,
12472 hydrateOnMediaQuery: hydrateOnMediaQuery,
12473 hydrateOnVisible: hydrateOnVisible,
12474 initCustomFormatter: initCustomFormatter,
12475 initDirectivesForSSR: initDirectivesForSSR,
12476 inject: inject,
12477 isMemoSame: isMemoSame,
12478 isProxy: isProxy,
12479 isReactive: isReactive,
12480 isReadonly: isReadonly,
12481 isRef: isRef,
12482 isRuntimeOnly: isRuntimeOnly,
12483 isShallow: isShallow,
12484 isVNode: isVNode,
12485 markRaw: markRaw,
12486 mergeDefaults: mergeDefaults,
12487 mergeModels: mergeModels,
12488 mergeProps: mergeProps,
12489 nextTick: nextTick,
12490 normalizeClass: normalizeClass,
12491 normalizeProps: normalizeProps,
12492 normalizeStyle: normalizeStyle,
12493 onActivated: onActivated,
12494 onBeforeMount: onBeforeMount,
12495 onBeforeUnmount: onBeforeUnmount,
12496 onBeforeUpdate: onBeforeUpdate,
12497 onDeactivated: onDeactivated,
12498 onErrorCaptured: onErrorCaptured,
12499 onMounted: onMounted,
12500 onRenderTracked: onRenderTracked,
12501 onRenderTriggered: onRenderTriggered,
12502 onScopeDispose: onScopeDispose,
12503 onServerPrefetch: onServerPrefetch,
12504 onUnmounted: onUnmounted,
12505 onUpdated: onUpdated,
12506 onWatcherCleanup: onWatcherCleanup,
12507 openBlock: openBlock,
12508 popScopeId: popScopeId,
12509 provide: provide,
12510 proxyRefs: proxyRefs,
12511 pushScopeId: pushScopeId,
12512 queuePostFlushCb: queuePostFlushCb,
12513 reactive: reactive,
12514 readonly: readonly,
12515 ref: ref,
12516 registerRuntimeCompiler: registerRuntimeCompiler,
12517 render: render,
12518 renderList: renderList,
12519 renderSlot: renderSlot,
12520 resolveComponent: resolveComponent,
12521 resolveDirective: resolveDirective,
12522 resolveDynamicComponent: resolveDynamicComponent,
12523 resolveFilter: resolveFilter,
12524 resolveTransitionHooks: resolveTransitionHooks,
12525 setBlockTracking: setBlockTracking,
12526 setDevtoolsHook: setDevtoolsHook,
12527 setTransitionHooks: setTransitionHooks,
12528 shallowReactive: shallowReactive,
12529 shallowReadonly: shallowReadonly,
12530 shallowRef: shallowRef,
12531 ssrContextKey: ssrContextKey,
12532 ssrUtils: ssrUtils,
12533 stop: stop,
12534 toDisplayString: toDisplayString,
12535 toHandlerKey: toHandlerKey,
12536 toHandlers: toHandlers,
12537 toRaw: toRaw,
12538 toRef: toRef,
12539 toRefs: toRefs,
12540 toValue: toValue,
12541 transformVNodeArgs: transformVNodeArgs,
12542 triggerRef: triggerRef,
12543 unref: unref,
12544 useAttrs: useAttrs,
12545 useCssModule: useCssModule,
12546 useCssVars: useCssVars,
12547 useHost: useHost,
12548 useId: useId,
12549 useModel: useModel,
12550 useSSRContext: useSSRContext,
12551 useShadowRoot: useShadowRoot,
12552 useSlots: useSlots,
12553 useTemplateRef: useTemplateRef,
12554 useTransitionState: useTransitionState,
12555 vModelCheckbox: vModelCheckbox,
12556 vModelDynamic: vModelDynamic,
12557 vModelRadio: vModelRadio,
12558 vModelSelect: vModelSelect,
12559 vModelText: vModelText,
12560 vShow: vShow,
12561 version: version,
12562 warn: warn,
12563 watch: watch,
12564 watchEffect: watchEffect,
12565 watchPostEffect: watchPostEffect,
12566 watchSyncEffect: watchSyncEffect,
12567 withAsyncContext: withAsyncContext,
12568 withCtx: withCtx,
12569 withDefaults: withDefaults,
12570 withDirectives: withDirectives,
12571 withKeys: withKeys,
12572 withMemo: withMemo,
12573 withModifiers: withModifiers,
12574 withScopeId: withScopeId
12575});
12576
12577function initDev() {
12578 {
12579 {
12580 console.info(
12581 `You are running a development build of Vue.
12582Make sure to use the production build (*.prod.js) when deploying for production.`
12583 );
12584 }
12585 initCustomFormatter();
12586 }
12587}
12588
12589const FRAGMENT = Symbol(`Fragment` );
12590const TELEPORT = Symbol(`Teleport` );
12591const SUSPENSE = Symbol(`Suspense` );
12592const KEEP_ALIVE = Symbol(`KeepAlive` );
12593const BASE_TRANSITION = Symbol(
12594 `BaseTransition`
12595);
12596const OPEN_BLOCK = Symbol(`openBlock` );
12597const CREATE_BLOCK = Symbol(`createBlock` );
12598const CREATE_ELEMENT_BLOCK = Symbol(
12599 `createElementBlock`
12600);
12601const CREATE_VNODE = Symbol(`createVNode` );
12602const CREATE_ELEMENT_VNODE = Symbol(
12603 `createElementVNode`
12604);
12605const CREATE_COMMENT = Symbol(
12606 `createCommentVNode`
12607);
12608const CREATE_TEXT = Symbol(
12609 `createTextVNode`
12610);
12611const CREATE_STATIC = Symbol(
12612 `createStaticVNode`
12613);
12614const RESOLVE_COMPONENT = Symbol(
12615 `resolveComponent`
12616);
12617const RESOLVE_DYNAMIC_COMPONENT = Symbol(
12618 `resolveDynamicComponent`
12619);
12620const RESOLVE_DIRECTIVE = Symbol(
12621 `resolveDirective`
12622);
12623const RESOLVE_FILTER = Symbol(
12624 `resolveFilter`
12625);
12626const WITH_DIRECTIVES = Symbol(
12627 `withDirectives`
12628);
12629const RENDER_LIST = Symbol(`renderList` );
12630const RENDER_SLOT = Symbol(`renderSlot` );
12631const CREATE_SLOTS = Symbol(`createSlots` );
12632const TO_DISPLAY_STRING = Symbol(
12633 `toDisplayString`
12634);
12635const MERGE_PROPS = Symbol(`mergeProps` );
12636const NORMALIZE_CLASS = Symbol(
12637 `normalizeClass`
12638);
12639const NORMALIZE_STYLE = Symbol(
12640 `normalizeStyle`
12641);
12642const NORMALIZE_PROPS = Symbol(
12643 `normalizeProps`
12644);
12645const GUARD_REACTIVE_PROPS = Symbol(
12646 `guardReactiveProps`
12647);
12648const TO_HANDLERS = Symbol(`toHandlers` );
12649const CAMELIZE = Symbol(`camelize` );
12650const CAPITALIZE = Symbol(`capitalize` );
12651const TO_HANDLER_KEY = Symbol(
12652 `toHandlerKey`
12653);
12654const SET_BLOCK_TRACKING = Symbol(
12655 `setBlockTracking`
12656);
12657const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
12658const POP_SCOPE_ID = Symbol(`popScopeId` );
12659const WITH_CTX = Symbol(`withCtx` );
12660const UNREF = Symbol(`unref` );
12661const IS_REF = Symbol(`isRef` );
12662const WITH_MEMO = Symbol(`withMemo` );
12663const IS_MEMO_SAME = Symbol(`isMemoSame` );
12664const helperNameMap = {
12665 [FRAGMENT]: `Fragment`,
12666 [TELEPORT]: `Teleport`,
12667 [SUSPENSE]: `Suspense`,
12668 [KEEP_ALIVE]: `KeepAlive`,
12669 [BASE_TRANSITION]: `BaseTransition`,
12670 [OPEN_BLOCK]: `openBlock`,
12671 [CREATE_BLOCK]: `createBlock`,
12672 [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
12673 [CREATE_VNODE]: `createVNode`,
12674 [CREATE_ELEMENT_VNODE]: `createElementVNode`,
12675 [CREATE_COMMENT]: `createCommentVNode`,
12676 [CREATE_TEXT]: `createTextVNode`,
12677 [CREATE_STATIC]: `createStaticVNode`,
12678 [RESOLVE_COMPONENT]: `resolveComponent`,
12679 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
12680 [RESOLVE_DIRECTIVE]: `resolveDirective`,
12681 [RESOLVE_FILTER]: `resolveFilter`,
12682 [WITH_DIRECTIVES]: `withDirectives`,
12683 [RENDER_LIST]: `renderList`,
12684 [RENDER_SLOT]: `renderSlot`,
12685 [CREATE_SLOTS]: `createSlots`,
12686 [TO_DISPLAY_STRING]: `toDisplayString`,
12687 [MERGE_PROPS]: `mergeProps`,
12688 [NORMALIZE_CLASS]: `normalizeClass`,
12689 [NORMALIZE_STYLE]: `normalizeStyle`,
12690 [NORMALIZE_PROPS]: `normalizeProps`,
12691 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
12692 [TO_HANDLERS]: `toHandlers`,
12693 [CAMELIZE]: `camelize`,
12694 [CAPITALIZE]: `capitalize`,
12695 [TO_HANDLER_KEY]: `toHandlerKey`,
12696 [SET_BLOCK_TRACKING]: `setBlockTracking`,
12697 [PUSH_SCOPE_ID]: `pushScopeId`,
12698 [POP_SCOPE_ID]: `popScopeId`,
12699 [WITH_CTX]: `withCtx`,
12700 [UNREF]: `unref`,
12701 [IS_REF]: `isRef`,
12702 [WITH_MEMO]: `withMemo`,
12703 [IS_MEMO_SAME]: `isMemoSame`
12704};
12705function registerRuntimeHelpers(helpers) {
12706 Object.getOwnPropertySymbols(helpers).forEach((s) => {
12707 helperNameMap[s] = helpers[s];
12708 });
12709}
12710
12711const locStub = {
12712 start: { line: 1, column: 1, offset: 0 },
12713 end: { line: 1, column: 1, offset: 0 },
12714 source: ""
12715};
12716function createRoot(children, source = "") {
12717 return {
12718 type: 0,
12719 source,
12720 children,
12721 helpers: /* @__PURE__ */ new Set(),
12722 components: [],
12723 directives: [],
12724 hoists: [],
12725 imports: [],
12726 cached: [],
12727 temps: 0,
12728 codegenNode: void 0,
12729 loc: locStub
12730 };
12731}
12732function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
12733 if (context) {
12734 if (isBlock) {
12735 context.helper(OPEN_BLOCK);
12736 context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
12737 } else {
12738 context.helper(getVNodeHelper(context.inSSR, isComponent));
12739 }
12740 if (directives) {
12741 context.helper(WITH_DIRECTIVES);
12742 }
12743 }
12744 return {
12745 type: 13,
12746 tag,
12747 props,
12748 children,
12749 patchFlag,
12750 dynamicProps,
12751 directives,
12752 isBlock,
12753 disableTracking,
12754 isComponent,
12755 loc
12756 };
12757}
12758function createArrayExpression(elements, loc = locStub) {
12759 return {
12760 type: 17,
12761 loc,
12762 elements
12763 };
12764}
12765function createObjectExpression(properties, loc = locStub) {
12766 return {
12767 type: 15,
12768 loc,
12769 properties
12770 };
12771}
12772function createObjectProperty(key, value) {
12773 return {
12774 type: 16,
12775 loc: locStub,
12776 key: isString(key) ? createSimpleExpression(key, true) : key,
12777 value
12778 };
12779}
12780function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
12781 return {
12782 type: 4,
12783 loc,
12784 content,
12785 isStatic,
12786 constType: isStatic ? 3 : constType
12787 };
12788}
12789function createCompoundExpression(children, loc = locStub) {
12790 return {
12791 type: 8,
12792 loc,
12793 children
12794 };
12795}
12796function createCallExpression(callee, args = [], loc = locStub) {
12797 return {
12798 type: 14,
12799 loc,
12800 callee,
12801 arguments: args
12802 };
12803}
12804function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
12805 return {
12806 type: 18,
12807 params,
12808 returns,
12809 newline,
12810 isSlot,
12811 loc
12812 };
12813}
12814function createConditionalExpression(test, consequent, alternate, newline = true) {
12815 return {
12816 type: 19,
12817 test,
12818 consequent,
12819 alternate,
12820 newline,
12821 loc: locStub
12822 };
12823}
12824function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
12825 return {
12826 type: 20,
12827 index,
12828 value,
12829 needPauseTracking,
12830 inVOnce,
12831 needArraySpread: false,
12832 loc: locStub
12833 };
12834}
12835function createBlockStatement(body) {
12836 return {
12837 type: 21,
12838 body,
12839 loc: locStub
12840 };
12841}
12842function getVNodeHelper(ssr, isComponent) {
12843 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
12844}
12845function getVNodeBlockHelper(ssr, isComponent) {
12846 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
12847}
12848function convertToBlock(node, { helper, removeHelper, inSSR }) {
12849 if (!node.isBlock) {
12850 node.isBlock = true;
12851 removeHelper(getVNodeHelper(inSSR, node.isComponent));
12852 helper(OPEN_BLOCK);
12853 helper(getVNodeBlockHelper(inSSR, node.isComponent));
12854 }
12855}
12856
12857const defaultDelimitersOpen = new Uint8Array([123, 123]);
12858const defaultDelimitersClose = new Uint8Array([125, 125]);
12859function isTagStartChar(c) {
12860 return c >= 97 && c <= 122 || c >= 65 && c <= 90;
12861}
12862function isWhitespace(c) {
12863 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
12864}
12865function isEndOfTagSection(c) {
12866 return c === 47 || c === 62 || isWhitespace(c);
12867}
12868function toCharCodes(str) {
12869 const ret = new Uint8Array(str.length);
12870 for (let i = 0; i < str.length; i++) {
12871 ret[i] = str.charCodeAt(i);
12872 }
12873 return ret;
12874}
12875const Sequences = {
12876 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
12877 // CDATA[
12878 CdataEnd: new Uint8Array([93, 93, 62]),
12879 // ]]>
12880 CommentEnd: new Uint8Array([45, 45, 62]),
12881 // `-->`
12882 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
12883 // `<\/script`
12884 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
12885 // `</style`
12886 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
12887 // `</title`
12888 TextareaEnd: new Uint8Array([
12889 60,
12890 47,
12891 116,
12892 101,
12893 120,
12894 116,
12895 97,
12896 114,
12897 101,
12898 97
12899 ])
12900 // `</textarea
12901};
12902class Tokenizer {
12903 constructor(stack, cbs) {
12904 this.stack = stack;
12905 this.cbs = cbs;
12906 /** The current state the tokenizer is in. */
12907 this.state = 1;
12908 /** The read buffer. */
12909 this.buffer = "";
12910 /** The beginning of the section that is currently being read. */
12911 this.sectionStart = 0;
12912 /** The index within the buffer that we are currently looking at. */
12913 this.index = 0;
12914 /** The start of the last entity. */
12915 this.entityStart = 0;
12916 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
12917 this.baseState = 1;
12918 /** For special parsing behavior inside of script and style tags. */
12919 this.inRCDATA = false;
12920 /** For disabling RCDATA tags handling */
12921 this.inXML = false;
12922 /** For disabling interpolation parsing in v-pre */
12923 this.inVPre = false;
12924 /** Record newline positions for fast line / column calculation */
12925 this.newlines = [];
12926 this.mode = 0;
12927 this.delimiterOpen = defaultDelimitersOpen;
12928 this.delimiterClose = defaultDelimitersClose;
12929 this.delimiterIndex = -1;
12930 this.currentSequence = void 0;
12931 this.sequenceIndex = 0;
12932 }
12933 get inSFCRoot() {
12934 return this.mode === 2 && this.stack.length === 0;
12935 }
12936 reset() {
12937 this.state = 1;
12938 this.mode = 0;
12939 this.buffer = "";
12940 this.sectionStart = 0;
12941 this.index = 0;
12942 this.baseState = 1;
12943 this.inRCDATA = false;
12944 this.currentSequence = void 0;
12945 this.newlines.length = 0;
12946 this.delimiterOpen = defaultDelimitersOpen;
12947 this.delimiterClose = defaultDelimitersClose;
12948 }
12949 /**
12950 * Generate Position object with line / column information using recorded
12951 * newline positions. We know the index is always going to be an already
12952 * processed index, so all the newlines up to this index should have been
12953 * recorded.
12954 */
12955 getPos(index) {
12956 let line = 1;
12957 let column = index + 1;
12958 for (let i = this.newlines.length - 1; i >= 0; i--) {
12959 const newlineIndex = this.newlines[i];
12960 if (index > newlineIndex) {
12961 line = i + 2;
12962 column = index - newlineIndex;
12963 break;
12964 }
12965 }
12966 return {
12967 column,
12968 line,
12969 offset: index
12970 };
12971 }
12972 peek() {
12973 return this.buffer.charCodeAt(this.index + 1);
12974 }
12975 stateText(c) {
12976 if (c === 60) {
12977 if (this.index > this.sectionStart) {
12978 this.cbs.ontext(this.sectionStart, this.index);
12979 }
12980 this.state = 5;
12981 this.sectionStart = this.index;
12982 } else if (!this.inVPre && c === this.delimiterOpen[0]) {
12983 this.state = 2;
12984 this.delimiterIndex = 0;
12985 this.stateInterpolationOpen(c);
12986 }
12987 }
12988 stateInterpolationOpen(c) {
12989 if (c === this.delimiterOpen[this.delimiterIndex]) {
12990 if (this.delimiterIndex === this.delimiterOpen.length - 1) {
12991 const start = this.index + 1 - this.delimiterOpen.length;
12992 if (start > this.sectionStart) {
12993 this.cbs.ontext(this.sectionStart, start);
12994 }
12995 this.state = 3;
12996 this.sectionStart = start;
12997 } else {
12998 this.delimiterIndex++;
12999 }
13000 } else if (this.inRCDATA) {
13001 this.state = 32;
13002 this.stateInRCDATA(c);
13003 } else {
13004 this.state = 1;
13005 this.stateText(c);
13006 }
13007 }
13008 stateInterpolation(c) {
13009 if (c === this.delimiterClose[0]) {
13010 this.state = 4;
13011 this.delimiterIndex = 0;
13012 this.stateInterpolationClose(c);
13013 }
13014 }
13015 stateInterpolationClose(c) {
13016 if (c === this.delimiterClose[this.delimiterIndex]) {
13017 if (this.delimiterIndex === this.delimiterClose.length - 1) {
13018 this.cbs.oninterpolation(this.sectionStart, this.index + 1);
13019 if (this.inRCDATA) {
13020 this.state = 32;
13021 } else {
13022 this.state = 1;
13023 }
13024 this.sectionStart = this.index + 1;
13025 } else {
13026 this.delimiterIndex++;
13027 }
13028 } else {
13029 this.state = 3;
13030 this.stateInterpolation(c);
13031 }
13032 }
13033 stateSpecialStartSequence(c) {
13034 const isEnd = this.sequenceIndex === this.currentSequence.length;
13035 const isMatch = isEnd ? (
13036 // If we are at the end of the sequence, make sure the tag name has ended
13037 isEndOfTagSection(c)
13038 ) : (
13039 // Otherwise, do a case-insensitive comparison
13040 (c | 32) === this.currentSequence[this.sequenceIndex]
13041 );
13042 if (!isMatch) {
13043 this.inRCDATA = false;
13044 } else if (!isEnd) {
13045 this.sequenceIndex++;
13046 return;
13047 }
13048 this.sequenceIndex = 0;
13049 this.state = 6;
13050 this.stateInTagName(c);
13051 }
13052 /** Look for an end tag. For <title> and <textarea>, also decode entities. */
13053 stateInRCDATA(c) {
13054 if (this.sequenceIndex === this.currentSequence.length) {
13055 if (c === 62 || isWhitespace(c)) {
13056 const endOfText = this.index - this.currentSequence.length;
13057 if (this.sectionStart < endOfText) {
13058 const actualIndex = this.index;
13059 this.index = endOfText;
13060 this.cbs.ontext(this.sectionStart, endOfText);
13061 this.index = actualIndex;
13062 }
13063 this.sectionStart = endOfText + 2;
13064 this.stateInClosingTagName(c);
13065 this.inRCDATA = false;
13066 return;
13067 }
13068 this.sequenceIndex = 0;
13069 }
13070 if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
13071 this.sequenceIndex += 1;
13072 } else if (this.sequenceIndex === 0) {
13073 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
13074 if (!this.inVPre && c === this.delimiterOpen[0]) {
13075 this.state = 2;
13076 this.delimiterIndex = 0;
13077 this.stateInterpolationOpen(c);
13078 }
13079 } else if (this.fastForwardTo(60)) {
13080 this.sequenceIndex = 1;
13081 }
13082 } else {
13083 this.sequenceIndex = Number(c === 60);
13084 }
13085 }
13086 stateCDATASequence(c) {
13087 if (c === Sequences.Cdata[this.sequenceIndex]) {
13088 if (++this.sequenceIndex === Sequences.Cdata.length) {
13089 this.state = 28;
13090 this.currentSequence = Sequences.CdataEnd;
13091 this.sequenceIndex = 0;
13092 this.sectionStart = this.index + 1;
13093 }
13094 } else {
13095 this.sequenceIndex = 0;
13096 this.state = 23;
13097 this.stateInDeclaration(c);
13098 }
13099 }
13100 /**
13101 * When we wait for one specific character, we can speed things up
13102 * by skipping through the buffer until we find it.
13103 *
13104 * @returns Whether the character was found.
13105 */
13106 fastForwardTo(c) {
13107 while (++this.index < this.buffer.length) {
13108 const cc = this.buffer.charCodeAt(this.index);
13109 if (cc === 10) {
13110 this.newlines.push(this.index);
13111 }
13112 if (cc === c) {
13113 return true;
13114 }
13115 }
13116 this.index = this.buffer.length - 1;
13117 return false;
13118 }
13119 /**
13120 * Comments and CDATA end with `-->` and `]]>`.
13121 *
13122 * Their common qualities are:
13123 * - Their end sequences have a distinct character they start with.
13124 * - That character is then repeated, so we have to check multiple repeats.
13125 * - All characters but the start character of the sequence can be skipped.
13126 */
13127 stateInCommentLike(c) {
13128 if (c === this.currentSequence[this.sequenceIndex]) {
13129 if (++this.sequenceIndex === this.currentSequence.length) {
13130 if (this.currentSequence === Sequences.CdataEnd) {
13131 this.cbs.oncdata(this.sectionStart, this.index - 2);
13132 } else {
13133 this.cbs.oncomment(this.sectionStart, this.index - 2);
13134 }
13135 this.sequenceIndex = 0;
13136 this.sectionStart = this.index + 1;
13137 this.state = 1;
13138 }
13139 } else if (this.sequenceIndex === 0) {
13140 if (this.fastForwardTo(this.currentSequence[0])) {
13141 this.sequenceIndex = 1;
13142 }
13143 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
13144 this.sequenceIndex = 0;
13145 }
13146 }
13147 startSpecial(sequence, offset) {
13148 this.enterRCDATA(sequence, offset);
13149 this.state = 31;
13150 }
13151 enterRCDATA(sequence, offset) {
13152 this.inRCDATA = true;
13153 this.currentSequence = sequence;
13154 this.sequenceIndex = offset;
13155 }
13156 stateBeforeTagName(c) {
13157 if (c === 33) {
13158 this.state = 22;
13159 this.sectionStart = this.index + 1;
13160 } else if (c === 63) {
13161 this.state = 24;
13162 this.sectionStart = this.index + 1;
13163 } else if (isTagStartChar(c)) {
13164 this.sectionStart = this.index;
13165 if (this.mode === 0) {
13166 this.state = 6;
13167 } else if (this.inSFCRoot) {
13168 this.state = 34;
13169 } else if (!this.inXML) {
13170 if (c === 116) {
13171 this.state = 30;
13172 } else {
13173 this.state = c === 115 ? 29 : 6;
13174 }
13175 } else {
13176 this.state = 6;
13177 }
13178 } else if (c === 47) {
13179 this.state = 8;
13180 } else {
13181 this.state = 1;
13182 this.stateText(c);
13183 }
13184 }
13185 stateInTagName(c) {
13186 if (isEndOfTagSection(c)) {
13187 this.handleTagName(c);
13188 }
13189 }
13190 stateInSFCRootTagName(c) {
13191 if (isEndOfTagSection(c)) {
13192 const tag = this.buffer.slice(this.sectionStart, this.index);
13193 if (tag !== "template") {
13194 this.enterRCDATA(toCharCodes(`</` + tag), 0);
13195 }
13196 this.handleTagName(c);
13197 }
13198 }
13199 handleTagName(c) {
13200 this.cbs.onopentagname(this.sectionStart, this.index);
13201 this.sectionStart = -1;
13202 this.state = 11;
13203 this.stateBeforeAttrName(c);
13204 }
13205 stateBeforeClosingTagName(c) {
13206 if (isWhitespace(c)) ; else if (c === 62) {
13207 {
13208 this.cbs.onerr(14, this.index);
13209 }
13210 this.state = 1;
13211 this.sectionStart = this.index + 1;
13212 } else {
13213 this.state = isTagStartChar(c) ? 9 : 27;
13214 this.sectionStart = this.index;
13215 }
13216 }
13217 stateInClosingTagName(c) {
13218 if (c === 62 || isWhitespace(c)) {
13219 this.cbs.onclosetag(this.sectionStart, this.index);
13220 this.sectionStart = -1;
13221 this.state = 10;
13222 this.stateAfterClosingTagName(c);
13223 }
13224 }
13225 stateAfterClosingTagName(c) {
13226 if (c === 62) {
13227 this.state = 1;
13228 this.sectionStart = this.index + 1;
13229 }
13230 }
13231 stateBeforeAttrName(c) {
13232 if (c === 62) {
13233 this.cbs.onopentagend(this.index);
13234 if (this.inRCDATA) {
13235 this.state = 32;
13236 } else {
13237 this.state = 1;
13238 }
13239 this.sectionStart = this.index + 1;
13240 } else if (c === 47) {
13241 this.state = 7;
13242 if (this.peek() !== 62) {
13243 this.cbs.onerr(22, this.index);
13244 }
13245 } else if (c === 60 && this.peek() === 47) {
13246 this.cbs.onopentagend(this.index);
13247 this.state = 5;
13248 this.sectionStart = this.index;
13249 } else if (!isWhitespace(c)) {
13250 if (c === 61) {
13251 this.cbs.onerr(
13252 19,
13253 this.index
13254 );
13255 }
13256 this.handleAttrStart(c);
13257 }
13258 }
13259 handleAttrStart(c) {
13260 if (c === 118 && this.peek() === 45) {
13261 this.state = 13;
13262 this.sectionStart = this.index;
13263 } else if (c === 46 || c === 58 || c === 64 || c === 35) {
13264 this.cbs.ondirname(this.index, this.index + 1);
13265 this.state = 14;
13266 this.sectionStart = this.index + 1;
13267 } else {
13268 this.state = 12;
13269 this.sectionStart = this.index;
13270 }
13271 }
13272 stateInSelfClosingTag(c) {
13273 if (c === 62) {
13274 this.cbs.onselfclosingtag(this.index);
13275 this.state = 1;
13276 this.sectionStart = this.index + 1;
13277 this.inRCDATA = false;
13278 } else if (!isWhitespace(c)) {
13279 this.state = 11;
13280 this.stateBeforeAttrName(c);
13281 }
13282 }
13283 stateInAttrName(c) {
13284 if (c === 61 || isEndOfTagSection(c)) {
13285 this.cbs.onattribname(this.sectionStart, this.index);
13286 this.handleAttrNameEnd(c);
13287 } else if (c === 34 || c === 39 || c === 60) {
13288 this.cbs.onerr(
13289 17,
13290 this.index
13291 );
13292 }
13293 }
13294 stateInDirName(c) {
13295 if (c === 61 || isEndOfTagSection(c)) {
13296 this.cbs.ondirname(this.sectionStart, this.index);
13297 this.handleAttrNameEnd(c);
13298 } else if (c === 58) {
13299 this.cbs.ondirname(this.sectionStart, this.index);
13300 this.state = 14;
13301 this.sectionStart = this.index + 1;
13302 } else if (c === 46) {
13303 this.cbs.ondirname(this.sectionStart, this.index);
13304 this.state = 16;
13305 this.sectionStart = this.index + 1;
13306 }
13307 }
13308 stateInDirArg(c) {
13309 if (c === 61 || isEndOfTagSection(c)) {
13310 this.cbs.ondirarg(this.sectionStart, this.index);
13311 this.handleAttrNameEnd(c);
13312 } else if (c === 91) {
13313 this.state = 15;
13314 } else if (c === 46) {
13315 this.cbs.ondirarg(this.sectionStart, this.index);
13316 this.state = 16;
13317 this.sectionStart = this.index + 1;
13318 }
13319 }
13320 stateInDynamicDirArg(c) {
13321 if (c === 93) {
13322 this.state = 14;
13323 } else if (c === 61 || isEndOfTagSection(c)) {
13324 this.cbs.ondirarg(this.sectionStart, this.index + 1);
13325 this.handleAttrNameEnd(c);
13326 {
13327 this.cbs.onerr(
13328 27,
13329 this.index
13330 );
13331 }
13332 }
13333 }
13334 stateInDirModifier(c) {
13335 if (c === 61 || isEndOfTagSection(c)) {
13336 this.cbs.ondirmodifier(this.sectionStart, this.index);
13337 this.handleAttrNameEnd(c);
13338 } else if (c === 46) {
13339 this.cbs.ondirmodifier(this.sectionStart, this.index);
13340 this.sectionStart = this.index + 1;
13341 }
13342 }
13343 handleAttrNameEnd(c) {
13344 this.sectionStart = this.index;
13345 this.state = 17;
13346 this.cbs.onattribnameend(this.index);
13347 this.stateAfterAttrName(c);
13348 }
13349 stateAfterAttrName(c) {
13350 if (c === 61) {
13351 this.state = 18;
13352 } else if (c === 47 || c === 62) {
13353 this.cbs.onattribend(0, this.sectionStart);
13354 this.sectionStart = -1;
13355 this.state = 11;
13356 this.stateBeforeAttrName(c);
13357 } else if (!isWhitespace(c)) {
13358 this.cbs.onattribend(0, this.sectionStart);
13359 this.handleAttrStart(c);
13360 }
13361 }
13362 stateBeforeAttrValue(c) {
13363 if (c === 34) {
13364 this.state = 19;
13365 this.sectionStart = this.index + 1;
13366 } else if (c === 39) {
13367 this.state = 20;
13368 this.sectionStart = this.index + 1;
13369 } else if (!isWhitespace(c)) {
13370 this.sectionStart = this.index;
13371 this.state = 21;
13372 this.stateInAttrValueNoQuotes(c);
13373 }
13374 }
13375 handleInAttrValue(c, quote) {
13376 if (c === quote || this.fastForwardTo(quote)) {
13377 this.cbs.onattribdata(this.sectionStart, this.index);
13378 this.sectionStart = -1;
13379 this.cbs.onattribend(
13380 quote === 34 ? 3 : 2,
13381 this.index + 1
13382 );
13383 this.state = 11;
13384 }
13385 }
13386 stateInAttrValueDoubleQuotes(c) {
13387 this.handleInAttrValue(c, 34);
13388 }
13389 stateInAttrValueSingleQuotes(c) {
13390 this.handleInAttrValue(c, 39);
13391 }
13392 stateInAttrValueNoQuotes(c) {
13393 if (isWhitespace(c) || c === 62) {
13394 this.cbs.onattribdata(this.sectionStart, this.index);
13395 this.sectionStart = -1;
13396 this.cbs.onattribend(1, this.index);
13397 this.state = 11;
13398 this.stateBeforeAttrName(c);
13399 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13400 this.cbs.onerr(
13401 18,
13402 this.index
13403 );
13404 } else ;
13405 }
13406 stateBeforeDeclaration(c) {
13407 if (c === 91) {
13408 this.state = 26;
13409 this.sequenceIndex = 0;
13410 } else {
13411 this.state = c === 45 ? 25 : 23;
13412 }
13413 }
13414 stateInDeclaration(c) {
13415 if (c === 62 || this.fastForwardTo(62)) {
13416 this.state = 1;
13417 this.sectionStart = this.index + 1;
13418 }
13419 }
13420 stateInProcessingInstruction(c) {
13421 if (c === 62 || this.fastForwardTo(62)) {
13422 this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13423 this.state = 1;
13424 this.sectionStart = this.index + 1;
13425 }
13426 }
13427 stateBeforeComment(c) {
13428 if (c === 45) {
13429 this.state = 28;
13430 this.currentSequence = Sequences.CommentEnd;
13431 this.sequenceIndex = 2;
13432 this.sectionStart = this.index + 1;
13433 } else {
13434 this.state = 23;
13435 }
13436 }
13437 stateInSpecialComment(c) {
13438 if (c === 62 || this.fastForwardTo(62)) {
13439 this.cbs.oncomment(this.sectionStart, this.index);
13440 this.state = 1;
13441 this.sectionStart = this.index + 1;
13442 }
13443 }
13444 stateBeforeSpecialS(c) {
13445 if (c === Sequences.ScriptEnd[3]) {
13446 this.startSpecial(Sequences.ScriptEnd, 4);
13447 } else if (c === Sequences.StyleEnd[3]) {
13448 this.startSpecial(Sequences.StyleEnd, 4);
13449 } else {
13450 this.state = 6;
13451 this.stateInTagName(c);
13452 }
13453 }
13454 stateBeforeSpecialT(c) {
13455 if (c === Sequences.TitleEnd[3]) {
13456 this.startSpecial(Sequences.TitleEnd, 4);
13457 } else if (c === Sequences.TextareaEnd[3]) {
13458 this.startSpecial(Sequences.TextareaEnd, 4);
13459 } else {
13460 this.state = 6;
13461 this.stateInTagName(c);
13462 }
13463 }
13464 startEntity() {
13465 }
13466 stateInEntity() {
13467 }
13468 /**
13469 * Iterates through the buffer, calling the function corresponding to the current state.
13470 *
13471 * States that are more likely to be hit are higher up, as a performance improvement.
13472 */
13473 parse(input) {
13474 this.buffer = input;
13475 while (this.index < this.buffer.length) {
13476 const c = this.buffer.charCodeAt(this.index);
13477 if (c === 10) {
13478 this.newlines.push(this.index);
13479 }
13480 switch (this.state) {
13481 case 1: {
13482 this.stateText(c);
13483 break;
13484 }
13485 case 2: {
13486 this.stateInterpolationOpen(c);
13487 break;
13488 }
13489 case 3: {
13490 this.stateInterpolation(c);
13491 break;
13492 }
13493 case 4: {
13494 this.stateInterpolationClose(c);
13495 break;
13496 }
13497 case 31: {
13498 this.stateSpecialStartSequence(c);
13499 break;
13500 }
13501 case 32: {
13502 this.stateInRCDATA(c);
13503 break;
13504 }
13505 case 26: {
13506 this.stateCDATASequence(c);
13507 break;
13508 }
13509 case 19: {
13510 this.stateInAttrValueDoubleQuotes(c);
13511 break;
13512 }
13513 case 12: {
13514 this.stateInAttrName(c);
13515 break;
13516 }
13517 case 13: {
13518 this.stateInDirName(c);
13519 break;
13520 }
13521 case 14: {
13522 this.stateInDirArg(c);
13523 break;
13524 }
13525 case 15: {
13526 this.stateInDynamicDirArg(c);
13527 break;
13528 }
13529 case 16: {
13530 this.stateInDirModifier(c);
13531 break;
13532 }
13533 case 28: {
13534 this.stateInCommentLike(c);
13535 break;
13536 }
13537 case 27: {
13538 this.stateInSpecialComment(c);
13539 break;
13540 }
13541 case 11: {
13542 this.stateBeforeAttrName(c);
13543 break;
13544 }
13545 case 6: {
13546 this.stateInTagName(c);
13547 break;
13548 }
13549 case 34: {
13550 this.stateInSFCRootTagName(c);
13551 break;
13552 }
13553 case 9: {
13554 this.stateInClosingTagName(c);
13555 break;
13556 }
13557 case 5: {
13558 this.stateBeforeTagName(c);
13559 break;
13560 }
13561 case 17: {
13562 this.stateAfterAttrName(c);
13563 break;
13564 }
13565 case 20: {
13566 this.stateInAttrValueSingleQuotes(c);
13567 break;
13568 }
13569 case 18: {
13570 this.stateBeforeAttrValue(c);
13571 break;
13572 }
13573 case 8: {
13574 this.stateBeforeClosingTagName(c);
13575 break;
13576 }
13577 case 10: {
13578 this.stateAfterClosingTagName(c);
13579 break;
13580 }
13581 case 29: {
13582 this.stateBeforeSpecialS(c);
13583 break;
13584 }
13585 case 30: {
13586 this.stateBeforeSpecialT(c);
13587 break;
13588 }
13589 case 21: {
13590 this.stateInAttrValueNoQuotes(c);
13591 break;
13592 }
13593 case 7: {
13594 this.stateInSelfClosingTag(c);
13595 break;
13596 }
13597 case 23: {
13598 this.stateInDeclaration(c);
13599 break;
13600 }
13601 case 22: {
13602 this.stateBeforeDeclaration(c);
13603 break;
13604 }
13605 case 25: {
13606 this.stateBeforeComment(c);
13607 break;
13608 }
13609 case 24: {
13610 this.stateInProcessingInstruction(c);
13611 break;
13612 }
13613 case 33: {
13614 this.stateInEntity();
13615 break;
13616 }
13617 }
13618 this.index++;
13619 }
13620 this.cleanup();
13621 this.finish();
13622 }
13623 /**
13624 * Remove data that has already been consumed from the buffer.
13625 */
13626 cleanup() {
13627 if (this.sectionStart !== this.index) {
13628 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13629 this.cbs.ontext(this.sectionStart, this.index);
13630 this.sectionStart = this.index;
13631 } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13632 this.cbs.onattribdata(this.sectionStart, this.index);
13633 this.sectionStart = this.index;
13634 }
13635 }
13636 }
13637 finish() {
13638 this.handleTrailingData();
13639 this.cbs.onend();
13640 }
13641 /** Handle any trailing data. */
13642 handleTrailingData() {
13643 const endIndex = this.buffer.length;
13644 if (this.sectionStart >= endIndex) {
13645 return;
13646 }
13647 if (this.state === 28) {
13648 if (this.currentSequence === Sequences.CdataEnd) {
13649 this.cbs.oncdata(this.sectionStart, endIndex);
13650 } else {
13651 this.cbs.oncomment(this.sectionStart, endIndex);
13652 }
13653 } 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 {
13654 this.cbs.ontext(this.sectionStart, endIndex);
13655 }
13656 }
13657 emitCodePoint(cp, consumed) {
13658 }
13659}
13660
13661function defaultOnError(error) {
13662 throw error;
13663}
13664function defaultOnWarn(msg) {
13665 console.warn(`[Vue warn] ${msg.message}`);
13666}
13667function createCompilerError(code, loc, messages, additionalMessage) {
13668 const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
13669 const error = new SyntaxError(String(msg));
13670 error.code = code;
13671 error.loc = loc;
13672 return error;
13673}
13674const errorMessages = {
13675 // parse errors
13676 [0]: "Illegal comment.",
13677 [1]: "CDATA section is allowed only in XML context.",
13678 [2]: "Duplicate attribute.",
13679 [3]: "End tag cannot have attributes.",
13680 [4]: "Illegal '/' in tags.",
13681 [5]: "Unexpected EOF in tag.",
13682 [6]: "Unexpected EOF in CDATA section.",
13683 [7]: "Unexpected EOF in comment.",
13684 [8]: "Unexpected EOF in script.",
13685 [9]: "Unexpected EOF in tag.",
13686 [10]: "Incorrectly closed comment.",
13687 [11]: "Incorrectly opened comment.",
13688 [12]: "Illegal tag name. Use '&lt;' to print '<'.",
13689 [13]: "Attribute value was expected.",
13690 [14]: "End tag name was expected.",
13691 [15]: "Whitespace was expected.",
13692 [16]: "Unexpected '<!--' in comment.",
13693 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
13694 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
13695 [19]: "Attribute name cannot start with '='.",
13696 [21]: "'<?' is allowed only in XML context.",
13697 [20]: `Unexpected null character.`,
13698 [22]: "Illegal '/' in tags.",
13699 // Vue-specific parse errors
13700 [23]: "Invalid end tag.",
13701 [24]: "Element is missing end tag.",
13702 [25]: "Interpolation end sign was not found.",
13703 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
13704 [26]: "Legal directive name was expected.",
13705 // transform errors
13706 [28]: `v-if/v-else-if is missing expression.`,
13707 [29]: `v-if/else branches must use unique keys.`,
13708 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
13709 [31]: `v-for is missing expression.`,
13710 [32]: `v-for has invalid expression.`,
13711 [33]: `<template v-for> key should be placed on the <template> tag.`,
13712 [34]: `v-bind is missing expression.`,
13713 [52]: `v-bind with same-name shorthand only allows static argument.`,
13714 [35]: `v-on is missing expression.`,
13715 [36]: `Unexpected custom directive on <slot> outlet.`,
13716 [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.`,
13717 [38]: `Duplicate slot names found. `,
13718 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
13719 [40]: `v-slot can only be used on components or <template> tags.`,
13720 [41]: `v-model is missing expression.`,
13721 [42]: `v-model value must be a valid JavaScript member expression.`,
13722 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
13723 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
13724Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
13725 [45]: `Error parsing JavaScript expression: `,
13726 [46]: `<KeepAlive> expects exactly one child component.`,
13727 [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.`,
13728 // generic errors
13729 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13730 [48]: `ES module mode is not supported in this build of compiler.`,
13731 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13732 [50]: `"scopeId" option is only supported in module mode.`,
13733 // just to fulfill types
13734 [53]: ``
13735};
13736
13737const isStaticExp = (p) => p.type === 4 && p.isStatic;
13738function isCoreComponent(tag) {
13739 switch (tag) {
13740 case "Teleport":
13741 case "teleport":
13742 return TELEPORT;
13743 case "Suspense":
13744 case "suspense":
13745 return SUSPENSE;
13746 case "KeepAlive":
13747 case "keep-alive":
13748 return KEEP_ALIVE;
13749 case "BaseTransition":
13750 case "base-transition":
13751 return BASE_TRANSITION;
13752 }
13753}
13754const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13755const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13756const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13757const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13758const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13759const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13760const isMemberExpressionBrowser = (exp) => {
13761 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
13762 let state = 0 /* inMemberExp */;
13763 let stateStack = [];
13764 let currentOpenBracketCount = 0;
13765 let currentOpenParensCount = 0;
13766 let currentStringType = null;
13767 for (let i = 0; i < path.length; i++) {
13768 const char = path.charAt(i);
13769 switch (state) {
13770 case 0 /* inMemberExp */:
13771 if (char === "[") {
13772 stateStack.push(state);
13773 state = 1 /* inBrackets */;
13774 currentOpenBracketCount++;
13775 } else if (char === "(") {
13776 stateStack.push(state);
13777 state = 2 /* inParens */;
13778 currentOpenParensCount++;
13779 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
13780 return false;
13781 }
13782 break;
13783 case 1 /* inBrackets */:
13784 if (char === `'` || char === `"` || char === "`") {
13785 stateStack.push(state);
13786 state = 3 /* inString */;
13787 currentStringType = char;
13788 } else if (char === `[`) {
13789 currentOpenBracketCount++;
13790 } else if (char === `]`) {
13791 if (!--currentOpenBracketCount) {
13792 state = stateStack.pop();
13793 }
13794 }
13795 break;
13796 case 2 /* inParens */:
13797 if (char === `'` || char === `"` || char === "`") {
13798 stateStack.push(state);
13799 state = 3 /* inString */;
13800 currentStringType = char;
13801 } else if (char === `(`) {
13802 currentOpenParensCount++;
13803 } else if (char === `)`) {
13804 if (i === path.length - 1) {
13805 return false;
13806 }
13807 if (!--currentOpenParensCount) {
13808 state = stateStack.pop();
13809 }
13810 }
13811 break;
13812 case 3 /* inString */:
13813 if (char === currentStringType) {
13814 state = stateStack.pop();
13815 currentStringType = null;
13816 }
13817 break;
13818 }
13819 }
13820 return !currentOpenBracketCount && !currentOpenParensCount;
13821};
13822const isMemberExpression = isMemberExpressionBrowser ;
13823const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
13824const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
13825const isFnExpression = isFnExpressionBrowser ;
13826function assert(condition, msg) {
13827 if (!condition) {
13828 throw new Error(msg || `unexpected compiler condition`);
13829 }
13830}
13831function findDir(node, name, allowEmpty = false) {
13832 for (let i = 0; i < node.props.length; i++) {
13833 const p = node.props[i];
13834 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
13835 return p;
13836 }
13837 }
13838}
13839function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
13840 for (let i = 0; i < node.props.length; i++) {
13841 const p = node.props[i];
13842 if (p.type === 6) {
13843 if (dynamicOnly) continue;
13844 if (p.name === name && (p.value || allowEmpty)) {
13845 return p;
13846 }
13847 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
13848 return p;
13849 }
13850 }
13851}
13852function isStaticArgOf(arg, name) {
13853 return !!(arg && isStaticExp(arg) && arg.content === name);
13854}
13855function hasDynamicKeyVBind(node) {
13856 return node.props.some(
13857 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
13858 p.arg.type !== 4 || // v-bind:[_ctx.foo]
13859 !p.arg.isStatic)
13860 // v-bind:[foo]
13861 );
13862}
13863function isText$1(node) {
13864 return node.type === 5 || node.type === 2;
13865}
13866function isVSlot(p) {
13867 return p.type === 7 && p.name === "slot";
13868}
13869function isTemplateNode(node) {
13870 return node.type === 1 && node.tagType === 3;
13871}
13872function isSlotOutlet(node) {
13873 return node.type === 1 && node.tagType === 2;
13874}
13875const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
13876function getUnnormalizedProps(props, callPath = []) {
13877 if (props && !isString(props) && props.type === 14) {
13878 const callee = props.callee;
13879 if (!isString(callee) && propsHelperSet.has(callee)) {
13880 return getUnnormalizedProps(
13881 props.arguments[0],
13882 callPath.concat(props)
13883 );
13884 }
13885 }
13886 return [props, callPath];
13887}
13888function injectProp(node, prop, context) {
13889 let propsWithInjection;
13890 let props = node.type === 13 ? node.props : node.arguments[2];
13891 let callPath = [];
13892 let parentCall;
13893 if (props && !isString(props) && props.type === 14) {
13894 const ret = getUnnormalizedProps(props);
13895 props = ret[0];
13896 callPath = ret[1];
13897 parentCall = callPath[callPath.length - 1];
13898 }
13899 if (props == null || isString(props)) {
13900 propsWithInjection = createObjectExpression([prop]);
13901 } else if (props.type === 14) {
13902 const first = props.arguments[0];
13903 if (!isString(first) && first.type === 15) {
13904 if (!hasProp(prop, first)) {
13905 first.properties.unshift(prop);
13906 }
13907 } else {
13908 if (props.callee === TO_HANDLERS) {
13909 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
13910 createObjectExpression([prop]),
13911 props
13912 ]);
13913 } else {
13914 props.arguments.unshift(createObjectExpression([prop]));
13915 }
13916 }
13917 !propsWithInjection && (propsWithInjection = props);
13918 } else if (props.type === 15) {
13919 if (!hasProp(prop, props)) {
13920 props.properties.unshift(prop);
13921 }
13922 propsWithInjection = props;
13923 } else {
13924 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
13925 createObjectExpression([prop]),
13926 props
13927 ]);
13928 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13929 parentCall = callPath[callPath.length - 2];
13930 }
13931 }
13932 if (node.type === 13) {
13933 if (parentCall) {
13934 parentCall.arguments[0] = propsWithInjection;
13935 } else {
13936 node.props = propsWithInjection;
13937 }
13938 } else {
13939 if (parentCall) {
13940 parentCall.arguments[0] = propsWithInjection;
13941 } else {
13942 node.arguments[2] = propsWithInjection;
13943 }
13944 }
13945}
13946function hasProp(prop, props) {
13947 let result = false;
13948 if (prop.key.type === 4) {
13949 const propKeyName = prop.key.content;
13950 result = props.properties.some(
13951 (p) => p.key.type === 4 && p.key.content === propKeyName
13952 );
13953 }
13954 return result;
13955}
13956function toValidAssetId(name, type) {
13957 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13958 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13959 })}`;
13960}
13961function getMemoedVNodeCall(node) {
13962 if (node.type === 14 && node.callee === WITH_MEMO) {
13963 return node.arguments[1].returns;
13964 } else {
13965 return node;
13966 }
13967}
13968const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
13969
13970const defaultParserOptions = {
13971 parseMode: "base",
13972 ns: 0,
13973 delimiters: [`{{`, `}}`],
13974 getNamespace: () => 0,
13975 isVoidTag: NO,
13976 isPreTag: NO,
13977 isIgnoreNewlineTag: NO,
13978 isCustomElement: NO,
13979 onError: defaultOnError,
13980 onWarn: defaultOnWarn,
13981 comments: true,
13982 prefixIdentifiers: false
13983};
13984let currentOptions = defaultParserOptions;
13985let currentRoot = null;
13986let currentInput = "";
13987let currentOpenTag = null;
13988let currentProp = null;
13989let currentAttrValue = "";
13990let currentAttrStartIndex = -1;
13991let currentAttrEndIndex = -1;
13992let inPre = 0;
13993let inVPre = false;
13994let currentVPreBoundary = null;
13995const stack = [];
13996const tokenizer = new Tokenizer(stack, {
13997 onerr: emitError,
13998 ontext(start, end) {
13999 onText(getSlice(start, end), start, end);
14000 },
14001 ontextentity(char, start, end) {
14002 onText(char, start, end);
14003 },
14004 oninterpolation(start, end) {
14005 if (inVPre) {
14006 return onText(getSlice(start, end), start, end);
14007 }
14008 let innerStart = start + tokenizer.delimiterOpen.length;
14009 let innerEnd = end - tokenizer.delimiterClose.length;
14010 while (isWhitespace(currentInput.charCodeAt(innerStart))) {
14011 innerStart++;
14012 }
14013 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
14014 innerEnd--;
14015 }
14016 let exp = getSlice(innerStart, innerEnd);
14017 if (exp.includes("&")) {
14018 {
14019 exp = currentOptions.decodeEntities(exp, false);
14020 }
14021 }
14022 addNode({
14023 type: 5,
14024 content: createExp(exp, false, getLoc(innerStart, innerEnd)),
14025 loc: getLoc(start, end)
14026 });
14027 },
14028 onopentagname(start, end) {
14029 const name = getSlice(start, end);
14030 currentOpenTag = {
14031 type: 1,
14032 tag: name,
14033 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
14034 tagType: 0,
14035 // will be refined on tag close
14036 props: [],
14037 children: [],
14038 loc: getLoc(start - 1, end),
14039 codegenNode: void 0
14040 };
14041 },
14042 onopentagend(end) {
14043 endOpenTag(end);
14044 },
14045 onclosetag(start, end) {
14046 const name = getSlice(start, end);
14047 if (!currentOptions.isVoidTag(name)) {
14048 let found = false;
14049 for (let i = 0; i < stack.length; i++) {
14050 const e = stack[i];
14051 if (e.tag.toLowerCase() === name.toLowerCase()) {
14052 found = true;
14053 if (i > 0) {
14054 emitError(24, stack[0].loc.start.offset);
14055 }
14056 for (let j = 0; j <= i; j++) {
14057 const el = stack.shift();
14058 onCloseTag(el, end, j < i);
14059 }
14060 break;
14061 }
14062 }
14063 if (!found) {
14064 emitError(23, backTrack(start, 60));
14065 }
14066 }
14067 },
14068 onselfclosingtag(end) {
14069 const name = currentOpenTag.tag;
14070 currentOpenTag.isSelfClosing = true;
14071 endOpenTag(end);
14072 if (stack[0] && stack[0].tag === name) {
14073 onCloseTag(stack.shift(), end);
14074 }
14075 },
14076 onattribname(start, end) {
14077 currentProp = {
14078 type: 6,
14079 name: getSlice(start, end),
14080 nameLoc: getLoc(start, end),
14081 value: void 0,
14082 loc: getLoc(start)
14083 };
14084 },
14085 ondirname(start, end) {
14086 const raw = getSlice(start, end);
14087 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
14088 if (!inVPre && name === "") {
14089 emitError(26, start);
14090 }
14091 if (inVPre || name === "") {
14092 currentProp = {
14093 type: 6,
14094 name: raw,
14095 nameLoc: getLoc(start, end),
14096 value: void 0,
14097 loc: getLoc(start)
14098 };
14099 } else {
14100 currentProp = {
14101 type: 7,
14102 name,
14103 rawName: raw,
14104 exp: void 0,
14105 arg: void 0,
14106 modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
14107 loc: getLoc(start)
14108 };
14109 if (name === "pre") {
14110 inVPre = tokenizer.inVPre = true;
14111 currentVPreBoundary = currentOpenTag;
14112 const props = currentOpenTag.props;
14113 for (let i = 0; i < props.length; i++) {
14114 if (props[i].type === 7) {
14115 props[i] = dirToAttr(props[i]);
14116 }
14117 }
14118 }
14119 }
14120 },
14121 ondirarg(start, end) {
14122 if (start === end) return;
14123 const arg = getSlice(start, end);
14124 if (inVPre) {
14125 currentProp.name += arg;
14126 setLocEnd(currentProp.nameLoc, end);
14127 } else {
14128 const isStatic = arg[0] !== `[`;
14129 currentProp.arg = createExp(
14130 isStatic ? arg : arg.slice(1, -1),
14131 isStatic,
14132 getLoc(start, end),
14133 isStatic ? 3 : 0
14134 );
14135 }
14136 },
14137 ondirmodifier(start, end) {
14138 const mod = getSlice(start, end);
14139 if (inVPre) {
14140 currentProp.name += "." + mod;
14141 setLocEnd(currentProp.nameLoc, end);
14142 } else if (currentProp.name === "slot") {
14143 const arg = currentProp.arg;
14144 if (arg) {
14145 arg.content += "." + mod;
14146 setLocEnd(arg.loc, end);
14147 }
14148 } else {
14149 const exp = createSimpleExpression(mod, true, getLoc(start, end));
14150 currentProp.modifiers.push(exp);
14151 }
14152 },
14153 onattribdata(start, end) {
14154 currentAttrValue += getSlice(start, end);
14155 if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
14156 currentAttrEndIndex = end;
14157 },
14158 onattribentity(char, start, end) {
14159 currentAttrValue += char;
14160 if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
14161 currentAttrEndIndex = end;
14162 },
14163 onattribnameend(end) {
14164 const start = currentProp.loc.start.offset;
14165 const name = getSlice(start, end);
14166 if (currentProp.type === 7) {
14167 currentProp.rawName = name;
14168 }
14169 if (currentOpenTag.props.some(
14170 (p) => (p.type === 7 ? p.rawName : p.name) === name
14171 )) {
14172 emitError(2, start);
14173 }
14174 },
14175 onattribend(quote, end) {
14176 if (currentOpenTag && currentProp) {
14177 setLocEnd(currentProp.loc, end);
14178 if (quote !== 0) {
14179 if (currentAttrValue.includes("&")) {
14180 currentAttrValue = currentOptions.decodeEntities(
14181 currentAttrValue,
14182 true
14183 );
14184 }
14185 if (currentProp.type === 6) {
14186 if (currentProp.name === "class") {
14187 currentAttrValue = condense(currentAttrValue).trim();
14188 }
14189 if (quote === 1 && !currentAttrValue) {
14190 emitError(13, end);
14191 }
14192 currentProp.value = {
14193 type: 2,
14194 content: currentAttrValue,
14195 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
14196 };
14197 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
14198 tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
14199 }
14200 } else {
14201 let expParseMode = 0 /* Normal */;
14202 currentProp.exp = createExp(
14203 currentAttrValue,
14204 false,
14205 getLoc(currentAttrStartIndex, currentAttrEndIndex),
14206 0,
14207 expParseMode
14208 );
14209 if (currentProp.name === "for") {
14210 currentProp.forParseResult = parseForExpression(currentProp.exp);
14211 }
14212 }
14213 }
14214 if (currentProp.type !== 7 || currentProp.name !== "pre") {
14215 currentOpenTag.props.push(currentProp);
14216 }
14217 }
14218 currentAttrValue = "";
14219 currentAttrStartIndex = currentAttrEndIndex = -1;
14220 },
14221 oncomment(start, end) {
14222 if (currentOptions.comments) {
14223 addNode({
14224 type: 3,
14225 content: getSlice(start, end),
14226 loc: getLoc(start - 4, end + 3)
14227 });
14228 }
14229 },
14230 onend() {
14231 const end = currentInput.length;
14232 if (tokenizer.state !== 1) {
14233 switch (tokenizer.state) {
14234 case 5:
14235 case 8:
14236 emitError(5, end);
14237 break;
14238 case 3:
14239 case 4:
14240 emitError(
14241 25,
14242 tokenizer.sectionStart
14243 );
14244 break;
14245 case 28:
14246 if (tokenizer.currentSequence === Sequences.CdataEnd) {
14247 emitError(6, end);
14248 } else {
14249 emitError(7, end);
14250 }
14251 break;
14252 case 6:
14253 case 7:
14254 case 9:
14255 case 11:
14256 case 12:
14257 case 13:
14258 case 14:
14259 case 15:
14260 case 16:
14261 case 17:
14262 case 18:
14263 case 19:
14264 // "
14265 case 20:
14266 // '
14267 case 21:
14268 emitError(9, end);
14269 break;
14270 }
14271 }
14272 for (let index = 0; index < stack.length; index++) {
14273 onCloseTag(stack[index], end - 1);
14274 emitError(24, stack[index].loc.start.offset);
14275 }
14276 },
14277 oncdata(start, end) {
14278 if (stack[0].ns !== 0) {
14279 onText(getSlice(start, end), start, end);
14280 } else {
14281 emitError(1, start - 9);
14282 }
14283 },
14284 onprocessinginstruction(start) {
14285 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14286 emitError(
14287 21,
14288 start - 1
14289 );
14290 }
14291 }
14292});
14293const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14294const stripParensRE = /^\(|\)$/g;
14295function parseForExpression(input) {
14296 const loc = input.loc;
14297 const exp = input.content;
14298 const inMatch = exp.match(forAliasRE);
14299 if (!inMatch) return;
14300 const [, LHS, RHS] = inMatch;
14301 const createAliasExpression = (content, offset, asParam = false) => {
14302 const start = loc.start.offset + offset;
14303 const end = start + content.length;
14304 return createExp(
14305 content,
14306 false,
14307 getLoc(start, end),
14308 0,
14309 asParam ? 1 /* Params */ : 0 /* Normal */
14310 );
14311 };
14312 const result = {
14313 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14314 value: void 0,
14315 key: void 0,
14316 index: void 0,
14317 finalized: false
14318 };
14319 let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14320 const trimmedOffset = LHS.indexOf(valueContent);
14321 const iteratorMatch = valueContent.match(forIteratorRE);
14322 if (iteratorMatch) {
14323 valueContent = valueContent.replace(forIteratorRE, "").trim();
14324 const keyContent = iteratorMatch[1].trim();
14325 let keyOffset;
14326 if (keyContent) {
14327 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14328 result.key = createAliasExpression(keyContent, keyOffset, true);
14329 }
14330 if (iteratorMatch[2]) {
14331 const indexContent = iteratorMatch[2].trim();
14332 if (indexContent) {
14333 result.index = createAliasExpression(
14334 indexContent,
14335 exp.indexOf(
14336 indexContent,
14337 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14338 ),
14339 true
14340 );
14341 }
14342 }
14343 }
14344 if (valueContent) {
14345 result.value = createAliasExpression(valueContent, trimmedOffset, true);
14346 }
14347 return result;
14348}
14349function getSlice(start, end) {
14350 return currentInput.slice(start, end);
14351}
14352function endOpenTag(end) {
14353 if (tokenizer.inSFCRoot) {
14354 currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
14355 }
14356 addNode(currentOpenTag);
14357 const { tag, ns } = currentOpenTag;
14358 if (ns === 0 && currentOptions.isPreTag(tag)) {
14359 inPre++;
14360 }
14361 if (currentOptions.isVoidTag(tag)) {
14362 onCloseTag(currentOpenTag, end);
14363 } else {
14364 stack.unshift(currentOpenTag);
14365 if (ns === 1 || ns === 2) {
14366 tokenizer.inXML = true;
14367 }
14368 }
14369 currentOpenTag = null;
14370}
14371function onText(content, start, end) {
14372 {
14373 const tag = stack[0] && stack[0].tag;
14374 if (tag !== "script" && tag !== "style" && content.includes("&")) {
14375 content = currentOptions.decodeEntities(content, false);
14376 }
14377 }
14378 const parent = stack[0] || currentRoot;
14379 const lastNode = parent.children[parent.children.length - 1];
14380 if (lastNode && lastNode.type === 2) {
14381 lastNode.content += content;
14382 setLocEnd(lastNode.loc, end);
14383 } else {
14384 parent.children.push({
14385 type: 2,
14386 content,
14387 loc: getLoc(start, end)
14388 });
14389 }
14390}
14391function onCloseTag(el, end, isImplied = false) {
14392 if (isImplied) {
14393 setLocEnd(el.loc, backTrack(end, 60));
14394 } else {
14395 setLocEnd(el.loc, lookAhead(end, 62) + 1);
14396 }
14397 if (tokenizer.inSFCRoot) {
14398 if (el.children.length) {
14399 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14400 } else {
14401 el.innerLoc.end = extend({}, el.innerLoc.start);
14402 }
14403 el.innerLoc.source = getSlice(
14404 el.innerLoc.start.offset,
14405 el.innerLoc.end.offset
14406 );
14407 }
14408 const { tag, ns, children } = el;
14409 if (!inVPre) {
14410 if (tag === "slot") {
14411 el.tagType = 2;
14412 } else if (isFragmentTemplate(el)) {
14413 el.tagType = 3;
14414 } else if (isComponent(el)) {
14415 el.tagType = 1;
14416 }
14417 }
14418 if (!tokenizer.inRCDATA) {
14419 el.children = condenseWhitespace(children);
14420 }
14421 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14422 const first = children[0];
14423 if (first && first.type === 2) {
14424 first.content = first.content.replace(/^\r?\n/, "");
14425 }
14426 }
14427 if (ns === 0 && currentOptions.isPreTag(tag)) {
14428 inPre--;
14429 }
14430 if (currentVPreBoundary === el) {
14431 inVPre = tokenizer.inVPre = false;
14432 currentVPreBoundary = null;
14433 }
14434 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14435 tokenizer.inXML = false;
14436 }
14437}
14438function lookAhead(index, c) {
14439 let i = index;
14440 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
14441 return i;
14442}
14443function backTrack(index, c) {
14444 let i = index;
14445 while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
14446 return i;
14447}
14448const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14449function isFragmentTemplate({ tag, props }) {
14450 if (tag === "template") {
14451 for (let i = 0; i < props.length; i++) {
14452 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14453 return true;
14454 }
14455 }
14456 }
14457 return false;
14458}
14459function isComponent({ tag, props }) {
14460 if (currentOptions.isCustomElement(tag)) {
14461 return false;
14462 }
14463 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
14464 return true;
14465 }
14466 for (let i = 0; i < props.length; i++) {
14467 const p = props[i];
14468 if (p.type === 6) {
14469 if (p.name === "is" && p.value) {
14470 if (p.value.content.startsWith("vue:")) {
14471 return true;
14472 }
14473 }
14474 }
14475 }
14476 return false;
14477}
14478function isUpperCase(c) {
14479 return c > 64 && c < 91;
14480}
14481const windowsNewlineRE = /\r\n/g;
14482function condenseWhitespace(nodes, tag) {
14483 const shouldCondense = currentOptions.whitespace !== "preserve";
14484 let removedWhitespace = false;
14485 for (let i = 0; i < nodes.length; i++) {
14486 const node = nodes[i];
14487 if (node.type === 2) {
14488 if (!inPre) {
14489 if (isAllWhitespace(node.content)) {
14490 const prev = nodes[i - 1] && nodes[i - 1].type;
14491 const next = nodes[i + 1] && nodes[i + 1].type;
14492 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14493 removedWhitespace = true;
14494 nodes[i] = null;
14495 } else {
14496 node.content = " ";
14497 }
14498 } else if (shouldCondense) {
14499 node.content = condense(node.content);
14500 }
14501 } else {
14502 node.content = node.content.replace(windowsNewlineRE, "\n");
14503 }
14504 }
14505 }
14506 return removedWhitespace ? nodes.filter(Boolean) : nodes;
14507}
14508function isAllWhitespace(str) {
14509 for (let i = 0; i < str.length; i++) {
14510 if (!isWhitespace(str.charCodeAt(i))) {
14511 return false;
14512 }
14513 }
14514 return true;
14515}
14516function hasNewlineChar(str) {
14517 for (let i = 0; i < str.length; i++) {
14518 const c = str.charCodeAt(i);
14519 if (c === 10 || c === 13) {
14520 return true;
14521 }
14522 }
14523 return false;
14524}
14525function condense(str) {
14526 let ret = "";
14527 let prevCharIsWhitespace = false;
14528 for (let i = 0; i < str.length; i++) {
14529 if (isWhitespace(str.charCodeAt(i))) {
14530 if (!prevCharIsWhitespace) {
14531 ret += " ";
14532 prevCharIsWhitespace = true;
14533 }
14534 } else {
14535 ret += str[i];
14536 prevCharIsWhitespace = false;
14537 }
14538 }
14539 return ret;
14540}
14541function addNode(node) {
14542 (stack[0] || currentRoot).children.push(node);
14543}
14544function getLoc(start, end) {
14545 return {
14546 start: tokenizer.getPos(start),
14547 // @ts-expect-error allow late attachment
14548 end: end == null ? end : tokenizer.getPos(end),
14549 // @ts-expect-error allow late attachment
14550 source: end == null ? end : getSlice(start, end)
14551 };
14552}
14553function cloneLoc(loc) {
14554 return getLoc(loc.start.offset, loc.end.offset);
14555}
14556function setLocEnd(loc, end) {
14557 loc.end = tokenizer.getPos(end);
14558 loc.source = getSlice(loc.start.offset, end);
14559}
14560function dirToAttr(dir) {
14561 const attr = {
14562 type: 6,
14563 name: dir.rawName,
14564 nameLoc: getLoc(
14565 dir.loc.start.offset,
14566 dir.loc.start.offset + dir.rawName.length
14567 ),
14568 value: void 0,
14569 loc: dir.loc
14570 };
14571 if (dir.exp) {
14572 const loc = dir.exp.loc;
14573 if (loc.end.offset < dir.loc.end.offset) {
14574 loc.start.offset--;
14575 loc.start.column--;
14576 loc.end.offset++;
14577 loc.end.column++;
14578 }
14579 attr.value = {
14580 type: 2,
14581 content: dir.exp.content,
14582 loc
14583 };
14584 }
14585 return attr;
14586}
14587function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
14588 const exp = createSimpleExpression(content, isStatic, loc, constType);
14589 return exp;
14590}
14591function emitError(code, index, message) {
14592 currentOptions.onError(
14593 createCompilerError(code, getLoc(index, index), void 0, message)
14594 );
14595}
14596function reset() {
14597 tokenizer.reset();
14598 currentOpenTag = null;
14599 currentProp = null;
14600 currentAttrValue = "";
14601 currentAttrStartIndex = -1;
14602 currentAttrEndIndex = -1;
14603 stack.length = 0;
14604}
14605function baseParse(input, options) {
14606 reset();
14607 currentInput = input;
14608 currentOptions = extend({}, defaultParserOptions);
14609 if (options) {
14610 let key;
14611 for (key in options) {
14612 if (options[key] != null) {
14613 currentOptions[key] = options[key];
14614 }
14615 }
14616 }
14617 {
14618 if (!currentOptions.decodeEntities) {
14619 throw new Error(
14620 `[@vue/compiler-core] decodeEntities option is required in browser builds.`
14621 );
14622 }
14623 }
14624 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
14625 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
14626 const delimiters = options && options.delimiters;
14627 if (delimiters) {
14628 tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
14629 tokenizer.delimiterClose = toCharCodes(delimiters[1]);
14630 }
14631 const root = currentRoot = createRoot([], input);
14632 tokenizer.parse(currentInput);
14633 root.loc = getLoc(0, input.length);
14634 root.children = condenseWhitespace(root.children);
14635 currentRoot = null;
14636 return root;
14637}
14638
14639function cacheStatic(root, context) {
14640 walk(
14641 root,
14642 void 0,
14643 context,
14644 // Root node is unfortunately non-hoistable due to potential parent
14645 // fallthrough attributes.
14646 isSingleElementRoot(root, root.children[0])
14647 );
14648}
14649function isSingleElementRoot(root, child) {
14650 const { children } = root;
14651 return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14652}
14653function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14654 const { children } = node;
14655 const toCache = [];
14656 for (let i = 0; i < children.length; i++) {
14657 const child = children[i];
14658 if (child.type === 1 && child.tagType === 0) {
14659 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14660 if (constantType > 0) {
14661 if (constantType >= 2) {
14662 child.codegenNode.patchFlag = -1;
14663 toCache.push(child);
14664 continue;
14665 }
14666 } else {
14667 const codegenNode = child.codegenNode;
14668 if (codegenNode.type === 13) {
14669 const flag = codegenNode.patchFlag;
14670 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
14671 const props = getNodeProps(child);
14672 if (props) {
14673 codegenNode.props = context.hoist(props);
14674 }
14675 }
14676 if (codegenNode.dynamicProps) {
14677 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
14678 }
14679 }
14680 }
14681 } else if (child.type === 12) {
14682 const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14683 if (constantType >= 2) {
14684 toCache.push(child);
14685 continue;
14686 }
14687 }
14688 if (child.type === 1) {
14689 const isComponent = child.tagType === 1;
14690 if (isComponent) {
14691 context.scopes.vSlot++;
14692 }
14693 walk(child, node, context, false, inFor);
14694 if (isComponent) {
14695 context.scopes.vSlot--;
14696 }
14697 } else if (child.type === 11) {
14698 walk(child, node, context, child.children.length === 1, true);
14699 } else if (child.type === 9) {
14700 for (let i2 = 0; i2 < child.branches.length; i2++) {
14701 walk(
14702 child.branches[i2],
14703 node,
14704 context,
14705 child.branches[i2].children.length === 1,
14706 inFor
14707 );
14708 }
14709 }
14710 }
14711 let cachedAsArray = false;
14712 if (toCache.length === children.length && node.type === 1) {
14713 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14714 node.codegenNode.children = getCacheExpression(
14715 createArrayExpression(node.codegenNode.children)
14716 );
14717 cachedAsArray = true;
14718 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14719 const slot = getSlotNode(node.codegenNode, "default");
14720 if (slot) {
14721 slot.returns = getCacheExpression(
14722 createArrayExpression(slot.returns)
14723 );
14724 cachedAsArray = true;
14725 }
14726 } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
14727 const slotName = findDir(node, "slot", true);
14728 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14729 if (slot) {
14730 slot.returns = getCacheExpression(
14731 createArrayExpression(slot.returns)
14732 );
14733 cachedAsArray = true;
14734 }
14735 }
14736 }
14737 if (!cachedAsArray) {
14738 for (const child of toCache) {
14739 child.codegenNode = context.cache(child.codegenNode);
14740 }
14741 }
14742 function getCacheExpression(value) {
14743 const exp = context.cache(value);
14744 if (inFor && context.hmr) {
14745 exp.needArraySpread = true;
14746 }
14747 return exp;
14748 }
14749 function getSlotNode(node2, name) {
14750 if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
14751 const slot = node2.children.properties.find(
14752 (p) => p.key === name || p.key.content === name
14753 );
14754 return slot && slot.value;
14755 }
14756 }
14757 if (toCache.length && context.transformHoist) {
14758 context.transformHoist(children, context, node);
14759 }
14760}
14761function getConstantType(node, context) {
14762 const { constantCache } = context;
14763 switch (node.type) {
14764 case 1:
14765 if (node.tagType !== 0) {
14766 return 0;
14767 }
14768 const cached = constantCache.get(node);
14769 if (cached !== void 0) {
14770 return cached;
14771 }
14772 const codegenNode = node.codegenNode;
14773 if (codegenNode.type !== 13) {
14774 return 0;
14775 }
14776 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
14777 return 0;
14778 }
14779 if (codegenNode.patchFlag === void 0) {
14780 let returnType2 = 3;
14781 const generatedPropsType = getGeneratedPropsConstantType(node, context);
14782 if (generatedPropsType === 0) {
14783 constantCache.set(node, 0);
14784 return 0;
14785 }
14786 if (generatedPropsType < returnType2) {
14787 returnType2 = generatedPropsType;
14788 }
14789 for (let i = 0; i < node.children.length; i++) {
14790 const childType = getConstantType(node.children[i], context);
14791 if (childType === 0) {
14792 constantCache.set(node, 0);
14793 return 0;
14794 }
14795 if (childType < returnType2) {
14796 returnType2 = childType;
14797 }
14798 }
14799 if (returnType2 > 1) {
14800 for (let i = 0; i < node.props.length; i++) {
14801 const p = node.props[i];
14802 if (p.type === 7 && p.name === "bind" && p.exp) {
14803 const expType = getConstantType(p.exp, context);
14804 if (expType === 0) {
14805 constantCache.set(node, 0);
14806 return 0;
14807 }
14808 if (expType < returnType2) {
14809 returnType2 = expType;
14810 }
14811 }
14812 }
14813 }
14814 if (codegenNode.isBlock) {
14815 for (let i = 0; i < node.props.length; i++) {
14816 const p = node.props[i];
14817 if (p.type === 7) {
14818 constantCache.set(node, 0);
14819 return 0;
14820 }
14821 }
14822 context.removeHelper(OPEN_BLOCK);
14823 context.removeHelper(
14824 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent)
14825 );
14826 codegenNode.isBlock = false;
14827 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
14828 }
14829 constantCache.set(node, returnType2);
14830 return returnType2;
14831 } else {
14832 constantCache.set(node, 0);
14833 return 0;
14834 }
14835 case 2:
14836 case 3:
14837 return 3;
14838 case 9:
14839 case 11:
14840 case 10:
14841 return 0;
14842 case 5:
14843 case 12:
14844 return getConstantType(node.content, context);
14845 case 4:
14846 return node.constType;
14847 case 8:
14848 let returnType = 3;
14849 for (let i = 0; i < node.children.length; i++) {
14850 const child = node.children[i];
14851 if (isString(child) || isSymbol(child)) {
14852 continue;
14853 }
14854 const childType = getConstantType(child, context);
14855 if (childType === 0) {
14856 return 0;
14857 } else if (childType < returnType) {
14858 returnType = childType;
14859 }
14860 }
14861 return returnType;
14862 case 20:
14863 return 2;
14864 default:
14865 return 0;
14866 }
14867}
14868const allowHoistedHelperSet = /* @__PURE__ */ new Set([
14869 NORMALIZE_CLASS,
14870 NORMALIZE_STYLE,
14871 NORMALIZE_PROPS,
14872 GUARD_REACTIVE_PROPS
14873]);
14874function getConstantTypeOfHelperCall(value, context) {
14875 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
14876 const arg = value.arguments[0];
14877 if (arg.type === 4) {
14878 return getConstantType(arg, context);
14879 } else if (arg.type === 14) {
14880 return getConstantTypeOfHelperCall(arg, context);
14881 }
14882 }
14883 return 0;
14884}
14885function getGeneratedPropsConstantType(node, context) {
14886 let returnType = 3;
14887 const props = getNodeProps(node);
14888 if (props && props.type === 15) {
14889 const { properties } = props;
14890 for (let i = 0; i < properties.length; i++) {
14891 const { key, value } = properties[i];
14892 const keyType = getConstantType(key, context);
14893 if (keyType === 0) {
14894 return keyType;
14895 }
14896 if (keyType < returnType) {
14897 returnType = keyType;
14898 }
14899 let valueType;
14900 if (value.type === 4) {
14901 valueType = getConstantType(value, context);
14902 } else if (value.type === 14) {
14903 valueType = getConstantTypeOfHelperCall(value, context);
14904 } else {
14905 valueType = 0;
14906 }
14907 if (valueType === 0) {
14908 return valueType;
14909 }
14910 if (valueType < returnType) {
14911 returnType = valueType;
14912 }
14913 }
14914 }
14915 return returnType;
14916}
14917function getNodeProps(node) {
14918 const codegenNode = node.codegenNode;
14919 if (codegenNode.type === 13) {
14920 return codegenNode.props;
14921 }
14922}
14923
14924function createTransformContext(root, {
14925 filename = "",
14926 prefixIdentifiers = false,
14927 hoistStatic = false,
14928 hmr = false,
14929 cacheHandlers = false,
14930 nodeTransforms = [],
14931 directiveTransforms = {},
14932 transformHoist = null,
14933 isBuiltInComponent = NOOP,
14934 isCustomElement = NOOP,
14935 expressionPlugins = [],
14936 scopeId = null,
14937 slotted = true,
14938 ssr = false,
14939 inSSR = false,
14940 ssrCssVars = ``,
14941 bindingMetadata = EMPTY_OBJ,
14942 inline = false,
14943 isTS = false,
14944 onError = defaultOnError,
14945 onWarn = defaultOnWarn,
14946 compatConfig
14947}) {
14948 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
14949 const context = {
14950 // options
14951 filename,
14952 selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14953 prefixIdentifiers,
14954 hoistStatic,
14955 hmr,
14956 cacheHandlers,
14957 nodeTransforms,
14958 directiveTransforms,
14959 transformHoist,
14960 isBuiltInComponent,
14961 isCustomElement,
14962 expressionPlugins,
14963 scopeId,
14964 slotted,
14965 ssr,
14966 inSSR,
14967 ssrCssVars,
14968 bindingMetadata,
14969 inline,
14970 isTS,
14971 onError,
14972 onWarn,
14973 compatConfig,
14974 // state
14975 root,
14976 helpers: /* @__PURE__ */ new Map(),
14977 components: /* @__PURE__ */ new Set(),
14978 directives: /* @__PURE__ */ new Set(),
14979 hoists: [],
14980 imports: [],
14981 cached: [],
14982 constantCache: /* @__PURE__ */ new WeakMap(),
14983 temps: 0,
14984 identifiers: /* @__PURE__ */ Object.create(null),
14985 scopes: {
14986 vFor: 0,
14987 vSlot: 0,
14988 vPre: 0,
14989 vOnce: 0
14990 },
14991 parent: null,
14992 grandParent: null,
14993 currentNode: root,
14994 childIndex: 0,
14995 inVOnce: false,
14996 // methods
14997 helper(name) {
14998 const count = context.helpers.get(name) || 0;
14999 context.helpers.set(name, count + 1);
15000 return name;
15001 },
15002 removeHelper(name) {
15003 const count = context.helpers.get(name);
15004 if (count) {
15005 const currentCount = count - 1;
15006 if (!currentCount) {
15007 context.helpers.delete(name);
15008 } else {
15009 context.helpers.set(name, currentCount);
15010 }
15011 }
15012 },
15013 helperString(name) {
15014 return `_${helperNameMap[context.helper(name)]}`;
15015 },
15016 replaceNode(node) {
15017 {
15018 if (!context.currentNode) {
15019 throw new Error(`Node being replaced is already removed.`);
15020 }
15021 if (!context.parent) {
15022 throw new Error(`Cannot replace root node.`);
15023 }
15024 }
15025 context.parent.children[context.childIndex] = context.currentNode = node;
15026 },
15027 removeNode(node) {
15028 if (!context.parent) {
15029 throw new Error(`Cannot remove root node.`);
15030 }
15031 const list = context.parent.children;
15032 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1;
15033 if (removalIndex < 0) {
15034 throw new Error(`node being removed is not a child of current parent`);
15035 }
15036 if (!node || node === context.currentNode) {
15037 context.currentNode = null;
15038 context.onNodeRemoved();
15039 } else {
15040 if (context.childIndex > removalIndex) {
15041 context.childIndex--;
15042 context.onNodeRemoved();
15043 }
15044 }
15045 context.parent.children.splice(removalIndex, 1);
15046 },
15047 onNodeRemoved: NOOP,
15048 addIdentifiers(exp) {
15049 },
15050 removeIdentifiers(exp) {
15051 },
15052 hoist(exp) {
15053 if (isString(exp)) exp = createSimpleExpression(exp);
15054 context.hoists.push(exp);
15055 const identifier = createSimpleExpression(
15056 `_hoisted_${context.hoists.length}`,
15057 false,
15058 exp.loc,
15059 2
15060 );
15061 identifier.hoisted = exp;
15062 return identifier;
15063 },
15064 cache(exp, isVNode = false, inVOnce = false) {
15065 const cacheExp = createCacheExpression(
15066 context.cached.length,
15067 exp,
15068 isVNode,
15069 inVOnce
15070 );
15071 context.cached.push(cacheExp);
15072 return cacheExp;
15073 }
15074 };
15075 return context;
15076}
15077function transform(root, options) {
15078 const context = createTransformContext(root, options);
15079 traverseNode(root, context);
15080 if (options.hoistStatic) {
15081 cacheStatic(root, context);
15082 }
15083 if (!options.ssr) {
15084 createRootCodegen(root, context);
15085 }
15086 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
15087 root.components = [...context.components];
15088 root.directives = [...context.directives];
15089 root.imports = context.imports;
15090 root.hoists = context.hoists;
15091 root.temps = context.temps;
15092 root.cached = context.cached;
15093 root.transformed = true;
15094}
15095function createRootCodegen(root, context) {
15096 const { helper } = context;
15097 const { children } = root;
15098 if (children.length === 1) {
15099 const child = children[0];
15100 if (isSingleElementRoot(root, child) && child.codegenNode) {
15101 const codegenNode = child.codegenNode;
15102 if (codegenNode.type === 13) {
15103 convertToBlock(codegenNode, context);
15104 }
15105 root.codegenNode = codegenNode;
15106 } else {
15107 root.codegenNode = child;
15108 }
15109 } else if (children.length > 1) {
15110 let patchFlag = 64;
15111 if (children.filter((c) => c.type !== 3).length === 1) {
15112 patchFlag |= 2048;
15113 }
15114 root.codegenNode = createVNodeCall(
15115 context,
15116 helper(FRAGMENT),
15117 void 0,
15118 root.children,
15119 patchFlag,
15120 void 0,
15121 void 0,
15122 true,
15123 void 0,
15124 false
15125 );
15126 } else ;
15127}
15128function traverseChildren(parent, context) {
15129 let i = 0;
15130 const nodeRemoved = () => {
15131 i--;
15132 };
15133 for (; i < parent.children.length; i++) {
15134 const child = parent.children[i];
15135 if (isString(child)) continue;
15136 context.grandParent = context.parent;
15137 context.parent = parent;
15138 context.childIndex = i;
15139 context.onNodeRemoved = nodeRemoved;
15140 traverseNode(child, context);
15141 }
15142}
15143function traverseNode(node, context) {
15144 context.currentNode = node;
15145 const { nodeTransforms } = context;
15146 const exitFns = [];
15147 for (let i2 = 0; i2 < nodeTransforms.length; i2++) {
15148 const onExit = nodeTransforms[i2](node, context);
15149 if (onExit) {
15150 if (isArray(onExit)) {
15151 exitFns.push(...onExit);
15152 } else {
15153 exitFns.push(onExit);
15154 }
15155 }
15156 if (!context.currentNode) {
15157 return;
15158 } else {
15159 node = context.currentNode;
15160 }
15161 }
15162 switch (node.type) {
15163 case 3:
15164 if (!context.ssr) {
15165 context.helper(CREATE_COMMENT);
15166 }
15167 break;
15168 case 5:
15169 if (!context.ssr) {
15170 context.helper(TO_DISPLAY_STRING);
15171 }
15172 break;
15173 // for container types, further traverse downwards
15174 case 9:
15175 for (let i2 = 0; i2 < node.branches.length; i2++) {
15176 traverseNode(node.branches[i2], context);
15177 }
15178 break;
15179 case 10:
15180 case 11:
15181 case 1:
15182 case 0:
15183 traverseChildren(node, context);
15184 break;
15185 }
15186 context.currentNode = node;
15187 let i = exitFns.length;
15188 while (i--) {
15189 exitFns[i]();
15190 }
15191}
15192function createStructuralDirectiveTransform(name, fn) {
15193 const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
15194 return (node, context) => {
15195 if (node.type === 1) {
15196 const { props } = node;
15197 if (node.tagType === 3 && props.some(isVSlot)) {
15198 return;
15199 }
15200 const exitFns = [];
15201 for (let i = 0; i < props.length; i++) {
15202 const prop = props[i];
15203 if (prop.type === 7 && matches(prop.name)) {
15204 props.splice(i, 1);
15205 i--;
15206 const onExit = fn(node, prop, context);
15207 if (onExit) exitFns.push(onExit);
15208 }
15209 }
15210 return exitFns;
15211 }
15212 };
15213}
15214
15215const PURE_ANNOTATION = `/*@__PURE__*/`;
15216const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
15217function createCodegenContext(ast, {
15218 mode = "function",
15219 prefixIdentifiers = mode === "module",
15220 sourceMap = false,
15221 filename = `template.vue.html`,
15222 scopeId = null,
15223 optimizeImports = false,
15224 runtimeGlobalName = `Vue`,
15225 runtimeModuleName = `vue`,
15226 ssrRuntimeModuleName = "vue/server-renderer",
15227 ssr = false,
15228 isTS = false,
15229 inSSR = false
15230}) {
15231 const context = {
15232 mode,
15233 prefixIdentifiers,
15234 sourceMap,
15235 filename,
15236 scopeId,
15237 optimizeImports,
15238 runtimeGlobalName,
15239 runtimeModuleName,
15240 ssrRuntimeModuleName,
15241 ssr,
15242 isTS,
15243 inSSR,
15244 source: ast.source,
15245 code: ``,
15246 column: 1,
15247 line: 1,
15248 offset: 0,
15249 indentLevel: 0,
15250 pure: false,
15251 map: void 0,
15252 helper(key) {
15253 return `_${helperNameMap[key]}`;
15254 },
15255 push(code, newlineIndex = -2 /* None */, node) {
15256 context.code += code;
15257 },
15258 indent() {
15259 newline(++context.indentLevel);
15260 },
15261 deindent(withoutNewLine = false) {
15262 if (withoutNewLine) {
15263 --context.indentLevel;
15264 } else {
15265 newline(--context.indentLevel);
15266 }
15267 },
15268 newline() {
15269 newline(context.indentLevel);
15270 }
15271 };
15272 function newline(n) {
15273 context.push("\n" + ` `.repeat(n), 0 /* Start */);
15274 }
15275 return context;
15276}
15277function generate(ast, options = {}) {
15278 const context = createCodegenContext(ast, options);
15279 if (options.onContextCreated) options.onContextCreated(context);
15280 const {
15281 mode,
15282 push,
15283 prefixIdentifiers,
15284 indent,
15285 deindent,
15286 newline,
15287 scopeId,
15288 ssr
15289 } = context;
15290 const helpers = Array.from(ast.helpers);
15291 const hasHelpers = helpers.length > 0;
15292 const useWithBlock = !prefixIdentifiers && mode !== "module";
15293 const preambleContext = context;
15294 {
15295 genFunctionPreamble(ast, preambleContext);
15296 }
15297 const functionName = ssr ? `ssrRender` : `render`;
15298 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"];
15299 const signature = args.join(", ");
15300 {
15301 push(`function ${functionName}(${signature}) {`);
15302 }
15303 indent();
15304 if (useWithBlock) {
15305 push(`with (_ctx) {`);
15306 indent();
15307 if (hasHelpers) {
15308 push(
15309 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15310`,
15311 -1 /* End */
15312 );
15313 newline();
15314 }
15315 }
15316 if (ast.components.length) {
15317 genAssets(ast.components, "component", context);
15318 if (ast.directives.length || ast.temps > 0) {
15319 newline();
15320 }
15321 }
15322 if (ast.directives.length) {
15323 genAssets(ast.directives, "directive", context);
15324 if (ast.temps > 0) {
15325 newline();
15326 }
15327 }
15328 if (ast.temps > 0) {
15329 push(`let `);
15330 for (let i = 0; i < ast.temps; i++) {
15331 push(`${i > 0 ? `, ` : ``}_temp${i}`);
15332 }
15333 }
15334 if (ast.components.length || ast.directives.length || ast.temps) {
15335 push(`
15336`, 0 /* Start */);
15337 newline();
15338 }
15339 if (!ssr) {
15340 push(`return `);
15341 }
15342 if (ast.codegenNode) {
15343 genNode(ast.codegenNode, context);
15344 } else {
15345 push(`null`);
15346 }
15347 if (useWithBlock) {
15348 deindent();
15349 push(`}`);
15350 }
15351 deindent();
15352 push(`}`);
15353 return {
15354 ast,
15355 code: context.code,
15356 preamble: ``,
15357 map: context.map ? context.map.toJSON() : void 0
15358 };
15359}
15360function genFunctionPreamble(ast, context) {
15361 const {
15362 ssr,
15363 prefixIdentifiers,
15364 push,
15365 newline,
15366 runtimeModuleName,
15367 runtimeGlobalName,
15368 ssrRuntimeModuleName
15369 } = context;
15370 const VueBinding = runtimeGlobalName;
15371 const helpers = Array.from(ast.helpers);
15372 if (helpers.length > 0) {
15373 {
15374 push(`const _Vue = ${VueBinding}
15375`, -1 /* End */);
15376 if (ast.hoists.length) {
15377 const staticHelpers = [
15378 CREATE_VNODE,
15379 CREATE_ELEMENT_VNODE,
15380 CREATE_COMMENT,
15381 CREATE_TEXT,
15382 CREATE_STATIC
15383 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
15384 push(`const { ${staticHelpers} } = _Vue
15385`, -1 /* End */);
15386 }
15387 }
15388 }
15389 genHoists(ast.hoists, context);
15390 newline();
15391 push(`return `);
15392}
15393function genAssets(assets, type, { helper, push, newline, isTS }) {
15394 const resolver = helper(
15395 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE
15396 );
15397 for (let i = 0; i < assets.length; i++) {
15398 let id = assets[i];
15399 const maybeSelfReference = id.endsWith("__self");
15400 if (maybeSelfReference) {
15401 id = id.slice(0, -6);
15402 }
15403 push(
15404 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`
15405 );
15406 if (i < assets.length - 1) {
15407 newline();
15408 }
15409 }
15410}
15411function genHoists(hoists, context) {
15412 if (!hoists.length) {
15413 return;
15414 }
15415 context.pure = true;
15416 const { push, newline } = context;
15417 newline();
15418 for (let i = 0; i < hoists.length; i++) {
15419 const exp = hoists[i];
15420 if (exp) {
15421 push(`const _hoisted_${i + 1} = `);
15422 genNode(exp, context);
15423 newline();
15424 }
15425 }
15426 context.pure = false;
15427}
15428function isText(n) {
15429 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
15430}
15431function genNodeListAsArray(nodes, context) {
15432 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
15433 context.push(`[`);
15434 multilines && context.indent();
15435 genNodeList(nodes, context, multilines);
15436 multilines && context.deindent();
15437 context.push(`]`);
15438}
15439function genNodeList(nodes, context, multilines = false, comma = true) {
15440 const { push, newline } = context;
15441 for (let i = 0; i < nodes.length; i++) {
15442 const node = nodes[i];
15443 if (isString(node)) {
15444 push(node, -3 /* Unknown */);
15445 } else if (isArray(node)) {
15446 genNodeListAsArray(node, context);
15447 } else {
15448 genNode(node, context);
15449 }
15450 if (i < nodes.length - 1) {
15451 if (multilines) {
15452 comma && push(",");
15453 newline();
15454 } else {
15455 comma && push(", ");
15456 }
15457 }
15458 }
15459}
15460function genNode(node, context) {
15461 if (isString(node)) {
15462 context.push(node, -3 /* Unknown */);
15463 return;
15464 }
15465 if (isSymbol(node)) {
15466 context.push(context.helper(node));
15467 return;
15468 }
15469 switch (node.type) {
15470 case 1:
15471 case 9:
15472 case 11:
15473 assert(
15474 node.codegenNode != null,
15475 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
15476 );
15477 genNode(node.codegenNode, context);
15478 break;
15479 case 2:
15480 genText(node, context);
15481 break;
15482 case 4:
15483 genExpression(node, context);
15484 break;
15485 case 5:
15486 genInterpolation(node, context);
15487 break;
15488 case 12:
15489 genNode(node.codegenNode, context);
15490 break;
15491 case 8:
15492 genCompoundExpression(node, context);
15493 break;
15494 case 3:
15495 genComment(node, context);
15496 break;
15497 case 13:
15498 genVNodeCall(node, context);
15499 break;
15500 case 14:
15501 genCallExpression(node, context);
15502 break;
15503 case 15:
15504 genObjectExpression(node, context);
15505 break;
15506 case 17:
15507 genArrayExpression(node, context);
15508 break;
15509 case 18:
15510 genFunctionExpression(node, context);
15511 break;
15512 case 19:
15513 genConditionalExpression(node, context);
15514 break;
15515 case 20:
15516 genCacheExpression(node, context);
15517 break;
15518 case 21:
15519 genNodeList(node.body, context, true, false);
15520 break;
15521 // SSR only types
15522 case 22:
15523 break;
15524 case 23:
15525 break;
15526 case 24:
15527 break;
15528 case 25:
15529 break;
15530 case 26:
15531 break;
15532 /* v8 ignore start */
15533 case 10:
15534 break;
15535 default:
15536 {
15537 assert(false, `unhandled codegen node type: ${node.type}`);
15538 const exhaustiveCheck = node;
15539 return exhaustiveCheck;
15540 }
15541 }
15542}
15543function genText(node, context) {
15544 context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15545}
15546function genExpression(node, context) {
15547 const { content, isStatic } = node;
15548 context.push(
15549 isStatic ? JSON.stringify(content) : content,
15550 -3 /* Unknown */,
15551 node
15552 );
15553}
15554function genInterpolation(node, context) {
15555 const { push, helper, pure } = context;
15556 if (pure) push(PURE_ANNOTATION);
15557 push(`${helper(TO_DISPLAY_STRING)}(`);
15558 genNode(node.content, context);
15559 push(`)`);
15560}
15561function genCompoundExpression(node, context) {
15562 for (let i = 0; i < node.children.length; i++) {
15563 const child = node.children[i];
15564 if (isString(child)) {
15565 context.push(child, -3 /* Unknown */);
15566 } else {
15567 genNode(child, context);
15568 }
15569 }
15570}
15571function genExpressionAsPropertyKey(node, context) {
15572 const { push } = context;
15573 if (node.type === 8) {
15574 push(`[`);
15575 genCompoundExpression(node, context);
15576 push(`]`);
15577 } else if (node.isStatic) {
15578 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15579 push(text, -2 /* None */, node);
15580 } else {
15581 push(`[${node.content}]`, -3 /* Unknown */, node);
15582 }
15583}
15584function genComment(node, context) {
15585 const { push, helper, pure } = context;
15586 if (pure) {
15587 push(PURE_ANNOTATION);
15588 }
15589 push(
15590 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15591 -3 /* Unknown */,
15592 node
15593 );
15594}
15595function genVNodeCall(node, context) {
15596 const { push, helper, pure } = context;
15597 const {
15598 tag,
15599 props,
15600 children,
15601 patchFlag,
15602 dynamicProps,
15603 directives,
15604 isBlock,
15605 disableTracking,
15606 isComponent
15607 } = node;
15608 let patchFlagString;
15609 if (patchFlag) {
15610 {
15611 if (patchFlag < 0) {
15612 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
15613 } else {
15614 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
15615 patchFlagString = patchFlag + ` /* ${flagNames} */`;
15616 }
15617 }
15618 }
15619 if (directives) {
15620 push(helper(WITH_DIRECTIVES) + `(`);
15621 }
15622 if (isBlock) {
15623 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
15624 }
15625 if (pure) {
15626 push(PURE_ANNOTATION);
15627 }
15628 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15629 push(helper(callHelper) + `(`, -2 /* None */, node);
15630 genNodeList(
15631 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
15632 context
15633 );
15634 push(`)`);
15635 if (isBlock) {
15636 push(`)`);
15637 }
15638 if (directives) {
15639 push(`, `);
15640 genNode(directives, context);
15641 push(`)`);
15642 }
15643}
15644function genNullableArgs(args) {
15645 let i = args.length;
15646 while (i--) {
15647 if (args[i] != null) break;
15648 }
15649 return args.slice(0, i + 1).map((arg) => arg || `null`);
15650}
15651function genCallExpression(node, context) {
15652 const { push, helper, pure } = context;
15653 const callee = isString(node.callee) ? node.callee : helper(node.callee);
15654 if (pure) {
15655 push(PURE_ANNOTATION);
15656 }
15657 push(callee + `(`, -2 /* None */, node);
15658 genNodeList(node.arguments, context);
15659 push(`)`);
15660}
15661function genObjectExpression(node, context) {
15662 const { push, indent, deindent, newline } = context;
15663 const { properties } = node;
15664 if (!properties.length) {
15665 push(`{}`, -2 /* None */, node);
15666 return;
15667 }
15668 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
15669 push(multilines ? `{` : `{ `);
15670 multilines && indent();
15671 for (let i = 0; i < properties.length; i++) {
15672 const { key, value } = properties[i];
15673 genExpressionAsPropertyKey(key, context);
15674 push(`: `);
15675 genNode(value, context);
15676 if (i < properties.length - 1) {
15677 push(`,`);
15678 newline();
15679 }
15680 }
15681 multilines && deindent();
15682 push(multilines ? `}` : ` }`);
15683}
15684function genArrayExpression(node, context) {
15685 genNodeListAsArray(node.elements, context);
15686}
15687function genFunctionExpression(node, context) {
15688 const { push, indent, deindent } = context;
15689 const { params, returns, body, newline, isSlot } = node;
15690 if (isSlot) {
15691 push(`_${helperNameMap[WITH_CTX]}(`);
15692 }
15693 push(`(`, -2 /* None */, node);
15694 if (isArray(params)) {
15695 genNodeList(params, context);
15696 } else if (params) {
15697 genNode(params, context);
15698 }
15699 push(`) => `);
15700 if (newline || body) {
15701 push(`{`);
15702 indent();
15703 }
15704 if (returns) {
15705 if (newline) {
15706 push(`return `);
15707 }
15708 if (isArray(returns)) {
15709 genNodeListAsArray(returns, context);
15710 } else {
15711 genNode(returns, context);
15712 }
15713 } else if (body) {
15714 genNode(body, context);
15715 }
15716 if (newline || body) {
15717 deindent();
15718 push(`}`);
15719 }
15720 if (isSlot) {
15721 push(`)`);
15722 }
15723}
15724function genConditionalExpression(node, context) {
15725 const { test, consequent, alternate, newline: needNewline } = node;
15726 const { push, indent, deindent, newline } = context;
15727 if (test.type === 4) {
15728 const needsParens = !isSimpleIdentifier(test.content);
15729 needsParens && push(`(`);
15730 genExpression(test, context);
15731 needsParens && push(`)`);
15732 } else {
15733 push(`(`);
15734 genNode(test, context);
15735 push(`)`);
15736 }
15737 needNewline && indent();
15738 context.indentLevel++;
15739 needNewline || push(` `);
15740 push(`? `);
15741 genNode(consequent, context);
15742 context.indentLevel--;
15743 needNewline && newline();
15744 needNewline || push(` `);
15745 push(`: `);
15746 const isNested = alternate.type === 19;
15747 if (!isNested) {
15748 context.indentLevel++;
15749 }
15750 genNode(alternate, context);
15751 if (!isNested) {
15752 context.indentLevel--;
15753 }
15754 needNewline && deindent(
15755 true
15756 /* without newline */
15757 );
15758}
15759function genCacheExpression(node, context) {
15760 const { push, helper, indent, deindent, newline } = context;
15761 const { needPauseTracking, needArraySpread } = node;
15762 if (needArraySpread) {
15763 push(`[...(`);
15764 }
15765 push(`_cache[${node.index}] || (`);
15766 if (needPauseTracking) {
15767 indent();
15768 push(`${helper(SET_BLOCK_TRACKING)}(-1`);
15769 if (node.inVOnce) push(`, true`);
15770 push(`),`);
15771 newline();
15772 push(`(`);
15773 }
15774 push(`_cache[${node.index}] = `);
15775 genNode(node.value, context);
15776 if (needPauseTracking) {
15777 push(`).cacheIndex = ${node.index},`);
15778 newline();
15779 push(`${helper(SET_BLOCK_TRACKING)}(1),`);
15780 newline();
15781 push(`_cache[${node.index}]`);
15782 deindent();
15783 }
15784 push(`)`);
15785 if (needArraySpread) {
15786 push(`)]`);
15787 }
15788}
15789
15790const prohibitedKeywordRE = new RegExp(
15791 "\\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"
15792);
15793const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
15794function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
15795 const exp = node.content;
15796 if (!exp.trim()) {
15797 return;
15798 }
15799 try {
15800 new Function(
15801 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`
15802 );
15803 } catch (e) {
15804 let message = e.message;
15805 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE);
15806 if (keywordMatch) {
15807 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
15808 }
15809 context.onError(
15810 createCompilerError(
15811 45,
15812 node.loc,
15813 void 0,
15814 message
15815 )
15816 );
15817 }
15818}
15819
15820const transformExpression = (node, context) => {
15821 if (node.type === 5) {
15822 node.content = processExpression(
15823 node.content,
15824 context
15825 );
15826 } else if (node.type === 1) {
15827 const memo = findDir(node, "memo");
15828 for (let i = 0; i < node.props.length; i++) {
15829 const dir = node.props[i];
15830 if (dir.type === 7 && dir.name !== "for") {
15831 const exp = dir.exp;
15832 const arg = dir.arg;
15833 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
15834 !(memo && arg && arg.type === 4 && arg.content === "key")) {
15835 dir.exp = processExpression(
15836 exp,
15837 context,
15838 // slot args must be processed as function params
15839 dir.name === "slot"
15840 );
15841 }
15842 if (arg && arg.type === 4 && !arg.isStatic) {
15843 dir.arg = processExpression(arg, context);
15844 }
15845 }
15846 }
15847 }
15848};
15849function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) {
15850 {
15851 {
15852 validateBrowserExpression(node, context, asParams, asRawStatements);
15853 }
15854 return node;
15855 }
15856}
15857
15858const transformIf = createStructuralDirectiveTransform(
15859 /^(if|else|else-if)$/,
15860 (node, dir, context) => {
15861 return processIf(node, dir, context, (ifNode, branch, isRoot) => {
15862 const siblings = context.parent.children;
15863 let i = siblings.indexOf(ifNode);
15864 let key = 0;
15865 while (i-- >= 0) {
15866 const sibling = siblings[i];
15867 if (sibling && sibling.type === 9) {
15868 key += sibling.branches.length;
15869 }
15870 }
15871 return () => {
15872 if (isRoot) {
15873 ifNode.codegenNode = createCodegenNodeForBranch(
15874 branch,
15875 key,
15876 context
15877 );
15878 } else {
15879 const parentCondition = getParentCondition(ifNode.codegenNode);
15880 parentCondition.alternate = createCodegenNodeForBranch(
15881 branch,
15882 key + ifNode.branches.length - 1,
15883 context
15884 );
15885 }
15886 };
15887 });
15888 }
15889);
15890function processIf(node, dir, context, processCodegen) {
15891 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
15892 const loc = dir.exp ? dir.exp.loc : node.loc;
15893 context.onError(
15894 createCompilerError(28, dir.loc)
15895 );
15896 dir.exp = createSimpleExpression(`true`, false, loc);
15897 }
15898 if (dir.exp) {
15899 validateBrowserExpression(dir.exp, context);
15900 }
15901 if (dir.name === "if") {
15902 const branch = createIfBranch(node, dir);
15903 const ifNode = {
15904 type: 9,
15905 loc: cloneLoc(node.loc),
15906 branches: [branch]
15907 };
15908 context.replaceNode(ifNode);
15909 if (processCodegen) {
15910 return processCodegen(ifNode, branch, true);
15911 }
15912 } else {
15913 const siblings = context.parent.children;
15914 const comments = [];
15915 let i = siblings.indexOf(node);
15916 while (i-- >= -1) {
15917 const sibling = siblings[i];
15918 if (sibling && sibling.type === 3) {
15919 context.removeNode(sibling);
15920 comments.unshift(sibling);
15921 continue;
15922 }
15923 if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
15924 context.removeNode(sibling);
15925 continue;
15926 }
15927 if (sibling && sibling.type === 9) {
15928 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
15929 context.onError(
15930 createCompilerError(30, node.loc)
15931 );
15932 }
15933 context.removeNode();
15934 const branch = createIfBranch(node, dir);
15935 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15936 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15937 branch.children = [...comments, ...branch.children];
15938 }
15939 {
15940 const key = branch.userKey;
15941 if (key) {
15942 sibling.branches.forEach(({ userKey }) => {
15943 if (isSameKey(userKey, key)) {
15944 context.onError(
15945 createCompilerError(
15946 29,
15947 branch.userKey.loc
15948 )
15949 );
15950 }
15951 });
15952 }
15953 }
15954 sibling.branches.push(branch);
15955 const onExit = processCodegen && processCodegen(sibling, branch, false);
15956 traverseNode(branch, context);
15957 if (onExit) onExit();
15958 context.currentNode = null;
15959 } else {
15960 context.onError(
15961 createCompilerError(30, node.loc)
15962 );
15963 }
15964 break;
15965 }
15966 }
15967}
15968function createIfBranch(node, dir) {
15969 const isTemplateIf = node.tagType === 3;
15970 return {
15971 type: 10,
15972 loc: node.loc,
15973 condition: dir.name === "else" ? void 0 : dir.exp,
15974 children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
15975 userKey: findProp(node, `key`),
15976 isTemplateIf
15977 };
15978}
15979function createCodegenNodeForBranch(branch, keyIndex, context) {
15980 if (branch.condition) {
15981 return createConditionalExpression(
15982 branch.condition,
15983 createChildrenCodegenNode(branch, keyIndex, context),
15984 // make sure to pass in asBlock: true so that the comment node call
15985 // closes the current block.
15986 createCallExpression(context.helper(CREATE_COMMENT), [
15987 '"v-if"' ,
15988 "true"
15989 ])
15990 );
15991 } else {
15992 return createChildrenCodegenNode(branch, keyIndex, context);
15993 }
15994}
15995function createChildrenCodegenNode(branch, keyIndex, context) {
15996 const { helper } = context;
15997 const keyProperty = createObjectProperty(
15998 `key`,
15999 createSimpleExpression(
16000 `${keyIndex}`,
16001 false,
16002 locStub,
16003 2
16004 )
16005 );
16006 const { children } = branch;
16007 const firstChild = children[0];
16008 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
16009 if (needFragmentWrapper) {
16010 if (children.length === 1 && firstChild.type === 11) {
16011 const vnodeCall = firstChild.codegenNode;
16012 injectProp(vnodeCall, keyProperty, context);
16013 return vnodeCall;
16014 } else {
16015 let patchFlag = 64;
16016 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
16017 patchFlag |= 2048;
16018 }
16019 return createVNodeCall(
16020 context,
16021 helper(FRAGMENT),
16022 createObjectExpression([keyProperty]),
16023 children,
16024 patchFlag,
16025 void 0,
16026 void 0,
16027 true,
16028 false,
16029 false,
16030 branch.loc
16031 );
16032 }
16033 } else {
16034 const ret = firstChild.codegenNode;
16035 const vnodeCall = getMemoedVNodeCall(ret);
16036 if (vnodeCall.type === 13) {
16037 convertToBlock(vnodeCall, context);
16038 }
16039 injectProp(vnodeCall, keyProperty, context);
16040 return ret;
16041 }
16042}
16043function isSameKey(a, b) {
16044 if (!a || a.type !== b.type) {
16045 return false;
16046 }
16047 if (a.type === 6) {
16048 if (a.value.content !== b.value.content) {
16049 return false;
16050 }
16051 } else {
16052 const exp = a.exp;
16053 const branchExp = b.exp;
16054 if (exp.type !== branchExp.type) {
16055 return false;
16056 }
16057 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
16058 return false;
16059 }
16060 }
16061 return true;
16062}
16063function getParentCondition(node) {
16064 while (true) {
16065 if (node.type === 19) {
16066 if (node.alternate.type === 19) {
16067 node = node.alternate;
16068 } else {
16069 return node;
16070 }
16071 } else if (node.type === 20) {
16072 node = node.value;
16073 }
16074 }
16075}
16076
16077const transformBind = (dir, _node, context) => {
16078 const { modifiers, loc } = dir;
16079 const arg = dir.arg;
16080 let { exp } = dir;
16081 if (exp && exp.type === 4 && !exp.content.trim()) {
16082 {
16083 exp = void 0;
16084 }
16085 }
16086 if (!exp) {
16087 if (arg.type !== 4 || !arg.isStatic) {
16088 context.onError(
16089 createCompilerError(
16090 52,
16091 arg.loc
16092 )
16093 );
16094 return {
16095 props: [
16096 createObjectProperty(arg, createSimpleExpression("", true, loc))
16097 ]
16098 };
16099 }
16100 transformBindShorthand(dir);
16101 exp = dir.exp;
16102 }
16103 if (arg.type !== 4) {
16104 arg.children.unshift(`(`);
16105 arg.children.push(`) || ""`);
16106 } else if (!arg.isStatic) {
16107 arg.content = `${arg.content} || ""`;
16108 }
16109 if (modifiers.some((mod) => mod.content === "camel")) {
16110 if (arg.type === 4) {
16111 if (arg.isStatic) {
16112 arg.content = camelize(arg.content);
16113 } else {
16114 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
16115 }
16116 } else {
16117 arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
16118 arg.children.push(`)`);
16119 }
16120 }
16121 if (!context.inSSR) {
16122 if (modifiers.some((mod) => mod.content === "prop")) {
16123 injectPrefix(arg, ".");
16124 }
16125 if (modifiers.some((mod) => mod.content === "attr")) {
16126 injectPrefix(arg, "^");
16127 }
16128 }
16129 return {
16130 props: [createObjectProperty(arg, exp)]
16131 };
16132};
16133const transformBindShorthand = (dir, context) => {
16134 const arg = dir.arg;
16135 const propName = camelize(arg.content);
16136 dir.exp = createSimpleExpression(propName, false, arg.loc);
16137};
16138const injectPrefix = (arg, prefix) => {
16139 if (arg.type === 4) {
16140 if (arg.isStatic) {
16141 arg.content = prefix + arg.content;
16142 } else {
16143 arg.content = `\`${prefix}\${${arg.content}}\``;
16144 }
16145 } else {
16146 arg.children.unshift(`'${prefix}' + (`);
16147 arg.children.push(`)`);
16148 }
16149};
16150
16151const transformFor = createStructuralDirectiveTransform(
16152 "for",
16153 (node, dir, context) => {
16154 const { helper, removeHelper } = context;
16155 return processFor(node, dir, context, (forNode) => {
16156 const renderExp = createCallExpression(helper(RENDER_LIST), [
16157 forNode.source
16158 ]);
16159 const isTemplate = isTemplateNode(node);
16160 const memo = findDir(node, "memo");
16161 const keyProp = findProp(node, `key`, false, true);
16162 const isDirKey = keyProp && keyProp.type === 7;
16163 if (isDirKey && !keyProp.exp) {
16164 transformBindShorthand(keyProp);
16165 }
16166 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16167 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16168 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
16169 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
16170 forNode.codegenNode = createVNodeCall(
16171 context,
16172 helper(FRAGMENT),
16173 void 0,
16174 renderExp,
16175 fragmentFlag,
16176 void 0,
16177 void 0,
16178 true,
16179 !isStableFragment,
16180 false,
16181 node.loc
16182 );
16183 return () => {
16184 let childBlock;
16185 const { children } = forNode;
16186 if (isTemplate) {
16187 node.children.some((c) => {
16188 if (c.type === 1) {
16189 const key = findProp(c, "key");
16190 if (key) {
16191 context.onError(
16192 createCompilerError(
16193 33,
16194 key.loc
16195 )
16196 );
16197 return true;
16198 }
16199 }
16200 });
16201 }
16202 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
16203 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
16204 if (slotOutlet) {
16205 childBlock = slotOutlet.codegenNode;
16206 if (isTemplate && keyProperty) {
16207 injectProp(childBlock, keyProperty, context);
16208 }
16209 } else if (needFragmentWrapper) {
16210 childBlock = createVNodeCall(
16211 context,
16212 helper(FRAGMENT),
16213 keyProperty ? createObjectExpression([keyProperty]) : void 0,
16214 node.children,
16215 64,
16216 void 0,
16217 void 0,
16218 true,
16219 void 0,
16220 false
16221 );
16222 } else {
16223 childBlock = children[0].codegenNode;
16224 if (isTemplate && keyProperty) {
16225 injectProp(childBlock, keyProperty, context);
16226 }
16227 if (childBlock.isBlock !== !isStableFragment) {
16228 if (childBlock.isBlock) {
16229 removeHelper(OPEN_BLOCK);
16230 removeHelper(
16231 getVNodeBlockHelper(context.inSSR, childBlock.isComponent)
16232 );
16233 } else {
16234 removeHelper(
16235 getVNodeHelper(context.inSSR, childBlock.isComponent)
16236 );
16237 }
16238 }
16239 childBlock.isBlock = !isStableFragment;
16240 if (childBlock.isBlock) {
16241 helper(OPEN_BLOCK);
16242 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
16243 } else {
16244 helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
16245 }
16246 }
16247 if (memo) {
16248 const loop = createFunctionExpression(
16249 createForLoopParams(forNode.parseResult, [
16250 createSimpleExpression(`_cached`)
16251 ])
16252 );
16253 loop.body = createBlockStatement([
16254 createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
16255 createCompoundExpression([
16256 `if (_cached`,
16257 ...keyExp ? [` && _cached.key === `, keyExp] : [],
16258 ` && ${context.helperString(
16259 IS_MEMO_SAME
16260 )}(_cached, _memo)) return _cached`
16261 ]),
16262 createCompoundExpression([`const _item = `, childBlock]),
16263 createSimpleExpression(`_item.memo = _memo`),
16264 createSimpleExpression(`return _item`)
16265 ]);
16266 renderExp.arguments.push(
16267 loop,
16268 createSimpleExpression(`_cache`),
16269 createSimpleExpression(String(context.cached.length))
16270 );
16271 context.cached.push(null);
16272 } else {
16273 renderExp.arguments.push(
16274 createFunctionExpression(
16275 createForLoopParams(forNode.parseResult),
16276 childBlock,
16277 true
16278 )
16279 );
16280 }
16281 };
16282 });
16283 }
16284);
16285function processFor(node, dir, context, processCodegen) {
16286 if (!dir.exp) {
16287 context.onError(
16288 createCompilerError(31, dir.loc)
16289 );
16290 return;
16291 }
16292 const parseResult = dir.forParseResult;
16293 if (!parseResult) {
16294 context.onError(
16295 createCompilerError(32, dir.loc)
16296 );
16297 return;
16298 }
16299 finalizeForParseResult(parseResult, context);
16300 const { addIdentifiers, removeIdentifiers, scopes } = context;
16301 const { source, value, key, index } = parseResult;
16302 const forNode = {
16303 type: 11,
16304 loc: dir.loc,
16305 source,
16306 valueAlias: value,
16307 keyAlias: key,
16308 objectIndexAlias: index,
16309 parseResult,
16310 children: isTemplateNode(node) ? node.children : [node]
16311 };
16312 context.replaceNode(forNode);
16313 scopes.vFor++;
16314 const onExit = processCodegen && processCodegen(forNode);
16315 return () => {
16316 scopes.vFor--;
16317 if (onExit) onExit();
16318 };
16319}
16320function finalizeForParseResult(result, context) {
16321 if (result.finalized) return;
16322 {
16323 validateBrowserExpression(result.source, context);
16324 if (result.key) {
16325 validateBrowserExpression(
16326 result.key,
16327 context,
16328 true
16329 );
16330 }
16331 if (result.index) {
16332 validateBrowserExpression(
16333 result.index,
16334 context,
16335 true
16336 );
16337 }
16338 if (result.value) {
16339 validateBrowserExpression(
16340 result.value,
16341 context,
16342 true
16343 );
16344 }
16345 }
16346 result.finalized = true;
16347}
16348function createForLoopParams({ value, key, index }, memoArgs = []) {
16349 return createParamsList([value, key, index, ...memoArgs]);
16350}
16351function createParamsList(args) {
16352 let i = args.length;
16353 while (i--) {
16354 if (args[i]) break;
16355 }
16356 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
16357}
16358
16359const defaultFallback = createSimpleExpression(`undefined`, false);
16360const trackSlotScopes = (node, context) => {
16361 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
16362 const vSlot = findDir(node, "slot");
16363 if (vSlot) {
16364 vSlot.exp;
16365 context.scopes.vSlot++;
16366 return () => {
16367 context.scopes.vSlot--;
16368 };
16369 }
16370 }
16371};
16372const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
16373 props,
16374 children,
16375 false,
16376 true,
16377 children.length ? children[0].loc : loc
16378);
16379function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16380 context.helper(WITH_CTX);
16381 const { children, loc } = node;
16382 const slotsProperties = [];
16383 const dynamicSlots = [];
16384 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
16385 const onComponentSlot = findDir(node, "slot", true);
16386 if (onComponentSlot) {
16387 const { arg, exp } = onComponentSlot;
16388 if (arg && !isStaticExp(arg)) {
16389 hasDynamicSlots = true;
16390 }
16391 slotsProperties.push(
16392 createObjectProperty(
16393 arg || createSimpleExpression("default", true),
16394 buildSlotFn(exp, void 0, children, loc)
16395 )
16396 );
16397 }
16398 let hasTemplateSlots = false;
16399 let hasNamedDefaultSlot = false;
16400 const implicitDefaultChildren = [];
16401 const seenSlotNames = /* @__PURE__ */ new Set();
16402 let conditionalBranchIndex = 0;
16403 for (let i = 0; i < children.length; i++) {
16404 const slotElement = children[i];
16405 let slotDir;
16406 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
16407 if (slotElement.type !== 3) {
16408 implicitDefaultChildren.push(slotElement);
16409 }
16410 continue;
16411 }
16412 if (onComponentSlot) {
16413 context.onError(
16414 createCompilerError(37, slotDir.loc)
16415 );
16416 break;
16417 }
16418 hasTemplateSlots = true;
16419 const { children: slotChildren, loc: slotLoc } = slotElement;
16420 const {
16421 arg: slotName = createSimpleExpression(`default`, true),
16422 exp: slotProps,
16423 loc: dirLoc
16424 } = slotDir;
16425 let staticSlotName;
16426 if (isStaticExp(slotName)) {
16427 staticSlotName = slotName ? slotName.content : `default`;
16428 } else {
16429 hasDynamicSlots = true;
16430 }
16431 const vFor = findDir(slotElement, "for");
16432 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
16433 let vIf;
16434 let vElse;
16435 if (vIf = findDir(slotElement, "if")) {
16436 hasDynamicSlots = true;
16437 dynamicSlots.push(
16438 createConditionalExpression(
16439 vIf.exp,
16440 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++),
16441 defaultFallback
16442 )
16443 );
16444 } else if (vElse = findDir(
16445 slotElement,
16446 /^else(-if)?$/,
16447 true
16448 /* allowEmpty */
16449 )) {
16450 let j = i;
16451 let prev;
16452 while (j--) {
16453 prev = children[j];
16454 if (prev.type !== 3) {
16455 break;
16456 }
16457 }
16458 if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
16459 let conditional = dynamicSlots[dynamicSlots.length - 1];
16460 while (conditional.alternate.type === 19) {
16461 conditional = conditional.alternate;
16462 }
16463 conditional.alternate = vElse.exp ? createConditionalExpression(
16464 vElse.exp,
16465 buildDynamicSlot(
16466 slotName,
16467 slotFunction,
16468 conditionalBranchIndex++
16469 ),
16470 defaultFallback
16471 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
16472 } else {
16473 context.onError(
16474 createCompilerError(30, vElse.loc)
16475 );
16476 }
16477 } else if (vFor) {
16478 hasDynamicSlots = true;
16479 const parseResult = vFor.forParseResult;
16480 if (parseResult) {
16481 finalizeForParseResult(parseResult, context);
16482 dynamicSlots.push(
16483 createCallExpression(context.helper(RENDER_LIST), [
16484 parseResult.source,
16485 createFunctionExpression(
16486 createForLoopParams(parseResult),
16487 buildDynamicSlot(slotName, slotFunction),
16488 true
16489 )
16490 ])
16491 );
16492 } else {
16493 context.onError(
16494 createCompilerError(
16495 32,
16496 vFor.loc
16497 )
16498 );
16499 }
16500 } else {
16501 if (staticSlotName) {
16502 if (seenSlotNames.has(staticSlotName)) {
16503 context.onError(
16504 createCompilerError(
16505 38,
16506 dirLoc
16507 )
16508 );
16509 continue;
16510 }
16511 seenSlotNames.add(staticSlotName);
16512 if (staticSlotName === "default") {
16513 hasNamedDefaultSlot = true;
16514 }
16515 }
16516 slotsProperties.push(createObjectProperty(slotName, slotFunction));
16517 }
16518 }
16519 if (!onComponentSlot) {
16520 const buildDefaultSlotProperty = (props, children2) => {
16521 const fn = buildSlotFn(props, void 0, children2, loc);
16522 return createObjectProperty(`default`, fn);
16523 };
16524 if (!hasTemplateSlots) {
16525 slotsProperties.push(buildDefaultSlotProperty(void 0, children));
16526 } else if (implicitDefaultChildren.length && // #3766
16527 // with whitespace: 'preserve', whitespaces between slots will end up in
16528 // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
16529 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) {
16530 if (hasNamedDefaultSlot) {
16531 context.onError(
16532 createCompilerError(
16533 39,
16534 implicitDefaultChildren[0].loc
16535 )
16536 );
16537 } else {
16538 slotsProperties.push(
16539 buildDefaultSlotProperty(void 0, implicitDefaultChildren)
16540 );
16541 }
16542 }
16543 }
16544 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
16545 let slots = createObjectExpression(
16546 slotsProperties.concat(
16547 createObjectProperty(
16548 `_`,
16549 // 2 = compiled but dynamic = can skip normalization, but must run diff
16550 // 1 = compiled and static = can skip normalization AND diff as optimized
16551 createSimpleExpression(
16552 slotFlag + (` /* ${slotFlagsText[slotFlag]} */` ),
16553 false
16554 )
16555 )
16556 ),
16557 loc
16558 );
16559 if (dynamicSlots.length) {
16560 slots = createCallExpression(context.helper(CREATE_SLOTS), [
16561 slots,
16562 createArrayExpression(dynamicSlots)
16563 ]);
16564 }
16565 return {
16566 slots,
16567 hasDynamicSlots
16568 };
16569}
16570function buildDynamicSlot(name, fn, index) {
16571 const props = [
16572 createObjectProperty(`name`, name),
16573 createObjectProperty(`fn`, fn)
16574 ];
16575 if (index != null) {
16576 props.push(
16577 createObjectProperty(`key`, createSimpleExpression(String(index), true))
16578 );
16579 }
16580 return createObjectExpression(props);
16581}
16582function hasForwardedSlots(children) {
16583 for (let i = 0; i < children.length; i++) {
16584 const child = children[i];
16585 switch (child.type) {
16586 case 1:
16587 if (child.tagType === 2 || hasForwardedSlots(child.children)) {
16588 return true;
16589 }
16590 break;
16591 case 9:
16592 if (hasForwardedSlots(child.branches)) return true;
16593 break;
16594 case 10:
16595 case 11:
16596 if (hasForwardedSlots(child.children)) return true;
16597 break;
16598 }
16599 }
16600 return false;
16601}
16602function isNonWhitespaceContent(node) {
16603 if (node.type !== 2 && node.type !== 12)
16604 return true;
16605 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
16606}
16607
16608const directiveImportMap = /* @__PURE__ */ new WeakMap();
16609const transformElement = (node, context) => {
16610 return function postTransformElement() {
16611 node = context.currentNode;
16612 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
16613 return;
16614 }
16615 const { tag, props } = node;
16616 const isComponent = node.tagType === 1;
16617 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
16618 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
16619 let vnodeProps;
16620 let vnodeChildren;
16621 let patchFlag = 0;
16622 let vnodeDynamicProps;
16623 let dynamicPropNames;
16624 let vnodeDirectives;
16625 let shouldUseBlock = (
16626 // dynamic component may resolve to plain elements
16627 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
16628 // updates inside get proper isSVG flag at runtime. (#639, #643)
16629 // This is technically web-specific, but splitting the logic out of core
16630 // leads to too much unnecessary complexity.
16631 (tag === "svg" || tag === "foreignObject" || tag === "math")
16632 );
16633 if (props.length > 0) {
16634 const propsBuildResult = buildProps(
16635 node,
16636 context,
16637 void 0,
16638 isComponent,
16639 isDynamicComponent
16640 );
16641 vnodeProps = propsBuildResult.props;
16642 patchFlag = propsBuildResult.patchFlag;
16643 dynamicPropNames = propsBuildResult.dynamicPropNames;
16644 const directives = propsBuildResult.directives;
16645 vnodeDirectives = directives && directives.length ? createArrayExpression(
16646 directives.map((dir) => buildDirectiveArgs(dir, context))
16647 ) : void 0;
16648 if (propsBuildResult.shouldUseBlock) {
16649 shouldUseBlock = true;
16650 }
16651 }
16652 if (node.children.length > 0) {
16653 if (vnodeTag === KEEP_ALIVE) {
16654 shouldUseBlock = true;
16655 patchFlag |= 1024;
16656 if (node.children.length > 1) {
16657 context.onError(
16658 createCompilerError(46, {
16659 start: node.children[0].loc.start,
16660 end: node.children[node.children.length - 1].loc.end,
16661 source: ""
16662 })
16663 );
16664 }
16665 }
16666 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling
16667 vnodeTag !== TELEPORT && // explained above.
16668 vnodeTag !== KEEP_ALIVE;
16669 if (shouldBuildAsSlots) {
16670 const { slots, hasDynamicSlots } = buildSlots(node, context);
16671 vnodeChildren = slots;
16672 if (hasDynamicSlots) {
16673 patchFlag |= 1024;
16674 }
16675 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
16676 const child = node.children[0];
16677 const type = child.type;
16678 const hasDynamicTextChild = type === 5 || type === 8;
16679 if (hasDynamicTextChild && getConstantType(child, context) === 0) {
16680 patchFlag |= 1;
16681 }
16682 if (hasDynamicTextChild || type === 2) {
16683 vnodeChildren = child;
16684 } else {
16685 vnodeChildren = node.children;
16686 }
16687 } else {
16688 vnodeChildren = node.children;
16689 }
16690 }
16691 if (dynamicPropNames && dynamicPropNames.length) {
16692 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
16693 }
16694 node.codegenNode = createVNodeCall(
16695 context,
16696 vnodeTag,
16697 vnodeProps,
16698 vnodeChildren,
16699 patchFlag === 0 ? void 0 : patchFlag,
16700 vnodeDynamicProps,
16701 vnodeDirectives,
16702 !!shouldUseBlock,
16703 false,
16704 isComponent,
16705 node.loc
16706 );
16707 };
16708};
16709function resolveComponentType(node, context, ssr = false) {
16710 let { tag } = node;
16711 const isExplicitDynamic = isComponentTag(tag);
16712 const isProp = findProp(
16713 node,
16714 "is",
16715 false,
16716 true
16717 /* allow empty */
16718 );
16719 if (isProp) {
16720 if (isExplicitDynamic || false) {
16721 let exp;
16722 if (isProp.type === 6) {
16723 exp = isProp.value && createSimpleExpression(isProp.value.content, true);
16724 } else {
16725 exp = isProp.exp;
16726 if (!exp) {
16727 exp = createSimpleExpression(`is`, false, isProp.arg.loc);
16728 }
16729 }
16730 if (exp) {
16731 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16732 exp
16733 ]);
16734 }
16735 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
16736 tag = isProp.value.content.slice(4);
16737 }
16738 }
16739 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16740 if (builtIn) {
16741 if (!ssr) context.helper(builtIn);
16742 return builtIn;
16743 }
16744 context.helper(RESOLVE_COMPONENT);
16745 context.components.add(tag);
16746 return toValidAssetId(tag, `component`);
16747}
16748function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
16749 const { tag, loc: elementLoc, children } = node;
16750 let properties = [];
16751 const mergeArgs = [];
16752 const runtimeDirectives = [];
16753 const hasChildren = children.length > 0;
16754 let shouldUseBlock = false;
16755 let patchFlag = 0;
16756 let hasRef = false;
16757 let hasClassBinding = false;
16758 let hasStyleBinding = false;
16759 let hasHydrationEventBinding = false;
16760 let hasDynamicKeys = false;
16761 let hasVnodeHook = false;
16762 const dynamicPropNames = [];
16763 const pushMergeArg = (arg) => {
16764 if (properties.length) {
16765 mergeArgs.push(
16766 createObjectExpression(dedupeProperties(properties), elementLoc)
16767 );
16768 properties = [];
16769 }
16770 if (arg) mergeArgs.push(arg);
16771 };
16772 const pushRefVForMarker = () => {
16773 if (context.scopes.vFor > 0) {
16774 properties.push(
16775 createObjectProperty(
16776 createSimpleExpression("ref_for", true),
16777 createSimpleExpression("true")
16778 )
16779 );
16780 }
16781 };
16782 const analyzePatchFlag = ({ key, value }) => {
16783 if (isStaticExp(key)) {
16784 const name = key.content;
16785 const isEventHandler = isOn(name);
16786 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click
16787 // dedicated fast path.
16788 name.toLowerCase() !== "onclick" && // omit v-model handlers
16789 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks
16790 !isReservedProp(name)) {
16791 hasHydrationEventBinding = true;
16792 }
16793 if (isEventHandler && isReservedProp(name)) {
16794 hasVnodeHook = true;
16795 }
16796 if (isEventHandler && value.type === 14) {
16797 value = value.arguments[0];
16798 }
16799 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
16800 return;
16801 }
16802 if (name === "ref") {
16803 hasRef = true;
16804 } else if (name === "class") {
16805 hasClassBinding = true;
16806 } else if (name === "style") {
16807 hasStyleBinding = true;
16808 } else if (name !== "key" && !dynamicPropNames.includes(name)) {
16809 dynamicPropNames.push(name);
16810 }
16811 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
16812 dynamicPropNames.push(name);
16813 }
16814 } else {
16815 hasDynamicKeys = true;
16816 }
16817 };
16818 for (let i = 0; i < props.length; i++) {
16819 const prop = props[i];
16820 if (prop.type === 6) {
16821 const { loc, name, nameLoc, value } = prop;
16822 let isStatic = true;
16823 if (name === "ref") {
16824 hasRef = true;
16825 pushRefVForMarker();
16826 }
16827 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) {
16828 continue;
16829 }
16830 properties.push(
16831 createObjectProperty(
16832 createSimpleExpression(name, true, nameLoc),
16833 createSimpleExpression(
16834 value ? value.content : "",
16835 isStatic,
16836 value ? value.loc : loc
16837 )
16838 )
16839 );
16840 } else {
16841 const { name, arg, exp, loc, modifiers } = prop;
16842 const isVBind = name === "bind";
16843 const isVOn = name === "on";
16844 if (name === "slot") {
16845 if (!isComponent) {
16846 context.onError(
16847 createCompilerError(40, loc)
16848 );
16849 }
16850 continue;
16851 }
16852 if (name === "once" || name === "memo") {
16853 continue;
16854 }
16855 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) {
16856 continue;
16857 }
16858 if (isVOn && ssr) {
16859 continue;
16860 }
16861 if (
16862 // #938: elements with dynamic keys should be forced into blocks
16863 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
16864 // before children
16865 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
16866 ) {
16867 shouldUseBlock = true;
16868 }
16869 if (isVBind && isStaticArgOf(arg, "ref")) {
16870 pushRefVForMarker();
16871 }
16872 if (!arg && (isVBind || isVOn)) {
16873 hasDynamicKeys = true;
16874 if (exp) {
16875 if (isVBind) {
16876 pushRefVForMarker();
16877 pushMergeArg();
16878 mergeArgs.push(exp);
16879 } else {
16880 pushMergeArg({
16881 type: 14,
16882 loc,
16883 callee: context.helper(TO_HANDLERS),
16884 arguments: isComponent ? [exp] : [exp, `true`]
16885 });
16886 }
16887 } else {
16888 context.onError(
16889 createCompilerError(
16890 isVBind ? 34 : 35,
16891 loc
16892 )
16893 );
16894 }
16895 continue;
16896 }
16897 if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16898 patchFlag |= 32;
16899 }
16900 const directiveTransform = context.directiveTransforms[name];
16901 if (directiveTransform) {
16902 const { props: props2, needRuntime } = directiveTransform(prop, node, context);
16903 !ssr && props2.forEach(analyzePatchFlag);
16904 if (isVOn && arg && !isStaticExp(arg)) {
16905 pushMergeArg(createObjectExpression(props2, elementLoc));
16906 } else {
16907 properties.push(...props2);
16908 }
16909 if (needRuntime) {
16910 runtimeDirectives.push(prop);
16911 if (isSymbol(needRuntime)) {
16912 directiveImportMap.set(prop, needRuntime);
16913 }
16914 }
16915 } else if (!isBuiltInDirective(name)) {
16916 runtimeDirectives.push(prop);
16917 if (hasChildren) {
16918 shouldUseBlock = true;
16919 }
16920 }
16921 }
16922 }
16923 let propsExpression = void 0;
16924 if (mergeArgs.length) {
16925 pushMergeArg();
16926 if (mergeArgs.length > 1) {
16927 propsExpression = createCallExpression(
16928 context.helper(MERGE_PROPS),
16929 mergeArgs,
16930 elementLoc
16931 );
16932 } else {
16933 propsExpression = mergeArgs[0];
16934 }
16935 } else if (properties.length) {
16936 propsExpression = createObjectExpression(
16937 dedupeProperties(properties),
16938 elementLoc
16939 );
16940 }
16941 if (hasDynamicKeys) {
16942 patchFlag |= 16;
16943 } else {
16944 if (hasClassBinding && !isComponent) {
16945 patchFlag |= 2;
16946 }
16947 if (hasStyleBinding && !isComponent) {
16948 patchFlag |= 4;
16949 }
16950 if (dynamicPropNames.length) {
16951 patchFlag |= 8;
16952 }
16953 if (hasHydrationEventBinding) {
16954 patchFlag |= 32;
16955 }
16956 }
16957 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16958 patchFlag |= 512;
16959 }
16960 if (!context.inSSR && propsExpression) {
16961 switch (propsExpression.type) {
16962 case 15:
16963 let classKeyIndex = -1;
16964 let styleKeyIndex = -1;
16965 let hasDynamicKey = false;
16966 for (let i = 0; i < propsExpression.properties.length; i++) {
16967 const key = propsExpression.properties[i].key;
16968 if (isStaticExp(key)) {
16969 if (key.content === "class") {
16970 classKeyIndex = i;
16971 } else if (key.content === "style") {
16972 styleKeyIndex = i;
16973 }
16974 } else if (!key.isHandlerKey) {
16975 hasDynamicKey = true;
16976 }
16977 }
16978 const classProp = propsExpression.properties[classKeyIndex];
16979 const styleProp = propsExpression.properties[styleKeyIndex];
16980 if (!hasDynamicKey) {
16981 if (classProp && !isStaticExp(classProp.value)) {
16982 classProp.value = createCallExpression(
16983 context.helper(NORMALIZE_CLASS),
16984 [classProp.value]
16985 );
16986 }
16987 if (styleProp && // the static style is compiled into an object,
16988 // so use `hasStyleBinding` to ensure that it is a dynamic style binding
16989 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
16990 // v-bind:style with static literal object
16991 styleProp.value.type === 17)) {
16992 styleProp.value = createCallExpression(
16993 context.helper(NORMALIZE_STYLE),
16994 [styleProp.value]
16995 );
16996 }
16997 } else {
16998 propsExpression = createCallExpression(
16999 context.helper(NORMALIZE_PROPS),
17000 [propsExpression]
17001 );
17002 }
17003 break;
17004 case 14:
17005 break;
17006 default:
17007 propsExpression = createCallExpression(
17008 context.helper(NORMALIZE_PROPS),
17009 [
17010 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
17011 propsExpression
17012 ])
17013 ]
17014 );
17015 break;
17016 }
17017 }
17018 return {
17019 props: propsExpression,
17020 directives: runtimeDirectives,
17021 patchFlag,
17022 dynamicPropNames,
17023 shouldUseBlock
17024 };
17025}
17026function dedupeProperties(properties) {
17027 const knownProps = /* @__PURE__ */ new Map();
17028 const deduped = [];
17029 for (let i = 0; i < properties.length; i++) {
17030 const prop = properties[i];
17031 if (prop.key.type === 8 || !prop.key.isStatic) {
17032 deduped.push(prop);
17033 continue;
17034 }
17035 const name = prop.key.content;
17036 const existing = knownProps.get(name);
17037 if (existing) {
17038 if (name === "style" || name === "class" || isOn(name)) {
17039 mergeAsArray(existing, prop);
17040 }
17041 } else {
17042 knownProps.set(name, prop);
17043 deduped.push(prop);
17044 }
17045 }
17046 return deduped;
17047}
17048function mergeAsArray(existing, incoming) {
17049 if (existing.value.type === 17) {
17050 existing.value.elements.push(incoming.value);
17051 } else {
17052 existing.value = createArrayExpression(
17053 [existing.value, incoming.value],
17054 existing.loc
17055 );
17056 }
17057}
17058function buildDirectiveArgs(dir, context) {
17059 const dirArgs = [];
17060 const runtime = directiveImportMap.get(dir);
17061 if (runtime) {
17062 dirArgs.push(context.helperString(runtime));
17063 } else {
17064 {
17065 context.helper(RESOLVE_DIRECTIVE);
17066 context.directives.add(dir.name);
17067 dirArgs.push(toValidAssetId(dir.name, `directive`));
17068 }
17069 }
17070 const { loc } = dir;
17071 if (dir.exp) dirArgs.push(dir.exp);
17072 if (dir.arg) {
17073 if (!dir.exp) {
17074 dirArgs.push(`void 0`);
17075 }
17076 dirArgs.push(dir.arg);
17077 }
17078 if (Object.keys(dir.modifiers).length) {
17079 if (!dir.arg) {
17080 if (!dir.exp) {
17081 dirArgs.push(`void 0`);
17082 }
17083 dirArgs.push(`void 0`);
17084 }
17085 const trueExpression = createSimpleExpression(`true`, false, loc);
17086 dirArgs.push(
17087 createObjectExpression(
17088 dir.modifiers.map(
17089 (modifier) => createObjectProperty(modifier, trueExpression)
17090 ),
17091 loc
17092 )
17093 );
17094 }
17095 return createArrayExpression(dirArgs, dir.loc);
17096}
17097function stringifyDynamicPropNames(props) {
17098 let propsNamesString = `[`;
17099 for (let i = 0, l = props.length; i < l; i++) {
17100 propsNamesString += JSON.stringify(props[i]);
17101 if (i < l - 1) propsNamesString += ", ";
17102 }
17103 return propsNamesString + `]`;
17104}
17105function isComponentTag(tag) {
17106 return tag === "component" || tag === "Component";
17107}
17108
17109const transformSlotOutlet = (node, context) => {
17110 if (isSlotOutlet(node)) {
17111 const { children, loc } = node;
17112 const { slotName, slotProps } = processSlotOutlet(node, context);
17113 const slotArgs = [
17114 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
17115 slotName,
17116 "{}",
17117 "undefined",
17118 "true"
17119 ];
17120 let expectedLen = 2;
17121 if (slotProps) {
17122 slotArgs[2] = slotProps;
17123 expectedLen = 3;
17124 }
17125 if (children.length) {
17126 slotArgs[3] = createFunctionExpression([], children, false, false, loc);
17127 expectedLen = 4;
17128 }
17129 if (context.scopeId && !context.slotted) {
17130 expectedLen = 5;
17131 }
17132 slotArgs.splice(expectedLen);
17133 node.codegenNode = createCallExpression(
17134 context.helper(RENDER_SLOT),
17135 slotArgs,
17136 loc
17137 );
17138 }
17139};
17140function processSlotOutlet(node, context) {
17141 let slotName = `"default"`;
17142 let slotProps = void 0;
17143 const nonNameProps = [];
17144 for (let i = 0; i < node.props.length; i++) {
17145 const p = node.props[i];
17146 if (p.type === 6) {
17147 if (p.value) {
17148 if (p.name === "name") {
17149 slotName = JSON.stringify(p.value.content);
17150 } else {
17151 p.name = camelize(p.name);
17152 nonNameProps.push(p);
17153 }
17154 }
17155 } else {
17156 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
17157 if (p.exp) {
17158 slotName = p.exp;
17159 } else if (p.arg && p.arg.type === 4) {
17160 const name = camelize(p.arg.content);
17161 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
17162 }
17163 } else {
17164 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
17165 p.arg.content = camelize(p.arg.content);
17166 }
17167 nonNameProps.push(p);
17168 }
17169 }
17170 }
17171 if (nonNameProps.length > 0) {
17172 const { props, directives } = buildProps(
17173 node,
17174 context,
17175 nonNameProps,
17176 false,
17177 false
17178 );
17179 slotProps = props;
17180 if (directives.length) {
17181 context.onError(
17182 createCompilerError(
17183 36,
17184 directives[0].loc
17185 )
17186 );
17187 }
17188 }
17189 return {
17190 slotName,
17191 slotProps
17192 };
17193}
17194
17195const transformOn$1 = (dir, node, context, augmentor) => {
17196 const { loc, modifiers, arg } = dir;
17197 if (!dir.exp && !modifiers.length) {
17198 context.onError(createCompilerError(35, loc));
17199 }
17200 let eventName;
17201 if (arg.type === 4) {
17202 if (arg.isStatic) {
17203 let rawName = arg.content;
17204 if (rawName.startsWith("vnode")) {
17205 context.onError(createCompilerError(51, arg.loc));
17206 }
17207 if (rawName.startsWith("vue:")) {
17208 rawName = `vnode-${rawName.slice(4)}`;
17209 }
17210 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
17211 // for non-element and vnode lifecycle event listeners, auto convert
17212 // it to camelCase. See issue #2249
17213 toHandlerKey(camelize(rawName))
17214 ) : (
17215 // preserve case for plain element listeners that have uppercase
17216 // letters, as these may be custom elements' custom events
17217 `on:${rawName}`
17218 );
17219 eventName = createSimpleExpression(eventString, true, arg.loc);
17220 } else {
17221 eventName = createCompoundExpression([
17222 `${context.helperString(TO_HANDLER_KEY)}(`,
17223 arg,
17224 `)`
17225 ]);
17226 }
17227 } else {
17228 eventName = arg;
17229 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
17230 eventName.children.push(`)`);
17231 }
17232 let exp = dir.exp;
17233 if (exp && !exp.content.trim()) {
17234 exp = void 0;
17235 }
17236 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
17237 if (exp) {
17238 const isMemberExp = isMemberExpression(exp);
17239 const isInlineStatement = !(isMemberExp || isFnExpression(exp));
17240 const hasMultipleStatements = exp.content.includes(`;`);
17241 {
17242 validateBrowserExpression(
17243 exp,
17244 context,
17245 false,
17246 hasMultipleStatements
17247 );
17248 }
17249 if (isInlineStatement || shouldCache && isMemberExp) {
17250 exp = createCompoundExpression([
17251 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
17252 exp,
17253 hasMultipleStatements ? `}` : `)`
17254 ]);
17255 }
17256 }
17257 let ret = {
17258 props: [
17259 createObjectProperty(
17260 eventName,
17261 exp || createSimpleExpression(`() => {}`, false, loc)
17262 )
17263 ]
17264 };
17265 if (augmentor) {
17266 ret = augmentor(ret);
17267 }
17268 if (shouldCache) {
17269 ret.props[0].value = context.cache(ret.props[0].value);
17270 }
17271 ret.props.forEach((p) => p.key.isHandlerKey = true);
17272 return ret;
17273};
17274
17275const transformText = (node, context) => {
17276 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
17277 return () => {
17278 const children = node.children;
17279 let currentContainer = void 0;
17280 let hasText = false;
17281 for (let i = 0; i < children.length; i++) {
17282 const child = children[i];
17283 if (isText$1(child)) {
17284 hasText = true;
17285 for (let j = i + 1; j < children.length; j++) {
17286 const next = children[j];
17287 if (isText$1(next)) {
17288 if (!currentContainer) {
17289 currentContainer = children[i] = createCompoundExpression(
17290 [child],
17291 child.loc
17292 );
17293 }
17294 currentContainer.children.push(` + `, next);
17295 children.splice(j, 1);
17296 j--;
17297 } else {
17298 currentContainer = void 0;
17299 break;
17300 }
17301 }
17302 }
17303 }
17304 if (!hasText || // if this is a plain element with a single text child, leave it
17305 // as-is since the runtime has dedicated fast path for this by directly
17306 // setting textContent of the element.
17307 // for component root it's always normalized anyway.
17308 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
17309 // custom directives can potentially add DOM elements arbitrarily,
17310 // we need to avoid setting textContent of the element at runtime
17311 // to avoid accidentally overwriting the DOM elements added
17312 // by the user through custom directives.
17313 !node.props.find(
17314 (p) => p.type === 7 && !context.directiveTransforms[p.name]
17315 ) && // in compat mode, <template> tags with no special directives
17316 // will be rendered as a fragment so its children must be
17317 // converted into vnodes.
17318 true)) {
17319 return;
17320 }
17321 for (let i = 0; i < children.length; i++) {
17322 const child = children[i];
17323 if (isText$1(child) || child.type === 8) {
17324 const callArgs = [];
17325 if (child.type !== 2 || child.content !== " ") {
17326 callArgs.push(child);
17327 }
17328 if (!context.ssr && getConstantType(child, context) === 0) {
17329 callArgs.push(
17330 1 + (` /* ${PatchFlagNames[1]} */` )
17331 );
17332 }
17333 children[i] = {
17334 type: 12,
17335 content: child,
17336 loc: child.loc,
17337 codegenNode: createCallExpression(
17338 context.helper(CREATE_TEXT),
17339 callArgs
17340 )
17341 };
17342 }
17343 }
17344 };
17345 }
17346};
17347
17348const seen$1 = /* @__PURE__ */ new WeakSet();
17349const transformOnce = (node, context) => {
17350 if (node.type === 1 && findDir(node, "once", true)) {
17351 if (seen$1.has(node) || context.inVOnce || context.inSSR) {
17352 return;
17353 }
17354 seen$1.add(node);
17355 context.inVOnce = true;
17356 context.helper(SET_BLOCK_TRACKING);
17357 return () => {
17358 context.inVOnce = false;
17359 const cur = context.currentNode;
17360 if (cur.codegenNode) {
17361 cur.codegenNode = context.cache(
17362 cur.codegenNode,
17363 true,
17364 true
17365 );
17366 }
17367 };
17368 }
17369};
17370
17371const transformModel$1 = (dir, node, context) => {
17372 const { exp, arg } = dir;
17373 if (!exp) {
17374 context.onError(
17375 createCompilerError(41, dir.loc)
17376 );
17377 return createTransformProps();
17378 }
17379 const rawExp = exp.loc.source.trim();
17380 const expString = exp.type === 4 ? exp.content : rawExp;
17381 const bindingType = context.bindingMetadata[rawExp];
17382 if (bindingType === "props" || bindingType === "props-aliased") {
17383 context.onError(createCompilerError(44, exp.loc));
17384 return createTransformProps();
17385 }
17386 const maybeRef = false;
17387 if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
17388 context.onError(
17389 createCompilerError(42, exp.loc)
17390 );
17391 return createTransformProps();
17392 }
17393 const propName = arg ? arg : createSimpleExpression("modelValue", true);
17394 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`;
17395 let assignmentExp;
17396 const eventArg = context.isTS ? `($event: any)` : `$event`;
17397 {
17398 assignmentExp = createCompoundExpression([
17399 `${eventArg} => ((`,
17400 exp,
17401 `) = $event)`
17402 ]);
17403 }
17404 const props = [
17405 // modelValue: foo
17406 createObjectProperty(propName, dir.exp),
17407 // "onUpdate:modelValue": $event => (foo = $event)
17408 createObjectProperty(eventName, assignmentExp)
17409 ];
17410 if (dir.modifiers.length && node.tagType === 1) {
17411 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17412 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17413 props.push(
17414 createObjectProperty(
17415 modifiersKey,
17416 createSimpleExpression(
17417 `{ ${modifiers} }`,
17418 false,
17419 dir.loc,
17420 2
17421 )
17422 )
17423 );
17424 }
17425 return createTransformProps(props);
17426};
17427function createTransformProps(props = []) {
17428 return { props };
17429}
17430
17431const seen = /* @__PURE__ */ new WeakSet();
17432const transformMemo = (node, context) => {
17433 if (node.type === 1) {
17434 const dir = findDir(node, "memo");
17435 if (!dir || seen.has(node)) {
17436 return;
17437 }
17438 seen.add(node);
17439 return () => {
17440 const codegenNode = node.codegenNode || context.currentNode.codegenNode;
17441 if (codegenNode && codegenNode.type === 13) {
17442 if (node.tagType !== 1) {
17443 convertToBlock(codegenNode, context);
17444 }
17445 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
17446 dir.exp,
17447 createFunctionExpression(void 0, codegenNode),
17448 `_cache`,
17449 String(context.cached.length)
17450 ]);
17451 context.cached.push(null);
17452 }
17453 };
17454 }
17455};
17456
17457function getBaseTransformPreset(prefixIdentifiers) {
17458 return [
17459 [
17460 transformOnce,
17461 transformIf,
17462 transformMemo,
17463 transformFor,
17464 ...[],
17465 ...[transformExpression] ,
17466 transformSlotOutlet,
17467 transformElement,
17468 trackSlotScopes,
17469 transformText
17470 ],
17471 {
17472 on: transformOn$1,
17473 bind: transformBind,
17474 model: transformModel$1
17475 }
17476 ];
17477}
17478function baseCompile(source, options = {}) {
17479 const onError = options.onError || defaultOnError;
17480 const isModuleMode = options.mode === "module";
17481 {
17482 if (options.prefixIdentifiers === true) {
17483 onError(createCompilerError(47));
17484 } else if (isModuleMode) {
17485 onError(createCompilerError(48));
17486 }
17487 }
17488 const prefixIdentifiers = false;
17489 if (options.cacheHandlers) {
17490 onError(createCompilerError(49));
17491 }
17492 if (options.scopeId && !isModuleMode) {
17493 onError(createCompilerError(50));
17494 }
17495 const resolvedOptions = extend({}, options, {
17496 prefixIdentifiers
17497 });
17498 const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
17499 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17500 transform(
17501 ast,
17502 extend({}, resolvedOptions, {
17503 nodeTransforms: [
17504 ...nodeTransforms,
17505 ...options.nodeTransforms || []
17506 // user transforms
17507 ],
17508 directiveTransforms: extend(
17509 {},
17510 directiveTransforms,
17511 options.directiveTransforms || {}
17512 // user transforms
17513 )
17514 })
17515 );
17516 return generate(ast, resolvedOptions);
17517}
17518
17519const noopDirectiveTransform = () => ({ props: [] });
17520
17521const V_MODEL_RADIO = Symbol(`vModelRadio` );
17522const V_MODEL_CHECKBOX = Symbol(
17523 `vModelCheckbox`
17524);
17525const V_MODEL_TEXT = Symbol(`vModelText` );
17526const V_MODEL_SELECT = Symbol(
17527 `vModelSelect`
17528);
17529const V_MODEL_DYNAMIC = Symbol(
17530 `vModelDynamic`
17531);
17532const V_ON_WITH_MODIFIERS = Symbol(
17533 `vOnModifiersGuard`
17534);
17535const V_ON_WITH_KEYS = Symbol(
17536 `vOnKeysGuard`
17537);
17538const V_SHOW = Symbol(`vShow` );
17539const TRANSITION = Symbol(`Transition` );
17540const TRANSITION_GROUP = Symbol(
17541 `TransitionGroup`
17542);
17543registerRuntimeHelpers({
17544 [V_MODEL_RADIO]: `vModelRadio`,
17545 [V_MODEL_CHECKBOX]: `vModelCheckbox`,
17546 [V_MODEL_TEXT]: `vModelText`,
17547 [V_MODEL_SELECT]: `vModelSelect`,
17548 [V_MODEL_DYNAMIC]: `vModelDynamic`,
17549 [V_ON_WITH_MODIFIERS]: `withModifiers`,
17550 [V_ON_WITH_KEYS]: `withKeys`,
17551 [V_SHOW]: `vShow`,
17552 [TRANSITION]: `Transition`,
17553 [TRANSITION_GROUP]: `TransitionGroup`
17554});
17555
17556let decoder;
17557function decodeHtmlBrowser(raw, asAttr = false) {
17558 if (!decoder) {
17559 decoder = document.createElement("div");
17560 }
17561 if (asAttr) {
17562 decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
17563 return decoder.children[0].getAttribute("foo");
17564 } else {
17565 decoder.innerHTML = raw;
17566 return decoder.textContent;
17567 }
17568}
17569
17570const parserOptions = {
17571 parseMode: "html",
17572 isVoidTag,
17573 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17574 isPreTag: (tag) => tag === "pre",
17575 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17576 decodeEntities: decodeHtmlBrowser ,
17577 isBuiltInComponent: (tag) => {
17578 if (tag === "Transition" || tag === "transition") {
17579 return TRANSITION;
17580 } else if (tag === "TransitionGroup" || tag === "transition-group") {
17581 return TRANSITION_GROUP;
17582 }
17583 },
17584 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17585 getNamespace(tag, parent, rootNamespace) {
17586 let ns = parent ? parent.ns : rootNamespace;
17587 if (parent && ns === 2) {
17588 if (parent.tag === "annotation-xml") {
17589 if (tag === "svg") {
17590 return 1;
17591 }
17592 if (parent.props.some(
17593 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
17594 )) {
17595 ns = 0;
17596 }
17597 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
17598 ns = 0;
17599 }
17600 } else if (parent && ns === 1) {
17601 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
17602 ns = 0;
17603 }
17604 }
17605 if (ns === 0) {
17606 if (tag === "svg") {
17607 return 1;
17608 }
17609 if (tag === "math") {
17610 return 2;
17611 }
17612 }
17613 return ns;
17614 }
17615};
17616
17617const transformStyle = (node) => {
17618 if (node.type === 1) {
17619 node.props.forEach((p, i) => {
17620 if (p.type === 6 && p.name === "style" && p.value) {
17621 node.props[i] = {
17622 type: 7,
17623 name: `bind`,
17624 arg: createSimpleExpression(`style`, true, p.loc),
17625 exp: parseInlineCSS(p.value.content, p.loc),
17626 modifiers: [],
17627 loc: p.loc
17628 };
17629 }
17630 });
17631 }
17632};
17633const parseInlineCSS = (cssText, loc) => {
17634 const normalized = parseStringStyle(cssText);
17635 return createSimpleExpression(
17636 JSON.stringify(normalized),
17637 false,
17638 loc,
17639 3
17640 );
17641};
17642
17643function createDOMCompilerError(code, loc) {
17644 return createCompilerError(
17645 code,
17646 loc,
17647 DOMErrorMessages
17648 );
17649}
17650const DOMErrorMessages = {
17651 [53]: `v-html is missing expression.`,
17652 [54]: `v-html will override element children.`,
17653 [55]: `v-text is missing expression.`,
17654 [56]: `v-text will override element children.`,
17655 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17656 [58]: `v-model argument is not supported on plain elements.`,
17657 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17658 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17659 [61]: `v-show is missing expression.`,
17660 [62]: `<Transition> expects exactly one child element or component.`,
17661 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17662};
17663
17664const transformVHtml = (dir, node, context) => {
17665 const { exp, loc } = dir;
17666 if (!exp) {
17667 context.onError(
17668 createDOMCompilerError(53, loc)
17669 );
17670 }
17671 if (node.children.length) {
17672 context.onError(
17673 createDOMCompilerError(54, loc)
17674 );
17675 node.children.length = 0;
17676 }
17677 return {
17678 props: [
17679 createObjectProperty(
17680 createSimpleExpression(`innerHTML`, true, loc),
17681 exp || createSimpleExpression("", true)
17682 )
17683 ]
17684 };
17685};
17686
17687const transformVText = (dir, node, context) => {
17688 const { exp, loc } = dir;
17689 if (!exp) {
17690 context.onError(
17691 createDOMCompilerError(55, loc)
17692 );
17693 }
17694 if (node.children.length) {
17695 context.onError(
17696 createDOMCompilerError(56, loc)
17697 );
17698 node.children.length = 0;
17699 }
17700 return {
17701 props: [
17702 createObjectProperty(
17703 createSimpleExpression(`textContent`, true),
17704 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
17705 context.helperString(TO_DISPLAY_STRING),
17706 [exp],
17707 loc
17708 ) : createSimpleExpression("", true)
17709 )
17710 ]
17711 };
17712};
17713
17714const transformModel = (dir, node, context) => {
17715 const baseResult = transformModel$1(dir, node, context);
17716 if (!baseResult.props.length || node.tagType === 1) {
17717 return baseResult;
17718 }
17719 if (dir.arg) {
17720 context.onError(
17721 createDOMCompilerError(
17722 58,
17723 dir.arg.loc
17724 )
17725 );
17726 }
17727 function checkDuplicatedValue() {
17728 const value = findDir(node, "bind");
17729 if (value && isStaticArgOf(value.arg, "value")) {
17730 context.onError(
17731 createDOMCompilerError(
17732 60,
17733 value.loc
17734 )
17735 );
17736 }
17737 }
17738 const { tag } = node;
17739 const isCustomElement = context.isCustomElement(tag);
17740 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
17741 let directiveToUse = V_MODEL_TEXT;
17742 let isInvalidType = false;
17743 if (tag === "input" || isCustomElement) {
17744 const type = findProp(node, `type`);
17745 if (type) {
17746 if (type.type === 7) {
17747 directiveToUse = V_MODEL_DYNAMIC;
17748 } else if (type.value) {
17749 switch (type.value.content) {
17750 case "radio":
17751 directiveToUse = V_MODEL_RADIO;
17752 break;
17753 case "checkbox":
17754 directiveToUse = V_MODEL_CHECKBOX;
17755 break;
17756 case "file":
17757 isInvalidType = true;
17758 context.onError(
17759 createDOMCompilerError(
17760 59,
17761 dir.loc
17762 )
17763 );
17764 break;
17765 default:
17766 checkDuplicatedValue();
17767 break;
17768 }
17769 }
17770 } else if (hasDynamicKeyVBind(node)) {
17771 directiveToUse = V_MODEL_DYNAMIC;
17772 } else {
17773 checkDuplicatedValue();
17774 }
17775 } else if (tag === "select") {
17776 directiveToUse = V_MODEL_SELECT;
17777 } else {
17778 checkDuplicatedValue();
17779 }
17780 if (!isInvalidType) {
17781 baseResult.needRuntime = context.helper(directiveToUse);
17782 }
17783 } else {
17784 context.onError(
17785 createDOMCompilerError(
17786 57,
17787 dir.loc
17788 )
17789 );
17790 }
17791 baseResult.props = baseResult.props.filter(
17792 (p) => !(p.key.type === 4 && p.key.content === "modelValue")
17793 );
17794 return baseResult;
17795};
17796
17797const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
17798const isNonKeyModifier = /* @__PURE__ */ makeMap(
17799 // event propagation management
17800 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
17801);
17802const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
17803const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
17804const resolveModifiers = (key, modifiers, context, loc) => {
17805 const keyModifiers = [];
17806 const nonKeyModifiers = [];
17807 const eventOptionModifiers = [];
17808 for (let i = 0; i < modifiers.length; i++) {
17809 const modifier = modifiers[i].content;
17810 if (isEventOptionModifier(modifier)) {
17811 eventOptionModifiers.push(modifier);
17812 } else {
17813 if (maybeKeyModifier(modifier)) {
17814 if (isStaticExp(key)) {
17815 if (isKeyboardEvent(key.content.toLowerCase())) {
17816 keyModifiers.push(modifier);
17817 } else {
17818 nonKeyModifiers.push(modifier);
17819 }
17820 } else {
17821 keyModifiers.push(modifier);
17822 nonKeyModifiers.push(modifier);
17823 }
17824 } else {
17825 if (isNonKeyModifier(modifier)) {
17826 nonKeyModifiers.push(modifier);
17827 } else {
17828 keyModifiers.push(modifier);
17829 }
17830 }
17831 }
17832 }
17833 return {
17834 keyModifiers,
17835 nonKeyModifiers,
17836 eventOptionModifiers
17837 };
17838};
17839const transformClick = (key, event) => {
17840 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
17841 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
17842 `(`,
17843 key,
17844 `) === "onClick" ? "${event}" : (`,
17845 key,
17846 `)`
17847 ]) : key;
17848};
17849const transformOn = (dir, node, context) => {
17850 return transformOn$1(dir, node, context, (baseResult) => {
17851 const { modifiers } = dir;
17852 if (!modifiers.length) return baseResult;
17853 let { key, value: handlerExp } = baseResult.props[0];
17854 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
17855 if (nonKeyModifiers.includes("right")) {
17856 key = transformClick(key, `onContextmenu`);
17857 }
17858 if (nonKeyModifiers.includes("middle")) {
17859 key = transformClick(key, `onMouseup`);
17860 }
17861 if (nonKeyModifiers.length) {
17862 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
17863 handlerExp,
17864 JSON.stringify(nonKeyModifiers)
17865 ]);
17866 }
17867 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
17868 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
17869 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
17870 handlerExp,
17871 JSON.stringify(keyModifiers)
17872 ]);
17873 }
17874 if (eventOptionModifiers.length) {
17875 const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
17876 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
17877 }
17878 return {
17879 props: [createObjectProperty(key, handlerExp)]
17880 };
17881 });
17882};
17883
17884const transformShow = (dir, node, context) => {
17885 const { exp, loc } = dir;
17886 if (!exp) {
17887 context.onError(
17888 createDOMCompilerError(61, loc)
17889 );
17890 }
17891 return {
17892 props: [],
17893 needRuntime: context.helper(V_SHOW)
17894 };
17895};
17896
17897const transformTransition = (node, context) => {
17898 if (node.type === 1 && node.tagType === 1) {
17899 const component = context.isBuiltInComponent(node.tag);
17900 if (component === TRANSITION) {
17901 return () => {
17902 if (!node.children.length) {
17903 return;
17904 }
17905 if (hasMultipleChildren(node)) {
17906 context.onError(
17907 createDOMCompilerError(
17908 62,
17909 {
17910 start: node.children[0].loc.start,
17911 end: node.children[node.children.length - 1].loc.end,
17912 source: ""
17913 }
17914 )
17915 );
17916 }
17917 const child = node.children[0];
17918 if (child.type === 1) {
17919 for (const p of child.props) {
17920 if (p.type === 7 && p.name === "show") {
17921 node.props.push({
17922 type: 6,
17923 name: "persisted",
17924 nameLoc: node.loc,
17925 value: void 0,
17926 loc: node.loc
17927 });
17928 }
17929 }
17930 }
17931 };
17932 }
17933 }
17934};
17935function hasMultipleChildren(node) {
17936 const children = node.children = node.children.filter(
17937 (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
17938 );
17939 const child = children[0];
17940 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
17941}
17942
17943const ignoreSideEffectTags = (node, context) => {
17944 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
17945 context.onError(
17946 createDOMCompilerError(
17947 63,
17948 node.loc
17949 )
17950 );
17951 context.removeNode();
17952 }
17953};
17954
17955function isValidHTMLNesting(parent, child) {
17956 if (parent in onlyValidChildren) {
17957 return onlyValidChildren[parent].has(child);
17958 }
17959 if (child in onlyValidParents) {
17960 return onlyValidParents[child].has(parent);
17961 }
17962 if (parent in knownInvalidChildren) {
17963 if (knownInvalidChildren[parent].has(child)) return false;
17964 }
17965 if (child in knownInvalidParents) {
17966 if (knownInvalidParents[child].has(parent)) return false;
17967 }
17968 return true;
17969}
17970const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
17971const emptySet = /* @__PURE__ */ new Set([]);
17972const onlyValidChildren = {
17973 head: /* @__PURE__ */ new Set([
17974 "base",
17975 "basefront",
17976 "bgsound",
17977 "link",
17978 "meta",
17979 "title",
17980 "noscript",
17981 "noframes",
17982 "style",
17983 "script",
17984 "template"
17985 ]),
17986 optgroup: /* @__PURE__ */ new Set(["option"]),
17987 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
17988 // table
17989 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
17990 tr: /* @__PURE__ */ new Set(["td", "th"]),
17991 colgroup: /* @__PURE__ */ new Set(["col"]),
17992 tbody: /* @__PURE__ */ new Set(["tr"]),
17993 thead: /* @__PURE__ */ new Set(["tr"]),
17994 tfoot: /* @__PURE__ */ new Set(["tr"]),
17995 // these elements can not have any children elements
17996 script: emptySet,
17997 iframe: emptySet,
17998 option: emptySet,
17999 textarea: emptySet,
18000 style: emptySet,
18001 title: emptySet
18002};
18003const onlyValidParents = {
18004 // sections
18005 html: emptySet,
18006 body: /* @__PURE__ */ new Set(["html"]),
18007 head: /* @__PURE__ */ new Set(["html"]),
18008 // table
18009 td: /* @__PURE__ */ new Set(["tr"]),
18010 colgroup: /* @__PURE__ */ new Set(["table"]),
18011 caption: /* @__PURE__ */ new Set(["table"]),
18012 tbody: /* @__PURE__ */ new Set(["table"]),
18013 tfoot: /* @__PURE__ */ new Set(["table"]),
18014 col: /* @__PURE__ */ new Set(["colgroup"]),
18015 th: /* @__PURE__ */ new Set(["tr"]),
18016 thead: /* @__PURE__ */ new Set(["table"]),
18017 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
18018 // data list
18019 dd: /* @__PURE__ */ new Set(["dl", "div"]),
18020 dt: /* @__PURE__ */ new Set(["dl", "div"]),
18021 // other
18022 figcaption: /* @__PURE__ */ new Set(["figure"]),
18023 // li: new Set(["ul", "ol"]),
18024 summary: /* @__PURE__ */ new Set(["details"]),
18025 area: /* @__PURE__ */ new Set(["map"])
18026};
18027const knownInvalidChildren = {
18028 p: /* @__PURE__ */ new Set([
18029 "address",
18030 "article",
18031 "aside",
18032 "blockquote",
18033 "center",
18034 "details",
18035 "dialog",
18036 "dir",
18037 "div",
18038 "dl",
18039 "fieldset",
18040 "figure",
18041 "footer",
18042 "form",
18043 "h1",
18044 "h2",
18045 "h3",
18046 "h4",
18047 "h5",
18048 "h6",
18049 "header",
18050 "hgroup",
18051 "hr",
18052 "li",
18053 "main",
18054 "nav",
18055 "menu",
18056 "ol",
18057 "p",
18058 "pre",
18059 "section",
18060 "table",
18061 "ul"
18062 ]),
18063 svg: /* @__PURE__ */ new Set([
18064 "b",
18065 "blockquote",
18066 "br",
18067 "code",
18068 "dd",
18069 "div",
18070 "dl",
18071 "dt",
18072 "em",
18073 "embed",
18074 "h1",
18075 "h2",
18076 "h3",
18077 "h4",
18078 "h5",
18079 "h6",
18080 "hr",
18081 "i",
18082 "img",
18083 "li",
18084 "menu",
18085 "meta",
18086 "ol",
18087 "p",
18088 "pre",
18089 "ruby",
18090 "s",
18091 "small",
18092 "span",
18093 "strong",
18094 "sub",
18095 "sup",
18096 "table",
18097 "u",
18098 "ul",
18099 "var"
18100 ])
18101};
18102const knownInvalidParents = {
18103 a: /* @__PURE__ */ new Set(["a"]),
18104 button: /* @__PURE__ */ new Set(["button"]),
18105 dd: /* @__PURE__ */ new Set(["dd", "dt"]),
18106 dt: /* @__PURE__ */ new Set(["dd", "dt"]),
18107 form: /* @__PURE__ */ new Set(["form"]),
18108 li: /* @__PURE__ */ new Set(["li"]),
18109 h1: headings,
18110 h2: headings,
18111 h3: headings,
18112 h4: headings,
18113 h5: headings,
18114 h6: headings
18115};
18116
18117const validateHtmlNesting = (node, context) => {
18118 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
18119 const error = new SyntaxError(
18120 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
18121 );
18122 error.loc = node.loc;
18123 context.onWarn(error);
18124 }
18125};
18126
18127const DOMNodeTransforms = [
18128 transformStyle,
18129 ...[transformTransition, validateHtmlNesting]
18130];
18131const DOMDirectiveTransforms = {
18132 cloak: noopDirectiveTransform,
18133 html: transformVHtml,
18134 text: transformVText,
18135 model: transformModel,
18136 // override compiler-core
18137 on: transformOn,
18138 // override compiler-core
18139 show: transformShow
18140};
18141function compile(src, options = {}) {
18142 return baseCompile(
18143 src,
18144 extend({}, parserOptions, options, {
18145 nodeTransforms: [
18146 // ignore <script> and <tag>
18147 // this is not put inside DOMNodeTransforms because that list is used
18148 // by compiler-ssr to generate vnode fallback branches
18149 ignoreSideEffectTags,
18150 ...DOMNodeTransforms,
18151 ...options.nodeTransforms || []
18152 ],
18153 directiveTransforms: extend(
18154 {},
18155 DOMDirectiveTransforms,
18156 options.directiveTransforms || {}
18157 ),
18158 transformHoist: null
18159 })
18160 );
18161}
18162
18163{
18164 initDev();
18165}
18166const compileCache = /* @__PURE__ */ Object.create(null);
18167function compileToFunction(template, options) {
18168 if (!isString(template)) {
18169 if (template.nodeType) {
18170 template = template.innerHTML;
18171 } else {
18172 warn(`invalid template option: `, template);
18173 return NOOP;
18174 }
18175 }
18176 const key = genCacheKey(template, options);
18177 const cached = compileCache[key];
18178 if (cached) {
18179 return cached;
18180 }
18181 if (template[0] === "#") {
18182 const el = document.querySelector(template);
18183 if (!el) {
18184 warn(`Template element not found or is empty: ${template}`);
18185 }
18186 template = el ? el.innerHTML : ``;
18187 }
18188 const opts = extend(
18189 {
18190 hoistStatic: true,
18191 onError: onError ,
18192 onWarn: (e) => onError(e, true)
18193 },
18194 options
18195 );
18196 if (!opts.isCustomElement && typeof customElements !== "undefined") {
18197 opts.isCustomElement = (tag) => !!customElements.get(tag);
18198 }
18199 const { code } = compile(template, opts);
18200 function onError(err, asWarning = false) {
18201 const message = asWarning ? err.message : `Template compilation error: ${err.message}`;
18202 const codeFrame = err.loc && generateCodeFrame(
18203 template,
18204 err.loc.start.offset,
18205 err.loc.end.offset
18206 );
18207 warn(codeFrame ? `${message}
18208${codeFrame}` : message);
18209 }
18210 const render = new Function("Vue", code)(runtimeDom);
18211 render._rc = true;
18212 return compileCache[key] = render;
18213}
18214registerRuntimeCompiler(compileToFunction);
18215
18216export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };