1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var Vue = (function (exports) {
|
7 | 'use strict';
|
8 |
|
9 |
|
10 |
|
11 | function makeMap(str) {
|
12 | const map = Object.create(null);
|
13 | for (const key of str.split(",")) map[key] = 1;
|
14 | return (val) => val in map;
|
15 | }
|
16 |
|
17 | const EMPTY_OBJ = Object.freeze({}) ;
|
18 | const EMPTY_ARR = Object.freeze([]) ;
|
19 | const NOOP = () => {
|
20 | };
|
21 | const NO = () => false;
|
22 | const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
23 | (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
24 | const isModelListener = (key) => key.startsWith("onUpdate:");
|
25 | const extend = Object.assign;
|
26 | const remove = (arr, el) => {
|
27 | const i = arr.indexOf(el);
|
28 | if (i > -1) {
|
29 | arr.splice(i, 1);
|
30 | }
|
31 | };
|
32 | const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
33 | const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
34 | const isArray = Array.isArray;
|
35 | const isMap = (val) => toTypeString(val) === "[object Map]";
|
36 | const isSet = (val) => toTypeString(val) === "[object Set]";
|
37 | const isDate = (val) => toTypeString(val) === "[object Date]";
|
38 | const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
39 | const isFunction = (val) => typeof val === "function";
|
40 | const isString = (val) => typeof val === "string";
|
41 | const isSymbol = (val) => typeof val === "symbol";
|
42 | const isObject = (val) => val !== null && typeof val === "object";
|
43 | const isPromise = (val) => {
|
44 | return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
45 | };
|
46 | const objectToString = Object.prototype.toString;
|
47 | const toTypeString = (value) => objectToString.call(value);
|
48 | const toRawType = (value) => {
|
49 | return toTypeString(value).slice(8, -1);
|
50 | };
|
51 | const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
52 | const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
53 | const isReservedProp = makeMap(
|
54 |
|
55 | ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
56 | );
|
57 | const isBuiltInDirective = makeMap(
|
58 | "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
59 | );
|
60 | const cacheStringFunction = (fn) => {
|
61 | const cache = Object.create(null);
|
62 | return (str) => {
|
63 | const hit = cache[str];
|
64 | return hit || (cache[str] = fn(str));
|
65 | };
|
66 | };
|
67 | const camelizeRE = /-(\w)/g;
|
68 | const camelize = cacheStringFunction(
|
69 | (str) => {
|
70 | return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
71 | }
|
72 | );
|
73 | const hyphenateRE = /\B([A-Z])/g;
|
74 | const hyphenate = cacheStringFunction(
|
75 | (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
76 | );
|
77 | const capitalize = cacheStringFunction((str) => {
|
78 | return str.charAt(0).toUpperCase() + str.slice(1);
|
79 | });
|
80 | const toHandlerKey = cacheStringFunction(
|
81 | (str) => {
|
82 | const s = str ? `on${capitalize(str)}` : ``;
|
83 | return s;
|
84 | }
|
85 | );
|
86 | const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
87 | const invokeArrayFns = (fns, ...arg) => {
|
88 | for (let i = 0; i < fns.length; i++) {
|
89 | fns[i](...arg);
|
90 | }
|
91 | };
|
92 | const def = (obj, key, value, writable = false) => {
|
93 | Object.defineProperty(obj, key, {
|
94 | configurable: true,
|
95 | enumerable: false,
|
96 | writable,
|
97 | value
|
98 | });
|
99 | };
|
100 | const looseToNumber = (val) => {
|
101 | const n = parseFloat(val);
|
102 | return isNaN(n) ? val : n;
|
103 | };
|
104 | const toNumber = (val) => {
|
105 | const n = isString(val) ? Number(val) : NaN;
|
106 | return isNaN(n) ? val : n;
|
107 | };
|
108 | let _globalThis;
|
109 | const getGlobalThis = () => {
|
110 | return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
111 | };
|
112 |
|
113 | const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
|
114 | const isGloballyAllowed = makeMap(GLOBALS_ALLOWED);
|
115 |
|
116 | function normalizeStyle(value) {
|
117 | if (isArray(value)) {
|
118 | const res = {};
|
119 | for (let i = 0; i < value.length; i++) {
|
120 | const item = value[i];
|
121 | const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
122 | if (normalized) {
|
123 | for (const key in normalized) {
|
124 | res[key] = normalized[key];
|
125 | }
|
126 | }
|
127 | }
|
128 | return res;
|
129 | } else if (isString(value) || isObject(value)) {
|
130 | return value;
|
131 | }
|
132 | }
|
133 | const listDelimiterRE = /;(?![^(]*\))/g;
|
134 | const propertyDelimiterRE = /:([^]+)/;
|
135 | const styleCommentRE = /\/\*[^]*?\*\//g;
|
136 | function parseStringStyle(cssText) {
|
137 | const ret = {};
|
138 | cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
139 | if (item) {
|
140 | const tmp = item.split(propertyDelimiterRE);
|
141 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
142 | }
|
143 | });
|
144 | return ret;
|
145 | }
|
146 | function stringifyStyle(styles) {
|
147 | if (!styles) return "";
|
148 | if (isString(styles)) return styles;
|
149 | let ret = "";
|
150 | for (const key in styles) {
|
151 | const value = styles[key];
|
152 | if (isString(value) || typeof value === "number") {
|
153 | const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
154 | ret += `${normalizedKey}:${value};`;
|
155 | }
|
156 | }
|
157 | return ret;
|
158 | }
|
159 | function normalizeClass(value) {
|
160 | let res = "";
|
161 | if (isString(value)) {
|
162 | res = value;
|
163 | } else if (isArray(value)) {
|
164 | for (let i = 0; i < value.length; i++) {
|
165 | const normalized = normalizeClass(value[i]);
|
166 | if (normalized) {
|
167 | res += normalized + " ";
|
168 | }
|
169 | }
|
170 | } else if (isObject(value)) {
|
171 | for (const name in value) {
|
172 | if (value[name]) {
|
173 | res += name + " ";
|
174 | }
|
175 | }
|
176 | }
|
177 | return res.trim();
|
178 | }
|
179 | function normalizeProps(props) {
|
180 | if (!props) return null;
|
181 | let { class: klass, style } = props;
|
182 | if (klass && !isString(klass)) {
|
183 | props.class = normalizeClass(klass);
|
184 | }
|
185 | if (style) {
|
186 | props.style = normalizeStyle(style);
|
187 | }
|
188 | return props;
|
189 | }
|
190 |
|
191 | const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
192 | const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
193 | const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
194 | const isHTMLTag = makeMap(HTML_TAGS);
|
195 | const isSVGTag = makeMap(SVG_TAGS);
|
196 | const isMathMLTag = makeMap(MATH_TAGS);
|
197 |
|
198 | const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
199 | const isSpecialBooleanAttr = makeMap(specialBooleanAttrs);
|
200 | const isBooleanAttr = makeMap(
|
201 | specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
202 | );
|
203 | function includeBooleanAttr(value) {
|
204 | return !!value || value === "";
|
205 | }
|
206 | const isKnownHtmlAttr = makeMap(
|
207 | `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`
|
208 | );
|
209 | const isKnownSvgAttr = makeMap(
|
210 | `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`
|
211 | );
|
212 | function isRenderableAttrValue(value) {
|
213 | if (value == null) {
|
214 | return false;
|
215 | }
|
216 | const type = typeof value;
|
217 | return type === "string" || type === "number" || type === "boolean";
|
218 | }
|
219 |
|
220 | const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
221 | function getEscapedCssVarName(key, doubleEscape) {
|
222 | return key.replace(
|
223 | cssVarNameEscapeSymbolsRE,
|
224 | (s) => `\\${s}`
|
225 | );
|
226 | }
|
227 |
|
228 | function looseCompareArrays(a, b) {
|
229 | if (a.length !== b.length) return false;
|
230 | let equal = true;
|
231 | for (let i = 0; equal && i < a.length; i++) {
|
232 | equal = looseEqual(a[i], b[i]);
|
233 | }
|
234 | return equal;
|
235 | }
|
236 | function looseEqual(a, b) {
|
237 | if (a === b) return true;
|
238 | let aValidType = isDate(a);
|
239 | let bValidType = isDate(b);
|
240 | if (aValidType || bValidType) {
|
241 | return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
242 | }
|
243 | aValidType = isSymbol(a);
|
244 | bValidType = isSymbol(b);
|
245 | if (aValidType || bValidType) {
|
246 | return a === b;
|
247 | }
|
248 | aValidType = isArray(a);
|
249 | bValidType = isArray(b);
|
250 | if (aValidType || bValidType) {
|
251 | return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
252 | }
|
253 | aValidType = isObject(a);
|
254 | bValidType = isObject(b);
|
255 | if (aValidType || bValidType) {
|
256 | if (!aValidType || !bValidType) {
|
257 | return false;
|
258 | }
|
259 | const aKeysCount = Object.keys(a).length;
|
260 | const bKeysCount = Object.keys(b).length;
|
261 | if (aKeysCount !== bKeysCount) {
|
262 | return false;
|
263 | }
|
264 | for (const key in a) {
|
265 | const aHasKey = a.hasOwnProperty(key);
|
266 | const bHasKey = b.hasOwnProperty(key);
|
267 | if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
268 | return false;
|
269 | }
|
270 | }
|
271 | }
|
272 | return String(a) === String(b);
|
273 | }
|
274 | function looseIndexOf(arr, val) {
|
275 | return arr.findIndex((item) => looseEqual(item, val));
|
276 | }
|
277 |
|
278 | const isRef$1 = (val) => {
|
279 | return !!(val && val["__v_isRef"] === true);
|
280 | };
|
281 | const toDisplayString = (val) => {
|
282 | 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);
|
283 | };
|
284 | const replacer = (_key, val) => {
|
285 | if (isRef$1(val)) {
|
286 | return replacer(_key, val.value);
|
287 | } else if (isMap(val)) {
|
288 | return {
|
289 | [`Map(${val.size})`]: [...val.entries()].reduce(
|
290 | (entries, [key, val2], i) => {
|
291 | entries[stringifySymbol(key, i) + " =>"] = val2;
|
292 | return entries;
|
293 | },
|
294 | {}
|
295 | )
|
296 | };
|
297 | } else if (isSet(val)) {
|
298 | return {
|
299 | [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
300 | };
|
301 | } else if (isSymbol(val)) {
|
302 | return stringifySymbol(val);
|
303 | } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
304 | return String(val);
|
305 | }
|
306 | return val;
|
307 | };
|
308 | const stringifySymbol = (v, i = "") => {
|
309 | var _a;
|
310 | return (
|
311 |
|
312 |
|
313 | isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
|
314 | );
|
315 | };
|
316 |
|
317 | function warn$2(msg, ...args) {
|
318 | console.warn(`[Vue warn] ${msg}`, ...args);
|
319 | }
|
320 |
|
321 | let activeEffectScope;
|
322 | class EffectScope {
|
323 | constructor(detached = false) {
|
324 | this.detached = detached;
|
325 | |
326 |
|
327 |
|
328 | this._active = true;
|
329 | |
330 |
|
331 |
|
332 | this.effects = [];
|
333 | |
334 |
|
335 |
|
336 | this.cleanups = [];
|
337 | this._isPaused = false;
|
338 | this.parent = activeEffectScope;
|
339 | if (!detached && activeEffectScope) {
|
340 | this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
|
341 | this
|
342 | ) - 1;
|
343 | }
|
344 | }
|
345 | get active() {
|
346 | return this._active;
|
347 | }
|
348 | pause() {
|
349 | if (this._active) {
|
350 | this._isPaused = true;
|
351 | let i, l;
|
352 | if (this.scopes) {
|
353 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
354 | this.scopes[i].pause();
|
355 | }
|
356 | }
|
357 | for (i = 0, l = this.effects.length; i < l; i++) {
|
358 | this.effects[i].pause();
|
359 | }
|
360 | }
|
361 | }
|
362 | |
363 |
|
364 |
|
365 | resume() {
|
366 | if (this._active) {
|
367 | if (this._isPaused) {
|
368 | this._isPaused = false;
|
369 | let i, l;
|
370 | if (this.scopes) {
|
371 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
372 | this.scopes[i].resume();
|
373 | }
|
374 | }
|
375 | for (i = 0, l = this.effects.length; i < l; i++) {
|
376 | this.effects[i].resume();
|
377 | }
|
378 | }
|
379 | }
|
380 | }
|
381 | run(fn) {
|
382 | if (this._active) {
|
383 | const currentEffectScope = activeEffectScope;
|
384 | try {
|
385 | activeEffectScope = this;
|
386 | return fn();
|
387 | } finally {
|
388 | activeEffectScope = currentEffectScope;
|
389 | }
|
390 | } else {
|
391 | warn$2(`cannot run an inactive effect scope.`);
|
392 | }
|
393 | }
|
394 | |
395 |
|
396 |
|
397 |
|
398 | on() {
|
399 | activeEffectScope = this;
|
400 | }
|
401 | |
402 |
|
403 |
|
404 |
|
405 | off() {
|
406 | activeEffectScope = this.parent;
|
407 | }
|
408 | stop(fromParent) {
|
409 | if (this._active) {
|
410 | this._active = false;
|
411 | let i, l;
|
412 | for (i = 0, l = this.effects.length; i < l; i++) {
|
413 | this.effects[i].stop();
|
414 | }
|
415 | this.effects.length = 0;
|
416 | for (i = 0, l = this.cleanups.length; i < l; i++) {
|
417 | this.cleanups[i]();
|
418 | }
|
419 | this.cleanups.length = 0;
|
420 | if (this.scopes) {
|
421 | for (i = 0, l = this.scopes.length; i < l; i++) {
|
422 | this.scopes[i].stop(true);
|
423 | }
|
424 | this.scopes.length = 0;
|
425 | }
|
426 | if (!this.detached && this.parent && !fromParent) {
|
427 | const last = this.parent.scopes.pop();
|
428 | if (last && last !== this) {
|
429 | this.parent.scopes[this.index] = last;
|
430 | last.index = this.index;
|
431 | }
|
432 | }
|
433 | this.parent = void 0;
|
434 | }
|
435 | }
|
436 | }
|
437 | function effectScope(detached) {
|
438 | return new EffectScope(detached);
|
439 | }
|
440 | function getCurrentScope() {
|
441 | return activeEffectScope;
|
442 | }
|
443 | function onScopeDispose(fn, failSilently = false) {
|
444 | if (activeEffectScope) {
|
445 | activeEffectScope.cleanups.push(fn);
|
446 | } else if (!failSilently) {
|
447 | warn$2(
|
448 | `onScopeDispose() is called when there is no active effect scope to be associated with.`
|
449 | );
|
450 | }
|
451 | }
|
452 |
|
453 | let activeSub;
|
454 | const pausedQueueEffects = new WeakSet();
|
455 | class ReactiveEffect {
|
456 | constructor(fn) {
|
457 | this.fn = fn;
|
458 | |
459 |
|
460 |
|
461 | this.deps = void 0;
|
462 | |
463 |
|
464 |
|
465 | this.depsTail = void 0;
|
466 | |
467 |
|
468 |
|
469 | this.flags = 1 | 4;
|
470 | |
471 |
|
472 |
|
473 | this.next = void 0;
|
474 | |
475 |
|
476 |
|
477 | this.cleanup = void 0;
|
478 | this.scheduler = void 0;
|
479 | if (activeEffectScope && activeEffectScope.active) {
|
480 | activeEffectScope.effects.push(this);
|
481 | }
|
482 | }
|
483 | pause() {
|
484 | this.flags |= 64;
|
485 | }
|
486 | resume() {
|
487 | if (this.flags & 64) {
|
488 | this.flags &= ~64;
|
489 | if (pausedQueueEffects.has(this)) {
|
490 | pausedQueueEffects.delete(this);
|
491 | this.trigger();
|
492 | }
|
493 | }
|
494 | }
|
495 | |
496 |
|
497 |
|
498 | notify() {
|
499 | if (this.flags & 2 && !(this.flags & 32)) {
|
500 | return;
|
501 | }
|
502 | if (!(this.flags & 8)) {
|
503 | batch(this);
|
504 | }
|
505 | }
|
506 | run() {
|
507 | if (!(this.flags & 1)) {
|
508 | return this.fn();
|
509 | }
|
510 | this.flags |= 2;
|
511 | cleanupEffect(this);
|
512 | prepareDeps(this);
|
513 | const prevEffect = activeSub;
|
514 | const prevShouldTrack = shouldTrack;
|
515 | activeSub = this;
|
516 | shouldTrack = true;
|
517 | try {
|
518 | return this.fn();
|
519 | } finally {
|
520 | if (activeSub !== this) {
|
521 | warn$2(
|
522 | "Active effect was not restored correctly - this is likely a Vue internal bug."
|
523 | );
|
524 | }
|
525 | cleanupDeps(this);
|
526 | activeSub = prevEffect;
|
527 | shouldTrack = prevShouldTrack;
|
528 | this.flags &= ~2;
|
529 | }
|
530 | }
|
531 | stop() {
|
532 | if (this.flags & 1) {
|
533 | for (let link = this.deps; link; link = link.nextDep) {
|
534 | removeSub(link);
|
535 | }
|
536 | this.deps = this.depsTail = void 0;
|
537 | cleanupEffect(this);
|
538 | this.onStop && this.onStop();
|
539 | this.flags &= ~1;
|
540 | }
|
541 | }
|
542 | trigger() {
|
543 | if (this.flags & 64) {
|
544 | pausedQueueEffects.add(this);
|
545 | } else if (this.scheduler) {
|
546 | this.scheduler();
|
547 | } else {
|
548 | this.runIfDirty();
|
549 | }
|
550 | }
|
551 | |
552 |
|
553 |
|
554 | runIfDirty() {
|
555 | if (isDirty(this)) {
|
556 | this.run();
|
557 | }
|
558 | }
|
559 | get dirty() {
|
560 | return isDirty(this);
|
561 | }
|
562 | }
|
563 | let batchDepth = 0;
|
564 | let batchedSub;
|
565 | let batchedComputed;
|
566 | function batch(sub, isComputed = false) {
|
567 | sub.flags |= 8;
|
568 | if (isComputed) {
|
569 | sub.next = batchedComputed;
|
570 | batchedComputed = sub;
|
571 | return;
|
572 | }
|
573 | sub.next = batchedSub;
|
574 | batchedSub = sub;
|
575 | }
|
576 | function startBatch() {
|
577 | batchDepth++;
|
578 | }
|
579 | function endBatch() {
|
580 | if (--batchDepth > 0) {
|
581 | return;
|
582 | }
|
583 | if (batchedComputed) {
|
584 | let e = batchedComputed;
|
585 | batchedComputed = void 0;
|
586 | while (e) {
|
587 | const next = e.next;
|
588 | e.next = void 0;
|
589 | e.flags &= ~8;
|
590 | e = next;
|
591 | }
|
592 | }
|
593 | let error;
|
594 | while (batchedSub) {
|
595 | let e = batchedSub;
|
596 | batchedSub = void 0;
|
597 | while (e) {
|
598 | const next = e.next;
|
599 | e.next = void 0;
|
600 | e.flags &= ~8;
|
601 | if (e.flags & 1) {
|
602 | try {
|
603 | ;
|
604 | e.trigger();
|
605 | } catch (err) {
|
606 | if (!error) error = err;
|
607 | }
|
608 | }
|
609 | e = next;
|
610 | }
|
611 | }
|
612 | if (error) throw error;
|
613 | }
|
614 | function prepareDeps(sub) {
|
615 | for (let link = sub.deps; link; link = link.nextDep) {
|
616 | link.version = -1;
|
617 | link.prevActiveLink = link.dep.activeLink;
|
618 | link.dep.activeLink = link;
|
619 | }
|
620 | }
|
621 | function cleanupDeps(sub) {
|
622 | let head;
|
623 | let tail = sub.depsTail;
|
624 | let link = tail;
|
625 | while (link) {
|
626 | const prev = link.prevDep;
|
627 | if (link.version === -1) {
|
628 | if (link === tail) tail = prev;
|
629 | removeSub(link);
|
630 | removeDep(link);
|
631 | } else {
|
632 | head = link;
|
633 | }
|
634 | link.dep.activeLink = link.prevActiveLink;
|
635 | link.prevActiveLink = void 0;
|
636 | link = prev;
|
637 | }
|
638 | sub.deps = head;
|
639 | sub.depsTail = tail;
|
640 | }
|
641 | function isDirty(sub) {
|
642 | for (let link = sub.deps; link; link = link.nextDep) {
|
643 | if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
|
644 | return true;
|
645 | }
|
646 | }
|
647 | if (sub._dirty) {
|
648 | return true;
|
649 | }
|
650 | return false;
|
651 | }
|
652 | function refreshComputed(computed) {
|
653 | if (computed.flags & 4 && !(computed.flags & 16)) {
|
654 | return;
|
655 | }
|
656 | computed.flags &= ~16;
|
657 | if (computed.globalVersion === globalVersion) {
|
658 | return;
|
659 | }
|
660 | computed.globalVersion = globalVersion;
|
661 | const dep = computed.dep;
|
662 | computed.flags |= 2;
|
663 | if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
|
664 | computed.flags &= ~2;
|
665 | return;
|
666 | }
|
667 | const prevSub = activeSub;
|
668 | const prevShouldTrack = shouldTrack;
|
669 | activeSub = computed;
|
670 | shouldTrack = true;
|
671 | try {
|
672 | prepareDeps(computed);
|
673 | const value = computed.fn(computed._value);
|
674 | if (dep.version === 0 || hasChanged(value, computed._value)) {
|
675 | computed._value = value;
|
676 | dep.version++;
|
677 | }
|
678 | } catch (err) {
|
679 | dep.version++;
|
680 | throw err;
|
681 | } finally {
|
682 | activeSub = prevSub;
|
683 | shouldTrack = prevShouldTrack;
|
684 | cleanupDeps(computed);
|
685 | computed.flags &= ~2;
|
686 | }
|
687 | }
|
688 | function removeSub(link, soft = false) {
|
689 | const { dep, prevSub, nextSub } = link;
|
690 | if (prevSub) {
|
691 | prevSub.nextSub = nextSub;
|
692 | link.prevSub = void 0;
|
693 | }
|
694 | if (nextSub) {
|
695 | nextSub.prevSub = prevSub;
|
696 | link.nextSub = void 0;
|
697 | }
|
698 | if (dep.subsHead === link) {
|
699 | dep.subsHead = nextSub;
|
700 | }
|
701 | if (dep.subs === link) {
|
702 | dep.subs = prevSub;
|
703 | if (!prevSub && dep.computed) {
|
704 | dep.computed.flags &= ~4;
|
705 | for (let l = dep.computed.deps; l; l = l.nextDep) {
|
706 | removeSub(l, true);
|
707 | }
|
708 | }
|
709 | }
|
710 | if (!soft && !--dep.sc && dep.map) {
|
711 | dep.map.delete(dep.key);
|
712 | }
|
713 | }
|
714 | function removeDep(link) {
|
715 | const { prevDep, nextDep } = link;
|
716 | if (prevDep) {
|
717 | prevDep.nextDep = nextDep;
|
718 | link.prevDep = void 0;
|
719 | }
|
720 | if (nextDep) {
|
721 | nextDep.prevDep = prevDep;
|
722 | link.nextDep = void 0;
|
723 | }
|
724 | }
|
725 | function effect(fn, options) {
|
726 | if (fn.effect instanceof ReactiveEffect) {
|
727 | fn = fn.effect.fn;
|
728 | }
|
729 | const e = new ReactiveEffect(fn);
|
730 | if (options) {
|
731 | extend(e, options);
|
732 | }
|
733 | try {
|
734 | e.run();
|
735 | } catch (err) {
|
736 | e.stop();
|
737 | throw err;
|
738 | }
|
739 | const runner = e.run.bind(e);
|
740 | runner.effect = e;
|
741 | return runner;
|
742 | }
|
743 | function stop(runner) {
|
744 | runner.effect.stop();
|
745 | }
|
746 | let shouldTrack = true;
|
747 | const trackStack = [];
|
748 | function pauseTracking() {
|
749 | trackStack.push(shouldTrack);
|
750 | shouldTrack = false;
|
751 | }
|
752 | function resetTracking() {
|
753 | const last = trackStack.pop();
|
754 | shouldTrack = last === void 0 ? true : last;
|
755 | }
|
756 | function cleanupEffect(e) {
|
757 | const { cleanup } = e;
|
758 | e.cleanup = void 0;
|
759 | if (cleanup) {
|
760 | const prevSub = activeSub;
|
761 | activeSub = void 0;
|
762 | try {
|
763 | cleanup();
|
764 | } finally {
|
765 | activeSub = prevSub;
|
766 | }
|
767 | }
|
768 | }
|
769 |
|
770 | let globalVersion = 0;
|
771 | class Link {
|
772 | constructor(sub, dep) {
|
773 | this.sub = sub;
|
774 | this.dep = dep;
|
775 | this.version = dep.version;
|
776 | this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
777 | }
|
778 | }
|
779 | class Dep {
|
780 | constructor(computed) {
|
781 | this.computed = computed;
|
782 | this.version = 0;
|
783 | |
784 |
|
785 |
|
786 | this.activeLink = void 0;
|
787 | |
788 |
|
789 |
|
790 | this.subs = void 0;
|
791 | |
792 |
|
793 |
|
794 | this.map = void 0;
|
795 | this.key = void 0;
|
796 | |
797 |
|
798 |
|
799 | this.sc = 0;
|
800 | {
|
801 | this.subsHead = void 0;
|
802 | }
|
803 | }
|
804 | track(debugInfo) {
|
805 | if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
806 | return;
|
807 | }
|
808 | let link = this.activeLink;
|
809 | if (link === void 0 || link.sub !== activeSub) {
|
810 | link = this.activeLink = new Link(activeSub, this);
|
811 | if (!activeSub.deps) {
|
812 | activeSub.deps = activeSub.depsTail = link;
|
813 | } else {
|
814 | link.prevDep = activeSub.depsTail;
|
815 | activeSub.depsTail.nextDep = link;
|
816 | activeSub.depsTail = link;
|
817 | }
|
818 | addSub(link);
|
819 | } else if (link.version === -1) {
|
820 | link.version = this.version;
|
821 | if (link.nextDep) {
|
822 | const next = link.nextDep;
|
823 | next.prevDep = link.prevDep;
|
824 | if (link.prevDep) {
|
825 | link.prevDep.nextDep = next;
|
826 | }
|
827 | link.prevDep = activeSub.depsTail;
|
828 | link.nextDep = void 0;
|
829 | activeSub.depsTail.nextDep = link;
|
830 | activeSub.depsTail = link;
|
831 | if (activeSub.deps === link) {
|
832 | activeSub.deps = next;
|
833 | }
|
834 | }
|
835 | }
|
836 | if (activeSub.onTrack) {
|
837 | activeSub.onTrack(
|
838 | extend(
|
839 | {
|
840 | effect: activeSub
|
841 | },
|
842 | debugInfo
|
843 | )
|
844 | );
|
845 | }
|
846 | return link;
|
847 | }
|
848 | trigger(debugInfo) {
|
849 | this.version++;
|
850 | globalVersion++;
|
851 | this.notify(debugInfo);
|
852 | }
|
853 | notify(debugInfo) {
|
854 | startBatch();
|
855 | try {
|
856 | if (true) {
|
857 | for (let head = this.subsHead; head; head = head.nextSub) {
|
858 | if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
859 | head.sub.onTrigger(
|
860 | extend(
|
861 | {
|
862 | effect: head.sub
|
863 | },
|
864 | debugInfo
|
865 | )
|
866 | );
|
867 | }
|
868 | }
|
869 | }
|
870 | for (let link = this.subs; link; link = link.prevSub) {
|
871 | if (link.sub.notify()) {
|
872 | ;
|
873 | link.sub.dep.notify();
|
874 | }
|
875 | }
|
876 | } finally {
|
877 | endBatch();
|
878 | }
|
879 | }
|
880 | }
|
881 | function addSub(link) {
|
882 | link.dep.sc++;
|
883 | if (link.sub.flags & 4) {
|
884 | const computed = link.dep.computed;
|
885 | if (computed && !link.dep.subs) {
|
886 | computed.flags |= 4 | 16;
|
887 | for (let l = computed.deps; l; l = l.nextDep) {
|
888 | addSub(l);
|
889 | }
|
890 | }
|
891 | const currentTail = link.dep.subs;
|
892 | if (currentTail !== link) {
|
893 | link.prevSub = currentTail;
|
894 | if (currentTail) currentTail.nextSub = link;
|
895 | }
|
896 | if (link.dep.subsHead === void 0) {
|
897 | link.dep.subsHead = link;
|
898 | }
|
899 | link.dep.subs = link;
|
900 | }
|
901 | }
|
902 | const targetMap = new WeakMap();
|
903 | const ITERATE_KEY = Symbol(
|
904 | "Object iterate"
|
905 | );
|
906 | const MAP_KEY_ITERATE_KEY = Symbol(
|
907 | "Map keys iterate"
|
908 | );
|
909 | const ARRAY_ITERATE_KEY = Symbol(
|
910 | "Array iterate"
|
911 | );
|
912 | function track(target, type, key) {
|
913 | if (shouldTrack && activeSub) {
|
914 | let depsMap = targetMap.get(target);
|
915 | if (!depsMap) {
|
916 | targetMap.set(target, depsMap = new Map());
|
917 | }
|
918 | let dep = depsMap.get(key);
|
919 | if (!dep) {
|
920 | depsMap.set(key, dep = new Dep());
|
921 | dep.map = depsMap;
|
922 | dep.key = key;
|
923 | }
|
924 | {
|
925 | dep.track({
|
926 | target,
|
927 | type,
|
928 | key
|
929 | });
|
930 | }
|
931 | }
|
932 | }
|
933 | function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
934 | const depsMap = targetMap.get(target);
|
935 | if (!depsMap) {
|
936 | globalVersion++;
|
937 | return;
|
938 | }
|
939 | const run = (dep) => {
|
940 | if (dep) {
|
941 | {
|
942 | dep.trigger({
|
943 | target,
|
944 | type,
|
945 | key,
|
946 | newValue,
|
947 | oldValue,
|
948 | oldTarget
|
949 | });
|
950 | }
|
951 | }
|
952 | };
|
953 | startBatch();
|
954 | if (type === "clear") {
|
955 | depsMap.forEach(run);
|
956 | } else {
|
957 | const targetIsArray = isArray(target);
|
958 | const isArrayIndex = targetIsArray && isIntegerKey(key);
|
959 | if (targetIsArray && key === "length") {
|
960 | const newLength = Number(newValue);
|
961 | depsMap.forEach((dep, key2) => {
|
962 | if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
963 | run(dep);
|
964 | }
|
965 | });
|
966 | } else {
|
967 | if (key !== void 0 || depsMap.has(void 0)) {
|
968 | run(depsMap.get(key));
|
969 | }
|
970 | if (isArrayIndex) {
|
971 | run(depsMap.get(ARRAY_ITERATE_KEY));
|
972 | }
|
973 | switch (type) {
|
974 | case "add":
|
975 | if (!targetIsArray) {
|
976 | run(depsMap.get(ITERATE_KEY));
|
977 | if (isMap(target)) {
|
978 | run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
979 | }
|
980 | } else if (isArrayIndex) {
|
981 | run(depsMap.get("length"));
|
982 | }
|
983 | break;
|
984 | case "delete":
|
985 | if (!targetIsArray) {
|
986 | run(depsMap.get(ITERATE_KEY));
|
987 | if (isMap(target)) {
|
988 | run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
989 | }
|
990 | }
|
991 | break;
|
992 | case "set":
|
993 | if (isMap(target)) {
|
994 | run(depsMap.get(ITERATE_KEY));
|
995 | }
|
996 | break;
|
997 | }
|
998 | }
|
999 | }
|
1000 | endBatch();
|
1001 | }
|
1002 | function getDepFromReactive(object, key) {
|
1003 | const depMap = targetMap.get(object);
|
1004 | return depMap && depMap.get(key);
|
1005 | }
|
1006 |
|
1007 | function reactiveReadArray(array) {
|
1008 | const raw = toRaw(array);
|
1009 | if (raw === array) return raw;
|
1010 | track(raw, "iterate", ARRAY_ITERATE_KEY);
|
1011 | return isShallow(array) ? raw : raw.map(toReactive);
|
1012 | }
|
1013 | function shallowReadArray(arr) {
|
1014 | track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
1015 | return arr;
|
1016 | }
|
1017 | const arrayInstrumentations = {
|
1018 | __proto__: null,
|
1019 | [Symbol.iterator]() {
|
1020 | return iterator(this, Symbol.iterator, toReactive);
|
1021 | },
|
1022 | concat(...args) {
|
1023 | return reactiveReadArray(this).concat(
|
1024 | ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
|
1025 | );
|
1026 | },
|
1027 | entries() {
|
1028 | return iterator(this, "entries", (value) => {
|
1029 | value[1] = toReactive(value[1]);
|
1030 | return value;
|
1031 | });
|
1032 | },
|
1033 | every(fn, thisArg) {
|
1034 | return apply(this, "every", fn, thisArg, void 0, arguments);
|
1035 | },
|
1036 | filter(fn, thisArg) {
|
1037 | return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
1038 | },
|
1039 | find(fn, thisArg) {
|
1040 | return apply(this, "find", fn, thisArg, toReactive, arguments);
|
1041 | },
|
1042 | findIndex(fn, thisArg) {
|
1043 | return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
1044 | },
|
1045 | findLast(fn, thisArg) {
|
1046 | return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
1047 | },
|
1048 | findLastIndex(fn, thisArg) {
|
1049 | return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
1050 | },
|
1051 |
|
1052 | forEach(fn, thisArg) {
|
1053 | return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
1054 | },
|
1055 | includes(...args) {
|
1056 | return searchProxy(this, "includes", args);
|
1057 | },
|
1058 | indexOf(...args) {
|
1059 | return searchProxy(this, "indexOf", args);
|
1060 | },
|
1061 | join(separator) {
|
1062 | return reactiveReadArray(this).join(separator);
|
1063 | },
|
1064 |
|
1065 | lastIndexOf(...args) {
|
1066 | return searchProxy(this, "lastIndexOf", args);
|
1067 | },
|
1068 | map(fn, thisArg) {
|
1069 | return apply(this, "map", fn, thisArg, void 0, arguments);
|
1070 | },
|
1071 | pop() {
|
1072 | return noTracking(this, "pop");
|
1073 | },
|
1074 | push(...args) {
|
1075 | return noTracking(this, "push", args);
|
1076 | },
|
1077 | reduce(fn, ...args) {
|
1078 | return reduce(this, "reduce", fn, args);
|
1079 | },
|
1080 | reduceRight(fn, ...args) {
|
1081 | return reduce(this, "reduceRight", fn, args);
|
1082 | },
|
1083 | shift() {
|
1084 | return noTracking(this, "shift");
|
1085 | },
|
1086 |
|
1087 | some(fn, thisArg) {
|
1088 | return apply(this, "some", fn, thisArg, void 0, arguments);
|
1089 | },
|
1090 | splice(...args) {
|
1091 | return noTracking(this, "splice", args);
|
1092 | },
|
1093 | toReversed() {
|
1094 | return reactiveReadArray(this).toReversed();
|
1095 | },
|
1096 | toSorted(comparer) {
|
1097 | return reactiveReadArray(this).toSorted(comparer);
|
1098 | },
|
1099 | toSpliced(...args) {
|
1100 | return reactiveReadArray(this).toSpliced(...args);
|
1101 | },
|
1102 | unshift(...args) {
|
1103 | return noTracking(this, "unshift", args);
|
1104 | },
|
1105 | values() {
|
1106 | return iterator(this, "values", toReactive);
|
1107 | }
|
1108 | };
|
1109 | function iterator(self, method, wrapValue) {
|
1110 | const arr = shallowReadArray(self);
|
1111 | const iter = arr[method]();
|
1112 | if (arr !== self && !isShallow(self)) {
|
1113 | iter._next = iter.next;
|
1114 | iter.next = () => {
|
1115 | const result = iter._next();
|
1116 | if (result.value) {
|
1117 | result.value = wrapValue(result.value);
|
1118 | }
|
1119 | return result;
|
1120 | };
|
1121 | }
|
1122 | return iter;
|
1123 | }
|
1124 | const arrayProto = Array.prototype;
|
1125 | function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
1126 | const arr = shallowReadArray(self);
|
1127 | const needsWrap = arr !== self && !isShallow(self);
|
1128 | const methodFn = arr[method];
|
1129 | if (methodFn !== arrayProto[method]) {
|
1130 | const result2 = methodFn.apply(self, args);
|
1131 | return needsWrap ? toReactive(result2) : result2;
|
1132 | }
|
1133 | let wrappedFn = fn;
|
1134 | if (arr !== self) {
|
1135 | if (needsWrap) {
|
1136 | wrappedFn = function(item, index) {
|
1137 | return fn.call(this, toReactive(item), index, self);
|
1138 | };
|
1139 | } else if (fn.length > 2) {
|
1140 | wrappedFn = function(item, index) {
|
1141 | return fn.call(this, item, index, self);
|
1142 | };
|
1143 | }
|
1144 | }
|
1145 | const result = methodFn.call(arr, wrappedFn, thisArg);
|
1146 | return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
1147 | }
|
1148 | function reduce(self, method, fn, args) {
|
1149 | const arr = shallowReadArray(self);
|
1150 | let wrappedFn = fn;
|
1151 | if (arr !== self) {
|
1152 | if (!isShallow(self)) {
|
1153 | wrappedFn = function(acc, item, index) {
|
1154 | return fn.call(this, acc, toReactive(item), index, self);
|
1155 | };
|
1156 | } else if (fn.length > 3) {
|
1157 | wrappedFn = function(acc, item, index) {
|
1158 | return fn.call(this, acc, item, index, self);
|
1159 | };
|
1160 | }
|
1161 | }
|
1162 | return arr[method](wrappedFn, ...args);
|
1163 | }
|
1164 | function searchProxy(self, method, args) {
|
1165 | const arr = toRaw(self);
|
1166 | track(arr, "iterate", ARRAY_ITERATE_KEY);
|
1167 | const res = arr[method](...args);
|
1168 | if ((res === -1 || res === false) && isProxy(args[0])) {
|
1169 | args[0] = toRaw(args[0]);
|
1170 | return arr[method](...args);
|
1171 | }
|
1172 | return res;
|
1173 | }
|
1174 | function noTracking(self, method, args = []) {
|
1175 | pauseTracking();
|
1176 | startBatch();
|
1177 | const res = toRaw(self)[method].apply(self, args);
|
1178 | endBatch();
|
1179 | resetTracking();
|
1180 | return res;
|
1181 | }
|
1182 |
|
1183 | const isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`);
|
1184 | const builtInSymbols = new Set(
|
1185 | Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
1186 | );
|
1187 | function hasOwnProperty(key) {
|
1188 | if (!isSymbol(key)) key = String(key);
|
1189 | const obj = toRaw(this);
|
1190 | track(obj, "has", key);
|
1191 | return obj.hasOwnProperty(key);
|
1192 | }
|
1193 | class BaseReactiveHandler {
|
1194 | constructor(_isReadonly = false, _isShallow = false) {
|
1195 | this._isReadonly = _isReadonly;
|
1196 | this._isShallow = _isShallow;
|
1197 | }
|
1198 | get(target, key, receiver) {
|
1199 | if (key === "__v_skip") return target["__v_skip"];
|
1200 | const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
1201 | if (key === "__v_isReactive") {
|
1202 | return !isReadonly2;
|
1203 | } else if (key === "__v_isReadonly") {
|
1204 | return isReadonly2;
|
1205 | } else if (key === "__v_isShallow") {
|
1206 | return isShallow2;
|
1207 | } else if (key === "__v_raw") {
|
1208 | if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) ||
|
1209 |
|
1210 | Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
1211 | return target;
|
1212 | }
|
1213 | return;
|
1214 | }
|
1215 | const targetIsArray = isArray(target);
|
1216 | if (!isReadonly2) {
|
1217 | let fn;
|
1218 | if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
1219 | return fn;
|
1220 | }
|
1221 | if (key === "hasOwnProperty") {
|
1222 | return hasOwnProperty;
|
1223 | }
|
1224 | }
|
1225 | const res = Reflect.get(
|
1226 | target,
|
1227 | key,
|
1228 |
|
1229 |
|
1230 |
|
1231 | isRef(target) ? target : receiver
|
1232 | );
|
1233 | if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
1234 | return res;
|
1235 | }
|
1236 | if (!isReadonly2) {
|
1237 | track(target, "get", key);
|
1238 | }
|
1239 | if (isShallow2) {
|
1240 | return res;
|
1241 | }
|
1242 | if (isRef(res)) {
|
1243 | return targetIsArray && isIntegerKey(key) ? res : res.value;
|
1244 | }
|
1245 | if (isObject(res)) {
|
1246 | return isReadonly2 ? readonly(res) : reactive(res);
|
1247 | }
|
1248 | return res;
|
1249 | }
|
1250 | }
|
1251 | class MutableReactiveHandler extends BaseReactiveHandler {
|
1252 | constructor(isShallow2 = false) {
|
1253 | super(false, isShallow2);
|
1254 | }
|
1255 | set(target, key, value, receiver) {
|
1256 | let oldValue = target[key];
|
1257 | if (!this._isShallow) {
|
1258 | const isOldValueReadonly = isReadonly(oldValue);
|
1259 | if (!isShallow(value) && !isReadonly(value)) {
|
1260 | oldValue = toRaw(oldValue);
|
1261 | value = toRaw(value);
|
1262 | }
|
1263 | if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
1264 | if (isOldValueReadonly) {
|
1265 | return false;
|
1266 | } else {
|
1267 | oldValue.value = value;
|
1268 | return true;
|
1269 | }
|
1270 | }
|
1271 | }
|
1272 | const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
1273 | const result = Reflect.set(
|
1274 | target,
|
1275 | key,
|
1276 | value,
|
1277 | isRef(target) ? target : receiver
|
1278 | );
|
1279 | if (target === toRaw(receiver)) {
|
1280 | if (!hadKey) {
|
1281 | trigger(target, "add", key, value);
|
1282 | } else if (hasChanged(value, oldValue)) {
|
1283 | trigger(target, "set", key, value, oldValue);
|
1284 | }
|
1285 | }
|
1286 | return result;
|
1287 | }
|
1288 | deleteProperty(target, key) {
|
1289 | const hadKey = hasOwn(target, key);
|
1290 | const oldValue = target[key];
|
1291 | const result = Reflect.deleteProperty(target, key);
|
1292 | if (result && hadKey) {
|
1293 | trigger(target, "delete", key, void 0, oldValue);
|
1294 | }
|
1295 | return result;
|
1296 | }
|
1297 | has(target, key) {
|
1298 | const result = Reflect.has(target, key);
|
1299 | if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
1300 | track(target, "has", key);
|
1301 | }
|
1302 | return result;
|
1303 | }
|
1304 | ownKeys(target) {
|
1305 | track(
|
1306 | target,
|
1307 | "iterate",
|
1308 | isArray(target) ? "length" : ITERATE_KEY
|
1309 | );
|
1310 | return Reflect.ownKeys(target);
|
1311 | }
|
1312 | }
|
1313 | class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
1314 | constructor(isShallow2 = false) {
|
1315 | super(true, isShallow2);
|
1316 | }
|
1317 | set(target, key) {
|
1318 | {
|
1319 | warn$2(
|
1320 | `Set operation on key "${String(key)}" failed: target is readonly.`,
|
1321 | target
|
1322 | );
|
1323 | }
|
1324 | return true;
|
1325 | }
|
1326 | deleteProperty(target, key) {
|
1327 | {
|
1328 | warn$2(
|
1329 | `Delete operation on key "${String(key)}" failed: target is readonly.`,
|
1330 | target
|
1331 | );
|
1332 | }
|
1333 | return true;
|
1334 | }
|
1335 | }
|
1336 | const mutableHandlers = new MutableReactiveHandler();
|
1337 | const readonlyHandlers = new ReadonlyReactiveHandler();
|
1338 | const shallowReactiveHandlers = new MutableReactiveHandler(true);
|
1339 | const shallowReadonlyHandlers = new ReadonlyReactiveHandler(true);
|
1340 |
|
1341 | const toShallow = (value) => value;
|
1342 | const getProto = (v) => Reflect.getPrototypeOf(v);
|
1343 | function createIterableMethod(method, isReadonly2, isShallow2) {
|
1344 | return function(...args) {
|
1345 | const target = this["__v_raw"];
|
1346 | const rawTarget = toRaw(target);
|
1347 | const targetIsMap = isMap(rawTarget);
|
1348 | const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
1349 | const isKeyOnly = method === "keys" && targetIsMap;
|
1350 | const innerIterator = target[method](...args);
|
1351 | const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
1352 | !isReadonly2 && track(
|
1353 | rawTarget,
|
1354 | "iterate",
|
1355 | isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
|
1356 | );
|
1357 | return {
|
1358 |
|
1359 | next() {
|
1360 | const { value, done } = innerIterator.next();
|
1361 | return done ? { value, done } : {
|
1362 | value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
1363 | done
|
1364 | };
|
1365 | },
|
1366 |
|
1367 | [Symbol.iterator]() {
|
1368 | return this;
|
1369 | }
|
1370 | };
|
1371 | };
|
1372 | }
|
1373 | function createReadonlyMethod(type) {
|
1374 | return function(...args) {
|
1375 | {
|
1376 | const key = args[0] ? `on key "${args[0]}" ` : ``;
|
1377 | warn$2(
|
1378 | `${capitalize(type)} operation ${key}failed: target is readonly.`,
|
1379 | toRaw(this)
|
1380 | );
|
1381 | }
|
1382 | return type === "delete" ? false : type === "clear" ? void 0 : this;
|
1383 | };
|
1384 | }
|
1385 | function createInstrumentations(readonly, shallow) {
|
1386 | const instrumentations = {
|
1387 | get(key) {
|
1388 | const target = this["__v_raw"];
|
1389 | const rawTarget = toRaw(target);
|
1390 | const rawKey = toRaw(key);
|
1391 | if (!readonly) {
|
1392 | if (hasChanged(key, rawKey)) {
|
1393 | track(rawTarget, "get", key);
|
1394 | }
|
1395 | track(rawTarget, "get", rawKey);
|
1396 | }
|
1397 | const { has } = getProto(rawTarget);
|
1398 | const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
1399 | if (has.call(rawTarget, key)) {
|
1400 | return wrap(target.get(key));
|
1401 | } else if (has.call(rawTarget, rawKey)) {
|
1402 | return wrap(target.get(rawKey));
|
1403 | } else if (target !== rawTarget) {
|
1404 | target.get(key);
|
1405 | }
|
1406 | },
|
1407 | get size() {
|
1408 | const target = this["__v_raw"];
|
1409 | !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
1410 | return Reflect.get(target, "size", target);
|
1411 | },
|
1412 | has(key) {
|
1413 | const target = this["__v_raw"];
|
1414 | const rawTarget = toRaw(target);
|
1415 | const rawKey = toRaw(key);
|
1416 | if (!readonly) {
|
1417 | if (hasChanged(key, rawKey)) {
|
1418 | track(rawTarget, "has", key);
|
1419 | }
|
1420 | track(rawTarget, "has", rawKey);
|
1421 | }
|
1422 | return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
1423 | },
|
1424 | forEach(callback, thisArg) {
|
1425 | const observed = this;
|
1426 | const target = observed["__v_raw"];
|
1427 | const rawTarget = toRaw(target);
|
1428 | const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
1429 | !readonly && track(rawTarget, "iterate", ITERATE_KEY);
|
1430 | return target.forEach((value, key) => {
|
1431 | return callback.call(thisArg, wrap(value), wrap(key), observed);
|
1432 | });
|
1433 | }
|
1434 | };
|
1435 | extend(
|
1436 | instrumentations,
|
1437 | readonly ? {
|
1438 | add: createReadonlyMethod("add"),
|
1439 | set: createReadonlyMethod("set"),
|
1440 | delete: createReadonlyMethod("delete"),
|
1441 | clear: createReadonlyMethod("clear")
|
1442 | } : {
|
1443 | add(value) {
|
1444 | if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
1445 | value = toRaw(value);
|
1446 | }
|
1447 | const target = toRaw(this);
|
1448 | const proto = getProto(target);
|
1449 | const hadKey = proto.has.call(target, value);
|
1450 | if (!hadKey) {
|
1451 | target.add(value);
|
1452 | trigger(target, "add", value, value);
|
1453 | }
|
1454 | return this;
|
1455 | },
|
1456 | set(key, value) {
|
1457 | if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
1458 | value = toRaw(value);
|
1459 | }
|
1460 | const target = toRaw(this);
|
1461 | const { has, get } = getProto(target);
|
1462 | let hadKey = has.call(target, key);
|
1463 | if (!hadKey) {
|
1464 | key = toRaw(key);
|
1465 | hadKey = has.call(target, key);
|
1466 | } else {
|
1467 | checkIdentityKeys(target, has, key);
|
1468 | }
|
1469 | const oldValue = get.call(target, key);
|
1470 | target.set(key, value);
|
1471 | if (!hadKey) {
|
1472 | trigger(target, "add", key, value);
|
1473 | } else if (hasChanged(value, oldValue)) {
|
1474 | trigger(target, "set", key, value, oldValue);
|
1475 | }
|
1476 | return this;
|
1477 | },
|
1478 | delete(key) {
|
1479 | const target = toRaw(this);
|
1480 | const { has, get } = getProto(target);
|
1481 | let hadKey = has.call(target, key);
|
1482 | if (!hadKey) {
|
1483 | key = toRaw(key);
|
1484 | hadKey = has.call(target, key);
|
1485 | } else {
|
1486 | checkIdentityKeys(target, has, key);
|
1487 | }
|
1488 | const oldValue = get ? get.call(target, key) : void 0;
|
1489 | const result = target.delete(key);
|
1490 | if (hadKey) {
|
1491 | trigger(target, "delete", key, void 0, oldValue);
|
1492 | }
|
1493 | return result;
|
1494 | },
|
1495 | clear() {
|
1496 | const target = toRaw(this);
|
1497 | const hadItems = target.size !== 0;
|
1498 | const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
|
1499 | const result = target.clear();
|
1500 | if (hadItems) {
|
1501 | trigger(
|
1502 | target,
|
1503 | "clear",
|
1504 | void 0,
|
1505 | void 0,
|
1506 | oldTarget
|
1507 | );
|
1508 | }
|
1509 | return result;
|
1510 | }
|
1511 | }
|
1512 | );
|
1513 | const iteratorMethods = [
|
1514 | "keys",
|
1515 | "values",
|
1516 | "entries",
|
1517 | Symbol.iterator
|
1518 | ];
|
1519 | iteratorMethods.forEach((method) => {
|
1520 | instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
1521 | });
|
1522 | return instrumentations;
|
1523 | }
|
1524 | function createInstrumentationGetter(isReadonly2, shallow) {
|
1525 | const instrumentations = createInstrumentations(isReadonly2, shallow);
|
1526 | return (target, key, receiver) => {
|
1527 | if (key === "__v_isReactive") {
|
1528 | return !isReadonly2;
|
1529 | } else if (key === "__v_isReadonly") {
|
1530 | return isReadonly2;
|
1531 | } else if (key === "__v_raw") {
|
1532 | return target;
|
1533 | }
|
1534 | return Reflect.get(
|
1535 | hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
1536 | key,
|
1537 | receiver
|
1538 | );
|
1539 | };
|
1540 | }
|
1541 | const mutableCollectionHandlers = {
|
1542 | get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
1543 | };
|
1544 | const shallowCollectionHandlers = {
|
1545 | get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
1546 | };
|
1547 | const readonlyCollectionHandlers = {
|
1548 | get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
1549 | };
|
1550 | const shallowReadonlyCollectionHandlers = {
|
1551 | get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
1552 | };
|
1553 | function checkIdentityKeys(target, has, key) {
|
1554 | const rawKey = toRaw(key);
|
1555 | if (rawKey !== key && has.call(target, rawKey)) {
|
1556 | const type = toRawType(target);
|
1557 | warn$2(
|
1558 | `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.`
|
1559 | );
|
1560 | }
|
1561 | }
|
1562 |
|
1563 | const reactiveMap = new WeakMap();
|
1564 | const shallowReactiveMap = new WeakMap();
|
1565 | const readonlyMap = new WeakMap();
|
1566 | const shallowReadonlyMap = new WeakMap();
|
1567 | function targetTypeMap(rawType) {
|
1568 | switch (rawType) {
|
1569 | case "Object":
|
1570 | case "Array":
|
1571 | return 1 ;
|
1572 | case "Map":
|
1573 | case "Set":
|
1574 | case "WeakMap":
|
1575 | case "WeakSet":
|
1576 | return 2 ;
|
1577 | default:
|
1578 | return 0 ;
|
1579 | }
|
1580 | }
|
1581 | function getTargetType(value) {
|
1582 | return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
1583 | }
|
1584 | function reactive(target) {
|
1585 | if (isReadonly(target)) {
|
1586 | return target;
|
1587 | }
|
1588 | return createReactiveObject(
|
1589 | target,
|
1590 | false,
|
1591 | mutableHandlers,
|
1592 | mutableCollectionHandlers,
|
1593 | reactiveMap
|
1594 | );
|
1595 | }
|
1596 | function shallowReactive(target) {
|
1597 | return createReactiveObject(
|
1598 | target,
|
1599 | false,
|
1600 | shallowReactiveHandlers,
|
1601 | shallowCollectionHandlers,
|
1602 | shallowReactiveMap
|
1603 | );
|
1604 | }
|
1605 | function readonly(target) {
|
1606 | return createReactiveObject(
|
1607 | target,
|
1608 | true,
|
1609 | readonlyHandlers,
|
1610 | readonlyCollectionHandlers,
|
1611 | readonlyMap
|
1612 | );
|
1613 | }
|
1614 | function shallowReadonly(target) {
|
1615 | return createReactiveObject(
|
1616 | target,
|
1617 | true,
|
1618 | shallowReadonlyHandlers,
|
1619 | shallowReadonlyCollectionHandlers,
|
1620 | shallowReadonlyMap
|
1621 | );
|
1622 | }
|
1623 | function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
1624 | if (!isObject(target)) {
|
1625 | {
|
1626 | warn$2(
|
1627 | `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
|
1628 | target
|
1629 | )}`
|
1630 | );
|
1631 | }
|
1632 | return target;
|
1633 | }
|
1634 | if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
1635 | return target;
|
1636 | }
|
1637 | const existingProxy = proxyMap.get(target);
|
1638 | if (existingProxy) {
|
1639 | return existingProxy;
|
1640 | }
|
1641 | const targetType = getTargetType(target);
|
1642 | if (targetType === 0 ) {
|
1643 | return target;
|
1644 | }
|
1645 | const proxy = new Proxy(
|
1646 | target,
|
1647 | targetType === 2 ? collectionHandlers : baseHandlers
|
1648 | );
|
1649 | proxyMap.set(target, proxy);
|
1650 | return proxy;
|
1651 | }
|
1652 | function isReactive(value) {
|
1653 | if (isReadonly(value)) {
|
1654 | return isReactive(value["__v_raw"]);
|
1655 | }
|
1656 | return !!(value && value["__v_isReactive"]);
|
1657 | }
|
1658 | function isReadonly(value) {
|
1659 | return !!(value && value["__v_isReadonly"]);
|
1660 | }
|
1661 | function isShallow(value) {
|
1662 | return !!(value && value["__v_isShallow"]);
|
1663 | }
|
1664 | function isProxy(value) {
|
1665 | return value ? !!value["__v_raw"] : false;
|
1666 | }
|
1667 | function toRaw(observed) {
|
1668 | const raw = observed && observed["__v_raw"];
|
1669 | return raw ? toRaw(raw) : observed;
|
1670 | }
|
1671 | function markRaw(value) {
|
1672 | if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
|
1673 | def(value, "__v_skip", true);
|
1674 | }
|
1675 | return value;
|
1676 | }
|
1677 | const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
1678 | const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
1679 |
|
1680 | function isRef(r) {
|
1681 | return r ? r["__v_isRef"] === true : false;
|
1682 | }
|
1683 | function ref(value) {
|
1684 | return createRef(value, false);
|
1685 | }
|
1686 | function shallowRef(value) {
|
1687 | return createRef(value, true);
|
1688 | }
|
1689 | function createRef(rawValue, shallow) {
|
1690 | if (isRef(rawValue)) {
|
1691 | return rawValue;
|
1692 | }
|
1693 | return new RefImpl(rawValue, shallow);
|
1694 | }
|
1695 | class RefImpl {
|
1696 | constructor(value, isShallow2) {
|
1697 | this.dep = new Dep();
|
1698 | this["__v_isRef"] = true;
|
1699 | this["__v_isShallow"] = false;
|
1700 | this._rawValue = isShallow2 ? value : toRaw(value);
|
1701 | this._value = isShallow2 ? value : toReactive(value);
|
1702 | this["__v_isShallow"] = isShallow2;
|
1703 | }
|
1704 | get value() {
|
1705 | {
|
1706 | this.dep.track({
|
1707 | target: this,
|
1708 | type: "get",
|
1709 | key: "value"
|
1710 | });
|
1711 | }
|
1712 | return this._value;
|
1713 | }
|
1714 | set value(newValue) {
|
1715 | const oldValue = this._rawValue;
|
1716 | const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
1717 | newValue = useDirectValue ? newValue : toRaw(newValue);
|
1718 | if (hasChanged(newValue, oldValue)) {
|
1719 | this._rawValue = newValue;
|
1720 | this._value = useDirectValue ? newValue : toReactive(newValue);
|
1721 | {
|
1722 | this.dep.trigger({
|
1723 | target: this,
|
1724 | type: "set",
|
1725 | key: "value",
|
1726 | newValue,
|
1727 | oldValue
|
1728 | });
|
1729 | }
|
1730 | }
|
1731 | }
|
1732 | }
|
1733 | function triggerRef(ref2) {
|
1734 | if (ref2.dep) {
|
1735 | {
|
1736 | ref2.dep.trigger({
|
1737 | target: ref2,
|
1738 | type: "set",
|
1739 | key: "value",
|
1740 | newValue: ref2._value
|
1741 | });
|
1742 | }
|
1743 | }
|
1744 | }
|
1745 | function unref(ref2) {
|
1746 | return isRef(ref2) ? ref2.value : ref2;
|
1747 | }
|
1748 | function toValue(source) {
|
1749 | return isFunction(source) ? source() : unref(source);
|
1750 | }
|
1751 | const shallowUnwrapHandlers = {
|
1752 | get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
|
1753 | set: (target, key, value, receiver) => {
|
1754 | const oldValue = target[key];
|
1755 | if (isRef(oldValue) && !isRef(value)) {
|
1756 | oldValue.value = value;
|
1757 | return true;
|
1758 | } else {
|
1759 | return Reflect.set(target, key, value, receiver);
|
1760 | }
|
1761 | }
|
1762 | };
|
1763 | function proxyRefs(objectWithRefs) {
|
1764 | return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
1765 | }
|
1766 | class CustomRefImpl {
|
1767 | constructor(factory) {
|
1768 | this["__v_isRef"] = true;
|
1769 | this._value = void 0;
|
1770 | const dep = this.dep = new Dep();
|
1771 | const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
1772 | this._get = get;
|
1773 | this._set = set;
|
1774 | }
|
1775 | get value() {
|
1776 | return this._value = this._get();
|
1777 | }
|
1778 | set value(newVal) {
|
1779 | this._set(newVal);
|
1780 | }
|
1781 | }
|
1782 | function customRef(factory) {
|
1783 | return new CustomRefImpl(factory);
|
1784 | }
|
1785 | function toRefs(object) {
|
1786 | if (!isProxy(object)) {
|
1787 | warn$2(`toRefs() expects a reactive object but received a plain one.`);
|
1788 | }
|
1789 | const ret = isArray(object) ? new Array(object.length) : {};
|
1790 | for (const key in object) {
|
1791 | ret[key] = propertyToRef(object, key);
|
1792 | }
|
1793 | return ret;
|
1794 | }
|
1795 | class ObjectRefImpl {
|
1796 | constructor(_object, _key, _defaultValue) {
|
1797 | this._object = _object;
|
1798 | this._key = _key;
|
1799 | this._defaultValue = _defaultValue;
|
1800 | this["__v_isRef"] = true;
|
1801 | this._value = void 0;
|
1802 | }
|
1803 | get value() {
|
1804 | const val = this._object[this._key];
|
1805 | return this._value = val === void 0 ? this._defaultValue : val;
|
1806 | }
|
1807 | set value(newVal) {
|
1808 | this._object[this._key] = newVal;
|
1809 | }
|
1810 | get dep() {
|
1811 | return getDepFromReactive(toRaw(this._object), this._key);
|
1812 | }
|
1813 | }
|
1814 | class GetterRefImpl {
|
1815 | constructor(_getter) {
|
1816 | this._getter = _getter;
|
1817 | this["__v_isRef"] = true;
|
1818 | this["__v_isReadonly"] = true;
|
1819 | this._value = void 0;
|
1820 | }
|
1821 | get value() {
|
1822 | return this._value = this._getter();
|
1823 | }
|
1824 | }
|
1825 | function toRef(source, key, defaultValue) {
|
1826 | if (isRef(source)) {
|
1827 | return source;
|
1828 | } else if (isFunction(source)) {
|
1829 | return new GetterRefImpl(source);
|
1830 | } else if (isObject(source) && arguments.length > 1) {
|
1831 | return propertyToRef(source, key, defaultValue);
|
1832 | } else {
|
1833 | return ref(source);
|
1834 | }
|
1835 | }
|
1836 | function propertyToRef(source, key, defaultValue) {
|
1837 | const val = source[key];
|
1838 | return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
1839 | }
|
1840 |
|
1841 | class ComputedRefImpl {
|
1842 | constructor(fn, setter, isSSR) {
|
1843 | this.fn = fn;
|
1844 | this.setter = setter;
|
1845 | |
1846 |
|
1847 |
|
1848 | this._value = void 0;
|
1849 | |
1850 |
|
1851 |
|
1852 | this.dep = new Dep(this);
|
1853 | |
1854 |
|
1855 |
|
1856 | this.__v_isRef = true;
|
1857 |
|
1858 |
|
1859 | |
1860 |
|
1861 |
|
1862 | this.deps = void 0;
|
1863 | |
1864 |
|
1865 |
|
1866 | this.depsTail = void 0;
|
1867 | |
1868 |
|
1869 |
|
1870 | this.flags = 16;
|
1871 | |
1872 |
|
1873 |
|
1874 | this.globalVersion = globalVersion - 1;
|
1875 | |
1876 |
|
1877 |
|
1878 | this.next = void 0;
|
1879 |
|
1880 | this.effect = this;
|
1881 | this["__v_isReadonly"] = !setter;
|
1882 | this.isSSR = isSSR;
|
1883 | }
|
1884 | |
1885 |
|
1886 |
|
1887 | notify() {
|
1888 | this.flags |= 16;
|
1889 | if (!(this.flags & 8) &&
|
1890 | activeSub !== this) {
|
1891 | batch(this, true);
|
1892 | return true;
|
1893 | }
|
1894 | }
|
1895 | get value() {
|
1896 | const link = this.dep.track({
|
1897 | target: this,
|
1898 | type: "get",
|
1899 | key: "value"
|
1900 | }) ;
|
1901 | refreshComputed(this);
|
1902 | if (link) {
|
1903 | link.version = this.dep.version;
|
1904 | }
|
1905 | return this._value;
|
1906 | }
|
1907 | set value(newValue) {
|
1908 | if (this.setter) {
|
1909 | this.setter(newValue);
|
1910 | } else {
|
1911 | warn$2("Write operation failed: computed value is readonly");
|
1912 | }
|
1913 | }
|
1914 | }
|
1915 | function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
1916 | let getter;
|
1917 | let setter;
|
1918 | if (isFunction(getterOrOptions)) {
|
1919 | getter = getterOrOptions;
|
1920 | } else {
|
1921 | getter = getterOrOptions.get;
|
1922 | setter = getterOrOptions.set;
|
1923 | }
|
1924 | const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
1925 | if (debugOptions && !isSSR) {
|
1926 | cRef.onTrack = debugOptions.onTrack;
|
1927 | cRef.onTrigger = debugOptions.onTrigger;
|
1928 | }
|
1929 | return cRef;
|
1930 | }
|
1931 |
|
1932 | const TrackOpTypes = {
|
1933 | "GET": "get",
|
1934 | "HAS": "has",
|
1935 | "ITERATE": "iterate"
|
1936 | };
|
1937 | const TriggerOpTypes = {
|
1938 | "SET": "set",
|
1939 | "ADD": "add",
|
1940 | "DELETE": "delete",
|
1941 | "CLEAR": "clear"
|
1942 | };
|
1943 |
|
1944 | const INITIAL_WATCHER_VALUE = {};
|
1945 | const cleanupMap = new WeakMap();
|
1946 | let activeWatcher = void 0;
|
1947 | function getCurrentWatcher() {
|
1948 | return activeWatcher;
|
1949 | }
|
1950 | function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
1951 | if (owner) {
|
1952 | let cleanups = cleanupMap.get(owner);
|
1953 | if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
1954 | cleanups.push(cleanupFn);
|
1955 | } else if (!failSilently) {
|
1956 | warn$2(
|
1957 | `onWatcherCleanup() was called when there was no active watcher to associate with.`
|
1958 | );
|
1959 | }
|
1960 | }
|
1961 | function watch$1(source, cb, options = EMPTY_OBJ) {
|
1962 | const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
1963 | const warnInvalidSource = (s) => {
|
1964 | (options.onWarn || warn$2)(
|
1965 | `Invalid watch source: `,
|
1966 | s,
|
1967 | `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
|
1968 | );
|
1969 | };
|
1970 | const reactiveGetter = (source2) => {
|
1971 | if (deep) return source2;
|
1972 | if (isShallow(source2) || deep === false || deep === 0)
|
1973 | return traverse(source2, 1);
|
1974 | return traverse(source2);
|
1975 | };
|
1976 | let effect;
|
1977 | let getter;
|
1978 | let cleanup;
|
1979 | let boundCleanup;
|
1980 | let forceTrigger = false;
|
1981 | let isMultiSource = false;
|
1982 | if (isRef(source)) {
|
1983 | getter = () => source.value;
|
1984 | forceTrigger = isShallow(source);
|
1985 | } else if (isReactive(source)) {
|
1986 | getter = () => reactiveGetter(source);
|
1987 | forceTrigger = true;
|
1988 | } else if (isArray(source)) {
|
1989 | isMultiSource = true;
|
1990 | forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
1991 | getter = () => source.map((s) => {
|
1992 | if (isRef(s)) {
|
1993 | return s.value;
|
1994 | } else if (isReactive(s)) {
|
1995 | return reactiveGetter(s);
|
1996 | } else if (isFunction(s)) {
|
1997 | return call ? call(s, 2) : s();
|
1998 | } else {
|
1999 | warnInvalidSource(s);
|
2000 | }
|
2001 | });
|
2002 | } else if (isFunction(source)) {
|
2003 | if (cb) {
|
2004 | getter = call ? () => call(source, 2) : source;
|
2005 | } else {
|
2006 | getter = () => {
|
2007 | if (cleanup) {
|
2008 | pauseTracking();
|
2009 | try {
|
2010 | cleanup();
|
2011 | } finally {
|
2012 | resetTracking();
|
2013 | }
|
2014 | }
|
2015 | const currentEffect = activeWatcher;
|
2016 | activeWatcher = effect;
|
2017 | try {
|
2018 | return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
2019 | } finally {
|
2020 | activeWatcher = currentEffect;
|
2021 | }
|
2022 | };
|
2023 | }
|
2024 | } else {
|
2025 | getter = NOOP;
|
2026 | warnInvalidSource(source);
|
2027 | }
|
2028 | if (cb && deep) {
|
2029 | const baseGetter = getter;
|
2030 | const depth = deep === true ? Infinity : deep;
|
2031 | getter = () => traverse(baseGetter(), depth);
|
2032 | }
|
2033 | const scope = getCurrentScope();
|
2034 | const watchHandle = () => {
|
2035 | effect.stop();
|
2036 | if (scope && scope.active) {
|
2037 | remove(scope.effects, effect);
|
2038 | }
|
2039 | };
|
2040 | if (once && cb) {
|
2041 | const _cb = cb;
|
2042 | cb = (...args) => {
|
2043 | _cb(...args);
|
2044 | watchHandle();
|
2045 | };
|
2046 | }
|
2047 | let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
2048 | const job = (immediateFirstRun) => {
|
2049 | if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
2050 | return;
|
2051 | }
|
2052 | if (cb) {
|
2053 | const newValue = effect.run();
|
2054 | if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
2055 | if (cleanup) {
|
2056 | cleanup();
|
2057 | }
|
2058 | const currentWatcher = activeWatcher;
|
2059 | activeWatcher = effect;
|
2060 | try {
|
2061 | const args = [
|
2062 | newValue,
|
2063 |
|
2064 | oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
2065 | boundCleanup
|
2066 | ];
|
2067 | call ? call(cb, 3, args) : (
|
2068 |
|
2069 | cb(...args)
|
2070 | );
|
2071 | oldValue = newValue;
|
2072 | } finally {
|
2073 | activeWatcher = currentWatcher;
|
2074 | }
|
2075 | }
|
2076 | } else {
|
2077 | effect.run();
|
2078 | }
|
2079 | };
|
2080 | if (augmentJob) {
|
2081 | augmentJob(job);
|
2082 | }
|
2083 | effect = new ReactiveEffect(getter);
|
2084 | effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
2085 | boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
2086 | cleanup = effect.onStop = () => {
|
2087 | const cleanups = cleanupMap.get(effect);
|
2088 | if (cleanups) {
|
2089 | if (call) {
|
2090 | call(cleanups, 4);
|
2091 | } else {
|
2092 | for (const cleanup2 of cleanups) cleanup2();
|
2093 | }
|
2094 | cleanupMap.delete(effect);
|
2095 | }
|
2096 | };
|
2097 | {
|
2098 | effect.onTrack = options.onTrack;
|
2099 | effect.onTrigger = options.onTrigger;
|
2100 | }
|
2101 | if (cb) {
|
2102 | if (immediate) {
|
2103 | job(true);
|
2104 | } else {
|
2105 | oldValue = effect.run();
|
2106 | }
|
2107 | } else if (scheduler) {
|
2108 | scheduler(job.bind(null, true), true);
|
2109 | } else {
|
2110 | effect.run();
|
2111 | }
|
2112 | watchHandle.pause = effect.pause.bind(effect);
|
2113 | watchHandle.resume = effect.resume.bind(effect);
|
2114 | watchHandle.stop = watchHandle;
|
2115 | return watchHandle;
|
2116 | }
|
2117 | function traverse(value, depth = Infinity, seen) {
|
2118 | if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
2119 | return value;
|
2120 | }
|
2121 | seen = seen || new Set();
|
2122 | if (seen.has(value)) {
|
2123 | return value;
|
2124 | }
|
2125 | seen.add(value);
|
2126 | depth--;
|
2127 | if (isRef(value)) {
|
2128 | traverse(value.value, depth, seen);
|
2129 | } else if (isArray(value)) {
|
2130 | for (let i = 0; i < value.length; i++) {
|
2131 | traverse(value[i], depth, seen);
|
2132 | }
|
2133 | } else if (isSet(value) || isMap(value)) {
|
2134 | value.forEach((v) => {
|
2135 | traverse(v, depth, seen);
|
2136 | });
|
2137 | } else if (isPlainObject(value)) {
|
2138 | for (const key in value) {
|
2139 | traverse(value[key], depth, seen);
|
2140 | }
|
2141 | for (const key of Object.getOwnPropertySymbols(value)) {
|
2142 | if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
2143 | traverse(value[key], depth, seen);
|
2144 | }
|
2145 | }
|
2146 | }
|
2147 | return value;
|
2148 | }
|
2149 |
|
2150 | const stack = [];
|
2151 | function pushWarningContext(vnode) {
|
2152 | stack.push(vnode);
|
2153 | }
|
2154 | function popWarningContext() {
|
2155 | stack.pop();
|
2156 | }
|
2157 | let isWarning = false;
|
2158 | function warn$1(msg, ...args) {
|
2159 | if (isWarning) return;
|
2160 | isWarning = true;
|
2161 | pauseTracking();
|
2162 | const instance = stack.length ? stack[stack.length - 1].component : null;
|
2163 | const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
2164 | const trace = getComponentTrace();
|
2165 | if (appWarnHandler) {
|
2166 | callWithErrorHandling(
|
2167 | appWarnHandler,
|
2168 | instance,
|
2169 | 11,
|
2170 | [
|
2171 |
|
2172 | msg + args.map((a) => {
|
2173 | var _a, _b;
|
2174 | return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
2175 | }).join(""),
|
2176 | instance && instance.proxy,
|
2177 | trace.map(
|
2178 | ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
2179 | ).join("\n"),
|
2180 | trace
|
2181 | ]
|
2182 | );
|
2183 | } else {
|
2184 | const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
2185 | if (trace.length &&
|
2186 | true) {
|
2187 | warnArgs.push(`
|
2188 | `, ...formatTrace(trace));
|
2189 | }
|
2190 | console.warn(...warnArgs);
|
2191 | }
|
2192 | resetTracking();
|
2193 | isWarning = false;
|
2194 | }
|
2195 | function getComponentTrace() {
|
2196 | let currentVNode = stack[stack.length - 1];
|
2197 | if (!currentVNode) {
|
2198 | return [];
|
2199 | }
|
2200 | const normalizedStack = [];
|
2201 | while (currentVNode) {
|
2202 | const last = normalizedStack[0];
|
2203 | if (last && last.vnode === currentVNode) {
|
2204 | last.recurseCount++;
|
2205 | } else {
|
2206 | normalizedStack.push({
|
2207 | vnode: currentVNode,
|
2208 | recurseCount: 0
|
2209 | });
|
2210 | }
|
2211 | const parentInstance = currentVNode.component && currentVNode.component.parent;
|
2212 | currentVNode = parentInstance && parentInstance.vnode;
|
2213 | }
|
2214 | return normalizedStack;
|
2215 | }
|
2216 | function formatTrace(trace) {
|
2217 | const logs = [];
|
2218 | trace.forEach((entry, i) => {
|
2219 | logs.push(...i === 0 ? [] : [`
|
2220 | `], ...formatTraceEntry(entry));
|
2221 | });
|
2222 | return logs;
|
2223 | }
|
2224 | function formatTraceEntry({ vnode, recurseCount }) {
|
2225 | const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
2226 | const isRoot = vnode.component ? vnode.component.parent == null : false;
|
2227 | const open = ` at <${formatComponentName(
|
2228 | vnode.component,
|
2229 | vnode.type,
|
2230 | isRoot
|
2231 | )}`;
|
2232 | const close = `>` + postfix;
|
2233 | return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
2234 | }
|
2235 | function formatProps(props) {
|
2236 | const res = [];
|
2237 | const keys = Object.keys(props);
|
2238 | keys.slice(0, 3).forEach((key) => {
|
2239 | res.push(...formatProp(key, props[key]));
|
2240 | });
|
2241 | if (keys.length > 3) {
|
2242 | res.push(` ...`);
|
2243 | }
|
2244 | return res;
|
2245 | }
|
2246 | function formatProp(key, value, raw) {
|
2247 | if (isString(value)) {
|
2248 | value = JSON.stringify(value);
|
2249 | return raw ? value : [`${key}=${value}`];
|
2250 | } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
2251 | return raw ? value : [`${key}=${value}`];
|
2252 | } else if (isRef(value)) {
|
2253 | value = formatProp(key, toRaw(value.value), true);
|
2254 | return raw ? value : [`${key}=Ref<`, value, `>`];
|
2255 | } else if (isFunction(value)) {
|
2256 | return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
2257 | } else {
|
2258 | value = toRaw(value);
|
2259 | return raw ? value : [`${key}=`, value];
|
2260 | }
|
2261 | }
|
2262 | function assertNumber(val, type) {
|
2263 | if (val === void 0) {
|
2264 | return;
|
2265 | } else if (typeof val !== "number") {
|
2266 | warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
|
2267 | } else if (isNaN(val)) {
|
2268 | warn$1(`${type} is NaN - the duration expression might be incorrect.`);
|
2269 | }
|
2270 | }
|
2271 |
|
2272 | const ErrorCodes = {
|
2273 | "SETUP_FUNCTION": 0,
|
2274 | "0": "SETUP_FUNCTION",
|
2275 | "RENDER_FUNCTION": 1,
|
2276 | "1": "RENDER_FUNCTION",
|
2277 | "NATIVE_EVENT_HANDLER": 5,
|
2278 | "5": "NATIVE_EVENT_HANDLER",
|
2279 | "COMPONENT_EVENT_HANDLER": 6,
|
2280 | "6": "COMPONENT_EVENT_HANDLER",
|
2281 | "VNODE_HOOK": 7,
|
2282 | "7": "VNODE_HOOK",
|
2283 | "DIRECTIVE_HOOK": 8,
|
2284 | "8": "DIRECTIVE_HOOK",
|
2285 | "TRANSITION_HOOK": 9,
|
2286 | "9": "TRANSITION_HOOK",
|
2287 | "APP_ERROR_HANDLER": 10,
|
2288 | "10": "APP_ERROR_HANDLER",
|
2289 | "APP_WARN_HANDLER": 11,
|
2290 | "11": "APP_WARN_HANDLER",
|
2291 | "FUNCTION_REF": 12,
|
2292 | "12": "FUNCTION_REF",
|
2293 | "ASYNC_COMPONENT_LOADER": 13,
|
2294 | "13": "ASYNC_COMPONENT_LOADER",
|
2295 | "SCHEDULER": 14,
|
2296 | "14": "SCHEDULER",
|
2297 | "COMPONENT_UPDATE": 15,
|
2298 | "15": "COMPONENT_UPDATE",
|
2299 | "APP_UNMOUNT_CLEANUP": 16,
|
2300 | "16": "APP_UNMOUNT_CLEANUP"
|
2301 | };
|
2302 | const ErrorTypeStrings$1 = {
|
2303 | ["sp"]: "serverPrefetch hook",
|
2304 | ["bc"]: "beforeCreate hook",
|
2305 | ["c"]: "created hook",
|
2306 | ["bm"]: "beforeMount hook",
|
2307 | ["m"]: "mounted hook",
|
2308 | ["bu"]: "beforeUpdate hook",
|
2309 | ["u"]: "updated",
|
2310 | ["bum"]: "beforeUnmount hook",
|
2311 | ["um"]: "unmounted hook",
|
2312 | ["a"]: "activated hook",
|
2313 | ["da"]: "deactivated hook",
|
2314 | ["ec"]: "errorCaptured hook",
|
2315 | ["rtc"]: "renderTracked hook",
|
2316 | ["rtg"]: "renderTriggered hook",
|
2317 | [0]: "setup function",
|
2318 | [1]: "render function",
|
2319 | [2]: "watcher getter",
|
2320 | [3]: "watcher callback",
|
2321 | [4]: "watcher cleanup function",
|
2322 | [5]: "native event handler",
|
2323 | [6]: "component event handler",
|
2324 | [7]: "vnode hook",
|
2325 | [8]: "directive hook",
|
2326 | [9]: "transition hook",
|
2327 | [10]: "app errorHandler",
|
2328 | [11]: "app warnHandler",
|
2329 | [12]: "ref function",
|
2330 | [13]: "async component loader",
|
2331 | [14]: "scheduler flush",
|
2332 | [15]: "component update",
|
2333 | [16]: "app unmount cleanup function"
|
2334 | };
|
2335 | function callWithErrorHandling(fn, instance, type, args) {
|
2336 | try {
|
2337 | return args ? fn(...args) : fn();
|
2338 | } catch (err) {
|
2339 | handleError(err, instance, type);
|
2340 | }
|
2341 | }
|
2342 | function callWithAsyncErrorHandling(fn, instance, type, args) {
|
2343 | if (isFunction(fn)) {
|
2344 | const res = callWithErrorHandling(fn, instance, type, args);
|
2345 | if (res && isPromise(res)) {
|
2346 | res.catch((err) => {
|
2347 | handleError(err, instance, type);
|
2348 | });
|
2349 | }
|
2350 | return res;
|
2351 | }
|
2352 | if (isArray(fn)) {
|
2353 | const values = [];
|
2354 | for (let i = 0; i < fn.length; i++) {
|
2355 | values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
2356 | }
|
2357 | return values;
|
2358 | } else {
|
2359 | warn$1(
|
2360 | `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
2361 | );
|
2362 | }
|
2363 | }
|
2364 | function handleError(err, instance, type, throwInDev = true) {
|
2365 | const contextVNode = instance ? instance.vnode : null;
|
2366 | const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
2367 | if (instance) {
|
2368 | let cur = instance.parent;
|
2369 | const exposedInstance = instance.proxy;
|
2370 | const errorInfo = ErrorTypeStrings$1[type] ;
|
2371 | while (cur) {
|
2372 | const errorCapturedHooks = cur.ec;
|
2373 | if (errorCapturedHooks) {
|
2374 | for (let i = 0; i < errorCapturedHooks.length; i++) {
|
2375 | if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
2376 | return;
|
2377 | }
|
2378 | }
|
2379 | }
|
2380 | cur = cur.parent;
|
2381 | }
|
2382 | if (errorHandler) {
|
2383 | pauseTracking();
|
2384 | callWithErrorHandling(errorHandler, null, 10, [
|
2385 | err,
|
2386 | exposedInstance,
|
2387 | errorInfo
|
2388 | ]);
|
2389 | resetTracking();
|
2390 | return;
|
2391 | }
|
2392 | }
|
2393 | logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
2394 | }
|
2395 | function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
2396 | {
|
2397 | const info = ErrorTypeStrings$1[type];
|
2398 | if (contextVNode) {
|
2399 | pushWarningContext(contextVNode);
|
2400 | }
|
2401 | warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
2402 | if (contextVNode) {
|
2403 | popWarningContext();
|
2404 | }
|
2405 | if (throwInDev) {
|
2406 | throw err;
|
2407 | } else {
|
2408 | console.error(err);
|
2409 | }
|
2410 | }
|
2411 | }
|
2412 |
|
2413 | const queue = [];
|
2414 | let flushIndex = -1;
|
2415 | const pendingPostFlushCbs = [];
|
2416 | let activePostFlushCbs = null;
|
2417 | let postFlushIndex = 0;
|
2418 | const resolvedPromise = Promise.resolve();
|
2419 | let currentFlushPromise = null;
|
2420 | const RECURSION_LIMIT = 100;
|
2421 | function nextTick(fn) {
|
2422 | const p = currentFlushPromise || resolvedPromise;
|
2423 | return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
2424 | }
|
2425 | function findInsertionIndex(id) {
|
2426 | let start = flushIndex + 1;
|
2427 | let end = queue.length;
|
2428 | while (start < end) {
|
2429 | const middle = start + end >>> 1;
|
2430 | const middleJob = queue[middle];
|
2431 | const middleJobId = getId(middleJob);
|
2432 | if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
2433 | start = middle + 1;
|
2434 | } else {
|
2435 | end = middle;
|
2436 | }
|
2437 | }
|
2438 | return start;
|
2439 | }
|
2440 | function queueJob(job) {
|
2441 | if (!(job.flags & 1)) {
|
2442 | const jobId = getId(job);
|
2443 | const lastJob = queue[queue.length - 1];
|
2444 | if (!lastJob ||
|
2445 | !(job.flags & 2) && jobId >= getId(lastJob)) {
|
2446 | queue.push(job);
|
2447 | } else {
|
2448 | queue.splice(findInsertionIndex(jobId), 0, job);
|
2449 | }
|
2450 | job.flags |= 1;
|
2451 | queueFlush();
|
2452 | }
|
2453 | }
|
2454 | function queueFlush() {
|
2455 | if (!currentFlushPromise) {
|
2456 | currentFlushPromise = resolvedPromise.then(flushJobs);
|
2457 | }
|
2458 | }
|
2459 | function queuePostFlushCb(cb) {
|
2460 | if (!isArray(cb)) {
|
2461 | if (activePostFlushCbs && cb.id === -1) {
|
2462 | activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
2463 | } else if (!(cb.flags & 1)) {
|
2464 | pendingPostFlushCbs.push(cb);
|
2465 | cb.flags |= 1;
|
2466 | }
|
2467 | } else {
|
2468 | pendingPostFlushCbs.push(...cb);
|
2469 | }
|
2470 | queueFlush();
|
2471 | }
|
2472 | function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
|
2473 | {
|
2474 | seen = seen || new Map();
|
2475 | }
|
2476 | for (; i < queue.length; i++) {
|
2477 | const cb = queue[i];
|
2478 | if (cb && cb.flags & 2) {
|
2479 | if (instance && cb.id !== instance.uid) {
|
2480 | continue;
|
2481 | }
|
2482 | if (checkRecursiveUpdates(seen, cb)) {
|
2483 | continue;
|
2484 | }
|
2485 | queue.splice(i, 1);
|
2486 | i--;
|
2487 | if (cb.flags & 4) {
|
2488 | cb.flags &= ~1;
|
2489 | }
|
2490 | cb();
|
2491 | if (!(cb.flags & 4)) {
|
2492 | cb.flags &= ~1;
|
2493 | }
|
2494 | }
|
2495 | }
|
2496 | }
|
2497 | function flushPostFlushCbs(seen) {
|
2498 | if (pendingPostFlushCbs.length) {
|
2499 | const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
2500 | (a, b) => getId(a) - getId(b)
|
2501 | );
|
2502 | pendingPostFlushCbs.length = 0;
|
2503 | if (activePostFlushCbs) {
|
2504 | activePostFlushCbs.push(...deduped);
|
2505 | return;
|
2506 | }
|
2507 | activePostFlushCbs = deduped;
|
2508 | {
|
2509 | seen = seen || new Map();
|
2510 | }
|
2511 | for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
2512 | const cb = activePostFlushCbs[postFlushIndex];
|
2513 | if (checkRecursiveUpdates(seen, cb)) {
|
2514 | continue;
|
2515 | }
|
2516 | if (cb.flags & 4) {
|
2517 | cb.flags &= ~1;
|
2518 | }
|
2519 | if (!(cb.flags & 8)) cb();
|
2520 | cb.flags &= ~1;
|
2521 | }
|
2522 | activePostFlushCbs = null;
|
2523 | postFlushIndex = 0;
|
2524 | }
|
2525 | }
|
2526 | const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
2527 | function flushJobs(seen) {
|
2528 | {
|
2529 | seen = seen || new Map();
|
2530 | }
|
2531 | const check = (job) => checkRecursiveUpdates(seen, job) ;
|
2532 | try {
|
2533 | for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
2534 | const job = queue[flushIndex];
|
2535 | if (job && !(job.flags & 8)) {
|
2536 | if (check(job)) {
|
2537 | continue;
|
2538 | }
|
2539 | if (job.flags & 4) {
|
2540 | job.flags &= ~1;
|
2541 | }
|
2542 | callWithErrorHandling(
|
2543 | job,
|
2544 | job.i,
|
2545 | job.i ? 15 : 14
|
2546 | );
|
2547 | if (!(job.flags & 4)) {
|
2548 | job.flags &= ~1;
|
2549 | }
|
2550 | }
|
2551 | }
|
2552 | } finally {
|
2553 | for (; flushIndex < queue.length; flushIndex++) {
|
2554 | const job = queue[flushIndex];
|
2555 | if (job) {
|
2556 | job.flags &= ~1;
|
2557 | }
|
2558 | }
|
2559 | flushIndex = -1;
|
2560 | queue.length = 0;
|
2561 | flushPostFlushCbs(seen);
|
2562 | currentFlushPromise = null;
|
2563 | if (queue.length || pendingPostFlushCbs.length) {
|
2564 | flushJobs(seen);
|
2565 | }
|
2566 | }
|
2567 | }
|
2568 | function checkRecursiveUpdates(seen, fn) {
|
2569 | const count = seen.get(fn) || 0;
|
2570 | if (count > RECURSION_LIMIT) {
|
2571 | const instance = fn.i;
|
2572 | const componentName = instance && getComponentName(instance.type);
|
2573 | handleError(
|
2574 | `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.`,
|
2575 | null,
|
2576 | 10
|
2577 | );
|
2578 | return true;
|
2579 | }
|
2580 | seen.set(fn, count + 1);
|
2581 | return false;
|
2582 | }
|
2583 |
|
2584 | let isHmrUpdating = false;
|
2585 | const hmrDirtyComponents = new Map();
|
2586 | {
|
2587 | getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
2588 | createRecord: tryWrap(createRecord),
|
2589 | rerender: tryWrap(rerender),
|
2590 | reload: tryWrap(reload)
|
2591 | };
|
2592 | }
|
2593 | const map = new Map();
|
2594 | function registerHMR(instance) {
|
2595 | const id = instance.type.__hmrId;
|
2596 | let record = map.get(id);
|
2597 | if (!record) {
|
2598 | createRecord(id, instance.type);
|
2599 | record = map.get(id);
|
2600 | }
|
2601 | record.instances.add(instance);
|
2602 | }
|
2603 | function unregisterHMR(instance) {
|
2604 | map.get(instance.type.__hmrId).instances.delete(instance);
|
2605 | }
|
2606 | function createRecord(id, initialDef) {
|
2607 | if (map.has(id)) {
|
2608 | return false;
|
2609 | }
|
2610 | map.set(id, {
|
2611 | initialDef: normalizeClassComponent(initialDef),
|
2612 | instances: new Set()
|
2613 | });
|
2614 | return true;
|
2615 | }
|
2616 | function normalizeClassComponent(component) {
|
2617 | return isClassComponent(component) ? component.__vccOpts : component;
|
2618 | }
|
2619 | function rerender(id, newRender) {
|
2620 | const record = map.get(id);
|
2621 | if (!record) {
|
2622 | return;
|
2623 | }
|
2624 | record.initialDef.render = newRender;
|
2625 | [...record.instances].forEach((instance) => {
|
2626 | if (newRender) {
|
2627 | instance.render = newRender;
|
2628 | normalizeClassComponent(instance.type).render = newRender;
|
2629 | }
|
2630 | instance.renderCache = [];
|
2631 | isHmrUpdating = true;
|
2632 | instance.update();
|
2633 | isHmrUpdating = false;
|
2634 | });
|
2635 | }
|
2636 | function reload(id, newComp) {
|
2637 | const record = map.get(id);
|
2638 | if (!record) return;
|
2639 | newComp = normalizeClassComponent(newComp);
|
2640 | updateComponentDef(record.initialDef, newComp);
|
2641 | const instances = [...record.instances];
|
2642 | for (let i = 0; i < instances.length; i++) {
|
2643 | const instance = instances[i];
|
2644 | const oldComp = normalizeClassComponent(instance.type);
|
2645 | let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
2646 | if (!dirtyInstances) {
|
2647 | if (oldComp !== record.initialDef) {
|
2648 | updateComponentDef(oldComp, newComp);
|
2649 | }
|
2650 | hmrDirtyComponents.set(oldComp, dirtyInstances = new Set());
|
2651 | }
|
2652 | dirtyInstances.add(instance);
|
2653 | instance.appContext.propsCache.delete(instance.type);
|
2654 | instance.appContext.emitsCache.delete(instance.type);
|
2655 | instance.appContext.optionsCache.delete(instance.type);
|
2656 | if (instance.ceReload) {
|
2657 | dirtyInstances.add(instance);
|
2658 | instance.ceReload(newComp.styles);
|
2659 | dirtyInstances.delete(instance);
|
2660 | } else if (instance.parent) {
|
2661 | queueJob(() => {
|
2662 | isHmrUpdating = true;
|
2663 | instance.parent.update();
|
2664 | isHmrUpdating = false;
|
2665 | dirtyInstances.delete(instance);
|
2666 | });
|
2667 | } else if (instance.appContext.reload) {
|
2668 | instance.appContext.reload();
|
2669 | } else if (typeof window !== "undefined") {
|
2670 | window.location.reload();
|
2671 | } else {
|
2672 | console.warn(
|
2673 | "[HMR] Root or manually mounted instance modified. Full reload required."
|
2674 | );
|
2675 | }
|
2676 | if (instance.root.ce && instance !== instance.root) {
|
2677 | instance.root.ce._removeChildStyle(oldComp);
|
2678 | }
|
2679 | }
|
2680 | queuePostFlushCb(() => {
|
2681 | hmrDirtyComponents.clear();
|
2682 | });
|
2683 | }
|
2684 | function updateComponentDef(oldComp, newComp) {
|
2685 | extend(oldComp, newComp);
|
2686 | for (const key in oldComp) {
|
2687 | if (key !== "__file" && !(key in newComp)) {
|
2688 | delete oldComp[key];
|
2689 | }
|
2690 | }
|
2691 | }
|
2692 | function tryWrap(fn) {
|
2693 | return (id, arg) => {
|
2694 | try {
|
2695 | return fn(id, arg);
|
2696 | } catch (e) {
|
2697 | console.error(e);
|
2698 | console.warn(
|
2699 | `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
|
2700 | );
|
2701 | }
|
2702 | };
|
2703 | }
|
2704 |
|
2705 | let devtools$1;
|
2706 | let buffer = [];
|
2707 | let devtoolsNotInstalled = false;
|
2708 | function emit$1(event, ...args) {
|
2709 | if (devtools$1) {
|
2710 | devtools$1.emit(event, ...args);
|
2711 | } else if (!devtoolsNotInstalled) {
|
2712 | buffer.push({ event, args });
|
2713 | }
|
2714 | }
|
2715 | function setDevtoolsHook$1(hook, target) {
|
2716 | var _a, _b;
|
2717 | devtools$1 = hook;
|
2718 | if (devtools$1) {
|
2719 | devtools$1.enabled = true;
|
2720 | buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
|
2721 | buffer = [];
|
2722 | } else if (
|
2723 |
|
2724 |
|
2725 |
|
2726 | typeof window !== "undefined" &&
|
2727 | window.HTMLElement &&
|
2728 |
|
2729 | !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
2730 | ) {
|
2731 | const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
2732 | replay.push((newHook) => {
|
2733 | setDevtoolsHook$1(newHook, target);
|
2734 | });
|
2735 | setTimeout(() => {
|
2736 | if (!devtools$1) {
|
2737 | target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
2738 | devtoolsNotInstalled = true;
|
2739 | buffer = [];
|
2740 | }
|
2741 | }, 3e3);
|
2742 | } else {
|
2743 | devtoolsNotInstalled = true;
|
2744 | buffer = [];
|
2745 | }
|
2746 | }
|
2747 | function devtoolsInitApp(app, version) {
|
2748 | emit$1("app:init" , app, version, {
|
2749 | Fragment,
|
2750 | Text,
|
2751 | Comment,
|
2752 | Static
|
2753 | });
|
2754 | }
|
2755 | function devtoolsUnmountApp(app) {
|
2756 | emit$1("app:unmount" , app);
|
2757 | }
|
2758 | const devtoolsComponentAdded = createDevtoolsComponentHook("component:added" );
|
2759 | const devtoolsComponentUpdated = createDevtoolsComponentHook("component:updated" );
|
2760 | const _devtoolsComponentRemoved = createDevtoolsComponentHook(
|
2761 | "component:removed"
|
2762 | );
|
2763 | const devtoolsComponentRemoved = (component) => {
|
2764 | if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" &&
|
2765 | !devtools$1.cleanupBuffer(component)) {
|
2766 | _devtoolsComponentRemoved(component);
|
2767 | }
|
2768 | };
|
2769 |
|
2770 |
|
2771 | function createDevtoolsComponentHook(hook) {
|
2772 | return (component) => {
|
2773 | emit$1(
|
2774 | hook,
|
2775 | component.appContext.app,
|
2776 | component.uid,
|
2777 | component.parent ? component.parent.uid : void 0,
|
2778 | component
|
2779 | );
|
2780 | };
|
2781 | }
|
2782 | const devtoolsPerfStart = createDevtoolsPerformanceHook("perf:start" );
|
2783 | const devtoolsPerfEnd = createDevtoolsPerformanceHook("perf:end" );
|
2784 | function createDevtoolsPerformanceHook(hook) {
|
2785 | return (component, type, time) => {
|
2786 | emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
2787 | };
|
2788 | }
|
2789 | function devtoolsComponentEmit(component, event, params) {
|
2790 | emit$1(
|
2791 | "component:emit" ,
|
2792 | component.appContext.app,
|
2793 | component,
|
2794 | event,
|
2795 | params
|
2796 | );
|
2797 | }
|
2798 |
|
2799 | let currentRenderingInstance = null;
|
2800 | let currentScopeId = null;
|
2801 | function setCurrentRenderingInstance(instance) {
|
2802 | const prev = currentRenderingInstance;
|
2803 | currentRenderingInstance = instance;
|
2804 | currentScopeId = instance && instance.type.__scopeId || null;
|
2805 | return prev;
|
2806 | }
|
2807 | function pushScopeId(id) {
|
2808 | currentScopeId = id;
|
2809 | }
|
2810 | function popScopeId() {
|
2811 | currentScopeId = null;
|
2812 | }
|
2813 | const withScopeId = (_id) => withCtx;
|
2814 | function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
2815 | if (!ctx) return fn;
|
2816 | if (fn._n) {
|
2817 | return fn;
|
2818 | }
|
2819 | const renderFnWithContext = (...args) => {
|
2820 | if (renderFnWithContext._d) {
|
2821 | setBlockTracking(-1);
|
2822 | }
|
2823 | const prevInstance = setCurrentRenderingInstance(ctx);
|
2824 | let res;
|
2825 | try {
|
2826 | res = fn(...args);
|
2827 | } finally {
|
2828 | setCurrentRenderingInstance(prevInstance);
|
2829 | if (renderFnWithContext._d) {
|
2830 | setBlockTracking(1);
|
2831 | }
|
2832 | }
|
2833 | {
|
2834 | devtoolsComponentUpdated(ctx);
|
2835 | }
|
2836 | return res;
|
2837 | };
|
2838 | renderFnWithContext._n = true;
|
2839 | renderFnWithContext._c = true;
|
2840 | renderFnWithContext._d = true;
|
2841 | return renderFnWithContext;
|
2842 | }
|
2843 |
|
2844 | function validateDirectiveName(name) {
|
2845 | if (isBuiltInDirective(name)) {
|
2846 | warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
2847 | }
|
2848 | }
|
2849 | function withDirectives(vnode, directives) {
|
2850 | if (currentRenderingInstance === null) {
|
2851 | warn$1(`withDirectives can only be used inside render functions.`);
|
2852 | return vnode;
|
2853 | }
|
2854 | const instance = getComponentPublicInstance(currentRenderingInstance);
|
2855 | const bindings = vnode.dirs || (vnode.dirs = []);
|
2856 | for (let i = 0; i < directives.length; i++) {
|
2857 | let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
2858 | if (dir) {
|
2859 | if (isFunction(dir)) {
|
2860 | dir = {
|
2861 | mounted: dir,
|
2862 | updated: dir
|
2863 | };
|
2864 | }
|
2865 | if (dir.deep) {
|
2866 | traverse(value);
|
2867 | }
|
2868 | bindings.push({
|
2869 | dir,
|
2870 | instance,
|
2871 | value,
|
2872 | oldValue: void 0,
|
2873 | arg,
|
2874 | modifiers
|
2875 | });
|
2876 | }
|
2877 | }
|
2878 | return vnode;
|
2879 | }
|
2880 | function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
2881 | const bindings = vnode.dirs;
|
2882 | const oldBindings = prevVNode && prevVNode.dirs;
|
2883 | for (let i = 0; i < bindings.length; i++) {
|
2884 | const binding = bindings[i];
|
2885 | if (oldBindings) {
|
2886 | binding.oldValue = oldBindings[i].value;
|
2887 | }
|
2888 | let hook = binding.dir[name];
|
2889 | if (hook) {
|
2890 | pauseTracking();
|
2891 | callWithAsyncErrorHandling(hook, instance, 8, [
|
2892 | vnode.el,
|
2893 | binding,
|
2894 | vnode,
|
2895 | prevVNode
|
2896 | ]);
|
2897 | resetTracking();
|
2898 | }
|
2899 | }
|
2900 | }
|
2901 |
|
2902 | const TeleportEndKey = Symbol("_vte");
|
2903 | const isTeleport = (type) => type.__isTeleport;
|
2904 | const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
2905 | const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
|
2906 | const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
2907 | const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
2908 | const resolveTarget = (props, select) => {
|
2909 | const targetSelector = props && props.to;
|
2910 | if (isString(targetSelector)) {
|
2911 | if (!select) {
|
2912 | warn$1(
|
2913 | `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
|
2914 | );
|
2915 | return null;
|
2916 | } else {
|
2917 | const target = select(targetSelector);
|
2918 | if (!target && !isTeleportDisabled(props)) {
|
2919 | warn$1(
|
2920 | `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.`
|
2921 | );
|
2922 | }
|
2923 | return target;
|
2924 | }
|
2925 | } else {
|
2926 | if (!targetSelector && !isTeleportDisabled(props)) {
|
2927 | warn$1(`Invalid Teleport target: ${targetSelector}`);
|
2928 | }
|
2929 | return targetSelector;
|
2930 | }
|
2931 | };
|
2932 | const TeleportImpl = {
|
2933 | name: "Teleport",
|
2934 | __isTeleport: true,
|
2935 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
2936 | const {
|
2937 | mc: mountChildren,
|
2938 | pc: patchChildren,
|
2939 | pbc: patchBlockChildren,
|
2940 | o: { insert, querySelector, createText, createComment }
|
2941 | } = internals;
|
2942 | const disabled = isTeleportDisabled(n2.props);
|
2943 | let { shapeFlag, children, dynamicChildren } = n2;
|
2944 | if (isHmrUpdating) {
|
2945 | optimized = false;
|
2946 | dynamicChildren = null;
|
2947 | }
|
2948 | if (n1 == null) {
|
2949 | const placeholder = n2.el = createComment("teleport start") ;
|
2950 | const mainAnchor = n2.anchor = createComment("teleport end") ;
|
2951 | insert(placeholder, container, anchor);
|
2952 | insert(mainAnchor, container, anchor);
|
2953 | const mount = (container2, anchor2) => {
|
2954 | if (shapeFlag & 16) {
|
2955 | if (parentComponent && parentComponent.isCE) {
|
2956 | parentComponent.ce._teleportTarget = container2;
|
2957 | }
|
2958 | mountChildren(
|
2959 | children,
|
2960 | container2,
|
2961 | anchor2,
|
2962 | parentComponent,
|
2963 | parentSuspense,
|
2964 | namespace,
|
2965 | slotScopeIds,
|
2966 | optimized
|
2967 | );
|
2968 | }
|
2969 | };
|
2970 | const mountToTarget = () => {
|
2971 | const target = n2.target = resolveTarget(n2.props, querySelector);
|
2972 | const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
2973 | if (target) {
|
2974 | if (namespace !== "svg" && isTargetSVG(target)) {
|
2975 | namespace = "svg";
|
2976 | } else if (namespace !== "mathml" && isTargetMathML(target)) {
|
2977 | namespace = "mathml";
|
2978 | }
|
2979 | if (!disabled) {
|
2980 | mount(target, targetAnchor);
|
2981 | updateCssVars(n2, false);
|
2982 | }
|
2983 | } else if (!disabled) {
|
2984 | warn$1(
|
2985 | "Invalid Teleport target on mount:",
|
2986 | target,
|
2987 | `(${typeof target})`
|
2988 | );
|
2989 | }
|
2990 | };
|
2991 | if (disabled) {
|
2992 | mount(container, mainAnchor);
|
2993 | updateCssVars(n2, true);
|
2994 | }
|
2995 | if (isTeleportDeferred(n2.props)) {
|
2996 | queuePostRenderEffect(() => {
|
2997 | mountToTarget();
|
2998 | n2.el.__isMounted = true;
|
2999 | }, parentSuspense);
|
3000 | } else {
|
3001 | mountToTarget();
|
3002 | }
|
3003 | } else {
|
3004 | if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) {
|
3005 | queuePostRenderEffect(() => {
|
3006 | TeleportImpl.process(
|
3007 | n1,
|
3008 | n2,
|
3009 | container,
|
3010 | anchor,
|
3011 | parentComponent,
|
3012 | parentSuspense,
|
3013 | namespace,
|
3014 | slotScopeIds,
|
3015 | optimized,
|
3016 | internals
|
3017 | );
|
3018 | delete n1.el.__isMounted;
|
3019 | }, parentSuspense);
|
3020 | return;
|
3021 | }
|
3022 | n2.el = n1.el;
|
3023 | n2.targetStart = n1.targetStart;
|
3024 | const mainAnchor = n2.anchor = n1.anchor;
|
3025 | const target = n2.target = n1.target;
|
3026 | const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
3027 | const wasDisabled = isTeleportDisabled(n1.props);
|
3028 | const currentContainer = wasDisabled ? container : target;
|
3029 | const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
3030 | if (namespace === "svg" || isTargetSVG(target)) {
|
3031 | namespace = "svg";
|
3032 | } else if (namespace === "mathml" || isTargetMathML(target)) {
|
3033 | namespace = "mathml";
|
3034 | }
|
3035 | if (dynamicChildren) {
|
3036 | patchBlockChildren(
|
3037 | n1.dynamicChildren,
|
3038 | dynamicChildren,
|
3039 | currentContainer,
|
3040 | parentComponent,
|
3041 | parentSuspense,
|
3042 | namespace,
|
3043 | slotScopeIds
|
3044 | );
|
3045 | traverseStaticChildren(n1, n2, true);
|
3046 | } else if (!optimized) {
|
3047 | patchChildren(
|
3048 | n1,
|
3049 | n2,
|
3050 | currentContainer,
|
3051 | currentAnchor,
|
3052 | parentComponent,
|
3053 | parentSuspense,
|
3054 | namespace,
|
3055 | slotScopeIds,
|
3056 | false
|
3057 | );
|
3058 | }
|
3059 | if (disabled) {
|
3060 | if (!wasDisabled) {
|
3061 | moveTeleport(
|
3062 | n2,
|
3063 | container,
|
3064 | mainAnchor,
|
3065 | internals,
|
3066 | 1
|
3067 | );
|
3068 | } else {
|
3069 | if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
3070 | n2.props.to = n1.props.to;
|
3071 | }
|
3072 | }
|
3073 | } else {
|
3074 | if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
3075 | const nextTarget = n2.target = resolveTarget(
|
3076 | n2.props,
|
3077 | querySelector
|
3078 | );
|
3079 | if (nextTarget) {
|
3080 | moveTeleport(
|
3081 | n2,
|
3082 | nextTarget,
|
3083 | null,
|
3084 | internals,
|
3085 | 0
|
3086 | );
|
3087 | } else {
|
3088 | warn$1(
|
3089 | "Invalid Teleport target on update:",
|
3090 | target,
|
3091 | `(${typeof target})`
|
3092 | );
|
3093 | }
|
3094 | } else if (wasDisabled) {
|
3095 | moveTeleport(
|
3096 | n2,
|
3097 | target,
|
3098 | targetAnchor,
|
3099 | internals,
|
3100 | 1
|
3101 | );
|
3102 | }
|
3103 | }
|
3104 | updateCssVars(n2, disabled);
|
3105 | }
|
3106 | },
|
3107 | remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
3108 | const {
|
3109 | shapeFlag,
|
3110 | children,
|
3111 | anchor,
|
3112 | targetStart,
|
3113 | targetAnchor,
|
3114 | target,
|
3115 | props
|
3116 | } = vnode;
|
3117 | if (target) {
|
3118 | hostRemove(targetStart);
|
3119 | hostRemove(targetAnchor);
|
3120 | }
|
3121 | doRemove && hostRemove(anchor);
|
3122 | if (shapeFlag & 16) {
|
3123 | const shouldRemove = doRemove || !isTeleportDisabled(props);
|
3124 | for (let i = 0; i < children.length; i++) {
|
3125 | const child = children[i];
|
3126 | unmount(
|
3127 | child,
|
3128 | parentComponent,
|
3129 | parentSuspense,
|
3130 | shouldRemove,
|
3131 | !!child.dynamicChildren
|
3132 | );
|
3133 | }
|
3134 | }
|
3135 | },
|
3136 | move: moveTeleport,
|
3137 | hydrate: hydrateTeleport
|
3138 | };
|
3139 | function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
3140 | if (moveType === 0) {
|
3141 | insert(vnode.targetAnchor, container, parentAnchor);
|
3142 | }
|
3143 | const { el, anchor, shapeFlag, children, props } = vnode;
|
3144 | const isReorder = moveType === 2;
|
3145 | if (isReorder) {
|
3146 | insert(el, container, parentAnchor);
|
3147 | }
|
3148 | if (!isReorder || isTeleportDisabled(props)) {
|
3149 | if (shapeFlag & 16) {
|
3150 | for (let i = 0; i < children.length; i++) {
|
3151 | move(
|
3152 | children[i],
|
3153 | container,
|
3154 | parentAnchor,
|
3155 | 2
|
3156 | );
|
3157 | }
|
3158 | }
|
3159 | }
|
3160 | if (isReorder) {
|
3161 | insert(anchor, container, parentAnchor);
|
3162 | }
|
3163 | }
|
3164 | function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
3165 | o: { nextSibling, parentNode, querySelector, insert, createText }
|
3166 | }, hydrateChildren) {
|
3167 | const target = vnode.target = resolveTarget(
|
3168 | vnode.props,
|
3169 | querySelector
|
3170 | );
|
3171 | if (target) {
|
3172 | const disabled = isTeleportDisabled(vnode.props);
|
3173 | const targetNode = target._lpa || target.firstChild;
|
3174 | if (vnode.shapeFlag & 16) {
|
3175 | if (disabled) {
|
3176 | vnode.anchor = hydrateChildren(
|
3177 | nextSibling(node),
|
3178 | vnode,
|
3179 | parentNode(node),
|
3180 | parentComponent,
|
3181 | parentSuspense,
|
3182 | slotScopeIds,
|
3183 | optimized
|
3184 | );
|
3185 | vnode.targetStart = targetNode;
|
3186 | vnode.targetAnchor = targetNode && nextSibling(targetNode);
|
3187 | } else {
|
3188 | vnode.anchor = nextSibling(node);
|
3189 | let targetAnchor = targetNode;
|
3190 | while (targetAnchor) {
|
3191 | if (targetAnchor && targetAnchor.nodeType === 8) {
|
3192 | if (targetAnchor.data === "teleport start anchor") {
|
3193 | vnode.targetStart = targetAnchor;
|
3194 | } else if (targetAnchor.data === "teleport anchor") {
|
3195 | vnode.targetAnchor = targetAnchor;
|
3196 | target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
3197 | break;
|
3198 | }
|
3199 | }
|
3200 | targetAnchor = nextSibling(targetAnchor);
|
3201 | }
|
3202 | if (!vnode.targetAnchor) {
|
3203 | prepareAnchor(target, vnode, createText, insert);
|
3204 | }
|
3205 | hydrateChildren(
|
3206 | targetNode && nextSibling(targetNode),
|
3207 | vnode,
|
3208 | target,
|
3209 | parentComponent,
|
3210 | parentSuspense,
|
3211 | slotScopeIds,
|
3212 | optimized
|
3213 | );
|
3214 | }
|
3215 | }
|
3216 | updateCssVars(vnode, disabled);
|
3217 | }
|
3218 | return vnode.anchor && nextSibling(vnode.anchor);
|
3219 | }
|
3220 | const Teleport = TeleportImpl;
|
3221 | function updateCssVars(vnode, isDisabled) {
|
3222 | const ctx = vnode.ctx;
|
3223 | if (ctx && ctx.ut) {
|
3224 | let node, anchor;
|
3225 | if (isDisabled) {
|
3226 | node = vnode.el;
|
3227 | anchor = vnode.anchor;
|
3228 | } else {
|
3229 | node = vnode.targetStart;
|
3230 | anchor = vnode.targetAnchor;
|
3231 | }
|
3232 | while (node && node !== anchor) {
|
3233 | if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
3234 | node = node.nextSibling;
|
3235 | }
|
3236 | ctx.ut();
|
3237 | }
|
3238 | }
|
3239 | function prepareAnchor(target, vnode, createText, insert) {
|
3240 | const targetStart = vnode.targetStart = createText("");
|
3241 | const targetAnchor = vnode.targetAnchor = createText("");
|
3242 | targetStart[TeleportEndKey] = targetAnchor;
|
3243 | if (target) {
|
3244 | insert(targetStart, target);
|
3245 | insert(targetAnchor, target);
|
3246 | }
|
3247 | return targetAnchor;
|
3248 | }
|
3249 |
|
3250 | const leaveCbKey = Symbol("_leaveCb");
|
3251 | const enterCbKey$1 = Symbol("_enterCb");
|
3252 | function useTransitionState() {
|
3253 | const state = {
|
3254 | isMounted: false,
|
3255 | isLeaving: false,
|
3256 | isUnmounting: false,
|
3257 | leavingVNodes: new Map()
|
3258 | };
|
3259 | onMounted(() => {
|
3260 | state.isMounted = true;
|
3261 | });
|
3262 | onBeforeUnmount(() => {
|
3263 | state.isUnmounting = true;
|
3264 | });
|
3265 | return state;
|
3266 | }
|
3267 | const TransitionHookValidator = [Function, Array];
|
3268 | const BaseTransitionPropsValidators = {
|
3269 | mode: String,
|
3270 | appear: Boolean,
|
3271 | persisted: Boolean,
|
3272 |
|
3273 | onBeforeEnter: TransitionHookValidator,
|
3274 | onEnter: TransitionHookValidator,
|
3275 | onAfterEnter: TransitionHookValidator,
|
3276 | onEnterCancelled: TransitionHookValidator,
|
3277 |
|
3278 | onBeforeLeave: TransitionHookValidator,
|
3279 | onLeave: TransitionHookValidator,
|
3280 | onAfterLeave: TransitionHookValidator,
|
3281 | onLeaveCancelled: TransitionHookValidator,
|
3282 |
|
3283 | onBeforeAppear: TransitionHookValidator,
|
3284 | onAppear: TransitionHookValidator,
|
3285 | onAfterAppear: TransitionHookValidator,
|
3286 | onAppearCancelled: TransitionHookValidator
|
3287 | };
|
3288 | const recursiveGetSubtree = (instance) => {
|
3289 | const subTree = instance.subTree;
|
3290 | return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
|
3291 | };
|
3292 | const BaseTransitionImpl = {
|
3293 | name: `BaseTransition`,
|
3294 | props: BaseTransitionPropsValidators,
|
3295 | setup(props, { slots }) {
|
3296 | const instance = getCurrentInstance();
|
3297 | const state = useTransitionState();
|
3298 | return () => {
|
3299 | const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
3300 | if (!children || !children.length) {
|
3301 | return;
|
3302 | }
|
3303 | const child = findNonCommentChild(children);
|
3304 | const rawProps = toRaw(props);
|
3305 | const { mode } = rawProps;
|
3306 | if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
3307 | warn$1(`invalid <transition> mode: ${mode}`);
|
3308 | }
|
3309 | if (state.isLeaving) {
|
3310 | return emptyPlaceholder(child);
|
3311 | }
|
3312 | const innerChild = getInnerChild$1(child);
|
3313 | if (!innerChild) {
|
3314 | return emptyPlaceholder(child);
|
3315 | }
|
3316 | let enterHooks = resolveTransitionHooks(
|
3317 | innerChild,
|
3318 | rawProps,
|
3319 | state,
|
3320 | instance,
|
3321 |
|
3322 | (hooks) => enterHooks = hooks
|
3323 | );
|
3324 | if (innerChild.type !== Comment) {
|
3325 | setTransitionHooks(innerChild, enterHooks);
|
3326 | }
|
3327 | let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
|
3328 | if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
3329 | let leavingHooks = resolveTransitionHooks(
|
3330 | oldInnerChild,
|
3331 | rawProps,
|
3332 | state,
|
3333 | instance
|
3334 | );
|
3335 | setTransitionHooks(oldInnerChild, leavingHooks);
|
3336 | if (mode === "out-in" && innerChild.type !== Comment) {
|
3337 | state.isLeaving = true;
|
3338 | leavingHooks.afterLeave = () => {
|
3339 | state.isLeaving = false;
|
3340 | if (!(instance.job.flags & 8)) {
|
3341 | instance.update();
|
3342 | }
|
3343 | delete leavingHooks.afterLeave;
|
3344 | oldInnerChild = void 0;
|
3345 | };
|
3346 | return emptyPlaceholder(child);
|
3347 | } else if (mode === "in-out" && innerChild.type !== Comment) {
|
3348 | leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
3349 | const leavingVNodesCache = getLeavingNodesForType(
|
3350 | state,
|
3351 | oldInnerChild
|
3352 | );
|
3353 | leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
3354 | el[leaveCbKey] = () => {
|
3355 | earlyRemove();
|
3356 | el[leaveCbKey] = void 0;
|
3357 | delete enterHooks.delayedLeave;
|
3358 | oldInnerChild = void 0;
|
3359 | };
|
3360 | enterHooks.delayedLeave = () => {
|
3361 | delayedLeave();
|
3362 | delete enterHooks.delayedLeave;
|
3363 | oldInnerChild = void 0;
|
3364 | };
|
3365 | };
|
3366 | } else {
|
3367 | oldInnerChild = void 0;
|
3368 | }
|
3369 | } else if (oldInnerChild) {
|
3370 | oldInnerChild = void 0;
|
3371 | }
|
3372 | return child;
|
3373 | };
|
3374 | }
|
3375 | };
|
3376 | function findNonCommentChild(children) {
|
3377 | let child = children[0];
|
3378 | if (children.length > 1) {
|
3379 | let hasFound = false;
|
3380 | for (const c of children) {
|
3381 | if (c.type !== Comment) {
|
3382 | if (hasFound) {
|
3383 | warn$1(
|
3384 | "<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
3385 | );
|
3386 | break;
|
3387 | }
|
3388 | child = c;
|
3389 | hasFound = true;
|
3390 | }
|
3391 | }
|
3392 | }
|
3393 | return child;
|
3394 | }
|
3395 | const BaseTransition = BaseTransitionImpl;
|
3396 | function getLeavingNodesForType(state, vnode) {
|
3397 | const { leavingVNodes } = state;
|
3398 | let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
3399 | if (!leavingVNodesCache) {
|
3400 | leavingVNodesCache = Object.create(null);
|
3401 | leavingVNodes.set(vnode.type, leavingVNodesCache);
|
3402 | }
|
3403 | return leavingVNodesCache;
|
3404 | }
|
3405 | function resolveTransitionHooks(vnode, props, state, instance, postClone) {
|
3406 | const {
|
3407 | appear,
|
3408 | mode,
|
3409 | persisted = false,
|
3410 | onBeforeEnter,
|
3411 | onEnter,
|
3412 | onAfterEnter,
|
3413 | onEnterCancelled,
|
3414 | onBeforeLeave,
|
3415 | onLeave,
|
3416 | onAfterLeave,
|
3417 | onLeaveCancelled,
|
3418 | onBeforeAppear,
|
3419 | onAppear,
|
3420 | onAfterAppear,
|
3421 | onAppearCancelled
|
3422 | } = props;
|
3423 | const key = String(vnode.key);
|
3424 | const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
3425 | const callHook = (hook, args) => {
|
3426 | hook && callWithAsyncErrorHandling(
|
3427 | hook,
|
3428 | instance,
|
3429 | 9,
|
3430 | args
|
3431 | );
|
3432 | };
|
3433 | const callAsyncHook = (hook, args) => {
|
3434 | const done = args[1];
|
3435 | callHook(hook, args);
|
3436 | if (isArray(hook)) {
|
3437 | if (hook.every((hook2) => hook2.length <= 1)) done();
|
3438 | } else if (hook.length <= 1) {
|
3439 | done();
|
3440 | }
|
3441 | };
|
3442 | const hooks = {
|
3443 | mode,
|
3444 | persisted,
|
3445 | beforeEnter(el) {
|
3446 | let hook = onBeforeEnter;
|
3447 | if (!state.isMounted) {
|
3448 | if (appear) {
|
3449 | hook = onBeforeAppear || onBeforeEnter;
|
3450 | } else {
|
3451 | return;
|
3452 | }
|
3453 | }
|
3454 | if (el[leaveCbKey]) {
|
3455 | el[leaveCbKey](
|
3456 | true
|
3457 |
|
3458 | );
|
3459 | }
|
3460 | const leavingVNode = leavingVNodesCache[key];
|
3461 | if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
|
3462 | leavingVNode.el[leaveCbKey]();
|
3463 | }
|
3464 | callHook(hook, [el]);
|
3465 | },
|
3466 | enter(el) {
|
3467 | let hook = onEnter;
|
3468 | let afterHook = onAfterEnter;
|
3469 | let cancelHook = onEnterCancelled;
|
3470 | if (!state.isMounted) {
|
3471 | if (appear) {
|
3472 | hook = onAppear || onEnter;
|
3473 | afterHook = onAfterAppear || onAfterEnter;
|
3474 | cancelHook = onAppearCancelled || onEnterCancelled;
|
3475 | } else {
|
3476 | return;
|
3477 | }
|
3478 | }
|
3479 | let called = false;
|
3480 | const done = el[enterCbKey$1] = (cancelled) => {
|
3481 | if (called) return;
|
3482 | called = true;
|
3483 | if (cancelled) {
|
3484 | callHook(cancelHook, [el]);
|
3485 | } else {
|
3486 | callHook(afterHook, [el]);
|
3487 | }
|
3488 | if (hooks.delayedLeave) {
|
3489 | hooks.delayedLeave();
|
3490 | }
|
3491 | el[enterCbKey$1] = void 0;
|
3492 | };
|
3493 | if (hook) {
|
3494 | callAsyncHook(hook, [el, done]);
|
3495 | } else {
|
3496 | done();
|
3497 | }
|
3498 | },
|
3499 | leave(el, remove) {
|
3500 | const key2 = String(vnode.key);
|
3501 | if (el[enterCbKey$1]) {
|
3502 | el[enterCbKey$1](
|
3503 | true
|
3504 |
|
3505 | );
|
3506 | }
|
3507 | if (state.isUnmounting) {
|
3508 | return remove();
|
3509 | }
|
3510 | callHook(onBeforeLeave, [el]);
|
3511 | let called = false;
|
3512 | const done = el[leaveCbKey] = (cancelled) => {
|
3513 | if (called) return;
|
3514 | called = true;
|
3515 | remove();
|
3516 | if (cancelled) {
|
3517 | callHook(onLeaveCancelled, [el]);
|
3518 | } else {
|
3519 | callHook(onAfterLeave, [el]);
|
3520 | }
|
3521 | el[leaveCbKey] = void 0;
|
3522 | if (leavingVNodesCache[key2] === vnode) {
|
3523 | delete leavingVNodesCache[key2];
|
3524 | }
|
3525 | };
|
3526 | leavingVNodesCache[key2] = vnode;
|
3527 | if (onLeave) {
|
3528 | callAsyncHook(onLeave, [el, done]);
|
3529 | } else {
|
3530 | done();
|
3531 | }
|
3532 | },
|
3533 | clone(vnode2) {
|
3534 | const hooks2 = resolveTransitionHooks(
|
3535 | vnode2,
|
3536 | props,
|
3537 | state,
|
3538 | instance,
|
3539 | postClone
|
3540 | );
|
3541 | if (postClone) postClone(hooks2);
|
3542 | return hooks2;
|
3543 | }
|
3544 | };
|
3545 | return hooks;
|
3546 | }
|
3547 | function emptyPlaceholder(vnode) {
|
3548 | if (isKeepAlive(vnode)) {
|
3549 | vnode = cloneVNode(vnode);
|
3550 | vnode.children = null;
|
3551 | return vnode;
|
3552 | }
|
3553 | }
|
3554 | function getInnerChild$1(vnode) {
|
3555 | if (!isKeepAlive(vnode)) {
|
3556 | if (isTeleport(vnode.type) && vnode.children) {
|
3557 | return findNonCommentChild(vnode.children);
|
3558 | }
|
3559 | return vnode;
|
3560 | }
|
3561 | if (vnode.component) {
|
3562 | return vnode.component.subTree;
|
3563 | }
|
3564 | const { shapeFlag, children } = vnode;
|
3565 | if (children) {
|
3566 | if (shapeFlag & 16) {
|
3567 | return children[0];
|
3568 | }
|
3569 | if (shapeFlag & 32 && isFunction(children.default)) {
|
3570 | return children.default();
|
3571 | }
|
3572 | }
|
3573 | }
|
3574 | function setTransitionHooks(vnode, hooks) {
|
3575 | if (vnode.shapeFlag & 6 && vnode.component) {
|
3576 | vnode.transition = hooks;
|
3577 | setTransitionHooks(vnode.component.subTree, hooks);
|
3578 | } else if (vnode.shapeFlag & 128) {
|
3579 | vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
3580 | vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
3581 | } else {
|
3582 | vnode.transition = hooks;
|
3583 | }
|
3584 | }
|
3585 | function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
3586 | let ret = [];
|
3587 | let keyedFragmentCount = 0;
|
3588 | for (let i = 0; i < children.length; i++) {
|
3589 | let child = children[i];
|
3590 | const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
|
3591 | if (child.type === Fragment) {
|
3592 | if (child.patchFlag & 128) keyedFragmentCount++;
|
3593 | ret = ret.concat(
|
3594 | getTransitionRawChildren(child.children, keepComment, key)
|
3595 | );
|
3596 | } else if (keepComment || child.type !== Comment) {
|
3597 | ret.push(key != null ? cloneVNode(child, { key }) : child);
|
3598 | }
|
3599 | }
|
3600 | if (keyedFragmentCount > 1) {
|
3601 | for (let i = 0; i < ret.length; i++) {
|
3602 | ret[i].patchFlag = -2;
|
3603 | }
|
3604 | }
|
3605 | return ret;
|
3606 | }
|
3607 |
|
3608 |
|
3609 |
|
3610 | function defineComponent(options, extraOptions) {
|
3611 | return isFunction(options) ? (
|
3612 |
|
3613 |
|
3614 | (() => extend({ name: options.name }, extraOptions, { setup: options }))()
|
3615 | ) : options;
|
3616 | }
|
3617 |
|
3618 | function useId() {
|
3619 | const i = getCurrentInstance();
|
3620 | if (i) {
|
3621 | return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
|
3622 | } else {
|
3623 | warn$1(
|
3624 | `useId() is called when there is no active component instance to be associated with.`
|
3625 | );
|
3626 | }
|
3627 | return "";
|
3628 | }
|
3629 | function markAsyncBoundary(instance) {
|
3630 | instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
|
3631 | }
|
3632 |
|
3633 | const knownTemplateRefs = new WeakSet();
|
3634 | function useTemplateRef(key) {
|
3635 | const i = getCurrentInstance();
|
3636 | const r = shallowRef(null);
|
3637 | if (i) {
|
3638 | const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
|
3639 | let desc;
|
3640 | if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
|
3641 | warn$1(`useTemplateRef('${key}') already exists.`);
|
3642 | } else {
|
3643 | Object.defineProperty(refs, key, {
|
3644 | enumerable: true,
|
3645 | get: () => r.value,
|
3646 | set: (val) => r.value = val
|
3647 | });
|
3648 | }
|
3649 | } else {
|
3650 | warn$1(
|
3651 | `useTemplateRef() is called when there is no active component instance to be associated with.`
|
3652 | );
|
3653 | }
|
3654 | const ret = readonly(r) ;
|
3655 | {
|
3656 | knownTemplateRefs.add(ret);
|
3657 | }
|
3658 | return ret;
|
3659 | }
|
3660 |
|
3661 | function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
3662 | if (isArray(rawRef)) {
|
3663 | rawRef.forEach(
|
3664 | (r, i) => setRef(
|
3665 | r,
|
3666 | oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
3667 | parentSuspense,
|
3668 | vnode,
|
3669 | isUnmount
|
3670 | )
|
3671 | );
|
3672 | return;
|
3673 | }
|
3674 | if (isAsyncWrapper(vnode) && !isUnmount) {
|
3675 | if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
|
3676 | setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
|
3677 | }
|
3678 | return;
|
3679 | }
|
3680 | const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
|
3681 | const value = isUnmount ? null : refValue;
|
3682 | const { i: owner, r: ref } = rawRef;
|
3683 | if (!owner) {
|
3684 | warn$1(
|
3685 | `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
|
3686 | );
|
3687 | return;
|
3688 | }
|
3689 | const oldRef = oldRawRef && oldRawRef.r;
|
3690 | const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
3691 | const setupState = owner.setupState;
|
3692 | const rawSetupState = toRaw(setupState);
|
3693 | const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
|
3694 | {
|
3695 | if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
|
3696 | warn$1(
|
3697 | `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
|
3698 | );
|
3699 | }
|
3700 | if (knownTemplateRefs.has(rawSetupState[key])) {
|
3701 | return false;
|
3702 | }
|
3703 | }
|
3704 | return hasOwn(rawSetupState, key);
|
3705 | };
|
3706 | if (oldRef != null && oldRef !== ref) {
|
3707 | if (isString(oldRef)) {
|
3708 | refs[oldRef] = null;
|
3709 | if (canSetSetupRef(oldRef)) {
|
3710 | setupState[oldRef] = null;
|
3711 | }
|
3712 | } else if (isRef(oldRef)) {
|
3713 | oldRef.value = null;
|
3714 | }
|
3715 | }
|
3716 | if (isFunction(ref)) {
|
3717 | callWithErrorHandling(ref, owner, 12, [value, refs]);
|
3718 | } else {
|
3719 | const _isString = isString(ref);
|
3720 | const _isRef = isRef(ref);
|
3721 | if (_isString || _isRef) {
|
3722 | const doSet = () => {
|
3723 | if (rawRef.f) {
|
3724 | const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
3725 | if (isUnmount) {
|
3726 | isArray(existing) && remove(existing, refValue);
|
3727 | } else {
|
3728 | if (!isArray(existing)) {
|
3729 | if (_isString) {
|
3730 | refs[ref] = [refValue];
|
3731 | if (canSetSetupRef(ref)) {
|
3732 | setupState[ref] = refs[ref];
|
3733 | }
|
3734 | } else {
|
3735 | ref.value = [refValue];
|
3736 | if (rawRef.k) refs[rawRef.k] = ref.value;
|
3737 | }
|
3738 | } else if (!existing.includes(refValue)) {
|
3739 | existing.push(refValue);
|
3740 | }
|
3741 | }
|
3742 | } else if (_isString) {
|
3743 | refs[ref] = value;
|
3744 | if (canSetSetupRef(ref)) {
|
3745 | setupState[ref] = value;
|
3746 | }
|
3747 | } else if (_isRef) {
|
3748 | ref.value = value;
|
3749 | if (rawRef.k) refs[rawRef.k] = value;
|
3750 | } else {
|
3751 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
3752 | }
|
3753 | };
|
3754 | if (value) {
|
3755 | doSet.id = -1;
|
3756 | queuePostRenderEffect(doSet, parentSuspense);
|
3757 | } else {
|
3758 | doSet();
|
3759 | }
|
3760 | } else {
|
3761 | warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
|
3762 | }
|
3763 | }
|
3764 | }
|
3765 |
|
3766 | let hasLoggedMismatchError = false;
|
3767 | const logMismatchError = () => {
|
3768 | if (hasLoggedMismatchError) {
|
3769 | return;
|
3770 | }
|
3771 | console.error("Hydration completed but contains mismatches.");
|
3772 | hasLoggedMismatchError = true;
|
3773 | };
|
3774 | const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
3775 | const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
3776 | const getContainerType = (container) => {
|
3777 | if (container.nodeType !== 1) return void 0;
|
3778 | if (isSVGContainer(container)) return "svg";
|
3779 | if (isMathMLContainer(container)) return "mathml";
|
3780 | return void 0;
|
3781 | };
|
3782 | const isComment = (node) => node.nodeType === 8;
|
3783 | function createHydrationFunctions(rendererInternals) {
|
3784 | const {
|
3785 | mt: mountComponent,
|
3786 | p: patch,
|
3787 | o: {
|
3788 | patchProp,
|
3789 | createText,
|
3790 | nextSibling,
|
3791 | parentNode,
|
3792 | remove,
|
3793 | insert,
|
3794 | createComment
|
3795 | }
|
3796 | } = rendererInternals;
|
3797 | const hydrate = (vnode, container) => {
|
3798 | if (!container.hasChildNodes()) {
|
3799 | warn$1(
|
3800 | `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
|
3801 | );
|
3802 | patch(null, vnode, container);
|
3803 | flushPostFlushCbs();
|
3804 | container._vnode = vnode;
|
3805 | return;
|
3806 | }
|
3807 | hydrateNode(container.firstChild, vnode, null, null, null);
|
3808 | flushPostFlushCbs();
|
3809 | container._vnode = vnode;
|
3810 | };
|
3811 | const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
3812 | optimized = optimized || !!vnode.dynamicChildren;
|
3813 | const isFragmentStart = isComment(node) && node.data === "[";
|
3814 | const onMismatch = () => handleMismatch(
|
3815 | node,
|
3816 | vnode,
|
3817 | parentComponent,
|
3818 | parentSuspense,
|
3819 | slotScopeIds,
|
3820 | isFragmentStart
|
3821 | );
|
3822 | const { type, ref, shapeFlag, patchFlag } = vnode;
|
3823 | let domType = node.nodeType;
|
3824 | vnode.el = node;
|
3825 | {
|
3826 | def(node, "__vnode", vnode, true);
|
3827 | def(node, "__vueParentComponent", parentComponent, true);
|
3828 | }
|
3829 | if (patchFlag === -2) {
|
3830 | optimized = false;
|
3831 | vnode.dynamicChildren = null;
|
3832 | }
|
3833 | let nextNode = null;
|
3834 | switch (type) {
|
3835 | case Text:
|
3836 | if (domType !== 3) {
|
3837 | if (vnode.children === "") {
|
3838 | insert(vnode.el = createText(""), parentNode(node), node);
|
3839 | nextNode = node;
|
3840 | } else {
|
3841 | nextNode = onMismatch();
|
3842 | }
|
3843 | } else {
|
3844 | if (node.data !== vnode.children) {
|
3845 | warn$1(
|
3846 | `Hydration text mismatch in`,
|
3847 | node.parentNode,
|
3848 | `
|
3849 | - rendered on server: ${JSON.stringify(
|
3850 | node.data
|
3851 | )}
|
3852 | - expected on client: ${JSON.stringify(vnode.children)}`
|
3853 | );
|
3854 | logMismatchError();
|
3855 | node.data = vnode.children;
|
3856 | }
|
3857 | nextNode = nextSibling(node);
|
3858 | }
|
3859 | break;
|
3860 | case Comment:
|
3861 | if (isTemplateNode(node)) {
|
3862 | nextNode = nextSibling(node);
|
3863 | replaceNode(
|
3864 | vnode.el = node.content.firstChild,
|
3865 | node,
|
3866 | parentComponent
|
3867 | );
|
3868 | } else if (domType !== 8 || isFragmentStart) {
|
3869 | nextNode = onMismatch();
|
3870 | } else {
|
3871 | nextNode = nextSibling(node);
|
3872 | }
|
3873 | break;
|
3874 | case Static:
|
3875 | if (isFragmentStart) {
|
3876 | node = nextSibling(node);
|
3877 | domType = node.nodeType;
|
3878 | }
|
3879 | if (domType === 1 || domType === 3) {
|
3880 | nextNode = node;
|
3881 | const needToAdoptContent = !vnode.children.length;
|
3882 | for (let i = 0; i < vnode.staticCount; i++) {
|
3883 | if (needToAdoptContent)
|
3884 | vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
|
3885 | if (i === vnode.staticCount - 1) {
|
3886 | vnode.anchor = nextNode;
|
3887 | }
|
3888 | nextNode = nextSibling(nextNode);
|
3889 | }
|
3890 | return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
3891 | } else {
|
3892 | onMismatch();
|
3893 | }
|
3894 | break;
|
3895 | case Fragment:
|
3896 | if (!isFragmentStart) {
|
3897 | nextNode = onMismatch();
|
3898 | } else {
|
3899 | nextNode = hydrateFragment(
|
3900 | node,
|
3901 | vnode,
|
3902 | parentComponent,
|
3903 | parentSuspense,
|
3904 | slotScopeIds,
|
3905 | optimized
|
3906 | );
|
3907 | }
|
3908 | break;
|
3909 | default:
|
3910 | if (shapeFlag & 1) {
|
3911 | if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
|
3912 | nextNode = onMismatch();
|
3913 | } else {
|
3914 | nextNode = hydrateElement(
|
3915 | node,
|
3916 | vnode,
|
3917 | parentComponent,
|
3918 | parentSuspense,
|
3919 | slotScopeIds,
|
3920 | optimized
|
3921 | );
|
3922 | }
|
3923 | } else if (shapeFlag & 6) {
|
3924 | vnode.slotScopeIds = slotScopeIds;
|
3925 | const container = parentNode(node);
|
3926 | if (isFragmentStart) {
|
3927 | nextNode = locateClosingAnchor(node);
|
3928 | } else if (isComment(node) && node.data === "teleport start") {
|
3929 | nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
3930 | } else {
|
3931 | nextNode = nextSibling(node);
|
3932 | }
|
3933 | mountComponent(
|
3934 | vnode,
|
3935 | container,
|
3936 | null,
|
3937 | parentComponent,
|
3938 | parentSuspense,
|
3939 | getContainerType(container),
|
3940 | optimized
|
3941 | );
|
3942 | if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
|
3943 | let subTree;
|
3944 | if (isFragmentStart) {
|
3945 | subTree = createVNode(Fragment);
|
3946 | subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
3947 | } else {
|
3948 | subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
3949 | }
|
3950 | subTree.el = node;
|
3951 | vnode.component.subTree = subTree;
|
3952 | }
|
3953 | } else if (shapeFlag & 64) {
|
3954 | if (domType !== 8) {
|
3955 | nextNode = onMismatch();
|
3956 | } else {
|
3957 | nextNode = vnode.type.hydrate(
|
3958 | node,
|
3959 | vnode,
|
3960 | parentComponent,
|
3961 | parentSuspense,
|
3962 | slotScopeIds,
|
3963 | optimized,
|
3964 | rendererInternals,
|
3965 | hydrateChildren
|
3966 | );
|
3967 | }
|
3968 | } else if (shapeFlag & 128) {
|
3969 | nextNode = vnode.type.hydrate(
|
3970 | node,
|
3971 | vnode,
|
3972 | parentComponent,
|
3973 | parentSuspense,
|
3974 | getContainerType(parentNode(node)),
|
3975 | slotScopeIds,
|
3976 | optimized,
|
3977 | rendererInternals,
|
3978 | hydrateNode
|
3979 | );
|
3980 | } else {
|
3981 | warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
3982 | }
|
3983 | }
|
3984 | if (ref != null) {
|
3985 | setRef(ref, null, parentSuspense, vnode);
|
3986 | }
|
3987 | return nextNode;
|
3988 | };
|
3989 | const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
3990 | optimized = optimized || !!vnode.dynamicChildren;
|
3991 | const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
3992 | const forcePatch = type === "input" || type === "option";
|
3993 | {
|
3994 | if (dirs) {
|
3995 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
3996 | }
|
3997 | let needCallTransitionHooks = false;
|
3998 | if (isTemplateNode(el)) {
|
3999 | needCallTransitionHooks = needTransition(
|
4000 | null,
|
4001 |
|
4002 | transition
|
4003 | ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
|
4004 | const content = el.content.firstChild;
|
4005 | if (needCallTransitionHooks) {
|
4006 | transition.beforeEnter(content);
|
4007 | }
|
4008 | replaceNode(content, el, parentComponent);
|
4009 | vnode.el = el = content;
|
4010 | }
|
4011 | if (shapeFlag & 16 &&
|
4012 | !(props && (props.innerHTML || props.textContent))) {
|
4013 | let next = hydrateChildren(
|
4014 | el.firstChild,
|
4015 | vnode,
|
4016 | el,
|
4017 | parentComponent,
|
4018 | parentSuspense,
|
4019 | slotScopeIds,
|
4020 | optimized
|
4021 | );
|
4022 | let hasWarned = false;
|
4023 | while (next) {
|
4024 | if (!isMismatchAllowed(el, 1 )) {
|
4025 | if (!hasWarned) {
|
4026 | warn$1(
|
4027 | `Hydration children mismatch on`,
|
4028 | el,
|
4029 | `
|
4030 | Server rendered element contains more child nodes than client vdom.`
|
4031 | );
|
4032 | hasWarned = true;
|
4033 | }
|
4034 | logMismatchError();
|
4035 | }
|
4036 | const cur = next;
|
4037 | next = next.nextSibling;
|
4038 | remove(cur);
|
4039 | }
|
4040 | } else if (shapeFlag & 8) {
|
4041 | let clientText = vnode.children;
|
4042 | if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
4043 | clientText = clientText.slice(1);
|
4044 | }
|
4045 | if (el.textContent !== clientText) {
|
4046 | if (!isMismatchAllowed(el, 0 )) {
|
4047 | warn$1(
|
4048 | `Hydration text content mismatch on`,
|
4049 | el,
|
4050 | `
|
4051 | - rendered on server: ${el.textContent}
|
4052 | - expected on client: ${vnode.children}`
|
4053 | );
|
4054 | logMismatchError();
|
4055 | }
|
4056 | el.textContent = vnode.children;
|
4057 | }
|
4058 | }
|
4059 | if (props) {
|
4060 | {
|
4061 | const isCustomElement = el.tagName.includes("-");
|
4062 | for (const key in props) {
|
4063 | if (
|
4064 |
|
4065 | !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
|
4066 | logMismatchError();
|
4067 | }
|
4068 | if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) ||
|
4069 | key[0] === "." || isCustomElement) {
|
4070 | patchProp(el, key, null, props[key], void 0, parentComponent);
|
4071 | }
|
4072 | }
|
4073 | }
|
4074 | }
|
4075 | let vnodeHooks;
|
4076 | if (vnodeHooks = props && props.onVnodeBeforeMount) {
|
4077 | invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
4078 | }
|
4079 | if (dirs) {
|
4080 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
4081 | }
|
4082 | if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
|
4083 | queueEffectWithSuspense(() => {
|
4084 | vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
|
4085 | needCallTransitionHooks && transition.enter(el);
|
4086 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
4087 | }, parentSuspense);
|
4088 | }
|
4089 | }
|
4090 | return el.nextSibling;
|
4091 | };
|
4092 | const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
4093 | optimized = optimized || !!parentVNode.dynamicChildren;
|
4094 | const children = parentVNode.children;
|
4095 | const l = children.length;
|
4096 | let hasWarned = false;
|
4097 | for (let i = 0; i < l; i++) {
|
4098 | const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
4099 | const isText = vnode.type === Text;
|
4100 | if (node) {
|
4101 | if (isText && !optimized) {
|
4102 | if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
|
4103 | insert(
|
4104 | createText(
|
4105 | node.data.slice(vnode.children.length)
|
4106 | ),
|
4107 | container,
|
4108 | nextSibling(node)
|
4109 | );
|
4110 | node.data = vnode.children;
|
4111 | }
|
4112 | }
|
4113 | node = hydrateNode(
|
4114 | node,
|
4115 | vnode,
|
4116 | parentComponent,
|
4117 | parentSuspense,
|
4118 | slotScopeIds,
|
4119 | optimized
|
4120 | );
|
4121 | } else if (isText && !vnode.children) {
|
4122 | insert(vnode.el = createText(""), container);
|
4123 | } else {
|
4124 | if (!isMismatchAllowed(container, 1 )) {
|
4125 | if (!hasWarned) {
|
4126 | warn$1(
|
4127 | `Hydration children mismatch on`,
|
4128 | container,
|
4129 | `
|
4130 | Server rendered element contains fewer child nodes than client vdom.`
|
4131 | );
|
4132 | hasWarned = true;
|
4133 | }
|
4134 | logMismatchError();
|
4135 | }
|
4136 | patch(
|
4137 | null,
|
4138 | vnode,
|
4139 | container,
|
4140 | null,
|
4141 | parentComponent,
|
4142 | parentSuspense,
|
4143 | getContainerType(container),
|
4144 | slotScopeIds
|
4145 | );
|
4146 | }
|
4147 | }
|
4148 | return node;
|
4149 | };
|
4150 | const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
4151 | const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
4152 | if (fragmentSlotScopeIds) {
|
4153 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
4154 | }
|
4155 | const container = parentNode(node);
|
4156 | const next = hydrateChildren(
|
4157 | nextSibling(node),
|
4158 | vnode,
|
4159 | container,
|
4160 | parentComponent,
|
4161 | parentSuspense,
|
4162 | slotScopeIds,
|
4163 | optimized
|
4164 | );
|
4165 | if (next && isComment(next) && next.data === "]") {
|
4166 | return nextSibling(vnode.anchor = next);
|
4167 | } else {
|
4168 | logMismatchError();
|
4169 | insert(vnode.anchor = createComment(`]`), container, next);
|
4170 | return next;
|
4171 | }
|
4172 | };
|
4173 | const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
4174 | if (!isMismatchAllowed(node.parentElement, 1 )) {
|
4175 | warn$1(
|
4176 | `Hydration node mismatch:
|
4177 | - rendered on server:`,
|
4178 | node,
|
4179 | node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
|
4180 | `
|
4181 | - expected on client:`,
|
4182 | vnode.type
|
4183 | );
|
4184 | logMismatchError();
|
4185 | }
|
4186 | vnode.el = null;
|
4187 | if (isFragment) {
|
4188 | const end = locateClosingAnchor(node);
|
4189 | while (true) {
|
4190 | const next2 = nextSibling(node);
|
4191 | if (next2 && next2 !== end) {
|
4192 | remove(next2);
|
4193 | } else {
|
4194 | break;
|
4195 | }
|
4196 | }
|
4197 | }
|
4198 | const next = nextSibling(node);
|
4199 | const container = parentNode(node);
|
4200 | remove(node);
|
4201 | patch(
|
4202 | null,
|
4203 | vnode,
|
4204 | container,
|
4205 | next,
|
4206 | parentComponent,
|
4207 | parentSuspense,
|
4208 | getContainerType(container),
|
4209 | slotScopeIds
|
4210 | );
|
4211 | if (parentComponent) {
|
4212 | parentComponent.vnode.el = vnode.el;
|
4213 | updateHOCHostEl(parentComponent, vnode.el);
|
4214 | }
|
4215 | return next;
|
4216 | };
|
4217 | const locateClosingAnchor = (node, open = "[", close = "]") => {
|
4218 | let match = 0;
|
4219 | while (node) {
|
4220 | node = nextSibling(node);
|
4221 | if (node && isComment(node)) {
|
4222 | if (node.data === open) match++;
|
4223 | if (node.data === close) {
|
4224 | if (match === 0) {
|
4225 | return nextSibling(node);
|
4226 | } else {
|
4227 | match--;
|
4228 | }
|
4229 | }
|
4230 | }
|
4231 | }
|
4232 | return node;
|
4233 | };
|
4234 | const replaceNode = (newNode, oldNode, parentComponent) => {
|
4235 | const parentNode2 = oldNode.parentNode;
|
4236 | if (parentNode2) {
|
4237 | parentNode2.replaceChild(newNode, oldNode);
|
4238 | }
|
4239 | let parent = parentComponent;
|
4240 | while (parent) {
|
4241 | if (parent.vnode.el === oldNode) {
|
4242 | parent.vnode.el = parent.subTree.el = newNode;
|
4243 | }
|
4244 | parent = parent.parent;
|
4245 | }
|
4246 | };
|
4247 | const isTemplateNode = (node) => {
|
4248 | return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
4249 | };
|
4250 | return [hydrate, hydrateNode];
|
4251 | }
|
4252 | function propHasMismatch(el, key, clientValue, vnode, instance) {
|
4253 | let mismatchType;
|
4254 | let mismatchKey;
|
4255 | let actual;
|
4256 | let expected;
|
4257 | if (key === "class") {
|
4258 | actual = el.getAttribute("class");
|
4259 | expected = normalizeClass(clientValue);
|
4260 | if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
|
4261 | mismatchType = 2 ;
|
4262 | mismatchKey = `class`;
|
4263 | }
|
4264 | } else if (key === "style") {
|
4265 | actual = el.getAttribute("style") || "";
|
4266 | expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
|
4267 | const actualMap = toStyleMap(actual);
|
4268 | const expectedMap = toStyleMap(expected);
|
4269 | if (vnode.dirs) {
|
4270 | for (const { dir, value } of vnode.dirs) {
|
4271 | if (dir.name === "show" && !value) {
|
4272 | expectedMap.set("display", "none");
|
4273 | }
|
4274 | }
|
4275 | }
|
4276 | if (instance) {
|
4277 | resolveCssVars(instance, vnode, expectedMap);
|
4278 | }
|
4279 | if (!isMapEqual(actualMap, expectedMap)) {
|
4280 | mismatchType = 3 ;
|
4281 | mismatchKey = "style";
|
4282 | }
|
4283 | } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
|
4284 | if (isBooleanAttr(key)) {
|
4285 | actual = el.hasAttribute(key);
|
4286 | expected = includeBooleanAttr(clientValue);
|
4287 | } else if (clientValue == null) {
|
4288 | actual = el.hasAttribute(key);
|
4289 | expected = false;
|
4290 | } else {
|
4291 | if (el.hasAttribute(key)) {
|
4292 | actual = el.getAttribute(key);
|
4293 | } else if (key === "value" && el.tagName === "TEXTAREA") {
|
4294 | actual = el.value;
|
4295 | } else {
|
4296 | actual = false;
|
4297 | }
|
4298 | expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
|
4299 | }
|
4300 | if (actual !== expected) {
|
4301 | mismatchType = 4 ;
|
4302 | mismatchKey = key;
|
4303 | }
|
4304 | }
|
4305 | if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
|
4306 | const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
|
4307 | const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
|
4308 | const postSegment = `
|
4309 | - rendered on server: ${format(actual)}
|
4310 | - expected on client: ${format(expected)}
|
4311 | Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
|
4312 | You should fix the source of the mismatch.`;
|
4313 | {
|
4314 | warn$1(preSegment, el, postSegment);
|
4315 | }
|
4316 | return true;
|
4317 | }
|
4318 | return false;
|
4319 | }
|
4320 | function toClassSet(str) {
|
4321 | return new Set(str.trim().split(/\s+/));
|
4322 | }
|
4323 | function isSetEqual(a, b) {
|
4324 | if (a.size !== b.size) {
|
4325 | return false;
|
4326 | }
|
4327 | for (const s of a) {
|
4328 | if (!b.has(s)) {
|
4329 | return false;
|
4330 | }
|
4331 | }
|
4332 | return true;
|
4333 | }
|
4334 | function toStyleMap(str) {
|
4335 | const styleMap = new Map();
|
4336 | for (const item of str.split(";")) {
|
4337 | let [key, value] = item.split(":");
|
4338 | key = key.trim();
|
4339 | value = value && value.trim();
|
4340 | if (key && value) {
|
4341 | styleMap.set(key, value);
|
4342 | }
|
4343 | }
|
4344 | return styleMap;
|
4345 | }
|
4346 | function isMapEqual(a, b) {
|
4347 | if (a.size !== b.size) {
|
4348 | return false;
|
4349 | }
|
4350 | for (const [key, value] of a) {
|
4351 | if (value !== b.get(key)) {
|
4352 | return false;
|
4353 | }
|
4354 | }
|
4355 | return true;
|
4356 | }
|
4357 | function resolveCssVars(instance, vnode, expectedMap) {
|
4358 | const root = instance.subTree;
|
4359 | if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
|
4360 | const cssVars = instance.getCssVars();
|
4361 | for (const key in cssVars) {
|
4362 | expectedMap.set(
|
4363 | `--${getEscapedCssVarName(key)}`,
|
4364 | String(cssVars[key])
|
4365 | );
|
4366 | }
|
4367 | }
|
4368 | if (vnode === root && instance.parent) {
|
4369 | resolveCssVars(instance.parent, instance.vnode, expectedMap);
|
4370 | }
|
4371 | }
|
4372 | const allowMismatchAttr = "data-allow-mismatch";
|
4373 | const MismatchTypeString = {
|
4374 | [0 ]: "text",
|
4375 | [1 ]: "children",
|
4376 | [2 ]: "class",
|
4377 | [3 ]: "style",
|
4378 | [4 ]: "attribute"
|
4379 | };
|
4380 | function isMismatchAllowed(el, allowedType) {
|
4381 | if (allowedType === 0 || allowedType === 1 ) {
|
4382 | while (el && !el.hasAttribute(allowMismatchAttr)) {
|
4383 | el = el.parentElement;
|
4384 | }
|
4385 | }
|
4386 | const allowedAttr = el && el.getAttribute(allowMismatchAttr);
|
4387 | if (allowedAttr == null) {
|
4388 | return false;
|
4389 | } else if (allowedAttr === "") {
|
4390 | return true;
|
4391 | } else {
|
4392 | const list = allowedAttr.split(",");
|
4393 | if (allowedType === 0 && list.includes("children")) {
|
4394 | return true;
|
4395 | }
|
4396 | return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
|
4397 | }
|
4398 | }
|
4399 |
|
4400 | const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
4401 | const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
4402 | const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
|
4403 | const id = requestIdleCallback(hydrate, { timeout });
|
4404 | return () => cancelIdleCallback(id);
|
4405 | };
|
4406 | function elementIsVisibleInViewport(el) {
|
4407 | const { top, left, bottom, right } = el.getBoundingClientRect();
|
4408 | const { innerHeight, innerWidth } = window;
|
4409 | return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
|
4410 | }
|
4411 | const hydrateOnVisible = (opts) => (hydrate, forEach) => {
|
4412 | const ob = new IntersectionObserver((entries) => {
|
4413 | for (const e of entries) {
|
4414 | if (!e.isIntersecting) continue;
|
4415 | ob.disconnect();
|
4416 | hydrate();
|
4417 | break;
|
4418 | }
|
4419 | }, opts);
|
4420 | forEach((el) => {
|
4421 | if (!(el instanceof Element)) return;
|
4422 | if (elementIsVisibleInViewport(el)) {
|
4423 | hydrate();
|
4424 | ob.disconnect();
|
4425 | return false;
|
4426 | }
|
4427 | ob.observe(el);
|
4428 | });
|
4429 | return () => ob.disconnect();
|
4430 | };
|
4431 | const hydrateOnMediaQuery = (query) => (hydrate) => {
|
4432 | if (query) {
|
4433 | const mql = matchMedia(query);
|
4434 | if (mql.matches) {
|
4435 | hydrate();
|
4436 | } else {
|
4437 | mql.addEventListener("change", hydrate, { once: true });
|
4438 | return () => mql.removeEventListener("change", hydrate);
|
4439 | }
|
4440 | }
|
4441 | };
|
4442 | const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
4443 | if (isString(interactions)) interactions = [interactions];
|
4444 | let hasHydrated = false;
|
4445 | const doHydrate = (e) => {
|
4446 | if (!hasHydrated) {
|
4447 | hasHydrated = true;
|
4448 | teardown();
|
4449 | hydrate();
|
4450 | e.target.dispatchEvent(new e.constructor(e.type, e));
|
4451 | }
|
4452 | };
|
4453 | const teardown = () => {
|
4454 | forEach((el) => {
|
4455 | for (const i of interactions) {
|
4456 | el.removeEventListener(i, doHydrate);
|
4457 | }
|
4458 | });
|
4459 | };
|
4460 | forEach((el) => {
|
4461 | for (const i of interactions) {
|
4462 | el.addEventListener(i, doHydrate, { once: true });
|
4463 | }
|
4464 | });
|
4465 | return teardown;
|
4466 | };
|
4467 | function forEachElement(node, cb) {
|
4468 | if (isComment(node) && node.data === "[") {
|
4469 | let depth = 1;
|
4470 | let next = node.nextSibling;
|
4471 | while (next) {
|
4472 | if (next.nodeType === 1) {
|
4473 | const result = cb(next);
|
4474 | if (result === false) {
|
4475 | break;
|
4476 | }
|
4477 | } else if (isComment(next)) {
|
4478 | if (next.data === "]") {
|
4479 | if (--depth === 0) break;
|
4480 | } else if (next.data === "[") {
|
4481 | depth++;
|
4482 | }
|
4483 | }
|
4484 | next = next.nextSibling;
|
4485 | }
|
4486 | } else {
|
4487 | cb(node);
|
4488 | }
|
4489 | }
|
4490 |
|
4491 | const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
4492 |
|
4493 |
|
4494 | function defineAsyncComponent(source) {
|
4495 | if (isFunction(source)) {
|
4496 | source = { loader: source };
|
4497 | }
|
4498 | const {
|
4499 | loader,
|
4500 | loadingComponent,
|
4501 | errorComponent,
|
4502 | delay = 200,
|
4503 | hydrate: hydrateStrategy,
|
4504 | timeout,
|
4505 |
|
4506 | suspensible = true,
|
4507 | onError: userOnError
|
4508 | } = source;
|
4509 | let pendingRequest = null;
|
4510 | let resolvedComp;
|
4511 | let retries = 0;
|
4512 | const retry = () => {
|
4513 | retries++;
|
4514 | pendingRequest = null;
|
4515 | return load();
|
4516 | };
|
4517 | const load = () => {
|
4518 | let thisRequest;
|
4519 | return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
4520 | err = err instanceof Error ? err : new Error(String(err));
|
4521 | if (userOnError) {
|
4522 | return new Promise((resolve, reject) => {
|
4523 | const userRetry = () => resolve(retry());
|
4524 | const userFail = () => reject(err);
|
4525 | userOnError(err, userRetry, userFail, retries + 1);
|
4526 | });
|
4527 | } else {
|
4528 | throw err;
|
4529 | }
|
4530 | }).then((comp) => {
|
4531 | if (thisRequest !== pendingRequest && pendingRequest) {
|
4532 | return pendingRequest;
|
4533 | }
|
4534 | if (!comp) {
|
4535 | warn$1(
|
4536 | `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
|
4537 | );
|
4538 | }
|
4539 | if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
4540 | comp = comp.default;
|
4541 | }
|
4542 | if (comp && !isObject(comp) && !isFunction(comp)) {
|
4543 | throw new Error(`Invalid async component load result: ${comp}`);
|
4544 | }
|
4545 | resolvedComp = comp;
|
4546 | return comp;
|
4547 | }));
|
4548 | };
|
4549 | return defineComponent({
|
4550 | name: "AsyncComponentWrapper",
|
4551 | __asyncLoader: load,
|
4552 | __asyncHydrate(el, instance, hydrate) {
|
4553 | const doHydrate = hydrateStrategy ? () => {
|
4554 | const teardown = hydrateStrategy(
|
4555 | hydrate,
|
4556 | (cb) => forEachElement(el, cb)
|
4557 | );
|
4558 | if (teardown) {
|
4559 | (instance.bum || (instance.bum = [])).push(teardown);
|
4560 | }
|
4561 | } : hydrate;
|
4562 | if (resolvedComp) {
|
4563 | doHydrate();
|
4564 | } else {
|
4565 | load().then(() => !instance.isUnmounted && doHydrate());
|
4566 | }
|
4567 | },
|
4568 | get __asyncResolved() {
|
4569 | return resolvedComp;
|
4570 | },
|
4571 | setup() {
|
4572 | const instance = currentInstance;
|
4573 | markAsyncBoundary(instance);
|
4574 | if (resolvedComp) {
|
4575 | return () => createInnerComp(resolvedComp, instance);
|
4576 | }
|
4577 | const onError = (err) => {
|
4578 | pendingRequest = null;
|
4579 | handleError(
|
4580 | err,
|
4581 | instance,
|
4582 | 13,
|
4583 | !errorComponent
|
4584 | );
|
4585 | };
|
4586 | if (suspensible && instance.suspense || false) {
|
4587 | return load().then((comp) => {
|
4588 | return () => createInnerComp(comp, instance);
|
4589 | }).catch((err) => {
|
4590 | onError(err);
|
4591 | return () => errorComponent ? createVNode(errorComponent, {
|
4592 | error: err
|
4593 | }) : null;
|
4594 | });
|
4595 | }
|
4596 | const loaded = ref(false);
|
4597 | const error = ref();
|
4598 | const delayed = ref(!!delay);
|
4599 | if (delay) {
|
4600 | setTimeout(() => {
|
4601 | delayed.value = false;
|
4602 | }, delay);
|
4603 | }
|
4604 | if (timeout != null) {
|
4605 | setTimeout(() => {
|
4606 | if (!loaded.value && !error.value) {
|
4607 | const err = new Error(
|
4608 | `Async component timed out after ${timeout}ms.`
|
4609 | );
|
4610 | onError(err);
|
4611 | error.value = err;
|
4612 | }
|
4613 | }, timeout);
|
4614 | }
|
4615 | load().then(() => {
|
4616 | loaded.value = true;
|
4617 | if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
4618 | instance.parent.update();
|
4619 | }
|
4620 | }).catch((err) => {
|
4621 | onError(err);
|
4622 | error.value = err;
|
4623 | });
|
4624 | return () => {
|
4625 | if (loaded.value && resolvedComp) {
|
4626 | return createInnerComp(resolvedComp, instance);
|
4627 | } else if (error.value && errorComponent) {
|
4628 | return createVNode(errorComponent, {
|
4629 | error: error.value
|
4630 | });
|
4631 | } else if (loadingComponent && !delayed.value) {
|
4632 | return createVNode(loadingComponent);
|
4633 | }
|
4634 | };
|
4635 | }
|
4636 | });
|
4637 | }
|
4638 | function createInnerComp(comp, parent) {
|
4639 | const { ref: ref2, props, children, ce } = parent.vnode;
|
4640 | const vnode = createVNode(comp, props, children);
|
4641 | vnode.ref = ref2;
|
4642 | vnode.ce = ce;
|
4643 | delete parent.vnode.ce;
|
4644 | return vnode;
|
4645 | }
|
4646 |
|
4647 | const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
4648 | const KeepAliveImpl = {
|
4649 | name: `KeepAlive`,
|
4650 |
|
4651 |
|
4652 |
|
4653 | __isKeepAlive: true,
|
4654 | props: {
|
4655 | include: [String, RegExp, Array],
|
4656 | exclude: [String, RegExp, Array],
|
4657 | max: [String, Number]
|
4658 | },
|
4659 | setup(props, { slots }) {
|
4660 | const instance = getCurrentInstance();
|
4661 | const sharedContext = instance.ctx;
|
4662 | const cache = new Map();
|
4663 | const keys = new Set();
|
4664 | let current = null;
|
4665 | {
|
4666 | instance.__v_cache = cache;
|
4667 | }
|
4668 | const parentSuspense = instance.suspense;
|
4669 | const {
|
4670 | renderer: {
|
4671 | p: patch,
|
4672 | m: move,
|
4673 | um: _unmount,
|
4674 | o: { createElement }
|
4675 | }
|
4676 | } = sharedContext;
|
4677 | const storageContainer = createElement("div");
|
4678 | sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
4679 | const instance2 = vnode.component;
|
4680 | move(vnode, container, anchor, 0, parentSuspense);
|
4681 | patch(
|
4682 | instance2.vnode,
|
4683 | vnode,
|
4684 | container,
|
4685 | anchor,
|
4686 | instance2,
|
4687 | parentSuspense,
|
4688 | namespace,
|
4689 | vnode.slotScopeIds,
|
4690 | optimized
|
4691 | );
|
4692 | queuePostRenderEffect(() => {
|
4693 | instance2.isDeactivated = false;
|
4694 | if (instance2.a) {
|
4695 | invokeArrayFns(instance2.a);
|
4696 | }
|
4697 | const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
4698 | if (vnodeHook) {
|
4699 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4700 | }
|
4701 | }, parentSuspense);
|
4702 | {
|
4703 | devtoolsComponentAdded(instance2);
|
4704 | }
|
4705 | };
|
4706 | sharedContext.deactivate = (vnode) => {
|
4707 | const instance2 = vnode.component;
|
4708 | invalidateMount(instance2.m);
|
4709 | invalidateMount(instance2.a);
|
4710 | move(vnode, storageContainer, null, 1, parentSuspense);
|
4711 | queuePostRenderEffect(() => {
|
4712 | if (instance2.da) {
|
4713 | invokeArrayFns(instance2.da);
|
4714 | }
|
4715 | const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
4716 | if (vnodeHook) {
|
4717 | invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
4718 | }
|
4719 | instance2.isDeactivated = true;
|
4720 | }, parentSuspense);
|
4721 | {
|
4722 | devtoolsComponentAdded(instance2);
|
4723 | }
|
4724 | };
|
4725 | function unmount(vnode) {
|
4726 | resetShapeFlag(vnode);
|
4727 | _unmount(vnode, instance, parentSuspense, true);
|
4728 | }
|
4729 | function pruneCache(filter) {
|
4730 | cache.forEach((vnode, key) => {
|
4731 | const name = getComponentName(vnode.type);
|
4732 | if (name && !filter(name)) {
|
4733 | pruneCacheEntry(key);
|
4734 | }
|
4735 | });
|
4736 | }
|
4737 | function pruneCacheEntry(key) {
|
4738 | const cached = cache.get(key);
|
4739 | if (cached && (!current || !isSameVNodeType(cached, current))) {
|
4740 | unmount(cached);
|
4741 | } else if (current) {
|
4742 | resetShapeFlag(current);
|
4743 | }
|
4744 | cache.delete(key);
|
4745 | keys.delete(key);
|
4746 | }
|
4747 | watch(
|
4748 | () => [props.include, props.exclude],
|
4749 | ([include, exclude]) => {
|
4750 | include && pruneCache((name) => matches(include, name));
|
4751 | exclude && pruneCache((name) => !matches(exclude, name));
|
4752 | },
|
4753 |
|
4754 | { flush: "post", deep: true }
|
4755 | );
|
4756 | let pendingCacheKey = null;
|
4757 | const cacheSubtree = () => {
|
4758 | if (pendingCacheKey != null) {
|
4759 | if (isSuspense(instance.subTree.type)) {
|
4760 | queuePostRenderEffect(() => {
|
4761 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
4762 | }, instance.subTree.suspense);
|
4763 | } else {
|
4764 | cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
4765 | }
|
4766 | }
|
4767 | };
|
4768 | onMounted(cacheSubtree);
|
4769 | onUpdated(cacheSubtree);
|
4770 | onBeforeUnmount(() => {
|
4771 | cache.forEach((cached) => {
|
4772 | const { subTree, suspense } = instance;
|
4773 | const vnode = getInnerChild(subTree);
|
4774 | if (cached.type === vnode.type && cached.key === vnode.key) {
|
4775 | resetShapeFlag(vnode);
|
4776 | const da = vnode.component.da;
|
4777 | da && queuePostRenderEffect(da, suspense);
|
4778 | return;
|
4779 | }
|
4780 | unmount(cached);
|
4781 | });
|
4782 | });
|
4783 | return () => {
|
4784 | pendingCacheKey = null;
|
4785 | if (!slots.default) {
|
4786 | return current = null;
|
4787 | }
|
4788 | const children = slots.default();
|
4789 | const rawVNode = children[0];
|
4790 | if (children.length > 1) {
|
4791 | {
|
4792 | warn$1(`KeepAlive should contain exactly one component child.`);
|
4793 | }
|
4794 | current = null;
|
4795 | return children;
|
4796 | } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
4797 | current = null;
|
4798 | return rawVNode;
|
4799 | }
|
4800 | let vnode = getInnerChild(rawVNode);
|
4801 | if (vnode.type === Comment) {
|
4802 | current = null;
|
4803 | return vnode;
|
4804 | }
|
4805 | const comp = vnode.type;
|
4806 | const name = getComponentName(
|
4807 | isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
4808 | );
|
4809 | const { include, exclude, max } = props;
|
4810 | if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
4811 | vnode.shapeFlag &= ~256;
|
4812 | current = vnode;
|
4813 | return rawVNode;
|
4814 | }
|
4815 | const key = vnode.key == null ? comp : vnode.key;
|
4816 | const cachedVNode = cache.get(key);
|
4817 | if (vnode.el) {
|
4818 | vnode = cloneVNode(vnode);
|
4819 | if (rawVNode.shapeFlag & 128) {
|
4820 | rawVNode.ssContent = vnode;
|
4821 | }
|
4822 | }
|
4823 | pendingCacheKey = key;
|
4824 | if (cachedVNode) {
|
4825 | vnode.el = cachedVNode.el;
|
4826 | vnode.component = cachedVNode.component;
|
4827 | if (vnode.transition) {
|
4828 | setTransitionHooks(vnode, vnode.transition);
|
4829 | }
|
4830 | vnode.shapeFlag |= 512;
|
4831 | keys.delete(key);
|
4832 | keys.add(key);
|
4833 | } else {
|
4834 | keys.add(key);
|
4835 | if (max && keys.size > parseInt(max, 10)) {
|
4836 | pruneCacheEntry(keys.values().next().value);
|
4837 | }
|
4838 | }
|
4839 | vnode.shapeFlag |= 256;
|
4840 | current = vnode;
|
4841 | return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
4842 | };
|
4843 | }
|
4844 | };
|
4845 | const KeepAlive = KeepAliveImpl;
|
4846 | function matches(pattern, name) {
|
4847 | if (isArray(pattern)) {
|
4848 | return pattern.some((p) => matches(p, name));
|
4849 | } else if (isString(pattern)) {
|
4850 | return pattern.split(",").includes(name);
|
4851 | } else if (isRegExp(pattern)) {
|
4852 | pattern.lastIndex = 0;
|
4853 | return pattern.test(name);
|
4854 | }
|
4855 | return false;
|
4856 | }
|
4857 | function onActivated(hook, target) {
|
4858 | registerKeepAliveHook(hook, "a", target);
|
4859 | }
|
4860 | function onDeactivated(hook, target) {
|
4861 | registerKeepAliveHook(hook, "da", target);
|
4862 | }
|
4863 | function registerKeepAliveHook(hook, type, target = currentInstance) {
|
4864 | const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
4865 | let current = target;
|
4866 | while (current) {
|
4867 | if (current.isDeactivated) {
|
4868 | return;
|
4869 | }
|
4870 | current = current.parent;
|
4871 | }
|
4872 | return hook();
|
4873 | });
|
4874 | injectHook(type, wrappedHook, target);
|
4875 | if (target) {
|
4876 | let current = target.parent;
|
4877 | while (current && current.parent) {
|
4878 | if (isKeepAlive(current.parent.vnode)) {
|
4879 | injectToKeepAliveRoot(wrappedHook, type, target, current);
|
4880 | }
|
4881 | current = current.parent;
|
4882 | }
|
4883 | }
|
4884 | }
|
4885 | function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
4886 | const injected = injectHook(
|
4887 | type,
|
4888 | hook,
|
4889 | keepAliveRoot,
|
4890 | true
|
4891 |
|
4892 | );
|
4893 | onUnmounted(() => {
|
4894 | remove(keepAliveRoot[type], injected);
|
4895 | }, target);
|
4896 | }
|
4897 | function resetShapeFlag(vnode) {
|
4898 | vnode.shapeFlag &= ~256;
|
4899 | vnode.shapeFlag &= ~512;
|
4900 | }
|
4901 | function getInnerChild(vnode) {
|
4902 | return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
4903 | }
|
4904 |
|
4905 | function injectHook(type, hook, target = currentInstance, prepend = false) {
|
4906 | if (target) {
|
4907 | const hooks = target[type] || (target[type] = []);
|
4908 | const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
4909 | pauseTracking();
|
4910 | const reset = setCurrentInstance(target);
|
4911 | const res = callWithAsyncErrorHandling(hook, target, type, args);
|
4912 | reset();
|
4913 | resetTracking();
|
4914 | return res;
|
4915 | });
|
4916 | if (prepend) {
|
4917 | hooks.unshift(wrappedHook);
|
4918 | } else {
|
4919 | hooks.push(wrappedHook);
|
4920 | }
|
4921 | return wrappedHook;
|
4922 | } else {
|
4923 | const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
4924 | warn$1(
|
4925 | `${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.` )
|
4926 | );
|
4927 | }
|
4928 | }
|
4929 | const createHook = (lifecycle) => (hook, target = currentInstance) => {
|
4930 | if (!isInSSRComponentSetup || lifecycle === "sp") {
|
4931 | injectHook(lifecycle, (...args) => hook(...args), target);
|
4932 | }
|
4933 | };
|
4934 | const onBeforeMount = createHook("bm");
|
4935 | const onMounted = createHook("m");
|
4936 | const onBeforeUpdate = createHook(
|
4937 | "bu"
|
4938 | );
|
4939 | const onUpdated = createHook("u");
|
4940 | const onBeforeUnmount = createHook(
|
4941 | "bum"
|
4942 | );
|
4943 | const onUnmounted = createHook("um");
|
4944 | const onServerPrefetch = createHook(
|
4945 | "sp"
|
4946 | );
|
4947 | const onRenderTriggered = createHook("rtg");
|
4948 | const onRenderTracked = createHook("rtc");
|
4949 | function onErrorCaptured(hook, target = currentInstance) {
|
4950 | injectHook("ec", hook, target);
|
4951 | }
|
4952 |
|
4953 | const COMPONENTS = "components";
|
4954 | const DIRECTIVES = "directives";
|
4955 | function resolveComponent(name, maybeSelfReference) {
|
4956 | return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
4957 | }
|
4958 | const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
4959 | function resolveDynamicComponent(component) {
|
4960 | if (isString(component)) {
|
4961 | return resolveAsset(COMPONENTS, component, false) || component;
|
4962 | } else {
|
4963 | return component || NULL_DYNAMIC_COMPONENT;
|
4964 | }
|
4965 | }
|
4966 | function resolveDirective(name) {
|
4967 | return resolveAsset(DIRECTIVES, name);
|
4968 | }
|
4969 | function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
4970 | const instance = currentRenderingInstance || currentInstance;
|
4971 | if (instance) {
|
4972 | const Component = instance.type;
|
4973 | if (type === COMPONENTS) {
|
4974 | const selfName = getComponentName(
|
4975 | Component,
|
4976 | false
|
4977 | );
|
4978 | if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
4979 | return Component;
|
4980 | }
|
4981 | }
|
4982 | const res = (
|
4983 |
|
4984 |
|
4985 | resolve(instance[type] || Component[type], name) ||
|
4986 | resolve(instance.appContext[type], name)
|
4987 | );
|
4988 | if (!res && maybeSelfReference) {
|
4989 | return Component;
|
4990 | }
|
4991 | if (warnMissing && !res) {
|
4992 | const extra = type === COMPONENTS ? `
|
4993 | If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
4994 | warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
4995 | }
|
4996 | return res;
|
4997 | } else {
|
4998 | warn$1(
|
4999 | `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
5000 | );
|
5001 | }
|
5002 | }
|
5003 | function resolve(registry, name) {
|
5004 | return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
|
5005 | }
|
5006 |
|
5007 | function renderList(source, renderItem, cache, index) {
|
5008 | let ret;
|
5009 | const cached = cache && cache[index];
|
5010 | const sourceIsArray = isArray(source);
|
5011 | if (sourceIsArray || isString(source)) {
|
5012 | const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
5013 | let needsWrap = false;
|
5014 | if (sourceIsReactiveArray) {
|
5015 | needsWrap = !isShallow(source);
|
5016 | source = shallowReadArray(source);
|
5017 | }
|
5018 | ret = new Array(source.length);
|
5019 | for (let i = 0, l = source.length; i < l; i++) {
|
5020 | ret[i] = renderItem(
|
5021 | needsWrap ? toReactive(source[i]) : source[i],
|
5022 | i,
|
5023 | void 0,
|
5024 | cached && cached[i]
|
5025 | );
|
5026 | }
|
5027 | } else if (typeof source === "number") {
|
5028 | if (!Number.isInteger(source)) {
|
5029 | warn$1(`The v-for range expect an integer value but got ${source}.`);
|
5030 | }
|
5031 | ret = new Array(source);
|
5032 | for (let i = 0; i < source; i++) {
|
5033 | ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
5034 | }
|
5035 | } else if (isObject(source)) {
|
5036 | if (source[Symbol.iterator]) {
|
5037 | ret = Array.from(
|
5038 | source,
|
5039 | (item, i) => renderItem(item, i, void 0, cached && cached[i])
|
5040 | );
|
5041 | } else {
|
5042 | const keys = Object.keys(source);
|
5043 | ret = new Array(keys.length);
|
5044 | for (let i = 0, l = keys.length; i < l; i++) {
|
5045 | const key = keys[i];
|
5046 | ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
5047 | }
|
5048 | }
|
5049 | } else {
|
5050 | ret = [];
|
5051 | }
|
5052 | if (cache) {
|
5053 | cache[index] = ret;
|
5054 | }
|
5055 | return ret;
|
5056 | }
|
5057 |
|
5058 | function createSlots(slots, dynamicSlots) {
|
5059 | for (let i = 0; i < dynamicSlots.length; i++) {
|
5060 | const slot = dynamicSlots[i];
|
5061 | if (isArray(slot)) {
|
5062 | for (let j = 0; j < slot.length; j++) {
|
5063 | slots[slot[j].name] = slot[j].fn;
|
5064 | }
|
5065 | } else if (slot) {
|
5066 | slots[slot.name] = slot.key ? (...args) => {
|
5067 | const res = slot.fn(...args);
|
5068 | if (res) res.key = slot.key;
|
5069 | return res;
|
5070 | } : slot.fn;
|
5071 | }
|
5072 | }
|
5073 | return slots;
|
5074 | }
|
5075 |
|
5076 | function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
5077 | if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
5078 | if (name !== "default") props.name = name;
|
5079 | return openBlock(), createBlock(
|
5080 | Fragment,
|
5081 | null,
|
5082 | [createVNode("slot", props, fallback && fallback())],
|
5083 | 64
|
5084 | );
|
5085 | }
|
5086 | let slot = slots[name];
|
5087 | if (slot && slot.length > 1) {
|
5088 | warn$1(
|
5089 | `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.`
|
5090 | );
|
5091 | slot = () => [];
|
5092 | }
|
5093 | if (slot && slot._c) {
|
5094 | slot._d = false;
|
5095 | }
|
5096 | openBlock();
|
5097 | const validSlotContent = slot && ensureValidVNode(slot(props));
|
5098 | const slotKey = props.key ||
|
5099 |
|
5100 | validSlotContent && validSlotContent.key;
|
5101 | const rendered = createBlock(
|
5102 | Fragment,
|
5103 | {
|
5104 | key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) +
|
5105 | (!validSlotContent && fallback ? "_fb" : "")
|
5106 | },
|
5107 | validSlotContent || (fallback ? fallback() : []),
|
5108 | validSlotContent && slots._ === 1 ? 64 : -2
|
5109 | );
|
5110 | if (!noSlotted && rendered.scopeId) {
|
5111 | rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
5112 | }
|
5113 | if (slot && slot._c) {
|
5114 | slot._d = true;
|
5115 | }
|
5116 | return rendered;
|
5117 | }
|
5118 | function ensureValidVNode(vnodes) {
|
5119 | return vnodes.some((child) => {
|
5120 | if (!isVNode(child)) return true;
|
5121 | if (child.type === Comment) return false;
|
5122 | if (child.type === Fragment && !ensureValidVNode(child.children))
|
5123 | return false;
|
5124 | return true;
|
5125 | }) ? vnodes : null;
|
5126 | }
|
5127 |
|
5128 | function toHandlers(obj, preserveCaseIfNecessary) {
|
5129 | const ret = {};
|
5130 | if (!isObject(obj)) {
|
5131 | warn$1(`v-on with no argument expects an object value.`);
|
5132 | return ret;
|
5133 | }
|
5134 | for (const key in obj) {
|
5135 | ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
|
5136 | }
|
5137 | return ret;
|
5138 | }
|
5139 |
|
5140 | const getPublicInstance = (i) => {
|
5141 | if (!i) return null;
|
5142 | if (isStatefulComponent(i)) return getComponentPublicInstance(i);
|
5143 | return getPublicInstance(i.parent);
|
5144 | };
|
5145 | const publicPropertiesMap = (
|
5146 |
|
5147 |
|
5148 | extend( Object.create(null), {
|
5149 | $: (i) => i,
|
5150 | $el: (i) => i.vnode.el,
|
5151 | $data: (i) => i.data,
|
5152 | $props: (i) => shallowReadonly(i.props) ,
|
5153 | $attrs: (i) => shallowReadonly(i.attrs) ,
|
5154 | $slots: (i) => shallowReadonly(i.slots) ,
|
5155 | $refs: (i) => shallowReadonly(i.refs) ,
|
5156 | $parent: (i) => getPublicInstance(i.parent),
|
5157 | $root: (i) => getPublicInstance(i.root),
|
5158 | $host: (i) => i.ce,
|
5159 | $emit: (i) => i.emit,
|
5160 | $options: (i) => resolveMergedOptions(i) ,
|
5161 | $forceUpdate: (i) => i.f || (i.f = () => {
|
5162 | queueJob(i.update);
|
5163 | }),
|
5164 | $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
5165 | $watch: (i) => instanceWatch.bind(i)
|
5166 | })
|
5167 | );
|
5168 | const isReservedPrefix = (key) => key === "_" || key === "$";
|
5169 | const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
5170 | const PublicInstanceProxyHandlers = {
|
5171 | get({ _: instance }, key) {
|
5172 | if (key === "__v_skip") {
|
5173 | return true;
|
5174 | }
|
5175 | const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
5176 | if (key === "__isVue") {
|
5177 | return true;
|
5178 | }
|
5179 | let normalizedProps;
|
5180 | if (key[0] !== "$") {
|
5181 | const n = accessCache[key];
|
5182 | if (n !== void 0) {
|
5183 | switch (n) {
|
5184 | case 1 :
|
5185 | return setupState[key];
|
5186 | case 2 :
|
5187 | return data[key];
|
5188 | case 4 :
|
5189 | return ctx[key];
|
5190 | case 3 :
|
5191 | return props[key];
|
5192 | }
|
5193 | } else if (hasSetupBinding(setupState, key)) {
|
5194 | accessCache[key] = 1 ;
|
5195 | return setupState[key];
|
5196 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
5197 | accessCache[key] = 2 ;
|
5198 | return data[key];
|
5199 | } else if (
|
5200 |
|
5201 |
|
5202 | (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
|
5203 | ) {
|
5204 | accessCache[key] = 3 ;
|
5205 | return props[key];
|
5206 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
5207 | accessCache[key] = 4 ;
|
5208 | return ctx[key];
|
5209 | } else if (shouldCacheAccess) {
|
5210 | accessCache[key] = 0 ;
|
5211 | }
|
5212 | }
|
5213 | const publicGetter = publicPropertiesMap[key];
|
5214 | let cssModule, globalProperties;
|
5215 | if (publicGetter) {
|
5216 | if (key === "$attrs") {
|
5217 | track(instance.attrs, "get", "");
|
5218 | markAttrsAccessed();
|
5219 | } else if (key === "$slots") {
|
5220 | track(instance, "get", key);
|
5221 | }
|
5222 | return publicGetter(instance);
|
5223 | } else if (
|
5224 |
|
5225 | (cssModule = type.__cssModules) && (cssModule = cssModule[key])
|
5226 | ) {
|
5227 | return cssModule;
|
5228 | } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
5229 | accessCache[key] = 4 ;
|
5230 | return ctx[key];
|
5231 | } else if (
|
5232 |
|
5233 | globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
|
5234 | ) {
|
5235 | {
|
5236 | return globalProperties[key];
|
5237 | }
|
5238 | } else if (currentRenderingInstance && (!isString(key) ||
|
5239 |
|
5240 | key.indexOf("__v") !== 0)) {
|
5241 | if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
5242 | warn$1(
|
5243 | `Property ${JSON.stringify(
|
5244 | key
|
5245 | )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
|
5246 | );
|
5247 | } else if (instance === currentRenderingInstance) {
|
5248 | warn$1(
|
5249 | `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
5250 | );
|
5251 | }
|
5252 | }
|
5253 | },
|
5254 | set({ _: instance }, key, value) {
|
5255 | const { data, setupState, ctx } = instance;
|
5256 | if (hasSetupBinding(setupState, key)) {
|
5257 | setupState[key] = value;
|
5258 | return true;
|
5259 | } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
5260 | warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
5261 | return false;
|
5262 | } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
5263 | data[key] = value;
|
5264 | return true;
|
5265 | } else if (hasOwn(instance.props, key)) {
|
5266 | warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
5267 | return false;
|
5268 | }
|
5269 | if (key[0] === "$" && key.slice(1) in instance) {
|
5270 | warn$1(
|
5271 | `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
|
5272 | );
|
5273 | return false;
|
5274 | } else {
|
5275 | if (key in instance.appContext.config.globalProperties) {
|
5276 | Object.defineProperty(ctx, key, {
|
5277 | enumerable: true,
|
5278 | configurable: true,
|
5279 | value
|
5280 | });
|
5281 | } else {
|
5282 | ctx[key] = value;
|
5283 | }
|
5284 | }
|
5285 | return true;
|
5286 | },
|
5287 | has({
|
5288 | _: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
5289 | }, key) {
|
5290 | let normalizedProps;
|
5291 | 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);
|
5292 | },
|
5293 | defineProperty(target, key, descriptor) {
|
5294 | if (descriptor.get != null) {
|
5295 | target._.accessCache[key] = 0;
|
5296 | } else if (hasOwn(descriptor, "value")) {
|
5297 | this.set(target, key, descriptor.value, null);
|
5298 | }
|
5299 | return Reflect.defineProperty(target, key, descriptor);
|
5300 | }
|
5301 | };
|
5302 | {
|
5303 | PublicInstanceProxyHandlers.ownKeys = (target) => {
|
5304 | warn$1(
|
5305 | `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
5306 | );
|
5307 | return Reflect.ownKeys(target);
|
5308 | };
|
5309 | }
|
5310 | const RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, {
|
5311 | get(target, key) {
|
5312 | if (key === Symbol.unscopables) {
|
5313 | return;
|
5314 | }
|
5315 | return PublicInstanceProxyHandlers.get(target, key, target);
|
5316 | },
|
5317 | has(_, key) {
|
5318 | const has = key[0] !== "_" && !isGloballyAllowed(key);
|
5319 | if (!has && PublicInstanceProxyHandlers.has(_, key)) {
|
5320 | warn$1(
|
5321 | `Property ${JSON.stringify(
|
5322 | key
|
5323 | )} should not start with _ which is a reserved prefix for Vue internals.`
|
5324 | );
|
5325 | }
|
5326 | return has;
|
5327 | }
|
5328 | });
|
5329 | function createDevRenderContext(instance) {
|
5330 | const target = {};
|
5331 | Object.defineProperty(target, `_`, {
|
5332 | configurable: true,
|
5333 | enumerable: false,
|
5334 | get: () => instance
|
5335 | });
|
5336 | Object.keys(publicPropertiesMap).forEach((key) => {
|
5337 | Object.defineProperty(target, key, {
|
5338 | configurable: true,
|
5339 | enumerable: false,
|
5340 | get: () => publicPropertiesMap[key](instance),
|
5341 | // intercepted by the proxy so no need for implementation,
|
5342 | // but needed to prevent set errors
|
5343 | set: NOOP
|
5344 | });
|
5345 | });
|
5346 | return target;
|
5347 | }
|
5348 | function exposePropsOnRenderContext(instance) {
|
5349 | const {
|
5350 | ctx,
|
5351 | propsOptions: [propsOptions]
|
5352 | } = instance;
|
5353 | if (propsOptions) {
|
5354 | Object.keys(propsOptions).forEach((key) => {
|
5355 | Object.defineProperty(ctx, key, {
|
5356 | enumerable: true,
|
5357 | configurable: true,
|
5358 | get: () => instance.props[key],
|
5359 | set: NOOP
|
5360 | });
|
5361 | });
|
5362 | }
|
5363 | }
|
5364 | function exposeSetupStateOnRenderContext(instance) {
|
5365 | const { ctx, setupState } = instance;
|
5366 | Object.keys(toRaw(setupState)).forEach((key) => {
|
5367 | if (!setupState.__isScriptSetup) {
|
5368 | if (isReservedPrefix(key[0])) {
|
5369 | warn$1(
|
5370 | `setup() return property ${JSON.stringify(
|
5371 | key
|
5372 | )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
|
5373 | );
|
5374 | return;
|
5375 | }
|
5376 | Object.defineProperty(ctx, key, {
|
5377 | enumerable: true,
|
5378 | configurable: true,
|
5379 | get: () => setupState[key],
|
5380 | set: NOOP
|
5381 | });
|
5382 | }
|
5383 | });
|
5384 | }
|
5385 |
|
5386 | const warnRuntimeUsage = (method) => warn$1(
|
5387 | `${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.`
|
5388 | );
|
5389 | function defineProps() {
|
5390 | {
|
5391 | warnRuntimeUsage(`defineProps`);
|
5392 | }
|
5393 | return null;
|
5394 | }
|
5395 | function defineEmits() {
|
5396 | {
|
5397 | warnRuntimeUsage(`defineEmits`);
|
5398 | }
|
5399 | return null;
|
5400 | }
|
5401 | function defineExpose(exposed) {
|
5402 | {
|
5403 | warnRuntimeUsage(`defineExpose`);
|
5404 | }
|
5405 | }
|
5406 | function defineOptions(options) {
|
5407 | {
|
5408 | warnRuntimeUsage(`defineOptions`);
|
5409 | }
|
5410 | }
|
5411 | function defineSlots() {
|
5412 | {
|
5413 | warnRuntimeUsage(`defineSlots`);
|
5414 | }
|
5415 | return null;
|
5416 | }
|
5417 | function defineModel() {
|
5418 | {
|
5419 | warnRuntimeUsage("defineModel");
|
5420 | }
|
5421 | }
|
5422 | function withDefaults(props, defaults) {
|
5423 | {
|
5424 | warnRuntimeUsage(`withDefaults`);
|
5425 | }
|
5426 | return null;
|
5427 | }
|
5428 | function useSlots() {
|
5429 | return getContext().slots;
|
5430 | }
|
5431 | function useAttrs() {
|
5432 | return getContext().attrs;
|
5433 | }
|
5434 | function getContext() {
|
5435 | const i = getCurrentInstance();
|
5436 | if (!i) {
|
5437 | warn$1(`useContext() called without active instance.`);
|
5438 | }
|
5439 | return i.setupContext || (i.setupContext = createSetupContext(i));
|
5440 | }
|
5441 | function normalizePropsOrEmits(props) {
|
5442 | return isArray(props) ? props.reduce(
|
5443 | (normalized, p) => (normalized[p] = null, normalized),
|
5444 | {}
|
5445 | ) : props;
|
5446 | }
|
5447 | function mergeDefaults(raw, defaults) {
|
5448 | const props = normalizePropsOrEmits(raw);
|
5449 | for (const key in defaults) {
|
5450 | if (key.startsWith("__skip")) continue;
|
5451 | let opt = props[key];
|
5452 | if (opt) {
|
5453 | if (isArray(opt) || isFunction(opt)) {
|
5454 | opt = props[key] = { type: opt, default: defaults[key] };
|
5455 | } else {
|
5456 | opt.default = defaults[key];
|
5457 | }
|
5458 | } else if (opt === null) {
|
5459 | opt = props[key] = { default: defaults[key] };
|
5460 | } else {
|
5461 | warn$1(`props default key "${key}" has no corresponding declaration.`);
|
5462 | }
|
5463 | if (opt && defaults[`__skip_${key}`]) {
|
5464 | opt.skipFactory = true;
|
5465 | }
|
5466 | }
|
5467 | return props;
|
5468 | }
|
5469 | function mergeModels(a, b) {
|
5470 | if (!a || !b) return a || b;
|
5471 | if (isArray(a) && isArray(b)) return a.concat(b);
|
5472 | return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
5473 | }
|
5474 | function createPropsRestProxy(props, excludedKeys) {
|
5475 | const ret = {};
|
5476 | for (const key in props) {
|
5477 | if (!excludedKeys.includes(key)) {
|
5478 | Object.defineProperty(ret, key, {
|
5479 | enumerable: true,
|
5480 | get: () => props[key]
|
5481 | });
|
5482 | }
|
5483 | }
|
5484 | return ret;
|
5485 | }
|
5486 | function withAsyncContext(getAwaitable) {
|
5487 | const ctx = getCurrentInstance();
|
5488 | if (!ctx) {
|
5489 | warn$1(
|
5490 | `withAsyncContext called without active current instance. This is likely a bug.`
|
5491 | );
|
5492 | }
|
5493 | let awaitable = getAwaitable();
|
5494 | unsetCurrentInstance();
|
5495 | if (isPromise(awaitable)) {
|
5496 | awaitable = awaitable.catch((e) => {
|
5497 | setCurrentInstance(ctx);
|
5498 | throw e;
|
5499 | });
|
5500 | }
|
5501 | return [awaitable, () => setCurrentInstance(ctx)];
|
5502 | }
|
5503 |
|
5504 | function createDuplicateChecker() {
|
5505 | const cache = /* @__PURE__ */ Object.create(null);
|
5506 | return (type, key) => {
|
5507 | if (cache[key]) {
|
5508 | warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
5509 | } else {
|
5510 | cache[key] = type;
|
5511 | }
|
5512 | };
|
5513 | }
|
5514 | let shouldCacheAccess = true;
|
5515 | function applyOptions(instance) {
|
5516 | const options = resolveMergedOptions(instance);
|
5517 | const publicThis = instance.proxy;
|
5518 | const ctx = instance.ctx;
|
5519 | shouldCacheAccess = false;
|
5520 | if (options.beforeCreate) {
|
5521 | callHook$1(options.beforeCreate, instance, "bc");
|
5522 | }
|
5523 | const {
|
5524 | // state
|
5525 | data: dataOptions,
|
5526 | computed: computedOptions,
|
5527 | methods,
|
5528 | watch: watchOptions,
|
5529 | provide: provideOptions,
|
5530 | inject: injectOptions,
|
5531 | // lifecycle
|
5532 | created,
|
5533 | beforeMount,
|
5534 | mounted,
|
5535 | beforeUpdate,
|
5536 | updated,
|
5537 | activated,
|
5538 | deactivated,
|
5539 | beforeDestroy,
|
5540 | beforeUnmount,
|
5541 | destroyed,
|
5542 | unmounted,
|
5543 | render,
|
5544 | renderTracked,
|
5545 | renderTriggered,
|
5546 | errorCaptured,
|
5547 | serverPrefetch,
|
5548 | // public API
|
5549 | expose,
|
5550 | inheritAttrs,
|
5551 | // assets
|
5552 | components,
|
5553 | directives,
|
5554 | filters
|
5555 | } = options;
|
5556 | const checkDuplicateProperties = createDuplicateChecker() ;
|
5557 | {
|
5558 | const [propsOptions] = instance.propsOptions;
|
5559 | if (propsOptions) {
|
5560 | for (const key in propsOptions) {
|
5561 | checkDuplicateProperties("Props" /* PROPS */, key);
|
5562 | }
|
5563 | }
|
5564 | }
|
5565 | if (injectOptions) {
|
5566 | resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
5567 | }
|
5568 | if (methods) {
|
5569 | for (const key in methods) {
|
5570 | const methodHandler = methods[key];
|
5571 | if (isFunction(methodHandler)) {
|
5572 | {
|
5573 | Object.defineProperty(ctx, key, {
|
5574 | value: methodHandler.bind(publicThis),
|
5575 | configurable: true,
|
5576 | enumerable: true,
|
5577 | writable: true
|
5578 | });
|
5579 | }
|
5580 | {
|
5581 | checkDuplicateProperties("Methods" /* METHODS */, key);
|
5582 | }
|
5583 | } else {
|
5584 | warn$1(
|
5585 | `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
5586 | );
|
5587 | }
|
5588 | }
|
5589 | }
|
5590 | if (dataOptions) {
|
5591 | if (!isFunction(dataOptions)) {
|
5592 | warn$1(
|
5593 | `The data option must be a function. Plain object usage is no longer supported.`
|
5594 | );
|
5595 | }
|
5596 | const data = dataOptions.call(publicThis, publicThis);
|
5597 | if (isPromise(data)) {
|
5598 | warn$1(
|
5599 | `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
|
5600 | );
|
5601 | }
|
5602 | if (!isObject(data)) {
|
5603 | warn$1(`data() should return an object.`);
|
5604 | } else {
|
5605 | instance.data = reactive(data);
|
5606 | {
|
5607 | for (const key in data) {
|
5608 | checkDuplicateProperties("Data" , key);
|
5609 | if (!isReservedPrefix(key[0])) {
|
5610 | Object.defineProperty(ctx, key, {
|
5611 | configurable: true,
|
5612 | enumerable: true,
|
5613 | get: () => data[key],
|
5614 | set: NOOP
|
5615 | });
|
5616 | }
|
5617 | }
|
5618 | }
|
5619 | }
|
5620 | }
|
5621 | shouldCacheAccess = true;
|
5622 | if (computedOptions) {
|
5623 | for (const key in computedOptions) {
|
5624 | const opt = computedOptions[key];
|
5625 | const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
5626 | if (get === NOOP) {
|
5627 | warn$1(`Computed property "${key}" has no getter.`);
|
5628 | }
|
5629 | const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
|
5630 | warn$1(
|
5631 | `Write operation failed: computed property "${key}" is readonly.`
|
5632 | );
|
5633 | } ;
|
5634 | const c = computed({
|
5635 | get,
|
5636 | set
|
5637 | });
|
5638 | Object.defineProperty(ctx, key, {
|
5639 | enumerable: true,
|
5640 | configurable: true,
|
5641 | get: () => c.value,
|
5642 | set: (v) => c.value = v
|
5643 | });
|
5644 | {
|
5645 | checkDuplicateProperties("Computed" , key);
|
5646 | }
|
5647 | }
|
5648 | }
|
5649 | if (watchOptions) {
|
5650 | for (const key in watchOptions) {
|
5651 | createWatcher(watchOptions[key], ctx, publicThis, key);
|
5652 | }
|
5653 | }
|
5654 | if (provideOptions) {
|
5655 | const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
5656 | Reflect.ownKeys(provides).forEach((key) => {
|
5657 | provide(key, provides[key]);
|
5658 | });
|
5659 | }
|
5660 | if (created) {
|
5661 | callHook$1(created, instance, "c");
|
5662 | }
|
5663 | function registerLifecycleHook(register, hook) {
|
5664 | if (isArray(hook)) {
|
5665 | hook.forEach((_hook) => register(_hook.bind(publicThis)));
|
5666 | } else if (hook) {
|
5667 | register(hook.bind(publicThis));
|
5668 | }
|
5669 | }
|
5670 | registerLifecycleHook(onBeforeMount, beforeMount);
|
5671 | registerLifecycleHook(onMounted, mounted);
|
5672 | registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
5673 | registerLifecycleHook(onUpdated, updated);
|
5674 | registerLifecycleHook(onActivated, activated);
|
5675 | registerLifecycleHook(onDeactivated, deactivated);
|
5676 | registerLifecycleHook(onErrorCaptured, errorCaptured);
|
5677 | registerLifecycleHook(onRenderTracked, renderTracked);
|
5678 | registerLifecycleHook(onRenderTriggered, renderTriggered);
|
5679 | registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
5680 | registerLifecycleHook(onUnmounted, unmounted);
|
5681 | registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
5682 | if (isArray(expose)) {
|
5683 | if (expose.length) {
|
5684 | const exposed = instance.exposed || (instance.exposed = {});
|
5685 | expose.forEach((key) => {
|
5686 | Object.defineProperty(exposed, key, {
|
5687 | get: () => publicThis[key],
|
5688 | set: (val) => publicThis[key] = val
|
5689 | });
|
5690 | });
|
5691 | } else if (!instance.exposed) {
|
5692 | instance.exposed = {};
|
5693 | }
|
5694 | }
|
5695 | if (render && instance.render === NOOP) {
|
5696 | instance.render = render;
|
5697 | }
|
5698 | if (inheritAttrs != null) {
|
5699 | instance.inheritAttrs = inheritAttrs;
|
5700 | }
|
5701 | if (components) instance.components = components;
|
5702 | if (directives) instance.directives = directives;
|
5703 | }
|
5704 | function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
|
5705 | if (isArray(injectOptions)) {
|
5706 | injectOptions = normalizeInject(injectOptions);
|
5707 | }
|
5708 | for (const key in injectOptions) {
|
5709 | const opt = injectOptions[key];
|
5710 | let injected;
|
5711 | if (isObject(opt)) {
|
5712 | if ("default" in opt) {
|
5713 | injected = inject(
|
5714 | opt.from || key,
|
5715 | opt.default,
|
5716 | true
|
5717 | );
|
5718 | } else {
|
5719 | injected = inject(opt.from || key);
|
5720 | }
|
5721 | } else {
|
5722 | injected = inject(opt);
|
5723 | }
|
5724 | if (isRef(injected)) {
|
5725 | Object.defineProperty(ctx, key, {
|
5726 | enumerable: true,
|
5727 | configurable: true,
|
5728 | get: () => injected.value,
|
5729 | set: (v) => injected.value = v
|
5730 | });
|
5731 | } else {
|
5732 | ctx[key] = injected;
|
5733 | }
|
5734 | {
|
5735 | checkDuplicateProperties("Inject" , key);
|
5736 | }
|
5737 | }
|
5738 | }
|
5739 | function callHook$1(hook, instance, type) {
|
5740 | callWithAsyncErrorHandling(
|
5741 | isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
|
5742 | instance,
|
5743 | type
|
5744 | );
|
5745 | }
|
5746 | function createWatcher(raw, ctx, publicThis, key) {
|
5747 | let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
5748 | if (isString(raw)) {
|
5749 | const handler = ctx[raw];
|
5750 | if (isFunction(handler)) {
|
5751 | {
|
5752 | watch(getter, handler);
|
5753 | }
|
5754 | } else {
|
5755 | warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
5756 | }
|
5757 | } else if (isFunction(raw)) {
|
5758 | {
|
5759 | watch(getter, raw.bind(publicThis));
|
5760 | }
|
5761 | } else if (isObject(raw)) {
|
5762 | if (isArray(raw)) {
|
5763 | raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
5764 | } else {
|
5765 | const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
5766 | if (isFunction(handler)) {
|
5767 | watch(getter, handler, raw);
|
5768 | } else {
|
5769 | warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
5770 | }
|
5771 | }
|
5772 | } else {
|
5773 | warn$1(`Invalid watch option: "${key}"`, raw);
|
5774 | }
|
5775 | }
|
5776 | function resolveMergedOptions(instance) {
|
5777 | const base = instance.type;
|
5778 | const { mixins, extends: extendsOptions } = base;
|
5779 | const {
|
5780 | mixins: globalMixins,
|
5781 | optionsCache: cache,
|
5782 | config: { optionMergeStrategies }
|
5783 | } = instance.appContext;
|
5784 | const cached = cache.get(base);
|
5785 | let resolved;
|
5786 | if (cached) {
|
5787 | resolved = cached;
|
5788 | } else if (!globalMixins.length && !mixins && !extendsOptions) {
|
5789 | {
|
5790 | resolved = base;
|
5791 | }
|
5792 | } else {
|
5793 | resolved = {};
|
5794 | if (globalMixins.length) {
|
5795 | globalMixins.forEach(
|
5796 | (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
|
5797 | );
|
5798 | }
|
5799 | mergeOptions(resolved, base, optionMergeStrategies);
|
5800 | }
|
5801 | if (isObject(base)) {
|
5802 | cache.set(base, resolved);
|
5803 | }
|
5804 | return resolved;
|
5805 | }
|
5806 | function mergeOptions(to, from, strats, asMixin = false) {
|
5807 | const { mixins, extends: extendsOptions } = from;
|
5808 | if (extendsOptions) {
|
5809 | mergeOptions(to, extendsOptions, strats, true);
|
5810 | }
|
5811 | if (mixins) {
|
5812 | mixins.forEach(
|
5813 | (m) => mergeOptions(to, m, strats, true)
|
5814 | );
|
5815 | }
|
5816 | for (const key in from) {
|
5817 | if (asMixin && key === "expose") {
|
5818 | warn$1(
|
5819 | `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
|
5820 | );
|
5821 | } else {
|
5822 | const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
5823 | to[key] = strat ? strat(to[key], from[key]) : from[key];
|
5824 | }
|
5825 | }
|
5826 | return to;
|
5827 | }
|
5828 | const internalOptionMergeStrats = {
|
5829 | data: mergeDataFn,
|
5830 | props: mergeEmitsOrPropsOptions,
|
5831 | emits: mergeEmitsOrPropsOptions,
|
5832 |
|
5833 | methods: mergeObjectOptions,
|
5834 | computed: mergeObjectOptions,
|
5835 |
|
5836 | beforeCreate: mergeAsArray,
|
5837 | created: mergeAsArray,
|
5838 | beforeMount: mergeAsArray,
|
5839 | mounted: mergeAsArray,
|
5840 | beforeUpdate: mergeAsArray,
|
5841 | updated: mergeAsArray,
|
5842 | beforeDestroy: mergeAsArray,
|
5843 | beforeUnmount: mergeAsArray,
|
5844 | destroyed: mergeAsArray,
|
5845 | unmounted: mergeAsArray,
|
5846 | activated: mergeAsArray,
|
5847 | deactivated: mergeAsArray,
|
5848 | errorCaptured: mergeAsArray,
|
5849 | serverPrefetch: mergeAsArray,
|
5850 |
|
5851 | components: mergeObjectOptions,
|
5852 | directives: mergeObjectOptions,
|
5853 |
|
5854 | watch: mergeWatchOptions,
|
5855 |
|
5856 | provide: mergeDataFn,
|
5857 | inject: mergeInject
|
5858 | };
|
5859 | function mergeDataFn(to, from) {
|
5860 | if (!from) {
|
5861 | return to;
|
5862 | }
|
5863 | if (!to) {
|
5864 | return from;
|
5865 | }
|
5866 | return function mergedDataFn() {
|
5867 | return (extend)(
|
5868 | isFunction(to) ? to.call(this, this) : to,
|
5869 | isFunction(from) ? from.call(this, this) : from
|
5870 | );
|
5871 | };
|
5872 | }
|
5873 | function mergeInject(to, from) {
|
5874 | return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
5875 | }
|
5876 | function normalizeInject(raw) {
|
5877 | if (isArray(raw)) {
|
5878 | const res = {};
|
5879 | for (let i = 0; i < raw.length; i++) {
|
5880 | res[raw[i]] = raw[i];
|
5881 | }
|
5882 | return res;
|
5883 | }
|
5884 | return raw;
|
5885 | }
|
5886 | function mergeAsArray(to, from) {
|
5887 | return to ? [...new Set([].concat(to, from))] : from;
|
5888 | }
|
5889 | function mergeObjectOptions(to, from) {
|
5890 | return to ? extend( Object.create(null), to, from) : from;
|
5891 | }
|
5892 | function mergeEmitsOrPropsOptions(to, from) {
|
5893 | if (to) {
|
5894 | if (isArray(to) && isArray(from)) {
|
5895 | return [... new Set([...to, ...from])];
|
5896 | }
|
5897 | return extend(
|
5898 | Object.create(null),
|
5899 | normalizePropsOrEmits(to),
|
5900 | normalizePropsOrEmits(from != null ? from : {})
|
5901 | );
|
5902 | } else {
|
5903 | return from;
|
5904 | }
|
5905 | }
|
5906 | function mergeWatchOptions(to, from) {
|
5907 | if (!to) return from;
|
5908 | if (!from) return to;
|
5909 | const merged = extend( Object.create(null), to);
|
5910 | for (const key in from) {
|
5911 | merged[key] = mergeAsArray(to[key], from[key]);
|
5912 | }
|
5913 | return merged;
|
5914 | }
|
5915 |
|
5916 | function createAppContext() {
|
5917 | return {
|
5918 | app: null,
|
5919 | config: {
|
5920 | isNativeTag: NO,
|
5921 | performance: false,
|
5922 | globalProperties: {},
|
5923 | optionMergeStrategies: {},
|
5924 | errorHandler: void 0,
|
5925 | warnHandler: void 0,
|
5926 | compilerOptions: {}
|
5927 | },
|
5928 | mixins: [],
|
5929 | components: {},
|
5930 | directives: {},
|
5931 | provides: Object.create(null),
|
5932 | optionsCache: new WeakMap(),
|
5933 | propsCache: new WeakMap(),
|
5934 | emitsCache: new WeakMap()
|
5935 | };
|
5936 | }
|
5937 | let uid$1 = 0;
|
5938 | function createAppAPI(render, hydrate) {
|
5939 | return function createApp(rootComponent, rootProps = null) {
|
5940 | if (!isFunction(rootComponent)) {
|
5941 | rootComponent = extend({}, rootComponent);
|
5942 | }
|
5943 | if (rootProps != null && !isObject(rootProps)) {
|
5944 | warn$1(`root props passed to app.mount() must be an object.`);
|
5945 | rootProps = null;
|
5946 | }
|
5947 | const context = createAppContext();
|
5948 | const installedPlugins = new WeakSet();
|
5949 | const pluginCleanupFns = [];
|
5950 | let isMounted = false;
|
5951 | const app = context.app = {
|
5952 | _uid: uid$1++,
|
5953 | _component: rootComponent,
|
5954 | _props: rootProps,
|
5955 | _container: null,
|
5956 | _context: context,
|
5957 | _instance: null,
|
5958 | version,
|
5959 | get config() {
|
5960 | return context.config;
|
5961 | },
|
5962 | set config(v) {
|
5963 | {
|
5964 | warn$1(
|
5965 | `app.config cannot be replaced. Modify individual options instead.`
|
5966 | );
|
5967 | }
|
5968 | },
|
5969 | use(plugin, ...options) {
|
5970 | if (installedPlugins.has(plugin)) {
|
5971 | warn$1(`Plugin has already been applied to target app.`);
|
5972 | } else if (plugin && isFunction(plugin.install)) {
|
5973 | installedPlugins.add(plugin);
|
5974 | plugin.install(app, ...options);
|
5975 | } else if (isFunction(plugin)) {
|
5976 | installedPlugins.add(plugin);
|
5977 | plugin(app, ...options);
|
5978 | } else {
|
5979 | warn$1(
|
5980 | `A plugin must either be a function or an object with an "install" function.`
|
5981 | );
|
5982 | }
|
5983 | return app;
|
5984 | },
|
5985 | mixin(mixin) {
|
5986 | {
|
5987 | if (!context.mixins.includes(mixin)) {
|
5988 | context.mixins.push(mixin);
|
5989 | } else {
|
5990 | warn$1(
|
5991 | "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
5992 | );
|
5993 | }
|
5994 | }
|
5995 | return app;
|
5996 | },
|
5997 | component(name, component) {
|
5998 | {
|
5999 | validateComponentName(name, context.config);
|
6000 | }
|
6001 | if (!component) {
|
6002 | return context.components[name];
|
6003 | }
|
6004 | if (context.components[name]) {
|
6005 | warn$1(`Component "${name}" has already been registered in target app.`);
|
6006 | }
|
6007 | context.components[name] = component;
|
6008 | return app;
|
6009 | },
|
6010 | directive(name, directive) {
|
6011 | {
|
6012 | validateDirectiveName(name);
|
6013 | }
|
6014 | if (!directive) {
|
6015 | return context.directives[name];
|
6016 | }
|
6017 | if (context.directives[name]) {
|
6018 | warn$1(`Directive "${name}" has already been registered in target app.`);
|
6019 | }
|
6020 | context.directives[name] = directive;
|
6021 | return app;
|
6022 | },
|
6023 | mount(rootContainer, isHydrate, namespace) {
|
6024 | if (!isMounted) {
|
6025 | if (rootContainer.__vue_app__) {
|
6026 | warn$1(
|
6027 | `There is already an app instance mounted on the host container.
|
6028 | If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
6029 | );
|
6030 | }
|
6031 | const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
|
6032 | vnode.appContext = context;
|
6033 | if (namespace === true) {
|
6034 | namespace = "svg";
|
6035 | } else if (namespace === false) {
|
6036 | namespace = void 0;
|
6037 | }
|
6038 | {
|
6039 | context.reload = () => {
|
6040 | render(
|
6041 | cloneVNode(vnode),
|
6042 | rootContainer,
|
6043 | namespace
|
6044 | );
|
6045 | };
|
6046 | }
|
6047 | if (isHydrate && hydrate) {
|
6048 | hydrate(vnode, rootContainer);
|
6049 | } else {
|
6050 | render(vnode, rootContainer, namespace);
|
6051 | }
|
6052 | isMounted = true;
|
6053 | app._container = rootContainer;
|
6054 | rootContainer.__vue_app__ = app;
|
6055 | {
|
6056 | app._instance = vnode.component;
|
6057 | devtoolsInitApp(app, version);
|
6058 | }
|
6059 | return getComponentPublicInstance(vnode.component);
|
6060 | } else {
|
6061 | warn$1(
|
6062 | `App has already been mounted.
|
6063 | If 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)\``
|
6064 | );
|
6065 | }
|
6066 | },
|
6067 | onUnmount(cleanupFn) {
|
6068 | if (typeof cleanupFn !== "function") {
|
6069 | warn$1(
|
6070 | `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
6071 | );
|
6072 | }
|
6073 | pluginCleanupFns.push(cleanupFn);
|
6074 | },
|
6075 | unmount() {
|
6076 | if (isMounted) {
|
6077 | callWithAsyncErrorHandling(
|
6078 | pluginCleanupFns,
|
6079 | app._instance,
|
6080 | 16
|
6081 | );
|
6082 | render(null, app._container);
|
6083 | {
|
6084 | app._instance = null;
|
6085 | devtoolsUnmountApp(app);
|
6086 | }
|
6087 | delete app._container.__vue_app__;
|
6088 | } else {
|
6089 | warn$1(`Cannot unmount an app that is not mounted.`);
|
6090 | }
|
6091 | },
|
6092 | provide(key, value) {
|
6093 | if (key in context.provides) {
|
6094 | warn$1(
|
6095 | `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
6096 | );
|
6097 | }
|
6098 | context.provides[key] = value;
|
6099 | return app;
|
6100 | },
|
6101 | runWithContext(fn) {
|
6102 | const lastApp = currentApp;
|
6103 | currentApp = app;
|
6104 | try {
|
6105 | return fn();
|
6106 | } finally {
|
6107 | currentApp = lastApp;
|
6108 | }
|
6109 | }
|
6110 | };
|
6111 | return app;
|
6112 | };
|
6113 | }
|
6114 | let currentApp = null;
|
6115 |
|
6116 | function provide(key, value) {
|
6117 | if (!currentInstance) {
|
6118 | {
|
6119 | warn$1(`provide() can only be used inside setup().`);
|
6120 | }
|
6121 | } else {
|
6122 | let provides = currentInstance.provides;
|
6123 | const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
6124 | if (parentProvides === provides) {
|
6125 | provides = currentInstance.provides = Object.create(parentProvides);
|
6126 | }
|
6127 | provides[key] = value;
|
6128 | }
|
6129 | }
|
6130 | function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
6131 | const instance = currentInstance || currentRenderingInstance;
|
6132 | if (instance || currentApp) {
|
6133 | const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
6134 | if (provides && key in provides) {
|
6135 | return provides[key];
|
6136 | } else if (arguments.length > 1) {
|
6137 | return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
6138 | } else {
|
6139 | warn$1(`injection "${String(key)}" not found.`);
|
6140 | }
|
6141 | } else {
|
6142 | warn$1(`inject() can only be used inside setup() or functional components.`);
|
6143 | }
|
6144 | }
|
6145 | function hasInjectionContext() {
|
6146 | return !!(currentInstance || currentRenderingInstance || currentApp);
|
6147 | }
|
6148 |
|
6149 | const internalObjectProto = {};
|
6150 | const createInternalObject = () => Object.create(internalObjectProto);
|
6151 | const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
6152 |
|
6153 | function initProps(instance, rawProps, isStateful, isSSR = false) {
|
6154 | const props = {};
|
6155 | const attrs = createInternalObject();
|
6156 | instance.propsDefaults = Object.create(null);
|
6157 | setFullProps(instance, rawProps, props, attrs);
|
6158 | for (const key in instance.propsOptions[0]) {
|
6159 | if (!(key in props)) {
|
6160 | props[key] = void 0;
|
6161 | }
|
6162 | }
|
6163 | {
|
6164 | validateProps(rawProps || {}, props, instance);
|
6165 | }
|
6166 | if (isStateful) {
|
6167 | instance.props = isSSR ? props : shallowReactive(props);
|
6168 | } else {
|
6169 | if (!instance.type.props) {
|
6170 | instance.props = attrs;
|
6171 | } else {
|
6172 | instance.props = props;
|
6173 | }
|
6174 | }
|
6175 | instance.attrs = attrs;
|
6176 | }
|
6177 | function isInHmrContext(instance) {
|
6178 | while (instance) {
|
6179 | if (instance.type.__hmrId) return true;
|
6180 | instance = instance.parent;
|
6181 | }
|
6182 | }
|
6183 | function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
6184 | const {
|
6185 | props,
|
6186 | attrs,
|
6187 | vnode: { patchFlag }
|
6188 | } = instance;
|
6189 | const rawCurrentProps = toRaw(props);
|
6190 | const [options] = instance.propsOptions;
|
6191 | let hasAttrsChanged = false;
|
6192 | if (
|
6193 |
|
6194 |
|
6195 |
|
6196 | !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
|
6197 | ) {
|
6198 | if (patchFlag & 8) {
|
6199 | const propsToUpdate = instance.vnode.dynamicProps;
|
6200 | for (let i = 0; i < propsToUpdate.length; i++) {
|
6201 | let key = propsToUpdate[i];
|
6202 | if (isEmitListener(instance.emitsOptions, key)) {
|
6203 | continue;
|
6204 | }
|
6205 | const value = rawProps[key];
|
6206 | if (options) {
|
6207 | if (hasOwn(attrs, key)) {
|
6208 | if (value !== attrs[key]) {
|
6209 | attrs[key] = value;
|
6210 | hasAttrsChanged = true;
|
6211 | }
|
6212 | } else {
|
6213 | const camelizedKey = camelize(key);
|
6214 | props[camelizedKey] = resolvePropValue(
|
6215 | options,
|
6216 | rawCurrentProps,
|
6217 | camelizedKey,
|
6218 | value,
|
6219 | instance,
|
6220 | false
|
6221 | );
|
6222 | }
|
6223 | } else {
|
6224 | if (value !== attrs[key]) {
|
6225 | attrs[key] = value;
|
6226 | hasAttrsChanged = true;
|
6227 | }
|
6228 | }
|
6229 | }
|
6230 | }
|
6231 | } else {
|
6232 | if (setFullProps(instance, rawProps, props, attrs)) {
|
6233 | hasAttrsChanged = true;
|
6234 | }
|
6235 | let kebabKey;
|
6236 | for (const key in rawCurrentProps) {
|
6237 | if (!rawProps ||
|
6238 | !hasOwn(rawProps, key) &&
|
6239 |
|
6240 | ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
|
6241 | if (options) {
|
6242 | if (rawPrevProps &&
|
6243 | (rawPrevProps[key] !== void 0 ||
|
6244 | rawPrevProps[kebabKey] !== void 0)) {
|
6245 | props[key] = resolvePropValue(
|
6246 | options,
|
6247 | rawCurrentProps,
|
6248 | key,
|
6249 | void 0,
|
6250 | instance,
|
6251 | true
|
6252 | );
|
6253 | }
|
6254 | } else {
|
6255 | delete props[key];
|
6256 | }
|
6257 | }
|
6258 | }
|
6259 | if (attrs !== rawCurrentProps) {
|
6260 | for (const key in attrs) {
|
6261 | if (!rawProps || !hasOwn(rawProps, key) && true) {
|
6262 | delete attrs[key];
|
6263 | hasAttrsChanged = true;
|
6264 | }
|
6265 | }
|
6266 | }
|
6267 | }
|
6268 | if (hasAttrsChanged) {
|
6269 | trigger(instance.attrs, "set", "");
|
6270 | }
|
6271 | {
|
6272 | validateProps(rawProps || {}, props, instance);
|
6273 | }
|
6274 | }
|
6275 | function setFullProps(instance, rawProps, props, attrs) {
|
6276 | const [options, needCastKeys] = instance.propsOptions;
|
6277 | let hasAttrsChanged = false;
|
6278 | let rawCastValues;
|
6279 | if (rawProps) {
|
6280 | for (let key in rawProps) {
|
6281 | if (isReservedProp(key)) {
|
6282 | continue;
|
6283 | }
|
6284 | const value = rawProps[key];
|
6285 | let camelKey;
|
6286 | if (options && hasOwn(options, camelKey = camelize(key))) {
|
6287 | if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
6288 | props[camelKey] = value;
|
6289 | } else {
|
6290 | (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
6291 | }
|
6292 | } else if (!isEmitListener(instance.emitsOptions, key)) {
|
6293 | if (!(key in attrs) || value !== attrs[key]) {
|
6294 | attrs[key] = value;
|
6295 | hasAttrsChanged = true;
|
6296 | }
|
6297 | }
|
6298 | }
|
6299 | }
|
6300 | if (needCastKeys) {
|
6301 | const rawCurrentProps = toRaw(props);
|
6302 | const castValues = rawCastValues || EMPTY_OBJ;
|
6303 | for (let i = 0; i < needCastKeys.length; i++) {
|
6304 | const key = needCastKeys[i];
|
6305 | props[key] = resolvePropValue(
|
6306 | options,
|
6307 | rawCurrentProps,
|
6308 | key,
|
6309 | castValues[key],
|
6310 | instance,
|
6311 | !hasOwn(castValues, key)
|
6312 | );
|
6313 | }
|
6314 | }
|
6315 | return hasAttrsChanged;
|
6316 | }
|
6317 | function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
6318 | const opt = options[key];
|
6319 | if (opt != null) {
|
6320 | const hasDefault = hasOwn(opt, "default");
|
6321 | if (hasDefault && value === void 0) {
|
6322 | const defaultValue = opt.default;
|
6323 | if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
6324 | const { propsDefaults } = instance;
|
6325 | if (key in propsDefaults) {
|
6326 | value = propsDefaults[key];
|
6327 | } else {
|
6328 | const reset = setCurrentInstance(instance);
|
6329 | value = propsDefaults[key] = defaultValue.call(
|
6330 | null,
|
6331 | props
|
6332 | );
|
6333 | reset();
|
6334 | }
|
6335 | } else {
|
6336 | value = defaultValue;
|
6337 | }
|
6338 | if (instance.ce) {
|
6339 | instance.ce._setProp(key, value);
|
6340 | }
|
6341 | }
|
6342 | if (opt[0 ]) {
|
6343 | if (isAbsent && !hasDefault) {
|
6344 | value = false;
|
6345 | } else if (opt[1 ] && (value === "" || value === hyphenate(key))) {
|
6346 | value = true;
|
6347 | }
|
6348 | }
|
6349 | }
|
6350 | return value;
|
6351 | }
|
6352 | const mixinPropsCache = new WeakMap();
|
6353 | function normalizePropsOptions(comp, appContext, asMixin = false) {
|
6354 | const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
6355 | const cached = cache.get(comp);
|
6356 | if (cached) {
|
6357 | return cached;
|
6358 | }
|
6359 | const raw = comp.props;
|
6360 | const normalized = {};
|
6361 | const needCastKeys = [];
|
6362 | let hasExtends = false;
|
6363 | if (!isFunction(comp)) {
|
6364 | const extendProps = (raw2) => {
|
6365 | hasExtends = true;
|
6366 | const [props, keys] = normalizePropsOptions(raw2, appContext, true);
|
6367 | extend(normalized, props);
|
6368 | if (keys) needCastKeys.push(...keys);
|
6369 | };
|
6370 | if (!asMixin && appContext.mixins.length) {
|
6371 | appContext.mixins.forEach(extendProps);
|
6372 | }
|
6373 | if (comp.extends) {
|
6374 | extendProps(comp.extends);
|
6375 | }
|
6376 | if (comp.mixins) {
|
6377 | comp.mixins.forEach(extendProps);
|
6378 | }
|
6379 | }
|
6380 | if (!raw && !hasExtends) {
|
6381 | if (isObject(comp)) {
|
6382 | cache.set(comp, EMPTY_ARR);
|
6383 | }
|
6384 | return EMPTY_ARR;
|
6385 | }
|
6386 | if (isArray(raw)) {
|
6387 | for (let i = 0; i < raw.length; i++) {
|
6388 | if (!isString(raw[i])) {
|
6389 | warn$1(`props must be strings when using array syntax.`, raw[i]);
|
6390 | }
|
6391 | const normalizedKey = camelize(raw[i]);
|
6392 | if (validatePropName(normalizedKey)) {
|
6393 | normalized[normalizedKey] = EMPTY_OBJ;
|
6394 | }
|
6395 | }
|
6396 | } else if (raw) {
|
6397 | if (!isObject(raw)) {
|
6398 | warn$1(`invalid props options`, raw);
|
6399 | }
|
6400 | for (const key in raw) {
|
6401 | const normalizedKey = camelize(key);
|
6402 | if (validatePropName(normalizedKey)) {
|
6403 | const opt = raw[key];
|
6404 | const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
|
6405 | const propType = prop.type;
|
6406 | let shouldCast = false;
|
6407 | let shouldCastTrue = true;
|
6408 | if (isArray(propType)) {
|
6409 | for (let index = 0; index < propType.length; ++index) {
|
6410 | const type = propType[index];
|
6411 | const typeName = isFunction(type) && type.name;
|
6412 | if (typeName === "Boolean") {
|
6413 | shouldCast = true;
|
6414 | break;
|
6415 | } else if (typeName === "String") {
|
6416 | shouldCastTrue = false;
|
6417 | }
|
6418 | }
|
6419 | } else {
|
6420 | shouldCast = isFunction(propType) && propType.name === "Boolean";
|
6421 | }
|
6422 | prop[0 ] = shouldCast;
|
6423 | prop[1 ] = shouldCastTrue;
|
6424 | if (shouldCast || hasOwn(prop, "default")) {
|
6425 | needCastKeys.push(normalizedKey);
|
6426 | }
|
6427 | }
|
6428 | }
|
6429 | }
|
6430 | const res = [normalized, needCastKeys];
|
6431 | if (isObject(comp)) {
|
6432 | cache.set(comp, res);
|
6433 | }
|
6434 | return res;
|
6435 | }
|
6436 | function validatePropName(key) {
|
6437 | if (key[0] !== "$" && !isReservedProp(key)) {
|
6438 | return true;
|
6439 | } else {
|
6440 | warn$1(`Invalid prop name: "${key}" is a reserved property.`);
|
6441 | }
|
6442 | return false;
|
6443 | }
|
6444 | function getType(ctor) {
|
6445 | if (ctor === null) {
|
6446 | return "null";
|
6447 | }
|
6448 | if (typeof ctor === "function") {
|
6449 | return ctor.name || "";
|
6450 | } else if (typeof ctor === "object") {
|
6451 | const name = ctor.constructor && ctor.constructor.name;
|
6452 | return name || "";
|
6453 | }
|
6454 | return "";
|
6455 | }
|
6456 | function validateProps(rawProps, props, instance) {
|
6457 | const resolvedValues = toRaw(props);
|
6458 | const options = instance.propsOptions[0];
|
6459 | const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
6460 | for (const key in options) {
|
6461 | let opt = options[key];
|
6462 | if (opt == null) continue;
|
6463 | validateProp(
|
6464 | key,
|
6465 | resolvedValues[key],
|
6466 | opt,
|
6467 | shallowReadonly(resolvedValues) ,
|
6468 | !camelizePropsKey.includes(key)
|
6469 | );
|
6470 | }
|
6471 | }
|
6472 | function validateProp(name, value, prop, props, isAbsent) {
|
6473 | const { type, required, validator, skipCheck } = prop;
|
6474 | if (required && isAbsent) {
|
6475 | warn$1('Missing required prop: "' + name + '"');
|
6476 | return;
|
6477 | }
|
6478 | if (value == null && !required) {
|
6479 | return;
|
6480 | }
|
6481 | if (type != null && type !== true && !skipCheck) {
|
6482 | let isValid = false;
|
6483 | const types = isArray(type) ? type : [type];
|
6484 | const expectedTypes = [];
|
6485 | for (let i = 0; i < types.length && !isValid; i++) {
|
6486 | const { valid, expectedType } = assertType(value, types[i]);
|
6487 | expectedTypes.push(expectedType || "");
|
6488 | isValid = valid;
|
6489 | }
|
6490 | if (!isValid) {
|
6491 | warn$1(getInvalidTypeMessage(name, value, expectedTypes));
|
6492 | return;
|
6493 | }
|
6494 | }
|
6495 | if (validator && !validator(value, props)) {
|
6496 | warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
6497 | }
|
6498 | }
|
6499 | const isSimpleType = makeMap(
|
6500 | "String,Number,Boolean,Function,Symbol,BigInt"
|
6501 | );
|
6502 | function assertType(value, type) {
|
6503 | let valid;
|
6504 | const expectedType = getType(type);
|
6505 | if (expectedType === "null") {
|
6506 | valid = value === null;
|
6507 | } else if (isSimpleType(expectedType)) {
|
6508 | const t = typeof value;
|
6509 | valid = t === expectedType.toLowerCase();
|
6510 | if (!valid && t === "object") {
|
6511 | valid = value instanceof type;
|
6512 | }
|
6513 | } else if (expectedType === "Object") {
|
6514 | valid = isObject(value);
|
6515 | } else if (expectedType === "Array") {
|
6516 | valid = isArray(value);
|
6517 | } else {
|
6518 | valid = value instanceof type;
|
6519 | }
|
6520 | return {
|
6521 | valid,
|
6522 | expectedType
|
6523 | };
|
6524 | }
|
6525 | function getInvalidTypeMessage(name, value, expectedTypes) {
|
6526 | if (expectedTypes.length === 0) {
|
6527 | return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
6528 | }
|
6529 | let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
|
6530 | const expectedType = expectedTypes[0];
|
6531 | const receivedType = toRawType(value);
|
6532 | const expectedValue = styleValue(value, expectedType);
|
6533 | const receivedValue = styleValue(value, receivedType);
|
6534 | if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
6535 | message += ` with value ${expectedValue}`;
|
6536 | }
|
6537 | message += `, got ${receivedType} `;
|
6538 | if (isExplicable(receivedType)) {
|
6539 | message += `with value ${receivedValue}.`;
|
6540 | }
|
6541 | return message;
|
6542 | }
|
6543 | function styleValue(value, type) {
|
6544 | if (type === "String") {
|
6545 | return `"${value}"`;
|
6546 | } else if (type === "Number") {
|
6547 | return `${Number(value)}`;
|
6548 | } else {
|
6549 | return `${value}`;
|
6550 | }
|
6551 | }
|
6552 | function isExplicable(type) {
|
6553 | const explicitTypes = ["string", "number", "boolean"];
|
6554 | return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
6555 | }
|
6556 | function isBoolean(...args) {
|
6557 | return args.some((elem) => elem.toLowerCase() === "boolean");
|
6558 | }
|
6559 |
|
6560 | const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
6561 | const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
6562 | const normalizeSlot = (key, rawSlot, ctx) => {
|
6563 | if (rawSlot._n) {
|
6564 | return rawSlot;
|
6565 | }
|
6566 | const normalized = withCtx((...args) => {
|
6567 | if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
|
6568 | warn$1(
|
6569 | `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.`
|
6570 | );
|
6571 | }
|
6572 | return normalizeSlotValue(rawSlot(...args));
|
6573 | }, ctx);
|
6574 | normalized._c = false;
|
6575 | return normalized;
|
6576 | };
|
6577 | const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
6578 | const ctx = rawSlots._ctx;
|
6579 | for (const key in rawSlots) {
|
6580 | if (isInternalKey(key)) continue;
|
6581 | const value = rawSlots[key];
|
6582 | if (isFunction(value)) {
|
6583 | slots[key] = normalizeSlot(key, value, ctx);
|
6584 | } else if (value != null) {
|
6585 | {
|
6586 | warn$1(
|
6587 | `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
6588 | );
|
6589 | }
|
6590 | const normalized = normalizeSlotValue(value);
|
6591 | slots[key] = () => normalized;
|
6592 | }
|
6593 | }
|
6594 | };
|
6595 | const normalizeVNodeSlots = (instance, children) => {
|
6596 | if (!isKeepAlive(instance.vnode) && true) {
|
6597 | warn$1(
|
6598 | `Non-function value encountered for default slot. Prefer function slots for better performance.`
|
6599 | );
|
6600 | }
|
6601 | const normalized = normalizeSlotValue(children);
|
6602 | instance.slots.default = () => normalized;
|
6603 | };
|
6604 | const assignSlots = (slots, children, optimized) => {
|
6605 | for (const key in children) {
|
6606 | if (optimized || key !== "_") {
|
6607 | slots[key] = children[key];
|
6608 | }
|
6609 | }
|
6610 | };
|
6611 | const initSlots = (instance, children, optimized) => {
|
6612 | const slots = instance.slots = createInternalObject();
|
6613 | if (instance.vnode.shapeFlag & 32) {
|
6614 | const type = children._;
|
6615 | if (type) {
|
6616 | assignSlots(slots, children, optimized);
|
6617 | if (optimized) {
|
6618 | def(slots, "_", type, true);
|
6619 | }
|
6620 | } else {
|
6621 | normalizeObjectSlots(children, slots);
|
6622 | }
|
6623 | } else if (children) {
|
6624 | normalizeVNodeSlots(instance, children);
|
6625 | }
|
6626 | };
|
6627 | const updateSlots = (instance, children, optimized) => {
|
6628 | const { vnode, slots } = instance;
|
6629 | let needDeletionCheck = true;
|
6630 | let deletionComparisonTarget = EMPTY_OBJ;
|
6631 | if (vnode.shapeFlag & 32) {
|
6632 | const type = children._;
|
6633 | if (type) {
|
6634 | if (isHmrUpdating) {
|
6635 | assignSlots(slots, children, optimized);
|
6636 | trigger(instance, "set", "$slots");
|
6637 | } else if (optimized && type === 1) {
|
6638 | needDeletionCheck = false;
|
6639 | } else {
|
6640 | assignSlots(slots, children, optimized);
|
6641 | }
|
6642 | } else {
|
6643 | needDeletionCheck = !children.$stable;
|
6644 | normalizeObjectSlots(children, slots);
|
6645 | }
|
6646 | deletionComparisonTarget = children;
|
6647 | } else if (children) {
|
6648 | normalizeVNodeSlots(instance, children);
|
6649 | deletionComparisonTarget = { default: 1 };
|
6650 | }
|
6651 | if (needDeletionCheck) {
|
6652 | for (const key in slots) {
|
6653 | if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
|
6654 | delete slots[key];
|
6655 | }
|
6656 | }
|
6657 | }
|
6658 | };
|
6659 |
|
6660 | let supported;
|
6661 | let perf;
|
6662 | function startMeasure(instance, type) {
|
6663 | if (instance.appContext.config.performance && isSupported()) {
|
6664 | perf.mark(`vue-${type}-${instance.uid}`);
|
6665 | }
|
6666 | {
|
6667 | devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
6668 | }
|
6669 | }
|
6670 | function endMeasure(instance, type) {
|
6671 | if (instance.appContext.config.performance && isSupported()) {
|
6672 | const startTag = `vue-${type}-${instance.uid}`;
|
6673 | const endTag = startTag + `:end`;
|
6674 | perf.mark(endTag);
|
6675 | perf.measure(
|
6676 | `<${formatComponentName(instance, instance.type)}> ${type}`,
|
6677 | startTag,
|
6678 | endTag
|
6679 | );
|
6680 | perf.clearMarks(startTag);
|
6681 | perf.clearMarks(endTag);
|
6682 | }
|
6683 | {
|
6684 | devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
6685 | }
|
6686 | }
|
6687 | function isSupported() {
|
6688 | if (supported !== void 0) {
|
6689 | return supported;
|
6690 | }
|
6691 | if (typeof window !== "undefined" && window.performance) {
|
6692 | supported = true;
|
6693 | perf = window.performance;
|
6694 | } else {
|
6695 | supported = false;
|
6696 | }
|
6697 | return supported;
|
6698 | }
|
6699 |
|
6700 | const queuePostRenderEffect = queueEffectWithSuspense ;
|
6701 | function createRenderer(options) {
|
6702 | return baseCreateRenderer(options);
|
6703 | }
|
6704 | function createHydrationRenderer(options) {
|
6705 | return baseCreateRenderer(options, createHydrationFunctions);
|
6706 | }
|
6707 | function baseCreateRenderer(options, createHydrationFns) {
|
6708 | const target = getGlobalThis();
|
6709 | target.__VUE__ = true;
|
6710 | {
|
6711 | setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
6712 | }
|
6713 | const {
|
6714 | insert: hostInsert,
|
6715 | remove: hostRemove,
|
6716 | patchProp: hostPatchProp,
|
6717 | createElement: hostCreateElement,
|
6718 | createText: hostCreateText,
|
6719 | createComment: hostCreateComment,
|
6720 | setText: hostSetText,
|
6721 | setElementText: hostSetElementText,
|
6722 | parentNode: hostParentNode,
|
6723 | nextSibling: hostNextSibling,
|
6724 | setScopeId: hostSetScopeId = NOOP,
|
6725 | insertStaticContent: hostInsertStaticContent
|
6726 | } = options;
|
6727 | const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
6728 | if (n1 === n2) {
|
6729 | return;
|
6730 | }
|
6731 | if (n1 && !isSameVNodeType(n1, n2)) {
|
6732 | anchor = getNextHostNode(n1);
|
6733 | unmount(n1, parentComponent, parentSuspense, true);
|
6734 | n1 = null;
|
6735 | }
|
6736 | if (n2.patchFlag === -2) {
|
6737 | optimized = false;
|
6738 | n2.dynamicChildren = null;
|
6739 | }
|
6740 | const { type, ref, shapeFlag } = n2;
|
6741 | switch (type) {
|
6742 | case Text:
|
6743 | processText(n1, n2, container, anchor);
|
6744 | break;
|
6745 | case Comment:
|
6746 | processCommentNode(n1, n2, container, anchor);
|
6747 | break;
|
6748 | case Static:
|
6749 | if (n1 == null) {
|
6750 | mountStaticNode(n2, container, anchor, namespace);
|
6751 | } else {
|
6752 | patchStaticNode(n1, n2, container, namespace);
|
6753 | }
|
6754 | break;
|
6755 | case Fragment:
|
6756 | processFragment(
|
6757 | n1,
|
6758 | n2,
|
6759 | container,
|
6760 | anchor,
|
6761 | parentComponent,
|
6762 | parentSuspense,
|
6763 | namespace,
|
6764 | slotScopeIds,
|
6765 | optimized
|
6766 | );
|
6767 | break;
|
6768 | default:
|
6769 | if (shapeFlag & 1) {
|
6770 | processElement(
|
6771 | n1,
|
6772 | n2,
|
6773 | container,
|
6774 | anchor,
|
6775 | parentComponent,
|
6776 | parentSuspense,
|
6777 | namespace,
|
6778 | slotScopeIds,
|
6779 | optimized
|
6780 | );
|
6781 | } else if (shapeFlag & 6) {
|
6782 | processComponent(
|
6783 | n1,
|
6784 | n2,
|
6785 | container,
|
6786 | anchor,
|
6787 | parentComponent,
|
6788 | parentSuspense,
|
6789 | namespace,
|
6790 | slotScopeIds,
|
6791 | optimized
|
6792 | );
|
6793 | } else if (shapeFlag & 64) {
|
6794 | type.process(
|
6795 | n1,
|
6796 | n2,
|
6797 | container,
|
6798 | anchor,
|
6799 | parentComponent,
|
6800 | parentSuspense,
|
6801 | namespace,
|
6802 | slotScopeIds,
|
6803 | optimized,
|
6804 | internals
|
6805 | );
|
6806 | } else if (shapeFlag & 128) {
|
6807 | type.process(
|
6808 | n1,
|
6809 | n2,
|
6810 | container,
|
6811 | anchor,
|
6812 | parentComponent,
|
6813 | parentSuspense,
|
6814 | namespace,
|
6815 | slotScopeIds,
|
6816 | optimized,
|
6817 | internals
|
6818 | );
|
6819 | } else {
|
6820 | warn$1("Invalid VNode type:", type, `(${typeof type})`);
|
6821 | }
|
6822 | }
|
6823 | if (ref != null && parentComponent) {
|
6824 | setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
|
6825 | }
|
6826 | };
|
6827 | const processText = (n1, n2, container, anchor) => {
|
6828 | if (n1 == null) {
|
6829 | hostInsert(
|
6830 | n2.el = hostCreateText(n2.children),
|
6831 | container,
|
6832 | anchor
|
6833 | );
|
6834 | } else {
|
6835 | const el = n2.el = n1.el;
|
6836 | if (n2.children !== n1.children) {
|
6837 | hostSetText(el, n2.children);
|
6838 | }
|
6839 | }
|
6840 | };
|
6841 | const processCommentNode = (n1, n2, container, anchor) => {
|
6842 | if (n1 == null) {
|
6843 | hostInsert(
|
6844 | n2.el = hostCreateComment(n2.children || ""),
|
6845 | container,
|
6846 | anchor
|
6847 | );
|
6848 | } else {
|
6849 | n2.el = n1.el;
|
6850 | }
|
6851 | };
|
6852 | const mountStaticNode = (n2, container, anchor, namespace) => {
|
6853 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6854 | n2.children,
|
6855 | container,
|
6856 | anchor,
|
6857 | namespace,
|
6858 | n2.el,
|
6859 | n2.anchor
|
6860 | );
|
6861 | };
|
6862 | const patchStaticNode = (n1, n2, container, namespace) => {
|
6863 | if (n2.children !== n1.children) {
|
6864 | const anchor = hostNextSibling(n1.anchor);
|
6865 | removeStaticNode(n1);
|
6866 | [n2.el, n2.anchor] = hostInsertStaticContent(
|
6867 | n2.children,
|
6868 | container,
|
6869 | anchor,
|
6870 | namespace
|
6871 | );
|
6872 | } else {
|
6873 | n2.el = n1.el;
|
6874 | n2.anchor = n1.anchor;
|
6875 | }
|
6876 | };
|
6877 | const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
|
6878 | let next;
|
6879 | while (el && el !== anchor) {
|
6880 | next = hostNextSibling(el);
|
6881 | hostInsert(el, container, nextSibling);
|
6882 | el = next;
|
6883 | }
|
6884 | hostInsert(anchor, container, nextSibling);
|
6885 | };
|
6886 | const removeStaticNode = ({ el, anchor }) => {
|
6887 | let next;
|
6888 | while (el && el !== anchor) {
|
6889 | next = hostNextSibling(el);
|
6890 | hostRemove(el);
|
6891 | el = next;
|
6892 | }
|
6893 | hostRemove(anchor);
|
6894 | };
|
6895 | const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6896 | if (n2.type === "svg") {
|
6897 | namespace = "svg";
|
6898 | } else if (n2.type === "math") {
|
6899 | namespace = "mathml";
|
6900 | }
|
6901 | if (n1 == null) {
|
6902 | mountElement(
|
6903 | n2,
|
6904 | container,
|
6905 | anchor,
|
6906 | parentComponent,
|
6907 | parentSuspense,
|
6908 | namespace,
|
6909 | slotScopeIds,
|
6910 | optimized
|
6911 | );
|
6912 | } else {
|
6913 | patchElement(
|
6914 | n1,
|
6915 | n2,
|
6916 | parentComponent,
|
6917 | parentSuspense,
|
6918 | namespace,
|
6919 | slotScopeIds,
|
6920 | optimized
|
6921 | );
|
6922 | }
|
6923 | };
|
6924 | const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
6925 | let el;
|
6926 | let vnodeHook;
|
6927 | const { props, shapeFlag, transition, dirs } = vnode;
|
6928 | el = vnode.el = hostCreateElement(
|
6929 | vnode.type,
|
6930 | namespace,
|
6931 | props && props.is,
|
6932 | props
|
6933 | );
|
6934 | if (shapeFlag & 8) {
|
6935 | hostSetElementText(el, vnode.children);
|
6936 | } else if (shapeFlag & 16) {
|
6937 | mountChildren(
|
6938 | vnode.children,
|
6939 | el,
|
6940 | null,
|
6941 | parentComponent,
|
6942 | parentSuspense,
|
6943 | resolveChildrenNamespace(vnode, namespace),
|
6944 | slotScopeIds,
|
6945 | optimized
|
6946 | );
|
6947 | }
|
6948 | if (dirs) {
|
6949 | invokeDirectiveHook(vnode, null, parentComponent, "created");
|
6950 | }
|
6951 | setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
6952 | if (props) {
|
6953 | for (const key in props) {
|
6954 | if (key !== "value" && !isReservedProp(key)) {
|
6955 | hostPatchProp(el, key, null, props[key], namespace, parentComponent);
|
6956 | }
|
6957 | }
|
6958 | if ("value" in props) {
|
6959 | hostPatchProp(el, "value", null, props.value, namespace);
|
6960 | }
|
6961 | if (vnodeHook = props.onVnodeBeforeMount) {
|
6962 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6963 | }
|
6964 | }
|
6965 | {
|
6966 | def(el, "__vnode", vnode, true);
|
6967 | def(el, "__vueParentComponent", parentComponent, true);
|
6968 | }
|
6969 | if (dirs) {
|
6970 | invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
6971 | }
|
6972 | const needCallTransitionHooks = needTransition(parentSuspense, transition);
|
6973 | if (needCallTransitionHooks) {
|
6974 | transition.beforeEnter(el);
|
6975 | }
|
6976 | hostInsert(el, container, anchor);
|
6977 | if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
|
6978 | queuePostRenderEffect(() => {
|
6979 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
6980 | needCallTransitionHooks && transition.enter(el);
|
6981 | dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
6982 | }, parentSuspense);
|
6983 | }
|
6984 | };
|
6985 | const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
6986 | if (scopeId) {
|
6987 | hostSetScopeId(el, scopeId);
|
6988 | }
|
6989 | if (slotScopeIds) {
|
6990 | for (let i = 0; i < slotScopeIds.length; i++) {
|
6991 | hostSetScopeId(el, slotScopeIds[i]);
|
6992 | }
|
6993 | }
|
6994 | if (parentComponent) {
|
6995 | let subTree = parentComponent.subTree;
|
6996 | if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
|
6997 | subTree = filterSingleRoot(subTree.children) || subTree;
|
6998 | }
|
6999 | if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
7000 | const parentVNode = parentComponent.vnode;
|
7001 | setScopeId(
|
7002 | el,
|
7003 | parentVNode,
|
7004 | parentVNode.scopeId,
|
7005 | parentVNode.slotScopeIds,
|
7006 | parentComponent.parent
|
7007 | );
|
7008 | }
|
7009 | }
|
7010 | };
|
7011 | const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
7012 | for (let i = start; i < children.length; i++) {
|
7013 | const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
7014 | patch(
|
7015 | null,
|
7016 | child,
|
7017 | container,
|
7018 | anchor,
|
7019 | parentComponent,
|
7020 | parentSuspense,
|
7021 | namespace,
|
7022 | slotScopeIds,
|
7023 | optimized
|
7024 | );
|
7025 | }
|
7026 | };
|
7027 | const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7028 | const el = n2.el = n1.el;
|
7029 | {
|
7030 | el.__vnode = n2;
|
7031 | }
|
7032 | let { patchFlag, dynamicChildren, dirs } = n2;
|
7033 | patchFlag |= n1.patchFlag & 16;
|
7034 | const oldProps = n1.props || EMPTY_OBJ;
|
7035 | const newProps = n2.props || EMPTY_OBJ;
|
7036 | let vnodeHook;
|
7037 | parentComponent && toggleRecurse(parentComponent, false);
|
7038 | if (vnodeHook = newProps.onVnodeBeforeUpdate) {
|
7039 | invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7040 | }
|
7041 | if (dirs) {
|
7042 | invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
7043 | }
|
7044 | parentComponent && toggleRecurse(parentComponent, true);
|
7045 | if (isHmrUpdating) {
|
7046 | patchFlag = 0;
|
7047 | optimized = false;
|
7048 | dynamicChildren = null;
|
7049 | }
|
7050 | if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
|
7051 | hostSetElementText(el, "");
|
7052 | }
|
7053 | if (dynamicChildren) {
|
7054 | patchBlockChildren(
|
7055 | n1.dynamicChildren,
|
7056 | dynamicChildren,
|
7057 | el,
|
7058 | parentComponent,
|
7059 | parentSuspense,
|
7060 | resolveChildrenNamespace(n2, namespace),
|
7061 | slotScopeIds
|
7062 | );
|
7063 | {
|
7064 | traverseStaticChildren(n1, n2);
|
7065 | }
|
7066 | } else if (!optimized) {
|
7067 | patchChildren(
|
7068 | n1,
|
7069 | n2,
|
7070 | el,
|
7071 | null,
|
7072 | parentComponent,
|
7073 | parentSuspense,
|
7074 | resolveChildrenNamespace(n2, namespace),
|
7075 | slotScopeIds,
|
7076 | false
|
7077 | );
|
7078 | }
|
7079 | if (patchFlag > 0) {
|
7080 | if (patchFlag & 16) {
|
7081 | patchProps(el, oldProps, newProps, parentComponent, namespace);
|
7082 | } else {
|
7083 | if (patchFlag & 2) {
|
7084 | if (oldProps.class !== newProps.class) {
|
7085 | hostPatchProp(el, "class", null, newProps.class, namespace);
|
7086 | }
|
7087 | }
|
7088 | if (patchFlag & 4) {
|
7089 | hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
|
7090 | }
|
7091 | if (patchFlag & 8) {
|
7092 | const propsToUpdate = n2.dynamicProps;
|
7093 | for (let i = 0; i < propsToUpdate.length; i++) {
|
7094 | const key = propsToUpdate[i];
|
7095 | const prev = oldProps[key];
|
7096 | const next = newProps[key];
|
7097 | if (next !== prev || key === "value") {
|
7098 | hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
7099 | }
|
7100 | }
|
7101 | }
|
7102 | }
|
7103 | if (patchFlag & 1) {
|
7104 | if (n1.children !== n2.children) {
|
7105 | hostSetElementText(el, n2.children);
|
7106 | }
|
7107 | }
|
7108 | } else if (!optimized && dynamicChildren == null) {
|
7109 | patchProps(el, oldProps, newProps, parentComponent, namespace);
|
7110 | }
|
7111 | if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
7112 | queuePostRenderEffect(() => {
|
7113 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
7114 | dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
7115 | }, parentSuspense);
|
7116 | }
|
7117 | };
|
7118 | const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
|
7119 | for (let i = 0; i < newChildren.length; i++) {
|
7120 | const oldVNode = oldChildren[i];
|
7121 | const newVNode = newChildren[i];
|
7122 | const container = (
|
7123 |
|
7124 |
|
7125 | oldVNode.el &&
|
7126 |
|
7127 | (oldVNode.type === Fragment ||
|
7128 |
|
7129 | !isSameVNodeType(oldVNode, newVNode) ||
|
7130 | oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
|
7131 |
|
7132 |
|
7133 | fallbackContainer
|
7134 | )
|
7135 | );
|
7136 | patch(
|
7137 | oldVNode,
|
7138 | newVNode,
|
7139 | container,
|
7140 | null,
|
7141 | parentComponent,
|
7142 | parentSuspense,
|
7143 | namespace,
|
7144 | slotScopeIds,
|
7145 | true
|
7146 | );
|
7147 | }
|
7148 | };
|
7149 | const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
7150 | if (oldProps !== newProps) {
|
7151 | if (oldProps !== EMPTY_OBJ) {
|
7152 | for (const key in oldProps) {
|
7153 | if (!isReservedProp(key) && !(key in newProps)) {
|
7154 | hostPatchProp(
|
7155 | el,
|
7156 | key,
|
7157 | oldProps[key],
|
7158 | null,
|
7159 | namespace,
|
7160 | parentComponent
|
7161 | );
|
7162 | }
|
7163 | }
|
7164 | }
|
7165 | for (const key in newProps) {
|
7166 | if (isReservedProp(key)) continue;
|
7167 | const next = newProps[key];
|
7168 | const prev = oldProps[key];
|
7169 | if (next !== prev && key !== "value") {
|
7170 | hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
7171 | }
|
7172 | }
|
7173 | if ("value" in newProps) {
|
7174 | hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
|
7175 | }
|
7176 | }
|
7177 | };
|
7178 | const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7179 | const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
|
7180 | const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
|
7181 | let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
7182 | if (
|
7183 |
|
7184 | isHmrUpdating || patchFlag & 2048
|
7185 | ) {
|
7186 | patchFlag = 0;
|
7187 | optimized = false;
|
7188 | dynamicChildren = null;
|
7189 | }
|
7190 | if (fragmentSlotScopeIds) {
|
7191 | slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
7192 | }
|
7193 | if (n1 == null) {
|
7194 | hostInsert(fragmentStartAnchor, container, anchor);
|
7195 | hostInsert(fragmentEndAnchor, container, anchor);
|
7196 | mountChildren(
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 | n2.children || [],
|
7202 | container,
|
7203 | fragmentEndAnchor,
|
7204 | parentComponent,
|
7205 | parentSuspense,
|
7206 | namespace,
|
7207 | slotScopeIds,
|
7208 | optimized
|
7209 | );
|
7210 | } else {
|
7211 | if (patchFlag > 0 && patchFlag & 64 && dynamicChildren &&
|
7212 |
|
7213 | n1.dynamicChildren) {
|
7214 | patchBlockChildren(
|
7215 | n1.dynamicChildren,
|
7216 | dynamicChildren,
|
7217 | container,
|
7218 | parentComponent,
|
7219 | parentSuspense,
|
7220 | namespace,
|
7221 | slotScopeIds
|
7222 | );
|
7223 | {
|
7224 | traverseStaticChildren(n1, n2);
|
7225 | }
|
7226 | } else {
|
7227 | patchChildren(
|
7228 | n1,
|
7229 | n2,
|
7230 | container,
|
7231 | fragmentEndAnchor,
|
7232 | parentComponent,
|
7233 | parentSuspense,
|
7234 | namespace,
|
7235 | slotScopeIds,
|
7236 | optimized
|
7237 | );
|
7238 | }
|
7239 | }
|
7240 | };
|
7241 | const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7242 | n2.slotScopeIds = slotScopeIds;
|
7243 | if (n1 == null) {
|
7244 | if (n2.shapeFlag & 512) {
|
7245 | parentComponent.ctx.activate(
|
7246 | n2,
|
7247 | container,
|
7248 | anchor,
|
7249 | namespace,
|
7250 | optimized
|
7251 | );
|
7252 | } else {
|
7253 | mountComponent(
|
7254 | n2,
|
7255 | container,
|
7256 | anchor,
|
7257 | parentComponent,
|
7258 | parentSuspense,
|
7259 | namespace,
|
7260 | optimized
|
7261 | );
|
7262 | }
|
7263 | } else {
|
7264 | updateComponent(n1, n2, optimized);
|
7265 | }
|
7266 | };
|
7267 | const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
7268 | const instance = (initialVNode.component = createComponentInstance(
|
7269 | initialVNode,
|
7270 | parentComponent,
|
7271 | parentSuspense
|
7272 | ));
|
7273 | if (instance.type.__hmrId) {
|
7274 | registerHMR(instance);
|
7275 | }
|
7276 | {
|
7277 | pushWarningContext(initialVNode);
|
7278 | startMeasure(instance, `mount`);
|
7279 | }
|
7280 | if (isKeepAlive(initialVNode)) {
|
7281 | instance.ctx.renderer = internals;
|
7282 | }
|
7283 | {
|
7284 | {
|
7285 | startMeasure(instance, `init`);
|
7286 | }
|
7287 | setupComponent(instance, false, optimized);
|
7288 | {
|
7289 | endMeasure(instance, `init`);
|
7290 | }
|
7291 | }
|
7292 | if (instance.asyncDep) {
|
7293 | if (isHmrUpdating) initialVNode.el = null;
|
7294 | parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
|
7295 | if (!initialVNode.el) {
|
7296 | const placeholder = instance.subTree = createVNode(Comment);
|
7297 | processCommentNode(null, placeholder, container, anchor);
|
7298 | }
|
7299 | } else {
|
7300 | setupRenderEffect(
|
7301 | instance,
|
7302 | initialVNode,
|
7303 | container,
|
7304 | anchor,
|
7305 | parentSuspense,
|
7306 | namespace,
|
7307 | optimized
|
7308 | );
|
7309 | }
|
7310 | {
|
7311 | popWarningContext();
|
7312 | endMeasure(instance, `mount`);
|
7313 | }
|
7314 | };
|
7315 | const updateComponent = (n1, n2, optimized) => {
|
7316 | const instance = n2.component = n1.component;
|
7317 | if (shouldUpdateComponent(n1, n2, optimized)) {
|
7318 | if (instance.asyncDep && !instance.asyncResolved) {
|
7319 | {
|
7320 | pushWarningContext(n2);
|
7321 | }
|
7322 | updateComponentPreRender(instance, n2, optimized);
|
7323 | {
|
7324 | popWarningContext();
|
7325 | }
|
7326 | return;
|
7327 | } else {
|
7328 | instance.next = n2;
|
7329 | instance.update();
|
7330 | }
|
7331 | } else {
|
7332 | n2.el = n1.el;
|
7333 | instance.vnode = n2;
|
7334 | }
|
7335 | };
|
7336 | const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
|
7337 | const componentUpdateFn = () => {
|
7338 | if (!instance.isMounted) {
|
7339 | let vnodeHook;
|
7340 | const { el, props } = initialVNode;
|
7341 | const { bm, m, parent, root, type } = instance;
|
7342 | const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
7343 | toggleRecurse(instance, false);
|
7344 | if (bm) {
|
7345 | invokeArrayFns(bm);
|
7346 | }
|
7347 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
|
7348 | invokeVNodeHook(vnodeHook, parent, initialVNode);
|
7349 | }
|
7350 | toggleRecurse(instance, true);
|
7351 | if (el && hydrateNode) {
|
7352 | const hydrateSubTree = () => {
|
7353 | {
|
7354 | startMeasure(instance, `render`);
|
7355 | }
|
7356 | instance.subTree = renderComponentRoot(instance);
|
7357 | {
|
7358 | endMeasure(instance, `render`);
|
7359 | }
|
7360 | {
|
7361 | startMeasure(instance, `hydrate`);
|
7362 | }
|
7363 | hydrateNode(
|
7364 | el,
|
7365 | instance.subTree,
|
7366 | instance,
|
7367 | parentSuspense,
|
7368 | null
|
7369 | );
|
7370 | {
|
7371 | endMeasure(instance, `hydrate`);
|
7372 | }
|
7373 | };
|
7374 | if (isAsyncWrapperVNode && type.__asyncHydrate) {
|
7375 | type.__asyncHydrate(
|
7376 | el,
|
7377 | instance,
|
7378 | hydrateSubTree
|
7379 | );
|
7380 | } else {
|
7381 | hydrateSubTree();
|
7382 | }
|
7383 | } else {
|
7384 | if (root.ce) {
|
7385 | root.ce._injectChildStyle(type);
|
7386 | }
|
7387 | {
|
7388 | startMeasure(instance, `render`);
|
7389 | }
|
7390 | const subTree = instance.subTree = renderComponentRoot(instance);
|
7391 | {
|
7392 | endMeasure(instance, `render`);
|
7393 | }
|
7394 | {
|
7395 | startMeasure(instance, `patch`);
|
7396 | }
|
7397 | patch(
|
7398 | null,
|
7399 | subTree,
|
7400 | container,
|
7401 | anchor,
|
7402 | instance,
|
7403 | parentSuspense,
|
7404 | namespace
|
7405 | );
|
7406 | {
|
7407 | endMeasure(instance, `patch`);
|
7408 | }
|
7409 | initialVNode.el = subTree.el;
|
7410 | }
|
7411 | if (m) {
|
7412 | queuePostRenderEffect(m, parentSuspense);
|
7413 | }
|
7414 | if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
|
7415 | const scopedInitialVNode = initialVNode;
|
7416 | queuePostRenderEffect(
|
7417 | () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
|
7418 | parentSuspense
|
7419 | );
|
7420 | }
|
7421 | if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
|
7422 | instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
7423 | }
|
7424 | instance.isMounted = true;
|
7425 | {
|
7426 | devtoolsComponentAdded(instance);
|
7427 | }
|
7428 | initialVNode = container = anchor = null;
|
7429 | } else {
|
7430 | let { next, bu, u, parent, vnode } = instance;
|
7431 | {
|
7432 | const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
|
7433 | if (nonHydratedAsyncRoot) {
|
7434 | if (next) {
|
7435 | next.el = vnode.el;
|
7436 | updateComponentPreRender(instance, next, optimized);
|
7437 | }
|
7438 | nonHydratedAsyncRoot.asyncDep.then(() => {
|
7439 | if (!instance.isUnmounted) {
|
7440 | componentUpdateFn();
|
7441 | }
|
7442 | });
|
7443 | return;
|
7444 | }
|
7445 | }
|
7446 | let originNext = next;
|
7447 | let vnodeHook;
|
7448 | {
|
7449 | pushWarningContext(next || instance.vnode);
|
7450 | }
|
7451 | toggleRecurse(instance, false);
|
7452 | if (next) {
|
7453 | next.el = vnode.el;
|
7454 | updateComponentPreRender(instance, next, optimized);
|
7455 | } else {
|
7456 | next = vnode;
|
7457 | }
|
7458 | if (bu) {
|
7459 | invokeArrayFns(bu);
|
7460 | }
|
7461 | if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
|
7462 | invokeVNodeHook(vnodeHook, parent, next, vnode);
|
7463 | }
|
7464 | toggleRecurse(instance, true);
|
7465 | {
|
7466 | startMeasure(instance, `render`);
|
7467 | }
|
7468 | const nextTree = renderComponentRoot(instance);
|
7469 | {
|
7470 | endMeasure(instance, `render`);
|
7471 | }
|
7472 | const prevTree = instance.subTree;
|
7473 | instance.subTree = nextTree;
|
7474 | {
|
7475 | startMeasure(instance, `patch`);
|
7476 | }
|
7477 | patch(
|
7478 | prevTree,
|
7479 | nextTree,
|
7480 |
|
7481 | hostParentNode(prevTree.el),
|
7482 |
|
7483 | getNextHostNode(prevTree),
|
7484 | instance,
|
7485 | parentSuspense,
|
7486 | namespace
|
7487 | );
|
7488 | {
|
7489 | endMeasure(instance, `patch`);
|
7490 | }
|
7491 | next.el = nextTree.el;
|
7492 | if (originNext === null) {
|
7493 | updateHOCHostEl(instance, nextTree.el);
|
7494 | }
|
7495 | if (u) {
|
7496 | queuePostRenderEffect(u, parentSuspense);
|
7497 | }
|
7498 | if (vnodeHook = next.props && next.props.onVnodeUpdated) {
|
7499 | queuePostRenderEffect(
|
7500 | () => invokeVNodeHook(vnodeHook, parent, next, vnode),
|
7501 | parentSuspense
|
7502 | );
|
7503 | }
|
7504 | {
|
7505 | devtoolsComponentUpdated(instance);
|
7506 | }
|
7507 | {
|
7508 | popWarningContext();
|
7509 | }
|
7510 | }
|
7511 | };
|
7512 | instance.scope.on();
|
7513 | const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
7514 | instance.scope.off();
|
7515 | const update = instance.update = effect.run.bind(effect);
|
7516 | const job = instance.job = effect.runIfDirty.bind(effect);
|
7517 | job.i = instance;
|
7518 | job.id = instance.uid;
|
7519 | effect.scheduler = () => queueJob(job);
|
7520 | toggleRecurse(instance, true);
|
7521 | {
|
7522 | effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
7523 | effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
7524 | }
|
7525 | update();
|
7526 | };
|
7527 | const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
7528 | nextVNode.component = instance;
|
7529 | const prevProps = instance.vnode.props;
|
7530 | instance.vnode = nextVNode;
|
7531 | instance.next = null;
|
7532 | updateProps(instance, nextVNode.props, prevProps, optimized);
|
7533 | updateSlots(instance, nextVNode.children, optimized);
|
7534 | pauseTracking();
|
7535 | flushPreFlushCbs(instance);
|
7536 | resetTracking();
|
7537 | };
|
7538 | const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
|
7539 | const c1 = n1 && n1.children;
|
7540 | const prevShapeFlag = n1 ? n1.shapeFlag : 0;
|
7541 | const c2 = n2.children;
|
7542 | const { patchFlag, shapeFlag } = n2;
|
7543 | if (patchFlag > 0) {
|
7544 | if (patchFlag & 128) {
|
7545 | patchKeyedChildren(
|
7546 | c1,
|
7547 | c2,
|
7548 | container,
|
7549 | anchor,
|
7550 | parentComponent,
|
7551 | parentSuspense,
|
7552 | namespace,
|
7553 | slotScopeIds,
|
7554 | optimized
|
7555 | );
|
7556 | return;
|
7557 | } else if (patchFlag & 256) {
|
7558 | patchUnkeyedChildren(
|
7559 | c1,
|
7560 | c2,
|
7561 | container,
|
7562 | anchor,
|
7563 | parentComponent,
|
7564 | parentSuspense,
|
7565 | namespace,
|
7566 | slotScopeIds,
|
7567 | optimized
|
7568 | );
|
7569 | return;
|
7570 | }
|
7571 | }
|
7572 | if (shapeFlag & 8) {
|
7573 | if (prevShapeFlag & 16) {
|
7574 | unmountChildren(c1, parentComponent, parentSuspense);
|
7575 | }
|
7576 | if (c2 !== c1) {
|
7577 | hostSetElementText(container, c2);
|
7578 | }
|
7579 | } else {
|
7580 | if (prevShapeFlag & 16) {
|
7581 | if (shapeFlag & 16) {
|
7582 | patchKeyedChildren(
|
7583 | c1,
|
7584 | c2,
|
7585 | container,
|
7586 | anchor,
|
7587 | parentComponent,
|
7588 | parentSuspense,
|
7589 | namespace,
|
7590 | slotScopeIds,
|
7591 | optimized
|
7592 | );
|
7593 | } else {
|
7594 | unmountChildren(c1, parentComponent, parentSuspense, true);
|
7595 | }
|
7596 | } else {
|
7597 | if (prevShapeFlag & 8) {
|
7598 | hostSetElementText(container, "");
|
7599 | }
|
7600 | if (shapeFlag & 16) {
|
7601 | mountChildren(
|
7602 | c2,
|
7603 | container,
|
7604 | anchor,
|
7605 | parentComponent,
|
7606 | parentSuspense,
|
7607 | namespace,
|
7608 | slotScopeIds,
|
7609 | optimized
|
7610 | );
|
7611 | }
|
7612 | }
|
7613 | }
|
7614 | };
|
7615 | const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7616 | c1 = c1 || EMPTY_ARR;
|
7617 | c2 = c2 || EMPTY_ARR;
|
7618 | const oldLength = c1.length;
|
7619 | const newLength = c2.length;
|
7620 | const commonLength = Math.min(oldLength, newLength);
|
7621 | let i;
|
7622 | for (i = 0; i < commonLength; i++) {
|
7623 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7624 | patch(
|
7625 | c1[i],
|
7626 | nextChild,
|
7627 | container,
|
7628 | null,
|
7629 | parentComponent,
|
7630 | parentSuspense,
|
7631 | namespace,
|
7632 | slotScopeIds,
|
7633 | optimized
|
7634 | );
|
7635 | }
|
7636 | if (oldLength > newLength) {
|
7637 | unmountChildren(
|
7638 | c1,
|
7639 | parentComponent,
|
7640 | parentSuspense,
|
7641 | true,
|
7642 | false,
|
7643 | commonLength
|
7644 | );
|
7645 | } else {
|
7646 | mountChildren(
|
7647 | c2,
|
7648 | container,
|
7649 | anchor,
|
7650 | parentComponent,
|
7651 | parentSuspense,
|
7652 | namespace,
|
7653 | slotScopeIds,
|
7654 | optimized,
|
7655 | commonLength
|
7656 | );
|
7657 | }
|
7658 | };
|
7659 | const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
7660 | let i = 0;
|
7661 | const l2 = c2.length;
|
7662 | let e1 = c1.length - 1;
|
7663 | let e2 = l2 - 1;
|
7664 | while (i <= e1 && i <= e2) {
|
7665 | const n1 = c1[i];
|
7666 | const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7667 | if (isSameVNodeType(n1, n2)) {
|
7668 | patch(
|
7669 | n1,
|
7670 | n2,
|
7671 | container,
|
7672 | null,
|
7673 | parentComponent,
|
7674 | parentSuspense,
|
7675 | namespace,
|
7676 | slotScopeIds,
|
7677 | optimized
|
7678 | );
|
7679 | } else {
|
7680 | break;
|
7681 | }
|
7682 | i++;
|
7683 | }
|
7684 | while (i <= e1 && i <= e2) {
|
7685 | const n1 = c1[e1];
|
7686 | const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
|
7687 | if (isSameVNodeType(n1, n2)) {
|
7688 | patch(
|
7689 | n1,
|
7690 | n2,
|
7691 | container,
|
7692 | null,
|
7693 | parentComponent,
|
7694 | parentSuspense,
|
7695 | namespace,
|
7696 | slotScopeIds,
|
7697 | optimized
|
7698 | );
|
7699 | } else {
|
7700 | break;
|
7701 | }
|
7702 | e1--;
|
7703 | e2--;
|
7704 | }
|
7705 | if (i > e1) {
|
7706 | if (i <= e2) {
|
7707 | const nextPos = e2 + 1;
|
7708 | const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
|
7709 | while (i <= e2) {
|
7710 | patch(
|
7711 | null,
|
7712 | c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
|
7713 | container,
|
7714 | anchor,
|
7715 | parentComponent,
|
7716 | parentSuspense,
|
7717 | namespace,
|
7718 | slotScopeIds,
|
7719 | optimized
|
7720 | );
|
7721 | i++;
|
7722 | }
|
7723 | }
|
7724 | } else if (i > e2) {
|
7725 | while (i <= e1) {
|
7726 | unmount(c1[i], parentComponent, parentSuspense, true);
|
7727 | i++;
|
7728 | }
|
7729 | } else {
|
7730 | const s1 = i;
|
7731 | const s2 = i;
|
7732 | const keyToNewIndexMap = new Map();
|
7733 | for (i = s2; i <= e2; i++) {
|
7734 | const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
|
7735 | if (nextChild.key != null) {
|
7736 | if (keyToNewIndexMap.has(nextChild.key)) {
|
7737 | warn$1(
|
7738 | `Duplicate keys found during update:`,
|
7739 | JSON.stringify(nextChild.key),
|
7740 | `Make sure keys are unique.`
|
7741 | );
|
7742 | }
|
7743 | keyToNewIndexMap.set(nextChild.key, i);
|
7744 | }
|
7745 | }
|
7746 | let j;
|
7747 | let patched = 0;
|
7748 | const toBePatched = e2 - s2 + 1;
|
7749 | let moved = false;
|
7750 | let maxNewIndexSoFar = 0;
|
7751 | const newIndexToOldIndexMap = new Array(toBePatched);
|
7752 | for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
|
7753 | for (i = s1; i <= e1; i++) {
|
7754 | const prevChild = c1[i];
|
7755 | if (patched >= toBePatched) {
|
7756 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7757 | continue;
|
7758 | }
|
7759 | let newIndex;
|
7760 | if (prevChild.key != null) {
|
7761 | newIndex = keyToNewIndexMap.get(prevChild.key);
|
7762 | } else {
|
7763 | for (j = s2; j <= e2; j++) {
|
7764 | if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
|
7765 | newIndex = j;
|
7766 | break;
|
7767 | }
|
7768 | }
|
7769 | }
|
7770 | if (newIndex === void 0) {
|
7771 | unmount(prevChild, parentComponent, parentSuspense, true);
|
7772 | } else {
|
7773 | newIndexToOldIndexMap[newIndex - s2] = i + 1;
|
7774 | if (newIndex >= maxNewIndexSoFar) {
|
7775 | maxNewIndexSoFar = newIndex;
|
7776 | } else {
|
7777 | moved = true;
|
7778 | }
|
7779 | patch(
|
7780 | prevChild,
|
7781 | c2[newIndex],
|
7782 | container,
|
7783 | null,
|
7784 | parentComponent,
|
7785 | parentSuspense,
|
7786 | namespace,
|
7787 | slotScopeIds,
|
7788 | optimized
|
7789 | );
|
7790 | patched++;
|
7791 | }
|
7792 | }
|
7793 | const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
|
7794 | j = increasingNewIndexSequence.length - 1;
|
7795 | for (i = toBePatched - 1; i >= 0; i--) {
|
7796 | const nextIndex = s2 + i;
|
7797 | const nextChild = c2[nextIndex];
|
7798 | const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
|
7799 | if (newIndexToOldIndexMap[i] === 0) {
|
7800 | patch(
|
7801 | null,
|
7802 | nextChild,
|
7803 | container,
|
7804 | anchor,
|
7805 | parentComponent,
|
7806 | parentSuspense,
|
7807 | namespace,
|
7808 | slotScopeIds,
|
7809 | optimized
|
7810 | );
|
7811 | } else if (moved) {
|
7812 | if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
7813 | move(nextChild, container, anchor, 2);
|
7814 | } else {
|
7815 | j--;
|
7816 | }
|
7817 | }
|
7818 | }
|
7819 | }
|
7820 | };
|
7821 | const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
7822 | const { el, type, transition, children, shapeFlag } = vnode;
|
7823 | if (shapeFlag & 6) {
|
7824 | move(vnode.component.subTree, container, anchor, moveType);
|
7825 | return;
|
7826 | }
|
7827 | if (shapeFlag & 128) {
|
7828 | vnode.suspense.move(container, anchor, moveType);
|
7829 | return;
|
7830 | }
|
7831 | if (shapeFlag & 64) {
|
7832 | type.move(vnode, container, anchor, internals);
|
7833 | return;
|
7834 | }
|
7835 | if (type === Fragment) {
|
7836 | hostInsert(el, container, anchor);
|
7837 | for (let i = 0; i < children.length; i++) {
|
7838 | move(children[i], container, anchor, moveType);
|
7839 | }
|
7840 | hostInsert(vnode.anchor, container, anchor);
|
7841 | return;
|
7842 | }
|
7843 | if (type === Static) {
|
7844 | moveStaticNode(vnode, container, anchor);
|
7845 | return;
|
7846 | }
|
7847 | const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
|
7848 | if (needTransition2) {
|
7849 | if (moveType === 0) {
|
7850 | transition.beforeEnter(el);
|
7851 | hostInsert(el, container, anchor);
|
7852 | queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
7853 | } else {
|
7854 | const { leave, delayLeave, afterLeave } = transition;
|
7855 | const remove2 = () => hostInsert(el, container, anchor);
|
7856 | const performLeave = () => {
|
7857 | leave(el, () => {
|
7858 | remove2();
|
7859 | afterLeave && afterLeave();
|
7860 | });
|
7861 | };
|
7862 | if (delayLeave) {
|
7863 | delayLeave(el, remove2, performLeave);
|
7864 | } else {
|
7865 | performLeave();
|
7866 | }
|
7867 | }
|
7868 | } else {
|
7869 | hostInsert(el, container, anchor);
|
7870 | }
|
7871 | };
|
7872 | const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
7873 | const {
|
7874 | type,
|
7875 | props,
|
7876 | ref,
|
7877 | children,
|
7878 | dynamicChildren,
|
7879 | shapeFlag,
|
7880 | patchFlag,
|
7881 | dirs,
|
7882 | cacheIndex
|
7883 | } = vnode;
|
7884 | if (patchFlag === -2) {
|
7885 | optimized = false;
|
7886 | }
|
7887 | if (ref != null) {
|
7888 | setRef(ref, null, parentSuspense, vnode, true);
|
7889 | }
|
7890 | if (cacheIndex != null) {
|
7891 | parentComponent.renderCache[cacheIndex] = void 0;
|
7892 | }
|
7893 | if (shapeFlag & 256) {
|
7894 | parentComponent.ctx.deactivate(vnode);
|
7895 | return;
|
7896 | }
|
7897 | const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
7898 | const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
7899 | let vnodeHook;
|
7900 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
7901 | invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7902 | }
|
7903 | if (shapeFlag & 6) {
|
7904 | unmountComponent(vnode.component, parentSuspense, doRemove);
|
7905 | } else {
|
7906 | if (shapeFlag & 128) {
|
7907 | vnode.suspense.unmount(parentSuspense, doRemove);
|
7908 | return;
|
7909 | }
|
7910 | if (shouldInvokeDirs) {
|
7911 | invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
7912 | }
|
7913 | if (shapeFlag & 64) {
|
7914 | vnode.type.remove(
|
7915 | vnode,
|
7916 | parentComponent,
|
7917 | parentSuspense,
|
7918 | internals,
|
7919 | doRemove
|
7920 | );
|
7921 | } else if (dynamicChildren &&
|
7922 |
|
7923 |
|
7924 |
|
7925 |
|
7926 | !dynamicChildren.hasOnce &&
|
7927 | (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
7928 | unmountChildren(
|
7929 | dynamicChildren,
|
7930 | parentComponent,
|
7931 | parentSuspense,
|
7932 | false,
|
7933 | true
|
7934 | );
|
7935 | } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
|
7936 | unmountChildren(children, parentComponent, parentSuspense);
|
7937 | }
|
7938 | if (doRemove) {
|
7939 | remove(vnode);
|
7940 | }
|
7941 | }
|
7942 | if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
|
7943 | queuePostRenderEffect(() => {
|
7944 | vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
7945 | shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
7946 | }, parentSuspense);
|
7947 | }
|
7948 | };
|
7949 | const remove = (vnode) => {
|
7950 | const { type, el, anchor, transition } = vnode;
|
7951 | if (type === Fragment) {
|
7952 | if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
|
7953 | vnode.children.forEach((child) => {
|
7954 | if (child.type === Comment) {
|
7955 | hostRemove(child.el);
|
7956 | } else {
|
7957 | remove(child);
|
7958 | }
|
7959 | });
|
7960 | } else {
|
7961 | removeFragment(el, anchor);
|
7962 | }
|
7963 | return;
|
7964 | }
|
7965 | if (type === Static) {
|
7966 | removeStaticNode(vnode);
|
7967 | return;
|
7968 | }
|
7969 | const performRemove = () => {
|
7970 | hostRemove(el);
|
7971 | if (transition && !transition.persisted && transition.afterLeave) {
|
7972 | transition.afterLeave();
|
7973 | }
|
7974 | };
|
7975 | if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
|
7976 | const { leave, delayLeave } = transition;
|
7977 | const performLeave = () => leave(el, performRemove);
|
7978 | if (delayLeave) {
|
7979 | delayLeave(vnode.el, performRemove, performLeave);
|
7980 | } else {
|
7981 | performLeave();
|
7982 | }
|
7983 | } else {
|
7984 | performRemove();
|
7985 | }
|
7986 | };
|
7987 | const removeFragment = (cur, end) => {
|
7988 | let next;
|
7989 | while (cur !== end) {
|
7990 | next = hostNextSibling(cur);
|
7991 | hostRemove(cur);
|
7992 | cur = next;
|
7993 | }
|
7994 | hostRemove(end);
|
7995 | };
|
7996 | const unmountComponent = (instance, parentSuspense, doRemove) => {
|
7997 | if (instance.type.__hmrId) {
|
7998 | unregisterHMR(instance);
|
7999 | }
|
8000 | const { bum, scope, job, subTree, um, m, a } = instance;
|
8001 | invalidateMount(m);
|
8002 | invalidateMount(a);
|
8003 | if (bum) {
|
8004 | invokeArrayFns(bum);
|
8005 | }
|
8006 | scope.stop();
|
8007 | if (job) {
|
8008 | job.flags |= 8;
|
8009 | unmount(subTree, instance, parentSuspense, doRemove);
|
8010 | }
|
8011 | if (um) {
|
8012 | queuePostRenderEffect(um, parentSuspense);
|
8013 | }
|
8014 | queuePostRenderEffect(() => {
|
8015 | instance.isUnmounted = true;
|
8016 | }, parentSuspense);
|
8017 | if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
|
8018 | parentSuspense.deps--;
|
8019 | if (parentSuspense.deps === 0) {
|
8020 | parentSuspense.resolve();
|
8021 | }
|
8022 | }
|
8023 | {
|
8024 | devtoolsComponentRemoved(instance);
|
8025 | }
|
8026 | };
|
8027 | const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
|
8028 | for (let i = start; i < children.length; i++) {
|
8029 | unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
|
8030 | }
|
8031 | };
|
8032 | const getNextHostNode = (vnode) => {
|
8033 | if (vnode.shapeFlag & 6) {
|
8034 | return getNextHostNode(vnode.component.subTree);
|
8035 | }
|
8036 | if (vnode.shapeFlag & 128) {
|
8037 | return vnode.suspense.next();
|
8038 | }
|
8039 | const el = hostNextSibling(vnode.anchor || vnode.el);
|
8040 | const teleportEnd = el && el[TeleportEndKey];
|
8041 | return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
8042 | };
|
8043 | let isFlushing = false;
|
8044 | const render = (vnode, container, namespace) => {
|
8045 | if (vnode == null) {
|
8046 | if (container._vnode) {
|
8047 | unmount(container._vnode, null, null, true);
|
8048 | }
|
8049 | } else {
|
8050 | patch(
|
8051 | container._vnode || null,
|
8052 | vnode,
|
8053 | container,
|
8054 | null,
|
8055 | null,
|
8056 | null,
|
8057 | namespace
|
8058 | );
|
8059 | }
|
8060 | container._vnode = vnode;
|
8061 | if (!isFlushing) {
|
8062 | isFlushing = true;
|
8063 | flushPreFlushCbs();
|
8064 | flushPostFlushCbs();
|
8065 | isFlushing = false;
|
8066 | }
|
8067 | };
|
8068 | const internals = {
|
8069 | p: patch,
|
8070 | um: unmount,
|
8071 | m: move,
|
8072 | r: remove,
|
8073 | mt: mountComponent,
|
8074 | mc: mountChildren,
|
8075 | pc: patchChildren,
|
8076 | pbc: patchBlockChildren,
|
8077 | n: getNextHostNode,
|
8078 | o: options
|
8079 | };
|
8080 | let hydrate;
|
8081 | let hydrateNode;
|
8082 | if (createHydrationFns) {
|
8083 | [hydrate, hydrateNode] = createHydrationFns(
|
8084 | internals
|
8085 | );
|
8086 | }
|
8087 | return {
|
8088 | render,
|
8089 | hydrate,
|
8090 | createApp: createAppAPI(render, hydrate)
|
8091 | };
|
8092 | }
|
8093 | function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
8094 | return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
8095 | }
|
8096 | function toggleRecurse({ effect, job }, allowed) {
|
8097 | if (allowed) {
|
8098 | effect.flags |= 32;
|
8099 | job.flags |= 4;
|
8100 | } else {
|
8101 | effect.flags &= ~32;
|
8102 | job.flags &= ~4;
|
8103 | }
|
8104 | }
|
8105 | function needTransition(parentSuspense, transition) {
|
8106 | return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
8107 | }
|
8108 | function traverseStaticChildren(n1, n2, shallow = false) {
|
8109 | const ch1 = n1.children;
|
8110 | const ch2 = n2.children;
|
8111 | if (isArray(ch1) && isArray(ch2)) {
|
8112 | for (let i = 0; i < ch1.length; i++) {
|
8113 | const c1 = ch1[i];
|
8114 | let c2 = ch2[i];
|
8115 | if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
|
8116 | if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
|
8117 | c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
8118 | c2.el = c1.el;
|
8119 | }
|
8120 | if (!shallow && c2.patchFlag !== -2)
|
8121 | traverseStaticChildren(c1, c2);
|
8122 | }
|
8123 | if (c2.type === Text) {
|
8124 | c2.el = c1.el;
|
8125 | }
|
8126 | if (c2.type === Comment && !c2.el) {
|
8127 | c2.el = c1.el;
|
8128 | }
|
8129 | }
|
8130 | }
|
8131 | }
|
8132 | function getSequence(arr) {
|
8133 | const p = arr.slice();
|
8134 | const result = [0];
|
8135 | let i, j, u, v, c;
|
8136 | const len = arr.length;
|
8137 | for (i = 0; i < len; i++) {
|
8138 | const arrI = arr[i];
|
8139 | if (arrI !== 0) {
|
8140 | j = result[result.length - 1];
|
8141 | if (arr[j] < arrI) {
|
8142 | p[i] = j;
|
8143 | result.push(i);
|
8144 | continue;
|
8145 | }
|
8146 | u = 0;
|
8147 | v = result.length - 1;
|
8148 | while (u < v) {
|
8149 | c = u + v >> 1;
|
8150 | if (arr[result[c]] < arrI) {
|
8151 | u = c + 1;
|
8152 | } else {
|
8153 | v = c;
|
8154 | }
|
8155 | }
|
8156 | if (arrI < arr[result[u]]) {
|
8157 | if (u > 0) {
|
8158 | p[i] = result[u - 1];
|
8159 | }
|
8160 | result[u] = i;
|
8161 | }
|
8162 | }
|
8163 | }
|
8164 | u = result.length;
|
8165 | v = result[u - 1];
|
8166 | while (u-- > 0) {
|
8167 | result[u] = v;
|
8168 | v = p[v];
|
8169 | }
|
8170 | return result;
|
8171 | }
|
8172 | function locateNonHydratedAsyncRoot(instance) {
|
8173 | const subComponent = instance.subTree.component;
|
8174 | if (subComponent) {
|
8175 | if (subComponent.asyncDep && !subComponent.asyncResolved) {
|
8176 | return subComponent;
|
8177 | } else {
|
8178 | return locateNonHydratedAsyncRoot(subComponent);
|
8179 | }
|
8180 | }
|
8181 | }
|
8182 | function invalidateMount(hooks) {
|
8183 | if (hooks) {
|
8184 | for (let i = 0; i < hooks.length; i++)
|
8185 | hooks[i].flags |= 8;
|
8186 | }
|
8187 | }
|
8188 |
|
8189 | const ssrContextKey = Symbol.for("v-scx");
|
8190 | const useSSRContext = () => {
|
8191 | {
|
8192 | warn$1(`useSSRContext() is not supported in the global build.`);
|
8193 | }
|
8194 | };
|
8195 |
|
8196 | function watchEffect(effect, options) {
|
8197 | return doWatch(effect, null, options);
|
8198 | }
|
8199 | function watchPostEffect(effect, options) {
|
8200 | return doWatch(
|
8201 | effect,
|
8202 | null,
|
8203 | extend({}, options, { flush: "post" })
|
8204 | );
|
8205 | }
|
8206 | function watchSyncEffect(effect, options) {
|
8207 | return doWatch(
|
8208 | effect,
|
8209 | null,
|
8210 | extend({}, options, { flush: "sync" })
|
8211 | );
|
8212 | }
|
8213 | function watch(source, cb, options) {
|
8214 | if (!isFunction(cb)) {
|
8215 | warn$1(
|
8216 | `\`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.`
|
8217 | );
|
8218 | }
|
8219 | return doWatch(source, cb, options);
|
8220 | }
|
8221 | function doWatch(source, cb, options = EMPTY_OBJ) {
|
8222 | const { immediate, deep, flush, once } = options;
|
8223 | if (!cb) {
|
8224 | if (immediate !== void 0) {
|
8225 | warn$1(
|
8226 | `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
|
8227 | );
|
8228 | }
|
8229 | if (deep !== void 0) {
|
8230 | warn$1(
|
8231 | `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
8232 | );
|
8233 | }
|
8234 | if (once !== void 0) {
|
8235 | warn$1(
|
8236 | `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
8237 | );
|
8238 | }
|
8239 | }
|
8240 | const baseWatchOptions = extend({}, options);
|
8241 | baseWatchOptions.onWarn = warn$1;
|
8242 | const instance = currentInstance;
|
8243 | baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
8244 | let isPre = false;
|
8245 | if (flush === "post") {
|
8246 | baseWatchOptions.scheduler = (job) => {
|
8247 | queuePostRenderEffect(job, instance && instance.suspense);
|
8248 | };
|
8249 | } else if (flush !== "sync") {
|
8250 | isPre = true;
|
8251 | baseWatchOptions.scheduler = (job, isFirstRun) => {
|
8252 | if (isFirstRun) {
|
8253 | job();
|
8254 | } else {
|
8255 | queueJob(job);
|
8256 | }
|
8257 | };
|
8258 | }
|
8259 | baseWatchOptions.augmentJob = (job) => {
|
8260 | if (cb) {
|
8261 | job.flags |= 4;
|
8262 | }
|
8263 | if (isPre) {
|
8264 | job.flags |= 2;
|
8265 | if (instance) {
|
8266 | job.id = instance.uid;
|
8267 | job.i = instance;
|
8268 | }
|
8269 | }
|
8270 | };
|
8271 | const watchHandle = watch$1(source, cb, baseWatchOptions);
|
8272 | return watchHandle;
|
8273 | }
|
8274 | function instanceWatch(source, value, options) {
|
8275 | const publicThis = this.proxy;
|
8276 | const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
8277 | let cb;
|
8278 | if (isFunction(value)) {
|
8279 | cb = value;
|
8280 | } else {
|
8281 | cb = value.handler;
|
8282 | options = value;
|
8283 | }
|
8284 | const reset = setCurrentInstance(this);
|
8285 | const res = doWatch(getter, cb.bind(publicThis), options);
|
8286 | reset();
|
8287 | return res;
|
8288 | }
|
8289 | function createPathGetter(ctx, path) {
|
8290 | const segments = path.split(".");
|
8291 | return () => {
|
8292 | let cur = ctx;
|
8293 | for (let i = 0; i < segments.length && cur; i++) {
|
8294 | cur = cur[segments[i]];
|
8295 | }
|
8296 | return cur;
|
8297 | };
|
8298 | }
|
8299 |
|
8300 | function useModel(props, name, options = EMPTY_OBJ) {
|
8301 | const i = getCurrentInstance();
|
8302 | if (!i) {
|
8303 | warn$1(`useModel() called without active instance.`);
|
8304 | return ref();
|
8305 | }
|
8306 | const camelizedName = camelize(name);
|
8307 | if (!i.propsOptions[0][camelizedName]) {
|
8308 | warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
8309 | return ref();
|
8310 | }
|
8311 | const hyphenatedName = hyphenate(name);
|
8312 | const modifiers = getModelModifiers(props, camelizedName);
|
8313 | const res = customRef((track, trigger) => {
|
8314 | let localValue;
|
8315 | let prevSetValue = EMPTY_OBJ;
|
8316 | let prevEmittedValue;
|
8317 | watchSyncEffect(() => {
|
8318 | const propValue = props[camelizedName];
|
8319 | if (hasChanged(localValue, propValue)) {
|
8320 | localValue = propValue;
|
8321 | trigger();
|
8322 | }
|
8323 | });
|
8324 | return {
|
8325 | get() {
|
8326 | track();
|
8327 | return options.get ? options.get(localValue) : localValue;
|
8328 | },
|
8329 | set(value) {
|
8330 | const emittedValue = options.set ? options.set(value) : value;
|
8331 | if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
|
8332 | return;
|
8333 | }
|
8334 | const rawProps = i.vnode.props;
|
8335 | if (!(rawProps &&
|
8336 | (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
|
8337 | localValue = value;
|
8338 | trigger();
|
8339 | }
|
8340 | i.emit(`update:${name}`, emittedValue);
|
8341 | if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
|
8342 | trigger();
|
8343 | }
|
8344 | prevSetValue = value;
|
8345 | prevEmittedValue = emittedValue;
|
8346 | }
|
8347 | };
|
8348 | });
|
8349 | res[Symbol.iterator] = () => {
|
8350 | let i2 = 0;
|
8351 | return {
|
8352 | next() {
|
8353 | if (i2 < 2) {
|
8354 | return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
|
8355 | } else {
|
8356 | return { done: true };
|
8357 | }
|
8358 | }
|
8359 | };
|
8360 | };
|
8361 | return res;
|
8362 | }
|
8363 | const getModelModifiers = (props, modelName) => {
|
8364 | return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
|
8365 | };
|
8366 |
|
8367 | function emit(instance, event, ...rawArgs) {
|
8368 | if (instance.isUnmounted) return;
|
8369 | const props = instance.vnode.props || EMPTY_OBJ;
|
8370 | {
|
8371 | const {
|
8372 | emitsOptions,
|
8373 | propsOptions: [propsOptions]
|
8374 | } = instance;
|
8375 | if (emitsOptions) {
|
8376 | if (!(event in emitsOptions) && true) {
|
8377 | if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
|
8378 | warn$1(
|
8379 | `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
|
8380 | );
|
8381 | }
|
8382 | } else {
|
8383 | const validator = emitsOptions[event];
|
8384 | if (isFunction(validator)) {
|
8385 | const isValid = validator(...rawArgs);
|
8386 | if (!isValid) {
|
8387 | warn$1(
|
8388 | `Invalid event arguments: event validation failed for event "${event}".`
|
8389 | );
|
8390 | }
|
8391 | }
|
8392 | }
|
8393 | }
|
8394 | }
|
8395 | let args = rawArgs;
|
8396 | const isModelListener = event.startsWith("update:");
|
8397 | const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
8398 | if (modifiers) {
|
8399 | if (modifiers.trim) {
|
8400 | args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
8401 | }
|
8402 | if (modifiers.number) {
|
8403 | args = rawArgs.map(looseToNumber);
|
8404 | }
|
8405 | }
|
8406 | {
|
8407 | devtoolsComponentEmit(instance, event, args);
|
8408 | }
|
8409 | {
|
8410 | const lowerCaseEvent = event.toLowerCase();
|
8411 | if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
8412 | warn$1(
|
8413 | `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
8414 | instance,
|
8415 | instance.type
|
8416 | )} 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(
|
8417 | event
|
8418 | )}" instead of "${event}".`
|
8419 | );
|
8420 | }
|
8421 | }
|
8422 | let handlerName;
|
8423 | let handler = props[handlerName = toHandlerKey(event)] ||
|
8424 | props[handlerName = toHandlerKey(camelize(event))];
|
8425 | if (!handler && isModelListener) {
|
8426 | handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
8427 | }
|
8428 | if (handler) {
|
8429 | callWithAsyncErrorHandling(
|
8430 | handler,
|
8431 | instance,
|
8432 | 6,
|
8433 | args
|
8434 | );
|
8435 | }
|
8436 | const onceHandler = props[handlerName + `Once`];
|
8437 | if (onceHandler) {
|
8438 | if (!instance.emitted) {
|
8439 | instance.emitted = {};
|
8440 | } else if (instance.emitted[handlerName]) {
|
8441 | return;
|
8442 | }
|
8443 | instance.emitted[handlerName] = true;
|
8444 | callWithAsyncErrorHandling(
|
8445 | onceHandler,
|
8446 | instance,
|
8447 | 6,
|
8448 | args
|
8449 | );
|
8450 | }
|
8451 | }
|
8452 | function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
8453 | const cache = appContext.emitsCache;
|
8454 | const cached = cache.get(comp);
|
8455 | if (cached !== void 0) {
|
8456 | return cached;
|
8457 | }
|
8458 | const raw = comp.emits;
|
8459 | let normalized = {};
|
8460 | let hasExtends = false;
|
8461 | if (!isFunction(comp)) {
|
8462 | const extendEmits = (raw2) => {
|
8463 | const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
8464 | if (normalizedFromExtend) {
|
8465 | hasExtends = true;
|
8466 | extend(normalized, normalizedFromExtend);
|
8467 | }
|
8468 | };
|
8469 | if (!asMixin && appContext.mixins.length) {
|
8470 | appContext.mixins.forEach(extendEmits);
|
8471 | }
|
8472 | if (comp.extends) {
|
8473 | extendEmits(comp.extends);
|
8474 | }
|
8475 | if (comp.mixins) {
|
8476 | comp.mixins.forEach(extendEmits);
|
8477 | }
|
8478 | }
|
8479 | if (!raw && !hasExtends) {
|
8480 | if (isObject(comp)) {
|
8481 | cache.set(comp, null);
|
8482 | }
|
8483 | return null;
|
8484 | }
|
8485 | if (isArray(raw)) {
|
8486 | raw.forEach((key) => normalized[key] = null);
|
8487 | } else {
|
8488 | extend(normalized, raw);
|
8489 | }
|
8490 | if (isObject(comp)) {
|
8491 | cache.set(comp, normalized);
|
8492 | }
|
8493 | return normalized;
|
8494 | }
|
8495 | function isEmitListener(options, key) {
|
8496 | if (!options || !isOn(key)) {
|
8497 | return false;
|
8498 | }
|
8499 | key = key.slice(2).replace(/Once$/, "");
|
8500 | return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
8501 | }
|
8502 |
|
8503 | let accessedAttrs = false;
|
8504 | function markAttrsAccessed() {
|
8505 | accessedAttrs = true;
|
8506 | }
|
8507 | function renderComponentRoot(instance) {
|
8508 | const {
|
8509 | type: Component,
|
8510 | vnode,
|
8511 | proxy,
|
8512 | withProxy,
|
8513 | propsOptions: [propsOptions],
|
8514 | slots,
|
8515 | attrs,
|
8516 | emit,
|
8517 | render,
|
8518 | renderCache,
|
8519 | props,
|
8520 | data,
|
8521 | setupState,
|
8522 | ctx,
|
8523 | inheritAttrs
|
8524 | } = instance;
|
8525 | const prev = setCurrentRenderingInstance(instance);
|
8526 | let result;
|
8527 | let fallthroughAttrs;
|
8528 | {
|
8529 | accessedAttrs = false;
|
8530 | }
|
8531 | try {
|
8532 | if (vnode.shapeFlag & 4) {
|
8533 | const proxyToUse = withProxy || proxy;
|
8534 | const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
8535 | get(target, key, receiver) {
|
8536 | warn$1(
|
8537 | `Property '${String(
|
8538 | key
|
8539 | )}' was accessed via 'this'. Avoid using 'this' in templates.`
|
8540 | );
|
8541 | return Reflect.get(target, key, receiver);
|
8542 | }
|
8543 | }) : proxyToUse;
|
8544 | result = normalizeVNode(
|
8545 | render.call(
|
8546 | thisProxy,
|
8547 | proxyToUse,
|
8548 | renderCache,
|
8549 | true ? shallowReadonly(props) : props,
|
8550 | setupState,
|
8551 | data,
|
8552 | ctx
|
8553 | )
|
8554 | );
|
8555 | fallthroughAttrs = attrs;
|
8556 | } else {
|
8557 | const render2 = Component;
|
8558 | if (attrs === props) {
|
8559 | markAttrsAccessed();
|
8560 | }
|
8561 | result = normalizeVNode(
|
8562 | render2.length > 1 ? render2(
|
8563 | true ? shallowReadonly(props) : props,
|
8564 | true ? {
|
8565 | get attrs() {
|
8566 | markAttrsAccessed();
|
8567 | return shallowReadonly(attrs);
|
8568 | },
|
8569 | slots,
|
8570 | emit
|
8571 | } : { attrs, slots, emit }
|
8572 | ) : render2(
|
8573 | true ? shallowReadonly(props) : props,
|
8574 | null
|
8575 | )
|
8576 | );
|
8577 | fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
8578 | }
|
8579 | } catch (err) {
|
8580 | blockStack.length = 0;
|
8581 | handleError(err, instance, 1);
|
8582 | result = createVNode(Comment);
|
8583 | }
|
8584 | let root = result;
|
8585 | let setRoot = void 0;
|
8586 | if (result.patchFlag > 0 && result.patchFlag & 2048) {
|
8587 | [root, setRoot] = getChildRoot(result);
|
8588 | }
|
8589 | if (fallthroughAttrs && inheritAttrs !== false) {
|
8590 | const keys = Object.keys(fallthroughAttrs);
|
8591 | const { shapeFlag } = root;
|
8592 | if (keys.length) {
|
8593 | if (shapeFlag & (1 | 6)) {
|
8594 | if (propsOptions && keys.some(isModelListener)) {
|
8595 | fallthroughAttrs = filterModelListeners(
|
8596 | fallthroughAttrs,
|
8597 | propsOptions
|
8598 | );
|
8599 | }
|
8600 | root = cloneVNode(root, fallthroughAttrs, false, true);
|
8601 | } else if (!accessedAttrs && root.type !== Comment) {
|
8602 | const allAttrs = Object.keys(attrs);
|
8603 | const eventAttrs = [];
|
8604 | const extraAttrs = [];
|
8605 | for (let i = 0, l = allAttrs.length; i < l; i++) {
|
8606 | const key = allAttrs[i];
|
8607 | if (isOn(key)) {
|
8608 | if (!isModelListener(key)) {
|
8609 | eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
8610 | }
|
8611 | } else {
|
8612 | extraAttrs.push(key);
|
8613 | }
|
8614 | }
|
8615 | if (extraAttrs.length) {
|
8616 | warn$1(
|
8617 | `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.`
|
8618 | );
|
8619 | }
|
8620 | if (eventAttrs.length) {
|
8621 | warn$1(
|
8622 | `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.`
|
8623 | );
|
8624 | }
|
8625 | }
|
8626 | }
|
8627 | }
|
8628 | if (vnode.dirs) {
|
8629 | if (!isElementRoot(root)) {
|
8630 | warn$1(
|
8631 | `Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
8632 | );
|
8633 | }
|
8634 | root = cloneVNode(root, null, false, true);
|
8635 | root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
8636 | }
|
8637 | if (vnode.transition) {
|
8638 | if (!isElementRoot(root)) {
|
8639 | warn$1(
|
8640 | `Component inside <Transition> renders non-element root node that cannot be animated.`
|
8641 | );
|
8642 | }
|
8643 | setTransitionHooks(root, vnode.transition);
|
8644 | }
|
8645 | if (setRoot) {
|
8646 | setRoot(root);
|
8647 | } else {
|
8648 | result = root;
|
8649 | }
|
8650 | setCurrentRenderingInstance(prev);
|
8651 | return result;
|
8652 | }
|
8653 | const getChildRoot = (vnode) => {
|
8654 | const rawChildren = vnode.children;
|
8655 | const dynamicChildren = vnode.dynamicChildren;
|
8656 | const childRoot = filterSingleRoot(rawChildren, false);
|
8657 | if (!childRoot) {
|
8658 | return [vnode, void 0];
|
8659 | } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
|
8660 | return getChildRoot(childRoot);
|
8661 | }
|
8662 | const index = rawChildren.indexOf(childRoot);
|
8663 | const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
8664 | const setRoot = (updatedRoot) => {
|
8665 | rawChildren[index] = updatedRoot;
|
8666 | if (dynamicChildren) {
|
8667 | if (dynamicIndex > -1) {
|
8668 | dynamicChildren[dynamicIndex] = updatedRoot;
|
8669 | } else if (updatedRoot.patchFlag > 0) {
|
8670 | vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
8671 | }
|
8672 | }
|
8673 | };
|
8674 | return [normalizeVNode(childRoot), setRoot];
|
8675 | };
|
8676 | function filterSingleRoot(children, recurse = true) {
|
8677 | let singleRoot;
|
8678 | for (let i = 0; i < children.length; i++) {
|
8679 | const child = children[i];
|
8680 | if (isVNode(child)) {
|
8681 | if (child.type !== Comment || child.children === "v-if") {
|
8682 | if (singleRoot) {
|
8683 | return;
|
8684 | } else {
|
8685 | singleRoot = child;
|
8686 | if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
|
8687 | return filterSingleRoot(singleRoot.children);
|
8688 | }
|
8689 | }
|
8690 | }
|
8691 | } else {
|
8692 | return;
|
8693 | }
|
8694 | }
|
8695 | return singleRoot;
|
8696 | }
|
8697 | const getFunctionalFallthrough = (attrs) => {
|
8698 | let res;
|
8699 | for (const key in attrs) {
|
8700 | if (key === "class" || key === "style" || isOn(key)) {
|
8701 | (res || (res = {}))[key] = attrs[key];
|
8702 | }
|
8703 | }
|
8704 | return res;
|
8705 | };
|
8706 | const filterModelListeners = (attrs, props) => {
|
8707 | const res = {};
|
8708 | for (const key in attrs) {
|
8709 | if (!isModelListener(key) || !(key.slice(9) in props)) {
|
8710 | res[key] = attrs[key];
|
8711 | }
|
8712 | }
|
8713 | return res;
|
8714 | };
|
8715 | const isElementRoot = (vnode) => {
|
8716 | return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
|
8717 | };
|
8718 | function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
8719 | const { props: prevProps, children: prevChildren, component } = prevVNode;
|
8720 | const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
8721 | const emits = component.emitsOptions;
|
8722 | if ((prevChildren || nextChildren) && isHmrUpdating) {
|
8723 | return true;
|
8724 | }
|
8725 | if (nextVNode.dirs || nextVNode.transition) {
|
8726 | return true;
|
8727 | }
|
8728 | if (optimized && patchFlag >= 0) {
|
8729 | if (patchFlag & 1024) {
|
8730 | return true;
|
8731 | }
|
8732 | if (patchFlag & 16) {
|
8733 | if (!prevProps) {
|
8734 | return !!nextProps;
|
8735 | }
|
8736 | return hasPropsChanged(prevProps, nextProps, emits);
|
8737 | } else if (patchFlag & 8) {
|
8738 | const dynamicProps = nextVNode.dynamicProps;
|
8739 | for (let i = 0; i < dynamicProps.length; i++) {
|
8740 | const key = dynamicProps[i];
|
8741 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
8742 | return true;
|
8743 | }
|
8744 | }
|
8745 | }
|
8746 | } else {
|
8747 | if (prevChildren || nextChildren) {
|
8748 | if (!nextChildren || !nextChildren.$stable) {
|
8749 | return true;
|
8750 | }
|
8751 | }
|
8752 | if (prevProps === nextProps) {
|
8753 | return false;
|
8754 | }
|
8755 | if (!prevProps) {
|
8756 | return !!nextProps;
|
8757 | }
|
8758 | if (!nextProps) {
|
8759 | return true;
|
8760 | }
|
8761 | return hasPropsChanged(prevProps, nextProps, emits);
|
8762 | }
|
8763 | return false;
|
8764 | }
|
8765 | function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
8766 | const nextKeys = Object.keys(nextProps);
|
8767 | if (nextKeys.length !== Object.keys(prevProps).length) {
|
8768 | return true;
|
8769 | }
|
8770 | for (let i = 0; i < nextKeys.length; i++) {
|
8771 | const key = nextKeys[i];
|
8772 | if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
8773 | return true;
|
8774 | }
|
8775 | }
|
8776 | return false;
|
8777 | }
|
8778 | function updateHOCHostEl({ vnode, parent }, el) {
|
8779 | while (parent) {
|
8780 | const root = parent.subTree;
|
8781 | if (root.suspense && root.suspense.activeBranch === vnode) {
|
8782 | root.el = vnode.el;
|
8783 | }
|
8784 | if (root === vnode) {
|
8785 | (vnode = parent.vnode).el = el;
|
8786 | parent = parent.parent;
|
8787 | } else {
|
8788 | break;
|
8789 | }
|
8790 | }
|
8791 | }
|
8792 |
|
8793 | const isSuspense = (type) => type.__isSuspense;
|
8794 | let suspenseId = 0;
|
8795 | const SuspenseImpl = {
|
8796 | name: "Suspense",
|
8797 |
|
8798 |
|
8799 |
|
8800 |
|
8801 | __isSuspense: true,
|
8802 | process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
8803 | if (n1 == null) {
|
8804 | mountSuspense(
|
8805 | n2,
|
8806 | container,
|
8807 | anchor,
|
8808 | parentComponent,
|
8809 | parentSuspense,
|
8810 | namespace,
|
8811 | slotScopeIds,
|
8812 | optimized,
|
8813 | rendererInternals
|
8814 | );
|
8815 | } else {
|
8816 | if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
8817 | n2.suspense = n1.suspense;
|
8818 | n2.suspense.vnode = n2;
|
8819 | n2.el = n1.el;
|
8820 | return;
|
8821 | }
|
8822 | patchSuspense(
|
8823 | n1,
|
8824 | n2,
|
8825 | container,
|
8826 | anchor,
|
8827 | parentComponent,
|
8828 | namespace,
|
8829 | slotScopeIds,
|
8830 | optimized,
|
8831 | rendererInternals
|
8832 | );
|
8833 | }
|
8834 | },
|
8835 | hydrate: hydrateSuspense,
|
8836 | normalize: normalizeSuspenseChildren
|
8837 | };
|
8838 | const Suspense = SuspenseImpl ;
|
8839 | function triggerEvent(vnode, name) {
|
8840 | const eventListener = vnode.props && vnode.props[name];
|
8841 | if (isFunction(eventListener)) {
|
8842 | eventListener();
|
8843 | }
|
8844 | }
|
8845 | function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
8846 | const {
|
8847 | p: patch,
|
8848 | o: { createElement }
|
8849 | } = rendererInternals;
|
8850 | const hiddenContainer = createElement("div");
|
8851 | const suspense = vnode.suspense = createSuspenseBoundary(
|
8852 | vnode,
|
8853 | parentSuspense,
|
8854 | parentComponent,
|
8855 | container,
|
8856 | hiddenContainer,
|
8857 | anchor,
|
8858 | namespace,
|
8859 | slotScopeIds,
|
8860 | optimized,
|
8861 | rendererInternals
|
8862 | );
|
8863 | patch(
|
8864 | null,
|
8865 | suspense.pendingBranch = vnode.ssContent,
|
8866 | hiddenContainer,
|
8867 | null,
|
8868 | parentComponent,
|
8869 | suspense,
|
8870 | namespace,
|
8871 | slotScopeIds
|
8872 | );
|
8873 | if (suspense.deps > 0) {
|
8874 | triggerEvent(vnode, "onPending");
|
8875 | triggerEvent(vnode, "onFallback");
|
8876 | patch(
|
8877 | null,
|
8878 | vnode.ssFallback,
|
8879 | container,
|
8880 | anchor,
|
8881 | parentComponent,
|
8882 | null,
|
8883 |
|
8884 | namespace,
|
8885 | slotScopeIds
|
8886 | );
|
8887 | setActiveBranch(suspense, vnode.ssFallback);
|
8888 | } else {
|
8889 | suspense.resolve(false, true);
|
8890 | }
|
8891 | }
|
8892 | function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
8893 | const suspense = n2.suspense = n1.suspense;
|
8894 | suspense.vnode = n2;
|
8895 | n2.el = n1.el;
|
8896 | const newBranch = n2.ssContent;
|
8897 | const newFallback = n2.ssFallback;
|
8898 | const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
8899 | if (pendingBranch) {
|
8900 | suspense.pendingBranch = newBranch;
|
8901 | if (isSameVNodeType(newBranch, pendingBranch)) {
|
8902 | patch(
|
8903 | pendingBranch,
|
8904 | newBranch,
|
8905 | suspense.hiddenContainer,
|
8906 | null,
|
8907 | parentComponent,
|
8908 | suspense,
|
8909 | namespace,
|
8910 | slotScopeIds,
|
8911 | optimized
|
8912 | );
|
8913 | if (suspense.deps <= 0) {
|
8914 | suspense.resolve();
|
8915 | } else if (isInFallback) {
|
8916 | if (!isHydrating) {
|
8917 | patch(
|
8918 | activeBranch,
|
8919 | newFallback,
|
8920 | container,
|
8921 | anchor,
|
8922 | parentComponent,
|
8923 | null,
|
8924 |
|
8925 | namespace,
|
8926 | slotScopeIds,
|
8927 | optimized
|
8928 | );
|
8929 | setActiveBranch(suspense, newFallback);
|
8930 | }
|
8931 | }
|
8932 | } else {
|
8933 | suspense.pendingId = suspenseId++;
|
8934 | if (isHydrating) {
|
8935 | suspense.isHydrating = false;
|
8936 | suspense.activeBranch = pendingBranch;
|
8937 | } else {
|
8938 | unmount(pendingBranch, parentComponent, suspense);
|
8939 | }
|
8940 | suspense.deps = 0;
|
8941 | suspense.effects.length = 0;
|
8942 | suspense.hiddenContainer = createElement("div");
|
8943 | if (isInFallback) {
|
8944 | patch(
|
8945 | null,
|
8946 | newBranch,
|
8947 | suspense.hiddenContainer,
|
8948 | null,
|
8949 | parentComponent,
|
8950 | suspense,
|
8951 | namespace,
|
8952 | slotScopeIds,
|
8953 | optimized
|
8954 | );
|
8955 | if (suspense.deps <= 0) {
|
8956 | suspense.resolve();
|
8957 | } else {
|
8958 | patch(
|
8959 | activeBranch,
|
8960 | newFallback,
|
8961 | container,
|
8962 | anchor,
|
8963 | parentComponent,
|
8964 | null,
|
8965 |
|
8966 | namespace,
|
8967 | slotScopeIds,
|
8968 | optimized
|
8969 | );
|
8970 | setActiveBranch(suspense, newFallback);
|
8971 | }
|
8972 | } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
8973 | patch(
|
8974 | activeBranch,
|
8975 | newBranch,
|
8976 | container,
|
8977 | anchor,
|
8978 | parentComponent,
|
8979 | suspense,
|
8980 | namespace,
|
8981 | slotScopeIds,
|
8982 | optimized
|
8983 | );
|
8984 | suspense.resolve(true);
|
8985 | } else {
|
8986 | patch(
|
8987 | null,
|
8988 | newBranch,
|
8989 | suspense.hiddenContainer,
|
8990 | null,
|
8991 | parentComponent,
|
8992 | suspense,
|
8993 | namespace,
|
8994 | slotScopeIds,
|
8995 | optimized
|
8996 | );
|
8997 | if (suspense.deps <= 0) {
|
8998 | suspense.resolve();
|
8999 | }
|
9000 | }
|
9001 | }
|
9002 | } else {
|
9003 | if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
9004 | patch(
|
9005 | activeBranch,
|
9006 | newBranch,
|
9007 | container,
|
9008 | anchor,
|
9009 | parentComponent,
|
9010 | suspense,
|
9011 | namespace,
|
9012 | slotScopeIds,
|
9013 | optimized
|
9014 | );
|
9015 | setActiveBranch(suspense, newBranch);
|
9016 | } else {
|
9017 | triggerEvent(n2, "onPending");
|
9018 | suspense.pendingBranch = newBranch;
|
9019 | if (newBranch.shapeFlag & 512) {
|
9020 | suspense.pendingId = newBranch.component.suspenseId;
|
9021 | } else {
|
9022 | suspense.pendingId = suspenseId++;
|
9023 | }
|
9024 | patch(
|
9025 | null,
|
9026 | newBranch,
|
9027 | suspense.hiddenContainer,
|
9028 | null,
|
9029 | parentComponent,
|
9030 | suspense,
|
9031 | namespace,
|
9032 | slotScopeIds,
|
9033 | optimized
|
9034 | );
|
9035 | if (suspense.deps <= 0) {
|
9036 | suspense.resolve();
|
9037 | } else {
|
9038 | const { timeout, pendingId } = suspense;
|
9039 | if (timeout > 0) {
|
9040 | setTimeout(() => {
|
9041 | if (suspense.pendingId === pendingId) {
|
9042 | suspense.fallback(newFallback);
|
9043 | }
|
9044 | }, timeout);
|
9045 | } else if (timeout === 0) {
|
9046 | suspense.fallback(newFallback);
|
9047 | }
|
9048 | }
|
9049 | }
|
9050 | }
|
9051 | }
|
9052 | let hasWarned = false;
|
9053 | function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
9054 | if (!hasWarned) {
|
9055 | hasWarned = true;
|
9056 | console[console.info ? "info" : "log"](
|
9057 | `<Suspense> is an experimental feature and its API will likely change.`
|
9058 | );
|
9059 | }
|
9060 | const {
|
9061 | p: patch,
|
9062 | m: move,
|
9063 | um: unmount,
|
9064 | n: next,
|
9065 | o: { parentNode, remove }
|
9066 | } = rendererInternals;
|
9067 | let parentSuspenseId;
|
9068 | const isSuspensible = isVNodeSuspensible(vnode);
|
9069 | if (isSuspensible) {
|
9070 | if (parentSuspense && parentSuspense.pendingBranch) {
|
9071 | parentSuspenseId = parentSuspense.pendingId;
|
9072 | parentSuspense.deps++;
|
9073 | }
|
9074 | }
|
9075 | const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
|
9076 | {
|
9077 | assertNumber(timeout, `Suspense timeout`);
|
9078 | }
|
9079 | const initialAnchor = anchor;
|
9080 | const suspense = {
|
9081 | vnode,
|
9082 | parent: parentSuspense,
|
9083 | parentComponent,
|
9084 | namespace,
|
9085 | container,
|
9086 | hiddenContainer,
|
9087 | deps: 0,
|
9088 | pendingId: suspenseId++,
|
9089 | timeout: typeof timeout === "number" ? timeout : -1,
|
9090 | activeBranch: null,
|
9091 | pendingBranch: null,
|
9092 | isInFallback: !isHydrating,
|
9093 | isHydrating,
|
9094 | isUnmounted: false,
|
9095 | effects: [],
|
9096 | resolve(resume = false, sync = false) {
|
9097 | {
|
9098 | if (!resume && !suspense.pendingBranch) {
|
9099 | throw new Error(
|
9100 | `suspense.resolve() is called without a pending branch.`
|
9101 | );
|
9102 | }
|
9103 | if (suspense.isUnmounted) {
|
9104 | throw new Error(
|
9105 | `suspense.resolve() is called on an already unmounted suspense boundary.`
|
9106 | );
|
9107 | }
|
9108 | }
|
9109 | const {
|
9110 | vnode: vnode2,
|
9111 | activeBranch,
|
9112 | pendingBranch,
|
9113 | pendingId,
|
9114 | effects,
|
9115 | parentComponent: parentComponent2,
|
9116 | container: container2
|
9117 | } = suspense;
|
9118 | let delayEnter = false;
|
9119 | if (suspense.isHydrating) {
|
9120 | suspense.isHydrating = false;
|
9121 | } else if (!resume) {
|
9122 | delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
9123 | if (delayEnter) {
|
9124 | activeBranch.transition.afterLeave = () => {
|
9125 | if (pendingId === suspense.pendingId) {
|
9126 | move(
|
9127 | pendingBranch,
|
9128 | container2,
|
9129 | anchor === initialAnchor ? next(activeBranch) : anchor,
|
9130 | 0
|
9131 | );
|
9132 | queuePostFlushCb(effects);
|
9133 | }
|
9134 | };
|
9135 | }
|
9136 | if (activeBranch) {
|
9137 | if (parentNode(activeBranch.el) === container2) {
|
9138 | anchor = next(activeBranch);
|
9139 | }
|
9140 | unmount(activeBranch, parentComponent2, suspense, true);
|
9141 | }
|
9142 | if (!delayEnter) {
|
9143 | move(pendingBranch, container2, anchor, 0);
|
9144 | }
|
9145 | }
|
9146 | setActiveBranch(suspense, pendingBranch);
|
9147 | suspense.pendingBranch = null;
|
9148 | suspense.isInFallback = false;
|
9149 | let parent = suspense.parent;
|
9150 | let hasUnresolvedAncestor = false;
|
9151 | while (parent) {
|
9152 | if (parent.pendingBranch) {
|
9153 | parent.effects.push(...effects);
|
9154 | hasUnresolvedAncestor = true;
|
9155 | break;
|
9156 | }
|
9157 | parent = parent.parent;
|
9158 | }
|
9159 | if (!hasUnresolvedAncestor && !delayEnter) {
|
9160 | queuePostFlushCb(effects);
|
9161 | }
|
9162 | suspense.effects = [];
|
9163 | if (isSuspensible) {
|
9164 | if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
9165 | parentSuspense.deps--;
|
9166 | if (parentSuspense.deps === 0 && !sync) {
|
9167 | parentSuspense.resolve();
|
9168 | }
|
9169 | }
|
9170 | }
|
9171 | triggerEvent(vnode2, "onResolve");
|
9172 | },
|
9173 | fallback(fallbackVNode) {
|
9174 | if (!suspense.pendingBranch) {
|
9175 | return;
|
9176 | }
|
9177 | const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
9178 | triggerEvent(vnode2, "onFallback");
|
9179 | const anchor2 = next(activeBranch);
|
9180 | const mountFallback = () => {
|
9181 | if (!suspense.isInFallback) {
|
9182 | return;
|
9183 | }
|
9184 | patch(
|
9185 | null,
|
9186 | fallbackVNode,
|
9187 | container2,
|
9188 | anchor2,
|
9189 | parentComponent2,
|
9190 | null,
|
9191 |
|
9192 | namespace2,
|
9193 | slotScopeIds,
|
9194 | optimized
|
9195 | );
|
9196 | setActiveBranch(suspense, fallbackVNode);
|
9197 | };
|
9198 | const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
9199 | if (delayEnter) {
|
9200 | activeBranch.transition.afterLeave = mountFallback;
|
9201 | }
|
9202 | suspense.isInFallback = true;
|
9203 | unmount(
|
9204 | activeBranch,
|
9205 | parentComponent2,
|
9206 | null,
|
9207 |
|
9208 | true
|
9209 |
|
9210 | );
|
9211 | if (!delayEnter) {
|
9212 | mountFallback();
|
9213 | }
|
9214 | },
|
9215 | move(container2, anchor2, type) {
|
9216 | suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
9217 | suspense.container = container2;
|
9218 | },
|
9219 | next() {
|
9220 | return suspense.activeBranch && next(suspense.activeBranch);
|
9221 | },
|
9222 | registerDep(instance, setupRenderEffect, optimized2) {
|
9223 | const isInPendingSuspense = !!suspense.pendingBranch;
|
9224 | if (isInPendingSuspense) {
|
9225 | suspense.deps++;
|
9226 | }
|
9227 | const hydratedEl = instance.vnode.el;
|
9228 | instance.asyncDep.catch((err) => {
|
9229 | handleError(err, instance, 0);
|
9230 | }).then((asyncSetupResult) => {
|
9231 | if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
9232 | return;
|
9233 | }
|
9234 | instance.asyncResolved = true;
|
9235 | const { vnode: vnode2 } = instance;
|
9236 | {
|
9237 | pushWarningContext(vnode2);
|
9238 | }
|
9239 | handleSetupResult(instance, asyncSetupResult, false);
|
9240 | if (hydratedEl) {
|
9241 | vnode2.el = hydratedEl;
|
9242 | }
|
9243 | const placeholder = !hydratedEl && instance.subTree.el;
|
9244 | setupRenderEffect(
|
9245 | instance,
|
9246 | vnode2,
|
9247 |
|
9248 |
|
9249 |
|
9250 | parentNode(hydratedEl || instance.subTree.el),
|
9251 |
|
9252 |
|
9253 | hydratedEl ? null : next(instance.subTree),
|
9254 | suspense,
|
9255 | namespace,
|
9256 | optimized2
|
9257 | );
|
9258 | if (placeholder) {
|
9259 | remove(placeholder);
|
9260 | }
|
9261 | updateHOCHostEl(instance, vnode2.el);
|
9262 | {
|
9263 | popWarningContext();
|
9264 | }
|
9265 | if (isInPendingSuspense && --suspense.deps === 0) {
|
9266 | suspense.resolve();
|
9267 | }
|
9268 | });
|
9269 | },
|
9270 | unmount(parentSuspense2, doRemove) {
|
9271 | suspense.isUnmounted = true;
|
9272 | if (suspense.activeBranch) {
|
9273 | unmount(
|
9274 | suspense.activeBranch,
|
9275 | parentComponent,
|
9276 | parentSuspense2,
|
9277 | doRemove
|
9278 | );
|
9279 | }
|
9280 | if (suspense.pendingBranch) {
|
9281 | unmount(
|
9282 | suspense.pendingBranch,
|
9283 | parentComponent,
|
9284 | parentSuspense2,
|
9285 | doRemove
|
9286 | );
|
9287 | }
|
9288 | }
|
9289 | };
|
9290 | return suspense;
|
9291 | }
|
9292 | function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
9293 | const suspense = vnode.suspense = createSuspenseBoundary(
|
9294 | vnode,
|
9295 | parentSuspense,
|
9296 | parentComponent,
|
9297 | node.parentNode,
|
9298 |
|
9299 | document.createElement("div"),
|
9300 | null,
|
9301 | namespace,
|
9302 | slotScopeIds,
|
9303 | optimized,
|
9304 | rendererInternals,
|
9305 | true
|
9306 | );
|
9307 | const result = hydrateNode(
|
9308 | node,
|
9309 | suspense.pendingBranch = vnode.ssContent,
|
9310 | parentComponent,
|
9311 | suspense,
|
9312 | slotScopeIds,
|
9313 | optimized
|
9314 | );
|
9315 | if (suspense.deps === 0) {
|
9316 | suspense.resolve(false, true);
|
9317 | }
|
9318 | return result;
|
9319 | }
|
9320 | function normalizeSuspenseChildren(vnode) {
|
9321 | const { shapeFlag, children } = vnode;
|
9322 | const isSlotChildren = shapeFlag & 32;
|
9323 | vnode.ssContent = normalizeSuspenseSlot(
|
9324 | isSlotChildren ? children.default : children
|
9325 | );
|
9326 | vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
9327 | }
|
9328 | function normalizeSuspenseSlot(s) {
|
9329 | let block;
|
9330 | if (isFunction(s)) {
|
9331 | const trackBlock = isBlockTreeEnabled && s._c;
|
9332 | if (trackBlock) {
|
9333 | s._d = false;
|
9334 | openBlock();
|
9335 | }
|
9336 | s = s();
|
9337 | if (trackBlock) {
|
9338 | s._d = true;
|
9339 | block = currentBlock;
|
9340 | closeBlock();
|
9341 | }
|
9342 | }
|
9343 | if (isArray(s)) {
|
9344 | const singleChild = filterSingleRoot(s);
|
9345 | if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
|
9346 | warn$1(`<Suspense> slots expect a single root node.`);
|
9347 | }
|
9348 | s = singleChild;
|
9349 | }
|
9350 | s = normalizeVNode(s);
|
9351 | if (block && !s.dynamicChildren) {
|
9352 | s.dynamicChildren = block.filter((c) => c !== s);
|
9353 | }
|
9354 | return s;
|
9355 | }
|
9356 | function queueEffectWithSuspense(fn, suspense) {
|
9357 | if (suspense && suspense.pendingBranch) {
|
9358 | if (isArray(fn)) {
|
9359 | suspense.effects.push(...fn);
|
9360 | } else {
|
9361 | suspense.effects.push(fn);
|
9362 | }
|
9363 | } else {
|
9364 | queuePostFlushCb(fn);
|
9365 | }
|
9366 | }
|
9367 | function setActiveBranch(suspense, branch) {
|
9368 | suspense.activeBranch = branch;
|
9369 | const { vnode, parentComponent } = suspense;
|
9370 | let el = branch.el;
|
9371 | while (!el && branch.component) {
|
9372 | branch = branch.component.subTree;
|
9373 | el = branch.el;
|
9374 | }
|
9375 | vnode.el = el;
|
9376 | if (parentComponent && parentComponent.subTree === vnode) {
|
9377 | parentComponent.vnode.el = el;
|
9378 | updateHOCHostEl(parentComponent, el);
|
9379 | }
|
9380 | }
|
9381 | function isVNodeSuspensible(vnode) {
|
9382 | const suspensible = vnode.props && vnode.props.suspensible;
|
9383 | return suspensible != null && suspensible !== false;
|
9384 | }
|
9385 |
|
9386 | const Fragment = Symbol.for("v-fgt");
|
9387 | const Text = Symbol.for("v-txt");
|
9388 | const Comment = Symbol.for("v-cmt");
|
9389 | const Static = Symbol.for("v-stc");
|
9390 | const blockStack = [];
|
9391 | let currentBlock = null;
|
9392 | function openBlock(disableTracking = false) {
|
9393 | blockStack.push(currentBlock = disableTracking ? null : []);
|
9394 | }
|
9395 | function closeBlock() {
|
9396 | blockStack.pop();
|
9397 | currentBlock = blockStack[blockStack.length - 1] || null;
|
9398 | }
|
9399 | let isBlockTreeEnabled = 1;
|
9400 | function setBlockTracking(value, inVOnce = false) {
|
9401 | isBlockTreeEnabled += value;
|
9402 | if (value < 0 && currentBlock && inVOnce) {
|
9403 | currentBlock.hasOnce = true;
|
9404 | }
|
9405 | }
|
9406 | function setupBlock(vnode) {
|
9407 | vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
|
9408 | closeBlock();
|
9409 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
9410 | currentBlock.push(vnode);
|
9411 | }
|
9412 | return vnode;
|
9413 | }
|
9414 | function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
|
9415 | return setupBlock(
|
9416 | createBaseVNode(
|
9417 | type,
|
9418 | props,
|
9419 | children,
|
9420 | patchFlag,
|
9421 | dynamicProps,
|
9422 | shapeFlag,
|
9423 | true
|
9424 | )
|
9425 | );
|
9426 | }
|
9427 | function createBlock(type, props, children, patchFlag, dynamicProps) {
|
9428 | return setupBlock(
|
9429 | createVNode(
|
9430 | type,
|
9431 | props,
|
9432 | children,
|
9433 | patchFlag,
|
9434 | dynamicProps,
|
9435 | true
|
9436 | )
|
9437 | );
|
9438 | }
|
9439 | function isVNode(value) {
|
9440 | return value ? value.__v_isVNode === true : false;
|
9441 | }
|
9442 | function isSameVNodeType(n1, n2) {
|
9443 | if (n2.shapeFlag & 6 && n1.component) {
|
9444 | const dirtyInstances = hmrDirtyComponents.get(n2.type);
|
9445 | if (dirtyInstances && dirtyInstances.has(n1.component)) {
|
9446 | n1.shapeFlag &= ~256;
|
9447 | n2.shapeFlag &= ~512;
|
9448 | return false;
|
9449 | }
|
9450 | }
|
9451 | return n1.type === n2.type && n1.key === n2.key;
|
9452 | }
|
9453 | let vnodeArgsTransformer;
|
9454 | function transformVNodeArgs(transformer) {
|
9455 | vnodeArgsTransformer = transformer;
|
9456 | }
|
9457 | const createVNodeWithArgsTransform = (...args) => {
|
9458 | return _createVNode(
|
9459 | ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
|
9460 | );
|
9461 | };
|
9462 | const normalizeKey = ({ key }) => key != null ? key : null;
|
9463 | const normalizeRef = ({
|
9464 | ref,
|
9465 | ref_key,
|
9466 | ref_for
|
9467 | }) => {
|
9468 | if (typeof ref === "number") {
|
9469 | ref = "" + ref;
|
9470 | }
|
9471 | return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
9472 | };
|
9473 | function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
9474 | const vnode = {
|
9475 | __v_isVNode: true,
|
9476 | __v_skip: true,
|
9477 | type,
|
9478 | props,
|
9479 | key: props && normalizeKey(props),
|
9480 | ref: props && normalizeRef(props),
|
9481 | scopeId: currentScopeId,
|
9482 | slotScopeIds: null,
|
9483 | children,
|
9484 | component: null,
|
9485 | suspense: null,
|
9486 | ssContent: null,
|
9487 | ssFallback: null,
|
9488 | dirs: null,
|
9489 | transition: null,
|
9490 | el: null,
|
9491 | anchor: null,
|
9492 | target: null,
|
9493 | targetStart: null,
|
9494 | targetAnchor: null,
|
9495 | staticCount: 0,
|
9496 | shapeFlag,
|
9497 | patchFlag,
|
9498 | dynamicProps,
|
9499 | dynamicChildren: null,
|
9500 | appContext: null,
|
9501 | ctx: currentRenderingInstance
|
9502 | };
|
9503 | if (needFullChildrenNormalization) {
|
9504 | normalizeChildren(vnode, children);
|
9505 | if (shapeFlag & 128) {
|
9506 | type.normalize(vnode);
|
9507 | }
|
9508 | } else if (children) {
|
9509 | vnode.shapeFlag |= isString(children) ? 8 : 16;
|
9510 | }
|
9511 | if (vnode.key !== vnode.key) {
|
9512 | warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
9513 | }
|
9514 | if (isBlockTreeEnabled > 0 &&
|
9515 | !isBlockNode &&
|
9516 | currentBlock &&
|
9517 |
|
9518 |
|
9519 |
|
9520 | (vnode.patchFlag > 0 || shapeFlag & 6) &&
|
9521 |
|
9522 | vnode.patchFlag !== 32) {
|
9523 | currentBlock.push(vnode);
|
9524 | }
|
9525 | return vnode;
|
9526 | }
|
9527 | const createVNode = createVNodeWithArgsTransform ;
|
9528 | function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
9529 | if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
9530 | if (!type) {
|
9531 | warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
9532 | }
|
9533 | type = Comment;
|
9534 | }
|
9535 | if (isVNode(type)) {
|
9536 | const cloned = cloneVNode(
|
9537 | type,
|
9538 | props,
|
9539 | true
|
9540 |
|
9541 | );
|
9542 | if (children) {
|
9543 | normalizeChildren(cloned, children);
|
9544 | }
|
9545 | if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
9546 | if (cloned.shapeFlag & 6) {
|
9547 | currentBlock[currentBlock.indexOf(type)] = cloned;
|
9548 | } else {
|
9549 | currentBlock.push(cloned);
|
9550 | }
|
9551 | }
|
9552 | cloned.patchFlag = -2;
|
9553 | return cloned;
|
9554 | }
|
9555 | if (isClassComponent(type)) {
|
9556 | type = type.__vccOpts;
|
9557 | }
|
9558 | if (props) {
|
9559 | props = guardReactiveProps(props);
|
9560 | let { class: klass, style } = props;
|
9561 | if (klass && !isString(klass)) {
|
9562 | props.class = normalizeClass(klass);
|
9563 | }
|
9564 | if (isObject(style)) {
|
9565 | if (isProxy(style) && !isArray(style)) {
|
9566 | style = extend({}, style);
|
9567 | }
|
9568 | props.style = normalizeStyle(style);
|
9569 | }
|
9570 | }
|
9571 | const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
9572 | if (shapeFlag & 4 && isProxy(type)) {
|
9573 | type = toRaw(type);
|
9574 | warn$1(
|
9575 | `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\`.`,
|
9576 | `
|
9577 | Component that was made reactive: `,
|
9578 | type
|
9579 | );
|
9580 | }
|
9581 | return createBaseVNode(
|
9582 | type,
|
9583 | props,
|
9584 | children,
|
9585 | patchFlag,
|
9586 | dynamicProps,
|
9587 | shapeFlag,
|
9588 | isBlockNode,
|
9589 | true
|
9590 | );
|
9591 | }
|
9592 | function guardReactiveProps(props) {
|
9593 | if (!props) return null;
|
9594 | return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
9595 | }
|
9596 | function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
9597 | const { props, ref, patchFlag, children, transition } = vnode;
|
9598 | const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
9599 | const cloned = {
|
9600 | __v_isVNode: true,
|
9601 | __v_skip: true,
|
9602 | type: vnode.type,
|
9603 | props: mergedProps,
|
9604 | key: mergedProps && normalizeKey(mergedProps),
|
9605 | ref: extraProps && extraProps.ref ? (
|
9606 |
|
9607 |
|
9608 |
|
9609 | mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
9610 | ) : ref,
|
9611 | scopeId: vnode.scopeId,
|
9612 | slotScopeIds: vnode.slotScopeIds,
|
9613 | children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
9614 | target: vnode.target,
|
9615 | targetStart: vnode.targetStart,
|
9616 | targetAnchor: vnode.targetAnchor,
|
9617 | staticCount: vnode.staticCount,
|
9618 | shapeFlag: vnode.shapeFlag,
|
9619 |
|
9620 |
|
9621 |
|
9622 |
|
9623 | patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
9624 | dynamicProps: vnode.dynamicProps,
|
9625 | dynamicChildren: vnode.dynamicChildren,
|
9626 | appContext: vnode.appContext,
|
9627 | dirs: vnode.dirs,
|
9628 | transition,
|
9629 |
|
9630 |
|
9631 |
|
9632 |
|
9633 | component: vnode.component,
|
9634 | suspense: vnode.suspense,
|
9635 | ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
9636 | ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
9637 | el: vnode.el,
|
9638 | anchor: vnode.anchor,
|
9639 | ctx: vnode.ctx,
|
9640 | ce: vnode.ce
|
9641 | };
|
9642 | if (transition && cloneTransition) {
|
9643 | setTransitionHooks(
|
9644 | cloned,
|
9645 | transition.clone(cloned)
|
9646 | );
|
9647 | }
|
9648 | return cloned;
|
9649 | }
|
9650 | function deepCloneVNode(vnode) {
|
9651 | const cloned = cloneVNode(vnode);
|
9652 | if (isArray(vnode.children)) {
|
9653 | cloned.children = vnode.children.map(deepCloneVNode);
|
9654 | }
|
9655 | return cloned;
|
9656 | }
|
9657 | function createTextVNode(text = " ", flag = 0) {
|
9658 | return createVNode(Text, null, text, flag);
|
9659 | }
|
9660 | function createStaticVNode(content, numberOfNodes) {
|
9661 | const vnode = createVNode(Static, null, content);
|
9662 | vnode.staticCount = numberOfNodes;
|
9663 | return vnode;
|
9664 | }
|
9665 | function createCommentVNode(text = "", asBlock = false) {
|
9666 | return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
|
9667 | }
|
9668 | function normalizeVNode(child) {
|
9669 | if (child == null || typeof child === "boolean") {
|
9670 | return createVNode(Comment);
|
9671 | } else if (isArray(child)) {
|
9672 | return createVNode(
|
9673 | Fragment,
|
9674 | null,
|
9675 |
|
9676 | child.slice()
|
9677 | );
|
9678 | } else if (isVNode(child)) {
|
9679 | return cloneIfMounted(child);
|
9680 | } else {
|
9681 | return createVNode(Text, null, String(child));
|
9682 | }
|
9683 | }
|
9684 | function cloneIfMounted(child) {
|
9685 | return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
|
9686 | }
|
9687 | function normalizeChildren(vnode, children) {
|
9688 | let type = 0;
|
9689 | const { shapeFlag } = vnode;
|
9690 | if (children == null) {
|
9691 | children = null;
|
9692 | } else if (isArray(children)) {
|
9693 | type = 16;
|
9694 | } else if (typeof children === "object") {
|
9695 | if (shapeFlag & (1 | 64)) {
|
9696 | const slot = children.default;
|
9697 | if (slot) {
|
9698 | slot._c && (slot._d = false);
|
9699 | normalizeChildren(vnode, slot());
|
9700 | slot._c && (slot._d = true);
|
9701 | }
|
9702 | return;
|
9703 | } else {
|
9704 | type = 32;
|
9705 | const slotFlag = children._;
|
9706 | if (!slotFlag && !isInternalObject(children)) {
|
9707 | children._ctx = currentRenderingInstance;
|
9708 | } else if (slotFlag === 3 && currentRenderingInstance) {
|
9709 | if (currentRenderingInstance.slots._ === 1) {
|
9710 | children._ = 1;
|
9711 | } else {
|
9712 | children._ = 2;
|
9713 | vnode.patchFlag |= 1024;
|
9714 | }
|
9715 | }
|
9716 | }
|
9717 | } else if (isFunction(children)) {
|
9718 | children = { default: children, _ctx: currentRenderingInstance };
|
9719 | type = 32;
|
9720 | } else {
|
9721 | children = String(children);
|
9722 | if (shapeFlag & 64) {
|
9723 | type = 16;
|
9724 | children = [createTextVNode(children)];
|
9725 | } else {
|
9726 | type = 8;
|
9727 | }
|
9728 | }
|
9729 | vnode.children = children;
|
9730 | vnode.shapeFlag |= type;
|
9731 | }
|
9732 | function mergeProps(...args) {
|
9733 | const ret = {};
|
9734 | for (let i = 0; i < args.length; i++) {
|
9735 | const toMerge = args[i];
|
9736 | for (const key in toMerge) {
|
9737 | if (key === "class") {
|
9738 | if (ret.class !== toMerge.class) {
|
9739 | ret.class = normalizeClass([ret.class, toMerge.class]);
|
9740 | }
|
9741 | } else if (key === "style") {
|
9742 | ret.style = normalizeStyle([ret.style, toMerge.style]);
|
9743 | } else if (isOn(key)) {
|
9744 | const existing = ret[key];
|
9745 | const incoming = toMerge[key];
|
9746 | if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
9747 | ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
9748 | }
|
9749 | } else if (key !== "") {
|
9750 | ret[key] = toMerge[key];
|
9751 | }
|
9752 | }
|
9753 | }
|
9754 | return ret;
|
9755 | }
|
9756 | function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
9757 | callWithAsyncErrorHandling(hook, instance, 7, [
|
9758 | vnode,
|
9759 | prevVNode
|
9760 | ]);
|
9761 | }
|
9762 |
|
9763 | const emptyAppContext = createAppContext();
|
9764 | let uid = 0;
|
9765 | function createComponentInstance(vnode, parent, suspense) {
|
9766 | const type = vnode.type;
|
9767 | const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
9768 | const instance = {
|
9769 | uid: uid++,
|
9770 | vnode,
|
9771 | type,
|
9772 | parent,
|
9773 | appContext,
|
9774 | root: null,
|
9775 |
|
9776 | next: null,
|
9777 | subTree: null,
|
9778 |
|
9779 | effect: null,
|
9780 | update: null,
|
9781 |
|
9782 | job: null,
|
9783 | scope: new EffectScope(
|
9784 | true
|
9785 |
|
9786 | ),
|
9787 | render: null,
|
9788 | proxy: null,
|
9789 | exposed: null,
|
9790 | exposeProxy: null,
|
9791 | withProxy: null,
|
9792 | provides: parent ? parent.provides : Object.create(appContext.provides),
|
9793 | ids: parent ? parent.ids : ["", 0, 0],
|
9794 | accessCache: null,
|
9795 | renderCache: [],
|
9796 |
|
9797 | components: null,
|
9798 | directives: null,
|
9799 |
|
9800 | propsOptions: normalizePropsOptions(type, appContext),
|
9801 | emitsOptions: normalizeEmitsOptions(type, appContext),
|
9802 |
|
9803 | emit: null,
|
9804 |
|
9805 | emitted: null,
|
9806 |
|
9807 | propsDefaults: EMPTY_OBJ,
|
9808 |
|
9809 | inheritAttrs: type.inheritAttrs,
|
9810 |
|
9811 | ctx: EMPTY_OBJ,
|
9812 | data: EMPTY_OBJ,
|
9813 | props: EMPTY_OBJ,
|
9814 | attrs: EMPTY_OBJ,
|
9815 | slots: EMPTY_OBJ,
|
9816 | refs: EMPTY_OBJ,
|
9817 | setupState: EMPTY_OBJ,
|
9818 | setupContext: null,
|
9819 |
|
9820 | suspense,
|
9821 | suspenseId: suspense ? suspense.pendingId : 0,
|
9822 | asyncDep: null,
|
9823 | asyncResolved: false,
|
9824 |
|
9825 |
|
9826 | isMounted: false,
|
9827 | isUnmounted: false,
|
9828 | isDeactivated: false,
|
9829 | bc: null,
|
9830 | c: null,
|
9831 | bm: null,
|
9832 | m: null,
|
9833 | bu: null,
|
9834 | u: null,
|
9835 | um: null,
|
9836 | bum: null,
|
9837 | da: null,
|
9838 | a: null,
|
9839 | rtg: null,
|
9840 | rtc: null,
|
9841 | ec: null,
|
9842 | sp: null
|
9843 | };
|
9844 | {
|
9845 | instance.ctx = createDevRenderContext(instance);
|
9846 | }
|
9847 | instance.root = parent ? parent.root : instance;
|
9848 | instance.emit = emit.bind(null, instance);
|
9849 | if (vnode.ce) {
|
9850 | vnode.ce(instance);
|
9851 | }
|
9852 | return instance;
|
9853 | }
|
9854 | let currentInstance = null;
|
9855 | const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
9856 | let internalSetCurrentInstance;
|
9857 | let setInSSRSetupState;
|
9858 | {
|
9859 | internalSetCurrentInstance = (i) => {
|
9860 | currentInstance = i;
|
9861 | };
|
9862 | setInSSRSetupState = (v) => {
|
9863 | isInSSRComponentSetup = v;
|
9864 | };
|
9865 | }
|
9866 | const setCurrentInstance = (instance) => {
|
9867 | const prev = currentInstance;
|
9868 | internalSetCurrentInstance(instance);
|
9869 | instance.scope.on();
|
9870 | return () => {
|
9871 | instance.scope.off();
|
9872 | internalSetCurrentInstance(prev);
|
9873 | };
|
9874 | };
|
9875 | const unsetCurrentInstance = () => {
|
9876 | currentInstance && currentInstance.scope.off();
|
9877 | internalSetCurrentInstance(null);
|
9878 | };
|
9879 | const isBuiltInTag = makeMap("slot,component");
|
9880 | function validateComponentName(name, { isNativeTag }) {
|
9881 | if (isBuiltInTag(name) || isNativeTag(name)) {
|
9882 | warn$1(
|
9883 | "Do not use built-in or reserved HTML elements as component id: " + name
|
9884 | );
|
9885 | }
|
9886 | }
|
9887 | function isStatefulComponent(instance) {
|
9888 | return instance.vnode.shapeFlag & 4;
|
9889 | }
|
9890 | let isInSSRComponentSetup = false;
|
9891 | function setupComponent(instance, isSSR = false, optimized = false) {
|
9892 | isSSR && setInSSRSetupState(isSSR);
|
9893 | const { props, children } = instance.vnode;
|
9894 | const isStateful = isStatefulComponent(instance);
|
9895 | initProps(instance, props, isStateful, isSSR);
|
9896 | initSlots(instance, children, optimized);
|
9897 | const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
9898 | isSSR && setInSSRSetupState(false);
|
9899 | return setupResult;
|
9900 | }
|
9901 | function setupStatefulComponent(instance, isSSR) {
|
9902 | var _a;
|
9903 | const Component = instance.type;
|
9904 | {
|
9905 | if (Component.name) {
|
9906 | validateComponentName(Component.name, instance.appContext.config);
|
9907 | }
|
9908 | if (Component.components) {
|
9909 | const names = Object.keys(Component.components);
|
9910 | for (let i = 0; i < names.length; i++) {
|
9911 | validateComponentName(names[i], instance.appContext.config);
|
9912 | }
|
9913 | }
|
9914 | if (Component.directives) {
|
9915 | const names = Object.keys(Component.directives);
|
9916 | for (let i = 0; i < names.length; i++) {
|
9917 | validateDirectiveName(names[i]);
|
9918 | }
|
9919 | }
|
9920 | if (Component.compilerOptions && isRuntimeOnly()) {
|
9921 | warn$1(
|
9922 | `"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.`
|
9923 | );
|
9924 | }
|
9925 | }
|
9926 | instance.accessCache = Object.create(null);
|
9927 | instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
9928 | {
|
9929 | exposePropsOnRenderContext(instance);
|
9930 | }
|
9931 | const { setup } = Component;
|
9932 | if (setup) {
|
9933 | pauseTracking();
|
9934 | const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
9935 | const reset = setCurrentInstance(instance);
|
9936 | const setupResult = callWithErrorHandling(
|
9937 | setup,
|
9938 | instance,
|
9939 | 0,
|
9940 | [
|
9941 | shallowReadonly(instance.props) ,
|
9942 | setupContext
|
9943 | ]
|
9944 | );
|
9945 | const isAsyncSetup = isPromise(setupResult);
|
9946 | resetTracking();
|
9947 | reset();
|
9948 | if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
9949 | markAsyncBoundary(instance);
|
9950 | }
|
9951 | if (isAsyncSetup) {
|
9952 | setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
9953 | if (isSSR) {
|
9954 | return setupResult.then((resolvedResult) => {
|
9955 | handleSetupResult(instance, resolvedResult, isSSR);
|
9956 | }).catch((e) => {
|
9957 | handleError(e, instance, 0);
|
9958 | });
|
9959 | } else {
|
9960 | instance.asyncDep = setupResult;
|
9961 | if (!instance.suspense) {
|
9962 | const name = (_a = Component.name) != null ? _a : "Anonymous";
|
9963 | warn$1(
|
9964 | `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.`
|
9965 | );
|
9966 | }
|
9967 | }
|
9968 | } else {
|
9969 | handleSetupResult(instance, setupResult, isSSR);
|
9970 | }
|
9971 | } else {
|
9972 | finishComponentSetup(instance, isSSR);
|
9973 | }
|
9974 | }
|
9975 | function handleSetupResult(instance, setupResult, isSSR) {
|
9976 | if (isFunction(setupResult)) {
|
9977 | {
|
9978 | instance.render = setupResult;
|
9979 | }
|
9980 | } else if (isObject(setupResult)) {
|
9981 | if (isVNode(setupResult)) {
|
9982 | warn$1(
|
9983 | `setup() should not return VNodes directly - return a render function instead.`
|
9984 | );
|
9985 | }
|
9986 | {
|
9987 | instance.devtoolsRawSetupState = setupResult;
|
9988 | }
|
9989 | instance.setupState = proxyRefs(setupResult);
|
9990 | {
|
9991 | exposeSetupStateOnRenderContext(instance);
|
9992 | }
|
9993 | } else if (setupResult !== void 0) {
|
9994 | warn$1(
|
9995 | `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
|
9996 | );
|
9997 | }
|
9998 | finishComponentSetup(instance, isSSR);
|
9999 | }
|
10000 | let compile$1;
|
10001 | let installWithProxy;
|
10002 | function registerRuntimeCompiler(_compile) {
|
10003 | compile$1 = _compile;
|
10004 | installWithProxy = (i) => {
|
10005 | if (i.render._rc) {
|
10006 | i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
|
10007 | }
|
10008 | };
|
10009 | }
|
10010 | const isRuntimeOnly = () => !compile$1;
|
10011 | function finishComponentSetup(instance, isSSR, skipOptions) {
|
10012 | const Component = instance.type;
|
10013 | if (!instance.render) {
|
10014 | if (!isSSR && compile$1 && !Component.render) {
|
10015 | const template = Component.template || resolveMergedOptions(instance).template;
|
10016 | if (template) {
|
10017 | {
|
10018 | startMeasure(instance, `compile`);
|
10019 | }
|
10020 | const { isCustomElement, compilerOptions } = instance.appContext.config;
|
10021 | const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
10022 | const finalCompilerOptions = extend(
|
10023 | extend(
|
10024 | {
|
10025 | isCustomElement,
|
10026 | delimiters
|
10027 | },
|
10028 | compilerOptions
|
10029 | ),
|
10030 | componentCompilerOptions
|
10031 | );
|
10032 | Component.render = compile$1(template, finalCompilerOptions);
|
10033 | {
|
10034 | endMeasure(instance, `compile`);
|
10035 | }
|
10036 | }
|
10037 | }
|
10038 | instance.render = Component.render || NOOP;
|
10039 | if (installWithProxy) {
|
10040 | installWithProxy(instance);
|
10041 | }
|
10042 | }
|
10043 | {
|
10044 | const reset = setCurrentInstance(instance);
|
10045 | pauseTracking();
|
10046 | try {
|
10047 | applyOptions(instance);
|
10048 | } finally {
|
10049 | resetTracking();
|
10050 | reset();
|
10051 | }
|
10052 | }
|
10053 | if (!Component.render && instance.render === NOOP && !isSSR) {
|
10054 | if (!compile$1 && Component.template) {
|
10055 | warn$1(
|
10056 | `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
10057 | );
|
10058 | } else {
|
10059 | warn$1(`Component is missing template or render function: `, Component);
|
10060 | }
|
10061 | }
|
10062 | }
|
10063 | const attrsProxyHandlers = {
|
10064 | get(target, key) {
|
10065 | markAttrsAccessed();
|
10066 | track(target, "get", "");
|
10067 | return target[key];
|
10068 | },
|
10069 | set() {
|
10070 | warn$1(`setupContext.attrs is readonly.`);
|
10071 | return false;
|
10072 | },
|
10073 | deleteProperty() {
|
10074 | warn$1(`setupContext.attrs is readonly.`);
|
10075 | return false;
|
10076 | }
|
10077 | } ;
|
10078 | function getSlotsProxy(instance) {
|
10079 | return new Proxy(instance.slots, {
|
10080 | get(target, key) {
|
10081 | track(instance, "get", "$slots");
|
10082 | return target[key];
|
10083 | }
|
10084 | });
|
10085 | }
|
10086 | function createSetupContext(instance) {
|
10087 | const expose = (exposed) => {
|
10088 | {
|
10089 | if (instance.exposed) {
|
10090 | warn$1(`expose() should be called only once per setup().`);
|
10091 | }
|
10092 | if (exposed != null) {
|
10093 | let exposedType = typeof exposed;
|
10094 | if (exposedType === "object") {
|
10095 | if (isArray(exposed)) {
|
10096 | exposedType = "array";
|
10097 | } else if (isRef(exposed)) {
|
10098 | exposedType = "ref";
|
10099 | }
|
10100 | }
|
10101 | if (exposedType !== "object") {
|
10102 | warn$1(
|
10103 | `expose() should be passed a plain object, received ${exposedType}.`
|
10104 | );
|
10105 | }
|
10106 | }
|
10107 | }
|
10108 | instance.exposed = exposed || {};
|
10109 | };
|
10110 | {
|
10111 | let attrsProxy;
|
10112 | let slotsProxy;
|
10113 | return Object.freeze({
|
10114 | get attrs() {
|
10115 | return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
|
10116 | },
|
10117 | get slots() {
|
10118 | return slotsProxy || (slotsProxy = getSlotsProxy(instance));
|
10119 | },
|
10120 | get emit() {
|
10121 | return (event, ...args) => instance.emit(event, ...args);
|
10122 | },
|
10123 | expose
|
10124 | });
|
10125 | }
|
10126 | }
|
10127 | function getComponentPublicInstance(instance) {
|
10128 | if (instance.exposed) {
|
10129 | return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
10130 | get(target, key) {
|
10131 | if (key in target) {
|
10132 | return target[key];
|
10133 | } else if (key in publicPropertiesMap) {
|
10134 | return publicPropertiesMap[key](instance);
|
10135 | }
|
10136 | },
|
10137 | has(target, key) {
|
10138 | return key in target || key in publicPropertiesMap;
|
10139 | }
|
10140 | }));
|
10141 | } else {
|
10142 | return instance.proxy;
|
10143 | }
|
10144 | }
|
10145 | const classifyRE = /(?:^|[-_])(\w)/g;
|
10146 | const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
10147 | function getComponentName(Component, includeInferred = true) {
|
10148 | return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
10149 | }
|
10150 | function formatComponentName(instance, Component, isRoot = false) {
|
10151 | let name = getComponentName(Component);
|
10152 | if (!name && Component.__file) {
|
10153 | const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
10154 | if (match) {
|
10155 | name = match[1];
|
10156 | }
|
10157 | }
|
10158 | if (!name && instance && instance.parent) {
|
10159 | const inferFromRegistry = (registry) => {
|
10160 | for (const key in registry) {
|
10161 | if (registry[key] === Component) {
|
10162 | return key;
|
10163 | }
|
10164 | }
|
10165 | };
|
10166 | name = inferFromRegistry(
|
10167 | instance.components || instance.parent.type.components
|
10168 | ) || inferFromRegistry(instance.appContext.components);
|
10169 | }
|
10170 | return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
10171 | }
|
10172 | function isClassComponent(value) {
|
10173 | return isFunction(value) && "__vccOpts" in value;
|
10174 | }
|
10175 |
|
10176 | const computed = (getterOrOptions, debugOptions) => {
|
10177 | const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
10178 | {
|
10179 | const i = getCurrentInstance();
|
10180 | if (i && i.appContext.config.warnRecursiveComputed) {
|
10181 | c._warnRecursive = true;
|
10182 | }
|
10183 | }
|
10184 | return c;
|
10185 | };
|
10186 |
|
10187 | function h(type, propsOrChildren, children) {
|
10188 | const l = arguments.length;
|
10189 | if (l === 2) {
|
10190 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
10191 | if (isVNode(propsOrChildren)) {
|
10192 | return createVNode(type, null, [propsOrChildren]);
|
10193 | }
|
10194 | return createVNode(type, propsOrChildren);
|
10195 | } else {
|
10196 | return createVNode(type, null, propsOrChildren);
|
10197 | }
|
10198 | } else {
|
10199 | if (l > 3) {
|
10200 | children = Array.prototype.slice.call(arguments, 2);
|
10201 | } else if (l === 3 && isVNode(children)) {
|
10202 | children = [children];
|
10203 | }
|
10204 | return createVNode(type, propsOrChildren, children);
|
10205 | }
|
10206 | }
|
10207 |
|
10208 | function initCustomFormatter() {
|
10209 | if (typeof window === "undefined") {
|
10210 | return;
|
10211 | }
|
10212 | const vueStyle = { style: "color:#3ba776" };
|
10213 | const numberStyle = { style: "color:#1677ff" };
|
10214 | const stringStyle = { style: "color:#f5222d" };
|
10215 | const keywordStyle = { style: "color:#eb2f96" };
|
10216 | const formatter = {
|
10217 | __vue_custom_formatter: true,
|
10218 | header(obj) {
|
10219 | if (!isObject(obj)) {
|
10220 | return null;
|
10221 | }
|
10222 | if (obj.__isVue) {
|
10223 | return ["div", vueStyle, `VueInstance`];
|
10224 | } else if (isRef(obj)) {
|
10225 | return [
|
10226 | "div",
|
10227 | {},
|
10228 | ["span", vueStyle, genRefFlag(obj)],
|
10229 | "<",
|
10230 |
|
10231 | formatValue("_value" in obj ? obj._value : obj),
|
10232 | `>`
|
10233 | ];
|
10234 | } else if (isReactive(obj)) {
|
10235 | return [
|
10236 | "div",
|
10237 | {},
|
10238 | ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
10239 | "<",
|
10240 | formatValue(obj),
|
10241 | `>${isReadonly(obj) ? ` (readonly)` : ``}`
|
10242 | ];
|
10243 | } else if (isReadonly(obj)) {
|
10244 | return [
|
10245 | "div",
|
10246 | {},
|
10247 | ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
10248 | "<",
|
10249 | formatValue(obj),
|
10250 | ">"
|
10251 | ];
|
10252 | }
|
10253 | return null;
|
10254 | },
|
10255 | hasBody(obj) {
|
10256 | return obj && obj.__isVue;
|
10257 | },
|
10258 | body(obj) {
|
10259 | if (obj && obj.__isVue) {
|
10260 | return [
|
10261 | "div",
|
10262 | {},
|
10263 | ...formatInstance(obj.$)
|
10264 | ];
|
10265 | }
|
10266 | }
|
10267 | };
|
10268 | function formatInstance(instance) {
|
10269 | const blocks = [];
|
10270 | if (instance.type.props && instance.props) {
|
10271 | blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
10272 | }
|
10273 | if (instance.setupState !== EMPTY_OBJ) {
|
10274 | blocks.push(createInstanceBlock("setup", instance.setupState));
|
10275 | }
|
10276 | if (instance.data !== EMPTY_OBJ) {
|
10277 | blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
10278 | }
|
10279 | const computed = extractKeys(instance, "computed");
|
10280 | if (computed) {
|
10281 | blocks.push(createInstanceBlock("computed", computed));
|
10282 | }
|
10283 | const injected = extractKeys(instance, "inject");
|
10284 | if (injected) {
|
10285 | blocks.push(createInstanceBlock("injected", injected));
|
10286 | }
|
10287 | blocks.push([
|
10288 | "div",
|
10289 | {},
|
10290 | [
|
10291 | "span",
|
10292 | {
|
10293 | style: keywordStyle.style + ";opacity:0.66"
|
10294 | },
|
10295 | "$ (internal): "
|
10296 | ],
|
10297 | ["object", { object: instance }]
|
10298 | ]);
|
10299 | return blocks;
|
10300 | }
|
10301 | function createInstanceBlock(type, target) {
|
10302 | target = extend({}, target);
|
10303 | if (!Object.keys(target).length) {
|
10304 | return ["span", {}];
|
10305 | }
|
10306 | return [
|
10307 | "div",
|
10308 | { style: "line-height:1.25em;margin-bottom:0.6em" },
|
10309 | [
|
10310 | "div",
|
10311 | {
|
10312 | style: "color:#476582"
|
10313 | },
|
10314 | type
|
10315 | ],
|
10316 | [
|
10317 | "div",
|
10318 | {
|
10319 | style: "padding-left:1.25em"
|
10320 | },
|
10321 | ...Object.keys(target).map((key) => {
|
10322 | return [
|
10323 | "div",
|
10324 | {},
|
10325 | ["span", keywordStyle, key + ": "],
|
10326 | formatValue(target[key], false)
|
10327 | ];
|
10328 | })
|
10329 | ]
|
10330 | ];
|
10331 | }
|
10332 | function formatValue(v, asRaw = true) {
|
10333 | if (typeof v === "number") {
|
10334 | return ["span", numberStyle, v];
|
10335 | } else if (typeof v === "string") {
|
10336 | return ["span", stringStyle, JSON.stringify(v)];
|
10337 | } else if (typeof v === "boolean") {
|
10338 | return ["span", keywordStyle, v];
|
10339 | } else if (isObject(v)) {
|
10340 | return ["object", { object: asRaw ? toRaw(v) : v }];
|
10341 | } else {
|
10342 | return ["span", stringStyle, String(v)];
|
10343 | }
|
10344 | }
|
10345 | function extractKeys(instance, type) {
|
10346 | const Comp = instance.type;
|
10347 | if (isFunction(Comp)) {
|
10348 | return;
|
10349 | }
|
10350 | const extracted = {};
|
10351 | for (const key in instance.ctx) {
|
10352 | if (isKeyOfType(Comp, key, type)) {
|
10353 | extracted[key] = instance.ctx[key];
|
10354 | }
|
10355 | }
|
10356 | return extracted;
|
10357 | }
|
10358 | function isKeyOfType(Comp, key, type) {
|
10359 | const opts = Comp[type];
|
10360 | if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
10361 | return true;
|
10362 | }
|
10363 | if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
10364 | return true;
|
10365 | }
|
10366 | if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
10367 | return true;
|
10368 | }
|
10369 | }
|
10370 | function genRefFlag(v) {
|
10371 | if (isShallow(v)) {
|
10372 | return `ShallowRef`;
|
10373 | }
|
10374 | if (v.effect) {
|
10375 | return `ComputedRef`;
|
10376 | }
|
10377 | return `Ref`;
|
10378 | }
|
10379 | if (window.devtoolsFormatters) {
|
10380 | window.devtoolsFormatters.push(formatter);
|
10381 | } else {
|
10382 | window.devtoolsFormatters = [formatter];
|
10383 | }
|
10384 | }
|
10385 |
|
10386 | function withMemo(memo, render, cache, index) {
|
10387 | const cached = cache[index];
|
10388 | if (cached && isMemoSame(cached, memo)) {
|
10389 | return cached;
|
10390 | }
|
10391 | const ret = render();
|
10392 | ret.memo = memo.slice();
|
10393 | ret.cacheIndex = index;
|
10394 | return cache[index] = ret;
|
10395 | }
|
10396 | function isMemoSame(cached, memo) {
|
10397 | const prev = cached.memo;
|
10398 | if (prev.length != memo.length) {
|
10399 | return false;
|
10400 | }
|
10401 | for (let i = 0; i < prev.length; i++) {
|
10402 | if (hasChanged(prev[i], memo[i])) {
|
10403 | return false;
|
10404 | }
|
10405 | }
|
10406 | if (isBlockTreeEnabled > 0 && currentBlock) {
|
10407 | currentBlock.push(cached);
|
10408 | }
|
10409 | return true;
|
10410 | }
|
10411 |
|
10412 | const version = "3.5.13";
|
10413 | const warn = warn$1 ;
|
10414 | const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
10415 | const devtools = devtools$1 ;
|
10416 | const setDevtoolsHook = setDevtoolsHook$1 ;
|
10417 | const ssrUtils = null;
|
10418 | const resolveFilter = null;
|
10419 | const compatUtils = null;
|
10420 | const DeprecationTypes = null;
|
10421 |
|
10422 | let policy = void 0;
|
10423 | const tt = typeof window !== "undefined" && window.trustedTypes;
|
10424 | if (tt) {
|
10425 | try {
|
10426 | policy = tt.createPolicy("vue", {
|
10427 | createHTML: (val) => val
|
10428 | });
|
10429 | } catch (e) {
|
10430 | warn(`Error creating trusted types policy: ${e}`);
|
10431 | }
|
10432 | }
|
10433 | const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
|
10434 | const svgNS = "http://www.w3.org/2000/svg";
|
10435 | const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
10436 | const doc = typeof document !== "undefined" ? document : null;
|
10437 | const templateContainer = doc && doc.createElement("template");
|
10438 | const nodeOps = {
|
10439 | insert: (child, parent, anchor) => {
|
10440 | parent.insertBefore(child, anchor || null);
|
10441 | },
|
10442 | remove: (child) => {
|
10443 | const parent = child.parentNode;
|
10444 | if (parent) {
|
10445 | parent.removeChild(child);
|
10446 | }
|
10447 | },
|
10448 | createElement: (tag, namespace, is, props) => {
|
10449 | const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
|
10450 | if (tag === "select" && props && props.multiple != null) {
|
10451 | el.setAttribute("multiple", props.multiple);
|
10452 | }
|
10453 | return el;
|
10454 | },
|
10455 | createText: (text) => doc.createTextNode(text),
|
10456 | createComment: (text) => doc.createComment(text),
|
10457 | setText: (node, text) => {
|
10458 | node.nodeValue = text;
|
10459 | },
|
10460 | setElementText: (el, text) => {
|
10461 | el.textContent = text;
|
10462 | },
|
10463 | parentNode: (node) => node.parentNode,
|
10464 | nextSibling: (node) => node.nextSibling,
|
10465 | querySelector: (selector) => doc.querySelector(selector),
|
10466 | setScopeId(el, id) {
|
10467 | el.setAttribute(id, "");
|
10468 | },
|
10469 |
|
10470 |
|
10471 |
|
10472 |
|
10473 | insertStaticContent(content, parent, anchor, namespace, start, end) {
|
10474 | const before = anchor ? anchor.previousSibling : parent.lastChild;
|
10475 | if (start && (start === end || start.nextSibling)) {
|
10476 | while (true) {
|
10477 | parent.insertBefore(start.cloneNode(true), anchor);
|
10478 | if (start === end || !(start = start.nextSibling)) break;
|
10479 | }
|
10480 | } else {
|
10481 | templateContainer.innerHTML = unsafeToTrustedHTML(
|
10482 | namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
|
10483 | );
|
10484 | const template = templateContainer.content;
|
10485 | if (namespace === "svg" || namespace === "mathml") {
|
10486 | const wrapper = template.firstChild;
|
10487 | while (wrapper.firstChild) {
|
10488 | template.appendChild(wrapper.firstChild);
|
10489 | }
|
10490 | template.removeChild(wrapper);
|
10491 | }
|
10492 | parent.insertBefore(template, anchor);
|
10493 | }
|
10494 | return [
|
10495 |
|
10496 | before ? before.nextSibling : parent.firstChild,
|
10497 |
|
10498 | anchor ? anchor.previousSibling : parent.lastChild
|
10499 | ];
|
10500 | }
|
10501 | };
|
10502 |
|
10503 | const TRANSITION = "transition";
|
10504 | const ANIMATION = "animation";
|
10505 | const vtcKey = Symbol("_vtc");
|
10506 | const DOMTransitionPropsValidators = {
|
10507 | name: String,
|
10508 | type: String,
|
10509 | css: {
|
10510 | type: Boolean,
|
10511 | default: true
|
10512 | },
|
10513 | duration: [String, Number, Object],
|
10514 | enterFromClass: String,
|
10515 | enterActiveClass: String,
|
10516 | enterToClass: String,
|
10517 | appearFromClass: String,
|
10518 | appearActiveClass: String,
|
10519 | appearToClass: String,
|
10520 | leaveFromClass: String,
|
10521 | leaveActiveClass: String,
|
10522 | leaveToClass: String
|
10523 | };
|
10524 | const TransitionPropsValidators = extend(
|
10525 | {},
|
10526 | BaseTransitionPropsValidators,
|
10527 | DOMTransitionPropsValidators
|
10528 | );
|
10529 | const decorate$1 = (t) => {
|
10530 | t.displayName = "Transition";
|
10531 | t.props = TransitionPropsValidators;
|
10532 | return t;
|
10533 | };
|
10534 | const Transition = decorate$1(
|
10535 | (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
|
10536 | );
|
10537 | const callHook = (hook, args = []) => {
|
10538 | if (isArray(hook)) {
|
10539 | hook.forEach((h2) => h2(...args));
|
10540 | } else if (hook) {
|
10541 | hook(...args);
|
10542 | }
|
10543 | };
|
10544 | const hasExplicitCallback = (hook) => {
|
10545 | return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
|
10546 | };
|
10547 | function resolveTransitionProps(rawProps) {
|
10548 | const baseProps = {};
|
10549 | for (const key in rawProps) {
|
10550 | if (!(key in DOMTransitionPropsValidators)) {
|
10551 | baseProps[key] = rawProps[key];
|
10552 | }
|
10553 | }
|
10554 | if (rawProps.css === false) {
|
10555 | return baseProps;
|
10556 | }
|
10557 | const {
|
10558 | name = "v",
|
10559 | type,
|
10560 | duration,
|
10561 | enterFromClass = `${name}-enter-from`,
|
10562 | enterActiveClass = `${name}-enter-active`,
|
10563 | enterToClass = `${name}-enter-to`,
|
10564 | appearFromClass = enterFromClass,
|
10565 | appearActiveClass = enterActiveClass,
|
10566 | appearToClass = enterToClass,
|
10567 | leaveFromClass = `${name}-leave-from`,
|
10568 | leaveActiveClass = `${name}-leave-active`,
|
10569 | leaveToClass = `${name}-leave-to`
|
10570 | } = rawProps;
|
10571 | const durations = normalizeDuration(duration);
|
10572 | const enterDuration = durations && durations[0];
|
10573 | const leaveDuration = durations && durations[1];
|
10574 | const {
|
10575 | onBeforeEnter,
|
10576 | onEnter,
|
10577 | onEnterCancelled,
|
10578 | onLeave,
|
10579 | onLeaveCancelled,
|
10580 | onBeforeAppear = onBeforeEnter,
|
10581 | onAppear = onEnter,
|
10582 | onAppearCancelled = onEnterCancelled
|
10583 | } = baseProps;
|
10584 | const finishEnter = (el, isAppear, done, isCancelled) => {
|
10585 | el._enterCancelled = isCancelled;
|
10586 | removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
10587 | removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
10588 | done && done();
|
10589 | };
|
10590 | const finishLeave = (el, done) => {
|
10591 | el._isLeaving = false;
|
10592 | removeTransitionClass(el, leaveFromClass);
|
10593 | removeTransitionClass(el, leaveToClass);
|
10594 | removeTransitionClass(el, leaveActiveClass);
|
10595 | done && done();
|
10596 | };
|
10597 | const makeEnterHook = (isAppear) => {
|
10598 | return (el, done) => {
|
10599 | const hook = isAppear ? onAppear : onEnter;
|
10600 | const resolve = () => finishEnter(el, isAppear, done);
|
10601 | callHook(hook, [el, resolve]);
|
10602 | nextFrame(() => {
|
10603 | removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
10604 | addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
10605 | if (!hasExplicitCallback(hook)) {
|
10606 | whenTransitionEnds(el, type, enterDuration, resolve);
|
10607 | }
|
10608 | });
|
10609 | };
|
10610 | };
|
10611 | return extend(baseProps, {
|
10612 | onBeforeEnter(el) {
|
10613 | callHook(onBeforeEnter, [el]);
|
10614 | addTransitionClass(el, enterFromClass);
|
10615 | addTransitionClass(el, enterActiveClass);
|
10616 | },
|
10617 | onBeforeAppear(el) {
|
10618 | callHook(onBeforeAppear, [el]);
|
10619 | addTransitionClass(el, appearFromClass);
|
10620 | addTransitionClass(el, appearActiveClass);
|
10621 | },
|
10622 | onEnter: makeEnterHook(false),
|
10623 | onAppear: makeEnterHook(true),
|
10624 | onLeave(el, done) {
|
10625 | el._isLeaving = true;
|
10626 | const resolve = () => finishLeave(el, done);
|
10627 | addTransitionClass(el, leaveFromClass);
|
10628 | if (!el._enterCancelled) {
|
10629 | forceReflow();
|
10630 | addTransitionClass(el, leaveActiveClass);
|
10631 | } else {
|
10632 | addTransitionClass(el, leaveActiveClass);
|
10633 | forceReflow();
|
10634 | }
|
10635 | nextFrame(() => {
|
10636 | if (!el._isLeaving) {
|
10637 | return;
|
10638 | }
|
10639 | removeTransitionClass(el, leaveFromClass);
|
10640 | addTransitionClass(el, leaveToClass);
|
10641 | if (!hasExplicitCallback(onLeave)) {
|
10642 | whenTransitionEnds(el, type, leaveDuration, resolve);
|
10643 | }
|
10644 | });
|
10645 | callHook(onLeave, [el, resolve]);
|
10646 | },
|
10647 | onEnterCancelled(el) {
|
10648 | finishEnter(el, false, void 0, true);
|
10649 | callHook(onEnterCancelled, [el]);
|
10650 | },
|
10651 | onAppearCancelled(el) {
|
10652 | finishEnter(el, true, void 0, true);
|
10653 | callHook(onAppearCancelled, [el]);
|
10654 | },
|
10655 | onLeaveCancelled(el) {
|
10656 | finishLeave(el);
|
10657 | callHook(onLeaveCancelled, [el]);
|
10658 | }
|
10659 | });
|
10660 | }
|
10661 | function normalizeDuration(duration) {
|
10662 | if (duration == null) {
|
10663 | return null;
|
10664 | } else if (isObject(duration)) {
|
10665 | return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
10666 | } else {
|
10667 | const n = NumberOf(duration);
|
10668 | return [n, n];
|
10669 | }
|
10670 | }
|
10671 | function NumberOf(val) {
|
10672 | const res = toNumber(val);
|
10673 | {
|
10674 | assertNumber(res, "<transition> explicit duration");
|
10675 | }
|
10676 | return res;
|
10677 | }
|
10678 | function addTransitionClass(el, cls) {
|
10679 | cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
|
10680 | (el[vtcKey] || (el[vtcKey] = new Set())).add(cls);
|
10681 | }
|
10682 | function removeTransitionClass(el, cls) {
|
10683 | cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
|
10684 | const _vtc = el[vtcKey];
|
10685 | if (_vtc) {
|
10686 | _vtc.delete(cls);
|
10687 | if (!_vtc.size) {
|
10688 | el[vtcKey] = void 0;
|
10689 | }
|
10690 | }
|
10691 | }
|
10692 | function nextFrame(cb) {
|
10693 | requestAnimationFrame(() => {
|
10694 | requestAnimationFrame(cb);
|
10695 | });
|
10696 | }
|
10697 | let endId = 0;
|
10698 | function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
|
10699 | const id = el._endId = ++endId;
|
10700 | const resolveIfNotStale = () => {
|
10701 | if (id === el._endId) {
|
10702 | resolve();
|
10703 | }
|
10704 | };
|
10705 | if (explicitTimeout != null) {
|
10706 | return setTimeout(resolveIfNotStale, explicitTimeout);
|
10707 | }
|
10708 | const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
|
10709 | if (!type) {
|
10710 | return resolve();
|
10711 | }
|
10712 | const endEvent = type + "end";
|
10713 | let ended = 0;
|
10714 | const end = () => {
|
10715 | el.removeEventListener(endEvent, onEnd);
|
10716 | resolveIfNotStale();
|
10717 | };
|
10718 | const onEnd = (e) => {
|
10719 | if (e.target === el && ++ended >= propCount) {
|
10720 | end();
|
10721 | }
|
10722 | };
|
10723 | setTimeout(() => {
|
10724 | if (ended < propCount) {
|
10725 | end();
|
10726 | }
|
10727 | }, timeout + 1);
|
10728 | el.addEventListener(endEvent, onEnd);
|
10729 | }
|
10730 | function getTransitionInfo(el, expectedType) {
|
10731 | const styles = window.getComputedStyle(el);
|
10732 | const getStyleProperties = (key) => (styles[key] || "").split(", ");
|
10733 | const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
|
10734 | const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
|
10735 | const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
10736 | const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
|
10737 | const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
|
10738 | const animationTimeout = getTimeout(animationDelays, animationDurations);
|
10739 | let type = null;
|
10740 | let timeout = 0;
|
10741 | let propCount = 0;
|
10742 | if (expectedType === TRANSITION) {
|
10743 | if (transitionTimeout > 0) {
|
10744 | type = TRANSITION;
|
10745 | timeout = transitionTimeout;
|
10746 | propCount = transitionDurations.length;
|
10747 | }
|
10748 | } else if (expectedType === ANIMATION) {
|
10749 | if (animationTimeout > 0) {
|
10750 | type = ANIMATION;
|
10751 | timeout = animationTimeout;
|
10752 | propCount = animationDurations.length;
|
10753 | }
|
10754 | } else {
|
10755 | timeout = Math.max(transitionTimeout, animationTimeout);
|
10756 | type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
10757 | propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
10758 | }
|
10759 | const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
|
10760 | getStyleProperties(`${TRANSITION}Property`).toString()
|
10761 | );
|
10762 | return {
|
10763 | type,
|
10764 | timeout,
|
10765 | propCount,
|
10766 | hasTransform
|
10767 | };
|
10768 | }
|
10769 | function getTimeout(delays, durations) {
|
10770 | while (delays.length < durations.length) {
|
10771 | delays = delays.concat(delays);
|
10772 | }
|
10773 | return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
|
10774 | }
|
10775 | function toMs(s) {
|
10776 | if (s === "auto") return 0;
|
10777 | return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
10778 | }
|
10779 | function forceReflow() {
|
10780 | return document.body.offsetHeight;
|
10781 | }
|
10782 |
|
10783 | function patchClass(el, value, isSVG) {
|
10784 | const transitionClasses = el[vtcKey];
|
10785 | if (transitionClasses) {
|
10786 | value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
|
10787 | }
|
10788 | if (value == null) {
|
10789 | el.removeAttribute("class");
|
10790 | } else if (isSVG) {
|
10791 | el.setAttribute("class", value);
|
10792 | } else {
|
10793 | el.className = value;
|
10794 | }
|
10795 | }
|
10796 |
|
10797 | const vShowOriginalDisplay = Symbol("_vod");
|
10798 | const vShowHidden = Symbol("_vsh");
|
10799 | const vShow = {
|
10800 | beforeMount(el, { value }, { transition }) {
|
10801 | el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
10802 | if (transition && value) {
|
10803 | transition.beforeEnter(el);
|
10804 | } else {
|
10805 | setDisplay(el, value);
|
10806 | }
|
10807 | },
|
10808 | mounted(el, { value }, { transition }) {
|
10809 | if (transition && value) {
|
10810 | transition.enter(el);
|
10811 | }
|
10812 | },
|
10813 | updated(el, { value, oldValue }, { transition }) {
|
10814 | if (!value === !oldValue) return;
|
10815 | if (transition) {
|
10816 | if (value) {
|
10817 | transition.beforeEnter(el);
|
10818 | setDisplay(el, true);
|
10819 | transition.enter(el);
|
10820 | } else {
|
10821 | transition.leave(el, () => {
|
10822 | setDisplay(el, false);
|
10823 | });
|
10824 | }
|
10825 | } else {
|
10826 | setDisplay(el, value);
|
10827 | }
|
10828 | },
|
10829 | beforeUnmount(el, { value }) {
|
10830 | setDisplay(el, value);
|
10831 | }
|
10832 | };
|
10833 | {
|
10834 | vShow.name = "show";
|
10835 | }
|
10836 | function setDisplay(el, value) {
|
10837 | el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
10838 | el[vShowHidden] = !value;
|
10839 | }
|
10840 |
|
10841 | const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
|
10842 | function useCssVars(getter) {
|
10843 | const instance = getCurrentInstance();
|
10844 | if (!instance) {
|
10845 | warn(`useCssVars is called without current active component instance.`);
|
10846 | return;
|
10847 | }
|
10848 | const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
|
10849 | Array.from(
|
10850 | document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
|
10851 | ).forEach((node) => setVarsOnNode(node, vars));
|
10852 | };
|
10853 | {
|
10854 | instance.getCssVars = () => getter(instance.proxy);
|
10855 | }
|
10856 | const setVars = () => {
|
10857 | const vars = getter(instance.proxy);
|
10858 | if (instance.ce) {
|
10859 | setVarsOnNode(instance.ce, vars);
|
10860 | } else {
|
10861 | setVarsOnVNode(instance.subTree, vars);
|
10862 | }
|
10863 | updateTeleports(vars);
|
10864 | };
|
10865 | onBeforeUpdate(() => {
|
10866 | queuePostFlushCb(setVars);
|
10867 | });
|
10868 | onMounted(() => {
|
10869 | watch(setVars, NOOP, { flush: "post" });
|
10870 | const ob = new MutationObserver(setVars);
|
10871 | ob.observe(instance.subTree.el.parentNode, { childList: true });
|
10872 | onUnmounted(() => ob.disconnect());
|
10873 | });
|
10874 | }
|
10875 | function setVarsOnVNode(vnode, vars) {
|
10876 | if (vnode.shapeFlag & 128) {
|
10877 | const suspense = vnode.suspense;
|
10878 | vnode = suspense.activeBranch;
|
10879 | if (suspense.pendingBranch && !suspense.isHydrating) {
|
10880 | suspense.effects.push(() => {
|
10881 | setVarsOnVNode(suspense.activeBranch, vars);
|
10882 | });
|
10883 | }
|
10884 | }
|
10885 | while (vnode.component) {
|
10886 | vnode = vnode.component.subTree;
|
10887 | }
|
10888 | if (vnode.shapeFlag & 1 && vnode.el) {
|
10889 | setVarsOnNode(vnode.el, vars);
|
10890 | } else if (vnode.type === Fragment) {
|
10891 | vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
10892 | } else if (vnode.type === Static) {
|
10893 | let { el, anchor } = vnode;
|
10894 | while (el) {
|
10895 | setVarsOnNode(el, vars);
|
10896 | if (el === anchor) break;
|
10897 | el = el.nextSibling;
|
10898 | }
|
10899 | }
|
10900 | }
|
10901 | function setVarsOnNode(el, vars) {
|
10902 | if (el.nodeType === 1) {
|
10903 | const style = el.style;
|
10904 | let cssText = "";
|
10905 | for (const key in vars) {
|
10906 | style.setProperty(`--${key}`, vars[key]);
|
10907 | cssText += `--${key}: ${vars[key]};`;
|
10908 | }
|
10909 | style[CSS_VAR_TEXT] = cssText;
|
10910 | }
|
10911 | }
|
10912 |
|
10913 | const displayRE = /(^|;)\s*display\s*:/;
|
10914 | function patchStyle(el, prev, next) {
|
10915 | const style = el.style;
|
10916 | const isCssString = isString(next);
|
10917 | let hasControlledDisplay = false;
|
10918 | if (next && !isCssString) {
|
10919 | if (prev) {
|
10920 | if (!isString(prev)) {
|
10921 | for (const key in prev) {
|
10922 | if (next[key] == null) {
|
10923 | setStyle(style, key, "");
|
10924 | }
|
10925 | }
|
10926 | } else {
|
10927 | for (const prevStyle of prev.split(";")) {
|
10928 | const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
10929 | if (next[key] == null) {
|
10930 | setStyle(style, key, "");
|
10931 | }
|
10932 | }
|
10933 | }
|
10934 | }
|
10935 | for (const key in next) {
|
10936 | if (key === "display") {
|
10937 | hasControlledDisplay = true;
|
10938 | }
|
10939 | setStyle(style, key, next[key]);
|
10940 | }
|
10941 | } else {
|
10942 | if (isCssString) {
|
10943 | if (prev !== next) {
|
10944 | const cssVarText = style[CSS_VAR_TEXT];
|
10945 | if (cssVarText) {
|
10946 | next += ";" + cssVarText;
|
10947 | }
|
10948 | style.cssText = next;
|
10949 | hasControlledDisplay = displayRE.test(next);
|
10950 | }
|
10951 | } else if (prev) {
|
10952 | el.removeAttribute("style");
|
10953 | }
|
10954 | }
|
10955 | if (vShowOriginalDisplay in el) {
|
10956 | el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
10957 | if (el[vShowHidden]) {
|
10958 | style.display = "none";
|
10959 | }
|
10960 | }
|
10961 | }
|
10962 | const semicolonRE = /[^\\];\s*$/;
|
10963 | const importantRE = /\s*!important$/;
|
10964 | function setStyle(style, name, val) {
|
10965 | if (isArray(val)) {
|
10966 | val.forEach((v) => setStyle(style, name, v));
|
10967 | } else {
|
10968 | if (val == null) val = "";
|
10969 | {
|
10970 | if (semicolonRE.test(val)) {
|
10971 | warn(
|
10972 | `Unexpected semicolon at the end of '${name}' style value: '${val}'`
|
10973 | );
|
10974 | }
|
10975 | }
|
10976 | if (name.startsWith("--")) {
|
10977 | style.setProperty(name, val);
|
10978 | } else {
|
10979 | const prefixed = autoPrefix(style, name);
|
10980 | if (importantRE.test(val)) {
|
10981 | style.setProperty(
|
10982 | hyphenate(prefixed),
|
10983 | val.replace(importantRE, ""),
|
10984 | "important"
|
10985 | );
|
10986 | } else {
|
10987 | style[prefixed] = val;
|
10988 | }
|
10989 | }
|
10990 | }
|
10991 | }
|
10992 | const prefixes = ["Webkit", "Moz", "ms"];
|
10993 | const prefixCache = {};
|
10994 | function autoPrefix(style, rawName) {
|
10995 | const cached = prefixCache[rawName];
|
10996 | if (cached) {
|
10997 | return cached;
|
10998 | }
|
10999 | let name = camelize(rawName);
|
11000 | if (name !== "filter" && name in style) {
|
11001 | return prefixCache[rawName] = name;
|
11002 | }
|
11003 | name = capitalize(name);
|
11004 | for (let i = 0; i < prefixes.length; i++) {
|
11005 | const prefixed = prefixes[i] + name;
|
11006 | if (prefixed in style) {
|
11007 | return prefixCache[rawName] = prefixed;
|
11008 | }
|
11009 | }
|
11010 | return rawName;
|
11011 | }
|
11012 |
|
11013 | const xlinkNS = "http://www.w3.org/1999/xlink";
|
11014 | function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
|
11015 | if (isSVG && key.startsWith("xlink:")) {
|
11016 | if (value == null) {
|
11017 | el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
11018 | } else {
|
11019 | el.setAttributeNS(xlinkNS, key, value);
|
11020 | }
|
11021 | } else {
|
11022 | if (value == null || isBoolean && !includeBooleanAttr(value)) {
|
11023 | el.removeAttribute(key);
|
11024 | } else {
|
11025 | el.setAttribute(
|
11026 | key,
|
11027 | isBoolean ? "" : isSymbol(value) ? String(value) : value
|
11028 | );
|
11029 | }
|
11030 | }
|
11031 | }
|
11032 |
|
11033 | function patchDOMProp(el, key, value, parentComponent, attrName) {
|
11034 | if (key === "innerHTML" || key === "textContent") {
|
11035 | if (value != null) {
|
11036 | el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
|
11037 | }
|
11038 | return;
|
11039 | }
|
11040 | const tag = el.tagName;
|
11041 | if (key === "value" && tag !== "PROGRESS" &&
|
11042 | !tag.includes("-")) {
|
11043 | const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
|
11044 | const newValue = value == null ? (
|
11045 |
|
11046 |
|
11047 | el.type === "checkbox" ? "on" : ""
|
11048 | ) : String(value);
|
11049 | if (oldValue !== newValue || !("_value" in el)) {
|
11050 | el.value = newValue;
|
11051 | }
|
11052 | if (value == null) {
|
11053 | el.removeAttribute(key);
|
11054 | }
|
11055 | el._value = value;
|
11056 | return;
|
11057 | }
|
11058 | let needRemove = false;
|
11059 | if (value === "" || value == null) {
|
11060 | const type = typeof el[key];
|
11061 | if (type === "boolean") {
|
11062 | value = includeBooleanAttr(value);
|
11063 | } else if (value == null && type === "string") {
|
11064 | value = "";
|
11065 | needRemove = true;
|
11066 | } else if (type === "number") {
|
11067 | value = 0;
|
11068 | needRemove = true;
|
11069 | }
|
11070 | }
|
11071 | try {
|
11072 | el[key] = value;
|
11073 | } catch (e) {
|
11074 | if (!needRemove) {
|
11075 | warn(
|
11076 | `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
|
11077 | e
|
11078 | );
|
11079 | }
|
11080 | }
|
11081 | needRemove && el.removeAttribute(attrName || key);
|
11082 | }
|
11083 |
|
11084 | function addEventListener(el, event, handler, options) {
|
11085 | el.addEventListener(event, handler, options);
|
11086 | }
|
11087 | function removeEventListener(el, event, handler, options) {
|
11088 | el.removeEventListener(event, handler, options);
|
11089 | }
|
11090 | const veiKey = Symbol("_vei");
|
11091 | function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
11092 | const invokers = el[veiKey] || (el[veiKey] = {});
|
11093 | const existingInvoker = invokers[rawName];
|
11094 | if (nextValue && existingInvoker) {
|
11095 | existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
|
11096 | } else {
|
11097 | const [name, options] = parseName(rawName);
|
11098 | if (nextValue) {
|
11099 | const invoker = invokers[rawName] = createInvoker(
|
11100 | sanitizeEventValue(nextValue, rawName) ,
|
11101 | instance
|
11102 | );
|
11103 | addEventListener(el, name, invoker, options);
|
11104 | } else if (existingInvoker) {
|
11105 | removeEventListener(el, name, existingInvoker, options);
|
11106 | invokers[rawName] = void 0;
|
11107 | }
|
11108 | }
|
11109 | }
|
11110 | const optionsModifierRE = /(?:Once|Passive|Capture)$/;
|
11111 | function parseName(name) {
|
11112 | let options;
|
11113 | if (optionsModifierRE.test(name)) {
|
11114 | options = {};
|
11115 | let m;
|
11116 | while (m = name.match(optionsModifierRE)) {
|
11117 | name = name.slice(0, name.length - m[0].length);
|
11118 | options[m[0].toLowerCase()] = true;
|
11119 | }
|
11120 | }
|
11121 | const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
|
11122 | return [event, options];
|
11123 | }
|
11124 | let cachedNow = 0;
|
11125 | const p = Promise.resolve();
|
11126 | const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
11127 | function createInvoker(initialValue, instance) {
|
11128 | const invoker = (e) => {
|
11129 | if (!e._vts) {
|
11130 | e._vts = Date.now();
|
11131 | } else if (e._vts <= invoker.attached) {
|
11132 | return;
|
11133 | }
|
11134 | callWithAsyncErrorHandling(
|
11135 | patchStopImmediatePropagation(e, invoker.value),
|
11136 | instance,
|
11137 | 5,
|
11138 | [e]
|
11139 | );
|
11140 | };
|
11141 | invoker.value = initialValue;
|
11142 | invoker.attached = getNow();
|
11143 | return invoker;
|
11144 | }
|
11145 | function sanitizeEventValue(value, propName) {
|
11146 | if (isFunction(value) || isArray(value)) {
|
11147 | return value;
|
11148 | }
|
11149 | warn(
|
11150 | `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
|
11151 | Expected function or array of functions, received type ${typeof value}.`
|
11152 | );
|
11153 | return NOOP;
|
11154 | }
|
11155 | function patchStopImmediatePropagation(e, value) {
|
11156 | if (isArray(value)) {
|
11157 | const originalStop = e.stopImmediatePropagation;
|
11158 | e.stopImmediatePropagation = () => {
|
11159 | originalStop.call(e);
|
11160 | e._stopped = true;
|
11161 | };
|
11162 | return value.map(
|
11163 | (fn) => (e2) => !e2._stopped && fn && fn(e2)
|
11164 | );
|
11165 | } else {
|
11166 | return value;
|
11167 | }
|
11168 | }
|
11169 |
|
11170 | const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 &&
|
11171 | key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
11172 | const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
11173 | const isSVG = namespace === "svg";
|
11174 | if (key === "class") {
|
11175 | patchClass(el, nextValue, isSVG);
|
11176 | } else if (key === "style") {
|
11177 | patchStyle(el, prevValue, nextValue);
|
11178 | } else if (isOn(key)) {
|
11179 | if (!isModelListener(key)) {
|
11180 | patchEvent(el, key, prevValue, nextValue, parentComponent);
|
11181 | }
|
11182 | } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
11183 | patchDOMProp(el, key, nextValue);
|
11184 | if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
|
11185 | patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
11186 | }
|
11187 | } else if (
|
11188 |
|
11189 | el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue))
|
11190 | ) {
|
11191 | patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
|
11192 | } else {
|
11193 | if (key === "true-value") {
|
11194 | el._trueValue = nextValue;
|
11195 | } else if (key === "false-value") {
|
11196 | el._falseValue = nextValue;
|
11197 | }
|
11198 | patchAttr(el, key, nextValue, isSVG);
|
11199 | }
|
11200 | };
|
11201 | function shouldSetAsProp(el, key, value, isSVG) {
|
11202 | if (isSVG) {
|
11203 | if (key === "innerHTML" || key === "textContent") {
|
11204 | return true;
|
11205 | }
|
11206 | if (key in el && isNativeOn(key) && isFunction(value)) {
|
11207 | return true;
|
11208 | }
|
11209 | return false;
|
11210 | }
|
11211 | if (key === "spellcheck" || key === "draggable" || key === "translate") {
|
11212 | return false;
|
11213 | }
|
11214 | if (key === "form") {
|
11215 | return false;
|
11216 | }
|
11217 | if (key === "list" && el.tagName === "INPUT") {
|
11218 | return false;
|
11219 | }
|
11220 | if (key === "type" && el.tagName === "TEXTAREA") {
|
11221 | return false;
|
11222 | }
|
11223 | if (key === "width" || key === "height") {
|
11224 | const tag = el.tagName;
|
11225 | if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
|
11226 | return false;
|
11227 | }
|
11228 | }
|
11229 | if (isNativeOn(key) && isString(value)) {
|
11230 | return false;
|
11231 | }
|
11232 | return key in el;
|
11233 | }
|
11234 |
|
11235 | const REMOVAL = {};
|
11236 |
|
11237 |
|
11238 | function defineCustomElement(options, extraOptions, _createApp) {
|
11239 | const Comp = defineComponent(options, extraOptions);
|
11240 | if (isPlainObject(Comp)) extend(Comp, extraOptions);
|
11241 | class VueCustomElement extends VueElement {
|
11242 | constructor(initialProps) {
|
11243 | super(Comp, initialProps, _createApp);
|
11244 | }
|
11245 | }
|
11246 | VueCustomElement.def = Comp;
|
11247 | return VueCustomElement;
|
11248 | }
|
11249 |
|
11250 | const defineSSRCustomElement = (options, extraOptions) => {
|
11251 | return defineCustomElement(options, extraOptions, createSSRApp);
|
11252 | };
|
11253 | const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
|
11254 | };
|
11255 | class VueElement extends BaseClass {
|
11256 | constructor(_def, _props = {}, _createApp = createApp) {
|
11257 | super();
|
11258 | this._def = _def;
|
11259 | this._props = _props;
|
11260 | this._createApp = _createApp;
|
11261 | this._isVueCE = true;
|
11262 | |
11263 |
|
11264 |
|
11265 | this._instance = null;
|
11266 | |
11267 |
|
11268 |
|
11269 | this._app = null;
|
11270 | |
11271 |
|
11272 |
|
11273 | this._nonce = this._def.nonce;
|
11274 | this._connected = false;
|
11275 | this._resolved = false;
|
11276 | this._numberProps = null;
|
11277 | this._styleChildren = new WeakSet();
|
11278 | this._ob = null;
|
11279 | if (this.shadowRoot && _createApp !== createApp) {
|
11280 | this._root = this.shadowRoot;
|
11281 | } else {
|
11282 | if (this.shadowRoot) {
|
11283 | warn(
|
11284 | `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
|
11285 | );
|
11286 | }
|
11287 | if (_def.shadowRoot !== false) {
|
11288 | this.attachShadow({ mode: "open" });
|
11289 | this._root = this.shadowRoot;
|
11290 | } else {
|
11291 | this._root = this;
|
11292 | }
|
11293 | }
|
11294 | if (!this._def.__asyncLoader) {
|
11295 | this._resolveProps(this._def);
|
11296 | }
|
11297 | }
|
11298 | connectedCallback() {
|
11299 | if (!this.isConnected) return;
|
11300 | if (!this.shadowRoot) {
|
11301 | this._parseSlots();
|
11302 | }
|
11303 | this._connected = true;
|
11304 | let parent = this;
|
11305 | while (parent = parent && (parent.parentNode || parent.host)) {
|
11306 | if (parent instanceof VueElement) {
|
11307 | this._parent = parent;
|
11308 | break;
|
11309 | }
|
11310 | }
|
11311 | if (!this._instance) {
|
11312 | if (this._resolved) {
|
11313 | this._setParent();
|
11314 | this._update();
|
11315 | } else {
|
11316 | if (parent && parent._pendingResolve) {
|
11317 | this._pendingResolve = parent._pendingResolve.then(() => {
|
11318 | this._pendingResolve = void 0;
|
11319 | this._resolveDef();
|
11320 | });
|
11321 | } else {
|
11322 | this._resolveDef();
|
11323 | }
|
11324 | }
|
11325 | }
|
11326 | }
|
11327 | _setParent(parent = this._parent) {
|
11328 | if (parent) {
|
11329 | this._instance.parent = parent._instance;
|
11330 | this._instance.provides = parent._instance.provides;
|
11331 | }
|
11332 | }
|
11333 | disconnectedCallback() {
|
11334 | this._connected = false;
|
11335 | nextTick(() => {
|
11336 | if (!this._connected) {
|
11337 | if (this._ob) {
|
11338 | this._ob.disconnect();
|
11339 | this._ob = null;
|
11340 | }
|
11341 | this._app && this._app.unmount();
|
11342 | if (this._instance) this._instance.ce = void 0;
|
11343 | this._app = this._instance = null;
|
11344 | }
|
11345 | });
|
11346 | }
|
11347 | |
11348 |
|
11349 |
|
11350 | _resolveDef() {
|
11351 | if (this._pendingResolve) {
|
11352 | return;
|
11353 | }
|
11354 | for (let i = 0; i < this.attributes.length; i++) {
|
11355 | this._setAttr(this.attributes[i].name);
|
11356 | }
|
11357 | this._ob = new MutationObserver((mutations) => {
|
11358 | for (const m of mutations) {
|
11359 | this._setAttr(m.attributeName);
|
11360 | }
|
11361 | });
|
11362 | this._ob.observe(this, { attributes: true });
|
11363 | const resolve = (def, isAsync = false) => {
|
11364 | this._resolved = true;
|
11365 | this._pendingResolve = void 0;
|
11366 | const { props, styles } = def;
|
11367 | let numberProps;
|
11368 | if (props && !isArray(props)) {
|
11369 | for (const key in props) {
|
11370 | const opt = props[key];
|
11371 | if (opt === Number || opt && opt.type === Number) {
|
11372 | if (key in this._props) {
|
11373 | this._props[key] = toNumber(this._props[key]);
|
11374 | }
|
11375 | (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
|
11376 | }
|
11377 | }
|
11378 | }
|
11379 | this._numberProps = numberProps;
|
11380 | if (isAsync) {
|
11381 | this._resolveProps(def);
|
11382 | }
|
11383 | if (this.shadowRoot) {
|
11384 | this._applyStyles(styles);
|
11385 | } else if (styles) {
|
11386 | warn(
|
11387 | "Custom element style injection is not supported when using shadowRoot: false"
|
11388 | );
|
11389 | }
|
11390 | this._mount(def);
|
11391 | };
|
11392 | const asyncDef = this._def.__asyncLoader;
|
11393 | if (asyncDef) {
|
11394 | this._pendingResolve = asyncDef().then(
|
11395 | (def) => resolve(this._def = def, true)
|
11396 | );
|
11397 | } else {
|
11398 | resolve(this._def);
|
11399 | }
|
11400 | }
|
11401 | _mount(def) {
|
11402 | if (!def.name) {
|
11403 | def.name = "VueElement";
|
11404 | }
|
11405 | this._app = this._createApp(def);
|
11406 | if (def.configureApp) {
|
11407 | def.configureApp(this._app);
|
11408 | }
|
11409 | this._app._ceVNode = this._createVNode();
|
11410 | this._app.mount(this._root);
|
11411 | const exposed = this._instance && this._instance.exposed;
|
11412 | if (!exposed) return;
|
11413 | for (const key in exposed) {
|
11414 | if (!hasOwn(this, key)) {
|
11415 | Object.defineProperty(this, key, {
|
11416 |
|
11417 | get: () => unref(exposed[key])
|
11418 | });
|
11419 | } else {
|
11420 | warn(`Exposed property "${key}" already exists on custom element.`);
|
11421 | }
|
11422 | }
|
11423 | }
|
11424 | _resolveProps(def) {
|
11425 | const { props } = def;
|
11426 | const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
11427 | for (const key of Object.keys(this)) {
|
11428 | if (key[0] !== "_" && declaredPropKeys.includes(key)) {
|
11429 | this._setProp(key, this[key]);
|
11430 | }
|
11431 | }
|
11432 | for (const key of declaredPropKeys.map(camelize)) {
|
11433 | Object.defineProperty(this, key, {
|
11434 | get() {
|
11435 | return this._getProp(key);
|
11436 | },
|
11437 | set(val) {
|
11438 | this._setProp(key, val, true, true);
|
11439 | }
|
11440 | });
|
11441 | }
|
11442 | }
|
11443 | _setAttr(key) {
|
11444 | if (key.startsWith("data-v-")) return;
|
11445 | const has = this.hasAttribute(key);
|
11446 | let value = has ? this.getAttribute(key) : REMOVAL;
|
11447 | const camelKey = camelize(key);
|
11448 | if (has && this._numberProps && this._numberProps[camelKey]) {
|
11449 | value = toNumber(value);
|
11450 | }
|
11451 | this._setProp(camelKey, value, false, true);
|
11452 | }
|
11453 | |
11454 |
|
11455 |
|
11456 | _getProp(key) {
|
11457 | return this._props[key];
|
11458 | }
|
11459 | |
11460 |
|
11461 |
|
11462 | _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
|
11463 | if (val !== this._props[key]) {
|
11464 | if (val === REMOVAL) {
|
11465 | delete this._props[key];
|
11466 | } else {
|
11467 | this._props[key] = val;
|
11468 | if (key === "key" && this._app) {
|
11469 | this._app._ceVNode.key = val;
|
11470 | }
|
11471 | }
|
11472 | if (shouldUpdate && this._instance) {
|
11473 | this._update();
|
11474 | }
|
11475 | if (shouldReflect) {
|
11476 | const ob = this._ob;
|
11477 | ob && ob.disconnect();
|
11478 | if (val === true) {
|
11479 | this.setAttribute(hyphenate(key), "");
|
11480 | } else if (typeof val === "string" || typeof val === "number") {
|
11481 | this.setAttribute(hyphenate(key), val + "");
|
11482 | } else if (!val) {
|
11483 | this.removeAttribute(hyphenate(key));
|
11484 | }
|
11485 | ob && ob.observe(this, { attributes: true });
|
11486 | }
|
11487 | }
|
11488 | }
|
11489 | _update() {
|
11490 | render(this._createVNode(), this._root);
|
11491 | }
|
11492 | _createVNode() {
|
11493 | const baseProps = {};
|
11494 | if (!this.shadowRoot) {
|
11495 | baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
11496 | }
|
11497 | const vnode = createVNode(this._def, extend(baseProps, this._props));
|
11498 | if (!this._instance) {
|
11499 | vnode.ce = (instance) => {
|
11500 | this._instance = instance;
|
11501 | instance.ce = this;
|
11502 | instance.isCE = true;
|
11503 | {
|
11504 | instance.ceReload = (newStyles) => {
|
11505 | if (this._styles) {
|
11506 | this._styles.forEach((s) => this._root.removeChild(s));
|
11507 | this._styles.length = 0;
|
11508 | }
|
11509 | this._applyStyles(newStyles);
|
11510 | this._instance = null;
|
11511 | this._update();
|
11512 | };
|
11513 | }
|
11514 | const dispatch = (event, args) => {
|
11515 | this.dispatchEvent(
|
11516 | new CustomEvent(
|
11517 | event,
|
11518 | isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
|
11519 | )
|
11520 | );
|
11521 | };
|
11522 | instance.emit = (event, ...args) => {
|
11523 | dispatch(event, args);
|
11524 | if (hyphenate(event) !== event) {
|
11525 | dispatch(hyphenate(event), args);
|
11526 | }
|
11527 | };
|
11528 | this._setParent();
|
11529 | };
|
11530 | }
|
11531 | return vnode;
|
11532 | }
|
11533 | _applyStyles(styles, owner) {
|
11534 | if (!styles) return;
|
11535 | if (owner) {
|
11536 | if (owner === this._def || this._styleChildren.has(owner)) {
|
11537 | return;
|
11538 | }
|
11539 | this._styleChildren.add(owner);
|
11540 | }
|
11541 | const nonce = this._nonce;
|
11542 | for (let i = styles.length - 1; i >= 0; i--) {
|
11543 | const s = document.createElement("style");
|
11544 | if (nonce) s.setAttribute("nonce", nonce);
|
11545 | s.textContent = styles[i];
|
11546 | this.shadowRoot.prepend(s);
|
11547 | {
|
11548 | if (owner) {
|
11549 | if (owner.__hmrId) {
|
11550 | if (!this._childStyles) this._childStyles = new Map();
|
11551 | let entry = this._childStyles.get(owner.__hmrId);
|
11552 | if (!entry) {
|
11553 | this._childStyles.set(owner.__hmrId, entry = []);
|
11554 | }
|
11555 | entry.push(s);
|
11556 | }
|
11557 | } else {
|
11558 | (this._styles || (this._styles = [])).push(s);
|
11559 | }
|
11560 | }
|
11561 | }
|
11562 | }
|
11563 | |
11564 |
|
11565 |
|
11566 | _parseSlots() {
|
11567 | const slots = this._slots = {};
|
11568 | let n;
|
11569 | while (n = this.firstChild) {
|
11570 | const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
|
11571 | (slots[slotName] || (slots[slotName] = [])).push(n);
|
11572 | this.removeChild(n);
|
11573 | }
|
11574 | }
|
11575 | |
11576 |
|
11577 |
|
11578 | _renderSlots() {
|
11579 | const outlets = (this._teleportTarget || this).querySelectorAll("slot");
|
11580 | const scopeId = this._instance.type.__scopeId;
|
11581 | for (let i = 0; i < outlets.length; i++) {
|
11582 | const o = outlets[i];
|
11583 | const slotName = o.getAttribute("name") || "default";
|
11584 | const content = this._slots[slotName];
|
11585 | const parent = o.parentNode;
|
11586 | if (content) {
|
11587 | for (const n of content) {
|
11588 | if (scopeId && n.nodeType === 1) {
|
11589 | const id = scopeId + "-s";
|
11590 | const walker = document.createTreeWalker(n, 1);
|
11591 | n.setAttribute(id, "");
|
11592 | let child;
|
11593 | while (child = walker.nextNode()) {
|
11594 | child.setAttribute(id, "");
|
11595 | }
|
11596 | }
|
11597 | parent.insertBefore(n, o);
|
11598 | }
|
11599 | } else {
|
11600 | while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
11601 | }
|
11602 | parent.removeChild(o);
|
11603 | }
|
11604 | }
|
11605 | |
11606 |
|
11607 |
|
11608 | _injectChildStyle(comp) {
|
11609 | this._applyStyles(comp.styles, comp);
|
11610 | }
|
11611 | |
11612 |
|
11613 |
|
11614 | _removeChildStyle(comp) {
|
11615 | {
|
11616 | this._styleChildren.delete(comp);
|
11617 | if (this._childStyles && comp.__hmrId) {
|
11618 | const oldStyles = this._childStyles.get(comp.__hmrId);
|
11619 | if (oldStyles) {
|
11620 | oldStyles.forEach((s) => this._root.removeChild(s));
|
11621 | oldStyles.length = 0;
|
11622 | }
|
11623 | }
|
11624 | }
|
11625 | }
|
11626 | }
|
11627 | function useHost(caller) {
|
11628 | const instance = getCurrentInstance();
|
11629 | const el = instance && instance.ce;
|
11630 | if (el) {
|
11631 | return el;
|
11632 | } else {
|
11633 | if (!instance) {
|
11634 | warn(
|
11635 | `${caller || "useHost"} called without an active component instance.`
|
11636 | );
|
11637 | } else {
|
11638 | warn(
|
11639 | `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
|
11640 | );
|
11641 | }
|
11642 | }
|
11643 | return null;
|
11644 | }
|
11645 | function useShadowRoot() {
|
11646 | const el = useHost("useShadowRoot") ;
|
11647 | return el && el.shadowRoot;
|
11648 | }
|
11649 |
|
11650 | function useCssModule(name = "$style") {
|
11651 | {
|
11652 | {
|
11653 | warn(`useCssModule() is not supported in the global build.`);
|
11654 | }
|
11655 | return EMPTY_OBJ;
|
11656 | }
|
11657 | }
|
11658 |
|
11659 | const positionMap = new WeakMap();
|
11660 | const newPositionMap = new WeakMap();
|
11661 | const moveCbKey = Symbol("_moveCb");
|
11662 | const enterCbKey = Symbol("_enterCb");
|
11663 | const decorate = (t) => {
|
11664 | delete t.props.mode;
|
11665 | return t;
|
11666 | };
|
11667 | const TransitionGroupImpl = decorate({
|
11668 | name: "TransitionGroup",
|
11669 | props: extend({}, TransitionPropsValidators, {
|
11670 | tag: String,
|
11671 | moveClass: String
|
11672 | }),
|
11673 | setup(props, { slots }) {
|
11674 | const instance = getCurrentInstance();
|
11675 | const state = useTransitionState();
|
11676 | let prevChildren;
|
11677 | let children;
|
11678 | onUpdated(() => {
|
11679 | if (!prevChildren.length) {
|
11680 | return;
|
11681 | }
|
11682 | const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
11683 | if (!hasCSSTransform(
|
11684 | prevChildren[0].el,
|
11685 | instance.vnode.el,
|
11686 | moveClass
|
11687 | )) {
|
11688 | return;
|
11689 | }
|
11690 | prevChildren.forEach(callPendingCbs);
|
11691 | prevChildren.forEach(recordPosition);
|
11692 | const movedChildren = prevChildren.filter(applyTranslation);
|
11693 | forceReflow();
|
11694 | movedChildren.forEach((c) => {
|
11695 | const el = c.el;
|
11696 | const style = el.style;
|
11697 | addTransitionClass(el, moveClass);
|
11698 | style.transform = style.webkitTransform = style.transitionDuration = "";
|
11699 | const cb = el[moveCbKey] = (e) => {
|
11700 | if (e && e.target !== el) {
|
11701 | return;
|
11702 | }
|
11703 | if (!e || /transform$/.test(e.propertyName)) {
|
11704 | el.removeEventListener("transitionend", cb);
|
11705 | el[moveCbKey] = null;
|
11706 | removeTransitionClass(el, moveClass);
|
11707 | }
|
11708 | };
|
11709 | el.addEventListener("transitionend", cb);
|
11710 | });
|
11711 | });
|
11712 | return () => {
|
11713 | const rawProps = toRaw(props);
|
11714 | const cssTransitionProps = resolveTransitionProps(rawProps);
|
11715 | let tag = rawProps.tag || Fragment;
|
11716 | prevChildren = [];
|
11717 | if (children) {
|
11718 | for (let i = 0; i < children.length; i++) {
|
11719 | const child = children[i];
|
11720 | if (child.el && child.el instanceof Element) {
|
11721 | prevChildren.push(child);
|
11722 | setTransitionHooks(
|
11723 | child,
|
11724 | resolveTransitionHooks(
|
11725 | child,
|
11726 | cssTransitionProps,
|
11727 | state,
|
11728 | instance
|
11729 | )
|
11730 | );
|
11731 | positionMap.set(
|
11732 | child,
|
11733 | child.el.getBoundingClientRect()
|
11734 | );
|
11735 | }
|
11736 | }
|
11737 | }
|
11738 | children = slots.default ? getTransitionRawChildren(slots.default()) : [];
|
11739 | for (let i = 0; i < children.length; i++) {
|
11740 | const child = children[i];
|
11741 | if (child.key != null) {
|
11742 | setTransitionHooks(
|
11743 | child,
|
11744 | resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
11745 | );
|
11746 | } else if (child.type !== Text) {
|
11747 | warn(`<TransitionGroup> children must be keyed.`);
|
11748 | }
|
11749 | }
|
11750 | return createVNode(tag, null, children);
|
11751 | };
|
11752 | }
|
11753 | });
|
11754 | const TransitionGroup = TransitionGroupImpl;
|
11755 | function callPendingCbs(c) {
|
11756 | const el = c.el;
|
11757 | if (el[moveCbKey]) {
|
11758 | el[moveCbKey]();
|
11759 | }
|
11760 | if (el[enterCbKey]) {
|
11761 | el[enterCbKey]();
|
11762 | }
|
11763 | }
|
11764 | function recordPosition(c) {
|
11765 | newPositionMap.set(c, c.el.getBoundingClientRect());
|
11766 | }
|
11767 | function applyTranslation(c) {
|
11768 | const oldPos = positionMap.get(c);
|
11769 | const newPos = newPositionMap.get(c);
|
11770 | const dx = oldPos.left - newPos.left;
|
11771 | const dy = oldPos.top - newPos.top;
|
11772 | if (dx || dy) {
|
11773 | const s = c.el.style;
|
11774 | s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
|
11775 | s.transitionDuration = "0s";
|
11776 | return c;
|
11777 | }
|
11778 | }
|
11779 | function hasCSSTransform(el, root, moveClass) {
|
11780 | const clone = el.cloneNode();
|
11781 | const _vtc = el[vtcKey];
|
11782 | if (_vtc) {
|
11783 | _vtc.forEach((cls) => {
|
11784 | cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
|
11785 | });
|
11786 | }
|
11787 | moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
|
11788 | clone.style.display = "none";
|
11789 | const container = root.nodeType === 1 ? root : root.parentNode;
|
11790 | container.appendChild(clone);
|
11791 | const { hasTransform } = getTransitionInfo(clone);
|
11792 | container.removeChild(clone);
|
11793 | return hasTransform;
|
11794 | }
|
11795 |
|
11796 | const getModelAssigner = (vnode) => {
|
11797 | const fn = vnode.props["onUpdate:modelValue"] || false;
|
11798 | return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
|
11799 | };
|
11800 | function onCompositionStart(e) {
|
11801 | e.target.composing = true;
|
11802 | }
|
11803 | function onCompositionEnd(e) {
|
11804 | const target = e.target;
|
11805 | if (target.composing) {
|
11806 | target.composing = false;
|
11807 | target.dispatchEvent(new Event("input"));
|
11808 | }
|
11809 | }
|
11810 | const assignKey = Symbol("_assign");
|
11811 | const vModelText = {
|
11812 | created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
11813 | el[assignKey] = getModelAssigner(vnode);
|
11814 | const castToNumber = number || vnode.props && vnode.props.type === "number";
|
11815 | addEventListener(el, lazy ? "change" : "input", (e) => {
|
11816 | if (e.target.composing) return;
|
11817 | let domValue = el.value;
|
11818 | if (trim) {
|
11819 | domValue = domValue.trim();
|
11820 | }
|
11821 | if (castToNumber) {
|
11822 | domValue = looseToNumber(domValue);
|
11823 | }
|
11824 | el[assignKey](domValue);
|
11825 | });
|
11826 | if (trim) {
|
11827 | addEventListener(el, "change", () => {
|
11828 | el.value = el.value.trim();
|
11829 | });
|
11830 | }
|
11831 | if (!lazy) {
|
11832 | addEventListener(el, "compositionstart", onCompositionStart);
|
11833 | addEventListener(el, "compositionend", onCompositionEnd);
|
11834 | addEventListener(el, "change", onCompositionEnd);
|
11835 | }
|
11836 | },
|
11837 |
|
11838 | mounted(el, { value }) {
|
11839 | el.value = value == null ? "" : value;
|
11840 | },
|
11841 | beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
11842 | el[assignKey] = getModelAssigner(vnode);
|
11843 | if (el.composing) return;
|
11844 | const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
|
11845 | const newValue = value == null ? "" : value;
|
11846 | if (elValue === newValue) {
|
11847 | return;
|
11848 | }
|
11849 | if (document.activeElement === el && el.type !== "range") {
|
11850 | if (lazy && value === oldValue) {
|
11851 | return;
|
11852 | }
|
11853 | if (trim && el.value.trim() === newValue) {
|
11854 | return;
|
11855 | }
|
11856 | }
|
11857 | el.value = newValue;
|
11858 | }
|
11859 | };
|
11860 | const vModelCheckbox = {
|
11861 |
|
11862 | deep: true,
|
11863 | created(el, _, vnode) {
|
11864 | el[assignKey] = getModelAssigner(vnode);
|
11865 | addEventListener(el, "change", () => {
|
11866 | const modelValue = el._modelValue;
|
11867 | const elementValue = getValue(el);
|
11868 | const checked = el.checked;
|
11869 | const assign = el[assignKey];
|
11870 | if (isArray(modelValue)) {
|
11871 | const index = looseIndexOf(modelValue, elementValue);
|
11872 | const found = index !== -1;
|
11873 | if (checked && !found) {
|
11874 | assign(modelValue.concat(elementValue));
|
11875 | } else if (!checked && found) {
|
11876 | const filtered = [...modelValue];
|
11877 | filtered.splice(index, 1);
|
11878 | assign(filtered);
|
11879 | }
|
11880 | } else if (isSet(modelValue)) {
|
11881 | const cloned = new Set(modelValue);
|
11882 | if (checked) {
|
11883 | cloned.add(elementValue);
|
11884 | } else {
|
11885 | cloned.delete(elementValue);
|
11886 | }
|
11887 | assign(cloned);
|
11888 | } else {
|
11889 | assign(getCheckboxValue(el, checked));
|
11890 | }
|
11891 | });
|
11892 | },
|
11893 |
|
11894 | mounted: setChecked,
|
11895 | beforeUpdate(el, binding, vnode) {
|
11896 | el[assignKey] = getModelAssigner(vnode);
|
11897 | setChecked(el, binding, vnode);
|
11898 | }
|
11899 | };
|
11900 | function setChecked(el, { value, oldValue }, vnode) {
|
11901 | el._modelValue = value;
|
11902 | let checked;
|
11903 | if (isArray(value)) {
|
11904 | checked = looseIndexOf(value, vnode.props.value) > -1;
|
11905 | } else if (isSet(value)) {
|
11906 | checked = value.has(vnode.props.value);
|
11907 | } else {
|
11908 | if (value === oldValue) return;
|
11909 | checked = looseEqual(value, getCheckboxValue(el, true));
|
11910 | }
|
11911 | if (el.checked !== checked) {
|
11912 | el.checked = checked;
|
11913 | }
|
11914 | }
|
11915 | const vModelRadio = {
|
11916 | created(el, { value }, vnode) {
|
11917 | el.checked = looseEqual(value, vnode.props.value);
|
11918 | el[assignKey] = getModelAssigner(vnode);
|
11919 | addEventListener(el, "change", () => {
|
11920 | el[assignKey](getValue(el));
|
11921 | });
|
11922 | },
|
11923 | beforeUpdate(el, { value, oldValue }, vnode) {
|
11924 | el[assignKey] = getModelAssigner(vnode);
|
11925 | if (value !== oldValue) {
|
11926 | el.checked = looseEqual(value, vnode.props.value);
|
11927 | }
|
11928 | }
|
11929 | };
|
11930 | const vModelSelect = {
|
11931 |
|
11932 | deep: true,
|
11933 | created(el, { value, modifiers: { number } }, vnode) {
|
11934 | const isSetModel = isSet(value);
|
11935 | addEventListener(el, "change", () => {
|
11936 | const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
11937 | (o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
11938 | );
|
11939 | el[assignKey](
|
11940 | el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
11941 | );
|
11942 | el._assigning = true;
|
11943 | nextTick(() => {
|
11944 | el._assigning = false;
|
11945 | });
|
11946 | });
|
11947 | el[assignKey] = getModelAssigner(vnode);
|
11948 | },
|
11949 |
|
11950 |
|
11951 | mounted(el, { value }) {
|
11952 | setSelected(el, value);
|
11953 | },
|
11954 | beforeUpdate(el, _binding, vnode) {
|
11955 | el[assignKey] = getModelAssigner(vnode);
|
11956 | },
|
11957 | updated(el, { value }) {
|
11958 | if (!el._assigning) {
|
11959 | setSelected(el, value);
|
11960 | }
|
11961 | }
|
11962 | };
|
11963 | function setSelected(el, value) {
|
11964 | const isMultiple = el.multiple;
|
11965 | const isArrayValue = isArray(value);
|
11966 | if (isMultiple && !isArrayValue && !isSet(value)) {
|
11967 | warn(
|
11968 | `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
|
11969 | );
|
11970 | return;
|
11971 | }
|
11972 | for (let i = 0, l = el.options.length; i < l; i++) {
|
11973 | const option = el.options[i];
|
11974 | const optionValue = getValue(option);
|
11975 | if (isMultiple) {
|
11976 | if (isArrayValue) {
|
11977 | const optionType = typeof optionValue;
|
11978 | if (optionType === "string" || optionType === "number") {
|
11979 | option.selected = value.some((v) => String(v) === String(optionValue));
|
11980 | } else {
|
11981 | option.selected = looseIndexOf(value, optionValue) > -1;
|
11982 | }
|
11983 | } else {
|
11984 | option.selected = value.has(optionValue);
|
11985 | }
|
11986 | } else if (looseEqual(getValue(option), value)) {
|
11987 | if (el.selectedIndex !== i) el.selectedIndex = i;
|
11988 | return;
|
11989 | }
|
11990 | }
|
11991 | if (!isMultiple && el.selectedIndex !== -1) {
|
11992 | el.selectedIndex = -1;
|
11993 | }
|
11994 | }
|
11995 | function getValue(el) {
|
11996 | return "_value" in el ? el._value : el.value;
|
11997 | }
|
11998 | function getCheckboxValue(el, checked) {
|
11999 | const key = checked ? "_trueValue" : "_falseValue";
|
12000 | return key in el ? el[key] : checked;
|
12001 | }
|
12002 | const vModelDynamic = {
|
12003 | created(el, binding, vnode) {
|
12004 | callModelHook(el, binding, vnode, null, "created");
|
12005 | },
|
12006 | mounted(el, binding, vnode) {
|
12007 | callModelHook(el, binding, vnode, null, "mounted");
|
12008 | },
|
12009 | beforeUpdate(el, binding, vnode, prevVNode) {
|
12010 | callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
|
12011 | },
|
12012 | updated(el, binding, vnode, prevVNode) {
|
12013 | callModelHook(el, binding, vnode, prevVNode, "updated");
|
12014 | }
|
12015 | };
|
12016 | function resolveDynamicModel(tagName, type) {
|
12017 | switch (tagName) {
|
12018 | case "SELECT":
|
12019 | return vModelSelect;
|
12020 | case "TEXTAREA":
|
12021 | return vModelText;
|
12022 | default:
|
12023 | switch (type) {
|
12024 | case "checkbox":
|
12025 | return vModelCheckbox;
|
12026 | case "radio":
|
12027 | return vModelRadio;
|
12028 | default:
|
12029 | return vModelText;
|
12030 | }
|
12031 | }
|
12032 | }
|
12033 | function callModelHook(el, binding, vnode, prevVNode, hook) {
|
12034 | const modelToUse = resolveDynamicModel(
|
12035 | el.tagName,
|
12036 | vnode.props && vnode.props.type
|
12037 | );
|
12038 | const fn = modelToUse[hook];
|
12039 | fn && fn(el, binding, vnode, prevVNode);
|
12040 | }
|
12041 |
|
12042 | const systemModifiers = ["ctrl", "shift", "alt", "meta"];
|
12043 | const modifierGuards = {
|
12044 | stop: (e) => e.stopPropagation(),
|
12045 | prevent: (e) => e.preventDefault(),
|
12046 | self: (e) => e.target !== e.currentTarget,
|
12047 | ctrl: (e) => !e.ctrlKey,
|
12048 | shift: (e) => !e.shiftKey,
|
12049 | alt: (e) => !e.altKey,
|
12050 | meta: (e) => !e.metaKey,
|
12051 | left: (e) => "button" in e && e.button !== 0,
|
12052 | middle: (e) => "button" in e && e.button !== 1,
|
12053 | right: (e) => "button" in e && e.button !== 2,
|
12054 | exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
12055 | };
|
12056 | const withModifiers = (fn, modifiers) => {
|
12057 | const cache = fn._withMods || (fn._withMods = {});
|
12058 | const cacheKey = modifiers.join(".");
|
12059 | return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
|
12060 | for (let i = 0; i < modifiers.length; i++) {
|
12061 | const guard = modifierGuards[modifiers[i]];
|
12062 | if (guard && guard(event, modifiers)) return;
|
12063 | }
|
12064 | return fn(event, ...args);
|
12065 | });
|
12066 | };
|
12067 | const keyNames = {
|
12068 | esc: "escape",
|
12069 | space: " ",
|
12070 | up: "arrow-up",
|
12071 | left: "arrow-left",
|
12072 | right: "arrow-right",
|
12073 | down: "arrow-down",
|
12074 | delete: "backspace"
|
12075 | };
|
12076 | const withKeys = (fn, modifiers) => {
|
12077 | const cache = fn._withKeys || (fn._withKeys = {});
|
12078 | const cacheKey = modifiers.join(".");
|
12079 | return cache[cacheKey] || (cache[cacheKey] = (event) => {
|
12080 | if (!("key" in event)) {
|
12081 | return;
|
12082 | }
|
12083 | const eventKey = hyphenate(event.key);
|
12084 | if (modifiers.some(
|
12085 | (k) => k === eventKey || keyNames[k] === eventKey
|
12086 | )) {
|
12087 | return fn(event);
|
12088 | }
|
12089 | });
|
12090 | };
|
12091 |
|
12092 | const rendererOptions = extend({ patchProp }, nodeOps);
|
12093 | let renderer;
|
12094 | let enabledHydration = false;
|
12095 | function ensureRenderer() {
|
12096 | return renderer || (renderer = createRenderer(rendererOptions));
|
12097 | }
|
12098 | function ensureHydrationRenderer() {
|
12099 | renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
|
12100 | enabledHydration = true;
|
12101 | return renderer;
|
12102 | }
|
12103 | const render = (...args) => {
|
12104 | ensureRenderer().render(...args);
|
12105 | };
|
12106 | const hydrate = (...args) => {
|
12107 | ensureHydrationRenderer().hydrate(...args);
|
12108 | };
|
12109 | const createApp = (...args) => {
|
12110 | const app = ensureRenderer().createApp(...args);
|
12111 | {
|
12112 | injectNativeTagCheck(app);
|
12113 | injectCompilerOptionsCheck(app);
|
12114 | }
|
12115 | const { mount } = app;
|
12116 | app.mount = (containerOrSelector) => {
|
12117 | const container = normalizeContainer(containerOrSelector);
|
12118 | if (!container) return;
|
12119 | const component = app._component;
|
12120 | if (!isFunction(component) && !component.render && !component.template) {
|
12121 | component.template = container.innerHTML;
|
12122 | }
|
12123 | if (container.nodeType === 1) {
|
12124 | container.textContent = "";
|
12125 | }
|
12126 | const proxy = mount(container, false, resolveRootNamespace(container));
|
12127 | if (container instanceof Element) {
|
12128 | container.removeAttribute("v-cloak");
|
12129 | container.setAttribute("data-v-app", "");
|
12130 | }
|
12131 | return proxy;
|
12132 | };
|
12133 | return app;
|
12134 | };
|
12135 | const createSSRApp = (...args) => {
|
12136 | const app = ensureHydrationRenderer().createApp(...args);
|
12137 | {
|
12138 | injectNativeTagCheck(app);
|
12139 | injectCompilerOptionsCheck(app);
|
12140 | }
|
12141 | const { mount } = app;
|
12142 | app.mount = (containerOrSelector) => {
|
12143 | const container = normalizeContainer(containerOrSelector);
|
12144 | if (container) {
|
12145 | return mount(container, true, resolveRootNamespace(container));
|
12146 | }
|
12147 | };
|
12148 | return app;
|
12149 | };
|
12150 | function resolveRootNamespace(container) {
|
12151 | if (container instanceof SVGElement) {
|
12152 | return "svg";
|
12153 | }
|
12154 | if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
|
12155 | return "mathml";
|
12156 | }
|
12157 | }
|
12158 | function injectNativeTagCheck(app) {
|
12159 | Object.defineProperty(app.config, "isNativeTag", {
|
12160 | value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
|
12161 | writable: false
|
12162 | });
|
12163 | }
|
12164 | function injectCompilerOptionsCheck(app) {
|
12165 | if (isRuntimeOnly()) {
|
12166 | const isCustomElement = app.config.isCustomElement;
|
12167 | Object.defineProperty(app.config, "isCustomElement", {
|
12168 | get() {
|
12169 | return isCustomElement;
|
12170 | },
|
12171 | set() {
|
12172 | warn(
|
12173 | `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
|
12174 | );
|
12175 | }
|
12176 | });
|
12177 | const compilerOptions = app.config.compilerOptions;
|
12178 | 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.
|
12179 | - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
|
12180 | - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
|
12181 | - 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`;
|
12182 | Object.defineProperty(app.config, "compilerOptions", {
|
12183 | get() {
|
12184 | warn(msg);
|
12185 | return compilerOptions;
|
12186 | },
|
12187 | set() {
|
12188 | warn(msg);
|
12189 | }
|
12190 | });
|
12191 | }
|
12192 | }
|
12193 | function normalizeContainer(container) {
|
12194 | if (isString(container)) {
|
12195 | const res = document.querySelector(container);
|
12196 | if (!res) {
|
12197 | warn(
|
12198 | `Failed to mount app: mount target selector "${container}" returned null.`
|
12199 | );
|
12200 | }
|
12201 | return res;
|
12202 | }
|
12203 | if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
|
12204 | warn(
|
12205 | `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
|
12206 | );
|
12207 | }
|
12208 | return container;
|
12209 | }
|
12210 | const initDirectivesForSSR = NOOP;
|
12211 |
|
12212 | function initDev() {
|
12213 | {
|
12214 | {
|
12215 | console.info(
|
12216 | `You are running a development build of Vue.
|
12217 | Make sure to use the production build (*.prod.js) when deploying for production.`
|
12218 | );
|
12219 | }
|
12220 | initCustomFormatter();
|
12221 | }
|
12222 | }
|
12223 |
|
12224 | {
|
12225 | initDev();
|
12226 | }
|
12227 | const compile = () => {
|
12228 | {
|
12229 | warn(
|
12230 | `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
|
12231 | );
|
12232 | }
|
12233 | };
|
12234 |
|
12235 | exports.BaseTransition = BaseTransition;
|
12236 | exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
12237 | exports.Comment = Comment;
|
12238 | exports.DeprecationTypes = DeprecationTypes;
|
12239 | exports.EffectScope = EffectScope;
|
12240 | exports.ErrorCodes = ErrorCodes;
|
12241 | exports.ErrorTypeStrings = ErrorTypeStrings;
|
12242 | exports.Fragment = Fragment;
|
12243 | exports.KeepAlive = KeepAlive;
|
12244 | exports.ReactiveEffect = ReactiveEffect;
|
12245 | exports.Static = Static;
|
12246 | exports.Suspense = Suspense;
|
12247 | exports.Teleport = Teleport;
|
12248 | exports.Text = Text;
|
12249 | exports.TrackOpTypes = TrackOpTypes;
|
12250 | exports.Transition = Transition;
|
12251 | exports.TransitionGroup = TransitionGroup;
|
12252 | exports.TriggerOpTypes = TriggerOpTypes;
|
12253 | exports.VueElement = VueElement;
|
12254 | exports.assertNumber = assertNumber;
|
12255 | exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
|
12256 | exports.callWithErrorHandling = callWithErrorHandling;
|
12257 | exports.camelize = camelize;
|
12258 | exports.capitalize = capitalize;
|
12259 | exports.cloneVNode = cloneVNode;
|
12260 | exports.compatUtils = compatUtils;
|
12261 | exports.compile = compile;
|
12262 | exports.computed = computed;
|
12263 | exports.createApp = createApp;
|
12264 | exports.createBlock = createBlock;
|
12265 | exports.createCommentVNode = createCommentVNode;
|
12266 | exports.createElementBlock = createElementBlock;
|
12267 | exports.createElementVNode = createBaseVNode;
|
12268 | exports.createHydrationRenderer = createHydrationRenderer;
|
12269 | exports.createPropsRestProxy = createPropsRestProxy;
|
12270 | exports.createRenderer = createRenderer;
|
12271 | exports.createSSRApp = createSSRApp;
|
12272 | exports.createSlots = createSlots;
|
12273 | exports.createStaticVNode = createStaticVNode;
|
12274 | exports.createTextVNode = createTextVNode;
|
12275 | exports.createVNode = createVNode;
|
12276 | exports.customRef = customRef;
|
12277 | exports.defineAsyncComponent = defineAsyncComponent;
|
12278 | exports.defineComponent = defineComponent;
|
12279 | exports.defineCustomElement = defineCustomElement;
|
12280 | exports.defineEmits = defineEmits;
|
12281 | exports.defineExpose = defineExpose;
|
12282 | exports.defineModel = defineModel;
|
12283 | exports.defineOptions = defineOptions;
|
12284 | exports.defineProps = defineProps;
|
12285 | exports.defineSSRCustomElement = defineSSRCustomElement;
|
12286 | exports.defineSlots = defineSlots;
|
12287 | exports.devtools = devtools;
|
12288 | exports.effect = effect;
|
12289 | exports.effectScope = effectScope;
|
12290 | exports.getCurrentInstance = getCurrentInstance;
|
12291 | exports.getCurrentScope = getCurrentScope;
|
12292 | exports.getCurrentWatcher = getCurrentWatcher;
|
12293 | exports.getTransitionRawChildren = getTransitionRawChildren;
|
12294 | exports.guardReactiveProps = guardReactiveProps;
|
12295 | exports.h = h;
|
12296 | exports.handleError = handleError;
|
12297 | exports.hasInjectionContext = hasInjectionContext;
|
12298 | exports.hydrate = hydrate;
|
12299 | exports.hydrateOnIdle = hydrateOnIdle;
|
12300 | exports.hydrateOnInteraction = hydrateOnInteraction;
|
12301 | exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
|
12302 | exports.hydrateOnVisible = hydrateOnVisible;
|
12303 | exports.initCustomFormatter = initCustomFormatter;
|
12304 | exports.initDirectivesForSSR = initDirectivesForSSR;
|
12305 | exports.inject = inject;
|
12306 | exports.isMemoSame = isMemoSame;
|
12307 | exports.isProxy = isProxy;
|
12308 | exports.isReactive = isReactive;
|
12309 | exports.isReadonly = isReadonly;
|
12310 | exports.isRef = isRef;
|
12311 | exports.isRuntimeOnly = isRuntimeOnly;
|
12312 | exports.isShallow = isShallow;
|
12313 | exports.isVNode = isVNode;
|
12314 | exports.markRaw = markRaw;
|
12315 | exports.mergeDefaults = mergeDefaults;
|
12316 | exports.mergeModels = mergeModels;
|
12317 | exports.mergeProps = mergeProps;
|
12318 | exports.nextTick = nextTick;
|
12319 | exports.normalizeClass = normalizeClass;
|
12320 | exports.normalizeProps = normalizeProps;
|
12321 | exports.normalizeStyle = normalizeStyle;
|
12322 | exports.onActivated = onActivated;
|
12323 | exports.onBeforeMount = onBeforeMount;
|
12324 | exports.onBeforeUnmount = onBeforeUnmount;
|
12325 | exports.onBeforeUpdate = onBeforeUpdate;
|
12326 | exports.onDeactivated = onDeactivated;
|
12327 | exports.onErrorCaptured = onErrorCaptured;
|
12328 | exports.onMounted = onMounted;
|
12329 | exports.onRenderTracked = onRenderTracked;
|
12330 | exports.onRenderTriggered = onRenderTriggered;
|
12331 | exports.onScopeDispose = onScopeDispose;
|
12332 | exports.onServerPrefetch = onServerPrefetch;
|
12333 | exports.onUnmounted = onUnmounted;
|
12334 | exports.onUpdated = onUpdated;
|
12335 | exports.onWatcherCleanup = onWatcherCleanup;
|
12336 | exports.openBlock = openBlock;
|
12337 | exports.popScopeId = popScopeId;
|
12338 | exports.provide = provide;
|
12339 | exports.proxyRefs = proxyRefs;
|
12340 | exports.pushScopeId = pushScopeId;
|
12341 | exports.queuePostFlushCb = queuePostFlushCb;
|
12342 | exports.reactive = reactive;
|
12343 | exports.readonly = readonly;
|
12344 | exports.ref = ref;
|
12345 | exports.registerRuntimeCompiler = registerRuntimeCompiler;
|
12346 | exports.render = render;
|
12347 | exports.renderList = renderList;
|
12348 | exports.renderSlot = renderSlot;
|
12349 | exports.resolveComponent = resolveComponent;
|
12350 | exports.resolveDirective = resolveDirective;
|
12351 | exports.resolveDynamicComponent = resolveDynamicComponent;
|
12352 | exports.resolveFilter = resolveFilter;
|
12353 | exports.resolveTransitionHooks = resolveTransitionHooks;
|
12354 | exports.setBlockTracking = setBlockTracking;
|
12355 | exports.setDevtoolsHook = setDevtoolsHook;
|
12356 | exports.setTransitionHooks = setTransitionHooks;
|
12357 | exports.shallowReactive = shallowReactive;
|
12358 | exports.shallowReadonly = shallowReadonly;
|
12359 | exports.shallowRef = shallowRef;
|
12360 | exports.ssrContextKey = ssrContextKey;
|
12361 | exports.ssrUtils = ssrUtils;
|
12362 | exports.stop = stop;
|
12363 | exports.toDisplayString = toDisplayString;
|
12364 | exports.toHandlerKey = toHandlerKey;
|
12365 | exports.toHandlers = toHandlers;
|
12366 | exports.toRaw = toRaw;
|
12367 | exports.toRef = toRef;
|
12368 | exports.toRefs = toRefs;
|
12369 | exports.toValue = toValue;
|
12370 | exports.transformVNodeArgs = transformVNodeArgs;
|
12371 | exports.triggerRef = triggerRef;
|
12372 | exports.unref = unref;
|
12373 | exports.useAttrs = useAttrs;
|
12374 | exports.useCssModule = useCssModule;
|
12375 | exports.useCssVars = useCssVars;
|
12376 | exports.useHost = useHost;
|
12377 | exports.useId = useId;
|
12378 | exports.useModel = useModel;
|
12379 | exports.useSSRContext = useSSRContext;
|
12380 | exports.useShadowRoot = useShadowRoot;
|
12381 | exports.useSlots = useSlots;
|
12382 | exports.useTemplateRef = useTemplateRef;
|
12383 | exports.useTransitionState = useTransitionState;
|
12384 | exports.vModelCheckbox = vModelCheckbox;
|
12385 | exports.vModelDynamic = vModelDynamic;
|
12386 | exports.vModelRadio = vModelRadio;
|
12387 | exports.vModelSelect = vModelSelect;
|
12388 | exports.vModelText = vModelText;
|
12389 | exports.vShow = vShow;
|
12390 | exports.version = version;
|
12391 | exports.warn = warn;
|
12392 | exports.watch = watch;
|
12393 | exports.watchEffect = watchEffect;
|
12394 | exports.watchPostEffect = watchPostEffect;
|
12395 | exports.watchSyncEffect = watchSyncEffect;
|
12396 | exports.withAsyncContext = withAsyncContext;
|
12397 | exports.withCtx = withCtx;
|
12398 | exports.withDefaults = withDefaults;
|
12399 | exports.withDirectives = withDirectives;
|
12400 | exports.withKeys = withKeys;
|
12401 | exports.withMemo = withMemo;
|
12402 | exports.withModifiers = withModifiers;
|
12403 | exports.withScopeId = withScopeId;
|
12404 |
|
12405 | return exports;
|
12406 |
|
12407 | })({});
|