vendor: 5,317 bytes, lines 1-141
1/** 2* vue v3.5.25 3* (c) 2018-present Yuxi (Evan) You and Vue contributors 4* @license MIT 5**/ 6var Vue = (function (exports) { 7 'use strict'; 8 9 // @__NO_SIDE_EFFECTS__ 10 function makeMap(str) { 11 const map = /* @__PURE__ */ Object.create(null); 12 for (const key of str.split(",")) map[key] = 1; 13 return (val) => val in map; 14 } 15 16 const EMPTY_OBJ = Object.freeze({}); 17 const EMPTY_ARR = Object.freeze([]); 18 const NOOP = () => { 19 }; 20 const NO = () => false; 21 const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter 22 (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); 23 const isModelListener = (key) => key.startsWith("onUpdate:"); 24 const extend = Object.assign; 25 const remove = (arr, el) => { 26 const i = arr.indexOf(el); 27 if (i > -1) { 28 arr.splice(i, 1); 29 } 30 }; 31 const hasOwnProperty$1 = Object.prototype.hasOwnProperty; 32 const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); 33 const isArray = Array.isArray; 34 const isMap = (val) => toTypeString(val) === "[object Map]"; 35 const isSet = (val) => toTypeString(val) === "[object Set]"; 36 const isDate = (val) => toTypeString(val) === "[object Date]"; 37 const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 38 const isFunction = (val) => typeof val === "function"; 39 const isString = (val) => typeof val === "string"; 40 const isSymbol = (val) => typeof val === "symbol"; 41 const isObject = (val) => val !== null && typeof val === "object"; 42 const isPromise = (val) => { 43 return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); 44 }; 45 const objectToString = Object.prototype.toString; 46 const toTypeString = (value) => objectToString.call(value); 47 const toRawType = (value) => { 48 return toTypeString(value).slice(8, -1); 49 }; 50 const isPlainObject = (val) => toTypeString(val) === "[object Object]"; 51 const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 52 const isReservedProp = /* @__PURE__ */ makeMap( 53 // the leading comma is intentional so empty string "" is also included 54 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 55 ); 56 const isBuiltInDirective = /* @__PURE__ */ makeMap( 57 "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" 58 ); 59 const cacheStringFunction = (fn) => { 60 const cache = /* @__PURE__ */ Object.create(null); 61 return ((str) => { 62 const hit = cache[str]; 63 return hit || (cache[str] = fn(str)); 64 }); 65 }; 66 const camelizeRE = /-\w/g; 67 const camelize = cacheStringFunction( 68 (str) => { 69 return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase()); 70 } 71 ); 72 const hyphenateRE = /\B([A-Z])/g; 73 const hyphenate = cacheStringFunction( 74 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 75 ); 76 const capitalize = cacheStringFunction((str) => { 77 return str.charAt(0).toUpperCase() + str.slice(1); 78 }); 79 const toHandlerKey = cacheStringFunction( 80 (str) => { 81 const s = str ? `on${capitalize(str)}` : ``; 82 return s; 83 } 84 ); 85 const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 86 const invokeArrayFns = (fns, ...arg) => { 87 for (let i = 0; i < fns.length; i++) { 88 fns[i](...arg); 89 } 90 }; 91 const def = (obj, key, value, writable = false) => { 92 Object.defineProperty(obj, key, { 93 configurable: true, 94 enumerable: false, 95 writable, 96 value 97 }); 98 }; 99 const looseToNumber = (val) => { 100 const n = parseFloat(val); 101 return isNaN(n) ? val : n; 102 }; 103 const toNumber = (val) => { 104 const n = isString(val) ? Number(val) : NaN; 105 return isNaN(n) ? val : n; 106 }; 107 let _globalThis; 108 const getGlobalThis = () => { 109 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 110 }; 111 function genCacheKey(source, options) { 112 return source + JSON.stringify( 113 options, 114 (_, val) => typeof val === "function" ? val.toString() : val 115 ); 116 } 117 118 const PatchFlagNames = { 119 [1]: `TEXT`, 120 [2]: `CLASS`, 121 [4]: `STYLE`, 122 [8]: `PROPS`, 123 [16]: `FULL_PROPS`, 124 [32]: `NEED_HYDRATION`, 125 [64]: `STABLE_FRAGMENT`, 126 [128]: `KEYED_FRAGMENT`, 127 [256]: `UNKEYED_FRAGMENT`, 128 [512]: `NEED_PATCH`, 129 [1024]: `DYNAMIC_SLOTS`, 130 [2048]: `DEV_ROOT_FRAGMENT`, 131 [-1]: `CACHED`, 132 [-2]: `BAIL` 133 }; 134 135 const slotFlagsText = { 136 [1]: "STABLE", 137 [2]: "DYNAMIC", 138 [3]: "FORWARDED" 139 }; 140 141 const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decode
vendor: 7,201 bytes, lines 141-273
141URI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; 142 const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); 143 144 const range = 2; 145 function generateCodeFrame(source, start = 0, end = source.length) { 146 start = Math.max(0, Math.min(start, source.length)); 147 end = Math.max(0, Math.min(end, source.length)); 148 if (start > end) return ""; 149 let lines = source.split(/(\r?\n)/); 150 const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); 151 lines = lines.filter((_, idx) => idx % 2 === 0); 152 let count = 0; 153 const res = []; 154 for (let i = 0; i < lines.length; i++) { 155 count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); 156 if (count >= start) { 157 for (let j = i - range; j <= i + range || end > count; j++) { 158 if (j < 0 || j >= lines.length) continue; 159 const line = j + 1; 160 res.push( 161 `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` 162 ); 163 const lineLength = lines[j].length; 164 const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; 165 if (j === i) { 166 const pad = start - (count - (lineLength + newLineSeqLength)); 167 const length = Math.max( 168 1, 169 end > count ? lineLength - pad : end - start 170 ); 171 res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); 172 } else if (j > i) { 173 if (end > count) { 174 const length = Math.max(Math.min(end - count, lineLength), 1); 175 res.push(` | ` + "^".repeat(length)); 176 } 177 count += lineLength + newLineSeqLength; 178 } 179 } 180 break; 181 } 182 } 183 return res.join("\n"); 184 } 185 186 function normalizeStyle(value) { 187 if (isArray(value)) { 188 const res = {}; 189 for (let i = 0; i < value.length; i++) { 190 const item = value[i]; 191 const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); 192 if (normalized) { 193 for (const key in normalized) { 194 res[key] = normalized[key]; 195 } 196 } 197 } 198 return res; 199 } else if (isString(value) || isObject(value)) { 200 return value; 201 } 202 } 203 const listDelimiterRE = /;(?![^(]*\))/g; 204 const propertyDelimiterRE = /:([^]+)/; 205 const styleCommentRE = /\/\*[^]*?\*\//g; 206 function parseStringStyle(cssText) { 207 const ret = {}; 208 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { 209 if (item) { 210 const tmp = item.split(propertyDelimiterRE); 211 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 212 } 213 }); 214 return ret; 215 } 216 function stringifyStyle(styles) { 217 if (!styles) return ""; 218 if (isString(styles)) return styles; 219 let ret = ""; 220 for (const key in styles) { 221 const value = styles[key]; 222 if (isString(value) || typeof value === "number") { 223 const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); 224 ret += `${normalizedKey}:${value};`; 225 } 226 } 227 return ret; 228 } 229 function normalizeClass(value) { 230 let res = ""; 231 if (isString(value)) { 232 res = value; 233 } else if (isArray(value)) { 234 for (let i = 0; i < value.length; i++) { 235 const normalized = normalizeClass(value[i]); 236 if (normalized) { 237 res += normalized + " "; 238 } 239 } 240 } else if (isObject(value)) { 241 for (const name in value) { 242 if (value[name]) { 243 res += name + " "; 244 } 245 } 246 } 247 return res.trim(); 248 } 249 function normalizeProps(props) { 250 if (!props) return null; 251 let { class: klass, style } = props; 252 if (klass && !isString(klass)) { 253 props.class = normalizeClass(klass); 254 } 255 if (style) { 256 props.style = normalizeStyle(style); 257 } 258 return props; 259 } 260 261 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"; 262 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"; 263 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"; 264 const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; 265 const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); 266 const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); 267 const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); 268 const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); 269 270 const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 271 const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 272 const isBooleanAttr = /* @__PURE__ */ makeMap( 273 specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,
273checked,muted,multiple,selected` 274 ); 275 function includeBooleanAttr(value) { 276 return !!value || value === ""; 277 } 278 const isKnownHtmlAttr = /* @__PURE__ */ makeMap( 279 `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` 280 ); 281 const isKnownSvgAttr = /* @__PURE__ */ makeMap( 282 `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
vendor: 98,442 bytes, lines 282-3051
282-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` 283 ); 284 function isRenderableAttrValue(value) { 285 if (value == null) { 286 return false; 287 } 288 const type = typeof value; 289 return type === "string" || type === "number" || type === "boolean"; 290 } 291 292 const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; 293 function getEscapedCssVarName(key, doubleEscape) { 294 return key.replace( 295 cssVarNameEscapeSymbolsRE, 296 (s) => `\\${s}` 297 ); 298 } 299 300 function looseCompareArrays(a, b) { 301 if (a.length !== b.length) return false; 302 let equal = true; 303 for (let i = 0; equal && i < a.length; i++) { 304 equal = looseEqual(a[i], b[i]); 305 } 306 return equal; 307 } 308 function looseEqual(a, b) { 309 if (a === b) return true; 310 let aValidType = isDate(a); 311 let bValidType = isDate(b); 312 if (aValidType || bValidType) { 313 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 314 } 315 aValidType = isSymbol(a); 316 bValidType = isSymbol(b); 317 if (aValidType || bValidType) { 318 return a === b; 319 } 320 aValidType = isArray(a); 321 bValidType = isArray(b); 322 if (aValidType || bValidType) { 323 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 324 } 325 aValidType = isObject(a); 326 bValidType = isObject(b); 327 if (aValidType || bValidType) { 328 if (!aValidType || !bValidType) { 329 return false; 330 } 331 const aKeysCount = Object.keys(a).length; 332 const bKeysCount = Object.keys(b).length; 333 if (aKeysCount !== bKeysCount) { 334 return false; 335 } 336 for (const key in a) { 337 const aHasKey = a.hasOwnProperty(key); 338 const bHasKey = b.hasOwnProperty(key); 339 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 340 return false; 341 } 342 } 343 } 344 return String(a) === String(b); 345 } 346 function looseIndexOf(arr, val) { 347 return arr.findIndex((item) => looseEqual(item, val)); 348 } 349 350 const isRef$1 = (val) => { 351 return !!(val && val["__v_isRef"] === true); 352 }; 353 const toDisplayString = (val) => { 354 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); 355 }; 356 const replacer = (_key, val) => { 357 if (isRef$1(val)) { 358 return replacer(_key, val.value); 359 } else if (isMap(val)) { 360 return { 361 [`Map(${val.size})`]: [...val.entries()].reduce( 362 (entries, [key, val2], i) => { 363 entries[stringifySymbol(key, i) + " =>"] = val2; 364 return entries; 365 }, 366 {} 367 ) 368 }; 369 } else if (isSet(val)) { 370 return { 371 [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) 372 }; 373 } else if (isSymbol(val)) { 374 return stringifySymbol(val); 375 } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { 376 return String(val); 377 } 378 return val; 379 }; 380 const stringifySymbol = (v, i = "") => { 381 var _a; 382 return ( 383 // Symbol.description in es2019+ so we need to cast here to pass 384 // the lib: es2016 check 385 isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v 386 ); 387 }; 388 389 function normalizeCssVarValue(value) { 390 if (value == null) { 391 return "initial"; 392 } 393 if (typeof value === "string") { 394 return value === "" ? " " : value; 395 } 396 if (typeof value !== "number" || !Number.isFinite(value)) { 397 { 398 console.warn( 399 "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", 400 value 401 ); 402 } 403 } 404 return String(value); 405 } 406 407 function warn$2(msg, ...args) { 408 console.warn(`[Vue warn] ${msg}`, ...args); 409 } 410 411 let activeEffectScope; 412 class EffectScope { 413 constructor(detached = false) { 414 this.detached = detached; 415 /** 416 * @internal 417 */ 418 this._active = true; 419 /** 420 * @internal track `on` calls, allow `on` call multiple times 421 */ 422 this._on = 0; 423 /** 424 * @internal 425 */ 426 this.effects = []; 427 /** 428 * @internal 429 */ 430 this.cleanups = []; 431 this._isPaused = false; 432 this.parent = activeEffectScope; 433 if (!detached && activeEffectScope) { 434 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 435 this 436 ) - 1; 437 } 438 } 439 get active() { 440 return this._active; 441 } 442 pause() { 443 if (this._active) { 444 this._isPaused = true; 445 let i, l; 446 if (this.scopes) { 447 for (i = 0, l = this.scopes.length; i < l; i++) { 448 this.scopes[i].pause(); 449 } 450 } 451 for (i = 0, l = this.effects.length; i < l; i++) { 452 this.effects[i].pause(); 453 } 454 } 455 } 456 /** 457 * Resumes the effect scope, including all child scopes and effects. 458 */ 459 resume() { 460 if (this._active) { 461 if (this._isPaused) { 462 this._isPaused = false; 463 let i, l; 464 if (this.scopes) { 465 for (i = 0, l = this.scopes.length; i < l; i++) { 466 this.scopes[i].resume(); 467 } 468 } 469 for (i = 0, l = this.effects.length; i < l; i++) { 470 this.effects[i].resume(); 471 } 472 } 473 } 474 } 475 run(fn) { 476 if (this._active) { 477 const currentEffectScope = activeEffectScope; 478 try { 479 activeEffectScope = this; 480 return fn(); 481 } finally { 482 activeEffectScope = currentEffectScope; 483 } 484 } else { 485 warn$2(`cannot run an inactive effect scope.`); 486 } 487 } 488 /** 489 * This should only be called on non-detached scopes 490 * @internal 491 */ 492 on() { 493 if (++this._on === 1) { 494 this.prevScope = activeEffectScope; 495 activeEffectScope = this; 496 } 497 } 498 /** 499 * This should only be called on non-detached scopes 500 * @internal 501 */ 502 off() { 503 if (this._on > 0 && --this._on === 0) { 504 activeEffectScope = this.prevScope; 505 this.prevScope = void 0; 506 } 507 } 508 stop(fromParent) { 509 if (this._active) { 510 this._active = false; 511 let i, l; 512 for (i = 0, l = this.effects.length; i < l; i++) { 513 this.effects[i].stop(); 514 } 515 this.effects.length = 0; 516 for (i = 0, l = this.cleanups.length; i < l; i++) { 517 this.cleanups[i](); 518 } 519 this.cleanups.length = 0; 520 if (this.scopes) { 521 for (i = 0, l = this.scopes.length; i < l; i++) { 522 this.scopes[i].stop(true); 523 } 524 this.scopes.length = 0; 525 } 526 if (!this.detached && this.parent && !fromParent) { 527 const last = this.parent.scopes.pop(); 528 if (last && last !== this) { 529 this.parent.scopes[this.index] = last; 530 last.index = this.index; 531 } 532 } 533 this.parent = void 0; 534 } 535 } 536 } 537 function effectScope(detached) { 538 return new EffectScope(detached); 539 } 540 function getCurrentScope() { 541 return activeEffectScope; 542 } 543 function onScopeDispose(fn, failSilently = false) { 544 if (activeEffectScope) { 545 activeEffectScope.cleanups.push(fn); 546 } else if (!failSilently) { 547 warn$2( 548 `onScopeDispose() is called when there is no active effect scope to be associated with.` 549 ); 550 } 551 } 552 553 let activeSub; 554 const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); 555 class ReactiveEffect { 556 constructor(fn) { 557 this.fn = fn; 558 /** 559 * @internal 560 */ 561 this.deps = void 0; 562 /** 563 * @internal 564 */ 565 this.depsTail = void 0; 566 /** 567 * @internal 568 */ 569 this.flags = 1 | 4; 570 /** 571 * @internal 572 */ 573 this.next = void 0; 574 /** 575 * @internal 576 */ 577 this.cleanup = void 0; 578 this.scheduler = void 0; 579 if (activeEffectScope && activeEffectScope.active) { 580 activeEffectScope.effects.push(this); 581 } 582 } 583 pause() { 584 this.flags |= 64; 585 } 586 resume() { 587 if (this.flags & 64) { 588 this.flags &= -65; 589 if (pausedQueueEffects.has(this)) { 590 pausedQueueEffects.delete(this); 591 this.trigger(); 592 } 593 } 594 } 595 /** 596 * @internal 597 */ 598 notify() { 599 if (this.flags & 2 && !(this.flags & 32)) { 600 return; 601 } 602 if (!(this.flags & 8)) { 603 batch(this); 604 } 605 } 606 run() { 607 if (!(this.flags & 1)) { 608 return this.fn(); 609 } 610 this.flags |= 2; 611 cleanupEffect(this); 612 prepareDeps(this); 613 const prevEffect = activeSub; 614 const prevShouldTrack = shouldTrack; 615 activeSub = this; 616 shouldTrack = true; 617 try { 618 return this.fn(); 619 } finally { 620 if (activeSub !== this) { 621 warn$2( 622 "Active effect was not restored correctly - this is likely a Vue internal bug." 623 ); 624 } 625 cleanupDeps(this); 626 activeSub = prevEffect; 627 shouldTrack = prevShouldTrack; 628 this.flags &= -3; 629 } 630 } 631 stop() { 632 if (this.flags & 1) { 633 for (let link = this.deps; link; link = link.nextDep) { 634 removeSub(link); 635 } 636 this.deps = this.depsTail = void 0; 637 cleanupEffect(this); 638 this.onStop && this.onStop(); 639 this.flags &= -2; 640 } 641 } 642 trigger() { 643 if (this.flags & 64) { 644 pausedQueueEffects.add(this); 645 } else if (this.scheduler) { 646 this.scheduler(); 647 } else { 648 this.runIfDirty(); 649 } 650 } 651 /** 652 * @internal 653 */ 654 runIfDirty() { 655 if (isDirty(this)) { 656 this.run(); 657 } 658 } 659 get dirty() { 660 return isDirty(this); 661 } 662 } 663 let batchDepth = 0; 664 let batchedSub; 665 let batchedComputed; 666 function batch(sub, isComputed = false) { 667 sub.flags |= 8; 668 if (isComputed) { 669 sub.next = batchedComputed; 670 batchedComputed = sub; 671 return; 672 } 673 sub.next = batchedSub; 674 batchedSub = sub; 675 } 676 function startBatch() { 677 batchDepth++; 678 } 679 function endBatch() { 680 if (--batchDepth > 0) { 681 return; 682 } 683 if (batchedComputed) { 684 let e = batchedComputed; 685 batchedComputed = void 0; 686 while (e) { 687 const next = e.next; 688 e.next = void 0; 689 e.flags &= -9; 690 e = next; 691 } 692 } 693 let error; 694 while (batchedSub) { 695 let e = batchedSub; 696 batchedSub = void 0; 697 while (e) { 698 const next = e.next; 699 e.next = void 0; 700 e.flags &= -9; 701 if (e.flags & 1) { 702 try { 703 ; 704 e.trigger(); 705 } catch (err) { 706 if (!error) error = err; 707 } 708 } 709 e = next; 710 } 711 } 712 if (error) throw error; 713 } 714 function prepareDeps(sub) { 715 for (let link = sub.deps; link; link = link.nextDep) { 716 link.version = -1; 717 link.prevActiveLink = link.dep.activeLink; 718 link.dep.activeLink = link; 719 } 720 } 721 function cleanupDeps(sub) { 722 let head; 723 let tail = sub.depsTail; 724 let link = tail; 725 while (link) { 726 const prev = link.prevDep; 727 if (link.version === -1) { 728 if (link === tail) tail = prev; 729 removeSub(link); 730 removeDep(link); 731 } else { 732 head = link; 733 } 734 link.dep.activeLink = link.prevActiveLink; 735 link.prevActiveLink = void 0; 736 link = prev; 737 } 738 sub.deps = head; 739 sub.depsTail = tail; 740 } 741 function isDirty(sub) { 742 for (let link = sub.deps; link; link = link.nextDep) { 743 if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) { 744 return true; 745 } 746 } 747 if (sub._dirty) { 748 return true; 749 } 750 return false; 751 } 752 function refreshComputed(computed) { 753 if (computed.flags & 4 && !(computed.flags & 16)) { 754 return; 755 } 756 computed.flags &= -17; 757 if (computed.globalVersion === globalVersion) { 758 return; 759 } 760 computed.globalVersion = globalVersion; 761 if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) { 762 return; 763 } 764 computed.flags |= 2; 765 const dep = computed.dep; 766 const prevSub = activeSub; 767 const prevShouldTrack = shouldTrack; 768 activeSub = computed; 769 shouldTrack = true; 770 try { 771 prepareDeps(computed); 772 const value = computed.fn(computed._value); 773 if (dep.version === 0 || hasChanged(value, computed._value)) { 774 computed.flags |= 128; 775 computed._value = value; 776 dep.version++; 777 } 778 } catch (err) { 779 dep.version++; 780 throw err; 781 } finally { 782 activeSub = prevSub; 783 shouldTrack = prevShouldTrack; 784 cleanupDeps(computed); 785 computed.flags &= -3; 786 } 787 } 788 function removeSub(link, soft = false) { 789 const { dep, prevSub, nextSub } = link; 790 if (prevSub) { 791 prevSub.nextSub = nextSub; 792 link.prevSub = void 0; 793 } 794 if (nextSub) { 795 nextSub.prevSub = prevSub; 796 link.nextSub = void 0; 797 } 798 if (dep.subsHead === link) { 799 dep.subsHead = nextSub; 800 } 801 if (dep.subs === link) { 802 dep.subs = prevSub; 803 if (!prevSub && dep.computed) { 804 dep.computed.flags &= -5; 805 for (let l = dep.computed.deps; l; l = l.nextDep) { 806 removeSub(l, true); 807 } 808 } 809 } 810 if (!soft && !--dep.sc && dep.map) { 811 dep.map.delete(dep.key); 812 } 813 } 814 function removeDep(link) { 815 const { prevDep, nextDep } = link; 816 if (prevDep) { 817 prevDep.nextDep = nextDep; 818 link.prevDep = void 0; 819 } 820 if (nextDep) { 821 nextDep.prevDep = prevDep; 822 link.nextDep = void 0; 823 } 824 } 825 function effect(fn, options) { 826 if (fn.effect instanceof ReactiveEffect) { 827 fn = fn.effect.fn; 828 } 829 const e = new ReactiveEffect(fn); 830 if (options) { 831 extend(e, options); 832 } 833 try { 834 e.run(); 835 } catch (err) { 836 e.stop(); 837 throw err; 838 } 839 const runner = e.run.bind(e); 840 runner.effect = e; 841 return runner; 842 } 843 function stop(runner) { 844 runner.effect.stop(); 845 } 846 let shouldTrack = true; 847 const trackStack = []; 848 function pauseTracking() { 849 trackStack.push(shouldTrack); 850 shouldTrack = false; 851 } 852 function resetTracking() { 853 const last = trackStack.pop(); 854 shouldTrack = last === void 0 ? true : last; 855 } 856 function cleanupEffect(e) { 857 const { cleanup } = e; 858 e.cleanup = void 0; 859 if (cleanup) { 860 const prevSub = activeSub; 861 activeSub = void 0; 862 try { 863 cleanup(); 864 } finally { 865 activeSub = prevSub; 866 } 867 } 868 } 869 870 let globalVersion = 0; 871 class Link { 872 constructor(sub, dep) { 873 this.sub = sub; 874 this.dep = dep; 875 this.version = dep.version; 876 this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; 877 } 878 } 879 class Dep { 880 // TODO isolatedDeclarations "__v_skip" 881 constructor(computed) { 882 this.computed = computed; 883 this.version = 0; 884 /** 885 * Link between this dep and the current active effect 886 */ 887 this.activeLink = void 0; 888 /** 889 * Doubly linked list representing the subscribing effects (tail) 890 */ 891 this.subs = void 0; 892 /** 893 * For object property deps cleanup 894 */ 895 this.map = void 0; 896 this.key = void 0; 897 /** 898 * Subscriber counter 899 */ 900 this.sc = 0; 901 /** 902 * @internal 903 */ 904 this.__v_skip = true; 905 { 906 this.subsHead = void 0; 907 } 908 } 909 track(debugInfo) { 910 if (!activeSub || !shouldTrack || activeSub === this.computed) { 911 return; 912 } 913 let link = this.activeLink; 914 if (link === void 0 || link.sub !== activeSub) { 915 link = this.activeLink = new Link(activeSub, this); 916 if (!activeSub.deps) { 917 activeSub.deps = activeSub.depsTail = link; 918 } else { 919 link.prevDep = activeSub.depsTail; 920 activeSub.depsTail.nextDep = link; 921 activeSub.depsTail = link; 922 } 923 addSub(link); 924 } else if (link.version === -1) { 925 link.version = this.version; 926 if (link.nextDep) { 927 const next = link.nextDep; 928 next.prevDep = link.prevDep; 929 if (link.prevDep) { 930 link.prevDep.nextDep = next; 931 } 932 link.prevDep = activeSub.depsTail; 933 link.nextDep = void 0; 934 activeSub.depsTail.nextDep = link; 935 activeSub.depsTail = link; 936 if (activeSub.deps === link) { 937 activeSub.deps = next; 938 } 939 } 940 } 941 if (activeSub.onTrack) { 942 activeSub.onTrack( 943 extend( 944 { 945 effect: activeSub 946 }, 947 debugInfo 948 ) 949 ); 950 } 951 return link; 952 } 953 trigger(debugInfo) { 954 this.version++; 955 globalVersion++; 956 this.notify(debugInfo); 957 } 958 notify(debugInfo) { 959 startBatch(); 960 try { 961 if (true) { 962 for (let head = this.subsHead; head; head = head.nextSub) { 963 if (head.sub.onTrigger && !(head.sub.flags & 8)) { 964 head.sub.onTrigger( 965 extend( 966 { 967 effect: head.sub 968 }, 969 debugInfo 970 ) 971 ); 972 } 973 } 974 } 975 for (let link = this.subs; link; link = link.prevSub) { 976 if (link.sub.notify()) { 977 ; 978 link.sub.dep.notify(); 979 } 980 } 981 } finally { 982 endBatch(); 983 } 984 } 985 } 986 function addSub(link) { 987 link.dep.sc++; 988 if (link.sub.flags & 4) { 989 const computed = link.dep.computed; 990 if (computed && !link.dep.subs) { 991 computed.flags |= 4 | 16; 992 for (let l = computed.deps; l; l = l.nextDep) { 993 addSub(l); 994 } 995 } 996 const currentTail = link.dep.subs; 997 if (currentTail !== link) { 998 link.prevSub = currentTail; 999 if (currentTail) currentTail.nextSub = link; 1000 } 1001 if (link.dep.subsHead === void 0) { 1002 link.dep.subsHead = link; 1003 } 1004 link.dep.subs = link; 1005 } 1006 } 1007 const targetMap = /* @__PURE__ */ new WeakMap(); 1008 const ITERATE_KEY = Symbol( 1009 "Object iterate" 1010 ); 1011 const MAP_KEY_ITERATE_KEY = Symbol( 1012 "Map keys iterate" 1013 ); 1014 const ARRAY_ITERATE_KEY = Symbol( 1015 "Array iterate" 1016 ); 1017 function track(target, type, key) { 1018 if (shouldTrack && activeSub) { 1019 let depsMap = targetMap.get(target); 1020 if (!depsMap) { 1021 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 1022 } 1023 let dep = depsMap.get(key); 1024 if (!dep) { 1025 depsMap.set(key, dep = new Dep()); 1026 dep.map = depsMap; 1027 dep.key = key; 1028 } 1029 { 1030 dep.track({ 1031 target, 1032 type, 1033 key 1034 }); 1035 } 1036 } 1037 } 1038 function trigger(target, type, key, newValue, oldValue, oldTarget) { 1039 const depsMap = targetMap.get(target); 1040 if (!depsMap) { 1041 globalVersion++; 1042 return; 1043 } 1044 const run = (dep) => { 1045 if (dep) { 1046 { 1047 dep.trigger({ 1048 target, 1049 type, 1050 key, 1051 newValue, 1052 oldValue, 1053 oldTarget 1054 }); 1055 } 1056 } 1057 }; 1058 startBatch(); 1059 if (type === "clear") { 1060 depsMap.forEach(run); 1061 } else { 1062 const targetIsArray = isArray(target); 1063 const isArrayIndex = targetIsArray && isIntegerKey(key); 1064 if (targetIsArray && key === "length") { 1065 const newLength = Number(newValue); 1066 depsMap.forEach((dep, key2) => { 1067 if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) { 1068 run(dep); 1069 } 1070 }); 1071 } else { 1072 if (key !== void 0 || depsMap.has(void 0)) { 1073 run(depsMap.get(key)); 1074 } 1075 if (isArrayIndex) { 1076 run(depsMap.get(ARRAY_ITERATE_KEY)); 1077 } 1078 switch (type) { 1079 case "add": 1080 if (!targetIsArray) { 1081 run(depsMap.get(ITERATE_KEY)); 1082 if (isMap(target)) { 1083 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1084 } 1085 } else if (isArrayIndex) { 1086 run(depsMap.get("length")); 1087 } 1088 break; 1089 case "delete": 1090 if (!targetIsArray) { 1091 run(depsMap.get(ITERATE_KEY)); 1092 if (isMap(target)) { 1093 run(depsMap.get(MAP_KEY_ITERATE_KEY)); 1094 } 1095 } 1096 break; 1097 case "set": 1098 if (isMap(target)) { 1099 run(depsMap.get(ITERATE_KEY)); 1100 } 1101 break; 1102 } 1103 } 1104 } 1105 endBatch(); 1106 } 1107 function getDepFromReactive(object, key) { 1108 const depMap = targetMap.get(object); 1109 return depMap && depMap.get(key); 1110 } 1111 1112 function reactiveReadArray(array) { 1113 const raw = toRaw(array); 1114 if (raw === array) return raw; 1115 track(raw, "iterate", ARRAY_ITERATE_KEY); 1116 return isShallow(array) ? raw : raw.map(toReactive); 1117 } 1118 function shallowReadArray(arr) { 1119 track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); 1120 return arr; 1121 } 1122 function toWrapped(target, item) { 1123 if (isReadonly(target)) { 1124 return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item); 1125 } 1126 return toReactive(item); 1127 } 1128 const arrayInstrumentations = { 1129 __proto__: null, 1130 [Symbol.iterator]() { 1131 return iterator(this, Symbol.iterator, (item) => toWrapped(this, item)); 1132 }, 1133 concat(...args) { 1134 return reactiveReadArray(this).concat( 1135 ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x) 1136 ); 1137 }, 1138 entries() { 1139 return iterator(this, "entries", (value) => { 1140 value[1] = toWrapped(this, value[1]); 1141 return value; 1142 }); 1143 }, 1144 every(fn, thisArg) { 1145 return apply(this, "every", fn, thisArg, void 0, arguments); 1146 }, 1147 filter(fn, thisArg) { 1148 return apply( 1149 this, 1150 "filter", 1151 fn, 1152 thisArg, 1153 (v) => v.map((item) => toWrapped(this, item)), 1154 arguments 1155 ); 1156 }, 1157 find(fn, thisArg) { 1158 return apply( 1159 this, 1160 "find", 1161 fn, 1162 thisArg, 1163 (item) => toWrapped(this, item), 1164 arguments 1165 ); 1166 }, 1167 findIndex(fn, thisArg) { 1168 return apply(this, "findIndex", fn, thisArg, void 0, arguments); 1169 }, 1170 findLast(fn, thisArg) { 1171 return apply( 1172 this, 1173 "findLast", 1174 fn, 1175 thisArg, 1176 (item) => toWrapped(this, item), 1177 arguments 1178 ); 1179 }, 1180 findLastIndex(fn, thisArg) { 1181 return apply(this, "findLastIndex", fn, thisArg, void 0, arguments); 1182 }, 1183 // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement 1184 forEach(fn, thisArg) { 1185 return apply(this, "forEach", fn, thisArg, void 0, arguments); 1186 }, 1187 includes(...args) { 1188 return searchProxy(this, "includes", args); 1189 }, 1190 indexOf(...args) { 1191 return searchProxy(this, "indexOf", args); 1192 }, 1193 join(separator) { 1194 return reactiveReadArray(this).join(separator); 1195 }, 1196 // keys() iterator only reads `length`, no optimization required 1197 lastIndexOf(...args) { 1198 return searchProxy(this, "lastIndexOf", args); 1199 }, 1200 map(fn, thisArg) { 1201 return apply(this, "map", fn, thisArg, void 0, arguments); 1202 }, 1203 pop() { 1204 return noTracking(this, "pop"); 1205 }, 1206 push(...args) { 1207 return noTracking(this, "push", args); 1208 }, 1209 reduce(fn, ...args) { 1210 return reduce(this, "reduce", fn, args); 1211 }, 1212 reduceRight(fn, ...args) { 1213 return reduce(this, "reduceRight", fn, args); 1214 }, 1215 shift() { 1216 return noTracking(this, "shift"); 1217 }, 1218 // slice could use ARRAY_ITERATE but also seems to beg for range tracking 1219 some(fn, thisArg) { 1220 return apply(this, "some", fn, thisArg, void 0, arguments); 1221 }, 1222 splice(...args) { 1223 return noTracking(this, "splice", args); 1224 }, 1225 toReversed() { 1226 return reactiveReadArray(this).toReversed(); 1227 }, 1228 toSorted(comparer) { 1229 return reactiveReadArray(this).toSorted(comparer); 1230 }, 1231 toSpliced(...args) { 1232 return reactiveReadArray(this).toSpliced(...args); 1233 }, 1234 unshift(...args) { 1235 return noTracking(this, "unshift", args); 1236 }, 1237 values() { 1238 return iterator(this, "values", (item) => toWrapped(this, item)); 1239 } 1240 }; 1241 function iterator(self, method, wrapValue) { 1242 const arr = shallowReadArray(self); 1243 const iter = arr[method](); 1244 if (arr !== self && !isShallow(self)) { 1245 iter._next = iter.next; 1246 iter.next = () => { 1247 const result = iter._next(); 1248 if (!result.done) { 1249 result.value = wrapValue(result.value); 1250 } 1251 return result; 1252 }; 1253 } 1254 return iter; 1255 } 1256 const arrayProto = Array.prototype; 1257 function apply(self, method, fn, thisArg, wrappedRetFn, args) { 1258 const arr = shallowReadArray(self); 1259 const needsWrap = arr !== self && !isShallow(self); 1260 const methodFn = arr[method]; 1261 if (methodFn !== arrayProto[method]) { 1262 const result2 = methodFn.apply(self, args); 1263 return needsWrap ? toReactive(result2) : result2; 1264 } 1265 let wrappedFn = fn; 1266 if (arr !== self) { 1267 if (needsWrap) { 1268 wrappedFn = function (item, index) { 1269 return fn.call(this, toWrapped(self, item), index, self); 1270 }; 1271 } else if (fn.length > 2) { 1272 wrappedFn = function (item, index) { 1273 return fn.call(this, item, index, self); 1274 }; 1275 } 1276 } 1277 const result = methodFn.call(arr, wrappedFn, thisArg); 1278 return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; 1279 } 1280 function reduce(self, method, fn, args) { 1281 const arr = shallowReadArray(self); 1282 let wrappedFn = fn; 1283 if (arr !== self) { 1284 if (!isShallow(self)) { 1285 wrappedFn = function (acc, item, index) { 1286 return fn.call(this, acc, toWrapped(self, item), index, self); 1287 }; 1288 } else if (fn.length > 3) { 1289 wrappedFn = function (acc, item, index) { 1290 return fn.call(this, acc, item, index, self); 1291 }; 1292 } 1293 } 1294 return arr[method](wrappedFn, ...args); 1295 } 1296 function searchProxy(self, method, args) { 1297 const arr = toRaw(self); 1298 track(arr, "iterate", ARRAY_ITERATE_KEY); 1299 const res = arr[method](...args); 1300 if ((res === -1 || res === false) && isProxy(args[0])) { 1301 args[0] = toRaw(args[0]); 1302 return arr[method](...args); 1303 } 1304 return res; 1305 } 1306 function noTracking(self, method, args = []) { 1307 pauseTracking(); 1308 startBatch(); 1309 const res = toRaw(self)[method].apply(self, args); 1310 endBatch(); 1311 resetTracking(); 1312 return res; 1313 } 1314 1315 const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 1316 const builtInSymbols = new Set( 1317 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) 1318 ); 1319 function hasOwnProperty(key) { 1320 if (!isSymbol(key)) key = String(key); 1321 const obj = toRaw(this); 1322 track(obj, "has", key); 1323 return obj.hasOwnProperty(key); 1324 } 1325 class BaseReactiveHandler { 1326 constructor(_isReadonly = false, _isShallow = false) { 1327 this._isReadonly = _isReadonly; 1328 this._isShallow = _isShallow; 1329 } 1330 get(target, key, receiver) { 1331 if (key === "__v_skip") return target["__v_skip"]; 1332 const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; 1333 if (key === "__v_isReactive") { 1334 return !isReadonly2; 1335 } else if (key === "__v_isReadonly") { 1336 return isReadonly2; 1337 } else if (key === "__v_isShallow") { 1338 return isShallow2; 1339 } else if (key === "__v_raw") { 1340 if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype 1341 // this means the receiver is a user proxy of the reactive proxy 1342 Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { 1343 return target; 1344 } 1345 return; 1346 } 1347 const targetIsArray = isArray(target); 1348 if (!isReadonly2) { 1349 let fn; 1350 if (targetIsArray && (fn = arrayInstrumentations[key])) { 1351 return fn; 1352 } 1353 if (key === "hasOwnProperty") { 1354 return hasOwnProperty; 1355 } 1356 } 1357 const res = Reflect.get( 1358 target, 1359 key, 1360 // if this is a proxy wrapping a ref, return methods using the raw ref 1361 // as receiver so that we don't have to call `toRaw` on the ref in all 1362 // its class methods 1363 isRef(target) ? target : receiver 1364 ); 1365 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 1366 return res; 1367 } 1368 if (!isReadonly2) { 1369 track(target, "get", key); 1370 } 1371 if (isShallow2) { 1372 return res; 1373 } 1374 if (isRef(res)) { 1375 const value = targetIsArray && isIntegerKey(key) ? res : res.value; 1376 return isReadonly2 && isObject(value) ? readonly(value) : value; 1377 } 1378 if (isObject(res)) { 1379 return isReadonly2 ? readonly(res) : reactive(res); 1380 } 1381 return res; 1382 } 1383 } 1384 class MutableReactiveHandler extends BaseReactiveHandler { 1385 constructor(isShallow2 = false) { 1386 super(false, isShallow2); 1387 } 1388 set(target, key, value, receiver) { 1389 let oldValue = target[key]; 1390 const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key); 1391 if (!this._isShallow) { 1392 const isOldValueReadonly = isReadonly(oldValue); 1393 if (!isShallow(value) && !isReadonly(value)) { 1394 oldValue = toRaw(oldValue); 1395 value = toRaw(value); 1396 } 1397 if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) { 1398 if (isOldValueReadonly) { 1399 { 1400 warn$2( 1401 `Set operation on key "${String(key)}" failed: target is readonly.`, 1402 target[key] 1403 ); 1404 } 1405 return true; 1406 } else { 1407 oldValue.value = value; 1408 return true; 1409 } 1410 } 1411 } 1412 const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key); 1413 const result = Reflect.set( 1414 target, 1415 key, 1416 value, 1417 isRef(target) ? target : receiver 1418 ); 1419 if (target === toRaw(receiver)) { 1420 if (!hadKey) { 1421 trigger(target, "add", key, value); 1422 } else if (hasChanged(value, oldValue)) { 1423 trigger(target, "set", key, value, oldValue); 1424 } 1425 } 1426 return result; 1427 } 1428 deleteProperty(target, key) { 1429 const hadKey = hasOwn(target, key); 1430 const oldValue = target[key]; 1431 const result = Reflect.deleteProperty(target, key); 1432 if (result && hadKey) { 1433 trigger(target, "delete", key, void 0, oldValue); 1434 } 1435 return result; 1436 } 1437 has(target, key) { 1438 const result = Reflect.has(target, key); 1439 if (!isSymbol(key) || !builtInSymbols.has(key)) { 1440 track(target, "has", key); 1441 } 1442 return result; 1443 } 1444 ownKeys(target) { 1445 track( 1446 target, 1447 "iterate", 1448 isArray(target) ? "length" : ITERATE_KEY 1449 ); 1450 return Reflect.ownKeys(target); 1451 } 1452 } 1453 class ReadonlyReactiveHandler extends BaseReactiveHandler { 1454 constructor(isShallow2 = false) { 1455 super(true, isShallow2); 1456 } 1457 set(target, key) { 1458 { 1459 warn$2( 1460 `Set operation on key "${String(key)}" failed: target is readonly.`, 1461 target 1462 ); 1463 } 1464 return true; 1465 } 1466 deleteProperty(target, key) { 1467 { 1468 warn$2( 1469 `Delete operation on key "${String(key)}" failed: target is readonly.`, 1470 target 1471 ); 1472 } 1473 return true; 1474 } 1475 } 1476 const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); 1477 const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); 1478 const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); 1479 const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); 1480 1481 const toShallow = (value) => value; 1482 const getProto = (v) => Reflect.getPrototypeOf(v); 1483 function createIterableMethod(method, isReadonly2, isShallow2) { 1484 return function (...args) { 1485 const target = this["__v_raw"]; 1486 const rawTarget = toRaw(target); 1487 const targetIsMap = isMap(rawTarget); 1488 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 1489 const isKeyOnly = method === "keys" && targetIsMap; 1490 const innerIterator = target[method](...args); 1491 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 1492 !isReadonly2 && track( 1493 rawTarget, 1494 "iterate", 1495 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 1496 ); 1497 return { 1498 // iterator protocol 1499 next() { 1500 const { value, done } = innerIterator.next(); 1501 return done ? { value, done } : { 1502 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 1503 done 1504 }; 1505 }, 1506 // iterable protocol 1507 [Symbol.iterator]() { 1508 return this; 1509 } 1510 }; 1511 }; 1512 } 1513 function createReadonlyMethod(type) { 1514 return function (...args) { 1515 { 1516 const key = args[0] ? `on key "${args[0]}" ` : ``; 1517 warn$2( 1518 `${capitalize(type)} operation ${key}failed: target is readonly.`, 1519 toRaw(this) 1520 ); 1521 } 1522 return type === "delete" ? false : type === "clear" ? void 0 : this; 1523 }; 1524 } 1525 function createInstrumentations(readonly, shallow) { 1526 const instrumentations = { 1527 get(key) { 1528 const target = this["__v_raw"]; 1529 const rawTarget = toRaw(target); 1530 const rawKey = toRaw(key); 1531 if (!readonly) { 1532 if (hasChanged(key, rawKey)) { 1533 track(rawTarget, "get", key); 1534 } 1535 track(rawTarget, "get", rawKey); 1536 } 1537 const { has } = getProto(rawTarget); 1538 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1539 if (has.call(rawTarget, key)) { 1540 return wrap(target.get(key)); 1541 } else if (has.call(rawTarget, rawKey)) { 1542 return wrap(target.get(rawKey)); 1543 } else if (target !== rawTarget) { 1544 target.get(key); 1545 } 1546 }, 1547 get size() { 1548 const target = this["__v_raw"]; 1549 !readonly && track(toRaw(target), "iterate", ITERATE_KEY); 1550 return target.size; 1551 }, 1552 has(key) { 1553 const target = this["__v_raw"]; 1554 const rawTarget = toRaw(target); 1555 const rawKey = toRaw(key); 1556 if (!readonly) { 1557 if (hasChanged(key, rawKey)) { 1558 track(rawTarget, "has", key); 1559 } 1560 track(rawTarget, "has", rawKey); 1561 } 1562 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 1563 }, 1564 forEach(callback, thisArg) { 1565 const observed = this; 1566 const target = observed["__v_raw"]; 1567 const rawTarget = toRaw(target); 1568 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive; 1569 !readonly && track(rawTarget, "iterate", ITERATE_KEY); 1570 return target.forEach((value, key) => { 1571 return callback.call(thisArg, wrap(value), wrap(key), observed); 1572 }); 1573 } 1574 }; 1575 extend( 1576 instrumentations, 1577 readonly ? { 1578 add: createReadonlyMethod("add"), 1579 set: createReadonlyMethod("set"), 1580 delete: createReadonlyMethod("delete"), 1581 clear: createReadonlyMethod("clear") 1582 } : { 1583 add(value) { 1584 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1585 value = toRaw(value); 1586 } 1587 const target = toRaw(this); 1588 const proto = getProto(target); 1589 const hadKey = proto.has.call(target, value); 1590 if (!hadKey) { 1591 target.add(value); 1592 trigger(target, "add", value, value); 1593 } 1594 return this; 1595 }, 1596 set(key, value) { 1597 if (!shallow && !isShallow(value) && !isReadonly(value)) { 1598 value = toRaw(value); 1599 } 1600 const target = toRaw(this); 1601 const { has, get } = getProto(target); 1602 let hadKey = has.call(target, key); 1603 if (!hadKey) { 1604 key = toRaw(key); 1605 hadKey = has.call(target, key); 1606 } else { 1607 checkIdentityKeys(target, has, key); 1608 } 1609 const oldValue = get.call(target, key); 1610 target.set(key, value); 1611 if (!hadKey) { 1612 trigger(target, "add", key, value); 1613 } else if (hasChanged(value, oldValue)) { 1614 trigger(target, "set", key, value, oldValue); 1615 } 1616 return this; 1617 }, 1618 delete(key) { 1619 const target = toRaw(this); 1620 const { has, get } = getProto(target); 1621 let hadKey = has.call(target, key); 1622 if (!hadKey) { 1623 key = toRaw(key); 1624 hadKey = has.call(target, key); 1625 } else { 1626 checkIdentityKeys(target, has, key); 1627 } 1628 const oldValue = get ? get.call(target, key) : void 0; 1629 const result = target.delete(key); 1630 if (hadKey) { 1631 trigger(target, "delete", key, void 0, oldValue); 1632 } 1633 return result; 1634 }, 1635 clear() { 1636 const target = toRaw(this); 1637 const hadItems = target.size !== 0; 1638 const oldTarget = isMap(target) ? new Map(target) : new Set(target); 1639 const result = target.clear(); 1640 if (hadItems) { 1641 trigger( 1642 target, 1643 "clear", 1644 void 0, 1645 void 0, 1646 oldTarget 1647 ); 1648 } 1649 return result; 1650 } 1651 } 1652 ); 1653 const iteratorMethods = [ 1654 "keys", 1655 "values", 1656 "entries", 1657 Symbol.iterator 1658 ]; 1659 iteratorMethods.forEach((method) => { 1660 instrumentations[method] = createIterableMethod(method, readonly, shallow); 1661 }); 1662 return instrumentations; 1663 } 1664 function createInstrumentationGetter(isReadonly2, shallow) { 1665 const instrumentations = createInstrumentations(isReadonly2, shallow); 1666 return (target, key, receiver) => { 1667 if (key === "__v_isReactive") { 1668 return !isReadonly2; 1669 } else if (key === "__v_isReadonly") { 1670 return isReadonly2; 1671 } else if (key === "__v_raw") { 1672 return target; 1673 } 1674 return Reflect.get( 1675 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 1676 key, 1677 receiver 1678 ); 1679 }; 1680 } 1681 const mutableCollectionHandlers = { 1682 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 1683 }; 1684 const shallowCollectionHandlers = { 1685 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 1686 }; 1687 const readonlyCollectionHandlers = { 1688 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 1689 }; 1690 const shallowReadonlyCollectionHandlers = { 1691 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 1692 }; 1693 function checkIdentityKeys(target, has, key) { 1694 const rawKey = toRaw(key); 1695 if (rawKey !== key && has.call(target, rawKey)) { 1696 const type = toRawType(target); 1697 warn$2( 1698 `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.` 1699 ); 1700 } 1701 } 1702 1703 const reactiveMap = /* @__PURE__ */ new WeakMap(); 1704 const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1705 const readonlyMap = /* @__PURE__ */ new WeakMap(); 1706 const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1707 function targetTypeMap(rawType) { 1708 switch (rawType) { 1709 case "Object": 1710 case "Array": 1711 return 1 /* COMMON */; 1712 case "Map": 1713 case "Set": 1714 case "WeakMap": 1715 case "WeakSet": 1716 return 2 /* COLLECTION */; 1717 default: 1718 return 0 /* INVALID */; 1719 } 1720 } 1721 function getTargetType(value) { 1722 return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); 1723 } 1724 function reactive(target) { 1725 if (isReadonly(target)) { 1726 return target; 1727 } 1728 return createReactiveObject( 1729 target, 1730 false, 1731 mutableHandlers, 1732 mutableCollectionHandlers, 1733 reactiveMap 1734 ); 1735 } 1736 function shallowReactive(target) { 1737 return createReactiveObject( 1738 target, 1739 false, 1740 shallowReactiveHandlers, 1741 shallowCollectionHandlers, 1742 shallowReactiveMap 1743 ); 1744 } 1745 function readonly(target) { 1746 return createReactiveObject( 1747 target, 1748 true, 1749 readonlyHandlers, 1750 readonlyCollectionHandlers, 1751 readonlyMap 1752 ); 1753 } 1754 function shallowReadonly(target) { 1755 return createReactiveObject( 1756 target, 1757 true, 1758 shallowReadonlyHandlers, 1759 shallowReadonlyCollectionHandlers, 1760 shallowReadonlyMap 1761 ); 1762 } 1763 function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1764 if (!isObject(target)) { 1765 { 1766 warn$2( 1767 `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( 1768 target 1769 )}` 1770 ); 1771 } 1772 return target; 1773 } 1774 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1775 return target; 1776 } 1777 const targetType = getTargetType(target); 1778 if (targetType === 0 /* INVALID */) { 1779 return target; 1780 } 1781 const existingProxy = proxyMap.get(target); 1782 if (existingProxy) { 1783 return existingProxy; 1784 } 1785 const proxy = new Proxy( 1786 target, 1787 targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers 1788 ); 1789 proxyMap.set(target, proxy); 1790 return proxy; 1791 } 1792 function isReactive(value) { 1793 if (isReadonly(value)) { 1794 return isReactive(value["__v_raw"]); 1795 } 1796 return !!(value && value["__v_isReactive"]); 1797 } 1798 function isReadonly(value) { 1799 return !!(value && value["__v_isReadonly"]); 1800 } 1801 function isShallow(value) { 1802 return !!(value && value["__v_isShallow"]); 1803 } 1804 function isProxy(value) { 1805 return value ? !!value["__v_raw"] : false; 1806 } 1807 function toRaw(observed) { 1808 const raw = observed && observed["__v_raw"]; 1809 return raw ? toRaw(raw) : observed; 1810 } 1811 function markRaw(value) { 1812 if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) { 1813 def(value, "__v_skip", true); 1814 } 1815 return value; 1816 } 1817 const toReactive = (value) => isObject(value) ? reactive(value) : value; 1818 const toReadonly = (value) => isObject(value) ? readonly(value) : value; 1819 1820 function isRef(r) { 1821 return r ? r["__v_isRef"] === true : false; 1822 } 1823 function ref(value) { 1824 return createRef(value, false); 1825 } 1826 function shallowRef(value) { 1827 return createRef(value, true); 1828 } 1829 function createRef(rawValue, shallow) { 1830 if (isRef(rawValue)) { 1831 return rawValue; 1832 } 1833 return new RefImpl(rawValue, shallow); 1834 } 1835 class RefImpl { 1836 constructor(value, isShallow2) { 1837 this.dep = new Dep(); 1838 this["__v_isRef"] = true; 1839 this["__v_isShallow"] = false; 1840 this._rawValue = isShallow2 ? value : toRaw(value); 1841 this._value = isShallow2 ? value : toReactive(value); 1842 this["__v_isShallow"] = isShallow2; 1843 } 1844 get value() { 1845 { 1846 this.dep.track({ 1847 target: this, 1848 type: "get", 1849 key: "value" 1850 }); 1851 } 1852 return this._value; 1853 } 1854 set value(newValue) { 1855 const oldValue = this._rawValue; 1856 const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue); 1857 newValue = useDirectValue ? newValue : toRaw(newValue); 1858 if (hasChanged(newValue, oldValue)) { 1859 this._rawValue = newValue; 1860 this._value = useDirectValue ? newValue : toReactive(newValue); 1861 { 1862 this.dep.trigger({ 1863 target: this, 1864 type: "set", 1865 key: "value", 1866 newValue, 1867 oldValue 1868 }); 1869 } 1870 } 1871 } 1872 } 1873 function triggerRef(ref2) { 1874 if (ref2.dep) { 1875 { 1876 ref2.dep.trigger({ 1877 target: ref2, 1878 type: "set", 1879 key: "value", 1880 newValue: ref2._value 1881 }); 1882 } 1883 } 1884 } 1885 function unref(ref2) { 1886 return isRef(ref2) ? ref2.value : ref2; 1887 } 1888 function toValue(source) { 1889 return isFunction(source) ? source() : unref(source); 1890 } 1891 const shallowUnwrapHandlers = { 1892 get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)), 1893 set: (target, key, value, receiver) => { 1894 const oldValue = target[key]; 1895 if (isRef(oldValue) && !isRef(value)) { 1896 oldValue.value = value; 1897 return true; 1898 } else { 1899 return Reflect.set(target, key, value, receiver); 1900 } 1901 } 1902 }; 1903 function proxyRefs(objectWithRefs) { 1904 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1905 } 1906 class CustomRefImpl { 1907 constructor(factory) { 1908 this["__v_isRef"] = true; 1909 this._value = void 0; 1910 const dep = this.dep = new Dep(); 1911 const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); 1912 this._get = get; 1913 this._set = set; 1914 } 1915 get value() { 1916 return this._value = this._get(); 1917 } 1918 set value(newVal) { 1919 this._set(newVal); 1920 } 1921 } 1922 function customRef(factory) { 1923 return new CustomRefImpl(factory); 1924 } 1925 function toRefs(object) { 1926 if (!isProxy(object)) { 1927 warn$2(`toRefs() expects a reactive object but received a plain one.`); 1928 } 1929 const ret = isArray(object) ? new Array(object.length) : {}; 1930 for (const key in object) { 1931 ret[key] = propertyToRef(object, key); 1932 } 1933 return ret; 1934 } 1935 class ObjectRefImpl { 1936 constructor(_object, _key, _defaultValue) { 1937 this._object = _object; 1938 this._key = _key; 1939 this._defaultValue = _defaultValue; 1940 this["__v_isRef"] = true; 1941 this._value = void 0; 1942 this._raw = toRaw(_object); 1943 let shallow = true; 1944 let obj = _object; 1945 if (!isArray(_object) || !isIntegerKey(String(_key))) { 1946 do { 1947 shallow = !isProxy(obj) || isShallow(obj); 1948 } while (shallow && (obj = obj["__v_raw"])); 1949 } 1950 this._shallow = shallow; 1951 } 1952 get value() { 1953 let val = this._object[this._key]; 1954 if (this._shallow) { 1955 val = unref(val); 1956 } 1957 return this._value = val === void 0 ? this._defaultValue : val; 1958 } 1959 set value(newVal) { 1960 if (this._shallow && isRef(this._raw[this._key])) { 1961 const nestedRef = this._object[this._key]; 1962 if (isRef(nestedRef)) { 1963 nestedRef.value = newVal; 1964 return; 1965 } 1966 } 1967 this._object[this._key] = newVal; 1968 } 1969 get dep() { 1970 return getDepFromReactive(this._raw, this._key); 1971 } 1972 } 1973 class GetterRefImpl { 1974 constructor(_getter) { 1975 this._getter = _getter; 1976 this["__v_isRef"] = true; 1977 this["__v_isReadonly"] = true; 1978 this._value = void 0; 1979 } 1980 get value() { 1981 return this._value = this._getter(); 1982 } 1983 } 1984 function toRef(source, key, defaultValue) { 1985 if (isRef(source)) { 1986 return source; 1987 } else if (isFunction(source)) { 1988 return new GetterRefImpl(source); 1989 } else if (isObject(source) && arguments.length > 1) { 1990 return propertyToRef(source, key, defaultValue); 1991 } else { 1992 return ref(source); 1993 } 1994 } 1995 function propertyToRef(source, key, defaultValue) { 1996 return new ObjectRefImpl(source, key, defaultValue); 1997 } 1998 1999 class ComputedRefImpl { 2000 constructor(fn, setter, isSSR) { 2001 this.fn = fn; 2002 this.setter = setter; 2003 /** 2004 * @internal 2005 */ 2006 this._value = void 0; 2007 /** 2008 * @internal 2009 */ 2010 this.dep = new Dep(this); 2011 /** 2012 * @internal 2013 */ 2014 this.__v_isRef = true; 2015 // TODO isolatedDeclarations "__v_isReadonly" 2016 // A computed is also a subscriber that tracks other deps 2017 /** 2018 * @internal 2019 */ 2020 this.deps = void 0; 2021 /** 2022 * @internal 2023 */ 2024 this.depsTail = void 0; 2025 /** 2026 * @internal 2027 */ 2028 this.flags = 16; 2029 /** 2030 * @internal 2031 */ 2032 this.globalVersion = globalVersion - 1; 2033 /** 2034 * @internal 2035 */ 2036 this.next = void 0; 2037 // for backwards compat 2038 this.effect = this; 2039 this["__v_isReadonly"] = !setter; 2040 this.isSSR = isSSR; 2041 } 2042 /** 2043 * @internal 2044 */ 2045 notify() { 2046 this.flags |= 16; 2047 if (!(this.flags & 8) && // avoid infinite self recursion 2048 activeSub !== this) { 2049 batch(this, true); 2050 return true; 2051 } 2052 } 2053 get value() { 2054 const link = this.dep.track({ 2055 target: this, 2056 type: "get", 2057 key: "value" 2058 }); 2059 refreshComputed(this); 2060 if (link) { 2061 link.version = this.dep.version; 2062 } 2063 return this._value; 2064 } 2065 set value(newValue) { 2066 if (this.setter) { 2067 this.setter(newValue); 2068 } else { 2069 warn$2("Write operation failed: computed value is readonly"); 2070 } 2071 } 2072 } 2073 function computed$1(getterOrOptions, debugOptions, isSSR = false) { 2074 let getter; 2075 let setter; 2076 if (isFunction(getterOrOptions)) { 2077 getter = getterOrOptions; 2078 } else { 2079 getter = getterOrOptions.get; 2080 setter = getterOrOptions.set; 2081 } 2082 const cRef = new ComputedRefImpl(getter, setter, isSSR); 2083 if (debugOptions && !isSSR) { 2084 cRef.onTrack = debugOptions.onTrack; 2085 cRef.onTrigger = debugOptions.onTrigger; 2086 } 2087 return cRef; 2088 } 2089 2090 const TrackOpTypes = { 2091 "GET": "get", 2092 "HAS": "has", 2093 "ITERATE": "iterate" 2094 }; 2095 const TriggerOpTypes = { 2096 "SET": "set", 2097 "ADD": "add", 2098 "DELETE": "delete", 2099 "CLEAR": "clear" 2100 }; 2101 2102 const INITIAL_WATCHER_VALUE = {}; 2103 const cleanupMap = /* @__PURE__ */ new WeakMap(); 2104 let activeWatcher = void 0; 2105 function getCurrentWatcher() { 2106 return activeWatcher; 2107 } 2108 function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { 2109 if (owner) { 2110 let cleanups = cleanupMap.get(owner); 2111 if (!cleanups) cleanupMap.set(owner, cleanups = []); 2112 cleanups.push(cleanupFn); 2113 } else if (!failSilently) { 2114 warn$2( 2115 `onWatcherCleanup() was called when there was no active watcher to associate with.` 2116 ); 2117 } 2118 } 2119 function watch$1(source, cb, options = EMPTY_OBJ) { 2120 const { immediate, deep, once, scheduler, augmentJob, call } = options; 2121 const warnInvalidSource = (s) => { 2122 (options.onWarn || warn$2)( 2123 `Invalid watch source: `, 2124 s, 2125 `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` 2126 ); 2127 }; 2128 const reactiveGetter = (source2) => { 2129 if (deep) return source2; 2130 if (isShallow(source2) || deep === false || deep === 0) 2131 return traverse(source2, 1); 2132 return traverse(source2); 2133 }; 2134 let effect; 2135 let getter; 2136 let cleanup; 2137 let boundCleanup; 2138 let forceTrigger = false; 2139 let isMultiSource = false; 2140 if (isRef(source)) { 2141 getter = () => source.value; 2142 forceTrigger = isShallow(source); 2143 } else if (isReactive(source)) { 2144 getter = () => reactiveGetter(source); 2145 forceTrigger = true; 2146 } else if (isArray(source)) { 2147 isMultiSource = true; 2148 forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); 2149 getter = () => source.map((s) => { 2150 if (isRef(s)) { 2151 return s.value; 2152 } else if (isReactive(s)) { 2153 return reactiveGetter(s); 2154 } else if (isFunction(s)) { 2155 return call ? call(s, 2) : s(); 2156 } else { 2157 warnInvalidSource(s); 2158 } 2159 }); 2160 } else if (isFunction(source)) { 2161 if (cb) { 2162 getter = call ? () => call(source, 2) : source; 2163 } else { 2164 getter = () => { 2165 if (cleanup) { 2166 pauseTracking(); 2167 try { 2168 cleanup(); 2169 } finally { 2170 resetTracking(); 2171 } 2172 } 2173 const currentEffect = activeWatcher; 2174 activeWatcher = effect; 2175 try { 2176 return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); 2177 } finally { 2178 activeWatcher = currentEffect; 2179 } 2180 }; 2181 } 2182 } else { 2183 getter = NOOP; 2184 warnInvalidSource(source); 2185 } 2186 if (cb && deep) { 2187 const baseGetter = getter; 2188 const depth = deep === true ? Infinity : deep; 2189 getter = () => traverse(baseGetter(), depth); 2190 } 2191 const scope = getCurrentScope(); 2192 const watchHandle = () => { 2193 effect.stop(); 2194 if (scope && scope.active) { 2195 remove(scope.effects, effect); 2196 } 2197 }; 2198 if (once && cb) { 2199 const _cb = cb; 2200 cb = (...args) => { 2201 _cb(...args); 2202 watchHandle(); 2203 }; 2204 } 2205 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 2206 const job = (immediateFirstRun) => { 2207 if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) { 2208 return; 2209 } 2210 if (cb) { 2211 const newValue = effect.run(); 2212 if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) { 2213 if (cleanup) { 2214 cleanup(); 2215 } 2216 const currentWatcher = activeWatcher; 2217 activeWatcher = effect; 2218 try { 2219 const args = [ 2220 newValue, 2221 // pass undefined as the old value when it's changed for the first time 2222 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 2223 boundCleanup 2224 ]; 2225 oldValue = newValue; 2226 call ? call(cb, 3, args) : ( 2227 // @ts-expect-error 2228 cb(...args) 2229 ); 2230 } finally { 2231 activeWatcher = currentWatcher; 2232 } 2233 } 2234 } else { 2235 effect.run(); 2236 } 2237 }; 2238 if (augmentJob) { 2239 augmentJob(job); 2240 } 2241 effect = new ReactiveEffect(getter); 2242 effect.scheduler = scheduler ? () => scheduler(job, false) : job; 2243 boundCleanup = (fn) => onWatcherCleanup(fn, false, effect); 2244 cleanup = effect.onStop = () => { 2245 const cleanups = cleanupMap.get(effect); 2246 if (cleanups) { 2247 if (call) { 2248 call(cleanups, 4); 2249 } else { 2250 for (const cleanup2 of cleanups) cleanup2(); 2251 } 2252 cleanupMap.delete(effect); 2253 } 2254 }; 2255 { 2256 effect.onTrack = options.onTrack; 2257 effect.onTrigger = options.onTrigger; 2258 } 2259 if (cb) { 2260 if (immediate) { 2261 job(true); 2262 } else { 2263 oldValue = effect.run(); 2264 } 2265 } else if (scheduler) { 2266 scheduler(job.bind(null, true), true); 2267 } else { 2268 effect.run(); 2269 } 2270 watchHandle.pause = effect.pause.bind(effect); 2271 watchHandle.resume = effect.resume.bind(effect); 2272 watchHandle.stop = watchHandle; 2273 return watchHandle; 2274 } 2275 function traverse(value, depth = Infinity, seen) { 2276 if (depth <= 0 || !isObject(value) || value["__v_skip"]) { 2277 return value; 2278 } 2279 seen = seen || /* @__PURE__ */ new Map(); 2280 if ((seen.get(value) || 0) >= depth) { 2281 return value; 2282 } 2283 seen.set(value, depth); 2284 depth--; 2285 if (isRef(value)) { 2286 traverse(value.value, depth, seen); 2287 } else if (isArray(value)) { 2288 for (let i = 0; i < value.length; i++) { 2289 traverse(value[i], depth, seen); 2290 } 2291 } else if (isSet(value) || isMap(value)) { 2292 value.forEach((v) => { 2293 traverse(v, depth, seen); 2294 }); 2295 } else if (isPlainObject(value)) { 2296 for (const key in value) { 2297 traverse(value[key], depth, seen); 2298 } 2299 for (const key of Object.getOwnPropertySymbols(value)) { 2300 if (Object.prototype.propertyIsEnumerable.call(value, key)) { 2301 traverse(value[key], depth, seen); 2302 } 2303 } 2304 } 2305 return value; 2306 } 2307 2308 const stack$1 = []; 2309 function pushWarningContext(vnode) { 2310 stack$1.push(vnode); 2311 } 2312 function popWarningContext() { 2313 stack$1.pop(); 2314 } 2315 let isWarning = false; 2316 function warn$1(msg, ...args) { 2317 if (isWarning) return; 2318 isWarning = true; 2319 pauseTracking(); 2320 const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null; 2321 const appWarnHandler = instance && instance.appContext.config.warnHandler; 2322 const trace = getComponentTrace(); 2323 if (appWarnHandler) { 2324 callWithErrorHandling( 2325 appWarnHandler, 2326 instance, 2327 11, 2328 [ 2329 // eslint-disable-next-line no-restricted-syntax 2330 msg + args.map((a) => { 2331 var _a, _b; 2332 return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); 2333 }).join(""), 2334 instance && instance.proxy, 2335 trace.map( 2336 ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` 2337 ).join("\n"), 2338 trace 2339 ] 2340 ); 2341 } else { 2342 const warnArgs = [`[Vue warn]: ${msg}`, ...args]; 2343 if (trace.length && // avoid spamming console during tests 2344 true) { 2345 warnArgs.push(` 2346`, ...formatTrace(trace)); 2347 } 2348 console.warn(...warnArgs); 2349 } 2350 resetTracking(); 2351 isWarning = false; 2352 } 2353 function getComponentTrace() { 2354 let currentVNode = stack$1[stack$1.length - 1]; 2355 if (!currentVNode) { 2356 return []; 2357 } 2358 const normalizedStack = []; 2359 while (currentVNode) { 2360 const last = normalizedStack[0]; 2361 if (last && last.vnode === currentVNode) { 2362 last.recurseCount++; 2363 } else { 2364 normalizedStack.push({ 2365 vnode: currentVNode, 2366 recurseCount: 0 2367 }); 2368 } 2369 const parentInstance = currentVNode.component && currentVNode.component.parent; 2370 currentVNode = parentInstance && parentInstance.vnode; 2371 } 2372 return normalizedStack; 2373 } 2374 function formatTrace(trace) { 2375 const logs = []; 2376 trace.forEach((entry, i) => { 2377 logs.push(...i === 0 ? [] : [` 2378`], ...formatTraceEntry(entry)); 2379 }); 2380 return logs; 2381 } 2382 function formatTraceEntry({ vnode, recurseCount }) { 2383 const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; 2384 const isRoot = vnode.component ? vnode.component.parent == null : false; 2385 const open = ` at <${formatComponentName( 2386 vnode.component, 2387 vnode.type, 2388 isRoot 2389 )}`; 2390 const close = `>` + postfix; 2391 return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; 2392 } 2393 function formatProps(props) { 2394 const res = []; 2395 const keys = Object.keys(props); 2396 keys.slice(0, 3).forEach((key) => { 2397 res.push(...formatProp(key, props[key])); 2398 }); 2399 if (keys.length > 3) { 2400 res.push(` ...`); 2401 } 2402 return res; 2403 } 2404 function formatProp(key, value, raw) { 2405 if (isString(value)) { 2406 value = JSON.stringify(value); 2407 return raw ? value : [`${key}=${value}`]; 2408 } else if (typeof value === "number" || typeof value === "boolean" || value == null) { 2409 return raw ? value : [`${key}=${value}`]; 2410 } else if (isRef(value)) { 2411 value = formatProp(key, toRaw(value.value), true); 2412 return raw ? value : [`${key}=Ref<`, value, `>`]; 2413 } else if (isFunction(value)) { 2414 return [`${key}=fn${value.name ? `<${value.name}>` : ``}`]; 2415 } else { 2416 value = toRaw(value); 2417 return raw ? value : [`${key}=`, value]; 2418 } 2419 } 2420 function assertNumber(val, type) { 2421 if (val === void 0) { 2422 return; 2423 } else if (typeof val !== "number") { 2424 warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); 2425 } else if (isNaN(val)) { 2426 warn$1(`${type} is NaN - the duration expression might be incorrect.`); 2427 } 2428 } 2429 2430 const ErrorCodes = { 2431 "SETUP_FUNCTION": 0, 2432 "0": "SETUP_FUNCTION", 2433 "RENDER_FUNCTION": 1, 2434 "1": "RENDER_FUNCTION", 2435 "NATIVE_EVENT_HANDLER": 5, 2436 "5": "NATIVE_EVENT_HANDLER", 2437 "COMPONENT_EVENT_HANDLER": 6, 2438 "6": "COMPONENT_EVENT_HANDLER", 2439 "VNODE_HOOK": 7, 2440 "7": "VNODE_HOOK", 2441 "DIRECTIVE_HOOK": 8, 2442 "8": "DIRECTIVE_HOOK", 2443 "TRANSITION_HOOK": 9, 2444 "9": "TRANSITION_HOOK", 2445 "APP_ERROR_HANDLER": 10, 2446 "10": "APP_ERROR_HANDLER", 2447 "APP_WARN_HANDLER": 11, 2448 "11": "APP_WARN_HANDLER", 2449 "FUNCTION_REF": 12, 2450 "12": "FUNCTION_REF", 2451 "ASYNC_COMPONENT_LOADER": 13, 2452 "13": "ASYNC_COMPONENT_LOADER", 2453 "SCHEDULER": 14, 2454 "14": "SCHEDULER", 2455 "COMPONENT_UPDATE": 15, 2456 "15": "COMPONENT_UPDATE", 2457 "APP_UNMOUNT_CLEANUP": 16, 2458 "16": "APP_UNMOUNT_CLEANUP" 2459 }; 2460 const ErrorTypeStrings$1 = { 2461 ["sp"]: "serverPrefetch hook", 2462 ["bc"]: "beforeCreate hook", 2463 ["c"]: "created hook", 2464 ["bm"]: "beforeMount hook", 2465 ["m"]: "mounted hook", 2466 ["bu"]: "beforeUpdate hook", 2467 ["u"]: "updated", 2468 ["bum"]: "beforeUnmount hook", 2469 ["um"]: "unmounted hook", 2470 ["a"]: "activated hook", 2471 ["da"]: "deactivated hook", 2472 ["ec"]: "errorCaptured hook", 2473 ["rtc"]: "renderTracked hook", 2474 ["rtg"]: "renderTriggered hook", 2475 [0]: "setup function", 2476 [1]: "render function", 2477 [2]: "watcher getter", 2478 [3]: "watcher callback", 2479 [4]: "watcher cleanup function", 2480 [5]: "native event handler", 2481 [6]: "component event handler", 2482 [7]: "vnode hook", 2483 [8]: "directive hook", 2484 [9]: "transition hook", 2485 [10]: "app errorHandler", 2486 [11]: "app warnHandler", 2487 [12]: "ref function", 2488 [13]: "async component loader", 2489 [14]: "scheduler flush", 2490 [15]: "component update", 2491 [16]: "app unmount cleanup function" 2492 }; 2493 function callWithErrorHandling(fn, instance, type, args) { 2494 try { 2495 return args ? fn(...args) : fn(); 2496 } catch (err) { 2497 handleError(err, instance, type); 2498 } 2499 } 2500 function callWithAsyncErrorHandling(fn, instance, type, args) { 2501 if (isFunction(fn)) { 2502 const res = callWithErrorHandling(fn, instance, type, args); 2503 if (res && isPromise(res)) { 2504 res.catch((err) => { 2505 handleError(err, instance, type); 2506 }); 2507 } 2508 return res; 2509 } 2510 if (isArray(fn)) { 2511 const values = []; 2512 for (let i = 0; i < fn.length; i++) { 2513 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); 2514 } 2515 return values; 2516 } else { 2517 warn$1( 2518 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}` 2519 ); 2520 } 2521 } 2522 function handleError(err, instance, type, throwInDev = true) { 2523 const contextVNode = instance ? instance.vnode : null; 2524 const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; 2525 if (instance) { 2526 let cur = instance.parent; 2527 const exposedInstance = instance.proxy; 2528 const errorInfo = ErrorTypeStrings$1[type]; 2529 while (cur) { 2530 const errorCapturedHooks = cur.ec; 2531 if (errorCapturedHooks) { 2532 for (let i = 0; i < errorCapturedHooks.length; i++) { 2533 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 2534 return; 2535 } 2536 } 2537 } 2538 cur = cur.parent; 2539 } 2540 if (errorHandler) { 2541 pauseTracking(); 2542 callWithErrorHandling(errorHandler, null, 10, [ 2543 err, 2544 exposedInstance, 2545 errorInfo 2546 ]); 2547 resetTracking(); 2548 return; 2549 } 2550 } 2551 logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); 2552 } 2553 function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { 2554 { 2555 const info = ErrorTypeStrings$1[type]; 2556 if (contextVNode) { 2557 pushWarningContext(contextVNode); 2558 } 2559 warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); 2560 if (contextVNode) { 2561 popWarningContext(); 2562 } 2563 if (throwInDev) { 2564 throw err; 2565 } else { 2566 console.error(err); 2567 } 2568 } 2569 } 2570 2571 const queue = []; 2572 let flushIndex = -1; 2573 const pendingPostFlushCbs = []; 2574 let activePostFlushCbs = null; 2575 let postFlushIndex = 0; 2576 const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 2577 let currentFlushPromise = null; 2578 const RECURSION_LIMIT = 100; 2579 function nextTick(fn) { 2580 const p = currentFlushPromise || resolvedPromise; 2581 return fn ? p.then(this ? fn.bind(this) : fn) : p; 2582 } 2583 function findInsertionIndex(id) { 2584 let start = flushIndex + 1; 2585 let end = queue.length; 2586 while (start < end) { 2587 const middle = start + end >>> 1; 2588 const middleJob = queue[middle]; 2589 const middleJobId = getId(middleJob); 2590 if (middleJobId < id || middleJobId === id && middleJob.flags & 2) { 2591 start = middle + 1; 2592 } else { 2593 end = middle; 2594 } 2595 } 2596 return start; 2597 } 2598 function queueJob(job) { 2599 if (!(job.flags & 1)) { 2600 const jobId = getId(job); 2601 const lastJob = queue[queue.length - 1]; 2602 if (!lastJob || // fast path when the job id is larger than the tail 2603 !(job.flags & 2) && jobId >= getId(lastJob)) { 2604 queue.push(job); 2605 } else { 2606 queue.splice(findInsertionIndex(jobId), 0, job); 2607 } 2608 job.flags |= 1; 2609 queueFlush(); 2610 } 2611 } 2612 function queueFlush() { 2613 if (!currentFlushPromise) { 2614 currentFlushPromise = resolvedPromise.then(flushJobs); 2615 } 2616 } 2617 function queuePostFlushCb(cb) { 2618 if (!isArray(cb)) { 2619 if (activePostFlushCbs && cb.id === -1) { 2620 activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); 2621 } else if (!(cb.flags & 1)) { 2622 pendingPostFlushCbs.push(cb); 2623 cb.flags |= 1; 2624 } 2625 } else { 2626 pendingPostFlushCbs.push(...cb); 2627 } 2628 queueFlush(); 2629 } 2630 function flushPreFlushCbs(instance, seen, i = flushIndex + 1) { 2631 { 2632 seen = seen || /* @__PURE__ */ new Map(); 2633 } 2634 for (; i < queue.length; i++) { 2635 const cb = queue[i]; 2636 if (cb && cb.flags & 2) { 2637 if (instance && cb.id !== instance.uid) { 2638 continue; 2639 } 2640 if (checkRecursiveUpdates(seen, cb)) { 2641 continue; 2642 } 2643 queue.splice(i, 1); 2644 i--; 2645 if (cb.flags & 4) { 2646 cb.flags &= -2; 2647 } 2648 cb(); 2649 if (!(cb.flags & 4)) { 2650 cb.flags &= -2; 2651 } 2652 } 2653 } 2654 } 2655 function flushPostFlushCbs(seen) { 2656 if (pendingPostFlushCbs.length) { 2657 const deduped = [...new Set(pendingPostFlushCbs)].sort( 2658 (a, b) => getId(a) - getId(b) 2659 ); 2660 pendingPostFlushCbs.length = 0; 2661 if (activePostFlushCbs) { 2662 activePostFlushCbs.push(...deduped); 2663 return; 2664 } 2665 activePostFlushCbs = deduped; 2666 { 2667 seen = seen || /* @__PURE__ */ new Map(); 2668 } 2669 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 2670 const cb = activePostFlushCbs[postFlushIndex]; 2671 if (checkRecursiveUpdates(seen, cb)) { 2672 continue; 2673 } 2674 if (cb.flags & 4) { 2675 cb.flags &= -2; 2676 } 2677 if (!(cb.flags & 8)) cb(); 2678 cb.flags &= -2; 2679 } 2680 activePostFlushCbs = null; 2681 postFlushIndex = 0; 2682 } 2683 } 2684 const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id; 2685 function flushJobs(seen) { 2686 { 2687 seen = seen || /* @__PURE__ */ new Map(); 2688 } 2689 const check = (job) => checkRecursiveUpdates(seen, job); 2690 try { 2691 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 2692 const job = queue[flushIndex]; 2693 if (job && !(job.flags & 8)) { 2694 if (check(job)) { 2695 continue; 2696 } 2697 if (job.flags & 4) { 2698 job.flags &= ~1; 2699 } 2700 callWithErrorHandling( 2701 job, 2702 job.i, 2703 job.i ? 15 : 14 2704 ); 2705 if (!(job.flags & 4)) { 2706 job.flags &= ~1; 2707 } 2708 } 2709 } 2710 } finally { 2711 for (; flushIndex < queue.length; flushIndex++) { 2712 const job = queue[flushIndex]; 2713 if (job) { 2714 job.flags &= -2; 2715 } 2716 } 2717 flushIndex = -1; 2718 queue.length = 0; 2719 flushPostFlushCbs(seen); 2720 currentFlushPromise = null; 2721 if (queue.length || pendingPostFlushCbs.length) { 2722 flushJobs(seen); 2723 } 2724 } 2725 } 2726 function checkRecursiveUpdates(seen, fn) { 2727 const count = seen.get(fn) || 0; 2728 if (count > RECURSION_LIMIT) { 2729 const instance = fn.i; 2730 const componentName = instance && getComponentName(instance.type); 2731 handleError( 2732 `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.`, 2733 null, 2734 10 2735 ); 2736 return true; 2737 } 2738 seen.set(fn, count + 1); 2739 return false; 2740 } 2741 2742 let isHmrUpdating = false; 2743 const hmrDirtyComponents = /* @__PURE__ */ new Map(); 2744 { 2745 getGlobalThis().__VUE_HMR_RUNTIME__ = { 2746 createRecord: tryWrap(createRecord), 2747 rerender: tryWrap(rerender), 2748 reload: tryWrap(reload) 2749 }; 2750 } 2751 const map = /* @__PURE__ */ new Map(); 2752 function registerHMR(instance) { 2753 const id = instance.type.__hmrId; 2754 let record = map.get(id); 2755 if (!record) { 2756 createRecord(id, instance.type); 2757 record = map.get(id); 2758 } 2759 record.instances.add(instance); 2760 } 2761 function unregisterHMR(instance) { 2762 map.get(instance.type.__hmrId).instances.delete(instance); 2763 } 2764 function createRecord(id, initialDef) { 2765 if (map.has(id)) { 2766 return false; 2767 } 2768 map.set(id, { 2769 initialDef: normalizeClassComponent(initialDef), 2770 instances: /* @__PURE__ */ new Set() 2771 }); 2772 return true; 2773 } 2774 function normalizeClassComponent(component) { 2775 return isClassComponent(component) ? component.__vccOpts : component; 2776 } 2777 function rerender(id, newRender) { 2778 const record = map.get(id); 2779 if (!record) { 2780 return; 2781 } 2782 record.initialDef.render = newRender; 2783 [...record.instances].forEach((instance) => { 2784 if (newRender) { 2785 instance.render = newRender; 2786 normalizeClassComponent(instance.type).render = newRender; 2787 } 2788 instance.renderCache = []; 2789 isHmrUpdating = true; 2790 if (!(instance.job.flags & 8)) { 2791 instance.update(); 2792 } 2793 isHmrUpdating = false; 2794 }); 2795 } 2796 function reload(id, newComp) { 2797 const record = map.get(id); 2798 if (!record) return; 2799 newComp = normalizeClassComponent(newComp); 2800 updateComponentDef(record.initialDef, newComp); 2801 const instances = [...record.instances]; 2802 for (let i = 0; i < instances.length; i++) { 2803 const instance = instances[i]; 2804 const oldComp = normalizeClassComponent(instance.type); 2805 let dirtyInstances = hmrDirtyComponents.get(oldComp); 2806 if (!dirtyInstances) { 2807 if (oldComp !== record.initialDef) { 2808 updateComponentDef(oldComp, newComp); 2809 } 2810 hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); 2811 } 2812 dirtyInstances.add(instance); 2813 instance.appContext.propsCache.delete(instance.type); 2814 instance.appContext.emitsCache.delete(instance.type); 2815 instance.appContext.optionsCache.delete(instance.type); 2816 if (instance.ceReload) { 2817 dirtyInstances.add(instance); 2818 instance.ceReload(newComp.styles); 2819 dirtyInstances.delete(instance); 2820 } else if (instance.parent) { 2821 queueJob(() => { 2822 if (!(instance.job.flags & 8)) { 2823 isHmrUpdating = true; 2824 instance.parent.update(); 2825 isHmrUpdating = false; 2826 dirtyInstances.delete(instance); 2827 } 2828 }); 2829 } else if (instance.appContext.reload) { 2830 instance.appContext.reload(); 2831 } else if (typeof window !== "undefined") { 2832 window.location.reload(); 2833 } else { 2834 console.warn( 2835 "[HMR] Root or manually mounted instance modified. Full reload required." 2836 ); 2837 } 2838 if (instance.root.ce && instance !== instance.root) { 2839 instance.root.ce._removeChildStyle(oldComp); 2840 } 2841 } 2842 queuePostFlushCb(() => { 2843 hmrDirtyComponents.clear(); 2844 }); 2845 } 2846 function updateComponentDef(oldComp, newComp) { 2847 extend(oldComp, newComp); 2848 for (const key in oldComp) { 2849 if (key !== "__file" && !(key in newComp)) { 2850 delete oldComp[key]; 2851 } 2852 } 2853 } 2854 function tryWrap(fn) { 2855 return (id, arg) => { 2856 try { 2857 return fn(id, arg); 2858 } catch (e) { 2859 console.error(e); 2860 console.warn( 2861 `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` 2862 ); 2863 } 2864 }; 2865 } 2866 2867 let devtools$1; 2868 let buffer = []; 2869 let devtoolsNotInstalled = false; 2870 function emit$1(event, ...args) { 2871 if (devtools$1) { 2872 devtools$1.emit(event, ...args); 2873 } else if (!devtoolsNotInstalled) { 2874 buffer.push({ event, args }); 2875 } 2876 } 2877 function setDevtoolsHook$1(hook, target) { 2878 var _a, _b; 2879 devtools$1 = hook; 2880 if (devtools$1) { 2881 devtools$1.enabled = true; 2882 buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); 2883 buffer = []; 2884 } else if ( 2885 // handle late devtools injection - only do this if we are in an actual 2886 // browser environment to avoid the timer handle stalling test runner exit 2887 // (#4815) 2888 typeof window !== "undefined" && // some envs mock window but not fully 2889 window.HTMLElement && // also exclude jsdom 2890 // eslint-disable-next-line no-restricted-syntax 2891 !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) 2892 ) { 2893 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 2894 replay.push((newHook) => { 2895 setDevtoolsHook$1(newHook, target); 2896 }); 2897 setTimeout(() => { 2898 if (!devtools$1) { 2899 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 2900 devtoolsNotInstalled = true; 2901 buffer = []; 2902 } 2903 }, 3e3); 2904 } else { 2905 devtoolsNotInstalled = true; 2906 buffer = []; 2907 } 2908 } 2909 function devtoolsInitApp(app, version) { 2910 emit$1("app:init" /* APP_INIT */, app, version, { 2911 Fragment, 2912 Text, 2913 Comment, 2914 Static 2915 }); 2916 } 2917 function devtoolsUnmountApp(app) { 2918 emit$1("app:unmount" /* APP_UNMOUNT */, app); 2919 } 2920 const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */); 2921 const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */); 2922 const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( 2923 "component:removed" /* COMPONENT_REMOVED */ 2924 ); 2925 const devtoolsComponentRemoved = (component) => { 2926 if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered 2927 !devtools$1.cleanupBuffer(component)) { 2928 _devtoolsComponentRemoved(component); 2929 } 2930 }; 2931 // @__NO_SIDE_EFFECTS__ 2932 function createDevtoolsComponentHook(hook) { 2933 return (component) => { 2934 emit$1( 2935 hook, 2936 component.appContext.app, 2937 component.uid, 2938 component.parent ? component.parent.uid : void 0, 2939 component 2940 ); 2941 }; 2942 } 2943 const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); 2944 const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); 2945 function createDevtoolsPerformanceHook(hook) { 2946 return (component, type, time) => { 2947 emit$1(hook, component.appContext.app, component.uid, component, type, time); 2948 }; 2949 } 2950 function devtoolsComponentEmit(component, event, params) { 2951 emit$1( 2952 "component:emit" /* COMPONENT_EMIT */, 2953 component.appContext.app, 2954 component, 2955 event, 2956 params 2957 ); 2958 } 2959 2960 let currentRenderingInstance = null; 2961 let currentScopeId = null; 2962 function setCurrentRenderingInstance(instance) { 2963 const prev = currentRenderingInstance; 2964 currentRenderingInstance = instance; 2965 currentScopeId = instance && instance.type.__scopeId || null; 2966 return prev; 2967 } 2968 function pushScopeId(id) { 2969 currentScopeId = id; 2970 } 2971 function popScopeId() { 2972 currentScopeId = null; 2973 } 2974 const withScopeId = (_id) => withCtx; 2975 function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 2976 if (!ctx) return fn; 2977 if (fn._n) { 2978 return fn; 2979 } 2980 const renderFnWithContext = (...args) => { 2981 if (renderFnWithContext._d) { 2982 setBlockTracking(-1); 2983 } 2984 const prevInstance = setCurrentRenderingInstance(ctx); 2985 let res; 2986 try { 2987 res = fn(...args); 2988 } finally { 2989 setCurrentRenderingInstance(prevInstance); 2990 if (renderFnWithContext._d) { 2991 setBlockTracking(1); 2992 } 2993 } 2994 { 2995 devtoolsComponentUpdated(ctx); 2996 } 2997 return res; 2998 }; 2999 renderFnWithContext._n = true; 3000 renderFnWithContext._c = true; 3001 renderFnWithContext._d = true; 3002 return renderFnWithContext; 3003 } 3004 3005 function validateDirectiveName(name) { 3006 if (isBuiltInDirective(name)) { 3007 warn$1("Do not use built-in directive ids as custom directive id: " + name); 3008 } 3009 } 3010 function withDirectives(vnode, directives) { 3011 if (currentRenderingInstance === null) { 3012 warn$1(`withDirectives can only be used inside render functions.`); 3013 return vnode; 3014 } 3015 const instance = getComponentPublicInstance(currentRenderingInstance); 3016 const bindings = vnode.dirs || (vnode.dirs = []); 3017 for (let i = 0; i < directives.length; i++) { 3018 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 3019 if (dir) { 3020 if (isFunction(dir)) { 3021 dir = { 3022 mounted: dir, 3023 updated: dir 3024 }; 3025 } 3026 if (dir.deep) { 3027 traverse(value); 3028 } 3029 bindings.push({ 3030 dir, 3031 instance, 3032 value, 3033 oldValue: void 0, 3034 arg, 3035 modifiers 3036 }); 3037 } 3038 } 3039 return vnode; 3040 } 3041 function invokeDirectiveHook(vnode, prevVNode, instance, name) { 3042 const bindings = vnode.dirs; 3043 const oldBindings = prevVNode && prevVNode.dirs; 3044 for (let i = 0; i < bindings.length; i++) { 3045 const binding = bindings[i]; 3046 if (oldBindings) { 3047 binding.oldValue = oldBindings[i].value; 3048 } 3049 let hook = binding.dir[name]; 3050 if (hook) { 3051 pauseTracking();
vendor: 14,310 bytes, lines 3052-3388
3052 callWithAsyncErrorHandling(hook, instance, 8, [ 3053 vnode.el, 3054 binding, 3055 vnode, 3056 prevVNode 3057 ]); 3058 resetTracking(); 3059 } 3060 } 3061 } 3062 3063 const TeleportEndKey = Symbol("_vte"); 3064 const isTeleport = (type) => type.__isTeleport; 3065 const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 3066 const isTeleportDeferred = (props) => props && (props.defer || props.defer === ""); 3067 const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 3068 const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement; 3069 const resolveTarget = (props, select) => { 3070 const targetSelector = props && props.to; 3071 if (isString(targetSelector)) { 3072 if (!select) { 3073 warn$1( 3074 `Current renderer does not support string target for Teleports. (missing querySelector renderer option)` 3075 ); 3076 return null; 3077 } else { 3078 const target = select(targetSelector); 3079 if (!target && !isTeleportDisabled(props)) { 3080 warn$1( 3081 `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.` 3082 ); 3083 } 3084 return target; 3085 } 3086 } else { 3087 if (!targetSelector && !isTeleportDisabled(props)) { 3088 warn$1(`Invalid Teleport target: ${targetSelector}`); 3089 } 3090 return targetSelector; 3091 } 3092 }; 3093 const TeleportImpl = { 3094 name: "Teleport", 3095 __isTeleport: true, 3096 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { 3097 const { 3098 mc: mountChildren, 3099 pc: patchChildren, 3100 pbc: patchBlockChildren, 3101 o: { insert, querySelector, createText, createComment } 3102 } = internals; 3103 const disabled = isTeleportDisabled(n2.props); 3104 let { shapeFlag, children, dynamicChildren } = n2; 3105 if (isHmrUpdating) { 3106 optimized = false; 3107 dynamicChildren = null; 3108 } 3109 if (n1 == null) { 3110 const placeholder = n2.el = createComment("teleport start"); 3111 const mainAnchor = n2.anchor = createComment("teleport end"); 3112 insert(placeholder, container, anchor); 3113 insert(mainAnchor, container, anchor); 3114 const mount = (container2, anchor2) => { 3115 if (shapeFlag & 16) { 3116 mountChildren( 3117 children, 3118 container2, 3119 anchor2, 3120 parentComponent, 3121 parentSuspense, 3122 namespace, 3123 slotScopeIds, 3124 optimized 3125 ); 3126 } 3127 }; 3128 const mountToTarget = () => { 3129 const target = n2.target = resolveTarget(n2.props, querySelector); 3130 const targetAnchor = prepareAnchor(target, n2, createText, insert); 3131 if (target) { 3132 if (namespace !== "svg" && isTargetSVG(target)) { 3133 namespace = "svg"; 3134 } else if (namespace !== "mathml" && isTargetMathML(target)) { 3135 namespace = "mathml"; 3136 } 3137 if (parentComponent && parentComponent.isCE) { 3138 (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target); 3139 } 3140 if (!disabled) { 3141 mount(target, targetAnchor); 3142 updateCssVars(n2, false); 3143 } 3144 } else if (!disabled) { 3145 warn$1( 3146 "Invalid Teleport target on mount:", 3147 target, 3148 `(${typeof target})` 3149 ); 3150 } 3151 }; 3152 if (disabled) { 3153 mount(container, mainAnchor); 3154 updateCssVars(n2, true); 3155 } 3156 if (isTeleportDeferred(n2.props)) { 3157 n2.el.__isMounted = false; 3158 queuePostRenderEffect(() => { 3159 mountToTarget(); 3160 delete n2.el.__isMounted; 3161 }, parentSuspense); 3162 } else { 3163 mountToTarget(); 3164 } 3165 } else { 3166 if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) { 3167 queuePostRenderEffect(() => { 3168 TeleportImpl.process( 3169 n1, 3170 n2, 3171 container, 3172 anchor, 3173 parentComponent, 3174 parentSuspense, 3175 namespace, 3176 slotScopeIds, 3177 optimized, 3178 internals 3179 ); 3180 }, parentSuspense); 3181 return; 3182 } 3183 n2.el = n1.el; 3184 n2.targetStart = n1.targetStart; 3185 const mainAnchor = n2.anchor = n1.anchor; 3186 const target = n2.target = n1.target; 3187 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 3188 const wasDisabled = isTeleportDisabled(n1.props); 3189 const currentContainer = wasDisabled ? container : target; 3190 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 3191 if (namespace === "svg" || isTargetSVG(target)) { 3192 namespace = "svg"; 3193 } else if (namespace === "mathml" || isTargetMathML(target)) { 3194 namespace = "mathml"; 3195 } 3196 if (dynamicChildren) { 3197 patchBlockChildren( 3198 n1.dynamicChildren, 3199 dynamicChildren, 3200 currentContainer, 3201 parentComponent, 3202 parentSuspense, 3203 namespace, 3204 slotScopeIds 3205 ); 3206 traverseStaticChildren(n1, n2, false); 3207 } else if (!optimized) { 3208 patchChildren( 3209 n1, 3210 n2, 3211 currentContainer, 3212 currentAnchor, 3213 parentComponent, 3214 parentSuspense, 3215 namespace, 3216 slotScopeIds, 3217 false 3218 ); 3219 } 3220 if (disabled) { 3221 if (!wasDisabled) { 3222 moveTeleport( 3223 n2, 3224 container, 3225 mainAnchor, 3226 internals, 3227 1 3228 ); 3229 } else { 3230 if (n2.props && n1.props && n2.props.to !== n1.props.to) { 3231 n2.props.to = n1.props.to; 3232 } 3233 } 3234 } else { 3235 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 3236 const nextTarget = n2.target = resolveTarget( 3237 n2.props, 3238 querySelector 3239 ); 3240 if (nextTarget) { 3241 moveTeleport( 3242 n2, 3243 nextTarget, 3244 null, 3245 internals, 3246 0 3247 ); 3248 } else { 3249 warn$1( 3250 "Invalid Teleport target on update:", 3251 target, 3252 `(${typeof target})` 3253 ); 3254 } 3255 } else if (wasDisabled) { 3256 moveTeleport( 3257 n2, 3258 target, 3259 targetAnchor, 3260 internals, 3261 1 3262 ); 3263 } 3264 } 3265 updateCssVars(n2, disabled); 3266 } 3267 }, 3268 remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { 3269 const { 3270 shapeFlag, 3271 children, 3272 anchor, 3273 targetStart, 3274 targetAnchor, 3275 target, 3276 props 3277 } = vnode; 3278 if (target) { 3279 hostRemove(targetStart); 3280 hostRemove(targetAnchor); 3281 } 3282 doRemove && hostRemove(anchor); 3283 if (shapeFlag & 16) { 3284 const shouldRemove = doRemove || !isTeleportDisabled(props); 3285 for (let i = 0; i < children.length; i++) { 3286 const child = children[i]; 3287 unmount( 3288 child, 3289 parentComponent, 3290 parentSuspense, 3291 shouldRemove, 3292 !!child.dynamicChildren 3293 ); 3294 } 3295 } 3296 }, 3297 move: moveTeleport, 3298 hydrate: hydrateTeleport 3299 }; 3300 function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) { 3301 if (moveType === 0) { 3302 insert(vnode.targetAnchor, container, parentAnchor); 3303 } 3304 const { el, anchor, shapeFlag, children, props } = vnode; 3305 const isReorder = moveType === 2; 3306 if (isReorder) { 3307 insert(el, container, parentAnchor); 3308 } 3309 if (!isReorder || isTeleportDisabled(props)) { 3310 if (shapeFlag & 16) { 3311 for (let i = 0; i < children.length; i++) { 3312 move( 3313 children[i], 3314 container, 3315 parentAnchor, 3316 2 3317 ); 3318 } 3319 } 3320 } 3321 if (isReorder) { 3322 insert(anchor, container, parentAnchor); 3323 } 3324 } 3325 function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 3326 o: { nextSibling, parentNode, querySelector, insert, createText } 3327 }, hydrateChildren) { 3328 function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) { 3329 vnode2.anchor = hydrateChildren( 3330 nextSibling(node2), 3331 vnode2, 3332 parentNode(node2), 3333 parentComponent, 3334 parentSuspense, 3335 slotScopeIds, 3336 optimized 3337 ); 3338 vnode2.targetStart = targetStart; 3339 vnode2.targetAnchor = targetAnchor; 3340 } 3341 const target = vnode.target = resolveTarget( 3342 vnode.props, 3343 querySelector 3344 ); 3345 const disabled = isTeleportDisabled(vnode.props); 3346 if (target) { 3347 const targetNode = target._lpa || target.firstChild; 3348 if (vnode.shapeFlag & 16) { 3349 if (disabled) { 3350 hydrateDisabledTeleport( 3351 node, 3352 vnode, 3353 targetNode, 3354 targetNode && nextSibling(targetNode) 3355 ); 3356 } else { 3357 vnode.anchor = nextSibling(node); 3358 let targetAnchor = targetNode; 3359 while (targetAnchor) { 3360 if (targetAnchor && targetAnchor.nodeType === 8) { 3361 if (targetAnchor.data === "teleport start anchor") { 3362 vnode.targetStart = targetAnchor; 3363 } else if (targetAnchor.data === "teleport anchor") { 3364 vnode.targetAnchor = targetAnchor; 3365 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 3366 break; 3367 } 3368 } 3369 targetAnchor = nextSibling(targetAnchor); 3370 } 3371 if (!vnode.targetAnchor) { 3372 prepareAnchor(target, vnode, createText, insert); 3373 } 3374 hydrateChildren( 3375 targetNode && nextSibling(targetNode), 3376 vnode, 3377 target, 3378 parentComponent, 3379 parentSuspense, 3380 slotScopeIds, 3381 optimized 3382 ); 3383 } 3384 } 3385 updateCssVars(vnode, disabled); 3386 } else if (disabled) { 3387 if (vnode.shapeFlag & 16) { 3388 hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
vendor: 52,760 bytes, lines 3389-4665
3389 } 3390 } 3391 return vnode.anchor && nextSibling(vnode.anchor); 3392 } 3393 const Teleport = TeleportImpl; 3394 function updateCssVars(vnode, isDisabled) { 3395 const ctx = vnode.ctx; 3396 if (ctx && ctx.ut) { 3397 let node, anchor; 3398 if (isDisabled) { 3399 node = vnode.el; 3400 anchor = vnode.anchor; 3401 } else { 3402 node = vnode.targetStart; 3403 anchor = vnode.targetAnchor; 3404 } 3405 while (node && node !== anchor) { 3406 if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid); 3407 node = node.nextSibling; 3408 } 3409 ctx.ut(); 3410 } 3411 } 3412 function prepareAnchor(target, vnode, createText, insert) { 3413 const targetStart = vnode.targetStart = createText(""); 3414 const targetAnchor = vnode.targetAnchor = createText(""); 3415 targetStart[TeleportEndKey] = targetAnchor; 3416 if (target) { 3417 insert(targetStart, target); 3418 insert(targetAnchor, target); 3419 } 3420 return targetAnchor; 3421 } 3422 3423 const leaveCbKey = Symbol("_leaveCb"); 3424 const enterCbKey$1 = Symbol("_enterCb"); 3425 function useTransitionState() { 3426 const state = { 3427 isMounted: false, 3428 isLeaving: false, 3429 isUnmounting: false, 3430 leavingVNodes: /* @__PURE__ */ new Map() 3431 }; 3432 onMounted(() => { 3433 state.isMounted = true; 3434 }); 3435 onBeforeUnmount(() => { 3436 state.isUnmounting = true; 3437 }); 3438 return state; 3439 } 3440 const TransitionHookValidator = [Function, Array]; 3441 const BaseTransitionPropsValidators = { 3442 mode: String, 3443 appear: Boolean, 3444 persisted: Boolean, 3445 // enter 3446 onBeforeEnter: TransitionHookValidator, 3447 onEnter: TransitionHookValidator, 3448 onAfterEnter: TransitionHookValidator, 3449 onEnterCancelled: TransitionHookValidator, 3450 // leave 3451 onBeforeLeave: TransitionHookValidator, 3452 onLeave: TransitionHookValidator, 3453 onAfterLeave: TransitionHookValidator, 3454 onLeaveCancelled: TransitionHookValidator, 3455 // appear 3456 onBeforeAppear: TransitionHookValidator, 3457 onAppear: TransitionHookValidator, 3458 onAfterAppear: TransitionHookValidator, 3459 onAppearCancelled: TransitionHookValidator 3460 }; 3461 const recursiveGetSubtree = (instance) => { 3462 const subTree = instance.subTree; 3463 return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; 3464 }; 3465 const BaseTransitionImpl = { 3466 name: `BaseTransition`, 3467 props: BaseTransitionPropsValidators, 3468 setup(props, { slots }) { 3469 const instance = getCurrentInstance(); 3470 const state = useTransitionState(); 3471 return () => { 3472 const children = slots.default && getTransitionRawChildren(slots.default(), true); 3473 if (!children || !children.length) { 3474 return; 3475 } 3476 const child = findNonCommentChild(children); 3477 const rawProps = toRaw(props); 3478 const { mode } = rawProps; 3479 if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") { 3480 warn$1(`invalid <transition> mode: ${mode}`); 3481 } 3482 if (state.isLeaving) { 3483 return emptyPlaceholder(child); 3484 } 3485 const innerChild = getInnerChild$1(child); 3486 if (!innerChild) { 3487 return emptyPlaceholder(child); 3488 } 3489 let enterHooks = resolveTransitionHooks( 3490 innerChild, 3491 rawProps, 3492 state, 3493 instance, 3494 // #11061, ensure enterHooks is fresh after clone 3495 (hooks) => enterHooks = hooks 3496 ); 3497 if (innerChild.type !== Comment) { 3498 setTransitionHooks(innerChild, enterHooks); 3499 } 3500 let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); 3501 if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) { 3502 let leavingHooks = resolveTransitionHooks( 3503 oldInnerChild, 3504 rawProps, 3505 state, 3506 instance 3507 ); 3508 setTransitionHooks(oldInnerChild, leavingHooks); 3509 if (mode === "out-in" && innerChild.type !== Comment) { 3510 state.isLeaving = true; 3511 leavingHooks.afterLeave = () => { 3512 state.isLeaving = false; 3513 if (!(instance.job.flags & 8)) { 3514 instance.update(); 3515 } 3516 delete leavingHooks.afterLeave; 3517 oldInnerChild = void 0; 3518 }; 3519 return emptyPlaceholder(child); 3520 } else if (mode === "in-out" && innerChild.type !== Comment) { 3521 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 3522 const leavingVNodesCache = getLeavingNodesForType( 3523 state, 3524 oldInnerChild 3525 ); 3526 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 3527 el[leaveCbKey] = () => { 3528 earlyRemove(); 3529 el[leaveCbKey] = void 0; 3530 delete enterHooks.delayedLeave; 3531 oldInnerChild = void 0; 3532 }; 3533 enterHooks.delayedLeave = () => { 3534 delayedLeave(); 3535 delete enterHooks.delayedLeave; 3536 oldInnerChild = void 0; 3537 }; 3538 }; 3539 } else { 3540 oldInnerChild = void 0; 3541 } 3542 } else if (oldInnerChild) { 3543 oldInnerChild = void 0; 3544 } 3545 return child; 3546 }; 3547 } 3548 }; 3549 function findNonCommentChild(children) { 3550 let child = children[0]; 3551 if (children.length > 1) { 3552 let hasFound = false; 3553 for (const c of children) { 3554 if (c.type !== Comment) { 3555 if (hasFound) { 3556 warn$1( 3557 "<transition> can only be used on a single element or component. Use <transition-group> for lists." 3558 ); 3559 break; 3560 } 3561 child = c; 3562 hasFound = true; 3563 } 3564 } 3565 } 3566 return child; 3567 } 3568 const BaseTransition = BaseTransitionImpl; 3569 function getLeavingNodesForType(state, vnode) { 3570 const { leavingVNodes } = state; 3571 let leavingVNodesCache = leavingVNodes.get(vnode.type); 3572 if (!leavingVNodesCache) { 3573 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 3574 leavingVNodes.set(vnode.type, leavingVNodesCache); 3575 } 3576 return leavingVNodesCache; 3577 } 3578 function resolveTransitionHooks(vnode, props, state, instance, postClone) { 3579 const { 3580 appear, 3581 mode, 3582 persisted = false, 3583 onBeforeEnter, 3584 onEnter, 3585 onAfterEnter, 3586 onEnterCancelled, 3587 onBeforeLeave, 3588 onLeave, 3589 onAfterLeave, 3590 onLeaveCancelled, 3591 onBeforeAppear, 3592 onAppear, 3593 onAfterAppear, 3594 onAppearCancelled 3595 } = props; 3596 const key = String(vnode.key); 3597 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 3598 const callHook = (hook, args) => { 3599 hook && callWithAsyncErrorHandling( 3600 hook, 3601 instance, 3602 9, 3603 args 3604 ); 3605 }; 3606 const callAsyncHook = (hook, args) => { 3607 const done = args[1]; 3608 callHook(hook, args); 3609 if (isArray(hook)) { 3610 if (hook.every((hook2) => hook2.length <= 1)) done(); 3611 } else if (hook.length <= 1) { 3612 done(); 3613 } 3614 }; 3615 const hooks = { 3616 mode, 3617 persisted, 3618 beforeEnter(el) { 3619 let hook = onBeforeEnter; 3620 if (!state.isMounted) { 3621 if (appear) { 3622 hook = onBeforeAppear || onBeforeEnter; 3623 } else { 3624 return; 3625 } 3626 } 3627 if (el[leaveCbKey]) { 3628 el[leaveCbKey]( 3629 true 3630 /* cancelled */ 3631 ); 3632 } 3633 const leavingVNode = leavingVNodesCache[key]; 3634 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { 3635 leavingVNode.el[leaveCbKey](); 3636 } 3637 callHook(hook, [el]); 3638 }, 3639 enter(el) { 3640 let hook = onEnter; 3641 let afterHook = onAfterEnter; 3642 let cancelHook = onEnterCancelled; 3643 if (!state.isMounted) { 3644 if (appear) { 3645 hook = onAppear || onEnter; 3646 afterHook = onAfterAppear || onAfterEnter; 3647 cancelHook = onAppearCancelled || onEnterCancelled; 3648 } else { 3649 return; 3650 } 3651 } 3652 let called = false; 3653 const done = el[enterCbKey$1] = (cancelled) => { 3654 if (called) return; 3655 called = true; 3656 if (cancelled) { 3657 callHook(cancelHook, [el]); 3658 } else { 3659 callHook(afterHook, [el]); 3660 } 3661 if (hooks.delayedLeave) { 3662 hooks.delayedLeave(); 3663 } 3664 el[enterCbKey$1] = void 0; 3665 }; 3666 if (hook) { 3667 callAsyncHook(hook, [el, done]); 3668 } else { 3669 done(); 3670 } 3671 }, 3672 leave(el, remove) { 3673 const key2 = String(vnode.key); 3674 if (el[enterCbKey$1]) { 3675 el[enterCbKey$1]( 3676 true 3677 /* cancelled */ 3678 ); 3679 } 3680 if (state.isUnmounting) { 3681 return remove(); 3682 } 3683 callHook(onBeforeLeave, [el]); 3684 let called = false; 3685 const done = el[leaveCbKey] = (cancelled) => { 3686 if (called) return; 3687 called = true; 3688 remove(); 3689 if (cancelled) { 3690 callHook(onLeaveCancelled, [el]); 3691 } else { 3692 callHook(onAfterLeave, [el]); 3693 } 3694 el[leaveCbKey] = void 0; 3695 if (leavingVNodesCache[key2] === vnode) { 3696 delete leavingVNodesCache[key2]; 3697 } 3698 }; 3699 leavingVNodesCache[key2] = vnode; 3700 if (onLeave) { 3701 callAsyncHook(onLeave, [el, done]); 3702 } else { 3703 done(); 3704 } 3705 }, 3706 clone(vnode2) { 3707 const hooks2 = resolveTransitionHooks( 3708 vnode2, 3709 props, 3710 state, 3711 instance, 3712 postClone 3713 ); 3714 if (postClone) postClone(hooks2); 3715 return hooks2; 3716 } 3717 }; 3718 return hooks; 3719 } 3720 function emptyPlaceholder(vnode) { 3721 if (isKeepAlive(vnode)) { 3722 vnode = cloneVNode(vnode); 3723 vnode.children = null; 3724 return vnode; 3725 } 3726 } 3727 function getInnerChild$1(vnode) { 3728 if (!isKeepAlive(vnode)) { 3729 if (isTeleport(vnode.type) && vnode.children) { 3730 return findNonCommentChild(vnode.children); 3731 } 3732 return vnode; 3733 } 3734 if (vnode.component) { 3735 return vnode.component.subTree; 3736 } 3737 const { shapeFlag, children } = vnode; 3738 if (children) { 3739 if (shapeFlag & 16) { 3740 return children[0]; 3741 } 3742 if (shapeFlag & 32 && isFunction(children.default)) { 3743 return children.default(); 3744 } 3745 } 3746 } 3747 function setTransitionHooks(vnode, hooks) { 3748 if (vnode.shapeFlag & 6 && vnode.component) { 3749 vnode.transition = hooks; 3750 setTransitionHooks(vnode.component.subTree, hooks); 3751 } else if (vnode.shapeFlag & 128) { 3752 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 3753 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 3754 } else { 3755 vnode.transition = hooks; 3756 } 3757 } 3758 function getTransitionRawChildren(children, keepComment = false, parentKey) { 3759 let ret = []; 3760 let keyedFragmentCount = 0; 3761 for (let i = 0; i < children.length; i++) { 3762 let child = children[i]; 3763 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 3764 if (child.type === Fragment) { 3765 if (child.patchFlag & 128) keyedFragmentCount++; 3766 ret = ret.concat( 3767 getTransitionRawChildren(child.children, keepComment, key) 3768 ); 3769 } else if (keepComment || child.type !== Comment) { 3770 ret.push(key != null ? cloneVNode(child, { key }) : child); 3771 } 3772 } 3773 if (keyedFragmentCount > 1) { 3774 for (let i = 0; i < ret.length; i++) { 3775 ret[i].patchFlag = -2; 3776 } 3777 } 3778 return ret; 3779 } 3780 3781 // @__NO_SIDE_EFFECTS__ 3782 function defineComponent(options, extraOptions) { 3783 return isFunction(options) ? ( 3784 // #8236: extend call and options.name access are considered side-effects 3785 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 3786 /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() 3787 ) : options; 3788 } 3789 3790 function useId() { 3791 const i = getCurrentInstance(); 3792 if (i) { 3793 return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++; 3794 } else { 3795 warn$1( 3796 `useId() is called when there is no active component instance to be associated with.` 3797 ); 3798 } 3799 return ""; 3800 } 3801 function markAsyncBoundary(instance) { 3802 instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; 3803 } 3804 3805 const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); 3806 function useTemplateRef(key) { 3807 const i = getCurrentInstance(); 3808 const r = shallowRef(null); 3809 if (i) { 3810 const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs; 3811 let desc; 3812 if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) { 3813 warn$1(`useTemplateRef('${key}') already exists.`); 3814 } else { 3815 Object.defineProperty(refs, key, { 3816 enumerable: true, 3817 get: () => r.value, 3818 set: (val) => r.value = val 3819 }); 3820 } 3821 } else { 3822 warn$1( 3823 `useTemplateRef() is called when there is no active component instance to be associated with.` 3824 ); 3825 } 3826 const ret = readonly(r); 3827 { 3828 knownTemplateRefs.add(ret); 3829 } 3830 return ret; 3831 } 3832 3833 const pendingSetRefMap = /* @__PURE__ */ new WeakMap(); 3834 function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 3835 if (isArray(rawRef)) { 3836 rawRef.forEach( 3837 (r, i) => setRef( 3838 r, 3839 oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), 3840 parentSuspense, 3841 vnode, 3842 isUnmount 3843 ) 3844 ); 3845 return; 3846 } 3847 if (isAsyncWrapper(vnode) && !isUnmount) { 3848 if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { 3849 setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); 3850 } 3851 return; 3852 } 3853 const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; 3854 const value = isUnmount ? null : refValue; 3855 const { i: owner, r: ref } = rawRef; 3856 if (!owner) { 3857 warn$1( 3858 `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` 3859 ); 3860 return; 3861 } 3862 const oldRef = oldRawRef && oldRawRef.r; 3863 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 3864 const setupState = owner.setupState; 3865 const rawSetupState = toRaw(setupState); 3866 const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => { 3867 { 3868 if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) { 3869 warn$1( 3870 `Template ref "${key}" used on a non-ref value. It will not work in the production build.` 3871 ); 3872 } 3873 if (knownTemplateRefs.has(rawSetupState[key])) { 3874 return false; 3875 } 3876 } 3877 return hasOwn(rawSetupState, key); 3878 }; 3879 const canSetRef = (ref2) => { 3880 return !knownTemplateRefs.has(ref2); 3881 }; 3882 if (oldRef != null && oldRef !== ref) { 3883 invalidatePendingSetRef(oldRawRef); 3884 if (isString(oldRef)) { 3885 refs[oldRef] = null; 3886 if (canSetSetupRef(oldRef)) { 3887 setupState[oldRef] = null; 3888 } 3889 } else if (isRef(oldRef)) { 3890 if (canSetRef(oldRef)) { 3891 oldRef.value = null; 3892 } 3893 const oldRawRefAtom = oldRawRef; 3894 if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null; 3895 } 3896 } 3897 if (isFunction(ref)) { 3898 callWithErrorHandling(ref, owner, 12, [value, refs]); 3899 } else { 3900 const _isString = isString(ref); 3901 const _isRef = isRef(ref); 3902 if (_isString || _isRef) { 3903 const doSet = () => { 3904 if (rawRef.f) { 3905 const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k]; 3906 if (isUnmount) { 3907 isArray(existing) && remove(existing, refValue); 3908 } else { 3909 if (!isArray(existing)) { 3910 if (_isString) { 3911 refs[ref] = [refValue]; 3912 if (canSetSetupRef(ref)) { 3913 setupState[ref] = refs[ref]; 3914 } 3915 } else { 3916 const newVal = [refValue]; 3917 if (canSetRef(ref)) { 3918 ref.value = newVal; 3919 } 3920 if (rawRef.k) refs[rawRef.k] = newVal; 3921 } 3922 } else if (!existing.includes(refValue)) { 3923 existing.push(refValue); 3924 } 3925 } 3926 } else if (_isString) { 3927 refs[ref] = value; 3928 if (canSetSetupRef(ref)) { 3929 setupState[ref] = value; 3930 } 3931 } else if (_isRef) { 3932 if (canSetRef(ref)) { 3933 ref.value = value; 3934 } 3935 if (rawRef.k) refs[rawRef.k] = value; 3936 } else { 3937 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3938 } 3939 }; 3940 if (value) { 3941 const job = () => { 3942 doSet(); 3943 pendingSetRefMap.delete(rawRef); 3944 }; 3945 job.id = -1; 3946 pendingSetRefMap.set(rawRef, job); 3947 queuePostRenderEffect(job, parentSuspense); 3948 } else { 3949 invalidatePendingSetRef(rawRef); 3950 doSet(); 3951 } 3952 } else { 3953 warn$1("Invalid template ref type:", ref, `(${typeof ref})`); 3954 } 3955 } 3956 } 3957 function invalidatePendingSetRef(rawRef) { 3958 const pendingSetRef = pendingSetRefMap.get(rawRef); 3959 if (pendingSetRef) { 3960 pendingSetRef.flags |= 8; 3961 pendingSetRefMap.delete(rawRef); 3962 } 3963 } 3964 3965 let hasLoggedMismatchError = false; 3966 const logMismatchError = () => { 3967 if (hasLoggedMismatchError) { 3968 return; 3969 } 3970 console.error("Hydration completed but contains mismatches."); 3971 hasLoggedMismatchError = true; 3972 }; 3973 const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject"; 3974 const isMathMLContainer = (container) => container.namespaceURI.includes("MathML"); 3975 const getContainerType = (container) => { 3976 if (container.nodeType !== 1) return void 0; 3977 if (isSVGContainer(container)) return "svg"; 3978 if (isMathMLContainer(container)) return "mathml"; 3979 return void 0; 3980 }; 3981 const isComment = (node) => node.nodeType === 8; 3982 function createHydrationFunctions(rendererInternals) { 3983 const { 3984 mt: mountComponent, 3985 p: patch, 3986 o: { 3987 patchProp, 3988 createText, 3989 nextSibling, 3990 parentNode, 3991 remove, 3992 insert, 3993 createComment 3994 } 3995 } = rendererInternals; 3996 const hydrate = (vnode, container) => { 3997 if (!container.hasChildNodes()) { 3998 warn$1( 3999 `Attempting to hydrate existing markup but container is empty. Performing full mount instead.` 4000 ); 4001 patch(null, vnode, container); 4002 flushPostFlushCbs(); 4003 container._vnode = vnode; 4004 return; 4005 } 4006 hydrateNode(container.firstChild, vnode, null, null, null); 4007 flushPostFlushCbs(); 4008 container._vnode = vnode; 4009 }; 4010 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 4011 optimized = optimized || !!vnode.dynamicChildren; 4012 const isFragmentStart = isComment(node) && node.data === "["; 4013 const onMismatch = () => handleMismatch( 4014 node, 4015 vnode, 4016 parentComponent, 4017 parentSuspense, 4018 slotScopeIds, 4019 isFragmentStart 4020 ); 4021 const { type, ref, shapeFlag, patchFlag } = vnode; 4022 let domType = node.nodeType; 4023 vnode.el = node; 4024 { 4025 def(node, "__vnode", vnode, true); 4026 def(node, "__vueParentComponent", parentComponent, true); 4027 } 4028 if (patchFlag === -2) { 4029 optimized = false; 4030 vnode.dynamicChildren = null; 4031 } 4032 let nextNode = null; 4033 switch (type) { 4034 case Text: 4035 if (domType !== 3) { 4036 if (vnode.children === "") { 4037 insert(vnode.el = createText(""), parentNode(node), node); 4038 nextNode = node; 4039 } else { 4040 nextNode = onMismatch(); 4041 } 4042 } else { 4043 if (node.data !== vnode.children) { 4044 warn$1( 4045 `Hydration text mismatch in`, 4046 node.parentNode, 4047 ` 4048 - rendered on server: ${JSON.stringify( 4049 node.data 4050 )} 4051 - expected on client: ${JSON.stringify(vnode.children)}` 4052 ); 4053 logMismatchError(); 4054 node.data = vnode.children; 4055 } 4056 nextNode = nextSibling(node); 4057 } 4058 break; 4059 case Comment: 4060 if (isTemplateNode(node)) { 4061 nextNode = nextSibling(node); 4062 replaceNode( 4063 vnode.el = node.content.firstChild, 4064 node, 4065 parentComponent 4066 ); 4067 } else if (domType !== 8 || isFragmentStart) { 4068 nextNode = onMismatch(); 4069 } else { 4070 nextNode = nextSibling(node); 4071 } 4072 break; 4073 case Static: 4074 if (isFragmentStart) { 4075 node = nextSibling(node); 4076 domType = node.nodeType; 4077 } 4078 if (domType === 1 || domType === 3) { 4079 nextNode = node; 4080 const needToAdoptContent = !vnode.children.length; 4081 for (let i = 0; i < vnode.staticCount; i++) { 4082 if (needToAdoptContent) 4083 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4084 if (i === vnode.staticCount - 1) { 4085 vnode.anchor = nextNode; 4086 } 4087 nextNode = nextSibling(nextNode); 4088 } 4089 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4090 } else { 4091 onMismatch(); 4092 } 4093 break; 4094 case Fragment: 4095 if (!isFragmentStart) { 4096 nextNode = onMismatch(); 4097 } else { 4098 nextNode = hydrateFragment( 4099 node, 4100 vnode, 4101 parentComponent, 4102 parentSuspense, 4103 slotScopeIds, 4104 optimized 4105 ); 4106 } 4107 break; 4108 default: 4109 if (shapeFlag & 1) { 4110 if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) { 4111 nextNode = onMismatch(); 4112 } else { 4113 nextNode = hydrateElement( 4114 node, 4115 vnode, 4116 parentComponent, 4117 parentSuspense, 4118 slotScopeIds, 4119 optimized 4120 ); 4121 } 4122 } else if (shapeFlag & 6) { 4123 vnode.slotScopeIds = slotScopeIds; 4124 const container = parentNode(node); 4125 if (isFragmentStart) { 4126 nextNode = locateClosingAnchor(node); 4127 } else if (isComment(node) && node.data === "teleport start") { 4128 nextNode = locateClosingAnchor(node, node.data, "teleport end"); 4129 } else { 4130 nextNode = nextSibling(node); 4131 } 4132 mountComponent( 4133 vnode, 4134 container, 4135 null, 4136 parentComponent, 4137 parentSuspense, 4138 getContainerType(container), 4139 optimized 4140 ); 4141 if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { 4142 let subTree; 4143 if (isFragmentStart) { 4144 subTree = createVNode(Fragment); 4145 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4146 } else { 4147 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4148 } 4149 subTree.el = node; 4150 vnode.component.subTree = subTree; 4151 } 4152 } else if (shapeFlag & 64) { 4153 if (domType !== 8) { 4154 nextNode = onMismatch(); 4155 } else { 4156 nextNode = vnode.type.hydrate( 4157 node, 4158 vnode, 4159 parentComponent, 4160 parentSuspense, 4161 slotScopeIds, 4162 optimized, 4163 rendererInternals, 4164 hydrateChildren 4165 ); 4166 } 4167 } else if (shapeFlag & 128) { 4168 nextNode = vnode.type.hydrate( 4169 node, 4170 vnode, 4171 parentComponent, 4172 parentSuspense, 4173 getContainerType(parentNode(node)), 4174 slotScopeIds, 4175 optimized, 4176 rendererInternals, 4177 hydrateNode 4178 ); 4179 } else { 4180 warn$1("Invalid HostVNode type:", type, `(${typeof type})`); 4181 } 4182 } 4183 if (ref != null) { 4184 setRef(ref, null, parentSuspense, vnode); 4185 } 4186 return nextNode; 4187 }; 4188 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4189 optimized = optimized || !!vnode.dynamicChildren; 4190 const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; 4191 const forcePatch = type === "input" || type === "option"; 4192 { 4193 if (dirs) { 4194 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4195 } 4196 let needCallTransitionHooks = false; 4197 if (isTemplateNode(el)) { 4198 needCallTransitionHooks = needTransition( 4199 null, 4200 // no need check parentSuspense in hydration 4201 transition 4202 ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; 4203 const content = el.content.firstChild; 4204 if (needCallTransitionHooks) { 4205 const cls = content.getAttribute("class"); 4206 if (cls) content.$cls = cls; 4207 transition.beforeEnter(content); 4208 } 4209 replaceNode(content, el, parentComponent); 4210 vnode.el = el = content; 4211 } 4212 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4213 !(props && (props.innerHTML || props.textContent))) { 4214 let next = hydrateChildren( 4215 el.firstChild, 4216 vnode, 4217 el, 4218 parentComponent, 4219 parentSuspense, 4220 slotScopeIds, 4221 optimized 4222 ); 4223 let hasWarned = false; 4224 while (next) { 4225 if (!isMismatchAllowed(el, 1 /* CHILDREN */)) { 4226 if (!hasWarned) { 4227 warn$1( 4228 `Hydration children mismatch on`, 4229 el, 4230 ` 4231Server rendered element contains more child nodes than client vdom.` 4232 ); 4233 hasWarned = true; 4234 } 4235 logMismatchError(); 4236 } 4237 const cur = next; 4238 next = next.nextSibling; 4239 remove(cur); 4240 } 4241 } else if (shapeFlag & 8) { 4242 let clientText = vnode.children; 4243 if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { 4244 clientText = clientText.slice(1); 4245 } 4246 const { textContent } = el; 4247 if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM 4248 textContent !== clientText.replace(/\r\n|\r/g, "\n")) { 4249 if (!isMismatchAllowed(el, 0 /* TEXT */)) { 4250 warn$1( 4251 `Hydration text content mismatch on`, 4252 el, 4253 ` 4254 - rendered on server: ${textContent} 4255 - expected on client: ${clientText}` 4256 ); 4257 logMismatchError(); 4258 } 4259 el.textContent = vnode.children; 4260 } 4261 } 4262 if (props) { 4263 { 4264 const isCustomElement = el.tagName.includes("-"); 4265 for (const key in props) { 4266 if (// #11189 skip if this node has directives that have created hooks 4267 // as it could have mutated the DOM in any possible way 4268 !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) { 4269 logMismatchError(); 4270 } 4271 if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers 4272 key[0] === "." || isCustomElement) { 4273 patchProp(el, key, null, props[key], void 0, parentComponent); 4274 } 4275 } 4276 } 4277 } 4278 let vnodeHooks; 4279 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4280 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4281 } 4282 if (dirs) { 4283 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4284 } 4285 if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { 4286 queueEffectWithSuspense(() => { 4287 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4288 needCallTransitionHooks && transition.enter(el); 4289 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4290 }, parentSuspense); 4291 } 4292 } 4293 return el.nextSibling; 4294 }; 4295 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4296 optimized = optimized || !!parentVNode.dynamicChildren; 4297 const children = parentVNode.children; 4298 const l = children.length; 4299 let hasWarned = false; 4300 for (let i = 0; i < l; i++) { 4301 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4302 const isText = vnode.type === Text; 4303 if (node) { 4304 if (isText && !optimized) { 4305 if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) { 4306 insert( 4307 createText( 4308 node.data.slice(vnode.children.length) 4309 ), 4310 container, 4311 nextSibling(node) 4312 ); 4313 node.data = vnode.children; 4314 } 4315 } 4316 node = hydrateNode( 4317 node, 4318 vnode, 4319 parentComponent, 4320 parentSuspense, 4321 slotScopeIds, 4322 optimized 4323 ); 4324 } else if (isText && !vnode.children) { 4325 insert(vnode.el = createText(""), container); 4326 } else { 4327 if (!isMismatchAllowed(container, 1 /* CHILDREN */)) { 4328 if (!hasWarned) { 4329 warn$1( 4330 `Hydration children mismatch on`, 4331 container, 4332 ` 4333Server rendered element contains fewer child nodes than client vdom.` 4334 ); 4335 hasWarned = true; 4336 } 4337 logMismatchError(); 4338 } 4339 patch( 4340 null, 4341 vnode, 4342 container, 4343 null, 4344 parentComponent, 4345 parentSuspense, 4346 getContainerType(container), 4347 slotScopeIds 4348 ); 4349 } 4350 } 4351 return node; 4352 }; 4353 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4354 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 4355 if (fragmentSlotScopeIds) { 4356 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 4357 } 4358 const container = parentNode(node); 4359 const next = hydrateChildren( 4360 nextSibling(node), 4361 vnode, 4362 container, 4363 parentComponent, 4364 parentSuspense, 4365 slotScopeIds, 4366 optimized 4367 ); 4368 if (next && isComment(next) && next.data === "]") { 4369 return nextSibling(vnode.anchor = next); 4370 } else { 4371 logMismatchError(); 4372 insert(vnode.anchor = createComment(`]`), container, next); 4373 return next; 4374 } 4375 }; 4376 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 4377 if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) { 4378 warn$1( 4379 `Hydration node mismatch: 4380- rendered on server:`, 4381 node, 4382 node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, 4383 ` 4384- expected on client:`, 4385 vnode.type 4386 ); 4387 logMismatchError(); 4388 } 4389 vnode.el = null; 4390 if (isFragment) { 4391 const end = locateClosingAnchor(node); 4392 while (true) { 4393 const next2 = nextSibling(node); 4394 if (next2 && next2 !== end) { 4395 remove(next2); 4396 } else { 4397 break; 4398 } 4399 } 4400 } 4401 const next = nextSibling(node); 4402 const container = parentNode(node); 4403 remove(node); 4404 patch( 4405 null, 4406 vnode, 4407 container, 4408 next, 4409 parentComponent, 4410 parentSuspense, 4411 getContainerType(container), 4412 slotScopeIds 4413 ); 4414 if (parentComponent) { 4415 parentComponent.vnode.el = vnode.el; 4416 updateHOCHostEl(parentComponent, vnode.el); 4417 } 4418 return next; 4419 }; 4420 const locateClosingAnchor = (node, open = "[", close = "]") => { 4421 let match = 0; 4422 while (node) { 4423 node = nextSibling(node); 4424 if (node && isComment(node)) { 4425 if (node.data === open) match++; 4426 if (node.data === close) { 4427 if (match === 0) { 4428 return nextSibling(node); 4429 } else { 4430 match--; 4431 } 4432 } 4433 } 4434 } 4435 return node; 4436 }; 4437 const replaceNode = (newNode, oldNode, parentComponent) => { 4438 const parentNode2 = oldNode.parentNode; 4439 if (parentNode2) { 4440 parentNode2.replaceChild(newNode, oldNode); 4441 } 4442 let parent = parentComponent; 4443 while (parent) { 4444 if (parent.vnode.el === oldNode) { 4445 parent.vnode.el = parent.subTree.el = newNode; 4446 } 4447 parent = parent.parent; 4448 } 4449 }; 4450 const isTemplateNode = (node) => { 4451 return node.nodeType === 1 && node.tagName === "TEMPLATE"; 4452 }; 4453 return [hydrate, hydrateNode]; 4454 } 4455 function propHasMismatch(el, key, clientValue, vnode, instance) { 4456 let mismatchType; 4457 let mismatchKey; 4458 let actual; 4459 let expected; 4460 if (key === "class") { 4461 if (el.$cls) { 4462 actual = el.$cls; 4463 delete el.$cls; 4464 } else { 4465 actual = el.getAttribute("class"); 4466 } 4467 expected = normalizeClass(clientValue); 4468 if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { 4469 mismatchType = 2 /* CLASS */; 4470 mismatchKey = `class`; 4471 } 4472 } else if (key === "style") { 4473 actual = el.getAttribute("style") || ""; 4474 expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); 4475 const actualMap = toStyleMap(actual); 4476 const expectedMap = toStyleMap(expected); 4477 if (vnode.dirs) { 4478 for (const { dir, value } of vnode.dirs) { 4479 if (dir.name === "show" && !value) { 4480 expectedMap.set("display", "none"); 4481 } 4482 } 4483 } 4484 if (instance) { 4485 resolveCssVars(instance, vnode, expectedMap); 4486 } 4487 if (!isMapEqual(actualMap, expectedMap)) { 4488 mismatchType = 3 /* STYLE */; 4489 mismatchKey = "style"; 4490 } 4491 } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { 4492 if (isBooleanAttr(key)) { 4493 actual = el.hasAttribute(key); 4494 expected = includeBooleanAttr(clientValue); 4495 } else if (clientValue == null) { 4496 actual = el.hasAttribute(key); 4497 expected = false; 4498 } else { 4499 if (el.hasAttribute(key)) { 4500 actual = el.getAttribute(key); 4501 } else if (key === "value" && el.tagName === "TEXTAREA") { 4502 actual = el.value; 4503 } else { 4504 actual = false; 4505 } 4506 expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; 4507 } 4508 if (actual !== expected) { 4509 mismatchType = 4 /* ATTRIBUTE */; 4510 mismatchKey = key; 4511 } 4512 } 4513 if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { 4514 const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`; 4515 const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; 4516 const postSegment = ` 4517 - rendered on server: ${format(actual)} 4518 - expected on client: ${format(expected)} 4519 Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. 4520 You should fix the source of the mismatch.`; 4521 { 4522 warn$1(preSegment, el, postSegment); 4523 } 4524 return true; 4525 } 4526 return false; 4527 } 4528 function toClassSet(str) { 4529 return new Set(str.trim().split(/\s+/)); 4530 } 4531 function isSetEqual(a, b) { 4532 if (a.size !== b.size) { 4533 return false; 4534 } 4535 for (const s of a) { 4536 if (!b.has(s)) { 4537 return false; 4538 } 4539 } 4540 return true; 4541 } 4542 function toStyleMap(str) { 4543 const styleMap = /* @__PURE__ */ new Map(); 4544 for (const item of str.split(";")) { 4545 let [key, value] = item.split(":"); 4546 key = key.trim(); 4547 value = value && value.trim(); 4548 if (key && value) { 4549 styleMap.set(key, value); 4550 } 4551 } 4552 return styleMap; 4553 } 4554 function isMapEqual(a, b) { 4555 if (a.size !== b.size) { 4556 return false; 4557 } 4558 for (const [key, value] of a) { 4559 if (value !== b.get(key)) { 4560 return false; 4561 } 4562 } 4563 return true; 4564 } 4565 function resolveCssVars(instance, vnode, expectedMap) { 4566 const root = instance.subTree; 4567 if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) { 4568 const cssVars = instance.getCssVars(); 4569 for (const key in cssVars) { 4570 const value = normalizeCssVarValue(cssVars[key]); 4571 expectedMap.set(`--${getEscapedCssVarName(key)}`, value); 4572 } 4573 } 4574 if (vnode === root && instance.parent) { 4575 resolveCssVars(instance.parent, instance.vnode, expectedMap); 4576 } 4577 } 4578 const allowMismatchAttr = "data-allow-mismatch"; 4579 const MismatchTypeString = { 4580 [0 /* TEXT */]: "text", 4581 [1 /* CHILDREN */]: "children", 4582 [2 /* CLASS */]: "class", 4583 [3 /* STYLE */]: "style", 4584 [4 /* ATTRIBUTE */]: "attribute" 4585 }; 4586 function isMismatchAllowed(el, allowedType) { 4587 if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) { 4588 while (el && !el.hasAttribute(allowMismatchAttr)) { 4589 el = el.parentElement; 4590 } 4591 } 4592 const allowedAttr = el && el.getAttribute(allowMismatchAttr); 4593 if (allowedAttr == null) { 4594 return false; 4595 } else if (allowedAttr === "") { 4596 return true; 4597 } else { 4598 const list = allowedAttr.split(","); 4599 if (allowedType === 0 /* TEXT */ && list.includes("children")) { 4600 return true; 4601 } 4602 return list.includes(MismatchTypeString[allowedType]); 4603 } 4604 } 4605 4606 const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1)); 4607 const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id)); 4608 const hydrateOnIdle = (timeout = 1e4) => (hydrate) => { 4609 const id = requestIdleCallback(hydrate, { timeout }); 4610 return () => cancelIdleCallback(id); 4611 }; 4612 function elementIsVisibleInViewport(el) { 4613 const { top, left, bottom, right } = el.getBoundingClientRect(); 4614 const { innerHeight, innerWidth } = window; 4615 return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth); 4616 } 4617 const hydrateOnVisible = (opts) => (hydrate, forEach) => { 4618 const ob = new IntersectionObserver((entries) => { 4619 for (const e of entries) { 4620 if (!e.isIntersecting) continue; 4621 ob.disconnect(); 4622 hydrate(); 4623 break; 4624 } 4625 }, opts); 4626 forEach((el) => { 4627 if (!(el instanceof Element)) return; 4628 if (elementIsVisibleInViewport(el)) { 4629 hydrate(); 4630 ob.disconnect(); 4631 return false; 4632 } 4633 ob.observe(el); 4634 }); 4635 return () => ob.disconnect(); 4636 }; 4637 const hydrateOnMediaQuery = (query) => (hydrate) => { 4638 if (query) { 4639 const mql = matchMedia(query); 4640 if (mql.matches) { 4641 hydrate(); 4642 } else { 4643 mql.addEventListener("change", hydrate, { once: true }); 4644 return () => mql.removeEventListener("change", hydrate); 4645 } 4646 } 4647 }; 4648 const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => { 4649 if (isString(interactions)) interactions = [interactions]; 4650 let hasHydrated = false; 4651 const doHydrate = (e) => { 4652 if (!hasHydrated) { 4653 hasHydrated = true; 4654 teardown(); 4655 hydrate(); 4656 e.target.dispatchEvent(new e.constructor(e.type, e)); 4657 } 4658 }; 4659 const teardown = () => { 4660 forEach((el) => { 4661 for (const i of interactions) { 4662 el.removeEventListener(i, doHydrate); 4663 } 4664 }); 4665 };
vendor: 6,660 bytes, lines 4666-4835
4666 forEach((el) => { 4667 for (const i of interactions) { 4668 el.addEventListener(i, doHydrate, { once: true }); 4669 } 4670 }); 4671 return teardown; 4672 }; 4673 function forEachElement(node, cb) { 4674 if (isComment(node) && node.data === "[") { 4675 let depth = 1; 4676 let next = node.nextSibling; 4677 while (next) { 4678 if (next.nodeType === 1) { 4679 const result = cb(next); 4680 if (result === false) { 4681 break; 4682 } 4683 } else if (isComment(next)) { 4684 if (next.data === "]") { 4685 if (--depth === 0) break; 4686 } else if (next.data === "[") { 4687 depth++; 4688 } 4689 } 4690 next = next.nextSibling; 4691 } 4692 } else { 4693 cb(node); 4694 } 4695 } 4696 4697 const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 4698 // @__NO_SIDE_EFFECTS__ 4699 function defineAsyncComponent(source) { 4700 if (isFunction(source)) { 4701 source = { loader: source }; 4702 } 4703 const { 4704 loader, 4705 loadingComponent, 4706 errorComponent, 4707 delay = 200, 4708 hydrate: hydrateStrategy, 4709 timeout, 4710 // undefined = never times out 4711 suspensible = true, 4712 onError: userOnError 4713 } = source; 4714 let pendingRequest = null; 4715 let resolvedComp; 4716 let retries = 0; 4717 const retry = () => { 4718 retries++; 4719 pendingRequest = null; 4720 return load(); 4721 }; 4722 const load = () => { 4723 let thisRequest; 4724 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 4725 err = err instanceof Error ? err : new Error(String(err)); 4726 if (userOnError) { 4727 return new Promise((resolve, reject) => { 4728 const userRetry = () => resolve(retry()); 4729 const userFail = () => reject(err); 4730 userOnError(err, userRetry, userFail, retries + 1); 4731 }); 4732 } else { 4733 throw err; 4734 } 4735 }).then((comp) => { 4736 if (thisRequest !== pendingRequest && pendingRequest) { 4737 return pendingRequest; 4738 } 4739 if (!comp) { 4740 warn$1( 4741 `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` 4742 ); 4743 } 4744 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 4745 comp = comp.default; 4746 } 4747 if (comp && !isObject(comp) && !isFunction(comp)) { 4748 throw new Error(`Invalid async component load result: ${comp}`); 4749 } 4750 resolvedComp = comp; 4751 return comp; 4752 })); 4753 }; 4754 return defineComponent({ 4755 name: "AsyncComponentWrapper", 4756 __asyncLoader: load, 4757 __asyncHydrate(el, instance, hydrate) { 4758 let patched = false; 4759 (instance.bu || (instance.bu = [])).push(() => patched = true); 4760 const performHydrate = () => { 4761 if (patched) { 4762 { 4763 warn$1( 4764 `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.` 4765 ); 4766 } 4767 return; 4768 } 4769 hydrate(); 4770 }; 4771 const doHydrate = hydrateStrategy ? () => { 4772 const teardown = hydrateStrategy( 4773 performHydrate, 4774 (cb) => forEachElement(el, cb) 4775 ); 4776 if (teardown) { 4777 (instance.bum || (instance.bum = [])).push(teardown); 4778 } 4779 } : performHydrate; 4780 if (resolvedComp) { 4781 doHydrate(); 4782 } else { 4783 load().then(() => !instance.isUnmounted && doHydrate()); 4784 } 4785 }, 4786 get __asyncResolved() { 4787 return resolvedComp; 4788 }, 4789 setup() { 4790 const instance = currentInstance; 4791 markAsyncBoundary(instance); 4792 if (resolvedComp) { 4793 return () => createInnerComp(resolvedComp, instance); 4794 } 4795 const onError = (err) => { 4796 pendingRequest = null; 4797 handleError( 4798 err, 4799 instance, 4800 13, 4801 !errorComponent 4802 ); 4803 }; 4804 if (suspensible && instance.suspense || false) { 4805 return load().then((comp) => { 4806 return () => createInnerComp(comp, instance); 4807 }).catch((err) => { 4808 onError(err); 4809 return () => errorComponent ? createVNode(errorComponent, { 4810 error: err 4811 }) : null; 4812 }); 4813 } 4814 const loaded = ref(false); 4815 const error = ref(); 4816 const delayed = ref(!!delay); 4817 if (delay) { 4818 setTimeout(() => { 4819 delayed.value = false; 4820 }, delay); 4821 } 4822 if (timeout != null) { 4823 setTimeout(() => { 4824 if (!loaded.value && !error.value) { 4825 const err = new Error( 4826 `Async component timed out after ${timeout}ms.` 4827 ); 4828 onError(err); 4829 error.value = err; 4830 } 4831 }, timeout); 4832 } 4833 load().then(() => { 4834 loaded.value = true; 4835 if (instance.parent && isKeepAlive(instance.parent.vnode)) {
vendor: 41,451 bytes, lines 4836-5877
4836 instance.parent.update(); 4837 } 4838 }).catch((err) => { 4839 onError(err); 4840 error.value = err; 4841 }); 4842 return () => { 4843 if (loaded.value && resolvedComp) { 4844 return createInnerComp(resolvedComp, instance); 4845 } else if (error.value && errorComponent) { 4846 return createVNode(errorComponent, { 4847 error: error.value 4848 }); 4849 } else if (loadingComponent && !delayed.value) { 4850 return createInnerComp( 4851 loadingComponent, 4852 instance 4853 ); 4854 } 4855 }; 4856 } 4857 }); 4858 } 4859 function createInnerComp(comp, parent) { 4860 const { ref: ref2, props, children, ce } = parent.vnode; 4861 const vnode = createVNode(comp, props, children); 4862 vnode.ref = ref2; 4863 vnode.ce = ce; 4864 delete parent.vnode.ce; 4865 return vnode; 4866 } 4867 4868 const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 4869 const KeepAliveImpl = { 4870 name: `KeepAlive`, 4871 // Marker for special handling inside the renderer. We are not using a === 4872 // check directly on KeepAlive in the renderer, because importing it directly 4873 // would prevent it from being tree-shaken. 4874 __isKeepAlive: true, 4875 props: { 4876 include: [String, RegExp, Array], 4877 exclude: [String, RegExp, Array], 4878 max: [String, Number] 4879 }, 4880 setup(props, { slots }) { 4881 const instance = getCurrentInstance(); 4882 const sharedContext = instance.ctx; 4883 const cache = /* @__PURE__ */ new Map(); 4884 const keys = /* @__PURE__ */ new Set(); 4885 let current = null; 4886 { 4887 instance.__v_cache = cache; 4888 } 4889 const parentSuspense = instance.suspense; 4890 const { 4891 renderer: { 4892 p: patch, 4893 m: move, 4894 um: _unmount, 4895 o: { createElement } 4896 } 4897 } = sharedContext; 4898 const storageContainer = createElement("div"); 4899 sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { 4900 const instance2 = vnode.component; 4901 move(vnode, container, anchor, 0, parentSuspense); 4902 patch( 4903 instance2.vnode, 4904 vnode, 4905 container, 4906 anchor, 4907 instance2, 4908 parentSuspense, 4909 namespace, 4910 vnode.slotScopeIds, 4911 optimized 4912 ); 4913 queuePostRenderEffect(() => { 4914 instance2.isDeactivated = false; 4915 if (instance2.a) { 4916 invokeArrayFns(instance2.a); 4917 } 4918 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 4919 if (vnodeHook) { 4920 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4921 } 4922 }, parentSuspense); 4923 { 4924 devtoolsComponentAdded(instance2); 4925 } 4926 }; 4927 sharedContext.deactivate = (vnode) => { 4928 const instance2 = vnode.component; 4929 invalidateMount(instance2.m); 4930 invalidateMount(instance2.a); 4931 move(vnode, storageContainer, null, 1, parentSuspense); 4932 queuePostRenderEffect(() => { 4933 if (instance2.da) { 4934 invokeArrayFns(instance2.da); 4935 } 4936 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 4937 if (vnodeHook) { 4938 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 4939 } 4940 instance2.isDeactivated = true; 4941 }, parentSuspense); 4942 { 4943 devtoolsComponentAdded(instance2); 4944 } 4945 { 4946 instance2.__keepAliveStorageContainer = storageContainer; 4947 } 4948 }; 4949 function unmount(vnode) { 4950 resetShapeFlag(vnode); 4951 _unmount(vnode, instance, parentSuspense, true); 4952 } 4953 function pruneCache(filter) { 4954 cache.forEach((vnode, key) => { 4955 const name = getComponentName(vnode.type); 4956 if (name && !filter(name)) { 4957 pruneCacheEntry(key); 4958 } 4959 }); 4960 } 4961 function pruneCacheEntry(key) { 4962 const cached = cache.get(key); 4963 if (cached && (!current || !isSameVNodeType(cached, current))) { 4964 unmount(cached); 4965 } else if (current) { 4966 resetShapeFlag(current); 4967 } 4968 cache.delete(key); 4969 keys.delete(key); 4970 } 4971 watch( 4972 () => [props.include, props.exclude], 4973 ([include, exclude]) => { 4974 include && pruneCache((name) => matches(include, name)); 4975 exclude && pruneCache((name) => !matches(exclude, name)); 4976 }, 4977 // prune post-render after `current` has been updated 4978 { flush: "post", deep: true } 4979 ); 4980 let pendingCacheKey = null; 4981 const cacheSubtree = () => { 4982 if (pendingCacheKey != null) { 4983 if (isSuspense(instance.subTree.type)) { 4984 queuePostRenderEffect(() => { 4985 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4986 }, instance.subTree.suspense); 4987 } else { 4988 cache.set(pendingCacheKey, getInnerChild(instance.subTree)); 4989 } 4990 } 4991 }; 4992 onMounted(cacheSubtree); 4993 onUpdated(cacheSubtree); 4994 onBeforeUnmount(() => { 4995 cache.forEach((cached) => { 4996 const { subTree, suspense } = instance; 4997 const vnode = getInnerChild(subTree); 4998 if (cached.type === vnode.type && cached.key === vnode.key) { 4999 resetShapeFlag(vnode); 5000 const da = vnode.component.da; 5001 da && queuePostRenderEffect(da, suspense); 5002 return; 5003 } 5004 unmount(cached); 5005 }); 5006 }); 5007 return () => { 5008 pendingCacheKey = null; 5009 if (!slots.default) { 5010 return current = null; 5011 } 5012 const children = slots.default(); 5013 const rawVNode = children[0]; 5014 if (children.length > 1) { 5015 { 5016 warn$1(`KeepAlive should contain exactly one component child.`); 5017 } 5018 current = null; 5019 return children; 5020 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 5021 current = null; 5022 return rawVNode; 5023 } 5024 let vnode = getInnerChild(rawVNode); 5025 if (vnode.type === Comment) { 5026 current = null; 5027 return vnode; 5028 } 5029 const comp = vnode.type; 5030 const name = getComponentName( 5031 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 5032 ); 5033 const { include, exclude, max } = props; 5034 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 5035 vnode.shapeFlag &= -257; 5036 current = vnode; 5037 return rawVNode; 5038 } 5039 const key = vnode.key == null ? comp : vnode.key; 5040 const cachedVNode = cache.get(key); 5041 if (vnode.el) { 5042 vnode = cloneVNode(vnode); 5043 if (rawVNode.shapeFlag & 128) { 5044 rawVNode.ssContent = vnode; 5045 } 5046 } 5047 pendingCacheKey = key; 5048 if (cachedVNode) { 5049 vnode.el = cachedVNode.el; 5050 vnode.component = cachedVNode.component; 5051 if (vnode.transition) { 5052 setTransitionHooks(vnode, vnode.transition); 5053 } 5054 vnode.shapeFlag |= 512; 5055 keys.delete(key); 5056 keys.add(key); 5057 } else { 5058 keys.add(key); 5059 if (max && keys.size > parseInt(max, 10)) { 5060 pruneCacheEntry(keys.values().next().value); 5061 } 5062 } 5063 vnode.shapeFlag |= 256; 5064 current = vnode; 5065 return isSuspense(rawVNode.type) ? rawVNode : vnode; 5066 }; 5067 } 5068 }; 5069 const KeepAlive = KeepAliveImpl; 5070 function matches(pattern, name) { 5071 if (isArray(pattern)) { 5072 return pattern.some((p) => matches(p, name)); 5073 } else if (isString(pattern)) { 5074 return pattern.split(",").includes(name); 5075 } else if (isRegExp(pattern)) { 5076 pattern.lastIndex = 0; 5077 return pattern.test(name); 5078 } 5079 return false; 5080 } 5081 function onActivated(hook, target) { 5082 registerKeepAliveHook(hook, "a", target); 5083 } 5084 function onDeactivated(hook, target) { 5085 registerKeepAliveHook(hook, "da", target); 5086 } 5087 function registerKeepAliveHook(hook, type, target = currentInstance) { 5088 const wrappedHook = hook.__wdc || (hook.__wdc = () => { 5089 let current = target; 5090 while (current) { 5091 if (current.isDeactivated) { 5092 return; 5093 } 5094 current = current.parent; 5095 } 5096 return hook(); 5097 }); 5098 injectHook(type, wrappedHook, target); 5099 if (target) { 5100 let current = target.parent; 5101 while (current && current.parent) { 5102 if (isKeepAlive(current.parent.vnode)) { 5103 injectToKeepAliveRoot(wrappedHook, type, target, current); 5104 } 5105 current = current.parent; 5106 } 5107 } 5108 } 5109 function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { 5110 const injected = injectHook( 5111 type, 5112 hook, 5113 keepAliveRoot, 5114 true 5115 /* prepend */ 5116 ); 5117 onUnmounted(() => { 5118 remove(keepAliveRoot[type], injected); 5119 }, target); 5120 } 5121 function resetShapeFlag(vnode) { 5122 vnode.shapeFlag &= -257; 5123 vnode.shapeFlag &= -513; 5124 } 5125 function getInnerChild(vnode) { 5126 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 5127 } 5128 5129 function injectHook(type, hook, target = currentInstance, prepend = false) { 5130 if (target) { 5131 const hooks = target[type] || (target[type] = []); 5132 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 5133 pauseTracking(); 5134 const reset = setCurrentInstance(target); 5135 const res = callWithAsyncErrorHandling(hook, target, type, args); 5136 reset(); 5137 resetTracking(); 5138 return res; 5139 }); 5140 if (prepend) { 5141 hooks.unshift(wrappedHook); 5142 } else { 5143 hooks.push(wrappedHook); 5144 } 5145 return wrappedHook; 5146 } else { 5147 const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); 5148 warn$1( 5149 `${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.`) 5150 ); 5151 } 5152 } 5153 const createHook = (lifecycle) => (hook, target = currentInstance) => { 5154 if (!isInSSRComponentSetup || lifecycle === "sp") { 5155 injectHook(lifecycle, (...args) => hook(...args), target); 5156 } 5157 }; 5158 const onBeforeMount = createHook("bm"); 5159 const onMounted = createHook("m"); 5160 const onBeforeUpdate = createHook( 5161 "bu" 5162 ); 5163 const onUpdated = createHook("u"); 5164 const onBeforeUnmount = createHook( 5165 "bum" 5166 ); 5167 const onUnmounted = createHook("um"); 5168 const onServerPrefetch = createHook( 5169 "sp" 5170 ); 5171 const onRenderTriggered = createHook("rtg"); 5172 const onRenderTracked = createHook("rtc"); 5173 function onErrorCaptured(hook, target = currentInstance) { 5174 injectHook("ec", hook, target); 5175 } 5176 5177 const COMPONENTS = "components"; 5178 const DIRECTIVES = "directives"; 5179 function resolveComponent(name, maybeSelfReference) { 5180 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 5181 } 5182 const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 5183 function resolveDynamicComponent(component) { 5184 if (isString(component)) { 5185 return resolveAsset(COMPONENTS, component, false) || component; 5186 } else { 5187 return component || NULL_DYNAMIC_COMPONENT; 5188 } 5189 } 5190 function resolveDirective(name) { 5191 return resolveAsset(DIRECTIVES, name); 5192 } 5193 function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { 5194 const instance = currentRenderingInstance || currentInstance; 5195 if (instance) { 5196 const Component = instance.type; 5197 if (type === COMPONENTS) { 5198 const selfName = getComponentName( 5199 Component, 5200 false 5201 ); 5202 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 5203 return Component; 5204 } 5205 } 5206 const res = ( 5207 // local registration 5208 // check instance[type] first which is resolved for options API 5209 resolve(instance[type] || Component[type], name) || // global registration 5210 resolve(instance.appContext[type], name) 5211 ); 5212 if (!res && maybeSelfReference) { 5213 return Component; 5214 } 5215 if (warnMissing && !res) { 5216 const extra = type === COMPONENTS ? ` 5217If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; 5218 warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); 5219 } 5220 return res; 5221 } else { 5222 warn$1( 5223 `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` 5224 ); 5225 } 5226 } 5227 function resolve(registry, name) { 5228 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 5229 } 5230 5231 function renderList(source, renderItem, cache, index) { 5232 let ret; 5233 const cached = cache && cache[index]; 5234 const sourceIsArray = isArray(source); 5235 if (sourceIsArray || isString(source)) { 5236 const sourceIsReactiveArray = sourceIsArray && isReactive(source); 5237 let needsWrap = false; 5238 let isReadonlySource = false; 5239 if (sourceIsReactiveArray) { 5240 needsWrap = !isShallow(source); 5241 isReadonlySource = isReadonly(source); 5242 source = shallowReadArray(source); 5243 } 5244 ret = new Array(source.length); 5245 for (let i = 0, l = source.length; i < l; i++) { 5246 ret[i] = renderItem( 5247 needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i], 5248 i, 5249 void 0, 5250 cached && cached[i] 5251 ); 5252 } 5253 } else if (typeof source === "number") { 5254 if (!Number.isInteger(source)) { 5255 warn$1(`The v-for range expect an integer value but got ${source}.`); 5256 } 5257 ret = new Array(source); 5258 for (let i = 0; i < source; i++) { 5259 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 5260 } 5261 } else if (isObject(source)) { 5262 if (source[Symbol.iterator]) { 5263 ret = Array.from( 5264 source, 5265 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 5266 ); 5267 } else { 5268 const keys = Object.keys(source); 5269 ret = new Array(keys.length); 5270 for (let i = 0, l = keys.length; i < l; i++) { 5271 const key = keys[i]; 5272 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 5273 } 5274 } 5275 } else { 5276 ret = []; 5277 } 5278 if (cache) { 5279 cache[index] = ret; 5280 } 5281 return ret; 5282 } 5283 5284 function createSlots(slots, dynamicSlots) { 5285 for (let i = 0; i < dynamicSlots.length; i++) { 5286 const slot = dynamicSlots[i]; 5287 if (isArray(slot)) { 5288 for (let j = 0; j < slot.length; j++) { 5289 slots[slot[j].name] = slot[j].fn; 5290 } 5291 } else if (slot) { 5292 slots[slot.name] = slot.key ? (...args) => { 5293 const res = slot.fn(...args); 5294 if (res) res.key = slot.key; 5295 return res; 5296 } : slot.fn; 5297 } 5298 } 5299 return slots; 5300 } 5301 5302 function renderSlot(slots, name, props = {}, fallback, noSlotted) { 5303 if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { 5304 const hasProps = Object.keys(props).length > 0; 5305 if (name !== "default") props.name = name; 5306 return openBlock(), createBlock( 5307 Fragment, 5308 null, 5309 [createVNode("slot", props, fallback && fallback())], 5310 hasProps ? -2 : 64 5311 ); 5312 } 5313 let slot = slots[name]; 5314 if (slot && slot.length > 1) { 5315 warn$1( 5316 `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.` 5317 ); 5318 slot = () => []; 5319 } 5320 if (slot && slot._c) { 5321 slot._d = false; 5322 } 5323 openBlock(); 5324 const validSlotContent = slot && ensureValidVNode(slot(props)); 5325 const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch 5326 // key attached in the `createSlots` helper, respect that 5327 validSlotContent && validSlotContent.key; 5328 const rendered = createBlock( 5329 Fragment, 5330 { 5331 key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content 5332 (!validSlotContent && fallback ? "_fb" : "") 5333 }, 5334 validSlotContent || (fallback ? fallback() : []), 5335 validSlotContent && slots._ === 1 ? 64 : -2 5336 ); 5337 if (!noSlotted && rendered.scopeId) { 5338 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 5339 } 5340 if (slot && slot._c) { 5341 slot._d = true; 5342 } 5343 return rendered; 5344 } 5345 function ensureValidVNode(vnodes) { 5346 return vnodes.some((child) => { 5347 if (!isVNode(child)) return true; 5348 if (child.type === Comment) return false; 5349 if (child.type === Fragment && !ensureValidVNode(child.children)) 5350 return false; 5351 return true; 5352 }) ? vnodes : null; 5353 } 5354 5355 function toHandlers(obj, preserveCaseIfNecessary) { 5356 const ret = {}; 5357 if (!isObject(obj)) { 5358 warn$1(`v-on with no argument expects an object value.`); 5359 return ret; 5360 } 5361 for (const key in obj) { 5362 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 5363 } 5364 return ret; 5365 } 5366 5367 const getPublicInstance = (i) => { 5368 if (!i) return null; 5369 if (isStatefulComponent(i)) return getComponentPublicInstance(i); 5370 return getPublicInstance(i.parent); 5371 }; 5372 const publicPropertiesMap = ( 5373 // Move PURE marker to new line to workaround compiler discarding it 5374 // due to type annotation 5375 /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { 5376 $: (i) => i, 5377 $el: (i) => i.vnode.el, 5378 $data: (i) => i.data, 5379 $props: (i) => shallowReadonly(i.props), 5380 $attrs: (i) => shallowReadonly(i.attrs), 5381 $slots: (i) => shallowReadonly(i.slots), 5382 $refs: (i) => shallowReadonly(i.refs), 5383 $parent: (i) => getPublicInstance(i.parent), 5384 $root: (i) => getPublicInstance(i.root), 5385 $host: (i) => i.ce, 5386 $emit: (i) => i.emit, 5387 $options: (i) => resolveMergedOptions(i), 5388 $forceUpdate: (i) => i.f || (i.f = () => { 5389 queueJob(i.update); 5390 }), 5391 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 5392 $watch: (i) => instanceWatch.bind(i) 5393 }) 5394 ); 5395 const isReservedPrefix = (key) => key === "_" || key === "$"; 5396 const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 5397 const PublicInstanceProxyHandlers = { 5398 get({ _: instance }, key) { 5399 if (key === "__v_skip") { 5400 return true; 5401 } 5402 const { ctx, setupState, data, props, accessCache, type, appContext } = instance; 5403 if (key === "__isVue") { 5404 return true; 5405 } 5406 if (key[0] !== "$") { 5407 const n = accessCache[key]; 5408 if (n !== void 0) { 5409 switch (n) { 5410 case 1 /* SETUP */: 5411 return setupState[key]; 5412 case 2 /* DATA */: 5413 return data[key]; 5414 case 4 /* CONTEXT */: 5415 return ctx[key]; 5416 case 3 /* PROPS */: 5417 return props[key]; 5418 } 5419 } else if (hasSetupBinding(setupState, key)) { 5420 accessCache[key] = 1 /* SETUP */; 5421 return setupState[key]; 5422 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5423 accessCache[key] = 2 /* DATA */; 5424 return data[key]; 5425 } else if (hasOwn(props, key)) { 5426 accessCache[key] = 3 /* PROPS */; 5427 return props[key]; 5428 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5429 accessCache[key] = 4 /* CONTEXT */; 5430 return ctx[key]; 5431 } else if (shouldCacheAccess) { 5432 accessCache[key] = 0 /* OTHER */; 5433 } 5434 } 5435 const publicGetter = publicPropertiesMap[key]; 5436 let cssModule, globalProperties; 5437 if (publicGetter) { 5438 if (key === "$attrs") { 5439 track(instance.attrs, "get", ""); 5440 markAttrsAccessed(); 5441 } else if (key === "$slots") { 5442 track(instance, "get", key); 5443 } 5444 return publicGetter(instance); 5445 } else if ( 5446 // css module (injected by vue-loader) 5447 (cssModule = type.__cssModules) && (cssModule = cssModule[key]) 5448 ) { 5449 return cssModule; 5450 } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { 5451 accessCache[key] = 4 /* CONTEXT */; 5452 return ctx[key]; 5453 } else if ( 5454 // global properties 5455 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 5456 ) { 5457 { 5458 return globalProperties[key]; 5459 } 5460 } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading 5461 // to infinite warning loop 5462 key.indexOf("__v") !== 0)) { 5463 if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { 5464 warn$1( 5465 `Property ${JSON.stringify( 5466 key 5467 )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` 5468 ); 5469 } else if (instance === currentRenderingInstance) { 5470 warn$1( 5471 `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` 5472 ); 5473 } 5474 } 5475 }, 5476 set({ _: instance }, key, value) { 5477 const { data, setupState, ctx } = instance; 5478 if (hasSetupBinding(setupState, key)) { 5479 setupState[key] = value; 5480 return true; 5481 } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) { 5482 warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`); 5483 return false; 5484 } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { 5485 data[key] = value; 5486 return true; 5487 } else if (hasOwn(instance.props, key)) { 5488 warn$1(`Attempting to mutate prop "${key}". Props are readonly.`); 5489 return false; 5490 } 5491 if (key[0] === "$" && key.slice(1) in instance) { 5492 warn$1( 5493 `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` 5494 ); 5495 return false; 5496 } else { 5497 if (key in instance.appContext.config.globalProperties) { 5498 Object.defineProperty(ctx, key, { 5499 enumerable: true, 5500 configurable: true, 5501 value 5502 }); 5503 } else { 5504 ctx[key] = value; 5505 } 5506 } 5507 return true; 5508 }, 5509 has({ 5510 _: { data, setupState, accessCache, ctx, appContext, props, type } 5511 }, key) { 5512 let cssModules; 5513 return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]); 5514 }, 5515 defineProperty(target, key, descriptor) { 5516 if (descriptor.get != null) { 5517 target._.accessCache[key] = 0; 5518 } else if (hasOwn(descriptor, "value")) { 5519 this.set(target, key, descriptor.value, null); 5520 } 5521 return Reflect.defineProperty(target, key, descriptor); 5522 } 5523 }; 5524 { 5525 PublicInstanceProxyHandlers.ownKeys = (target) => { 5526 warn$1( 5527 `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` 5528 ); 5529 return Reflect.ownKeys(target); 5530 }; 5531 } 5532 const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, { 5533 get(target, key) { 5534 if (key === Symbol.unscopables) { 5535 return; 5536 } 5537 return PublicInstanceProxyHandlers.get(target, key, target); 5538 }, 5539 has(_, key) { 5540 const has = key[0] !== "_" && !isGloballyAllowed(key); 5541 if (!has && PublicInstanceProxyHandlers.has(_, key)) { 5542 warn$1( 5543 `Property ${JSON.stringify( 5544 key 5545 )} should not start with _ which is a reserved prefix for Vue internals.` 5546 ); 5547 } 5548 return has; 5549 } 5550 }); 5551 function createDevRenderContext(instance) { 5552 const target = {}; 5553 Object.defineProperty(target, `_`, { 5554 configurable: true, 5555 enumerable: false, 5556 get: () => instance 5557 }); 5558 Object.keys(publicPropertiesMap).forEach((key) => { 5559 Object.defineProperty(target, key, { 5560 configurable: true, 5561 enumerable: false, 5562 get: () => publicPropertiesMap[key](instance), 5563 // intercepted by the proxy so no need for implementation, 5564 // but needed to prevent set errors 5565 set: NOOP 5566 }); 5567 }); 5568 return target; 5569 } 5570 function exposePropsOnRenderContext(instance) { 5571 const { 5572 ctx, 5573 propsOptions: [propsOptions] 5574 } = instance; 5575 if (propsOptions) { 5576 Object.keys(propsOptions).forEach((key) => { 5577 Object.defineProperty(ctx, key, { 5578 enumerable: true, 5579 configurable: true, 5580 get: () => instance.props[key], 5581 set: NOOP 5582 }); 5583 }); 5584 } 5585 } 5586 function exposeSetupStateOnRenderContext(instance) { 5587 const { ctx, setupState } = instance; 5588 Object.keys(toRaw(setupState)).forEach((key) => { 5589 if (!setupState.__isScriptSetup) { 5590 if (isReservedPrefix(key[0])) { 5591 warn$1( 5592 `setup() return property ${JSON.stringify( 5593 key 5594 )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` 5595 ); 5596 return; 5597 } 5598 Object.defineProperty(ctx, key, { 5599 enumerable: true, 5600 configurable: true, 5601 get: () => setupState[key], 5602 set: NOOP 5603 }); 5604 } 5605 }); 5606 } 5607 5608 const warnRuntimeUsage = (method) => warn$1( 5609 `${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.` 5610 ); 5611 function defineProps() { 5612 { 5613 warnRuntimeUsage(`defineProps`); 5614 } 5615 return null; 5616 } 5617 function defineEmits() { 5618 { 5619 warnRuntimeUsage(`defineEmits`); 5620 } 5621 return null; 5622 } 5623 function defineExpose(exposed) { 5624 { 5625 warnRuntimeUsage(`defineExpose`); 5626 } 5627 } 5628 function defineOptions(options) { 5629 { 5630 warnRuntimeUsage(`defineOptions`); 5631 } 5632 } 5633 function defineSlots() { 5634 { 5635 warnRuntimeUsage(`defineSlots`); 5636 } 5637 return null; 5638 } 5639 function defineModel() { 5640 { 5641 warnRuntimeUsage("defineModel"); 5642 } 5643 } 5644 function withDefaults(props, defaults) { 5645 { 5646 warnRuntimeUsage(`withDefaults`); 5647 } 5648 return null; 5649 } 5650 function useSlots() { 5651 return getContext("useSlots").slots; 5652 } 5653 function useAttrs() { 5654 return getContext("useAttrs").attrs; 5655 } 5656 function getContext(calledFunctionName) { 5657 const i = getCurrentInstance(); 5658 if (!i) { 5659 warn$1(`${calledFunctionName}() called without active instance.`); 5660 } 5661 return i.setupContext || (i.setupContext = createSetupContext(i)); 5662 } 5663 function normalizePropsOrEmits(props) { 5664 return isArray(props) ? props.reduce( 5665 (normalized, p) => (normalized[p] = null, normalized), 5666 {} 5667 ) : props; 5668 } 5669 function mergeDefaults(raw, defaults) { 5670 const props = normalizePropsOrEmits(raw); 5671 for (const key in defaults) { 5672 if (key.startsWith("__skip")) continue; 5673 let opt = props[key]; 5674 if (opt) { 5675 if (isArray(opt) || isFunction(opt)) { 5676 opt = props[key] = { type: opt, default: defaults[key] }; 5677 } else { 5678 opt.default = defaults[key]; 5679 } 5680 } else if (opt === null) { 5681 opt = props[key] = { default: defaults[key] }; 5682 } else { 5683 warn$1(`props default key "${key}" has no corresponding declaration.`); 5684 } 5685 if (opt && defaults[`__skip_${key}`]) { 5686 opt.skipFactory = true; 5687 } 5688 } 5689 return props; 5690 } 5691 function mergeModels(a, b) { 5692 if (!a || !b) return a || b; 5693 if (isArray(a) && isArray(b)) return a.concat(b); 5694 return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 5695 } 5696 function createPropsRestProxy(props, excludedKeys) { 5697 const ret = {}; 5698 for (const key in props) { 5699 if (!excludedKeys.includes(key)) { 5700 Object.defineProperty(ret, key, { 5701 enumerable: true, 5702 get: () => props[key] 5703 }); 5704 } 5705 } 5706 return ret; 5707 } 5708 function withAsyncContext(getAwaitable) { 5709 const ctx = getCurrentInstance(); 5710 if (!ctx) { 5711 warn$1( 5712 `withAsyncContext called without active current instance. This is likely a bug.` 5713 ); 5714 } 5715 let awaitable = getAwaitable(); 5716 unsetCurrentInstance(); 5717 if (isPromise(awaitable)) { 5718 awaitable = awaitable.catch((e) => { 5719 setCurrentInstance(ctx); 5720 throw e; 5721 }); 5722 } 5723 return [awaitable, () => setCurrentInstance(ctx)]; 5724 } 5725 5726 function createDuplicateChecker() { 5727 const cache = /* @__PURE__ */ Object.create(null); 5728 return (type, key) => { 5729 if (cache[key]) { 5730 warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`); 5731 } else { 5732 cache[key] = type; 5733 } 5734 }; 5735 } 5736 let shouldCacheAccess = true; 5737 function applyOptions(instance) { 5738 const options = resolveMergedOptions(instance); 5739 const publicThis = instance.proxy; 5740 const ctx = instance.ctx; 5741 shouldCacheAccess = false; 5742 if (options.beforeCreate) { 5743 callHook$1(options.beforeCreate, instance, "bc"); 5744 } 5745 const { 5746 // state 5747 data: dataOptions, 5748 computed: computedOptions, 5749 methods, 5750 watch: watchOptions, 5751 provide: provideOptions, 5752 inject: injectOptions, 5753 // lifecycle 5754 created, 5755 beforeMount, 5756 mounted, 5757 beforeUpdate, 5758 updated, 5759 activated, 5760 deactivated, 5761 beforeDestroy, 5762 beforeUnmount, 5763 destroyed, 5764 unmounted, 5765 render, 5766 renderTracked, 5767 renderTriggered, 5768 errorCaptured, 5769 serverPrefetch, 5770 // public API 5771 expose, 5772 inheritAttrs, 5773 // assets 5774 components, 5775 directives, 5776 filters 5777 } = options; 5778 const checkDuplicateProperties = createDuplicateChecker(); 5779 { 5780 const [propsOptions] = instance.propsOptions; 5781 if (propsOptions) { 5782 for (const key in propsOptions) { 5783 checkDuplicateProperties("Props" /* PROPS */, key); 5784 } 5785 } 5786 } 5787 if (injectOptions) { 5788 resolveInjections(injectOptions, ctx, checkDuplicateProperties); 5789 } 5790 if (methods) { 5791 for (const key in methods) { 5792 const methodHandler = methods[key]; 5793 if (isFunction(methodHandler)) { 5794 { 5795 Object.defineProperty(ctx, key, { 5796 value: methodHandler.bind(publicThis), 5797 configurable: true, 5798 enumerable: true, 5799 writable: true 5800 }); 5801 } 5802 { 5803 checkDuplicateProperties("Methods" /* METHODS */, key); 5804 } 5805 } else { 5806 warn$1( 5807 `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?` 5808 ); 5809 } 5810 } 5811 } 5812 if (dataOptions) { 5813 if (!isFunction(dataOptions)) { 5814 warn$1( 5815 `The data option must be a function. Plain object usage is no longer supported.` 5816 ); 5817 } 5818 const data = dataOptions.call(publicThis, publicThis); 5819 if (isPromise(data)) { 5820 warn$1( 5821 `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.` 5822 ); 5823 } 5824 if (!isObject(data)) { 5825 warn$1(`data() should return an object.`); 5826 } else { 5827 instance.data = reactive(data); 5828 { 5829 for (const key in data) { 5830 checkDuplicateProperties("Data" /* DATA */, key); 5831 if (!isReservedPrefix(key[0])) { 5832 Object.defineProperty(ctx, key, { 5833 configurable: true, 5834 enumerable: true, 5835 get: () => data[key], 5836 set: NOOP 5837 }); 5838 } 5839 } 5840 } 5841 } 5842 } 5843 shouldCacheAccess = true; 5844 if (computedOptions) { 5845 for (const key in computedOptions) { 5846 const opt = computedOptions[key]; 5847 const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 5848 if (get === NOOP) { 5849 warn$1(`Computed property "${key}" has no getter.`); 5850 } 5851 const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => { 5852 warn$1( 5853 `Write operation failed: computed property "${key}" is readonly.` 5854 ); 5855 }; 5856 const c = computed({ 5857 get, 5858 set 5859 }); 5860 Object.defineProperty(ctx, key, { 5861 enumerable: true, 5862 configurable: true, 5863 get: () => c.value, 5864 set: (v) => c.value = v 5865 }); 5866 { 5867 checkDuplicateProperties("Computed" /* COMPUTED */, key); 5868 } 5869 } 5870 } 5871 if (watchOptions) { 5872 for (const key in watchOptions) { 5873 createWatcher(watchOptions[key], ctx, publicThis, key); 5874 } 5875 } 5876 if (provideOptions) { 5877 const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
vendor: 5,099 bytes, lines 5878-6006
5878 Reflect.ownKeys(provides).forEach((key) => { 5879 provide(key, provides[key]); 5880 }); 5881 } 5882 if (created) { 5883 callHook$1(created, instance, "c"); 5884 } 5885 function registerLifecycleHook(register, hook) { 5886 if (isArray(hook)) { 5887 hook.forEach((_hook) => register(_hook.bind(publicThis))); 5888 } else if (hook) { 5889 register(hook.bind(publicThis)); 5890 } 5891 } 5892 registerLifecycleHook(onBeforeMount, beforeMount); 5893 registerLifecycleHook(onMounted, mounted); 5894 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 5895 registerLifecycleHook(onUpdated, updated); 5896 registerLifecycleHook(onActivated, activated); 5897 registerLifecycleHook(onDeactivated, deactivated); 5898 registerLifecycleHook(onErrorCaptured, errorCaptured); 5899 registerLifecycleHook(onRenderTracked, renderTracked); 5900 registerLifecycleHook(onRenderTriggered, renderTriggered); 5901 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 5902 registerLifecycleHook(onUnmounted, unmounted); 5903 registerLifecycleHook(onServerPrefetch, serverPrefetch); 5904 if (isArray(expose)) { 5905 if (expose.length) { 5906 const exposed = instance.exposed || (instance.exposed = {}); 5907 expose.forEach((key) => { 5908 Object.defineProperty(exposed, key, { 5909 get: () => publicThis[key], 5910 set: (val) => publicThis[key] = val, 5911 enumerable: true 5912 }); 5913 }); 5914 } else if (!instance.exposed) { 5915 instance.exposed = {}; 5916 } 5917 } 5918 if (render && instance.render === NOOP) { 5919 instance.render = render; 5920 } 5921 if (inheritAttrs != null) { 5922 instance.inheritAttrs = inheritAttrs; 5923 } 5924 if (components) instance.components = components; 5925 if (directives) instance.directives = directives; 5926 } 5927 function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { 5928 if (isArray(injectOptions)) { 5929 injectOptions = normalizeInject(injectOptions); 5930 } 5931 for (const key in injectOptions) { 5932 const opt = injectOptions[key]; 5933 let injected; 5934 if (isObject(opt)) { 5935 if ("default" in opt) { 5936 injected = inject( 5937 opt.from || key, 5938 opt.default, 5939 true 5940 ); 5941 } else { 5942 injected = inject(opt.from || key); 5943 } 5944 } else { 5945 injected = inject(opt); 5946 } 5947 if (isRef(injected)) { 5948 Object.defineProperty(ctx, key, { 5949 enumerable: true, 5950 configurable: true, 5951 get: () => injected.value, 5952 set: (v) => injected.value = v 5953 }); 5954 } else { 5955 ctx[key] = injected; 5956 } 5957 { 5958 checkDuplicateProperties("Inject" /* INJECT */, key); 5959 } 5960 } 5961 } 5962 function callHook$1(hook, instance, type) { 5963 callWithAsyncErrorHandling( 5964 isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), 5965 instance, 5966 type 5967 ); 5968 } 5969 function createWatcher(raw, ctx, publicThis, key) { 5970 let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 5971 if (isString(raw)) { 5972 const handler = ctx[raw]; 5973 if (isFunction(handler)) { 5974 { 5975 watch(getter, handler); 5976 } 5977 } else { 5978 warn$1(`Invalid watch handler specified by key "${raw}"`, handler); 5979 } 5980 } else if (isFunction(raw)) { 5981 { 5982 watch(getter, raw.bind(publicThis)); 5983 } 5984 } else if (isObject(raw)) { 5985 if (isArray(raw)) { 5986 raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); 5987 } else { 5988 const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; 5989 if (isFunction(handler)) { 5990 watch(getter, handler, raw); 5991 } else { 5992 warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler); 5993 } 5994 } 5995 } else { 5996 warn$1(`Invalid watch option: "${key}"`, raw); 5997 } 5998 } 5999 function resolveMergedOptions(instance) { 6000 const base = instance.type; 6001 const { mixins, extends: extendsOptions } = base; 6002 const { 6003 mixins: globalMixins, 6004 optionsCache: cache, 6005 config: { optionMergeStrategies } 6006 } = instance.appContext;
vendor: 10,624 bytes, lines 6007-6279
6007 const cached = cache.get(base); 6008 let resolved; 6009 if (cached) { 6010 resolved = cached; 6011 } else if (!globalMixins.length && !mixins && !extendsOptions) { 6012 { 6013 resolved = base; 6014 } 6015 } else { 6016 resolved = {}; 6017 if (globalMixins.length) { 6018 globalMixins.forEach( 6019 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 6020 ); 6021 } 6022 mergeOptions(resolved, base, optionMergeStrategies); 6023 } 6024 if (isObject(base)) { 6025 cache.set(base, resolved); 6026 } 6027 return resolved; 6028 } 6029 function mergeOptions(to, from, strats, asMixin = false) { 6030 const { mixins, extends: extendsOptions } = from; 6031 if (extendsOptions) { 6032 mergeOptions(to, extendsOptions, strats, true); 6033 } 6034 if (mixins) { 6035 mixins.forEach( 6036 (m) => mergeOptions(to, m, strats, true) 6037 ); 6038 } 6039 for (const key in from) { 6040 if (asMixin && key === "expose") { 6041 warn$1( 6042 `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.` 6043 ); 6044 } else { 6045 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 6046 to[key] = strat ? strat(to[key], from[key]) : from[key]; 6047 } 6048 } 6049 return to; 6050 } 6051 const internalOptionMergeStrats = { 6052 data: mergeDataFn, 6053 props: mergeEmitsOrPropsOptions, 6054 emits: mergeEmitsOrPropsOptions, 6055 // objects 6056 methods: mergeObjectOptions, 6057 computed: mergeObjectOptions, 6058 // lifecycle 6059 beforeCreate: mergeAsArray$1, 6060 created: mergeAsArray$1, 6061 beforeMount: mergeAsArray$1, 6062 mounted: mergeAsArray$1, 6063 beforeUpdate: mergeAsArray$1, 6064 updated: mergeAsArray$1, 6065 beforeDestroy: mergeAsArray$1, 6066 beforeUnmount: mergeAsArray$1, 6067 destroyed: mergeAsArray$1, 6068 unmounted: mergeAsArray$1, 6069 activated: mergeAsArray$1, 6070 deactivated: mergeAsArray$1, 6071 errorCaptured: mergeAsArray$1, 6072 serverPrefetch: mergeAsArray$1, 6073 // assets 6074 components: mergeObjectOptions, 6075 directives: mergeObjectOptions, 6076 // watch 6077 watch: mergeWatchOptions, 6078 // provide / inject 6079 provide: mergeDataFn, 6080 inject: mergeInject 6081 }; 6082 function mergeDataFn(to, from) { 6083 if (!from) { 6084 return to; 6085 } 6086 if (!to) { 6087 return from; 6088 } 6089 return function mergedDataFn() { 6090 return (extend)( 6091 isFunction(to) ? to.call(this, this) : to, 6092 isFunction(from) ? from.call(this, this) : from 6093 ); 6094 }; 6095 } 6096 function mergeInject(to, from) { 6097 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 6098 } 6099 function normalizeInject(raw) { 6100 if (isArray(raw)) { 6101 const res = {}; 6102 for (let i = 0; i < raw.length; i++) { 6103 res[raw[i]] = raw[i]; 6104 } 6105 return res; 6106 } 6107 return raw; 6108 } 6109 function mergeAsArray$1(to, from) { 6110 return to ? [...new Set([].concat(to, from))] : from; 6111 } 6112 function mergeObjectOptions(to, from) { 6113 return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from; 6114 } 6115 function mergeEmitsOrPropsOptions(to, from) { 6116 if (to) { 6117 if (isArray(to) && isArray(from)) { 6118 return [.../* @__PURE__ */ new Set([...to, ...from])]; 6119 } 6120 return extend( 6121 /* @__PURE__ */ Object.create(null), 6122 normalizePropsOrEmits(to), 6123 normalizePropsOrEmits(from != null ? from : {}) 6124 ); 6125 } else { 6126 return from; 6127 } 6128 } 6129 function mergeWatchOptions(to, from) { 6130 if (!to) return from; 6131 if (!from) return to; 6132 const merged = extend(/* @__PURE__ */ Object.create(null), to); 6133 for (const key in from) { 6134 merged[key] = mergeAsArray$1(to[key], from[key]); 6135 } 6136 return merged; 6137 } 6138 6139 function createAppContext() { 6140 return { 6141 app: null, 6142 config: { 6143 isNativeTag: NO, 6144 performance: false, 6145 globalProperties: {}, 6146 optionMergeStrategies: {}, 6147 errorHandler: void 0, 6148 warnHandler: void 0, 6149 compilerOptions: {} 6150 }, 6151 mixins: [], 6152 components: {}, 6153 directives: {}, 6154 provides: /* @__PURE__ */ Object.create(null), 6155 optionsCache: /* @__PURE__ */ new WeakMap(), 6156 propsCache: /* @__PURE__ */ new WeakMap(), 6157 emitsCache: /* @__PURE__ */ new WeakMap() 6158 }; 6159 } 6160 let uid$1 = 0; 6161 function createAppAPI(render, hydrate) { 6162 return function createApp(rootComponent, rootProps = null) { 6163 if (!isFunction(rootComponent)) { 6164 rootComponent = extend({}, rootComponent); 6165 } 6166 if (rootProps != null && !isObject(rootProps)) { 6167 warn$1(`root props passed to app.mount() must be an object.`); 6168 rootProps = null; 6169 } 6170 const context = createAppContext(); 6171 const installedPlugins = /* @__PURE__ */ new WeakSet(); 6172 const pluginCleanupFns = []; 6173 let isMounted = false; 6174 const app = context.app = { 6175 _uid: uid$1++, 6176 _component: rootComponent, 6177 _props: rootProps, 6178 _container: null, 6179 _context: context, 6180 _instance: null, 6181 version, 6182 get config() { 6183 return context.config; 6184 }, 6185 set config(v) { 6186 { 6187 warn$1( 6188 `app.config cannot be replaced. Modify individual options instead.` 6189 ); 6190 } 6191 }, 6192 use(plugin, ...options) { 6193 if (installedPlugins.has(plugin)) { 6194 warn$1(`Plugin has already been applied to target app.`); 6195 } else if (plugin && isFunction(plugin.install)) { 6196 installedPlugins.add(plugin); 6197 plugin.install(app, ...options); 6198 } else if (isFunction(plugin)) { 6199 installedPlugins.add(plugin); 6200 plugin(app, ...options); 6201 } else { 6202 warn$1( 6203 `A plugin must either be a function or an object with an "install" function.` 6204 ); 6205 } 6206 return app; 6207 }, 6208 mixin(mixin) { 6209 { 6210 if (!context.mixins.includes(mixin)) { 6211 context.mixins.push(mixin); 6212 } else { 6213 warn$1( 6214 "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "") 6215 ); 6216 } 6217 } 6218 return app; 6219 }, 6220 component(name, component) { 6221 { 6222 validateComponentName(name, context.config); 6223 } 6224 if (!component) { 6225 return context.components[name]; 6226 } 6227 if (context.components[name]) { 6228 warn$1(`Component "${name}" has already been registered in target app.`); 6229 } 6230 context.components[name] = component; 6231 return app; 6232 }, 6233 directive(name, directive) { 6234 { 6235 validateDirectiveName(name); 6236 } 6237 if (!directive) { 6238 return context.directives[name]; 6239 } 6240 if (context.directives[name]) { 6241 warn$1(`Directive "${name}" has already been registered in target app.`); 6242 } 6243 context.directives[name] = directive; 6244 return app; 6245 }, 6246 mount(rootContainer, isHydrate, namespace) { 6247 if (!isMounted) { 6248 if (rootContainer.__vue_app__) { 6249 warn$1( 6250 `There is already an app instance mounted on the host container. 6251 If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.` 6252 ); 6253 } 6254 const vnode = app._ceVNode || createVNode(rootComponent, rootProps); 6255 vnode.appContext = context; 6256 if (namespace === true) { 6257 namespace = "svg"; 6258 } else if (namespace === false) { 6259 namespace = void 0; 6260 } 6261 { 6262 context.reload = () => { 6263 const cloned = cloneVNode(vnode); 6264 cloned.el = null; 6265 render(cloned, rootContainer, namespace); 6266 }; 6267 } 6268 if (isHydrate && hydrate) { 6269 hydrate(vnode, rootContainer); 6270 } else { 6271 render(vnode, rootContainer, namespace); 6272 } 6273 isMounted = true; 6274 app._container = rootContainer; 6275 rootContainer.__vue_app__ = app; 6276 { 6277 app._instance = vnode.component; 6278 devtoolsInitApp(app, version); 6279 }
vendor: 12,103 bytes, lines 6280-6571
6280 return getComponentPublicInstance(vnode.component); 6281 } else { 6282 warn$1( 6283 `App has already been mounted. 6284If 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)\`` 6285 ); 6286 } 6287 }, 6288 onUnmount(cleanupFn) { 6289 if (typeof cleanupFn !== "function") { 6290 warn$1( 6291 `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}` 6292 ); 6293 } 6294 pluginCleanupFns.push(cleanupFn); 6295 }, 6296 unmount() { 6297 if (isMounted) { 6298 callWithAsyncErrorHandling( 6299 pluginCleanupFns, 6300 app._instance, 6301 16 6302 ); 6303 render(null, app._container); 6304 { 6305 app._instance = null; 6306 devtoolsUnmountApp(app); 6307 } 6308 delete app._container.__vue_app__; 6309 } else { 6310 warn$1(`Cannot unmount an app that is not mounted.`); 6311 } 6312 }, 6313 provide(key, value) { 6314 if (key in context.provides) { 6315 if (hasOwn(context.provides, key)) { 6316 warn$1( 6317 `App already provides property with key "${String(key)}". It will be overwritten with the new value.` 6318 ); 6319 } else { 6320 warn$1( 6321 `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.` 6322 ); 6323 } 6324 } 6325 context.provides[key] = value; 6326 return app; 6327 }, 6328 runWithContext(fn) { 6329 const lastApp = currentApp; 6330 currentApp = app; 6331 try { 6332 return fn(); 6333 } finally { 6334 currentApp = lastApp; 6335 } 6336 } 6337 }; 6338 return app; 6339 }; 6340 } 6341 let currentApp = null; 6342 6343 function provide(key, value) { 6344 { 6345 if (!currentInstance || currentInstance.isMounted) { 6346 warn$1(`provide() can only be used inside setup().`); 6347 } 6348 } 6349 if (currentInstance) { 6350 let provides = currentInstance.provides; 6351 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 6352 if (parentProvides === provides) { 6353 provides = currentInstance.provides = Object.create(parentProvides); 6354 } 6355 provides[key] = value; 6356 } 6357 } 6358 function inject(key, defaultValue, treatDefaultAsFactory = false) { 6359 const instance = getCurrentInstance(); 6360 if (instance || currentApp) { 6361 let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; 6362 if (provides && key in provides) { 6363 return provides[key]; 6364 } else if (arguments.length > 1) { 6365 return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 6366 } else { 6367 warn$1(`injection "${String(key)}" not found.`); 6368 } 6369 } else { 6370 warn$1(`inject() can only be used inside setup() or functional components.`); 6371 } 6372 } 6373 function hasInjectionContext() { 6374 return !!(getCurrentInstance() || currentApp); 6375 } 6376 6377 const ssrContextKey = Symbol.for("v-scx"); 6378 const useSSRContext = () => { 6379 { 6380 warn$1(`useSSRContext() is not supported in the global build.`); 6381 } 6382 }; 6383 6384 function watchEffect(effect, options) { 6385 return doWatch(effect, null, options); 6386 } 6387 function watchPostEffect(effect, options) { 6388 return doWatch( 6389 effect, 6390 null, 6391 extend({}, options, { flush: "post" }) 6392 ); 6393 } 6394 function watchSyncEffect(effect, options) { 6395 return doWatch( 6396 effect, 6397 null, 6398 extend({}, options, { flush: "sync" }) 6399 ); 6400 } 6401 function watch(source, cb, options) { 6402 if (!isFunction(cb)) { 6403 warn$1( 6404 `\`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.` 6405 ); 6406 } 6407 return doWatch(source, cb, options); 6408 } 6409 function doWatch(source, cb, options = EMPTY_OBJ) { 6410 const { immediate, deep, flush, once } = options; 6411 if (!cb) { 6412 if (immediate !== void 0) { 6413 warn$1( 6414 `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` 6415 ); 6416 } 6417 if (deep !== void 0) { 6418 warn$1( 6419 `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` 6420 ); 6421 } 6422 if (once !== void 0) { 6423 warn$1( 6424 `watch() "once" option is only respected when using the watch(source, callback, options?) signature.` 6425 ); 6426 } 6427 } 6428 const baseWatchOptions = extend({}, options); 6429 baseWatchOptions.onWarn = warn$1; 6430 const instance = currentInstance; 6431 baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args); 6432 let isPre = false; 6433 if (flush === "post") { 6434 baseWatchOptions.scheduler = (job) => { 6435 queuePostRenderEffect(job, instance && instance.suspense); 6436 }; 6437 } else if (flush !== "sync") { 6438 isPre = true; 6439 baseWatchOptions.scheduler = (job, isFirstRun) => { 6440 if (isFirstRun) { 6441 job(); 6442 } else { 6443 queueJob(job); 6444 } 6445 }; 6446 } 6447 baseWatchOptions.augmentJob = (job) => { 6448 if (cb) { 6449 job.flags |= 4; 6450 } 6451 if (isPre) { 6452 job.flags |= 2; 6453 if (instance) { 6454 job.id = instance.uid; 6455 job.i = instance; 6456 } 6457 } 6458 }; 6459 const watchHandle = watch$1(source, cb, baseWatchOptions); 6460 return watchHandle; 6461 } 6462 function instanceWatch(source, value, options) { 6463 const publicThis = this.proxy; 6464 const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 6465 let cb; 6466 if (isFunction(value)) { 6467 cb = value; 6468 } else { 6469 cb = value.handler; 6470 options = value; 6471 } 6472 const reset = setCurrentInstance(this); 6473 const res = doWatch(getter, cb.bind(publicThis), options); 6474 reset(); 6475 return res; 6476 } 6477 function createPathGetter(ctx, path) { 6478 const segments = path.split("."); 6479 return () => { 6480 let cur = ctx; 6481 for (let i = 0; i < segments.length && cur; i++) { 6482 cur = cur[segments[i]]; 6483 } 6484 return cur; 6485 }; 6486 } 6487 6488 function useModel(props, name, options = EMPTY_OBJ) { 6489 const i = getCurrentInstance(); 6490 if (!i) { 6491 warn$1(`useModel() called without active instance.`); 6492 return ref(); 6493 } 6494 const camelizedName = camelize(name); 6495 if (!i.propsOptions[0][camelizedName]) { 6496 warn$1(`useModel() called with prop "${name}" which is not declared.`); 6497 return ref(); 6498 } 6499 const hyphenatedName = hyphenate(name); 6500 const modifiers = getModelModifiers(props, camelizedName); 6501 const res = customRef((track, trigger) => { 6502 let localValue; 6503 let prevSetValue = EMPTY_OBJ; 6504 let prevEmittedValue; 6505 watchSyncEffect(() => { 6506 const propValue = props[camelizedName]; 6507 if (hasChanged(localValue, propValue)) { 6508 localValue = propValue; 6509 trigger(); 6510 } 6511 }); 6512 return { 6513 get() { 6514 track(); 6515 return options.get ? options.get(localValue) : localValue; 6516 }, 6517 set(value) { 6518 const emittedValue = options.set ? options.set(value) : value; 6519 if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) { 6520 return; 6521 } 6522 const rawProps = i.vnode.props; 6523 if (!(rawProps && // check if parent has passed v-model 6524 (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) { 6525 localValue = value; 6526 trigger(); 6527 } 6528 i.emit(`update:${name}`, emittedValue); 6529 if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) { 6530 trigger(); 6531 } 6532 prevSetValue = value; 6533 prevEmittedValue = emittedValue; 6534 } 6535 }; 6536 }); 6537 res[Symbol.iterator] = () => { 6538 let i2 = 0; 6539 return { 6540 next() { 6541 if (i2 < 2) { 6542 return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false }; 6543 } else { 6544 return { done: true }; 6545 } 6546 } 6547 }; 6548 }; 6549 return res; 6550 } 6551 const getModelModifiers = (props, modelName) => { 6552 return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`]; 6553 }; 6554 6555 function emit(instance, event, ...rawArgs) { 6556 if (instance.isUnmounted) return; 6557 const props = instance.vnode.props || EMPTY_OBJ; 6558 { 6559 const { 6560 emitsOptions, 6561 propsOptions: [propsOptions] 6562 } = instance; 6563 if (emitsOptions) { 6564 if (!(event in emitsOptions) && true) { 6565 if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) { 6566 warn$1( 6567 `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.` 6568 ); 6569 } 6570 } else { 6571 const validator = emitsOptions[event];
vendor: 80,656 bytes, lines 6572-8567
6572 if (isFunction(validator)) { 6573 const isValid = validator(...rawArgs); 6574 if (!isValid) { 6575 warn$1( 6576 `Invalid event arguments: event validation failed for event "${event}".` 6577 ); 6578 } 6579 } 6580 } 6581 } 6582 } 6583 let args = rawArgs; 6584 const isModelListener = event.startsWith("update:"); 6585 const modifiers = isModelListener && getModelModifiers(props, event.slice(7)); 6586 if (modifiers) { 6587 if (modifiers.trim) { 6588 args = rawArgs.map((a) => isString(a) ? a.trim() : a); 6589 } 6590 if (modifiers.number) { 6591 args = rawArgs.map(looseToNumber); 6592 } 6593 } 6594 { 6595 devtoolsComponentEmit(instance, event, args); 6596 } 6597 { 6598 const lowerCaseEvent = event.toLowerCase(); 6599 if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { 6600 warn$1( 6601 `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( 6602 instance, 6603 instance.type 6604 )} 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( 6605 event 6606 )}" instead of "${event}".` 6607 ); 6608 } 6609 } 6610 let handlerName; 6611 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 6612 props[handlerName = toHandlerKey(camelize(event))]; 6613 if (!handler && isModelListener) { 6614 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 6615 } 6616 if (handler) { 6617 callWithAsyncErrorHandling( 6618 handler, 6619 instance, 6620 6, 6621 args 6622 ); 6623 } 6624 const onceHandler = props[handlerName + `Once`]; 6625 if (onceHandler) { 6626 if (!instance.emitted) { 6627 instance.emitted = {}; 6628 } else if (instance.emitted[handlerName]) { 6629 return; 6630 } 6631 instance.emitted[handlerName] = true; 6632 callWithAsyncErrorHandling( 6633 onceHandler, 6634 instance, 6635 6, 6636 args 6637 ); 6638 } 6639 } 6640 const mixinEmitsCache = /* @__PURE__ */ new WeakMap(); 6641 function normalizeEmitsOptions(comp, appContext, asMixin = false) { 6642 const cache = asMixin ? mixinEmitsCache : appContext.emitsCache; 6643 const cached = cache.get(comp); 6644 if (cached !== void 0) { 6645 return cached; 6646 } 6647 const raw = comp.emits; 6648 let normalized = {}; 6649 let hasExtends = false; 6650 if (!isFunction(comp)) { 6651 const extendEmits = (raw2) => { 6652 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 6653 if (normalizedFromExtend) { 6654 hasExtends = true; 6655 extend(normalized, normalizedFromExtend); 6656 } 6657 }; 6658 if (!asMixin && appContext.mixins.length) { 6659 appContext.mixins.forEach(extendEmits); 6660 } 6661 if (comp.extends) { 6662 extendEmits(comp.extends); 6663 } 6664 if (comp.mixins) { 6665 comp.mixins.forEach(extendEmits); 6666 } 6667 } 6668 if (!raw && !hasExtends) { 6669 if (isObject(comp)) { 6670 cache.set(comp, null); 6671 } 6672 return null; 6673 } 6674 if (isArray(raw)) { 6675 raw.forEach((key) => normalized[key] = null); 6676 } else { 6677 extend(normalized, raw); 6678 } 6679 if (isObject(comp)) { 6680 cache.set(comp, normalized); 6681 } 6682 return normalized; 6683 } 6684 function isEmitListener(options, key) { 6685 if (!options || !isOn(key)) { 6686 return false; 6687 } 6688 key = key.slice(2).replace(/Once$/, ""); 6689 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 6690 } 6691 6692 let accessedAttrs = false; 6693 function markAttrsAccessed() { 6694 accessedAttrs = true; 6695 } 6696 function renderComponentRoot(instance) { 6697 const { 6698 type: Component, 6699 vnode, 6700 proxy, 6701 withProxy, 6702 propsOptions: [propsOptions], 6703 slots, 6704 attrs, 6705 emit, 6706 render, 6707 renderCache, 6708 props, 6709 data, 6710 setupState, 6711 ctx, 6712 inheritAttrs 6713 } = instance; 6714 const prev = setCurrentRenderingInstance(instance); 6715 let result; 6716 let fallthroughAttrs; 6717 { 6718 accessedAttrs = false; 6719 } 6720 try { 6721 if (vnode.shapeFlag & 4) { 6722 const proxyToUse = withProxy || proxy; 6723 const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, { 6724 get(target, key, receiver) { 6725 warn$1( 6726 `Property '${String( 6727 key 6728 )}' was accessed via 'this'. Avoid using 'this' in templates.` 6729 ); 6730 return Reflect.get(target, key, receiver); 6731 } 6732 }) : proxyToUse; 6733 result = normalizeVNode( 6734 render.call( 6735 thisProxy, 6736 proxyToUse, 6737 renderCache, 6738 true ? shallowReadonly(props) : props, 6739 setupState, 6740 data, 6741 ctx 6742 ) 6743 ); 6744 fallthroughAttrs = attrs; 6745 } else { 6746 const render2 = Component; 6747 if (attrs === props) { 6748 markAttrsAccessed(); 6749 } 6750 result = normalizeVNode( 6751 render2.length > 1 ? render2( 6752 true ? shallowReadonly(props) : props, 6753 true ? { 6754 get attrs() { 6755 markAttrsAccessed(); 6756 return shallowReadonly(attrs); 6757 }, 6758 slots, 6759 emit 6760 } : { attrs, slots, emit } 6761 ) : render2( 6762 true ? shallowReadonly(props) : props, 6763 null 6764 ) 6765 ); 6766 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 6767 } 6768 } catch (err) { 6769 blockStack.length = 0; 6770 handleError(err, instance, 1); 6771 result = createVNode(Comment); 6772 } 6773 let root = result; 6774 let setRoot = void 0; 6775 if (result.patchFlag > 0 && result.patchFlag & 2048) { 6776 [root, setRoot] = getChildRoot(result); 6777 } 6778 if (fallthroughAttrs && inheritAttrs !== false) { 6779 const keys = Object.keys(fallthroughAttrs); 6780 const { shapeFlag } = root; 6781 if (keys.length) { 6782 if (shapeFlag & (1 | 6)) { 6783 if (propsOptions && keys.some(isModelListener)) { 6784 fallthroughAttrs = filterModelListeners( 6785 fallthroughAttrs, 6786 propsOptions 6787 ); 6788 } 6789 root = cloneVNode(root, fallthroughAttrs, false, true); 6790 } else if (!accessedAttrs && root.type !== Comment) { 6791 const allAttrs = Object.keys(attrs); 6792 const eventAttrs = []; 6793 const extraAttrs = []; 6794 for (let i = 0, l = allAttrs.length; i < l; i++) { 6795 const key = allAttrs[i]; 6796 if (isOn(key)) { 6797 if (!isModelListener(key)) { 6798 eventAttrs.push(key[2].toLowerCase() + key.slice(3)); 6799 } 6800 } else { 6801 extraAttrs.push(key); 6802 } 6803 } 6804 if (extraAttrs.length) { 6805 warn$1( 6806 `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.` 6807 ); 6808 } 6809 if (eventAttrs.length) { 6810 warn$1( 6811 `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.` 6812 ); 6813 } 6814 } 6815 } 6816 } 6817 if (vnode.dirs) { 6818 if (!isElementRoot(root)) { 6819 warn$1( 6820 `Runtime directive used on component with non-element root node. The directives will not function as intended.` 6821 ); 6822 } 6823 root = cloneVNode(root, null, false, true); 6824 root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; 6825 } 6826 if (vnode.transition) { 6827 if (!isElementRoot(root)) { 6828 warn$1( 6829 `Component inside <Transition> renders non-element root node that cannot be animated.` 6830 ); 6831 } 6832 setTransitionHooks(root, vnode.transition); 6833 } 6834 if (setRoot) { 6835 setRoot(root); 6836 } else { 6837 result = root; 6838 } 6839 setCurrentRenderingInstance(prev); 6840 return result; 6841 } 6842 const getChildRoot = (vnode) => { 6843 const rawChildren = vnode.children; 6844 const dynamicChildren = vnode.dynamicChildren; 6845 const childRoot = filterSingleRoot(rawChildren, false); 6846 if (!childRoot) { 6847 return [vnode, void 0]; 6848 } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) { 6849 return getChildRoot(childRoot); 6850 } 6851 const index = rawChildren.indexOf(childRoot); 6852 const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; 6853 const setRoot = (updatedRoot) => { 6854 rawChildren[index] = updatedRoot; 6855 if (dynamicChildren) { 6856 if (dynamicIndex > -1) { 6857 dynamicChildren[dynamicIndex] = updatedRoot; 6858 } else if (updatedRoot.patchFlag > 0) { 6859 vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; 6860 } 6861 } 6862 }; 6863 return [normalizeVNode(childRoot), setRoot]; 6864 }; 6865 function filterSingleRoot(children, recurse = true) { 6866 let singleRoot; 6867 for (let i = 0; i < children.length; i++) { 6868 const child = children[i]; 6869 if (isVNode(child)) { 6870 if (child.type !== Comment || child.children === "v-if") { 6871 if (singleRoot) { 6872 return; 6873 } else { 6874 singleRoot = child; 6875 if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) { 6876 return filterSingleRoot(singleRoot.children); 6877 } 6878 } 6879 } 6880 } else { 6881 return; 6882 } 6883 } 6884 return singleRoot; 6885 } 6886 const getFunctionalFallthrough = (attrs) => { 6887 let res; 6888 for (const key in attrs) { 6889 if (key === "class" || key === "style" || isOn(key)) { 6890 (res || (res = {}))[key] = attrs[key]; 6891 } 6892 } 6893 return res; 6894 }; 6895 const filterModelListeners = (attrs, props) => { 6896 const res = {}; 6897 for (const key in attrs) { 6898 if (!isModelListener(key) || !(key.slice(9) in props)) { 6899 res[key] = attrs[key]; 6900 } 6901 } 6902 return res; 6903 }; 6904 const isElementRoot = (vnode) => { 6905 return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; 6906 }; 6907 function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 6908 const { props: prevProps, children: prevChildren, component } = prevVNode; 6909 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 6910 const emits = component.emitsOptions; 6911 if ((prevChildren || nextChildren) && isHmrUpdating) { 6912 return true; 6913 } 6914 if (nextVNode.dirs || nextVNode.transition) { 6915 return true; 6916 } 6917 if (optimized && patchFlag >= 0) { 6918 if (patchFlag & 1024) { 6919 return true; 6920 } 6921 if (patchFlag & 16) { 6922 if (!prevProps) { 6923 return !!nextProps; 6924 } 6925 return hasPropsChanged(prevProps, nextProps, emits); 6926 } else if (patchFlag & 8) { 6927 const dynamicProps = nextVNode.dynamicProps; 6928 for (let i = 0; i < dynamicProps.length; i++) { 6929 const key = dynamicProps[i]; 6930 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 6931 return true; 6932 } 6933 } 6934 } 6935 } else { 6936 if (prevChildren || nextChildren) { 6937 if (!nextChildren || !nextChildren.$stable) { 6938 return true; 6939 } 6940 } 6941 if (prevProps === nextProps) { 6942 return false; 6943 } 6944 if (!prevProps) { 6945 return !!nextProps; 6946 } 6947 if (!nextProps) { 6948 return true; 6949 } 6950 return hasPropsChanged(prevProps, nextProps, emits); 6951 } 6952 return false; 6953 } 6954 function hasPropsChanged(prevProps, nextProps, emitsOptions) { 6955 const nextKeys = Object.keys(nextProps); 6956 if (nextKeys.length !== Object.keys(prevProps).length) { 6957 return true; 6958 } 6959 for (let i = 0; i < nextKeys.length; i++) { 6960 const key = nextKeys[i]; 6961 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 6962 return true; 6963 } 6964 } 6965 return false; 6966 } 6967 function updateHOCHostEl({ vnode, parent }, el) { 6968 while (parent) { 6969 const root = parent.subTree; 6970 if (root.suspense && root.suspense.activeBranch === vnode) { 6971 root.el = vnode.el; 6972 } 6973 if (root === vnode) { 6974 (vnode = parent.vnode).el = el; 6975 parent = parent.parent; 6976 } else { 6977 break; 6978 } 6979 } 6980 } 6981 6982 const internalObjectProto = {}; 6983 const createInternalObject = () => Object.create(internalObjectProto); 6984 const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto; 6985 6986 function initProps(instance, rawProps, isStateful, isSSR = false) { 6987 const props = {}; 6988 const attrs = createInternalObject(); 6989 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 6990 setFullProps(instance, rawProps, props, attrs); 6991 for (const key in instance.propsOptions[0]) { 6992 if (!(key in props)) { 6993 props[key] = void 0; 6994 } 6995 } 6996 { 6997 validateProps(rawProps || {}, props, instance); 6998 } 6999 if (isStateful) { 7000 instance.props = isSSR ? props : shallowReactive(props); 7001 } else { 7002 if (!instance.type.props) { 7003 instance.props = attrs; 7004 } else { 7005 instance.props = props; 7006 } 7007 } 7008 instance.attrs = attrs; 7009 } 7010 function isInHmrContext(instance) { 7011 while (instance) { 7012 if (instance.type.__hmrId) return true; 7013 instance = instance.parent; 7014 } 7015 } 7016 function updateProps(instance, rawProps, rawPrevProps, optimized) { 7017 const { 7018 props, 7019 attrs, 7020 vnode: { patchFlag } 7021 } = instance; 7022 const rawCurrentProps = toRaw(props); 7023 const [options] = instance.propsOptions; 7024 let hasAttrsChanged = false; 7025 if ( 7026 // always force full diff in dev 7027 // - #1942 if hmr is enabled with sfc component 7028 // - vite#872 non-sfc component used by sfc component 7029 !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16) 7030 ) { 7031 if (patchFlag & 8) { 7032 const propsToUpdate = instance.vnode.dynamicProps; 7033 for (let i = 0; i < propsToUpdate.length; i++) { 7034 let key = propsToUpdate[i]; 7035 if (isEmitListener(instance.emitsOptions, key)) { 7036 continue; 7037 } 7038 const value = rawProps[key]; 7039 if (options) { 7040 if (hasOwn(attrs, key)) { 7041 if (value !== attrs[key]) { 7042 attrs[key] = value; 7043 hasAttrsChanged = true; 7044 } 7045 } else { 7046 const camelizedKey = camelize(key); 7047 props[camelizedKey] = resolvePropValue( 7048 options, 7049 rawCurrentProps, 7050 camelizedKey, 7051 value, 7052 instance, 7053 false 7054 ); 7055 } 7056 } else { 7057 if (value !== attrs[key]) { 7058 attrs[key] = value; 7059 hasAttrsChanged = true; 7060 } 7061 } 7062 } 7063 } 7064 } else { 7065 if (setFullProps(instance, rawProps, props, attrs)) { 7066 hasAttrsChanged = true; 7067 } 7068 let kebabKey; 7069 for (const key in rawCurrentProps) { 7070 if (!rawProps || // for camelCase 7071 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 7072 // and converted to camelCase (#955) 7073 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 7074 if (options) { 7075 if (rawPrevProps && // for camelCase 7076 (rawPrevProps[key] !== void 0 || // for kebab-case 7077 rawPrevProps[kebabKey] !== void 0)) { 7078 props[key] = resolvePropValue( 7079 options, 7080 rawCurrentProps, 7081 key, 7082 void 0, 7083 instance, 7084 true 7085 ); 7086 } 7087 } else { 7088 delete props[key]; 7089 } 7090 } 7091 } 7092 if (attrs !== rawCurrentProps) { 7093 for (const key in attrs) { 7094 if (!rawProps || !hasOwn(rawProps, key) && true) { 7095 delete attrs[key]; 7096 hasAttrsChanged = true; 7097 } 7098 } 7099 } 7100 } 7101 if (hasAttrsChanged) { 7102 trigger(instance.attrs, "set", ""); 7103 } 7104 { 7105 validateProps(rawProps || {}, props, instance); 7106 } 7107 } 7108 function setFullProps(instance, rawProps, props, attrs) { 7109 const [options, needCastKeys] = instance.propsOptions; 7110 let hasAttrsChanged = false; 7111 let rawCastValues; 7112 if (rawProps) { 7113 for (let key in rawProps) { 7114 if (isReservedProp(key)) { 7115 continue; 7116 } 7117 const value = rawProps[key]; 7118 let camelKey; 7119 if (options && hasOwn(options, camelKey = camelize(key))) { 7120 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 7121 props[camelKey] = value; 7122 } else { 7123 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 7124 } 7125 } else if (!isEmitListener(instance.emitsOptions, key)) { 7126 if (!(key in attrs) || value !== attrs[key]) { 7127 attrs[key] = value; 7128 hasAttrsChanged = true; 7129 } 7130 } 7131 } 7132 } 7133 if (needCastKeys) { 7134 const rawCurrentProps = toRaw(props); 7135 const castValues = rawCastValues || EMPTY_OBJ; 7136 for (let i = 0; i < needCastKeys.length; i++) { 7137 const key = needCastKeys[i]; 7138 props[key] = resolvePropValue( 7139 options, 7140 rawCurrentProps, 7141 key, 7142 castValues[key], 7143 instance, 7144 !hasOwn(castValues, key) 7145 ); 7146 } 7147 } 7148 return hasAttrsChanged; 7149 } 7150 function resolvePropValue(options, props, key, value, instance, isAbsent) { 7151 const opt = options[key]; 7152 if (opt != null) { 7153 const hasDefault = hasOwn(opt, "default"); 7154 if (hasDefault && value === void 0) { 7155 const defaultValue = opt.default; 7156 if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { 7157 const { propsDefaults } = instance; 7158 if (key in propsDefaults) { 7159 value = propsDefaults[key]; 7160 } else { 7161 const reset = setCurrentInstance(instance); 7162 value = propsDefaults[key] = defaultValue.call( 7163 null, 7164 props 7165 ); 7166 reset(); 7167 } 7168 } else { 7169 value = defaultValue; 7170 } 7171 if (instance.ce) { 7172 instance.ce._setProp(key, value); 7173 } 7174 } 7175 if (opt[0 /* shouldCast */]) { 7176 if (isAbsent && !hasDefault) { 7177 value = false; 7178 } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) { 7179 value = true; 7180 } 7181 } 7182 } 7183 return value; 7184 } 7185 const mixinPropsCache = /* @__PURE__ */ new WeakMap(); 7186 function normalizePropsOptions(comp, appContext, asMixin = false) { 7187 const cache = asMixin ? mixinPropsCache : appContext.propsCache; 7188 const cached = cache.get(comp); 7189 if (cached) { 7190 return cached; 7191 } 7192 const raw = comp.props; 7193 const normalized = {}; 7194 const needCastKeys = []; 7195 let hasExtends = false; 7196 if (!isFunction(comp)) { 7197 const extendProps = (raw2) => { 7198 hasExtends = true; 7199 const [props, keys] = normalizePropsOptions(raw2, appContext, true); 7200 extend(normalized, props); 7201 if (keys) needCastKeys.push(...keys); 7202 }; 7203 if (!asMixin && appContext.mixins.length) { 7204 appContext.mixins.forEach(extendProps); 7205 } 7206 if (comp.extends) { 7207 extendProps(comp.extends); 7208 } 7209 if (comp.mixins) { 7210 comp.mixins.forEach(extendProps); 7211 } 7212 } 7213 if (!raw && !hasExtends) { 7214 if (isObject(comp)) { 7215 cache.set(comp, EMPTY_ARR); 7216 } 7217 return EMPTY_ARR; 7218 } 7219 if (isArray(raw)) { 7220 for (let i = 0; i < raw.length; i++) { 7221 if (!isString(raw[i])) { 7222 warn$1(`props must be strings when using array syntax.`, raw[i]); 7223 } 7224 const normalizedKey = camelize(raw[i]); 7225 if (validatePropName(normalizedKey)) { 7226 normalized[normalizedKey] = EMPTY_OBJ; 7227 } 7228 } 7229 } else if (raw) { 7230 if (!isObject(raw)) { 7231 warn$1(`invalid props options`, raw); 7232 } 7233 for (const key in raw) { 7234 const normalizedKey = camelize(key); 7235 if (validatePropName(normalizedKey)) { 7236 const opt = raw[key]; 7237 const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); 7238 const propType = prop.type; 7239 let shouldCast = false; 7240 let shouldCastTrue = true; 7241 if (isArray(propType)) { 7242 for (let index = 0; index < propType.length; ++index) { 7243 const type = propType[index]; 7244 const typeName = isFunction(type) && type.name; 7245 if (typeName === "Boolean") { 7246 shouldCast = true; 7247 break; 7248 } else if (typeName === "String") { 7249 shouldCastTrue = false; 7250 } 7251 } 7252 } else { 7253 shouldCast = isFunction(propType) && propType.name === "Boolean"; 7254 } 7255 prop[0 /* shouldCast */] = shouldCast; 7256 prop[1 /* shouldCastTrue */] = shouldCastTrue; 7257 if (shouldCast || hasOwn(prop, "default")) { 7258 needCastKeys.push(normalizedKey); 7259 } 7260 } 7261 } 7262 } 7263 const res = [normalized, needCastKeys]; 7264 if (isObject(comp)) { 7265 cache.set(comp, res); 7266 } 7267 return res; 7268 } 7269 function validatePropName(key) { 7270 if (key[0] !== "$" && !isReservedProp(key)) { 7271 return true; 7272 } else { 7273 warn$1(`Invalid prop name: "${key}" is a reserved property.`); 7274 } 7275 return false; 7276 } 7277 function getType(ctor) { 7278 if (ctor === null) { 7279 return "null"; 7280 } 7281 if (typeof ctor === "function") { 7282 return ctor.name || ""; 7283 } else if (typeof ctor === "object") { 7284 const name = ctor.constructor && ctor.constructor.name; 7285 return name || ""; 7286 } 7287 return ""; 7288 } 7289 function validateProps(rawProps, props, instance) { 7290 const resolvedValues = toRaw(props); 7291 const options = instance.propsOptions[0]; 7292 const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key)); 7293 for (const key in options) { 7294 let opt = options[key]; 7295 if (opt == null) continue; 7296 validateProp( 7297 key, 7298 resolvedValues[key], 7299 opt, 7300 shallowReadonly(resolvedValues), 7301 !camelizePropsKey.includes(key) 7302 ); 7303 } 7304 } 7305 function validateProp(name, value, prop, props, isAbsent) { 7306 const { type, required, validator, skipCheck } = prop; 7307 if (required && isAbsent) { 7308 warn$1('Missing required prop: "' + name + '"'); 7309 return; 7310 } 7311 if (value == null && !required) { 7312 return; 7313 } 7314 if (type != null && type !== true && !skipCheck) { 7315 let isValid = false; 7316 const types = isArray(type) ? type : [type]; 7317 const expectedTypes = []; 7318 for (let i = 0; i < types.length && !isValid; i++) { 7319 const { valid, expectedType } = assertType(value, types[i]); 7320 expectedTypes.push(expectedType || ""); 7321 isValid = valid; 7322 } 7323 if (!isValid) { 7324 warn$1(getInvalidTypeMessage(name, value, expectedTypes)); 7325 return; 7326 } 7327 } 7328 if (validator && !validator(value, props)) { 7329 warn$1('Invalid prop: custom validator check failed for prop "' + name + '".'); 7330 } 7331 } 7332 const isSimpleType = /* @__PURE__ */ makeMap( 7333 "String,Number,Boolean,Function,Symbol,BigInt" 7334 ); 7335 function assertType(value, type) { 7336 let valid; 7337 const expectedType = getType(type); 7338 if (expectedType === "null") { 7339 valid = value === null; 7340 } else if (isSimpleType(expectedType)) { 7341 const t = typeof value; 7342 valid = t === expectedType.toLowerCase(); 7343 if (!valid && t === "object") { 7344 valid = value instanceof type; 7345 } 7346 } else if (expectedType === "Object") { 7347 valid = isObject(value); 7348 } else if (expectedType === "Array") { 7349 valid = isArray(value); 7350 } else { 7351 valid = value instanceof type; 7352 } 7353 return { 7354 valid, 7355 expectedType 7356 }; 7357 } 7358 function getInvalidTypeMessage(name, value, expectedTypes) { 7359 if (expectedTypes.length === 0) { 7360 return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`; 7361 } 7362 let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`; 7363 const expectedType = expectedTypes[0]; 7364 const receivedType = toRawType(value); 7365 const expectedValue = styleValue(value, expectedType); 7366 const receivedValue = styleValue(value, receivedType); 7367 if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) { 7368 message += ` with value ${expectedValue}`; 7369 } 7370 message += `, got ${receivedType} `; 7371 if (isExplicable(receivedType)) { 7372 message += `with value ${receivedValue}.`; 7373 } 7374 return message; 7375 } 7376 function styleValue(value, type) { 7377 if (type === "String") { 7378 return `"${value}"`; 7379 } else if (type === "Number") { 7380 return `${Number(value)}`; 7381 } else { 7382 return `${value}`; 7383 } 7384 } 7385 function isExplicable(type) { 7386 const explicitTypes = ["string", "number", "boolean"]; 7387 return explicitTypes.some((elem) => type.toLowerCase() === elem); 7388 } 7389 function isBoolean(...args) { 7390 return args.some((elem) => elem.toLowerCase() === "boolean"); 7391 } 7392 7393 const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable"; 7394 const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 7395 const normalizeSlot = (key, rawSlot, ctx) => { 7396 if (rawSlot._n) { 7397 return rawSlot; 7398 } 7399 const normalized = withCtx((...args) => { 7400 if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) { 7401 warn$1( 7402 `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.` 7403 ); 7404 } 7405 return normalizeSlotValue(rawSlot(...args)); 7406 }, ctx); 7407 normalized._c = false; 7408 return normalized; 7409 }; 7410 const normalizeObjectSlots = (rawSlots, slots, instance) => { 7411 const ctx = rawSlots._ctx; 7412 for (const key in rawSlots) { 7413 if (isInternalKey(key)) continue; 7414 const value = rawSlots[key]; 7415 if (isFunction(value)) { 7416 slots[key] = normalizeSlot(key, value, ctx); 7417 } else if (value != null) { 7418 { 7419 warn$1( 7420 `Non-function value encountered for slot "${key}". Prefer function slots for better performance.` 7421 ); 7422 } 7423 const normalized = normalizeSlotValue(value); 7424 slots[key] = () => normalized; 7425 } 7426 } 7427 }; 7428 const normalizeVNodeSlots = (instance, children) => { 7429 if (!isKeepAlive(instance.vnode) && true) { 7430 warn$1( 7431 `Non-function value encountered for default slot. Prefer function slots for better performance.` 7432 ); 7433 } 7434 const normalized = normalizeSlotValue(children); 7435 instance.slots.default = () => normalized; 7436 }; 7437 const assignSlots = (slots, children, optimized) => { 7438 for (const key in children) { 7439 if (optimized || !isInternalKey(key)) { 7440 slots[key] = children[key]; 7441 } 7442 } 7443 }; 7444 const initSlots = (instance, children, optimized) => { 7445 const slots = instance.slots = createInternalObject(); 7446 if (instance.vnode.shapeFlag & 32) { 7447 const type = children._; 7448 if (type) { 7449 assignSlots(slots, children, optimized); 7450 if (optimized) { 7451 def(slots, "_", type, true); 7452 } 7453 } else { 7454 normalizeObjectSlots(children, slots); 7455 } 7456 } else if (children) { 7457 normalizeVNodeSlots(instance, children); 7458 } 7459 }; 7460 const updateSlots = (instance, children, optimized) => { 7461 const { vnode, slots } = instance; 7462 let needDeletionCheck = true; 7463 let deletionComparisonTarget = EMPTY_OBJ; 7464 if (vnode.shapeFlag & 32) { 7465 const type = children._; 7466 if (type) { 7467 if (isHmrUpdating) { 7468 assignSlots(slots, children, optimized); 7469 trigger(instance, "set", "$slots"); 7470 } else if (optimized && type === 1) { 7471 needDeletionCheck = false; 7472 } else { 7473 assignSlots(slots, children, optimized); 7474 } 7475 } else { 7476 needDeletionCheck = !children.$stable; 7477 normalizeObjectSlots(children, slots); 7478 } 7479 deletionComparisonTarget = children; 7480 } else if (children) { 7481 normalizeVNodeSlots(instance, children); 7482 deletionComparisonTarget = { default: 1 }; 7483 } 7484 if (needDeletionCheck) { 7485 for (const key in slots) { 7486 if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { 7487 delete slots[key]; 7488 } 7489 } 7490 } 7491 }; 7492 7493 let supported; 7494 let perf; 7495 function startMeasure(instance, type) { 7496 if (instance.appContext.config.performance && isSupported()) { 7497 perf.mark(`vue-${type}-${instance.uid}`); 7498 } 7499 { 7500 devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now()); 7501 } 7502 } 7503 function endMeasure(instance, type) { 7504 if (instance.appContext.config.performance && isSupported()) { 7505 const startTag = `vue-${type}-${instance.uid}`; 7506 const endTag = startTag + `:end`; 7507 const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`; 7508 perf.mark(endTag); 7509 perf.measure(measureName, startTag, endTag); 7510 perf.clearMeasures(measureName); 7511 perf.clearMarks(startTag); 7512 perf.clearMarks(endTag); 7513 } 7514 { 7515 devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now()); 7516 } 7517 } 7518 function isSupported() { 7519 if (supported !== void 0) { 7520 return supported; 7521 } 7522 if (typeof window !== "undefined" && window.performance) { 7523 supported = true; 7524 perf = window.performance; 7525 } else { 7526 supported = false; 7527 } 7528 return supported; 7529 } 7530 7531 const queuePostRenderEffect = queueEffectWithSuspense; 7532 function createRenderer(options) { 7533 return baseCreateRenderer(options); 7534 } 7535 function createHydrationRenderer(options) { 7536 return baseCreateRenderer(options, createHydrationFunctions); 7537 } 7538 function baseCreateRenderer(options, createHydrationFns) { 7539 const target = getGlobalThis(); 7540 target.__VUE__ = true; 7541 { 7542 setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); 7543 } 7544 const { 7545 insert: hostInsert, 7546 remove: hostRemove, 7547 patchProp: hostPatchProp, 7548 createElement: hostCreateElement, 7549 createText: hostCreateText, 7550 createComment: hostCreateComment, 7551 setText: hostSetText, 7552 setElementText: hostSetElementText, 7553 parentNode: hostParentNode, 7554 nextSibling: hostNextSibling, 7555 setScopeId: hostSetScopeId = NOOP, 7556 insertStaticContent: hostInsertStaticContent 7557 } = options; 7558 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => { 7559 if (n1 === n2) { 7560 return; 7561 } 7562 if (n1 && !isSameVNodeType(n1, n2)) { 7563 anchor = getNextHostNode(n1); 7564 unmount(n1, parentComponent, parentSuspense, true); 7565 n1 = null; 7566 } 7567 if (n2.patchFlag === -2) { 7568 optimized = false; 7569 n2.dynamicChildren = null; 7570 } 7571 const { type, ref, shapeFlag } = n2; 7572 switch (type) { 7573 case Text: 7574 processText(n1, n2, container, anchor); 7575 break; 7576 case Comment: 7577 processCommentNode(n1, n2, container, anchor); 7578 break; 7579 case Static: 7580 if (n1 == null) { 7581 mountStaticNode(n2, container, anchor, namespace); 7582 } else { 7583 patchStaticNode(n1, n2, container, namespace); 7584 } 7585 break; 7586 case Fragment: 7587 processFragment( 7588 n1, 7589 n2, 7590 container, 7591 anchor, 7592 parentComponent, 7593 parentSuspense, 7594 namespace, 7595 slotScopeIds, 7596 optimized 7597 ); 7598 break; 7599 default: 7600 if (shapeFlag & 1) { 7601 processElement( 7602 n1, 7603 n2, 7604 container, 7605 anchor, 7606 parentComponent, 7607 parentSuspense, 7608 namespace, 7609 slotScopeIds, 7610 optimized 7611 ); 7612 } else if (shapeFlag & 6) { 7613 processComponent( 7614 n1, 7615 n2, 7616 container, 7617 anchor, 7618 parentComponent, 7619 parentSuspense, 7620 namespace, 7621 slotScopeIds, 7622 optimized 7623 ); 7624 } else if (shapeFlag & 64) { 7625 type.process( 7626 n1, 7627 n2, 7628 container, 7629 anchor, 7630 parentComponent, 7631 parentSuspense, 7632 namespace, 7633 slotScopeIds, 7634 optimized, 7635 internals 7636 ); 7637 } else if (shapeFlag & 128) { 7638 type.process( 7639 n1, 7640 n2, 7641 container, 7642 anchor, 7643 parentComponent, 7644 parentSuspense, 7645 namespace, 7646 slotScopeIds, 7647 optimized, 7648 internals 7649 ); 7650 } else { 7651 warn$1("Invalid VNode type:", type, `(${typeof type})`); 7652 } 7653 } 7654 if (ref != null && parentComponent) { 7655 setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 7656 } else if (ref == null && n1 && n1.ref != null) { 7657 setRef(n1.ref, null, parentSuspense, n1, true); 7658 } 7659 }; 7660 const processText = (n1, n2, container, anchor) => { 7661 if (n1 == null) { 7662 hostInsert( 7663 n2.el = hostCreateText(n2.children), 7664 container, 7665 anchor 7666 ); 7667 } else { 7668 const el = n2.el = n1.el; 7669 if (n2.children !== n1.children) { 7670 hostSetText(el, n2.children); 7671 } 7672 } 7673 }; 7674 const processCommentNode = (n1, n2, container, anchor) => { 7675 if (n1 == null) { 7676 hostInsert( 7677 n2.el = hostCreateComment(n2.children || ""), 7678 container, 7679 anchor 7680 ); 7681 } else { 7682 n2.el = n1.el; 7683 } 7684 }; 7685 const mountStaticNode = (n2, container, anchor, namespace) => { 7686 [n2.el, n2.anchor] = hostInsertStaticContent( 7687 n2.children, 7688 container, 7689 anchor, 7690 namespace, 7691 n2.el, 7692 n2.anchor 7693 ); 7694 }; 7695 const patchStaticNode = (n1, n2, container, namespace) => { 7696 if (n2.children !== n1.children) { 7697 const anchor = hostNextSibling(n1.anchor); 7698 removeStaticNode(n1); 7699 [n2.el, n2.anchor] = hostInsertStaticContent( 7700 n2.children, 7701 container, 7702 anchor, 7703 namespace 7704 ); 7705 } else { 7706 n2.el = n1.el; 7707 n2.anchor = n1.anchor; 7708 } 7709 }; 7710 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 7711 let next; 7712 while (el && el !== anchor) { 7713 next = hostNextSibling(el); 7714 hostInsert(el, container, nextSibling); 7715 el = next; 7716 } 7717 hostInsert(anchor, container, nextSibling); 7718 }; 7719 const removeStaticNode = ({ el, anchor }) => { 7720 let next; 7721 while (el && el !== anchor) { 7722 next = hostNextSibling(el); 7723 hostRemove(el); 7724 el = next; 7725 } 7726 hostRemove(anchor); 7727 }; 7728 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7729 if (n2.type === "svg") { 7730 namespace = "svg"; 7731 } else if (n2.type === "math") { 7732 namespace = "mathml"; 7733 } 7734 if (n1 == null) { 7735 mountElement( 7736 n2, 7737 container, 7738 anchor, 7739 parentComponent, 7740 parentSuspense, 7741 namespace, 7742 slotScopeIds, 7743 optimized 7744 ); 7745 } else { 7746 const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null; 7747 try { 7748 if (customElement) { 7749 customElement._beginPatch(); 7750 } 7751 patchElement( 7752 n1, 7753 n2, 7754 parentComponent, 7755 parentSuspense, 7756 namespace, 7757 slotScopeIds, 7758 optimized 7759 ); 7760 } finally { 7761 if (customElement) { 7762 customElement._endPatch(); 7763 } 7764 } 7765 } 7766 }; 7767 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7768 let el; 7769 let vnodeHook; 7770 const { props, shapeFlag, transition, dirs } = vnode; 7771 el = vnode.el = hostCreateElement( 7772 vnode.type, 7773 namespace, 7774 props && props.is, 7775 props 7776 ); 7777 if (shapeFlag & 8) { 7778 hostSetElementText(el, vnode.children); 7779 } else if (shapeFlag & 16) { 7780 mountChildren( 7781 vnode.children, 7782 el, 7783 null, 7784 parentComponent, 7785 parentSuspense, 7786 resolveChildrenNamespace(vnode, namespace), 7787 slotScopeIds, 7788 optimized 7789 ); 7790 } 7791 if (dirs) { 7792 invokeDirectiveHook(vnode, null, parentComponent, "created"); 7793 } 7794 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 7795 if (props) { 7796 for (const key in props) { 7797 if (key !== "value" && !isReservedProp(key)) { 7798 hostPatchProp(el, key, null, props[key], namespace, parentComponent); 7799 } 7800 } 7801 if ("value" in props) { 7802 hostPatchProp(el, "value", null, props.value, namespace); 7803 } 7804 if (vnodeHook = props.onVnodeBeforeMount) { 7805 invokeVNodeHook(vnodeHook, parentComponent, vnode); 7806 } 7807 } 7808 { 7809 def(el, "__vnode", vnode, true); 7810 def(el, "__vueParentComponent", parentComponent, true); 7811 } 7812 if (dirs) { 7813 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 7814 } 7815 const needCallTransitionHooks = needTransition(parentSuspense, transition); 7816 if (needCallTransitionHooks) { 7817 transition.beforeEnter(el); 7818 } 7819 hostInsert(el, container, anchor); 7820 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 7821 queuePostRenderEffect(() => { 7822 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 7823 needCallTransitionHooks && transition.enter(el); 7824 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 7825 }, parentSuspense); 7826 } 7827 }; 7828 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 7829 if (scopeId) { 7830 hostSetScopeId(el, scopeId); 7831 } 7832 if (slotScopeIds) { 7833 for (let i = 0; i < slotScopeIds.length; i++) { 7834 hostSetScopeId(el, slotScopeIds[i]); 7835 } 7836 } 7837 if (parentComponent) { 7838 let subTree = parentComponent.subTree; 7839 if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) { 7840 subTree = filterSingleRoot(subTree.children) || subTree; 7841 } 7842 if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) { 7843 const parentVNode = parentComponent.vnode; 7844 setScopeId( 7845 el, 7846 parentVNode, 7847 parentVNode.scopeId, 7848 parentVNode.slotScopeIds, 7849 parentComponent.parent 7850 ); 7851 } 7852 } 7853 }; 7854 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => { 7855 for (let i = start; i < children.length; i++) { 7856 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 7857 patch( 7858 null, 7859 child, 7860 container, 7861 anchor, 7862 parentComponent, 7863 parentSuspense, 7864 namespace, 7865 slotScopeIds, 7866 optimized 7867 ); 7868 } 7869 }; 7870 const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 7871 const el = n2.el = n1.el; 7872 { 7873 el.__vnode = n2; 7874 } 7875 let { patchFlag, dynamicChildren, dirs } = n2; 7876 patchFlag |= n1.patchFlag & 16; 7877 const oldProps = n1.props || EMPTY_OBJ; 7878 const newProps = n2.props || EMPTY_OBJ; 7879 let vnodeHook; 7880 parentComponent && toggleRecurse(parentComponent, false); 7881 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 7882 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7883 } 7884 if (dirs) { 7885 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 7886 } 7887 parentComponent && toggleRecurse(parentComponent, true); 7888 if (isHmrUpdating) { 7889 patchFlag = 0; 7890 optimized = false; 7891 dynamicChildren = null; 7892 } 7893 if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) { 7894 hostSetElementText(el, ""); 7895 } 7896 if (dynamicChildren) { 7897 patchBlockChildren( 7898 n1.dynamicChildren, 7899 dynamicChildren, 7900 el, 7901 parentComponent, 7902 parentSuspense, 7903 resolveChildrenNamespace(n2, namespace), 7904 slotScopeIds 7905 ); 7906 { 7907 traverseStaticChildren(n1, n2); 7908 } 7909 } else if (!optimized) { 7910 patchChildren( 7911 n1, 7912 n2, 7913 el, 7914 null, 7915 parentComponent, 7916 parentSuspense, 7917 resolveChildrenNamespace(n2, namespace), 7918 slotScopeIds, 7919 false 7920 ); 7921 } 7922 if (patchFlag > 0) { 7923 if (patchFlag & 16) { 7924 patchProps(el, oldProps, newProps, parentComponent, namespace); 7925 } else { 7926 if (patchFlag & 2) { 7927 if (oldProps.class !== newProps.class) { 7928 hostPatchProp(el, "class", null, newProps.class, namespace); 7929 } 7930 } 7931 if (patchFlag & 4) { 7932 hostPatchProp(el, "style", oldProps.style, newProps.style, namespace); 7933 } 7934 if (patchFlag & 8) { 7935 const propsToUpdate = n2.dynamicProps; 7936 for (let i = 0; i < propsToUpdate.length; i++) { 7937 const key = propsToUpdate[i]; 7938 const prev = oldProps[key]; 7939 const next = newProps[key]; 7940 if (next !== prev || key === "value") { 7941 hostPatchProp(el, key, prev, next, namespace, parentComponent); 7942 } 7943 } 7944 } 7945 } 7946 if (patchFlag & 1) { 7947 if (n1.children !== n2.children) { 7948 hostSetElementText(el, n2.children); 7949 } 7950 } 7951 } else if (!optimized && dynamicChildren == null) { 7952 patchProps(el, oldProps, newProps, parentComponent, namespace); 7953 } 7954 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 7955 queuePostRenderEffect(() => { 7956 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 7957 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 7958 }, parentSuspense); 7959 } 7960 }; 7961 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => { 7962 for (let i = 0; i < newChildren.length; i++) { 7963 const oldVNode = oldChildren[i]; 7964 const newVNode = newChildren[i]; 7965 const container = ( 7966 // oldVNode may be an errored async setup() component inside Suspense 7967 // which will not have a mounted element 7968 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 7969 // of the Fragment itself so it can move its children. 7970 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 7971 // which also requires the correct parent container 7972 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 7973 oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : ( 7974 // In other cases, the parent container is not actually used so we 7975 // just pass the block element here to avoid a DOM parentNode call. 7976 fallbackContainer 7977 ) 7978 ); 7979 patch( 7980 oldVNode, 7981 newVNode, 7982 container, 7983 null, 7984 parentComponent, 7985 parentSuspense, 7986 namespace, 7987 slotScopeIds, 7988 true 7989 ); 7990 } 7991 }; 7992 const patchProps = (el, oldProps, newProps, parentComponent, namespace) => { 7993 if (oldProps !== newProps) { 7994 if (oldProps !== EMPTY_OBJ) { 7995 for (const key in oldProps) { 7996 if (!isReservedProp(key) && !(key in newProps)) { 7997 hostPatchProp( 7998 el, 7999 key, 8000 oldProps[key], 8001 null, 8002 namespace, 8003 parentComponent 8004 ); 8005 } 8006 } 8007 } 8008 for (const key in newProps) { 8009 if (isReservedProp(key)) continue; 8010 const next = newProps[key]; 8011 const prev = oldProps[key]; 8012 if (next !== prev && key !== "value") { 8013 hostPatchProp(el, key, prev, next, namespace, parentComponent); 8014 } 8015 } 8016 if ("value" in newProps) { 8017 hostPatchProp(el, "value", oldProps.value, newProps.value, namespace); 8018 } 8019 } 8020 }; 8021 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8022 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 8023 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 8024 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 8025 if ( 8026 // #5523 dev root fragment may inherit directives 8027 isHmrUpdating || patchFlag & 2048 8028 ) { 8029 patchFlag = 0; 8030 optimized = false; 8031 dynamicChildren = null; 8032 } 8033 if (fragmentSlotScopeIds) { 8034 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 8035 } 8036 if (n1 == null) { 8037 hostInsert(fragmentStartAnchor, container, anchor); 8038 hostInsert(fragmentEndAnchor, container, anchor); 8039 mountChildren( 8040 // #10007 8041 // such fragment like `<></>` will be compiled into 8042 // a fragment which doesn't have a children. 8043 // In this case fallback to an empty array 8044 n2.children || [], 8045 container, 8046 fragmentEndAnchor, 8047 parentComponent, 8048 parentSuspense, 8049 namespace, 8050 slotScopeIds, 8051 optimized 8052 ); 8053 } else { 8054 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 8055 // of renderSlot() with no valid children 8056 n1.dynamicChildren) { 8057 patchBlockChildren( 8058 n1.dynamicChildren, 8059 dynamicChildren, 8060 container, 8061 parentComponent, 8062 parentSuspense, 8063 namespace, 8064 slotScopeIds 8065 ); 8066 { 8067 traverseStaticChildren(n1, n2); 8068 } 8069 } else { 8070 patchChildren( 8071 n1, 8072 n2, 8073 container, 8074 fragmentEndAnchor, 8075 parentComponent, 8076 parentSuspense, 8077 namespace, 8078 slotScopeIds, 8079 optimized 8080 ); 8081 } 8082 } 8083 }; 8084 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8085 n2.slotScopeIds = slotScopeIds; 8086 if (n1 == null) { 8087 if (n2.shapeFlag & 512) { 8088 parentComponent.ctx.activate( 8089 n2, 8090 container, 8091 anchor, 8092 namespace, 8093 optimized 8094 ); 8095 } else { 8096 mountComponent( 8097 n2, 8098 container, 8099 anchor, 8100 parentComponent, 8101 parentSuspense, 8102 namespace, 8103 optimized 8104 ); 8105 } 8106 } else { 8107 updateComponent(n1, n2, optimized); 8108 } 8109 }; 8110 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => { 8111 const instance = (initialVNode.component = createComponentInstance( 8112 initialVNode, 8113 parentComponent, 8114 parentSuspense 8115 )); 8116 if (instance.type.__hmrId) { 8117 registerHMR(instance); 8118 } 8119 { 8120 pushWarningContext(initialVNode); 8121 startMeasure(instance, `mount`); 8122 } 8123 if (isKeepAlive(initialVNode)) { 8124 instance.ctx.renderer = internals; 8125 } 8126 { 8127 { 8128 startMeasure(instance, `init`); 8129 } 8130 setupComponent(instance, false, optimized); 8131 { 8132 endMeasure(instance, `init`); 8133 } 8134 } 8135 if (isHmrUpdating) initialVNode.el = null; 8136 if (instance.asyncDep) { 8137 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); 8138 if (!initialVNode.el) { 8139 const placeholder = instance.subTree = createVNode(Comment); 8140 processCommentNode(null, placeholder, container, anchor); 8141 initialVNode.placeholder = placeholder.el; 8142 } 8143 } else { 8144 setupRenderEffect( 8145 instance, 8146 initialVNode, 8147 container, 8148 anchor, 8149 parentSuspense, 8150 namespace, 8151 optimized 8152 ); 8153 } 8154 { 8155 popWarningContext(); 8156 endMeasure(instance, `mount`); 8157 } 8158 }; 8159 const updateComponent = (n1, n2, optimized) => { 8160 const instance = n2.component = n1.component; 8161 if (shouldUpdateComponent(n1, n2, optimized)) { 8162 if (instance.asyncDep && !instance.asyncResolved) { 8163 { 8164 pushWarningContext(n2); 8165 } 8166 updateComponentPreRender(instance, n2, optimized); 8167 { 8168 popWarningContext(); 8169 } 8170 return; 8171 } else { 8172 instance.next = n2; 8173 instance.update(); 8174 } 8175 } else { 8176 n2.el = n1.el; 8177 instance.vnode = n2; 8178 } 8179 }; 8180 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => { 8181 const componentUpdateFn = () => { 8182 if (!instance.isMounted) { 8183 let vnodeHook; 8184 const { el, props } = initialVNode; 8185 const { bm, m, parent, root, type } = instance; 8186 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 8187 toggleRecurse(instance, false); 8188 if (bm) { 8189 invokeArrayFns(bm); 8190 } 8191 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 8192 invokeVNodeHook(vnodeHook, parent, initialVNode); 8193 } 8194 toggleRecurse(instance, true); 8195 if (el && hydrateNode) { 8196 const hydrateSubTree = () => { 8197 { 8198 startMeasure(instance, `render`); 8199 } 8200 instance.subTree = renderComponentRoot(instance); 8201 { 8202 endMeasure(instance, `render`); 8203 } 8204 { 8205 startMeasure(instance, `hydrate`); 8206 } 8207 hydrateNode( 8208 el, 8209 instance.subTree, 8210 instance, 8211 parentSuspense, 8212 null 8213 ); 8214 { 8215 endMeasure(instance, `hydrate`); 8216 } 8217 }; 8218 if (isAsyncWrapperVNode && type.__asyncHydrate) { 8219 type.__asyncHydrate( 8220 el, 8221 instance, 8222 hydrateSubTree 8223 ); 8224 } else { 8225 hydrateSubTree(); 8226 } 8227 } else { 8228 if (root.ce && // @ts-expect-error _def is private 8229 root.ce._def.shadowRoot !== false) { 8230 root.ce._injectChildStyle(type); 8231 } 8232 { 8233 startMeasure(instance, `render`); 8234 } 8235 const subTree = instance.subTree = renderComponentRoot(instance); 8236 { 8237 endMeasure(instance, `render`); 8238 } 8239 { 8240 startMeasure(instance, `patch`); 8241 } 8242 patch( 8243 null, 8244 subTree, 8245 container, 8246 anchor, 8247 instance, 8248 parentSuspense, 8249 namespace 8250 ); 8251 { 8252 endMeasure(instance, `patch`); 8253 } 8254 initialVNode.el = subTree.el; 8255 } 8256 if (m) { 8257 queuePostRenderEffect(m, parentSuspense); 8258 } 8259 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 8260 const scopedInitialVNode = initialVNode; 8261 queuePostRenderEffect( 8262 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 8263 parentSuspense 8264 ); 8265 } 8266 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 8267 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 8268 } 8269 instance.isMounted = true; 8270 { 8271 devtoolsComponentAdded(instance); 8272 } 8273 initialVNode = container = anchor = null; 8274 } else { 8275 let { next, bu, u, parent, vnode } = instance; 8276 { 8277 const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance); 8278 if (nonHydratedAsyncRoot) { 8279 if (next) { 8280 next.el = vnode.el; 8281 updateComponentPreRender(instance, next, optimized); 8282 } 8283 nonHydratedAsyncRoot.asyncDep.then(() => { 8284 if (!instance.isUnmounted) { 8285 componentUpdateFn(); 8286 } 8287 }); 8288 return; 8289 } 8290 } 8291 let originNext = next; 8292 let vnodeHook; 8293 { 8294 pushWarningContext(next || instance.vnode); 8295 } 8296 toggleRecurse(instance, false); 8297 if (next) { 8298 next.el = vnode.el; 8299 updateComponentPreRender(instance, next, optimized); 8300 } else { 8301 next = vnode; 8302 } 8303 if (bu) { 8304 invokeArrayFns(bu); 8305 } 8306 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 8307 invokeVNodeHook(vnodeHook, parent, next, vnode); 8308 } 8309 toggleRecurse(instance, true); 8310 { 8311 startMeasure(instance, `render`); 8312 } 8313 const nextTree = renderComponentRoot(instance); 8314 { 8315 endMeasure(instance, `render`); 8316 } 8317 const prevTree = instance.subTree; 8318 instance.subTree = nextTree; 8319 { 8320 startMeasure(instance, `patch`); 8321 } 8322 patch( 8323 prevTree, 8324 nextTree, 8325 // parent may have changed if it's in a teleport 8326 hostParentNode(prevTree.el), 8327 // anchor may have changed if it's in a fragment 8328 getNextHostNode(prevTree), 8329 instance, 8330 parentSuspense, 8331 namespace 8332 ); 8333 { 8334 endMeasure(instance, `patch`); 8335 } 8336 next.el = nextTree.el; 8337 if (originNext === null) { 8338 updateHOCHostEl(instance, nextTree.el); 8339 } 8340 if (u) { 8341 queuePostRenderEffect(u, parentSuspense); 8342 } 8343 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 8344 queuePostRenderEffect( 8345 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 8346 parentSuspense 8347 ); 8348 } 8349 { 8350 devtoolsComponentUpdated(instance); 8351 } 8352 { 8353 popWarningContext(); 8354 } 8355 } 8356 }; 8357 instance.scope.on(); 8358 const effect = instance.effect = new ReactiveEffect(componentUpdateFn); 8359 instance.scope.off(); 8360 const update = instance.update = effect.run.bind(effect); 8361 const job = instance.job = effect.runIfDirty.bind(effect); 8362 job.i = instance; 8363 job.id = instance.uid; 8364 effect.scheduler = () => queueJob(job); 8365 toggleRecurse(instance, true); 8366 { 8367 effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0; 8368 effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0; 8369 } 8370 update(); 8371 }; 8372 const updateComponentPreRender = (instance, nextVNode, optimized) => { 8373 nextVNode.component = instance; 8374 const prevProps = instance.vnode.props; 8375 instance.vnode = nextVNode; 8376 instance.next = null; 8377 updateProps(instance, nextVNode.props, prevProps, optimized); 8378 updateSlots(instance, nextVNode.children, optimized); 8379 pauseTracking(); 8380 flushPreFlushCbs(instance); 8381 resetTracking(); 8382 }; 8383 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => { 8384 const c1 = n1 && n1.children; 8385 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 8386 const c2 = n2.children; 8387 const { patchFlag, shapeFlag } = n2; 8388 if (patchFlag > 0) { 8389 if (patchFlag & 128) { 8390 patchKeyedChildren( 8391 c1, 8392 c2, 8393 container, 8394 anchor, 8395 parentComponent, 8396 parentSuspense, 8397 namespace, 8398 slotScopeIds, 8399 optimized 8400 ); 8401 return; 8402 } else if (patchFlag & 256) { 8403 patchUnkeyedChildren( 8404 c1, 8405 c2, 8406 container, 8407 anchor, 8408 parentComponent, 8409 parentSuspense, 8410 namespace, 8411 slotScopeIds, 8412 optimized 8413 ); 8414 return; 8415 } 8416 } 8417 if (shapeFlag & 8) { 8418 if (prevShapeFlag & 16) { 8419 unmountChildren(c1, parentComponent, parentSuspense); 8420 } 8421 if (c2 !== c1) { 8422 hostSetElementText(container, c2); 8423 } 8424 } else { 8425 if (prevShapeFlag & 16) { 8426 if (shapeFlag & 16) { 8427 patchKeyedChildren( 8428 c1, 8429 c2, 8430 container, 8431 anchor, 8432 parentComponent, 8433 parentSuspense, 8434 namespace, 8435 slotScopeIds, 8436 optimized 8437 ); 8438 } else { 8439 unmountChildren(c1, parentComponent, parentSuspense, true); 8440 } 8441 } else { 8442 if (prevShapeFlag & 8) { 8443 hostSetElementText(container, ""); 8444 } 8445 if (shapeFlag & 16) { 8446 mountChildren( 8447 c2, 8448 container, 8449 anchor, 8450 parentComponent, 8451 parentSuspense, 8452 namespace, 8453 slotScopeIds, 8454 optimized 8455 ); 8456 } 8457 } 8458 } 8459 }; 8460 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8461 c1 = c1 || EMPTY_ARR; 8462 c2 = c2 || EMPTY_ARR; 8463 const oldLength = c1.length; 8464 const newLength = c2.length; 8465 const commonLength = Math.min(oldLength, newLength); 8466 let i; 8467 for (i = 0; i < commonLength; i++) { 8468 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8469 patch( 8470 c1[i], 8471 nextChild, 8472 container, 8473 null, 8474 parentComponent, 8475 parentSuspense, 8476 namespace, 8477 slotScopeIds, 8478 optimized 8479 ); 8480 } 8481 if (oldLength > newLength) { 8482 unmountChildren( 8483 c1, 8484 parentComponent, 8485 parentSuspense, 8486 true, 8487 false, 8488 commonLength 8489 ); 8490 } else { 8491 mountChildren( 8492 c2, 8493 container, 8494 anchor, 8495 parentComponent, 8496 parentSuspense, 8497 namespace, 8498 slotScopeIds, 8499 optimized, 8500 commonLength 8501 ); 8502 } 8503 }; 8504 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => { 8505 let i = 0; 8506 const l2 = c2.length; 8507 let e1 = c1.length - 1; 8508 let e2 = l2 - 1; 8509 while (i <= e1 && i <= e2) { 8510 const n1 = c1[i]; 8511 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8512 if (isSameVNodeType(n1, n2)) { 8513 patch( 8514 n1, 8515 n2, 8516 container, 8517 null, 8518 parentComponent, 8519 parentSuspense, 8520 namespace, 8521 slotScopeIds, 8522 optimized 8523 ); 8524 } else { 8525 break; 8526 } 8527 i++; 8528 } 8529 while (i <= e1 && i <= e2) { 8530 const n1 = c1[e1]; 8531 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 8532 if (isSameVNodeType(n1, n2)) { 8533 patch( 8534 n1, 8535 n2, 8536 container, 8537 null, 8538 parentComponent, 8539 parentSuspense, 8540 namespace, 8541 slotScopeIds, 8542 optimized 8543 ); 8544 } else { 8545 break; 8546 } 8547 e1--; 8548 e2--; 8549 } 8550 if (i > e1) { 8551 if (i <= e2) { 8552 const nextPos = e2 + 1; 8553 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 8554 while (i <= e2) { 8555 patch( 8556 null, 8557 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 8558 container, 8559 anchor, 8560 parentComponent, 8561 parentSuspense, 8562 namespace, 8563 slotScopeIds, 8564 optimized 8565 ); 8566 i++; 8567
vendor: 11,000 bytes, lines 8567-8815
8567 } 8568 } 8569 } else if (i > e2) { 8570 while (i <= e1) { 8571 unmount(c1[i], parentComponent, parentSuspense, true); 8572 i++; 8573 } 8574 } else { 8575 const s1 = i; 8576 const s2 = i; 8577 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 8578 for (i = s2; i <= e2; i++) { 8579 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 8580 if (nextChild.key != null) { 8581 if (keyToNewIndexMap.has(nextChild.key)) { 8582 warn$1( 8583 `Duplicate keys found during update:`, 8584 JSON.stringify(nextChild.key), 8585 `Make sure keys are unique.` 8586 ); 8587 } 8588 keyToNewIndexMap.set(nextChild.key, i); 8589 } 8590 } 8591 let j; 8592 let patched = 0; 8593 const toBePatched = e2 - s2 + 1; 8594 let moved = false; 8595 let maxNewIndexSoFar = 0; 8596 const newIndexToOldIndexMap = new Array(toBePatched); 8597 for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0; 8598 for (i = s1; i <= e1; i++) { 8599 const prevChild = c1[i]; 8600 if (patched >= toBePatched) { 8601 unmount(prevChild, parentComponent, parentSuspense, true); 8602 continue; 8603 } 8604 let newIndex; 8605 if (prevChild.key != null) { 8606 newIndex = keyToNewIndexMap.get(prevChild.key); 8607 } else { 8608 for (j = s2; j <= e2; j++) { 8609 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 8610 newIndex = j; 8611 break; 8612 } 8613 } 8614 } 8615 if (newIndex === void 0) { 8616 unmount(prevChild, parentComponent, parentSuspense, true); 8617 } else { 8618 newIndexToOldIndexMap[newIndex - s2] = i + 1; 8619 if (newIndex >= maxNewIndexSoFar) { 8620 maxNewIndexSoFar = newIndex; 8621 } else { 8622 moved = true; 8623 } 8624 patch( 8625 prevChild, 8626 c2[newIndex], 8627 container, 8628 null, 8629 parentComponent, 8630 parentSuspense, 8631 namespace, 8632 slotScopeIds, 8633 optimized 8634 ); 8635 patched++; 8636 } 8637 } 8638 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 8639 j = increasingNewIndexSequence.length - 1; 8640 for (i = toBePatched - 1; i >= 0; i--) { 8641 const nextIndex = s2 + i; 8642 const nextChild = c2[nextIndex]; 8643 const anchorVNode = c2[nextIndex + 1]; 8644 const anchor = nextIndex + 1 < l2 ? ( 8645 // #13559, fallback to el placeholder for unresolved async component 8646 anchorVNode.el || anchorVNode.placeholder 8647 ) : parentAnchor; 8648 if (newIndexToOldIndexMap[i] === 0) { 8649 patch( 8650 null, 8651 nextChild, 8652 container, 8653 anchor, 8654 parentComponent, 8655 parentSuspense, 8656 namespace, 8657 slotScopeIds, 8658 optimized 8659 ); 8660 } else if (moved) { 8661 if (j < 0 || i !== increasingNewIndexSequence[j]) { 8662 move(nextChild, container, anchor, 2); 8663 } else { 8664 j--; 8665 } 8666 } 8667 } 8668 } 8669 }; 8670 const move = (vnode, container, anchor, moveType, parentSuspense = null) => { 8671 const { el, type, transition, children, shapeFlag } = vnode; 8672 if (shapeFlag & 6) { 8673 move(vnode.component.subTree, container, anchor, moveType); 8674 return; 8675 } 8676 if (shapeFlag & 128) { 8677 vnode.suspense.move(container, anchor, moveType); 8678 return; 8679 } 8680 if (shapeFlag & 64) { 8681 type.move(vnode, container, anchor, internals); 8682 return; 8683 } 8684 if (type === Fragment) { 8685 hostInsert(el, container, anchor); 8686 for (let i = 0; i < children.length; i++) { 8687 move(children[i], container, anchor, moveType); 8688 } 8689 hostInsert(vnode.anchor, container, anchor); 8690 return; 8691 } 8692 if (type === Static) { 8693 moveStaticNode(vnode, container, anchor); 8694 return; 8695 } 8696 const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; 8697 if (needTransition2) { 8698 if (moveType === 0) { 8699 transition.beforeEnter(el); 8700 hostInsert(el, container, anchor); 8701 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 8702 } else { 8703 const { leave, delayLeave, afterLeave } = transition; 8704 const remove2 = () => { 8705 if (vnode.ctx.isUnmounted) { 8706 hostRemove(el); 8707 } else { 8708 hostInsert(el, container, anchor); 8709 } 8710 }; 8711 const performLeave = () => { 8712 if (el._isLeaving) { 8713 el[leaveCbKey]( 8714 true 8715 /* cancelled */ 8716 ); 8717 } 8718 leave(el, () => { 8719 remove2(); 8720 afterLeave && afterLeave(); 8721 }); 8722 }; 8723 if (delayLeave) { 8724 delayLeave(el, remove2, performLeave); 8725 } else { 8726 performLeave(); 8727 } 8728 } 8729 } else { 8730 hostInsert(el, container, anchor); 8731 } 8732 }; 8733 const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 8734 const { 8735 type, 8736 props, 8737 ref, 8738 children, 8739 dynamicChildren, 8740 shapeFlag, 8741 patchFlag, 8742 dirs, 8743 cacheIndex 8744 } = vnode; 8745 if (patchFlag === -2) { 8746 optimized = false; 8747 } 8748 if (ref != null) { 8749 pauseTracking(); 8750 setRef(ref, null, parentSuspense, vnode, true); 8751 resetTracking(); 8752 } 8753 if (cacheIndex != null) { 8754 parentComponent.renderCache[cacheIndex] = void 0; 8755 } 8756 if (shapeFlag & 256) { 8757 parentComponent.ctx.deactivate(vnode); 8758 return; 8759 } 8760 const shouldInvokeDirs = shapeFlag & 1 && dirs; 8761 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 8762 let vnodeHook; 8763 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 8764 invokeVNodeHook(vnodeHook, parentComponent, vnode); 8765 } 8766 if (shapeFlag & 6) { 8767 unmountComponent(vnode.component, parentSuspense, doRemove); 8768 } else { 8769 if (shapeFlag & 128) { 8770 vnode.suspense.unmount(parentSuspense, doRemove); 8771 return; 8772 } 8773 if (shouldInvokeDirs) { 8774 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 8775 } 8776 if (shapeFlag & 64) { 8777 vnode.type.remove( 8778 vnode, 8779 parentComponent, 8780 parentSuspense, 8781 internals, 8782 doRemove 8783 ); 8784 } else if (dynamicChildren && // #5154 8785 // when v-once is used inside a block, setBlockTracking(-1) marks the 8786 // parent block with hasOnce: true 8787 // so that it doesn't take the fast path during unmount - otherwise 8788 // components nested in v-once are never unmounted. 8789 !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments 8790 (type !== Fragment || patchFlag > 0 && patchFlag & 64)) { 8791 unmountChildren( 8792 dynamicChildren, 8793 parentComponent, 8794 parentSuspense, 8795 false, 8796 true 8797 ); 8798 } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 8799 unmountChildren(children, parentComponent, parentSuspense); 8800 } 8801 if (doRemove) { 8802 remove(vnode); 8803 } 8804 } 8805 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 8806 queuePostRenderEffect(() => { 8807 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 8808 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 8809 }, parentSuspense); 8810 } 8811 }; 8812 const remove = (vnode) => { 8813 const { type, el, anchor, transition } = vnode; 8814 if (type === Fragment) { 8815 if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
vendor: 8,080 bytes, lines 8816-9042
8816 vnode.children.forEach((child) => { 8817 if (child.type === Comment) { 8818 hostRemove(child.el); 8819 } else { 8820 remove(child); 8821 } 8822 }); 8823 } else { 8824 removeFragment(el, anchor); 8825 } 8826 return; 8827 } 8828 if (type === Static) { 8829 removeStaticNode(vnode); 8830 return; 8831 } 8832 const performRemove = () => { 8833 hostRemove(el); 8834 if (transition && !transition.persisted && transition.afterLeave) { 8835 transition.afterLeave(); 8836 } 8837 }; 8838 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 8839 const { leave, delayLeave } = transition; 8840 const performLeave = () => leave(el, performRemove); 8841 if (delayLeave) { 8842 delayLeave(vnode.el, performRemove, performLeave); 8843 } else { 8844 performLeave(); 8845 } 8846 } else { 8847 performRemove(); 8848 } 8849 }; 8850 const removeFragment = (cur, end) => { 8851 let next; 8852 while (cur !== end) { 8853 next = hostNextSibling(cur); 8854 hostRemove(cur); 8855 cur = next; 8856 } 8857 hostRemove(end); 8858 }; 8859 const unmountComponent = (instance, parentSuspense, doRemove) => { 8860 if (instance.type.__hmrId) { 8861 unregisterHMR(instance); 8862 } 8863 const { bum, scope, job, subTree, um, m, a } = instance; 8864 invalidateMount(m); 8865 invalidateMount(a); 8866 if (bum) { 8867 invokeArrayFns(bum); 8868 } 8869 scope.stop(); 8870 if (job) { 8871 job.flags |= 8; 8872 unmount(subTree, instance, parentSuspense, doRemove); 8873 } 8874 if (um) { 8875 queuePostRenderEffect(um, parentSuspense); 8876 } 8877 queuePostRenderEffect(() => { 8878 instance.isUnmounted = true; 8879 }, parentSuspense); 8880 { 8881 devtoolsComponentRemoved(instance); 8882 } 8883 }; 8884 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 8885 for (let i = start; i < children.length; i++) { 8886 unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); 8887 } 8888 }; 8889 const getNextHostNode = (vnode) => { 8890 if (vnode.shapeFlag & 6) { 8891 return getNextHostNode(vnode.component.subTree); 8892 } 8893 if (vnode.shapeFlag & 128) { 8894 return vnode.suspense.next(); 8895 } 8896 const el = hostNextSibling(vnode.anchor || vnode.el); 8897 const teleportEnd = el && el[TeleportEndKey]; 8898 return teleportEnd ? hostNextSibling(teleportEnd) : el; 8899 }; 8900 let isFlushing = false; 8901 const render = (vnode, container, namespace) => { 8902 if (vnode == null) { 8903 if (container._vnode) { 8904 unmount(container._vnode, null, null, true); 8905 } 8906 } else { 8907 patch( 8908 container._vnode || null, 8909 vnode, 8910 container, 8911 null, 8912 null, 8913 null, 8914 namespace 8915 ); 8916 } 8917 container._vnode = vnode; 8918 if (!isFlushing) { 8919 isFlushing = true; 8920 flushPreFlushCbs(); 8921 flushPostFlushCbs(); 8922 isFlushing = false; 8923 } 8924 }; 8925 const internals = { 8926 p: patch, 8927 um: unmount, 8928 m: move, 8929 r: remove, 8930 mt: mountComponent, 8931 mc: mountChildren, 8932 pc: patchChildren, 8933 pbc: patchBlockChildren, 8934 n: getNextHostNode, 8935 o: options 8936 }; 8937 let hydrate; 8938 let hydrateNode; 8939 if (createHydrationFns) { 8940 [hydrate, hydrateNode] = createHydrationFns( 8941 internals 8942 ); 8943 } 8944 return { 8945 render, 8946 hydrate, 8947 createApp: createAppAPI(render, hydrate) 8948 }; 8949 } 8950 function resolveChildrenNamespace({ type, props }, currentNamespace) { 8951 return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace; 8952 } 8953 function toggleRecurse({ effect, job }, allowed) { 8954 if (allowed) { 8955 effect.flags |= 32; 8956 job.flags |= 4; 8957 } else { 8958 effect.flags &= -33; 8959 job.flags &= -5; 8960 } 8961 } 8962 function needTransition(parentSuspense, transition) { 8963 return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 8964 } 8965 function traverseStaticChildren(n1, n2, shallow = false) { 8966 const ch1 = n1.children; 8967 const ch2 = n2.children; 8968 if (isArray(ch1) && isArray(ch2)) { 8969 for (let i = 0; i < ch1.length; i++) { 8970 const c1 = ch1[i]; 8971 let c2 = ch2[i]; 8972 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 8973 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 8974 c2 = ch2[i] = cloneIfMounted(ch2[i]); 8975 c2.el = c1.el; 8976 } 8977 if (!shallow && c2.patchFlag !== -2) 8978 traverseStaticChildren(c1, c2); 8979 } 8980 if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes 8981 c2.patchFlag !== -1) { 8982 c2.el = c1.el; 8983 } 8984 if (c2.type === Comment && !c2.el) { 8985 c2.el = c1.el; 8986 } 8987 { 8988 c2.el && (c2.el.__vnode = c2); 8989 } 8990 } 8991 } 8992 } 8993 function getSequence(arr) { 8994 const p = arr.slice(); 8995 const result = [0]; 8996 let i, j, u, v, c; 8997 const len = arr.length; 8998 for (i = 0; i < len; i++) { 8999 const arrI = arr[i]; 9000 if (arrI !== 0) { 9001 j = result[result.length - 1]; 9002 if (arr[j] < arrI) { 9003 p[i] = j; 9004 result.push(i); 9005 continue; 9006 } 9007 u = 0; 9008 v = result.length - 1; 9009 while (u < v) { 9010 c = u + v >> 1; 9011 if (arr[result[c]] < arrI) { 9012 u = c + 1; 9013 } else { 9014 v = c; 9015 } 9016 } 9017 if (arrI < arr[result[u]]) { 9018 if (u > 0) { 9019 p[i] = result[u - 1]; 9020 } 9021 result[u] = i; 9022 } 9023 } 9024 } 9025 u = result.length; 9026 v = result[u - 1]; 9027 while (u-- > 0) { 9028 result[u] = v; 9029 v = p[v]; 9030 } 9031 return result; 9032 } 9033 function locateNonHydratedAsyncRoot(instance) { 9034 const subComponent = instance.subTree.component; 9035 if (subComponent) { 9036 if (subComponent.asyncDep && !subComponent.asyncResolved) { 9037 return subComponent; 9038 } else { 9039 return locateNonHydratedAsyncRoot(subComponent); 9040 } 9041 } 9042 }
vendor: 3,457 bytes, lines 9043-9143
9043 function invalidateMount(hooks) { 9044 if (hooks) { 9045 for (let i = 0; i < hooks.length; i++) 9046 hooks[i].flags |= 8; 9047 } 9048 } 9049 9050 const isSuspense = (type) => type.__isSuspense; 9051 let suspenseId = 0; 9052 const SuspenseImpl = { 9053 name: "Suspense", 9054 // In order to make Suspense tree-shakable, we need to avoid importing it 9055 // directly in the renderer. The renderer checks for the __isSuspense flag 9056 // on a vnode's type and calls the `process` method, passing in renderer 9057 // internals. 9058 __isSuspense: true, 9059 process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9060 if (n1 == null) { 9061 mountSuspense( 9062 n2, 9063 container, 9064 anchor, 9065 parentComponent, 9066 parentSuspense, 9067 namespace, 9068 slotScopeIds, 9069 optimized, 9070 rendererInternals 9071 ); 9072 } else { 9073 if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { 9074 n2.suspense = n1.suspense; 9075 n2.suspense.vnode = n2; 9076 n2.el = n1.el; 9077 return; 9078 } 9079 patchSuspense( 9080 n1, 9081 n2, 9082 container, 9083 anchor, 9084 parentComponent, 9085 namespace, 9086 slotScopeIds, 9087 optimized, 9088 rendererInternals 9089 ); 9090 } 9091 }, 9092 hydrate: hydrateSuspense, 9093 normalize: normalizeSuspenseChildren 9094 }; 9095 const Suspense = SuspenseImpl; 9096 function triggerEvent(vnode, name) { 9097 const eventListener = vnode.props && vnode.props[name]; 9098 if (isFunction(eventListener)) { 9099 eventListener(); 9100 } 9101 } 9102 function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { 9103 const { 9104 p: patch, 9105 o: { createElement } 9106 } = rendererInternals; 9107 const hiddenContainer = createElement("div"); 9108 const suspense = vnode.suspense = createSuspenseBoundary( 9109 vnode, 9110 parentSuspense, 9111 parentComponent, 9112 container, 9113 hiddenContainer, 9114 anchor, 9115 namespace, 9116 slotScopeIds, 9117 optimized, 9118 rendererInternals 9119 ); 9120 patch( 9121 null, 9122 suspense.pendingBranch = vnode.ssContent, 9123 hiddenContainer, 9124 null, 9125 parentComponent, 9126 suspense, 9127 namespace, 9128 slotScopeIds 9129 ); 9130 if (suspense.deps > 0) { 9131 triggerEvent(vnode, "onPending"); 9132 triggerEvent(vnode, "onFallback"); 9133 patch( 9134 null, 9135 vnode.ssFallback, 9136 container, 9137 anchor, 9138 parentComponent, 9139 null, 9140 // fallback tree will not have suspense context 9141 namespace, 9142 slotScopeIds 9143 );
9144 setActiveBranch(suspense, vnode.ssFallback); 9145 } else { 9146 suspense.resolve(false, true); 9147 } 9148 } 9149 function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { 9150 const suspense = n2.suspense = n1.suspense; 9151 suspense.vnode = n2; 9152 n2.el = n1.el; 9153 const newBranch = n2.ssContent; 9154 const newFallback = n2.ssFallback; 9155 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 9156 if (pendingBranch) { 9157 suspense.pendingBranch = newBranch; 9158 if (isSameVNodeType(pendingBranch, newBranch)) { 9159 patch( 9160 pendingBranch, 9161 newBranch, 9162 suspense.hiddenContainer, 9163 null, 9164 parentComponent, 9165 suspense, 9166 namespace, 9167 slotScopeIds, 9168 optimized 9169 ); 9170 if (suspense.deps <= 0) { 9171 suspense.resolve(); 9172 } else if (isInFallback) { 9173 if (!isHydrating) { 9174 patch( 9175 activeBranch, 9176 newFallback, 9177 container, 9178 anchor, 9179 parentComponent, 9180 null, 9181 // fallback tree will not have suspense context 9182 namespace, 9183 slotScopeIds, 9184 optimized 9185 );
vendor: 1,642 bytes, lines 9186-9226
9186 setActiveBranch(suspense, newFallback); 9187 } 9188 } 9189 } else { 9190 suspense.pendingId = suspenseId++; 9191 if (isHydrating) { 9192 suspense.isHydrating = false; 9193 suspense.activeBranch = pendingBranch; 9194 } else { 9195 unmount(pendingBranch, parentComponent, suspense); 9196 } 9197 suspense.deps = 0; 9198 suspense.effects.length = 0; 9199 suspense.hiddenContainer = createElement("div"); 9200 if (isInFallback) { 9201 patch( 9202 null, 9203 newBranch, 9204 suspense.hiddenContainer, 9205 null, 9206 parentComponent, 9207 suspense, 9208 namespace, 9209 slotScopeIds, 9210 optimized 9211 ); 9212 if (suspense.deps <= 0) { 9213 suspense.resolve(); 9214 } else { 9215 patch( 9216 activeBranch, 9217 newFallback, 9218 container, 9219 anchor, 9220 parentComponent, 9221 null, 9222 // fallback tree will not have suspense context 9223 namespace, 9224 slotScopeIds, 9225 optimized 9226 );
9227 setActiveBranch(suspense, newFallback); 9228 } 9229 } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9230 patch( 9231 activeBranch, 9232 newBranch, 9233 container, 9234 anchor, 9235 parentComponent, 9236 suspense, 9237 namespace, 9238 slotScopeIds, 9239 optimized 9240 ); 9241 suspense.resolve(true); 9242 } else { 9243 patch( 9244 null, 9245 newBranch, 9246 suspense.hiddenContainer, 9247 null, 9248 parentComponent, 9249 suspense, 9250 namespace, 9251 slotScopeIds, 9252 optimized 9253 ); 9254 if (suspense.deps <= 0) { 9255 suspense.resolve(); 9256 } 9257 } 9258 } 9259 } else { 9260 if (activeBranch && isSameVNodeType(activeBranch, newBranch)) { 9261 patch( 9262 activeBranch, 9263 newBranch, 9264 container, 9265 anchor, 9266 parentComponent, 9267 suspense, 9268 namespace, 9269 slotScopeIds, 9270 optimized 9271 );
vendor: 33,403 bytes, lines 9272-10119
9272 setActiveBranch(suspense, newBranch); 9273 } else { 9274 triggerEvent(n2, "onPending"); 9275 suspense.pendingBranch = newBranch; 9276 if (newBranch.shapeFlag & 512) { 9277 suspense.pendingId = newBranch.component.suspenseId; 9278 } else { 9279 suspense.pendingId = suspenseId++; 9280 } 9281 patch( 9282 null, 9283 newBranch, 9284 suspense.hiddenContainer, 9285 null, 9286 parentComponent, 9287 suspense, 9288 namespace, 9289 slotScopeIds, 9290 optimized 9291 ); 9292 if (suspense.deps <= 0) { 9293 suspense.resolve(); 9294 } else { 9295 const { timeout, pendingId } = suspense; 9296 if (timeout > 0) { 9297 setTimeout(() => { 9298 if (suspense.pendingId === pendingId) { 9299 suspense.fallback(newFallback); 9300 } 9301 }, timeout); 9302 } else if (timeout === 0) { 9303 suspense.fallback(newFallback); 9304 } 9305 } 9306 } 9307 } 9308 } 9309 let hasWarned = false; 9310 function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 9311 if (!hasWarned) { 9312 hasWarned = true; 9313 console[console.info ? "info" : "log"]( 9314 `<Suspense> is an experimental feature and its API will likely change.` 9315 ); 9316 } 9317 const { 9318 p: patch, 9319 m: move, 9320 um: unmount, 9321 n: next, 9322 o: { parentNode, remove } 9323 } = rendererInternals; 9324 let parentSuspenseId; 9325 const isSuspensible = isVNodeSuspensible(vnode); 9326 if (isSuspensible) { 9327 if (parentSuspense && parentSuspense.pendingBranch) { 9328 parentSuspenseId = parentSuspense.pendingId; 9329 parentSuspense.deps++; 9330 } 9331 } 9332 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 9333 { 9334 assertNumber(timeout, `Suspense timeout`); 9335 } 9336 const initialAnchor = anchor; 9337 const suspense = { 9338 vnode, 9339 parent: parentSuspense, 9340 parentComponent, 9341 namespace, 9342 container, 9343 hiddenContainer, 9344 deps: 0, 9345 pendingId: suspenseId++, 9346 timeout: typeof timeout === "number" ? timeout : -1, 9347 activeBranch: null, 9348 pendingBranch: null, 9349 isInFallback: !isHydrating, 9350 isHydrating, 9351 isUnmounted: false, 9352 effects: [], 9353 resolve(resume = false, sync = false) { 9354 { 9355 if (!resume && !suspense.pendingBranch) { 9356 throw new Error( 9357 `suspense.resolve() is called without a pending branch.` 9358 ); 9359 } 9360 if (suspense.isUnmounted) { 9361 throw new Error( 9362 `suspense.resolve() is called on an already unmounted suspense boundary.` 9363 ); 9364 } 9365 } 9366 const { 9367 vnode: vnode2, 9368 activeBranch, 9369 pendingBranch, 9370 pendingId, 9371 effects, 9372 parentComponent: parentComponent2, 9373 container: container2, 9374 isInFallback 9375 } = suspense; 9376 let delayEnter = false; 9377 if (suspense.isHydrating) { 9378 suspense.isHydrating = false; 9379 } else if (!resume) { 9380 delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 9381 if (delayEnter) { 9382 activeBranch.transition.afterLeave = () => { 9383 if (pendingId === suspense.pendingId) { 9384 move( 9385 pendingBranch, 9386 container2, 9387 anchor === initialAnchor ? next(activeBranch) : anchor, 9388 0 9389 ); 9390 queuePostFlushCb(effects); 9391 if (isInFallback && vnode2.ssFallback) { 9392 vnode2.ssFallback.el = null; 9393 } 9394 } 9395 }; 9396 } 9397 if (activeBranch) { 9398 if (parentNode(activeBranch.el) === container2) { 9399 anchor = next(activeBranch); 9400 } 9401 unmount(activeBranch, parentComponent2, suspense, true); 9402 if (!delayEnter && isInFallback && vnode2.ssFallback) { 9403 queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense); 9404 } 9405 } 9406 if (!delayEnter) { 9407 move(pendingBranch, container2, anchor, 0); 9408 } 9409 } 9410 setActiveBranch(suspense, pendingBranch); 9411 suspense.pendingBranch = null; 9412 suspense.isInFallback = false; 9413 let parent = suspense.parent; 9414 let hasUnresolvedAncestor = false; 9415 while (parent) { 9416 if (parent.pendingBranch) { 9417 parent.effects.push(...effects); 9418 hasUnresolvedAncestor = true; 9419 break; 9420 } 9421 parent = parent.parent; 9422 } 9423 if (!hasUnresolvedAncestor && !delayEnter) { 9424 queuePostFlushCb(effects); 9425 } 9426 suspense.effects = []; 9427 if (isSuspensible) { 9428 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 9429 parentSuspense.deps--; 9430 if (parentSuspense.deps === 0 && !sync) { 9431 parentSuspense.resolve(); 9432 } 9433 } 9434 } 9435 triggerEvent(vnode2, "onResolve"); 9436 }, 9437 fallback(fallbackVNode) { 9438 if (!suspense.pendingBranch) { 9439 return; 9440 } 9441 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; 9442 triggerEvent(vnode2, "onFallback"); 9443 const anchor2 = next(activeBranch); 9444 const mountFallback = () => { 9445 if (!suspense.isInFallback) { 9446 return; 9447 } 9448 patch( 9449 null, 9450 fallbackVNode, 9451 container2, 9452 anchor2, 9453 parentComponent2, 9454 null, 9455 // fallback tree will not have suspense context 9456 namespace2, 9457 slotScopeIds, 9458 optimized 9459 ); 9460 setActiveBranch(suspense, fallbackVNode); 9461 }; 9462 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 9463 if (delayEnter) { 9464 activeBranch.transition.afterLeave = mountFallback; 9465 } 9466 suspense.isInFallback = true; 9467 unmount( 9468 activeBranch, 9469 parentComponent2, 9470 null, 9471 // no suspense so unmount hooks fire now 9472 true 9473 // shouldRemove 9474 ); 9475 if (!delayEnter) { 9476 mountFallback(); 9477 } 9478 }, 9479 move(container2, anchor2, type) { 9480 suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); 9481 suspense.container = container2; 9482 }, 9483 next() { 9484 return suspense.activeBranch && next(suspense.activeBranch); 9485 }, 9486 registerDep(instance, setupRenderEffect, optimized2) { 9487 const isInPendingSuspense = !!suspense.pendingBranch; 9488 if (isInPendingSuspense) { 9489 suspense.deps++; 9490 } 9491 const hydratedEl = instance.vnode.el; 9492 instance.asyncDep.catch((err) => { 9493 handleError(err, instance, 0); 9494 }).then((asyncSetupResult) => { 9495 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 9496 return; 9497 } 9498 instance.asyncResolved = true; 9499 const { vnode: vnode2 } = instance; 9500 { 9501 pushWarningContext(vnode2); 9502 } 9503 handleSetupResult(instance, asyncSetupResult, false); 9504 if (hydratedEl) { 9505 vnode2.el = hydratedEl; 9506 } 9507 const placeholder = !hydratedEl && instance.subTree.el; 9508 setupRenderEffect( 9509 instance, 9510 vnode2, 9511 // component may have been moved before resolve. 9512 // if this is not a hydration, instance.subTree will be the comment 9513 // placeholder. 9514 parentNode(hydratedEl || instance.subTree.el), 9515 // anchor will not be used if this is hydration, so only need to 9516 // consider the comment placeholder case. 9517 hydratedEl ? null : next(instance.subTree), 9518 suspense, 9519 namespace, 9520 optimized2 9521 ); 9522 if (placeholder) { 9523 vnode2.placeholder = null; 9524 remove(placeholder); 9525 } 9526 updateHOCHostEl(instance, vnode2.el); 9527 { 9528 popWarningContext(); 9529 } 9530 if (isInPendingSuspense && --suspense.deps === 0) { 9531 suspense.resolve(); 9532 } 9533 }); 9534 }, 9535 unmount(parentSuspense2, doRemove) { 9536 suspense.isUnmounted = true; 9537 if (suspense.activeBranch) { 9538 unmount( 9539 suspense.activeBranch, 9540 parentComponent, 9541 parentSuspense2, 9542 doRemove 9543 ); 9544 } 9545 if (suspense.pendingBranch) { 9546 unmount( 9547 suspense.pendingBranch, 9548 parentComponent, 9549 parentSuspense2, 9550 doRemove 9551 ); 9552 } 9553 } 9554 }; 9555 return suspense; 9556 } 9557 function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { 9558 const suspense = vnode.suspense = createSuspenseBoundary( 9559 vnode, 9560 parentSuspense, 9561 parentComponent, 9562 node.parentNode, 9563 // eslint-disable-next-line no-restricted-globals 9564 document.createElement("div"), 9565 null, 9566 namespace, 9567 slotScopeIds, 9568 optimized, 9569 rendererInternals, 9570 true 9571 ); 9572 const result = hydrateNode( 9573 node, 9574 suspense.pendingBranch = vnode.ssContent, 9575 parentComponent, 9576 suspense, 9577 slotScopeIds, 9578 optimized 9579 ); 9580 if (suspense.deps === 0) { 9581 suspense.resolve(false, true); 9582 } 9583 return result; 9584 } 9585 function normalizeSuspenseChildren(vnode) { 9586 const { shapeFlag, children } = vnode; 9587 const isSlotChildren = shapeFlag & 32; 9588 vnode.ssContent = normalizeSuspenseSlot( 9589 isSlotChildren ? children.default : children 9590 ); 9591 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 9592 } 9593 function normalizeSuspenseSlot(s) { 9594 let block; 9595 if (isFunction(s)) { 9596 const trackBlock = isBlockTreeEnabled && s._c; 9597 if (trackBlock) { 9598 s._d = false; 9599 openBlock(); 9600 } 9601 s = s(); 9602 if (trackBlock) { 9603 s._d = true; 9604 block = currentBlock; 9605 closeBlock(); 9606 } 9607 } 9608 if (isArray(s)) { 9609 const singleChild = filterSingleRoot(s); 9610 if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) { 9611 warn$1(`<Suspense> slots expect a single root node.`); 9612 } 9613 s = singleChild; 9614 } 9615 s = normalizeVNode(s); 9616 if (block && !s.dynamicChildren) { 9617 s.dynamicChildren = block.filter((c) => c !== s); 9618 } 9619 return s; 9620 } 9621 function queueEffectWithSuspense(fn, suspense) { 9622 if (suspense && suspense.pendingBranch) { 9623 if (isArray(fn)) { 9624 suspense.effects.push(...fn); 9625 } else { 9626 suspense.effects.push(fn); 9627 } 9628 } else { 9629 queuePostFlushCb(fn); 9630 } 9631 } 9632 function setActiveBranch(suspense, branch) { 9633 suspense.activeBranch = branch; 9634 const { vnode, parentComponent } = suspense; 9635 let el = branch.el; 9636 while (!el && branch.component) { 9637 branch = branch.component.subTree; 9638 el = branch.el; 9639 } 9640 vnode.el = el; 9641 if (parentComponent && parentComponent.subTree === vnode) { 9642 parentComponent.vnode.el = el; 9643 updateHOCHostEl(parentComponent, el); 9644 } 9645 } 9646 function isVNodeSuspensible(vnode) { 9647 const suspensible = vnode.props && vnode.props.suspensible; 9648 return suspensible != null && suspensible !== false; 9649 } 9650 9651 const Fragment = Symbol.for("v-fgt"); 9652 const Text = Symbol.for("v-txt"); 9653 const Comment = Symbol.for("v-cmt"); 9654 const Static = Symbol.for("v-stc"); 9655 const blockStack = []; 9656 let currentBlock = null; 9657 function openBlock(disableTracking = false) { 9658 blockStack.push(currentBlock = disableTracking ? null : []); 9659 } 9660 function closeBlock() { 9661 blockStack.pop(); 9662 currentBlock = blockStack[blockStack.length - 1] || null; 9663 } 9664 let isBlockTreeEnabled = 1; 9665 function setBlockTracking(value, inVOnce = false) { 9666 isBlockTreeEnabled += value; 9667 if (value < 0 && currentBlock && inVOnce) { 9668 currentBlock.hasOnce = true; 9669 } 9670 } 9671 function setupBlock(vnode) { 9672 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 9673 closeBlock(); 9674 if (isBlockTreeEnabled > 0 && currentBlock) { 9675 currentBlock.push(vnode); 9676 } 9677 return vnode; 9678 } 9679 function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { 9680 return setupBlock( 9681 createBaseVNode( 9682 type, 9683 props, 9684 children, 9685 patchFlag, 9686 dynamicProps, 9687 shapeFlag, 9688 true 9689 ) 9690 ); 9691 } 9692 function createBlock(type, props, children, patchFlag, dynamicProps) { 9693 return setupBlock( 9694 createVNode( 9695 type, 9696 props, 9697 children, 9698 patchFlag, 9699 dynamicProps, 9700 true 9701 ) 9702 ); 9703 } 9704 function isVNode(value) { 9705 return value ? value.__v_isVNode === true : false; 9706 } 9707 function isSameVNodeType(n1, n2) { 9708 if (n2.shapeFlag & 6 && n1.component) { 9709 const dirtyInstances = hmrDirtyComponents.get(n2.type); 9710 if (dirtyInstances && dirtyInstances.has(n1.component)) { 9711 n1.shapeFlag &= -257; 9712 n2.shapeFlag &= -513; 9713 return false; 9714 } 9715 } 9716 return n1.type === n2.type && n1.key === n2.key; 9717 } 9718 let vnodeArgsTransformer; 9719 function transformVNodeArgs(transformer) { 9720 vnodeArgsTransformer = transformer; 9721 } 9722 const createVNodeWithArgsTransform = (...args) => { 9723 return _createVNode( 9724 ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args 9725 ); 9726 }; 9727 const normalizeKey = ({ key }) => key != null ? key : null; 9728 const normalizeRef = ({ 9729 ref, 9730 ref_key, 9731 ref_for 9732 }) => { 9733 if (typeof ref === "number") { 9734 ref = "" + ref; 9735 } 9736 return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null; 9737 }; 9738 function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 9739 const vnode = { 9740 __v_isVNode: true, 9741 __v_skip: true, 9742 type, 9743 props, 9744 key: props && normalizeKey(props), 9745 ref: props && normalizeRef(props), 9746 scopeId: currentScopeId, 9747 slotScopeIds: null, 9748 children, 9749 component: null, 9750 suspense: null, 9751 ssContent: null, 9752 ssFallback: null, 9753 dirs: null, 9754 transition: null, 9755 el: null, 9756 anchor: null, 9757 target: null, 9758 targetStart: null, 9759 targetAnchor: null, 9760 staticCount: 0, 9761 shapeFlag, 9762 patchFlag, 9763 dynamicProps, 9764 dynamicChildren: null, 9765 appContext: null, 9766 ctx: currentRenderingInstance 9767 }; 9768 if (needFullChildrenNormalization) { 9769 normalizeChildren(vnode, children); 9770 if (shapeFlag & 128) { 9771 type.normalize(vnode); 9772 } 9773 } else if (children) { 9774 vnode.shapeFlag |= isString(children) ? 8 : 16; 9775 } 9776 if (vnode.key !== vnode.key) { 9777 warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type); 9778 } 9779 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 9780 !isBlockNode && // has current parent block 9781 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 9782 // component nodes also should always be patched, because even if the 9783 // component doesn't need to update, it needs to persist the instance on to 9784 // the next vnode so that it can be properly unmounted later. 9785 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 9786 // vnode should not be considered dynamic due to handler caching. 9787 vnode.patchFlag !== 32) { 9788 currentBlock.push(vnode); 9789 } 9790 return vnode; 9791 } 9792 const createVNode = createVNodeWithArgsTransform; 9793 function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 9794 if (!type || type === NULL_DYNAMIC_COMPONENT) { 9795 if (!type) { 9796 warn$1(`Invalid vnode type when creating vnode: ${type}.`); 9797 } 9798 type = Comment; 9799 } 9800 if (isVNode(type)) { 9801 const cloned = cloneVNode( 9802 type, 9803 props, 9804 true 9805 /* mergeRef: true */ 9806 ); 9807 if (children) { 9808 normalizeChildren(cloned, children); 9809 } 9810 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 9811 if (cloned.shapeFlag & 6) { 9812 currentBlock[currentBlock.indexOf(type)] = cloned; 9813 } else { 9814 currentBlock.push(cloned); 9815 } 9816 } 9817 cloned.patchFlag = -2; 9818 return cloned; 9819 } 9820 if (isClassComponent(type)) { 9821 type = type.__vccOpts; 9822 } 9823 if (props) { 9824 props = guardReactiveProps(props); 9825 let { class: klass, style } = props; 9826 if (klass && !isString(klass)) { 9827 props.class = normalizeClass(klass); 9828 } 9829 if (isObject(style)) { 9830 if (isProxy(style) && !isArray(style)) { 9831 style = extend({}, style); 9832 } 9833 props.style = normalizeStyle(style); 9834 } 9835 } 9836 const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; 9837 if (shapeFlag & 4 && isProxy(type)) { 9838 type = toRaw(type); 9839 warn$1( 9840 `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\`.`, 9841 ` 9842Component that was made reactive: `, 9843 type 9844 ); 9845 } 9846 return createBaseVNode( 9847 type, 9848 props, 9849 children, 9850 patchFlag, 9851 dynamicProps, 9852 shapeFlag, 9853 isBlockNode, 9854 true 9855 ); 9856 } 9857 function guardReactiveProps(props) { 9858 if (!props) return null; 9859 return isProxy(props) || isInternalObject(props) ? extend({}, props) : props; 9860 } 9861 function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) { 9862 const { props, ref, patchFlag, children, transition } = vnode; 9863 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 9864 const cloned = { 9865 __v_isVNode: true, 9866 __v_skip: true, 9867 type: vnode.type, 9868 props: mergedProps, 9869 key: mergedProps && normalizeKey(mergedProps), 9870 ref: extraProps && extraProps.ref ? ( 9871 // #2078 in the case of <component :is="vnode" ref="extra"/> 9872 // if the vnode itself already has a ref, cloneVNode will need to merge 9873 // the refs so the single vnode can be set on multiple refs 9874 mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) 9875 ) : ref, 9876 scopeId: vnode.scopeId, 9877 slotScopeIds: vnode.slotScopeIds, 9878 children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children, 9879 target: vnode.target, 9880 targetStart: vnode.targetStart, 9881 targetAnchor: vnode.targetAnchor, 9882 staticCount: vnode.staticCount, 9883 shapeFlag: vnode.shapeFlag, 9884 // if the vnode is cloned with extra props, we can no longer assume its 9885 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 9886 // note: preserve flag for fragments since they use the flag for children 9887 // fast paths only. 9888 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 9889 dynamicProps: vnode.dynamicProps, 9890 dynamicChildren: vnode.dynamicChildren, 9891 appContext: vnode.appContext, 9892 dirs: vnode.dirs, 9893 transition, 9894 // These should technically only be non-null on mounted VNodes. However, 9895 // they *should* be copied for kept-alive vnodes. So we just always copy 9896 // them since them being non-null during a mount doesn't affect the logic as 9897 // they will simply be overwritten. 9898 component: vnode.component, 9899 suspense: vnode.suspense, 9900 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 9901 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 9902 placeholder: vnode.placeholder, 9903 el: vnode.el, 9904 anchor: vnode.anchor, 9905 ctx: vnode.ctx, 9906 ce: vnode.ce 9907 }; 9908 if (transition && cloneTransition) { 9909 setTransitionHooks( 9910 cloned, 9911 transition.clone(cloned) 9912 ); 9913 } 9914 return cloned; 9915 } 9916 function deepCloneVNode(vnode) { 9917 const cloned = cloneVNode(vnode); 9918 if (isArray(vnode.children)) { 9919 cloned.children = vnode.children.map(deepCloneVNode); 9920 } 9921 return cloned; 9922 } 9923 function createTextVNode(text = " ", flag = 0) { 9924 return createVNode(Text, null, text, flag); 9925 } 9926 function createStaticVNode(content, numberOfNodes) { 9927 const vnode = createVNode(Static, null, content); 9928 vnode.staticCount = numberOfNodes; 9929 return vnode; 9930 } 9931 function createCommentVNode(text = "", asBlock = false) { 9932 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 9933 } 9934 function normalizeVNode(child) { 9935 if (child == null || typeof child === "boolean") { 9936 return createVNode(Comment); 9937 } else if (isArray(child)) { 9938 return createVNode( 9939 Fragment, 9940 null, 9941 // #3666, avoid reference pollution when reusing vnode 9942 child.slice() 9943 ); 9944 } else if (isVNode(child)) { 9945 return cloneIfMounted(child); 9946 } else { 9947 return createVNode(Text, null, String(child)); 9948 } 9949 } 9950 function cloneIfMounted(child) { 9951 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 9952 } 9953 function normalizeChildren(vnode, children) { 9954 let type = 0; 9955 const { shapeFlag } = vnode; 9956 if (children == null) { 9957 children = null; 9958 } else if (isArray(children)) { 9959 type = 16; 9960 } else if (typeof children === "object") { 9961 if (shapeFlag & (1 | 64)) { 9962 const slot = children.default; 9963 if (slot) { 9964 slot._c && (slot._d = false); 9965 normalizeChildren(vnode, slot()); 9966 slot._c && (slot._d = true); 9967 } 9968 return; 9969 } else { 9970 type = 32; 9971 const slotFlag = children._; 9972 if (!slotFlag && !isInternalObject(children)) { 9973 children._ctx = currentRenderingInstance; 9974 } else if (slotFlag === 3 && currentRenderingInstance) { 9975 if (currentRenderingInstance.slots._ === 1) { 9976 children._ = 1; 9977 } else { 9978 children._ = 2; 9979 vnode.patchFlag |= 1024; 9980 } 9981 } 9982 } 9983 } else if (isFunction(children)) { 9984 children = { default: children, _ctx: currentRenderingInstance }; 9985 type = 32; 9986 } else { 9987 children = String(children); 9988 if (shapeFlag & 64) { 9989 type = 16; 9990 children = [createTextVNode(children)]; 9991 } else { 9992 type = 8; 9993 } 9994 } 9995 vnode.children = children; 9996 vnode.shapeFlag |= type; 9997 } 9998 function mergeProps(...args) { 9999 const ret = {}; 10000 for (let i = 0; i < args.length; i++) { 10001 const toMerge = args[i]; 10002 for (const key in toMerge) { 10003 if (key === "class") { 10004 if (ret.class !== toMerge.class) { 10005 ret.class = normalizeClass([ret.class, toMerge.class]); 10006 } 10007 } else if (key === "style") { 10008 ret.style = normalizeStyle([ret.style, toMerge.style]); 10009 } else if (isOn(key)) { 10010 const existing = ret[key]; 10011 const incoming = toMerge[key]; 10012 if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) { 10013 ret[key] = existing ? [].concat(existing, incoming) : incoming; 10014 } 10015 } else if (key !== "") { 10016 ret[key] = toMerge[key]; 10017 } 10018 } 10019 } 10020 return ret; 10021 } 10022 function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 10023 callWithAsyncErrorHandling(hook, instance, 7, [ 10024 vnode, 10025 prevVNode 10026 ]); 10027 } 10028 10029 const emptyAppContext = createAppContext(); 10030 let uid = 0; 10031 function createComponentInstance(vnode, parent, suspense) { 10032 const type = vnode.type; 10033 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 10034 const instance = { 10035 uid: uid++, 10036 vnode, 10037 type, 10038 parent, 10039 appContext, 10040 root: null, 10041 // to be immediately set 10042 next: null, 10043 subTree: null, 10044 // will be set synchronously right after creation 10045 effect: null, 10046 update: null, 10047 // will be set synchronously right after creation 10048 job: null, 10049 scope: new EffectScope( 10050 true 10051 /* detached */ 10052 ), 10053 render: null, 10054 proxy: null, 10055 exposed: null, 10056 exposeProxy: null, 10057 withProxy: null, 10058 provides: parent ? parent.provides : Object.create(appContext.provides), 10059 ids: parent ? parent.ids : ["", 0, 0], 10060 accessCache: null, 10061 renderCache: [], 10062 // local resolved assets 10063 components: null, 10064 directives: null, 10065 // resolved props and emits options 10066 propsOptions: normalizePropsOptions(type, appContext), 10067 emitsOptions: normalizeEmitsOptions(type, appContext), 10068 // emit 10069 emit: null, 10070 // to be set immediately 10071 emitted: null, 10072 // props default value 10073 propsDefaults: EMPTY_OBJ, 10074 // inheritAttrs 10075 inheritAttrs: type.inheritAttrs, 10076 // state 10077 ctx: EMPTY_OBJ, 10078 data: EMPTY_OBJ, 10079 props: EMPTY_OBJ, 10080 attrs: EMPTY_OBJ, 10081 slots: EMPTY_OBJ, 10082 refs: EMPTY_OBJ, 10083 setupState: EMPTY_OBJ, 10084 setupContext: null, 10085 // suspense related 10086 suspense, 10087 suspenseId: suspense ? suspense.pendingId : 0, 10088 asyncDep: null, 10089 asyncResolved: false, 10090 // lifecycle hooks 10091 // not using enums here because it results in computed properties 10092 isMounted: false, 10093 isUnmounted: false, 10094 isDeactivated: false, 10095 bc: null, 10096 c: null, 10097 bm: null, 10098 m: null, 10099 bu: null, 10100 u: null, 10101 um: null, 10102 bum: null, 10103 da: null, 10104 a: null, 10105 rtg: null, 10106 rtc: null, 10107 ec: null, 10108 sp: null 10109 }; 10110 { 10111 instance.ctx = createDevRenderContext(instance); 10112 } 10113 instance.root = parent ? parent.root : instance; 10114 instance.emit = emit.bind(null, instance); 10115 if (vnode.ce) { 10116 vnode.ce(instance); 10117 } 10118 return instance; 10119 }
vendor: 6,036 bytes, lines 10120-10264
10120 let currentInstance = null; 10121 const getCurrentInstance = () => currentInstance || currentRenderingInstance; 10122 let internalSetCurrentInstance; 10123 let setInSSRSetupState; 10124 { 10125 internalSetCurrentInstance = (i) => { 10126 currentInstance = i; 10127 }; 10128 setInSSRSetupState = (v) => { 10129 isInSSRComponentSetup = v; 10130 }; 10131 } 10132 const setCurrentInstance = (instance) => { 10133 const prev = currentInstance; 10134 internalSetCurrentInstance(instance); 10135 instance.scope.on(); 10136 return () => { 10137 instance.scope.off(); 10138 internalSetCurrentInstance(prev); 10139 }; 10140 }; 10141 const unsetCurrentInstance = () => { 10142 currentInstance && currentInstance.scope.off(); 10143 internalSetCurrentInstance(null); 10144 }; 10145 const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component"); 10146 function validateComponentName(name, { isNativeTag }) { 10147 if (isBuiltInTag(name) || isNativeTag(name)) { 10148 warn$1( 10149 "Do not use built-in or reserved HTML elements as component id: " + name 10150 ); 10151 } 10152 } 10153 function isStatefulComponent(instance) { 10154 return instance.vnode.shapeFlag & 4; 10155 } 10156 let isInSSRComponentSetup = false; 10157 function setupComponent(instance, isSSR = false, optimized = false) { 10158 isSSR && setInSSRSetupState(isSSR); 10159 const { props, children } = instance.vnode; 10160 const isStateful = isStatefulComponent(instance); 10161 initProps(instance, props, isStateful, isSSR); 10162 initSlots(instance, children, optimized || isSSR); 10163 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 10164 isSSR && setInSSRSetupState(false); 10165 return setupResult; 10166 } 10167 function setupStatefulComponent(instance, isSSR) { 10168 const Component = instance.type; 10169 { 10170 if (Component.name) { 10171 validateComponentName(Component.name, instance.appContext.config); 10172 } 10173 if (Component.components) { 10174 const names = Object.keys(Component.components); 10175 for (let i = 0; i < names.length; i++) { 10176 validateComponentName(names[i], instance.appContext.config); 10177 } 10178 } 10179 if (Component.directives) { 10180 const names = Object.keys(Component.directives); 10181 for (let i = 0; i < names.length; i++) { 10182 validateDirectiveName(names[i]); 10183 } 10184 } 10185 if (Component.compilerOptions && isRuntimeOnly()) { 10186 warn$1( 10187 `"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.` 10188 ); 10189 } 10190 } 10191 instance.accessCache = /* @__PURE__ */ Object.create(null); 10192 instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers); 10193 { 10194 exposePropsOnRenderContext(instance); 10195 } 10196 const { setup } = Component; 10197 if (setup) { 10198 pauseTracking(); 10199 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 10200 const reset = setCurrentInstance(instance); 10201 const setupResult = callWithErrorHandling( 10202 setup, 10203 instance, 10204 0, 10205 [ 10206 shallowReadonly(instance.props), 10207 setupContext 10208 ] 10209 ); 10210 const isAsyncSetup = isPromise(setupResult); 10211 resetTracking(); 10212 reset(); 10213 if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) { 10214 markAsyncBoundary(instance); 10215 } 10216 if (isAsyncSetup) { 10217 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 10218 if (isSSR) { 10219 return setupResult.then((resolvedResult) => { 10220 handleSetupResult(instance, resolvedResult, isSSR); 10221 }).catch((e) => { 10222 handleError(e, instance, 0); 10223 }); 10224 } else { 10225 instance.asyncDep = setupResult; 10226 if (!instance.suspense) { 10227 const name = formatComponentName(instance, Component); 10228 warn$1( 10229 `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.` 10230 ); 10231 } 10232 } 10233 } else { 10234 handleSetupResult(instance, setupResult, isSSR); 10235 } 10236 } else { 10237 finishComponentSetup(instance, isSSR); 10238 } 10239 } 10240 function handleSetupResult(instance, setupResult, isSSR) { 10241 if (isFunction(setupResult)) { 10242 { 10243 instance.render = setupResult; 10244 } 10245 } else if (isObject(setupResult)) { 10246 if (isVNode(setupResult)) { 10247 warn$1( 10248 `setup() should not return VNodes directly - return a render function instead.` 10249 ); 10250 } 10251 { 10252 instance.devtoolsRawSetupState = setupResult; 10253 } 10254 instance.setupState = proxyRefs(setupResult); 10255 { 10256 exposeSetupStateOnRenderContext(instance); 10257 } 10258 } else if (setupResult !== void 0) { 10259 warn$1( 10260 `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}` 10261 ); 10262 } 10263 finishComponentSetup(instance, isSSR); 10264 }
vendor: 14,740 bytes, lines 10265-10658
10265 let compile$1; 10266 let installWithProxy; 10267 function registerRuntimeCompiler(_compile) { 10268 compile$1 = _compile; 10269 installWithProxy = (i) => { 10270 if (i.render._rc) { 10271 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 10272 } 10273 }; 10274 } 10275 const isRuntimeOnly = () => !compile$1; 10276 function finishComponentSetup(instance, isSSR, skipOptions) { 10277 const Component = instance.type; 10278 if (!instance.render) { 10279 if (!isSSR && compile$1 && !Component.render) { 10280 const template = Component.template || resolveMergedOptions(instance).template; 10281 if (template) { 10282 { 10283 startMeasure(instance, `compile`); 10284 } 10285 const { isCustomElement, compilerOptions } = instance.appContext.config; 10286 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 10287 const finalCompilerOptions = extend( 10288 extend( 10289 { 10290 isCustomElement, 10291 delimiters 10292 }, 10293 compilerOptions 10294 ), 10295 componentCompilerOptions 10296 ); 10297 Component.render = compile$1(template, finalCompilerOptions); 10298 { 10299 endMeasure(instance, `compile`); 10300 } 10301 } 10302 } 10303 instance.render = Component.render || NOOP; 10304 if (installWithProxy) { 10305 installWithProxy(instance); 10306 } 10307 } 10308 { 10309 const reset = setCurrentInstance(instance); 10310 pauseTracking(); 10311 try { 10312 applyOptions(instance); 10313 } finally { 10314 resetTracking(); 10315 reset(); 10316 } 10317 } 10318 if (!Component.render && instance.render === NOOP && !isSSR) { 10319 if (!compile$1 && Component.template) { 10320 warn$1( 10321 `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.`) 10322 ); 10323 } else { 10324 warn$1(`Component is missing template or render function: `, Component); 10325 } 10326 } 10327 } 10328 const attrsProxyHandlers = { 10329 get(target, key) { 10330 markAttrsAccessed(); 10331 track(target, "get", ""); 10332 return target[key]; 10333 }, 10334 set() { 10335 warn$1(`setupContext.attrs is readonly.`); 10336 return false; 10337 }, 10338 deleteProperty() { 10339 warn$1(`setupContext.attrs is readonly.`); 10340 return false; 10341 } 10342 }; 10343 function getSlotsProxy(instance) { 10344 return new Proxy(instance.slots, { 10345 get(target, key) { 10346 track(instance, "get", "$slots"); 10347 return target[key]; 10348 } 10349 }); 10350 } 10351 function createSetupContext(instance) { 10352 const expose = (exposed) => { 10353 { 10354 if (instance.exposed) { 10355 warn$1(`expose() should be called only once per setup().`); 10356 } 10357 if (exposed != null) { 10358 let exposedType = typeof exposed; 10359 if (exposedType === "object") { 10360 if (isArray(exposed)) { 10361 exposedType = "array"; 10362 } else if (isRef(exposed)) { 10363 exposedType = "ref"; 10364 } 10365 } 10366 if (exposedType !== "object") { 10367 warn$1( 10368 `expose() should be passed a plain object, received ${exposedType}.` 10369 ); 10370 } 10371 } 10372 } 10373 instance.exposed = exposed || {}; 10374 }; 10375 { 10376 let attrsProxy; 10377 let slotsProxy; 10378 return Object.freeze({ 10379 get attrs() { 10380 return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers)); 10381 }, 10382 get slots() { 10383 return slotsProxy || (slotsProxy = getSlotsProxy(instance)); 10384 }, 10385 get emit() { 10386 return (event, ...args) => instance.emit(event, ...args); 10387 }, 10388 expose 10389 }); 10390 } 10391 } 10392 function getComponentPublicInstance(instance) { 10393 if (instance.exposed) { 10394 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 10395 get(target, key) { 10396 if (key in target) { 10397 return target[key]; 10398 } else if (key in publicPropertiesMap) { 10399 return publicPropertiesMap[key](instance); 10400 } 10401 }, 10402 has(target, key) { 10403 return key in target || key in publicPropertiesMap; 10404 } 10405 })); 10406 } else { 10407 return instance.proxy; 10408 } 10409 } 10410 const classifyRE = /(?:^|[-_])\w/g; 10411 const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); 10412 function getComponentName(Component, includeInferred = true) { 10413 return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 10414 } 10415 function formatComponentName(instance, Component, isRoot = false) { 10416 let name = getComponentName(Component); 10417 if (!name && Component.__file) { 10418 const match = Component.__file.match(/([^/\\]+)\.\w+$/); 10419 if (match) { 10420 name = match[1]; 10421 } 10422 } 10423 if (!name && instance) { 10424 const inferFromRegistry = (registry) => { 10425 for (const key in registry) { 10426 if (registry[key] === Component) { 10427 return key; 10428 } 10429 } 10430 }; 10431 name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry( 10432 instance.parent.type.components 10433 ) || inferFromRegistry(instance.appContext.components); 10434 } 10435 return name ? classify(name) : isRoot ? `App` : `Anonymous`; 10436 } 10437 function isClassComponent(value) { 10438 return isFunction(value) && "__vccOpts" in value; 10439 } 10440 10441 const computed = (getterOrOptions, debugOptions) => { 10442 const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 10443 { 10444 const i = getCurrentInstance(); 10445 if (i && i.appContext.config.warnRecursiveComputed) { 10446 c._warnRecursive = true; 10447 } 10448 } 10449 return c; 10450 }; 10451 10452 function h(type, propsOrChildren, children) { 10453 try { 10454 setBlockTracking(-1); 10455 const l = arguments.length; 10456 if (l === 2) { 10457 if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { 10458 if (isVNode(propsOrChildren)) { 10459 return createVNode(type, null, [propsOrChildren]); 10460 } 10461 return createVNode(type, propsOrChildren); 10462 } else { 10463 return createVNode(type, null, propsOrChildren); 10464 } 10465 } else { 10466 if (l > 3) { 10467 children = Array.prototype.slice.call(arguments, 2); 10468 } else if (l === 3 && isVNode(children)) { 10469 children = [children]; 10470 } 10471 return createVNode(type, propsOrChildren, children); 10472 } 10473 } finally { 10474 setBlockTracking(1); 10475 } 10476 } 10477 10478 function initCustomFormatter() { 10479 if (typeof window === "undefined") { 10480 return; 10481 } 10482 const vueStyle = { style: "color:#3ba776" }; 10483 const numberStyle = { style: "color:#1677ff" }; 10484 const stringStyle = { style: "color:#f5222d" }; 10485 const keywordStyle = { style: "color:#eb2f96" }; 10486 const formatter = { 10487 __vue_custom_formatter: true, 10488 header(obj) { 10489 if (!isObject(obj)) { 10490 return null; 10491 } 10492 if (obj.__isVue) { 10493 return ["div", vueStyle, `VueInstance`]; 10494 } else if (isRef(obj)) { 10495 pauseTracking(); 10496 const value = obj.value; 10497 resetTracking(); 10498 return [ 10499 "div", 10500 {}, 10501 ["span", vueStyle, genRefFlag(obj)], 10502 "<", 10503 formatValue(value), 10504 `>` 10505 ]; 10506 } else if (isReactive(obj)) { 10507 return [ 10508 "div", 10509 {}, 10510 ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"], 10511 "<", 10512 formatValue(obj), 10513 `>${isReadonly(obj) ? ` (readonly)` : ``}` 10514 ]; 10515 } else if (isReadonly(obj)) { 10516 return [ 10517 "div", 10518 {}, 10519 ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"], 10520 "<", 10521 formatValue(obj), 10522 ">" 10523 ]; 10524 } 10525 return null; 10526 }, 10527 hasBody(obj) { 10528 return obj && obj.__isVue; 10529 }, 10530 body(obj) { 10531 if (obj && obj.__isVue) { 10532 return [ 10533 "div", 10534 {}, 10535 ...formatInstance(obj.$) 10536 ]; 10537 } 10538 } 10539 }; 10540 function formatInstance(instance) { 10541 const blocks = []; 10542 if (instance.type.props && instance.props) { 10543 blocks.push(createInstanceBlock("props", toRaw(instance.props))); 10544 } 10545 if (instance.setupState !== EMPTY_OBJ) { 10546 blocks.push(createInstanceBlock("setup", instance.setupState)); 10547 } 10548 if (instance.data !== EMPTY_OBJ) { 10549 blocks.push(createInstanceBlock("data", toRaw(instance.data))); 10550 } 10551 const computed = extractKeys(instance, "computed"); 10552 if (computed) { 10553 blocks.push(createInstanceBlock("computed", computed)); 10554 } 10555 const injected = extractKeys(instance, "inject"); 10556 if (injected) { 10557 blocks.push(createInstanceBlock("injected", injected)); 10558 } 10559 blocks.push([ 10560 "div", 10561 {}, 10562 [ 10563 "span", 10564 { 10565 style: keywordStyle.style + ";opacity:0.66" 10566 }, 10567 "$ (internal): " 10568 ], 10569 ["object", { object: instance }] 10570 ]); 10571 return blocks; 10572 } 10573 function createInstanceBlock(type, target) { 10574 target = extend({}, target); 10575 if (!Object.keys(target).length) { 10576 return ["span", {}]; 10577 } 10578 return [ 10579 "div", 10580 { style: "line-height:1.25em;margin-bottom:0.6em" }, 10581 [ 10582 "div", 10583 { 10584 style: "color:#476582" 10585 }, 10586 type 10587 ], 10588 [ 10589 "div", 10590 { 10591 style: "padding-left:1.25em" 10592 }, 10593 ...Object.keys(target).map((key) => { 10594 return [ 10595 "div", 10596 {}, 10597 ["span", keywordStyle, key + ": "], 10598 formatValue(target[key], false) 10599 ]; 10600 }) 10601 ] 10602 ]; 10603 } 10604 function formatValue(v, asRaw = true) { 10605 if (typeof v === "number") { 10606 return ["span", numberStyle, v]; 10607 } else if (typeof v === "string") { 10608 return ["span", stringStyle, JSON.stringify(v)]; 10609 } else if (typeof v === "boolean") { 10610 return ["span", keywordStyle, v]; 10611 } else if (isObject(v)) { 10612 return ["object", { object: asRaw ? toRaw(v) : v }]; 10613 } else { 10614 return ["span", stringStyle, String(v)]; 10615 } 10616 } 10617 function extractKeys(instance, type) { 10618 const Comp = instance.type; 10619 if (isFunction(Comp)) { 10620 return; 10621 } 10622 const extracted = {}; 10623 for (const key in instance.ctx) { 10624 if (isKeyOfType(Comp, key, type)) { 10625 extracted[key] = instance.ctx[key]; 10626 } 10627 } 10628 return extracted; 10629 } 10630 function isKeyOfType(Comp, key, type) { 10631 const opts = Comp[type]; 10632 if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) { 10633 return true; 10634 } 10635 if (Comp.extends && isKeyOfType(Comp.extends, key, type)) { 10636 return true; 10637 } 10638 if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) { 10639 return true; 10640 } 10641 } 10642 function genRefFlag(v) { 10643 if (isShallow(v)) { 10644 return `ShallowRef`; 10645 } 10646 if (v.effect) { 10647 return `ComputedRef`; 10648 } 10649 return `Ref`; 10650 } 10651 if (window.devtoolsFormatters) { 10652 window.devtoolsFormatters.push(formatter); 10653 } else { 10654 window.devtoolsFormatters = [formatter]; 10655 } 10656 } 10657 10658 function withMemo(memo, render, cache, index) {
vendor: 1,657 bytes, lines 10659-10708
10659 const cached = cache[index]; 10660 if (cached && isMemoSame(cached, memo)) { 10661 return cached; 10662 } 10663 const ret = render(); 10664 ret.memo = memo.slice(); 10665 ret.cacheIndex = index; 10666 return cache[index] = ret; 10667 } 10668 function isMemoSame(cached, memo) { 10669 const prev = cached.memo; 10670 if (prev.length != memo.length) { 10671 return false; 10672 } 10673 for (let i = 0; i < prev.length; i++) { 10674 if (hasChanged(prev[i], memo[i])) { 10675 return false; 10676 } 10677 } 10678 if (isBlockTreeEnabled > 0 && currentBlock) { 10679 currentBlock.push(cached); 10680 } 10681 return true; 10682 } 10683 10684 const version = "3.5.25"; 10685 const warn = warn$1; 10686 const ErrorTypeStrings = ErrorTypeStrings$1; 10687 const devtools = devtools$1; 10688 const setDevtoolsHook = setDevtoolsHook$1; 10689 const ssrUtils = null; 10690 const resolveFilter = null; 10691 const compatUtils = null; 10692 const DeprecationTypes = null; 10693 10694 let policy = void 0; 10695 const tt = typeof window !== "undefined" && window.trustedTypes; 10696 if (tt) { 10697 try { 10698 policy = /* @__PURE__ */ tt.createPolicy("vue", { 10699 createHTML: (val) => val 10700 }); 10701 } catch (e) { 10702 warn(`Error creating trusted types policy: ${e}`); 10703 } 10704 } 10705 const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val; 10706 const svgNS = "http://www.w3.org/2000/svg"; 10707 const mathmlNS = "http://www.w3.org/1998/Math/MathML"; 10708 const doc = typeof document !== "undefined" ? document : null;
vendor: 9,320 bytes, lines 10709-10938
10709 const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 10710 const nodeOps = { 10711 insert: (child, parent, anchor) => { 10712 parent.insertBefore(child, anchor || null); 10713 }, 10714 remove: (child) => { 10715 const parent = child.parentNode; 10716 if (parent) { 10717 parent.removeChild(child); 10718 } 10719 }, 10720 createElement: (tag, namespace, is, props) => { 10721 const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); 10722 if (tag === "select" && props && props.multiple != null) { 10723 el.setAttribute("multiple", props.multiple); 10724 } 10725 return el; 10726 }, 10727 createText: (text) => doc.createTextNode(text), 10728 createComment: (text) => doc.createComment(text), 10729 setText: (node, text) => { 10730 node.nodeValue = text; 10731 }, 10732 setElementText: (el, text) => { 10733 el.textContent = text; 10734 }, 10735 parentNode: (node) => node.parentNode, 10736 nextSibling: (node) => node.nextSibling, 10737 querySelector: (selector) => doc.querySelector(selector), 10738 setScopeId(el, id) { 10739 el.setAttribute(id, ""); 10740 }, 10741 // __UNSAFE__ 10742 // Reason: innerHTML. 10743 // Static content here can only come from compiled templates. 10744 // As long as the user only uses trusted templates, this is safe. 10745 insertStaticContent(content, parent, anchor, namespace, start, end) { 10746 const before = anchor ? anchor.previousSibling : parent.lastChild; 10747 if (start && (start === end || start.nextSibling)) { 10748 while (true) { 10749 parent.insertBefore(start.cloneNode(true), anchor); 10750 if (start === end || !(start = start.nextSibling)) break; 10751 } 10752 } else { 10753 templateContainer.innerHTML = unsafeToTrustedHTML( 10754 namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content 10755 ); 10756 const template = templateContainer.content; 10757 if (namespace === "svg" || namespace === "mathml") { 10758 const wrapper = template.firstChild; 10759 while (wrapper.firstChild) { 10760 template.appendChild(wrapper.firstChild); 10761 } 10762 template.removeChild(wrapper); 10763 } 10764 parent.insertBefore(template, anchor); 10765 } 10766 return [ 10767 // first 10768 before ? before.nextSibling : parent.firstChild, 10769 // last 10770 anchor ? anchor.previousSibling : parent.lastChild 10771 ]; 10772 } 10773 }; 10774 10775 const TRANSITION$1 = "transition"; 10776 const ANIMATION = "animation"; 10777 const vtcKey = Symbol("_vtc"); 10778 const DOMTransitionPropsValidators = { 10779 name: String, 10780 type: String, 10781 css: { 10782 type: Boolean, 10783 default: true 10784 }, 10785 duration: [String, Number, Object], 10786 enterFromClass: String, 10787 enterActiveClass: String, 10788 enterToClass: String, 10789 appearFromClass: String, 10790 appearActiveClass: String, 10791 appearToClass: String, 10792 leaveFromClass: String, 10793 leaveActiveClass: String, 10794 leaveToClass: String 10795 }; 10796 const TransitionPropsValidators = /* @__PURE__ */ extend( 10797 {}, 10798 BaseTransitionPropsValidators, 10799 DOMTransitionPropsValidators 10800 ); 10801 const decorate$1 = (t) => { 10802 t.displayName = "Transition"; 10803 t.props = TransitionPropsValidators; 10804 return t; 10805 }; 10806 const Transition = /* @__PURE__ */ decorate$1( 10807 (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots) 10808 ); 10809 const callHook = (hook, args = []) => { 10810 if (isArray(hook)) { 10811 hook.forEach((h2) => h2(...args)); 10812 } else if (hook) { 10813 hook(...args); 10814 } 10815 }; 10816 const hasExplicitCallback = (hook) => { 10817 return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 10818 }; 10819 function resolveTransitionProps(rawProps) { 10820 const baseProps = {}; 10821 for (const key in rawProps) { 10822 if (!(key in DOMTransitionPropsValidators)) { 10823 baseProps[key] = rawProps[key]; 10824 } 10825 } 10826 if (rawProps.css === false) { 10827 return baseProps; 10828 } 10829 const { 10830 name = "v", 10831 type, 10832 duration, 10833 enterFromClass = `${name}-enter-from`, 10834 enterActiveClass = `${name}-enter-active`, 10835 enterToClass = `${name}-enter-to`, 10836 appearFromClass = enterFromClass, 10837 appearActiveClass = enterActiveClass, 10838 appearToClass = enterToClass, 10839 leaveFromClass = `${name}-leave-from`, 10840 leaveActiveClass = `${name}-leave-active`, 10841 leaveToClass = `${name}-leave-to` 10842 } = rawProps; 10843 const durations = normalizeDuration(duration); 10844 const enterDuration = durations && durations[0]; 10845 const leaveDuration = durations && durations[1]; 10846 const { 10847 onBeforeEnter, 10848 onEnter, 10849 onEnterCancelled, 10850 onLeave, 10851 onLeaveCancelled, 10852 onBeforeAppear = onBeforeEnter, 10853 onAppear = onEnter, 10854 onAppearCancelled = onEnterCancelled 10855 } = baseProps; 10856 const finishEnter = (el, isAppear, done, isCancelled) => { 10857 el._enterCancelled = isCancelled; 10858 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 10859 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 10860 done && done(); 10861 }; 10862 const finishLeave = (el, done) => { 10863 el._isLeaving = false; 10864 removeTransitionClass(el, leaveFromClass); 10865 removeTransitionClass(el, leaveToClass); 10866 removeTransitionClass(el, leaveActiveClass); 10867 done && done(); 10868 }; 10869 const makeEnterHook = (isAppear) => { 10870 return (el, done) => { 10871 const hook = isAppear ? onAppear : onEnter; 10872 const resolve = () => finishEnter(el, isAppear, done); 10873 callHook(hook, [el, resolve]); 10874 nextFrame(() => { 10875 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 10876 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 10877 if (!hasExplicitCallback(hook)) { 10878 whenTransitionEnds(el, type, enterDuration, resolve); 10879 } 10880 }); 10881 }; 10882 }; 10883 return extend(baseProps, { 10884 onBeforeEnter(el) { 10885 callHook(onBeforeEnter, [el]); 10886 addTransitionClass(el, enterFromClass); 10887 addTransitionClass(el, enterActiveClass); 10888 }, 10889 onBeforeAppear(el) { 10890 callHook(onBeforeAppear, [el]); 10891 addTransitionClass(el, appearFromClass); 10892 addTransitionClass(el, appearActiveClass); 10893 }, 10894 onEnter: makeEnterHook(false), 10895 onAppear: makeEnterHook(true), 10896 onLeave(el, done) { 10897 el._isLeaving = true; 10898 const resolve = () => finishLeave(el, done); 10899 addTransitionClass(el, leaveFromClass); 10900 if (!el._enterCancelled) { 10901 forceReflow(el); 10902 addTransitionClass(el, leaveActiveClass); 10903 } else { 10904 addTransitionClass(el, leaveActiveClass); 10905 forceReflow(el); 10906 } 10907 nextFrame(() => { 10908 if (!el._isLeaving) { 10909 return; 10910 } 10911 removeTransitionClass(el, leaveFromClass); 10912 addTransitionClass(el, leaveToClass); 10913 if (!hasExplicitCallback(onLeave)) { 10914 whenTransitionEnds(el, type, leaveDuration, resolve); 10915 } 10916 }); 10917 callHook(onLeave, [el, resolve]); 10918 }, 10919 onEnterCancelled(el) { 10920 finishEnter(el, false, void 0, true); 10921 callHook(onEnterCancelled, [el]); 10922 }, 10923 onAppearCancelled(el) { 10924 finishEnter(el, true, void 0, true); 10925 callHook(onAppearCancelled, [el]); 10926 }, 10927 onLeaveCancelled(el) { 10928 finishLeave(el); 10929 callHook(onLeaveCancelled, [el]); 10930 } 10931 }); 10932 } 10933 function normalizeDuration(duration) { 10934 if (duration == null) { 10935 return null; 10936 } else if (isObject(duration)) { 10937 return [NumberOf(duration.enter), NumberOf(duration.leave)]; 10938 } else {
vendor: 7,513 bytes, lines 10939-11143
10939 const n = NumberOf(duration); 10940 return [n, n]; 10941 } 10942 } 10943 function NumberOf(val) { 10944 const res = toNumber(val); 10945 { 10946 assertNumber(res, "<transition> explicit duration"); 10947 } 10948 return res; 10949 } 10950 function addTransitionClass(el, cls) { 10951 cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); 10952 (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); 10953 } 10954 function removeTransitionClass(el, cls) { 10955 cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); 10956 const _vtc = el[vtcKey]; 10957 if (_vtc) { 10958 _vtc.delete(cls); 10959 if (!_vtc.size) { 10960 el[vtcKey] = void 0; 10961 } 10962 } 10963 } 10964 function nextFrame(cb) { 10965 requestAnimationFrame(() => { 10966 requestAnimationFrame(cb); 10967 }); 10968 } 10969 let endId = 0; 10970 function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { 10971 const id = el._endId = ++endId; 10972 const resolveIfNotStale = () => { 10973 if (id === el._endId) { 10974 resolve(); 10975 } 10976 }; 10977 if (explicitTimeout != null) { 10978 return setTimeout(resolveIfNotStale, explicitTimeout); 10979 } 10980 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 10981 if (!type) { 10982 return resolve(); 10983 } 10984 const endEvent = type + "end"; 10985 let ended = 0; 10986 const end = () => { 10987 el.removeEventListener(endEvent, onEnd); 10988 resolveIfNotStale(); 10989 }; 10990 const onEnd = (e) => { 10991 if (e.target === el && ++ended >= propCount) { 10992 end(); 10993 } 10994 }; 10995 setTimeout(() => { 10996 if (ended < propCount) { 10997 end(); 10998 } 10999 }, timeout + 1); 11000 el.addEventListener(endEvent, onEnd); 11001 } 11002 function getTransitionInfo(el, expectedType) { 11003 const styles = window.getComputedStyle(el); 11004 const getStyleProperties = (key) => (styles[key] || "").split(", "); 11005 const transitionDelays = getStyleProperties(`${TRANSITION$1}Delay`); 11006 const transitionDurations = getStyleProperties(`${TRANSITION$1}Duration`); 11007 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 11008 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 11009 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 11010 const animationTimeout = getTimeout(animationDelays, animationDurations); 11011 let type = null; 11012 let timeout = 0; 11013 let propCount = 0; 11014 if (expectedType === TRANSITION$1) { 11015 if (transitionTimeout > 0) { 11016 type = TRANSITION$1; 11017 timeout = transitionTimeout; 11018 propCount = transitionDurations.length; 11019 } 11020 } else if (expectedType === ANIMATION) { 11021 if (animationTimeout > 0) { 11022 type = ANIMATION; 11023 timeout = animationTimeout; 11024 propCount = animationDurations.length; 11025 } 11026 } else { 11027 timeout = Math.max(transitionTimeout, animationTimeout); 11028 type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null; 11029 propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0; 11030 } 11031 const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test( 11032 getStyleProperties(`${TRANSITION$1}Property`).toString() 11033 ); 11034 return { 11035 type, 11036 timeout, 11037 propCount, 11038 hasTransform 11039 }; 11040 } 11041 function getTimeout(delays, durations) { 11042 while (delays.length < durations.length) { 11043 delays = delays.concat(delays); 11044 } 11045 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 11046 } 11047 function toMs(s) { 11048 if (s === "auto") return 0; 11049 return Number(s.slice(0, -1).replace(",", ".")) * 1e3; 11050 } 11051 function forceReflow(el) { 11052 const targetDocument = el ? el.ownerDocument : document; 11053 return targetDocument.body.offsetHeight; 11054 } 11055 11056 function patchClass(el, value, isSVG) { 11057 const transitionClasses = el[vtcKey]; 11058 if (transitionClasses) { 11059 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 11060 } 11061 if (value == null) { 11062 el.removeAttribute("class"); 11063 } else if (isSVG) { 11064 el.setAttribute("class", value); 11065 } else { 11066 el.className = value; 11067 } 11068 } 11069 11070 const vShowOriginalDisplay = Symbol("_vod"); 11071 const vShowHidden = Symbol("_vsh"); 11072 const vShow = { 11073 // used for prop mismatch check during hydration 11074 name: "show", 11075 beforeMount(el, { value }, { transition }) { 11076 el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; 11077 if (transition && value) { 11078 transition.beforeEnter(el); 11079 } else { 11080 setDisplay(el, value); 11081 } 11082 }, 11083 mounted(el, { value }, { transition }) { 11084 if (transition && value) { 11085 transition.enter(el); 11086 } 11087 }, 11088 updated(el, { value, oldValue }, { transition }) { 11089 if (!value === !oldValue) return; 11090 if (transition) { 11091 if (value) { 11092 transition.beforeEnter(el); 11093 setDisplay(el, true); 11094 transition.enter(el); 11095 } else { 11096 transition.leave(el, () => { 11097 setDisplay(el, false); 11098 }); 11099 } 11100 } else { 11101 setDisplay(el, value); 11102 } 11103 }, 11104 beforeUnmount(el, { value }) { 11105 setDisplay(el, value); 11106 } 11107 }; 11108 function setDisplay(el, value) { 11109 el.style.display = value ? el[vShowOriginalDisplay] : "none"; 11110 el[vShowHidden] = !value; 11111 } 11112 11113 const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT"); 11114 function useCssVars(getter) { 11115 const instance = getCurrentInstance(); 11116 if (!instance) { 11117 warn(`useCssVars is called without current active component instance.`); 11118 return; 11119 } 11120 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 11121 Array.from( 11122 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 11123 ).forEach((node) => setVarsOnNode(node, vars)); 11124 }; 11125 { 11126 instance.getCssVars = () => getter(instance.proxy); 11127 } 11128 const setVars = () => { 11129 const vars = getter(instance.proxy); 11130 if (instance.ce) { 11131 setVarsOnNode(instance.ce, vars); 11132 } else { 11133 setVarsOnVNode(instance.subTree, vars); 11134 } 11135 updateTeleports(vars); 11136 }; 11137 onBeforeUpdate(() => { 11138 queuePostFlushCb(setVars); 11139 }); 11140 onMounted(() => { 11141 watch(setVars, NOOP, { flush: "post" }); 11142 const ob = new MutationObserver(setVars); 11143 ob.observe(instance.subTree.el.parentNode, { childList: true });
vendor: 7,578 bytes, lines 11144-11349
11144 onUnmounted(() => ob.disconnect()); 11145 }); 11146 } 11147 function setVarsOnVNode(vnode, vars) { 11148 if (vnode.shapeFlag & 128) { 11149 const suspense = vnode.suspense; 11150 vnode = suspense.activeBranch; 11151 if (suspense.pendingBranch && !suspense.isHydrating) { 11152 suspense.effects.push(() => { 11153 setVarsOnVNode(suspense.activeBranch, vars); 11154 }); 11155 } 11156 } 11157 while (vnode.component) { 11158 vnode = vnode.component.subTree; 11159 } 11160 if (vnode.shapeFlag & 1 && vnode.el) { 11161 setVarsOnNode(vnode.el, vars); 11162 } else if (vnode.type === Fragment) { 11163 vnode.children.forEach((c) => setVarsOnVNode(c, vars)); 11164 } else if (vnode.type === Static) { 11165 let { el, anchor } = vnode; 11166 while (el) { 11167 setVarsOnNode(el, vars); 11168 if (el === anchor) break; 11169 el = el.nextSibling; 11170 } 11171 } 11172 } 11173 function setVarsOnNode(el, vars) { 11174 if (el.nodeType === 1) { 11175 const style = el.style; 11176 let cssText = ""; 11177 for (const key in vars) { 11178 const value = normalizeCssVarValue(vars[key]); 11179 style.setProperty(`--${key}`, value); 11180 cssText += `--${key}: ${value};`; 11181 } 11182 style[CSS_VAR_TEXT] = cssText; 11183 } 11184 } 11185 11186 const displayRE = /(?:^|;)\s*display\s*:/; 11187 function patchStyle(el, prev, next) { 11188 const style = el.style; 11189 const isCssString = isString(next); 11190 let hasControlledDisplay = false; 11191 if (next && !isCssString) { 11192 if (prev) { 11193 if (!isString(prev)) { 11194 for (const key in prev) { 11195 if (next[key] == null) { 11196 setStyle(style, key, ""); 11197 } 11198 } 11199 } else { 11200 for (const prevStyle of prev.split(";")) { 11201 const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); 11202 if (next[key] == null) { 11203 setStyle(style, key, ""); 11204 } 11205 } 11206 } 11207 } 11208 for (const key in next) { 11209 if (key === "display") { 11210 hasControlledDisplay = true; 11211 } 11212 setStyle(style, key, next[key]); 11213 } 11214 } else { 11215 if (isCssString) { 11216 if (prev !== next) { 11217 const cssVarText = style[CSS_VAR_TEXT]; 11218 if (cssVarText) { 11219 next += ";" + cssVarText; 11220 } 11221 style.cssText = next; 11222 hasControlledDisplay = displayRE.test(next); 11223 } 11224 } else if (prev) { 11225 el.removeAttribute("style"); 11226 } 11227 } 11228 if (vShowOriginalDisplay in el) { 11229 el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; 11230 if (el[vShowHidden]) { 11231 style.display = "none"; 11232 } 11233 } 11234 } 11235 const semicolonRE = /[^\\];\s*$/; 11236 const importantRE = /\s*!important$/; 11237 function setStyle(style, name, val) { 11238 if (isArray(val)) { 11239 val.forEach((v) => setStyle(style, name, v)); 11240 } else { 11241 if (val == null) val = ""; 11242 { 11243 if (semicolonRE.test(val)) { 11244 warn( 11245 `Unexpected semicolon at the end of '${name}' style value: '${val}'` 11246 ); 11247 } 11248 } 11249 if (name.startsWith("--")) { 11250 style.setProperty(name, val); 11251 } else { 11252 const prefixed = autoPrefix(style, name); 11253 if (importantRE.test(val)) { 11254 style.setProperty( 11255 hyphenate(prefixed), 11256 val.replace(importantRE, ""), 11257 "important" 11258 ); 11259 } else { 11260 style[prefixed] = val; 11261 } 11262 } 11263 } 11264 } 11265 const prefixes = ["Webkit", "Moz", "ms"]; 11266 const prefixCache = {}; 11267 function autoPrefix(style, rawName) { 11268 const cached = prefixCache[rawName]; 11269 if (cached) { 11270 return cached; 11271 } 11272 let name = camelize(rawName); 11273 if (name !== "filter" && name in style) { 11274 return prefixCache[rawName] = name; 11275 } 11276 name = capitalize(name); 11277 for (let i = 0; i < prefixes.length; i++) { 11278 const prefixed = prefixes[i] + name; 11279 if (prefixed in style) { 11280 return prefixCache[rawName] = prefixed; 11281 } 11282 } 11283 return rawName; 11284 } 11285 11286 const xlinkNS = "http://www.w3.org/1999/xlink"; 11287 function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) { 11288 if (isSVG && key.startsWith("xlink:")) { 11289 if (value == null) { 11290 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 11291 } else { 11292 el.setAttributeNS(xlinkNS, key, value); 11293 } 11294 } else { 11295 if (value == null || isBoolean && !includeBooleanAttr(value)) { 11296 el.removeAttribute(key); 11297 } else { 11298 el.setAttribute( 11299 key, 11300 isBoolean ? "" : isSymbol(value) ? String(value) : value 11301 ); 11302 } 11303 } 11304 } 11305 11306 function patchDOMProp(el, key, value, parentComponent, attrName) { 11307 if (key === "innerHTML" || key === "textContent") { 11308 if (value != null) { 11309 el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value; 11310 } 11311 return; 11312 } 11313 const tag = el.tagName; 11314 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 11315 !tag.includes("-")) { 11316 const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; 11317 const newValue = value == null ? ( 11318 // #11647: value should be set as empty string for null and undefined, 11319 // but <input type="checkbox"> should be set as 'on'. 11320 el.type === "checkbox" ? "on" : "" 11321 ) : String(value); 11322 if (oldValue !== newValue || !("_value" in el)) { 11323 el.value = newValue; 11324 } 11325 if (value == null) { 11326 el.removeAttribute(key); 11327 } 11328 el._value = value; 11329 return; 11330 } 11331 let needRemove = false; 11332 if (value === "" || value == null) { 11333 const type = typeof el[key]; 11334 if (type === "boolean") { 11335 value = includeBooleanAttr(value); 11336 } else if (value == null && type === "string") { 11337 value = ""; 11338 needRemove = true; 11339 } else if (type === "number") { 11340 value = 0; 11341 needRemove = true; 11342 } 11343 } 11344 try { 11345 el[key] = value; 11346 } catch (e) { 11347 if (!needRemove) { 11348 warn( 11349 `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value}
11349 is invalid.`, 11350 e 11351 ); 11352 } 11353 } 11354 needRemove && el.removeAttribute(attrName || key); 11355 } 11356 11357 function addEventListener(el, event, handler, options) { 11358 el.addEventListener(event, handler, options); 11359 } 11360 function removeEventListener(el, event, handler, options) { 11361 el.removeEventListener(event, handler, options); 11362 } 11363 const veiKey = Symbol("_vei"); 11364 function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 11365 const invokers = el[veiKey] || (el[veiKey] = {}); 11366 const existingInvoker = invokers[rawName]; 11367 if (nextValue && existingInvoker) { 11368 existingInvoker.value = sanitizeEventValue(nextValue, rawName); 11369 } else { 11370 const [name, options] = parseName(rawName); 11371 if (nextValue) { 11372 const invoker = invokers[rawName] = createInvoker( 11373 sanitizeEventValue(nextValue, rawName), 11374 instance 11375 ); 11376 addEventListener(el, name, invoker, options); 11377 } else if (existingInvoker) { 11378 removeEventListener(el, name, existingInvoker, options); 11379 invokers[rawName] = void 0; 11380 } 11381 } 11382 } 11383 const optionsModifierRE = /(?:Once|Passive|Capture)$/; 11384 function parseName(name) { 11385 let options; 11386 if (optionsModifierRE.test(name)) { 11387 options = {}; 11388 let m; 11389 while (m = name.match(optionsModifierRE)) { 11390 name = name.slice(0, name.length - m[0].length); 11391 options[m[0].toLowerCase()] = true; 11392 } 11393 } 11394 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 11395 return [event, options]; 11396 } 11397 let cachedNow = 0; 11398 const p = /* @__PURE__ */ Promise.resolve(); 11399 const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 11400 function createInvoker(initialValue, instance) { 11401 const invoker = (e) => { 11402 if (!e._vts) { 11403 e._vts = Date.now(); 11404 } else if (e._vts <= invoker.attached) { 11405 return; 11406 } 11407 callWithAsyncErrorHandling( 11408 patchStopImmediatePropagation(e, invoker.value), 11409 instance, 11410 5, 11411 [e] 11412 ); 11413 }; 11414 invoker.value = initialValue; 11415 invoker.attached = getNow(); 11416 return invoker; 11417 } 11418 function sanitizeEventValue(value, propName) { 11419 if (isFunction(value) || isArray(value)) { 11420 return value; 11421 } 11422 warn( 11423 `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop? 11424Expected function or array of functions, received type ${typeof value}.` 11425 ); 11426 return NOOP; 11427 } 11428 function patchStopImmediatePropagation(e, value) { 11429 if (isArray(value)) { 11430 const originalStop = e.stopImmediatePropagation; 11431 e.stopImmediatePropagation = () => { 11432 originalStop.call(e); 11433 e._stopped = true; 11434 }; 11435 return value.map( 11436 (fn) => (e2) => !e2._stopped && fn && fn(e2) 11437 ); 11438 } else { 11439 return value; 11440 } 11441 } 11442 11443 const isNativeOn = (key) =>
vendor: 15,946 bytes, lines 11443-11840
11443 key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter 11444 key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123; 11445 const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => { 11446 const isSVG = namespace === "svg"; 11447 if (key === "class") { 11448 patchClass(el, nextValue, isSVG); 11449 } else if (key === "style") { 11450 patchStyle(el, prevValue, nextValue); 11451 } else if (isOn(key)) { 11452 if (!isModelListener(key)) { 11453 patchEvent(el, key, prevValue, nextValue, parentComponent); 11454 } 11455 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { 11456 patchDOMProp(el, key, nextValue); 11457 if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) { 11458 patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value"); 11459 } 11460 } else if ( 11461 // #11081 force set props for possible async custom element 11462 el._isVueCE && (/[A-Z]/.test(key) || !isString(nextValue)) 11463 ) { 11464 patchDOMProp(el, camelize(key), nextValue, parentComponent, key); 11465 } else { 11466 if (key === "true-value") { 11467 el._trueValue = nextValue; 11468 } else if (key === "false-value") { 11469 el._falseValue = nextValue; 11470 } 11471 patchAttr(el, key, nextValue, isSVG); 11472 } 11473 }; 11474 function shouldSetAsProp(el, key, value, isSVG) { 11475 if (isSVG) { 11476 if (key === "innerHTML" || key === "textContent") { 11477 return true; 11478 } 11479 if (key in el && isNativeOn(key) && isFunction(value)) { 11480 return true; 11481 } 11482 return false; 11483 } 11484 if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") { 11485 return false; 11486 } 11487 if (key === "sandbox" && el.tagName === "IFRAME") { 11488 return false; 11489 } 11490 if (key === "form") { 11491 return false; 11492 } 11493 if (key === "list" && el.tagName === "INPUT") { 11494 return false; 11495 } 11496 if (key === "type" && el.tagName === "TEXTAREA") { 11497 return false; 11498 } 11499 if (key === "width" || key === "height") { 11500 const tag = el.tagName; 11501 if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") { 11502 return false; 11503 } 11504 } 11505 if (isNativeOn(key) && isString(value)) { 11506 return false; 11507 } 11508 return key in el; 11509 } 11510 11511 const REMOVAL = {}; 11512 // @__NO_SIDE_EFFECTS__ 11513 function defineCustomElement(options, extraOptions, _createApp) { 11514 let Comp = defineComponent(options, extraOptions); 11515 if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions); 11516 class VueCustomElement extends VueElement { 11517 constructor(initialProps) { 11518 super(Comp, initialProps, _createApp); 11519 } 11520 } 11521 VueCustomElement.def = Comp; 11522 return VueCustomElement; 11523 } 11524 const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => { 11525 return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp); 11526 }); 11527 const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 11528 }; 11529 class VueElement extends BaseClass { 11530 constructor(_def, _props = {}, _createApp = createApp) { 11531 super(); 11532 this._def = _def; 11533 this._props = _props; 11534 this._createApp = _createApp; 11535 this._isVueCE = true; 11536 /** 11537 * @internal 11538 */ 11539 this._instance = null; 11540 /** 11541 * @internal 11542 */ 11543 this._app = null; 11544 /** 11545 * @internal 11546 */ 11547 this._nonce = this._def.nonce; 11548 this._connected = false; 11549 this._resolved = false; 11550 this._patching = false; 11551 this._dirty = false; 11552 this._numberProps = null; 11553 this._styleChildren = /* @__PURE__ */ new WeakSet(); 11554 this._ob = null; 11555 if (this.shadowRoot && _createApp !== createApp) { 11556 this._root = this.shadowRoot; 11557 } else { 11558 if (this.shadowRoot) { 11559 warn( 11560 `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.` 11561 ); 11562 } 11563 if (_def.shadowRoot !== false) { 11564 this.attachShadow( 11565 extend({}, _def.shadowRootOptions, { 11566 mode: "open" 11567 }) 11568 ); 11569 this._root = this.shadowRoot; 11570 } else { 11571 this._root = this; 11572 } 11573 } 11574 } 11575 connectedCallback() { 11576 if (!this.isConnected) return; 11577 if (!this.shadowRoot && !this._resolved) { 11578 this._parseSlots(); 11579 } 11580 this._connected = true; 11581 let parent = this; 11582 while (parent = parent && (parent.parentNode || parent.host)) { 11583 if (parent instanceof VueElement) { 11584 this._parent = parent; 11585 break; 11586 } 11587 } 11588 if (!this._instance) { 11589 if (this._resolved) { 11590 this._mount(this._def); 11591 } else { 11592 if (parent && parent._pendingResolve) { 11593 this._pendingResolve = parent._pendingResolve.then(() => { 11594 this._pendingResolve = void 0; 11595 this._resolveDef(); 11596 }); 11597 } else { 11598 this._resolveDef(); 11599 } 11600 } 11601 } 11602 } 11603 _setParent(parent = this._parent) { 11604 if (parent) { 11605 this._instance.parent = parent._instance; 11606 this._inheritParentContext(parent); 11607 } 11608 } 11609 _inheritParentContext(parent = this._parent) { 11610 if (parent && this._app) { 11611 Object.setPrototypeOf( 11612 this._app._context.provides, 11613 parent._instance.provides 11614 ); 11615 } 11616 } 11617 disconnectedCallback() { 11618 this._connected = false; 11619 nextTick(() => { 11620 if (!this._connected) { 11621 if (this._ob) { 11622 this._ob.disconnect(); 11623 this._ob = null; 11624 } 11625 this._app && this._app.unmount(); 11626 if (this._instance) this._instance.ce = void 0; 11627 this._app = this._instance = null; 11628 if (this._teleportTargets) { 11629 this._teleportTargets.clear(); 11630 this._teleportTargets = void 0; 11631 } 11632 } 11633 }); 11634 } 11635 _processMutations(mutations) { 11636 for (const m of mutations) { 11637 this._setAttr(m.attributeName); 11638 } 11639 } 11640 /** 11641 * resolve inner component definition (handle possible async component) 11642 */ 11643 _resolveDef() { 11644 if (this._pendingResolve) { 11645 return; 11646 } 11647 for (let i = 0; i < this.attributes.length; i++) { 11648 this._setAttr(this.attributes[i].name); 11649 } 11650 this._ob = new MutationObserver(this._processMutations.bind(this)); 11651 this._ob.observe(this, { attributes: true }); 11652 const resolve = (def, isAsync = false) => { 11653 this._resolved = true; 11654 this._pendingResolve = void 0; 11655 const { props, styles } = def; 11656 let numberProps; 11657 if (props && !isArray(props)) { 11658 for (const key in props) { 11659 const opt = props[key]; 11660 if (opt === Number || opt && opt.type === Number) { 11661 if (key in this._props) { 11662 this._props[key] = toNumber(this._props[key]); 11663 } 11664 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 11665 } 11666 } 11667 } 11668 this._numberProps = numberProps; 11669 this._resolveProps(def); 11670 if (this.shadowRoot) { 11671 this._applyStyles(styles); 11672 } else if (styles) { 11673 warn( 11674 "Custom element style injection is not supported when using shadowRoot: false" 11675 ); 11676 } 11677 this._mount(def); 11678 }; 11679 const asyncDef = this._def.__asyncLoader; 11680 if (asyncDef) { 11681 this._pendingResolve = asyncDef().then((def) => { 11682 def.configureApp = this._def.configureApp; 11683 resolve(this._def = def, true); 11684 }); 11685 } else { 11686 resolve(this._def); 11687 } 11688 } 11689 _mount(def) { 11690 if (!def.name) { 11691 def.name = "VueElement"; 11692 } 11693 this._app = this._createApp(def); 11694 this._inheritParentContext(); 11695 if (def.configureApp) { 11696 def.configureApp(this._app); 11697 } 11698 this._app._ceVNode = this._createVNode(); 11699 this._app.mount(this._root); 11700 const exposed = this._instance && this._instance.exposed; 11701 if (!exposed) return; 11702 for (const key in exposed) { 11703 if (!hasOwn(this, key)) { 11704 Object.defineProperty(this, key, { 11705 // unwrap ref to be consistent with public instance behavior 11706 get: () => unref(exposed[key]) 11707 }); 11708 } else { 11709 warn(`Exposed property "${key}" already exists on custom element.`); 11710 } 11711 } 11712 } 11713 _resolveProps(def) { 11714 const { props } = def; 11715 const declaredPropKeys = isArray(props) ? props : Object.keys(props || {}); 11716 for (const key of Object.keys(this)) { 11717 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 11718 this._setProp(key, this[key]); 11719 } 11720 } 11721 for (const key of declaredPropKeys.map(camelize)) { 11722 Object.defineProperty(this, key, { 11723 get() { 11724 return this._getProp(key); 11725 }, 11726 set(val) { 11727 this._setProp(key, val, true, !this._patching); 11728 } 11729 }); 11730 } 11731 } 11732 _setAttr(key) { 11733 if (key.startsWith("data-v-")) return; 11734 const has = this.hasAttribute(key); 11735 let value = has ? this.getAttribute(key) : REMOVAL; 11736 const camelKey = camelize(key); 11737 if (has && this._numberProps && this._numberProps[camelKey]) { 11738 value = toNumber(value); 11739 } 11740 this._setProp(camelKey, value, false, true); 11741 } 11742 /** 11743 * @internal 11744 */ 11745 _getProp(key) { 11746 return this._props[key]; 11747 } 11748 /** 11749 * @internal 11750 */ 11751 _setProp(key, val, shouldReflect = true, shouldUpdate = false) { 11752 if (val !== this._props[key]) { 11753 this._dirty = true; 11754 if (val === REMOVAL) { 11755 delete this._props[key]; 11756 } else { 11757 this._props[key] = val; 11758 if (key === "key" && this._app) { 11759 this._app._ceVNode.key = val; 11760 } 11761 } 11762 if (shouldUpdate && this._instance) { 11763 this._update(); 11764 } 11765 if (shouldReflect) { 11766 const ob = this._ob; 11767 if (ob) { 11768 this._processMutations(ob.takeRecords()); 11769 ob.disconnect(); 11770 } 11771 if (val === true) { 11772 this.setAttribute(hyphenate(key), ""); 11773 } else if (typeof val === "string" || typeof val === "number") { 11774 this.setAttribute(hyphenate(key), val + ""); 11775 } else if (!val) { 11776 this.removeAttribute(hyphenate(key)); 11777 } 11778 ob && ob.observe(this, { attributes: true }); 11779 } 11780 } 11781 } 11782 _update() { 11783 const vnode = this._createVNode(); 11784 if (this._app) vnode.appContext = this._app._context; 11785 render(vnode, this._root); 11786 } 11787 _createVNode() { 11788 const baseProps = {}; 11789 if (!this.shadowRoot) { 11790 baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this); 11791 } 11792 const vnode = createVNode(this._def, extend(baseProps, this._props)); 11793 if (!this._instance) { 11794 vnode.ce = (instance) => { 11795 this._instance = instance; 11796 instance.ce = this; 11797 instance.isCE = true; 11798 { 11799 instance.ceReload = (newStyles) => { 11800 if (this._styles) { 11801 this._styles.forEach((s) => this._root.removeChild(s)); 11802 this._styles.length = 0; 11803 } 11804 this._applyStyles(newStyles); 11805 this._instance = null; 11806 this._update(); 11807 }; 11808 } 11809 const dispatch = (event, args) => { 11810 this.dispatchEvent( 11811 new CustomEvent( 11812 event, 11813 isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args } 11814 ) 11815 ); 11816 }; 11817 instance.emit = (event, ...args) => { 11818 dispatch(event, args); 11819 if (hyphenate(event) !== event) { 11820 dispatch(hyphenate(event), args); 11821 } 11822 }; 11823 this._setParent(); 11824 }; 11825 } 11826 return vnode; 11827 } 11828 _applyStyles(styles, owner) { 11829 if (!styles) return; 11830 if (owner) { 11831 if (owner === this._def || this._styleChildren.has(owner)) { 11832 return; 11833 } 11834 this._styleChildren.add(owner); 11835 } 11836 const nonce = this._nonce; 11837 for (let i = styles.length - 1; i >= 0; i--) { 11838 const s = document.createElement("style"); 11839 if (nonce) s.setAttribute("nonce", nonce); 11840 s.textContent = styles[i];
vendor: 6,150 bytes, lines 11841-12018
11841 this.shadowRoot.prepend(s); 11842 { 11843 if (owner) { 11844 if (owner.__hmrId) { 11845 if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map(); 11846 let entry = this._childStyles.get(owner.__hmrId); 11847 if (!entry) { 11848 this._childStyles.set(owner.__hmrId, entry = []); 11849 } 11850 entry.push(s); 11851 } 11852 } else { 11853 (this._styles || (this._styles = [])).push(s); 11854 } 11855 } 11856 } 11857 } 11858 /** 11859 * Only called when shadowRoot is false 11860 */ 11861 _parseSlots() { 11862 const slots = this._slots = {}; 11863 let n; 11864 while (n = this.firstChild) { 11865 const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default"; 11866 (slots[slotName] || (slots[slotName] = [])).push(n); 11867 this.removeChild(n); 11868 } 11869 } 11870 /** 11871 * Only called when shadowRoot is false 11872 */ 11873 _renderSlots() { 11874 const outlets = this._getSlots(); 11875 const scopeId = this._instance.type.__scopeId; 11876 for (let i = 0; i < outlets.length; i++) { 11877 const o = outlets[i]; 11878 const slotName = o.getAttribute("name") || "default"; 11879 const content = this._slots[slotName]; 11880 const parent = o.parentNode; 11881 if (content) { 11882 for (const n of content) { 11883 if (scopeId && n.nodeType === 1) { 11884 const id = scopeId + "-s"; 11885 const walker = document.createTreeWalker(n, 1); 11886 n.setAttribute(id, ""); 11887 let child; 11888 while (child = walker.nextNode()) { 11889 child.setAttribute(id, ""); 11890 } 11891 } 11892 parent.insertBefore(n, o); 11893 } 11894 } else { 11895 while (o.firstChild) parent.insertBefore(o.firstChild, o); 11896 } 11897 parent.removeChild(o); 11898 } 11899 } 11900 /** 11901 * @internal 11902 */ 11903 _getSlots() { 11904 const roots = [this]; 11905 if (this._teleportTargets) { 11906 roots.push(...this._teleportTargets); 11907 } 11908 const slots = /* @__PURE__ */ new Set(); 11909 for (const root of roots) { 11910 const found = root.querySelectorAll("slot"); 11911 for (let i = 0; i < found.length; i++) { 11912 slots.add(found[i]); 11913 } 11914 } 11915 return Array.from(slots); 11916 } 11917 /** 11918 * @internal 11919 */ 11920 _injectChildStyle(comp) { 11921 this._applyStyles(comp.styles, comp); 11922 } 11923 /** 11924 * @internal 11925 */ 11926 _beginPatch() { 11927 this._patching = true; 11928 this._dirty = false; 11929 } 11930 /** 11931 * @internal 11932 */ 11933 _endPatch() { 11934 this._patching = false; 11935 if (this._dirty && this._instance) { 11936 this._update(); 11937 } 11938 } 11939 /** 11940 * @internal 11941 */ 11942 _removeChildStyle(comp) { 11943 { 11944 this._styleChildren.delete(comp); 11945 if (this._childStyles && comp.__hmrId) { 11946 const oldStyles = this._childStyles.get(comp.__hmrId); 11947 if (oldStyles) { 11948 oldStyles.forEach((s) => this._root.removeChild(s)); 11949 oldStyles.length = 0; 11950 } 11951 } 11952 } 11953 } 11954 } 11955 function useHost(caller) { 11956 const instance = getCurrentInstance(); 11957 const el = instance && instance.ce; 11958 if (el) { 11959 return el; 11960 } else { 11961 if (!instance) { 11962 warn( 11963 `${caller || "useHost"} called without an active component instance.` 11964 ); 11965 } else { 11966 warn( 11967 `${caller || "useHost"} can only be used in components defined via defineCustomElement.` 11968 ); 11969 } 11970 } 11971 return null; 11972 } 11973 function useShadowRoot() { 11974 const el = useHost("useShadowRoot"); 11975 return el && el.shadowRoot; 11976 } 11977 11978 function useCssModule(name = "$style") { 11979 { 11980 { 11981 warn(`useCssModule() is not supported in the global build.`); 11982 } 11983 return EMPTY_OBJ; 11984 } 11985 } 11986 11987 const positionMap = /* @__PURE__ */ new WeakMap(); 11988 const newPositionMap = /* @__PURE__ */ new WeakMap(); 11989 const moveCbKey = Symbol("_moveCb"); 11990 const enterCbKey = Symbol("_enterCb"); 11991 const decorate = (t) => { 11992 delete t.props.mode; 11993 return t; 11994 }; 11995 const TransitionGroupImpl = /* @__PURE__ */ decorate({ 11996 name: "TransitionGroup", 11997 props: /* @__PURE__ */ extend({}, TransitionPropsValidators, { 11998 tag: String, 11999 moveClass: String 12000 }), 12001 setup(props, { slots }) { 12002 const instance = getCurrentInstance(); 12003 const state = useTransitionState(); 12004 let prevChildren; 12005 let children; 12006 onUpdated(() => { 12007 if (!prevChildren.length) { 12008 return; 12009 } 12010 const moveClass = props.moveClass || `${props.name || "v"}-move`; 12011 if (!hasCSSTransform( 12012 prevChildren[0].el, 12013 instance.vnode.el, 12014 moveClass 12015 )) { 12016 prevChildren = []; 12017 return; 12018 }
vendor: 12,797 bytes, lines 12019-12329
12019 prevChildren.forEach(callPendingCbs); 12020 prevChildren.forEach(recordPosition); 12021 const movedChildren = prevChildren.filter(applyTranslation); 12022 forceReflow(instance.vnode.el); 12023 movedChildren.forEach((c) => { 12024 const el = c.el; 12025 const style = el.style; 12026 addTransitionClass(el, moveClass); 12027 style.transform = style.webkitTransform = style.transitionDuration = ""; 12028 const cb = el[moveCbKey] = (e) => { 12029 if (e && e.target !== el) { 12030 return; 12031 } 12032 if (!e || e.propertyName.endsWith("transform")) { 12033 el.removeEventListener("transitionend", cb); 12034 el[moveCbKey] = null; 12035 removeTransitionClass(el, moveClass); 12036 } 12037 }; 12038 el.addEventListener("transitionend", cb); 12039 }); 12040 prevChildren = []; 12041 }); 12042 return () => { 12043 const rawProps = toRaw(props); 12044 const cssTransitionProps = resolveTransitionProps(rawProps); 12045 let tag = rawProps.tag || Fragment; 12046 prevChildren = []; 12047 if (children) { 12048 for (let i = 0; i < children.length; i++) { 12049 const child = children[i]; 12050 if (child.el && child.el instanceof Element) { 12051 prevChildren.push(child); 12052 setTransitionHooks( 12053 child, 12054 resolveTransitionHooks( 12055 child, 12056 cssTransitionProps, 12057 state, 12058 instance 12059 ) 12060 ); 12061 positionMap.set(child, { 12062 left: child.el.offsetLeft, 12063 top: child.el.offsetTop 12064 }); 12065 } 12066 } 12067 } 12068 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 12069 for (let i = 0; i < children.length; i++) { 12070 const child = children[i]; 12071 if (child.key != null) { 12072 setTransitionHooks( 12073 child, 12074 resolveTransitionHooks(child, cssTransitionProps, state, instance) 12075 ); 12076 } else if (child.type !== Text) { 12077 warn(`<TransitionGroup> children must be keyed.`); 12078 } 12079 } 12080 return createVNode(tag, null, children); 12081 }; 12082 } 12083 }); 12084 const TransitionGroup = TransitionGroupImpl; 12085 function callPendingCbs(c) { 12086 const el = c.el; 12087 if (el[moveCbKey]) { 12088 el[moveCbKey](); 12089 } 12090 if (el[enterCbKey]) { 12091 el[enterCbKey](); 12092 } 12093 } 12094 function recordPosition(c) { 12095 newPositionMap.set(c, { 12096 left: c.el.offsetLeft, 12097 top: c.el.offsetTop 12098 }); 12099 } 12100 function applyTranslation(c) { 12101 const oldPos = positionMap.get(c); 12102 const newPos = newPositionMap.get(c); 12103 const dx = oldPos.left - newPos.left; 12104 const dy = oldPos.top - newPos.top; 12105 if (dx || dy) { 12106 const s = c.el.style; 12107 s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`; 12108 s.transitionDuration = "0s"; 12109 return c; 12110 } 12111 } 12112 function hasCSSTransform(el, root, moveClass) { 12113 const clone = el.cloneNode(); 12114 const _vtc = el[vtcKey]; 12115 if (_vtc) { 12116 _vtc.forEach((cls) => { 12117 cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c)); 12118 }); 12119 } 12120 moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c)); 12121 clone.style.display = "none"; 12122 const container = root.nodeType === 1 ? root : root.parentNode; 12123 container.appendChild(clone); 12124 const { hasTransform } = getTransitionInfo(clone); 12125 container.removeChild(clone); 12126 return hasTransform; 12127 } 12128 12129 const getModelAssigner = (vnode) => { 12130 const fn = vnode.props["onUpdate:modelValue"] || false; 12131 return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn; 12132 }; 12133 function onCompositionStart(e) { 12134 e.target.composing = true; 12135 } 12136 function onCompositionEnd(e) { 12137 const target = e.target; 12138 if (target.composing) { 12139 target.composing = false; 12140 target.dispatchEvent(new Event("input")); 12141 } 12142 } 12143 const assignKey = Symbol("_assign"); 12144 function castValue(value, trim, number) { 12145 if (trim) value = value.trim(); 12146 if (number) value = looseToNumber(value); 12147 return value; 12148 } 12149 const vModelText = { 12150 created(el, { modifiers: { lazy, trim, number } }, vnode) { 12151 el[assignKey] = getModelAssigner(vnode); 12152 const castToNumber = number || vnode.props && vnode.props.type === "number"; 12153 addEventListener(el, lazy ? "change" : "input", (e) => { 12154 if (e.target.composing) return; 12155 el[assignKey](castValue(el.value, trim, castToNumber)); 12156 }); 12157 if (trim || castToNumber) { 12158 addEventListener(el, "change", () => { 12159 el.value = castValue(el.value, trim, castToNumber); 12160 }); 12161 } 12162 if (!lazy) { 12163 addEventListener(el, "compositionstart", onCompositionStart); 12164 addEventListener(el, "compositionend", onCompositionEnd); 12165 addEventListener(el, "change", onCompositionEnd); 12166 } 12167 }, 12168 // set value on mounted so it's after min/max for type="range" 12169 mounted(el, { value }) { 12170 el.value = value == null ? "" : value; 12171 }, 12172 beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) { 12173 el[assignKey] = getModelAssigner(vnode); 12174 if (el.composing) return; 12175 const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; 12176 const newValue = value == null ? "" : value; 12177 if (elValue === newValue) { 12178 return; 12179 } 12180 if (document.activeElement === el && el.type !== "range") { 12181 if (lazy && value === oldValue) { 12182 return; 12183 } 12184 if (trim && el.value.trim() === newValue) { 12185 return; 12186 } 12187 } 12188 el.value = newValue; 12189 } 12190 }; 12191 const vModelCheckbox = { 12192 // #4096 array checkboxes need to be deep traversed 12193 deep: true, 12194 created(el, _, vnode) { 12195 el[assignKey] = getModelAssigner(vnode); 12196 addEventListener(el, "change", () => { 12197 const modelValue = el._modelValue; 12198 const elementValue = getValue(el); 12199 const checked = el.checked; 12200 const assign = el[assignKey]; 12201 if (isArray(modelValue)) { 12202 const index = looseIndexOf(modelValue, elementValue); 12203 const found = index !== -1; 12204 if (checked && !found) { 12205 assign(modelValue.concat(elementValue)); 12206 } else if (!checked && found) { 12207 const filtered = [...modelValue]; 12208 filtered.splice(index, 1); 12209 assign(filtered); 12210 } 12211 } else if (isSet(modelValue)) { 12212 const cloned = new Set(modelValue); 12213 if (checked) { 12214 cloned.add(elementValue); 12215 } else { 12216 cloned.delete(elementValue); 12217 } 12218 assign(cloned); 12219 } else { 12220 assign(getCheckboxValue(el, checked)); 12221 } 12222 }); 12223 }, 12224 // set initial checked on mount to wait for true-value/false-value 12225 mounted: setChecked, 12226 beforeUpdate(el, binding, vnode) { 12227 el[assignKey] = getModelAssigner(vnode); 12228 setChecked(el, binding, vnode); 12229 } 12230 }; 12231 function setChecked(el, { value, oldValue }, vnode) { 12232 el._modelValue = value; 12233 let checked; 12234 if (isArray(value)) { 12235 checked = looseIndexOf(value, vnode.props.value) > -1; 12236 } else if (isSet(value)) { 12237 checked = value.has(vnode.props.value); 12238 } else { 12239 if (value === oldValue) return; 12240 checked = looseEqual(value, getCheckboxValue(el, true)); 12241 } 12242 if (el.checked !== checked) { 12243 el.checked = checked; 12244 } 12245 } 12246 const vModelRadio = { 12247 created(el, { value }, vnode) { 12248 el.checked = looseEqual(value, vnode.props.value); 12249 el[assignKey] = getModelAssigner(vnode); 12250 addEventListener(el, "change", () => { 12251 el[assignKey](getValue(el)); 12252 }); 12253 }, 12254 beforeUpdate(el, { value, oldValue }, vnode) { 12255 el[assignKey] = getModelAssigner(vnode); 12256 if (value !== oldValue) { 12257 el.checked = looseEqual(value, vnode.props.value); 12258 } 12259 } 12260 }; 12261 const vModelSelect = { 12262 // <select multiple> value need to be deep traversed 12263 deep: true, 12264 created(el, { value, modifiers: { number } }, vnode) { 12265 const isSetModel = isSet(value); 12266 addEventListener(el, "change", () => { 12267 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 12268 (o) => number ? looseToNumber(getValue(o)) : getValue(o) 12269 ); 12270 el[assignKey]( 12271 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 12272 ); 12273 el._assigning = true; 12274 nextTick(() => { 12275 el._assigning = false; 12276 }); 12277 }); 12278 el[assignKey] = getModelAssigner(vnode); 12279 }, 12280 // set value in mounted & updated because <select> relies on its children 12281 // <option>s. 12282 mounted(el, { value }) { 12283 setSelected(el, value); 12284 }, 12285 beforeUpdate(el, _binding, vnode) { 12286 el[assignKey] = getModelAssigner(vnode); 12287 }, 12288 updated(el, { value }) { 12289 if (!el._assigning) { 12290 setSelected(el, value); 12291 } 12292 } 12293 }; 12294 function setSelected(el, value) { 12295 const isMultiple = el.multiple; 12296 const isArrayValue = isArray(value); 12297 if (isMultiple && !isArrayValue && !isSet(value)) { 12298 warn( 12299 `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.` 12300 ); 12301 return; 12302 } 12303 for (let i = 0, l = el.options.length; i < l; i++) { 12304 const option = el.options[i]; 12305 const optionValue = getValue(option); 12306 if (isMultiple) { 12307 if (isArrayValue) { 12308 const optionType = typeof optionValue; 12309 if (optionType === "string" || optionType === "number") { 12310 option.selected = value.some((v) => String(v) === String(optionValue)); 12311 } else { 12312 option.selected = looseIndexOf(value, optionValue) > -1; 12313 } 12314 } else { 12315 option.selected = value.has(optionValue); 12316 } 12317 } else if (looseEqual(getValue(option), value)) { 12318 if (el.selectedIndex !== i) el.selectedIndex = i; 12319 return; 12320 } 12321 } 12322 if (!isMultiple && el.selectedIndex !== -1) { 12323 el.selectedIndex = -1; 12324 } 12325 } 12326 function getValue(el) { 12327 return "_value" in el ? el._value : el.value; 12328 } 12329 function getCheckboxValue(el, checked) {
vendor: 10,289 bytes, lines 12330-12610
12330 const key = checked ? "_trueValue" : "_falseValue"; 12331 return key in el ? el[key] : checked; 12332 } 12333 const vModelDynamic = { 12334 created(el, binding, vnode) { 12335 callModelHook(el, binding, vnode, null, "created"); 12336 }, 12337 mounted(el, binding, vnode) { 12338 callModelHook(el, binding, vnode, null, "mounted"); 12339 }, 12340 beforeUpdate(el, binding, vnode, prevVNode) { 12341 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 12342 }, 12343 updated(el, binding, vnode, prevVNode) { 12344 callModelHook(el, binding, vnode, prevVNode, "updated"); 12345 } 12346 }; 12347 function resolveDynamicModel(tagName, type) { 12348 switch (tagName) { 12349 case "SELECT": 12350 return vModelSelect; 12351 case "TEXTAREA": 12352 return vModelText; 12353 default: 12354 switch (type) { 12355 case "checkbox": 12356 return vModelCheckbox; 12357 case "radio": 12358 return vModelRadio; 12359 default: 12360 return vModelText; 12361 } 12362 } 12363 } 12364 function callModelHook(el, binding, vnode, prevVNode, hook) { 12365 const modelToUse = resolveDynamicModel( 12366 el.tagName, 12367 vnode.props && vnode.props.type 12368 ); 12369 const fn = modelToUse[hook]; 12370 fn && fn(el, binding, vnode, prevVNode); 12371 } 12372 12373 const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 12374 const modifierGuards = { 12375 stop: (e) => e.stopPropagation(), 12376 prevent: (e) => e.preventDefault(), 12377 self: (e) => e.target !== e.currentTarget, 12378 ctrl: (e) => !e.ctrlKey, 12379 shift: (e) => !e.shiftKey, 12380 alt: (e) => !e.altKey, 12381 meta: (e) => !e.metaKey, 12382 left: (e) => "button" in e && e.button !== 0, 12383 middle: (e) => "button" in e && e.button !== 1, 12384 right: (e) => "button" in e && e.button !== 2, 12385 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 12386 }; 12387 const withModifiers = (fn, modifiers) => { 12388 const cache = fn._withMods || (fn._withMods = {}); 12389 const cacheKey = modifiers.join("."); 12390 return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => { 12391 for (let i = 0; i < modifiers.length; i++) { 12392 const guard = modifierGuards[modifiers[i]]; 12393 if (guard && guard(event, modifiers)) return; 12394 } 12395 return fn(event, ...args); 12396 })); 12397 }; 12398 const keyNames = { 12399 esc: "escape", 12400 space: " ", 12401 up: "arrow-up", 12402 left: "arrow-left", 12403 right: "arrow-right", 12404 down: "arrow-down", 12405 delete: "backspace" 12406 }; 12407 const withKeys = (fn, modifiers) => { 12408 const cache = fn._withKeys || (fn._withKeys = {}); 12409 const cacheKey = modifiers.join("."); 12410 return cache[cacheKey] || (cache[cacheKey] = ((event) => { 12411 if (!("key" in event)) { 12412 return; 12413 } 12414 const eventKey = hyphenate(event.key); 12415 if (modifiers.some( 12416 (k) => k === eventKey || keyNames[k] === eventKey 12417 )) { 12418 return fn(event); 12419 } 12420 })); 12421 }; 12422 12423 const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); 12424 let renderer; 12425 let enabledHydration = false; 12426 function ensureRenderer() { 12427 return renderer || (renderer = createRenderer(rendererOptions)); 12428 } 12429 function ensureHydrationRenderer() { 12430 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 12431 enabledHydration = true; 12432 return renderer; 12433 } 12434 const render = ((...args) => { 12435 ensureRenderer().render(...args); 12436 }); 12437 const hydrate = ((...args) => { 12438 ensureHydrationRenderer().hydrate(...args); 12439 }); 12440 const createApp = ((...args) => { 12441 const app = ensureRenderer().createApp(...args); 12442 { 12443 injectNativeTagCheck(app); 12444 injectCompilerOptionsCheck(app); 12445 } 12446 const { mount } = app; 12447 app.mount = (containerOrSelector) => { 12448 const container = normalizeContainer(containerOrSelector); 12449 if (!container) return; 12450 const component = app._component; 12451 if (!isFunction(component) && !component.render && !component.template) { 12452 component.template = container.innerHTML; 12453 } 12454 if (container.nodeType === 1) { 12455 container.textContent = ""; 12456 } 12457 const proxy = mount(container, false, resolveRootNamespace(container)); 12458 if (container instanceof Element) { 12459 container.removeAttribute("v-cloak"); 12460 container.setAttribute("data-v-app", ""); 12461 } 12462 return proxy; 12463 }; 12464 return app; 12465 }); 12466 const createSSRApp = ((...args) => { 12467 const app = ensureHydrationRenderer().createApp(...args); 12468 { 12469 injectNativeTagCheck(app); 12470 injectCompilerOptionsCheck(app); 12471 } 12472 const { mount } = app; 12473 app.mount = (containerOrSelector) => { 12474 const container = normalizeContainer(containerOrSelector); 12475 if (container) { 12476 return mount(container, true, resolveRootNamespace(container)); 12477 } 12478 }; 12479 return app; 12480 }); 12481 function resolveRootNamespace(container) { 12482 if (container instanceof SVGElement) { 12483 return "svg"; 12484 } 12485 if (typeof MathMLElement === "function" && container instanceof MathMLElement) { 12486 return "mathml"; 12487 } 12488 } 12489 function injectNativeTagCheck(app) { 12490 Object.defineProperty(app.config, "isNativeTag", { 12491 value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 12492 writable: false 12493 }); 12494 } 12495 function injectCompilerOptionsCheck(app) { 12496 if (isRuntimeOnly()) { 12497 const isCustomElement = app.config.isCustomElement; 12498 Object.defineProperty(app.config, "isCustomElement", { 12499 get() { 12500 return isCustomElement; 12501 }, 12502 set() { 12503 warn( 12504 `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.` 12505 ); 12506 } 12507 }); 12508 const compilerOptions = app.config.compilerOptions; 12509 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. 12510- For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option. 12511- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader 12512- 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`; 12513 Object.defineProperty(app.config, "compilerOptions", { 12514 get() { 12515 warn(msg); 12516 return compilerOptions; 12517 }, 12518 set() { 12519 warn(msg); 12520 } 12521 }); 12522 } 12523 } 12524 function normalizeContainer(container) { 12525 if (isString(container)) { 12526 const res = document.querySelector(container); 12527 if (!res) { 12528 warn( 12529 `Failed to mount app: mount target selector "${container}" returned null.` 12530 ); 12531 } 12532 return res; 12533 } 12534 if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") { 12535 warn( 12536 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs` 12537 ); 12538 } 12539 return container; 12540 } 12541 const initDirectivesForSSR = NOOP; 12542 12543 function initDev() { 12544 { 12545 { 12546 console.info( 12547 `You are running a development build of Vue. 12548Make sure to use the production build (*.prod.js) when deploying for production.` 12549 ); 12550 } 12551 initCustomFormatter(); 12552 } 12553 } 12554 12555 const FRAGMENT = Symbol(`Fragment`); 12556 const TELEPORT = Symbol(`Teleport`); 12557 const SUSPENSE = Symbol(`Suspense`); 12558 const KEEP_ALIVE = Symbol(`KeepAlive`); 12559 const BASE_TRANSITION = Symbol( 12560 `BaseTransition` 12561 ); 12562 const OPEN_BLOCK = Symbol(`openBlock`); 12563 const CREATE_BLOCK = Symbol(`createBlock`); 12564 const CREATE_ELEMENT_BLOCK = Symbol( 12565 `createElementBlock` 12566 ); 12567 const CREATE_VNODE = Symbol(`createVNode`); 12568 const CREATE_ELEMENT_VNODE = Symbol( 12569 `createElementVNode` 12570 ); 12571 const CREATE_COMMENT = Symbol( 12572 `createCommentVNode` 12573 ); 12574 const CREATE_TEXT = Symbol( 12575 `createTextVNode` 12576 ); 12577 const CREATE_STATIC = Symbol( 12578 `createStaticVNode` 12579 ); 12580 const RESOLVE_COMPONENT = Symbol( 12581 `resolveComponent` 12582 ); 12583 const RESOLVE_DYNAMIC_COMPONENT = Symbol( 12584 `resolveDynamicComponent` 12585 ); 12586 const RESOLVE_DIRECTIVE = Symbol( 12587 `resolveDirective` 12588 ); 12589 const RESOLVE_FILTER = Symbol( 12590 `resolveFilter` 12591 ); 12592 const WITH_DIRECTIVES = Symbol( 12593 `withDirectives` 12594 ); 12595 const RENDER_LIST = Symbol(`renderList`); 12596 const RENDER_SLOT = Symbol(`renderSlot`); 12597 const CREATE_SLOTS = Symbol(`createSlots`); 12598 const TO_DISPLAY_STRING = Symbol( 12599 `toDisplayString` 12600 ); 12601 const MERGE_PROPS = Symbol(`mergeProps`); 12602 const NORMALIZE_CLASS = Symbol( 12603 `normalizeClass` 12604 ); 12605 const NORMALIZE_STYLE = Symbol( 12606 `normalizeStyle` 12607 ); 12608 const NORMALIZE_PROPS = Symbol( 12609 `normalizeProps` 12610 );
vendor: 37,183 bytes, lines 12611-13622
12611 const GUARD_REACTIVE_PROPS = Symbol( 12612 `guardReactiveProps` 12613 ); 12614 const TO_HANDLERS = Symbol(`toHandlers`); 12615 const CAMELIZE = Symbol(`camelize`); 12616 const CAPITALIZE = Symbol(`capitalize`); 12617 const TO_HANDLER_KEY = Symbol( 12618 `toHandlerKey` 12619 ); 12620 const SET_BLOCK_TRACKING = Symbol( 12621 `setBlockTracking` 12622 ); 12623 const PUSH_SCOPE_ID = Symbol(`pushScopeId`); 12624 const POP_SCOPE_ID = Symbol(`popScopeId`); 12625 const WITH_CTX = Symbol(`withCtx`); 12626 const UNREF = Symbol(`unref`); 12627 const IS_REF = Symbol(`isRef`); 12628 const WITH_MEMO = Symbol(`withMemo`); 12629 const IS_MEMO_SAME = Symbol(`isMemoSame`); 12630 const helperNameMap = { 12631 [FRAGMENT]: `Fragment`, 12632 [TELEPORT]: `Teleport`, 12633 [SUSPENSE]: `Suspense`, 12634 [KEEP_ALIVE]: `KeepAlive`, 12635 [BASE_TRANSITION]: `BaseTransition`, 12636 [OPEN_BLOCK]: `openBlock`, 12637 [CREATE_BLOCK]: `createBlock`, 12638 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 12639 [CREATE_VNODE]: `createVNode`, 12640 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 12641 [CREATE_COMMENT]: `createCommentVNode`, 12642 [CREATE_TEXT]: `createTextVNode`, 12643 [CREATE_STATIC]: `createStaticVNode`, 12644 [RESOLVE_COMPONENT]: `resolveComponent`, 12645 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 12646 [RESOLVE_DIRECTIVE]: `resolveDirective`, 12647 [RESOLVE_FILTER]: `resolveFilter`, 12648 [WITH_DIRECTIVES]: `withDirectives`, 12649 [RENDER_LIST]: `renderList`, 12650 [RENDER_SLOT]: `renderSlot`, 12651 [CREATE_SLOTS]: `createSlots`, 12652 [TO_DISPLAY_STRING]: `toDisplayString`, 12653 [MERGE_PROPS]: `mergeProps`, 12654 [NORMALIZE_CLASS]: `normalizeClass`, 12655 [NORMALIZE_STYLE]: `normalizeStyle`, 12656 [NORMALIZE_PROPS]: `normalizeProps`, 12657 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 12658 [TO_HANDLERS]: `toHandlers`, 12659 [CAMELIZE]: `camelize`, 12660 [CAPITALIZE]: `capitalize`, 12661 [TO_HANDLER_KEY]: `toHandlerKey`, 12662 [SET_BLOCK_TRACKING]: `setBlockTracking`, 12663 [PUSH_SCOPE_ID]: `pushScopeId`, 12664 [POP_SCOPE_ID]: `popScopeId`, 12665 [WITH_CTX]: `withCtx`, 12666 [UNREF]: `unref`, 12667 [IS_REF]: `isRef`, 12668 [WITH_MEMO]: `withMemo`, 12669 [IS_MEMO_SAME]: `isMemoSame` 12670 }; 12671 function registerRuntimeHelpers(helpers) { 12672 Object.getOwnPropertySymbols(helpers).forEach((s) => { 12673 helperNameMap[s] = helpers[s]; 12674 }); 12675 } 12676 12677 const locStub = { 12678 start: { line: 1, column: 1, offset: 0 }, 12679 end: { line: 1, column: 1, offset: 0 }, 12680 source: "" 12681 }; 12682 function createRoot(children, source = "") { 12683 return { 12684 type: 0, 12685 source, 12686 children, 12687 helpers: /* @__PURE__ */ new Set(), 12688 components: [], 12689 directives: [], 12690 hoists: [], 12691 imports: [], 12692 cached: [], 12693 temps: 0, 12694 codegenNode: void 0, 12695 loc: locStub 12696 }; 12697 } 12698 function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) { 12699 if (context) { 12700 if (isBlock) { 12701 context.helper(OPEN_BLOCK); 12702 context.helper(getVNodeBlockHelper(context.inSSR, isComponent)); 12703 } else { 12704 context.helper(getVNodeHelper(context.inSSR, isComponent)); 12705 } 12706 if (directives) { 12707 context.helper(WITH_DIRECTIVES); 12708 } 12709 } 12710 return { 12711 type: 13, 12712 tag, 12713 props, 12714 children, 12715 patchFlag, 12716 dynamicProps, 12717 directives, 12718 isBlock, 12719 disableTracking, 12720 isComponent, 12721 loc 12722 }; 12723 } 12724 function createArrayExpression(elements, loc = locStub) { 12725 return { 12726 type: 17, 12727 loc, 12728 elements 12729 }; 12730 } 12731 function createObjectExpression(properties, loc = locStub) { 12732 return { 12733 type: 15, 12734 loc, 12735 properties 12736 }; 12737 } 12738 function createObjectProperty(key, value) { 12739 return { 12740 type: 16, 12741 loc: locStub, 12742 key: isString(key) ? createSimpleExpression(key, true) : key, 12743 value 12744 }; 12745 } 12746 function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 12747 return { 12748 type: 4, 12749 loc, 12750 content, 12751 isStatic, 12752 constType: isStatic ? 3 : constType 12753 }; 12754 } 12755 function createCompoundExpression(children, loc = locStub) { 12756 return { 12757 type: 8, 12758 loc, 12759 children 12760 }; 12761 } 12762 function createCallExpression(callee, args = [], loc = locStub) { 12763 return { 12764 type: 14, 12765 loc, 12766 callee, 12767 arguments: args 12768 }; 12769 } 12770 function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 12771 return { 12772 type: 18, 12773 params, 12774 returns, 12775 newline, 12776 isSlot, 12777 loc 12778 }; 12779 } 12780 function createConditionalExpression(test, consequent, alternate, newline = true) { 12781 return { 12782 type: 19, 12783 test, 12784 consequent, 12785 alternate, 12786 newline, 12787 loc: locStub 12788 }; 12789 } 12790 function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { 12791 return { 12792 type: 20, 12793 index, 12794 value, 12795 needPauseTracking, 12796 inVOnce, 12797 needArraySpread: false, 12798 loc: locStub 12799 }; 12800 } 12801 function createBlockStatement(body) { 12802 return { 12803 type: 21, 12804 body, 12805 loc: locStub 12806 }; 12807 } 12808 function getVNodeHelper(ssr, isComponent) { 12809 return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 12810 } 12811 function getVNodeBlockHelper(ssr, isComponent) { 12812 return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 12813 } 12814 function convertToBlock(node, { helper, removeHelper, inSSR }) { 12815 if (!node.isBlock) { 12816 node.isBlock = true; 12817 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 12818 helper(OPEN_BLOCK); 12819 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 12820 } 12821 } 12822 12823 const defaultDelimitersOpen = new Uint8Array([123, 123]); 12824 const defaultDelimitersClose = new Uint8Array([125, 125]); 12825 function isTagStartChar(c) { 12826 return c >= 97 && c <= 122 || c >= 65 && c <= 90; 12827 } 12828 function isWhitespace(c) { 12829 return c === 32 || c === 10 || c === 9 || c === 12 || c === 13; 12830 } 12831 function isEndOfTagSection(c) { 12832 return c === 47 || c === 62 || isWhitespace(c); 12833 } 12834 function toCharCodes(str) { 12835 const ret = new Uint8Array(str.length); 12836 for (let i = 0; i < str.length; i++) { 12837 ret[i] = str.charCodeAt(i); 12838 } 12839 return ret; 12840 } 12841 const Sequences = { 12842 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 12843 // CDATA[ 12844 CdataEnd: new Uint8Array([93, 93, 62]), 12845 // ]]> 12846 CommentEnd: new Uint8Array([45, 45, 62]), 12847 // `-->` 12848 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 12849 // `<\/script` 12850 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 12851 // `</style` 12852 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 12853 // `</title` 12854 TextareaEnd: new Uint8Array([ 12855 60, 12856 47, 12857 116, 12858 101, 12859 120, 12860 116, 12861 97, 12862 114, 12863 101, 12864 97 12865 ]) 12866 // `</textarea 12867 }; 12868 class Tokenizer { 12869 constructor(stack, cbs) { 12870 this.stack = stack; 12871 this.cbs = cbs; 12872 /** The current state the tokenizer is in. */ 12873 this.state = 1; 12874 /** The read buffer. */ 12875 this.buffer = ""; 12876 /** The beginning of the section that is currently being read. */ 12877 this.sectionStart = 0; 12878 /** The index within the buffer that we are currently looking at. */ 12879 this.index = 0; 12880 /** The start of the last entity. */ 12881 this.entityStart = 0; 12882 /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */ 12883 this.baseState = 1; 12884 /** For special parsing behavior inside of script and style tags. */ 12885 this.inRCDATA = false; 12886 /** For disabling RCDATA tags handling */ 12887 this.inXML = false; 12888 /** For disabling interpolation parsing in v-pre */ 12889 this.inVPre = false; 12890 /** Record newline positions for fast line / column calculation */ 12891 this.newlines = []; 12892 this.mode = 0; 12893 this.delimiterOpen = defaultDelimitersOpen; 12894 this.delimiterClose = defaultDelimitersClose; 12895 this.delimiterIndex = -1; 12896 this.currentSequence = void 0; 12897 this.sequenceIndex = 0; 12898 } 12899 get inSFCRoot() { 12900 return this.mode === 2 && this.stack.length === 0; 12901 } 12902 reset() { 12903 this.state = 1; 12904 this.mode = 0; 12905 this.buffer = ""; 12906 this.sectionStart = 0; 12907 this.index = 0; 12908 this.baseState = 1; 12909 this.inRCDATA = false; 12910 this.currentSequence = void 0; 12911 this.newlines.length = 0; 12912 this.delimiterOpen = defaultDelimitersOpen; 12913 this.delimiterClose = defaultDelimitersClose; 12914 } 12915 /** 12916 * Generate Position object with line / column information using recorded 12917 * newline positions. We know the index is always going to be an already 12918 * processed index, so all the newlines up to this index should have been 12919 * recorded. 12920 */ 12921 getPos(index) { 12922 let line = 1; 12923 let column = index + 1; 12924 for (let i = this.newlines.length - 1; i >= 0; i--) { 12925 const newlineIndex = this.newlines[i]; 12926 if (index > newlineIndex) { 12927 line = i + 2; 12928 column = index - newlineIndex; 12929 break; 12930 } 12931 } 12932 return { 12933 column, 12934 line, 12935 offset: index 12936 }; 12937 } 12938 peek() { 12939 return this.buffer.charCodeAt(this.index + 1); 12940 } 12941 stateText(c) { 12942 if (c === 60) { 12943 if (this.index > this.sectionStart) { 12944 this.cbs.ontext(this.sectionStart, this.index); 12945 } 12946 this.state = 5; 12947 this.sectionStart = this.index; 12948 } else if (!this.inVPre && c === this.delimiterOpen[0]) { 12949 this.state = 2; 12950 this.delimiterIndex = 0; 12951 this.stateInterpolationOpen(c); 12952 } 12953 } 12954 stateInterpolationOpen(c) { 12955 if (c === this.delimiterOpen[this.delimiterIndex]) { 12956 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 12957 const start = this.index + 1 - this.delimiterOpen.length; 12958 if (start > this.sectionStart) { 12959 this.cbs.ontext(this.sectionStart, start); 12960 } 12961 this.state = 3; 12962 this.sectionStart = start; 12963 } else { 12964 this.delimiterIndex++; 12965 } 12966 } else if (this.inRCDATA) { 12967 this.state = 32; 12968 this.stateInRCDATA(c); 12969 } else { 12970 this.state = 1; 12971 this.stateText(c); 12972 } 12973 } 12974 stateInterpolation(c) { 12975 if (c === this.delimiterClose[0]) { 12976 this.state = 4; 12977 this.delimiterIndex = 0; 12978 this.stateInterpolationClose(c); 12979 } 12980 } 12981 stateInterpolationClose(c) { 12982 if (c === this.delimiterClose[this.delimiterIndex]) { 12983 if (this.delimiterIndex === this.delimiterClose.length - 1) { 12984 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 12985 if (this.inRCDATA) { 12986 this.state = 32; 12987 } else { 12988 this.state = 1; 12989 } 12990 this.sectionStart = this.index + 1; 12991 } else { 12992 this.delimiterIndex++; 12993 } 12994 } else { 12995 this.state = 3; 12996 this.stateInterpolation(c); 12997 } 12998 } 12999 stateSpecialStartSequence(c) { 13000 const isEnd = this.sequenceIndex === this.currentSequence.length; 13001 const isMatch = isEnd ? ( 13002 // If we are at the end of the sequence, make sure the tag name has ended 13003 isEndOfTagSection(c) 13004 ) : ( 13005 // Otherwise, do a case-insensitive comparison 13006 (c | 32) === this.currentSequence[this.sequenceIndex] 13007 ); 13008 if (!isMatch) { 13009 this.inRCDATA = false; 13010 } else if (!isEnd) { 13011 this.sequenceIndex++; 13012 return; 13013 } 13014 this.sequenceIndex = 0; 13015 this.state = 6; 13016 this.stateInTagName(c); 13017 } 13018 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 13019 stateInRCDATA(c) { 13020 if (this.sequenceIndex === this.currentSequence.length) { 13021 if (c === 62 || isWhitespace(c)) { 13022 const endOfText = this.index - this.currentSequence.length; 13023 if (this.sectionStart < endOfText) { 13024 const actualIndex = this.index; 13025 this.index = endOfText; 13026 this.cbs.ontext(this.sectionStart, endOfText); 13027 this.index = actualIndex; 13028 } 13029 this.sectionStart = endOfText + 2; 13030 this.stateInClosingTagName(c); 13031 this.inRCDATA = false; 13032 return; 13033 } 13034 this.sequenceIndex = 0; 13035 } 13036 if ((c | 32) === this.currentSequence[this.sequenceIndex]) { 13037 this.sequenceIndex += 1; 13038 } else if (this.sequenceIndex === 0) { 13039 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 13040 if (!this.inVPre && c === this.delimiterOpen[0]) { 13041 this.state = 2; 13042 this.delimiterIndex = 0; 13043 this.stateInterpolationOpen(c); 13044 } 13045 } else if (this.fastForwardTo(60)) { 13046 this.sequenceIndex = 1; 13047 } 13048 } else { 13049 this.sequenceIndex = Number(c === 60); 13050 } 13051 } 13052 stateCDATASequence(c) { 13053 if (c === Sequences.Cdata[this.sequenceIndex]) { 13054 if (++this.sequenceIndex === Sequences.Cdata.length) { 13055 this.state = 28; 13056 this.currentSequence = Sequences.CdataEnd; 13057 this.sequenceIndex = 0; 13058 this.sectionStart = this.index + 1; 13059 } 13060 } else { 13061 this.sequenceIndex = 0; 13062 this.state = 23; 13063 this.stateInDeclaration(c); 13064 } 13065 } 13066 /** 13067 * When we wait for one specific character, we can speed things up 13068 * by skipping through the buffer until we find it. 13069 * 13070 * @returns Whether the character was found. 13071 */ 13072 fastForwardTo(c) { 13073 while (++this.index < this.buffer.length) { 13074 const cc = this.buffer.charCodeAt(this.index); 13075 if (cc === 10) { 13076 this.newlines.push(this.index); 13077 } 13078 if (cc === c) { 13079 return true; 13080 } 13081 } 13082 this.index = this.buffer.length - 1; 13083 return false; 13084 } 13085 /** 13086 * Comments and CDATA end with `-->` and `]]>`. 13087 * 13088 * Their common qualities are: 13089 * - Their end sequences have a distinct character they start with. 13090 * - That character is then repeated, so we have to check multiple repeats. 13091 * - All characters but the start character of the sequence can be skipped. 13092 */ 13093 stateInCommentLike(c) { 13094 if (c === this.currentSequence[this.sequenceIndex]) { 13095 if (++this.sequenceIndex === this.currentSequence.length) { 13096 if (this.currentSequence === Sequences.CdataEnd) { 13097 this.cbs.oncdata(this.sectionStart, this.index - 2); 13098 } else { 13099 this.cbs.oncomment(this.sectionStart, this.index - 2); 13100 } 13101 this.sequenceIndex = 0; 13102 this.sectionStart = this.index + 1; 13103 this.state = 1; 13104 } 13105 } else if (this.sequenceIndex === 0) { 13106 if (this.fastForwardTo(this.currentSequence[0])) { 13107 this.sequenceIndex = 1; 13108 } 13109 } else if (c !== this.currentSequence[this.sequenceIndex - 1]) { 13110 this.sequenceIndex = 0; 13111 } 13112 } 13113 startSpecial(sequence, offset) { 13114 this.enterRCDATA(sequence, offset); 13115 this.state = 31; 13116 } 13117 enterRCDATA(sequence, offset) { 13118 this.inRCDATA = true; 13119 this.currentSequence = sequence; 13120 this.sequenceIndex = offset; 13121 } 13122 stateBeforeTagName(c) { 13123 if (c === 33) { 13124 this.state = 22; 13125 this.sectionStart = this.index + 1; 13126 } else if (c === 63) { 13127 this.state = 24; 13128 this.sectionStart = this.index + 1; 13129 } else if (isTagStartChar(c)) { 13130 this.sectionStart = this.index; 13131 if (this.mode === 0) { 13132 this.state = 6; 13133 } else if (this.inSFCRoot) { 13134 this.state = 34; 13135 } else if (!this.inXML) { 13136 if (c === 116) { 13137 this.state = 30; 13138 } else { 13139 this.state = c === 115 ? 29 : 6; 13140 } 13141 } else { 13142 this.state = 6; 13143 } 13144 } else if (c === 47) { 13145 this.state = 8; 13146 } else { 13147 this.state = 1; 13148 this.stateText(c); 13149 } 13150 } 13151 stateInTagName(c) { 13152 if (isEndOfTagSection(c)) { 13153 this.handleTagName(c); 13154 } 13155 } 13156 stateInSFCRootTagName(c) { 13157 if (isEndOfTagSection(c)) { 13158 const tag = this.buffer.slice(this.sectionStart, this.index); 13159 if (tag !== "template") { 13160 this.enterRCDATA(toCharCodes(`</` + tag), 0); 13161 } 13162 this.handleTagName(c); 13163 } 13164 } 13165 handleTagName(c) { 13166 this.cbs.onopentagname(this.sectionStart, this.index); 13167 this.sectionStart = -1; 13168 this.state = 11; 13169 this.stateBeforeAttrName(c); 13170 } 13171 stateBeforeClosingTagName(c) { 13172 if (isWhitespace(c)); else if (c === 62) { 13173 { 13174 this.cbs.onerr(14, this.index); 13175 } 13176 this.state = 1; 13177 this.sectionStart = this.index + 1; 13178 } else { 13179 this.state = isTagStartChar(c) ? 9 : 27; 13180 this.sectionStart = this.index; 13181 } 13182 } 13183 stateInClosingTagName(c) { 13184 if (c === 62 || isWhitespace(c)) { 13185 this.cbs.onclosetag(this.sectionStart, this.index); 13186 this.sectionStart = -1; 13187 this.state = 10; 13188 this.stateAfterClosingTagName(c); 13189 } 13190 } 13191 stateAfterClosingTagName(c) { 13192 if (c === 62) { 13193 this.state = 1; 13194 this.sectionStart = this.index + 1; 13195 } 13196 } 13197 stateBeforeAttrName(c) { 13198 if (c === 62) { 13199 this.cbs.onopentagend(this.index); 13200 if (this.inRCDATA) { 13201 this.state = 32; 13202 } else { 13203 this.state = 1; 13204 } 13205 this.sectionStart = this.index + 1; 13206 } else if (c === 47) { 13207 this.state = 7; 13208 if (this.peek() !== 62) { 13209 this.cbs.onerr(22, this.index); 13210 } 13211 } else if (c === 60 && this.peek() === 47) { 13212 this.cbs.onopentagend(this.index); 13213 this.state = 5; 13214 this.sectionStart = this.index; 13215 } else if (!isWhitespace(c)) { 13216 if (c === 61) { 13217 this.cbs.onerr( 13218 19, 13219 this.index 13220 ); 13221 } 13222 this.handleAttrStart(c); 13223 } 13224 } 13225 handleAttrStart(c) { 13226 if (c === 118 && this.peek() === 45) { 13227 this.state = 13; 13228 this.sectionStart = this.index; 13229 } else if (c === 46 || c === 58 || c === 64 || c === 35) { 13230 this.cbs.ondirname(this.index, this.index + 1); 13231 this.state = 14; 13232 this.sectionStart = this.index + 1; 13233 } else { 13234 this.state = 12; 13235 this.sectionStart = this.index; 13236 } 13237 } 13238 stateInSelfClosingTag(c) { 13239 if (c === 62) { 13240 this.cbs.onselfclosingtag(this.index); 13241 this.state = 1; 13242 this.sectionStart = this.index + 1; 13243 this.inRCDATA = false; 13244 } else if (!isWhitespace(c)) { 13245 this.state = 11; 13246 this.stateBeforeAttrName(c); 13247 } 13248 } 13249 stateInAttrName(c) { 13250 if (c === 61 || isEndOfTagSection(c)) { 13251 this.cbs.onattribname(this.sectionStart, this.index); 13252 this.handleAttrNameEnd(c); 13253 } else if (c === 34 || c === 39 || c === 60) { 13254 this.cbs.onerr( 13255 17, 13256 this.index 13257 ); 13258 } 13259 } 13260 stateInDirName(c) { 13261 if (c === 61 || isEndOfTagSection(c)) { 13262 this.cbs.ondirname(this.sectionStart, this.index); 13263 this.handleAttrNameEnd(c); 13264 } else if (c === 58) { 13265 this.cbs.ondirname(this.sectionStart, this.index); 13266 this.state = 14; 13267 this.sectionStart = this.index + 1; 13268 } else if (c === 46) { 13269 this.cbs.ondirname(this.sectionStart, this.index); 13270 this.state = 16; 13271 this.sectionStart = this.index + 1; 13272 } 13273 } 13274 stateInDirArg(c) { 13275 if (c === 61 || isEndOfTagSection(c)) { 13276 this.cbs.ondirarg(this.sectionStart, this.index); 13277 this.handleAttrNameEnd(c); 13278 } else if (c === 91) { 13279 this.state = 15; 13280 } else if (c === 46) { 13281 this.cbs.ondirarg(this.sectionStart, this.index); 13282 this.state = 16; 13283 this.sectionStart = this.index + 1; 13284 } 13285 } 13286 stateInDynamicDirArg(c) { 13287 if (c === 93) { 13288 this.state = 14; 13289 } else if (c === 61 || isEndOfTagSection(c)) { 13290 this.cbs.ondirarg(this.sectionStart, this.index + 1); 13291 this.handleAttrNameEnd(c); 13292 { 13293 this.cbs.onerr( 13294 27, 13295 this.index 13296 ); 13297 } 13298 } 13299 } 13300 stateInDirModifier(c) { 13301 if (c === 61 || isEndOfTagSection(c)) { 13302 this.cbs.ondirmodifier(this.sectionStart, this.index); 13303 this.handleAttrNameEnd(c); 13304 } else if (c === 46) { 13305 this.cbs.ondirmodifier(this.sectionStart, this.index); 13306 this.sectionStart = this.index + 1; 13307 } 13308 } 13309 handleAttrNameEnd(c) { 13310 this.sectionStart = this.index; 13311 this.state = 17; 13312 this.cbs.onattribnameend(this.index); 13313 this.stateAfterAttrName(c); 13314 } 13315 stateAfterAttrName(c) { 13316 if (c === 61) { 13317 this.state = 18; 13318 } else if (c === 47 || c === 62) { 13319 this.cbs.onattribend(0, this.sectionStart); 13320 this.sectionStart = -1; 13321 this.state = 11; 13322 this.stateBeforeAttrName(c); 13323 } else if (!isWhitespace(c)) { 13324 this.cbs.onattribend(0, this.sectionStart); 13325 this.handleAttrStart(c); 13326 } 13327 } 13328 stateBeforeAttrValue(c) { 13329 if (c === 34) { 13330 this.state = 19; 13331 this.sectionStart = this.index + 1; 13332 } else if (c === 39) { 13333 this.state = 20; 13334 this.sectionStart = this.index + 1; 13335 } else if (!isWhitespace(c)) { 13336 this.sectionStart = this.index; 13337 this.state = 21; 13338 this.stateInAttrValueNoQuotes(c); 13339 } 13340 } 13341 handleInAttrValue(c, quote) { 13342 if (c === quote || this.fastForwardTo(quote)) { 13343 this.cbs.onattribdata(this.sectionStart, this.index); 13344 this.sectionStart = -1; 13345 this.cbs.onattribend( 13346 quote === 34 ? 3 : 2, 13347 this.index + 1 13348 ); 13349 this.state = 11; 13350 } 13351 } 13352 stateInAttrValueDoubleQuotes(c) { 13353 this.handleInAttrValue(c, 34); 13354 } 13355 stateInAttrValueSingleQuotes(c) { 13356 this.handleInAttrValue(c, 39); 13357 } 13358 stateInAttrValueNoQuotes(c) { 13359 if (isWhitespace(c) || c === 62) { 13360 this.cbs.onattribdata(this.sectionStart, this.index); 13361 this.sectionStart = -1; 13362 this.cbs.onattribend(1, this.index); 13363 this.state = 11; 13364 this.stateBeforeAttrName(c); 13365 } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) { 13366 this.cbs.onerr( 13367 18, 13368 this.index 13369 ); 13370 } else; 13371 } 13372 stateBeforeDeclaration(c) { 13373 if (c === 91) { 13374 this.state = 26; 13375 this.sequenceIndex = 0; 13376 } else { 13377 this.state = c === 45 ? 25 : 23; 13378 } 13379 } 13380 stateInDeclaration(c) { 13381 if (c === 62 || this.fastForwardTo(62)) { 13382 this.state = 1; 13383 this.sectionStart = this.index + 1; 13384 } 13385 } 13386 stateInProcessingInstruction(c) { 13387 if (c === 62 || this.fastForwardTo(62)) { 13388 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 13389 this.state = 1; 13390 this.sectionStart = this.index + 1; 13391 } 13392 } 13393 stateBeforeComment(c) { 13394 if (c === 45) { 13395 this.state = 28; 13396 this.currentSequence = Sequences.CommentEnd; 13397 this.sequenceIndex = 2; 13398 this.sectionStart = this.index + 1; 13399 } else { 13400 this.state = 23; 13401 } 13402 } 13403 stateInSpecialComment(c) { 13404 if (c === 62 || this.fastForwardTo(62)) { 13405 this.cbs.oncomment(this.sectionStart, this.index); 13406 this.state = 1; 13407 this.sectionStart = this.index + 1; 13408 } 13409 } 13410 stateBeforeSpecialS(c) { 13411 if (c === Sequences.ScriptEnd[3]) { 13412 this.startSpecial(Sequences.ScriptEnd, 4); 13413 } else if (c === Sequences.StyleEnd[3]) { 13414 this.startSpecial(Sequences.StyleEnd, 4); 13415 } else { 13416 this.state = 6; 13417 this.stateInTagName(c); 13418 } 13419 } 13420 stateBeforeSpecialT(c) { 13421 if (c === Sequences.TitleEnd[3]) { 13422 this.startSpecial(Sequences.TitleEnd, 4); 13423 } else if (c === Sequences.TextareaEnd[3]) { 13424 this.startSpecial(Sequences.TextareaEnd, 4); 13425 } else { 13426 this.state = 6; 13427 this.stateInTagName(c); 13428 } 13429 } 13430 startEntity() { 13431 } 13432 stateInEntity() { 13433 } 13434 /** 13435 * Iterates through the buffer, calling the function corresponding to the current state. 13436 * 13437 * States that are more likely to be hit are higher up, as a performance improvement. 13438 */ 13439 parse(input) { 13440 this.buffer = input; 13441 while (this.index < this.buffer.length) { 13442 const c = this.buffer.charCodeAt(this.index); 13443 if (c === 10 && this.state !== 33) { 13444 this.newlines.push(this.index); 13445 } 13446 switch (this.state) { 13447 case 1: { 13448 this.stateText(c); 13449 break; 13450 } 13451 case 2: { 13452 this.stateInterpolationOpen(c); 13453 break; 13454 } 13455 case 3: { 13456 this.stateInterpolation(c); 13457 break; 13458 } 13459 case 4: { 13460 this.stateInterpolationClose(c); 13461 break; 13462 } 13463 case 31: { 13464 this.stateSpecialStartSequence(c); 13465 break; 13466 } 13467 case 32: { 13468 this.stateInRCDATA(c); 13469 break; 13470 } 13471 case 26: { 13472 this.stateCDATASequence(c); 13473 break; 13474 } 13475 case 19: { 13476 this.stateInAttrValueDoubleQuotes(c); 13477 break; 13478 } 13479 case 12: { 13480 this.stateInAttrName(c); 13481 break; 13482 } 13483 case 13: { 13484 this.stateInDirName(c); 13485 break; 13486 } 13487 case 14: { 13488 this.stateInDirArg(c); 13489 break; 13490 } 13491 case 15: { 13492 this.stateInDynamicDirArg(c); 13493 break; 13494 } 13495 case 16: { 13496 this.stateInDirModifier(c); 13497 break; 13498 } 13499 case 28: { 13500 this.stateInCommentLike(c); 13501 break; 13502 } 13503 case 27: { 13504 this.stateInSpecialComment(c); 13505 break; 13506 } 13507 case 11: { 13508 this.stateBeforeAttrName(c); 13509 break; 13510 } 13511 case 6: { 13512 this.stateInTagName(c); 13513 break; 13514 } 13515 case 34: { 13516 this.stateInSFCRootTagName(c); 13517 break; 13518 } 13519 case 9: { 13520 this.stateInClosingTagName(c); 13521 break; 13522 } 13523 case 5: { 13524 this.stateBeforeTagName(c); 13525 break; 13526 } 13527 case 17: { 13528 this.stateAfterAttrName(c); 13529 break; 13530 } 13531 case 20: { 13532 this.stateInAttrValueSingleQuotes(c); 13533 break; 13534 } 13535 case 18: { 13536 this.stateBeforeAttrValue(c); 13537 break; 13538 } 13539 case 8: { 13540 this.stateBeforeClosingTagName(c); 13541 break; 13542 } 13543 case 10: { 13544 this.stateAfterClosingTagName(c); 13545 break; 13546 } 13547 case 29: { 13548 this.stateBeforeSpecialS(c); 13549 break; 13550 } 13551 case 30: { 13552 this.stateBeforeSpecialT(c); 13553 break; 13554 } 13555 case 21: { 13556 this.stateInAttrValueNoQuotes(c); 13557 break; 13558 } 13559 case 7: { 13560 this.stateInSelfClosingTag(c); 13561 break; 13562 } 13563 case 23: { 13564 this.stateInDeclaration(c); 13565 break; 13566 } 13567 case 22: { 13568 this.stateBeforeDeclaration(c); 13569 break; 13570 } 13571 case 25: { 13572 this.stateBeforeComment(c); 13573 break; 13574 } 13575 case 24: { 13576 this.stateInProcessingInstruction(c); 13577 break; 13578 } 13579 case 33: { 13580 this.stateInEntity(); 13581 break; 13582 } 13583 } 13584 this.index++; 13585 } 13586 this.cleanup(); 13587 this.finish(); 13588 } 13589 /** 13590 * Remove data that has already been consumed from the buffer. 13591 */ 13592 cleanup() { 13593 if (this.sectionStart !== this.index) { 13594 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 13595 this.cbs.ontext(this.sectionStart, this.index); 13596 this.sectionStart = this.index; 13597 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 13598 this.cbs.onattribdata(this.sectionStart, this.index); 13599 this.sectionStart = this.index; 13600 } 13601 } 13602 } 13603 finish() { 13604 this.handleTrailingData(); 13605 this.cbs.onend(); 13606 } 13607 /** Handle any trailing data. */ 13608 handleTrailingData() { 13609 const endIndex = this.buffer.length; 13610 if (this.sectionStart >= endIndex) { 13611 return; 13612 } 13613 if (this.state === 28) { 13614 if (this.currentSequence === Sequences.CdataEnd) { 13615 this.cbs.oncdata(this.sectionStart, endIndex); 13616 } else { 13617 this.cbs.oncomment(this.sectionStart, endIndex); 13618 } 13619 } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9); else { 13620 this.cbs.ontext(this.sectionStart, endIndex); 13621 } 13622 }
13623 emitCodePoint(cp, consumed) { 13624 } 13625 } 13626 13627 function defaultOnError(error) { 13628 throw error; 13629 } 13630 function defaultOnWarn(msg) { 13631 console.warn(`[Vue warn] ${msg.message}`); 13632 } 13633 function createCompilerError(code, loc, messages, additionalMessage) { 13634 const msg = (messages || errorMessages)[code] + (additionalMessage || ``); 13635 const error = new SyntaxError(String(msg)); 13636 error.code = code; 13637 error.loc = loc; 13638 return error; 13639 } 13640 const errorMessages = { 13641 // parse errors 13642 [0]: "Illegal comment.", 13643 [1]: "CDATA section is allowed only in XML context.", 13644 [2]: "Duplicate attribute.", 13645 [3]: "End tag cannot have attributes.", 13646 [4]: "Illegal '/' in tags.", 13647 [5]: "Unexpected EOF in tag.", 13648 [6]: "Unexpected EOF in CDATA section.", 13649 [7]: "Unexpected EOF in comment.", 13650 [8]: "Unexpected EOF in script.", 13651 [9]: "Unexpected EOF in tag.", 13652 [10]: "Incorrectly closed comment.", 13653 [11]: "Incorrectly opened comment.", 13654 [12]: "Illegal tag name. Use '<' to print '<'.", 13655 [13]: "Attribute value was expected.", 13656 [14]: "End tag name was expected.", 13657 [15]: "Whitespace was expected.", 13658 [16]: "Unexpected '<!--' in comment.", 13659 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 13660 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 13661 [19]: "Attribute name cannot start with '='.", 13662 [21]: "'<?' is allowed only in XML context.", 13663 [20]: `Unexpected null character.`, 13664 [22]: "Illegal '/' in tags.", 13665 // Vue-specific parse errors 13666 [23]: "Invalid end tag.", 13667 [24]: "Element is missing end tag.", 13668 [25]: "Interpolation end sign was not found.", 13669 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 13670 [26]: "Legal directive name was expected.", 13671 // transform errors 13672 [28]: `v-if/v-else-if is missing expression.`, 13673 [29]: `v-if/else branches must use unique keys.`, 13674 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 13675 [31]: `v-for is missing expression.`, 13676 [32]: `v-for has invalid expression.`, 13677 [33]: `<template v-for> key should be placed on the <template> tag.`, 13678 [34]: `v-bind is missing expression.`, 13679 [52]: `v-bind with same-name shorthand only allows static argument.`, 13680 [35]: `v-on is missing expression.`, 13681 [36]: `Unexpected custom directive on <slot> outlet.`, 13682 [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`, 13683 [38]: `Duplicate slot names found. `, 13684 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 13685 [40]: `v-slot can only be used on components or <template> tags.`, 13686 [41]: `v-model is missing expression.`, 13687 [42]: `v-model value must be a valid JavaScript member expression.`, 13688 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 13689 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 13690Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 13691 [45]: `Error parsing JavaScript expression: `, 13692 [46]: `<KeepAlive> expects exactly one child component.`, 13693 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`, 13694 // generic errors 13695 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 13696 [48]: `ES module mode is not supported in this build of compiler.`,
vendor: 6,190 bytes, lines 13697-13844
13697 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 13698 [50]: `"scopeId" option is only supported in module mode.`, 13699 // just to fulfill types 13700 [53]: `` 13701 }; 13702 13703 const isStaticExp = (p) => p.type === 4 && p.isStatic; 13704 function isCoreComponent(tag) { 13705 switch (tag) { 13706 case "Teleport": 13707 case "teleport": 13708 return TELEPORT; 13709 case "Suspense": 13710 case "suspense": 13711 return SUSPENSE; 13712 case "KeepAlive": 13713 case "keep-alive": 13714 return KEEP_ALIVE; 13715 case "BaseTransition": 13716 case "base-transition": 13717 return BASE_TRANSITION; 13718 } 13719 } 13720 const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/; 13721 const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 13722 const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 13723 const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 13724 const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 13725 const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 13726 const isMemberExpressionBrowser = (exp) => { 13727 const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim()); 13728 let state = 0 /* inMemberExp */; 13729 let stateStack = []; 13730 let currentOpenBracketCount = 0; 13731 let currentOpenParensCount = 0; 13732 let currentStringType = null; 13733 for (let i = 0; i < path.length; i++) { 13734 const char = path.charAt(i); 13735 switch (state) { 13736 case 0 /* inMemberExp */: 13737 if (char === "[") { 13738 stateStack.push(state); 13739 state = 1 /* inBrackets */; 13740 currentOpenBracketCount++; 13741 } else if (char === "(") { 13742 stateStack.push(state); 13743 state = 2 /* inParens */; 13744 currentOpenParensCount++; 13745 } else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 13746 return false; 13747 } 13748 break; 13749 case 1 /* inBrackets */: 13750 if (char === `'` || char === `"` || char === "`") { 13751 stateStack.push(state); 13752 state = 3 /* inString */; 13753 currentStringType = char; 13754 } else if (char === `[`) { 13755 currentOpenBracketCount++; 13756 } else if (char === `]`) { 13757 if (!--currentOpenBracketCount) { 13758 state = stateStack.pop(); 13759 } 13760 } 13761 break; 13762 case 2 /* inParens */: 13763 if (char === `'` || char === `"` || char === "`") { 13764 stateStack.push(state); 13765 state = 3 /* inString */; 13766 currentStringType = char; 13767 } else if (char === `(`) { 13768 currentOpenParensCount++; 13769 } else if (char === `)`) { 13770 if (i === path.length - 1) { 13771 return false; 13772 } 13773 if (!--currentOpenParensCount) { 13774 state = stateStack.pop(); 13775 } 13776 } 13777 break; 13778 case 3 /* inString */: 13779 if (char === currentStringType) { 13780 state = stateStack.pop(); 13781 currentStringType = null; 13782 } 13783 break; 13784 } 13785 } 13786 return !currentOpenBracketCount && !currentOpenParensCount; 13787 }; 13788 const isMemberExpression = isMemberExpressionBrowser; 13789 const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/; 13790 const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 13791 const isFnExpression = isFnExpressionBrowser; 13792 function assert(condition, msg) { 13793 if (!condition) { 13794 throw new Error(msg || `unexpected compiler condition`); 13795 } 13796 } 13797 function findDir(node, name, allowEmpty = false) { 13798 for (let i = 0; i < node.props.length; i++) { 13799 const p = node.props[i]; 13800 if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) { 13801 return p; 13802 } 13803 } 13804 } 13805 function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 13806 for (let i = 0; i < node.props.length; i++) { 13807 const p = node.props[i]; 13808 if (p.type === 6) { 13809 if (dynamicOnly) continue; 13810 if (p.name === name && (p.value || allowEmpty)) { 13811 return p; 13812 } 13813 } else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) { 13814 return p; 13815 } 13816 } 13817 } 13818 function isStaticArgOf(arg, name) { 13819 return !!(arg && isStaticExp(arg) && arg.content === name); 13820 } 13821 function hasDynamicKeyVBind(node) { 13822 return node.props.some( 13823 (p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj" 13824 p.arg.type !== 4 || // v-bind:[_ctx.foo] 13825 !p.arg.isStatic) 13826 // v-bind:[foo] 13827 ); 13828 } 13829 function isText$1(node) { 13830 return node.type === 5 || node.type === 2; 13831 } 13832 function isVPre(p) { 13833 return p.type === 7 && p.name === "pre"; 13834 } 13835 function isVSlot(p) { 13836 return p.type === 7 && p.name === "slot"; 13837 } 13838 function isTemplateNode(node) { 13839 return node.type === 1 && node.tagType === 3; 13840 } 13841 function isSlotOutlet(node) { 13842 return node.type === 1 && node.tagType === 2; 13843 } 13844 const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROP
vendor: 4,494 bytes, lines 13844-13966
13844S]); 13845 function getUnnormalizedProps(props, callPath = []) { 13846 if (props && !isString(props) && props.type === 14) { 13847 const callee = props.callee; 13848 if (!isString(callee) && propsHelperSet.has(callee)) { 13849 return getUnnormalizedProps( 13850 props.arguments[0], 13851 callPath.concat(props) 13852 ); 13853 } 13854 } 13855 return [props, callPath]; 13856 } 13857 function injectProp(node, prop, context) { 13858 let propsWithInjection; 13859 let props = node.type === 13 ? node.props : node.arguments[2]; 13860 let callPath = []; 13861 let parentCall; 13862 if (props && !isString(props) && props.type === 14) { 13863 const ret = getUnnormalizedProps(props); 13864 props = ret[0]; 13865 callPath = ret[1]; 13866 parentCall = callPath[callPath.length - 1]; 13867 } 13868 if (props == null || isString(props)) { 13869 propsWithInjection = createObjectExpression([prop]); 13870 } else if (props.type === 14) { 13871 const first = props.arguments[0]; 13872 if (!isString(first) && first.type === 15) { 13873 if (!hasProp(prop, first)) { 13874 first.properties.unshift(prop); 13875 } 13876 } else { 13877 if (props.callee === TO_HANDLERS) { 13878 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13879 createObjectExpression([prop]), 13880 props 13881 ]); 13882 } else { 13883 props.arguments.unshift(createObjectExpression([prop])); 13884 } 13885 } 13886 !propsWithInjection && (propsWithInjection = props); 13887 } else if (props.type === 15) { 13888 if (!hasProp(prop, props)) { 13889 props.properties.unshift(prop); 13890 } 13891 propsWithInjection = props; 13892 } else { 13893 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 13894 createObjectExpression([prop]), 13895 props 13896 ]); 13897 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 13898 parentCall = callPath[callPath.length - 2]; 13899 } 13900 } 13901 if (node.type === 13) { 13902 if (parentCall) { 13903 parentCall.arguments[0] = propsWithInjection; 13904 } else { 13905 node.props = propsWithInjection; 13906 } 13907 } else { 13908 if (parentCall) { 13909 parentCall.arguments[0] = propsWithInjection; 13910 } else { 13911 node.arguments[2] = propsWithInjection; 13912 } 13913 } 13914 } 13915 function hasProp(prop, props) { 13916 let result = false; 13917 if (prop.key.type === 4) { 13918 const propKeyName = prop.key.content; 13919 result = props.properties.some( 13920 (p) => p.key.type === 4 && p.key.content === propKeyName 13921 ); 13922 } 13923 return result; 13924 } 13925 function toValidAssetId(name, type) { 13926 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 13927 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 13928 })}`; 13929 } 13930 function getMemoedVNodeCall(node) { 13931 if (node.type === 14 && node.callee === WITH_MEMO) { 13932 return node.arguments[1].returns; 13933 } else { 13934 return node; 13935 } 13936 } 13937 const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 13938 function isAllWhitespace(str) { 13939 for (let i = 0; i < str.length; i++) { 13940 if (!isWhitespace(str.charCodeAt(i))) { 13941 return false; 13942 } 13943 } 13944 return true; 13945 } 13946 function isWhitespaceText(node) { 13947 return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content); 13948 } 13949 function isCommentOrWhitespace(node) { 13950 return node.type === 3 || isWhitespaceText(node); 13951 } 13952 13953 const defaultParserOptions = { 13954 parseMode: "base", 13955 ns: 0, 13956 delimiters: [`{{`, `}}`], 13957 getNamespace: () => 0, 13958 isVoidTag: NO, 13959 isPreTag: NO, 13960 isIgnoreNewlineTag: NO, 13961 isCustomElement: NO, 13962 onError: defaultOnError, 13963 onWarn: defaultOnWarn, 13964 comments: true, 13965 prefixIdentifiers: false 13966 };
vendor: 144,456 bytes, lines 13967-17710
13967 let currentOptions = defaultParserOptions; 13968 let currentRoot = null; 13969 let currentInput = ""; 13970 let currentOpenTag = null; 13971 let currentProp = null; 13972 let currentAttrValue = ""; 13973 let currentAttrStartIndex = -1; 13974 let currentAttrEndIndex = -1; 13975 let inPre = 0; 13976 let inVPre = false; 13977 let currentVPreBoundary = null; 13978 const stack = []; 13979 const tokenizer = new Tokenizer(stack, { 13980 onerr: emitError, 13981 ontext(start, end) { 13982 onText(getSlice(start, end), start, end); 13983 }, 13984 ontextentity(char, start, end) { 13985 onText(char, start, end); 13986 }, 13987 oninterpolation(start, end) { 13988 if (inVPre) { 13989 return onText(getSlice(start, end), start, end); 13990 } 13991 let innerStart = start + tokenizer.delimiterOpen.length; 13992 let innerEnd = end - tokenizer.delimiterClose.length; 13993 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 13994 innerStart++; 13995 } 13996 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 13997 innerEnd--; 13998 } 13999 let exp = getSlice(innerStart, innerEnd); 14000 if (exp.includes("&")) { 14001 { 14002 exp = currentOptions.decodeEntities(exp, false); 14003 } 14004 } 14005 addNode({ 14006 type: 5, 14007 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 14008 loc: getLoc(start, end) 14009 }); 14010 }, 14011 onopentagname(start, end) { 14012 const name = getSlice(start, end); 14013 currentOpenTag = { 14014 type: 1, 14015 tag: name, 14016 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 14017 tagType: 0, 14018 // will be refined on tag close 14019 props: [], 14020 children: [], 14021 loc: getLoc(start - 1, end), 14022 codegenNode: void 0 14023 }; 14024 }, 14025 onopentagend(end) { 14026 endOpenTag(end); 14027 }, 14028 onclosetag(start, end) { 14029 const name = getSlice(start, end); 14030 if (!currentOptions.isVoidTag(name)) { 14031 let found = false; 14032 for (let i = 0; i < stack.length; i++) { 14033 const e = stack[i]; 14034 if (e.tag.toLowerCase() === name.toLowerCase()) { 14035 found = true; 14036 if (i > 0) { 14037 emitError(24, stack[0].loc.start.offset); 14038 } 14039 for (let j = 0; j <= i; j++) { 14040 const el = stack.shift(); 14041 onCloseTag(el, end, j < i); 14042 } 14043 break; 14044 } 14045 } 14046 if (!found) { 14047 emitError(23, backTrack(start, 60)); 14048 } 14049 } 14050 }, 14051 onselfclosingtag(end) { 14052 const name = currentOpenTag.tag; 14053 currentOpenTag.isSelfClosing = true; 14054 endOpenTag(end); 14055 if (stack[0] && stack[0].tag === name) { 14056 onCloseTag(stack.shift(), end); 14057 } 14058 }, 14059 onattribname(start, end) { 14060 currentProp = { 14061 type: 6, 14062 name: getSlice(start, end), 14063 nameLoc: getLoc(start, end), 14064 value: void 0, 14065 loc: getLoc(start) 14066 }; 14067 }, 14068 ondirname(start, end) { 14069 const raw = getSlice(start, end); 14070 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 14071 if (!inVPre && name === "") { 14072 emitError(26, start); 14073 } 14074 if (inVPre || name === "") { 14075 currentProp = { 14076 type: 6, 14077 name: raw, 14078 nameLoc: getLoc(start, end), 14079 value: void 0, 14080 loc: getLoc(start) 14081 }; 14082 } else { 14083 currentProp = { 14084 type: 7, 14085 name, 14086 rawName: raw, 14087 exp: void 0, 14088 arg: void 0, 14089 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 14090 loc: getLoc(start) 14091 }; 14092 if (name === "pre") { 14093 inVPre = tokenizer.inVPre = true; 14094 currentVPreBoundary = currentOpenTag; 14095 const props = currentOpenTag.props; 14096 for (let i = 0; i < props.length; i++) { 14097 if (props[i].type === 7) { 14098 props[i] = dirToAttr(props[i]); 14099 } 14100 } 14101 } 14102 } 14103 }, 14104 ondirarg(start, end) { 14105 if (start === end) return; 14106 const arg = getSlice(start, end); 14107 if (inVPre && !isVPre(currentProp)) { 14108 currentProp.name += arg; 14109 setLocEnd(currentProp.nameLoc, end); 14110 } else { 14111 const isStatic = arg[0] !== `[`; 14112 currentProp.arg = createExp( 14113 isStatic ? arg : arg.slice(1, -1), 14114 isStatic, 14115 getLoc(start, end), 14116 isStatic ? 3 : 0 14117 ); 14118 } 14119 }, 14120 ondirmodifier(start, end) { 14121 const mod = getSlice(start, end); 14122 if (inVPre && !isVPre(currentProp)) { 14123 currentProp.name += "." + mod; 14124 setLocEnd(currentProp.nameLoc, end); 14125 } else if (currentProp.name === "slot") { 14126 const arg = currentProp.arg; 14127 if (arg) { 14128 arg.content += "." + mod; 14129 setLocEnd(arg.loc, end); 14130 } 14131 } else { 14132 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 14133 currentProp.modifiers.push(exp); 14134 } 14135 }, 14136 onattribdata(start, end) { 14137 currentAttrValue += getSlice(start, end); 14138 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14139 currentAttrEndIndex = end; 14140 }, 14141 onattribentity(char, start, end) { 14142 currentAttrValue += char; 14143 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 14144 currentAttrEndIndex = end; 14145 }, 14146 onattribnameend(end) { 14147 const start = currentProp.loc.start.offset; 14148 const name = getSlice(start, end); 14149 if (currentProp.type === 7) { 14150 currentProp.rawName = name; 14151 } 14152 if (currentOpenTag.props.some( 14153 (p) => (p.type === 7 ? p.rawName : p.name) === name 14154 )) { 14155 emitError(2, start); 14156 } 14157 }, 14158 onattribend(quote, end) { 14159 if (currentOpenTag && currentProp) { 14160 setLocEnd(currentProp.loc, end); 14161 if (quote !== 0) { 14162 if (currentAttrValue.includes("&")) { 14163 currentAttrValue = currentOptions.decodeEntities( 14164 currentAttrValue, 14165 true 14166 ); 14167 } 14168 if (currentProp.type === 6) { 14169 if (currentProp.name === "class") { 14170 currentAttrValue = condense(currentAttrValue).trim(); 14171 } 14172 if (quote === 1 && !currentAttrValue) { 14173 emitError(13, end); 14174 } 14175 currentProp.value = { 14176 type: 2, 14177 content: currentAttrValue, 14178 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 14179 }; 14180 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 14181 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 14182 } 14183 } else { 14184 let expParseMode = 0 /* Normal */; 14185 currentProp.exp = createExp( 14186 currentAttrValue, 14187 false, 14188 getLoc(currentAttrStartIndex, currentAttrEndIndex), 14189 0, 14190 expParseMode 14191 ); 14192 if (currentProp.name === "for") { 14193 currentProp.forParseResult = parseForExpression(currentProp.exp); 14194 } 14195 } 14196 } 14197 if (currentProp.type !== 7 || currentProp.name !== "pre") { 14198 currentOpenTag.props.push(currentProp); 14199 } 14200 } 14201 currentAttrValue = ""; 14202 currentAttrStartIndex = currentAttrEndIndex = -1; 14203 }, 14204 oncomment(start, end) { 14205 if (currentOptions.comments) { 14206 addNode({ 14207 type: 3, 14208 content: getSlice(start, end), 14209 loc: getLoc(start - 4, end + 3) 14210 }); 14211 } 14212 }, 14213 onend() { 14214 const end = currentInput.length; 14215 if (tokenizer.state !== 1) { 14216 switch (tokenizer.state) { 14217 case 5: 14218 case 8: 14219 emitError(5, end); 14220 break; 14221 case 3: 14222 case 4: 14223 emitError( 14224 25, 14225 tokenizer.sectionStart 14226 ); 14227 break; 14228 case 28: 14229 if (tokenizer.currentSequence === Sequences.CdataEnd) { 14230 emitError(6, end); 14231 } else { 14232 emitError(7, end); 14233 } 14234 break; 14235 case 6: 14236 case 7: 14237 case 9: 14238 case 11: 14239 case 12: 14240 case 13: 14241 case 14: 14242 case 15: 14243 case 16: 14244 case 17: 14245 case 18: 14246 case 19: 14247 // " 14248 case 20: 14249 // ' 14250 case 21: 14251 emitError(9, end); 14252 break; 14253 } 14254 } 14255 for (let index = 0; index < stack.length; index++) { 14256 onCloseTag(stack[index], end - 1); 14257 emitError(24, stack[index].loc.start.offset); 14258 } 14259 }, 14260 oncdata(start, end) { 14261 if (stack[0].ns !== 0) { 14262 onText(getSlice(start, end), start, end); 14263 } else { 14264 emitError(1, start - 9); 14265 } 14266 }, 14267 onprocessinginstruction(start) { 14268 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14269 emitError( 14270 21, 14271 start - 1 14272 ); 14273 } 14274 } 14275 }); 14276 const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 14277 const stripParensRE = /^\(|\)$/g; 14278 function parseForExpression(input) { 14279 const loc = input.loc; 14280 const exp = input.content; 14281 const inMatch = exp.match(forAliasRE); 14282 if (!inMatch) return; 14283 const [, LHS, RHS] = inMatch; 14284 const createAliasExpression = (content, offset, asParam = false) => { 14285 const start = loc.start.offset + offset; 14286 const end = start + content.length; 14287 return createExp( 14288 content, 14289 false, 14290 getLoc(start, end), 14291 0, 14292 asParam ? 1 /* Params */ : 0 /* Normal */ 14293 ); 14294 }; 14295 const result = { 14296 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 14297 value: void 0, 14298 key: void 0, 14299 index: void 0, 14300 finalized: false 14301 }; 14302 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 14303 const trimmedOffset = LHS.indexOf(valueContent); 14304 const iteratorMatch = valueContent.match(forIteratorRE); 14305 if (iteratorMatch) { 14306 valueContent = valueContent.replace(forIteratorRE, "").trim(); 14307 const keyContent = iteratorMatch[1].trim(); 14308 let keyOffset; 14309 if (keyContent) { 14310 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 14311 result.key = createAliasExpression(keyContent, keyOffset, true); 14312 } 14313 if (iteratorMatch[2]) { 14314 const indexContent = iteratorMatch[2].trim(); 14315 if (indexContent) { 14316 result.index = createAliasExpression( 14317 indexContent, 14318 exp.indexOf( 14319 indexContent, 14320 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 14321 ), 14322 true 14323 ); 14324 } 14325 } 14326 } 14327 if (valueContent) { 14328 result.value = createAliasExpression(valueContent, trimmedOffset, true); 14329 } 14330 return result; 14331 } 14332 function getSlice(start, end) { 14333 return currentInput.slice(start, end); 14334 } 14335 function endOpenTag(end) { 14336 if (tokenizer.inSFCRoot) { 14337 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 14338 } 14339 addNode(currentOpenTag); 14340 const { tag, ns } = currentOpenTag; 14341 if (ns === 0 && currentOptions.isPreTag(tag)) { 14342 inPre++; 14343 } 14344 if (currentOptions.isVoidTag(tag)) { 14345 onCloseTag(currentOpenTag, end); 14346 } else { 14347 stack.unshift(currentOpenTag); 14348 if (ns === 1 || ns === 2) { 14349 tokenizer.inXML = true; 14350 } 14351 } 14352 currentOpenTag = null; 14353 } 14354 function onText(content, start, end) { 14355 { 14356 const tag = stack[0] && stack[0].tag; 14357 if (tag !== "script" && tag !== "style" && content.includes("&")) { 14358 content = currentOptions.decodeEntities(content, false); 14359 } 14360 } 14361 const parent = stack[0] || currentRoot; 14362 const lastNode = parent.children[parent.children.length - 1]; 14363 if (lastNode && lastNode.type === 2) { 14364 lastNode.content += content; 14365 setLocEnd(lastNode.loc, end); 14366 } else { 14367 parent.children.push({ 14368 type: 2, 14369 content, 14370 loc: getLoc(start, end) 14371 }); 14372 } 14373 } 14374 function onCloseTag(el, end, isImplied = false) { 14375 if (isImplied) { 14376 setLocEnd(el.loc, backTrack(end, 60)); 14377 } else { 14378 setLocEnd(el.loc, lookAhead(end, 62) + 1); 14379 } 14380 if (tokenizer.inSFCRoot) { 14381 if (el.children.length) { 14382 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 14383 } else { 14384 el.innerLoc.end = extend({}, el.innerLoc.start); 14385 } 14386 el.innerLoc.source = getSlice( 14387 el.innerLoc.start.offset, 14388 el.innerLoc.end.offset 14389 ); 14390 } 14391 const { tag, ns, children } = el; 14392 if (!inVPre) { 14393 if (tag === "slot") { 14394 el.tagType = 2; 14395 } else if (isFragmentTemplate(el)) { 14396 el.tagType = 3; 14397 } else if (isComponent(el)) { 14398 el.tagType = 1; 14399 } 14400 } 14401 if (!tokenizer.inRCDATA) { 14402 el.children = condenseWhitespace(children); 14403 } 14404 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) { 14405 const first = children[0]; 14406 if (first && first.type === 2) { 14407 first.content = first.content.replace(/^\r?\n/, ""); 14408 } 14409 } 14410 if (ns === 0 && currentOptions.isPreTag(tag)) { 14411 inPre--; 14412 } 14413 if (currentVPreBoundary === el) { 14414 inVPre = tokenizer.inVPre = false; 14415 currentVPreBoundary = null; 14416 } 14417 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 14418 tokenizer.inXML = false; 14419 } 14420 } 14421 function lookAhead(index, c) { 14422 let i = index; 14423 while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++; 14424 return i; 14425 } 14426 function backTrack(index, c) { 14427 let i = index; 14428 while (currentInput.charCodeAt(i) !== c && i >= 0) i--; 14429 return i; 14430 } 14431 const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 14432 function isFragmentTemplate({ tag, props }) { 14433 if (tag === "template") { 14434 for (let i = 0; i < props.length; i++) { 14435 if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) { 14436 return true; 14437 } 14438 } 14439 } 14440 return false; 14441 } 14442 function isComponent({ tag, props }) { 14443 if (currentOptions.isCustomElement(tag)) { 14444 return false; 14445 } 14446 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 14447 return true; 14448 } 14449 for (let i = 0; i < props.length; i++) { 14450 const p = props[i]; 14451 if (p.type === 6) { 14452 if (p.name === "is" && p.value) { 14453 if (p.value.content.startsWith("vue:")) { 14454 return true; 14455 } 14456 } 14457 } 14458 } 14459 return false; 14460 } 14461 function isUpperCase(c) { 14462 return c > 64 && c < 91; 14463 } 14464 const windowsNewlineRE = /\r\n/g; 14465 function condenseWhitespace(nodes) { 14466 const shouldCondense = currentOptions.whitespace !== "preserve"; 14467 let removedWhitespace = false; 14468 for (let i = 0; i < nodes.length; i++) { 14469 const node = nodes[i]; 14470 if (node.type === 2) { 14471 if (!inPre) { 14472 if (isAllWhitespace(node.content)) { 14473 const prev = nodes[i - 1] && nodes[i - 1].type; 14474 const next = nodes[i + 1] && nodes[i + 1].type; 14475 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 14476 removedWhitespace = true; 14477 nodes[i] = null; 14478 } else { 14479 node.content = " "; 14480 } 14481 } else if (shouldCondense) { 14482 node.content = condense(node.content); 14483 } 14484 } else { 14485 node.content = node.content.replace(windowsNewlineRE, "\n"); 14486 } 14487 } 14488 } 14489 return removedWhitespace ? nodes.filter(Boolean) : nodes; 14490 } 14491 function hasNewlineChar(str) { 14492 for (let i = 0; i < str.length; i++) { 14493 const c = str.charCodeAt(i); 14494 if (c === 10 || c === 13) { 14495 return true; 14496 } 14497 } 14498 return false; 14499 } 14500 function condense(str) { 14501 let ret = ""; 14502 let prevCharIsWhitespace = false; 14503 for (let i = 0; i < str.length; i++) { 14504 if (isWhitespace(str.charCodeAt(i))) { 14505 if (!prevCharIsWhitespace) { 14506 ret += " "; 14507 prevCharIsWhitespace = true; 14508 } 14509 } else { 14510 ret += str[i]; 14511 prevCharIsWhitespace = false; 14512 } 14513 } 14514 return ret; 14515 } 14516 function addNode(node) { 14517 (stack[0] || currentRoot).children.push(node); 14518 } 14519 function getLoc(start, end) { 14520 return { 14521 start: tokenizer.getPos(start), 14522 // @ts-expect-error allow late attachment 14523 end: end == null ? end : tokenizer.getPos(end), 14524 // @ts-expect-error allow late attachment 14525 source: end == null ? end : getSlice(start, end) 14526 }; 14527 } 14528 function cloneLoc(loc) { 14529 return getLoc(loc.start.offset, loc.end.offset); 14530 } 14531 function setLocEnd(loc, end) { 14532 loc.end = tokenizer.getPos(end); 14533 loc.source = getSlice(loc.start.offset, end); 14534 } 14535 function dirToAttr(dir) { 14536 const attr = { 14537 type: 6, 14538 name: dir.rawName, 14539 nameLoc: getLoc( 14540 dir.loc.start.offset, 14541 dir.loc.start.offset + dir.rawName.length 14542 ), 14543 value: void 0, 14544 loc: dir.loc 14545 }; 14546 if (dir.exp) { 14547 const loc = dir.exp.loc; 14548 if (loc.end.offset < dir.loc.end.offset) { 14549 loc.start.offset--; 14550 loc.start.column--; 14551 loc.end.offset++; 14552 loc.end.column++; 14553 } 14554 attr.value = { 14555 type: 2, 14556 content: dir.exp.content, 14557 loc 14558 }; 14559 } 14560 return attr; 14561 } 14562 function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) { 14563 const exp = createSimpleExpression(content, isStatic, loc, constType); 14564 return exp; 14565 } 14566 function emitError(code, index, message) { 14567 currentOptions.onError( 14568 createCompilerError(code, getLoc(index, index), void 0, message) 14569 ); 14570 } 14571 function reset() { 14572 tokenizer.reset(); 14573 currentOpenTag = null; 14574 currentProp = null; 14575 currentAttrValue = ""; 14576 currentAttrStartIndex = -1; 14577 currentAttrEndIndex = -1; 14578 stack.length = 0; 14579 } 14580 function baseParse(input, options) { 14581 reset(); 14582 currentInput = input; 14583 currentOptions = extend({}, defaultParserOptions); 14584 if (options) { 14585 let key; 14586 for (key in options) { 14587 if (options[key] != null) { 14588 currentOptions[key] = options[key]; 14589 } 14590 } 14591 } 14592 { 14593 if (!currentOptions.decodeEntities) { 14594 throw new Error( 14595 `[@vue/compiler-core] decodeEntities option is required in browser builds.` 14596 ); 14597 } 14598 } 14599 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 14600 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 14601 const delimiters = options && options.delimiters; 14602 if (delimiters) { 14603 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 14604 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 14605 } 14606 const root = currentRoot = createRoot([], input); 14607 tokenizer.parse(currentInput); 14608 root.loc = getLoc(0, input.length); 14609 root.children = condenseWhitespace(root.children); 14610 currentRoot = null; 14611 return root; 14612 } 14613 14614 function cacheStatic(root, context) { 14615 walk( 14616 root, 14617 void 0, 14618 context, 14619 // Root node is unfortunately non-hoistable due to potential parent 14620 // fallthrough attributes. 14621 !!getSingleElementRoot(root) 14622 ); 14623 } 14624 function getSingleElementRoot(root) { 14625 const children = root.children.filter((x) => x.type !== 3); 14626 return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null; 14627 } 14628 function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 14629 const { children } = node; 14630 const toCache = []; 14631 for (let i = 0; i < children.length; i++) { 14632 const child = children[i]; 14633 if (child.type === 1 && child.tagType === 0) { 14634 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14635 if (constantType > 0) { 14636 if (constantType >= 2) { 14637 child.codegenNode.patchFlag = -1; 14638 toCache.push(child); 14639 continue; 14640 } 14641 } else { 14642 const codegenNode = child.codegenNode; 14643 if (codegenNode.type === 13) { 14644 const flag = codegenNode.patchFlag; 14645 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 14646 const props = getNodeProps(child); 14647 if (props) { 14648 codegenNode.props = context.hoist(props); 14649 } 14650 } 14651 if (codegenNode.dynamicProps) { 14652 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 14653 } 14654 } 14655 } 14656 } else if (child.type === 12) { 14657 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 14658 if (constantType >= 2) { 14659 if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) { 14660 child.codegenNode.arguments.push( 14661 -1 + (` /* ${PatchFlagNames[-1]} */`) 14662 ); 14663 } 14664 toCache.push(child); 14665 continue; 14666 } 14667 } 14668 if (child.type === 1) { 14669 const isComponent = child.tagType === 1; 14670 if (isComponent) { 14671 context.scopes.vSlot++; 14672 } 14673 walk(child, node, context, false, inFor); 14674 if (isComponent) { 14675 context.scopes.vSlot--; 14676 } 14677 } else if (child.type === 11) { 14678 walk(child, node, context, child.children.length === 1, true); 14679 } else if (child.type === 9) { 14680 for (let i2 = 0; i2 < child.branches.length; i2++) { 14681 walk( 14682 child.branches[i2], 14683 node, 14684 context, 14685 child.branches[i2].children.length === 1, 14686 inFor 14687 ); 14688 } 14689 } 14690 } 14691 let cachedAsArray = false; 14692 if (toCache.length === children.length && node.type === 1) { 14693 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { 14694 node.codegenNode.children = getCacheExpression( 14695 createArrayExpression(node.codegenNode.children) 14696 ); 14697 cachedAsArray = true; 14698 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { 14699 const slot = getSlotNode(node.codegenNode, "default"); 14700 if (slot) { 14701 slot.returns = getCacheExpression( 14702 createArrayExpression(slot.returns) 14703 ); 14704 cachedAsArray = true; 14705 } 14706 } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) { 14707 const slotName = findDir(node, "slot", true); 14708 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 14709 if (slot) { 14710 slot.returns = getCacheExpression( 14711 createArrayExpression(slot.returns) 14712 ); 14713 cachedAsArray = true; 14714 } 14715 } 14716 } 14717 if (!cachedAsArray) { 14718 for (const child of toCache) { 14719 child.codegenNode = context.cache(child.codegenNode); 14720 } 14721 } 14722 function getCacheExpression(value) { 14723 const exp = context.cache(value); 14724 exp.needArraySpread = true; 14725 return exp; 14726 } 14727 function getSlotNode(node2, name) { 14728 if (node2.children && !isArray(node2.children) && node2.children.type === 15) { 14729 const slot = node2.children.properties.find( 14730 (p) => p.key === name || p.key.content === name 14731 ); 14732 return slot && slot.value; 14733 } 14734 } 14735 if (toCache.length && context.transformHoist) { 14736 context.transformHoist(children, context, node); 14737 } 14738 } 14739 function getConstantType(node, context) { 14740 const { constantCache } = context; 14741 switch (node.type) { 14742 case 1: 14743 if (node.tagType !== 0) { 14744 return 0; 14745 } 14746 const cached = constantCache.get(node); 14747 if (cached !== void 0) { 14748 return cached; 14749 } 14750 const codegenNode = node.codegenNode; 14751 if (codegenNode.type !== 13) { 14752 return 0; 14753 } 14754 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 14755 return 0; 14756 } 14757 if (codegenNode.patchFlag === void 0) { 14758 let returnType2 = 3; 14759 const generatedPropsType = getGeneratedPropsConstantType(node, context); 14760 if (generatedPropsType === 0) { 14761 constantCache.set(node, 0); 14762 return 0; 14763 } 14764 if (generatedPropsType < returnType2) { 14765 returnType2 = generatedPropsType; 14766 } 14767 for (let i = 0; i < node.children.length; i++) { 14768 const childType = getConstantType(node.children[i], context); 14769 if (childType === 0) { 14770 constantCache.set(node, 0); 14771 return 0; 14772 } 14773 if (childType < returnType2) { 14774 returnType2 = childType; 14775 } 14776 } 14777 if (returnType2 > 1) { 14778 for (let i = 0; i < node.props.length; i++) { 14779 const p = node.props[i]; 14780 if (p.type === 7 && p.name === "bind" && p.exp) { 14781 const expType = getConstantType(p.exp, context); 14782 if (expType === 0) { 14783 constantCache.set(node, 0); 14784 return 0; 14785 } 14786 if (expType < returnType2) { 14787 returnType2 = expType; 14788 } 14789 } 14790 } 14791 } 14792 if (codegenNode.isBlock) { 14793 for (let i = 0; i < node.props.length; i++) { 14794 const p = node.props[i]; 14795 if (p.type === 7) { 14796 constantCache.set(node, 0); 14797 return 0; 14798 } 14799 } 14800 context.removeHelper(OPEN_BLOCK); 14801 context.removeHelper( 14802 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 14803 ); 14804 codegenNode.isBlock = false; 14805 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 14806 } 14807 constantCache.set(node, returnType2); 14808 return returnType2; 14809 } else { 14810 constantCache.set(node, 0); 14811 return 0; 14812 } 14813 case 2: 14814 case 3: 14815 return 3; 14816 case 9: 14817 case 11: 14818 case 10: 14819 return 0; 14820 case 5: 14821 case 12: 14822 return getConstantType(node.content, context); 14823 case 4: 14824 return node.constType; 14825 case 8: 14826 let returnType = 3; 14827 for (let i = 0; i < node.children.length; i++) { 14828 const child = node.children[i]; 14829 if (isString(child) || isSymbol(child)) { 14830 continue; 14831 } 14832 const childType = getConstantType(child, context); 14833 if (childType === 0) { 14834 return 0; 14835 } else if (childType < returnType) { 14836 returnType = childType; 14837 } 14838 } 14839 return returnType; 14840 case 20: 14841 return 2; 14842 default: 14843 return 0; 14844 } 14845 } 14846 const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 14847 NORMALIZE_CLASS, 14848 NORMALIZE_STYLE, 14849 NORMALIZE_PROPS, 14850 GUARD_REACTIVE_PROPS 14851 ]); 14852 function getConstantTypeOfHelperCall(value, context) { 14853 if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) { 14854 const arg = value.arguments[0]; 14855 if (arg.type === 4) { 14856 return getConstantType(arg, context); 14857 } else if (arg.type === 14) { 14858 return getConstantTypeOfHelperCall(arg, context); 14859 } 14860 } 14861 return 0; 14862 } 14863 function getGeneratedPropsConstantType(node, context) { 14864 let returnType = 3; 14865 const props = getNodeProps(node); 14866 if (props && props.type === 15) { 14867 const { properties } = props; 14868 for (let i = 0; i < properties.length; i++) { 14869 const { key, value } = properties[i]; 14870 const keyType = getConstantType(key, context); 14871 if (keyType === 0) { 14872 return keyType; 14873 } 14874 if (keyType < returnType) { 14875 returnType = keyType; 14876 } 14877 let valueType; 14878 if (value.type === 4) { 14879 valueType = getConstantType(value, context); 14880 } else if (value.type === 14) { 14881 valueType = getConstantTypeOfHelperCall(value, context); 14882 } else { 14883 valueType = 0; 14884 } 14885 if (valueType === 0) { 14886 return valueType; 14887 } 14888 if (valueType < returnType) { 14889 returnType = valueType; 14890 } 14891 } 14892 } 14893 return returnType; 14894 } 14895 function getNodeProps(node) { 14896 const codegenNode = node.codegenNode; 14897 if (codegenNode.type === 13) { 14898 return codegenNode.props; 14899 } 14900 } 14901 14902 function createTransformContext(root, { 14903 filename = "", 14904 prefixIdentifiers = false, 14905 hoistStatic = false, 14906 hmr = false, 14907 cacheHandlers = false, 14908 nodeTransforms = [], 14909 directiveTransforms = {}, 14910 transformHoist = null, 14911 isBuiltInComponent = NOOP, 14912 isCustomElement = NOOP, 14913 expressionPlugins = [], 14914 scopeId = null, 14915 slotted = true, 14916 ssr = false, 14917 inSSR = false, 14918 ssrCssVars = ``, 14919 bindingMetadata = EMPTY_OBJ, 14920 inline = false, 14921 isTS = false, 14922 onError = defaultOnError, 14923 onWarn = defaultOnWarn, 14924 compatConfig 14925 }) { 14926 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 14927 const context = { 14928 // options 14929 filename, 14930 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 14931 prefixIdentifiers, 14932 hoistStatic, 14933 hmr, 14934 cacheHandlers, 14935 nodeTransforms, 14936 directiveTransforms, 14937 transformHoist, 14938 isBuiltInComponent, 14939 isCustomElement, 14940 expressionPlugins, 14941 scopeId, 14942 slotted, 14943 ssr, 14944 inSSR, 14945 ssrCssVars, 14946 bindingMetadata, 14947 inline, 14948 isTS, 14949 onError, 14950 onWarn, 14951 compatConfig, 14952 // state 14953 root, 14954 helpers: /* @__PURE__ */ new Map(), 14955 components: /* @__PURE__ */ new Set(), 14956 directives: /* @__PURE__ */ new Set(), 14957 hoists: [], 14958 imports: [], 14959 cached: [], 14960 constantCache: /* @__PURE__ */ new WeakMap(), 14961 temps: 0, 14962 identifiers: /* @__PURE__ */ Object.create(null), 14963 scopes: { 14964 vFor: 0, 14965 vSlot: 0, 14966 vPre: 0, 14967 vOnce: 0 14968 }, 14969 parent: null, 14970 grandParent: null, 14971 currentNode: root, 14972 childIndex: 0, 14973 inVOnce: false, 14974 // methods 14975 helper(name) { 14976 const count = context.helpers.get(name) || 0; 14977 context.helpers.set(name, count + 1); 14978 return name; 14979 }, 14980 removeHelper(name) { 14981 const count = context.helpers.get(name); 14982 if (count) { 14983 const currentCount = count - 1; 14984 if (!currentCount) { 14985 context.helpers.delete(name); 14986 } else { 14987 context.helpers.set(name, currentCount); 14988 } 14989 } 14990 }, 14991 helperString(name) { 14992 return `_${helperNameMap[context.helper(name)]}`; 14993 }, 14994 replaceNode(node) { 14995 { 14996 if (!context.currentNode) { 14997 throw new Error(`Node being replaced is already removed.`); 14998 } 14999 if (!context.parent) { 15000 throw new Error(`Cannot replace root node.`); 15001 } 15002 } 15003 context.parent.children[context.childIndex] = context.currentNode = node; 15004 }, 15005 removeNode(node) { 15006 if (!context.parent) { 15007 throw new Error(`Cannot remove root node.`); 15008 } 15009 const list = context.parent.children; 15010 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 15011 if (removalIndex < 0) { 15012 throw new Error(`node being removed is not a child of current parent`); 15013 } 15014 if (!node || node === context.currentNode) { 15015 context.currentNode = null; 15016 context.onNodeRemoved(); 15017 } else { 15018 if (context.childIndex > removalIndex) { 15019 context.childIndex--; 15020 context.onNodeRemoved(); 15021 } 15022 } 15023 context.parent.children.splice(removalIndex, 1); 15024 }, 15025 onNodeRemoved: NOOP, 15026 addIdentifiers(exp) { 15027 }, 15028 removeIdentifiers(exp) { 15029 }, 15030 hoist(exp) { 15031 if (isString(exp)) exp = createSimpleExpression(exp); 15032 context.hoists.push(exp); 15033 const identifier = createSimpleExpression( 15034 `_hoisted_${context.hoists.length}`, 15035 false, 15036 exp.loc, 15037 2 15038 ); 15039 identifier.hoisted = exp; 15040 return identifier; 15041 }, 15042 cache(exp, isVNode = false, inVOnce = false) { 15043 const cacheExp = createCacheExpression( 15044 context.cached.length, 15045 exp, 15046 isVNode, 15047 inVOnce 15048 ); 15049 context.cached.push(cacheExp); 15050 return cacheExp; 15051 } 15052 }; 15053 return context; 15054 } 15055 function transform(root, options) { 15056 const context = createTransformContext(root, options); 15057 traverseNode(root, context); 15058 if (options.hoistStatic) { 15059 cacheStatic(root, context); 15060 } 15061 if (!options.ssr) { 15062 createRootCodegen(root, context); 15063 } 15064 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 15065 root.components = [...context.components]; 15066 root.directives = [...context.directives]; 15067 root.imports = context.imports; 15068 root.hoists = context.hoists; 15069 root.temps = context.temps; 15070 root.cached = context.cached; 15071 root.transformed = true; 15072 } 15073 function createRootCodegen(root, context) { 15074 const { helper } = context; 15075 const { children } = root; 15076 if (children.length === 1) { 15077 const singleElementRootChild = getSingleElementRoot(root); 15078 if (singleElementRootChild && singleElementRootChild.codegenNode) { 15079 const codegenNode = singleElementRootChild.codegenNode; 15080 if (codegenNode.type === 13) { 15081 convertToBlock(codegenNode, context); 15082 } 15083 root.codegenNode = codegenNode; 15084 } else { 15085 root.codegenNode = children[0]; 15086 } 15087 } else if (children.length > 1) { 15088 let patchFlag = 64; 15089 if (children.filter((c) => c.type !== 3).length === 1) { 15090 patchFlag |= 2048; 15091 } 15092 root.codegenNode = createVNodeCall( 15093 context, 15094 helper(FRAGMENT), 15095 void 0, 15096 root.children, 15097 patchFlag, 15098 void 0, 15099 void 0, 15100 true, 15101 void 0, 15102 false 15103 ); 15104 } else; 15105 } 15106 function traverseChildren(parent, context) { 15107 let i = 0; 15108 const nodeRemoved = () => { 15109 i--; 15110 }; 15111 for (; i < parent.children.length; i++) { 15112 const child = parent.children[i]; 15113 if (isString(child)) continue; 15114 context.grandParent = context.parent; 15115 context.parent = parent; 15116 context.childIndex = i; 15117 context.onNodeRemoved = nodeRemoved; 15118 traverseNode(child, context); 15119 } 15120 } 15121 function traverseNode(node, context) { 15122 context.currentNode = node; 15123 const { nodeTransforms } = context; 15124 const exitFns = []; 15125 for (let i2 = 0; i2 < nodeTransforms.length; i2++) { 15126 const onExit = nodeTransforms[i2](node, context); 15127 if (onExit) { 15128 if (isArray(onExit)) { 15129 exitFns.push(...onExit); 15130 } else { 15131 exitFns.push(onExit); 15132 } 15133 } 15134 if (!context.currentNode) { 15135 return; 15136 } else { 15137 node = context.currentNode; 15138 } 15139 } 15140 switch (node.type) { 15141 case 3: 15142 if (!context.ssr) { 15143 context.helper(CREATE_COMMENT); 15144 } 15145 break; 15146 case 5: 15147 if (!context.ssr) { 15148 context.helper(TO_DISPLAY_STRING); 15149 } 15150 break; 15151 // for container types, further traverse downwards 15152 case 9: 15153 for (let i2 = 0; i2 < node.branches.length; i2++) { 15154 traverseNode(node.branches[i2], context); 15155 } 15156 break; 15157 case 10: 15158 case 11: 15159 case 1: 15160 case 0: 15161 traverseChildren(node, context); 15162 break; 15163 } 15164 context.currentNode = node; 15165 let i = exitFns.length; 15166 while (i--) { 15167 exitFns[i](); 15168 } 15169 } 15170 function createStructuralDirectiveTransform(name, fn) { 15171 const matches = isString(name) ? (n) => n === name : (n) => name.test(n); 15172 return (node, context) => { 15173 if (node.type === 1) { 15174 const { props } = node; 15175 if (node.tagType === 3 && props.some(isVSlot)) { 15176 return; 15177 } 15178 const exitFns = []; 15179 for (let i = 0; i < props.length; i++) { 15180 const prop = props[i]; 15181 if (prop.type === 7 && matches(prop.name)) { 15182 props.splice(i, 1); 15183 i--; 15184 const onExit = fn(node, prop, context); 15185 if (onExit) exitFns.push(onExit); 15186 } 15187 } 15188 return exitFns; 15189 } 15190 }; 15191 } 15192 15193 const PURE_ANNOTATION = `/*@__PURE__*/`; 15194 const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`; 15195 function createCodegenContext(ast, { 15196 mode = "function", 15197 prefixIdentifiers = mode === "module", 15198 sourceMap = false, 15199 filename = `template.vue.html`, 15200 scopeId = null, 15201 optimizeImports = false, 15202 runtimeGlobalName = `Vue`, 15203 runtimeModuleName = `vue`, 15204 ssrRuntimeModuleName = "vue/server-renderer", 15205 ssr = false, 15206 isTS = false, 15207 inSSR = false 15208 }) { 15209 const context = { 15210 mode, 15211 prefixIdentifiers, 15212 sourceMap, 15213 filename, 15214 scopeId, 15215 optimizeImports, 15216 runtimeGlobalName, 15217 runtimeModuleName, 15218 ssrRuntimeModuleName, 15219 ssr, 15220 isTS, 15221 inSSR, 15222 source: ast.source, 15223 code: ``, 15224 column: 1, 15225 line: 1, 15226 offset: 0, 15227 indentLevel: 0, 15228 pure: false, 15229 map: void 0, 15230 helper(key) { 15231 return `_${helperNameMap[key]}`; 15232 }, 15233 push(code, newlineIndex = -2 /* None */, node) { 15234 context.code += code; 15235 }, 15236 indent() { 15237 newline(++context.indentLevel); 15238 }, 15239 deindent(withoutNewLine = false) { 15240 if (withoutNewLine) { 15241 --context.indentLevel; 15242 } else { 15243 newline(--context.indentLevel); 15244 } 15245 }, 15246 newline() { 15247 newline(context.indentLevel); 15248 } 15249 }; 15250 function newline(n) { 15251 context.push("\n" + ` `.repeat(n), 0 /* Start */); 15252 } 15253 return context; 15254 } 15255 function generate(ast, options = {}) { 15256 const context = createCodegenContext(ast, options); 15257 if (options.onContextCreated) options.onContextCreated(context); 15258 const { 15259 mode, 15260 push, 15261 prefixIdentifiers, 15262 indent, 15263 deindent, 15264 newline, 15265 scopeId, 15266 ssr 15267 } = context; 15268 const helpers = Array.from(ast.helpers); 15269 const hasHelpers = helpers.length > 0; 15270 const useWithBlock = !prefixIdentifiers && mode !== "module"; 15271 const preambleContext = context; 15272 { 15273 genFunctionPreamble(ast, preambleContext); 15274 } 15275 const functionName = ssr ? `ssrRender` : `render`; 15276 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 15277 const signature = args.join(", "); 15278 { 15279 push(`function ${functionName}(${signature}) {`); 15280 } 15281 indent(); 15282 if (useWithBlock) { 15283 push(`with (_ctx) {`); 15284 indent(); 15285 if (hasHelpers) { 15286 push( 15287 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 15288`, 15289 -1 /* End */ 15290 ); 15291 newline(); 15292 } 15293 } 15294 if (ast.components.length) { 15295 genAssets(ast.components, "component", context); 15296 if (ast.directives.length || ast.temps > 0) { 15297 newline(); 15298 } 15299 } 15300 if (ast.directives.length) { 15301 genAssets(ast.directives, "directive", context); 15302 if (ast.temps > 0) { 15303 newline(); 15304 } 15305 } 15306 if (ast.temps > 0) { 15307 push(`let `); 15308 for (let i = 0; i < ast.temps; i++) { 15309 push(`${i > 0 ? `, ` : ``}_temp${i}`); 15310 } 15311 } 15312 if (ast.components.length || ast.directives.length || ast.temps) { 15313 push(` 15314`, 0 /* Start */); 15315 newline(); 15316 } 15317 if (!ssr) { 15318 push(`return `); 15319 } 15320 if (ast.codegenNode) { 15321 genNode(ast.codegenNode, context); 15322 } else { 15323 push(`null`); 15324 } 15325 if (useWithBlock) { 15326 deindent(); 15327 push(`}`); 15328 } 15329 deindent(); 15330 push(`}`); 15331 return { 15332 ast, 15333 code: context.code, 15334 preamble: ``, 15335 map: context.map ? context.map.toJSON() : void 0 15336 }; 15337 } 15338 function genFunctionPreamble(ast, context) { 15339 const { 15340 ssr, 15341 prefixIdentifiers, 15342 push, 15343 newline, 15344 runtimeModuleName, 15345 runtimeGlobalName, 15346 ssrRuntimeModuleName 15347 } = context; 15348 const VueBinding = runtimeGlobalName; 15349 const helpers = Array.from(ast.helpers); 15350 if (helpers.length > 0) { 15351 { 15352 push(`const _Vue = ${VueBinding} 15353`, -1 /* End */); 15354 if (ast.hoists.length) { 15355 const staticHelpers = [ 15356 CREATE_VNODE, 15357 CREATE_ELEMENT_VNODE, 15358 CREATE_COMMENT, 15359 CREATE_TEXT, 15360 CREATE_STATIC 15361 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 15362 push(`const { ${staticHelpers} } = _Vue 15363`, -1 /* End */); 15364 } 15365 } 15366 } 15367 genHoists(ast.hoists, context); 15368 newline(); 15369 push(`return `); 15370 } 15371 function genAssets(assets, type, { helper, push, newline, isTS }) { 15372 const resolver = helper( 15373 type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 15374 ); 15375 for (let i = 0; i < assets.length; i++) { 15376 let id = assets[i]; 15377 const maybeSelfReference = id.endsWith("__self"); 15378 if (maybeSelfReference) { 15379 id = id.slice(0, -6); 15380 } 15381 push( 15382 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 15383 ); 15384 if (i < assets.length - 1) { 15385 newline(); 15386 } 15387 } 15388 } 15389 function genHoists(hoists, context) { 15390 if (!hoists.length) { 15391 return; 15392 } 15393 context.pure = true; 15394 const { push, newline } = context; 15395 newline(); 15396 for (let i = 0; i < hoists.length; i++) { 15397 const exp = hoists[i]; 15398 if (exp) { 15399 push(`const _hoisted_${i + 1} = `); 15400 genNode(exp, context); 15401 newline(); 15402 } 15403 } 15404 context.pure = false; 15405 } 15406 function isText(n) { 15407 return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8; 15408 } 15409 function genNodeListAsArray(nodes, context) { 15410 const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n)); 15411 context.push(`[`); 15412 multilines && context.indent(); 15413 genNodeList(nodes, context, multilines); 15414 multilines && context.deindent(); 15415 context.push(`]`); 15416 } 15417 function genNodeList(nodes, context, multilines = false, comma = true) { 15418 const { push, newline } = context; 15419 for (let i = 0; i < nodes.length; i++) { 15420 const node = nodes[i]; 15421 if (isString(node)) { 15422 push(node, -3 /* Unknown */); 15423 } else if (isArray(node)) { 15424 genNodeListAsArray(node, context); 15425 } else { 15426 genNode(node, context); 15427 } 15428 if (i < nodes.length - 1) { 15429 if (multilines) { 15430 comma && push(","); 15431 newline(); 15432 } else { 15433 comma && push(", "); 15434 } 15435 } 15436 } 15437 } 15438 function genNode(node, context) { 15439 if (isString(node)) { 15440 context.push(node, -3 /* Unknown */); 15441 return; 15442 } 15443 if (isSymbol(node)) { 15444 context.push(context.helper(node)); 15445 return; 15446 } 15447 switch (node.type) { 15448 case 1: 15449 case 9: 15450 case 11: 15451 assert( 15452 node.codegenNode != null, 15453 `Codegen node is missing for element/if/for node. Apply appropriate transforms first.` 15454 ); 15455 genNode(node.codegenNode, context); 15456 break; 15457 case 2: 15458 genText(node, context); 15459 break; 15460 case 4: 15461 genExpression(node, context); 15462 break; 15463 case 5: 15464 genInterpolation(node, context); 15465 break; 15466 case 12: 15467 genNode(node.codegenNode, context); 15468 break; 15469 case 8: 15470 genCompoundExpression(node, context); 15471 break; 15472 case 3: 15473 genComment(node, context); 15474 break; 15475 case 13: 15476 genVNodeCall(node, context); 15477 break; 15478 case 14: 15479 genCallExpression(node, context); 15480 break; 15481 case 15: 15482 genObjectExpression(node, context); 15483 break; 15484 case 17: 15485 genArrayExpression(node, context); 15486 break; 15487 case 18: 15488 genFunctionExpression(node, context); 15489 break; 15490 case 19: 15491 genConditionalExpression(node, context); 15492 break; 15493 case 20: 15494 genCacheExpression(node, context); 15495 break; 15496 case 21: 15497 genNodeList(node.body, context, true, false); 15498 break; 15499 // SSR only types 15500 case 22: 15501 break; 15502 case 23: 15503 break; 15504 case 24: 15505 break; 15506 case 25: 15507 break; 15508 case 26: 15509 break; 15510 /* v8 ignore start */ 15511 case 10: 15512 break; 15513 default: 15514 { 15515 assert(false, `unhandled codegen node type: ${node.type}`); 15516 const exhaustiveCheck = node; 15517 return exhaustiveCheck; 15518 } 15519 } 15520 } 15521 function genText(node, context) { 15522 context.push(JSON.stringify(node.content), -3 /* Unknown */, node); 15523 } 15524 function genExpression(node, context) { 15525 const { content, isStatic } = node; 15526 context.push( 15527 isStatic ? JSON.stringify(content) : content, 15528 -3 /* Unknown */, 15529 node 15530 ); 15531 } 15532 function genInterpolation(node, context) { 15533 const { push, helper, pure } = context; 15534 if (pure) push(PURE_ANNOTATION); 15535 push(`${helper(TO_DISPLAY_STRING)}(`); 15536 genNode(node.content, context); 15537 push(`)`); 15538 } 15539 function genCompoundExpression(node, context) { 15540 for (let i = 0; i < node.children.length; i++) { 15541 const child = node.children[i]; 15542 if (isString(child)) { 15543 context.push(child, -3 /* Unknown */); 15544 } else { 15545 genNode(child, context); 15546 } 15547 } 15548 } 15549 function genExpressionAsPropertyKey(node, context) { 15550 const { push } = context; 15551 if (node.type === 8) { 15552 push(`[`); 15553 genCompoundExpression(node, context); 15554 push(`]`); 15555 } else if (node.isStatic) { 15556 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 15557 push(text, -2 /* None */, node); 15558 } else { 15559 push(`[${node.content}]`, -3 /* Unknown */, node); 15560 } 15561 } 15562 function genComment(node, context) { 15563 const { push, helper, pure } = context; 15564 if (pure) { 15565 push(PURE_ANNOTATION); 15566 } 15567 push( 15568 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 15569 -3 /* Unknown */, 15570 node 15571 ); 15572 } 15573 function genVNodeCall(node, context) { 15574 const { push, helper, pure } = context; 15575 const { 15576 tag, 15577 props, 15578 children, 15579 patchFlag, 15580 dynamicProps, 15581 directives, 15582 isBlock, 15583 disableTracking, 15584 isComponent 15585 } = node; 15586 let patchFlagString; 15587 if (patchFlag) { 15588 { 15589 if (patchFlag < 0) { 15590 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`; 15591 } else { 15592 const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `); 15593 patchFlagString = patchFlag + ` /* ${flagNames} */`; 15594 } 15595 } 15596 } 15597 if (directives) { 15598 push(helper(WITH_DIRECTIVES) + `(`); 15599 } 15600 if (isBlock) { 15601 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 15602 } 15603 if (pure) { 15604 push(PURE_ANNOTATION); 15605 } 15606 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent); 15607 push(helper(callHelper) + `(`, -2 /* None */, node); 15608 genNodeList( 15609 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 15610 context 15611 ); 15612 push(`)`); 15613 if (isBlock) { 15614 push(`)`); 15615 } 15616 if (directives) { 15617 push(`, `); 15618 genNode(directives, context); 15619 push(`)`); 15620 } 15621 } 15622 function genNullableArgs(args) { 15623 let i = args.length; 15624 while (i--) { 15625 if (args[i] != null) break; 15626 } 15627 return args.slice(0, i + 1).map((arg) => arg || `null`); 15628 } 15629 function genCallExpression(node, context) { 15630 const { push, helper, pure } = context; 15631 const callee = isString(node.callee) ? node.callee : helper(node.callee); 15632 if (pure) { 15633 push(PURE_ANNOTATION); 15634 } 15635 push(callee + `(`, -2 /* None */, node); 15636 genNodeList(node.arguments, context); 15637 push(`)`); 15638 } 15639 function genObjectExpression(node, context) { 15640 const { push, indent, deindent, newline } = context; 15641 const { properties } = node; 15642 if (!properties.length) { 15643 push(`{}`, -2 /* None */, node); 15644 return; 15645 } 15646 const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4); 15647 push(multilines ? `{` : `{ `); 15648 multilines && indent(); 15649 for (let i = 0; i < properties.length; i++) { 15650 const { key, value } = properties[i]; 15651 genExpressionAsPropertyKey(key, context); 15652 push(`: `); 15653 genNode(value, context); 15654 if (i < properties.length - 1) { 15655 push(`,`); 15656 newline(); 15657 } 15658 } 15659 multilines && deindent(); 15660 push(multilines ? `}` : ` }`); 15661 } 15662 function genArrayExpression(node, context) { 15663 genNodeListAsArray(node.elements, context); 15664 } 15665 function genFunctionExpression(node, context) { 15666 const { push, indent, deindent } = context; 15667 const { params, returns, body, newline, isSlot } = node; 15668 if (isSlot) { 15669 push(`_${helperNameMap[WITH_CTX]}(`); 15670 } 15671 push(`(`, -2 /* None */, node); 15672 if (isArray(params)) { 15673 genNodeList(params, context); 15674 } else if (params) { 15675 genNode(params, context); 15676 } 15677 push(`) => `); 15678 if (newline || body) { 15679 push(`{`); 15680 indent(); 15681 } 15682 if (returns) { 15683 if (newline) { 15684 push(`return `); 15685 } 15686 if (isArray(returns)) { 15687 genNodeListAsArray(returns, context); 15688 } else { 15689 genNode(returns, context); 15690 } 15691 } else if (body) { 15692 genNode(body, context); 15693 } 15694 if (newline || body) { 15695 deindent(); 15696 push(`}`); 15697 } 15698 if (isSlot) { 15699 push(`)`); 15700 } 15701 } 15702 function genConditionalExpression(node, context) { 15703 const { test, consequent, alternate, newline: needNewline } = node; 15704 const { push, indent, deindent, newline } = context; 15705 if (test.type === 4) { 15706 const needsParens = !isSimpleIdentifier(test.content); 15707 needsParens && push(`(`); 15708 genExpression(test, context); 15709 needsParens && push(`)`); 15710 } else { 15711 push(`(`); 15712 genNode(test, context); 15713 push(`)`); 15714 } 15715 needNewline && indent(); 15716 context.indentLevel++; 15717 needNewline || push(` `); 15718 push(`? `); 15719 genNode(consequent, context); 15720 context.indentLevel--; 15721 needNewline && newline(); 15722 needNewline || push(` `); 15723 push(`: `); 15724 const isNested = alternate.type === 19; 15725 if (!isNested) { 15726 context.indentLevel++; 15727 } 15728 genNode(alternate, context); 15729 if (!isNested) { 15730 context.indentLevel--; 15731 } 15732 needNewline && deindent( 15733 true 15734 /* without newline */ 15735 ); 15736 } 15737 function genCacheExpression(node, context) { 15738 const { push, helper, indent, deindent, newline } = context; 15739 const { needPauseTracking, needArraySpread } = node; 15740 if (needArraySpread) { 15741 push(`[...(`); 15742 } 15743 push(`_cache[${node.index}] || (`); 15744 if (needPauseTracking) { 15745 indent(); 15746 push(`${helper(SET_BLOCK_TRACKING)}(-1`); 15747 if (node.inVOnce) push(`, true`); 15748 push(`),`); 15749 newline(); 15750 push(`(`); 15751 } 15752 push(`_cache[${node.index}] = `); 15753 genNode(node.value, context); 15754 if (needPauseTracking) { 15755 push(`).cacheIndex = ${node.index},`); 15756 newline(); 15757 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 15758 newline(); 15759 push(`_cache[${node.index}]`); 15760 deindent(); 15761 } 15762 push(`)`); 15763 if (needArraySpread) { 15764 push(`)]`); 15765 } 15766 } 15767 15768 const prohibitedKeywordRE = new RegExp( 15769 "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b" 15770 ); 15771 const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 15772 function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) { 15773 const exp = node.content; 15774 if (!exp.trim()) { 15775 return; 15776 } 15777 try { 15778 new Function( 15779 asRawStatements ? ` ${exp} ` : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}` 15780 ); 15781 } catch (e) { 15782 let message = e.message; 15783 const keywordMatch = exp.replace(stripStringRE, "").match(prohibitedKeywordRE); 15784 if (keywordMatch) { 15785 message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`; 15786 } 15787 context.onError( 15788 createCompilerError( 15789 45, 15790 node.loc, 15791 void 0, 15792 message 15793 ) 15794 ); 15795 } 15796 } 15797 15798 const transformExpression = (node, context) => { 15799 if (node.type === 5) { 15800 node.content = processExpression( 15801 node.content, 15802 context 15803 ); 15804 } else if (node.type === 1) { 15805 const memo = findDir(node, "memo"); 15806 for (let i = 0; i < node.props.length; i++) { 15807 const dir = node.props[i]; 15808 if (dir.type === 7 && dir.name !== "for") { 15809 const exp = dir.exp; 15810 const arg = dir.arg; 15811 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor) 15812 !(memo && arg && arg.type === 4 && arg.content === "key")) { 15813 dir.exp = processExpression( 15814 exp, 15815 context, 15816 // slot args must be processed as function params 15817 dir.name === "slot" 15818 ); 15819 } 15820 if (arg && arg.type === 4 && !arg.isStatic) { 15821 dir.arg = processExpression(arg, context); 15822 } 15823 } 15824 } 15825 } 15826 }; 15827 function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 15828 { 15829 { 15830 validateBrowserExpression(node, context, asParams, asRawStatements); 15831 } 15832 return node; 15833 } 15834 } 15835 15836 const transformIf = createStructuralDirectiveTransform( 15837 /^(?:if|else|else-if)$/, 15838 (node, dir, context) => { 15839 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 15840 const siblings = context.parent.children; 15841 let i = siblings.indexOf(ifNode); 15842 let key = 0; 15843 while (i-- >= 0) { 15844 const sibling = siblings[i]; 15845 if (sibling && sibling.type === 9) { 15846 key += sibling.branches.length; 15847 } 15848 } 15849 return () => { 15850 if (isRoot) { 15851 ifNode.codegenNode = createCodegenNodeForBranch( 15852 branch, 15853 key, 15854 context 15855 ); 15856 } else { 15857 const parentCondition = getParentCondition(ifNode.codegenNode); 15858 parentCondition.alternate = createCodegenNodeForBranch( 15859 branch, 15860 key + ifNode.branches.length - 1, 15861 context 15862 ); 15863 } 15864 }; 15865 }); 15866 } 15867 ); 15868 function processIf(node, dir, context, processCodegen) { 15869 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 15870 const loc = dir.exp ? dir.exp.loc : node.loc; 15871 context.onError( 15872 createCompilerError(28, dir.loc) 15873 ); 15874 dir.exp = createSimpleExpression(`true`, false, loc); 15875 } 15876 if (dir.exp) { 15877 validateBrowserExpression(dir.exp, context); 15878 } 15879 if (dir.name === "if") { 15880 const branch = createIfBranch(node, dir); 15881 const ifNode = { 15882 type: 9, 15883 loc: cloneLoc(node.loc), 15884 branches: [branch] 15885 }; 15886 context.replaceNode(ifNode); 15887 if (processCodegen) { 15888 return processCodegen(ifNode, branch, true); 15889 } 15890 } else { 15891 const siblings = context.parent.children; 15892 const comments = []; 15893 let i = siblings.indexOf(node); 15894 while (i-- >= -1) { 15895 const sibling = siblings[i]; 15896 if (sibling && isCommentOrWhitespace(sibling)) { 15897 context.removeNode(sibling); 15898 if (sibling.type === 3) { 15899 comments.unshift(sibling); 15900 } 15901 continue; 15902 } 15903 if (sibling && sibling.type === 9) { 15904 if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) { 15905 context.onError( 15906 createCompilerError(30, node.loc) 15907 ); 15908 } 15909 context.removeNode(); 15910 const branch = createIfBranch(node, dir); 15911 if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition> 15912 !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) { 15913 branch.children = [...comments, ...branch.children]; 15914 } 15915 { 15916 const key = branch.userKey; 15917 if (key) { 15918 sibling.branches.forEach(({ userKey }) => { 15919 if (isSameKey(userKey, key)) { 15920 context.onError( 15921 createCompilerError( 15922 29, 15923 branch.userKey.loc 15924 ) 15925 ); 15926 } 15927 }); 15928 } 15929 } 15930 sibling.branches.push(branch); 15931 const onExit = processCodegen && processCodegen(sibling, branch, false); 15932 traverseNode(branch, context); 15933 if (onExit) onExit(); 15934 context.currentNode = null; 15935 } else { 15936 context.onError( 15937 createCompilerError(30, node.loc) 15938 ); 15939 } 15940 break; 15941 } 15942 } 15943 } 15944 function createIfBranch(node, dir) { 15945 const isTemplateIf = node.tagType === 3; 15946 return { 15947 type: 10, 15948 loc: node.loc, 15949 condition: dir.name === "else" ? void 0 : dir.exp, 15950 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 15951 userKey: findProp(node, `key`), 15952 isTemplateIf 15953 }; 15954 } 15955 function createCodegenNodeForBranch(branch, keyIndex, context) { 15956 if (branch.condition) { 15957 return createConditionalExpression( 15958 branch.condition, 15959 createChildrenCodegenNode(branch, keyIndex, context), 15960 // make sure to pass in asBlock: true so that the comment node call 15961 // closes the current block. 15962 createCallExpression(context.helper(CREATE_COMMENT), [ 15963 '"v-if"', 15964 "true" 15965 ]) 15966 ); 15967 } else { 15968 return createChildrenCodegenNode(branch, keyIndex, context); 15969 } 15970 } 15971 function createChildrenCodegenNode(branch, keyIndex, context) { 15972 const { helper } = context; 15973 const keyProperty = createObjectProperty( 15974 `key`, 15975 createSimpleExpression( 15976 `${keyIndex}`, 15977 false, 15978 locStub, 15979 2 15980 ) 15981 ); 15982 const { children } = branch; 15983 const firstChild = children[0]; 15984 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 15985 if (needFragmentWrapper) { 15986 if (children.length === 1 && firstChild.type === 11) { 15987 const vnodeCall = firstChild.codegenNode; 15988 injectProp(vnodeCall, keyProperty, context); 15989 return vnodeCall; 15990 } else { 15991 let patchFlag = 64; 15992 if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) { 15993 patchFlag |= 2048; 15994 } 15995 return createVNodeCall( 15996 context, 15997 helper(FRAGMENT), 15998 createObjectExpression([keyProperty]), 15999 children, 16000 patchFlag, 16001 void 0, 16002 void 0, 16003 true, 16004 false, 16005 false, 16006 branch.loc 16007 ); 16008 } 16009 } else { 16010 const ret = firstChild.codegenNode; 16011 const vnodeCall = getMemoedVNodeCall(ret); 16012 if (vnodeCall.type === 13) { 16013 convertToBlock(vnodeCall, context); 16014 } 16015 injectProp(vnodeCall, keyProperty, context); 16016 return ret; 16017 } 16018 } 16019 function isSameKey(a, b) { 16020 if (!a || a.type !== b.type) { 16021 return false; 16022 } 16023 if (a.type === 6) { 16024 if (a.value.content !== b.value.content) { 16025 return false; 16026 } 16027 } else { 16028 const exp = a.exp; 16029 const branchExp = b.exp; 16030 if (exp.type !== branchExp.type) { 16031 return false; 16032 } 16033 if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) { 16034 return false; 16035 } 16036 } 16037 return true; 16038 } 16039 function getParentCondition(node) { 16040 while (true) { 16041 if (node.type === 19) { 16042 if (node.alternate.type === 19) { 16043 node = node.alternate; 16044 } else { 16045 return node; 16046 } 16047 } else if (node.type === 20) { 16048 node = node.value; 16049 } 16050 } 16051 } 16052 16053 const transformFor = createStructuralDirectiveTransform( 16054 "for", 16055 (node, dir, context) => { 16056 const { helper, removeHelper } = context; 16057 return processFor(node, dir, context, (forNode) => { 16058 const renderExp = createCallExpression(helper(RENDER_LIST), [ 16059 forNode.source 16060 ]); 16061 const isTemplate = isTemplateNode(node); 16062 const memo = findDir(node, "memo"); 16063 const keyProp = findProp(node, `key`, false, true); 16064 keyProp && keyProp.type === 7; 16065 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 16066 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null; 16067 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 16068 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 16069 forNode.codegenNode = createVNodeCall( 16070 context, 16071 helper(FRAGMENT), 16072 void 0, 16073 renderExp, 16074 fragmentFlag, 16075 void 0, 16076 void 0, 16077 true, 16078 !isStableFragment, 16079 false, 16080 node.loc 16081 ); 16082 return () => { 16083 let childBlock; 16084 const { children } = forNode; 16085 if (isTemplate) { 16086 node.children.some((c) => { 16087 if (c.type === 1) { 16088 const key = findProp(c, "key"); 16089 if (key) { 16090 context.onError( 16091 createCompilerError( 16092 33, 16093 key.loc 16094 ) 16095 ); 16096 return true; 16097 } 16098 } 16099 }); 16100 } 16101 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 16102 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 16103 if (slotOutlet) { 16104 childBlock = slotOutlet.codegenNode; 16105 if (isTemplate && keyProperty) { 16106 injectProp(childBlock, keyProperty, context); 16107 } 16108 } else if (needFragmentWrapper) { 16109 childBlock = createVNodeCall( 16110 context, 16111 helper(FRAGMENT), 16112 keyProperty ? createObjectExpression([keyProperty]) : void 0, 16113 node.children, 16114 64, 16115 void 0, 16116 void 0, 16117 true, 16118 void 0, 16119 false 16120 ); 16121 } else { 16122 childBlock = children[0].codegenNode; 16123 if (isTemplate && keyProperty) { 16124 injectProp(childBlock, keyProperty, context); 16125 } 16126 if (childBlock.isBlock !== !isStableFragment) { 16127 if (childBlock.isBlock) { 16128 removeHelper(OPEN_BLOCK); 16129 removeHelper( 16130 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 16131 ); 16132 } else { 16133 removeHelper( 16134 getVNodeHelper(context.inSSR, childBlock.isComponent) 16135 ); 16136 } 16137 } 16138 childBlock.isBlock = !isStableFragment; 16139 if (childBlock.isBlock) { 16140 helper(OPEN_BLOCK); 16141 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 16142 } else { 16143 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 16144 } 16145 } 16146 if (memo) { 16147 const loop = createFunctionExpression( 16148 createForLoopParams(forNode.parseResult, [ 16149 createSimpleExpression(`_cached`) 16150 ]) 16151 ); 16152 loop.body = createBlockStatement([ 16153 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 16154 createCompoundExpression([ 16155 `if (_cached`, 16156 ...keyExp ? [` && _cached.key === `, keyExp] : [], 16157 ` && ${context.helperString( 16158 IS_MEMO_SAME 16159 )}(_cached, _memo)) return _cached` 16160 ]), 16161 createCompoundExpression([`const _item = `, childBlock]), 16162 createSimpleExpression(`_item.memo = _memo`), 16163 createSimpleExpression(`return _item`) 16164 ]); 16165 renderExp.arguments.push( 16166 loop, 16167 createSimpleExpression(`_cache`), 16168 createSimpleExpression(String(context.cached.length)) 16169 ); 16170 context.cached.push(null); 16171 } else { 16172 renderExp.arguments.push( 16173 createFunctionExpression( 16174 createForLoopParams(forNode.parseResult), 16175 childBlock, 16176 true 16177 ) 16178 ); 16179 } 16180 }; 16181 }); 16182 } 16183 ); 16184 function processFor(node, dir, context, processCodegen) { 16185 if (!dir.exp) { 16186 context.onError( 16187 createCompilerError(31, dir.loc) 16188 ); 16189 return; 16190 } 16191 const parseResult = dir.forParseResult; 16192 if (!parseResult) { 16193 context.onError( 16194 createCompilerError(32, dir.loc) 16195 ); 16196 return; 16197 } 16198 finalizeForParseResult(parseResult, context); 16199 const { addIdentifiers, removeIdentifiers, scopes } = context; 16200 const { source, value, key, index } = parseResult; 16201 const forNode = { 16202 type: 11, 16203 loc: dir.loc, 16204 source, 16205 valueAlias: value, 16206 keyAlias: key, 16207 objectIndexAlias: index, 16208 parseResult, 16209 children: isTemplateNode(node) ? node.children : [node] 16210 }; 16211 context.replaceNode(forNode); 16212 scopes.vFor++; 16213 const onExit = processCodegen && processCodegen(forNode); 16214 return () => { 16215 scopes.vFor--; 16216 if (onExit) onExit(); 16217 }; 16218 } 16219 function finalizeForParseResult(result, context) { 16220 if (result.finalized) return; 16221 { 16222 validateBrowserExpression(result.source, context); 16223 if (result.key) { 16224 validateBrowserExpression( 16225 result.key, 16226 context, 16227 true 16228 ); 16229 } 16230 if (result.index) { 16231 validateBrowserExpression( 16232 result.index, 16233 context, 16234 true 16235 ); 16236 } 16237 if (result.value) { 16238 validateBrowserExpression( 16239 result.value, 16240 context, 16241 true 16242 ); 16243 } 16244 } 16245 result.finalized = true; 16246 } 16247 function createForLoopParams({ value, key, index }, memoArgs = []) { 16248 return createParamsList([value, key, index, ...memoArgs]); 16249 } 16250 function createParamsList(args) { 16251 let i = args.length; 16252 while (i--) { 16253 if (args[i]) break; 16254 } 16255 return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false)); 16256 } 16257 16258 const defaultFallback = createSimpleExpression(`undefined`, false); 16259 const trackSlotScopes = (node, context) => { 16260 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 16261 const vSlot = findDir(node, "slot"); 16262 if (vSlot) { 16263 vSlot.exp; 16264 context.scopes.vSlot++; 16265 return () => { 16266 context.scopes.vSlot--; 16267 }; 16268 } 16269 } 16270 }; 16271 const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 16272 props, 16273 children, 16274 false, 16275 true, 16276 children.length ? children[0].loc : loc 16277 ); 16278 function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 16279 context.helper(WITH_CTX); 16280 const { children, loc } = node; 16281 const slotsProperties = []; 16282 const dynamicSlots = []; 16283 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 16284 const onComponentSlot = findDir(node, "slot", true); 16285 if (onComponentSlot) { 16286 const { arg, exp } = onComponentSlot; 16287 if (arg && !isStaticExp(arg)) { 16288 hasDynamicSlots = true; 16289 } 16290 slotsProperties.push( 16291 createObjectProperty( 16292 arg || createSimpleExpression("default", true), 16293 buildSlotFn(exp, void 0, children, loc) 16294 ) 16295 ); 16296 } 16297 let hasTemplateSlots = false; 16298 let hasNamedDefaultSlot = false; 16299 const implicitDefaultChildren = []; 16300 const seenSlotNames = /* @__PURE__ */ new Set(); 16301 let conditionalBranchIndex = 0; 16302 for (let i = 0; i < children.length; i++) { 16303 const slotElement = children[i]; 16304 let slotDir; 16305 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 16306 if (slotElement.type !== 3) { 16307 implicitDefaultChildren.push(slotElement); 16308 } 16309 continue; 16310 } 16311 if (onComponentSlot) { 16312 context.onError( 16313 createCompilerError(37, slotDir.loc) 16314 ); 16315 break; 16316 } 16317 hasTemplateSlots = true; 16318 const { children: slotChildren, loc: slotLoc } = slotElement; 16319 const { 16320 arg: slotName = createSimpleExpression(`default`, true), 16321 exp: slotProps, 16322 loc: dirLoc 16323 } = slotDir; 16324 let staticSlotName; 16325 if (isStaticExp(slotName)) { 16326 staticSlotName = slotName ? slotName.content : `default`; 16327 } else { 16328 hasDynamicSlots = true; 16329 } 16330 const vFor = findDir(slotElement, "for"); 16331 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 16332 let vIf; 16333 let vElse; 16334 if (vIf = findDir(slotElement, "if")) { 16335 hasDynamicSlots = true; 16336 dynamicSlots.push( 16337 createConditionalExpression( 16338 vIf.exp, 16339 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 16340 defaultFallback 16341 ) 16342 ); 16343 } else if (vElse = findDir( 16344 slotElement, 16345 /^else(?:-if)?$/, 16346 true 16347 /* allowEmpty */ 16348 )) { 16349 let j = i; 16350 let prev; 16351 while (j--) { 16352 prev = children[j]; 16353 if (!isCommentOrWhitespace(prev)) { 16354 break; 16355 } 16356 } 16357 if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) { 16358 let conditional = dynamicSlots[dynamicSlots.length - 1]; 16359 while (conditional.alternate.type === 19) { 16360 conditional = conditional.alternate; 16361 } 16362 conditional.alternate = vElse.exp ? createConditionalExpression( 16363 vElse.exp, 16364 buildDynamicSlot( 16365 slotName, 16366 slotFunction, 16367 conditionalBranchIndex++ 16368 ), 16369 defaultFallback 16370 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 16371 } else { 16372 context.onError( 16373 createCompilerError(30, vElse.loc) 16374 ); 16375 } 16376 } else if (vFor) { 16377 hasDynamicSlots = true; 16378 const parseResult = vFor.forParseResult; 16379 if (parseResult) { 16380 finalizeForParseResult(parseResult, context); 16381 dynamicSlots.push( 16382 createCallExpression(context.helper(RENDER_LIST), [ 16383 parseResult.source, 16384 createFunctionExpression( 16385 createForLoopParams(parseResult), 16386 buildDynamicSlot(slotName, slotFunction), 16387 true 16388 ) 16389 ]) 16390 ); 16391 } else { 16392 context.onError( 16393 createCompilerError( 16394 32, 16395 vFor.loc 16396 ) 16397 ); 16398 } 16399 } else { 16400 if (staticSlotName) { 16401 if (seenSlotNames.has(staticSlotName)) { 16402 context.onError( 16403 createCompilerError( 16404 38, 16405 dirLoc 16406 ) 16407 ); 16408 continue; 16409 } 16410 seenSlotNames.add(staticSlotName); 16411 if (staticSlotName === "default") { 16412 hasNamedDefaultSlot = true; 16413 } 16414 } 16415 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 16416 } 16417 } 16418 if (!onComponentSlot) { 16419 const buildDefaultSlotProperty = (props, children2) => { 16420 const fn = buildSlotFn(props, void 0, children2, loc); 16421 return createObjectProperty(`default`, fn); 16422 }; 16423 if (!hasTemplateSlots) { 16424 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 16425 } else if (implicitDefaultChildren.length && // #3766 16426 // with whitespace: 'preserve', whitespaces between slots will end up in 16427 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 16428 !implicitDefaultChildren.every(isWhitespaceText)) { 16429 if (hasNamedDefaultSlot) { 16430 context.onError( 16431 createCompilerError( 16432 39, 16433 implicitDefaultChildren[0].loc 16434 ) 16435 ); 16436 } else { 16437 slotsProperties.push( 16438 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 16439 ); 16440 } 16441 } 16442 } 16443 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 16444 let slots = createObjectExpression( 16445 slotsProperties.concat( 16446 createObjectProperty( 16447 `_`, 16448 // 2 = compiled but dynamic = can skip normalization, but must run diff 16449 // 1 = compiled and static = can skip normalization AND diff as optimized 16450 createSimpleExpression( 16451 slotFlag + (` /* ${slotFlagsText[slotFlag]} */`), 16452 false 16453 ) 16454 ) 16455 ), 16456 loc 16457 ); 16458 if (dynamicSlots.length) { 16459 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 16460 slots, 16461 createArrayExpression(dynamicSlots) 16462 ]); 16463 } 16464 return { 16465 slots, 16466 hasDynamicSlots 16467 }; 16468 } 16469 function buildDynamicSlot(name, fn, index) { 16470 const props = [ 16471 createObjectProperty(`name`, name), 16472 createObjectProperty(`fn`, fn) 16473 ]; 16474 if (index != null) { 16475 props.push( 16476 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 16477 ); 16478 } 16479 return createObjectExpression(props); 16480 } 16481 function hasForwardedSlots(children) { 16482 for (let i = 0; i < children.length; i++) { 16483 const child = children[i]; 16484 switch (child.type) { 16485 case 1: 16486 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 16487 return true; 16488 } 16489 break; 16490 case 9: 16491 if (hasForwardedSlots(child.branches)) return true; 16492 break; 16493 case 10: 16494 case 11: 16495 if (hasForwardedSlots(child.children)) return true; 16496 break; 16497 } 16498 } 16499 return false; 16500 } 16501 16502 const directiveImportMap = /* @__PURE__ */ new WeakMap(); 16503 const transformElement = (node, context) => { 16504 return function postTransformElement() { 16505 node = context.currentNode; 16506 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 16507 return; 16508 } 16509 const { tag, props } = node; 16510 const isComponent = node.tagType === 1; 16511 let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`; 16512 const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 16513 let vnodeProps; 16514 let vnodeChildren; 16515 let patchFlag = 0; 16516 let vnodeDynamicProps; 16517 let dynamicPropNames; 16518 let vnodeDirectives; 16519 let shouldUseBlock = ( 16520 // dynamic component may resolve to plain elements 16521 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block 16522 // updates inside get proper isSVG flag at runtime. (#639, #643) 16523 // This is technically web-specific, but splitting the logic out of core 16524 // leads to too much unnecessary complexity. 16525 (tag === "svg" || tag === "foreignObject" || tag === "math") 16526 ); 16527 if (props.length > 0) { 16528 const propsBuildResult = buildProps( 16529 node, 16530 context, 16531 void 0, 16532 isComponent, 16533 isDynamicComponent 16534 ); 16535 vnodeProps = propsBuildResult.props; 16536 patchFlag = propsBuildResult.patchFlag; 16537 dynamicPropNames = propsBuildResult.dynamicPropNames; 16538 const directives = propsBuildResult.directives; 16539 vnodeDirectives = directives && directives.length ? createArrayExpression( 16540 directives.map((dir) => buildDirectiveArgs(dir, context)) 16541 ) : void 0; 16542 if (propsBuildResult.shouldUseBlock) { 16543 shouldUseBlock = true; 16544 } 16545 } 16546 if (node.children.length > 0) { 16547 if (vnodeTag === KEEP_ALIVE) { 16548 shouldUseBlock = true; 16549 patchFlag |= 1024; 16550 if (node.children.length > 1) { 16551 context.onError( 16552 createCompilerError(46, { 16553 start: node.children[0].loc.start, 16554 end: node.children[node.children.length - 1].loc.end, 16555 source: "" 16556 }) 16557 ); 16558 } 16559 } 16560 const shouldBuildAsSlots = isComponent && // Teleport is not a real component and has dedicated runtime handling 16561 vnodeTag !== TELEPORT && // explained above. 16562 vnodeTag !== KEEP_ALIVE; 16563 if (shouldBuildAsSlots) { 16564 const { slots, hasDynamicSlots } = buildSlots(node, context); 16565 vnodeChildren = slots; 16566 if (hasDynamicSlots) { 16567 patchFlag |= 1024; 16568 } 16569 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 16570 const child = node.children[0]; 16571 const type = child.type; 16572 const hasDynamicTextChild = type === 5 || type === 8; 16573 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 16574 patchFlag |= 1; 16575 } 16576 if (hasDynamicTextChild || type === 2) { 16577 vnodeChildren = child; 16578 } else { 16579 vnodeChildren = node.children; 16580 } 16581 } else { 16582 vnodeChildren = node.children; 16583 } 16584 } 16585 if (dynamicPropNames && dynamicPropNames.length) { 16586 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 16587 } 16588 node.codegenNode = createVNodeCall( 16589 context, 16590 vnodeTag, 16591 vnodeProps, 16592 vnodeChildren, 16593 patchFlag === 0 ? void 0 : patchFlag, 16594 vnodeDynamicProps, 16595 vnodeDirectives, 16596 !!shouldUseBlock, 16597 false, 16598 isComponent, 16599 node.loc 16600 ); 16601 }; 16602 }; 16603 function resolveComponentType(node, context, ssr = false) { 16604 let { tag } = node; 16605 const isExplicitDynamic = isComponentTag(tag); 16606 const isProp = findProp( 16607 node, 16608 "is", 16609 false, 16610 true 16611 /* allow empty */ 16612 ); 16613 if (isProp) { 16614 if (isExplicitDynamic || false) { 16615 let exp; 16616 if (isProp.type === 6) { 16617 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 16618 } else { 16619 exp = isProp.exp; 16620 if (!exp) { 16621 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 16622 } 16623 } 16624 if (exp) { 16625 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 16626 exp 16627 ]); 16628 } 16629 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 16630 tag = isProp.value.content.slice(4); 16631 } 16632 } 16633 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 16634 if (builtIn) { 16635 if (!ssr) context.helper(builtIn); 16636 return builtIn; 16637 } 16638 context.helper(RESOLVE_COMPONENT); 16639 context.components.add(tag); 16640 return toValidAssetId(tag, `component`); 16641 } 16642 function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) { 16643 const { tag, loc: elementLoc, children } = node; 16644 let properties = []; 16645 const mergeArgs = []; 16646 const runtimeDirectives = []; 16647 const hasChildren = children.length > 0; 16648 let shouldUseBlock = false; 16649 let patchFlag = 0; 16650 let hasRef = false; 16651 let hasClassBinding = false; 16652 let hasStyleBinding = false; 16653 let hasHydrationEventBinding = false; 16654 let hasDynamicKeys = false; 16655 let hasVnodeHook = false; 16656 const dynamicPropNames = []; 16657 const pushMergeArg = (arg) => { 16658 if (properties.length) { 16659 mergeArgs.push( 16660 createObjectExpression(dedupeProperties(properties), elementLoc) 16661 ); 16662 properties = []; 16663 } 16664 if (arg) mergeArgs.push(arg); 16665 }; 16666 const pushRefVForMarker = () => { 16667 if (context.scopes.vFor > 0) { 16668 properties.push( 16669 createObjectProperty( 16670 createSimpleExpression("ref_for", true), 16671 createSimpleExpression("true") 16672 ) 16673 ); 16674 } 16675 }; 16676 const analyzePatchFlag = ({ key, value }) => { 16677 if (isStaticExp(key)) { 16678 const name = key.content; 16679 const isEventHandler = isOn(name); 16680 if (isEventHandler && (!isComponent || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 16681 // dedicated fast path. 16682 name.toLowerCase() !== "onclick" && // omit v-model handlers 16683 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 16684 !isReservedProp(name)) { 16685 hasHydrationEventBinding = true; 16686 } 16687 if (isEventHandler && isReservedProp(name)) { 16688 hasVnodeHook = true; 16689 } 16690 if (isEventHandler && value.type === 14) { 16691 value = value.arguments[0]; 16692 } 16693 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 16694 return; 16695 } 16696 if (name === "ref") { 16697 hasRef = true; 16698 } else if (name === "class") { 16699 hasClassBinding = true; 16700 } else if (name === "style") { 16701 hasStyleBinding = true; 16702 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 16703 dynamicPropNames.push(name); 16704 } 16705 if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 16706 dynamicPropNames.push(name); 16707 } 16708 } else { 16709 hasDynamicKeys = true; 16710 } 16711 }; 16712 for (let i = 0; i < props.length; i++) { 16713 const prop = props[i]; 16714 if (prop.type === 6) { 16715 const { loc, name, nameLoc, value } = prop; 16716 let isStatic = true; 16717 if (name === "ref") { 16718 hasRef = true; 16719 pushRefVForMarker(); 16720 } 16721 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || false)) { 16722 continue; 16723 } 16724 properties.push( 16725 createObjectProperty( 16726 createSimpleExpression(name, true, nameLoc), 16727 createSimpleExpression( 16728 value ? value.content : "", 16729 isStatic, 16730 value ? value.loc : loc 16731 ) 16732 ) 16733 ); 16734 } else { 16735 const { name, arg, exp, loc, modifiers } = prop; 16736 const isVBind = name === "bind"; 16737 const isVOn = name === "on"; 16738 if (name === "slot") { 16739 if (!isComponent) { 16740 context.onError( 16741 createCompilerError(40, loc) 16742 ); 16743 } 16744 continue; 16745 } 16746 if (name === "once" || name === "memo") { 16747 continue; 16748 } 16749 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || false)) { 16750 continue; 16751 } 16752 if (isVOn && ssr) { 16753 continue; 16754 } 16755 if ( 16756 // #938: elements with dynamic keys should be forced into blocks 16757 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 16758 // before children 16759 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 16760 ) { 16761 shouldUseBlock = true; 16762 } 16763 if (isVBind && isStaticArgOf(arg, "ref")) { 16764 pushRefVForMarker(); 16765 } 16766 if (!arg && (isVBind || isVOn)) { 16767 hasDynamicKeys = true; 16768 if (exp) { 16769 if (isVBind) { 16770 pushRefVForMarker(); 16771 pushMergeArg(); 16772 mergeArgs.push(exp); 16773 } else { 16774 pushMergeArg({ 16775 type: 14, 16776 loc, 16777 callee: context.helper(TO_HANDLERS), 16778 arguments: isComponent ? [exp] : [exp, `true`] 16779 }); 16780 } 16781 } else { 16782 context.onError( 16783 createCompilerError( 16784 isVBind ? 34 : 35, 16785 loc 16786 ) 16787 ); 16788 } 16789 continue; 16790 } 16791 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 16792 patchFlag |= 32; 16793 } 16794 const directiveTransform = context.directiveTransforms[name]; 16795 if (directiveTransform) { 16796 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 16797 !ssr && props2.forEach(analyzePatchFlag); 16798 if (isVOn && arg && !isStaticExp(arg)) { 16799 pushMergeArg(createObjectExpression(props2, elementLoc)); 16800 } else { 16801 properties.push(...props2); 16802 } 16803 if (needRuntime) { 16804 runtimeDirectives.push(prop); 16805 if (isSymbol(needRuntime)) { 16806 directiveImportMap.set(prop, needRuntime); 16807 } 16808 } 16809 } else if (!isBuiltInDirective(name)) { 16810 runtimeDirectives.push(prop); 16811 if (hasChildren) { 16812 shouldUseBlock = true; 16813 } 16814 } 16815 } 16816 } 16817 let propsExpression = void 0; 16818 if (mergeArgs.length) { 16819 pushMergeArg(); 16820 if (mergeArgs.length > 1) { 16821 propsExpression = createCallExpression( 16822 context.helper(MERGE_PROPS), 16823 mergeArgs, 16824 elementLoc 16825 ); 16826 } else { 16827 propsExpression = mergeArgs[0]; 16828 } 16829 } else if (properties.length) { 16830 propsExpression = createObjectExpression( 16831 dedupeProperties(properties), 16832 elementLoc 16833 ); 16834 } 16835 if (hasDynamicKeys) { 16836 patchFlag |= 16; 16837 } else { 16838 if (hasClassBinding && !isComponent) { 16839 patchFlag |= 2; 16840 } 16841 if (hasStyleBinding && !isComponent) { 16842 patchFlag |= 4; 16843 } 16844 if (dynamicPropNames.length) { 16845 patchFlag |= 8; 16846 } 16847 if (hasHydrationEventBinding) { 16848 patchFlag |= 32; 16849 } 16850 } 16851 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 16852 patchFlag |= 512; 16853 } 16854 if (!context.inSSR && propsExpression) { 16855 switch (propsExpression.type) { 16856 case 15: 16857 let classKeyIndex = -1; 16858 let styleKeyIndex = -1; 16859 let hasDynamicKey = false; 16860 for (let i = 0; i < propsExpression.properties.length; i++) { 16861 const key = propsExpression.properties[i].key; 16862 if (isStaticExp(key)) { 16863 if (key.content === "class") { 16864 classKeyIndex = i; 16865 } else if (key.content === "style") { 16866 styleKeyIndex = i; 16867 } 16868 } else if (!key.isHandlerKey) { 16869 hasDynamicKey = true; 16870 } 16871 } 16872 const classProp = propsExpression.properties[classKeyIndex]; 16873 const styleProp = propsExpression.properties[styleKeyIndex]; 16874 if (!hasDynamicKey) { 16875 if (classProp && !isStaticExp(classProp.value)) { 16876 classProp.value = createCallExpression( 16877 context.helper(NORMALIZE_CLASS), 16878 [classProp.value] 16879 ); 16880 } 16881 if (styleProp && // the static style is compiled into an object, 16882 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 16883 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 16884 // v-bind:style with static literal object 16885 styleProp.value.type === 17)) { 16886 styleProp.value = createCallExpression( 16887 context.helper(NORMALIZE_STYLE), 16888 [styleProp.value] 16889 ); 16890 } 16891 } else { 16892 propsExpression = createCallExpression( 16893 context.helper(NORMALIZE_PROPS), 16894 [propsExpression] 16895 ); 16896 } 16897 break; 16898 case 14: 16899 break; 16900 default: 16901 propsExpression = createCallExpression( 16902 context.helper(NORMALIZE_PROPS), 16903 [ 16904 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 16905 propsExpression 16906 ]) 16907 ] 16908 ); 16909 break; 16910 } 16911 } 16912 return { 16913 props: propsExpression, 16914 directives: runtimeDirectives, 16915 patchFlag, 16916 dynamicPropNames, 16917 shouldUseBlock 16918 }; 16919 } 16920 function dedupeProperties(properties) { 16921 const knownProps = /* @__PURE__ */ new Map(); 16922 const deduped = []; 16923 for (let i = 0; i < properties.length; i++) { 16924 const prop = properties[i]; 16925 if (prop.key.type === 8 || !prop.key.isStatic) { 16926 deduped.push(prop); 16927 continue; 16928 } 16929 const name = prop.key.content; 16930 const existing = knownProps.get(name); 16931 if (existing) { 16932 if (name === "style" || name === "class" || isOn(name)) { 16933 mergeAsArray(existing, prop); 16934 } 16935 } else { 16936 knownProps.set(name, prop); 16937 deduped.push(prop); 16938 } 16939 } 16940 return deduped; 16941 } 16942 function mergeAsArray(existing, incoming) { 16943 if (existing.value.type === 17) { 16944 existing.value.elements.push(incoming.value); 16945 } else { 16946 existing.value = createArrayExpression( 16947 [existing.value, incoming.value], 16948 existing.loc 16949 ); 16950 } 16951 } 16952 function buildDirectiveArgs(dir, context) { 16953 const dirArgs = []; 16954 const runtime = directiveImportMap.get(dir); 16955 if (runtime) { 16956 dirArgs.push(context.helperString(runtime)); 16957 } else { 16958 { 16959 context.helper(RESOLVE_DIRECTIVE); 16960 context.directives.add(dir.name); 16961 dirArgs.push(toValidAssetId(dir.name, `directive`)); 16962 } 16963 } 16964 const { loc } = dir; 16965 if (dir.exp) dirArgs.push(dir.exp); 16966 if (dir.arg) { 16967 if (!dir.exp) { 16968 dirArgs.push(`void 0`); 16969 } 16970 dirArgs.push(dir.arg); 16971 } 16972 if (Object.keys(dir.modifiers).length) { 16973 if (!dir.arg) { 16974 if (!dir.exp) { 16975 dirArgs.push(`void 0`); 16976 } 16977 dirArgs.push(`void 0`); 16978 } 16979 const trueExpression = createSimpleExpression(`true`, false, loc); 16980 dirArgs.push( 16981 createObjectExpression( 16982 dir.modifiers.map( 16983 (modifier) => createObjectProperty(modifier, trueExpression) 16984 ), 16985 loc 16986 ) 16987 ); 16988 } 16989 return createArrayExpression(dirArgs, dir.loc); 16990 } 16991 function stringifyDynamicPropNames(props) { 16992 let propsNamesString = `[`; 16993 for (let i = 0, l = props.length; i < l; i++) { 16994 propsNamesString += JSON.stringify(props[i]); 16995 if (i < l - 1) propsNamesString += ", "; 16996 } 16997 return propsNamesString + `]`; 16998 } 16999 function isComponentTag(tag) { 17000 return tag === "component" || tag === "Component"; 17001 } 17002 17003 const transformSlotOutlet = (node, context) => { 17004 if (isSlotOutlet(node)) { 17005 const { children, loc } = node; 17006 const { slotName, slotProps } = processSlotOutlet(node, context); 17007 const slotArgs = [ 17008 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 17009 slotName, 17010 "{}", 17011 "undefined", 17012 "true" 17013 ]; 17014 let expectedLen = 2; 17015 if (slotProps) { 17016 slotArgs[2] = slotProps; 17017 expectedLen = 3; 17018 } 17019 if (children.length) { 17020 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 17021 expectedLen = 4; 17022 } 17023 if (context.scopeId && !context.slotted) { 17024 expectedLen = 5; 17025 } 17026 slotArgs.splice(expectedLen); 17027 node.codegenNode = createCallExpression( 17028 context.helper(RENDER_SLOT), 17029 slotArgs, 17030 loc 17031 ); 17032 } 17033 }; 17034 function processSlotOutlet(node, context) { 17035 let slotName = `"default"`; 17036 let slotProps = void 0; 17037 const nonNameProps = []; 17038 for (let i = 0; i < node.props.length; i++) { 17039 const p = node.props[i]; 17040 if (p.type === 6) { 17041 if (p.value) { 17042 if (p.name === "name") { 17043 slotName = JSON.stringify(p.value.content); 17044 } else { 17045 p.name = camelize(p.name); 17046 nonNameProps.push(p); 17047 } 17048 } 17049 } else { 17050 if (p.name === "bind" && isStaticArgOf(p.arg, "name")) { 17051 if (p.exp) { 17052 slotName = p.exp; 17053 } else if (p.arg && p.arg.type === 4) { 17054 const name = camelize(p.arg.content); 17055 slotName = p.exp = createSimpleExpression(name, false, p.arg.loc); 17056 } 17057 } else { 17058 if (p.name === "bind" && p.arg && isStaticExp(p.arg)) { 17059 p.arg.content = camelize(p.arg.content); 17060 } 17061 nonNameProps.push(p); 17062 } 17063 } 17064 } 17065 if (nonNameProps.length > 0) { 17066 const { props, directives } = buildProps( 17067 node, 17068 context, 17069 nonNameProps, 17070 false, 17071 false 17072 ); 17073 slotProps = props; 17074 if (directives.length) { 17075 context.onError( 17076 createCompilerError( 17077 36, 17078 directives[0].loc 17079 ) 17080 ); 17081 } 17082 } 17083 return { 17084 slotName, 17085 slotProps 17086 }; 17087 } 17088 17089 const transformOn$1 = (dir, node, context, augmentor) => { 17090 const { loc, modifiers, arg } = dir; 17091 if (!dir.exp && !modifiers.length) { 17092 context.onError(createCompilerError(35, loc)); 17093 } 17094 let eventName; 17095 if (arg.type === 4) { 17096 if (arg.isStatic) { 17097 let rawName = arg.content; 17098 if (rawName.startsWith("vnode")) { 17099 context.onError(createCompilerError(51, arg.loc)); 17100 } 17101 if (rawName.startsWith("vue:")) { 17102 rawName = `vnode-${rawName.slice(4)}`; 17103 } 17104 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 17105 // for non-element and vnode lifecycle event listeners, auto convert 17106 // it to camelCase. See issue #2249 17107 toHandlerKey(camelize(rawName)) 17108 ) : ( 17109 // preserve case for plain element listeners that have uppercase 17110 // letters, as these may be custom elements' custom events 17111 `on:${rawName}` 17112 ); 17113 eventName = createSimpleExpression(eventString, true, arg.loc); 17114 } else { 17115 eventName = createCompoundExpression([ 17116 `${context.helperString(TO_HANDLER_KEY)}(`, 17117 arg, 17118 `)` 17119 ]); 17120 } 17121 } else { 17122 eventName = arg; 17123 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 17124 eventName.children.push(`)`); 17125 } 17126 let exp = dir.exp; 17127 if (exp && !exp.content.trim()) { 17128 exp = void 0; 17129 } 17130 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 17131 if (exp) { 17132 const isMemberExp = isMemberExpression(exp); 17133 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 17134 const hasMultipleStatements = exp.content.includes(`;`); 17135 { 17136 validateBrowserExpression( 17137 exp, 17138 context, 17139 false, 17140 hasMultipleStatements 17141 ); 17142 } 17143 if (isInlineStatement || shouldCache && isMemberExp) { 17144 exp = createCompoundExpression([ 17145 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 17146 exp, 17147 hasMultipleStatements ? `}` : `)` 17148 ]); 17149 } 17150 } 17151 let ret = { 17152 props: [ 17153 createObjectProperty( 17154 eventName, 17155 exp || createSimpleExpression(`() => {}`, false, loc) 17156 ) 17157 ] 17158 }; 17159 if (augmentor) { 17160 ret = augmentor(ret); 17161 } 17162 if (shouldCache) { 17163 ret.props[0].value = context.cache(ret.props[0].value); 17164 } 17165 ret.props.forEach((p) => p.key.isHandlerKey = true); 17166 return ret; 17167 }; 17168 17169 const transformBind = (dir, _node, context) => { 17170 const { modifiers, loc } = dir; 17171 const arg = dir.arg; 17172 let { exp } = dir; 17173 if (exp && exp.type === 4 && !exp.content.trim()) { 17174 { 17175 exp = void 0; 17176 } 17177 } 17178 if (arg.type !== 4) { 17179 arg.children.unshift(`(`); 17180 arg.children.push(`) || ""`); 17181 } else if (!arg.isStatic) { 17182 arg.content = arg.content ? `${arg.content} || ""` : `""`; 17183 } 17184 if (modifiers.some((mod) => mod.content === "camel")) { 17185 if (arg.type === 4) { 17186 if (arg.isStatic) { 17187 arg.content = camelize(arg.content); 17188 } else { 17189 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 17190 } 17191 } else { 17192 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 17193 arg.children.push(`)`); 17194 } 17195 } 17196 if (!context.inSSR) { 17197 if (modifiers.some((mod) => mod.content === "prop")) { 17198 injectPrefix(arg, "."); 17199 } 17200 if (modifiers.some((mod) => mod.content === "attr")) { 17201 injectPrefix(arg, "^"); 17202 } 17203 } 17204 return { 17205 props: [createObjectProperty(arg, exp)] 17206 }; 17207 }; 17208 const injectPrefix = (arg, prefix) => { 17209 if (arg.type === 4) { 17210 if (arg.isStatic) { 17211 arg.content = prefix + arg.content; 17212 } else { 17213 arg.content = `\`${prefix}\${${arg.content}}\``; 17214 } 17215 } else { 17216 arg.children.unshift(`'${prefix}' + (`); 17217 arg.children.push(`)`); 17218 } 17219 }; 17220 17221 const transformText = (node, context) => { 17222 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 17223 return () => { 17224 const children = node.children; 17225 let currentContainer = void 0; 17226 let hasText = false; 17227 for (let i = 0; i < children.length; i++) { 17228 const child = children[i]; 17229 if (isText$1(child)) { 17230 hasText = true; 17231 for (let j = i + 1; j < children.length; j++) { 17232 const next = children[j]; 17233 if (isText$1(next)) { 17234 if (!currentContainer) { 17235 currentContainer = children[i] = createCompoundExpression( 17236 [child], 17237 child.loc 17238 ); 17239 } 17240 currentContainer.children.push(` + `, next); 17241 children.splice(j, 1); 17242 j--; 17243 } else { 17244 currentContainer = void 0; 17245 break; 17246 } 17247 } 17248 } 17249 } 17250 if (!hasText || // if this is a plain element with a single text child, leave it 17251 // as-is since the runtime has dedicated fast path for this by directly 17252 // setting textContent of the element. 17253 // for component root it's always normalized anyway. 17254 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 17255 // custom directives can potentially add DOM elements arbitrarily, 17256 // we need to avoid setting textContent of the element at runtime 17257 // to avoid accidentally overwriting the DOM elements added 17258 // by the user through custom directives. 17259 !node.props.find( 17260 (p) => p.type === 7 && !context.directiveTransforms[p.name] 17261 ) && // in compat mode, <template> tags with no special directives 17262 // will be rendered as a fragment so its children must be 17263 // converted into vnodes. 17264 true)) { 17265 return; 17266 } 17267 for (let i = 0; i < children.length; i++) { 17268 const child = children[i]; 17269 if (isText$1(child) || child.type === 8) { 17270 const callArgs = []; 17271 if (child.type !== 2 || child.content !== " ") { 17272 callArgs.push(child); 17273 } 17274 if (!context.ssr && getConstantType(child, context) === 0) { 17275 callArgs.push( 17276 1 + (` /* ${PatchFlagNames[1]} */`) 17277 ); 17278 } 17279 children[i] = { 17280 type: 12, 17281 content: child, 17282 loc: child.loc, 17283 codegenNode: createCallExpression( 17284 context.helper(CREATE_TEXT), 17285 callArgs 17286 ) 17287 }; 17288 } 17289 } 17290 }; 17291 } 17292 }; 17293 17294 const seen$1 = /* @__PURE__ */ new WeakSet(); 17295 const transformOnce = (node, context) => { 17296 if (node.type === 1 && findDir(node, "once", true)) { 17297 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 17298 return; 17299 } 17300 seen$1.add(node); 17301 context.inVOnce = true; 17302 context.helper(SET_BLOCK_TRACKING); 17303 return () => { 17304 context.inVOnce = false; 17305 const cur = context.currentNode; 17306 if (cur.codegenNode) { 17307 cur.codegenNode = context.cache( 17308 cur.codegenNode, 17309 true, 17310 true 17311 ); 17312 } 17313 }; 17314 } 17315 }; 17316 17317 const transformModel$1 = (dir, node, context) => { 17318 const { exp, arg } = dir; 17319 if (!exp) { 17320 context.onError( 17321 createCompilerError(41, dir.loc) 17322 ); 17323 return createTransformProps(); 17324 } 17325 const rawExp = exp.loc.source.trim(); 17326 const expString = exp.type === 4 ? exp.content : rawExp; 17327 const bindingType = context.bindingMetadata[rawExp]; 17328 if (bindingType === "props" || bindingType === "props-aliased") { 17329 context.onError(createCompilerError(44, exp.loc)); 17330 return createTransformProps(); 17331 } 17332 if (!expString.trim() || !isMemberExpression(exp) && true) { 17333 context.onError( 17334 createCompilerError(42, exp.loc) 17335 ); 17336 return createTransformProps(); 17337 } 17338 const propName = arg ? arg : createSimpleExpression("modelValue", true); 17339 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 17340 let assignmentExp; 17341 const eventArg = context.isTS ? `($event: any)` : `$event`; 17342 { 17343 assignmentExp = createCompoundExpression([ 17344 `${eventArg} => ((`, 17345 exp, 17346 `) = $event)` 17347 ]); 17348 } 17349 const props = [ 17350 // modelValue: foo 17351 createObjectProperty(propName, dir.exp), 17352 // "onUpdate:modelValue": $event => (foo = $event) 17353 createObjectProperty(eventName, assignmentExp) 17354 ]; 17355 if (dir.modifiers.length && node.tagType === 1) { 17356 const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `); 17357 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 17358 props.push( 17359 createObjectProperty( 17360 modifiersKey, 17361 createSimpleExpression( 17362 `{ ${modifiers} }`, 17363 false, 17364 dir.loc, 17365 2 17366 ) 17367 ) 17368 ); 17369 } 17370 return createTransformProps(props); 17371 }; 17372 function createTransformProps(props = []) { 17373 return { props }; 17374 } 17375 17376 const seen = /* @__PURE__ */ new WeakSet(); 17377 const transformMemo = (node, context) => { 17378 if (node.type === 1) { 17379 const dir = findDir(node, "memo"); 17380 if (!dir || seen.has(node) || context.inSSR) { 17381 return; 17382 } 17383 seen.add(node); 17384 return () => { 17385 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 17386 if (codegenNode && codegenNode.type === 13) { 17387 if (node.tagType !== 1) { 17388 convertToBlock(codegenNode, context); 17389 } 17390 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 17391 dir.exp, 17392 createFunctionExpression(void 0, codegenNode), 17393 `_cache`, 17394 String(context.cached.length) 17395 ]); 17396 context.cached.push(null); 17397 } 17398 }; 17399 } 17400 }; 17401 17402 const transformVBindShorthand = (node, context) => { 17403 if (node.type === 1) { 17404 for (const prop of node.props) { 17405 if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser 17406 prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) { 17407 const arg = prop.arg; 17408 if (arg.type !== 4 || !arg.isStatic) { 17409 context.onError( 17410 createCompilerError( 17411 52, 17412 arg.loc 17413 ) 17414 ); 17415 prop.exp = createSimpleExpression("", true, arg.loc); 17416 } else { 17417 const propName = camelize(arg.content); 17418 if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424 17419 propName[0] === "-") { 17420 prop.exp = createSimpleExpression(propName, false, arg.loc); 17421 } 17422 } 17423 } 17424 } 17425 } 17426 }; 17427 17428 function getBaseTransformPreset(prefixIdentifiers) { 17429 return [ 17430 [ 17431 transformVBindShorthand, 17432 transformOnce, 17433 transformIf, 17434 transformMemo, 17435 transformFor, 17436 ...[], 17437 ...[transformExpression], 17438 transformSlotOutlet, 17439 transformElement, 17440 trackSlotScopes, 17441 transformText 17442 ], 17443 { 17444 on: transformOn$1, 17445 bind: transformBind, 17446 model: transformModel$1 17447 } 17448 ]; 17449 } 17450 function baseCompile(source, options = {}) { 17451 const onError = options.onError || defaultOnError; 17452 const isModuleMode = options.mode === "module"; 17453 { 17454 if (options.prefixIdentifiers === true) { 17455 onError(createCompilerError(47)); 17456 } else if (isModuleMode) { 17457 onError(createCompilerError(48)); 17458 } 17459 } 17460 const prefixIdentifiers = false; 17461 if (options.cacheHandlers) { 17462 onError(createCompilerError(49)); 17463 } 17464 if (options.scopeId && !isModuleMode) { 17465 onError(createCompilerError(50)); 17466 } 17467 const resolvedOptions = extend({}, options, { 17468 prefixIdentifiers 17469 }); 17470 const ast = isString(source) ? baseParse(source, resolvedOptions) : source; 17471 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 17472 transform( 17473 ast, 17474 extend({}, resolvedOptions, { 17475 nodeTransforms: [ 17476 ...nodeTransforms, 17477 ...options.nodeTransforms || [] 17478 // user transforms 17479 ], 17480 directiveTransforms: extend( 17481 {}, 17482 directiveTransforms, 17483 options.directiveTransforms || {} 17484 // user transforms 17485 ) 17486 }) 17487 ); 17488 return generate(ast, resolvedOptions); 17489 } 17490 17491 const noopDirectiveTransform = () => ({ props: [] }); 17492 17493 const V_MODEL_RADIO = Symbol(`vModelRadio`); 17494 const V_MODEL_CHECKBOX = Symbol( 17495 `vModelCheckbox` 17496 ); 17497 const V_MODEL_TEXT = Symbol(`vModelText`); 17498 const V_MODEL_SELECT = Symbol( 17499 `vModelSelect` 17500 ); 17501 const V_MODEL_DYNAMIC = Symbol( 17502 `vModelDynamic` 17503 ); 17504 const V_ON_WITH_MODIFIERS = Symbol( 17505 `vOnModifiersGuard` 17506 ); 17507 const V_ON_WITH_KEYS = Symbol( 17508 `vOnKeysGuard` 17509 ); 17510 const V_SHOW = Symbol(`vShow`); 17511 const TRANSITION = Symbol(`Transition`); 17512 const TRANSITION_GROUP = Symbol( 17513 `TransitionGroup` 17514 ); 17515 registerRuntimeHelpers({ 17516 [V_MODEL_RADIO]: `vModelRadio`, 17517 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 17518 [V_MODEL_TEXT]: `vModelText`, 17519 [V_MODEL_SELECT]: `vModelSelect`, 17520 [V_MODEL_DYNAMIC]: `vModelDynamic`, 17521 [V_ON_WITH_MODIFIERS]: `withModifiers`, 17522 [V_ON_WITH_KEYS]: `withKeys`, 17523 [V_SHOW]: `vShow`, 17524 [TRANSITION]: `Transition`, 17525 [TRANSITION_GROUP]: `TransitionGroup` 17526 }); 17527 17528 let decoder; 17529 function decodeHtmlBrowser(raw, asAttr = false) { 17530 if (!decoder) { 17531 decoder = document.createElement("div"); 17532 } 17533 if (asAttr) { 17534 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 17535 return decoder.children[0].getAttribute("foo"); 17536 } else { 17537 decoder.innerHTML = raw; 17538 return decoder.textContent; 17539 } 17540 } 17541 17542 const parserOptions = { 17543 parseMode: "html", 17544 isVoidTag, 17545 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 17546 isPreTag: (tag) => tag === "pre", 17547 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", 17548 decodeEntities: decodeHtmlBrowser, 17549 isBuiltInComponent: (tag) => { 17550 if (tag === "Transition" || tag === "transition") { 17551 return TRANSITION; 17552 } else if (tag === "TransitionGroup" || tag === "transition-group") { 17553 return TRANSITION_GROUP; 17554 } 17555 }, 17556 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 17557 getNamespace(tag, parent, rootNamespace) { 17558 let ns = parent ? parent.ns : rootNamespace; 17559 if (parent && ns === 2) { 17560 if (parent.tag === "annotation-xml") { 17561 if (tag === "svg") { 17562 return 1; 17563 } 17564 if (parent.props.some( 17565 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 17566 )) { 17567 ns = 0; 17568 } 17569 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 17570 ns = 0; 17571 } 17572 } else if (parent && ns === 1) { 17573 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 17574 ns = 0; 17575 } 17576 } 17577 if (ns === 0) { 17578 if (tag === "svg") { 17579 return 1; 17580 } 17581 if (tag === "math") { 17582 return 2; 17583 } 17584 } 17585 return ns; 17586 } 17587 }; 17588 17589 const transformStyle = (node) => { 17590 if (node.type === 1) { 17591 node.props.forEach((p, i) => { 17592 if (p.type === 6 && p.name === "style" && p.value) { 17593 node.props[i] = { 17594 type: 7, 17595 name: `bind`, 17596 arg: createSimpleExpression(`style`, true, p.loc), 17597 exp: parseInlineCSS(p.value.content, p.loc), 17598 modifiers: [], 17599 loc: p.loc 17600 }; 17601 } 17602 }); 17603 } 17604 }; 17605 const parseInlineCSS = (cssText, loc) => { 17606 const normalized = parseStringStyle(cssText); 17607 return createSimpleExpression( 17608 JSON.stringify(normalized), 17609 false, 17610 loc, 17611 3 17612 ); 17613 }; 17614 17615 function createDOMCompilerError(code, loc) { 17616 return createCompilerError( 17617 code, 17618 loc, 17619 DOMErrorMessages 17620 ); 17621 } 17622 const DOMErrorMessages = { 17623 [53]: `v-html is missing expression.`, 17624 [54]: `v-html will override element children.`, 17625 [55]: `v-text is missing expression.`, 17626 [56]: `v-text will override element children.`, 17627 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 17628 [58]: `v-model argument is not supported on plain elements.`, 17629 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 17630 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 17631 [61]: `v-show is missing expression.`, 17632 [62]: `<Transition> expects exactly one child element or component.`, 17633 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 17634 }; 17635 17636 const transformVHtml = (dir, node, context) => { 17637 const { exp, loc } = dir; 17638 if (!exp) { 17639 context.onError( 17640 createDOMCompilerError(53, loc) 17641 ); 17642 } 17643 if (node.children.length) { 17644 context.onError( 17645 createDOMCompilerError(54, loc) 17646 ); 17647 node.children.length = 0; 17648 } 17649 return { 17650 props: [ 17651 createObjectProperty( 17652 createSimpleExpression(`innerHTML`, true, loc), 17653 exp || createSimpleExpression("", true) 17654 ) 17655 ] 17656 }; 17657 }; 17658 17659 const transformVText = (dir, node, context) => { 17660 const { exp, loc } = dir; 17661 if (!exp) { 17662 context.onError( 17663 createDOMCompilerError(55, loc) 17664 ); 17665 } 17666 if (node.children.length) { 17667 context.onError( 17668 createDOMCompilerError(56, loc) 17669 ); 17670 node.children.length = 0; 17671 } 17672 return { 17673 props: [ 17674 createObjectProperty( 17675 createSimpleExpression(`textContent`, true), 17676 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 17677 context.helperString(TO_DISPLAY_STRING), 17678 [exp], 17679 loc 17680 ) : createSimpleExpression("", true) 17681 ) 17682 ] 17683 }; 17684 }; 17685 17686 const transformModel = (dir, node, context) => { 17687 const baseResult = transformModel$1(dir, node, context); 17688 if (!baseResult.props.length || node.tagType === 1) { 17689 return baseResult; 17690 } 17691 if (dir.arg) { 17692 context.onError( 17693 createDOMCompilerError( 17694 58, 17695 dir.arg.loc 17696 ) 17697 ); 17698 } 17699 function checkDuplicatedValue() { 17700 const value = findDir(node, "bind"); 17701 if (value && isStaticArgOf(value.arg, "value")) { 17702 context.onError( 17703 createDOMCompilerError( 17704 60, 17705 value.loc 17706 ) 17707 ); 17708 } 17709 } 17710 const { tag } = node;
vendor: 4,555 bytes, lines 17711-17821
17711 const isCustomElement = context.isCustomElement(tag); 17712 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 17713 let directiveToUse = V_MODEL_TEXT; 17714 let isInvalidType = false; 17715 if (tag === "input" || isCustomElement) { 17716 const type = findProp(node, `type`); 17717 if (type) { 17718 if (type.type === 7) { 17719 directiveToUse = V_MODEL_DYNAMIC; 17720 } else if (type.value) { 17721 switch (type.value.content) { 17722 case "radio": 17723 directiveToUse = V_MODEL_RADIO; 17724 break; 17725 case "checkbox": 17726 directiveToUse = V_MODEL_CHECKBOX; 17727 break; 17728 case "file": 17729 isInvalidType = true; 17730 context.onError( 17731 createDOMCompilerError( 17732 59, 17733 dir.loc 17734 ) 17735 ); 17736 break; 17737 default: 17738 checkDuplicatedValue(); 17739 break; 17740 } 17741 } 17742 } else if (hasDynamicKeyVBind(node)) { 17743 directiveToUse = V_MODEL_DYNAMIC; 17744 } else { 17745 checkDuplicatedValue(); 17746 } 17747 } else if (tag === "select") { 17748 directiveToUse = V_MODEL_SELECT; 17749 } else { 17750 checkDuplicatedValue(); 17751 } 17752 if (!isInvalidType) { 17753 baseResult.needRuntime = context.helper(directiveToUse); 17754 } 17755 } else { 17756 context.onError( 17757 createDOMCompilerError( 17758 57, 17759 dir.loc 17760 ) 17761 ); 17762 } 17763 baseResult.props = baseResult.props.filter( 17764 (p) => !(p.key.type === 4 && p.key.content === "modelValue") 17765 ); 17766 return baseResult; 17767 }; 17768 17769 const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 17770 const isNonKeyModifier = /* @__PURE__ */ makeMap( 17771 // event propagation management 17772 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 17773 ); 17774 const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 17775 const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 17776 const resolveModifiers = (key, modifiers, context, loc) => { 17777 const keyModifiers = []; 17778 const nonKeyModifiers = []; 17779 const eventOptionModifiers = []; 17780 for (let i = 0; i < modifiers.length; i++) { 17781 const modifier = modifiers[i].content; 17782 if (isEventOptionModifier(modifier)) { 17783 eventOptionModifiers.push(modifier); 17784 } else { 17785 if (maybeKeyModifier(modifier)) { 17786 if (isStaticExp(key)) { 17787 if (isKeyboardEvent(key.content.toLowerCase())) { 17788 keyModifiers.push(modifier); 17789 } else { 17790 nonKeyModifiers.push(modifier); 17791 } 17792 } else { 17793 keyModifiers.push(modifier); 17794 nonKeyModifiers.push(modifier); 17795 } 17796 } else { 17797 if (isNonKeyModifier(modifier)) { 17798 nonKeyModifiers.push(modifier); 17799 } else { 17800 keyModifiers.push(modifier); 17801 } 17802 } 17803 } 17804 } 17805 return { 17806 keyModifiers, 17807 nonKeyModifiers, 17808 eventOptionModifiers 17809 }; 17810 }; 17811 const transformClick = (key, event) => { 17812 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 17813 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 17814 `(`, 17815 key, 17816 `) === "onClick" ? "${event}" : (`, 17817 key, 17818 `)` 17819 ]) : key; 17820 }; 17821 const transformOn = (dir, node, context) => {
vendor: 11,383 bytes, lines 17822-18146
17822 return transformOn$1(dir, node, context, (baseResult) => { 17823 const { modifiers } = dir; 17824 if (!modifiers.length) return baseResult; 17825 let { key, value: handlerExp } = baseResult.props[0]; 17826 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 17827 if (nonKeyModifiers.includes("right")) { 17828 key = transformClick(key, `onContextmenu`); 17829 } 17830 if (nonKeyModifiers.includes("middle")) { 17831 key = transformClick(key, `onMouseup`); 17832 } 17833 if (nonKeyModifiers.length) { 17834 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 17835 handlerExp, 17836 JSON.stringify(nonKeyModifiers) 17837 ]); 17838 } 17839 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 17840 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 17841 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 17842 handlerExp, 17843 JSON.stringify(keyModifiers) 17844 ]); 17845 } 17846 if (eventOptionModifiers.length) { 17847 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 17848 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 17849 } 17850 return { 17851 props: [createObjectProperty(key, handlerExp)] 17852 }; 17853 }); 17854 }; 17855 17856 const transformShow = (dir, node, context) => { 17857 const { exp, loc } = dir; 17858 if (!exp) { 17859 context.onError( 17860 createDOMCompilerError(61, loc) 17861 ); 17862 } 17863 return { 17864 props: [], 17865 needRuntime: context.helper(V_SHOW) 17866 }; 17867 }; 17868 17869 const transformTransition = (node, context) => { 17870 if (node.type === 1 && node.tagType === 1) { 17871 const component = context.isBuiltInComponent(node.tag); 17872 if (component === TRANSITION) { 17873 return () => { 17874 if (!node.children.length) { 17875 return; 17876 } 17877 if (hasMultipleChildren(node)) { 17878 context.onError( 17879 createDOMCompilerError( 17880 62, 17881 { 17882 start: node.children[0].loc.start, 17883 end: node.children[node.children.length - 1].loc.end, 17884 source: "" 17885 } 17886 ) 17887 ); 17888 } 17889 const child = node.children[0]; 17890 if (child.type === 1) { 17891 for (const p of child.props) { 17892 if (p.type === 7 && p.name === "show") { 17893 node.props.push({ 17894 type: 6, 17895 name: "persisted", 17896 nameLoc: node.loc, 17897 value: void 0, 17898 loc: node.loc 17899 }); 17900 } 17901 } 17902 } 17903 }; 17904 } 17905 } 17906 }; 17907 function hasMultipleChildren(node) { 17908 const children = node.children = node.children.filter( 17909 (c) => !isCommentOrWhitespace(c) 17910 ); 17911 const child = children[0]; 17912 return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren); 17913 } 17914 17915 const ignoreSideEffectTags = (node, context) => { 17916 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 17917 context.onError( 17918 createDOMCompilerError( 17919 63, 17920 node.loc 17921 ) 17922 ); 17923 context.removeNode(); 17924 } 17925 }; 17926 17927 function isValidHTMLNesting(parent, child) { 17928 if (parent === "template") { 17929 return true; 17930 } 17931 if (parent in onlyValidChildren) { 17932 return onlyValidChildren[parent].has(child); 17933 } 17934 if (child in onlyValidParents) { 17935 return onlyValidParents[child].has(parent); 17936 } 17937 if (parent in knownInvalidChildren) { 17938 if (knownInvalidChildren[parent].has(child)) return false; 17939 } 17940 if (child in knownInvalidParents) { 17941 if (knownInvalidParents[child].has(parent)) return false; 17942 } 17943 return true; 17944 } 17945 const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); 17946 const emptySet = /* @__PURE__ */ new Set([]); 17947 const onlyValidChildren = { 17948 head: /* @__PURE__ */ new Set([ 17949 "base", 17950 "basefront", 17951 "bgsound", 17952 "link", 17953 "meta", 17954 "title", 17955 "noscript", 17956 "noframes", 17957 "style", 17958 "script", 17959 "template" 17960 ]), 17961 optgroup: /* @__PURE__ */ new Set(["option"]), 17962 select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), 17963 // table 17964 table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), 17965 tr: /* @__PURE__ */ new Set(["td", "th"]), 17966 colgroup: /* @__PURE__ */ new Set(["col"]), 17967 tbody: /* @__PURE__ */ new Set(["tr"]), 17968 thead: /* @__PURE__ */ new Set(["tr"]), 17969 tfoot: /* @__PURE__ */ new Set(["tr"]), 17970 // these elements can not have any children elements 17971 script: emptySet, 17972 iframe: emptySet, 17973 option: emptySet, 17974 textarea: emptySet, 17975 style: emptySet, 17976 title: emptySet 17977 }; 17978 const onlyValidParents = { 17979 // sections 17980 html: emptySet, 17981 body: /* @__PURE__ */ new Set(["html"]), 17982 head: /* @__PURE__ */ new Set(["html"]), 17983 // table 17984 td: /* @__PURE__ */ new Set(["tr"]), 17985 colgroup: /* @__PURE__ */ new Set(["table"]), 17986 caption: /* @__PURE__ */ new Set(["table"]), 17987 tbody: /* @__PURE__ */ new Set(["table"]), 17988 tfoot: /* @__PURE__ */ new Set(["table"]), 17989 col: /* @__PURE__ */ new Set(["colgroup"]), 17990 th: /* @__PURE__ */ new Set(["tr"]), 17991 thead: /* @__PURE__ */ new Set(["table"]), 17992 tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), 17993 // data list 17994 dd: /* @__PURE__ */ new Set(["dl", "div"]), 17995 dt: /* @__PURE__ */ new Set(["dl", "div"]), 17996 // other 17997 figcaption: /* @__PURE__ */ new Set(["figure"]), 17998 // li: new Set(["ul", "ol"]), 17999 summary: /* @__PURE__ */ new Set(["details"]), 18000 area: /* @__PURE__ */ new Set(["map"]) 18001 }; 18002 const knownInvalidChildren = { 18003 p: /* @__PURE__ */ new Set([ 18004 "address", 18005 "article", 18006 "aside", 18007 "blockquote", 18008 "center", 18009 "details", 18010 "dialog", 18011 "dir", 18012 "div", 18013 "dl", 18014 "fieldset", 18015 "figure", 18016 "footer", 18017 "form", 18018 "h1", 18019 "h2", 18020 "h3", 18021 "h4", 18022 "h5", 18023 "h6", 18024 "header", 18025 "hgroup", 18026 "hr", 18027 "li", 18028 "main", 18029 "nav", 18030 "menu", 18031 "ol", 18032 "p", 18033 "pre", 18034 "section", 18035 "table", 18036 "ul" 18037 ]), 18038 svg: /* @__PURE__ */ new Set([ 18039 "b", 18040 "blockquote", 18041 "br", 18042 "code", 18043 "dd", 18044 "div", 18045 "dl", 18046 "dt", 18047 "em", 18048 "embed", 18049 "h1", 18050 "h2", 18051 "h3", 18052 "h4", 18053 "h5", 18054 "h6", 18055 "hr", 18056 "i", 18057 "img", 18058 "li", 18059 "menu", 18060 "meta", 18061 "ol", 18062 "p", 18063 "pre", 18064 "ruby", 18065 "s", 18066 "small", 18067 "span", 18068 "strong", 18069 "sub", 18070 "sup", 18071 "table", 18072 "u", 18073 "ul", 18074 "var" 18075 ]) 18076 }; 18077 const knownInvalidParents = { 18078 a: /* @__PURE__ */ new Set(["a"]), 18079 button: /* @__PURE__ */ new Set(["button"]), 18080 dd: /* @__PURE__ */ new Set(["dd", "dt"]), 18081 dt: /* @__PURE__ */ new Set(["dd", "dt"]), 18082 form: /* @__PURE__ */ new Set(["form"]), 18083 li: /* @__PURE__ */ new Set(["li"]), 18084 h1: headings, 18085 h2: headings, 18086 h3: headings, 18087 h4: headings, 18088 h5: headings, 18089 h6: headings 18090 }; 18091 18092 const validateHtmlNesting = (node, context) => { 18093 if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { 18094 const error = new SyntaxError( 18095 `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` 18096 ); 18097 error.loc = node.loc; 18098 context.onWarn(error); 18099 } 18100 }; 18101 18102 const DOMNodeTransforms = [ 18103 transformStyle, 18104 ...[transformTransition, validateHtmlNesting] 18105 ]; 18106 const DOMDirectiveTransforms = { 18107 cloak: noopDirectiveTransform, 18108 html: transformVHtml, 18109 text: transformVText, 18110 model: transformModel, 18111 // override compiler-core 18112 on: transformOn, 18113 // override compiler-core 18114 show: transformShow 18115 }; 18116 function compile(src, options = {}) { 18117 return baseCompile( 18118 src, 18119 extend({}, parserOptions, options, { 18120 nodeTransforms: [ 18121 // ignore <script> and <tag> 18122 // this is not put inside DOMNodeTransforms because that list is used 18123 // by compiler-ssr to generate vnode fallback branches 18124 ignoreSideEffectTags, 18125 ...DOMNodeTransforms, 18126 ...options.nodeTransforms || [] 18127 ], 18128 directiveTransforms: extend( 18129 {}, 18130 DOMDirectiveTransforms, 18131 options.directiveTransforms || {} 18132 ), 18133 transformHoist: null 18134 }) 18135 ); 18136 } 18137 18138 { 18139 initDev(); 18140 } 18141 const compileCache = /* @__PURE__ */ Object.create(null); 18142 function compileToFunction(template, options) { 18143 if (!isString(template)) { 18144 if (template.nodeType) { 18145 template = template.innerHTML; 18146 } else {
18147 warn(`invalid template option: `, template); 18148 return NOOP; 18149 } 18150 } 18151 const key = genCacheKey(template, options); 18152 const cached = compileCache[key]; 18153 if (cached) { 18154 return cached; 18155 } 18156 if (template[0] === "#") { 18157 const el = document.querySelector(template); 18158 if (!el) { 18159 warn(`Template element not found or is empty: ${template}`); 18160 } 18161 template = el ? el.innerHTML : ``; 18162 } 18163 const opts = extend( 18164 { 18165 hoistStatic: true, 18166 onError: onError, 18167 onWarn: (e) => onError(e, true) 18168 }, 18169 options 18170 ); 18171 if (!opts.isCustomElement && typeof customElements !== "undefined") { 18172 opts.isCustomElement = (tag) => !!customElements.get(tag); 18173 } 18174 const { code } = compile(template, opts); 18175 function onError(err, asWarning = false) { 18176 const message = asWarning ? err.message : `Template compilation error: ${err.message}`; 18177 const codeFrame = err.loc && generateCodeFrame( 18178 template, 18179 err.loc.start.offset, 18180 err.loc.end.offset 18181 ); 18182 warn(codeFrame ? `${message} 18183${codeFrame}` : message); 18184 } 18185 const render = new Function(code)(); 18186 render._rc = true; 18187 return compileCache[key] = render; 18188 } 18189 registerRuntimeCompiler(compileToFunction); 18190 18191 exports.BaseTransition = BaseTransition; 18192 exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators; 18193 exports.Comment = Comment; 18194 exports.DeprecationTypes = DeprecationTypes; 18195 exports.EffectScope = EffectScope; 18196 exports.ErrorCodes = ErrorCodes; 18197 exports.ErrorTypeStrings = ErrorTypeStrings; 18198 exports.Fragment = Fragment; 18199 exports.KeepAlive = KeepAlive; 18200 exports.ReactiveEffect = ReactiveEffect; 18201 exports.Static = Static; 18202 exports.Suspense = Suspense; 18203 exports.Teleport = Teleport; 18204 exports.Text = Text; 18205 exports.TrackOpTypes = TrackOpTypes; 18206 exports.Transition = Transition; 18207 exports.TransitionGroup = TransitionGroup; 18208 exports.TriggerOpTypes = TriggerOpTypes; 18209 exports.VueElement = VueElement; 18210 exports.assertNumber = assertNumber; 18211 exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling; 18212 exports.callWithErrorHandling = callWithErrorHandling; 18213 exports.camelize = camelize; 18214 exports.capitalize = capitalize; 18215 exports.cloneVNode = cloneVNode; 18216 exports.compatUtils = compatUtils; 18217 exports.compile = compileToFunction; 18218 exports.computed = computed; 18219 exports.createApp = createApp; 18220 exports.createBlock = createBlock; 18221 exports.createCommentVNode = createCommentVNode; 18222 exports.createElementBlock = createElementBlock; 18223 exports.createElementVNode = createBaseVNode; 18224 exports.createHydrationRenderer = createHydrationRenderer; 18225 exports.createPropsRestProxy = createPropsRestProxy; 18226 exports.createRenderer = createRenderer; 18227 exports.createSSRApp = createSSRApp; 18228 exports.createSlots = createSlots; 18229 exports.createStaticVNode = createStaticVNode; 18230 exports.createTextVNode = createTextVNode; 18231 exports.createVNode = createVNode; 18232 exports.customRef = customRef; 18233 exports.defineAsyncComponent = defineAsyncComponent; 18234 exports.defineComponent = defineComponent; 18235 exports.defineCustomElement = defineCustomElement; 18236 exports.defineEmits = defineEmits; 18237 exports.defineExpose = defineExpose; 18238 exports.defineModel = defineModel; 18239 exports.defineOptions = defineOptions; 18240 exports.defineProps = defineProps; 18241 exports.defineSSRCustomElement = defineSSRCustomElement; 18242 exports.defineSlots = defineSlots; 18243 exports.devtools = devtools; 18244 exports.effect = effect; 18245 exports.effectScope = effectScope; 18246 exports.getCurrentInstance = getCurrentInstance; 18247 exports.getCurrentScope = getCurrentScope; 18248 exports.getCurrentWatcher = getCurrentWatcher; 18249 exports.getTransitionRawChildren = getTransitionRawChildren; 18250 exports.guardReactiveProps = guardReactiveProps; 18251 exports.h = h; 18252 exports.handleError = handleError; 18253 exports.hasInjectionContext = hasInjectionContext; 18254 exports.hydrate = hydrate; 18255 exports.hydrateOnIdle = hydrateOnIdle; 18256 exports.hydrateOnInteraction = hydrateOnInteraction; 18257 exports.hydrateOnMediaQuery = hydrateOnMediaQuery; 18258 exports.hydrateOnVisible = hydrateOnVisible;
18259 exports.initCustomFormatter = initCustomFormatter; 18260 exports.initDirectivesForSSR = initDirectivesForSSR; 18261 exports.inject = inject; 18262 exports.isMemoSame = isMemoSame; 18263 exports.isProxy = isProxy; 18264 exports.isReactive = isReactive; 18265 exports.isReadonly = isReadonly; 18266 exports.isRef = isRef; 18267 exports.isRuntimeOnly = isRuntimeOnly; 18268 exports.isShallow = isShallow; 18269 exports.isVNode = isVNode; 18270 exports.markRaw = markRaw; 18271 exports.mergeDefaults = mergeDefaults; 18272 exports.mergeModels = mergeModels; 18273 exports.mergeProps = mergeProps; 18274 exports.nextTick = nextTick; 18275 exports.nodeOps = nodeOps; 18276 exports.normalizeClass = normalizeClass; 18277 exports.normalizeProps = normalizeProps; 18278 exports.normalizeStyle = normalizeStyle; 18279 exports.onActivated = onActivated; 18280 exports.onBeforeMount = onBeforeMount; 18281 exports.onBeforeUnmount = onBeforeUnmount; 18282 exports.onBeforeUpdate = onBeforeUpdate; 18283 exports.onDeactivated = onDeactivated; 18284 exports.onErrorCaptured = onErrorCaptured; 18285 exports.onMounted = onMounted; 18286 exports.onRenderTracked = onRenderTracked; 18287 exports.onRenderTriggered = onRenderTriggered; 18288 exports.onScopeDispose = onScopeDispose; 18289 exports.onServerPrefetch = onServerPrefetch; 18290 exports.onUnmounted = onUnmounted; 18291 exports.onUpdated = onUpdated; 18292 exports.onWatcherCleanup = onWatcherCleanup; 18293 exports.openBlock = openBlock; 18294 exports.patchProp = patchProp; 18295 exports.popScopeId = popScopeId; 18296 exports.provide = provide; 18297 exports.proxyRefs = proxyRefs; 18298 exports.pushScopeId = pushScopeId; 18299 exports.queuePostFlushCb = queuePostFlushCb; 18300 exports.reactive = reactive; 18301 exports.readonly = readonly; 18302 exports.ref = ref; 18303 exports.registerRuntimeCompiler = registerRuntimeCompiler; 18304 exports.render = render; 18305 exports.renderList = renderList; 18306 exports.renderSlot = renderSlot; 18307 exports.resolveComponent = resolveComponent; 18308 exports.resolveDirective = resolveDirective; 18309 exports.resolveDynamicComponent = resolveDynamicComponent; 18310 exports.resolveFilter = resolveFilter; 18311 exports.resolveTransitionHooks = resolveTransitionHooks; 18312 exports.setBlockTracking = setBlockTracking; 18313 exports.setDevtoolsHook = setDevtoolsHook; 18314 exports.setTransitionHooks = setTransitionHooks; 18315 exports.shallowReactive = shallowReactive; 18316 exports.shallowReadonly = shallowReadonly; 18317 exports.shallowRef = shallowRef; 18318 exports.ssrContextKey = ssrContextKey; 18319 exports.ssrUtils = ssrUtils; 18320 exports.stop = stop; 18321 exports.toDisplayString = toDisplayString; 18322 exports.toHandlerKey = toHandlerKey; 18323 exports.toHandlers = toHandlers; 18324 exports.toRaw = toRaw; 18325 exports.toRef = toRef; 18326 exports.toRefs = toRefs; 18327 exports.toValue = toValue; 18328 exports.transformVNodeArgs = transformVNodeArgs; 18329 exports.triggerRef = triggerRef; 18330 exports.unref = unref; 18331 exports.useAttrs = useAttrs; 18332 exports.useCssModule = useCssModule; 18333 exports.useCssVars = useCssVars; 18334 exports.useHost = useHost; 18335 exports.useId = useId; 18336 exports.useModel = useModel; 18337 exports.useSSRContext = useSSRContext; 18338 exports.useShadowRoot = useShadowRoot; 18339 exports.useSlots = useSlots; 18340 exports.useTemplateRef = useTemplateRef; 18341 exports.useTransitionState = useTransitionState; 18342 exports.vModelCheckbox = vModelCheckbox; 18343 exports.vModelDynamic = vModelDynamic; 18344 exports.vModelRadio = vModelRadio; 18345 exports.vModelSelect = vModelSelect; 18346 exports.vModelText = vModelText; 18347 exports.vShow = vShow; 18348 exports.version = version; 18349 exports.warn = warn; 18350 exports.watch = watch; 18351 exports.watchEffect = watchEffect; 18352 exports.watchPostEffect = watchPostEffect; 18353 exports.watchSyncEffect = watchSyncEffect; 18354 exports.withAsyncContext = withAsyncContext; 18355 exports.withCtx = withCtx; 18356 exports.withDefaults = withDefaults; 18357 exports.withDirectives = withDirectives; 18358 exports.withKeys = withKeys; 18359 exports.withMemo = withMemo; 18360 exports.withModifiers = withModifiers; 18361 exports.withScopeId = withScopeId; 18362 18363 return exports; 18364 18365})({});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.